summaryrefslogtreecommitdiff
path: root/source/d/p2c/p2c_1.21alpha2-2.1.diff
blob: b7fbaf007717bb8bee000e96ddb281daf79f6964 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
--- 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 <joy-packages@debian.org>, 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 <joy-packages@debian.org>
+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 <joy-packages@debian.org>.
+
+The original source can be found at:
+	http://www.synaptics.com/people/daveg/
+
+p2c's author is Dave Gillespie <daveg@synaptics.com>.
+
+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 <stigge@antcom.de>  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 <joy-packages@debian.org>  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 <jrodin@jagor.srce.hr>  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 <jrodin@jagor.srce.hr>  Thu,  7 Jan 1999 19:01:32 +0100
+
+p2c (1.20-2) unstable; urgency=low
+
+  * Fixed the FSF address in copyright file
+
+ -- Josip Rodin <jrodin@jagor.srce.hr>  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 <jrodin@jagor.srce.hr>  Mon, 28 Dec 1998 18:14:23 +0100
+
+Changes by Andrew Howell <andrew@it.com.au>:
+
+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);