[DGD] DGD Kernel function prototypes

Felix A. Croes felix at dworkin.nl
Tue May 3 13:48:18 CEST 2011


Jared Maddox <absinthdraco at gmail.com> wrote:

> I'm writing a kernel extension to allow DGD to create SDL windows.
> I've gotten much of the work for the display and window functions
> complete (which is more of a starting point than anything), but I
> don't know the format for the kernel function's prototypes, so I can't
> complete this initial work. I grabbed this out of extra.c (and renamed
> it):
> char pt_gui[] =
> {
> 	C_TYPECHECKED | C_STATIC, /* Function traits. */
> 	2,
> 	1,
> 	0,
> 	9,
> 	T_MIXED,
> 	T_STRING,
> 	T_STRING,
> 	T_STRING
> };
> But I don't really know how to interpret it. Is the T_MIXED the return
> type? Is the return type the next-to-last T_STRING (I'm mostly certain
> that the very last isn't the return type)? What are the numeric values
> about? In short, how do I figure out the meaning of the fields in the
> prototype description so that I can specify them correctly?

If at all possible, try to use the LPC extension framework:

    http://sourceforge.net/projects/lpc-ext/

but that may be difficult in your case.  The meaning of values in
the array is:

    - class bitflags
    - number of arguments
    - number of optional extra arguments
    - size of the whole array, high byte
    - size of the whole array, low byte
    - return type
    - type of first argument
    - type of second argument
    ...

Don't forget that DGD can execute code atomically, and kfun calls may
be rolled back.


> Additionally, is there any reason why DGD's main function would need
> to be in the main thread? Some OS's (Apple, mostly) require all Gui
> operations to occur in the main thread, so I'm going to have a
> compiler flag that shifts the main DGD function into another thread,
> but I need to know whether this is likely to cause problems (I don't
> think so, but just in case...).

The function dgd_main does not have to be in the main thread.  Indeed,
with the old Windows port, it wasn't.

Regards,
Felix Croes



More information about the DGD mailing list