Index: Makefile.in =================================================================== diff -u -rc7f559b495780389f79b9c67843d3e05efcc5e8f -r17ba2f1d86be4afd497d652b7ee39a5edc771a22 --- Makefile.in (.../Makefile.in) (revision c7f559b495780389f79b9c67843d3e05efcc5e8f) +++ Makefile.in (.../Makefile.in) (revision 17ba2f1d86be4afd497d652b7ee39a5edc771a22) @@ -523,18 +523,19 @@ $(src_generic_dir)/nsfAPI.h: $(src_generic_dir)/gentclAPI.tcl $(src_generic_dir)/nsfAPI.decls $(TCLSH) $(src_generic_dir)/gentclAPI.tcl $(src_generic_dir)/nsfAPI.decls > $(src_generic_dir)/nsfAPI.h -nsfStubInit.$(OBJEXT): $(PKG_HEADERS) -nsfStubLib.$(OBJEXT): $(src_generic_dir)/nsfStubLib.c $(PKG_HEADERS) +aolstub.$(OBJEXT): $(src_generic_dir)/aolstub.c $(PKG_HEADERS) nsf.$(OBJEXT): $(src_generic_dir)/nsf.c $(src_generic_dir)/predefined.h $(src_generic_dir)/nsfAccessInt.h $(src_generic_dir)/nsfAPI.h $(PKG_HEADERS) $(src_generic_dir)/nsfStack.c $(DTRACE_HDR) nsfError.$(OBJEXT): $(src_generic_dir)/nsfError.c $(PKG_HEADERS) nsfMetaData.$(OBJEXT): $(src_generic_dir)/nsfMetaData.c $(PKG_HEADERS) +nsfObj.$(OBJEXT): $(src_generic_dir)/nsfObj.c $(PKG_HEADERS) nsfObjectData.$(OBJEXT): $(src_generic_dir)/nsfObjectData.c $(PKG_HEADERS) +nsfPointer.$(OBJEXT): $(src_generic_dir)/nsfPointer.c $(PKG_HEADERS) nsfProfile.$(OBJEXT): $(src_generic_dir)/nsfProfile.c $(PKG_HEADERS) +nsfShadow.$(OBJEXT): $(src_generic_dir)/nsfShadow.c $(PKG_HEADERS) +nsfStubInit.$(OBJEXT): $(PKG_HEADERS) +nsfStubLib.$(OBJEXT): $(src_generic_dir)/nsfStubLib.c $(PKG_HEADERS) nsfTrace.$(OBJEXT): $(src_generic_dir)/nsfTrace.c $(PKG_HEADERS) nsfUtil.$(OBJEXT): $(src_generic_dir)/nsfUtil.c $(PKG_HEADERS) -nsfObj.$(OBJEXT): $(src_generic_dir)/nsfObj.c $(PKG_HEADERS) -nsfShadow.$(OBJEXT): $(src_generic_dir)/nsfShadow.c $(PKG_HEADERS) -aolstub.$(OBJEXT): $(src_generic_dir)/aolstub.c $(PKG_HEADERS) # # Target to regenerate header files and stub files from the *.decls tables. Index: TODO =================================================================== diff -u -r31fc20e0f7088356b01a427be2a08b0a1f1b6d73 -r17ba2f1d86be4afd497d652b7ee39a5edc771a22 --- TODO (.../TODO) (revision 31fc20e0f7088356b01a427be2a08b0a1f1b6d73) +++ TODO (.../TODO) (revision 17ba2f1d86be4afd497d652b7ee39a5edc771a22) @@ -2981,6 +2981,18 @@ - library/nx/nx-zip.tcl: added a zip file generator as package +- nsf.c: + * new file nsfPointer.c + * generic new value checker ConvertToPointer to handle c-level + conversions (which can be registed from nsf extensions) + * extern defined interface for the pointer converter: + Nsf_PointerTypeLookup(), Nsf_PointerTypeRegister(), + Nsf_PointerAdd(), Nsf_PointerDelete(), + Nsf_PointerInit(), Nsf_PointerExit(). +- library mongodb + * changed mongoAPI to pointer converter interface + + TODO: - do we have to adjust the documentation in xotcl2 for object initialization? - maybe optional arg (true) to ::nsf::object::initialized Index: configure =================================================================== diff -u -rbd4aa15282abe386464ef276b78f2708f249f333 -r17ba2f1d86be4afd497d652b7ee39a5edc771a22 --- configure (.../configure) (revision bd4aa15282abe386464ef276b78f2708f249f333) +++ configure (.../configure) (revision 17ba2f1d86be4afd497d652b7ee39a5edc771a22) @@ -5543,7 +5543,7 @@ vars="nsf.c nsfError.c nsfObjectData.c nsfProfile.c \ - nsfTrace.c nsfUtil.c nsfObj.c nsfShadow.c nsfCompile.c aolstub.c nsfStubInit.c" + nsfTrace.c nsfUtil.c nsfObj.c nsfPointer.c nsfShadow.c nsfCompile.c aolstub.c nsfStubInit.c" for i in $vars; do case $i in \$*) Index: configure.in =================================================================== diff -u -rbd4aa15282abe386464ef276b78f2708f249f333 -r17ba2f1d86be4afd497d652b7ee39a5edc771a22 --- configure.in (.../configure.in) (revision bd4aa15282abe386464ef276b78f2708f249f333) +++ configure.in (.../configure.in) (revision 17ba2f1d86be4afd497d652b7ee39a5edc771a22) @@ -193,7 +193,7 @@ TEA_ADD_SOURCES([nsf.c nsfError.c nsfObjectData.c nsfProfile.c \ - nsfTrace.c nsfUtil.c nsfObj.c nsfShadow.c nsfCompile.c aolstub.c nsfStubInit.c]) + nsfTrace.c nsfUtil.c nsfObj.c nsfPointer.c nsfShadow.c nsfCompile.c aolstub.c nsfStubInit.c]) TEA_ADD_HEADERS([generic/nsf.h generic/nsfInt.h generic/nsfDecls.h generic/nsfIntDecls.h]) TEA_ADD_INCLUDES([]) TEA_ADD_LIBS([]) Index: generic/gentclAPI.tcl =================================================================== diff -u -rdf67ed7db2b0cda881c4a9e704379a2a02d415b6 -r17ba2f1d86be4afd497d652b7ee39a5edc771a22 --- generic/gentclAPI.tcl (.../gentclAPI.tcl) (revision df67ed7db2b0cda881c4a9e704379a2a02d415b6) +++ generic/gentclAPI.tcl (.../gentclAPI.tcl) (revision 17ba2f1d86be4afd497d652b7ee39a5edc771a22) @@ -69,13 +69,20 @@ set (-argName) $type append flags |NSF_ARG_IS_ENUMERATION } + default { + if {[info exists ::ptrConverter($type)]} { + set converter Pointer + } else { + error "unknown type $type" + } + } } - if {$converter in {Tclobj Integer Int32 Boolean String Class Object}} { + if {$converter in {Tclobj Integer Int32 Boolean String Class Object Pointer}} { set conv Nsf_ConvertTo$converter } else { set conv ConvertTo$converter } - lappend l "{\"$argName\", $flags, $(-nrargs), $conv, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}" + lappend l "{\"$argName\", $flags, $(-nrargs), $conv, NULL,NULL,\"$(-type)\",NULL,NULL,NULL,NULL,NULL}" } if {[llength $l] == 0} { return "{NULL, 0, 0, NULL, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}" @@ -184,7 +191,13 @@ } *|* {set type "int "} default { - error "type '$(-type)' not allowed for argument" + if {[info exists ::ptrConverter($(-type))]} { + set type "$(-type) *" + set varName "$(-type)Ptr" + set calledArg $varName + } else { + error "type '$(-type)' not allowed for argument" + } } } } Index: generic/nsf.c =================================================================== diff -u -r9f51576de17e47b9495ae7ceea1340bc8d200507 -r17ba2f1d86be4afd497d652b7ee39a5edc771a22 --- generic/nsf.c (.../nsf.c) (revision 9f51576de17e47b9495ae7ceea1340bc8d200507) +++ generic/nsf.c (.../nsf.c) (revision 17ba2f1d86be4afd497d652b7ee39a5edc771a22) @@ -9717,6 +9717,8 @@ return NsfObjErrType(interp, NULL, objPtr, "class", (Nsf_Param *)pPtr); } + + /* *---------------------------------------------------------------------- * Nsf_ConvertToFilterreg -- @@ -10149,39 +10151,61 @@ } else { int i, found = -1; + Tcl_DString ds, *dsPtr = &ds; + Tcl_DStringInit(dsPtr); + Tcl_DStringAppend(dsPtr, option, optionLength); + if (paramPtr->converter) { - Tcl_Obj *obj = Tcl_NewStringObj(option,optionLength); NsfPrintError(interp, "Parameter option '%s' unknown for parameter type '%s'", - ObjStr(obj), paramPtr->type); - DECR_REF_COUNT(obj); + Tcl_DStringValue(dsPtr), paramPtr->type); + Tcl_DStringFree(dsPtr); return TCL_ERROR; } - for (i=0; stringTypeOpts[i]; i++) { - /* Do not allow abbreviations, so the additional strlen checks - for a full match */ - if (strncmp(option, stringTypeOpts[i], optionLength) == 0 - && strlen(stringTypeOpts[i]) == optionLength) { - found = i; - break; - } - } - if (found > -1) { - /* converter is stringType */ - result = ParamOptionSetConverter(interp, paramPtr, "stringtype", Nsf_ConvertToTclobj); - paramPtr->converterArg = Tcl_NewStringObj(stringTypeOpts[i], -1); - INCR_REF_COUNT(paramPtr->converterArg); + if (Nsf_PointerTypeLookup(interp, Tcl_DStringValue(dsPtr))) { + /* + * Check, if the option refers to a pointer converter + */ + fprintf(stderr, "param %s ptr %p type %s\n", paramPtr->name, paramPtr, Tcl_DStringValue(dsPtr)); + ParamOptionSetConverter(interp, paramPtr, Tcl_DStringValue(dsPtr), Nsf_ConvertToPointer); + Tcl_DStringFree(dsPtr); + } else { - - /* - * The parameter option is still unknown. We assume that the parameter - * option identifies a user-defined argument checker, implemented as a - * method. + + /* + * The option is still unkown, check the Tcl string-is checkers */ - paramPtr->converterName = ParamCheckObj(option, optionLength); - INCR_REF_COUNT(paramPtr->converterName); - result = ParamOptionSetConverter(interp, paramPtr, ObjStr(paramPtr->converterName), ConvertViaCmd); + Tcl_DStringFree(dsPtr); + + for (i=0; stringTypeOpts[i]; i++) { + /* + * Do not allow abbreviations, so the additional strlen checks + * for a full match + */ + if (strncmp(option, stringTypeOpts[i], optionLength) == 0 + && strlen(stringTypeOpts[i]) == optionLength) { + found = i; + break; + } + } + + if (found > -1) { + /* converter is stringType */ + result = ParamOptionSetConverter(interp, paramPtr, "stringtype", Nsf_ConvertToTclobj); + paramPtr->converterArg = Tcl_NewStringObj(stringTypeOpts[i], -1); + INCR_REF_COUNT(paramPtr->converterArg); + } else { + + /* + * The parameter option is still unknown. We assume that the parameter + * option identifies a user-defined argument checker, implemented as a + * method. + */ + paramPtr->converterName = ParamCheckObj(option, optionLength); + INCR_REF_COUNT(paramPtr->converterName); + result = ParamOptionSetConverter(interp, paramPtr, ObjStr(paramPtr->converterName), ConvertViaCmd); + } } } @@ -21225,6 +21249,11 @@ } NsfStringIncrFree(&RUNTIME_STATE(interp)->iss); + /* + * Free all data in the pointer converter + */ + Nsf_PointerExit(interp); + #if defined(NSF_PROFILE) NsfProfileFree(interp); #endif @@ -21333,7 +21362,12 @@ NsfMutexUnlock(&initMutex); + /* + * Initialize the pointer converter + */ + Nsf_PointerInit(interp); + /* fprintf(stderr, "SIZES: obj=%d, tcl_obj=%d, DString=%d, class=%d, namespace=%d, command=%d, HashTable=%d\n", sizeof(NsfObject), sizeof(Tcl_Obj), sizeof(Tcl_DString), sizeof(NsfClass), sizeof(Namespace), sizeof(Command), sizeof(Tcl_HashTable)); Index: generic/nsf.h =================================================================== diff -u -r417968f9109f1c27af478b142b34b64f38e3908e -r17ba2f1d86be4afd497d652b7ee39a5edc771a22 --- generic/nsf.h (.../nsf.h) (revision 417968f9109f1c27af478b142b34b64f38e3908e) +++ generic/nsf.h (.../nsf.h) (revision 17ba2f1d86be4afd497d652b7ee39a5edc771a22) @@ -232,7 +232,8 @@ Nsf_TypeConverter Nsf_ConvertToBoolean, Nsf_ConvertToClass, Nsf_ConvertToInteger, Nsf_ConvertToInt32, Nsf_ConvertToObject, Nsf_ConvertToParameter, - Nsf_ConvertToString, Nsf_ConvertToSwitch, Nsf_ConvertToTclobj; + Nsf_ConvertToString, Nsf_ConvertToSwitch, + Nsf_ConvertToTclobj, Nsf_ConvertToPointer; typedef struct Nsf_Param { char *name; @@ -264,12 +265,30 @@ extern int NsfNoCurrentObjectError(Tcl_Interp *interp, CONST char *what); +/* + * logging + */ #define NSF_LOG_NOTICE 2 #define NSF_LOG_WARN 1 extern void NsfLog(Tcl_Interp *interp, int requiredLevel, CONST char *fmt, ...); +/* + * Nsf Pointer converter interface + */ + +extern int Nsf_PointerAdd(Tcl_Interp *interp, char *buffer, CONST char *typeName, void *valuePtr); +extern int Nsf_PointerDelete(void *valuePtr); +extern void Nsf_PointerInit(Tcl_Interp *interp); +extern void Nsf_PointerExit(Tcl_Interp *interp); +extern void *Nsf_PointerTypeLookup(Tcl_Interp *interp, CONST char* typeName); +extern int Nsf_PointerTypeRegister(Tcl_Interp *interp, CONST char* typeName, int *counterPtr); + +/* + * methodDefinition + */ + typedef struct Nsf_methodDefinition { CONST char *methodName; Tcl_ObjCmdProc *proc; Index: generic/nsfAPI.h =================================================================== diff -u -rc7f559b495780389f79b9c67843d3e05efcc5e8f -r17ba2f1d86be4afd497d652b7ee39a5edc771a22 --- generic/nsfAPI.h (.../nsfAPI.h) (revision c7f559b495780389f79b9c67843d3e05efcc5e8f) +++ generic/nsfAPI.h (.../nsfAPI.h) (revision 17ba2f1d86be4afd497d652b7ee39a5edc771a22) @@ -2310,219 +2310,219 @@ static Nsf_methodDefinition method_definitions[] = { {"::nsf::methods::class::alloc", NsfCAllocMethodStub, 1, { - {"objectName", NSF_ARG_REQUIRED, 1, Nsf_ConvertToTclobj, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}} + {"objectName", NSF_ARG_REQUIRED, 1, Nsf_ConvertToTclobj, NULL,NULL,"tclobj",NULL,NULL,NULL,NULL,NULL}} }, {"::nsf::methods::class::create", NsfCCreateMethodStub, 2, { - {"objectName", NSF_ARG_REQUIRED, 1, Nsf_ConvertToString, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}, - {"args", 0, 1, ConvertToNothing, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}} + {"objectName", NSF_ARG_REQUIRED, 1, Nsf_ConvertToString, NULL,NULL,"",NULL,NULL,NULL,NULL,NULL}, + {"args", 0, 1, ConvertToNothing, NULL,NULL,"allargs",NULL,NULL,NULL,NULL,NULL}} }, {"::nsf::methods::class::dealloc", NsfCDeallocMethodStub, 1, { - {"object", NSF_ARG_REQUIRED, 1, Nsf_ConvertToTclobj, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}} + {"object", NSF_ARG_REQUIRED, 1, Nsf_ConvertToTclobj, NULL,NULL,"tclobj",NULL,NULL,NULL,NULL,NULL}} }, {"::nsf::methods::class::filterguard", NsfCFilterGuardMethodStub, 2, { - {"filter", NSF_ARG_REQUIRED, 1, Nsf_ConvertToString, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}, - {"guard", NSF_ARG_REQUIRED, 1, Nsf_ConvertToTclobj, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}} + {"filter", NSF_ARG_REQUIRED, 1, Nsf_ConvertToString, NULL,NULL,"",NULL,NULL,NULL,NULL,NULL}, + {"guard", NSF_ARG_REQUIRED, 1, Nsf_ConvertToTclobj, NULL,NULL,"tclobj",NULL,NULL,NULL,NULL,NULL}} }, {"::nsf::methods::class::mixinguard", NsfCMixinGuardMethodStub, 2, { - {"mixin", NSF_ARG_REQUIRED, 1, Nsf_ConvertToTclobj, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}, - {"guard", NSF_ARG_REQUIRED, 1, Nsf_ConvertToTclobj, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}} + {"mixin", NSF_ARG_REQUIRED, 1, Nsf_ConvertToTclobj, NULL,NULL,"tclobj",NULL,NULL,NULL,NULL,NULL}, + {"guard", NSF_ARG_REQUIRED, 1, Nsf_ConvertToTclobj, NULL,NULL,"tclobj",NULL,NULL,NULL,NULL,NULL}} }, {"::nsf::methods::class::new", NsfCNewMethodStub, 2, { - {"-childof", 0, 1, Nsf_ConvertToObject, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}, - {"args", 0, 1, ConvertToNothing, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}} + {"-childof", 0, 1, Nsf_ConvertToObject, NULL,NULL,"object",NULL,NULL,NULL,NULL,NULL}, + {"args", 0, 1, ConvertToNothing, NULL,NULL,"args",NULL,NULL,NULL,NULL,NULL}} }, {"::nsf::methods::class::recreate", NsfCRecreateMethodStub, 2, { - {"objectName", NSF_ARG_REQUIRED, 1, Nsf_ConvertToTclobj, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}, - {"args", 0, 1, ConvertToNothing, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}} + {"objectName", NSF_ARG_REQUIRED, 1, Nsf_ConvertToTclobj, NULL,NULL,"tclobj",NULL,NULL,NULL,NULL,NULL}, + {"args", 0, 1, ConvertToNothing, NULL,NULL,"allargs",NULL,NULL,NULL,NULL,NULL}} }, {"::nsf::methods::class::superclass", NsfCSuperclassMethodStub, 1, { - {"superclasses", 0, 1, Nsf_ConvertToTclobj, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}} + {"superclasses", 0, 1, Nsf_ConvertToTclobj, NULL,NULL,"tclobj",NULL,NULL,NULL,NULL,NULL}} }, {"::nsf::methods::class::info::filterguard", NsfClassInfoFilterguardMethodStub, 1, { - {"filter", NSF_ARG_REQUIRED, 1, Nsf_ConvertToString, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}} + {"filter", NSF_ARG_REQUIRED, 1, Nsf_ConvertToString, NULL,NULL,"",NULL,NULL,NULL,NULL,NULL}} }, {"::nsf::methods::class::info::filtermethods", NsfClassInfoFiltermethodsMethodStub, 2, { - {"-guards", 0, 0, Nsf_ConvertToString, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}, - {"pattern", 0, 1, Nsf_ConvertToString, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}} + {"-guards", 0, 0, Nsf_ConvertToString, NULL,NULL,"",NULL,NULL,NULL,NULL,NULL}, + {"pattern", 0, 1, Nsf_ConvertToString, NULL,NULL,"",NULL,NULL,NULL,NULL,NULL}} }, {"::nsf::methods::class::info::forward", NsfClassInfoForwardMethodStub, 2, { - {"-definition", 0, 0, Nsf_ConvertToString, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}, - {"name", 0, 1, Nsf_ConvertToString, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}} + {"-definition", 0, 0, Nsf_ConvertToString, NULL,NULL,"",NULL,NULL,NULL,NULL,NULL}, + {"name", 0, 1, Nsf_ConvertToString, NULL,NULL,"",NULL,NULL,NULL,NULL,NULL}} }, {"::nsf::methods::class::info::heritage", NsfClassInfoHeritageMethodStub, 1, { - {"pattern", 0, 1, Nsf_ConvertToString, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}} + {"pattern", 0, 1, Nsf_ConvertToString, NULL,NULL,"",NULL,NULL,NULL,NULL,NULL}} }, {"::nsf::methods::class::info::instances", NsfClassInfoInstancesMethodStub, 2, { - {"-closure", 0, 0, Nsf_ConvertToString, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}, - {"pattern", 0, 1, ConvertToObjpattern, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}} + {"-closure", 0, 0, Nsf_ConvertToString, NULL,NULL,"",NULL,NULL,NULL,NULL,NULL}, + {"pattern", 0, 1, ConvertToObjpattern, NULL,NULL,"objpattern",NULL,NULL,NULL,NULL,NULL}} }, {"::nsf::methods::class::info::method", NsfClassInfoMethodMethodStub, 2, { - {"infomethodsubcmd", 0|NSF_ARG_IS_ENUMERATION, 1, ConvertToInfomethodsubcmd, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}, - {"name", NSF_ARG_REQUIRED, 1, Nsf_ConvertToTclobj, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}} + {"infomethodsubcmd", 0|NSF_ARG_IS_ENUMERATION, 1, ConvertToInfomethodsubcmd, NULL,NULL,"args|body|definition|exists|handle|parameter|parametersyntax|type|precondition|postcondition|submethods",NULL,NULL,NULL,NULL,NULL}, + {"name", NSF_ARG_REQUIRED, 1, Nsf_ConvertToTclobj, NULL,NULL,"tclobj",NULL,NULL,NULL,NULL,NULL}} }, {"::nsf::methods::class::info::methods", NsfClassInfoMethodsMethodStub, 4, { - {"-callprotection", 0|NSF_ARG_IS_ENUMERATION, 1, ConvertToCallprotection, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}, - {"-methodtype", 0|NSF_ARG_IS_ENUMERATION, 1, ConvertToMethodtype, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}, - {"-path", 0, 0, Nsf_ConvertToString, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}, - {"pattern", 0, 1, Nsf_ConvertToString, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}} + {"-callprotection", 0|NSF_ARG_IS_ENUMERATION, 1, ConvertToCallprotection, NULL,NULL,"all|protected|public",NULL,NULL,NULL,NULL,NULL}, + {"-methodtype", 0|NSF_ARG_IS_ENUMERATION, 1, ConvertToMethodtype, NULL,NULL,"all|scripted|builtin|alias|forwarder|object|setter|nsfproc",NULL,NULL,NULL,NULL,NULL}, + {"-path", 0, 0, Nsf_ConvertToString, NULL,NULL,"",NULL,NULL,NULL,NULL,NULL}, + {"pattern", 0, 1, Nsf_ConvertToString, NULL,NULL,"",NULL,NULL,NULL,NULL,NULL}} }, {"::nsf::methods::class::info::mixinof", NsfClassInfoMixinOfMethodStub, 3, { - {"-closure", 0, 0, Nsf_ConvertToString, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}, - {"-scope", 0|NSF_ARG_IS_ENUMERATION, 1, ConvertToScope, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}, - {"pattern", 0, 1, ConvertToObjpattern, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}} + {"-closure", 0, 0, Nsf_ConvertToString, NULL,NULL,"",NULL,NULL,NULL,NULL,NULL}, + {"-scope", 0|NSF_ARG_IS_ENUMERATION, 1, ConvertToScope, NULL,NULL,"all|class|object",NULL,NULL,NULL,NULL,NULL}, + {"pattern", 0, 1, ConvertToObjpattern, NULL,NULL,"objpattern",NULL,NULL,NULL,NULL,NULL}} }, {"::nsf::methods::class::info::mixinclasses", NsfClassInfoMixinclassesMethodStub, 4, { - {"-closure", 0, 0, Nsf_ConvertToString, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}, - {"-guards", 0, 0, Nsf_ConvertToString, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}, - {"-heritage", 0, 0, Nsf_ConvertToString, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}, - {"pattern", 0, 1, ConvertToObjpattern, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}} + {"-closure", 0, 0, Nsf_ConvertToString, NULL,NULL,"",NULL,NULL,NULL,NULL,NULL}, + {"-guards", 0, 0, Nsf_ConvertToString, NULL,NULL,"",NULL,NULL,NULL,NULL,NULL}, + {"-heritage", 0, 0, Nsf_ConvertToString, NULL,NULL,"",NULL,NULL,NULL,NULL,NULL}, + {"pattern", 0, 1, ConvertToObjpattern, NULL,NULL,"objpattern",NULL,NULL,NULL,NULL,NULL}} }, {"::nsf::methods::class::info::mixinguard", NsfClassInfoMixinguardMethodStub, 1, { - {"mixin", NSF_ARG_REQUIRED, 1, Nsf_ConvertToString, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}} + {"mixin", NSF_ARG_REQUIRED, 1, Nsf_ConvertToString, NULL,NULL,"",NULL,NULL,NULL,NULL,NULL}} }, {"::nsf::methods::class::info::objectparameter", NsfClassInfoObjectparameterMethodStub, 2, { - {"infoobjectparametersubcmd", NSF_ARG_REQUIRED|NSF_ARG_IS_ENUMERATION, 1, ConvertToInfoobjectparametersubcmd, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}, - {"pattern", 0, 1, Nsf_ConvertToString, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}} + {"infoobjectparametersubcmd", NSF_ARG_REQUIRED|NSF_ARG_IS_ENUMERATION, 1, ConvertToInfoobjectparametersubcmd, NULL,NULL,"list|name|parameter|parametersyntax",NULL,NULL,NULL,NULL,NULL}, + {"pattern", 0, 1, Nsf_ConvertToString, NULL,NULL,"",NULL,NULL,NULL,NULL,NULL}} }, {"::nsf::methods::class::info::slots", NsfClassInfoSlotsMethodStub, 4, { - {"-closure", 0, 0, Nsf_ConvertToString, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}, - {"-source", 0|NSF_ARG_IS_ENUMERATION, 1, ConvertToSource, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}, - {"-type", 0, 1, Nsf_ConvertToClass, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}, - {"pattern", 0, 1, Nsf_ConvertToString, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}} + {"-closure", 0, 0, Nsf_ConvertToString, NULL,NULL,"",NULL,NULL,NULL,NULL,NULL}, + {"-source", 0|NSF_ARG_IS_ENUMERATION, 1, ConvertToSource, NULL,NULL,"all|application|baseclasses",NULL,NULL,NULL,NULL,NULL}, + {"-type", 0, 1, Nsf_ConvertToClass, NULL,NULL,"class",NULL,NULL,NULL,NULL,NULL}, + {"pattern", 0, 1, Nsf_ConvertToString, NULL,NULL,"",NULL,NULL,NULL,NULL,NULL}} }, {"::nsf::methods::class::info::subclass", NsfClassInfoSubclassMethodStub, 2, { - {"-closure", 0, 0, Nsf_ConvertToString, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}, - {"pattern", 0, 1, ConvertToObjpattern, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}} + {"-closure", 0, 0, Nsf_ConvertToString, NULL,NULL,"",NULL,NULL,NULL,NULL,NULL}, + {"pattern", 0, 1, ConvertToObjpattern, NULL,NULL,"objpattern",NULL,NULL,NULL,NULL,NULL}} }, {"::nsf::methods::class::info::superclass", NsfClassInfoSuperclassMethodStub, 2, { - {"-closure", 0, 0, Nsf_ConvertToString, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}, - {"pattern", 0, 1, Nsf_ConvertToTclobj, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}} + {"-closure", 0, 0, Nsf_ConvertToString, NULL,NULL,"",NULL,NULL,NULL,NULL,NULL}, + {"pattern", 0, 1, Nsf_ConvertToTclobj, NULL,NULL,"tclobj",NULL,NULL,NULL,NULL,NULL}} }, {"::nsf::colon", NsfColonCmdStub, 1, { - {"args", 0, 1, ConvertToNothing, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}} + {"args", 0, 1, ConvertToNothing, NULL,NULL,"allargs",NULL,NULL,NULL,NULL,NULL}} }, {"::nsf::configure", NsfConfigureCmdStub, 2, { - {"configureoption", NSF_ARG_REQUIRED|NSF_ARG_IS_ENUMERATION, 1, ConvertToConfigureoption, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}, - {"value", 0, 1, Nsf_ConvertToTclobj, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}} + {"configureoption", NSF_ARG_REQUIRED|NSF_ARG_IS_ENUMERATION, 1, ConvertToConfigureoption, NULL,NULL,"debug|dtrace|filter|profile|softrecreate|objectsystems|keepinitcmd|checkresults|checkarguments",NULL,NULL,NULL,NULL,NULL}, + {"value", 0, 1, Nsf_ConvertToTclobj, NULL,NULL,"tclobj",NULL,NULL,NULL,NULL,NULL}} }, {"::nsf::createobjectsystem", NsfCreateObjectSystemCmdStub, 3, { - {"rootClass", NSF_ARG_REQUIRED, 1, Nsf_ConvertToTclobj, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}, - {"rootMetaClass", NSF_ARG_REQUIRED, 1, Nsf_ConvertToTclobj, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}, - {"systemMethods", 0, 1, Nsf_ConvertToTclobj, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}} + {"rootClass", NSF_ARG_REQUIRED, 1, Nsf_ConvertToTclobj, NULL,NULL,"tclobj",NULL,NULL,NULL,NULL,NULL}, + {"rootMetaClass", NSF_ARG_REQUIRED, 1, Nsf_ConvertToTclobj, NULL,NULL,"tclobj",NULL,NULL,NULL,NULL,NULL}, + {"systemMethods", 0, 1, Nsf_ConvertToTclobj, NULL,NULL,"tclobj",NULL,NULL,NULL,NULL,NULL}} }, {"::nsf::current", NsfCurrentCmdStub, 1, { - {"currentoption", 0|NSF_ARG_IS_ENUMERATION, 1, ConvertToCurrentoption, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}} + {"currentoption", 0|NSF_ARG_IS_ENUMERATION, 1, ConvertToCurrentoption, NULL,NULL,"proc|method|methodpath|object|class|activelevel|args|activemixin|calledproc|calledmethod|calledclass|callingproc|callingmethod|callingclass|callinglevel|callingobject|filterreg|isnextcall|next",NULL,NULL,NULL,NULL,NULL}} }, {"::nsf::__db_run_assertions", NsfDebugRunAssertionsCmdStub, 0, { {NULL, 0, 0, NULL, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}} }, {"::nsf::dispatch", NsfDispatchCmdStub, 4, { - {"object", NSF_ARG_REQUIRED, 1, Nsf_ConvertToObject, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}, - {"-frame", 0|NSF_ARG_IS_ENUMERATION, 1, ConvertToFrame, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}, - {"command", NSF_ARG_REQUIRED, 1, Nsf_ConvertToTclobj, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}, - {"args", 0, 1, ConvertToNothing, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}} + {"object", NSF_ARG_REQUIRED, 1, Nsf_ConvertToObject, NULL,NULL,"object",NULL,NULL,NULL,NULL,NULL}, + {"-frame", 0|NSF_ARG_IS_ENUMERATION, 1, ConvertToFrame, NULL,NULL,"method|object|default",NULL,NULL,NULL,NULL,NULL}, + {"command", NSF_ARG_REQUIRED, 1, Nsf_ConvertToTclobj, NULL,NULL,"tclobj",NULL,NULL,NULL,NULL,NULL}, + {"args", 0, 1, ConvertToNothing, NULL,NULL,"args",NULL,NULL,NULL,NULL,NULL}} }, {"::nsf::finalize", NsfFinalizeObjCmdStub, 0, { {NULL, 0, 0, NULL, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}} }, {"::nsf::interp", NsfInterpObjCmdStub, 2, { - {"name", NSF_ARG_REQUIRED, 1, Nsf_ConvertToString, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}, - {"args", 0, 1, ConvertToNothing, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}} + {"name", NSF_ARG_REQUIRED, 1, Nsf_ConvertToString, NULL,NULL,"",NULL,NULL,NULL,NULL,NULL}, + {"args", 0, 1, ConvertToNothing, NULL,NULL,"allargs",NULL,NULL,NULL,NULL,NULL}} }, {"::nsf::invalidateobjectparameter", NsfInvalidateObjectParameterCmdStub, 1, { - {"class", NSF_ARG_REQUIRED, 1, Nsf_ConvertToClass, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}} + {"class", NSF_ARG_REQUIRED, 1, Nsf_ConvertToClass, NULL,NULL,"class",NULL,NULL,NULL,NULL,NULL}} }, {"::nsf::is", NsfIsCmdStub, 3, { - {"-complain", 0, 0, Nsf_ConvertToString, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}, - {"constraint", NSF_ARG_REQUIRED, 1, Nsf_ConvertToTclobj, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}, - {"value", NSF_ARG_REQUIRED, 1, Nsf_ConvertToTclobj, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}} + {"-complain", 0, 0, Nsf_ConvertToString, NULL,NULL,"",NULL,NULL,NULL,NULL,NULL}, + {"constraint", NSF_ARG_REQUIRED, 1, Nsf_ConvertToTclobj, NULL,NULL,"tclobj",NULL,NULL,NULL,NULL,NULL}, + {"value", NSF_ARG_REQUIRED, 1, Nsf_ConvertToTclobj, NULL,NULL,"tclobj",NULL,NULL,NULL,NULL,NULL}} }, {"::nsf::method::alias", NsfMethodAliasCmdStub, 5, { - {"object", NSF_ARG_REQUIRED, 1, Nsf_ConvertToObject, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}, - {"-per-object", 0, 0, Nsf_ConvertToString, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}, - {"methodName", NSF_ARG_REQUIRED, 1, Nsf_ConvertToString, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}, - {"-frame", 0|NSF_ARG_IS_ENUMERATION, 1, ConvertToFrame, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}, - {"cmdName", NSF_ARG_REQUIRED, 1, Nsf_ConvertToTclobj, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}} + {"object", NSF_ARG_REQUIRED, 1, Nsf_ConvertToObject, NULL,NULL,"object",NULL,NULL,NULL,NULL,NULL}, + {"-per-object", 0, 0, Nsf_ConvertToString, NULL,NULL,"",NULL,NULL,NULL,NULL,NULL}, + {"methodName", NSF_ARG_REQUIRED, 1, Nsf_ConvertToString, NULL,NULL,"",NULL,NULL,NULL,NULL,NULL}, + {"-frame", 0|NSF_ARG_IS_ENUMERATION, 1, ConvertToFrame, NULL,NULL,"method|object|default",NULL,NULL,NULL,NULL,NULL}, + {"cmdName", NSF_ARG_REQUIRED, 1, Nsf_ConvertToTclobj, NULL,NULL,"tclobj",NULL,NULL,NULL,NULL,NULL}} }, {"::nsf::method::assertion", NsfMethodAssertionCmdStub, 3, { - {"object", NSF_ARG_REQUIRED, 1, Nsf_ConvertToObject, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}, - {"assertionsubcmd", NSF_ARG_REQUIRED|NSF_ARG_IS_ENUMERATION, 1, ConvertToAssertionsubcmd, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}, - {"arg", 0, 1, Nsf_ConvertToTclobj, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}} + {"object", NSF_ARG_REQUIRED, 1, Nsf_ConvertToObject, NULL,NULL,"object",NULL,NULL,NULL,NULL,NULL}, + {"assertionsubcmd", NSF_ARG_REQUIRED|NSF_ARG_IS_ENUMERATION, 1, ConvertToAssertionsubcmd, NULL,NULL,"check|object-invar|class-invar",NULL,NULL,NULL,NULL,NULL}, + {"arg", 0, 1, Nsf_ConvertToTclobj, NULL,NULL,"tclobj",NULL,NULL,NULL,NULL,NULL}} }, {"::nsf::method::create", NsfMethodCreateCmdStub, 9, { - {"object", NSF_ARG_REQUIRED, 1, Nsf_ConvertToObject, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}, - {"-inner-namespace", 0, 0, Nsf_ConvertToString, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}, - {"-per-object", 0, 0, Nsf_ConvertToString, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}, - {"-reg-object", 0, 1, Nsf_ConvertToObject, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}, - {"methodName", NSF_ARG_REQUIRED, 1, Nsf_ConvertToTclobj, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}, - {"arguments", NSF_ARG_REQUIRED, 1, Nsf_ConvertToTclobj, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}, - {"body", NSF_ARG_REQUIRED, 1, Nsf_ConvertToTclobj, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}, - {"-precondition", 0, 1, Nsf_ConvertToTclobj, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}, - {"-postcondition", 0, 1, Nsf_ConvertToTclobj, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}} + {"object", NSF_ARG_REQUIRED, 1, Nsf_ConvertToObject, NULL,NULL,"object",NULL,NULL,NULL,NULL,NULL}, + {"-inner-namespace", 0, 0, Nsf_ConvertToString, NULL,NULL,"",NULL,NULL,NULL,NULL,NULL}, + {"-per-object", 0, 0, Nsf_ConvertToString, NULL,NULL,"",NULL,NULL,NULL,NULL,NULL}, + {"-reg-object", 0, 1, Nsf_ConvertToObject, NULL,NULL,"object",NULL,NULL,NULL,NULL,NULL}, + {"methodName", NSF_ARG_REQUIRED, 1, Nsf_ConvertToTclobj, NULL,NULL,"tclobj",NULL,NULL,NULL,NULL,NULL}, + {"arguments", NSF_ARG_REQUIRED, 1, Nsf_ConvertToTclobj, NULL,NULL,"tclobj",NULL,NULL,NULL,NULL,NULL}, + {"body", NSF_ARG_REQUIRED, 1, Nsf_ConvertToTclobj, NULL,NULL,"tclobj",NULL,NULL,NULL,NULL,NULL}, + {"-precondition", 0, 1, Nsf_ConvertToTclobj, NULL,NULL,"tclobj",NULL,NULL,NULL,NULL,NULL}, + {"-postcondition", 0, 1, Nsf_ConvertToTclobj, NULL,NULL,"tclobj",NULL,NULL,NULL,NULL,NULL}} }, {"::nsf::method::delete", NsfMethodDeleteCmdStub, 3, { - {"object", NSF_ARG_REQUIRED, 1, Nsf_ConvertToObject, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}, - {"-per-object", 0, 0, Nsf_ConvertToString, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}, - {"methodName", NSF_ARG_REQUIRED, 1, Nsf_ConvertToTclobj, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}} + {"object", NSF_ARG_REQUIRED, 1, Nsf_ConvertToObject, NULL,NULL,"object",NULL,NULL,NULL,NULL,NULL}, + {"-per-object", 0, 0, Nsf_ConvertToString, NULL,NULL,"",NULL,NULL,NULL,NULL,NULL}, + {"methodName", NSF_ARG_REQUIRED, 1, Nsf_ConvertToTclobj, NULL,NULL,"tclobj",NULL,NULL,NULL,NULL,NULL}} }, {"::nsf::method::forward", NsfMethodForwardCmdStub, 11, { - {"object", NSF_ARG_REQUIRED, 1, Nsf_ConvertToObject, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}, - {"-per-object", 0, 0, Nsf_ConvertToString, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}, - {"method", NSF_ARG_REQUIRED, 1, Nsf_ConvertToTclobj, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}, - {"-default", 0, 1, Nsf_ConvertToTclobj, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}, - {"-earlybinding", 0, 0, Nsf_ConvertToString, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}, - {"-methodprefix", 0, 1, Nsf_ConvertToTclobj, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}, - {"-objframe", 0, 0, Nsf_ConvertToString, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}, - {"-onerror", 0, 1, Nsf_ConvertToTclobj, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}, - {"-verbose", 0, 0, Nsf_ConvertToString, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}, - {"target", 0, 1, Nsf_ConvertToTclobj, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}, - {"args", 0, 1, ConvertToNothing, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}} + {"object", NSF_ARG_REQUIRED, 1, Nsf_ConvertToObject, NULL,NULL,"object",NULL,NULL,NULL,NULL,NULL}, + {"-per-object", 0, 0, Nsf_ConvertToString, NULL,NULL,"",NULL,NULL,NULL,NULL,NULL}, + {"method", NSF_ARG_REQUIRED, 1, Nsf_ConvertToTclobj, NULL,NULL,"tclobj",NULL,NULL,NULL,NULL,NULL}, + {"-default", 0, 1, Nsf_ConvertToTclobj, NULL,NULL,"tclobj",NULL,NULL,NULL,NULL,NULL}, + {"-earlybinding", 0, 0, Nsf_ConvertToString, NULL,NULL,"",NULL,NULL,NULL,NULL,NULL}, + {"-methodprefix", 0, 1, Nsf_ConvertToTclobj, NULL,NULL,"tclobj",NULL,NULL,NULL,NULL,NULL}, + {"-objframe", 0, 0, Nsf_ConvertToString, NULL,NULL,"",NULL,NULL,NULL,NULL,NULL}, + {"-onerror", 0, 1, Nsf_ConvertToTclobj, NULL,NULL,"tclobj",NULL,NULL,NULL,NULL,NULL}, + {"-verbose", 0, 0, Nsf_ConvertToString, NULL,NULL,"",NULL,NULL,NULL,NULL,NULL}, + {"target", 0, 1, Nsf_ConvertToTclobj, NULL,NULL,"tclobj",NULL,NULL,NULL,NULL,NULL}, + {"args", 0, 1, ConvertToNothing, NULL,NULL,"args",NULL,NULL,NULL,NULL,NULL}} }, {"::nsf::method::property", NsfMethodPropertyCmdStub, 5, { - {"object", NSF_ARG_REQUIRED, 1, Nsf_ConvertToObject, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}, - {"-per-object", 0, 0, Nsf_ConvertToString, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}, - {"methodName", NSF_ARG_REQUIRED, 1, Nsf_ConvertToTclobj, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}, - {"methodproperty", NSF_ARG_REQUIRED|NSF_ARG_IS_ENUMERATION, 1, ConvertToMethodproperty, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}, - {"value", 0, 1, Nsf_ConvertToTclobj, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}} + {"object", NSF_ARG_REQUIRED, 1, Nsf_ConvertToObject, NULL,NULL,"object",NULL,NULL,NULL,NULL,NULL}, + {"-per-object", 0, 0, Nsf_ConvertToString, NULL,NULL,"",NULL,NULL,NULL,NULL,NULL}, + {"methodName", NSF_ARG_REQUIRED, 1, Nsf_ConvertToTclobj, NULL,NULL,"tclobj",NULL,NULL,NULL,NULL,NULL}, + {"methodproperty", NSF_ARG_REQUIRED|NSF_ARG_IS_ENUMERATION, 1, ConvertToMethodproperty, NULL,NULL,"class-only|call-protected|redefine-protected|returns|slotcontainer|slotobj",NULL,NULL,NULL,NULL,NULL}, + {"value", 0, 1, Nsf_ConvertToTclobj, NULL,NULL,"tclobj",NULL,NULL,NULL,NULL,NULL}} }, {"::nsf::method::registered", NsfMethodRegisteredCmdStub, 1, { - {"handle", NSF_ARG_REQUIRED, 1, Nsf_ConvertToTclobj, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}} + {"handle", NSF_ARG_REQUIRED, 1, Nsf_ConvertToTclobj, NULL,NULL,"tclobj",NULL,NULL,NULL,NULL,NULL}} }, {"::nsf::method::setter", NsfMethodSetterCmdStub, 3, { - {"object", NSF_ARG_REQUIRED, 1, Nsf_ConvertToObject, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}, - {"-per-object", 0, 0, Nsf_ConvertToString, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}, - {"parameter", NSF_ARG_REQUIRED, 1, Nsf_ConvertToTclobj, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}} + {"object", NSF_ARG_REQUIRED, 1, Nsf_ConvertToObject, NULL,NULL,"object",NULL,NULL,NULL,NULL,NULL}, + {"-per-object", 0, 0, Nsf_ConvertToString, NULL,NULL,"",NULL,NULL,NULL,NULL,NULL}, + {"parameter", NSF_ARG_REQUIRED, 1, Nsf_ConvertToTclobj, NULL,NULL,"tclobj",NULL,NULL,NULL,NULL,NULL}} }, {"::nsf::my", NsfMyCmdStub, 3, { - {"-local", 0, 0, Nsf_ConvertToString, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}, - {"methodName", NSF_ARG_REQUIRED, 1, Nsf_ConvertToTclobj, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}, - {"args", 0, 1, ConvertToNothing, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}} + {"-local", 0, 0, Nsf_ConvertToString, NULL,NULL,"",NULL,NULL,NULL,NULL,NULL}, + {"methodName", NSF_ARG_REQUIRED, 1, Nsf_ConvertToTclobj, NULL,NULL,"tclobj",NULL,NULL,NULL,NULL,NULL}, + {"args", 0, 1, ConvertToNothing, NULL,NULL,"args",NULL,NULL,NULL,NULL,NULL}} }, {"::nsf::nscopycmds", NsfNSCopyCmdsCmdStub, 2, { - {"fromNs", NSF_ARG_REQUIRED, 1, Nsf_ConvertToTclobj, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}, - {"toNs", NSF_ARG_REQUIRED, 1, Nsf_ConvertToTclobj, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}} + {"fromNs", NSF_ARG_REQUIRED, 1, Nsf_ConvertToTclobj, NULL,NULL,"tclobj",NULL,NULL,NULL,NULL,NULL}, + {"toNs", NSF_ARG_REQUIRED, 1, Nsf_ConvertToTclobj, NULL,NULL,"tclobj",NULL,NULL,NULL,NULL,NULL}} }, {"::nsf::nscopyvars", NsfNSCopyVarsCmdStub, 2, { - {"fromNs", NSF_ARG_REQUIRED, 1, Nsf_ConvertToTclobj, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}, - {"toNs", NSF_ARG_REQUIRED, 1, Nsf_ConvertToTclobj, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}} + {"fromNs", NSF_ARG_REQUIRED, 1, Nsf_ConvertToTclobj, NULL,NULL,"tclobj",NULL,NULL,NULL,NULL,NULL}, + {"toNs", NSF_ARG_REQUIRED, 1, Nsf_ConvertToTclobj, NULL,NULL,"tclobj",NULL,NULL,NULL,NULL,NULL}} }, {"::nsf::next", NsfNextCmdStub, 1, { - {"arguments", 0, 1, Nsf_ConvertToTclobj, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}} + {"arguments", 0, 1, Nsf_ConvertToTclobj, NULL,NULL,"tclobj",NULL,NULL,NULL,NULL,NULL}} }, {"::nsf::object::exists", NsfObjectExistsCmdStub, 1, { - {"value", NSF_ARG_REQUIRED, 1, Nsf_ConvertToTclobj, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}} + {"value", NSF_ARG_REQUIRED, 1, Nsf_ConvertToTclobj, NULL,NULL,"tclobj",NULL,NULL,NULL,NULL,NULL}} }, {"::nsf::object::initialized", NsfObjectInitializedCmdStub, 1, { - {"objectName", NSF_ARG_REQUIRED, 1, Nsf_ConvertToObject, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}} + {"objectName", NSF_ARG_REQUIRED, 1, Nsf_ConvertToObject, NULL,NULL,"object",NULL,NULL,NULL,NULL,NULL}} }, {"::nsf::object::qualify", NsfObjectQualifyCmdStub, 1, { - {"objectName", NSF_ARG_REQUIRED, 1, Nsf_ConvertToTclobj, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}} + {"objectName", NSF_ARG_REQUIRED, 1, Nsf_ConvertToTclobj, NULL,NULL,"tclobj",NULL,NULL,NULL,NULL,NULL}} }, {"::nsf::proc", NsfProcCmdStub, 4, { - {"-ad", 0, 0, Nsf_ConvertToString, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}, - {"procName", NSF_ARG_REQUIRED, 1, Nsf_ConvertToTclobj, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}, - {"arguments", NSF_ARG_REQUIRED, 1, Nsf_ConvertToTclobj, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}, - {"body", NSF_ARG_REQUIRED, 1, Nsf_ConvertToTclobj, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}} + {"-ad", 0, 0, Nsf_ConvertToString, NULL,NULL,"",NULL,NULL,NULL,NULL,NULL}, + {"procName", NSF_ARG_REQUIRED, 1, Nsf_ConvertToTclobj, NULL,NULL,"tclobj",NULL,NULL,NULL,NULL,NULL}, + {"arguments", NSF_ARG_REQUIRED, 1, Nsf_ConvertToTclobj, NULL,NULL,"tclobj",NULL,NULL,NULL,NULL,NULL}, + {"body", NSF_ARG_REQUIRED, 1, Nsf_ConvertToTclobj, NULL,NULL,"tclobj",NULL,NULL,NULL,NULL,NULL}} }, {"::nsf::__profile_clear", NsfProfileClearDataStubStub, 0, { {NULL, 0, 0, NULL, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}} @@ -2531,9 +2531,9 @@ {NULL, 0, 0, NULL, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}} }, {"::nsf::relation", NsfRelationCmdStub, 3, { - {"object", NSF_ARG_REQUIRED, 1, Nsf_ConvertToObject, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}, - {"relationtype", NSF_ARG_REQUIRED|NSF_ARG_IS_ENUMERATION, 1, ConvertToRelationtype, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}, - {"value", 0, 1, Nsf_ConvertToTclobj, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}} + {"object", NSF_ARG_REQUIRED, 1, Nsf_ConvertToObject, NULL,NULL,"object",NULL,NULL,NULL,NULL,NULL}, + {"relationtype", NSF_ARG_REQUIRED|NSF_ARG_IS_ENUMERATION, 1, ConvertToRelationtype, NULL,NULL,"object-mixin|class-mixin|object-filter|class-filter|class|superclass|rootclass",NULL,NULL,NULL,NULL,NULL}, + {"value", 0, 1, Nsf_ConvertToTclobj, NULL,NULL,"tclobj",NULL,NULL,NULL,NULL,NULL}} }, {"::nsf::self", NsfSelfCmdStub, 0, { {NULL, 0, 0, NULL, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}} @@ -2545,52 +2545,52 @@ {NULL, 0, 0, NULL, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}} }, {"::nsf::var::exists", NsfVarExistsCmdStub, 2, { - {"object", NSF_ARG_REQUIRED, 1, Nsf_ConvertToObject, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}, - {"varName", NSF_ARG_REQUIRED, 1, Nsf_ConvertToString, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}} + {"object", NSF_ARG_REQUIRED, 1, Nsf_ConvertToObject, NULL,NULL,"object",NULL,NULL,NULL,NULL,NULL}, + {"varName", NSF_ARG_REQUIRED, 1, Nsf_ConvertToString, NULL,NULL,"",NULL,NULL,NULL,NULL,NULL}} }, {"::nsf::var::import", NsfVarImportCmdStub, 2, { - {"object", NSF_ARG_REQUIRED, 1, Nsf_ConvertToObject, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}, - {"args", 0, 1, ConvertToNothing, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}} + {"object", NSF_ARG_REQUIRED, 1, Nsf_ConvertToObject, NULL,NULL,"object",NULL,NULL,NULL,NULL,NULL}, + {"args", 0, 1, ConvertToNothing, NULL,NULL,"args",NULL,NULL,NULL,NULL,NULL}} }, {"::nsf::var::set", NsfVarSetCmdStub, 3, { - {"object", NSF_ARG_REQUIRED, 1, Nsf_ConvertToObject, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}, - {"varName", NSF_ARG_REQUIRED, 1, Nsf_ConvertToTclobj, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}, - {"value", 0, 1, Nsf_ConvertToTclobj, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}} + {"object", NSF_ARG_REQUIRED, 1, Nsf_ConvertToObject, NULL,NULL,"object",NULL,NULL,NULL,NULL,NULL}, + {"varName", NSF_ARG_REQUIRED, 1, Nsf_ConvertToTclobj, NULL,NULL,"tclobj",NULL,NULL,NULL,NULL,NULL}, + {"value", 0, 1, Nsf_ConvertToTclobj, NULL,NULL,"tclobj",NULL,NULL,NULL,NULL,NULL}} }, {"::nsf::var::unset", NsfVarUnsetCmdStub, 2, { - {"object", NSF_ARG_REQUIRED, 1, Nsf_ConvertToObject, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}, - {"varName", NSF_ARG_REQUIRED, 1, Nsf_ConvertToTclobj, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}} + {"object", NSF_ARG_REQUIRED, 1, Nsf_ConvertToObject, NULL,NULL,"object",NULL,NULL,NULL,NULL,NULL}, + {"varName", NSF_ARG_REQUIRED, 1, Nsf_ConvertToTclobj, NULL,NULL,"tclobj",NULL,NULL,NULL,NULL,NULL}} }, {"::nsf::methods::object::autoname", NsfOAutonameMethodStub, 3, { - {"-instance", 0, 0, Nsf_ConvertToString, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}, - {"-reset", 0, 0, Nsf_ConvertToString, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}, - {"name", NSF_ARG_REQUIRED, 1, Nsf_ConvertToTclobj, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}} + {"-instance", 0, 0, Nsf_ConvertToString, NULL,NULL,"",NULL,NULL,NULL,NULL,NULL}, + {"-reset", 0, 0, Nsf_ConvertToString, NULL,NULL,"",NULL,NULL,NULL,NULL,NULL}, + {"name", NSF_ARG_REQUIRED, 1, Nsf_ConvertToTclobj, NULL,NULL,"tclobj",NULL,NULL,NULL,NULL,NULL}} }, {"::nsf::methods::object::class", NsfOClassMethodStub, 1, { - {"class", 0, 1, Nsf_ConvertToTclobj, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}} + {"class", 0, 1, Nsf_ConvertToTclobj, NULL,NULL,"tclobj",NULL,NULL,NULL,NULL,NULL}} }, {"::nsf::methods::object::cleanup", NsfOCleanupMethodStub, 0, { {NULL, 0, 0, NULL, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}} }, {"::nsf::methods::object::configure", NsfOConfigureMethodStub, 1, { - {"args", 0, 1, ConvertToNothing, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}} + {"args", 0, 1, ConvertToNothing, NULL,NULL,"allargs",NULL,NULL,NULL,NULL,NULL}} }, {"::nsf::methods::object::destroy", NsfODestroyMethodStub, 0, { {NULL, 0, 0, NULL, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}} }, {"::nsf::methods::object::exists", NsfOExistsMethodStub, 1, { - {"varName", NSF_ARG_REQUIRED, 1, Nsf_ConvertToString, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}} + {"varName", NSF_ARG_REQUIRED, 1, Nsf_ConvertToString, NULL,NULL,"",NULL,NULL,NULL,NULL,NULL}} }, {"::nsf::methods::object::filterguard", NsfOFilterGuardMethodStub, 2, { - {"filter", NSF_ARG_REQUIRED, 1, Nsf_ConvertToString, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}, - {"guard", NSF_ARG_REQUIRED, 1, Nsf_ConvertToTclobj, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}} + {"filter", NSF_ARG_REQUIRED, 1, Nsf_ConvertToString, NULL,NULL,"",NULL,NULL,NULL,NULL,NULL}, + {"guard", NSF_ARG_REQUIRED, 1, Nsf_ConvertToTclobj, NULL,NULL,"tclobj",NULL,NULL,NULL,NULL,NULL}} }, {"::nsf::methods::object::instvar", NsfOInstvarMethodStub, 1, { - {"args", 0, 1, ConvertToNothing, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}} + {"args", 0, 1, ConvertToNothing, NULL,NULL,"allargs",NULL,NULL,NULL,NULL,NULL}} }, {"::nsf::methods::object::mixinguard", NsfOMixinGuardMethodStub, 2, { - {"mixin", NSF_ARG_REQUIRED, 1, Nsf_ConvertToTclobj, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}, - {"guard", NSF_ARG_REQUIRED, 1, Nsf_ConvertToTclobj, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}} + {"mixin", NSF_ARG_REQUIRED, 1, Nsf_ConvertToTclobj, NULL,NULL,"tclobj",NULL,NULL,NULL,NULL,NULL}, + {"guard", NSF_ARG_REQUIRED, 1, Nsf_ConvertToTclobj, NULL,NULL,"tclobj",NULL,NULL,NULL,NULL,NULL}} }, {"::nsf::methods::object::noinit", NsfONoinitMethodStub, 0, { {NULL, 0, 0, NULL, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}} @@ -2599,99 +2599,99 @@ {NULL, 0, 0, NULL, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}} }, {"::nsf::methods::object::residualargs", NsfOResidualargsMethodStub, 1, { - {"args", 0, 1, ConvertToNothing, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}} + {"args", 0, 1, ConvertToNothing, NULL,NULL,"allargs",NULL,NULL,NULL,NULL,NULL}} }, {"::nsf::methods::object::uplevel", NsfOUplevelMethodStub, 1, { - {"args", 0, 1, ConvertToNothing, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}} + {"args", 0, 1, ConvertToNothing, NULL,NULL,"allargs",NULL,NULL,NULL,NULL,NULL}} }, {"::nsf::methods::object::upvar", NsfOUpvarMethodStub, 1, { - {"args", 0, 1, ConvertToNothing, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}} + {"args", 0, 1, ConvertToNothing, NULL,NULL,"allargs",NULL,NULL,NULL,NULL,NULL}} }, {"::nsf::methods::object::volatile", NsfOVolatileMethodStub, 0, { {NULL, 0, 0, NULL, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}} }, {"::nsf::methods::object::info::children", NsfObjInfoChildrenMethodStub, 2, { - {"-type", 0, 1, Nsf_ConvertToClass, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}, - {"pattern", 0, 1, Nsf_ConvertToString, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}} + {"-type", 0, 1, Nsf_ConvertToClass, NULL,NULL,"class",NULL,NULL,NULL,NULL,NULL}, + {"pattern", 0, 1, Nsf_ConvertToString, NULL,NULL,"",NULL,NULL,NULL,NULL,NULL}} }, {"::nsf::methods::object::info::class", NsfObjInfoClassMethodStub, 0, { {NULL, 0, 0, NULL, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}} }, {"::nsf::methods::object::info::filterguard", NsfObjInfoFilterguardMethodStub, 1, { - {"fileName", NSF_ARG_REQUIRED, 1, Nsf_ConvertToString, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}} + {"fileName", NSF_ARG_REQUIRED, 1, Nsf_ConvertToString, NULL,NULL,"",NULL,NULL,NULL,NULL,NULL}} }, {"::nsf::methods::object::info::filtermethods", NsfObjInfoFiltermethodsMethodStub, 3, { - {"-guards", 0, 0, Nsf_ConvertToString, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}, - {"-order", 0, 0, Nsf_ConvertToString, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}, - {"pattern", 0, 1, Nsf_ConvertToString, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}} + {"-guards", 0, 0, Nsf_ConvertToString, NULL,NULL,"",NULL,NULL,NULL,NULL,NULL}, + {"-order", 0, 0, Nsf_ConvertToString, NULL,NULL,"",NULL,NULL,NULL,NULL,NULL}, + {"pattern", 0, 1, Nsf_ConvertToString, NULL,NULL,"",NULL,NULL,NULL,NULL,NULL}} }, {"::nsf::methods::object::info::forward", NsfObjInfoForwardMethodStub, 2, { - {"-definition", 0, 0, Nsf_ConvertToString, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}, - {"name", 0, 1, Nsf_ConvertToString, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}} + {"-definition", 0, 0, Nsf_ConvertToString, NULL,NULL,"",NULL,NULL,NULL,NULL,NULL}, + {"name", 0, 1, Nsf_ConvertToString, NULL,NULL,"",NULL,NULL,NULL,NULL,NULL}} }, {"::nsf::methods::object::info::hasmixin", NsfObjInfoHasMixinMethodStub, 1, { - {"class", NSF_ARG_REQUIRED, 1, Nsf_ConvertToClass, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}} + {"class", NSF_ARG_REQUIRED, 1, Nsf_ConvertToClass, NULL,NULL,"class",NULL,NULL,NULL,NULL,NULL}} }, {"::nsf::methods::object::info::hastype", NsfObjInfoHasTypeMethodStub, 1, { - {"class", NSF_ARG_REQUIRED, 1, Nsf_ConvertToClass, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}} + {"class", NSF_ARG_REQUIRED, 1, Nsf_ConvertToClass, NULL,NULL,"class",NULL,NULL,NULL,NULL,NULL}} }, {"::nsf::methods::object::info::hasnamespace", NsfObjInfoHasnamespaceMethodStub, 0, { {NULL, 0, 0, NULL, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}} }, {"::nsf::methods::object::info::is", NsfObjInfoIsMethodStub, 1, { - {"objectkind", NSF_ARG_REQUIRED|NSF_ARG_IS_ENUMERATION, 1, ConvertToObjectkind, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}} + {"objectkind", NSF_ARG_REQUIRED|NSF_ARG_IS_ENUMERATION, 1, ConvertToObjectkind, NULL,NULL,"class|baseclass|metaclass",NULL,NULL,NULL,NULL,NULL}} }, {"::nsf::methods::object::info::lookupfilter", NsfObjInfoLookupFilterMethodStub, 1, { - {"filter", NSF_ARG_REQUIRED, 1, Nsf_ConvertToString, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}} + {"filter", NSF_ARG_REQUIRED, 1, Nsf_ConvertToString, NULL,NULL,"",NULL,NULL,NULL,NULL,NULL}} }, {"::nsf::methods::object::info::lookupmethod", NsfObjInfoLookupMethodMethodStub, 1, { - {"name", NSF_ARG_REQUIRED, 1, Nsf_ConvertToTclobj, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}} + {"name", NSF_ARG_REQUIRED, 1, Nsf_ConvertToTclobj, NULL,NULL,"tclobj",NULL,NULL,NULL,NULL,NULL}} }, {"::nsf::methods::object::info::lookupmethods", NsfObjInfoLookupMethodsMethodStub, 7, { - {"-callprotection", 0|NSF_ARG_IS_ENUMERATION, 1, ConvertToCallprotection, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}, - {"-incontext", 0, 0, Nsf_ConvertToString, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}, - {"-methodtype", 0|NSF_ARG_IS_ENUMERATION, 1, ConvertToMethodtype, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}, - {"-nomixins", 0, 0, Nsf_ConvertToString, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}, - {"-path", 0, 0, Nsf_ConvertToString, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}, - {"-source", 0|NSF_ARG_IS_ENUMERATION, 1, ConvertToSource, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}, - {"pattern", 0, 1, Nsf_ConvertToString, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}} + {"-callprotection", 0|NSF_ARG_IS_ENUMERATION, 1, ConvertToCallprotection, NULL,NULL,"all|protected|public",NULL,NULL,NULL,NULL,NULL}, + {"-incontext", 0, 0, Nsf_ConvertToString, NULL,NULL,"",NULL,NULL,NULL,NULL,NULL}, + {"-methodtype", 0|NSF_ARG_IS_ENUMERATION, 1, ConvertToMethodtype, NULL,NULL,"all|scripted|builtin|alias|forwarder|object|setter",NULL,NULL,NULL,NULL,NULL}, + {"-nomixins", 0, 0, Nsf_ConvertToString, NULL,NULL,"",NULL,NULL,NULL,NULL,NULL}, + {"-path", 0, 0, Nsf_ConvertToString, NULL,NULL,"",NULL,NULL,NULL,NULL,NULL}, + {"-source", 0|NSF_ARG_IS_ENUMERATION, 1, ConvertToSource, NULL,NULL,"all|application|baseclasses",NULL,NULL,NULL,NULL,NULL}, + {"pattern", 0, 1, Nsf_ConvertToString, NULL,NULL,"",NULL,NULL,NULL,NULL,NULL}} }, {"::nsf::methods::object::info::lookupslots", NsfObjInfoLookupSlotsMethodStub, 3, { - {"-source", 0|NSF_ARG_IS_ENUMERATION, 1, ConvertToSource, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}, - {"-type", 0, 1, Nsf_ConvertToClass, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}, - {"pattern", 0, 1, Nsf_ConvertToString, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}} + {"-source", 0|NSF_ARG_IS_ENUMERATION, 1, ConvertToSource, NULL,NULL,"all|application|baseclasses",NULL,NULL,NULL,NULL,NULL}, + {"-type", 0, 1, Nsf_ConvertToClass, NULL,NULL,"class",NULL,NULL,NULL,NULL,NULL}, + {"pattern", 0, 1, Nsf_ConvertToString, NULL,NULL,"",NULL,NULL,NULL,NULL,NULL}} }, {"::nsf::methods::object::info::method", NsfObjInfoMethodMethodStub, 2, { - {"infomethodsubcmd", 0|NSF_ARG_IS_ENUMERATION, 1, ConvertToInfomethodsubcmd, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}, - {"name", NSF_ARG_REQUIRED, 1, Nsf_ConvertToTclobj, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}} + {"infomethodsubcmd", 0|NSF_ARG_IS_ENUMERATION, 1, ConvertToInfomethodsubcmd, NULL,NULL,"args|body|definition|exists|handle|parameter|parametersyntax|type|precondition|postcondition|submethods",NULL,NULL,NULL,NULL,NULL}, + {"name", NSF_ARG_REQUIRED, 1, Nsf_ConvertToTclobj, NULL,NULL,"tclobj",NULL,NULL,NULL,NULL,NULL}} }, {"::nsf::methods::object::info::methods", NsfObjInfoMethodsMethodStub, 4, { - {"-callprotection", 0|NSF_ARG_IS_ENUMERATION, 1, ConvertToCallprotection, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}, - {"-methodtype", 0|NSF_ARG_IS_ENUMERATION, 1, ConvertToMethodtype, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}, - {"-path", 0, 0, Nsf_ConvertToString, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}, - {"pattern", 0, 1, Nsf_ConvertToString, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}} + {"-callprotection", 0|NSF_ARG_IS_ENUMERATION, 1, ConvertToCallprotection, NULL,NULL,"all|protected|public",NULL,NULL,NULL,NULL,NULL}, + {"-methodtype", 0|NSF_ARG_IS_ENUMERATION, 1, ConvertToMethodtype, NULL,NULL,"all|scripted|builtin|alias|forwarder|object|setter|nsfproc",NULL,NULL,NULL,NULL,NULL}, + {"-path", 0, 0, Nsf_ConvertToString, NULL,NULL,"",NULL,NULL,NULL,NULL,NULL}, + {"pattern", 0, 1, Nsf_ConvertToString, NULL,NULL,"",NULL,NULL,NULL,NULL,NULL}} }, {"::nsf::methods::object::info::mixinclasses", NsfObjInfoMixinclassesMethodStub, 3, { - {"-guards", 0, 0, Nsf_ConvertToString, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}, - {"-heritage", 0, 0, Nsf_ConvertToString, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}, - {"pattern", 0, 1, ConvertToObjpattern, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}} + {"-guards", 0, 0, Nsf_ConvertToString, NULL,NULL,"",NULL,NULL,NULL,NULL,NULL}, + {"-heritage", 0, 0, Nsf_ConvertToString, NULL,NULL,"",NULL,NULL,NULL,NULL,NULL}, + {"pattern", 0, 1, ConvertToObjpattern, NULL,NULL,"objpattern",NULL,NULL,NULL,NULL,NULL}} }, {"::nsf::methods::object::info::mixinguard", NsfObjInfoMixinguardMethodStub, 1, { - {"mixin", NSF_ARG_REQUIRED, 1, Nsf_ConvertToString, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}} + {"mixin", NSF_ARG_REQUIRED, 1, Nsf_ConvertToString, NULL,NULL,"",NULL,NULL,NULL,NULL,NULL}} }, {"::nsf::methods::object::info::parent", NsfObjInfoParentMethodStub, 0, { {NULL, 0, 0, NULL, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}} }, {"::nsf::methods::object::info::precedence", NsfObjInfoPrecedenceMethodStub, 2, { - {"-intrinsic", 0, 0, Nsf_ConvertToString, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}, - {"pattern", 0, 1, Nsf_ConvertToString, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}} + {"-intrinsic", 0, 0, Nsf_ConvertToString, NULL,NULL,"",NULL,NULL,NULL,NULL,NULL}, + {"pattern", 0, 1, Nsf_ConvertToString, NULL,NULL,"",NULL,NULL,NULL,NULL,NULL}} }, {"::nsf::methods::object::info::slots", NsfObjInfoSlotsMethodStub, 2, { - {"-type", 0, 1, Nsf_ConvertToClass, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}, - {"pattern", 0, 1, Nsf_ConvertToString, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}} + {"-type", 0, 1, Nsf_ConvertToClass, NULL,NULL,"class",NULL,NULL,NULL,NULL,NULL}, + {"pattern", 0, 1, Nsf_ConvertToString, NULL,NULL,"",NULL,NULL,NULL,NULL,NULL}} }, {"::nsf::methods::object::info::vars", NsfObjInfoVarsMethodStub, 1, { - {"pattern", 0, 1, Nsf_ConvertToString, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}} + {"pattern", 0, 1, Nsf_ConvertToString, NULL,NULL,"",NULL,NULL,NULL,NULL,NULL}} },{NULL} }; Index: generic/nsfPointer.c =================================================================== diff -u --- generic/nsfPointer.c (revision 0) +++ generic/nsfPointer.c (revision 17ba2f1d86be4afd497d652b7ee39a5edc771a22) @@ -0,0 +1,327 @@ +/* + * + * Next Scripting Framework + * + * Copyright (C) 1999-2010 Gustaf Neumann, Uwe Zdun + * + * + * nsfPointer.c -- + * + * C-level converter to opaque structures + * + */ + +#include "nsfInt.h" + +static Tcl_HashTable pointerHashTable, *pointerHashTablePtr = &pointerHashTable; +static NsfMutex pointerMutex = 0; + +/* + *---------------------------------------------------------------------- + * + * Nsf_PointerAdd -- + * + * Add an entry to our locally maintained hash table and set its + * value to the provided valuePtr. The keys are generated based on + * the passed type and the counter obtained from the type + * registration. + * + * Results: + * Tcl result code + * + * Side effects: + * None. + * + *---------------------------------------------------------------------- + */ +int +Nsf_PointerAdd(Tcl_Interp *interp, char *buffer, CONST char *typeName, void *valuePtr) { + Tcl_HashEntry *hPtr; + int isNew, *counterPtr; + Tcl_DString ds, *dsPtr = &ds; + + counterPtr = Nsf_PointerTypeLookup(interp, typeName); + if (counterPtr) { + Tcl_DStringInit(dsPtr); + Tcl_DStringAppend(dsPtr, typeName, -1); + Tcl_DStringAppend(dsPtr, ":%d", 3); + NsfMutexLock(&pointerMutex); + sprintf(buffer, Tcl_DStringValue(dsPtr), (*counterPtr)++); + hPtr = Tcl_CreateHashEntry(pointerHashTablePtr, buffer, &isNew); + NsfMutexUnlock(&pointerMutex); + Tcl_SetHashValue(hPtr, valuePtr); + Tcl_DStringFree(dsPtr); + } else { + return NsfPrintError(interp, "no type converter for %s registered", typeName); + } + return TCL_OK; +} + + +/* + *---------------------------------------------------------------------- + * + * Nsf_PointerGet -- + * + * Get an entry to our locally maintained hash table and make sure + * that the prefix matches (this ensures that the right type of + * entry is obtained). If the prefix does not match, or there is no + * such entry in the table, the function returns NULL. + * + * Results: + * valuePtr or NULL. + * + * Side effects: + * None. + * + *---------------------------------------------------------------------- + */ +static void * +Nsf_PointerGet(char *key, CONST char *prefix) { + Tcl_HashEntry *hPtr; + void *valuePtr = NULL; + + /* make sure to return the right type of hash entry */ + if (strncmp(prefix, key, strlen(prefix)) == 0) { + + NsfMutexLock(&pointerMutex); + hPtr = Tcl_CreateHashEntry(pointerHashTablePtr, key, NULL); + + if (hPtr) { + valuePtr = Tcl_GetHashValue(hPtr); + } + NsfMutexUnlock(&pointerMutex); + } + return valuePtr; +} + +/* + *---------------------------------------------------------------------- + * + * Nsf_PointerGetHptr -- + * + * Find for a pointer the associated key. The current (static) + * implementaiton is quite slow in case there are a high number of + * pointer values registered (which should not be the case for the + * current usage patterns). It could certainly be improved by a + * second hash table. The function should be run under a callers + * mutex. + * + * Results: + * key or NULL. + * + * Side effects: + * None. + * + *---------------------------------------------------------------------- + */ +static char * +Nsf_PointerGetHptr(void *valuePtr) { + Tcl_HashEntry *hPtr; + Tcl_HashSearch hSrch; + + for (hPtr = Tcl_FirstHashEntry(pointerHashTablePtr, &hSrch); hPtr; + hPtr = Tcl_NextHashEntry(&hSrch)) { + void *ptr = Tcl_GetHashValue(hPtr); + if (ptr == valuePtr) { + return hPtr; + } + } + return NULL; +} + +/* + *---------------------------------------------------------------------- + * + * Nsf_PointerDelete -- + * + * Delete an hash entry from our locally maintained hash table + * free the associated memory, if valuePtr is provided. + * + * Results: + * valuePtr or NULL. + * + * Side effects: + * None. + * + *---------------------------------------------------------------------- + */ +int +Nsf_PointerDelete(void *valuePtr) { + Tcl_HashEntry *hPtr; + int result; + + NsfMutexLock(&pointerMutex); + + hPtr = Nsf_PointerGetHptr(valuePtr); + if (hPtr) { + ckfree((char *)valuePtr); + Tcl_DeleteHashEntry(hPtr); + result = TCL_OK; + } else { + result = TCL_ERROR; + } + + NsfMutexUnlock(&pointerMutex); + return result; +} + + +/* + *---------------------------------------------------------------------- + * Nsf_ConvertToPointer -- + * + * Nsf_TypeConverter setting the client data (passed to C functions) + * to the valuePtr of the opaque structure. This nsf type converter + * checks the passed value via the internally maintained pointer hash + * table. + * + * Results: + * Tcl result code, *clientData and **outObjPtr + * + * Side effects: + * None. + * + *---------------------------------------------------------------------- + */ + +int +Nsf_ConvertToPointer(Tcl_Interp *interp, Tcl_Obj *objPtr, Nsf_Param CONST *pPtr, + ClientData *clientData, Tcl_Obj **outObjPtr) { + void *valuePtr; + + *outObjPtr = objPtr; + valuePtr = Nsf_PointerGet(ObjStr(objPtr), pPtr->type); + if (valuePtr) { + *clientData = valuePtr; + return TCL_OK; + } + return NsfObjErrType(interp, NULL, objPtr, pPtr->type, (Nsf_Param *)pPtr); +} + +/* + *---------------------------------------------------------------------- + * Nsf_PointerTypeRegister -- + * + * Register a pointer type which is identified by the type string + * + * Results: + * Tcl result code. + * + * Side effects: + * None. + * + *---------------------------------------------------------------------- + */ + +int +Nsf_PointerTypeRegister(Tcl_Interp *interp, CONST char* typeName, int *counterPtr) { + Tcl_HashEntry *hPtr; + int isNew; + + NsfMutexLock(&pointerMutex); + hPtr = Tcl_CreateHashEntry(pointerHashTablePtr, typeName, &isNew); + NsfMutexUnlock(&pointerMutex); + + if (isNew) { + Tcl_SetHashValue(hPtr, counterPtr); + return TCL_OK; + } else { + return NsfPrintError(interp, "type converter %s is already registered", typeName); + } +} + +/* + *---------------------------------------------------------------------- + * Nsf_PointerTypeLookup -- + * + * Lookup of type name. If the type name is registed, return the + * converter or NULL otherwise. + * + * Results: + * TypeConverter on success or NULL + * + * Side effects: + * None. + * + *---------------------------------------------------------------------- + */ + +void * +Nsf_PointerTypeLookup(Tcl_Interp *interp, CONST char* typeName) { + Tcl_HashEntry *hPtr; + int isNew; + + NsfMutexLock(&pointerMutex); + hPtr = Tcl_CreateHashEntry(pointerHashTablePtr, typeName, &isNew); + NsfMutexUnlock(&pointerMutex); + + if (hPtr) { + return Tcl_GetHashValue(hPtr); + } + return NULL; +} + +/* + *---------------------------------------------------------------------- + * Nsf_PointerInit -- + * + * Initialize the Pointer converter + * + * Results: + * void + * + * Side effects: + * None. + * + *---------------------------------------------------------------------- + */ + +void +Nsf_PointerInit(Tcl_Interp *interp) { + + NsfMutexLock(&pointerMutex); + Tcl_InitHashTable(pointerHashTablePtr, TCL_STRING_KEYS); + NsfMutexUnlock(&pointerMutex); + +} + +/* + *---------------------------------------------------------------------- + * Nsf_PointerExit -- + * + * Exit handler fr the Pointer converter + * + * Results: + * void + * + * Side effects: + * None. + * + *---------------------------------------------------------------------- + */ + +void +Nsf_PointerExit(Tcl_Interp *interp) { + Tcl_HashEntry *hPtr; + Tcl_HashSearch hSrch; + + NsfMutexLock(&pointerMutex); + for (hPtr = Tcl_FirstHashEntry(pointerHashTablePtr, &hSrch); hPtr; + hPtr = Tcl_NextHashEntry(&hSrch)) { + char *key = Tcl_GetHashKey(pointerHashTablePtr, hPtr); + void *valuePtr = Tcl_GetHashValue(hPtr); + + fprintf(stderr, "Nsf_PointerExit: we have still an entry %s with value %p\n", key, valuePtr); + } + Tcl_DeleteHashTable(pointerHashTablePtr); + NsfMutexUnlock(&pointerMutex); +} + +/* + * Local Variables: + * mode: c + * c-basic-offset: 2 + * fill-column: 72 + * End: + */ Index: generic/nsfUtil.c =================================================================== diff -u -rbd4aa15282abe386464ef276b78f2708f249f333 -r17ba2f1d86be4afd497d652b7ee39a5edc771a22 --- generic/nsfUtil.c (.../nsfUtil.c) (revision bd4aa15282abe386464ef276b78f2708f249f333) +++ generic/nsfUtil.c (.../nsfUtil.c) (revision 17ba2f1d86be4afd497d652b7ee39a5edc771a22) @@ -208,13 +208,3 @@ ckfree(iss->buffer); } - - - -/* - * Local Variables: - * mode: c - * c-basic-offset: 2 - * fill-column: 78 - * End: - */ Index: library/mongodb/mongoAPI.decls =================================================================== diff -u -rdf67ed7db2b0cda881c4a9e704379a2a02d415b6 -r17ba2f1d86be4afd497d652b7ee39a5edc771a22 --- library/mongodb/mongoAPI.decls (.../mongoAPI.decls) (revision df67ed7db2b0cda881c4a9e704379a2a02d415b6) +++ library/mongodb/mongoAPI.decls (.../mongoAPI.decls) (revision 17ba2f1d86be4afd497d652b7ee39a5edc771a22) @@ -7,37 +7,43 @@ array set ns { cmd "::mongo" } +array set ptrConverter { + mongo_connection 1 + gridfs 1 + gridfile 1 +} + cmd close NsfMongoClose { - {-argName "conn" -required 1 -type tclobj} + {-argName "conn" -required 1 -type mongo_connection} } cmd connect NsfMongoConnect { {-argName "-replica-set" -required 0 -nrargs 1} {-argName "-server" -required 0 -nrargs 1 -type tclobj} } cmd count NsfMongoCount { - {-argName "conn" -required 1 -type tclobj} + {-argName "conn" -required 1 -type mongo_connection} {-argName "namespace" -required 1} {-argName "query" -required 1 -type tclobj} } cmd index NsfMongoIndex { - {-argName "conn" -required 1 -type tclobj} + {-argName "conn" -required 1 -type mongo_connection} {-argName "namespace" -required 1} {-argName "attributes" -required 1 -type tclobj} {-argName "-dropdups" -required 0 -nrargs 0} {-argName "-unique" -required 0 -nrargs 0} } cmd insert NsfMongoInsert { - {-argName "conn" -required 1 -type tclobj} + {-argName "conn" -required 1 -type mongo_connection} {-argName "namespace" -required 1} {-argName "values" -required 1 -type tclobj} } cmd query NsfMongoQuery { - {-argName "conn" -required 1 -type tclobj} + {-argName "conn" -required 1 -type mongo_connection} {-argName "namespace" -required 1} {-argName "query" -required 1 -type tclobj} {-argName "-atts" -required 0 -nrargs 1 -type tclobj} @@ -46,13 +52,13 @@ } cmd remove NsfMongoRemove { - {-argName "conn" -required 1 -type tclobj} + {-argName "conn" -required 1 -type mongo_connection} {-argName "namespace" -required 1} {-argName "condition" -required 1 -type tclobj} } cmd update NsfMongoUpdate { - {-argName "conn" -required 1 -type tclobj} + {-argName "conn" -required 1 -type mongo_connection} {-argName "namespace" -required 1} {-argName "cond" -required 1 -type tclobj} {-argName "values" -required 1 -type tclobj} @@ -64,49 +70,49 @@ # GridFS # cmd gridfs::open NsfMongoGridFSOpen { - {-argName "conn" -required 1 -type tclobj} + {-argName "conn" -required 1 -type mongo_connection} {-argName "dbname" -required 1} {-argName "prefix" -required 1} } cmd gridfs::store_file NsfMongoGridFSStoreFile { - {-argName "gfs" -required 1 -type tclobj} + {-argName "gfs" -required 1 -type gridfs} {-argName "filename" -required 1} {-argName "remotename" -required 1} {-argName "contenttype" -required 1} } cmd gridfs::remove_file NsfMongoGridFSRemoveFile { - {-argName "gfs" -required 1 -type tclobj} + {-argName "gfs" -required 1 -type gridfs} {-argName "filename" -required 1} } cmd gridfs::close NsfMongoGridFSClose { - {-argName "gfs" -required 1 -type tclobj} + {-argName "gfs" -required 1 -type gridfs} } # # GridFile # cmd gridfile::close NsfMongoGridFileClose { - {-argName "gridfile" -required 1 -type tclobj} + {-argName "file" -required 1 -type gridfile} } cmd gridfile::get_contentlength NsfMongoGridFileGetContentlength { - {-argName "gridfile" -required 1 -type tclobj} + {-argName "file" -required 1 -type gridfile} } cmd gridfile::get_contenttype NsfMongoGridFileGetContentType { - {-argName "gridfile" -required 1 -type tclobj} + {-argName "file" -required 1 -type gridfile} } cmd gridfile::get_metadata NsfMongoGridFileGetMetaData { - {-argName "gridfile" -required 1 -type tclobj} + {-argName "file" -required 1 -type gridfile} } cmd gridfile::open NsfMongoGridFileOpen { - {-argName "gfs" -required 1 -type tclobj} + {-argName "fs" -required 1 -type gridfs} {-argName "filename" -required 1} } cmd gridfile::read NsfMongoGridFileRead { - {-argName "gridfile" -required 1 -type tclobj} + {-argName "file" -required 1 -type gridfile} {-argName "size" -required 1 -type int32} } Index: library/mongodb/mongoAPI.h =================================================================== diff -u -rdf67ed7db2b0cda881c4a9e704379a2a02d415b6 -r17ba2f1d86be4afd497d652b7ee39a5edc771a22 --- library/mongodb/mongoAPI.h (.../mongoAPI.h) (revision df67ed7db2b0cda881c4a9e704379a2a02d415b6) +++ library/mongodb/mongoAPI.h (.../mongoAPI.h) (revision 17ba2f1d86be4afd497d652b7ee39a5edc771a22) @@ -25,24 +25,24 @@ static int NsfMongoRemoveStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv []); static int NsfMongoUpdateStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv []); -static int NsfMongoClose(Tcl_Interp *interp, Tcl_Obj *conn); +static int NsfMongoClose(Tcl_Interp *interp, mongo_connection *mongo_connectionPtr); static int NsfMongoConnect(Tcl_Interp *interp, CONST char *withReplica_set, Tcl_Obj *withServer); -static int NsfMongoCount(Tcl_Interp *interp, Tcl_Obj *conn, CONST char *namespace, Tcl_Obj *query); -static int NsfMongoGridFSClose(Tcl_Interp *interp, Tcl_Obj *gfs); -static int NsfMongoGridFSOpen(Tcl_Interp *interp, Tcl_Obj *conn, CONST char *dbname, CONST char *prefix); -static int NsfMongoGridFSRemoveFile(Tcl_Interp *interp, Tcl_Obj *gfs, CONST char *filename); -static int NsfMongoGridFSStoreFile(Tcl_Interp *interp, Tcl_Obj *gfs, CONST char *filename, CONST char *remotename, CONST char *contenttype); -static int NsfMongoGridFileClose(Tcl_Interp *interp, Tcl_Obj *gridfile); -static int NsfMongoGridFileGetContentType(Tcl_Interp *interp, Tcl_Obj *gridfile); -static int NsfMongoGridFileGetContentlength(Tcl_Interp *interp, Tcl_Obj *gridfile); -static int NsfMongoGridFileGetMetaData(Tcl_Interp *interp, Tcl_Obj *gridfile); -static int NsfMongoGridFileOpen(Tcl_Interp *interp, Tcl_Obj *gfs, CONST char *filename); -static int NsfMongoGridFileRead(Tcl_Interp *interp, Tcl_Obj *gridfile, int size); -static int NsfMongoIndex(Tcl_Interp *interp, Tcl_Obj *conn, CONST char *namespace, Tcl_Obj *attributes, int withDropdups, int withUnique); -static int NsfMongoInsert(Tcl_Interp *interp, Tcl_Obj *conn, CONST char *namespace, Tcl_Obj *values); -static int NsfMongoQuery(Tcl_Interp *interp, Tcl_Obj *conn, CONST char *namespace, Tcl_Obj *query, Tcl_Obj *withAtts, int withLimit, int withSkip); -static int NsfMongoRemove(Tcl_Interp *interp, Tcl_Obj *conn, CONST char *namespace, Tcl_Obj *condition); -static int NsfMongoUpdate(Tcl_Interp *interp, Tcl_Obj *conn, CONST char *namespace, Tcl_Obj *cond, Tcl_Obj *values, int withUpsert, int withAll); +static int NsfMongoCount(Tcl_Interp *interp, mongo_connection *mongo_connectionPtr, CONST char *namespace, Tcl_Obj *query); +static int NsfMongoGridFSClose(Tcl_Interp *interp, gridfs *gridfsPtr); +static int NsfMongoGridFSOpen(Tcl_Interp *interp, mongo_connection *mongo_connectionPtr, CONST char *dbname, CONST char *prefix); +static int NsfMongoGridFSRemoveFile(Tcl_Interp *interp, gridfs *gridfsPtr, CONST char *filename); +static int NsfMongoGridFSStoreFile(Tcl_Interp *interp, gridfs *gridfsPtr, CONST char *filename, CONST char *remotename, CONST char *contenttype); +static int NsfMongoGridFileClose(Tcl_Interp *interp, gridfile *gridfilePtr); +static int NsfMongoGridFileGetContentType(Tcl_Interp *interp, gridfile *gridfilePtr); +static int NsfMongoGridFileGetContentlength(Tcl_Interp *interp, gridfile *gridfilePtr); +static int NsfMongoGridFileGetMetaData(Tcl_Interp *interp, gridfile *gridfilePtr); +static int NsfMongoGridFileOpen(Tcl_Interp *interp, gridfs *gridfsPtr, CONST char *filename); +static int NsfMongoGridFileRead(Tcl_Interp *interp, gridfile *gridfilePtr, int size); +static int NsfMongoIndex(Tcl_Interp *interp, mongo_connection *mongo_connectionPtr, CONST char *namespace, Tcl_Obj *attributes, int withDropdups, int withUnique); +static int NsfMongoInsert(Tcl_Interp *interp, mongo_connection *mongo_connectionPtr, CONST char *namespace, Tcl_Obj *values); +static int NsfMongoQuery(Tcl_Interp *interp, mongo_connection *mongo_connectionPtr, CONST char *namespace, Tcl_Obj *query, Tcl_Obj *withAtts, int withLimit, int withSkip); +static int NsfMongoRemove(Tcl_Interp *interp, mongo_connection *mongo_connectionPtr, CONST char *namespace, Tcl_Obj *condition); +static int NsfMongoUpdate(Tcl_Interp *interp, mongo_connection *mongo_connectionPtr, CONST char *namespace, Tcl_Obj *cond, Tcl_Obj *values, int withUpsert, int withAll); enum { NsfMongoCloseIdx, @@ -68,18 +68,21 @@ static int NsfMongoCloseStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) { + ParseContext pc; (void)clientData; - + if (ArgumentParse(interp, objc, objv, NULL, objv[0], + method_definitions[NsfMongoCloseIdx].paramDefs, + method_definitions[NsfMongoCloseIdx].nrParameters, 1, + &pc) != TCL_OK) { + return TCL_ERROR; + } else { + mongo_connection *mongo_connectionPtr = (mongo_connection *)pc.clientData[0]; - if (objc != 2) { - return NsfArgumentError(interp, "wrong # of arguments:", - method_definitions[NsfMongoCloseIdx].paramDefs, - NULL, objv[0]); - } - - return NsfMongoClose(interp, objc == 2 ? objv[1] : NULL); + assert(pc.status == 0); + return NsfMongoClose(interp, mongo_connectionPtr); + } } static int @@ -113,30 +116,33 @@ &pc) != TCL_OK) { return TCL_ERROR; } else { - Tcl_Obj *conn = (Tcl_Obj *)pc.clientData[0]; + mongo_connection *mongo_connectionPtr = (mongo_connection *)pc.clientData[0]; CONST char *namespace = (CONST char *)pc.clientData[1]; Tcl_Obj *query = (Tcl_Obj *)pc.clientData[2]; assert(pc.status == 0); - return NsfMongoCount(interp, conn, namespace, query); + return NsfMongoCount(interp, mongo_connectionPtr, namespace, query); } } static int NsfMongoGridFSCloseStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) { + ParseContext pc; (void)clientData; - + if (ArgumentParse(interp, objc, objv, NULL, objv[0], + method_definitions[NsfMongoGridFSCloseIdx].paramDefs, + method_definitions[NsfMongoGridFSCloseIdx].nrParameters, 1, + &pc) != TCL_OK) { + return TCL_ERROR; + } else { + gridfs *gridfsPtr = (gridfs *)pc.clientData[0]; - if (objc != 2) { - return NsfArgumentError(interp, "wrong # of arguments:", - method_definitions[NsfMongoGridFSCloseIdx].paramDefs, - NULL, objv[0]); - } - - return NsfMongoGridFSClose(interp, objc == 2 ? objv[1] : NULL); + assert(pc.status == 0); + return NsfMongoGridFSClose(interp, gridfsPtr); + } } static int @@ -150,12 +156,12 @@ &pc) != TCL_OK) { return TCL_ERROR; } else { - Tcl_Obj *conn = (Tcl_Obj *)pc.clientData[0]; + mongo_connection *mongo_connectionPtr = (mongo_connection *)pc.clientData[0]; CONST char *dbname = (CONST char *)pc.clientData[1]; CONST char *prefix = (CONST char *)pc.clientData[2]; assert(pc.status == 0); - return NsfMongoGridFSOpen(interp, conn, dbname, prefix); + return NsfMongoGridFSOpen(interp, mongo_connectionPtr, dbname, prefix); } } @@ -171,11 +177,11 @@ &pc) != TCL_OK) { return TCL_ERROR; } else { - Tcl_Obj *gfs = (Tcl_Obj *)pc.clientData[0]; + gridfs *gridfsPtr = (gridfs *)pc.clientData[0]; CONST char *filename = (CONST char *)pc.clientData[1]; assert(pc.status == 0); - return NsfMongoGridFSRemoveFile(interp, gfs, filename); + return NsfMongoGridFSRemoveFile(interp, gridfsPtr, filename); } } @@ -191,79 +197,91 @@ &pc) != TCL_OK) { return TCL_ERROR; } else { - Tcl_Obj *gfs = (Tcl_Obj *)pc.clientData[0]; + gridfs *gridfsPtr = (gridfs *)pc.clientData[0]; CONST char *filename = (CONST char *)pc.clientData[1]; CONST char *remotename = (CONST char *)pc.clientData[2]; CONST char *contenttype = (CONST char *)pc.clientData[3]; assert(pc.status == 0); - return NsfMongoGridFSStoreFile(interp, gfs, filename, remotename, contenttype); + return NsfMongoGridFSStoreFile(interp, gridfsPtr, filename, remotename, contenttype); } } static int NsfMongoGridFileCloseStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) { + ParseContext pc; (void)clientData; - + if (ArgumentParse(interp, objc, objv, NULL, objv[0], + method_definitions[NsfMongoGridFileCloseIdx].paramDefs, + method_definitions[NsfMongoGridFileCloseIdx].nrParameters, 1, + &pc) != TCL_OK) { + return TCL_ERROR; + } else { + gridfile *gridfilePtr = (gridfile *)pc.clientData[0]; - if (objc != 2) { - return NsfArgumentError(interp, "wrong # of arguments:", - method_definitions[NsfMongoGridFileCloseIdx].paramDefs, - NULL, objv[0]); - } - - return NsfMongoGridFileClose(interp, objc == 2 ? objv[1] : NULL); + assert(pc.status == 0); + return NsfMongoGridFileClose(interp, gridfilePtr); + } } static int NsfMongoGridFileGetContentTypeStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) { + ParseContext pc; (void)clientData; - + if (ArgumentParse(interp, objc, objv, NULL, objv[0], + method_definitions[NsfMongoGridFileGetContentTypeIdx].paramDefs, + method_definitions[NsfMongoGridFileGetContentTypeIdx].nrParameters, 1, + &pc) != TCL_OK) { + return TCL_ERROR; + } else { + gridfile *gridfilePtr = (gridfile *)pc.clientData[0]; - if (objc != 2) { - return NsfArgumentError(interp, "wrong # of arguments:", - method_definitions[NsfMongoGridFileGetContentTypeIdx].paramDefs, - NULL, objv[0]); - } - - return NsfMongoGridFileGetContentType(interp, objc == 2 ? objv[1] : NULL); + assert(pc.status == 0); + return NsfMongoGridFileGetContentType(interp, gridfilePtr); + } } static int NsfMongoGridFileGetContentlengthStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) { + ParseContext pc; (void)clientData; - + if (ArgumentParse(interp, objc, objv, NULL, objv[0], + method_definitions[NsfMongoGridFileGetContentlengthIdx].paramDefs, + method_definitions[NsfMongoGridFileGetContentlengthIdx].nrParameters, 1, + &pc) != TCL_OK) { + return TCL_ERROR; + } else { + gridfile *gridfilePtr = (gridfile *)pc.clientData[0]; - if (objc != 2) { - return NsfArgumentError(interp, "wrong # of arguments:", - method_definitions[NsfMongoGridFileGetContentlengthIdx].paramDefs, - NULL, objv[0]); - } - - return NsfMongoGridFileGetContentlength(interp, objc == 2 ? objv[1] : NULL); + assert(pc.status == 0); + return NsfMongoGridFileGetContentlength(interp, gridfilePtr); + } } static int NsfMongoGridFileGetMetaDataStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) { + ParseContext pc; (void)clientData; - + if (ArgumentParse(interp, objc, objv, NULL, objv[0], + method_definitions[NsfMongoGridFileGetMetaDataIdx].paramDefs, + method_definitions[NsfMongoGridFileGetMetaDataIdx].nrParameters, 1, + &pc) != TCL_OK) { + return TCL_ERROR; + } else { + gridfile *gridfilePtr = (gridfile *)pc.clientData[0]; - if (objc != 2) { - return NsfArgumentError(interp, "wrong # of arguments:", - method_definitions[NsfMongoGridFileGetMetaDataIdx].paramDefs, - NULL, objv[0]); - } - - return NsfMongoGridFileGetMetaData(interp, objc == 2 ? objv[1] : NULL); + assert(pc.status == 0); + return NsfMongoGridFileGetMetaData(interp, gridfilePtr); + } } static int @@ -277,11 +295,11 @@ &pc) != TCL_OK) { return TCL_ERROR; } else { - Tcl_Obj *gfs = (Tcl_Obj *)pc.clientData[0]; + gridfs *gridfsPtr = (gridfs *)pc.clientData[0]; CONST char *filename = (CONST char *)pc.clientData[1]; assert(pc.status == 0); - return NsfMongoGridFileOpen(interp, gfs, filename); + return NsfMongoGridFileOpen(interp, gridfsPtr, filename); } } @@ -297,11 +315,11 @@ &pc) != TCL_OK) { return TCL_ERROR; } else { - Tcl_Obj *gridfile = (Tcl_Obj *)pc.clientData[0]; + gridfile *gridfilePtr = (gridfile *)pc.clientData[0]; int size = (int )PTR2INT(pc.clientData[1]); assert(pc.status == 0); - return NsfMongoGridFileRead(interp, gridfile, size); + return NsfMongoGridFileRead(interp, gridfilePtr, size); } } @@ -317,14 +335,14 @@ &pc) != TCL_OK) { return TCL_ERROR; } else { - Tcl_Obj *conn = (Tcl_Obj *)pc.clientData[0]; + mongo_connection *mongo_connectionPtr = (mongo_connection *)pc.clientData[0]; CONST char *namespace = (CONST char *)pc.clientData[1]; Tcl_Obj *attributes = (Tcl_Obj *)pc.clientData[2]; int withDropdups = (int )PTR2INT(pc.clientData[3]); int withUnique = (int )PTR2INT(pc.clientData[4]); assert(pc.status == 0); - return NsfMongoIndex(interp, conn, namespace, attributes, withDropdups, withUnique); + return NsfMongoIndex(interp, mongo_connectionPtr, namespace, attributes, withDropdups, withUnique); } } @@ -340,12 +358,12 @@ &pc) != TCL_OK) { return TCL_ERROR; } else { - Tcl_Obj *conn = (Tcl_Obj *)pc.clientData[0]; + mongo_connection *mongo_connectionPtr = (mongo_connection *)pc.clientData[0]; CONST char *namespace = (CONST char *)pc.clientData[1]; Tcl_Obj *values = (Tcl_Obj *)pc.clientData[2]; assert(pc.status == 0); - return NsfMongoInsert(interp, conn, namespace, values); + return NsfMongoInsert(interp, mongo_connectionPtr, namespace, values); } } @@ -361,15 +379,15 @@ &pc) != TCL_OK) { return TCL_ERROR; } else { - Tcl_Obj *conn = (Tcl_Obj *)pc.clientData[0]; + mongo_connection *mongo_connectionPtr = (mongo_connection *)pc.clientData[0]; CONST char *namespace = (CONST char *)pc.clientData[1]; Tcl_Obj *query = (Tcl_Obj *)pc.clientData[2]; Tcl_Obj *withAtts = (Tcl_Obj *)pc.clientData[3]; int withLimit = (int )PTR2INT(pc.clientData[4]); int withSkip = (int )PTR2INT(pc.clientData[5]); assert(pc.status == 0); - return NsfMongoQuery(interp, conn, namespace, query, withAtts, withLimit, withSkip); + return NsfMongoQuery(interp, mongo_connectionPtr, namespace, query, withAtts, withLimit, withSkip); } } @@ -385,12 +403,12 @@ &pc) != TCL_OK) { return TCL_ERROR; } else { - Tcl_Obj *conn = (Tcl_Obj *)pc.clientData[0]; + mongo_connection *mongo_connectionPtr = (mongo_connection *)pc.clientData[0]; CONST char *namespace = (CONST char *)pc.clientData[1]; Tcl_Obj *condition = (Tcl_Obj *)pc.clientData[2]; assert(pc.status == 0); - return NsfMongoRemove(interp, conn, namespace, condition); + return NsfMongoRemove(interp, mongo_connectionPtr, namespace, condition); } } @@ -406,102 +424,102 @@ &pc) != TCL_OK) { return TCL_ERROR; } else { - Tcl_Obj *conn = (Tcl_Obj *)pc.clientData[0]; + mongo_connection *mongo_connectionPtr = (mongo_connection *)pc.clientData[0]; CONST char *namespace = (CONST char *)pc.clientData[1]; Tcl_Obj *cond = (Tcl_Obj *)pc.clientData[2]; Tcl_Obj *values = (Tcl_Obj *)pc.clientData[3]; int withUpsert = (int )PTR2INT(pc.clientData[4]); int withAll = (int )PTR2INT(pc.clientData[5]); assert(pc.status == 0); - return NsfMongoUpdate(interp, conn, namespace, cond, values, withUpsert, withAll); + return NsfMongoUpdate(interp, mongo_connectionPtr, namespace, cond, values, withUpsert, withAll); } } static Nsf_methodDefinition method_definitions[] = { {"::mongo::close", NsfMongoCloseStub, 1, { - {"conn", NSF_ARG_REQUIRED, 1, Nsf_ConvertToTclobj, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}} + {"conn", NSF_ARG_REQUIRED, 1, Nsf_ConvertToPointer, NULL,NULL,"mongo_connection",NULL,NULL,NULL,NULL,NULL}} }, {"::mongo::connect", NsfMongoConnectStub, 2, { - {"-replica-set", 0, 1, Nsf_ConvertToString, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}, - {"-server", 0, 1, Nsf_ConvertToTclobj, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}} + {"-replica-set", 0, 1, Nsf_ConvertToString, NULL,NULL,"",NULL,NULL,NULL,NULL,NULL}, + {"-server", 0, 1, Nsf_ConvertToTclobj, NULL,NULL,"tclobj",NULL,NULL,NULL,NULL,NULL}} }, {"::mongo::count", NsfMongoCountStub, 3, { - {"conn", NSF_ARG_REQUIRED, 1, Nsf_ConvertToTclobj, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}, - {"namespace", NSF_ARG_REQUIRED, 1, Nsf_ConvertToString, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}, - {"query", NSF_ARG_REQUIRED, 1, Nsf_ConvertToTclobj, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}} + {"conn", NSF_ARG_REQUIRED, 1, Nsf_ConvertToPointer, NULL,NULL,"mongo_connection",NULL,NULL,NULL,NULL,NULL}, + {"namespace", NSF_ARG_REQUIRED, 1, Nsf_ConvertToString, NULL,NULL,"",NULL,NULL,NULL,NULL,NULL}, + {"query", NSF_ARG_REQUIRED, 1, Nsf_ConvertToTclobj, NULL,NULL,"tclobj",NULL,NULL,NULL,NULL,NULL}} }, {"::mongo::gridfs::close", NsfMongoGridFSCloseStub, 1, { - {"gfs", NSF_ARG_REQUIRED, 1, Nsf_ConvertToTclobj, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}} + {"gfs", NSF_ARG_REQUIRED, 1, Nsf_ConvertToPointer, NULL,NULL,"gridfs",NULL,NULL,NULL,NULL,NULL}} }, {"::mongo::gridfs::open", NsfMongoGridFSOpenStub, 3, { - {"conn", NSF_ARG_REQUIRED, 1, Nsf_ConvertToTclobj, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}, - {"dbname", NSF_ARG_REQUIRED, 1, Nsf_ConvertToString, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}, - {"prefix", NSF_ARG_REQUIRED, 1, Nsf_ConvertToString, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}} + {"conn", NSF_ARG_REQUIRED, 1, Nsf_ConvertToPointer, NULL,NULL,"mongo_connection",NULL,NULL,NULL,NULL,NULL}, + {"dbname", NSF_ARG_REQUIRED, 1, Nsf_ConvertToString, NULL,NULL,"",NULL,NULL,NULL,NULL,NULL}, + {"prefix", NSF_ARG_REQUIRED, 1, Nsf_ConvertToString, NULL,NULL,"",NULL,NULL,NULL,NULL,NULL}} }, {"::mongo::gridfs::remove_file", NsfMongoGridFSRemoveFileStub, 2, { - {"gfs", NSF_ARG_REQUIRED, 1, Nsf_ConvertToTclobj, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}, - {"filename", NSF_ARG_REQUIRED, 1, Nsf_ConvertToString, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}} + {"gfs", NSF_ARG_REQUIRED, 1, Nsf_ConvertToPointer, NULL,NULL,"gridfs",NULL,NULL,NULL,NULL,NULL}, + {"filename", NSF_ARG_REQUIRED, 1, Nsf_ConvertToString, NULL,NULL,"",NULL,NULL,NULL,NULL,NULL}} }, {"::mongo::gridfs::store_file", NsfMongoGridFSStoreFileStub, 4, { - {"gfs", NSF_ARG_REQUIRED, 1, Nsf_ConvertToTclobj, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}, - {"filename", NSF_ARG_REQUIRED, 1, Nsf_ConvertToString, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}, - {"remotename", NSF_ARG_REQUIRED, 1, Nsf_ConvertToString, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}, - {"contenttype", NSF_ARG_REQUIRED, 1, Nsf_ConvertToString, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}} + {"gfs", NSF_ARG_REQUIRED, 1, Nsf_ConvertToPointer, NULL,NULL,"gridfs",NULL,NULL,NULL,NULL,NULL}, + {"filename", NSF_ARG_REQUIRED, 1, Nsf_ConvertToString, NULL,NULL,"",NULL,NULL,NULL,NULL,NULL}, + {"remotename", NSF_ARG_REQUIRED, 1, Nsf_ConvertToString, NULL,NULL,"",NULL,NULL,NULL,NULL,NULL}, + {"contenttype", NSF_ARG_REQUIRED, 1, Nsf_ConvertToString, NULL,NULL,"",NULL,NULL,NULL,NULL,NULL}} }, {"::mongo::gridfile::close", NsfMongoGridFileCloseStub, 1, { - {"gridfile", NSF_ARG_REQUIRED, 1, Nsf_ConvertToTclobj, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}} + {"file", NSF_ARG_REQUIRED, 1, Nsf_ConvertToPointer, NULL,NULL,"gridfile",NULL,NULL,NULL,NULL,NULL}} }, {"::mongo::gridfile::get_contenttype", NsfMongoGridFileGetContentTypeStub, 1, { - {"gridfile", NSF_ARG_REQUIRED, 1, Nsf_ConvertToTclobj, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}} + {"file", NSF_ARG_REQUIRED, 1, Nsf_ConvertToPointer, NULL,NULL,"gridfile",NULL,NULL,NULL,NULL,NULL}} }, {"::mongo::gridfile::get_contentlength", NsfMongoGridFileGetContentlengthStub, 1, { - {"gridfile", NSF_ARG_REQUIRED, 1, Nsf_ConvertToTclobj, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}} + {"file", NSF_ARG_REQUIRED, 1, Nsf_ConvertToPointer, NULL,NULL,"gridfile",NULL,NULL,NULL,NULL,NULL}} }, {"::mongo::gridfile::get_metadata", NsfMongoGridFileGetMetaDataStub, 1, { - {"gridfile", NSF_ARG_REQUIRED, 1, Nsf_ConvertToTclobj, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}} + {"file", NSF_ARG_REQUIRED, 1, Nsf_ConvertToPointer, NULL,NULL,"gridfile",NULL,NULL,NULL,NULL,NULL}} }, {"::mongo::gridfile::open", NsfMongoGridFileOpenStub, 2, { - {"gfs", NSF_ARG_REQUIRED, 1, Nsf_ConvertToTclobj, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}, - {"filename", NSF_ARG_REQUIRED, 1, Nsf_ConvertToString, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}} + {"fs", NSF_ARG_REQUIRED, 1, Nsf_ConvertToPointer, NULL,NULL,"gridfs",NULL,NULL,NULL,NULL,NULL}, + {"filename", NSF_ARG_REQUIRED, 1, Nsf_ConvertToString, NULL,NULL,"",NULL,NULL,NULL,NULL,NULL}} }, {"::mongo::gridfile::read", NsfMongoGridFileReadStub, 2, { - {"gridfile", NSF_ARG_REQUIRED, 1, Nsf_ConvertToTclobj, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}, - {"size", NSF_ARG_REQUIRED, 1, Nsf_ConvertToInt32, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}} + {"file", NSF_ARG_REQUIRED, 1, Nsf_ConvertToPointer, NULL,NULL,"gridfile",NULL,NULL,NULL,NULL,NULL}, + {"size", NSF_ARG_REQUIRED, 1, Nsf_ConvertToInt32, NULL,NULL,"int32",NULL,NULL,NULL,NULL,NULL}} }, {"::mongo::index", NsfMongoIndexStub, 5, { - {"conn", NSF_ARG_REQUIRED, 1, Nsf_ConvertToTclobj, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}, - {"namespace", NSF_ARG_REQUIRED, 1, Nsf_ConvertToString, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}, - {"attributes", NSF_ARG_REQUIRED, 1, Nsf_ConvertToTclobj, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}, - {"-dropdups", 0, 0, Nsf_ConvertToString, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}, - {"-unique", 0, 0, Nsf_ConvertToString, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}} + {"conn", NSF_ARG_REQUIRED, 1, Nsf_ConvertToPointer, NULL,NULL,"mongo_connection",NULL,NULL,NULL,NULL,NULL}, + {"namespace", NSF_ARG_REQUIRED, 1, Nsf_ConvertToString, NULL,NULL,"",NULL,NULL,NULL,NULL,NULL}, + {"attributes", NSF_ARG_REQUIRED, 1, Nsf_ConvertToTclobj, NULL,NULL,"tclobj",NULL,NULL,NULL,NULL,NULL}, + {"-dropdups", 0, 0, Nsf_ConvertToString, NULL,NULL,"",NULL,NULL,NULL,NULL,NULL}, + {"-unique", 0, 0, Nsf_ConvertToString, NULL,NULL,"",NULL,NULL,NULL,NULL,NULL}} }, {"::mongo::insert", NsfMongoInsertStub, 3, { - {"conn", NSF_ARG_REQUIRED, 1, Nsf_ConvertToTclobj, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}, - {"namespace", NSF_ARG_REQUIRED, 1, Nsf_ConvertToString, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}, - {"values", NSF_ARG_REQUIRED, 1, Nsf_ConvertToTclobj, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}} + {"conn", NSF_ARG_REQUIRED, 1, Nsf_ConvertToPointer, NULL,NULL,"mongo_connection",NULL,NULL,NULL,NULL,NULL}, + {"namespace", NSF_ARG_REQUIRED, 1, Nsf_ConvertToString, NULL,NULL,"",NULL,NULL,NULL,NULL,NULL}, + {"values", NSF_ARG_REQUIRED, 1, Nsf_ConvertToTclobj, NULL,NULL,"tclobj",NULL,NULL,NULL,NULL,NULL}} }, {"::mongo::query", NsfMongoQueryStub, 6, { - {"conn", NSF_ARG_REQUIRED, 1, Nsf_ConvertToTclobj, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}, - {"namespace", NSF_ARG_REQUIRED, 1, Nsf_ConvertToString, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}, - {"query", NSF_ARG_REQUIRED, 1, Nsf_ConvertToTclobj, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}, - {"-atts", 0, 1, Nsf_ConvertToTclobj, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}, - {"-limit", 0, 1, Nsf_ConvertToInt32, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}, - {"-skip", 0, 1, Nsf_ConvertToInt32, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}} + {"conn", NSF_ARG_REQUIRED, 1, Nsf_ConvertToPointer, NULL,NULL,"mongo_connection",NULL,NULL,NULL,NULL,NULL}, + {"namespace", NSF_ARG_REQUIRED, 1, Nsf_ConvertToString, NULL,NULL,"",NULL,NULL,NULL,NULL,NULL}, + {"query", NSF_ARG_REQUIRED, 1, Nsf_ConvertToTclobj, NULL,NULL,"tclobj",NULL,NULL,NULL,NULL,NULL}, + {"-atts", 0, 1, Nsf_ConvertToTclobj, NULL,NULL,"tclobj",NULL,NULL,NULL,NULL,NULL}, + {"-limit", 0, 1, Nsf_ConvertToInt32, NULL,NULL,"int32",NULL,NULL,NULL,NULL,NULL}, + {"-skip", 0, 1, Nsf_ConvertToInt32, NULL,NULL,"int32",NULL,NULL,NULL,NULL,NULL}} }, {"::mongo::remove", NsfMongoRemoveStub, 3, { - {"conn", NSF_ARG_REQUIRED, 1, Nsf_ConvertToTclobj, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}, - {"namespace", NSF_ARG_REQUIRED, 1, Nsf_ConvertToString, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}, - {"condition", NSF_ARG_REQUIRED, 1, Nsf_ConvertToTclobj, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}} + {"conn", NSF_ARG_REQUIRED, 1, Nsf_ConvertToPointer, NULL,NULL,"mongo_connection",NULL,NULL,NULL,NULL,NULL}, + {"namespace", NSF_ARG_REQUIRED, 1, Nsf_ConvertToString, NULL,NULL,"",NULL,NULL,NULL,NULL,NULL}, + {"condition", NSF_ARG_REQUIRED, 1, Nsf_ConvertToTclobj, NULL,NULL,"tclobj",NULL,NULL,NULL,NULL,NULL}} }, {"::mongo::update", NsfMongoUpdateStub, 6, { - {"conn", NSF_ARG_REQUIRED, 1, Nsf_ConvertToTclobj, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}, - {"namespace", NSF_ARG_REQUIRED, 1, Nsf_ConvertToString, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}, - {"cond", NSF_ARG_REQUIRED, 1, Nsf_ConvertToTclobj, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}, - {"values", NSF_ARG_REQUIRED, 1, Nsf_ConvertToTclobj, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}, - {"-upsert", 0, 0, Nsf_ConvertToString, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}, - {"-all", 0, 0, Nsf_ConvertToString, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}} + {"conn", NSF_ARG_REQUIRED, 1, Nsf_ConvertToPointer, NULL,NULL,"mongo_connection",NULL,NULL,NULL,NULL,NULL}, + {"namespace", NSF_ARG_REQUIRED, 1, Nsf_ConvertToString, NULL,NULL,"",NULL,NULL,NULL,NULL,NULL}, + {"cond", NSF_ARG_REQUIRED, 1, Nsf_ConvertToTclobj, NULL,NULL,"tclobj",NULL,NULL,NULL,NULL,NULL}, + {"values", NSF_ARG_REQUIRED, 1, Nsf_ConvertToTclobj, NULL,NULL,"tclobj",NULL,NULL,NULL,NULL,NULL}, + {"-upsert", 0, 0, Nsf_ConvertToString, NULL,NULL,"",NULL,NULL,NULL,NULL,NULL}, + {"-all", 0, 0, Nsf_ConvertToString, NULL,NULL,"",NULL,NULL,NULL,NULL,NULL}} },{NULL} }; Index: library/mongodb/nsfmongo.c =================================================================== diff -u -rdf67ed7db2b0cda881c4a9e704379a2a02d415b6 -r17ba2f1d86be4afd497d652b7ee39a5edc771a22 --- library/mongodb/nsfmongo.c (.../nsfmongo.c) (revision df67ed7db2b0cda881c4a9e704379a2a02d415b6) +++ library/mongodb/nsfmongo.c (.../nsfmongo.c) (revision 17ba2f1d86be4afd497d652b7ee39a5edc771a22) @@ -25,11 +25,12 @@ #include #include -static Tcl_HashTable mongoHashTable, *mongoHashTablePtr = &mongoHashTable; -static NsfMutex mongoMutex = 0; -static int mongoConns = 0; -static int mongoGridFSCount = 0; -static int mongoGridFileCount = 0; +/* + * Define the counters to generate nice symbols for pointer converter + */ +static int gridfsCount = 0; +static int gridfileCount = 0; +static int mongo_connectionCount = 0; /*********************************************************************** * The following definitions should not be here, but they are included @@ -114,104 +115,6 @@ /* *---------------------------------------------------------------------- * - * MongoHashAdd -- - * - * Add an entry to our locally maintained hash table and set its - * value to the provided valuePtr. The keys are generated based - * on the passed formatString and counter. - * - * Results: - * Void. - * - * Side effects: - * None. - * - *---------------------------------------------------------------------- - */ -static void -MongoHashAdd(char *buffer, CONST char *formatString, int *counterPtr, void *valuePtr) { - Tcl_HashEntry *hPtr; - int isNew; - - NsfMutexLock(&mongoMutex); - sprintf(buffer, formatString, (*counterPtr)++); - hPtr = Tcl_CreateHashEntry(mongoHashTablePtr, buffer, &isNew); - NsfMutexUnlock(&mongoMutex); - Tcl_SetHashValue(hPtr, valuePtr); -} - - -/* - *---------------------------------------------------------------------- - * - * MongoHashGet -- - * - * Get an entry to our locally maintained hash table and make - * sure that the prefix matches (this ensures that the right type - * of entry is obtained). If the prefix does not match, or there - * is no such entry in the table, the function returns NULL. - * - * Results: - * valuePtr or NULL. - * - * Side effects: - * None. - * - *---------------------------------------------------------------------- - */ -static void * -MongoHashGet(char *key, char *prefix) { - Tcl_HashEntry *hPtr; - void *valuePtr = NULL; - - /* make sure to return the right type of hash entry */ - if (strncmp(prefix, key, strlen(prefix)) == 0) { - - NsfMutexLock(&mongoMutex); - hPtr = Tcl_CreateHashEntry(mongoHashTablePtr, key, NULL); - - if (hPtr) { - valuePtr = Tcl_GetHashValue(hPtr); - } - NsfMutexUnlock(&mongoMutex); - } - return valuePtr; -} - -/* - *---------------------------------------------------------------------- - * - * MongoHashDelete -- - * - * Delete an hash entry from our locally maintained hash table - * free the associated memory, if valuePtr is provided. - * - * Results: - * valuePtr or NULL. - * - * Side effects: - * None. - * - *---------------------------------------------------------------------- - */ -static void -MongoHashDelete(CONST char *key, void *valuePtr) { - Tcl_HashEntry *hPtr; - - if (valuePtr) { - ckfree((char *)valuePtr); - } - - NsfMutexLock(&mongoMutex); - hPtr = Tcl_CreateHashEntry(mongoHashTablePtr, key, NULL); - assert(hPtr); - Tcl_DeleteHashEntry(hPtr); - NsfMutexUnlock(&mongoMutex); -} - -/* - *---------------------------------------------------------------------- - * * BsonToList -- * * Convert a bson structure to a tagged list. Each value field is @@ -558,16 +461,15 @@ /* cmd close NsfMongoClose { - {-argName "conn" -required 1 -type tclobj} + {-argName "conn" -required 1 -type mongo_connection} } */ static int -NsfMongoClose(Tcl_Interp *interp, Tcl_Obj *connObj) { - mongo_connection *connPtr = MongoHashGet(ObjStr(connObj), "mongo_conn"); +NsfMongoClose(Tcl_Interp *interp, mongo_connection *connPtr) { if (connPtr) { mongo_destroy(connPtr); - MongoHashDelete(ObjStr(connObj), connPtr); + Nsf_PointerDelete(connPtr); } return TCL_OK; } @@ -656,32 +558,27 @@ return NsfPrintError(interp, errorMsg); } - MongoHashAdd(channelName, "mongo_conn%d", &mongoConns, connPtr); + Nsf_PointerAdd(interp, channelName, "mongo_connection", connPtr); Tcl_SetObjResult(interp, Tcl_NewStringObj(channelName, -1)); return TCL_OK; } /* cmd query NsfMongoCount { - {-argName "conn" -required 1 -type tclobj} + {-argName "conn" -required 1 -type mongo_connection} {-argName "namespace" -required 1} {-argName "query" -required 1 -type tclobj} } */ static int -NsfMongoCount(Tcl_Interp *interp, Tcl_Obj *connObj, CONST char *namespace, Tcl_Obj *queryObj) { +NsfMongoCount(Tcl_Interp *interp, mongo_connection *connPtr, CONST char *namespace, Tcl_Obj *queryObj) { int objc, result; Tcl_Obj **objv; - mongo_connection *connPtr = MongoHashGet(ObjStr(connObj), "mongo_conn"); char *db, *collection; int count, length; bson query[1]; - if (connPtr == NULL) { - return NsfObjErrType(interp, "", connObj, "connection", NULL); - } - result = Tcl_ListObjGetElements(interp, queryObj, &objc, &objv); if (result != TCL_OK || (objc % 3 != 0)) { return NsfPrintError(interp, "%s: must contain a multiple of 3 elements", ObjStr(queryObj)); @@ -714,25 +611,21 @@ /* cmd index NsfMongoIndex { - {-argName "conn" -required 1 -type tclobj} + {-argName "conn" -required 1 -type mongo_connection} {-argName "namespace" -required 1} {-argName "attributes" -required 1 -type tclobj} {-argName "-dropdups" -required 0 -nrargs 0} {-argName "-unique" -required 0 -nrargs 0} } */ static int -NsfMongoIndex(Tcl_Interp *interp, Tcl_Obj *connObj, CONST char *namespace, Tcl_Obj *attributesObj, +NsfMongoIndex(Tcl_Interp *interp, mongo_connection *connPtr, CONST char *namespace, Tcl_Obj *attributesObj, int withDropdups, int withUnique) { - mongo_connection *connPtr = MongoHashGet(ObjStr(connObj), "mongo_conn"); bson_bool_t success; int objc, result, options = 0; Tcl_Obj **objv; bson keys[1], out[1]; - if (connPtr == NULL) { - return NsfObjErrType(interp, "", connObj, "connection", NULL); - } result = Tcl_ListObjGetElements(interp, attributesObj, &objc, &objv); if (result != TCL_OK || (objc % 3 != 0)) { return NsfPrintError(interp, "%s: must contain a multiple of 3 elements", ObjStr(attributesObj)); @@ -754,22 +647,17 @@ /* cmd insert NsfMongoInsert { - {-argName "conn" -required 1 -type tclobj} + {-argName "conn" -required 1 -type mongo_connection} {-argName "namespace" -required 1} {-argName "values" -required 1 -type tclobj} } */ -static int NsfMongoInsert(Tcl_Interp *interp, Tcl_Obj *connObj, CONST char *namespace, Tcl_Obj *valuesObj) { - mongo_connection *connPtr = MongoHashGet(ObjStr(connObj), "mongo_conn"); +static int NsfMongoInsert(Tcl_Interp *interp, mongo_connection *connPtr, CONST char *namespace, Tcl_Obj *valuesObj) { int i, objc, result; Tcl_Obj **objv, *resultObj; bson_buffer buf[1]; bson b[1]; - if (connPtr == NULL) { - return NsfObjErrType(interp, "", connObj, "connection", NULL); - } - result = Tcl_ListObjGetElements(interp, valuesObj, &objc, &objv); if (result != TCL_OK || (objc % 3 != 0)) { return NsfPrintError(interp, "%s: must contain a multiple of 3 elements", ObjStr(valuesObj)); @@ -799,7 +687,7 @@ /* cmd query NsfMongoQuery { - {-argName "conn" -required 1 -type tclobj} + {-argName "conn" -required 1 -type mongo_connection} {-argName "namespace" -required 1} {-argName "query" -required 1 -type tclobj} {-argName "-atts" -required 0 -nrargs 1 -type tclobj} @@ -808,23 +696,18 @@ } */ static int -NsfMongoQuery(Tcl_Interp *interp, Tcl_Obj *connObj, CONST char *namespace, +NsfMongoQuery(Tcl_Interp *interp, mongo_connection *connPtr, CONST char *namespace, Tcl_Obj *queryObj, Tcl_Obj *withAttsObj, int withLimit, int withSkip) { int objc1, objc2, result; Tcl_Obj **objv1, **objv2, *resultObj; - mongo_connection *connPtr = MongoHashGet(ObjStr(connObj), "mongo_conn"); mongo_cursor *cursor; bson query[1]; bson atts[1]; /*fprintf(stderr, "NsfMongoQuery: namespace %s withLimit %d withSkip %d\n", namespace, withLimit, withSkip);*/ - if (connPtr == NULL) { - return NsfObjErrType(interp, "", connObj, "connection", NULL); - } - result = Tcl_ListObjGetElements(interp, queryObj, &objc1, &objv1); if (result != TCL_OK || (objc1 % 3 != 0)) { return NsfPrintError(interp, "%s: must contain a multiple of 3 elements", ObjStr(queryObj)); @@ -864,22 +747,17 @@ /* cmd remove NsfMongoRemove { - {-argName "conn" -required 1 -type tclobj} + {-argName "conn" -required 1 -type mongo_connection} {-argName "namespace" -required 1} {-argName "condition" -required 1 -type tclobj} } */ static int -NsfMongoRemove(Tcl_Interp *interp, Tcl_Obj *connObj, CONST char *namespace, Tcl_Obj *conditionObj) { +NsfMongoRemove(Tcl_Interp *interp, mongo_connection *connPtr, CONST char *namespace, Tcl_Obj *conditionObj) { int objc, result; Tcl_Obj **objv; - mongo_connection *connPtr = MongoHashGet(ObjStr(connObj), "mongo_conn"); bson query[1]; - if (connPtr == NULL) { - return NsfObjErrType(interp, "", connObj, "connection", NULL); - } - result = Tcl_ListObjGetElements(interp, conditionObj, &objc, &objv); if (result != TCL_OK || (objc % 3 != 0)) { return NsfPrintError(interp, "%s: must contain a multiple of 3 elements", ObjStr(conditionObj)); @@ -894,7 +772,7 @@ /* cmd insert NsfMongoUpdate { - {-argName "conn" -required 1 -type tclobj} + {-argName "conn" -required 1 -type mongo_connection} {-argName "namespace" -required 1} {-argName "cond" -required 1 -type tclobj} {-argName "values" -required 1 -type tclobj} @@ -903,17 +781,12 @@ } */ static int -NsfMongoUpdate(Tcl_Interp *interp, Tcl_Obj *connObj, CONST char *namespace, +NsfMongoUpdate(Tcl_Interp *interp, mongo_connection *connPtr, CONST char *namespace, Tcl_Obj *conditionObj, Tcl_Obj *valuesObj, int withUpsert, int withAll) { int objc, result, options = 0; Tcl_Obj **objv; - mongo_connection *connPtr = MongoHashGet(ObjStr(connObj), "mongo_conn"); bson cond[1], values[1]; - if (connPtr == NULL) { - return NsfObjErrType(interp, "", connObj, "connection", NULL); - } - result = Tcl_ListObjGetElements(interp, conditionObj, &objc, &objv); if (result != TCL_OK || (objc % 3 != 0)) { return NsfPrintError(interp, "%s: must contain a multiple of 3 elements", ObjStr(conditionObj)); @@ -941,27 +814,22 @@ ***********************************************************************/ /* cmd gridfs::open NsfMongoGridFSOpen { - {-argName "conn" -required 1 -type tclobj} + {-argName "conn" -required 1 -type mongo_connection} {-argName "dbname" -required 1} {-argName "prefix" -required 1} } */ static int -NsfMongoGridFSOpen(Tcl_Interp *interp, Tcl_Obj *connObj, +NsfMongoGridFSOpen(Tcl_Interp *interp, mongo_connection *connPtr, CONST char *dbname, CONST char *prefix) { char buffer[80]; gridfs *gfsPtr; - mongo_connection *connPtr = MongoHashGet(ObjStr(connObj), "mongo_conn"); - if (connPtr == NULL) { - return NsfObjErrType(interp, "", connObj, "connection", NULL); - } - gfsPtr = (gridfs *)ckalloc(sizeof(gridfs)); gridfs_init(connPtr, dbname, prefix, gfsPtr); - MongoHashAdd(buffer, "mongo_fs%d", &mongoGridFSCount, gfsPtr); + Nsf_PointerAdd(interp, buffer, "gridfs", gfsPtr); Tcl_SetObjResult(interp, Tcl_NewStringObj(buffer, -1)); return TCL_OK; @@ -975,14 +843,9 @@ } */ static int -NsfMongoGridFSRemoveFile(Tcl_Interp *interp, Tcl_Obj *gridFSObj, +NsfMongoGridFSRemoveFile(Tcl_Interp *interp, gridfs *gridfsPtr, CONST char *filename) { - gridfs *gridfsPtr = MongoHashGet(ObjStr(gridFSObj), "mongo_fs"); - if (gridfsPtr == NULL) { - return NsfObjErrType(interp, "", gridFSObj, "GridFS", NULL); - } - /* the current interfaces does not return a status ! */ gridfs_remove_filename(gridfsPtr, filename); @@ -991,45 +854,33 @@ /* cmd gridfs::store_file NsfMongoGridFSStoreFile { - {-argName "gfs" -required 1 -type tclobj} + {-argName "gfs" -required 1 -type gridfs} {-argName "filename" -required 1} {-argName "remotename" -required 1} {-argName "contenttype" -required 1} } */ static int -NsfMongoGridFSStoreFile(Tcl_Interp *interp, Tcl_Obj *gridFSObj, +NsfMongoGridFSStoreFile(Tcl_Interp *interp, gridfs *gridfsPtr, CONST char *filename, CONST char *remotename, CONST char *contenttype) { - gridfs *gridfsPtr = MongoHashGet(ObjStr(gridFSObj), "mongo_fs"); - bson b; + bson b = gridfs_store_file(gridfsPtr, filename, remotename, contenttype); - if (gridfsPtr == NULL) { - return NsfObjErrType(interp, "", gridFSObj, "GridFS", NULL); - } - - b = gridfs_store_file(gridfsPtr, filename, remotename, contenttype); - Tcl_SetObjResult(interp, BsonToList(interp, b.data, 0)); return TCL_OK; } /* cmd gridfs::close NsfMongoGridFSClose { - {-argName "gfs" -required 1 -type tclobj} + {-argName "gfs" -required 1 -type gridfs} } */ static int -NsfMongoGridFSClose(Tcl_Interp *interp, Tcl_Obj *gridFSObj) { - gridfs *gridfsPtr = MongoHashGet(ObjStr(gridFSObj), "mongo_fs"); +NsfMongoGridFSClose(Tcl_Interp *interp, gridfs *gridfsPtr) { - if (gridfsPtr == NULL) { - return NsfObjErrType(interp, "", gridFSObj, "GridFS", NULL); - } - gridfs_destroy(gridfsPtr); - MongoHashDelete(ObjStr(gridFSObj), gridfsPtr); + Nsf_PointerDelete(gridfsPtr); return TCL_OK; } @@ -1040,36 +891,27 @@ /* cmd gridfile::close NsfMongoGridFileClose { - {-argName "gridfile" -required 1 -type tclobj} + {-argName "file" -required 1 -type gridfile} } */ static int -NsfMongoGridFileClose(Tcl_Interp *interp, Tcl_Obj *gridFileObj) { - gridfile* gridFilePtr = MongoHashGet(ObjStr(gridFileObj), "mongo_file"); +NsfMongoGridFileClose(Tcl_Interp *interp, gridfile* gridFilePtr) { - if (gridFilePtr == NULL) { - return NsfObjErrType(interp, "", gridFileObj, "GridFile", NULL); - } - gridfile_destroy(gridFilePtr); - MongoHashDelete(ObjStr(gridFileObj), gridFilePtr); + Nsf_PointerDelete(gridFilePtr); return TCL_OK; } /* cmd gridfile::get_contentlength NsfMongoGridFileGetContentlength { - {-argName "gridfile" -required 1 -type tclobj} + {-argName "gridfile" -required 1 -type gridfile} } */ static int -NsfMongoGridFileGetContentlength(Tcl_Interp *interp, Tcl_Obj *gridFileObj) { - gridfile* gridFilePtr = MongoHashGet(ObjStr(gridFileObj), "mongo_file"); +NsfMongoGridFileGetContentlength(Tcl_Interp *interp, gridfile* gridFilePtr) { gridfs_offset len; - if (gridFilePtr == NULL) { - return NsfObjErrType(interp, "", gridFileObj, "GridFile", NULL); - } len = gridfile_get_contentlength(gridFilePtr); Tcl_SetObjResult(interp, Tcl_NewLongObj(len)); @@ -1078,17 +920,13 @@ /* cmd gridfile::get_contenttype NsfMongoGridFileGetContentType { - {-argName "gridfile" -required 1 -type tclobj} + {-argName "gridfile" -required 1 -type gridfile} } */ static int -NsfMongoGridFileGetContentType(Tcl_Interp *interp, Tcl_Obj *gridFileObj) { - gridfile* gridFilePtr = MongoHashGet(ObjStr(gridFileObj), "mongo_file"); +NsfMongoGridFileGetContentType(Tcl_Interp *interp, gridfile* gridFilePtr) { CONST char *contentType; - if (gridFilePtr == NULL) { - return NsfObjErrType(interp, "", gridFileObj, "GridFile", NULL); - } contentType = gridfile_get_contenttype(gridFilePtr); Tcl_SetObjResult(interp, Tcl_NewStringObj(contentType, -1)); @@ -1097,17 +935,13 @@ /* cmd gridfile::get_metadata NsfMongoGridFileGetMetaData { - {-argName "gridfile" -required 1 -type tclobj} + {-argName "gridfile" -required 1 -type tclgridfile* gridFilePtrobj} } */ static int -NsfMongoGridFileGetMetaData(Tcl_Interp *interp, Tcl_Obj *gridFileObj) { - gridfile* gridFilePtr = MongoHashGet(ObjStr(gridFileObj), "mongo_file"); +NsfMongoGridFileGetMetaData(Tcl_Interp *interp, gridfile* gridFilePtr) { bson b; - if (gridFilePtr == NULL) { - return NsfObjErrType(interp, "", gridFileObj, "GridFile", NULL); - } b = gridfile_get_metadata(gridFilePtr); Tcl_SetObjResult(interp, BsonToList(interp, b.data, 0)); @@ -1116,27 +950,21 @@ /* cmd gridfile::open NsfMongoGridFileOpen { - {-argName "gfs" -required 1 -type tclobj} + {-argName "gfs" -required 1 -type gridfs} {-argName "filename" -required 1} } */ static int -NsfMongoGridFileOpen(Tcl_Interp *interp, Tcl_Obj *gridFSObj, - CONST char *filename) { +NsfMongoGridFileOpen(Tcl_Interp *interp, gridfs *gridfsPtr, CONST char *filename) { char buffer[80]; - gridfs *gridfsPtr = MongoHashGet(ObjStr(gridFSObj), "mongo_fs"); gridfile* gridFilePtr; int result; - if (gridfsPtr == NULL) { - return NsfObjErrType(interp, "", gridFSObj, "GridFS", NULL); - } - gridFilePtr = (gridfile *)ckalloc(sizeof(gridfile)); result = gridfs_find_filename(gridfsPtr, filename, gridFilePtr); if (result == 1) { - MongoHashAdd(buffer, "mongo_file%d", &mongoGridFileCount, gridFilePtr); + Nsf_PointerAdd(interp, buffer, "gridfile", gridFilePtr); Tcl_SetObjResult(interp, Tcl_NewStringObj(buffer, -1)); } else { ckfree((char *)gridFilePtr); @@ -1148,19 +976,15 @@ /* cmd gridfile::read NsfMongoGridFileRead { - {-argName "gridfile" -required 1 -type tclobj} + {-argName "gridfile" -required 1 -type gridfile} {-argName "size" -required 1 -type int} } */ static int -NsfMongoGridFileRead(Tcl_Interp *interp, Tcl_Obj *gridFileObj, int size) { - gridfile* gridFilePtr = MongoHashGet(ObjStr(gridFileObj), "mongo_file"); +NsfMongoGridFileRead(Tcl_Interp *interp, gridfile *gridFilePtr, int size) { int readSize; char *buffer; - if (gridFilePtr == NULL) { - return NsfObjErrType(interp, "", gridFileObj, "GridFile", NULL); - } buffer = ckalloc(size); readSize = gridfile_read(gridFilePtr, size, buffer); Tcl_SetObjResult(interp, Tcl_NewStringObj(buffer, readSize)); @@ -1206,10 +1030,14 @@ #endif Tcl_CreateExitHandler(Nsfmongo_Exit, interp); - NsfMutexLock(&mongoMutex); - Tcl_InitHashTable(mongoHashTablePtr, TCL_STRING_KEYS); - NsfMutexUnlock(&mongoMutex); + /* + * register the pointer converter + */ + Nsf_PointerTypeRegister(interp, "gridfs", &gridfsCount); + Nsf_PointerTypeRegister(interp, "gridfile", &gridfileCount); + Nsf_PointerTypeRegister(interp, "mongo_connection", &mongo_connectionCount); + /* create all method commands (will use the namespaces above) */ for (i=0; i < nr_elements(method_definitions)-1; i++) { Tcl_CreateObjCommand(interp, method_definitions[i].methodName, method_definitions[i].proc, 0, 0);