swirl
Guide to OmniMark 8   OmniMark home
docs home 
IndexConceptsTasksSyntaxLibrariesLegacy LibrariesErrors
 
  Related Syntax    
action  

reopen

 
 

Syntax

reopen stream-name indexer? open-modifier?


Purpose

The reopen action is used to open an existing stream object that was previously closed using the close action. (The exception to this is built-in streams like #main-output, which are dynamically reopenable.) Unlike with the open action, the contents of the attached object are not erased when it is reopened.

For example, the first output action in the following process rule will output "of our discontent", and the second output action will output "Now is the winter of our discontent":

  process
     local stream foo
     local stream bar
  
     open foo as buffer
     put foo "Now is the winter "
     close foo
  
     open bar as buffer
     put bar "Now is the winter "
     close bar
  
     open foo as buffer
     put foo "of our discontent"
     close foo
  
     reopen bar
     put bar "of our discontent"
     close bar
  
     output foo || "%n"
     output bar || "%n"

If the reopen new form is used, a new item is added to the specified stream shelf. The restrictions on this form of thereopen action are the same as those of the set new action. In this case, the attachment must be specified.

All of the open modifiers available for the open action are available for reopen except append, text-mode, binary-mode, buffered, and unbuffered.

When reopening a stream:

Previous versions of OmniMark allowed an attachment to be specified when reopening a stream:

    process
       local stream s
  
       reopen s as file "foo.txt"

This had the effect of opening the attachment in append mode. This form of the reopen action is deprecated and should no longer be used. In its place, the append modifier should be used with the open action:

    process
       local stream s
  
       open s with append as file "foo.txt"

    Related Syntax
   binary
   break-width
   file
   open
   referents
   text-mode
 
 
 

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

OmniMark 8.2.0 Documentation Generated: March 13, 2008 at 3:33:48 pm
If you have any comments about this section of the documentation, please use this form.

Copyright © Stilo International plc, 1988-2008.