first draft of a merge rule set

Neil Williams linux at
Mon Apr 12 14:52:56 EDT 2004

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.

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 
// Third level - objects that contain more than one primitive.
#define GMGNC_COMMODITY		1000

	Compound objects are then further defined in terms of their component 
	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. 
	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 

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


Neil Williams
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: signature
Url :

More information about the gnucash-devel mailing list