Institut für Astronomie und AstrophysikAbteilung AstronomieSand 1, D-72076 Tübingen, Germany |
cafe - syntax
Describe command line syntax
cafe
In cafe commands have the general form: > command,param1,..paramn [,/option1][,/option2]...[,/option42] This line consists of a command name ('command') and some required parameters, sometimes the group to which the command should applied to, and some optional flags. These optional flags always start with "/". All parameters/options are separated by ','. The brackets ("[..]") above denote optional parameters. In general it is not necessary to quote strings (as for example file names). Quoting with "" should be done if - the string looks like a number - the string starts with a '/' (e.g. absolute path). Otherwise the string will be interpreted as an option. - The string is enclosed in parentheses () or []. - White spaces in the string are important. If a parameter should be a number most times it is sufficient to write the number as usual in the format: digits[.digits E digits] with digits representing 0..9. If complex expressions are used they should be enclosed in parentheses (..) to avoid implicit string quoting. For example numbers in expressions should be placed in ().
The parameter syntax follows some conventions: - A command may access several subtasks to perform its goal. These are defined with string identifier. Often it is possible to combine these subtasks; this will be done with a "+".
The plot command could be used with different plot styles (these are executed by the subtasks) which may be combined with "+": > plot, data+model -> plot data AND model in a single plot panel. Help for these subtasks can be get with > help, <command>,. - If a subtask refers to a certain group, the group will be specified with ":" + group number.
> plot, data:1 -> plot data of group 1. - If a subtask needs some special parameters they will be passed in brackets "[]".
> data, lc.fits[time,rate] -> load data with column time=x, rate=y. - Setting of internal state parameters is done with the syntax: identifier=value while the identifier is a string defining what parameter to set and value defines at which value to set the parameter.
> setplot, xtitle=time -> sets internal parameter xtitle at string value "time".
A command line which does not start with a alphabetic value or a "!", "@", "#" (s.b.) is interpreted as a comment and does nothing. For convenience it is advised to denote comments with a semicolon as used in IDL (";"). BATCH-PROCESSING: If the command line starts with a "@" the following word is interpreted as a file name from which cafe commands are read. The file is called a "script".
cafe> @test.cmd -> read and execute commands from test.cmd If an command needs some user input the input will be read from the batch file. Lines starting with ";" are ignored in this case (see comments above). It is possible to pass parameters to the script processing which must be comma separated. The parameters are visible in the script as the IDL-variables "p1", "p2"..."p9". cafe> @plot,sin,5 -> pass the parameter p1="sin" and p2=5 to the script. This mechanism could be used to make the script flexible. The IDL variables could be expanded either using the "()"-Syntax or "%"-expressions (see below).
The file "plot.cmd" contains > plot,data+%p1% Then calling the script expands to: > @plot,model -> process "plot,data+model"
If the command line starts with a "!" the following will be interpreted as an IDL command. This has two purposes: 1.) To run a separate IDL process (e.g. compute print,2+2) 2.) To access the cafe inner state for either debugging purposes or to run cafe commands directly without syntax bypassing by the cafe environment. The main interesting part would probably be the cafe environment, stored in the struct called "env".
If the command line starts with a "#" the command will not be echoed into the log file.
Parameters with expressions which should be evaluated when calling the command may be encloses within "%". These expressions will be transformed into strings. The drawback is that scalar values only can be handled. To avoid this expression expansion the string must be quoted with double quotation marks (").
> ! data = "test.dat" > setplot, title=Plot of: %data% -> insert "test.dat" in %data% resulting in: "Plot of: test.dat"
Non existing cafe commands will be interpreted as shell commands. This allows easy access to the environment.
cafe> ls -l -> Execute shell command: ls -l > -rw-r--r-- 1 eckart users 3718 M�r 16 14:37 cafe_cafe.pro > -rw-r--r-- 1 eckart users 2831 M�r 16 14:45 cafe_chgrp.pro > -rw-r--r-- 1 eckart users 6559 M�r 16 14:46 cafe_chpar.pro > -rw-r--r-- 1 eckart users 5695 M�r 16 14:48 cafe_clean.pro
$Id: cafe_syntax.pro,v 1.10 2004/01/26 10:20:47 goehler Exp $
[Home Page] [Software, Documentation] [IDL Documentation] [Quick Reference] [Feedback]