Darwin Help

Back to Index

RunDarwinSession

Function RunDarwinSession - run Darwin code inside a Document and insert results

Calling Sequence  RunDarwinSession(doc)
Parameters
NameTypeDescription

doc structuretypically a document or part of one
Return Type  structure
Synopsis RunDarwinSession scans the input Document structure (or part of one) and collects all the structures of type DarwinCode(string), DarwinHideInput(string), DarwinExpression(string), DarwinHidden(string) and DarwinCodeHTML(string). These have the following effects:

DarwinCode(string) - The string contents of this structure are interpreted as statements to a darwin session and are collected and executed by darwin. The output is separated into its component, and each original DarwinCode structure is replaced by a green Code structure containing the input and a red Code structure containing the output.


DarwinHideInput(string) - The string contents of this structure are interpreted as statements to a darwin session and are collected and executed by darwin. The output is separated into its component, and each original DarwinHideInput structure is replaced by a red Code structure containing the output.


DarwinExpression(string) - The contents of this structure are considered to be statements also to be merged in the darwin code and executed. Their values will replace the structure in the Document. DarwinExpressions serve as a mechanism to incorporate values computed in the darwin run, which may not be known, into the text of the Document.


DarwinHidden(string) - The contents of this structure is executed, but no result is incorporated in the document. This is useful to set parameters appropriately while it is unwanted to reflect this in the resulting document. E.g. Set(gc=xxx).


DarwinCodeHTML(string) - The contents of this structure are assumed to contain characters which are invalid in normal HTML, (like "<" and ">") and these characters are converted to their corresponding Entity Names. Typical uses of this structure are programs which have the special symbols or programs which will output HTML tags. E.g. "if a < b then ..." or printf( '%s' ).


InvokeDarwin - This is a global variable which may be assigned with the name of a command to execute Darwin if the default ("darwin") is not suitable. This is needed when the Darwin command is special or it must be executed with special arguments.


DarwinOutputUpperLimit - This is a global variable which if assigned with a positive integer (call it n) will limit the number of output lines of each single DarwinCode() set of statements. The value n is the number of lines to be displayed, and if the output has more lines than n lines, the top n/2 lines will be displayed followed by a line ". . . . (xxx output lines skipped) . . . ." followed by the last n/2 lines. This is very useful when the output is undesirably long, but necessary.


DarwinTimeout - This is a global variable which if assigned a positive value will limit the execution time of the Darwin session to that value (in seconds). By default the session is allowed to run for 600 seconds.


RunDarwinSession is relatively robust against errors, help files, etc. It cannot display objects which are shown with the command View.

See also Code,   Color,   Copyright,   Document,   HTML,   HyperLink,   Indent,   LastUpdatedBy,   latex,   List,   Paragraph,   PostscriptFigure,   print,   Roman,   screenwidth,   Table,   TT,   View