File: NOTES.OS2

package info (click to toggle)
cccc 1%3A3.1.4-11
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 3,984 kB
  • sloc: ansic: 33,244; cpp: 10,527; java: 622; makefile: 158; sh: 11
file content (296 lines) | stat: -rw-r--r-- 8,339 bytes parent folder | download | duplicates (26)
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
14 April 94
Version 1.20 of pccts

At the moment this help file is available via anonymous FTP at

        Node: marvin.ecn.purdue.edu
        File: pub/pccts/1.20/NOTES.OS2

Mail corrections or additions to Steve Robenalt <steve@molly.dny.rockwell.com>
===============================================================================
Notes on building PCCTS under OS/2 2.X with the C Set compilers.

The supplied makefiles can be used to build PCCTS under OS/2 with minimal
trouble. First you need to edit the makefiles such that the Unix specific
defaults are commented out, then uncomment the lines which are specific
to OS/2 and C Set/2 compilers as originally set up by Ed Harfmann. Note
also that you need to use the target list which reflects the appropriate
naming conventions. Some of the lines now need to be changed to reflect
differences in conventions between the operating systems: 1) change forward
slashes in directories to backslashes, 2) change command line parameters
from -option to /option (note that this applies to C Set, not ANTLR and DLG
options), and 3) change rm to del for clean and scrub targets.

To build ANTLR for the first time:

note: I tried various combinations of "touch"ing files to try to prevent nmake
      from using ANTLR to rebuild itself, and was unsuccessful.

In the section labelled "Target list of PC machines", comment out the
scan.c and antlr.c dependencies. This prevents nmake from trying to invoke
ANTLR to build itself. After you have built ANTLR successfully for the first
time, you can uncomment these lines and it will build itself normally. (If you
had a working 1.10 installation before, you can also use the older binaries
when building the new ones.)

An example of the resulting makefile, with all the extra baggage for Unix, DOS,
and OS/2 1.X is shown here:

----- cut here -----

#
# Makefile for ANTLR 1.20
#
# SOFTWARE RIGHTS
#
# We reserve no LEGAL rights to the Purdue Compiler Construction Tool
# Set (PCCTS) -- PCCTS is in the public domain.  An individual or
# company may do whatever they wish with source code distributed with
# PCCTS or the code generated by PCCTS, including the incorporation of
# PCCTS, or its output, into commerical software.
# 
# We encourage users to develop software with PCCTS.  However, we do ask
# that credit is given to us for developing PCCTS.  By "credit",
# we mean that if you incorporate our source code into one of your
# programs (commercial product, research project, or otherwise) that you
# acknowledge this fact somewhere in the documentation, research report,
# etc...  If you like PCCTS and have developed a nice tool with the
# output, please mention that you developed it using PCCTS.  In
# addition, we ask that this header remain intact in our source code.
# As long as these guidelines are kept, we expect to continue enhancing
# this system and expect to make other tools available as they are
# completed.
#
# ANTLR 1.20
# Terence Parr
# Purdue University
# With AHPCRC, University of Minnesota
# 1989-1994
#
# Ported to Borland C++, IBM C-Set/2 and Microsoft 6.0 by
# Ed Harfmann
# Micro Data Base Systems
# Lafayette, Indiana
# - With updates by Steve Robenalt 4/94
#
SET=..\support\set
PCCTS_H=..\h

#
# C-Set/2 for OS/2
#
CC=icc
CFLAGS= /I. /I$(SET) /I$(PCCTS_H) /Sa /W3 /DUSER_ZZSYN
OUT_OBJ = /Fo
LIBS=
ANTLR=..\bin\antlr
DLG=..\bin\dlg
OBJ_EXT = obj

antlr.exe: antlr.obj scan.obj err.obj bits.obj build.obj fset2.obj \
        fset.obj gen.obj globals.obj hash.obj lex.obj main.obj \
        misc.obj set.obj pred.obj dialog.obj
        link386 @<<
$** /NOI
$@ /STACK:32768

$(LIBS: = +^
)
$(DEF_FILE) $(LFLAGS) ;
<<
        copy *.exe ..\bin

#
# *********** Target list of PC machines ***********
#
# Don't worry about the ambiguity messages coming from antlr
# for making antlr.c etc...  [should be 10 of them, I think]
#
#antlr.c stdpccts.h parser.dlg tokens.h err.c : antlr.g
#	$(ANTLR) antlr.g

antlr.$(OBJ_EXT): antlr.c mode.h tokens.h

scan.$(OBJ_EXT): scan.c mode.h tokens.h

#scan.c mode.h: parser.dlg
#	$(DLG) -C2 parser.dlg scan.c

set.$(OBJ_EXT): $(SET)\set.c
	$(CC) $(CFLAGS) /C $(OUT_OBJ)set.$(OBJ_EXT) $(SET)\set.c

#
# what files does PCCTS generate (both ANTLR and DLG)
#

PCCTS_GEN=antlr.c scan.c err.c tokens.h mode.h parser.dlg stdpccts.h remap.h

SRC=antlr.c scan.c err.c bits.c build.c fset2.c fset.c gen.c globals.c \
	hash.c lex.c main.c misc.c $(SET)\set.c pred.c dialog.c

