eXept Software AG Logo

Smalltalk/X Webserver

Documentation of class 'CodeGeneratorTool':

Home

Documentation
www.exept.de
Everywhere
for:
[back]

Class: CodeGeneratorTool


Inheritance:

   Object
   |
   +--CodeGeneratorTool
      |
      +--JavaScriptCodeGeneratorTool
      |
      +--SmalltalkCodeGeneratorTool

Package:
stx:libtool
Category:
Interface-Browsers
Version:
rev: 1.143 date: 2023/12/08 14:34:17
user: cg
file: CodeGeneratorTool.st directory: libtool
module: stx stc-classLibrary: libtool

Description:


This utility class contains various code generation facilites;
these were extracted from the old and newBrowser.
There is probably more to come...

Note: being refactored into separate per-language generators

copyright

COPYRIGHT (c) 2002 by eXept Software AG All Rights Reserved This software is furnished under a license and may be used only in accordance with the terms of that license and with the inclusion of the above copyright notice. This software may not be provided or otherwise made available to, or used by, any other person. No title to or ownership of the software is hereby transferred.

Class protocol:

code generation
o  createAccessMethodsFor: aCollectionOfVarNames in: aClass withChange: withChange asValueHolder: asValueHolder readersOnly: readersOnly writersOnly: writersOnly
create accessors in aClass

o  createApplicationCodeFor: aClass
create an empty application framework

o  createClassResponsibleProtocolFor: aClass
create stubs for the required protocol

o  createClassTypeTestMethodsIn: aClass forClasses: subClasses
create a #isXXX test methods (I'm tired of typing)

o  createDocumentationMethodsFor: aClass
create empty documentation methods

o  createEnumTypeCodeFor: aClass

o  createInitializationMethodIn: aClass
create a #initialize methods (I'm tired of typing)

o  createInitializedInstanceCreationMethodsIn: aClass
create a #new and #initialize methods (I'm tired of typing)

o  createIsAbstractMethodIn: aClass
create a #isABstract query method (I'm tired of typing)

o  createIsObsoleteMethodIn: aClass
create a #isABstract query method (I'm tired of typing)

o  createParametrizedInstanceCreationMethodsNamed: selector in: aClass
create a #selector instance creation method (I'm tired of typing)

o  createRedefinedInstanceCreationMethodsIn: aClass
create a redefined #new method

o  createSingletonPatternInstanceCreationMethodsIn: aClass usingVariable: varName
create redefined #new method for singleton pattern

o  createStandaloneStartupCodeFor: aClass
create an empty console application framework

o  createStartupCodeFor: aClass forStartOf: anApplicationClassOrNil
create standAloneStartup code

o  createTestCaseSampleCodeFor: aClass
create an (almost) empty testCase class

