[Maxc]If.run - overview More complete documentation on If.press Martin Newell and Beau Sheil. December 1978. Copyright Xerox Corporation 1979 --- Updated January 2, 1979 5:34 PM by MN String searching added - the s switch Updated December 4, 1979, by Peter Deutsch File date comparisons, nested IFs added Updated July 9, 1982, by Dan Swinehart Creation date comparison made explicit via /c switch --- If implements conditional execution of groups of commands to the Alto Executive. SYNTAX If [then ] [else ] where [] denotes an optional clause, and is one of: filename (yields true if file exists) filename/l=N (yields true if length of file = N) filename/lN (yields true if length of file > N) filename/s"string" (yields true if file contains string) and N is a decimal constant filename/r=otherfilename/r (yields true if read dates are equal) (similarly for filename/r is any string of Alto executive commands separated by ';'. Note necessity to escape semicolon past the Executive command line reader. Ifs can be nested by enclosing in braces ("{" and "}"): the braces will be removed before the are passed to the Executive. SEMANTICS In the case that yields true the in the then clause (if present) are passed to the Executive for execution, otherwise the in the else clause (if present) are passed. "*" in the /s switch string matches zero or more file characters. Must escape past the Executive. EXAMPLE I: The mesa compiler creates an .errlog file only if there are errors. To enter bravo if there were errors, or the mesa system if not: Compiler prog.mesa If prog.errlog then bravo/m prog else mesa prog This is a modification of the m quit macro in bravo for mesa. EXAMPLE II: BCPL always creates a transcript file. However, the equivalent effect can be achieved by: bcpl/f prog.bcpl If prog.bt/s"ERROR" then bravo/b prog else bldr prog