#
# ****** These next targets are common to UNIX and PC world ********
#

#clean up all the intermediate files
clean:
	del *.$(OBJ_EXT) 

#remove everything in clean plus the PCCTS files generated
scrub:
	del $(PCCTS_GEN) *.$(OBJ_EXT) 

----- cut here -----

To build DLG for the first time:

Follow the same steps as were used to build ANTLR, changing the slashes and
commands, targets, and extensions for OS/2. Comment out the dependencies for
dlg_p.c and dlg_a.c to prevent nmake from trying to invoke ANTLR and DLG to
build DLG (unless you have 1.10 binaries).

An example of the resulting makefile, with all the extra baggage for Unix, DOS,
and OS/2 1.X is shown here:

----- cut here -----

#
# Makefile for DLG 1.20
# Terence Parr
# Purdue University
# 1989-1993
#
# Ported to IBM C-Set/2 and Microsoft 6.0 by
# Ed Harfmann
# Micro Data Base Systems
# Lafayette, Indiana
# - With updates by Steve Robenalt 4/94
#
SET=..\support\set
PCCTS_H=..\h

#
# C-Set/2 for OS/2
#
CC=icc
CFLAGS= /I. /I$(SET) /I$(PCCTS_H) /Sa /W3
OUT_OBJ = /Fo
LIBS=
ANTLR=..\bin\antlr
DLG=..\bin\dlg
OBJ_EXT=obj

dlg.exe : dlg_p.obj dlg_a.obj main.obj err.obj set.obj support.obj \
        output.obj relabel.obj automata.obj
        link386 @<<
$** /NOI
$@ /STACK:32768

$(LIBS: = +^
)
$(DEF_FILE) $(LFLAGS) ;
<<
        copy *.exe ..\bin

SRC = dlg_p.c dlg_a.c main.c err.c $(SET)\set.c support.c output.c \
        relabel.c automata.c

#dlg_p.c parser.dlg err.c tokens.h : dlg_p.g
#	$(ANTLR) dlg_p.g

#dlg_a.c mode.h : parser.dlg
#	$(DLG) -C2 parser.dlg dlg_a.c

dlg_p.$(OBJ_EXT) : dlg_p.c dlg.h tokens.h mode.h
	$(CC) $(CFLAGS) /c dlg_p.c

dlg_a.$(OBJ_EXT) : dlg_a.c dlg.h tokens.h mode.h
	$(CC) $(CFLAGS) /c dlg_a.c

main.$(OBJ_EXT) : main.c dlg.h
	$(CC) $(CFLAGS) /c main.c

set.$(OBJ_EXT) : $(SET)\set.c
	$(CC) /c $(CFLAGS) $(SET)\set.c

lint:
	lint *.c

#clean up all the intermediate files
clean:
	del *.$(OBJ_EXT) 

----- cut here -----

Once you have built ANTLR and DLG successfully, you will also want to build
the genmk utility, located at ~\pccts\support\genmk. The makefile in this 
directory is relatively simple to modify, so I won't repeat it here.

At this point, you can test the executables by building one of the sample
programs, such as the Pascal or C example under ~pccts\lang. The prototype
makefile which is in these directories will work fine as a base, with OS/2
specific modifications as noted above. Note that the /Sa flag defines the
ANSI C mode of the compiler which is not the default. The default mode
does not define __STDC__ and will lead to lots of errors.

A sample pascal makefile is shown below:

----- cut here -----

GRM =pascal.g
LEX_FILE =pscan.dlg
GSRC=pascal.c err.c pscan.c ttree.c adebug.c
GOBJ=pascal.obj err.obj pscan.obj ttree.obj adebug.obj

PCCTS_GEN= pascal.c err.c $(LEX_FILE) pscan.c mode.h tokens.h

SRC =$(GSRC) pmain.c sym.c
OBJ =$(GOBJ) pmain.obj sym.obj
INCL = ..\..\h
SYM = ..\..\support\sym
ANTLR = ..\..\bin\antlr
DLG = ..\..\bin\dlg

CFLAGS=/I. /I$(INCL) /Sa
AFLAGS= -fl $(LEX_FILE) -gh

pascal.exe : $(OBJ)
	$(CC) $(CFLAGS) /Fopascal.exe $(OBJ)

pascal.c $(LEX_FILE) : $(GRM)
	$(ANTLR) $(AFLAGS) $(GRM)

mode.h pscan.c : $(LEX_FILE)
	$(DLG) -C2 $(LEX_FILE) pscan.c

pmain.obj : pmain.c pascal.h

pascal.obj : pascal.c mode.h tokens.h

sym.obj : $(SYM)\sym.c
	icc /c /Fo sym.obj $(CFLAGS) $(SYM)\sym.c

err.obj : err.c

clean:
	del $(PCCTS_GEN) *.obj


----- cut here -----

The C example can be built in much the same way.

If you have problems compiling anything, I would appreciate hearing about
it. I was able to get everything built and working without changing any
of the supplied or generated C code, so if you find that you need to make
changes to any code, I've probably written something up incorrectly.

Please post comments to the mailing list for PCCTS at:

	pccts-users@ahpcrc.umn.edu

since I am most likely to see them there.

- Steve Robenalt