Removed QIFIO.c related stuff.

git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@2372 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
Dave Peticolas 2000-05-24 10:25:01 +00:00
parent 1197fe3f6d
commit 151a0a35fa
6 changed files with 3 additions and 1439 deletions

View File

@ -41,9 +41,6 @@
/** PROTOTYPES ******************************************************/ /** PROTOTYPES ******************************************************/
AccountGroup *xaccReadQIFAccountGroup (char *datafile);
int xaccGetQIFIOError (void);
/* /*
* The xaccReadAccountGroupFD() and xaccWriteAccountGroupFD() * The xaccReadAccountGroupFD() and xaccWriteAccountGroupFD()
* routines read and write the GnuCash "xacc" byte stream (file) * routines read and write the GnuCash "xacc" byte stream (file)

View File

@ -35,7 +35,7 @@ LIBS = @LIBS@ ${GLIB_LIBS}
###################################################################### ######################################################################
# See Makefile.common for information about these variables. # See Makefile.common for information about these variables.
INDEP_SRCS := AccInfo.c Account.c Backend.c DateUtils.c FileIO.c Group.c \ INDEP_SRCS := AccInfo.c Account.c Backend.c DateUtils.c FileIO.c Group.c \
LedgerUtils.c QIFIO.c Query.c Queue.c Scrub.c Session.c \ LedgerUtils.c Query.c Queue.c Scrub.c Session.c \
Transaction.c TransLog.c date.c util.c GNCId.c \ Transaction.c TransLog.c date.c util.c GNCId.c \
guid/md5.c guid/guid.c guid/md5.c guid/guid.c
###################################################################### ######################################################################

File diff suppressed because it is too large Load Diff

View File

@ -1278,6 +1278,8 @@ xaccSplitDestroy (Split *split)
int ismember = 0; int ismember = 0;
Split *s; Split *s;
if (!split) return;
trans = split->parent; trans = split->parent;
assert (trans); assert (trans);
assert (trans->splits); assert (trans->splits);

View File

@ -813,122 +813,5 @@ double xaccParseAmount (const char * instr, gncBoolean monetary)
} }
/********************************************************************\
* xaccParseQIFAmount *
* parses monetary strings in QIF files *
* *
* Args: str -- pointer to string rep of sum *
* Return: double -- the parsed amount *
*
* Note: be careful changing this algorithm. The Quicken-file-format
* parser depends a lot on the ability of this routine to do what it's
* doing. Don't break it!
\********************************************************************/
/* The following tokens are used to define the US-style monetary
* strings. With a bit of cleverness, it should be possible to modify
* these to handle various international styles ... maybe ... */
#define MINUS_SIGN '-'
#define K_SEP ',' /* thousands separator */
#define DEC_SEP '.' /* decimal point */
double xaccParseQIFAmount (const char * instr)
{
char decimal_point = DEC_SEP;
char thousands_sep = K_SEP;
char *mstr, *str, *tok;
double dollars = 0.0;
int isneg = 0;
int len;
if (!instr) return 0.0;
mstr = strdup (instr);
str = mstr;
/* strip off garbage at end of the line */
tok = strchr (str, '\r');
if (tok) *tok = 0x0;
tok = strchr (str, '\n');
if (tok) *tok = 0x0;
/* search for a minus sign */
tok = strchr (str, MINUS_SIGN);
if (tok) {
isneg = 1;
str = tok+sizeof(char);
}
/* figure out separators */
{
char *tok1, *tok2;
tok1 = strrchr(str, DEC_SEP);
tok2 = strrchr(str, K_SEP);
if (tok1 < tok2)
{
decimal_point = K_SEP;
thousands_sep = DEC_SEP;
}
}
/* remove comma's */
tok = strchr (str, thousands_sep);
while (tok) {
*tok = 0x0;
dollars *= 1000.0;
dollars += ((double) (1000 * atoi (str)));
str = tok+sizeof(char);
tok = strchr (str, thousands_sep);
}
/* search for a decimal point */
tok = strchr (str, decimal_point);
if (tok) {
*tok = 0x0;
dollars += ((double) (atoi (str)));
str = tok+sizeof(char);
/* if there is anything trailing the decimal
* point, convert it */
if (str[0]) {
/* strip off garbage at end of the line */
tok = strchr (str, ' ');
if (tok) *tok = 0x0;
/* adjust for number of decimal places */
len = strlen(str);
if (6 == len) {
dollars += 0.000001 * ((double) atoi (str));
} else
if (5 == len) {
dollars += 0.00001 * ((double) atoi (str));
} else
if (4 == len) {
dollars += 0.0001 * ((double) atoi (str));
} else
if (3 == len) {
dollars += 0.001 * ((double) atoi (str));
} else
if (2 == len) {
dollars += 0.01 * ((double) atoi (str));
} else
if (1 == len) {
dollars += 0.1 * ((double) atoi (str));
}
}
} else {
dollars += ((double) (atoi (str)));
}
if (isneg) dollars = -dollars;
free (mstr);
return dollars;
}
/************************* END OF FILE ******************************\ /************************* END OF FILE ******************************\
\********************************************************************/ \********************************************************************/

View File

@ -216,26 +216,6 @@ char * xaccPrintAmountArgs (double val,
double xaccParseAmount (const char * instr, gncBoolean monetary); double xaccParseAmount (const char * instr, gncBoolean monetary);
/********************************************************************\
* xaccParseQIFAmount *
* parses monetary strings in QIF files *
* Note that these strings may be in the 'US' format of DDD,DDD,DDD.CC
* or they may be in european format: DDD.DDD.DDD,CC
* The routine tries to 'guess' which of these it is.
* This sounds really dopey, but Intuit/Quicken managed to 'internationalize'
* their export format, causing no end of pain.
*
* XXX hack alert: the right way to do this is to do the following:
* -- have a global flag that indicates 'euro' or 'us style'
* -- initial value of global flag depends on locale
* -- if during parsing, a euro currency is found, then flag set to euro.
* -- if during parsing, a us-format amount is found, then flag set to us.
* -- if both styles found during one run, then flag an error.
* *
\********************************************************************/
double xaccParseQIFAmount (const char * str);
/** TEMPLATES ******************************************************/ /** TEMPLATES ******************************************************/
/* /*
* There are several ideas going on in here. * There are several ideas going on in here.