swirl Guide to OmniMark 5   OmniMark home
docs home 
IndexConceptsTasksSyntaxLibrariesOMX VariablesErrors
 
     
declaration/definition   no-default-io    

Syntax

  declare no-default-io


Purpose

The no-default-io keyword prevents OmniMark from trying to use standard input, standard output, or standard error, which are not available to your program in certain environments. For example, you must use no-default-io in OmniMark server programs and similar transaction-based applications.

If you use no-default-io, you must include the instruction declare no-default-io at the beginning of your program, before all other program declarations except an escape declaration. The escape declaration (if one is used) must be first.

If you use no-default-io, you must establish your own input sources and output destinations.

Since no-default-io programs do not start with any established input sources or output destinations, the following streams cannot be used:

The #args shelf is still available in no-default-io programs, but #main-input does not read data from files named in that shelf as it would in a program without no-default-io.

When using no-default-io, #current-output and #current-input do not become available until explicitly connected by the program, as shown in this example:

  declare no-default-io

  global stream in-file
  global stream out-file

  process

     set in-file to file "inputfile"
     open out-file as "outputfile"

     using input as in-file
        using output as out-file
           submit #current-input

     close out-file

#error is never available in a no-default-io program, and all errors and status must be reported to an alternate destination. OmniMark provides the log-message function (part of the #builtin function library) as an alternate destination that can be used in any program (with or without no-default-io).

You can test whether #current-input and #current-output are available:

  declare no-default-io

  include "builtins.xin"

  global stream in-file
  global stream out-file

  process

     log-message "should not see in" when #current-input is attached
     log-message "should not see out" when #current-output is attached

     set in-file to file "inputfile"
     open out-file as "outputfile"

     using input as in-file
     do
        using output as out-file
        do
           log-message "should see in" when #current-input is attached
           log-message "should see out" when #current-output is attached
           submit #current-input
        done
     done

     close out-file

     log-message "should not see in" when #current-input is attached
     log-message "should not see out" when #current-output is attached

A no-default-io declaration can only be used in process programs. It cannot be used in aided translation type programs (cross-translate, up-translate, down-translate, and context-translate).

       
----

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

Generated: August 11, 2000 at 3:07:35 pm
If you have any comments about this section of the documentation, send email to docerrors@omnimark.com

Copyright © OmniMark Technologies Corporation, 1988-2000.