Index: generic/xotcl.c =================================================================== diff -u -r6b3921be54ad92034e563a09300ab2e4f49645aa -r1c11937f4f0aea905fbedfbb9c2d1782b08833f5 --- generic/xotcl.c (.../xotcl.c) (revision 6b3921be54ad92034e563a09300ab2e4f49645aa) +++ generic/xotcl.c (.../xotcl.c) (revision 1c11937f4f0aea905fbedfbb9c2d1782b08833f5) @@ -1,8 +1,7 @@ -/* $Id: xotcl.c,v 1.43 2006/10/04 20:40:23 neumann Exp $ - * +/* * XOTcl - Extended Object Tcl * - * Copyright (C) 1999-2009 Gustaf Neumann (a), Uwe Zdun (a) + * Copyright (C) 1999-2010 Gustaf Neumann (a), Uwe Zdun (a) * * (a) Vienna University of Economics and Business Administration * Institute. of Information Systems and New Media @@ -2283,7 +2282,7 @@ } int -XOTclAddInstanceMethod(Tcl_Interp *interp, XOTcl_Class *class, CONST char *methodName, +XOTclAddClassMethod(Tcl_Interp *interp, XOTcl_Class *class, CONST char *methodName, Tcl_ObjCmdProc *proc, ClientData clientData, Tcl_CmdDeleteProc *dp, int flags) { XOTclClass *cl = (XOTclClass *)class; @@ -3162,9 +3161,9 @@ /*fprintf(stderr, " %s, ", ObjStr(pl->cl->object.cmdName));*/ if ((pl->cl->object.flags & XOTCL_IS_ROOT_CLASS) == 0) { XOTclClassOpt *opt = pl->cl->opt; - if (opt && opt->instmixins) { - /* compute transitively the instmixin classes of this added - class */ + if (opt && opt->classmixins) { + /* compute transitively the (class) mixin classes of this + added class */ XOTclClasses *cls; int i, found = 0; for (i=0, cls = *checkList; cls; i++, cls = cls->nextPtr) { @@ -3180,7 +3179,7 @@ /*fprintf(stderr, "+++ transitive %s\n", ObjStr(pl->cl->object.cmdName));*/ - MixinComputeOrderFullList(interp, &opt->instmixins, mixinClasses, + MixinComputeOrderFullList(interp, &opt->classmixins, mixinClasses, checkList, level+1); } } @@ -3227,8 +3226,8 @@ /* append per-class mixins */ for (pl = ComputeOrder(obj->cl, obj->cl->order, Super); pl; pl = pl->nextPtr) { XOTclClassOpt *opt = pl->cl->opt; - if (opt && opt->instmixins) { - MixinComputeOrderFullList(interp, &opt->instmixins, &mixinClasses, + if (opt && opt->classmixins) { + MixinComputeOrderFullList(interp, &opt->classmixins, &mixinClasses, &checkList, 0); } } @@ -3575,7 +3574,7 @@ } /* - * recursively get all instmixins of a class into an initialized + * recursively get all classmixins of a class into an initialized * object ptr hashtable (TCL_ONE_WORD_KEYS) */ @@ -3587,20 +3586,20 @@ XOTclClasses *sc; /* - * check this class for instmixins + * check this class for classmixins */ if (startCl->opt) { XOTclCmdList *m; - for (m = startCl->opt->instmixins; m; m = m->nextPtr) { + for (m = startCl->opt->classmixins; m; m = m->nextPtr) { /* we should have no deleted commands in the list */ assert(Tcl_Command_cmdEpoch(m->cmdPtr) == NULL); cl = XOTclGetClassFromCmdPtr(m->cmdPtr); assert(cl); - /* fprintf(stderr, "Instmixin found: %s\n", className(cl)); */ + /* fprintf(stderr, "class mixin found: %s\n", className(cl)); */ if ((withGuards) && (m->clientData)) { /* fprintf(stderr, "addToResultSetWithGuards: %s\n", className(cl)); */ @@ -3612,7 +3611,7 @@ if (rc == 1) {return rc;} if (new) { - /* fprintf(stderr, "Instmixin getAllClassMixins for: %s (%s)\n", className(cl), ObjStr(startCl->object.cmdName)); */ + /* fprintf(stderr, "class mixin getAllClassMixins for: %s (%s)\n", className(cl), ObjStr(startCl->object.cmdName)); */ rc = getAllClassMixins(interp, destTable, cl, withGuards, pattern, matchObject); if (rc) {return rc;} } @@ -3621,7 +3620,7 @@ /* - * check all superclasses of startCl for instmixins + * check all superclasses of startCl for classmixins */ for (sc = startCl->super; sc; sc = sc->nextPtr) { /* fprintf(stderr, "Superclass getAllClassMixins for %s (%s)\n", ObjStr(sc->cl->object.cmdName), ObjStr(startCl->object.cmdName)); */ @@ -3668,16 +3667,16 @@ } static void -RemoveFromInstmixins(Tcl_Command cmd, XOTclCmdList *cmdlist) { +RemoveFromClassmixins(Tcl_Command cmd, XOTclCmdList *cmdlist) { for ( ; cmdlist; cmdlist = cmdlist->nextPtr) { XOTclClass *cl = XOTclGetClassFromCmdPtr(cmdlist->cmdPtr); XOTclClassOpt *clopt = cl ? cl->opt : NULL; if (clopt) { - XOTclCmdList *del = CmdListFindCmdInList(cmd, clopt->instmixins); + XOTclCmdList *del = CmdListFindCmdInList(cmd, clopt->classmixins); if (del) { /* fprintf(stderr, "Removing class %s from mixins of object %s\n", className(cl), ObjStr(XOTclGetObjectFromCmdPtr(cmdlist->cmdPtr)->cmdName)); */ - del = CmdListRemoveFromList(&clopt->instmixins, del); + del = CmdListRemoveFromList(&clopt->classmixins, del); CmdListDeleteCmdListEntry(del, GuardDel); if (cl->object.mixinOrder) MixinResetOrder(&cl->object); } @@ -3718,9 +3717,9 @@ /*fprintf(stderr, "invalidating instances of class %s\n", ObjStr(clPtr->cl->object.cmdName));*/ - /* here we should check, whether this class is used as - a mixin / instmixin somewhere else and invalidate - the objects of these as well -- */ + /* Here we should check, whether this class is used as an object or + class mixin somewhere else and invalidate the objects of these as + well -- */ for (; hPtr; hPtr = Tcl_NextHashEntry(&hSrch)) { XOTclObject *obj = (XOTclObject *)Tcl_GetHashKey(&cl->instances, hPtr); @@ -3791,8 +3790,8 @@ cl->order = saved; /* Reset mixin order for all objects having this class as a per - class mixin (instmixin). This means that we have to work through - the instmixin hierarchy with its corresponding instances. + class mixin. This means that we have to work through + the class mixin hierarchy with its corresponding instances. */ Tcl_InitHashTable(commandTable, TCL_ONE_WORD_KEYS); MEM_COUNT_ALLOC("Tcl_InitHashTable", commandTable); @@ -3805,7 +3804,7 @@ if (ncl) { MixinResetOrderForInstances(interp, ncl); /* this place seems to be sufficient to invalidate the computed object parameter definitions */ - /*fprintf(stderr, "MixinInvalidateObjOrders via instmixin %s calls ifd invalidate \n", className(ncl));*/ + /*fprintf(stderr, "MixinInvalidateObjOrders via class mixin %s calls ifd invalidate \n", className(ncl));*/ XOTclCInvalidateObjectParameterMethod(interp, ncl); } } @@ -3919,7 +3918,7 @@ } /* - * info option for mixins and instmixins + * info option for mixins and classmixins */ static int MixinInfo(Tcl_Interp *interp, XOTclCmdList *m, char *pattern, @@ -3981,12 +3980,11 @@ */ /* - * The search method implements filter search order for filter - * and instfilter: first a given name is interpreted as fully - * qualified method name. If no method is found, a proc is - * searched with fully name. Otherwise the simple name is searched - * on the heritage order: object (only for - * per-object filters), class, meta-class + * The search method implements filter search order for object and + * class ilter: first a given name is interpreted as fully qualified + * method name. If no method is found, a proc is searched with fully + * name. Otherwise the simple name is searched on the heritage order: + * object (only for per-object filters), class, meta-class */ static Tcl_Command @@ -3998,7 +3996,7 @@ XOTclObjectOpt *opt = startingObj->opt; /* * the object-specific filter can also be defined on the object's - * class, its hierarchy, or the respective instmixins; thus use the + * class, its hierarchy, or the respective classmixins; thus use the * object's class as start point for the class-specific search then ... */ startingCl = startingObj->cl; @@ -4014,12 +4012,12 @@ } /* - * search for instfilters on instmixins + * search for classfilters on classmixins */ if (startingCl) { XOTclClassOpt *opt = startingCl->opt; - if (opt && opt->instmixins) { - if ((cmd = MixinSearchMethodByName(interp, opt->instmixins, name, cl))) { + if (opt && opt->classmixins) { + if ((cmd = MixinSearchMethodByName(interp, opt->classmixins, name, cl))) { return cmd; } } @@ -4210,7 +4208,7 @@ int guardAdded = 0; XOTclObjectOpt *opt; - /* search guards for instfilters registered on mixins */ + /* search guards for classfilters registered on mixins */ if (!(obj->flags & XOTCL_MIXIN_ORDER_VALID)) MixinComputeDefined(interp, obj); if (obj->flags & XOTCL_MIXIN_ORDER_DEFINED_AND_VALID) { @@ -4220,7 +4218,7 @@ mixin = XOTclGetClassFromCmdPtr(ml->cmdPtr); if (mixin && mixin->opt) { guardAdded = GuardAddFromDefinitionList(interp, dest, obj, filterCmd, - mixin->opt->instfilters); + mixin->opt->classfilters); } } } @@ -4237,7 +4235,7 @@ XOTclClassOpt *opt = pl->cl->opt; if (opt) { guardAdded = GuardAddFromDefinitionList(interp, dest, obj, filterCmd, - opt->instfilters); + opt->classfilters); } } @@ -4309,11 +4307,11 @@ if (!(cmd = FilterSearch(interp, ObjStr(name), startingObj, startingCl, &cl))) { if (startingObj) - return XOTclVarErrMsg(interp, "filter: can't find filterproc on: ", + return XOTclVarErrMsg(interp, "object filter: can't find filterproc on: ", objectName(startingObj), " - proc: ", ObjStr(name), (char *) NULL); else - return XOTclVarErrMsg(interp, "instfilter: can't find filterproc on: ", + return XOTclVarErrMsg(interp, "class filter: can't find filterproc on: ", ObjStr(startingCl->object.cmdName), " - proc: ", ObjStr(name), (char *) NULL); } @@ -4394,9 +4392,9 @@ Tcl_HashEntry *hPtr = &clPtr->cl->instances ? Tcl_FirstHashEntry(&clPtr->cl->instances, &hSrch) : 0; - /* recalculate the commands of all instfilter registrations */ + /* recalculate the commands of all class-filter registrations */ if (clPtr->cl->opt) { - FilterSearchAgain(interp, &clPtr->cl->opt->instfilters, 0, clPtr->cl); + FilterSearchAgain(interp, &clPtr->cl->opt->classfilters, 0, clPtr->cl); } for (; hPtr; hPtr = Tcl_NextHashEntry(&hSrch)) { XOTclObject *obj = (XOTclObject *)Tcl_GetHashKey(&clPtr->cl->instances, hPtr); @@ -4433,7 +4431,7 @@ Tcl_FirstHashEntry(&clPtr->cl->instances, &hSrch) : NULL; XOTclClassOpt *opt = clPtr->cl->opt; if (opt) { - CmdListRemoveContextClassFromList(&opt->instfilters, removeClass, GuardDel); + CmdListRemoveContextClassFromList(&opt->classfilters, removeClass, GuardDel); } for (; hPtr; hPtr = Tcl_NextHashEntry(&hSrch)) { XOTclObject *obj = (XOTclObject*) Tcl_GetHashKey(&clPtr->cl->instances, hPtr); @@ -4448,9 +4446,8 @@ } /* - * build up a qualifier of the form proc/instproc - * if cl is not NULL, we build an instproc identifier for cl, else a proc - * with obj + * Build up a qualifier of the form method . + * If cl is NULL, we add the modifier "object". */ static Tcl_Obj * getFullProcQualifier(Tcl_Interp *interp, CONST char *cmdName, @@ -4480,9 +4477,9 @@ } /* - * info option for filters and instfilters + * info option for filters and classfilters * withGuards -> if not 0 => append guards - * fullProcQualifiers -> if not 0 => full names with obj/class proc/instproc + * fullProcQualifiers -> if not 0 => full names with obj/class method */ static int FilterInfo(Tcl_Interp *interp, XOTclCmdList *f, char *pattern, @@ -4587,11 +4584,10 @@ } /* - * Computes a linearized order of filter and instfilter. Then + * Computes a linearized order of object and class filter. Then * duplicates in the full list and with the class inheritance list of - * 'obj' are eliminated. - * The precendence rule is that the last occurence makes it into the - * final list. + * 'obj' are eliminated. The precendence rule is that the last + * occurence makes it into the final list. */ static void FilterComputeOrder(Tcl_Interp *interp, XOTclObject *obj) { @@ -4603,7 +4599,7 @@ fprintf(stderr, " List: ", objectName(obj)); */ - /* append instfilters registered for mixins */ + /* append classfilters registered for mixins */ if (!(obj->flags & XOTCL_MIXIN_ORDER_VALID)) MixinComputeDefined(interp, obj); @@ -4613,8 +4609,8 @@ for (ml = obj->mixinOrder; ml; ml = ml->nextPtr) { mixin = XOTclGetClassFromCmdPtr(ml->cmdPtr); - if (mixin && mixin->opt && mixin->opt->instfilters) - FilterComputeOrderFullList(interp, &mixin->opt->instfilters, &filterList); + if (mixin && mixin->opt && mixin->opt->classfilters) + FilterComputeOrderFullList(interp, &mixin->opt->classfilters, &filterList); } } @@ -4625,8 +4621,8 @@ /* append per-class filters */ for (pl = ComputeOrder(obj->cl, obj->cl->order, Super); pl; pl=pl->nextPtr) { XOTclClassOpt *opt = pl->cl->opt; - if (opt && opt->instfilters) { - FilterComputeOrderFullList(interp, &opt->instfilters, &filterList); + if (opt && opt->classfilters) { + FilterComputeOrderFullList(interp, &opt->classfilters, &filterList); } } @@ -4716,7 +4712,7 @@ * * returns a tcl obj list with the filter registration, like: * " filter , - * " instfilter , + * " filter , * or an empty list, if not registered */ static Tcl_Obj * @@ -4737,8 +4733,8 @@ /* search per-class filters */ for (pl = ComputeOrder(obj->cl, obj->cl->order, Super); pl; pl = pl->nextPtr) { XOTclClassOpt *opt = pl->cl->opt; - if (opt && opt->instfilters) { - if (CmdListFindCmdInList(cmd, opt->instfilters)) { + if (opt && opt->classfilters) { + if (CmdListFindCmdInList(cmd, opt->classfilters)) { Tcl_ListObjAppendElement(interp, list, pl->cl->object.cmdName); Tcl_ListObjAppendElement(interp, list, XOTclGlobalObjects[XOTE_FILTER]); Tcl_ListObjAppendElement(interp, list, @@ -5387,7 +5383,7 @@ } #endif -/* invoke a method implemented as a proc/instproc (with assertion checking) */ +/* invoke a scripted method (with assertion checking) */ static int ProcMethodDispatch(ClientData cp, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[], char *methodName, XOTclObject *obj, XOTclClass *cl, Tcl_Command cmdPtr, @@ -6399,7 +6395,7 @@ /* * If the argument is not required and no default value is * specified, we have to handle in the client code (eg. in the - * canonical arg handlers for instprocs) the unknown value + * canonical arg handlers for scripted methods) the unknown value * (e.g. don't set/unset a variable) */ if (!(paramPtr->flags & XOTCL_ARG_REQUIRED) && paramPtr->defaultValue == NULL) { @@ -6598,8 +6594,8 @@ /* if both, args and body are empty strings, we delete the method */ if (*argsStr == 0 && *bodyStr == 0) { result = cl ? - XOTclRemoveIMethod(interp, (XOTcl_Class *)cl, nameStr) : - XOTclRemovePMethod(interp, (XOTcl_Object *)obj, nameStr); + XOTclRemoveClassMethod(interp, (XOTcl_Class *)cl, nameStr) : + XOTclRemoveObjectMethod(interp, (XOTcl_Object *)obj, nameStr); } else { XOTclAssertionStore *aStore = NULL; if (precondition || postcondition) { @@ -7682,14 +7678,15 @@ if (clopt) { /* - * Remove this class from all isClassMixinOf lists and clear the instmixin list + * Remove this class from all isClassMixinOf lists and clear the + * class mixin list */ - RemoveFromClassMixinsOf(clopt->id, clopt->instmixins); + RemoveFromClassMixinsOf(clopt->id, clopt->classmixins); - CmdListRemoveList(&clopt->instmixins, GuardDel); + CmdListRemoveList(&clopt->classmixins, GuardDel); /*MixinInvalidateObjOrders(interp, cl);*/ - CmdListRemoveList(&clopt->instfilters, GuardDel); + CmdListRemoveList(&clopt->classfilters, GuardDel); /*FilterInvalidateObjOrders(interp, cl);*/ if (!recreate) { @@ -7701,10 +7698,11 @@ CmdListRemoveList(&clopt->isObjectMixinOf, GuardDel); /* - * Remove this class from all instmixin lists and clear the isClassMixinOf list + * Remove this class from all class mixin lists and clear the + * isClassMixinOf list */ - RemoveFromInstmixins(clopt->id, clopt->isClassMixinOf); + RemoveFromClassmixins(clopt->id, clopt->isClassMixinOf); CmdListRemoveList(&clopt->isClassMixinOf, GuardDel); } /* remove dependent filters of this class from all subclasses*/ @@ -8211,9 +8209,9 @@ /* has the class metaclass mixed in? */ for (pl = ComputeOrder(cl, cl->order, Super); pl; pl = pl->nextPtr) { XOTclClassOpt *clopt = pl->cl->opt; - if (clopt && clopt->instmixins) { + if (clopt && clopt->classmixins) { MixinComputeOrderFullList(interp, - &clopt->instmixins, + &clopt->classmixins, &mixinClasses, &checkList, 0); } @@ -8478,7 +8476,7 @@ } extern int -XOTclRemovePMethod(Tcl_Interp *interp, XOTcl_Object *object, CONST char *methodName) { +XOTclRemoveObjectMethod(Tcl_Interp *interp, XOTcl_Object *object, CONST char *methodName) { XOTclObject *obj = (XOTclObject*) object; AliasDelete(interp, obj->cmdName, methodName, 1); @@ -8496,7 +8494,7 @@ } extern int -XOTclRemoveIMethod(Tcl_Interp *interp, XOTcl_Class *class, CONST char *methodName) { +XOTclRemoveClassMethod(Tcl_Interp *interp, XOTcl_Class *class, CONST char *methodName) { XOTclClass *cl = (XOTclClass*) class; XOTclClassOpt *opt = cl->opt; int rc; @@ -9672,7 +9670,6 @@ return cmd; } -/* proc/instproc specific code */ static int ListProcBody(Tcl_Interp *interp, Proc *procPtr, char *methodName) { if (procPtr) { @@ -10413,7 +10410,7 @@ flags = 0; if (cl) { - result = XOTclAddInstanceMethod(interp, (XOTcl_Class *)cl, methodName, + result = XOTclAddClassMethod(interp, (XOTcl_Class *)cl, methodName, objProc, tcd, deleteProc, flags); nsPtr = cl->nsPtr; } else { @@ -10835,7 +10832,7 @@ (Tcl_ObjCmdProc*)XOTclForwardMethod, (ClientData)tcd, forwardCmdDeleteProc, 0); } else { - result = XOTclAddInstanceMethod(interp, (XOTcl_Class*)cl, methodName, + result = XOTclAddClassMethod(interp, (XOTcl_Class*)cl, methodName, (Tcl_ObjCmdProc*)XOTclForwardMethod, (ClientData)tcd, forwardCmdDeleteProc, 0); } @@ -11503,9 +11500,10 @@ if (value == NULL) { clopt = cl->opt; switch (relationtype) { - case RelationtypeClass_mixinIdx: return clopt ? MixinInfo(interp, clopt->instmixins, NULL, 1, NULL) : TCL_OK; + case RelationtypeClass_mixinIdx: + return clopt ? MixinInfo(interp, clopt->classmixins, NULL, 1, NULL) : TCL_OK; case RelationtypeClass_filterIdx: - return objopt ? FilterInfo(interp, clopt->instfilters, NULL, 1, 0) : TCL_OK; + return objopt ? FilterInfo(interp, clopt->classfilters, NULL, 1, 0) : TCL_OK; } } @@ -11643,9 +11641,9 @@ return TCL_ERROR; } } - if (clopt->instmixins) { - RemoveFromClassMixinsOf(cl->object.id, clopt->instmixins); - CmdListRemoveList(&clopt->instmixins, GuardDel); + if (clopt->classmixins) { + RemoveFromClassMixinsOf(cl->object.id, clopt->classmixins); + CmdListRemoveList(&clopt->classmixins, GuardDel); } MixinInvalidateObjOrders(interp, cl); @@ -11654,10 +11652,10 @@ * we have to invalidate the filters as well */ FilterInvalidateObjOrders(interp, cl); - clopt->instmixins = newMixinCmdList; + clopt->classmixins = newMixinCmdList; for (i = 0; i < oc; i++) { Tcl_Obj *ocl = NULL; - /* fprintf(stderr, "Added to instmixins of %s: %s\n", + /* fprintf(stderr, "Added to classmixins of %s: %s\n", className(cl), ObjStr(ov[i])); */ Tcl_ListObjIndex(interp, ov[i], 0, &ocl); @@ -11675,11 +11673,11 @@ case RelationtypeClass_filterIdx: - if (clopt->instfilters) CmdListRemoveList(&clopt->instfilters, GuardDel); + if (clopt->classfilters) CmdListRemoveList(&clopt->classfilters, GuardDel); FilterInvalidateObjOrders(interp, cl); for (i = 0; i < oc; i ++) { - if (FilterAdd(interp, &clopt->instfilters, ov[i], 0, cl) != TCL_OK) + if (FilterAdd(interp, &clopt->classfilters, ov[i], 0, cl) != TCL_OK) return TCL_ERROR; } break; @@ -11856,7 +11854,7 @@ XOTclClass *cl = (withPer_object || ! XOTclObjectIsClass(object)) ? NULL : (XOTclClass *)object; if (cl) { - result = XOTclAddInstanceMethod(interp, (XOTcl_Class *)cl, methodName, + result = XOTclAddClassMethod(interp, (XOTcl_Class *)cl, methodName, (Tcl_ObjCmdProc*)XOTclSetterMethod, 0, 0, 0); } else { result = XOTclAddObjectMethod(interp, (XOTcl_Object *)object, methodName, @@ -11932,7 +11930,7 @@ * * a) on class cleanup: ParsedParamFree(cl->parsedParamPtr) * b) on class structure changes, - * c) when instmixins are added, + * c) when classmixins are added, * d) when new slots are defined, * e) when slots are removed * @@ -12702,8 +12700,8 @@ char *filter, Tcl_Obj *guard) { XOTclClassOpt *opt = cl->opt; - if (opt && opt->instfilters) { - XOTclCmdList *h = CmdListFindNameInList(interp, filter, opt->instfilters); + if (opt && opt->classfilters) { + XOTclCmdList *h = CmdListFindNameInList(interp, filter, opt->classfilters); if (h) { if (h->clientData) GuardDel(h); @@ -12713,21 +12711,21 @@ } } - return XOTclVarErrMsg(interp, "Instfilterguard: can't find filter ", + return XOTclVarErrMsg(interp, "filterguard: can't find filter ", filter, " on ", className(cl), (char *) NULL); } static int XOTclCMixinGuardMethod(Tcl_Interp *interp, XOTclClass *cl, char *mixin, Tcl_Obj *guard) { XOTclClassOpt *opt = cl->opt; - if (opt && opt->instmixins) { + if (opt && opt->classmixins) { XOTclClass *mixinCl = XOTclpGetClass(interp, mixin); Tcl_Command mixinCmd = NULL; if (mixinCl) { mixinCmd = Tcl_GetCommandFromObj(interp, mixinCl->object.cmdName); } if (mixinCmd) { - XOTclCmdList *h = CmdListFindCmdInList(mixinCmd, opt->instmixins); + XOTclCmdList *h = CmdListFindCmdInList(mixinCmd, opt->classmixins); if (h) { if (h->clientData) GuardDel((XOTclCmdList*) h); @@ -12738,7 +12736,7 @@ } } - return XOTclVarErrMsg(interp, "Instmixinguard: can't find mixin ", + return XOTclVarErrMsg(interp, "mixinguard: can't find mixin ", mixin, " on ", className(cl), (char *) NULL); } @@ -13077,11 +13075,11 @@ } static int XOTclClassInfoFilterMethod(Tcl_Interp *interp, XOTclClass * class, int withGuards, char * pattern) { - return class->opt ? FilterInfo(interp, class->opt->instfilters, pattern, withGuards, 0) : TCL_OK; + return class->opt ? FilterInfo(interp, class->opt->classfilters, pattern, withGuards, 0) : TCL_OK; } static int XOTclClassInfoFilterguardMethod(Tcl_Interp *interp, XOTclClass * class, char * filter) { - return class->opt ? GuardList(interp, class->opt->instfilters, filter) : TCL_OK; + return class->opt ? GuardList(interp, class->opt->classfilters, filter) : TCL_OK; } static int XOTclClassInfoForwardMethod(Tcl_Interp *interp, XOTclClass *class, @@ -13104,17 +13102,14 @@ } MEM_COUNT_FREE("Tcl_InitHashTable", commandTable); } else { - rc = opt ? MixinInfo(interp, opt->instmixins, patternString, withGuards, patternObj) : TCL_OK; + rc = opt ? MixinInfo(interp, opt->classmixins, patternString, withGuards, patternObj) : TCL_OK; } return TCL_OK; } -/* TODO: this method should be removed, we should register XOTclClassInfoMixinMethod for - xotcl1 under name ... instmxin ... */ - static int XOTclClassInfoMixinguardMethod(Tcl_Interp *interp, XOTclClass * class, char * mixin) { - return class->opt ? GuardList(interp, class->opt->instmixins, mixin) : TCL_OK; + return class->opt ? GuardList(interp, class->opt->classmixins, mixin) : TCL_OK; } static int XOTclClassInfoClassMixinOfMethod(Tcl_Interp *interp, XOTclClass * class, int withClosure, @@ -13910,7 +13905,7 @@ Tcl_Export(interp, RUNTIME_STATE(interp)->XOTclNS, "self", 0); Tcl_Export(interp, RUNTIME_STATE(interp)->XOTclNS, "next", 0); Tcl_Export(interp, RUNTIME_STATE(interp)->XOTclNS, "my", 0); - Tcl_Export(interp, RUNTIME_STATE(interp)->XOTclNS, "instvar", 0); + Tcl_Export(interp, RUNTIME_STATE(interp)->XOTclNS, "importvar", 0); #ifdef XOTCL_BYTECODE XOTclBytecodeInit(); Index: generic/xotcl.decls =================================================================== diff -u -rb385d44db9e33f36d1629fbb0b82cf94d8dffe72 -r1c11937f4f0aea905fbedfbb9c2d1782b08833f5 --- generic/xotcl.decls (.../xotcl.decls) (revision b385d44db9e33f36d1629fbb0b82cf94d8dffe72) +++ generic/xotcl.decls (.../xotcl.decls) (revision 1c11937f4f0aea905fbedfbb9c2d1782b08833f5) @@ -56,20 +56,20 @@ int XOTclDeleteClass(Tcl_Interp *interp, struct XOTcl_Class *cl) } #declare 11 generic { -# int XOTclAddPMethod(Tcl_Interp *interp, struct XOTcl_Object *obj, +# int XOTclAddObjectMethod(Tcl_Interp *interp, struct XOTcl_Object *obj, # CONST char* nm, Tcl_ObjCmdProc* proc, # ClientData cd, Tcl_CmdDeleteProc *dp) #} #declare 12 generic { -# int XOTclAddIMethod(Tcl_Interp *interp, struct XOTcl_Class *cl, +# int XOTclAddClassMethod(Tcl_Interp *interp, struct XOTcl_Class *cl, # CONST char* nm, Tcl_ObjCmdProc* proc, # ClientData cd, Tcl_CmdDeleteProc *dp) #} declare 13 generic { - int XOTclRemovePMethod(Tcl_Interp *interp,struct XOTcl_Object *obj, CONST char *nm) + int XOTclRemoveObjectMethod(Tcl_Interp *interp,struct XOTcl_Object *obj, CONST char *nm) } declare 14 generic { - int XOTclRemoveIMethod(Tcl_Interp *interp, struct XOTcl_Class *cl, CONST char *nm) + int XOTclRemoveClassMethod(Tcl_Interp *interp, struct XOTcl_Class *cl, CONST char *nm) } declare 15 generic { Tcl_Obj *XOTclOSetInstVar(struct XOTcl_Object *obj, Tcl_Interp *interp, @@ -169,7 +169,7 @@ ClientData cd, Tcl_CmdDeleteProc *dp, int flags) } declare 42 generic { - int XOTclAddInstanceMethod(Tcl_Interp *interp, struct XOTcl_Class *cl, + int XOTclAddClassMethod(Tcl_Interp *interp, struct XOTcl_Class *cl, CONST char *nm, Tcl_ObjCmdProc *proc, ClientData cd, Tcl_CmdDeleteProc *dp, int flags) } Index: generic/xotclDecls.h =================================================================== diff -u -rb385d44db9e33f36d1629fbb0b82cf94d8dffe72 -r1c11937f4f0aea905fbedfbb9c2d1782b08833f5 --- generic/xotclDecls.h (.../xotclDecls.h) (revision b385d44db9e33f36d1629fbb0b82cf94d8dffe72) +++ generic/xotclDecls.h (.../xotclDecls.h) (revision 1c11937f4f0aea905fbedfbb9c2d1782b08833f5) @@ -75,16 +75,16 @@ #endif /* Slot 11 is reserved */ /* Slot 12 is reserved */ -#ifndef XOTclRemovePMethod_TCL_DECLARED -#define XOTclRemovePMethod_TCL_DECLARED +#ifndef XOTclRemoveObjectMethod_TCL_DECLARED +#define XOTclRemoveObjectMethod_TCL_DECLARED /* 13 */ -EXTERN int XOTclRemovePMethod (Tcl_Interp * interp, +EXTERN int XOTclRemoveObjectMethod (Tcl_Interp * interp, struct XOTcl_Object * obj, CONST char * nm); #endif -#ifndef XOTclRemoveIMethod_TCL_DECLARED -#define XOTclRemoveIMethod_TCL_DECLARED +#ifndef XOTclRemoveClassMethod_TCL_DECLARED +#define XOTclRemoveClassMethod_TCL_DECLARED /* 14 */ -EXTERN int XOTclRemoveIMethod (Tcl_Interp * interp, +EXTERN int XOTclRemoveClassMethod (Tcl_Interp * interp, struct XOTcl_Class * cl, CONST char * nm); #endif #ifndef XOTclOSetInstVar_TCL_DECLARED @@ -230,10 +230,10 @@ Tcl_ObjCmdProc * proc, ClientData cd, Tcl_CmdDeleteProc * dp, int flags); #endif -#ifndef XOTclAddInstanceMethod_TCL_DECLARED -#define XOTclAddInstanceMethod_TCL_DECLARED +#ifndef XOTclAddClassMethod_TCL_DECLARED +#define XOTclAddClassMethod_TCL_DECLARED /* 42 */ -EXTERN int XOTclAddInstanceMethod (Tcl_Interp * interp, +EXTERN int XOTclAddClassMethod (Tcl_Interp * interp, struct XOTcl_Class * cl, CONST char * nm, Tcl_ObjCmdProc * proc, ClientData cd, Tcl_CmdDeleteProc * dp, int flags); @@ -267,8 +267,8 @@ int (*xOTclDeleteClass) (Tcl_Interp * interp, struct XOTcl_Class * cl); /* 10 */ void *reserved11; void *reserved12; - int (*xOTclRemovePMethod) (Tcl_Interp * interp, struct XOTcl_Object * obj, CONST char * nm); /* 13 */ - int (*xOTclRemoveIMethod) (Tcl_Interp * interp, struct XOTcl_Class * cl, CONST char * nm); /* 14 */ + int (*xOTclRemoveObjectMethod) (Tcl_Interp * interp, struct XOTcl_Object * obj, CONST char * nm); /* 13 */ + int (*xOTclRemoveClassMethod) (Tcl_Interp * interp, struct XOTcl_Class * cl, CONST char * nm); /* 14 */ Tcl_Obj * (*xOTclOSetInstVar) (struct XOTcl_Object * obj, Tcl_Interp * interp, Tcl_Obj * name, Tcl_Obj * value, int flgs); /* 15 */ Tcl_Obj * (*xOTclOGetInstVar) (struct XOTcl_Object * obj, Tcl_Interp * interp, Tcl_Obj * name, int flgs); /* 16 */ void *reserved17; @@ -296,7 +296,7 @@ int (*xOTclCallMethodWithArgs) (ClientData cd, Tcl_Interp * interp, Tcl_Obj * method, Tcl_Obj * arg, int objc, Tcl_Obj *CONST objv[], int flags); /* 39 */ int (*xOTclObjErrArgCnt) (Tcl_Interp * interp, Tcl_Obj * cmdName, Tcl_Obj * methodName, char * arglist); /* 40 */ int (*xOTclAddObjectMethod) (Tcl_Interp * interp, struct XOTcl_Object * obj, CONST char * nm, Tcl_ObjCmdProc * proc, ClientData cd, Tcl_CmdDeleteProc * dp, int flags); /* 41 */ - int (*xOTclAddInstanceMethod) (Tcl_Interp * interp, struct XOTcl_Class * cl, CONST char * nm, Tcl_ObjCmdProc * proc, ClientData cd, Tcl_CmdDeleteProc * dp, int flags); /* 42 */ + int (*xOTclAddClassMethod) (Tcl_Interp * interp, struct XOTcl_Class * cl, CONST char * nm, Tcl_ObjCmdProc * proc, ClientData cd, Tcl_CmdDeleteProc * dp, int flags); /* 42 */ int (*xOTclCreate) (Tcl_Interp * in, XOTcl_Class * class, Tcl_Obj * name, ClientData data, int objc, Tcl_Obj *CONST objv[]); /* 43 */ } XotclStubs; @@ -351,13 +351,13 @@ #endif /* Slot 11 is reserved */ /* Slot 12 is reserved */ -#ifndef XOTclRemovePMethod -#define XOTclRemovePMethod \ - (xotclStubsPtr->xOTclRemovePMethod) /* 13 */ +#ifndef XOTclRemoveObjectMethod +#define XOTclRemoveObjectMethod \ + (xotclStubsPtr->xOTclRemoveObjectMethod) /* 13 */ #endif -#ifndef XOTclRemoveIMethod -#define XOTclRemoveIMethod \ - (xotclStubsPtr->xOTclRemoveIMethod) /* 14 */ +#ifndef XOTclRemoveClassMethod +#define XOTclRemoveClassMethod \ + (xotclStubsPtr->xOTclRemoveClassMethod) /* 14 */ #endif #ifndef XOTclOSetInstVar #define XOTclOSetInstVar \ @@ -452,9 +452,9 @@ #define XOTclAddObjectMethod \ (xotclStubsPtr->xOTclAddObjectMethod) /* 41 */ #endif -#ifndef XOTclAddInstanceMethod -#define XOTclAddInstanceMethod \ - (xotclStubsPtr->xOTclAddInstanceMethod) /* 42 */ +#ifndef XOTclAddClassMethod +#define XOTclAddClassMethod \ + (xotclStubsPtr->xOTclAddClassMethod) /* 42 */ #endif #ifndef XOTclCreate #define XOTclCreate \ Index: generic/xotclInt.h =================================================================== diff -u -r6b3921be54ad92034e563a09300ab2e4f49645aa -r1c11937f4f0aea905fbedfbb9c2d1782b08833f5 --- generic/xotclInt.h (.../xotclInt.h) (revision 6b3921be54ad92034e563a09300ab2e4f49645aa) +++ generic/xotclInt.h (.../xotclInt.h) (revision 1c11937f4f0aea905fbedfbb9c2d1782b08833f5) @@ -1,7 +1,7 @@ /* -*- Mode: c++ -*- * Extended Object Tcl (XOTcl) * - * Copyright (C) 1999-2009 Gustaf Neumann, Uwe Zdun + * Copyright (C) 1999-2010 Gustaf Neumann, Uwe Zdun * * xotclInt.h -- * @@ -515,8 +515,8 @@ } XOTclObjects; typedef struct XOTclClassOpt { - XOTclCmdList *instfilters; - XOTclCmdList *instmixins; + XOTclCmdList *classfilters; + XOTclCmdList *classmixins; XOTclCmdList *isObjectMixinOf; XOTclCmdList *isClassMixinOf; XOTclAssertionStore *assertions; Index: generic/xotclStubInit.c =================================================================== diff -u -rb385d44db9e33f36d1629fbb0b82cf94d8dffe72 -r1c11937f4f0aea905fbedfbb9c2d1782b08833f5 --- generic/xotclStubInit.c (.../xotclStubInit.c) (revision b385d44db9e33f36d1629fbb0b82cf94d8dffe72) +++ generic/xotclStubInit.c (.../xotclStubInit.c) (revision 1c11937f4f0aea905fbedfbb9c2d1782b08833f5) @@ -49,8 +49,8 @@ XOTclDeleteClass, /* 10 */ NULL, /* 11 */ NULL, /* 12 */ - XOTclRemovePMethod, /* 13 */ - XOTclRemoveIMethod, /* 14 */ + XOTclRemoveObjectMethod, /* 13 */ + XOTclRemoveClassMethod, /* 14 */ XOTclOSetInstVar, /* 15 */ XOTclOGetInstVar, /* 16 */ NULL, /* 17 */ @@ -78,7 +78,7 @@ XOTclCallMethodWithArgs, /* 39 */ XOTclObjErrArgCnt, /* 40 */ XOTclAddObjectMethod, /* 41 */ - XOTclAddInstanceMethod, /* 42 */ + XOTclAddClassMethod, /* 42 */ XOTclCreate, /* 43 */ }; Index: library/store/XOTclGdbm/xotclgdbm.c =================================================================== diff -u -rc72f9f638677608fab1502cd696c8f2d6b2952f9 -r1c11937f4f0aea905fbedfbb9c2d1782b08833f5 --- library/store/XOTclGdbm/xotclgdbm.c (.../xotclgdbm.c) (revision c72f9f638677608fab1502cd696c8f2d6b2952f9) +++ library/store/XOTclGdbm/xotclgdbm.c (.../xotclgdbm.c) (revision 1c11937f4f0aea905fbedfbb9c2d1782b08833f5) @@ -348,14 +348,14 @@ return result; cl = XOTclGetClass(in, "Storage=Gdbm"); - XOTclAddIMethod(in, cl, "open", XOTclGdbmOpenMethod, 0, 0); - XOTclAddIMethod(in, cl, "close", XOTclGdbmCloseMethod, 0, 0); - XOTclAddIMethod(in, cl, "set", XOTclGdbmSetMethod, 0, 0); - XOTclAddIMethod(in, cl, "exists", XOTclGdbmExistsMethod, 0, 0); - XOTclAddIMethod(in, cl, "names", XOTclGdbmNamesMethod, 0, 0); - XOTclAddIMethod(in, cl, "unset", XOTclGdbmUnsetMethod, 0, 0); - XOTclAddIMethod(in, cl, "firstkey", XOTclGdbmFirstKeyMethod, 0, 0); - XOTclAddIMethod(in, cl, "nextkey", XOTclGdbmNextKeyMethod, 0, 0); + XOTclAddClassMethod(in, cl, "open", XOTclGdbmOpenMethod, 0, 0); + XOTclAddClassMethod(in, cl, "close", XOTclGdbmCloseMethod, 0, 0); + XOTclAddClassMethod(in, cl, "set", XOTclGdbmSetMethod, 0, 0); + XOTclAddClassMethod(in, cl, "exists", XOTclGdbmExistsMethod, 0, 0); + XOTclAddClassMethod(in, cl, "names", XOTclGdbmNamesMethod, 0, 0); + XOTclAddClassMethod(in, cl, "unset", XOTclGdbmUnsetMethod, 0, 0); + XOTclAddClassMethod(in, cl, "firstkey", XOTclGdbmFirstKeyMethod, 0, 0); + XOTclAddClassMethod(in, cl, "nextkey", XOTclGdbmNextKeyMethod, 0, 0); Tcl_SetIntObj(Tcl_GetObjResult(in), 1); return TCL_OK; Index: library/store/XOTclSdbm/xotclsdbm.c =================================================================== diff -u -rc72f9f638677608fab1502cd696c8f2d6b2952f9 -r1c11937f4f0aea905fbedfbb9c2d1782b08833f5 --- library/store/XOTclSdbm/xotclsdbm.c (.../xotclsdbm.c) (revision c72f9f638677608fab1502cd696c8f2d6b2952f9) +++ library/store/XOTclSdbm/xotclsdbm.c (.../xotclsdbm.c) (revision 1c11937f4f0aea905fbedfbb9c2d1782b08833f5) @@ -393,14 +393,14 @@ return TCL_ERROR; } - XOTclAddIMethod(in, cl, "open", XOTclSdbmOpenMethod, 0, 0); - XOTclAddIMethod(in, cl, "close", XOTclSdbmCloseMethod, 0, 0); - XOTclAddIMethod(in, cl, "set", XOTclSdbmSetMethod, 0, 0); - XOTclAddIMethod(in, cl, "exists", XOTclSdbmExistsMethod, 0, 0); - XOTclAddIMethod(in, cl, "names", XOTclSdbmNamesMethod, 0, 0); - XOTclAddIMethod(in, cl, "unset", XOTclSdbmUnsetMethod, 0, 0); - XOTclAddIMethod(in, cl, "firstkey", XOTclSdbmFirstKeyMethod, 0, 0); - XOTclAddIMethod(in, cl, "nextkey", XOTclSdbmNextKeyMethod, 0, 0); + XOTclAddClassMethod(in, cl, "open", XOTclSdbmOpenMethod, 0, 0); + XOTclAddClassMethod(in, cl, "close", XOTclSdbmCloseMethod, 0, 0); + XOTclAddClassMethod(in, cl, "set", XOTclSdbmSetMethod, 0, 0); + XOTclAddClassMethod(in, cl, "exists", XOTclSdbmExistsMethod, 0, 0); + XOTclAddClassMethod(in, cl, "names", XOTclSdbmNamesMethod, 0, 0); + XOTclAddClassMethod(in, cl, "unset", XOTclSdbmUnsetMethod, 0, 0); + XOTclAddClassMethod(in, cl, "firstkey", XOTclSdbmFirstKeyMethod, 0, 0); + XOTclAddClassMethod(in, cl, "nextkey", XOTclSdbmNextKeyMethod, 0, 0); Tcl_SetIntObj(Tcl_GetObjResult(in), 1); return TCL_OK; Index: tests/aliastest.xotcl =================================================================== diff -u -rbe717fe9ef13e09dcfabf496ca61d75e4c042422 -r1c11937f4f0aea905fbedfbb9c2d1782b08833f5 --- tests/aliastest.xotcl (.../aliastest.xotcl) (revision be717fe9ef13e09dcfabf496ca61d75e4c042422) +++ tests/aliastest.xotcl (.../aliastest.xotcl) (revision 1c11937f4f0aea905fbedfbb9c2d1782b08833f5) @@ -285,13 +285,13 @@ ? {array get ::xotcl::alias ::o,FOO,1} "::o,FOO,1 ::o::bar" ? {o info method definition FOO} "::o alias FOO ::o::bar" -# AliasDelete in XOTclRemovePMethod +# AliasDelete in XOTclRemoveObjectMethod o method FOO {} {} ? {info exists ::xotcl::alias(::o,FOO,1)} 0 ? {array get ::xotcl::alias ::o,FOO,1} "" ? {o info method definition FOO} "" -# AliasDelete in XOTclRemoveIMethod +# AliasDelete in XOTclRemoveClassMethod C method FOO {} {} ? {info exists ::xotcl::alias(::C,FOO,0)} 0 ? {array get ::xotcl::alias ::C,FOO,0} ""