home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World 1998 October
/
PCWorld_1998-10_cd.bin
/
software
/
prehled
/
komix
/
DATA.Z
/
vatarget.tcl
< prev
next >
Wrap
Text File
|
1997-12-01
|
18KB
|
663 lines
#---------------------------------------------------------------------------
#
# Copyright (c) 1997 by Cayenne Software, Inc.
#
# This software is furnished under a license and may be used only in
# accordance with the terms of such license and with the inclusion of
# the above copyright notice. This software or any other copies thereof
# may not be provided or otherwise made available to any other person.
# No title to and ownership of the software is hereby transferred.
#
# The information in this software is subject to change without notice
# and should not be construed as a commitment by Cayenne Software, Inc.
#
#---------------------------------------------------------------------------
#
# File : vatarget.tcl
# Author :
# Original date : November 1997
# Description : Classes for code generation
#
#---------------------------------------------------------------------------
#---------------------------------------------------------------------------
# File: @(#)vacomment.tcl /main/titanic/1
#---------------------------------------------------------------------------
# Start user added include file section
# End user added include file section
Class VAComment : {GCObject} {
constructor
method destructor
method generate
attribute comment
}
constructor VAComment {class this} {
set this [GCObject::constructor $class $this]
# Start constructor user section
# End constructor user section
return $this
}
method VAComment::destructor {this} {
# Start destructor user section
# End destructor user section
}
method VAComment::generate {this section} {
if { [string length [$this comment]] > 0 } {
set restComment [$this comment]
set newlinePos [string first "\n" $restComment ]
while {$newlinePos != -1} {
set thisline [string range $restComment 0 [expr $newlinePos - 1]]
set restComment \
[string range $restComment [expr $newlinePos + 1] end]
set newlinePos [string first "\n" $restComment ]
$section append "// $thisline\n"
}
$section append "// $restComment\n"
}
}
# Do not delete this line -- regeneration end marker
#---------------------------------------------------------------------------
# File: @(#)vafeature.tcl /main/titanic/1
#---------------------------------------------------------------------------
# Start user added include file section
# End user added include file section
Class VAFeature : {GCObject} {
constructor
method destructor
attribute name
}
constructor VAFeature {class this} {
set this [GCObject::constructor $class $this]
# Start constructor user section
# End constructor user section
return $this
}
method VAFeature::destructor {this} {
# Start destructor user section
# End destructor user section
}
# Do not delete this line -- regeneration end marker
#---------------------------------------------------------------------------
# File: @(#)vaelement.tcl /main/titanic/3
#---------------------------------------------------------------------------
# Start user added include file section
# End user added include file section
Class VAElement : {GCObject} {
constructor
method destructor
method generateBegin
method generateBeginSub
method generateMiddle
method generateEnd
method generate
attribute name
attribute description
attribute type
attribute comment
}
constructor VAElement {class this} {
set this [GCObject::constructor $class $this]
$this type "none"
# Start constructor user section
# End constructor user section
return $this
}
method VAElement::destructor {this} {
# Start destructor user section
# End destructor user section
}
method VAElement::generateBegin {this section} {
}
method VAElement::generateBeginSub {this section} {
}
method VAElement::generateMiddle {this section} {
}
method VAElement::generateEnd {this section} {
}
method VAElement::generate {this section} {
if {[$this comment] != ""} {
[$this comment] generate $section
}
$section append "//VBBegin[$this type]Info: [$this name]"
if {[$this description] != ""} {
$section append ", \"[$this description]\""
}
$section append "\n"
$this generateBegin $section
$this generateBeginSub $section
$section append "//VBPartDataFile: [$this name].vbb\n"
$this generateMiddle $section
$this generateEnd $section
$section append "//VBEnd[$this type]Info: [$this name]\n"
}
# Do not delete this line -- regeneration end marker
#---------------------------------------------------------------------------
# File: @(#)vaparts.tcl /main/titanic/2
#---------------------------------------------------------------------------
# Start user added include file section
# End user added include file section
Class VAParts : {GCObject} {
constructor
method destructor
method generate
method getCls
method setCls
method removeCls
method getEnum
method setEnum
method removeEnum
method getTypedef
method setTypedef
method removeTypedef
attribute name
attribute cls
attribute enum
attribute typedef
}
constructor VAParts {class this} {
set this [GCObject::constructor $class $this]
$this cls [Dictionary new]
$this enum [Dictionary new]
$this typedef [Dictionary new]
# Start constructor user section
# End constructor user section
return $this
}
method VAParts::destructor {this} {
# Start destructor user section
# End destructor user section
}
method VAParts::generate {this typeToClassDict} {
$typeToClassDict foreach ooplclass fileDict {
if {[[$this cls] exists [$ooplclass getName]]} {
set vbefile [TextSection new]
[[$this cls] set [$ooplclass getName]] generate $vbefile
$fileDict set "vbe" $vbefile
} else {
if {[[$this enum] exists [$ooplclass getName]]} {
set vbefile [TextSection new]
[[$this enum] set [$ooplclass getName]] generate $vbefile
$fileDict set "vbe" $vbefile
} else {
if {[[$this typedef] exists [$ooplclass getName]]} {
set vbefile [TextSection new]
[[$this typedef] set [$ooplclass getName]] generate $vbefile
$fileDict set "vbe" $vbefile
}
}
}
}
}
# Do not delete this line -- regeneration end marker
method VAParts::getCls {this name} {
return [[$this cls] set $name]
}
method VAParts::setCls {this name newCls} {
[$this cls] set $name $newCls
}
method VAParts::removeCls {this name} {
[$this cls] unset $name
}
method VAParts::getEnum {this name} {
return [[$this enum] set $name]
}
method VAParts::setEnum {this name newEnum} {
[$this enum] set $name $newEnum
}
method VAParts::removeEnum {this name} {
[$this enum] unset $name
}
method VAParts::getTypedef {this name} {
return [[$this typedef] set $name]
}
method VAParts::setTypedef {this name newTypedef} {
[$this typedef] set $name $newTypedef
}
method VAParts::removeTypedef {this name} {
[$this typedef] unset $name
}
#---------------------------------------------------------------------------
# File: @(#)vasubfeatu.tcl /main/titanic/1
#---------------------------------------------------------------------------
# Start user added include file section
# End user added include file section
Class VASubFeature : {VAFeature} {
constructor
method destructor
method generate
method generateBegin
method generateEnd
attribute description
attribute preferred
attribute noConnect
attribute comment
}
constructor VASubFeature {class this} {
set this [VAFeature::constructor $class $this]
# Start constructor user section
# End constructor user section
return $this
}
method VASubFeature::destructor {this} {
# Start destructor user section
# End destructor user section
$this VAFeature::destructor
}
method VASubFeature::generate {this section} {
$this generateBegin $section
$this generateEnd $section
}
method VASubFeature::generateBegin {this section} {
if {[$this comment] != ""} {
[$this comment] generate $section
}
$section append "//VB[$this ftype]: [$this name]"
$section append ","
if {[$this description] != ""} {
$section append " \"[$this description]\""
}
$section append ","
}
method VASubFeature::generateEnd {this section} {
$section append "\n"
}
# Do not delete this line -- regeneration end marker
#---------------------------------------------------------------------------
# File: @(#)vaattribut.tcl /main/titanic/2
#---------------------------------------------------------------------------
# Start user added include file section
# End user added include file section
Class VAAttribute : {VASubFeature} {
constructor
method destructor
method generateEnd
attribute ftype
attribute type
attribute queryMember
attribute setMember
attribute noSetting
}
constructor VAAttribute {class this} {
set this [VASubFeature::constructor $class $this]
$this ftype "Attribute"
# Start constructor user section
# End constructor user section
return $this
}
method VAAttribute::destructor {this} {
# Start destructor user section
# End destructor user section
$this VASubFeature::destructor
}
method VAAttribute::generateEnd {this section} {
$section append " [$this type], "
$section append "[$this queryMember]"
if {[$this noConnect] == "1" || [$this noSetting] == "1" || [$this setMember] != ""} {
$section append ","
}
if {[$this setMember] != ""} {
$section append " [$this setMember]"
}
if {[$this noConnect] == "1" || [$this noSetting] == "1"} {
$section append ",,"
}
if {[$this noSetting] == "1"} {
$section append " NOSETTING"
}
if {[$this noConnect] == "1"} {
$section append " NOCONNECT"
}
$section append "\n"
}
# Do not delete this line -- regeneration end marker
#---------------------------------------------------------------------------
# File: @(#)vaaction.tcl /main/titanic/1
#---------------------------------------------------------------------------
# Start user added include file section
# End user added include file section
Class VAAction : {VASubFeature} {
constructor
method destructor
method generateEnd
attribute ftype
attribute returnType
attribute actionMember
}
constructor VAAction {class this} {
set this [VASubFeature::constructor $class $this]
$this ftype "Action"
# Start constructor user section
# End constructor user section
return $this
}
method VAAction::destructor {this} {
# Start destructor user section
# End destructor user section
$this VASubFeature::destructor
}
method VAAction::generateEnd {this section} {
$section append "[$this returnType], "
$section append "[$this actionMember]"
if {[$this noConnect] == "1"} {
$section append ", NOCONNECT"
}
$section append "\n"
}
# Do not delete this line -- regeneration end marker
#---------------------------------------------------------------------------
# File: @(#)vaenum.tcl /main/titanic/1
#---------------------------------------------------------------------------
# Start user added include file section
# End user added include file section
Class VAEnum : {VAFeature} {
constructor
method destructor
method generate
attribute value
}
constructor VAEnum {class this} {
set this [VAFeature::constructor $class $this]
# Start constructor user section
# End constructor user section
return $this
}
method VAEnum::destructor {this} {
# Start destructor user section
# End destructor user section
$this VAFeature::destructor
}
method VAEnum::generate {this section} {
$section append "[$this name]"
if {[$this value] != ""} {
$section append " = [$this value]"
}
}
# Do not delete this line -- regeneration end marker
#---------------------------------------------------------------------------
# File: @(#)vatypedef.tcl /main/titanic/1
#---------------------------------------------------------------------------
# Start user added include file section
# End user added include file section
Class VATypeDef : {VAElement} {
constructor
method destructor
attribute type
}
constructor VATypeDef {class this} {
set this [VAElement::constructor $class $this]
$this type "Typedef"
# Start constructor user section
# End constructor user section
return $this
}
method VATypeDef::destructor {this} {
# Start destructor user section
# End destructor user section
$this VAElement::destructor
}
# Do not delete this line -- regeneration end marker
#---------------------------------------------------------------------------
# File: @(#)vaenums.tcl /main/titanic/1
#---------------------------------------------------------------------------
# Start user added include file section
# End user added include file section
Class VAEnums : {VAElement} {
constructor
method destructor
method generateMiddle
method addEnum
method removeEnum
attribute type
attribute enumSet
}
constructor VAEnums {class this} {
set this [VAElement::constructor $class $this]
$this type "Enum"
$this enumSet [List new]
# Start constructor user section
# End constructor user section
return $this
}
method VAEnums::destructor {this} {
# Start destructor user section
# End destructor user section
$this VAElement::destructor
}
method VAEnums::generateMiddle {this section} {
$section append "//VBEnumerators: "
set first 1
[$this enumSet] foreach enum {
if {$first} {
set first 0
} else {
$section append "\n//VB:\t\t, "
}
$enum generate $section
}
$section append "\n"
}
# Do not delete this line -- regeneration end marker
method VAEnums::addEnum {this newEnum} {
[$this enumSet] append $newEnum
}
method VAEnums::removeEnum {this oldEnum} {
[$this enumSet] removeValue $oldEnum
}
#---------------------------------------------------------------------------
# File: @(#)vaclass.tcl /main/titanic/1
#---------------------------------------------------------------------------
# Start user added include file section
# End user added include file section
Class VAClass : {VAElement} {
constructor
method destructor
method generateBegin
method generateMiddle
method addAction
method removeAction
method addAttribute
method removeAttribute
attribute parentName
attribute iconResourceId
attribute resourceDll
attribute abstract
attribute constraints
attribute constructor
attribute type
attribute actionSet
attribute attributeSet
}
constructor VAClass {class this} {
set this [VAElement::constructor $class $this]
$this type "Part"
$this actionSet [List new]
$this attributeSet [List new]
# Start constructor user section
# End constructor user section
return $this
}
method VAClass::destructor {this} {
# Start destructor user section
# End destructor user section
$this VAElement::destructor
}
method VAClass::generateBegin {this section} {
if {[$this parentName] != "" } {
$section append "//VBParent: [$this parentName]\n"
}
}
method VAClass::generateMiddle {this section} {
$section append "//VBComposerInfo: class"
if {[$this iconResourceId] != ""} {
$section append ", [$this iconResourceId], [$this resourceDll]"
}
if {[$this abstract] == "1"} {
$section append ", abstract"
}
$section append "\n"
if {[$this constraints] != ""} {
$section append "//VBConstraints: [$this constraints]\n"
}
if {[$this constructor] != ""} {
$section append "//VBConstructor: [$this constructor]\n"
}
[$this actionSet] foreach action {
$action generate $section
}
[$this attributeSet] foreach attribute {
$attribute generate $section
}
set first 1
set new_section [TextSection new]
[$this actionSet] foreach action {
if {[$action preferred] == "1"} {
if {$first} {
set first 0
} else {
$new_section append "\n//VB:\t\t, "
}
$new_section append "[$action name]"
}
}
[$this attributeSet] foreach attribute {
if {[$attribute preferred] == "1"} {
if {$first} {
set first 0
} else {
$new_section append "\n//VB:\t\t, "
}
$new_section append "[$attribute name]"
}
}
if {!$first} {
$section append "//VBPreferredFeatures: "
$section appendSect $new_section
$section append "\n"
}
}
# Do not delete this line -- regeneration end marker
method VAClass::addAction {this newAction} {
[$this actionSet] append $newAction
}
method VAClass::removeAction {this oldAction} {
[$this actionSet] removeValue $oldAction
}
method VAClass::addAttribute {this newAttribute} {
[$this attributeSet] append $newAttribute
}
method VAClass::removeAttribute {this oldAttribute} {
[$this attributeSet] removeValue $oldAttribute
}