Index: generic/predefined.h =================================================================== diff -u -r2ce14fba0764a9fcbbe7cc2f582472526a58ddf0 -r16696cd93d38760506be3dfc95fb2bb7ae972d2f --- generic/predefined.h (.../predefined.h) (revision 2ce14fba0764a9fcbbe7cc2f582472526a58ddf0) +++ generic/predefined.h (.../predefined.h) (revision 16696cd93d38760506be3dfc95fb2bb7ae972d2f) @@ -1,9 +1,6 @@ static char cmd[] = "# $Id: predefined.xotcl,v 1.12 2006/10/04 20:40:23 neumann Exp $\n" "namespace eval ::xotcl {\n" -"proc ::xotcl::setrelation args {\n" -"puts stderr \"::xotcl::setrelation is deprecated, use '::xotcl::relation $args' instead\"\n" -"uplevel ::xotcl::relation $args}\n" "namespace eval ::oo {}\n" "::xotcl::createobjectsystem ::oo::object ::oo::class\n" "if {[info command ::oo::object] ne \"\"} {\n" @@ -61,6 +58,8 @@ "return \"valid options are: [join [lsort $methods] {, }]\"}\n" "::xotcl::classInfo proc unknown {method args} {\n" "error \"unknown info option \\\"$method\\\"; [my info info]\"}\n" +"# info instargs\n" +"# istype??\n" "proc ::xotcl::info_args {inst o method} {\n" "set result [list]\n" "foreach \\\n" @@ -147,7 +146,9 @@ "if {[llength $att]>1} {foreach {att default} $att break}\n" "if {[info exists default]} {\n" "foreach i [$class info instances] {\n" -"if {![$i exists $att]} {::xotcl::setinstvar $i $att $default}}\n" +"if {![$i exists $att]} {\n" +"if {[string match {*[*]*} $default]} {set default [$i eval subst $default]}\n" +"::xotcl::setinstvar $i $att $default}}\n" "unset default}}\n" "$class invalidateobjectparameter}\n" "createBootstrapAttributeSlots ::xotcl::Class {\n" @@ -183,6 +184,11 @@ "if {[string match __* $m]} continue\n" "lappend methods $m}\n" "error \"Method '$method' unknown for slot [::xotcl::self]; valid are: {[lsort $methods]]}\"}\n" +"::xotcl::Slot instproc destroy {} {\n" +"::xotcl::instvar domain\n" +"if {$domain ne \"\"} {\n" +"$domain invalidateobjectparameter}\n" +"next}\n" "::xotcl::Slot instproc init {} {\n" "::xotcl::instvar name domain manager per-object\n" "set forwarder [expr {${per-object} ? \"forward\" : \"instforward\"}]\n" Index: generic/predefined.xotcl =================================================================== diff -u -r2ce14fba0764a9fcbbe7cc2f582472526a58ddf0 -r16696cd93d38760506be3dfc95fb2bb7ae972d2f --- generic/predefined.xotcl (.../predefined.xotcl) (revision 2ce14fba0764a9fcbbe7cc2f582472526a58ddf0) +++ generic/predefined.xotcl (.../predefined.xotcl) (revision 16696cd93d38760506be3dfc95fb2bb7ae972d2f) @@ -1,9 +1,5 @@ # $Id: predefined.xotcl,v 1.12 2006/10/04 20:40:23 neumann Exp $ namespace eval ::xotcl { - proc ::xotcl::setrelation args { - puts stderr "::xotcl::setrelation is deprecated, use '::xotcl::relation $args' instead" - uplevel ::xotcl::relation $args - } # first we create the ::oo:: object system. Actually, we do not need it. namespace eval ::oo {} @@ -151,8 +147,44 @@ } # - # Backward compatibility info subcommands; TODO: should go finally into a library. + # Backward compatibility info subcommands; # + # TODO: should go finally into a library. + # + # Obsolete methods + # + # already emulated: + # + # => info params + # info args + # info nonposargs + # info default + # + # => info instparams + # info instargs + # info instnonposargs + # info instdefault + # + # => maybe instead of "info params" and "info instparams" + # info params ?-per-object? + # + # => TODO: use "params" in serializer, and all other occurances + # + # TODO: not yet emulated: + # + # => info is + # isobject + # isclass + # ismetaclass + # ismixin + # istype?? + # + # => method (should get pre- and postconditions via positional params) + # proc + # instproc + # + # TODO mark all absolete calls at least as deprecated in library + proc ::xotcl::info_args {inst o method} { set result [list] foreach \ @@ -306,14 +338,11 @@ if {[llength $att]>1} {foreach {att default} $att break} if {[info exists default]} { # checking subclasses is not required during bootstrap - foreach i [$class info instances] { - if {![$i exists $att]} {::xotcl::setinstvar $i $att $default} - # - # re-run configure to catch slot settings from "objectparameter", - # such as defaults etc. - # TODO: still needed? - #$i configure + if {![$i exists $att]} { + if {[string match {*[*]*} $default]} {set default [$i eval subst $default]} + ::xotcl::setinstvar $i $att $default + } } unset default } @@ -383,13 +412,13 @@ } # TODO crashes currently - #::xotcl::Slot instproc destroy {} { - # ::xotcl::instvar domain - # if {$domain ne ""} { - # $domain invalidateobjectparameter - # } - # next - #} + ::xotcl::Slot instproc destroy {} { + ::xotcl::instvar domain + if {$domain ne ""} { + $domain invalidateobjectparameter + } + next + } ::xotcl::Slot instproc init {} { ::xotcl::instvar name domain manager per-object @@ -1175,12 +1204,12 @@ # - # define method method + # define method "method" # ::xotcl::Object instproc method {name arguments body} { my proc name $arguments $body } -::xotcl::Class instproc method {-per-object:switch name arguments body} { + ::xotcl::Class instproc method {-per-object:switch name arguments body} { if {${per-object}} { my proc $name $arguments $body } else { Index: generic/xotcl.c =================================================================== diff -u -rb1eea4ce4b88c47dfa29c37b9fb0e52daf30b912 -r16696cd93d38760506be3dfc95fb2bb7ae972d2f --- generic/xotcl.c (.../xotcl.c) (revision b1eea4ce4b88c47dfa29c37b9fb0e52daf30b912) +++ generic/xotcl.c (.../xotcl.c) (revision 16696cd93d38760506be3dfc95fb2bb7ae972d2f) @@ -1376,8 +1376,8 @@ XOTCL_EXITHANDLER_ON_PHYSICAL_DESTROY) return TCL_OK; - /* fprintf(stderr, " obj %p flags %.4x %d\n", obj, obj->flags, - RUNTIME_STATE(interp)->callDestroy);*/ + /*fprintf(stderr, " callDestroy obj %p flags %.6x %d active %d\n", obj, obj->flags, + RUNTIME_STATE(interp)->callDestroy, obj->activationCount);*/ if (obj->flags & XOTCL_DESTROY_CALLED) return TCL_OK; @@ -1640,7 +1640,7 @@ obj = XOTclpGetObject(interp, Tcl_DStringValue(&name)); if (obj) { - /* fprintf(stderr, " ... obj= %s\n", objectName(obj));*/ + /*fprintf(stderr, " ... obj=%s flags %.6x\n", objectName(obj), obj->flags);*/ /* in the exit handler physical destroy --> directly call destroy */ if (RUNTIME_STATE(interp)->exitHandlerDestroyRound @@ -2159,6 +2159,7 @@ if (obj->flags & XOTCL_DURING_DELETE) { return; } + /*fprintf(stderr,"CallStackDoDestroy %p flags %.6x activation %d\n",obj,obj->flags,obj->activationCount);*/ obj->flags |= XOTCL_DURING_DELETE; oid = obj->id; @@ -2179,11 +2180,13 @@ static void CallStackDestroyObject(Tcl_Interp *interp, XOTclObject *obj) { + /*fprintf(stderr, " CallStackDestroyObject %p %s activationcount %d\n", + obj, objectName(obj), obj->activationCount == 0); */ if ((obj->flags & XOTCL_DESTROY_CALLED) == 0) { /* if the destroy method was not called yet, do it now */ #ifdef OBJDELETION_TRACE - fprintf(stderr, " CallStackDestroyObject has to call destroy method for %p\n",obj); + fprintf(stderr, " CallStackDestroyObject has to call destroy method for %p\n", obj); #endif callDestroyMethod(interp, obj, 0); /*fprintf(stderr, " CallStackDestroyObject after callDestroyMethod %p\n",obj);*/ @@ -7455,14 +7458,9 @@ /* * call and latch user destroy with obj->id if we haven't */ - /*fprintf(stderr, "PrimitiveCDestroy %s flags %x\n", objectName(obj), obj->flags);*/ + /*fprintf(stderr, "PrimitiveCDestroy %s flags %.6x\n", objectName(obj), obj->flags);*/ - if (!(obj->flags & XOTCL_DESTROY_CALLED)) - fprintf(stderr, "???? PrimitiveCDestroy call destroy\n"); - callDestroyMethod(interp, obj, 0); - obj->teardown = 0; - CleanupDestroyClass(interp, cl, 0, 0); /* @@ -10690,10 +10688,15 @@ static int XOTclODestroyMethod(Tcl_Interp *interp, XOTclObject *obj) { PRINTOBJ("XOTclODestroyMethod", obj); - /* XOTCL_DESTROY_CALLED might be set already be callDestroyMethod(), + /* + * XOTCL_DESTROY_CALLED might be set already be callDestroyMethod(), * the implicit destroy calls. It is necessary to set it here for * the explicit destroy calls in the script, which reach the - * Object->destroy. */ + * Object->destroy. + */ + /*fprintf(stderr,"XOTclODestroyMethod %p flags %.6x activation %d\n", + obj,obj->flags,obj->activationCount); */ + if ((obj->flags & XOTCL_DESTROY_CALLED) == 0) { obj->flags |= XOTCL_DESTROY_CALLED; } @@ -11313,14 +11316,13 @@ XOTclObject *delobj; int result; - /*fprintf(stderr, " dealloc %s\n",ObjStr(object));*/ - if (GetObjectFromObj(interp, object, &delobj) != TCL_OK) return XOTclVarErrMsg(interp, "Can't destroy object ", - ObjStr(object), " that does not exist.", - (char *) NULL); + ObjStr(object), " that does not exist.", (char *) NULL); - /* fprintf(stderr, "dealloc obj=%s, opt=%p\n", objectName(delobj), delobj->opt);*/ + /*fprintf(stderr, "dealloc obj=%s flags %.6x activation %d opt=%p\n", + objectName(delobj), delobj->flags, delobj->activationCount, delobj->opt);*/ + result = freeUnsetTraceVariable(interp, delobj); if (result != TCL_OK) { return result; @@ -11329,7 +11331,6 @@ /* * latch, and call delete command if not already in progress */ - if (RUNTIME_STATE(interp)->exitHandlerDestroyRound != XOTCL_EXITHANDLER_ON_SOFT_DESTROY) { CallStackDestroyObject(interp, delobj);