INSTALL
上传用户:upcnvip
上传日期:2007-01-06
资源大小:474k
文件大小:6k
源码类别:

编译器/解释器

开发平台:

C/C++

  1. This directory contains "p2c" version 1.14, a Pascal to C translator.
  2. "p2c"  Copyright 1989  Dave Gillespie
  3.                        256-80 Caltech
  4.                        Pasadena CA 91125
  5.                        daveg@csvax.caltech.edu, cit-vax!daveg
  6. This program is distributed under the terms of the GNU License Agreement.
  7. See the file src/COPYING for details.
  8. The GNU License Agreement restrictions do _not_ apply to code generated
  9. by p2c, nor to the p2c run-time files "p2clib.c" and "p2c.h".
  10. QUICK INSTRUCTIONS
  11. The top-level Makefile in this directory tree knows how to build
  12. p2c and run it on some example programs.  The compiled p2c will be
  13. "installed" in this directory tree rather than in public directories.
  14. (For a full public installation, see the instructions below.)
  15. Just type "make test" to build p2c and run the examples.
  16. FULL INSTALLATION INSTRUCTIONS
  17. For a complete system, you must:
  18.    a) Create a home directory for p2c, such as /usr/lib/p2c.  The exact
  19.       location does not matter, as long as p2c knows how to find it.
  20.    b) Create an include directory, such as /usr/include/p2c.  If you are
  21.       unable to arrange for an include directory, you can edit sys.p2crc
  22.       so as not to require one, or compile translated code with a
  23.       suitable -I flag.
  24.    c) Install the executable "p2c" in /usr/bin or elsewhere on the
  25.       standard search path.
  26.    d) Install the run-time library "libp2c.a" in /usr/lib or elsewhere
  27.       on the standard library search path.
  28.    e) Install the Unix manual entry "p2c.1" in /usr/man/man1.  If you
  29.       have a "man1.Z" directory instead (for compressed man pages)
  30.       you will have to edit the Makefile to use a "compress" command.
  31.    f) Install the necessary files in the p2c home directory.
  32. The Makefile is initially set up to create a private version of p2c in
  33. the p2c distribution directory.  Just "cd src" and "make install" to
  34. perform the above steps.  This will place the p2c executable, run-time
  35. library, include directory, and man page in the "home" subdirectory of
  36. the distribution directory.  The man page will be in human-readable form.
  37. To compile code that has been translated by this private version of p2c,
  38. use the command:
  39.     cc -I. foo.c libp2c.a
  40. (assuming "home," i.e., HOMEDIR, is the current directory.)
  41. The "examples" subdirectory contains a few sample Pascal programs and
  42. a Makefile to translate and compile them.
  43. To install p2c for public use, edit the Makefile to indicate the correct
  44. directory names.  Suggested names are included as comments.  Also change
  45. MANFILE as shown to store the man page in the proper form for the "man"
  46. command.
  47.     HOMEDIR      default /usr/lib/p2c       Home directory
  48.     INCDIR       default /usr/include/p2c   Include directory
  49.     BINDIR       default /usr/bin           Directory for "p2c" executable
  50.     LIBDIR       default /usr/lib           Directory for "libp2c.a" library
  51.     MANDIR       default /usr/man/man1      Directory for "p2c.1" manual page
  52. Make sure the home and include directories have been created and are
  53. writable, and that the bin, lib, and man directories are writable.
  54. (You may have to be root to do this.)  Recompile "p2c" with another
  55. "make install".  Be sure "trans.c" is recompiled with the new value
  56. of HOMEDIR; you can ensure this by doing "make newhome" before
  57. "make install".  You can always type "make" with no arguments to
  58. compile without installing.
  59. HP Pascal Workstation System users will want to copy all of ../HP/include
  60. into the new p2c include directory, and copy all of ../HP/import into
  61. the p2c home directory.  You will have to write emulations for the
  62. functions you use out of these modules.  (The HP directories are
  63. present in the ftp distribution only---they have been omitted from
  64. the shar'd version to save space.)
  65. Incomplete interface texts for standard Turbo units are included in
  66. turbo.imp.  Turbo users will have to flesh these out and write emulations
  67. for whatever parts of the Turbo runtime library they need.
  68. If you wish to edit various system-wide configuration parameters, it is
  69. better to put them in loc.p2crc than in sys.p2crc.  As an example, on a
  70. Turbo-oriented environment you may wish to add
  71.     Language Turbo
  72. to the loc.p2crc file to replace the normal default (HP Pascal).
  73. PORTABILITY
  74. P2c was originally developed on a homebrew C compiler on the HP Pascal
  75. Workstation operating system.  Current development takes place on HP-UX,
  76. which is System V based.  The translator has also been compiled and used
  77. on Sun-3's, so presumably it is fairly portable among 32-bit Unix machines.
  78. Many parts of the code will have to be adjusted in order for p2c to work
  79. on a machine with 16-bit ints.  I have never had reason or opportunity to
  80. track these down since I don't have access to such a machine.  Please note
  81. that code _generated_ by p2c works with either size of int even though p2c
  82. itself does not.
  83. If your compiler supports ANSI prototypes, most of the 16-bit portability
  84. problems will go away except for possible %d/%ld sloppiness in sprintf control
  85. strings.  There may be places where p2c tries to cast a pointer into an
  86. int, but I believe all such cases use longs consistently.  You will have
  87. a problem if your long type is not large enough to store a pointer.
  88. Because p2c was developed to run under Unix, it is sloppy about memory
  89. allocation.  Some data structures are allocated but never freed.  Profiles
  90. show that the waste is not too great in most cases, but if it is a problem
  91. you may have to write a garbage collector (this shouldn't be too hard if you
  92. only run the collector after translating each procedure).