[Thread Prev][Thread Next][Index]
query/ignore and use of Ferret error messages
Hello,
1. I was wondering if there is any way to simultaneously check the value of an optional argument of a script, display an error message if wrong, and attribute it a default value if undefined, i.e. to do in 1 line this serie of commands:
define symbol orientation = ($1%portrait%) !orientation can be "portrait" (default) or "landscape", nothing else.
if ($orientation"|portrait>F|landscape>F|*>T|") then
say "$&@# usage: go my_script [portrait/landscape]"
exit
endif
...
I was thinking to something like:
query/ignore $1%portrait|portrait|landscape|<$&@# usage: go my_script [portrait/landscape]%
but then, when $1 is supposed to have been set by default to its default value (because not provided by the user), I can not use $1 in:
say ($1) or Fprint -l ($1)
=> I get the error message " **ERROR: invalid command: Value needed for argument 1 in command"
The command query/ignore understood the default value instruction but does not seem to have attributed it to $1 (that's maybe not its function too).
I just would like to avoid to have ($1"...|...|...|") everywhere in my script. Just one would be enough. I probably can do this:
query/ignore $1%portrait|portrait|landscape|<$&@# usage: go my_script [portrait/landscape]%
define symbol orientation = ($1%portrait%)
but maybe is there a way to do is still shortly.
2. Last short question: is it possible to use and "customize" the error messages usually given by Ferret? So, automatically have this kind of message when a script encounters an error (error defined by me, not a normal error of Ferret): **ERROR: my error message
Is there any "error code", like 0 => ok, 1 => **ERROR:, 2 => *** NOTE:, ... ?
Thanks for any help!
Emilie
____________________________________________________________
Emilie VANVYVE
Physicist, PhD student
Université catholique de Louvain (UCL)
Institut d'astronomie et de géophysique G. Lemaître (ASTR)
Chemin du Cyclotron, 2
1348 Louvain-la-Neuve (Belgium)
Phone : +32-(0)10-473300
Fax : +32-(0)10-474722
E-mail : vanvyve@astr.ucl.ac.be
Web : www.astr.ucl.ac.be
[Thread Prev][Thread Next][Index]
Dept of Commerce /
NOAA /
OAR /
PMEL /
TMAP
Contact Us | Privacy Policy | Disclaimer | Accessibility Statement