home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World 1997 November
/
PCWorld_1997-11_cd.bin
/
software
/
programy
/
komix
/
DATA.Z
/
classmaker.tcl
< prev
next >
Wrap
Text File
|
1996-05-29
|
2KB
|
66 lines
#---------------------------------------------------------------------------
#
# (c) Westmount Technology 1994
#
# File: @(#)classmaker.tcl 1.2
# Author: <generated>
# Description:
#---------------------------------------------------------------------------
# SccsId = @(#)classmaker.tcl 1.2 28 Feb 1995 Copyright 1994 Westmount Technology
# Start user added include file section
# End user added include file section
Class ClassMaker : {Object} {
constructor
method destructor
}
constructor ClassMaker {class this name} {
set this [Object::constructor $class $this $name]
# Start constructor user section
# End constructor user section
return $this
}
method ClassMaker::destructor {this} {
# Start destructor user section
# End destructor user section
}
proc ClassMaker::extend {baseClass className attributes} {
if {(! [isCommand "$baseClass"]) || [isCommand "$className"]} return
set attrDef "\n"
foreach attr $attributes {
set attrDef [concat $attrDef "attribute $attr\n"]
}
set createCmd "\
Class $className : \{$baseClass\} \{\n\
method destructor\n\
constructor\n\
$attrDef\
\}"
if {[lsearch -exact ["$baseClass" info methods] destructor] != -1} {
set baseDestructCmd "\$this $baseClass::destructor\n"
} else {
set baseDestructCmd ""
}
set destructorCmd "\
method $className::destructor \{this\} \{\n\
$baseDestructCmd \
\}"
set constructorCmd "\
constructor $className \{class this name\} \{\n\
set this \[$baseClass::constructor \$class \$this \$name\]\n\
return \$this\n\
\}"
eval $createCmd
eval $destructorCmd
eval $constructorCmd
}
# Do not delete this line -- regeneration end marker