# target.icn: An object to represent a location to which links # may point, for webstyler.icn. #-- $define TARGET_REVISION "$Revision: 1.2 $" $define TARGET_DATE "$Date: 1996/10/10 18:14:39 $" #================================================================ # Class Target: Each instance represents a location to which a # link can point: a topic, plus an optional anchor-name within # that topic. This object was added for external version 1.03, # before which anchors within short names were not supported. #---------------------------------------------------------------- record targetTag ( # State for a Target object topic, # A Topic object anchor ) # An anchor including the pound sign, or &null #---------------------------------------------------------------- # INVARIANTS #---------------------------------------------------------------- # .topic == a Topic object # .anchor == # if this target represents a specific anchor -> # a string consisting of "#" followed by the anchor name # else -> &null #---------------------------------------------------------------- # METHODS #---------------------------------------------------------------- # Target_New ( topic, anchor ) # [ if the arguments satisfy the corresponding invariants -> # returns a new Topic object representing those values # ] #-- # Target_Topic ( self ) # [ returns self.topic # ] #-- # Target_Anchor ( self ) # [ if self.anchor is not &null -> # returns self.anchor # | else -> fails # ] #---------------------------------------------------------------- # - - - T a r g e t _ N e w - - - procedure Target_New ( topic, anchor ) local target target := targetTag ( ); target.topic := topic; target.anchor := anchor; return target; end # - - - T a r g e t _ T o p i c - - - procedure Target_Topic ( self ) return self.topic; end # - - - T a r g e t _ A n c h o r - - - procedure Target_Anchor ( self ) return \ self.anchor; # Fails if .anchor is &null end