| Title: | DEC Pascal Notes |
| Notice: | See note 1 for kits. Bug reports to CLT::DEC_PASCAL_BUGS |
| Moderator: | TLE::REAGAN |
| Created: | Sat Jan 25 1986 |
| Last Modified: | Tue Jun 03 1997 |
| Last Successful Update: | Fri Jun 06 1997 |
| Number of topics: | 2675 |
| Total number of notes: | 13409 |
Hello,
customer used the following construction for optional parameter checking.
Porting this application to OpenVMS Alpha will break it.
Is there a simple way to make it work again ?
(customer is talking about 10000 source modules to check/depend on this
construction)
regards,
Rob Boor, Off-Site Services, Utrecht - The Netherlands.
================================================================================
Used program (see note 2098.6)
program foo(output);
procedure ext( [unbound] procedure p1 := %ref 0;
[unbound] procedure p2 := %ref 0 ); external;
[global(ext)]
procedure int( [unbound] procedure p1;
[unbound] procedure p2 );
begin
if iaddress(p1) = 0
then
writeln('P1 is missing')
else
writeln('P1 is present');
if iaddress(p2) = 0
then
writeln('P2 is missing')
else
writeln('P2 is present');
end;
procedure test; begin end;
begin
ext;
ext(test);
ext(,test);
end.
OpenVMS VAX output:
$run try
P1 is missing
P2 is missing
P1 is present
P2 is missing
P1 is missing
P2 is present
OpenVMS Alpha output:
$run try
P1 is present
P2 is present
P1 is present
P2 is present
P1 is present
P2 is present
| T.R | Title | User | Personal Name | Date | Lines |
|---|---|---|---|---|---|
| 2660.1 | TLE::REAGAN | All of this chaos makes perfect sense | Mon Mar 10 1997 14:18 | 55 | |
I was about to make a comment about the person who wrote the code, but
then I checked 2098.6 and saw it was me... I guess the author was
too cleaver for his own good. :-) :-)
To quote from 2098.6,
> There is no way to "omit" a procedure parameter when calling one Pascal
> routine from another.
and
> Here's an example (with magic to emulate calling Pascal from a
> non-Pascal caller).
Well, one incompatable change when moving from VAX to Alpha is using
bound procedure values like the example tries to fake up. There
is a section in the User Manual, Chapter 9 "Migrating from OpenVMS VAX
to OpenVMS Alpha", section 9.5 "Bound Procedure Values".
As long as you don't trick the compiler, moving from VAX to Alpha was
transparent in this area. Programs such as this (or trying to use
Pascal and C with routine parameters) can unfortunately see the
difference. We never added any feature for "present but 0" like
was discussed back in 2098 since that was the only time somebody raised
the issue.
I can see two choices,
1) Use "%IMMED 0" on OpeVMS Alpha and use "%REF 0" on OpenVMS VAX.
That would mean you only have to visit the declarations and not
the call sites or the routine bodies. Since we don't have a
preprocessor on OpenVMS, you'll have to use some trick to get one set
of declarations for Alpha and other for VAX. Either 2 sets of modules
or perhaps do a %INCLUDE 'SOMELOGICALNAME' for the routine default
value and define the SOMELOGICALNAME to point to a file containing
"%IMMED 0" or one containing "%REF 0" before you do the compilation.
2) You can leave the %REF 0 alone, but go to the routine bodies and
change the test for present from the simple "iaddress(p1) = 0" to
type pint = ^integer_address;
var p1addr,p2addr : integer_address;
p1addr := iaddress(p1);
if p1addr::pint^ = 0 then { routine is absent }
This scheme doesn't require you change the definitions or the callers,
just the code in the called routine.
You can even add some code that checks the machine architecture and
"does the right thing" so the code would be compatible between OpenVMS
VAX and OpenVMS Alpha.
-John
| |||||
| 2660.2 | AUSS::GARSON | DECcharity Program Office | Mon Mar 10 1997 17:10 | 10 | |
re .*
Or of course with 10000 source modules involved, maybe the customer is
willing to wave some cash at Digital for an enhancement to the
compiler.
If the 10000 source modules are all callers with a limited number of
called routines then you might be able to introduce a platform specific
jacket for each called routine that converts the call into something that
can more reasonably be handled.
| |||||
| 2660.3 | Thanks | UTRTSC::BOOR | Tue Mar 11 1997 02:14 | 0 | |