next up previous contents
Next: The ReadLibrary command Up: Standard Files Previous: Standard Files

The ReadProgram Command

To load a standard file named filename into Darwin, type

> ReadProgram('filename');
Note that we can include operating system path information.
> ReadProgram('~hallett/Darwin/Tree.Construction.Algorithms');
Darwin treats the contents of filename exactly as though you had typed the contents in from the keyboard directly. This means that you can not only load routines and structures but instruct Darwin to execute them. If filename contains the following
>  x := 5;               # the following code is located in the 
>  y := proc( )          # external file called 'filename'.
>    print('hi');
>  end;
>  y;
>  done;
then Darwin will assign the value 5 to x, invoke procedure y and afterwards exit the session.

Gaston Gonnet