[comp.sys.mac.programmer] Think Pascal ==> Think C translation??

mbabramowicz@amherst.bitnet (10/27/90)

I used to program in Lightspeed Pascal (2.03) for the Mac, but I recently
switched to programming in Think C 4.0. I am getting ready to update a 
program that I wrote in Pascal, and I would like to translate it to C
to make it run faster.  However, the time that manual translation would
take would not be worth the effort.

So I was wondering: is there a program that will transfer my Pascal programs
into comparable C programs? The resulting C code does not have to be "good",
I can improve it, but it should work.

Or does such a program not exist?

vd09+@andrew.cmu.edu (Vincent M. Del Vecchio) (10/31/90)

This may be overkill for what you want to do, but then again, maybe not.

There is something called p2c, a Pascal to C translator for Unix (though
I think it would probably be fairly portable to other OSes as well),
which may be able to help you.  It generates decent, working C code
given Pascal input in any of several dialects.  I'm not sure how close
any of these is to Mac Pascals, but it should be acceptable.

You can get this from comp.sources.unix, v21, i46+.

Alternatively, I saw a Mac translator at one point, but it only handled
basic control structures, and required a lot of work afterwards.  p2c
generates compilable C code.

You may have problems with case sensitivity of C if you are making
toolbox calls.  I'm not sure how the translator handles such things.

Hope this helps.
+-------------------------------------------------------------------+
| Vincent Del Vecchio     \       #include <stddisclaimer.h>        |
| Box 4834                 \       #include <stdquote.h>            |
| 5125 Margaret Morrison St.\  BITNET: vd09+%andrew@cmuccvma.bitnet |
| Pittsburgh, PA  15213      \  UUCP: harvard!andrew.cmu.edu!vd09   |
| (412) 268-4441              \  Internet: vd09+@andrew.cmu.edu     |
+-------------------------------------------------------------------+

dmitri@bolvn.ph.utexas.edu (Dmitri Linde) (11/05/90)

Try CTools.  You can get if from sumex-aim.stanford.edu.  I think it is in 
/info-mac/lang

   It would do all the job for you, but is is useful.

- Dmitri Linde
dmitri@bolvan.ph.utexas.edu