system-call

operator

Return type:
Integer
Returns:
The numeric value of the command from the system.
Syntax
system-call string-expression
    


Purpose

system-call allows an operating-system-specific command to be executed in an OmniMark program. This operator must be followed by a string expression that contains a system-specific command. system-call invokes that command and returns the numeric result code returned by that command when it completes its task.

Because the system-call operator returns a numeric value, it must be used in a context where a numeric expression is required. string-expression contains the name of the program to run, as well as any command-line arguments that are being passed to it.

Use of the system-call operator can yield different results on different platforms. The built-in stream #platform-info can help in determining which platform the OmniMark program is being run.

In this example, an editing session is called with the name of the file to edit. After the system-call is made, a check for a negative value is made, which presumably means that the editor, "sled", could not be found. Note that because the system-call is made from a condition, it occurs before the output action actually takes place.

  find "\input{" any++ => file-name "}"
     output "Couldn't start the SLED editor.%n"
        when system-call "sled %g(file-name)" < 0

The OMPROCESS library provides a more flexible way of launching external processes from OmniMark programs, and will typically result in better performance.

Related Syntax