Could someone please explain the different uses of the "ClientData arg" parameter to the Nsv C functions in AOLserver 3.x vs. 4.0? For example, let's look at the 3.x NsTclVSetCmd and the (equivalent but object-ified) 4.x NsTclNsvSetObjCmd functions (see below).
I believe the ClientData typdef is a void * in both 3.x and 4.x. For these two NsTclNsv*Set*Cmd functions, in 3.x, "arg" is clearly just the single character 'g', while in 4.x, well basically I have no idea what arg is. Using the character 'g' like in 3.x definitely isn't right, as that makes my AOLserver segfault with a Bus Error. :) Could someone explain what's really going on with "arg", please? Thanks! # aol3-src/aolserver/nsd/tclcmds.c : { "nsv_set", NsTclVSetCmd, (ClientData) 's' }, # aol4-src/aolserver/nsd/tclcmds.c : {"nsv_set", NULL, NsTclNsvSetObjCmd}, # aol3-src/aolserver/nsd/tclvar.c : int NsTclVSetCmd(ClientData dummy, Tcl_Interp *interp, int argc, char **argv) { Array *arrayPtr; if (argc != 3 && argc != 4) { Tcl_AppendResult(interp, "wrong # args: should be: \"", argv[0], " array key ?value?\"", NULL); return TCL_ERROR; } if (argc == 3) { return NsTclVGetCmd((ClientData) 'g', interp, argc, argv); } arrayPtr = LockArray(interp, argv[1], FLAGS_CREATE); SetVar(arrayPtr, argv[2], argv[3]); UnlockArray(arrayPtr); Tcl_SetResult(interp, argv[3], TCL_VOLATILE); return TCL_OK; } # aol4-src/aolserver/nsd/tclvar.c : int NsTclNsvSetObjCmd(ClientData arg, Tcl_Interp *interp, int objc, Tcl_Obj **objv) { Array *arrayPtr; if (objc == 3) { return NsTclNsvGetObjCmd(arg, interp, objc, objv); } else if (objc != 4) { Tcl_WrongNumArgs(interp, 1, objv, "array key ?value?"); return TCL_ERROR; } arrayPtr = LockArray(arg, interp, objv[1], 1); SetVar(arrayPtr, objv[2], objv[3]); UnlockArray(arrayPtr); Tcl_SetObjResult(interp, objv[3]); return TCL_OK; } -- Andrew Piskorski <[EMAIL PROTECTED]> http://www.piskorski.com