Converting iso-4217-currencies.scm to C?
Alan Jenkins
sourcejedi.lkml at googlemail.com
Tue Feb 10 04:07:50 EST 2009
Derek Atkins wrote:
> Christian Stimming <stimming at tuhh.de> writes:
>
>
>> Right now we have a scheme -> C generator that generates a list of 3000
>> function calls. I think Alan's proposal was to change this into a generator
>> that generates a C array with 3000 entries, and writing some simple looping
>> code that loops over this array. In effect, I think this isn't much of a
>> difference (meaning Alan's time can probably be spent on more important
>> things instead), but if Alan would like to submit a patch, I'd probably agree
>> to commit this.
>>
>
> That seems relatively silly, IMHO. Why have scheme generate a
> C array? Why not just encode the list in the C array in the first
> place?
>
> I.e., I can imagine something like:
>
> typedef struct {
> const char* fullname;
> const char* unitname;
> const char* partname;
> const char* namespace;
> const char* mnemonic;
> const char* exchange_code;
> unsigned parts_per_unit;
> unsigned smallest_fraction;
> } GNCCurrencyDef;
>
> static GNCCurrencyDef gncISOCurrencies[] = {
> { "Afghanistan Afghani (old)", "afghani", "pul", "ISO4217", "AFA", "004", 100, 100 }, // through 2003-01-02
> { "Afghanistan Afghani", "afghani", "afghani", "ISO4217", "AFN", "971", 1, 1 }, // from 2002-10-07
> ...
> };
>
> Alan, is this what you had in mind?
>
Yes. I think Christian's right so I'll leave it alone. But you're
welcome to take the idea :).
Regards
Alan
More information about the gnucash-devel
mailing list