6 #--------------------------------------------------------------------------------------
8 # Utility script for csh library functions.
10 #--------------------------------------------------------------------------------------
17 setenv TIMER 0 # timer
19 setenv DEFAULT_OPTION - #
default option
22 # Wild card for any valid detector identifier or run number; to be used as ${ANY}.
24 setenv ANY_ID
"[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]"
26 setenv
PI 3.14159265359
27 setenv
TIMESTAMP "#splitline{}{#splitline{%d-%m-%y}{ %H:%M}}%F1970-01-01 00:00:00"
33 alias fatal
'echo `date` FATAL \!* ; exit'
34 alias error
'eval "if ( $DEBUG >= 0 ) then \\
35 echo `date` ERROR \!* \\
37 alias notice
'eval "if ( $DEBUG >= 1 ) then \\
38 echo `date` STATUS \!* \\
40 alias status
'eval "if ( $DEBUG >= 2 ) then \\
41 echo `date` STATUS \!* \\
43 alias warning
'eval "if ( $DEBUG >= 2 ) then \\
44 echo `date` WARNING \!* \\
46 alias
debug 'eval "if ( $DEBUG >= 3 ) then \\
47 echo `date` DEBUG \!* \\
52 # Source including PATH.
57 "if ( \!:1 =~ */* ) then \\
62 source `which \!:1` \!:2* \\
67 # Method to print environment variables.
69 alias print_env
'eval setenv'
73 # Method to check for CC Lyon.
75 # \return 1 for CC Lyon; else 0
77 alias is_CCLyon
'eval \\
78 "if ( $?HOST != 0 && `echo $HOST | cut -c1-2` == cc ) then \\
85 # Method to define variable.
89 alias define_variable
'eval \\
90 "if (${?\!:1} == 0) then \\
96 # Method to set variable.
97 # Note that a value equal to $DEFAULT_OPTION will not modify the variable.
100 # \param 2-N value(s)
103 "if ("\"\!:2*\"" != "\"$DEFAULT_OPTION\"") then \\
104 setenv \!:1 "\"\!:2*\"" \\
109 # Method to locally set variable.
110 # Note that a value equal to $DEFAULT_OPTION will not modify the variable.
113 # \param 2-N value(s)
115 alias set_local_variable
'eval \\
116 "if ("\"\!:2*\"" != "\"$DEFAULT_OPTION\"") then \\
117 set \!:1 "\"\!:2*\"" \\
122 # Method to unset variable.
126 alias unset_variable
'eval unsetenv \!:1'
130 # Method to print variables.
132 # \param 1-N list of variables
134 alias print_variable
'eval \\
135 "printf "%-20s\\ =\\ " \!:1 \\
137 if (`echo \!:1* | wc -w` > 1) then \\
138 print_variable \!:2* \\
143 # Method to check validity of variables.
145 # \param 1-N list of variables
147 alias check_variable
'eval \\
148 "if (! ${?\!:1}) then \\
149 fatal "Variable \!:1 not defined." \\
151 if (`echo \!:1* | wc -w` > 1) then \\
152 check_variable \!:2* \\
157 # Method to set array.
159 # \param 1 array name
162 alias set_array
'eval "set \!:1=(\!:2*)"'
166 # Method to count directory in ':' separated path list.
171 alias count_directory
'eval "echo -n ${\!:1} | tr : \\n | grep "^\\\\\!:2\\\$" | wc -w"'
175 # Method to remove directory from ':' separated path list.
180 alias remove_directory
'eval "setenv \!:1 `echo -n ${\!:1} | tr : \\n | grep -v "^\\\\\!:2\\\$" | tr \\n : | sed "s/:\\\$//"`"'
184 # Method to remove variable from ':' separated path list.
189 alias remove_variable
'eval \\
190 "if (! ${?\!:2}) then \\
192 remove_directory \!:1 "\${\!:2}" \\
197 # Method to insert directory into ':' separated path list.
202 alias insert_directory
'eval \\
203 "if (! ${?\!:1}) then \\
205 else if (`echo -n ${\!:1} | tr : \\n | grep "^\\\\\!:2\\\$" | wc -w` == 0) then \\
206 setenv \!:1 \!:2\:${\!:1} \\
then echo Variable JPP_DIR undefined exit fi source $JPP_DIR setenv sh $JPP_DIR &dev null set_variable
static const double PI
Mathematical constants.
static const char *const TIMESTAMP
Time stamp of earliest UTC time.
#define DEBUG(A)
Message macros.