converting from Turbo Pascal

Dr. David Curtis dcurtis at crc.ac.uk
Wed Nov 14 23:37:41 AEST 1990


In article <Ib_2=lO00Vo9MpWFU1 at andrew.cmu.edu> sg2s+ at andrew.cmu.edu (Sean Michael Goller) writes:
>
>	Ok, here's the deal. I have this spiffy program written in Turbo Pascal
>with all kinds of gotoxy() and ClrScr() calls in it. I want to convert
>this program to effectively ANSI C. I'm not too worried about the screen
>controls, I can just run it as if it were on a tty.  My question is
>this. How should I go about this? Should I try to convert first to Turbo
>C, then to ANSI C? If so, does anyone know of a good utility that
>converts pascal code to C for the IBM or unix? (I tried running it
>through a unix program called p2c, and it frankly stinks. So, I'm
>looking for something else, preferably shareware or freeware.)
>
>Thanks in advance!
>------------------------------------------------------------------------------
>Sean Goller (Katsuichi)                          Internet:sg2s+ at andrew.cmu.edu
>Carnegie Mellon University                              BITNET:R746SG2S at CMCCVB


I think I have the answer for you . There's a translator to convert Turbo 
Pascal to Quick C written by Glockenspiel. It's in the public domain 
(sponsored by Microsoft to get people to use C, I guess. You have to
write your own copies of the library routines, e.g. to handle sets, but
it's not that hard. (Mail me for mine if you like.) You can get it in
the UK from the Lancaster Public Domain Library. The address is:

uk.ac.lancs.pdsoft

You do cpf (I think you yanks call this ftp) with user=pdsoft,
password=pdsoft.

There is a file called /micros/ibmpc/index, which lists the collection.
What you want is /micros/ibmpc/e211/e211t2c.boo, which contains the
translator + documentation.

The thing works OK. There a some bits that need to be commented out and
then translated by hand (complex IF-THENS, etc.). The only thing it gets
wrong is a DO...USING nested inside another which uses the same type of
pointer - the same pointer is used for outer and inner loops.

I translated 5000+ lines of a genetic analysis program with this and
compiled it on a few different machines. It was much quicker and easier
than using the Pascal compilers on the original code. Good luck with
this, I'd be interested to hear how you fare.

Pascal?                               Just say no.


Dave Curtis

Academic Department of Psychiatry,    Janet:       dc at UK.AC.UCL.SM.PSYCH
Middlesex Hospital,                   Elsewhere:   dc at PSYCH.SM.UCL.AC.UK
Mortimer Street, London W1N 8AA.      EARN/Bitnet: dc%PSYCH.SM.UCL at UKACRL
Tel 081-380 9475 Fax 081-323 1459     Usenet: ...!mcsun!ukc!mrccrc!D.Curtis



More information about the Comp.lang.c mailing list