Bruce writes:
> The difference in calling sequences caused a compatibility problem in one
> intrinsic, but I don't recall which it was. Stan probably does.
CREATE. One 16-bit value parameter (STACK) had 2**16 + 1 possible values ... if you
omitted it, it meant "get the value from the program file". If you included it,
that was the stack size you wanted.
Sample:
procedure foo (a : integer;
b : integer;
var c : integer;
d : integer;
e : integer)
Pascal/iX supports:
extensible ... a hidden parameter in R26 tells the "ordinal number" (1-based)
of the right-most actual parameter.
procedure foo (...as above...)
option extensible 2;
This says "parameters 1 and 2 *MUST* be passed in". After that,
you can truncate the parameter list anywhere you want.
A call like: foo (x, y, z, w);
would pass 4 in R26. The "haveextension" keyword in Pascal can
be used to see if a particular parameter was passed in for
a particular call.
default value ... you can specify that selected parameters have specified
default values. Note that the substitution of the default
value is done by the compiler at compilation of the *call*,
so the procedure itself cannot detect that this was done.
procedure foo (...as above...)
option default_parms (
b := 23,
c := nil);
foo (x, , , w) --> foo (x, b, NIL-sort-of, w);
you can't directly pass NIL to a reference parameter yourself,
but you could do: var ptr : ^integer;
ptr := nil;
foo (x, b, ptr^, w);
and, you can combine them:
procedure foo (...as above...)
option extensible 2
default_parms (
b := 23,
c := nil);
foo (x, y) --> foo (x, y) and R26 has 2
foo (x, y, ) --> foo (x, y, NIL-sort-of) and R26 has 3
foo (x, , , w) --> foo (x, 23, NIL-sort-of, w) and R26 has 4
foo (x); --> SYNTAX ERROR (you *said* you always want to pass
at least the first 2 parameters!)
(that second example is unexpected, eh?!)
The SYSINTR file contains examples of "extensibe" and "option default" intrinsics.
And if that's not complicated enough, it turns out that Pascal/iX *does* support
the old "parameter mask" concept ... but I don't think you can create an intrinsic
file with such a procedure entry. (Thanks to an unfortunate decision, the intrinsic
file isn't supposed to contain entries that might not be trivially mappable in COBOL.)
If you declare an external procedure in Pascal as "external spl variable;"
then a parameter mask is passed in R26. (No, you can't combine "extensible"
and "external spl variable;")
Why would you want to do that? Beats me! The feature came as a surprise, and
caused us extra work in the SPLash! compiler. My guess is that it's there to support
calls from Pascal/iX to PSPL or SPLII/iX (internal NM compilers that are vaguely
SPLash-like).
--
Stan Sieler [log in to unmask]
http://www.allegro.com/sieler.html
|