It's been rumoured that [EMAIL PROTECTED] said:
> 
> This is trivial to implement, and there are several posibilities.
> 
> 1) the curent gnucash file format is actually a byte stream.  If you
>    want ascii, it would be straightforward to cut-n-paste the FileIO.C
>    and replace all occurances of 'int i; write (fd, &i, 4);' with
>    printf ("%d\n", i);   This is almost trivial to do. Do it!


Of course, I forgot to mention:
If instead, you want to do XML, take e.g. the code
circa line 1745 of src/engine/FileIO.c, in the subroutine "writeSplit"

  damount = xaccSplitGetShareAmount (split);
  write( fd, &damount, sizeof(double) );

  damount = xaccSplitGetSharePrice (split);
  write( fd, &damount, sizeof(double) );

and replace it with:

  damount = xaccSplitGetShareAmount (split);
  printf("<gnc:amount>%f</gnc:amount>", damount);

  damount = xaccSplitGetSharePrice (split);
  printf("<gnc:price>%f</gnc:price>", damount);


Note by the way, that you've replaced 8 bytes with about 35 bytes
and so your files sizes will be 4x bigger than they are today.
gzip might help with this, at a cost of performance...


--linas

Reply via email to