Ns_TclInitInterps, Ns_TclInitModule, Ns_TclInterpServer,
- Provided by: aolserver4-dev (Version: 4.5.1-18)
- Source: aolserver4
- Report a bug
#include "ns.h" int Ns_TclInitInterps(server, initProc, arg) Ns_TclInitModule(arg, arg) char * Ns_TclInterpServer(interp) char * Ns_TclLibrary(void)
Ns_TclInitInterps arranges for initProc to be called on the startup initialization interp. initProc should have arguments and result that match the type Ns_TclInterpInitProc:
typedef int Ns_TclInterpInitProc(Tcl_Interp *interp, void *arg);
static Ns_TclInterpInitProc AddCmds;
static Tcl_CmdProc MsgCmd;
int
Ns_ModuleInit(char *server, char *module)
{
static char *arg = "hello";
return Ns_TclInitInterps(server, AddCmds, arg);
}
static int
AddCmds(Tcl_Interp *interp, void *arg)
{
Tcl_CreateCommand(interp, "msg", MsgCmd, arg, NULL);
return TCL_OK;
}
static int
MsgCmd(ClientData arg, Tcl_Interp *interp, int argc, char **argv)
{
Tcl_SetResult(interp, (char *) arg, TCL_STATIC);
return TCL_OK;
}
Ns_TclInterpServer returns the virtual server in which the given interp was created.
Ns_TclLibrary returns the shared Tcl library of the server installation (e.g., /usr/local/aolserver/modules/tcl).