[comp.lang.c] MicroSoft Turbo Pascal to C Translator

Shekar_Narayanan.SVSantaClara@Xerox.COM (11/29/87)

Don

	I would like a copy of the summary of the replies please.

	Thanks in advance.

	Shekar

nardacph@Hawaii-EMH.arpa (01/29/88)

In article <2226@killer.UUCP>, dons @ killer.uucp (Don Simoneaux) writes:
 
>On the back cover of the Dec 22, 1987 issue of PC Magazine is an ad
>for MicroSoft QuickC with the following quote:
>
>"Call (800)541-1261, Dept. B21 and we'll send you a free information
>packet, including details of how to obtain a TurboPascal to MicroSoft
>QuickC translator program."
>
>I called and they said they will send me the info packet *and* a disk
>with the translator program (not just "details of how to obtain").
 
Based on Don's article, which, by the way was dated 27 Nov 87, I called
Microsoft and was told the same thing.  The disk arrived last week.  It
turns out that it was written by company called Glockenspiel in Dublin,
Ireland.  By the way, the 8 files that make up the package are now
available on Compuserve in DL3 of the MSSYS forum.  Check with the MSSYS
sysop for exact file names.  Microsoft says to feel free to make copies
and pass them around.
 
>                       Does anyone out there know anything about this
>translator?  Is it any good?  It would surely be very handy, as there
>is a lot of good TP code floating around.
 
As a baseline, I wrote a very simple Turbo Pascal program and ran it
through the translator.  Here is the Turbo Pascal source:
------------------------------------------------------------------------
Program Main;
 
Begin
     WriteLn('Hello world!');
End.
------------------------------------------------------------------------
Here is the output of the translator:
------------------------------------------------------------------------
#include        <stdio.h>
#include        <string.h>
#include        <turbo.h>
int T2C_paramcount;
char **T2C_paramstr;
unsigned char huge * T2C_mem_array = 0;
unsigned int huge * T2C_memw_array = 0;
main (argc,argv)
int argc;
char *argv[];
{
T2C_paramcount = argc - 1;
T2C_paramstr = argv;
T2C_setup_delay();
T2CF_write(&T2C_CON,"%s\n",1,"Hello world!");
}
------------------------------------------------------------------------
The resulting C code isn't very pretty, but it compiled and ran correctly
using the MSC 5.0 compiler.  Incidentally, the translator requires that
program be compiled using the large model and linked to a special library
that is supplied as part of the translator package.  The startling thing
to me was that the size of the executable (.exe) file for this program was
70361 bytes!  A comparable program written in "native" C and and compiled
under MSC 5.0 produces an executable file 9309 bytes in length using the
large model and 7075 bytes in length using the small model.  The translator
appears to call in a lot of excess baggage from the library ....
 
I tried the translator on two larger Turbo Pascal programs that I had
handy, and it didn't work on either one.  I must admit that I wasn't
sufficiently motivated to try very hard to make it work ....
 
The prospect of maintaining or modifying the kind of code the translator
produces does not particularly appeal to me.
 
--
    Chuck Taylor
    Navy Regional Data Automation Center
    Box 140
    Pearl Harbor, HI 96860
 
    (808) 471-0819
    nardacph @ hawaii-emh.arpa