[net.lang.ada] Mixing VAX Ada and Pascal

GORDON@ENGVAX.UUCP (Misty Dragon E.) (03/18/86)

[this is a second submission.  Sorry if you already got it...]

>  We are currently transfering programs from Pascal to Ada.  Some of the Pascal
>programs are moderate size, and extend over several source files.  So, we have
>replaced the source files one by one - being in the VAX environment, one is
>supposed to be able to do things such as that (makes up for using VMS :-).
>
>  However, there seems to be a problem using access types (pointers) and
>discriminant records (variant records).  The access type variables don't 
>point to the proper places.  Has anyone else tried this??  Any suggestions??

I have responded in detail to the originator of this question.  In summary:

* Discriminant records *
Pascal lays out the discriminant where it occurs in the elaboration.
Ada puts the discriminant at the beginning of the record (after any
representation clauses).  

The solution is to use a proper rep. clause in Ada.

* Pointers *

Work just fine.  Both are 32 bit longwords.  Remember to pass them by reference
to Pascal routines (get Pragmas and Pascal declarations right)  Also pay
attention to data type representations.

I do mixed-language programming in Pascal and Ada all the time under VMS.  
I find it much more efficient to write Ada packages that properly interface 
the Pascal routines rather than convert code from Pascal to Ada.  After all,
this approach seems to me to be more in the "Ada spirit".

If anyone is interested in more detail, I will forward (or post) details.
However, everything is very well explained in The VAX ADA Runtime Reference
Manual and the Pascal User's Guide.  

[Incidentally, as an old Pascal user, new to Ada, I would like to plug the
book "Ada For Experienced Programmers" by Habermann and Perry from CMU.  
Published by Addison Wesley.  It lays out a familar Pascal operation and
"how to" in Ada right next to it.]

Gordon Howell                                  (Misty Dragon E.)
engvax!gordon@csvax.caltech.edu