[Maxc]<Alto>If.run - overview

More complete documentation on <AltoDocs>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 <condition> [then <commands>] [else <commands>]

where [] denotes an optional clause, and
  <condition> is one of:
     filename         (yields true if file exists)
     filename/l=N   (yields true if length of file = N)
     filename/l<N   (yields true if length of file < N)
     filename/l>N   (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<otherfilename/r, etc.)
     (similarly with either or both /r changed to /w -- write date)
     (similarly with either or both /r changed to /c -- creation date)
  <commands> 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 <commands> in braces ("{" and "}"): the braces
     will be removed before the <commands> are passed to the Executive.

SEMANTICS

In the case that <condition> yields true the <commands>
in the then clause (if present) are passed to the
Executive for execution, otherwise the <commands> 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