[Gnucash-changes] r13397 - gnucash/trunk/lib/libqof/qof - simplify creation of new application events

Derek Atkins warlord at MIT.EDU
Tue Feb 28 16:37:08 EST 2006


Neil Williams <codehelp at cvs.gnucash.org> writes:

> +/** \brief Allow application-specific events to be created.
> +
> +Used together with QOF_EVENT_BASE to simplify creation
> +of application events without interfering with any new
> +events added within QOF.
> +
> +/verbatim
> +#define APP_EVENT_A QOF_MAKE_EVENT(QOF_EVENT_BASE+0)
> +#define APP_EVENT_B QOF_MAKE_EVENT(QOF_EVENT_BASE+1)
> +/endverbatim

Actually, based on the definition of QOF_EVENT_BASE below,
this doesn't work.

> +#define QOF_EVENT_REMOVE   QOF_MAKE_EVENT(4)
>  #define QOF_EVENT__LAST    QOF_EVENT_REMOVE 
>  #define QOF_EVENT_ALL      (0xff)
>  
>  /** Allow scope for more defaults in future. Additional
>  event identifiers must be larger than this. */
> -#define QOF_DEFAULT_EVENT_LIMIT  QOF_EVENT__LAST
> +#define QOF_EVENT_BASE  QOF_EVENT__LAST

You want QOF_EVENT_BASE == 5 in this case..  But then you
need to change the code in qofevent.c to compare either
to QOF_EVENT__LAST or QOF_MAKE_EVENT(QOF_EVENT_BASE)

But unfortunately as-is the user API docs are incorrect based
on the following code.

Unfortunately I don't have a good suggestion here, short of
defining QOF_EVENT_BASE in line with the rest of the #defines
to make it clear.

-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