
(* MAS Lisp Utility Definition Module. *)
DEFINITION MODULE MASLISPU;

(* Import lists and declarations. *)

  FROM MASSTOR IMPORT LIST;

  FROM Portab IMPORT STRING;

  CONST  EXPR = 1;

(* Types, S-Expresion Types and Indicators. *)

  TYPE
    PROCF0 = PROCEDURE(): LIST;
    PROCF1 = PROCEDURE(LIST): LIST;
    PROCF2 = PROCEDURE(LIST, LIST): LIST;
    PROCF3 = PROCEDURE(LIST, LIST, LIST): LIST;
    PROCF4 = PROCEDURE(LIST, LIST, LIST, LIST): LIST;

    PROCP0 = PROCEDURE();
    PROCP1 = PROCEDURE(LIST);
    PROCP2 = PROCEDURE(LIST, LIST);
    PROCP3 = PROCEDURE(LIST, LIST, LIST);

    PROCP0V1 = PROCEDURE(VAR LIST);
    PROCP0V2 = PROCEDURE(VAR LIST, VAR LIST);

    PROCP1V1 = PROCEDURE(LIST, VAR LIST);
    PROCP1V2 = PROCEDURE(LIST, VAR LIST, VAR LIST);
    PROCP1V3 = PROCEDURE(LIST, VAR LIST, VAR LIST, VAR LIST);

    PROCP2V1 = PROCEDURE(LIST, LIST, VAR LIST);
    PROCP2V2 = PROCEDURE(LIST, LIST, VAR LIST, VAR LIST);
    PROCP2V3 = PROCEDURE(LIST, LIST, VAR LIST, VAR LIST, VAR LIST);

    PROCP3V1 = PROCEDURE(LIST, LIST, LIST, VAR LIST);
    PROCP3V2 = PROCEDURE(LIST, LIST, LIST, VAR LIST, VAR LIST);
    PROCP3V3 = PROCEDURE(LIST, LIST, LIST, VAR LIST, VAR LIST, VAR LIST);


  VAR EXTYP, ARITY, SUBR : LIST;   (*indicators*)


(* Procedure declarations. *)

PROCEDURE CallCompiled(F, PI : LIST; VAR PO : LIST; VAR fu : BOOLEAN);
(*Call compiled function or procedure. F is a function or procedure 
symbol. PI is the list of input parameters. fu is TRUE if F is a 
function and FALSE if F is a procedure. PO is a list of output 
parameters if F is a procedure and PO is the output parameter if 
F is a function. *)


PROCEDURE Compiledp0(F : PROCP0; S : STRING);
(*Compiled function declaration. F is a Modula-2 procedure, S is 
the print name of F. *)


PROCEDURE Compiledp1(F : PROCP1; S : STRING);
(*Compiled function declaration. F is a Modula-2 procedure, S is 
the print name of F. *)


PROCEDURE Compiledp2(F : PROCP2; S : STRING);
(*Compiled function declaration. F is a Modula-2 procedure, S is 
the print name of F. *)


PROCEDURE Compiledp3(F : PROCP3; S : STRING);
(*Compiled function declaration. F is a Modula-2 procedure, S is 
the print name of F. *)


PROCEDURE Compiledf0(F : PROCF0; S : STRING);
(*Compiled function declaration. F is a Modula-2 procedure, S is 
the print name of F. *)


PROCEDURE Compiledf1(F : PROCF1; S : STRING);
(*Compiled function declaration. F is a Modula-2 procedure, S is 
the print name of F. *)


PROCEDURE Compiledf2(F : PROCF2; S : STRING);
(*Compiled function declaration. F is a Modula-2 procedure, S is 
the print name of F. *)


PROCEDURE Compiledf3(F : PROCF3; S : STRING);
(*Compiled function declaration. F is a Modula-2 procedure, S is 
the print name of F. *)


PROCEDURE Compiledf4(F : PROCF4; S : STRING);
(*Compiled function declaration. F is a Modula-2 procedure, S is 
the print name of F. *)


PROCEDURE Compiledp1v2(F : PROCP1V2; S : STRING);
(*Compiled function declaration. F is a Modula-2 procedure, S is 
the print name of F. *)


PROCEDURE Compiledp1v3(F : PROCP1V3; S : STRING);
(*Compiled function declaration. F is a Modula-2 procedure, S is 
the print name of F. *)


PROCEDURE Compiledp2v2(F : PROCP2V2; S : STRING);
(*Compiled function declaration. F is a Modula-2 procedure, S is 
the print name of F. *)


PROCEDURE Compiledp2v3(F : PROCP2V3; S : STRING);
(*Compiled function declaration. F is a Modula-2 procedure, S is 
the print name of F. *)


PROCEDURE Compiledp3v2(F : PROCP3V2; S : STRING);
(*Compiled function declaration. F is a Modula-2 procedure, S is 
the print name of F. *)


PROCEDURE Compiledp3v3(F : PROCP3V3; S : STRING);
(*Compiled function declaration. F is a Modula-2 procedure, S is 
the print name of F. *)


PROCEDURE CompSummary();
(*Compiled function and procedure summary. Write out all 
compiled functions with their signature from symbol table SYMTB. *)


PROCEDURE Declare(VAR X : LIST; S : STRING);
(*Declare. X is declared as symbol with print name S. *)


PROCEDURE PROCP(X : LIST): BOOLEAN;
(*Procedure Pointer. Test if the symbol X is a compiled function. *)


PROCEDURE Signature(F : LIST; VAR PI, PO : LIST; VAR def : BOOLEAN);
(*Signature of a compiled function or procedure. F is a function or 
procedure symbol. PI is the number of input parameters. def is TRUE if 
F is defined as compiled function or procedure else def is FALSE. 
PO is the number of output parameters if F is a procedure, 
PO = -1 if F is a function. *)


END MASLISPU.
