OK, this is a DRAFT!! It only outlines the barest bones of the future code. 
I'm posting it now because I've got another few days of other work that will 
mean this will go quiet until the weekend.

However, it does outline how I want to provide rule definitions as templates 
and to generate those templates from existing .c struct definitions. It's 
worth getting things sorted at this stage - things like naming conventions 
and frameworks are difficult to correct later.

I won't put it all in the email - I'm v.fond of docbook and instead of wasting 
paper writing plans on paper, I compose my frameworks and notes in docbook. 
It means I can have my own documentation at my fingertips - always open in a 
nearby window. It also means that it's easy to convert into lots of formats.

http://www.codehelp.co.uk/code/index.html

The manpages for g_merge, qofbook and gncinvoice are more for my own reference 
than anything else, although I have put some comments in some files.

// The Primitives
#define GMCHAR                  1
#define GMINT                   2
#define GMFLOAT                 3
#define GMDOUBLE                4
// First level compound / customised
#define GMSTRING                10 // char*
#define GMGBOOLEAN              11
#define GMGINT                  12
#define GMGINT16                13
#define GMGINT64                14
// Second level compound - objects that can still be resolved to a single 
primitive
#define GMGNC_QUOTE_SOURCE      100
....
// Third level - objects that contain more than one primitive.
#define GMGNC_COMMODITY         1000

        Compound objects are then further defined in terms of their component 
primitives.
        Note that gnc_commodity is not complete in this example - it has been 
shortened to allow easier testing. The create_rule adds the details of each
field in the compound object to the rule set for that object. 
        
        
#define GMGNC_COMMODITY_FIELDS(x) {             \
        create_rule(x, "fullname", GMSTRING);   \
        create_rule(x, "namespace", GMSTRING);  \
        create_rule(x, "mnemonic", GMSTRING);   \
        create_rule(x, "printname", GMSTRING);  \
        create_rule(x, "exchange_code", GMSTRING); \
        create_rule(x, "fraction", GMINT);      \
        create_rule(x, "unique_name", GMSTRING);        \
        create_rule(x, "mark", GMGINT16);               \
        create_rule(x, "quote_flag", GMGBOOLEAN);       \
        create_rule(x, "quote_source", GMGNC_QUOTE_SOURCE); }

So far, a routine is working to assemble these rule sets into a workable 
structure. 

Next stage is to get the data into the same structures as the rules, then the 
comparison functions can start.


-- 

Neil Williams
=============
http://www.codehelp.co.uk/
http://www.dclug.org.uk/
http://www.isbn.org.uk/
http://sourceforge.net/projects/isbnsearch/

http://www.biglumber.com/x/web?qs=0x8801094A28BCB3E3

Attachment: pgp00000.pgp
Description: signature

_______________________________________________
gnucash-devel mailing list
[EMAIL PROTECTED]
https://lists.gnucash.org/mailman/listinfo/gnucash-devel

Reply via email to