#RESUME (delimit conditional source) 

Top  Previous  Next

 

#RESUME

The #RESUME statement marks the end of a section of source that is generated only if a #RELEASE statement is encountered. This allows empty unnecessary "boiler-plate" code to be easily removed from the generated source. The beginning of the section must be delimited by a matching #SUSPEND 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.

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.

When a #RESUME is executed without the output to the file being released, any conditional lines of code are un-done back to the matching #SUSPEND.

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:     #SUSPEND ,#RELEASE ,#?