--- p2c-1.21alpha2.orig/debian/README.Debian +++ p2c-1.21alpha2/debian/README.Debian @@ -0,0 +1,54 @@ +p2c for Debian +-------------- + +You should be aware that p2c is not perfect in converting Pascal sources +to C, and it won't make the best C code. + +Also if you notice that your translated C program won't compile because +of an undefined reference to PASCAL_MAIN function, just comment that line +from the C file and it should work. + +Here are some words from src/INSTALL file that could be of some use: + ++++ + + Incomplete interface texts for standard Turbo units are included in + turbo.imp. Turbo users will have to flesh these out and write emulations + for whatever parts of the Turbo runtime library they need. + + If you wish to edit various system-wide configuration parameters, it is + better to put them in loc.p2crc than in sys.p2crc. As an example, on a + Turbo-oriented environment you may wish to add + + Language Turbo + + to the loc.p2crc file to replace the normal default (HP Pascal). + + PORTABILITY + + P2c was originally developed on a homebrew C compiler on the HP Pascal + Workstation operating system. Current development takes place on HP-UX, + which is System V based. The translator has also been compiled and used + on Sun-3's, so presumably it is fairly portable among 32-bit Unix machines. + + Many parts of the code will have to be adjusted in order for p2c to work + on a machine with 16-bit ints. I have never had reason or opportunity to + track these down since I don't have access to such a machine. Please note + that code _generated_ by p2c works with either size of int even though p2c + itself does not. + + If your compiler supports ANSI prototypes, most of the 16-bit portability + problems will go away except for possible %d/%ld sloppiness in sprintf control + strings. There may be places where p2c tries to cast a pointer into an + int, but I believe all such cases use longs consistently. You will have + a problem if your long type is not large enough to store a pointer. + + Because p2c was developed to run under Unix, it is sloppy about memory + allocation. Some data structures are allocated but never freed. Profiles + show that the waste is not too great in most cases, but if it is a problem + you may have to write a garbage collector (this shouldn't be too hard if you + only run the collector after translating each procedure). + ++++ + + -- Josip Rodin , Mon, 28 Dec 1998 18:14:23 +0100 --- p2c-1.21alpha2.orig/debian/rules +++ p2c-1.21alpha2/debian/rules @@ -0,0 +1,46 @@ +#!/usr/bin/make -f +# Derived from a dh_make example and Andrew Howell's rules file. + +#export DH_VERBOSE=1 +export DH_COMPAT=4 + +CFLAGS := -g -Wall +ifneq "$(findstring noopt,$(DEB_BUILD_OPTIONS))" "" +CFLAGS += -O0 +else +CFLAGS += -O2 +endif + +build: src/p2c +src/p2c: src/p2c.h + $(MAKE) -C src OPT="$(CFLAGS)" LFLAGS="-s" + +clean: + dh_testdir + dh_testroot + $(MAKE) -C src clean + dh_clean + +binary-indep: +# No architecture independant packages here. + +binary-arch: build + dh_testdir + dh_testroot + dh_clean -k + $(MAKE) -C src install PREFIX="$(CURDIR)/debian/p2c/usr" + dh_installdocs src/README src/NOTES + dh_installexamples examples/* + dh_installchangelogs src/HISTORY + dh_link usr/share/man/man1/p2c.1.gz usr/share/man/man1/p2cc.1.gz + dh_strip + dh_compress + dh_fixperms + dh_installdeb + dh_shlibdeps + dh_gencontrol + dh_md5sums + dh_builddeb + +binary: binary-indep binary-arch +.PHONY: build clean binary-indep binary-arch binary --- p2c-1.21alpha2.orig/debian/control +++ p2c-1.21alpha2/debian/control @@ -0,0 +1,26 @@ +Source: p2c +Section: devel +Priority: optional +Maintainer: Josip Rodin +Build-Depends: debhelper (>= 4) +Standards-Version: 3.6.0 + +Package: p2c +Architecture: any +Depends: ${shlibs:Depends} +Suggests: gcc, gpc +Description: Pascal to C translator + 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, + Texas Instruments Pascal, Apollo Domain 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-1.21alpha2.orig/debian/copyright +++ p2c-1.21alpha2/debian/copyright @@ -0,0 +1,25 @@ +This package was put together by Andrew Howell. +The current maintainer is Josip Rodin . + +The original source can be found at: + http://www.synaptics.com/people/daveg/ + +p2c's author is Dave Gillespie . + +Copyright 1989-1993 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; version 2 dated June, 1991. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software Foundation, + Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +On Debian systems, the complete text of the GNU General Public License +can be found in the file /usr/share/common-licenses/GPL. --- p2c-1.21alpha2.orig/debian/changelog +++ p2c-1.21alpha2/debian/changelog @@ -0,0 +1,52 @@ +p2c (1.21alpha2-2.1) unstable; urgency=low + + * Non-maintainer upload (0-day) + * Applied patch by Peter De Wachter that fixes double memory free()'s + (Closes: #305412, #307706) + + -- Roland Stigge Thu, 5 May 2005 16:04:37 +0200 + +p2c (1.21alpha2-2) unstable; urgency=low + + * Added debhelper to build-depends, closes: #190499. + * Updated package standards. + + -- Josip Rodin Sat, 16 Aug 2003 13:02:10 +0200 + +p2c (1.21alpha2-1) unstable; urgency=low + + * New upstream version. Although it is marked as "alpha", it has been + made in 1993, so... :) (closes: #39400) + * Updated for Policy 3.x, rewrote most of debian/* and made a better + src/Makefile patch. + + -- Josip Rodin Sat, 11 Sep 1999 23:34:19 +0200 + +p2c (1.20-3) unstable; urgency=low + + * Removed `-m486 -fomit-frame-pointer' from the gcc flags, since ix86 + doesn't need it and it bugs m68k (and other ports). + + -- Josip Rodin Thu, 7 Jan 1999 19:01:32 +0100 + +p2c (1.20-2) unstable; urgency=low + + * Fixed the FSF address in copyright file + + -- Josip Rodin Tue, 29 Dec 1998 21:13:52 +0100 + +p2c (1.20-1) unstable; urgency=low + + * Initial Release for potato (2.2) + * Converted to new packaging format/standards + + -- Josip Rodin Mon, 28 Dec 1998 18:14:23 +0100 + +Changes by Andrew Howell : + +1.20-2: + 951123 + * Converted to ELF. + +1.20-1: + * added Debian GNU/Linux package maintenance system files --- p2c-1.21alpha2.orig/src/Makefile +++ p2c-1.21alpha2/src/Makefile @@ -19,22 +19,23 @@ SHELL = /bin/sh # Directories (private version) -HOMEDIR = ../home -INCDIR = ../home/p2c -BINDIR = .. -LIBDIR = ../home -MANDIR = ../home -MANFILE = p2c.cat # human-readable manual (for cat.1) +#HOMEDIR = ../home +#INCDIR = ../home/p2c +#BINDIR = .. +#LIBDIR = ../home +#MANDIR = ../home +#MANFILE = p2c.cat # human-readable manual (for cat.1) #MANFILE = p2c.man.inst # uncompressed nroff source (for man.1) #MANFILE = p2c.man.Z # compressed nroff source (for man.1.Z) # Directories (public version) -#HOMEDIR = /usr/lib/p2c -#INCDIR = /usr/include/p2c -#BINDIR = /usr/bin -#LIBDIR = /usr/lib -#MANDIR = /usr/man/man1 -#MANFILE = p2c.man.inst +PREFIX = /usr +HOMEDIR = $(PREFIX)/lib/p2c +INCDIR = $(PREFIX)/include/p2c +BINDIR = $(PREFIX)/bin +LIBDIR = $(PREFIX)/lib +MANDIR = $(PREFIX)/share/man/man1 +MANFILE = p2c.man.inst # Compiler options CC = cc # you may wish to use gcc here instead @@ -64,9 +65,9 @@ LIBOBJS = p2clib.o loc.p2clib.o OTHERLIBOBJS = -ABSHOMEDIR = `cd $(HOMEDIR); pwd` -ABSINCDIR = `cd $(INCDIR); pwd` -ABSLIBDIR = `cd $(LIBDIR); pwd` +ABSHOMEDIR = /usr/lib/p2c +ABSINCDIR = /usr/include/p2c +ABSLIBDIR = /usr/lib MISCSRCS = makeproto.c PROTOS = p2c.proto p2c.hdrs @@ -161,11 +162,11 @@ SHELL=/bin/sh makedirs: - if [ ! -d $(HOMEDIR) ]; then mkdir $(HOMEDIR); else true; fi - if [ ! -d $(BINDIR) ]; then mkdir $(BINDIR); else true; fi - if [ ! -d $(LIBDIR) ]; then mkdir $(LIBDIR); else true; fi - if [ ! -d $(MANDIR) ]; then mkdir $(MANDIR); else true; fi - if [ ! -d $(INCDIR) ]; then mkdir $(INCDIR); else true; fi + if [ ! -d $(HOMEDIR) ]; then mkdir -p $(HOMEDIR); else true; fi + if [ ! -d $(BINDIR) ]; then mkdir -p $(BINDIR); else true; fi + if [ ! -d $(LIBDIR) ]; then mkdir -p $(LIBDIR); else true; fi + if [ ! -d $(MANDIR) ]; then mkdir -p $(MANDIR); else true; fi + if [ ! -d $(INCDIR) ]; then mkdir -p $(INCDIR); else true; fi $(BINDIR)/p2c: p2c $(COPY) p2c $(BINDIR)/p2c @@ -212,6 +213,7 @@ clean: rm -f $(OBJS) $(LIBOBJS) $(PROTOS) p2c libp2c.a + rm -f makeproto p2cc p2c.man.inst p2c.cat wc: wc $(SRCS) $(LIBSRCS) trans.h --- p2c-1.21alpha2.orig/src/decl.c +++ p2c-1.21alpha2/src/decl.c @@ -789,8 +789,10 @@ mpp2 = &mp2->snext; if (mp2) *mpp2 = mp2->snext; +#if 0 if (mp->kind == MK_CONST) free_value(&mp->val); +#endif freeexpr(mp->constdefn); if (mp->cbase) forget_ctx(mp, 1); --- p2c-1.21alpha2.orig/src/parse.c +++ p2c-1.21alpha2/src/parse.c @@ -4642,8 +4642,10 @@ } } if (conserve_mem) { +#if 0 free_stmt((Stmt *)func->val.i); /* is this safe? */ func->val.i = 0; +#endif forget_ctx(func, 0); } outsection(spacing);