home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World 1998 October
/
PCWorld_1998-10_cd.bin
/
software
/
prehled
/
komix
/
DATA.Z
/
pbgentor.tcl
< prev
next >
Wrap
Text File
|
1997-11-07
|
55KB
|
1,916 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 : pbgentor.tcl
# Author :
# Original date : November 1997
# Description : Classes for code generation
#
#---------------------------------------------------------------------------
#---------------------------------------------------------------------------
# File: @(#)pbfilehand.tcl /main/titanic/1
#---------------------------------------------------------------------------
# Start user added include file section
# End user added include file section
require "filehandle.tcl"
Class PBFileHandler : {FileHandler} {
constructor
method destructor
method getFileTypes
method getSpecialFiles
method setImpFrom
attribute srwType
attribute srmType
attribute srsType
attribute sruType
}
constructor PBFileHandler {class this} {
set this [FileHandler::constructor $class $this]
$this srwType "window"
$this srmType "menu"
$this srsType "structure"
$this sruType "userobject"
# Start constructor user section
# End constructor user section
return $this
}
method PBFileHandler::destructor {this} {
# Start destructor user section
# End destructor user section
$this FileHandler::destructor
}
method PBFileHandler::getFileTypes {this} {
set list [List new]
$list append [$this srwType]
$list append [$this srmType]
$list append [$this srsType]
$list append [$this sruType]
return $list
}
method PBFileHandler::getSpecialFiles {this} {
return [List new]
}
method PBFileHandler::setImpFrom {this fileName class} {
$this FileHandler::setImpFrom $fileName $class
}
# Do not delete this line -- regeneration end marker
#---------------------------------------------------------------------------
# File: @(#)pbgenerato.tcl /main/titanic/8
#---------------------------------------------------------------------------
# Start user added include file section
require "pbllibrary.tcl"
require "pbtarget.tcl"
# End user added include file section
require "generator.tcl"
Class PBGenerator : {Generator} {
constructor
method destructor
method generate
method check
method isAutoLibrary
method getPblLibrary
method checkOldSrc
method exportSrc
method importSrc
attribute autoLibrary
attribute classesToImport
attribute removeOldLib
attribute pblLibrary
}
constructor PBGenerator {class this} {
set this [Generator::constructor $class $this]
$this autoLibrary -1
$this removeOldLib 1
# Start constructor user section
# End constructor user section
return $this
}
method PBGenerator::destructor {this} {
# Start destructor user section
# End destructor user section
$this Generator::destructor
}
method PBGenerator::generate {this classList} {
set typeToClassDictionary [Dictionary new]
set pbModel [PBModel new]
set regenerator [PBRegenerator new]
set fileHandler [PBFileHandler new]
$classList foreach class {
# because only for global classes (pb entries) code-files
# are generated, skip non globals
if ![$class isGlobalType] {
continue
}
set pbdefinition [$class generate $pbModel]
if {$pbdefinition == ""} {
continue
}
set entry [$pbdefinition libraryEntry]
if {$entry == ""} {
continue
}
set fileType [$entry getFileType]
set fileDesc [$fileHandler openFile $class $fileType]
if {$fileDesc != ""} {
$regenerator regenerate $entry $fileDesc
$fileHandler closeFile $fileDesc
}
}
$pbModel generate $typeToClassDictionary
return $typeToClassDictionary
}
method PBGenerator::check {this classList} {
set errornr 0
set cc [ClientContext::global]
set PhaseV [$cc currentPhase]
set sysName "PBBuiltins"
set sysV [$PhaseV findSystemVersion $sysName "system"]
if [$sysV isNil] {
m4_error $E_NOBUILTINDES $sysName
incr errornr 1
} else {
$classList foreach class {
if ![$class isGlobalType] {
continue
}
# in pbimport::generateOoplModel tests for valid classes
# for checking.
# puts " Language dependence checking for class: [$class getName]"
set tmpError [$class check]
incr errornr $tmpError
# puts " number of returned errors: $tmpError"
}
}
return $errornr
}
method PBGenerator::isAutoLibrary {this} {
set tmp [$this autoLibrary]
if {[$this autoLibrary] < 0} {
$this autoLibrary [PBGenerator::checkAutoLibrary]
}
return [$this autoLibrary]
}
proc PBGenerator::checkAutoLibrary {} {
set autoLibrary [PBGenerator::getAutoLibraryProp]
# platform check
global tcl_platform
if {![catch {set platform $tcl_platform(platform)}]} {
if {([string length $platform] >= 3) && \
([string tolower [string range $platform 0 2]] != "win")} {
m4_message $MPB_AUTOLIBNOTSUP $platform
set autoLibrary 0
}
}
if {$autoLibrary} {
m4_message $MPB_AUTOLIBON
} else {
m4_message $MPB_AUTOLIBOFF
}
return $autoLibrary
}
proc PBGenerator::getAutoLibraryProp {} {
# retrieve auto library setting and look if it is correct
# default is off (False)
set cc [ClientContext::global]
set cs [$cc currentSystem]
set autoLibrary [$cs getPropertyValue pb_auto_library]
if {$cs == ""} {
return 0
}
if { [string tolower $autoLibrary] == "on" } {
set autoLibrary 1
} elseif { [string tolower $autoLibrary] == "off" } {
set autoLibrary 0
} elseif { $autoLibrary == "0" } {
set autoLibrary 0
} elseif { $autoLibrary == "1" } {
set autoLibrary 1
} else {
# default:
set autoLibrary 0
}
return $autoLibrary
}
proc PBGenerator::setAutoLibraryProp {value} {
set cc [ClientContext::global]
set cs [$cc currentSystem]
if {$cs == ""} {
return
}
$cs setProperty pb_auto_library $value
}
method PBGenerator::getPblLibrary {this} {
set libName [[[[ClientContext::global] currentSystem] system] name]
set libName [string tolower $libName]
if {[$this pblLibrary] == ""} {
$this pblLibrary [PblLibrary new]
}
# if no library exists create
if ![[$this pblLibrary] existsLibrary] {
[$this pblLibrary] createLibrary
}
return [$this pblLibrary]
}
proc PBGenerator::checkOldSource {} {
# nothing yet
}
method PBGenerator::checkOldSrc {this classList} {
# if any .old file is present return True
set files [fstorage::dir]
$classList foreach class {
if ![$class isGlobalType] {
continue
}
set kind [$class getPBClassKind]
if {$kind == ${PBClassKind::NotSupported}} {
continue
}
set entryName [$class getName]
set entryType [PBLibraryEntry::getFileTypeByKind $kind]
set entryExt [PBLibraryEntry::getSrcFileTypeByFileType $entryType]
set fileName "$entryName\.$entryExt"
if {[regexp "\.old" $files]} {
# There is one so..., True
return 1
}
}
# no classes, or old files:
return 0
}
method PBGenerator::exportSrc {this classList} {
# first determine whether autoLibrary
if [$this isAutoLibrary] {
# get Library handler
$this pblLibrary [$this getPblLibrary]
# check whether there are old-libraries
if {[[$this pblLibrary] existsOldLibrary]} {
m4_error $EPB_OLDLIBEXISTS $libName
# there is an old library
# so turn off auto feature
$this autoLibrary 0
return 1
} else {
# export sourcefiles from library
# if they don't exists inside library
# it does not matter (import will create them)
m4_message $MPB_EXPORTING
set errornr [[$this pblLibrary] export $classList]
return $errornr
}
# now it's possible to generate and create source...
}
return 0
}
method PBGenerator::importSrc {this classList} {
# if there were no errors do import
# but if autoLibrary is (turned) off, do nothing
if [$this isAutoLibrary] {
# check whether there are old-libraries
if {[[$this pblLibrary] existsOldLibrary]} {
# there is an old library
# so do nothing
} else {
# before importing copy library
[$this pblLibrary] createOldLibrary
# now import sourcefiles to library
m4_message $MPB_IMPORTING
set errornr [[$this pblLibrary] import $classList]
if {$errornr == 0} {
# nothing went wrong, so remove old library
[$this pblLibrary] removeOldLibrary
} else {
# something went wrong durig import so restore the old
# library
[$this pblLibrary] restoreLibrary
return 1
}
}
# everything went ok
return 0
} else {
return 1
}
}
# Do not delete this line -- regeneration end marker
#---------------------------------------------------------------------------
# File: @(#)pbregenera.tcl /main/titanic/16
#---------------------------------------------------------------------------
# Start user added include file section
# End user added include file section
require "regenerato.tcl"
Class PBRegenerator : {Regenerator} {
constructor
method destructor
method regenerate
method checkEntryFiles
method processFile
method processForward
method processType
method skipType
method processVariables
method skipVariables
method processPrototypes
method processStructure
method processEntryStructure
method processEvent
method skipEvent
method processFunction
method skipFunction
method processSubroutine
method skipSubroutine
method processBinaryData
method skipBinaryData
method processOn
method skipOn
method processOnCreate
method processOnDestroy
method processParameter
method addObsoleteClass
method removeObsoleteClass
attribute currentClass
attribute currentEntry
attribute obsolete
attribute pbdebug
attribute obsoleteClassSet
}
constructor PBRegenerator {class this} {
set this [Regenerator::constructor $class $this]
$this obsoleteClassSet [List new]
# Start constructor user section
$this pbdebug 0
# End constructor user section
return $this
}
method PBRegenerator::destructor {this} {
# Start destructor user section
# End destructor user section
$this Regenerator::destructor
}
method PBRegenerator::regenerate {this entry fileDesc} {
$this currentEntry $entry
$this obsolete 0
set oldFileDesc $fileDesc
$this currentClass [[$this currentEntry] globalDefinition]
# All functions return True (!= 0) if syntax is correctly ended.
# This allows checking of an not correctly terminated file.
# if obsolete code is present then stop
if { ![$this checkEntryFiles $entry $fileDesc]} {
return 0
}
# process file:
# header:
if { ![eof $fileDesc] } {
set line [gets $fileDesc]
} else {
set line ""
}
if { [regexp {^ *\$PBExportHeader\$(.*)} $line \
total entryFileName] } {
if { ![eof $fileDesc] } {
set line [gets $fileDesc]
} else {
set line ""
}
}
if { [regexp {^ *\$PBExportComments\$(.*)} $line \
total entryComment] } {
[$this currentEntry] exportComments $entryComment
if { ![eof $fileDesc] } {
set line [gets $fileDesc]
} else {
set line ""
}
}
if { [regexp {^ *forward(.*|)} $line total] } {
$this processForward [$this currentEntry] $fileDesc
if { ![eof $fileDesc] } {
set line [gets $fileDesc]
} else {
set line ""
}
}
while { ![eof $fileDesc] } {
if { [regexp {^ *global type ([^ ]*) from ([^ ]*) *}\
$line total type from] } {
# when called correctly the type corresponds with currentEntry!
# if unsure a name comparison CAN be done
$this currentClass [[$this currentEntry] globalDefinition]
[$this currentClass] isRegenerated 1
if {[string tolower $from] == "structure"} {
# process type body and add variables to body of entry
set ret [$this processStructure [$this currentClass] $fileDesc]
} else {
# process type body and add variables to body of entry
set ret [$this processType [$this currentClass] $fileDesc]
}
} elseif { [regexp {^ *global ([^ ]*) ([^ ]*) *}\
$line total type name] } {
# just to be on the save side
$this currentClass [[$this currentEntry] globalDefinition]
[$this currentClass] isRegenerated 1
} elseif { [regexp {^ *type variables[ ]*} $line total] } {
# first get vars TextSection
if { [[$this currentClass] isA "PBClass"] } {
if { [[$this currentClass] nonModeledInstanceVars] != "" } {
set vars [[$this currentClass] nonModeledInstanceVars]
} else {
set vars [TextSection new]
[$this currentClass] nonModeledInstanceVars $vars
}
if { [[$this currentClass] nonModeledInstanceVars] == "" } {
}
set ret [$this processVariables $vars $fileDesc]
} else {
# currentClass cannot contain instance vars though it is present
m4_warning $W_OBSOLVARS [[$this currentClass] name]
$this obsolete 1
set ret [$this skipVariables $fileDesc]
if { ! $ret } {
m4_error $E_ENDEXPECT "instance variables" \
[[$this currentClass] name]
}
}
} elseif { [regexp {^ *shared variables.*} $line total] } {
# shared variables are part of entry, so set currentClass
# to given entry:
$this currentClass [[$this currentEntry] globalDefinition]
# first get vars TextSection
if { [[$this currentClass] isA "PBClass"] } {
if { [[$this currentClass] nonModeledSharedVars] != "" } {
set vars [[$this currentClass] nonModeledSharedVars]
} else {
set vars [TextSection new]
[$this currentClass] nonModeledSharedVars $vars
}
if { [[$this currentClass] nonModeledSharedVars] == "" } {
}
set ret [$this processVariables $vars $fileDesc]
} else {
# currentClass cannot contain instance vars though it is present
m4_warning $W_OBSOLVARS [[$this currentClass] name]
$this obsolete 1
set ret [$this skipVariables $fileDesc]
if { ! $ret } {
m4_error $E_ENDEXPECT "variables" \
[[$this currentClass] name]
}
}
} elseif { [regexp {^ *forward prototypes.*} $line total] } {
set ret [$this processPrototypes [$this currentClass] $fileDesc]
} elseif { [regexp {^ *type ([^ ]*) from ([^ ]*) within ([^ ]*)(| | .*)}\
$line total name from within] } {
# first find corresponding class (recursively)
if { [[[$this currentEntry] globalDefinition] isA \
"PBVisualContainer"] } {
$this currentClass [[[$this currentEntry] globalDefinition] \
findContainedClass $name 1]
if {[$this currentClass] != ""} {
[$this currentClass] isRegenerated 1
# found now use container to move to sortedContainedClass
set containee [[$this currentClass] container]
if {$containee != ""} {
$containee moveContainedClass [$this currentClass]
}
set ret [$this processType [$this currentClass] $fileDesc]
} else {
# object is gone
m4_warning $W_OBSOLPROPS $name
$this obsolete 1
set ret [$this skipType $fileDesc]
}
} else {
# a contained class is found but cannot be inserted
m4_warning $W_OBSOLCLASSENTRY $name [[$this currentEntry] \
getName]
$this addObsoleteClass $name
$this obsolete 1
set ret [$this skipType $fileDesc]
}
} elseif { [regexp {^ *type ([^ ]*) *from *([^ ]*)(| | .*)}\
$line total name from] } {
if { [string tolower $from] == "structure" } {
# if a structure then do nothing, inserted by generator
set ret [$this skipType $fileDesc]
} elseif { [[[$this currentEntry] globalDefinition] isA \
"PBVisualContainer"] } {
# first find corresponding class (recursively)
$this currentClass [[[$this currentEntry] globalDefinition] \
findContainedClass $name 1]
if {[$this currentClass] != ""} {
[$this currentClass] isRegenerated 1
# found now use container to move to sortedContainedClass
set containee [[$this currentClass] container]
if {$containee != ""} {
$containee moveContainedClass [$this currentClass]
}
set ret [$this processType [$this currentClass] $fileDesc]
} else {
# object is gone
m4_warning $W_OBSOLPROPS $name
$this obsolete 1
set ret [$this skipType $fileDesc]
}
} else {
# a contained class is found but cannot be inserted
m4_warning $W_OBSOLCLASSENTRY $name \
[[$this currentEntry] getName]
$this addObsoleteClass $name
$this obsolete 1
set ret [$this skipType $fileDesc]
}
if { ! $ret } {
m4_error $E_ENDEXPECT "type" [[$this currentClass] name]
}
} elseif { [regexp {^ *event *([^ ]*)::([^ ]*) *;(.*)$}\
$line total class name methLine] } {
set classname "$class::$name"
if {([[[$this currentEntry] globalDefinition] isA \
"PBVisualContainer"]) && \
[[[$this currentEntry] globalDefinition] \
controlPresentInSupers $class] } {
set body [TextSection new]
set ret [$this processEvent $body $fileDesc $line]
$body append "end event\n"
if {![[[[$this currentEntry] globalDefinition] \
derivedControlBody] exists $classname]} {
[[$this currentEntry] globalDefinition] \
setDerivedControlBody $classname $body
} else {
m4_warning $W_OBSOLMETHCONTR $name $class
$this obsolete 1
}
} else {
m4_warning $W_OBSOLMETHCONTR $name $classname
$this obsolete 1
set ret [$this skipEvent $fileDesc]
}
# generate syntax error if ret is false
if { ! $ret } {
m4_error $E_ENDEXPECTMETHOD "event" $name \
[[$this currentClass] name]
}
} elseif { [regexp {^ *on *([^ ]*)::([^ ]*) *;(.*)$}\
$line total class name methLine] } {
set classname "$class::$name"
if {([[[$this currentEntry] globalDefinition] isA \
"PBVisualContainer"]) && \
[[[$this currentEntry] globalDefinition] \
controlPresentInSupers $class] } {
set body [TextSection new]
set ret [$this processOn $body $fileDesc $line]
$body append "end on\n"
if {![[[[$this currentEntry] globalDefinition] \
derivedControlBody] exists $classname]} {
[[$this currentEntry] globalDefinition] \
setDerivedControlBody $classname $body
} else {
m4_warning $W_OBSOLMETHCONTR $name $class
$this obsolete 1
}
} else {
m4_warning $W_OBSOLMETHCONTR $name $classname
$this obsolete 1
set ret [$this skipOn $fileDesc]
}
# generate syntax error if ret is false
if { ! $ret } {
m4_error $E_ENDEXPECTMETHOD "event" $name \
[[$this currentClass] name]
}
} elseif { [regexp {^ *event *([^ ]*) *; *(call[^;]*;|)(.*)$}\
$line total name callSuper methLine] } {
# first check for association method
if { [regexp "^ *${PBCookie::associationAccessorMethod}" \
$methLine] } {
# association
set ret [$this skipEvent $fileDesc]
} elseif { [$this currentClass] == "" } {
m4_warning $W_OBSOLEVENT $name ""
$this obsolete 1
set ret [$this skipEvent $fileDesc]
} else {
set body ""
# first find corresponding function
# so check whether it can have functions:
if { ![[$this currentClass] isA "PBClass"] } {
# currentClass cannot contain events though it is present
m4_warning $W_OBSOLEVENTCLASS $name \
[[$this currentClass] name]
$this obsolete 1
set ret [$this skipEvent $fileDesc]
} else {
set event [[$this currentClass] findEvent $name]
if { $event != "" } {
# perfect matching method, if it has a body then move
# this body to another method (check function, not the
# events (no event overloading))
if { [$event body] != ""} {
# body is already filled, although this was perfect
# match, so find other and move body to other
# matching function (by name only)
set body [$event body]
set func [[$this currentClass] matchObjectFunction \
$name]
if {$func != ""} {
# matchOF already checks for empty bodies
m4_warning $W_OLDMETHOD $name \
[[$this currentClass] name]
$func body $body
} else {
# nothing suitable found: all already filled,
# or no matching names
m4_warning $W_OBSOLEVENT $name \
[[$this currentClass] name]
$this obsolete 1
}
}
set body [TextSection new]
$event body $body
if { $callSuper != "" } {
$event extendAncestorScript 1
}
} else {
# find a matching function and store code in this body
# preceding a comment line
# not find a event (no overloading)
set func [[$this currentClass] matchObjectFunction \
$name]
if {$func != ""} {
# matchOF already checks for empty bodies
set body [TextSection new]
m4_warning $W_OLDMETHOD $name \
[[$this currentClass] name]
$func body $body
$body append {// Old code section}
$body append "\n"
} else {
# nothing suitable found: all already filled, or no
# matching names
m4_warning $W_OBSOLEVENT $name \
[[$this currentClass] name]
$this obsolete 1
}
}
# if a body set then there was some match, and now fill body.
if { $body != "" } {
# processEvent checks association methods
# (and skip those)
set ret [$this processEvent $body $fileDesc $methLine]
} else {
# obsolete code user defined
$this obsolete 1
set ret [$this skipEvent $fileDesc]
}
}
}
# generate syntax error if ret is false
if { ! $ret } {
m4_error $E_ENDEXPECTMETHOD "event" $name \
[[$this currentClass] name]
}
} elseif { [regexp {^ *(|[^ ]* )function ([^ ]*) ([^ ]*) (\([^);]*\)) *; *(.*)$}\
$line total access type name args methLine] } {
# obsolete code when not a association
if { [regexp "^ *${PBCookie::associationAccessorMethod}" \
$methLine] } {
# association
set ret [$this skipFunction $fileDesc]
} elseif { [$this currentClass] == "" } {
$this obsolete 1
set ret [$this skipFunction $fileDesc]
} else {
set body ""
# first find corresponding function
# so check whether it can have functions:
if { ![[$this currentClass] isA "PBClass"] } {
# currentEntry cannot contain functions though it is present
m4_warning $W_OBSOLFUNCTCLASS $name \
[[$this currentClass] name]
$this obsolete 1
set ret [$this skipFunction $fileDesc]
} else {
# generate parameter list for finding correct function
# (overloading)
set paramList [$this processParameter $args]
set function [[$this currentClass] findObjectFunction \
$name $paramList]
if { $function != "" } {
# perfect matching method, if it has a body then move
# this body to another method (first check function
# then events
if { [$function body] != ""} {
# body is already filled, although this was
# perfect match, so find other and move body
# to other matching function (by name only)
set body [$function body]
set func [[$this currentClass] \
matchObjectFunction $name]
if {$func != ""} {
# matchOF already checks for empty bodies
$func body $body
} else {
set event [[$this currentClass] matchEvent \
$name]
if {$event != ""} {
# matchE already checks for empty bodies
$event body $body
} else {
# nothing suitable found: all already
# filled, or no matching names
m4_warning $W_OBSOLMETHOD $name \
[[$this currentClass] name]
$this obsolete 1
}
}
}
set body [TextSection new]
$function body $body
} else {
# find a matching and store code in
# this body preceding a comment line
set func [[$this currentClass] matchObjectFunction \
$name]
if {$func != ""} {
# matchOF already checks for empty bodies
set body [TextSection new]
m4_warning $W_OLDMETHOD $name \
[[$this currentClass] name]
$func body $body
$body append {// Old code section}
$body append "\n"
} else {
set event [[$this currentClass] matchEvent $name]
if {$event != ""} {
# matchE already checks for empty bodies
m4_warning $W_OLDMETHOD $name \
[[$this currentClass] name]
set body [TextSection new]
$event body $body
$body append {// Old code section}
$body append "\n"
} else {
# nothing suitable found: all already filled,
# or no matching names
m4_warning $W_OBSOLFUNCT $name \
[[$this currentClass] name]
$this obsolete 1
}
}
}
# if a body set then there was some match, and now
# fill body.
if { $body != "" } {
# processFunction checks association methods
# (and skip those)
set ret [$this processFunction $body $fileDesc \
$methLine]
} else {
# obsolete code, user defined
$this obsolete 1
set ret [$this skipFunction $fileDesc]
}
}
}
# generate syntax error if ret is false
if { ! $ret } {
m4_error $E_ENDEXPECTMETHOD "function" $name \
[[$this currentClass] name]
}
} elseif { [regexp {^ *(|[^ ]* )subroutine ([^ ]*) (\([^);]*\)) *; *(.*)$}\
$line total access name args methLine] } {
# first check for association method
if { [regexp "^ *${PBCookie::associationAccessorMethod}" \
$methLine] } {
# association
set ret [$this skipSubroutine $fileDesc]
} elseif { [$this currentClass] == "" } {
$this obsolete 1
set ret [$this skipSubroutine $fileDesc]
} else {
set body ""
# first find corresponding function
# so check whether it can have functions:
if { ![[$this currentClass] isA "PBClass"] } {
# currentEntry cannot contain functions though it is present
m4_warning $W_OBSOLSUBRTCLASS $name \
[[$this currentClass] name]
$this obsolete 1
set ret [$this skipSubroutine $fileDesc]
} else {
# generate parameter list for finding correct function
# (overloading)
set paramList [$this processParameter $args]
set function [[$this currentClass] findObjectFunction \
$name $paramList]
if { $function != "" } {
# perfect matching method, if it has a body then move
# this body to another method (first check function
# then events
if { [$function body] != ""} {
# body is already filled, although this was perfect
# match, so find other and move body to other
# matching function (by name only)
set body [$function body]
set func [[$this currentClass] matchObjectFunction \
$name]
if {$func != ""} {
# matchOF already checks for empty bodies
$func body $body
} else {
set event [[$this currentClass] matchEvent\
$name]
if {$event != ""} {
# matchE already checks for empty bodies
$event body $body
} else {
# nothing suitable found: all already
# filled, or no matching names
m4_warning $W_OBSOLMETHOD $name \
[[$this currentClass] name]
$this obsolete 1
}
}
}
set body [TextSection new]
$function body $body
} else {
# find a matching and store code in this body
# preceding a comment line
set func [[$this currentClass] matchObjectFunction \
$name]
if {$func != ""} {
# matchOF already checks for empty bodies
set body [TextSection new]
m4_warning $W_OLDMETHOD $name [[$this currentClass]
name]
$func body $body
$body append {// Old code section}
$body append "\n"
} else {
set event [[$this currentClass] matchEvent $name]
if {$event != ""} {
# matchE already checks for empty bodies
m4_warning $W_OLDMETHOD $name \
[[$this currentClass] name]
set body [TextSection new]
$event body $body
$body append {// Old code section}
$body append "\n"
} else {
# nothing suitable found: all already filled,
# or no matching names
m4_warning $W_OBSOLSUBRT $name \
[[$this currentClass] name]
$this obsolete 1
}
}
}
# if a body set then there was some match,
# and now fill body.
if { $body != "" } {
# processSubroutine checks association methods
# (and skip those)
set ret [$this processSubroutine $body $fileDesc \
$methLine]
} else {
# obsolete code user defined
$this obsolete 1
set ret [$this skipSubroutine $fileDesc]
}
}
}
# generate syntax error if ret is false
if { ! $ret } {
m4_error $E_ENDEXPECTMETHOD "subroutine" $name \
[[$this currentClass] name]
}
} elseif { [regexp {^ *on *([^ .]*)\.([^ ]*) *$} $line \
total class name ] } {
# first find corresponding class as defined by class in on
set onClass ""
if { [$this currentClass] != "" } {
if { [string tolower [[$this currentClass] name]] == \
[string tolower $class] } {
set onClass [$this currentClass]
} else {
if {[[[$this currentEntry] globalDefinition] isA \
"PBVisualContainer"]} {
set onClass [[[$this currentEntry] globalDefinition] \
findContainedClass $name 1]
}
}
} else {
if {[[[$this currentEntry] globalDefinition] isA \
"PBVisualContainer"]} {
set onClass [[[$this currentEntry] globalDefinition] \
findContainedClass $name 1]
}
}
if { $onClass == "" } {
# onClass not present
# but maybe it's a creation of menuitem present in one
# of the superclasses...
if {([string tolower $name] == "create") && \
([[$this currentEntry] getKind] == \
${PBClassKind::Menu}) && \
[[[$this currentEntry] globalDefinition] \
controlPresentInSupers $class] } {
set classname "$class::create"
set body [TextSection new]
set ret [$this processOn $body $fileDesc $line]
$body append "end on\n"
if {![[[[$this currentEntry] globalDefinition] \
derivedControlBody] exists $classname]} {
[[$this currentEntry] globalDefinition] \
setDerivedControlBody $classname $body
} else {
m4_warning $W_OBSOLMETHCONTR $name $class
$this obsolete 1
}
} else {
m4_warning $W_OBSOLMETHCONTR $name $class
$this obsolete 1
set ret [$this skipOn $fileDesc]
}
if { ! $ret } {
m4_error $E_ENDEXPECTMETHOD "on" $name $class
}
} else {
# first find corresponding function
# so check whether it can have functions:
if { [$onClass isA "PBClass"] } {
if { [string tolower $name] == "destroy" } {
set methLine ""
if { [$onClass isA "PBVisual"] } {
# only Visual class has an extensive destroy section
set ret [$this processOnDestroy $onClass \
$fileDesc $methLine]
} else {
set ret [$this skipOn $fileDesc]
}
if { ! $ret } {
m4_error $E_ENDEXPECTMETHOD "on" $name \
[$onClass name]
}
} elseif { [string tolower $name] == "create" } {
set methLine ""
if { [$onClass isA "PBVisual"] } {
# only Visual class has an extensive create section
set ret [$this processOnCreate $onClass \
$fileDesc $methLine]
} else {
set ret [$this skipOn $fileDesc]
}
if { ! $ret } {
m4_error $E_ENDEXPECTMETHOD "on" $name \
[$onClass name]
}
} else {
# this is a on event (hopefully)
set event [onClass findEvent $name]
if { $event != "" } {
if { [$event body] } {
set body [$event body]
} else {
set body [TextSection new]
$event body $body
}
set ret [$this processOn $body $fileDesc $methLine ]
if { ! $ret } {
m4_error $E_ENDEXPECTMETHOD "on" $name \
[$onClass name]
}
} else {
# obsolete code
m4_warning $W_OBSOLON $name [$onClass name]
$this obsolete 1
set ret [$this skipOn $fileDesc]
# generate syntax error if ret is false
if { ! $ret } {
m4_error $E_ENDEXPECTMETHOD "on" $name \
[$onClass name]
}
}
}
} else {
# currentClass cannot contain events though it is present
m4_warning $W_OBSOLONCLASS $name [$onClass name]
$this obsolete 1
set ret [$this skipOn $fileDesc]
if { ! $ret } {
m4_error $E_ENDEXPECTMETHOD "on" $name [$onClass name]
}
}
}
} elseif { [regexp {^ *on ([^ ;]*) *;(.*)$} $line \
total name methLine] } {
# treated as event!
# first find corresponding event
# so check whether it can have functions:
if { [$this currentClass] == "" } {
$this obsolete 1
m4_warning $W_OBSOLON $name ""
set ret [$this skipOn $fileDesc]
} elseif { [[$this currentClass] isA "PBClass"] } {
set event [[$this currentClass] findEvent $name]
if { $event != "" } {
if { [$event body] != ""} {
set body [$event body]
} else {
set body [TextSection new]
$event body $body
}
set ret [$this processOn $body $fileDesc $methLine]
} else {
# obsolete code
m4_warning $W_OBSOLON $name [[$this currentClass] name]
$this obsolete 1
set ret [$this skipOn $fileDesc]
}
} else {
# currentClass cannot contain events though it is present
m4_warning $W_OBSOLONCLASS $name [[$this currentClass] name]
$this obsolete 1
set ret [$this skipOn $fileDesc]
}
# generate syntax error if ret is false
if { [$this currentClass] == "" } {
set tmp ""
} else {
set tmp [[$this currentClass] name]
}
if { ! $ret } {
m4_error $E_ENDEXPECTMETHOD "on" $name $tmp
}
} elseif { [regexp "^ *${PBCookie::startBinaryDataSection}.*"\
$line total name methLine] } {
# first find corresponding event
# so check whether it can have functions:
$this currentClass [[$this currentEntry] globalDefinition]
if { [[$this currentClass] isA "PBVisualContainer"] } {
if { [$this currentClass] binaryData != "" } {
set binaryData [[$this currentClass] binaryData]
} else {
set binaryData [TextSection new]
[$this currentClass] binaryData $body
}
set ret [$this processBinaryData $binaryData $fileDesc]
# generate syntax error if ret is false
if { ! $ret } {
m4_error $E_ENDEXPECTBINARY [[$this currentClass] name]
}
} else {
# currentClass cannot contain events though it is present
m4_warning $W_OBSOLBINARY [[$this currentClass] name]
$this obsolete 1
set ret [$this skipBinaryData $fileDesc]
if { ! $ret } {
m4_error $E_ENDEXPECTBINARY [[$this currentClass] name]
}
}
} elseif { [regexp {^ *$} $line] } {
set ret 1
} else {
puts "Unexpected syntax: $line"
puts " Must be a begin-line of a section (eg. method, type declaration)"
puts " Possibly a wrong end-line (eg. end-line inside comment)"
set ret 0
}
# end parser
if { ! $ret } {
# something went wrong
m4_error $E_STOP [[$this currentEntry] getName]
return
# return 0
}
if { ![eof $fileDesc] } {
set line [gets $fileDesc]
} else {
set line ""
}
}
if { [$this obsolete] == 1 } {
# read file pointed by setting pointer back and reread it
seek $fileDesc 0
set cont [TextSection new]
while { ![eof $fileDesc] } {
$cont append "[gets $fileDesc]\n"
}
# write old file
set oldFileHandler [PBFileHandler new]
$oldFileHandler writeSectionToFile $cont \
[[[$this currentEntry] globalDefinition] ooplClass] \
"old.[[$this currentEntry] getFileType]"
}
# everthing went succesfully (maybe some obsolete code)
return
# return 1
}
method PBRegenerator::checkEntryFiles {this entry fileDesc} {
# if any .old file is present stop regenerating!
set files [fstorage::dir]
if {[regexp "[$entry getName]\.old" $files]} {
m4_error $E_HASOLD
return 0
} else {
return 1
}
}
method PBRegenerator::processFile {this entry fileDesc} {
# none (obsolete)
}
method PBRegenerator::processForward {this entry fileDesc} {
# read and skip all lines until a "end forward"
# return false if eof
set done 0
while { ![eof $fileDesc] && !$done } {
set line [gets $fileDesc]
if { [regexp {^end forward[ \t]*$} $line ] } {
set done 1
break
}
}
set ret $done
return $ret
}
method PBRegenerator::processType {this class fileDesc} {
# read and parse all lines until a "end type"
set done 0
while { ![eof $fileDesc] && !$done } {
set line [gets $fileDesc]
set type ""
set typename ""
set eventname ""
set value ""
if { [regexp {^end type[ \t]*$} $line ] } {
set done 1
break
}
if { [regexp {^ *([^ ]*) ([^ =]*) *=[ ]*([^\{ ].*)$}\
$line total type typename value] } {
} elseif { [regexp {^ *([^ ]*) ([^ =]*) *=[ ]*(\{[^\{\}]*\})}\
$line total type typename value] } {
} elseif { [regexp {^ *([^ ]*) ([^ =]*) *=[ ]*(\{[^\}]*)$}\
$line total type typename value] } {
# append value until closing brace is read
set end 0
while {![eof $fileDesc] && !$end } {
set line [gets $fileDesc]
if { [regexp {[^\}]*\}} $line] } {
set end 1
set value "$value\n$line"
} else {
set value "$value\n$line"
}
}
} elseif { [regexp {^ *event ([^ ]*) ([^ ]*)}\
$line total eventname eventid] } {
} elseif { [regexp {^ *event type ([^ ]*) ([^ ]*) \( \)} \
$line total type eventname] } {
} elseif { [regexp {^ *event ([^ ]*) (\([^\)]*\))} \
$line total eventname] } {
} elseif { [regexp {([^ ]*) ([^ ]*)} $line total type name] } {
if { $type == $name } {
# equals so probable a contained element
} else {
# a declared something
set typename $name
}
} else {
}
# if there is a typename add a builtin property to the class
if { [$class isA "PBVisual"] } {
if { $typename != "" && \
[string tolower $typename] != "menuname" && \
[string tolower $typename] != "windowtype"} {
$class setBuiltinProperty $typename \
[PBBuiltinProperty new $typename $type $value \
-where ${PBBuiltinProperty::InTypeDef} ]
}
}
}
# generate syntax error because done not set
if { !$done } {
m4_error $E_ENDEXPECT "type" [$class name]
}
set ret $done
return $ret
}
method PBRegenerator::skipType {this fileDesc} {
# read and skip all lines until a "end type"
# return false if eof
set done 0
while { ![eof $fileDesc] && !$done } {
set line [gets $fileDesc]
if { [regexp {^end type[ \t]*} $line ] } {
set done 1
break
}
}
set ret $done
return $ret
}
method PBRegenerator::processVariables {this body fileDesc} {
# read and skip all lines (= variables) except those after
# the non-modelled user defined attributes (and Declare ... ;) )
set done 0
# process variable section
# return false if eof
while { ![eof $fileDesc] && !$done } {
set line [gets $fileDesc]
if { [regexp {^end variables[ \t]*$} $line ] } {
# exit all
set done 1
} elseif { [regexp {^ *DECLARE.*} [string toupper $line] ] } {
# declared SQL query/function, non-object-team support
# so user defined:
$body append $line
$body append "\n"
# read all lines until a line ends with ";"
set declare 0
while { ![eof $fileDesc] && !$declare } {
set line [gets $fileDesc]
if { [regexp {[^;]*;.*} $line ] } {
$body append $line
$body append "\n"
set declare 1
} elseif { [regexp {^end variables[ \t]*} $line ] } {
# exit all
set done 1
set declare 1
m4_error $E_DECLARESYNTAX [[$this currentClass] name]
} else {
$body append $line
$body append "\n"
}
}
} elseif { [regexp "${PBCookie::nonModeledAttributeSection}" $line ] } {
# read all lines until next section (or "end variables" or EOF)
set next 0
set emptyLine 0
set emptyLineStr ""
while { ![eof $fileDesc] && !$next } {
set line [gets $fileDesc]
if { [regexp {^end variables[ \t]*$} $line ] } {
# exit all
set done 1
set next 1
} elseif { [regexp {^[ \t]*$} $line] } {
# some special empty line handling
# when empty line remember this and
# only store this line when NOT end of section
if { $emptyLine == 1 } {
# when already an empty line in buffer store this one
$body append $emptyLineStr
$body append "\n"
} else {
set emptyLine 1
set emptyLineStr $line
}
} elseif { ![regexp "${PBCookie::dataAttributeSection}" \
$line] && \
![regexp "${PBCookie::associationAttributeSection}" \
$line] && \
![regexp "${PBCookie::controlClassMapSection}" \
$line] } {
if { $emptyLine == 1 } {
# there is an empty line waiting to be stored first
$body append $emptyLineStr
$body append "\n"
set emptyLine 0
set emptyLineStr ""
}
$body append $line
$body append "\n"
} else {
# exit this section
set next 1
}
}
} else {
}
#end while
}
set ret $done
return $ret
}
method PBRegenerator::skipVariables {this fileDesc} {
# read and skip all lines until a "end type"
# return false if eof
set done 0
while { ![eof $fileDesc] && !$done } {
set line [gets $fileDesc]
if { [regexp {^end variables[ \t]*$} $line ] } {
set done 1
break
}
}
set ret $done
return $ret
}
method PBRegenerator::processPrototypes {this class fileDesc} {
# read and skip all lines until a "end prototypes"
# return false if eof
set done 0
while { ![eof $fileDesc] && !$done } {
set line [gets $fileDesc]
if { [regexp {^end prototypes[ \t]*$} $line ] } {
set done 1
break
}
}
# generate syntax error because done not set
if { !$done } {
m4_error $E_ENDEXPECT "prototypes" [$class name]
}
set ret $done
return $ret
}
method PBRegenerator::processStructure {this class fileDesc} {
# read and skip all lines until a "end type"
# return false if eof
set done 0
while { ![eof $fileDesc] && !$done } {
set line [gets $fileDesc]
if { [regexp {^end type[ \t]*$} $line ] } {
set done 1
break
}
}
# generate syntax error because done not set
if { !$done } {
m4_error $E_ENDEXPECTMETHOD "type" "(structure)" [$class name]
}
set ret $done
return $ret
}
method PBRegenerator::processEntryStructure {this class fileDesc} {
# read and skip all lines until a "end type"
# return false if eof
set done 0
while { ![eof $fileDesc] && !$done } {
set line [gets $fileDesc]
if { [regexp {^end type[ \t]*$} $line ] } {
set done 1
break
}
}
# generate syntax error because done not set
if { !$done } {
m4_error $E_ENDEXPECTMETHOD "type" "(structure)" [$class name]
}
set ret $done
return $ret
}
method PBRegenerator::processEvent {this body fileDesc line} {
# read and add all lines until a "end type"
# return false if eof
# if there is a start and end marker only get code between those
# eg constructor and destructor events
# deletes added code before any startmarker!
# stops adding after end marker!
set done 0
set skip 0
set bodyTmp [TextSection new]
while { ![eof $fileDesc] && !$done } {
if { [regexp {^end event[ \t]*$} $line ] } {
set done 1
break
} elseif { [regexp "^ *${PBCookie::endUserSection}" $line ] } {
set skip 1
# nothing
} elseif { [regexp "^ *${PBCookie::startUserSection}" $line ] } {
set skip 0
set bodyTmp [TextSection new]
# nothing
} else {
# add line to body
if {$skip == 0} {
$bodyTmp append $line
$bodyTmp append "\n"
}
}
# read next line
set line [gets $fileDesc]
}
$body appendSect $bodyTmp
set ret $done
return $ret
}
method PBRegenerator::skipEvent {this fileDesc} {
# read and skip all lines until a "end event"
# return false if eof
set done 0
while { ![eof $fileDesc] && !$done } {
set line [gets $fileDesc]
if { [regexp {^end event[ \t]*$} $line ] } {
set done 1
break
}
}
set ret $done
return $ret
}
method PBRegenerator::processFunction {this body fileDesc line} {
# read and add all lines until a "end type"
# return false if eof
set done 0
# set to false:
set skip 0
set bodyTmp [TextSection new]
while { ![eof $fileDesc] && !$done } {
if { [regexp {^end function[ \t]*$} $line ] } {
set done 1
break
} elseif { [regexp "^ *${PBCookie::associationAccessorMethod}" \
$line] } {
set skip 1
# nothing
} elseif { [regexp {^ *// User defined method.*} $line] } {
set skip 0
# nothing
} else {
# add line to body
$bodyTmp append $line
$bodyTmp append "\n"
}
# read next line
set line [gets $fileDesc]
}
if { $skip == 0} {
$body appendSect $bodyTmp
}
set ret $done
return $ret
}
method PBRegenerator::skipFunction {this fileDesc} {
# read and skip all lines until a "end function"
# return false if eof
set done 0
while { ![eof $fileDesc] && !$done } {
set line [gets $fileDesc]
if { [regexp {^end function[ \t]*$} $line ] } {
set done 1
break
}
}
set ret $done
return $ret
}
method PBRegenerator::processSubroutine {this body fileDesc line} {
# read and add all lines until a "end type"
# return false if eof
set done 0
# set to false:
set skip 0
set bodyTmp [TextSection new]
while { ![eof $fileDesc] && !$done } {
if { [regexp {^end subroutine[ \t]*$} $line ] } {
set done 1
break
} elseif { [regexp "^ *${PBCookie::associationAccessorMethod}" \
$line ] } {
set skip 1
# nothing
} elseif { [regexp {^ *// User defined method.*} $line ] } {
set skip 0
# nothing
} else {
# add line to body
$bodyTmp append $line
$bodyTmp append "\n"
}
# read next line
set line [gets $fileDesc]
}
if { $skip == 0} {
$body appendSect $bodyTmp
}
set ret $done
return $ret
}
method PBRegenerator::skipSubroutine {this fileDesc} {
# read and skip all lines until a "end function"
# return false if eof
set done 0
while { ![eof $fileDesc] && !$done } {
set line [gets $fileDesc]
if { [regexp {^end subroutine[ \t]*} $line ] } {
set done 1
break
}
}
set ret $done
return $ret
}
method PBRegenerator::processBinaryData {this body fileDesc} {
# read and add all lines until a "End of PowerBuilder Binary Data Section : No Source Expected After This Point"
# return false if eof
set done 0
while { ![eof $fileDesc] && !$done } {
if { [regexp "^ *${PBCookie::endBinaryDataSection}.*" $line ] } {
set done 1
break
} else {
# add line to body
$body append $line
$body append "\n"
}
# read next line
set line [gets $fileDesc]
}
set ret $done
return $ret
}
method PBRegenerator::skipBinaryData {this fileDesc} {
# read and skip all lines until a
# "End of PowerBuilder Binary Data Section :
# No Source Expected After This Point"
# return false if eof
set done 0
while { ![eof $fileDesc] && !$done } {
set line [gets $fileDesc]
if { [regexp "^ *${PBCookie::endBinaryDataSection}.*" $line ] } {
set done 1
break
}
}
set ret $done
return $ret
}
method PBRegenerator::processOn {this body fileDesc line} {
# read and add all lines until a "end type"
# return false if eof
set done 0
while { ![eof $fileDesc] && !$done } {
if { [regexp {^end on[ \t]*$} $line ] } {
set done 1
break
} elseif { [regexp "^ *${PBCookie::associationAccessorMethod}.*" \
$line ] } {
# nothing
} elseif { [regexp {// User defined method.*} $line ] } {
# nothing
} else {
# add line to body
$body append $line
$body append "\n"
}
# read next line
set line [gets $fileDesc]
}
set ret $done
return $ret
}
method PBRegenerator::skipOn {this fileDesc} {
# read and skip all lines until a "end on"
# return false if eof
set done 0
while { ![eof $fileDesc] && !$done } {
set line [gets $fileDesc]
if { [regexp {^end on[ \t]*$} $line ] } {
set done 1
break
}
}
set ret $done
return $ret
}
method PBRegenerator::processOnCreate {this class fileDesc line} {
# scan on-body for property initializations
set done 0
set thisClassName [string tolower [$class name]]
# get crappy section
if { [$class onCreateResidue] != "" } {
set body [$class onCreateResidue]
} else {
set body [TextSection new]
$class onCreateResidue $body
}
while { ![eof $fileDesc] && !$done } {
set line [gets $fileDesc]
set type ""
set name ""
set value ""
if { [regexp {^end on[ \t]*$} $line ] } {
set done 1
break
}
if { [regexp {^ *this\.([^ =]*) *= *create .*} $line \
total ] } {
} elseif { [regexp {^ *this\.([^ =]*) *= *([^\{ ].*)$} $line \
total name value] } {
} elseif { [regexp {^ *this\.([^ =]*) *= *(\{[^\}]*\})} $line \
total name value] } {
} elseif { [regexp {^ *if.*} $line] } {
} elseif { [regexp {^ *this\.([^ =]*) *= *(\{[^\}]*\})$} $line \
total name value] } {
} elseif { [regexp {^ *this\.([^ =]*) *= *(\{[^\}]*)$} $line \
total name value] } {
# append value until closing brace is read
set end 0
while {![eof $fileDesc] && !$end } {
set line [gets $fileDesc]
if { [regexp {[^\}]*\}.*} $line] } {
set end 1
set value "$value\n$line"
} else {
set value "$value\n$line"
}
}
} elseif { [regexp {^ *([^ =]*) *= *([^ ]*) *$} $line \
total name value] } {
set tmpname [string tolower $name]
set tmpvalue [string tolower $value]
if {($tmpname == $thisClassName) &&\
($tmpvalue == "this")} {
set name ""
}
} elseif { [regexp {^ *TriggerEvent\( *this *, *(\"|)constructor(\"|) *\) *$} $line total ] } {
} elseif { [regexp {^ *int *iCurrent *$} $line \
total ] } {
} elseif { [regexp {^ *iCurrent=UpperBound.*$} $line \
total ] } {
} elseif { [regexp {^ *call ([^:]*)::create *} $line \
total callname] } {
if {($callname != [$class superClassName]) && \
($callname != "super")} {
# add unknown line to crappy section.
$body append $line
$body append "\n"
}
} else {
# add unknown lines to crappy section.
$body append $line
$body append "\n"
}
# these exceptions may not be added:
set tmpname [string tolower $name]
if {[string length $tmpname] >= 5} {
set tmpname2 [string range $tmpname 0 4]
if {($tmpname2 == "item\[")} {
set name ""
}
}
if {[string length $tmpname] >= 8} {
set tmpname2 [string range $tmpname 0 7]
if {($tmpname2 == "control\[") } {
set name ""
}
}
if {$tmpname == "icurrent"} {
set name ""
}
# if there is a name add a builtin property to the class
if { $name != "" } {
$class setBuiltinProperty $name \
[PBBuiltinProperty new $name $type $value \
-where ${PBBuiltinProperty::InOnCreate} ]
}
}
set ret $done
return $ret
}
method PBRegenerator::processOnDestroy {this class fileDesc line} {
# skip on body and return false when eof
set done 0
if { [$class onDestroyResidue] != "" } {
set body [$class onDestroyResidue]
} else {
set body [TextSection new]
$class onDestroyResidue $body
}
while { ![eof $fileDesc] && !$done } {
set line [gets $fileDesc]
if { [regexp {^end on[ \t]*$} $line ] } {
set done 1
set line ""
break
} elseif { [regexp {^ *destroy\(this\.([^)]*)\).*} $line \
total name] } {
if {[$class findContainedClass $name] != ""} {
set line ""
} elseif {[[$this obsoleteClassSet] search -exact $name] >= 0} {
# was an obsolete class
set line ""
}
} elseif { [regexp {^ *TriggerEvent\( *this *, *(\"|)destructor(\"|) *\) *$} $line total ] } {
set line ""
} elseif { [regexp {^ *if IsValid\(MenuID\) then destroy\(MenuID\) *$} $line total ] } {
set line ""
} elseif { [regexp {^ *call ([^:]*)::destroy *} $line \
total callname] } {
if {($callname == [$class superClassName]) || \
($callname == "super")} {
set line ""
}
}
if {$line != "" } {
# add unknown lines to crappy section.
$body append $line
$body append "\n"
}
}
set ret $done
return $ret
}
method PBRegenerator::processParameter {this line} {
# create list of argument/parameter types from string given by line
set lst [List new]
# strip parentheses
if { [regexp {^ *\(([^)]*)\) *$} $line total params] } {
set params [string tolower $params]
} else {
set params [string tolower $line]
}
while { [regexp {^ *(reference |ref |readonly |value |)([^ ]*) ([^ ,]*) *,(.*)} $params total passBy type name params_] } {
set params $params_
$lst append $type
}
if { [regexp {^ *(reference |ref |readonly |value |)([^ ]*) ([^ ]*) *} $params total passBy type name] } {
$lst append $type
}
set i 0
$lst foreach arg {
incr i 1
}
return $lst
}
# Do not delete this line -- regeneration end marker
method PBRegenerator::addObsoleteClass {this newObsoleteClass} {
[$this obsoleteClassSet] append $newObsoleteClass
}
method PBRegenerator::removeObsoleteClass {this oldObsoleteClass} {
[$this obsoleteClassSet] removeValue $oldObsoleteClass
}