action
reopen stream-name indexer? open-modifier?
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:
reopen s with "".
break-width and binary modifiers are treated in two ways. If
the modifier is specified, then it is applied to the stream; if
the modifier is not specified, the default value is used. The
previous settings are not retained.
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 as file "foo.txt" with append