Do.run - overview

More complete documentation on Do.press

Martin Newell,  April 1978;  Lyle Ramshaw,  December 1980.
Copyright Xerox Corporation 1979,1980

Do executes a command file which may contain parameters
  for substitution.

Example

To edit a file on a remote file server, let edit.do contain:

  //Edit file #1 on file server #2
  Ftp #2 retrieve/c #1
  Bravo/n #1
  Ftp #2 store/c #1

Then the command:

  Do edit spec.bravo maxc

will execute:

  //Edit file spec.bravo on file server maxc
  Ftp maxc retrieve/c spec.bravo
  Bravo/n spec.bravo
  Ftp maxc store/c spec.bravo

Syntax:

Do [ [param1 [param2 [... [paramN]...]]]]
   will request missing items.

In  paramN is specified as #N or #N#
   the latter form being required when the parameter is followed
   by one of:{digit, #, ?, =, *}. The latter form may be always used
   if in doubt.

Literal # should be specified as ## when followed by one of
   the special characters mentioned above.

In specifying the parameters, escape is ". i.e. " is equivalent
   to an uninterpreted  (useful for including spaces in a
   parameter, e.g. Do file one" parameter )

Null parameters may be specified by typing a single hyphen;  if
   you want to use the string consisting of a single hyphen as an
   actual parameter, type "- instead.

Prompts: If no value for parameter n is given
   in the command line then the value of that parameter is
   requested interactively, using a standard prompt. The prompt
   may be changed by including it with the first appearance of
   that parameter in the Do file, thus:   #n?prompt#   where n is
   the number of the parameter as before, and "prompt" is the
   required prompt string, conforming to the rules for typing
   parameters (i.e. using " as escape).

Defaults: Another possibility when no value for parameter n is
   given is to provide a default in the Do file, thus: #n=default#
   where "default" is the default value of parameter n, again
   conforming to the rules for typing parameters.

File recognition: if  has an extension then no recognition,
   else the extensions .do and .cm are attempted, followed by an
   attempt at the file name with no extension.

Do does the right thing if embedded in a string of commands.

Do's may be nested arbitrarily deep.

Mapping feature:  if the first occurrence of the largest numbered
   formal parameter in the .do file has the form #n*, then Do
   will instantiate the .do file multiple times, first substituting the
   nth actual parameter for the nth formal, then substituting
   the (n+1)st actual for the nth formal, and so on.  Note that
   parameters cannot be defaulted if the mapping feature is in use.

Another example: to edit a file on a remote file server,
  let edit.do contain:

  //Edit file #1?Edit" file:# on file server #2=Ivy#
  Ftp #2 retrieve/c #1
  Bravo/n #1
  Ftp #2 store/c #1

then the command:

  Do edit spec.bravo maxc

will generate exactly the same as in the first example,
while the command:

  Do

will provoke the questions (and possible answers):

  Do file: edit
  Edit file: spec.bravo

and generate the commands:

  //Edit file spec.bravo on file server Ivy
  Ftp Ivy retrieve/c spec.bravo
  Bravo/n spec.bravo
  Ftp Ivy store/c spec.bravo

A mapping example:  Suppose that your Bravo is configured so 
   that, when invoked in the manner

     Bravo/H spec.bravo 3

it will hardcopy three copies of spec.bravo and then quit.  Let
the file hardcopy.do contain:

     //Hardcopy #1 copies of #2* first
     Bravo/H #2 #1
     //and then do the rest

Then, giving the Executive the command:

     Do Hardcopy 5 *.bravo

will print five copies of all of your .bravo files.