o  createVisitorMethodsIn: visitedClass andVisitorClass: visitorClass
create acceptVisitor: in visitedClass and acceptXXX in visitorClass. (I'm tired of typing)

o  createWebApplicationCodeFor: aClass
create an empty webApplication framework

o  createWebServiceCodeFor: aClass
create an empty webService framework

o  createWidgetCodeFor: aClass
create usually required widget code (redraw, model update, event handling)

o  createWindowSpecSourceCodeFor: aSpec class: className selector: methodName forFileIn: forFileIn
generate the code for the method to be compiled/filedIn

o  initialMenuSpecMethodSourceForApplications
return code for a menuSpec with typical stuff in it

** This method must be redefined in concrete classes (subclassResponsibility) **

o  initialPageMenuSpecMethodSourceForWebApplications
return code for a menuSpec with typical stuff in it

** This method must be redefined in concrete classes (subclassResponsibility) **

o  initialPageSpecMethodSourceForWebApplications
return an empty pageSpec

** This method must be redefined in concrete classes (subclassResponsibility) **

o  initialToolbarMenuSpecMethodSource
return a menuSpec with typical stuff in it

** This method must be redefined in concrete classes (subclassResponsibility) **

o  initialWindowSpecMethodSourceForApplications
return an empty windowSpec with an initial menubar in it

** This method must be redefined in concrete classes (subclassResponsibility) **

o  initialWindowSpecMethodSourceForDialogs
return an empty windowSpec for dialogs

** This method must be redefined in concrete classes (subclassResponsibility) **

code generation-basic
o  createAccessMethodsFor: aCollectionOfVarNames in: aClass withChange: withChange asValueHolder: asValueHolder readersOnly: readersOnly writersOnly: writersOnly lazyInitialization: lazyInitialization
workhorse for creating access methods for instvars.

code generation-individual methods
o  createAcceptVisitorMethod: selector in: aClass
create an acceptVisitor: method
(I'm tired of typing)

o  createAcceptVisitorMethodIn: aClass
create an acceptVisitor: method
(I'm tired of typing)

o  createAspectMethodFor: anAspectSymbol in: aClass
create an aspect method.

o  createCopyrightMethodFor: aClass
add copyright method containing your/your companies
copyright template but only if not already present.
this is only added, if specified in the
COPYRIGHT_TEMPLATE_FILE resources.

o  createDocumentationMethodFor: aClass
add documentation method containing doc template
but only if not already present.

o  createExamplesMethodFor: aClass
add examples method containing examples template
but only if not already present.

o  createFalseReturnMethodFor: aSelector category: cat in: aClass
add a ^ false method;
but only if not already present.

o  createImageSpecMethodFor: anImage comment: comment in: aClass selector: sel

o  createInitialHistoryMethodFor: aClass
add history method containing created-entry
but only if not already present.

o  createInstanceCreationMethodWithSetupFor: selector category: category in: aMetaClass
add an inst-creation method

o  createMultiSetterInstanceCreationMethodFor: aCollectionOfVarNames in: aClass
create a multi-setter instance creator method for instvars.
This creates a multi setter method (a:val1 b:val2 c:val3...)
and a corresponding new method on the class side.

o  createMultiSetterMethodFor: aCollectionOfVarNames in: aClass
create a multi-setter method (a:val1 b:val2 c:val3...) for instvars.

o  createSubclassResponsibilityMethodFor: aSelector category: cat in: aClass
add a subclassResponsibility method;
but only if not already present.

o  createUncachedPNGImageSpecMethodFor: anImage comment: comment in: aClass selector: sel

o  createUpdateMethodIn: aClass
create an update:with:from:-method
(I'm tired of typing)

o  createVersionMethodFor: aClass
add a version method containing RCS template
but only if not already present and it's not a private class.

code generation-menus
o  createActionMethodFor: aSelector in: aClass category: aCategory redefine: redefine

** This method must be redefined in concrete classes (subclassResponsibility) **

o  createAspectMethodFor: aSelector in: aClass category: aCategory redefine: redefine

** This method must be redefined in concrete classes (subclassResponsibility) **

compilation
o  compile: theCode forClass: aClass inCategory: cat
install some code for a class.
If refactory browser stuff is available the refactory tools are used to support undo

defaults
o  copyrightTemplate
return the contents of COPYRIGHT_TEMPLATE_FILE resources
or a standard template

o  copyrightTemplate: aString
set the COPYRIGHT_TEMPLATE_FILE

o  copyrightTemplateFor: aYearNumber
return the contents of COPYRIGHT_TEMPLATE_FILE resources
or a standard template

instance creation
o  new
(comment from inherited method)
return an instance of myself without indexed variables

interface specs
o  initialMenuSpecForApplications
This resource specification was automatically generated
by the MenuEditor of ST/X.

Usage example(s):

     MenuEditor new openOnClass:CodeGeneratorTool andSelector:#initialMenuSpecForApplications
     (Menu new fromLiteralArrayEncoding:(CodeGeneratorTool initialMenuSpecForApplications)) startUp

o  initialPageMenuSpecForWebApplications
This resource specification was automatically generated
by the MenuEditor of ST/X.

Usage example(s):

     MenuEditor new openOnClass:CodeGeneratorTool andSelector:#initialPageMenuSpecForWebApplications
     (Menu new fromLiteralArrayEncoding:(CodeGeneratorTool initialPageMenuSpecForWebApplications)) startUp

o  initialPageSpecForWebApplications
Do not manually edit this! If it is corrupted,
the UIPainter may not be able to read the specification.

Usage example(s):

     UIPainter new openOnClass:self andSelector:#initialPageSpecForWebApplications

o  initialToolbarMenuSpec
This resource specification was automatically generated
by the MenuEditor of ST/X.

Usage example(s):

     MenuEditor new openOnClass:CodeGeneratorTool andSelector:#initialToolbarMenuSpec
     (Menu new fromLiteralArrayEncoding:(CodeGeneratorTool initialToolbarMenuSpec)) startUp

o  initialWindowSpecForApplications
This resource specification was automatically generated
by the UIPainter of ST/X.

Usage example(s):

     UIPainter new openOnClass:CodeGeneratorTool andSelector:#initialWindowSpecForApplications

o  initialWindowSpecForApplications2
This resource specification was automatically generated
by the UIPainter of ST/X.

Usage example(s):

     UIPainter new openOnClass:CodeGeneratorTool andSelector:#initialWindowSpecForApplications2

o  initialWindowSpecForDialogs
This resource specification was automatically generated
by the UIPainter of ST/X.

Usage example(s):

     UIPainter new openOnClass:CodeGeneratorTool andSelector:#initialWindowSpecForDialogs

private
o  canUseRefactoringSupport
check if refactory browser stuff is available

o  methodNameTemplateFor: aSelector

** This method must be redefined in concrete classes (subclassResponsibility) **

queries
o  isAbstract
(comment from inherited method)
Return if this class is an abstract class.
True is returned for Object here; false for subclasses.
Abstract subclasses must redefine this again.

utilities
o  missingRequiredProtocolFor: aClass
return the missing required protocol;
that is the set of selectors which send #subclassResponsibility in a superclass and
have no implementation in aClass or in any class between aClass and that superclass

utilities - source code
o  codeGenerationCommentForClass: generatingClass
returns a comment for the method code generated by generatingClass

o  methodTemplate
return a method definition template string

o  methodTemplateForDocumentation
return a method definition template string for a documentation method

o  methodTemplateForPackageDocumentation
return a documentation method definition template string for a package

o  methodTemplateForVersionMethodCVS
careful to avoid expansion by cvs here!


Instance protocol:

bulk changes
o  addChange: aChange

o  executeCollectedChangesNamed: name
if both the compositeChangeCollector and I myself think, that it should be confirmed,
the let user do it - I am not sure, if the heuristics here is useful;
it might be better to let the generator decide (for example, if it does high-impact
changes, as opposed to simple ones)

o  startCollectChanges

code generation
o  createAccessMethodsFor: aCollectionOfVarNames in: aClass withChange: withChange asValueHolder: asValueHolder readersOnly: readersOnly writersOnly: writersOnly
create accessors in aClass

o  createApplicationCodeFor: aClass
create an empty application framework

o  createClassInitializeMethodIn: aClass
create a #initialize method on the class side (I'm tired of typing)

o  createClassResponsibleProtocolFor: aClass
create stubs for the required protocol

o  createClassTypeTestMethodsIn: aClass forClasses: subClasses
create a #isXXX test methods (I'm tired of typing)

** This method must be redefined in concrete classes (subclassResponsibility) **

o  createDocumentationMethodsFor: aClass
create empty documentation methods

o  createEnumTypeCodeFor: aClass

** This method must be redefined in concrete classes (subclassResponsibility) **

o  createExamplesMethodForViewClass: aClass
create an examples method

** This method must be redefined in concrete classes (subclassResponsibility) **

o  createInitializationMethodIn: aClass
create a #initialize methods (I'm tired of typing)

** This method must be redefined in concrete classes (subclassResponsibility) **

o  createInitializedInstanceCreationMethodsIn: aClass
create a #new and #initialize methods (I'm tired of typing)

** This method must be redefined in concrete classes (subclassResponsibility) **

o  createIsAbstractMethodIn: aClass
create a #isAbstract query method (I'm tired of typing)

** This method must be redefined in concrete classes (subclassResponsibility) **

o  createIsObsoleteMethodIn: aClass
create a #isObsolete query method (I'm tired of typing)

** This method must be redefined in concrete classes (subclassResponsibility) **

o  createParametrizedInstanceCreationMethodsNamed: selector in: aClass
create a #selector instance creation method (I'm tired of typing)

** This method must be redefined in concrete classes (subclassResponsibility) **

o  createPoolInitializationCodeFor: aClass

** This method must be redefined in concrete classes (subclassResponsibility) **

o  createRedefinedInstanceCreationMethodsIn: aClass
create a redefined #new methods

** This method must be redefined in concrete classes (subclassResponsibility) **

o  createSingletonPatternInstanceCreationMethodsIn: aClass usingVariable: varName
create redefined #new methods for a singleton pattern

** This method must be redefined in concrete classes (subclassResponsibility) **

o  createStandaloneStartupCodeFor: aClass
create an empty console application framework

o  createStandardPrintOnMethodIn: aClass
create a #printOn: method (I'm tired of typing)

** This method must be redefined in concrete classes (subclassResponsibility) **

o  createStartupCodeFor: aClass forStartOf: anApplicationClassOrNil
create startup code (main)

** This method must be redefined in concrete classes (subclassResponsibility) **

o  createTestCaseSampleCodeFor: aClass
create an (almost) empty testCase class

** This method must be redefined in concrete classes (subclassResponsibility) **

o  createVisitorMethodsIn: visitedClass andCompilerClass: visitorClass

This is much like createVisitorMethodsIn:andVisitorClass:,
but generates
acceptVisitor:forEffect:
and
visit<NODE>:forEffect:
in visit* methods.

o  createVisitorMethodsIn: visitedClass andVisitorClass2: visitorClass

This is much like createVisitorMethodsIn:andVisitorClass:,
but generates
self visitSuperclass: anObject
in visit* methods.

o  createVisitorMethodsIn: visitedClass andVisitorClass: visitorClass
create acceptVisitor: in visitedClass and acceptXXX in visitorClass. (I'm tired of typing)

** This method must be redefined in concrete classes (subclassResponsibility) **

o  createVisitorMethodsIn: arg1 andVisitorClass: arg2 withParameter: arg3 withSuper: arg4
raise an error: must be redefined in concrete subclass(es)

** This method must be redefined in concrete classes (subclassResponsibility) **

o  createWebApplicationCodeFor: aClass
create an empty webApplication framework

** This method must be redefined in concrete classes (subclassResponsibility) **

o  createWebServiceCodeFor: aClass
create an empty webService framework

** This method must be redefined in concrete classes (subclassResponsibility) **

o  createWidgetCodeFor: aClass
create usually required widget code (redraw, model update, event handling)

** This method must be redefined in concrete classes (subclassResponsibility) **

code generation-basic
o  createAccessMethodsFor: aCollectionOfVarNames in: aClass withChange: withChange asValueHolder: asValueHolder readersOnly: readersOnly writersOnly: writersOnly lazyInitialization: lazyInitialization
workhorse for creating access methods for instvars.

** This method must be redefined in concrete classes (subclassResponsibility) **

o  createCollectionAccessMethodsFor: aCollectionOfVarNames in: aClass withChange: withChange

** This method must be redefined in concrete classes (subclassResponsibility) **

o  createGetterFor: aVarName in: aClass

o  createSetterFor: aVarName in: aClass


o  createValueHoldersFor: aCollectionOfVarNames in: aClass lazyInitialization: lazyInitialization
workhorse for creating access methods for instvars.

** This method must be redefined in concrete classes (subclassResponsibility) **

code generation-individual methods
o  createAcceptVisitorMethod: selector in: aClass
create an acceptVisitor: method
(I'm tired of typing)

** This method must be redefined in concrete classes (subclassResponsibility) **

o  createAcceptVisitorMethodIn: aClass
create an acceptVisitor: method
(I'm tired of typing)

** This method must be redefined in concrete classes (subclassResponsibility) **

o  createAspectMethodFor: anAspectSymbol in: aClass
create an aspect method.

** This method must be redefined in concrete classes (subclassResponsibility) **

o  createCopyrightMethodFor: aClass
add copyright method containing your/your companies
copyright template but only if not already present.
this is only added, if specified in the
COPYRIGHT_TEMPLATE_FILE resources.

o  createCopyrightMethodFor: copyRightText for: aClass
add copyright method containing text,
but only if not already present.

** This method must be redefined in concrete classes (subclassResponsibility) **

o  createDocumentationMethodFor: aClass
add documentation method containing doc template
but only if not already present.

** This method must be redefined in concrete classes (subclassResponsibility) **

o  createExamplesMethodFor: aClass
add examples method containing examples template
but only if not already present.

** This method must be redefined in concrete classes (subclassResponsibility) **

o  createFalseReturnMethodFor: aSelector category: cat in: aClass
add a ^false method;
but only if not already present.

** This method must be redefined in concrete classes (subclassResponsibility) **

o  createImageSpecMethodFor: anImage comment: comment in: aClass selector: sel

** This method must be redefined in concrete classes (subclassResponsibility) **

o  createInitialHistoryMethodFor: aClass
add history method containing created-entry
but only if not already present.

** This method must be redefined in concrete classes (subclassResponsibility) **

o  createInstanceCreationMethodWithSetupFor: selector category: category in: aMetaClass
add an inst-creation method

** This method must be redefined in concrete classes (subclassResponsibility) **

o  createMultiSetterInstanceCreationMethodFor: aCollectionOfVarNames in: aClass
create a multi-setter instance creator method for instvars.
This creates a multi setter method (a:val1 b:val2 c:val3...)
and a corresponding new method on the class side.

** This method must be redefined in concrete classes (subclassResponsibility) **

o  createMultiSetterMethodFor: aCollectionOfVarNames in: aClass
create a multi-setter method (a:val1 b:val2 c:val3...) for instvars.

** This method must be redefined in concrete classes (subclassResponsibility) **

o  createShouldImplementMethodFor: aSelector category: cat in: aClass
add a shouldImplement method;
but only if not already present.

** This method must be redefined in concrete classes (subclassResponsibility) **

o  createSubclassResponsibilityMethodFor: aSelector category: cat in: aClass
add a subclassResponsibility method;
but only if not already present.

** This method must be redefined in concrete classes (subclassResponsibility) **

o  createUncachedPNGImageSpecMethodFor: anImage comment: comment in: aClass selector: sel

** This method must be redefined in concrete classes (subclassResponsibility) **

o  createUpdateMethodIn: aClass
create an update:with:from:-method
(I'm tired of typing)

** This method must be redefined in concrete classes (subclassResponsibility) **

o  createVersionMethodFor: aClass
add version method containing RCS template
but only if not already present and its not a private class.

** This method must be redefined in concrete classes (subclassResponsibility) **
** This is an obsolete interface - do not use it (it may vanish in future versions) **

code templates
o  codeFor_classInitialize

** This method must be redefined in concrete classes (subclassResponsibility) **

o  codeFor_closeAccept

** This method must be redefined in concrete classes (subclassResponsibility) **

o  codeFor_closeDownViews

** This method must be redefined in concrete classes (subclassResponsibility) **

o  codeFor_closeRequest

** This method must be redefined in concrete classes (subclassResponsibility) **

o  codeFor_doSaveAs

o  codeFor_emptyMenuActionCodeFor: selector menuItem: item

** This method must be redefined in concrete classes (subclassResponsibility) **

o  codeFor_hasUnsavedChanges

** This method must be redefined in concrete classes (subclassResponsibility) **

o  codeFor_menuNew

o  codeFor_menuOpen

o  codeFor_menuReload

o  codeFor_menuSave

o  codeFor_menuSaveAs

** This method must be redefined in concrete classes (subclassResponsibility) **

o  codeFor_openAboutThisApplication

** This method must be redefined in concrete classes (subclassResponsibility) **

o  codeFor_openDocumentation

** This method must be redefined in concrete classes (subclassResponsibility) **

o  codeFor_postBuildWith

** This method must be redefined in concrete classes (subclassResponsibility) **

o  codeFor_postOpenWith

** This method must be redefined in concrete classes (subclassResponsibility) **

o  codeFor_shouldImplementFor: selector inClass: aClass
used in the 'generate required protocol' to generate a shouldImplement-sending
method for each subclassClassresponsibility method above aClass.

** This method must be redefined in concrete classes (subclassResponsibility) **

o  codeFor_standAloneApplicationRegistryPath

o  codeFor_standAloneApplicationRegistryPathFor: aClass

** This method must be redefined in concrete classes (subclassResponsibility) **

o  codeFor_standAloneApplicationUUID

** This method must be redefined in concrete classes (subclassResponsibility) **

o  codeFor_standAloneMain

** This method must be redefined in concrete classes (subclassResponsibility) **

o  codeFor_standAloneRealMainMethodFor: aClass

** This method must be redefined in concrete classes (subclassResponsibility) **

o  codeFor_standAloneUsage

** This method must be redefined in concrete classes (subclassResponsibility) **

o  codeToAssign: expr to: var

** This method must be redefined in concrete classes (subclassResponsibility) **

o  code_forWidget_buttonPress

** This method must be redefined in concrete classes (subclassResponsibility) **

o  code_forWidget_initialize

** This method must be redefined in concrete classes (subclassResponsibility) **

o  code_forWidget_keyPress

** This method must be redefined in concrete classes (subclassResponsibility) **

o  code_forWidget_redraw

** This method must be redefined in concrete classes (subclassResponsibility) **

o  code_forWidget_sizeChanged

** This method must be redefined in concrete classes (subclassResponsibility) **

o  code_forWidget_update

** This method must be redefined in concrete classes (subclassResponsibility) **

o  eolCommentString

** This method must be redefined in concrete classes (subclassResponsibility) **

o  nilValueString

** This method must be redefined in concrete classes (subclassResponsibility) **

o  selfValueString

** This method must be redefined in concrete classes (subclassResponsibility) **

compilation
o  compile: theCode forClass: aClass inCategory: cat
install some code for a class.
If refactory browser stuff is available the refactory tools are used to support undo

o  compile: theCode forClass: aClass inCategory: categoryOrNil skipIfSame: skipIfSame
install some code for a class.
If refactory browser stuff is available the refactory tools are used to support undo

o  compilerClass
Return a real compiler classto use to compile code

** This method must be redefined in concrete classes (subclassResponsibility) **

initialization
o  confirmChanges
if true, let user confirm complicated changes; if false, just do it

o  confirmChanges: aBoolean
if true, let user confirm complicated changes; if false, just do it

o  initialize
(comment from inherited method)
just to ignore initialize to objects which do not need it

private
o  canUseRefactoringSupport
check if refactory browser stuff is available

o  privCreateClassResponsibleProtocolFor: aClass
create stubs for the required protocol.
aClass may be a a MetaClass or a non-MetaClass



ST/X 7.7.0.0; WebServer 1.702 at 20f6060372b9.unknown:8081; Sat, 21 Dec 2024 16:15:39 GMT