User Tools

Site Tools


application_source_generation_control_section_.htm
Navigation:  Templates > Template Language Reference > Complete Alpha Listing >====== #APPLICATION (source generation control section) C6H0068.jpg ====== Previous pageReturn to chapter overviewNext page

#APPLICATION( description ) [, HLP( helpid ) ] [ APPLICATION( [ child(chain) ]

blk2blue.jpg

#APPLICATION Begins source generation control section.
description A string constant describing the application section.
HLP Specifies on-line help is available.
helpid A string constant containing the identifier to access the Help system. This may be either a Help keyword or “context string.”
APPLICATION Tells the Application Generator to automatically place the named) child template on every procedure.
child(chain) The name of a #EXTENSION with the PROCEDURE attribute to automatically populate into every generated procedure when the #EXTENSION with the APPLICATION attribute is populated.

The #APPLICATION statement marks the beginning of a source generation control section. The section is terminated by the next Template Code Section (#PROGRAM, #MODULE, #PROCEDURE, #CONTROL, #CODE, #EXTENSION, #UTILITY, or #GROUP) statement. The Template statements contained in this section control the source generation process. Only one #APPLICATION section is allowed in a single Template set. Actual source generation is done by the #GENERATE statement.

Any User-defined symbols defined in the #APPLICATION section are available for use in any Template Code Section that is generated. Any prompts in this section are placed on the Global Properties window and have global scope.

Example:

#APPLICATION('Example Application Section')       #!Generate entire application

#PROMPT('Enable &Shared Files',CHECK),%SharedFiles

#PROMPT('Close Unused &Files',CHECK),%CloseFiles,DEFAULT(1)

#BUTTON('.INI File Settings')

 #PROMPT('Use .INI file',CHECK),%INIActive,DEFAULT(1)

 #ENABLE(%INIActive)

   #PROMPT('.INI File to use',DROP,'Program Name.INI|Other'),%INIFile

   #ENABLE(%INIFile='Other')

     #PROMPT('File Name',@S40),%ININame

   #ENDENABLE

   #PROMPT('Save Window Locations',CHECK),%INISaveWindow,DEFAULT(1)

 #ENDENABLE

#ENDBUTTON

#!

#!Global Template Declarations.

#MESSAGE('Generating ' & %Application,0) #! Open the Message Box

#DECLARE(%FilesUsed),UNIQUE,MULTI                 #! Label of every file used

#DECLARE(%FilePut,%FilesUsed)                     #! “Yes” for RI PUT used

#DECLARE(%FileDelete,%FilesUsed)                  #! “Yes” for RI DELETE used

#DECLARE(%ModuleFilesUsed,%Module),UNIQUE,MULTI,SAVE  #!Name of file used in module

#DECLARE(%ModuleFilePut,%ModuleFilesUsed),SAVE    #! “Yes” for RI PUT used

#DECLARE(%ModuleFileDelete,%ModuleFilesUsed),SAVE #! “Yes” for RI DELETE used

#DECLARE(%IniFileName)                            #! Used to construct INI file

#DECLARE(%ModuleProcs,%Module),MULTI,SAVE,UNIQUE  #! Program MAP prototype

#DECLARE(%ModulePrototype,%ModuleProcs)           #! Module MAP prototype

#DECLARE(%AccessMode)                             #! File open mode equate

#DECLARE(%BuildFile)                              #! Construction filename

#!

#!Initialization Code for Global User-defined Symbols.

#IF(%SharedFiles)                                 #! IF Shared Files Enabled

 #SET(%AccessMode,'42h')                         #! default access 'shared'

#ELSE                                             #! ELSE (IF NOT Shared Files ..)

 #SET(%AccessMode,'22h')                         #! default access 'open'

#ENDIF                                            #! END (IF Shared Files …)

#IF(%INIFile = 'Program Name.INI')                #! IF using program.ini

 #SET(%INIFileName, %Application & '.INI')       #! SET the file name

#ELSE                                             #! ELSE (IF NOT using Program.ini)

 #SET(%INIFileName,%ININame)                     #! SET the file name

#ENDIF                                            #! END (IF using program.ini)

#!

#! Main Source Code Generation Loop.

#DECLARE(%GlobalRegenerate)                       #! Flag that controls generation

#IF(~%ConditionalGenerate OR %DictionaryChanged OR %RegistryChanged)

 #SET(%GlobalRegenerate,%True)                   #! Generate Everything

#ELSE                                             #! ELSE (If no global change)

 #SET(%GlobalRegenerate,%False)                  #! Generate changed modules only

#ENDIF                                            #! END (IF Global Change)

#SET(%BuildFile,(%Application & '.TM$'))          #! Make temp program filename

#FOR(%Module), WHERE (%Module <;> %Program)        #! For all member modules

 #MESSAGE('Generating Module:    ' &amp; %Module, 1) #! Post generation message

 #IF(%ModuleChanged OR %GlobalRegenerate)        #! IF module to be generated

   #FREE(%ModuleProcs)                           #! Clear module prototypes

   #FREE(%ModuleFilesUsed)                       #! Clear files used

   #CREATE(%BuildFile)                           #! Create temp module file

   #FOR(%ModuleProcedure)                        #! FOR all procs in module

     #FIX(%Procedure,%ModuleProcedure)           #! Fix current procedure

     #MESSAGE('Generating Procedure: ' &amp; %Procedure, 2) #! Post generation message

     #GENERATE(%Procedure)                       #! Generate procedure code

   #ENDFOR                                       #! END (For all procs in module)

   #CLOSE(%BuildFile)                            #! Close last temp file

   #CREATE(%Module)                              #! Create a module file

   #GENERATE(%Module)                            #! Generate module header

   #APPEND(%BuildFile)                           #! Append the temp mod file

   #CLOSE(%Module)                               #! Close the module file

 #ENDIF                                          #! END (If module to be…)

#ENDFOR                                           #! END (For all member modules)

#FIX(%Module,%Program)                            #! FIX to program module

#MESSAGE('Generating Module:    ' &amp; %Module, 1)   #! Post generation message

#FREE(%ModuleProcs)                               #! Clear module prototypes

#FREE(%ModuleFilesUsed)                           #! Clear files used

#CREATE(%BuildFile)                               #! Create temp module file

#FOR(%ModuleProcedure)                            #! For all procs in module

 #FIX(%Procedure,%ModuleProcedure)               #! Fix current procedure

 #MESSAGE('Generating Procedure: ' &amp; %Procedure, 2) #! Post generation message

 #GENERATE(%Procedure)                           #! Generate procedure code

#ENDFOR                                           #! EndFor all procs in module

#CLOSE()                                          #! Close last temp file

See Also:     #GENERATE

#PROMPT

application_source_generation_control_section_.htm.txt · Last modified: 2021/04/15 15:56 by 127.0.0.1