# condition.icn: Object to track the state of conditional expansion # within a template. #-- $ifndef __CONDITION_ICN__ $define __CONDITION_ICN__ $define CONDITION_REVISION "$Revision: 1.2 $" $define CONDITION_DATE "$Date: 1995/11/03 19:55:39 $" #================================================================ # Class Condition: each instance tracks the state of one # conditional expansion operation within a template. The # `skipping' field is true if the conditional expansion is false, # false if we are expanding the tokens within it. #---------------------------------------------------------------- # condition := Condition_New ( skipping ) # [ returns a new condition object with fields: # .skipping := skipping # ] #-- # Condition_Is_Skipping ( condition ) # [ if condition.skipping is &null -> fail # | else -> return &null # ] #-- # Condition_Else ( condition ) # [ if condition.skipping is &null -> # condition.skipping := 1 # | else -> # condition.skipping := &null # ] #---------------------------------------------------------------- record conditionTag ( skipping ) # &null if we're expanding, true if we're skipping tokens # - - - C o n d i t i o n _ N e w - - - procedure Condition_New ( skipping ) local condition condition := conditionTag ( ); condition.skipping := skipping; return condition; end # --- Condition_New --- # - - - C o n d i t i o n _ I s _ S k i p p i n g - - - procedure Condition_Is_Skipping ( condition ) if \ condition.skipping then # Are we skipping tokens? return # Yes, succeed else fail; # No, fail end # - - - C o n d i t i o n _ E l s e - - - procedure Condition_Else ( condition ) condition.skipping := ( if ( / condition.skipping ) then 1 else &null ); end $endif