sim [-XToolkitoption ...] [-H] [-b breakpoint-type] [-d] [-h] [-i] [-o]
     [-r random-type] [-v] [file]


     sim lets the user interactively simulate a process from a specification
     in TIL-format given in file.  If no file is given, sim starts up empty.

     Simulation can be done by choosing randomly between  possible  actions,
     or  by  choosing  an action from a list of possible actions.  Atoms and
     processes can be traced, breakpoints can be set on atoms and processes,
     and the process status can be viewed.

     sim has 5 main windows:

     PSF    This window contains a translation of the TIL-code to the source
            language. The source language is derived  from  the  administra-
            tion-tuples  in  the  TIL-code.  If that cannot be found, psf is
            The code is generated by feeding the TIL-code to the program
            in which path is taken from the environment-variable  PSFBINDIR.
            If this variable doesn’t exist, /home/psf/bin is taken.  The xxx
            is replaced with the name of the source language.
            The name of the window is changed to that  of  the  source  lan-

            In this window the messages from the simulator will be given.

     TRACE  Shows the information on the traced atoms and processes, and the
            breakpoints encountered.

            Contains several buttons with the following functions:

                   Pops up a window with the names of  the  modules  in  the
                   TIL-code  and  a  quit  button.   Selecting  one of these
                   names, pops up another window with the names of the atoms
                   and  processes in this module.  Selecting one of these by
                   clicking on them, or selecting a whole group by  clicking
                   and dragging, will set breakpoints on the selected items.
                   This can be reversed by clicking on them again.  Pressing
                   the  quit button or again the breakpoint button pops down
                   both windows.

            Breakpoint type
                   Pops up a menu with the possibilities:
                           on execution
                           stop when one
                           stop when all

                   them, the random is turned off and a message is displayed
                   in the TRACE-window.  When random is turned on, the atoms
                   with  breakpoints on them are not chosen.  Breakpoints on
                   processes will still be dealt with as on execution.

            Trace  Atoms and processes can be selected to be traced, in  the
                   same  way  as breakpoints are set.  Traced atoms and pro-
                   cesses will be displayed in the TRACE-window.

            Default trace
                   If turned on, all atoms are traced following standard ACP
                   visibility rules.

            Reset  Resets the simulator.

            Process status
                   Shows  the  process-table  and the communication-table in
                   the MESSAGE-window.  The process-table is  given  in  the
                   following form:

                              PID   PPID STATUS FLAGS   PRIO HEAD

                   PID means process id

                   PPID parents process id

                   STATUS  if  this process has children, then this is indi-
                   cated by a S (sleeping) with the number of children it is
                   waiting for.

                   FLAGS the following flags can be found:
                           T      temporary process (result of a + or a sum)
                           D      deadlock
                           I      process is idle (due to an interrupt, dis-
                                  rupt, *, or #)
                           P      process can act as a port
                           E      encapsulated atom
                           H      hidden atom
                           C      communication  is  possible  with  another

                   PRIO gives the priority of the process. A negative prior-
                   ity  means  that  it may not be executed (due to a prior-
                   ity).  And the absolute value indicates which prio-opera-
                   tor caused this (counting from this process to the top of
                   the process-tree.  The priority MIN means that this  pro-
                   cess  exist  only for calculation of priorities.  A posi-
                   tive priority means that it has priority.   The  priority
                   MAX  symbolizes  a  forced  action,  a sum-expression for
                   which a value is needed (see also section Sum and Merge).

                   HEAD  shows  the  atoms  to be executed first by the pro-

                   FLAGS the following flags can be found:
                           E      encapsulated communication
                           H      hidden communication.

                   PRIO  gives the priority of the communication.  Its value
                   has the same meaning as for processes.

                   COMM shows the resulting communication.

            Trace to stdout
                   If turned on, trace output is generated on stdout in  the
                   format  described  in trace_format(5L).  Every time it is
                   turned on an info-line like
                      >file TIL-file
                   is put on stdout.  In which TIL-file is the name  of  the
                   file the current TIL-code is read from.

            Random If turned on, atoms are randomly picked from all the pos-
                   sible atoms that can be executed.  When there is a sum in
                   the choose-list, there is no random choice made.

            Random type
                   Pops up a menu with the possiblities:

                   normal  means  that  all  atoms (including the communica-
                   tions) have equal chance to be picked randomly.

                   weighted means that atoms have a chance to be picked ran-
                   domly  according  to  their position in the process tree.
                   If a chosen atom has possibilities for  communication,  a
                   random choice is made (equal chance) between the communi-
                   cations and the atom itself (if not encapsulated).

                   Pops up a menu with the possiblities:
                           Goto Mark

                   A history is kept of the states at the time  the  CHOOSE-
                   window  was  shown.  So states are not saved when running
                   randomly (continuous).

                   Undo goes back to the previous state.

                   Redo goes to the next state.

                   Mark Adds a mark to the current state. A  name  for  this

                   Load specification pops up a  DIALOG-window,  which  asks
                   for  a filename.  When given, the TIL-code from this file
                   is read into the simulator.

                   Quit simulator stops sim.

     CHOOSE On start of the simulation, this window will pop up with a  list
            of all the possible processes.  Selecting one will start simula-
            tion on this process.  If this process contains variables,  then
            a  value  for  each  of  the  variables have to be provided.  To
            achieve this, a window pops up with  a  list  of  variables  and
            their corresponding value (empty in this stage). Clicking on one
            of the variables results in popping  up  of  another  window  in
            which  a term can be given for the variable.  Confirming with no
            value for one of the variables is not possible.
            Both windows are provided with a history consisting of two  but-
            tons  (up and down). A value (or set of values) occurs only once
            in the history, i.e.  if the same value is entered, the  earlier
            value is removed from the history.

            During  simulation, this window shows a list of all the possible
            atoms that can be executed at this point  and  a  button  random
            once.  When one of the atoms is selected, this atom will be exe-
            cuted.  If clicking is done on the button random once,  an  atom
            will  be selected from this list randomly (according to the ran-
            dom type).

            If a sum is chosen from the list, a term for this  sum  will  be
            asked for (see also Sum and Merge).

            If the random button is on, this window will not be shown.

 Sum and Merge
     Sum  and merge are not fully implemented. The sums and merges over enu-
     merated sets are normally dealt with.  Some sorts and sets can be  con-
     verted to enumerated sets by simpp(1L).

     Other sums are put in the choose-list, and when a sum is chosen, a win-
     dow pops up.  In this window a term can be given for  the  variable  in
     the  sum.   If a correct term is given, this is filled in, and the pro-
     cess continues.
     This window is the same as the one for giving  values  for  a  variable
     from a process.

     However,  in  some  cases a term can be computed.  This is the case for
     certain constructions of sum and sequence operators.  The first atom of
     this  construction may communicate with another atom.  From this commu-
     nication, the values for variables of the sum operators can be derived.
     To make this possible, the following condition must be fulfilled:
            -  The  first atom of the sum-expression has to be easy to find,
            -  The  communication  partner  must  have  the same variable(s)
            (placeholder(s)) of the  atom’s  argument(s),  which  are  vari-
            able(s)  of the sum(s), somewhere in one of the arguments in the
            specified communication.

     In the context of the prio-operator, a value for  the  sum-variable  is
     needed,  in order to calculate it’s priority.  This is forced by giving
     it priority MAX.
     But, if the above conditions are fulfilled and the sets  of  the  prio-
     operator meet the above condition for sets, the priority is calculated.


     sim accepts all of the standard X toolkit  command  line  options  (see
     X(1)), as well as the following:

     -H     Turns off the history mechanism for memory preservation.

     -b breakpoint-type
            Sets  the  breakpoint type to breakpoint-type, where breakpoint-
            type may be one of the following values: exec for  on  execution
            (the default), one for stop when one, and all for stop when all.

     -d     Sets ’Default trace’ on.

     -h     Prints a help message.

     -i     If this option is given, sim reads  from  standard  input.   The
            format  of the input is described in trace_format(5L).  sim per-
            forms the action found in the input, and between actions a  win-
            dow (TRACE FROM STDIN) is popped up with 3 buttons:
                   Next step

            Next step makes sim go on with the next action.

            Stepping makes sim do all the actions until no further steps are
            possible or Stepping is pressed again.

            Quit makes sim  quit  from  this  mode  (reading  from  standard

            While this window is popped up, the functions Breakpoint, Reset,
            Random, Load specification (from Special) in the FUNCTION-window
            and random once in the CHOOSE-window are blocked.
            Messages  about  the  actions  are  given in the MESSAGE-window.
            When sim finds a fault in the input, a message is displayed  and
            sim quits from this mode.

     -o     Sets ’Trace to stdout’ on.

     -r random-type
                    Command  Random once
                    Viewport  view
                         Core  clip
                         List  choose_item
          TopLevelShell  FUNCTION
               Form  function
                    Toggle  Breakpoint
                    MenuButton  Breakpoint type
                         SimpleMenu  BREAKPOINT TYPE
                              SmeBSB  on execution
                              SmeBSB  stop when one
                              SmeBSB  stop when all
                    Toggle  Trace
                    Toggle  Default trace
                    Command  Reset
                    Command  Process status
                    Toggle  Trace to stdout
                    Toggle  Random
                    MenuButton  Random type
                         SimpleMenu  RANDOM TYPE
                              SmeBSB  normal
                              SmeBSB  weighted
                    MenuButton  History
                         SimpleMenu  HISTORY
                              SmeBSB  Undo
                              SmeBSB  Redo
                              SmeBSB  Mark
                              SmeBSB  Goto Mark
                         SimpleMenu  MARK MENU
                              SmeBSB  <mark name>
                    MenuButton  Special
                         SimpleMenu  SPECIAL
                              SmeBSB  Save trace
                              SmeBSB  Load specification
                              SmeBSB  Quit simulator
                         TopLevelShell  SPECIAL DIALOG
                              Dialog  Dialog
                                   Label  label
                                   Text  value
                                   Command  Confirm
                                   Command  Cancel
                    TopLevelShell  MODULES
                         Box  box
                              Label  <<MODULES>>
                              List  modules
                              Command  Quit
                         TopLevelShell  INFOSETTING
                              Box  box
                                   Label  <<OBJECTS>>
                                   List  infosetting

                    Command  Cancel
                    Command  up
                    Command  down
          TopLevelShell  TRACE FROM STDIN
               Box  tin
                    Command  Next step
                    Toggle  Stepping
                    Command  Quit
          TopLevelShell  PSF
               Text  psf
          TopLevelShell  PROCESS VAR
               Box  box
                    Label  process name
                    Box  lists
                         Box  variables
                              Label  Variables
                              Viewport  view
                                   Core  clip
                                   Scrollbar  horizontal
                                   List  list
                         Box  values
                              Label  Values
                              Viewport  view
                                   Core  clip
                                   Scrollbar  horizontal
                                   List  list
                         Box  history
                              Command  up
                              Command  down
                    Box  buttons
                         Command  Confirm
                         Command  Cancel


     sim  can  only handle a restricted subset of the TIL language (see sec-
     tion Sum and Merge).  There is a preprocessor  simpp(1L)  that  maps  a
     somewhat  larger  subset  of  TIL into the one that sim is able to deal
     with.  simpp(1L) can be invoked indirectly by using the  -s  option  of


     sim.trace   The  option  save  trace  in the special submenu writes the
                 contents of the TRACE-window to this file.

                 Temporary file for the  PSF-code  in  the  PSF-widget.  The
                 XXXXXX  consist  of  a  letter  and the current process ID,
                 which makes the filename unique.


     PSFBINDIR      Directory in  which  the  TIL-code  to  source  language

4th Berkeley Distribution July 18, 1995 SIM(1L)