[net.lang.ada] Mixing Ada and Pascal

JMUNGLE@USC-ISIF.ARPA (Jerry Mungle) (03/14/86)

  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??

  ADVthanksANCE !!!!
-------

Stachour@HI-MULTICS.ARPA ("Paul D. Stachour") (03/14/86)

  Jerry, while I don't work on a Vax running VMS at the moment, I do
know from years of experience that there are significant problems in
almost all operating systems in mixing languages, due to the general
defficiency in the definition of the run-time environment of the system.
If you'd like to look at the classical example that mixes languages very
well, look at the Multics Programmer's Reference Manual (Honeywell Order
number AG91).  Given that Multics was designed and built in the late
60's/early 70's, itsn't it interesting that almost no operating systems
built since then have been able to also solve the same problem?
   Yours for better using of software and software engineering,
      Paul Stachour
  P.S.:  I wonder if those designing and building APSE's are making them
adequate to other languages (lisp?)  as well as Ada.  Cheers, ...Paul

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