Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uunet!mcsun!ukc!mrccrc!dcurtis From: dcurtis@crc.ac.uk (Dr. David Curtis) Newsgroups: comp.lang.c Subject: Re: converting from Turbo Pascal Message-ID: <330@tin.crc.ac.uk> Date: 14 Nov 90 12:37:41 GMT References: Reply-To: dcurtis@crc.ac.uk (Dr. David Curtis) Organization: MRC Human Genome Resource Centre Lines: 53 In article sg2s+@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+@andrew.cmu.edu >Carnegie Mellon University BITNET:R746SG2S@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@UK.AC.UCL.SM.PSYCH Middlesex Hospital, Elsewhere: dc@PSYCH.SM.UCL.AC.UK Mortimer Street, London W1N 8AA. EARN/Bitnet: dc%PSYCH.SM.UCL@UKACRL Tel 081-380 9475 Fax 081-323 1459 Usenet: ...!mcsun!ukc!mrccrc!D.Curtis