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

has name

 
 

Return type: Switch
Returns:       Returns true if the specified stream item has a name, and false otherwise. Replacing has with hasnt will return the opposite results.

Syntax

stream-name indexer? (has | hasnt) name


Purpose

Streams that are attached to files, referents and external functions have names. Also, the built-in stream #markup-parser can have the name "XML" or "SGML."

If the stream has a name, the name of operator can be applied to the stream item to return a string expression containing the name of the stream.

The built-in stream #main-output has a name when it has been attached to a file on the command line that has "-of" or "-aof" options.

This example illustrates the use of has name to test whether a specified stream has a name. This is done in order to avoid the error of using the name of test on a stream that does not have a name.

  global stream new-output
  ...
  do when new-output has name
    do unless name of new-output = "new-out.txt"
      put #error "stream new-output has unexpected name: "
      put #error name of new-output
      halt with 1
    done
  else
    put #error "new-output was never opened " _
               "as file or referent%n"
    halt with 1
  done

    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.