This section details all the commands used in Open GENIE for input and output of data. The commands can be grouped as show below.
![]() | Storage and retrieval in one of the supported data file formats |
Filetype() | Returns information about the type of a data file |
Get() | Reads data into GENIE from a file |
List() | Lists the contents of a data file |
Nblocks() | Returns the number of readable blocks in a file |
Put() | Outputs Open GENIE data into a file |
![]() | Free format ASCII input and output of GENIE data |
Asciifile() | Read or write any format of ASCII data |
![]() | Data input from a user written program in FORTRAN or C. |
Module() | Call user written code as part of Open GENIE |
![]() | Printing information to and reading information from the user. |
Print() | Print information to the user |
Inquire() | Prompt the user for terminal input and read back an input variable |
Read_terminal() | Read a string back from the input terminal into a variable |
Open GENIE maintains a default "Current input file" and "Current output file". For input and output the Set/File/Input and Set/File/Output may be used to explicitly to set the files to be used as a default for later commands. For input files, defaults may also be set up in a similar fashion to those used in GENIE-V2 with separate defaults for disk, directory, instrument name and file extension using the appropriate Set() commands. The current defaults may be viewed with the Show/Defaults command.
One of the major strengths of Open GENIE is the flexibility available in accessing data. For all the supported file formats it is possible to use the lower level Get() and Put() commands to access named items of data directly.
The commands reading whole spectra (See the section on GENIE-V2 emulation) are built using these lower level commands. Whole spectra may also be saved/retrieved using Put() and Get() by treating workspaces as single Open GENIE variables.
Finds out the type of a datafile (if recognized by Open GENIE).
FILETYPE | [file=String] | Return a string giving the data file type. |
example:
# Check the type of a file printn Filetype("HRP00389.RAW") raw
Note: "file" defaults to the type of the default input file if there is one.
The filetype command makes the process Open GENIE uses to determine file types available to the user. By using the Filetype() command it is possible to write Open GENIE procedures which from the outside appear independent of input file type but internally take account of different data formats.
File (String) [ default = currently selected input file (via the Set() command) ]
File which is being tested.
RESULT = (String)
One of the following strings depending on the type of the file.
"<unknown>" | Filetype unknown to Open GENIE |
"raw" | ISIS original format raw data file |
"G2 intermediate" | GENIE-V2 intermediate file |
"G3 intermediate" | Open GENIE intermediate file |
"CRPT" | ISIS Current Run Parameter Table |
"HDF" | HDF format data file |
"ASCII" | Plain text (ASCII) file |
"<directory>" | A directory file on the host system |
"G3 ASCII" | Open GENIE ASCII dump formatted file |
this is only a mininum set of file types. If you have a file reading routine please mail genie@isise.rl.ac.uk and we will investigate adding your data file as one recognized by Open GENIE.
Read binary spectrum data into GENIE from any valid data source (eg ISIS Raw files, DAE, intermediate files etc.)
GET() | item=String [file=String] | Read binary data by name |
GET() | item=Integer [file=String] | Read binary data by number |
GET() | item=Interval [file=String] | Read binary data by interval |
GET() | item=IntegerArray [file=String] | Read binary data by range |
example:
# print the user name # then read in all the spectra in the file, # finally read every third spectrum from a file >> printn get("USER", "Isisfile.raw") Professor G. Offar >> 2d = get( 1 : get("NSP1") ) >> spin_up = get( 1:50@3 , "CSP4589.RAW" )
Note: Use the Dir() command to find out what data can be read from the file.
This function is a fully generic way of accessing binary data from Open GENIE from any valid data format. Open GENIE is always able to detect automatically what format the data source is in so there is no need to do anything differently when accessing an intermediate file, an ISIS raw file or even the Data Acquisition Electronics (DAE).
It should be remembered however that even if Open GENIE is able to detect the type of the data source, it cannot guarantee what items are available in the file, for example, asking for user information will work fine from an ISIS raw file, but not from the DAE! It is wise to check any unknown file with the Dir() command to see what information is available.
/Array
This optional qualifier specifies that when getting multiple spectra, the routine should return a workspace array of single spectrum workspaces, rather than a single multi-dimensional workspace.
Item (String or Integer or Range)
This specifies the name (String) or index (Integer) of the primary data item being requested from the data file. The assumption here is that all data items in the file are either named explictly or numbered. For example, "NSP1" is the name used in ISIS RAW files to get the total number of spectra in the first time regime. In the same file, specifying the integer 5 would get the fifth spectrum within the file. To find the names of items which may be specified on a particular file, the Dir() command may be used.
Open GENIE also supports unique data types called Interval and Range, a Range or Interval can be used to specify multiple indices or a range of indices respectively to access multi-dimensional data. For more information on specifying intervals, please see a description of the Interval syntax.
For the most general ability to specify a group of arbitrary spectra an Integer array of spectrum identifiers can be given as the the "Item" parameter.
File (String) [ default = Current input file ]
This parameter gives the source from which Open GENIE is reading the data specified. Normally this will be a file on disk or the data acquisition electronics but in future could also be a network address of a data source at a remote site.
If this parameter is not given, a file specified previously using the Set/File/Input command is used.
RESULT = (Any Open GENIE type)
Because the Get() command can return any sort of data from a file, the result of this function will the the closest available Open GENIE data type to the item being read. For example, if a string is being read from a file, the return type will be a String, alternatively, if a spectrum is being read, the return type will normally be an Open GENIE workspace.
Lists the items available within any datafile with a format Open GENIE understands.
LIST | file=String | Catalogues the contents of a data file |
LIST/IN | Lists the contents of the default input file | |
LIST/OUT | Lists the contents of the default output file | |
[/FULL] | List the file contents with full details |
example:
>> List "dat.out" Genie intermediate file version 1.0 Block Label Type 1 vanadium GXWorkspace 2 Run 1 GXWorkspace 3 Run 2 GXWorkspace
Note: To see comments use the /Full qualifier.
This command gives a means of listing out pertinent information about the contents of a data file. The block number and/or label string identify how to request the data when using the Get() command (either the block number or the label string can be given as the "Item" parameter).
/Full
Give a full listing of information, eg the full listing for the example above.
>> List/full "dat.out" Genie intermediate file version 1.0 Block = 1, Label = vanadium, Type = GXWorkspace Created: Tue 01 Jul at 14:02:36 BST by Chris <cmt@spudtek> Comment: Calibrating run Block = 2, Label = Run 1, Type = GXWorkspace Created: Tue 01 Jul at 14:03:36 BST by Chris <cmt@spudtek> Comment: 15/3/98 - Nobel data (first cut) Block = 3, Label = Run 2, Type = GXWorkspace Created: Tue 01 Jul at 14:16:58 BST by Chris <cmt@spudtek> Comment: 15/3/98 - Nobel data (what I wrote up)
File (String)
The input file to be listed
Parname2 (Type2)
As above
RESULT = (Workspace)
Returns the result of the command as a workspace of strings and string arrays so that the information can be used in a program. The example below shows the same listing returned in a workspace.
>> printn list:full("dat.out") Workspace [] ( header = "Genie intermediate file version 1.0" user = [Chris <cmt@spudtek> Chris <cmt@spudtek> Chris <cmt@spudtek> ] Array(3) type = [GXWorkspace GXWorkspace GXWorkspace ] Array(3) label = [vanadium Run 1 Run 2 ] Array(3 ) comment = [Calib. run 15/3/98 - Nobel dat (first cut) 15/3/98 - Nobel dat (written up) ] Array(3) date = [Tue 01 Jul at 14:02:36 BST Tue 01 Jul at 14:03:36 BST Tue 01 Jul at 14:16:58 BST ] Array(3) )
As for the List() but lists the contents of the default input file as specified with one or more of the Set() commands.
As for the List() but lists the contents of the default output file as specified with one or more of the Set() commands.
Returns the number of readable blocks in an Open GENIE recognized file.
NBLOCKS() | [file=String] | Return number of blocks in an intermediate file, or number of spectra in a raw file |
example:
# Check the number of spectra in a raw # file then do a multiplot >> Set/File/Input "hrp00345.raw" >> n = nblocks() >> multiplot 1:(n)
Note: For an ISIS raw file the above use of Nblocks() is equivalent to Get("NSP1").
Returns the number of blocks the Get() command would be able to read when reading by block number. Put in another way for a file "d.dat" the command Get(Nblocks("d.dat"), "d.dat") will access the last block in the file.
File (String) [ default = default input file ]
Any file of a type which can be recognised by Open GENIE.
RESULT = (Integer)
Returns the number of the highest block in the file.
Outputs Open GENIE data to a known file type.
PUT | gv=Any [label=String] [comment=String] [file=String] | Appends the specified variable to the end of the data file. |
[/NEW] | Create a new data file or overwrite existing file. | |
[/G3] | Write in Open GENIE intermediate format (default). | |
[/HDF] | Write in HDF format. |
example:
# Copy a whole multidimensional spectrum from a raw # file into a single item in an intermediate file >> Set/file/Input "hrp00273.raw" >> Set/file/Output "example.in3" >> put get(1:20) label="bigspec" comment="demo"
The Put() command provides a mechanism for saving Open GENIE variables of arbitrary complexity in an intermediate binary file. Items are written sequentially and appended to any already existing file - if the file does not exist or needs re-creating it can be created or overwritten by specifying the "/New" qualifier.
Variables being put into a file may optionally be tagged with a label string. This makes direct access using the Get() command easier as the label can be used by Get() instead of the block number. Comments may also be added to annotate individual data items in the file to enable identification later with the List() command.
/New
Used to force file creation when no file exists or when it is necessary to overwrite and existing file rather than appending a data item to it (the default).
/G3
Specifies that data will be written in Open GENIE intermediate file format.
/HDF
Identical behaviour, but specifies that data will be written in HDF format rather than in Open GENIE intermediate file format.
Gv (Any)
The Open GENIE variable to be written to the data file. Any genie variable of any complexity can be written directly into an intermediate file and retrieved with the Get() command.
Read or write any format of ASCII data.
ASCIIFILE:OPEN() | file=String [comment=String] [delimiter=String] | Open an ascii file |
ASCIIFILE/CLOSE | handle=AsciiFile | Close an open file |
ASCIIFILE:DATA() [:RESET] |
handle=AsciiFile | Return all data currently accumulated in a workspace. |
ASCIIFILE:LINES() | handle=AsciiFile | Return the number of data lines left to read |
ASCIIFILE/READFIXED | handle=AsciiFile [fields=String] format=String [count=Integer] | Read fixed format data |
ASCIIFILE/READFREE | handle=AsciiFile [fields=String] [separator=String] [count=Integer] | Read free format data |
ASCIIFILE/SKIP | handle=AsciiFile [nlines=Integer] | Skip lines on input |
ASCIIFILE/WRITEFREE | handle=AsciiFile comment=String separator=String gv1=Any [gv2=Any] [gv3=Any] [gv4=Any] | Write free format data |
ASCIIFILE/REWIND | handle=AsciiFile | Close and re-open a file at the start |
example:
# Read three data arrays (in columns separated by whitespace) # and assign to arrays in fields X, Y, and E in the new workspace. Handle = Asciifile:Open("myilldata.dat") wk1 = Asciifile:Readfree(Handle, "X,Y,E", $WHITESPACE, 8) printin wk1 Workspace [] ( x = [1.0 1.1 1.2 1.3 1.4 ...] Array(8 ) y = [2.1 2.1 2.2 2.0 2.0 ...] Array(8 ) e = [0.0 0.1 0.2 0.0 0.1 ...] Array(8 ) )
Open a file and return a handle for use with other Asciifile() commands. This command must be called before any other operations can be carried out
File (String)
Name of the ascii data file to be opened, or if it does not exist, to be created.
Comment (String) [ default = "" ]
When an ASCII file is opened by Open GENIE for reading, it is possible to specify a single character which is being used in the input file as a comment character. The result of this will be to effectively ignore all lines beginning with this character up to the last instance of "Delimiter" (the Asciifile:lines() command will report only the number of non-commented lines).
Delimiter (String) [ default = "\n" (new line) ]
A single character that indicates the end of a line of input and this is configureable because different systems may terminate lines in different ways. Normally this will only be necessary if the ASCII file has come from a different operating system (for example, files from a Macintosh may require "\r" as the delimiter).
RESULT = (Asciifile)
The result of this command is a file handle variable which must be stored and passed as a parameter to any future operations on the file.
Close the file, flushing any buffers to disk.
Handle (Asciifile)
Specifies the file to close. Once a file has been closed, the "Handle" value becomes undefined and should not be used.
It is possible to read data in two ways with the Asciifile() command. The example at the begining of this command description shows how data may be read into a workspace in a single go with the /Readfree qualifier. An alternative way of reading the same data is shown below using the Asciifile:Data() command.
Asciifile/Readfree Handle "X1,Y1,E1" $WHITESPACE 4 Asciifile/Readfree Handle "X2,Y2,E2" $WHITESPACE 4 wk1 = Asciifile:data(Handle) printn wk1 Workspace [] ( x1 = [1.0 1.1 1.2 1.3 ] Array(4 ) y1 = [2.1 2.1 2.2 2.0 ] Array(4 ) e1 = [0.0 0.1 0.2 0.0 ] Array(4 ) x2 = [1.4 1.5 1.6 1.7 ] Array(4 ) y2 = [2.0 2.0 2.0 2.0 ] Array(4 ) e2 = [0.1 0.1 0.2 0.0 ] Array(4 ) )
Using this method several different items of data may be accumulated into the workspace before it is returned.
/Reset
Clears the workspace which was previously being accumulated of all fields and gives a fresh start. Note that this does not reset any file pointers; to reset a file on reading use the /Rewind option.
Handle (Asciifile)
Specifies the file with which all the data is associated. A separate workspace may be accumulated for every open file handle.
RESULT = (Workspace)
Returns the accumulated workspace of data items.
Returns the number of data lines (i.e. non comment lines) in the file left to read. To return the total number of data lines in a file, the Asciifile:lines() command must be called before any lines of data are read in.
Handle (Asciifile)
Specifies the file to count the remaining lines in.
RESULT = (Integer)
Count of remaining lines to read.
Reads lines from an ASCII formatted file in "Fixed" format. This is similar to FORTRAN fixed format reads where data is identified exactly by position and length and there are not necessarily any spaces separating the data being read in. For example, the line below reads 50 lines out of a fixed format file consiting of two columns of real numbers in fields of width 10 each. The first character on each line is a space to be skipped before the numbers start.
wk = Asciifile:Readfixed(Handle, "x,y", " %10f%10f", 50)
/Optional
Describe only qualifiers which do not affect the parameter list here, before the parameters.
Handle (Asciifile)
Specifies the file to read data from. The current postion in the file is also remembered with the file handle.
Fields (String) [ default = "FIELD01, FIELD02, FIELD03, FIELD04, FIELD05, FIELD06" ]
Gives a list of names, separated by commas, which will be assigned to the fields of the resultant data workspace. The names will be associated, in order, with the columns of data as they are read from the input file.
If the empty string ("") is passed and the data being read is either a single value or a single column of data, a single variable or array will be returned instead of a whole workspace.
Format (String)
This is a C style sscanf expression (similar in a FORTRAN FORMAT statement in meaning). The "%" character is used to indicate the position and specific format for each data item in the line. Some examples of common formatting possibilities are given below.
%6f | Matches a floating point number of total width 6 |
%s | Matches a string of non-whitespace characters |
%10c | Matches ten characters, including white space |
%d | Matches an integer |
%4d | Matches an integer of width 4 |
%*f | Skips a float in the line |
%% | Matches a % character |
" " | (space) Skips one or more spaces |
Other sscanf formatting conventions may be used if they are supported on the host operating system.
Count (Integer) [ default = 1 ]
Number of lines to read in one operation. This effectively defines the size of the data arrays being returned for each column of data. To read to the end of the file specify -1.
RESULT = (Workspace, array or single value)
The result of an ASCII read operation depends on the amount and format of the data read, normally a workspace is returned, but for a single column of data or a single value in the file, an array or single item can be returned respectively (see the "Fields" parameter description).
Reads lines from an ASCII formatted file in "Free" format. This is similar to FORTRAN list directed read statements where data is separated, usually by spaces or commas. For example, the line below reads back a workspace with two array fields X and Y which are read from two columns in the input file where the columns are delimited by one or more "!" characters.
wk = Asciifile:Readfree(Handle, "x,y", "[!]+", 40)
Handle (Asciifile)
Specifies the file to read data from. The current postion in the file is also remembered with the file handle.
Fields (String) [ default = "FIELD01, FIELD02, FIELD03, FIELD04, FIELD05, FIELD06" ]
Gives a list of names, separated by commas, which will be assigned to the fields of the resultant data workspace. The names will be associated, in order, with the columns of data as they are read from the input file.
If the empty string ("") is passed and the data being read is either a single value or a single column of data, a single variable or array will be returned instead of a whole workspace.
Separator (String) [ default = $WHITESPACE ( one or more tabs or spaces ) ]
A single character or regular expression specifying what to expect between each item of data on a line. The definition of the default $WHITESPACE is "[ \t]+" meaning one or more space or tab characters. This default will be suitable for many cases but for example, an expression like " *, *" will delimit comma separated data. For more details of how to construct regular expressions see regular expressions in the Appendices to this manual.
Count (Integer) [ default = 1 ]
Number of lines to read in one operation. This effectively defines the size of the data arrays being returned for each column of data.
RESULT = (Workspace, array or single value)
The result of an ASCII read operation depends on the amount and format of the data read, normally a workspace is returned, but for a single column of data or a single value in the file, an array or single item can be returned respectively (see the "Fields" parameter description).
This skips "Nlines" of input data (i.e. non comment) lines in an input file.
Handle (Asciifile)
Specifies the file in which to skip the lines.
Nlines (Integer) [ default = skip 1 line ]
Number on lines in the input file to skip.
Writes Open GENIE variables into up to four free formatted columns of ASCII data. Data cannot be written to an existing file already opened for reading.
Handle (Asciifile)
Specifies the opened file to write data to.
Comment (String) [ default = "" ]
Optional user comment which will be preceded by the comment character specified with the Asciifile/Open command. If a comment character was specified for the file and nothing is specified for this parameter, Open GENIE will add its own default header.
Separator (String) [ default = " " ]
Specifies the character(s) to separate columns of output data with.
Gv1-Gv4 (Any valid Open GENIE type except workspaces)
Up to four separate GENIE data items to write out at one time. The values are written out in up to four columns. The longest data item of the four determines the length of the data added to the file. The shorter items are repeated to fill their columns.
Manage the dynamic loading and execution of user written C or FORTRAN code.
MODULE/COMPILE [/C] |
file=String [comp_flags=String] [link_flags=String] [symbols=String] | Compile a user written module |
MODULE/LOAD | file=String [desc=String] | (Re-) load the routine into memory |
MODULE/EXECUTE [/C] |
func=String pars=Workspace | Run a loaded module |
MODULE/LIST | Show loaded modules |
example:
# Compile a convolution module, load then run it on a 2-D workspace >> Module/Compile "conv.for" comp_flags="/check=all" symbols="conv_sub" >> Module/Load "conv.so" >> w1 = get(1:30) >> w2 = Module:Execute("conv_sub", w1)
Note: A compiled module only needs loading once per Open GENIE session.
Open GENIE looks after the details of compiling a dynamically loadable program module whatever system it is running on. This greatly simplifies what on some systems is quite a complex process. The end result of the compilation of either a C or FORTRAN program is a dynamically loadable library which can contain one or more subroutines callable by Open GENIE once the module has been loaded.
The Compiled module may be written in FORTRAN or C and needs to adhere to a simple set of conventions to ensure its correct communication with the running Open GENIE. The structure of a module and the facilities available to it are described in the FORTRAN Module Interface and the C Module Interface sections of this manual.
/C
Invoke the C compiler instead of the FORTRAN compiler (the default).
File (String)
The name of the FORTRAN or C source file (including the .f, .c, or .for part of the filename). The compilation will produce a shareable library of the same file name but with the file extension of ".so" for the dynamic library. Once created, this can be kept and used with the Module/Load command.
Comp_flags (String) [ default = "" ]
This string takes any compiler flags or switches which may be needed by your program. Open GENIE already will have already added anything that is needed for compiling modules.
Link_flags (String) [ default = "" ]
This string takes any linking flags or switches which may be needed to link the compiled code. Open GENIE will have already added all the flags needed to build a shareable library.
Symbols (String) [ default = "" ]
This is a comma separated list of the subroutine or C function names which you want open GENIE to be able to call from your module when you run a loaded module. This parameter supplies all the names you can use when specifying the "func" parameter in the Module/Execute command.
Note that if you do not list a name here, on most operating systems, the Module/Execute command will not be able to find your subroutine in the dynamic library and you will get an error.
The Module/Load command takes an existing compiled shareable module library and activates it into Open GENIE so that the routines in the module may be called. This only needs to be done once for any module file in an Open GENIE session. From then on it is possible to call routines within the module using the Module/Execute command. It is possible to check which modules are loaded with the Module/List command.
File (String)
The full filename of the shareable library module to be loaded (it will always be a file ending in ".so").
Desc (String) [ default = "<no description>" ]
An optional description string. This is useful when several different modules are being used to identify their function. The description is show when using the Module/List command.
This command runs a subroutine or C function from within a user written module. Open GENIE's advanced data access mechanism means that complex data can easily be transferred to and from a user written program without complex programming on the part of the user. The Module/Execute command can be called either as a function ( x = Module:Execute(...) ) or as a keyword command ( Module/Execute ... ). When called as a function a workspace is returned which may contain complex multi-dimensional data and/or simple strings and individual parameters.
Func (String)
The name of the subroutine or C function in the compiled module to call.
Pars (Workspace)
A workspace containing all the information for the external routine to process. This may be a workspace assembled just to package a few parameters and a data array needed by the external routine or it can be a complete n-dimensional workspace as read in by Open GENIE from data file (see the example above). See the sections on C Module Interface or FORTRAN Module Interface for details about the method of communicating parameters with the shareable library.
RESULT = (Workspace)
Contains the workspace given in the "Pars" parameter but as modified by the external subroutine.
Lists all the currently loaded user written modules.
Print to the users terminal (no newline).
[p1-p20=Any] | Converts all parameters for printing to the terminal screen |
example:
# print out a variable with some text >> print "Value of variable $PI=" $PI Value of variable $PI=3.14159265358979>>
Note: See also the other print commands in the group ( "print" - "n, i, in, e, en, d, dn" e.g. "printdn" )
The generic print command takes up to 20 parameters, these are converted into a text form suitable for display on an interactive terminal and then displayed to the terminal. Depending on the suffix of the print command the text will be sent via different output streams and will be coloured differently using ANSI escape code sequences. If the command ends with an "n" a newline will be added automatically after the text has been printed. If the print conversion is required (ie from variable to string) but without writing to the terminal, it is possible to use the As_string() function.
There are four possible output streams with the following attributes:
Stream type | Print Command | Characteristics |
Normal output | Print() or Printn() | Normal output in (typically) black text |
Informational output | Printi() or Printin() | Blue coloured, can be switched on and off (see Toggle/Info) |
Error output | Printe() or Printen() | Red coloured, includes line number and procedure where error occured |
Debugging output | Printd() or Printdn() | Mauve coloured, separates debugging output from other types of output |
P1-P20 (Any)
Variables to be printed. The strings produced by each variable are concatenated by the print command without adding any white space to allow maximum control over formatting.
Print to the users terminal with a terminating newline.
PRINTN | [p1-p20=Any] | Converts all parameters for printing to the terminal screen |
example:
# print out a variable with some text >> printn "Value of variable $PI=" $PI Value of variable $PI=3.14159265358979 >>
Note: See also the other print commands in the group ( "print" - "n, i, in, e, en, d, dn" e.g. "printdn" )
See the generic Print() command for a full description.
Print an informational message to the users terminal (no newline).
PRINTI | [p1-p20=Any] | Converts all parameters for printing to the terminal screen |
example:
# print out a variable with some text >> printi "Value of variable $PI=" $PI Value of variable $PI=3.14159265358979>>
Note: See also the other print commands in the group ( "print" - "n, i, in, e, en, d, dn" e.g. "printdn" )
See the generic Print() command for a full description.
Print an informational message to the users terminal with a terminating newline.
PRINTIN | [p1-p20=Any] | Converts all parameters for printing to the terminal screen |
example:
# print out a variable with some text >> printin "Value of variable $PI=" $PI Value of variable $PI=3.14159265358979 >>
Note: See also the other print commands in the group ( "print" - "n, i, in, e, en, d, dn" e.g. "printdn" )
See the generic Print() command for a full description.
Print an error message to the users terminal (no newline).
PRINTE | [p1-p20=Any] | Converts all parameters for printing to the terminal screen |
example:
# print out a variable with some text >> printe "Value of variable $PI=" $PI 0/(none)/Value of variable $PI=3.14159265358979>>
Note: See also the other print commands in the group ( "print" - "n, i, in, e, en, d, dn" e.g. "printdn" )
See the generic Print() command for a full description.
Print an error message to the users terminal with a terminating newline.
PRINTEN | [p1-p20=Any] | Converts all parameters for printing to the terminal screen |
example:
# print out a variable with some text >> printen "Value of variable $PI=" $PI 0/(none)/Value of variable $PI=3.14159265358979 >>
Note: See also the other print commands in the group ( "print" - "n, i, in, e, en, d, dn" e.g. "printdn" )
See the generic Print() command for a full description.
Print an debugging message to the users terminal (no newline).
PRINTD | [p1-p20=Any] | Converts all parameters for printing to the terminal screen |
example:
# print out a variable with some text >> printd "Value of variable $PI=" $PI Value of variable $PI=3.14159265358979>>
Note: See also the other print commands in the group ( "print" - "n, i, in, e, en, d, dn" e.g. "printdn" )
See the generic Print() command for a full description.
Print a debugging message to the users terminal with a terminating newline.
PRINTDN | [p1-p20=Any] | Converts all parameters for printing to the terminal screen |
example:
# print out a variable with some text >> printdn "Value of variable $PI=" $PI Value of variable $PI=3.14159265358979 >>
Note: See also the other print commands in the group ( "print" - "n, i, in, e, en, d, dn" e.g. "printdn" )
See the generic Print() command for a full description.
Prompts the user for terminal input and reads back an input variable.
INQUIRE | [aprompt=String] | Inquire information from the user interactively |
example:
# Read in a lower limit from the user >> llimit = inquire("Enter lower limit") Enter lower limit: 45.678 >> printn llimit 45.6779999999999 >> printn Is_a(llimit, "Real") $TRUE
Note: To read a string without any conversions or prompting use Read_terminal()
This command reads input from the users terminal. It also supplies a prompt string to obtain input from the user. The Inquire() command attempts to read the input variable back into the correct type of Open GENIE internal variable. Currently, this is only the case for single Integer or Real values. Any unrecognized type is returned as a string.
Aprompt (String) [ default = " :" ]
A string which tells the user what information is required, a ":" is appended to the prompt.
RESULT = (Any)
Either a string or the value of the variable as a Real or Integer. If no input is given "" is returned.
Read a string back from the input terminal into a variable
READ_TERMINAL() | Return a string typed in at the terminal |
example:
# Read a string >> printn "(" read_terminal() ")" abcd efg (abcd efg) >>
Note: To read numbers as well as strings you may wish to use the Inquire() command.
This command reads a string (terminated by a carriage return) from the terminal. A numeric string can be converted by using As_variable() on the string returned by Read_terminal(). This is the way the Inquire() command is written.
RESULT = (String)
The string read from the terminal, not including the return character which terminated the input.