clong@remus.rutgers.edu (Chris Long) (09/06/90)
I've heard rumors of such a critter, but is one actually available for the IBM pc? -Chris
raymond@oreo.berkeley.edu (Raymond Chen) (09/07/90)
Instructions on using my email index server can be obtained by sending the message "help" to rjc@math.princeton.edu. This is the same server that is mentioned in the Frequently Asked Questions file for this newsgroup. I just sent the server the command lookup /pascal/i && /\bC\b/ && (/convert/i || /translat/i) and received the following: Programs on wsmr-SIMTEL20.army.mil as of 90-09-03 matching your search criterion: Directory PD1:<MSDOS.C> CTOPAS.ARC B 7522 891206 Converts 'C' source to Pascal source (simple) T2C.ARC B 152264 880119 Microsoft's Turbo Pascal to C translator Directory PD1:<MSDOS.TURBOPAS> TPTC17.ARC B 67619 880829 Turbo Pascal to C translator, 1of4 TPTC17SC.ARC B 64565 880829 Turbo Pascal to C - src for translator, 2of4 TPTCINFO.ARC B 8454 880829 Info on Turbo Pascal to C translator, 4of4 Programs on grape.ecs.clarkson.edu as of 90-04-23 matching your search criterion: Directory /F/UPLOADS CTOPAS.ZIP C to Pascal converter T2C.ZIP Pascal to C translator Programs on chyde.uwasa.fi as of 90-04-24 matching your search criterion: Directory /pc/programming tptc17sc.lzh Turbo Pascal to C translator (source) Directory /pc/source p2c.lzh Pascal to C translator Programs on FidoNet node 2:515/1 (Micro Maniacs Opus) as of 90-04-24 matching your search criterion: Directory LANGS -- Language related files. ASM, C, Pas GLOCKEN.ZIP 112240 15-Jan-88 002 Glockenspiel Turbo Pascal to 'C' translator T2C.ZIP 112062 23-Aug-89 003 Turbo Pascal to 'C' translator TPTC17.ZIP 53481 26-Mar-88 004 Translate Turbo Pascal to 'C' V1.7 TPTOQC.ZIP 112062 01-Dec-87 003 Translate Turbo Pascal to Quick 'C' GLOCKEN.ZIP 112240 15-Jan-88 002 Glockenspiel Turbo Pascal to 'C' translator T2C.ZIP 112062 23-Aug-89 003 Turbo Pascal to 'C' translator TPTC17.ZIP 53481 26-Mar-88 004 Translate Turbo Pascal to 'C' V1.7 TPTOQC.ZIP 112062 01-Dec-87 003 Translate Turbo Pascal to Quick 'C' ~ TPTC16.ZIP 62157 10-Dec-89 004 Turbo Pascal to C translator (V1.6) Directory CLIB --'C' language library software (MSC compiler) TPAS2MSC.ZIP 111884 10-Dec-89 002 MS Convert Turbo Pascal to MS C
darrylo@hpnmdla.HP.COM (Darryl Okahata) (09/14/90)
In comp.sys.ibm.pc.misc, clong@remus.rutgers.edu (Chris Long) writes: > I've heard rumors of such a critter, but is one actually available for > the IBM pc? One of *THE* best Pascal-to-C translators -- one that handles Turbo Pascal -- is Dave Gillespie's p2c translator. Unfortunately, it only runs on unix (it's probably much too big for MSD*S), but it does supposedly produce code that can be compiled under MSD*S. You can get a copy via anonymous ftp from csvax.caltech.edu. I've included an excerpt from an old man page at the end of this message. -- Darryl Okahata UUCP: {hplabs!, hpcea!, hpfcla!} hpnmd!darrylo Internet: darrylo%hpnmd@hp-sde.sde.hp.com DISCLAIMER: this message is the author's personal opinion and does not constitute the support, opinion or policy of Hewlett-Packard or of the little green men that have been following him all day. =============================================================================== NAME p2c - Pascal to C translator, version 1.14 SYNOPSIS p2c [ options ] [ file [ module ] ] DESCRIPTION P2c is a tool for translating Pascal programs into C. The input consists of a set of source files in any of the following Pascal dialects: HP Pascal, Turbo/UCSD Pascal, DEC VAX Pascal, Oregon Software Pascal/2, Macintosh Programmer's Workshop Pascal, Sun/Berkeley Pascal. Modula-2 syntax is also supported. Output is a set of .c and .h files that comprise an equivalent program in any of several dialects of C. Output code may be kept machine- and dialect- independent, or it may be targeted to a specific machine and compiler. Most reasonable Pascal programs are converted into fully functional C which will compile and run with no further modifications, although p2c sometimes chooses to generate readable code at the expense of absolute generality. P2c endeavors to insert notes and warning messages into the output code to point out areas which may require human intervention. Output code is arranged to be readable and efficient, and to make use of C idioms wherever possible. The main goal of the translation is to produce C files which are pleasant and "natural" enough to be acceptable as the new source files for a program. In a pinch, p2c will also serve as an ad hoc Pascal compiler. Code generated by p2c normally does not assume characters are signed or unsigned. Also, it assumes int is the same as either short or long but does not depend on which. However, if int is not the same as long it is best to use a modern C compiler which supports prototypes. Generated code does not require an ANSI-compatible compiler (unless ANSI-style code is requested), but it does use various ANSI-standard library routines. All generated code includes the file <p2c/p2c.h> which in turn includes <stdio.h> and various other common resources. Also, many translated programs will need to be linked with the run-time library, typically -lp2c. Given a file name, p2c reads from the specified file and outputs to a file with a .c suffix added or substituted. For example, p2c myfile.pas reads from myfile.pas to produce the file myfile.c. The input file may contain a Pascal main program or a single Pascal module (or "unit" in Turbo and UCSD Pascal nomenclature), or it may just contain a number of procedures and declarations. P2c is designed to work for correct input programs. That is, it will accept partial programs but may occasionally core dump if the input refers to undefined symbols. If the input is a module, the translator will also produce a file module.h containing a translation of the module's interface section. The implementation section may be omitted in which case only the .h file will be interesting. If the program or module has include files, these may cause additional .c files to be generated depending on the value of the ExpandIncludes option (see below). If no file name is given, p2c reads Pascal from the standard input and writes the resulting C to standard output (though a .h file may still be produced). If a file name and module name are given, the file may include several modules (or units). The specified module is translated; any others are skipped. The output files will be named module.c and module.h. P2c never translates more than one module per run. Before starting, p2c reads the file /usr/local/lib/p2c/p2crc for a number of configuration parameters. (The actual path used on your system may vary. The -i option is a handy way to examine this file.) If the P2CRC environment variable is set, it gives the name of a file to read instead of the system file; this file can start with Include %H/p2crc to include the system file. Next, p2c attempts to read the file p2crc in your directory for further configuration. If this file does not exist, p2c looks for .p2crc instead.