\t Procedures Thing

\j The Procedures thing is designed to keep a list of all standard procedures
linked into SMS. For each procedure, it keeps a record of the normal
name, the Extension Thing Name and the Extension ID.

When new procedures are linked in, the Procedures Thing should be called to
make them available to any programming language. The run-time libraries
of programs can interrogate the procedures thing to find individual procedures
or to list all the procedures.

The Procedures Thing is not shareable, so programs should only use it briefly.
The Thing has a vector of eight entry points, any undefined entry points
return the error code ERR.NIMP. To call a vectored routine, JSR to the vector
address.

Procedure names and Extension Thing names should not exceed 16 characters long.

\f      Procedures Vector

        PRC_ADDP $20    Add procedures
        PRC_REMP $26    Remove procedures (not implemented)
        PRC_FIND $2c    Find procedure
        PRC_MKLS $32    Make list of procedures
        PRC_USEP $38    Use procedure
                 $3e    reserved
                 $44    reserved
                 $4a    reserved

\f
|                                                                      |
|  Vector $20            PRC_ADDP     Add procedures                   |
|                                                                      |
|  Call parameters                    Return parameters                | 
|                                                                      | 
|  A0                                 A0    preserved                  |
|  A1    pointer to Procedure Thing   A1    preserved                  |
|  A2    pointer to procedure table   A2    preserved                  |
|                                                                      |
|  Completion codes                                                    |
|                                                                      |
|        0 or ERR.IMEM                                                 |
|                                                                      |

\j The procedure table starts with a long relative pointer to the name of the
extension
Thing in a standard string, and is followed by any number of entries containing
the long word extension ID and the procedure name in a standard string. This
table is terminated by a zero long word.

\f      eg           dc.l    SPP_NAME-*
                     dc.w    'SERU',7,'SER_USE'
                     dc.w    'SERB',8,'SER_BUFF'
                     . . . .
                     . . . .
                     dc.l    0
                     . . . .
                     . . . .
           SPP_NAME  dc.w    11,'SER_PAR_PRT'

\f
|                                                                      |
|  Vector $26            PRC_REMP     Remove procedures                |
|                                                                      |
|  Call parameters                    Return parameters                |
|                                                                      |
|  A0                                 A0    preserved                  |
|  A1    pointer to Procedure Thing   A1    preserved                  |
|  A2    pointer to Thing name        A2    preserved                  |
|                                                                      |
|  Completion codes                                                    |
|                                                                      |
|        0                                                             |
|                                                                      |

\j This vector removes all the Procedures in a particular Thing from the
procedure list. This is done automatically as part of the PRC_ADDP call,
so this does not need to be called before PRC_ADDP.

\f
|                                                                      |
|  Vector $2c            PRC_FIND     Find a procedure                 |
|                                                                      |
|  Call parameters                    Return parameters                |
|                                                                      |
|  D2                                 D2    Extension ID               |
|                                                                      |
|  A0                                 A0    preserved                  |
|  A1    pointer to Procedure Thing   A1    preserved                  |
|  A2    pointer to procedure name    A2    pointer to Thing name      |
|                                                                      |
|  Completion codes                                                    |
|                                                                      |
|        0 or ERR.ITNF                                                 |
|                                                                      |

\j This vector is used to find a particular procedure. If the Thing name needs
to be kept, it should be copied to a safe place. Otherwise it should be
"used" before the Procedures Thing is "freed".

\f
|                                                                      |
|  Vector $32            PRC_LIST     List procedures                  |
|                                                                      |
|  Call parameters                    Return parameters                |
|                                                                      |
|  D0.w  list entry length (>=$30)                                     |
|  D1                                 D1    Number of procedures       |
|                                                                      |
|  A0                                 A0    preserved                  |
|  A1    pointer to Procedure Thing   A1    pointer to list            |
|  A2    pointer to Thing name or 0   A2    preserved                  |
|                                                                      |
|  Completion codes                                                    |
|                                                                      |
|        0 or ERR.IMEM                                                 |
|                                                                      |

\j This vector creates a standard list of procedures in all Things (a2=0) or
in a particular Thing. Each entry of the list contains the following
information:

\f      $00     six bytes zero
\f      $06     procedure name (string padded to 16 characters with spaces)
        $08     two bytes zero
        $1a     Thing name (string padded to 16 characters with spaces)
        $2c     Extension ID (long word)
        $30     zeros to end of entry


\f
|                                                                      |
|  Vector $38            PRC_USEP     Use a procedure                  |
|                                                                      |
|  Call parameters                    Return parameters                |
|                                                                      |
|  D1    Job ID                       D1    Job ID                     |
|  D3    Timeout                      D3    Version number             |
|                                                                      |
|  A0                                 A0    preserved                  |
|  A1    pointer to Procedure Thing   A1    pointer to Thing           |
|  A2    pointer to procedure name    A2    pointer to Thing linkage   |
|                                                                      |
|  Completion codes                                                    |
|                                                                      |
|        0 or ERR.ITNF, ERR.INUS etc.                                  |
|                                                                      |
\j This vector finds and uses a procedure. The Thing name is to be found
in the Thing Linkage, so you can free it again.
