swirl
Guide to OmniMark 9   OmniMark home
docs home 
IndexConceptsTasksSyntaxLibrariesLegacy LibrariesErrors
 
  Related Syntax    
operator  

referents is attached

 
 

Return type: Switch
Returns:       Returns true when the contents are defined or have been defined, and false otherwise. Replacing is with isnt will reverse the results

Syntax

this? referents indexer? (is | isnt) attached


Purpose

A referent is attached when its contents have been defined. However, the referent is no longer attached if a particular referent's contents have been specified, the referent has been closed, and the stream bound to that referent is subsequently discarded.

this indicates the currently selected referent. Indexer is a phrase identifying which referent is to be examined. The two cannot be combined.

This code sample illustrates using the "referents...is attached" test. The sample also shows that if a referent has been closed and the stream bound to that referent discarded, then the referent is no longer attached.

  macro attach-check token ref-name is
    do when referents{ref-name} is attached
      output "attached%n"
    else
      output "not attached%n"
    done
  macro-end
  
  process
     local stream s
     output referent "x"        ; referent "x" is not attached
     attach-check "x"
     open s as referent "x"     ; referent "x" is attached now
     attach-check "x"
     put s "some contents%n"    ; still attached
     attach-check "x"
     close s                    ; still attached
     attach-check "x"
     discard s                  ; referent "x" is no longer attached
     attach-check "x"
     set referent "x" to "more contents%n"
     attach-check "x"           ; attached now so we end up with a value

    Related Syntax
 
 
 

Top [ INDEX ] [ CONCEPTS ] [ TASKS ] [ SYNTAX ] [ LIBRARIES ] [ LEGACY LIBRARIES ] [ ERRORS ]

OmniMark 9.1.0 Documentation Generated: September 2, 2010 at 1:51:21 pm
If you have any comments about this section of the documentation, please use this form.

Copyright © Stilo International plc, 1988-2010.