View · Search · Index
No registered users in community xowiki
in last 10 minutes

[Xotcl] Re: XOTcl 0.83 questions (continued...)

From: <uwe.zdun_at_uni-essen.de>
Date: Fri, 8 Dec 2000 12:57:35 +0100 (CET)

Hi Zoran,

ZV> The main problem is the ORDER! What I need to
ZV> do is run a script against an initialized interpreter
ZV> and construct another script which will replicate all
ZV> XOTcl objects, classes etc,etc in an fresh interpreter.
ZV> So the *ORDER* of commands is crucial.

I've played around with ordering, when I've created the -- still very
incomplete -- script creation for agents. So what I've done now is to
extend the ScirptCreator component (in packages/script-creation) to
support several classes & objects with a method makeScriptForAll. It
then writes scripts with one possible order regarding the object &
class hierarchy.

It is still very incomplete ... but should already show how things
could function. It only handles procs and instprocs, but not:

-- adavanded features, like filters, mixins, etc. (for them ordering
   matters, too .. you cannot define a mixin without the class
   being defined)
-- tcl namespaces
-- indentation

I'll hope to extend & test it ASAP to support more functionalities,
but today I will not make it. Therefore, I send what I have so far.

It already handles another crucial issue besides ordering: it can
exclude certain objects & classes from re-creation. You surely do not
want the script creator itself or the predefined stuff (like Object
and Class)to be re-created.

--Uwe

Here's the example script:

###################################################################
# load the ScriptCreator
package require ScriptCreator
ScriptCreator s

# exclude everything defined so far
s excludedObjs [s getAllInstances Object]
puts "EXCLUDED [s excludedObjs]"

# set up some classes for testing

#
# some meta classes
#
Class Meta -superclass Class
Class Meta2 -superclass Meta
Class Meta3 -superclass Meta2
#
# some classes
#
Class X
Class Y
Meta Z
Meta2 A
Meta2 B
#
# some objs
#
X x
Object o
Y y1
Y y2
A a1
A a2



puts [s makeScriptForAll]

###################################################################


-- 
Uwe Zdun
Specification of Software Systems, University of Essen
Phone: +49 201 81 00 332, Fax: +49 201 81 00 398
zdun_at_xotcl.org, uwe.zdun_at_uni-essen.de