User Tools

Site Tools


suspend_begin_conditional_source_.htm
Navigation:  Templates > Template Language Reference > Complete Alpha Listing >====== #SUSPEND (begin conditional source) C6H0068.jpg ====== Previous pageReturn to chapter overviewNext page

#SUSPEND(<;section>)

blk2blue.jpg

#SUSPEND Identifiy the start of a conditionally generated source section
section A name that identifies a specific #SUSPEND section

The #SUSPEND statement marks the start of a section of source that is generated only if a non-conditional source line or a #RELEASE statement is encountered. (i.e., a line of code without “#?” or a #RELEASE must be encountered for the code between #SUSPEND and #RESUME to be generated). This allows empty unnecessary “boiler-plate” code to be easily removed from the generated source. The end of the section must be delimited by a matching #RESUME statement.

These #SUSPEND sections may be nested within each other to as many levels as necessary. A #RELEASE encountered in an inner nested section commits source generation for all the outer nested levels in which it is contained, also. The section parameter is used to distinguish between other nested #SUSPEND statements.

A #EMBED that contains source to generate performs an implied #RELEASE. Any generated source output also performs an implied #RELEASE. Therefore, an explicit #RELEASE statement is not always necessary. The #? statement defines an individual conditional source line that does not perform the implied #RELEASE.

Example:

ACCEPT

#SUSPEND                       #!Begin suspended generation

 #?CASE SELECTED()

 #FOR(%ScreenField)

  #SUSPEND

 #?OF %ScreenField

   #EMBED(%ScreenSetups,'Control selected code'),%ScreenField

                              #!Implied #RELEASE from the #EMBED of both nested sections

   #RESUME

 END

#RESUME                        #!End suspended generation

#SUSPEND                       #!Begin suspended generation

 #?CASE EVENT()

#SUSPEND

 #?OF EVENT:AlertKey

  #SUSPEND

   #?CASE KEYCODE()

     #FOR %HotKey

       #RELEASE               #!Explicit #RELEASE

   #?OF %HotKey

     #EMBED(%HotKeyProc,'Hot Key code'),%HotKey

     #ENDFOR

   #?END

   #RESUME

 #?END

#RESUME                        #!End suspended generation

END

See Also:     #RELEASE ,#RESUME ,#? ,#QUERY

suspend_begin_conditional_source_.htm.txt · Last modified: 2021/04/15 15:57 (external edit)