Re: C -> Lite Question

From: Georg Horn (horn@koblenz-net.de)
Date: Wed Dec 29 1999 - 20:52:49 EST


Hi,

You wrote:

> static efunct_t graph_efuncts[] = {
>
> /* Graph creation & output routines */
> { "htgCreateGraph", htgCreateGraph, "_htgCreateGraph", 12,
> {P_INT, P_INT, P_INT, P_INT, P_INT, P_INT, P_INT,
> P_INT, P_INT, P_INT, P_INT, P_INT, 0} },
> ...
> };
>
> in mod_graph.
> I do understand that this maps lite functions to C functions implemented
> in the libraries, but if someone could explain the meaning of fields, and
> the behaviour , I would be very happy ;-)

This is explained a few lines above:

/*
** Process related module function definitions
**
** This table maps from internal Lite function names to the C code.
** The format is :-
**
** {LiteName, CFunctPtr, CFunctName, NumArgs, { Arg1Type, Arg2Type.., 0}}
**
** Setting NumArgs to -1 indicates varargs
*/

> And what if I want to return a string to lite? These rutins are only
> taking parameters for input.

Look at mod_graph.c. You'll find a line reading:

    extern sym_t *externReturn;

and in the functions lines like:

    externReturn = createIntSymbol(-1);

That's all.

Bye,
Georg

-------------------------------------------------------------------------
To unsubscribe, go to http://www.Hughes.com.au/extras/email/



This archive was generated by hypermail 2b30 : Mon Mar 04 2002 - 09:04:04 EST