Proc

File Proc.str
Author unknown
Since unknown

Used for POSIX and POSIX+XSI




Statistics


General
Lines of code 31
Stratego
Module number 1 (100% documented)
Constructor number 0
Overlay number 0
Strategy number 1 (100% documented)
Rule number 1 (100% documented)
DynamicRule number 0



Strategy summary


File-as-fd(Strategy s) Opens a file, applies the strategy s the file descriptor, and ensures that the file descriptor is closed on return of s, regardless of outcome Proc.str
xtc-close-fd Closes a file descriptor Proc.str
xtc-command(Strategy tool) n/a Proc.str
xtc-generate(Strategy tool) Generates a new file using the component identified by tool Proc.str
xtc-io-transform(Strategy s) Transforms a file with an internal strategy s Proc.str
xtc-io-transform-text(Strategy s) Transforms a file with an internal strategy s into a text file Proc.str
xtc-new-file-name Generates a new file name, but does not create the file on disk Proc.str
xtc-open-fd Opens a file and returns a file descriptor Proc.str
xtc-transform(Strategy tool) n/a Proc.str
xtc-transform(Strategy tool, Strategy args) Invokes the XT component given by tool to transform the current term Proc.str
xtc-transform-file n/a Proc.str
xtc-transform-file(Strategy tool) Transforms an existing file with an external process into a new file Proc.str
xtc-transform-term(Strategy tool, Strategy args) n/a Proc.str

Rule summary


read-from Reads a term from a file Proc.str
xtc-generate(Strategy tool, Strategy args) Generates a new file using the component identified by tool Proc.str
xtc-transform-file(Strategy tool, Strategy args) Transforms an existing file with an external process into a new file Proc.str
xtc-transform-file(Strategy tool, Strategy args) n/a Proc.str



Strategy details


ATerm File-as-fd(Strategy s)
File Proc.str
Author unknown
Since unknown
 
Parameters
Strategy s s Int -> b

Opens a file, applies the strategy s the file descriptor,and ensures that the file descriptor is closed on returnof s, regardless of outcome. The strategy s will be handed a file descriptor for the the FILE given toFile-as-fd. The result of s will become the resultof File-as-fd, and the file descriptor will always beclosed, also when s fails.


type FILE -> b

 
ATerm xtc-close-fd
File Proc.str
Author unknown
Since unknown
 

Closes a file descriptor. This strategy can be used to closeany file opened by <tt>xtc-open-fd</tt>, and also thestandard files <tt>stdin</tt>, <tt>stdout</tt> and<tt>stderr</tt>.


type FILE -> Int

 
ATerm xtc-generate(Strategy tool)
File Proc.str
Author unknown
Since unknown
 
Parameters
Strategy tool tool _ -> name

Generates a new file using the component identified by tool. Thisstrategy will invoke the component given by tool with no arguments,and write the resulting term to a new file. A handle to the newfile will be returned. No arguments will be passed on to theinvoked component (except the implicit -o).


type _ -> FILE(b)

 
ATerm xtc-io-transform(Strategy s)
File Proc.str
Author unknown
Since unknown
 
Parameters
Strategy s s a -> b

Transforms a file with an internal strategy s. This strategywill open an external file, apply s to it, and write theresult back to the file.


type File -> File

 
ATerm xtc-io-transform-text(Strategy s)
File Proc.str
Author unknown
Since unknown
 
Parameters
Strategy s s a -> b

Transforms a file with an internal strategy s into a text file.This strategy will open an external file (which must be an ATerm),apply s to it, and print the result as a string back into thefile.


type File -> File

 
ATerm xtc-new-file-name
File Proc.str
Author unknown
Since unknown
 

Generates a new file name, but does not create the file ondisk. As the file is not created on disk, another processmay theoretically create it (and thus own it), thus causinga race condition. For this reason, you may prefer to us<tt>xtc-new-file</tt> instead.


type _ -> FILE

 
ATerm xtc-open-fd
File Proc.str
Author unknown
Since unknown
 

Opens a file and returns a file descriptor. This strategycan be used to open any <tt>FILE</tt>s as well as<tt>stdin</tt>, <tt>stdout</tt> and <tt>stderr</tt>. Thefile descriptor should be closed with <tt>xtc-close-fd</tt>.


type FILE -> Int

 
ATerm xtc-transform(Strategy tool, Strategy args)
File Proc.str
Author unknown
Since unknown
 
Parameters
Strategy tool tool _ -> String

Invokes the XT component given by tool to transform the current term. The tool strategy must give the name of the component to invoke. TheThe current term will be serialized to the invoked component, and theresult of its execution will become the new current term. The argsparameter must return a list of arguments that will be given to theinvoked component.


type t -> u

 
ATerm xtc-transform-file(Strategy tool)
File Proc.str
Author unknown
Since unknown
 
Parameters
Strategy tool tool _ -> n

Transforms an existing file with an external process into a new file.The resulting file will be created automatically, and a handle willbe returned by this strategy. The tool strategy must give the nameof the component to invoke. No arguments will be passed to thetransforming component.


type FILE(a) -> FILE(b)

 

Rule details


ATerm read-from
File Proc.str
Author unknown
Since unknown
 

Reads a term from a file. If the given file exists, it will betreated as an ATerm and its content will be returned, as a term.


type FILE -> t

 
ATerm xtc-generate(Strategy tool, Strategy args)
File Proc.str
Author unknown
Since unknown
 
Parameters
Strategy tool tool _ -> name

Generates a new file using the component identified by tool. Thisstrategy will invoke the component given by tool with no arguments,and write the resulting term to a new file. A handle to the newfile will be returned. The strategy args must produce a list ofarguments which are passed to the invoked component.


type _ -> FILE(b)

 
ATerm xtc-transform-file(Strategy tool, Strategy args)
File Proc.str
Author unknown
Since unknown
 
Parameters
Strategy tool tool _ -> n
Strategy args args _ -> List(arg)

Transforms an existing file with an external process into a new file.The resulting file will be created automatically, and a handle willbe returned by this strategy.

The tool strategy must give the name of the component to invoke. Theargs strategy must give a list of arguments to pass to the component.


type FILE(a) -> FILE(b)