home *** CD-ROM | disk | FTP | other *** search
- TPTC - Turbo Pascal to C translator, version 1.7, 25-Mar-88
- by Samuel H. Smith.
-
- This program will read a Turbo Pascal source file and convert it into
- the corresponding C source code. It does much of the work required in
- a full translation.
-
- TPTC is Copywrited Shareware, delivered in three archives:
-
- TPTC17.ARC - 03-26-88 - Translate Turbo Pascal to C. Exe+DOC files.
- This is the main distribution archive. It contains the translator,
- documentation and a few supporting files. See HISTORY.DOC for the
- revision history, including changes since the manual was last updated.
- See TODO.DOC for a list of changes that are planned in the near future.
-
- TPTC17SC.ARC - 03-26-88 - Full Source Code for TPTC. SourceWare.
- This is the complete source code for TPTC. This is distributed
- under the SourceWare concept. See the file LICENSE.DOC for details.
-
- TPTC17TC.ARC - 03-26-88 - A number of Test Cases for TPTC. This archive
- contains a number of "test cases" used to verify the operation of TPTC.
- New test cases are added as the translator development proceeds.
-
- Contents of the archives follow
-
- =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
-
- Archive: TPTC17.ARC
-
- Name Length Stowage SF Size now Date Time CRC
- ============ ======== ======== ==== ======== ========= ====== ====
- ERRORS.DOC 4200 Crunched 46% 2252 26 Mar 88 14:59 E97E
- HISTORY.DOC 9788 Crunched 50% 4824 26 Mar 88 13:01 FBA4
- LICENSE.DOC 1992 Crunched 41% 1174 14 Feb 88 19:48 3F30
- README 4062 Crunched 46% 2192 26 Mar 88 12:38 FB42
- T2C.BAT 493 Crunched 22% 382 26 Mar 88 05:34 6D5F
- TODO.DOC 690 Crunched 32% 469 25 Mar 88 20:24 2419
- TPTC.DOC 11448 Crunched 52% 5481 25 Mar 88 18:11 FB8A
- TPTC.EXE 61920 Crunched 34% 40828 26 Mar 88 19:12 701A
- TPTCMAC.H 5593 Crunched 50% 2796 26 Mar 88 05:47 1AF5
- TPTCSYS.PAS 4629 Crunched 50% 2309 26 Mar 88 05:47 B804
- TPTCSYS.UNS 1462 Crunched 47% 772 26 Mar 88 15:14 E12A
- UNINC.EXE 4896 Crunched 22% 3790 26 Mar 88 12:10 5901
- >*total 12 111173 39% 67269
-
- Archive: TPTC17SC.ARC
-
- Name Length Stowage SF Size now Date Time CRC
- ============ ======== ======== ==== ======== ========= ====== ====
- ATOI.INC 928 Crunched 41% 542 25 Mar 88 17:02 B530
- COMPALL.BAT 50 ----- 1% 50 24 Mar 88 19:57 4EE0
- COMPOLD.BAT 34 ----- 1% 34 15 Mar 88 19:02 79CB
- DOALL.BAT 282 Crunched 18% 231 26 Mar 88 15:16 C15D
- DOSTD.BAT 332 Crunched 28% 239 26 Mar 88 05:35 9BD1
- FTOA.INC 189 Crunched 17% 156 25 Mar 88 17:02 0DC0
- GETENV.INC 767 Crunched 38% 473 25 Mar 88 17:02 5516
- GO.BAT 21 ----- 2% 21 08 Aug 87 20:32 28B3
- HISTORY.DOC 9788 Crunched 50% 4824 26 Mar 88 13:01 FBA4
- ITOA.INC 306 Crunched 34% 201 25 Mar 88 17:02 7AC3
- KEYPRESS.INC 502 Crunched 49% 256 25 Mar 88 17:02 A410
- LICENSE.DOC 1992 Crunched 41% 1174 14 Feb 88 19:48 3F30
- LJUST.INC 219 Crunched 22% 170 25 Mar 88 17:02 0EB9
- LOOK.BAT 34 ----- 1% 34 12 Mar 88 12:46 9DA4
- MAKE.BAT 12 ----- 4% 12 17 Mar 88 18:04 F515
- README 4062 Crunched 46% 2192 26 Mar 88 12:38 FB42
- STOUPPER.INC 1043 Crunched 56% 451 25 Mar 88 17:02 D28C
- T2C.BAT 493 Crunched 22% 382 26 Mar 88 05:34 6D5F
- TPCDECL.INC 17316 Crunched 65% 5928 26 Mar 88 19:08 FEEC
- TPCEXPR.INC 18210 Crunched 63% 6596 26 Mar 88 05:48 F25F
- TPCMISC.INC 4471 Crunched 59% 1820 26 Mar 88 15:13 4075
- TPCSCAN.INC 19588 Crunched 65% 6702 26 Mar 88 12:32 90E3
- TPCSTMT.INC 23751 Crunched 65% 8134 25 Mar 88 20:36 2EA0
- TPCSYM.INC 7348 Crunched 60% 2871 26 Mar 88 15:12 5E75
- TPCUNIT.INC 12703 Crunched 60% 4964 26 Mar 88 14:44 6CB8
- TPTC.PAS 17770 Crunched 56% 7657 26 Mar 88 12:23 45D9
- TPTCMAC.H 5593 Crunched 50% 2796 26 Mar 88 05:47 1AF5
- TPTCSYS.PAS 4629 Crunched 50% 2309 26 Mar 88 05:47 B804
- UNINC.PAS 4867 Crunched 51% 2352 26 Mar 88 12:10 AF21
- UPD.BAT 155 Crunched 21% 122 26 Mar 88 08:18 BA34
- >*total 30 157455 59% 63693
-
- Archive: TPTC17TC.ARC
-
- Name Length Stowage SF Size now Date Time CRC
- ============ ======== ======== ==== ======== ========= ====== ====
- ACKER.PAS 369 Crunched 32% 249 25 Mar 88 17:02 0D99
- COMPALL.BAT 50 ----- 1% 50 24 Mar 88 19:57 4EE0
- COMPOLD.BAT 34 ----- 1% 34 15 Mar 88 19:02 79CB
- DIA.PAS 4743 Crunched 51% 2306 25 Mar 88 17:02 5BA6
- DIAL.PAS 1465 Crunched 42% 847 25 Mar 88 17:02 8D78
- DOALL.BAT 282 Crunched 18% 231 26 Mar 88 15:16 C15D
- FINDCHRS.PAS 1134 Crunched 46% 603 25 Mar 88 17:02 349B
- FMAP.PAS 5425 Crunched 56% 2387 25 Mar 88 17:02 FAC9
- LINKLIST.PAS 1845 Crunched 54% 847 25 Mar 88 17:02 4D72
- LOOK.BAT 34 ----- 1% 34 12 Mar 88 12:46 9DA4
- MINICRT.PAS 7092 Crunched 60% 2768 25 Mar 88 17:02 9229
- MTPLUS.PAS 1358 Crunched 39% 826 25 Mar 88 17:02 BC1E
- POINT4.PAS 561 Crunched 41% 326 25 Mar 88 17:02 DE9D
- POINTERS.PAS 478 Crunched 32% 321 25 Mar 88 17:02 D65B
- PUZZLE.PAS 4795 Crunched 60% 1875 25 Mar 88 17:02 9841
- QSORT.PAS 2240 Crunched 61% 852 25 Mar 88 17:02 1ABA
- README 4062 Crunched 46% 2192 26 Mar 88 12:38 FB42
- SETS.PAS 2116 Crunched 53% 986 25 Mar 88 17:02 C94E
- SIEVE.PAS 793 Crunched 47% 416 25 Mar 88 17:02 FCFA
- SMALLREC.PAS 868 Crunched 38% 533 25 Mar 88 17:02 5A5E
- SUBRANGE.PAS 1010 Crunched 41% 596 25 Mar 88 17:02 7130
- TEST.PAS 4998 Crunched 50% 2457 25 Mar 88 17:02 CC17
- TEST2.PAS 1641 Crunched 59% 664 25 Mar 88 17:02 2AC5
- TIMEDAT4.PAS 418 Crunched 26% 307 25 Mar 88 17:02 7373
- UNSQ.PAS 23602 Crunched 55% 10456 25 Mar 88 17:02 D16F
- VARREC.PAS 2075 Crunched 45% 1133 25 Mar 88 17:02 8F97
- >*total 26 73488 53% 34296
-
- Revision history of TPTC
- ------------------------
-
- 09/09/85 v0.0 (paspp)
- Initial coding by Samuel H. Smith. Never released.
-
- 12/19/86 v1.0
- First distributed as TPC10 under shareware concept.
-
- 04/15/87 v1.1
- Corrected handling of unary minus. Improved error messages; added
- error messages to object file. Added handler for integer subrange
- types. Added handling for goto statement and numeric labels. The
- macro header, tpcmac.h, now contains more declarations. Distributed
- as TPC11.
-
- 04/22/87 v1.2
- Corrected an error that led to a crash on lines with more than 40
- leading spaces. Distributed as TPC12.
-
- 05/20/87 v1.3
- Added support for pascal/MT+: external procedures and variables,
- special write/read indirect syntax, & and ! operators, default string
- size for string declarations. Distributed as TPC13.
-
- 05/26/87 v1.4
- Additional support for pascal/MT+. The translator "shifts" into a
- MT+ specific mode when it recognizes the 'MODULE' statement. The '|'
- operator is recognized for bitwise OR. The '\', '?' and '~' operators
- are all translated into a unary not. Read(ln) and Write(ln) now
- support the special case of "[]" for the I/O routine. Long integer
- literals are translated from '#nnn' to 'nnnL'
-
- 06/01/87 v1.5
- Added new command-line parser. Added -lower option to map identifiers
- to lower case. Added -mt option to force pascal/mt+ mode. Added
- partial var-parameter translation. Mem, MemW, Port and PortW are all
- translated into Turbo C. Turbo-c procedure declaration syntax is now
- used. Arrays may now be subscripted by enumeration types. Null else
- clause now handled properly in IF and CASE statements. For .. downto
- is now translated correctly. The VAL..VAL form is now translated in
- case statements.
-
- ---------------
- -- detect concat(concat... and replace with a sprintf variant
- -- changed sprintf calls to sbld calls to preserve sources during build
- -- pos(c,str) and pos(str,str) are now separately translated
- -- added 'base' to symbol table; use to add base-subscript offset
- in all subscript references.
- -- moved typename translations to tpcmac.h header
- -- fixed bug in non-translation of tshell directives
- -- forward pointer declarations
- -- translate inline into asm statements
- -- complete forward translation
-
- 10/13/87
- -- improved string and array parameter translations
- -- string returns are now translated into char *
-
- 10/15/87
- -- corrected error in typed constant translation where nested records
- are initialized.
- -- variant record declarations are translated into unions but no variant
- expression translations are done.
- -- changed nested procedure error messages to include procedure name.
-
- ---------------
- 02/13/88 v1.6
- Converted to TPAS 4.0 format; released under the SourceWare concept
- (see README and LICENSE.DOC).
-
- ---------------
- 03/10/88 v1.6a
- -- corrected recent errors in #include translation and -include processing.
- -- changes in status display and error message formats.
- -- translation of multi-dimensional and nested array declarations.
- -- translation of untyped var parameters.
- -- partial translation of absolute variable declarations.
- -- improved data type declaration in expressions with subscripts.
-
- 03/11/88
- -- new method of expression type tracking; type botching is greatly
- reduced while speeding execution.
- -- rewrote include file handler to allow nested includes.
-
- 03/12/88
- -- implemented proper procedure ordering for nested procedures (inmost
- procedures are output first, followed by outer procedures).
- -- shortened command-line options to single letters.
- -- added -W option to allow specification of a RAMDISK for work files.
-
- 03/13/88
- -- added translation of :(expression) parameters in write statements.
- -- corrected translation of 'actual' VAR and untyped parameters.
- -- improved type detection in record member references.
- -- created 'uninc' postprocessor to split up output into original
- include files (placed in a user specified destination directory).
- -- added 't2c.bat' batch file to combine translation and include processing.
- -- added code to ignore tp4.0 interface sections.
-
- 03/14/88
- -- improved indentation in generated code for variant record decls (remember,
- tptc is NOT a pretty printer! use CB or INDENT to get pretty indentation).
-
- 03/15/88
- -- added boolean as a basic type; this allows automatic selection of &, |
- and &&, || in expressions.
- -- implemented translation for 'str' standard procedure.
- -- partial translation of 'val' procedure.
- -- better implementation of subscript base value translation.
- -- better type tracking in subscripted variables.
-
- 03/16/88
- -- added macros for paramcount and paramstr instead of specific translations.
- -- corrected implementation of mt+ translation for write([proc],...) form.
- -- added unique prefix on local #define's to prevent name clashes.
- -- added specific translations for \r, \n, \b, \e character constants.
- -- added translation for intr() and msdos() calls.
- -- implemented constant folding in trivial cases where index bases are added.
- -- added translation of @(...) operator.
-
- 03/17/88
- -- corrected translation of pointers to simple types.
- -- improved translation of character and numeric subrange types.
- -- partial translation of set expressions.
- -- corrected enumeration-type subscript range calculation.
- -- added -Tnn command option to control tabstops in declarations.
- -- changes in symbol table and parser for 20% faster operation.
-
- 03/18/88
- -- disable '#...' translation (tshell passing) without -# option.
- -- exit all nested procs in fatal error handler.
- -- added symbol table entries for 'builtin' procedure translations (allows
- user redefinition of 'pos', for example).
- -- predefined symbol table entries are reported only if -DP option is used.
- -- partial translation of 'with' statements.
-
- 03/19/88
- -- slight improvement in recovery from syntax errors.
- -- corrected parsing of initialized set constants.
-
- 03/21/88
- -- added -B option for deBug trace while scanning source file.
- -- changed numeric character literals from octal to hex.
- -- added warning if pascal string length byte is used in expressions.
- -- implemented translation of ^c^c (multiple control character literals).
- -- eliminated recursion in scanning consecutive comments.
- -- added specific translations for \a, \f, \t, \v character literals.
- -- corrected translation of ^., ^[, and #$hex character literals.
- -- added ".pas" default on include filenames.
- -- corrected translation of "external 'file.ext'..." procedure option.
-
- 03/22/88
- -- corrected parsing error that could cause lockup at end of translation.
- -- added translation from chr(lit) to character literals where possible.
- -- allowed redefinition of 'exit' procedure.
- -- corrected empty case statement and empty then-before-else translation.
- -- corrected &* possibility in fscanv.
- -- improved output format in inline translation.
- -- added -BP option for deBug trace of statement Parsing.
- -- implemented proper local symbol tables in nested functions.
-
- 03/23/88
- -- corrected translation of :(expr) in write when expr starts with a digit.
- -- added runtime check for too many procedure parameters.
- -- better handling of nested with statements.
- -- partial translation of with dependant expressions.
- -- changed constant declarations from #define to 'const' to allow full
- scoping rules. (this doesn't work with tc1.0!)
-
- 03/24/88
- -- partial translation of expressions accessing variant record members.
- -- better handling of forward redeclarations that are incomplete.
- -- implemented translation of TP4 units
- -- 'interface' section creates .UNS file with TPTC symbol table
- information saved for later use.
- -- 'interface' section creates .UNH header file for inclusion
- in C sources using the unit
- -- 'uses' section generates include of .UNH header and loads
- the .UNS data into the current symbol table
- you must translate SYSTEM.DOC, DOS.DOC, etc, before units USING these
- can be translated.
- -- implemented translations for $DEFINE, $IFDEF, $IFNDEF, $ELSE and $ENDIF.
- -- moved standard symbol table entries to the special unit TPTCSYS.PAS,
- which is implicitly "used" in each translation. TPTCSYS.UNS must be
- in the default directory when TPTC is called. this eliminates the need
- for special translations for val, intr, msdos and many other standard
- procedures with VAR parameters.
- -- implemented translation of 'inline' procedures (tp4).
-
- ---------------
- 03/25/88 v1.7
- -- repackaged into three archives: tptc17 (main file; translator, docs and
- supporting files), tptc17sc (source code), tptc17tc (test cases).
- -- cosmetic changes in code generation for interface sections.
- -- implemented 'as new_name' clause for specification of a different
- procedure/function name in the translated code (see tptcsys.pas).
- -- inline procedures in an interface section generate a warning since
- they cannot be translated in this context.
- -- added -Sdir option to specify a search directory for .UNS symbol files
- that are not in the default directory.
- -- default command-line options can be specified through the TPTC
- environment variable from dos.
-
- 03/26/88
- -- changes in $i parsing (fixed case where '$i fxxx' parsed as '$ifdef xxx')
- -- changed untyped constants back to #defines despite the scoping problems
- (sure wish borland had fully implemented 'const' declarations).
- -- corrected translation of 'type mine = ^simple' where simple is already
- defined (tptc was doing a forward-type translation sometimes).