postgres development

Derek Atkins warlord at MIT.EDU
Sun Mar 23 11:32:56 CST 2003


Andrew Pimlott <gnucash-devel at andrew.pimlott.net> writes:

> I was talking about gw-app-file-spec.scm, which is what main.scm
> mostly uses.  gw-app-file-spec.scm is not implemented on
> gw-engine-spec.scm, but rather on C code that is tied to the GUI.

Well, yes, "app-file" is gnome-specific..  But you should be able to write
a program without using app-file.

> My point was that the fact that gnucash is a scheme program is not
> evidence that the scheme API is is well-suited to writing programs
> that are independent of the GUI.

And my response is that the 'gnucash' scheme program is not
representative of the scheme API.

> I've got a test script that can open a book and print the
> transactions.  I tried to use a date filter to get queries
> within a date range.
> 
>     (define query (gnc:malloc-query))
>     (gnc:query-add-date-match query
>                               #t 1 1 2002
>                               #f 1 1 2002
>                               'query-and)
> 
> This gives the nonsensical error
> 
>     <unnamed port>:6:1: In procedure gh_scm2newsymbol in expression (gnc:query-add-date-match query #t ...):
>     <unnamed port>:6:1: Wrong type argument in position 3: (#@quote query-and)
>     ABORT: (wrong-type-arg)

I don't get this, however I do get the other error you have below.  Looking
at the generated wrapper, it looks completely bogus.  In particular, this
code looks extremely wrong:

/* ARG 9 */
gw__arg_pos++;
if (gw__error_status != GW__ERR_NONE) goto gw__post_call_arg_8;

{
gw__scm_extras[0] = gh_call1(gw__enum__gnc_query_op__val_to_int_scm_func, gw__scm_extras[0]);
[snipped]

What's worse is that gw__scm_extras is never actually touched earlier
in the function, and even worse than that, the function is declared:

static SCM gw__tmp424_xaccQueryAddDateMatch_wrapper  (SCM gw__scm_arg0, SCM gw__scm_arg1, SCM gw__scm_arg2, SCM gw__scm_arg3, SCM gw__scm_arg4, SCM gw__scm_arg5, SCM gw__scm_arg6, SCM gw__scm_arg7, SCM gw__scm_arg8, SCM gw__restargs ) {

but gw__restargs is never actually USED... ANYWHERE.

So, this error is a g-wrap bug.

> (The wrapper in gw-engine-spec has the arguments in year-month-day
> order instead of day-month-year, but otherwise I have verified that
> everything matches up.)

I'll fix this (if I remember)....  Actually, can you just file
a bug report on this at bugzilla.gnome.org?  Please make me the
owner....

> This function appears to work, but there is another problem.  All of
> the Scheme functions for manipulating timepairs are in in the
> app-utils module.  When I have load the app-utils module, I get many
> warnings when I load a session.
> 
>     ** CRITICAL **: file gnc-component-manager.c: line 271 (gnc_cm_event_handler): assertion `id_type' failed.

This is a known architectural flaw in the component manager and
you can safely ignore it.

> An example is at the bottom.
> 
> The problem is that when app-utils is loaded, it registers a
> callback with gnc_engine_register_event_handler
> (gnc-component-manager.c:310).  The callback calls
> gnc_get_current_book (gnc-component-manager.c:270), which evidently
> assumes a GUI context.  Basically, gnc_get_current_book looks for
> the current session, which finds that there is no current session
> (even though I have already created a session), decides to create
> one, and then is surprised that it can't find the accounts I am
> loading in that session.

Yes, this is the architectural flaw that I mentioned.  One of the
things we hope to fix between now and the next major release (either
1.10 or 2, depending on when we get to it) is rototill the code and
remove all references to gnc_get_current_*() and instead pass context
objects around everywhere.

> I could probably get by loading date-utilities.scm directly (without
> app-utils), or by copy-n-pasting the relevant timepair code; but I'm
> afraid there will be further problems ahead.  These are two examples
> of why I am discouraged from using the Scheme API to write my own
> utilities.

As I said, you can ignore the criticals.  Or you can load app-utils
and use _ITS_ session instead of creating your own....

> I am using CVS that I just updated today.  I have guile 1.6, gwrap
> 1.3.4, and most everything else is from Debian testing.

Should be fine.

> Andrew

-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 at MIT.EDU                        PGP key available


More information about the gnucash-devel mailing list