[MUD-Dev] Re: Bruce Sterling on Virtual Community goals

Chris Gray cg at ami-cg.GraySage.Edmonton.AB.CA
Mon Oct 19 23:17:40 New Zealand Daylight Time 1998

[Jon Leonard:]

(Oops - I just realized I left off an attribution a few minutes ago.
Sorry about that - I was following up a message by Jon Leonard.)

 >Left to my own devices, I'd implement these calls as C functions.
 >Each module would have a structure listing the names of the functions
 >it exported and function pointers.  The structure might include stuff
 >about calling conventions, a documentation string, etc.  In my current
 >server, all functions take and return linked lists of arguments/results,
 >but that's not necessarily the best choice.

Yup, that works just fine. Here's a small snippet of mine:

    r_bi3("SubString", (Comp_t) SubString, T_S,
	"str", T_S, "start", T_I, "length", T_I);
    r_bi1("Length", (Comp_t) Length, T_I, "str", T_S);
    r_bi1("Capitalize", (Comp_t) Capitalize, T_S, "str", T_S);
    r_bi1("Pluralize", (Comp_t) Pluralize, T_S, "str", T_S);

(<func-name> <ptr-to-C-code> <result-type> {<arg-name> <arg-type>}*)

etc. An advantage of having the parameter names and types in the
internal system is that the on-line programmer can then ask the system
what the parameters of a given builtin are. And, if you make the
internal function-header representation the same as for user functions,
you just use the same code to display them, and for checking calls.

Chris Gray     cg at ami-cg.GraySage.Edmonton.AB.CA

More information about the MUD-Dev mailing list