QIF Import fails out of CVS

Derek Atkins warlord@MIT.EDU
13 Feb 2001 17:27:29 -0500


grib@gnumatic.com (Bill Gribble) writes:

> On Tue, Feb 13, 2001 at 04:35:37PM -0500, Derek Atkins wrote:
> > Converting this to scheme, step-by-step, assuming some value for num:
> > 
> > guile> (define num 12345678901234567890)
> > guile> (define mask 65535)
> > guile> (define mag (abs num))
> > guile> (logand mag mask)
> > ERROR: In procedure logand in expression (logand mag mask):
> > ERROR: Wrong type argument in position 1: 12345678901234567890
> > ABORT: (wrong-type-arg)
> 
> Good!  That means my work in fixing the gnc-helpers.c code wasn't
> wasted :)  Of course the patch I just sent answers the question "why
> were we passing such a huge number to gnc_scm_to_gint64?" 

Indeed.  The original version from CVS does not work, whereas your
most recent patch does.  Granted, the importer still has problems, but
it at least does seem to be working and actually imported a QIF file
(albeit "incorrectly" IMHO).

> The problem is that guile-1.3 logand requires fixnum args, and big
> numbers aren't fixnums.  I believe that by reducing the range with ash
> we can fix the problem, though it's not done yet (the current
> gnc-helpers.c doesn't ensure that both args are fixnums) -- by fixing
> the log10 thing that was causing the big values, gnucash will start
> working again, but the underlying scm_to_gint64 is still theoretically
> broken.

Yea.  If you'd like I can try to figure out a better approach for the
scm_to_gint64, because I agree that it wont work for large numbers..
I think we might need to do a little ash back and forth a bit.  I'll
try some stuff out and see if I can figure out a good method
(providing we can assume the number will fit in a gint64).

> > guile> (ash mag -62)
> > 2
> > 
> > I'm not sure what "ash" does precisely.  Even the C code is a bit
> > obfuscated.  

I really should have been using (ash mag -16).. But still.

> "Arithmetic Shift".  the equivalent of the C << and >> operator.

Thanks, I did figure this out eventually (with a little help from my
friends ;)

> Let me know if I was right about the log10 fixing everything..

I'm not sure where the log10 was added.  You most recent code does
actually work.

> b.g.

-derek

-- 
       Derek Atkins, SB '93 MIT EE, SM '95 MIT Media Laboratory
       Member, MIT Student Information Processing Board  (SIPB)
       URL: http://web.mit.edu/warlord/    PP-ASEL-IA     N1NWH
       warlord@MIT.EDU                        PGP key available