-- JunoToCedar.mesa
-- Last Edited by: Gnelson, December 8, 1983 5:32 pm

DIRECTORY Rope;

JunoToCedar: DEFINITIONS = {
ParameterList: TYPE = LIST OF REF ANY;
Proc: TYPE = PROC ANY RETURNS ANY;
-- This is a type whose set of values is the union of the sets of values of all procedure types in Cedar.
ROPE: TYPE = Rope.ROPE;
ProcIdentifier: TYPE = RECORD [moduleName: ROPE, procName: ROPE];
GetProc: PROC [pi: ProcIdentifier] RETURNS [success: BOOL, proc: Proc];
-- If the current run state includes a module named pi.moduleName which contains a procedure named pi.procName, then GetProc sets success to TRUE and proc to point at that procedure. Otherwise GetProc sets success to FALSE.
Apply: PROC[p: Proc, args: ParameterList] RETURNS [success: BOOL, results: ParameterList];
-- Let n be the number of arguments expected by p, and let t(i) be the type of the ith argument. Let v(i) be the ith element of args. If the length of args is n, and if for each i, v(i)^ conforms to (I'm not sure if this is the right technical term -- I mean "v(i)^ can be assigned to a t(i)") the type t(i), then the effect of Apply is to call p[v(1)^, ..., v(n)^], thereby producing a result record [w(1), ... w(m)] for some m. In this case Apply returns [success:TRUE, results:LIST[r(1), ... r(m)]], where r(i)^ = w(i). If the wrong number of arguments is supplyed or some argument has the wrong type, then Apply returns [FALSE, NIL].
-- Change: if v(i) is NIL or a LIST OF REF, then t(i) is assigned v(i) instead of v(i)^.
}.