[comp.lang.pascal] HELP: Pascal -=> C

eahill@umaxc.weeg.uiowa.edu (Edward Hill) (01/16/90)

Hello,

   I am currently trying to port a program to a NeXT.  This is a very very
   large program and I have the source code written in Pascal.  To make 
   my life a lot easier, I am looking for a program that will translate
   Pascal code to C code ( crude I understand ).  

   But it will be much easier to make a lot of bad C code better than to
   transfer all that pascal code to C code.

   Any help will be greatly appreciated.


						-Ed Hill
				      Computer Aided Instruction Lab
				            University of Iowa

silvert@cs.dal.ca (Bill Silvert) (01/16/90)

In article <449@ns-mx.uiowa.edu> eahill@umaxc.weeg.uiowa.edu (Edward Hill) writes:
>   I am currently trying to port a program to a NeXT.  This is a very very
>   large program and I have the source code written in Pascal.  To make 
>   my life a lot easier, I am looking for a program that will translate
>   Pascal code to C code ( crude I understand ).  

The syntax of C and Pascal are close enough so that by the proper use of
defines one can compile a lot of Pascal code with a C compiler (for
example, #define begin { and #define end }).  I haven't done this, but
when the Atari ST was new a lot of Atari magazines carried C code that
looked for all the world like Pascal, and some of the tricks they used
were really clever, as well as portable.

Of course a similar approach would be to use sed or m4 to translate
keywords -- I think I have seen a sed script for Modula-2 to C, but
don't know if I can still find it.


-- 
Bill Silvert, Habitat Ecology Division.
Bedford Institute of Oceanography, Dartmouth, NS, Canada B2Y 4A2
UUCP: ...!{uunet,watmath}!dalcs!biomel!bill
Internet: bill%biomel@cs.dal.CA		BITNET: bill%biomel%dalcs@dalac

mjw06513@uxa.cso.uiuc.edu (Mary Winters) (01/20/90)

There are a couple Pascal to C translators I am aware of. One is a shareware
product, the latest version of which is called TPTC17 or something similar.
This program translates Turbo Pascal (version 4?) to Turbo C. The other is
a freebie put out by Microsoft which translates Turbo Pascal to Microsoft
Quick C (in an obvious attempt to snatch some of Borland's customer base ;-)
I have not used either, but both are likely to take most of the grunt
work out of your porting chore. Only one potential problem: these programs
run on IBM PC/compatibles, so if you don't have one, you'll need to 
borrow one to do the conversion. Both are probably available on scads of
BBSi, and the Microsoft converter is also available for anonymous ftp from 
SIMTEL20.

Good luck with your porting!