History

CWEB — Release 3.4d, 1995-09-21.

Andreas Scherer committed 15 years ago

Commit 1ac0dc61 parent 0e8ebb26 files · +487 −0Browse files

Unified · Split

6 files
  1. Makefile +1 −0
  2. README +5 −0
  3. comm-ql.ch +340 −0
  4. ctang-ql.ch +25 −0
  5. cweav-ql.ch +32 −0
  6. readme.ql +84 −0
Makefile+1−0
@@ -72,6 +72,7 @@ ALMOSTALL = common.w ctangle.w Makefile README common.c common.h ctangle.c \ · 71 unmodified lines
72 cweav-vms.ch comm-man.ch ctang-man.ch cweav-man.ch \72 cweav-vms.ch comm-man.ch ctang-man.ch cweav-man.ch \
73 comm-pc.ch ctang-pc.ch cweav-pc.ch comm-amiga.ch \73 comm-pc.ch ctang-pc.ch cweav-pc.ch comm-amiga.ch \
74 comm-bs.ch ctang-bs.ch cweav-bs.ch makefile.bs \74 comm-bs.ch ctang-bs.ch cweav-bs.ch makefile.bs \
75 comm-ql.ch ctang-ql.ch cweav-ql.ch readme.ql \
75 comm-os2.ch cweb.1 cweb.el prod.w76 comm-os2.ch cweb.1 cweb.el prod.w
76ALL = $(ALMOSTALL) cweave.w77ALL = $(ALMOSTALL) cweave.w
77 78
README+5−0
@@ -24,6 +24,7 @@ comm-amiga.ch · 23 unmodified lines
24comm-bs.ch24comm-bs.ch
25comm-man.ch25comm-man.ch
26comm-pc.ch26comm-pc.ch
27comm-ql.ch
27comm-vms.ch28comm-vms.ch
28common.c29common.c
29common.h30common.h
@@ -31,12 +32,14 @@ common.w · 1 unmodified line
31ctang-bs.ch32ctang-bs.ch
32ctang-man.ch33ctang-man.ch
33ctang-pc.ch34ctang-pc.ch
35ctang-ql.ch
34ctang-vms.ch36ctang-vms.ch
35ctangle.c37ctangle.c
36ctangle.w38ctangle.w
37cweav-bs.ch39cweav-bs.ch
38cweav-man.ch40cweav-man.ch
39cweav-pc.ch41cweav-pc.ch
42cweav-ql.ch
40cweav-vms.ch43cweav-vms.ch
41cweave.w44cweave.w
42cweb.145cweb.1
@@ -46,6 +49,7 @@ cwebman.tex · 3 unmodified lines
46examples/49examples/
47makefile.bs50makefile.bs
48prod.w51prod.w
52readme.ql
49 53
50(If you got cweb by mail, you may have cweave.w.1 and cweave.w.254(If you got cweb by mail, you may have cweave.w.1 and cweave.w.2
51instead of cweave.w. The first thing to say then is55instead of cweave.w. The first thing to say then is
@@ -62,6 +66,7 @@ The file cweb.el is suggested for GNU-Emacs users. · 10 unmodified lines
62The files *-man.ch are used if you want to make the full 228-page CWEB manual.66The files *-man.ch are used if you want to make the full 228-page CWEB manual.
63The files *-bs.ch are used instead of *-pc.ch if you are doing BIG programs.67The files *-bs.ch are used instead of *-pc.ch if you are doing BIG programs.
64You can use makefile.bs to make CWEB with *-bs.ch.68You can use makefile.bs to make CWEB with *-bs.ch.
69The files *-ql.ch are for QDOS/SMSQ systems; see readme.ql for further info.
65The other files named *.ch are sample change files for local customization.70The other files named *.ch are sample change files for local customization.
66 71
67IMPORTANT: Please touch *.c before proceeding.72IMPORTANT: Please touch *.c before proceeding.
comm-ql.ch+340−0
@@ -0,0 +1,340 @@
1This is the change file for CWEB's COMMON under QSOD/SMSQ
2(Contributed by Robert H. Klein, September 1994)
3
4This change file is intended for use with C68 v4.13 (or later).
5compile with
6ex <dev_>cc;'-v -h -c -=500000 -DCWEBINPUTS=flp2_ common_c'
7
8
9
10@x
11\def\v{\char'174} % vertical (|) in typewriter font
12
13\def\title{Common code for CTANGLE and CWEAVE (Version 3.3)}
14\def\topofcontents{\null\vfill
15 \centerline{\titlefont Common code for {\ttitlefont CTANGLE} and
16 {\ttitlefont CWEAVE}}
17 \vskip 15pt
18 \centerline{(Version 3.3)}
19 \vfill}
20\def\botofcontents{\vfill
21\noindent
22@y
23\def\v{\char'174} % vertical (|) in typewriter font
24
25\def\title{Common code for CTANGLE and CWEAVE (QL Version 3.4)}
26\def\topofcontents{\null\vfill
27 \centerline{\titlefont Common code for {\ttitlefont CTANGLE} and
28 {\ttitlefont CWEAVE}}
29 \vskip 15pt
30 \centerline{(Version 3.4)}
31 \vfill}
32\def\botofcontents{\vfill
33\noindent
34@z
35
36@x
37The line number of each open file is also kept for error reporting and
38for the benefit of \.{CTANGLE}.
39
40@f line x /* make |line| an unreserved word */
41@d max_include_depth 10 /* maximum number of source files open
42 simultaneously, not counting the change file */
43@d max_file_name_length 60
44@d cur_file file[include_depth] /* current file */
45@d cur_file_name file_name[include_depth] /* current file name */
46@d cur_line line[include_depth] /* number of current line in current file */
47@d web_file file[0] /* main source file */
48@d web_file_name file_name[0] /* main source file name */
49@y
50The line number of each open file is also kept for error reporting and
51for the benefit of \.{CTANGLE}.
52
53For use on QDOS/SMSQ systems the variable |max_file_name_length| is shortened
54to 42 characters, i.e. 5 characters for the device name, 36 characters
55for the file name plus one character as string terminator. (Note that
56(current) QDOS/SMSQ file systems have a limitation of 36 characters as
57maximum length for a file name.
58
59@f line x /* make |line| an unreserved word */
60@d max_include_depth 10 /* maximum number of source files open
61 simultaneously, not counting the change file */
62@d max_file_name_length 42
63@d cur_file file[include_depth] /* current file */
64@d cur_file_name file_name[include_depth] /* current file name */
65@d cur_line line[include_depth] /* number of current line in current file */
66@d web_file file[0] /* main source file */
67@d web_file_name file_name[0] /* main source file name */
68@z
69
70
71@x
72 cur_file_name[l]='/'; /* \UNIX/ pathname separator */
73@y
74 cur_file_name[l]='_'; /* QDOS/SMSQ pathname separator */
75@z
76
77
78@x
79@ We now must look at the command line arguments and set the file names
80accordingly. At least one file name must be present: the \.{CWEB}
81file. It may have an extension, or it may omit the extension to get |".w"| or
82|".web"| added. The \TEX/ output file name is formed by replacing the \.{CWEB}
83file name extension by |".tex"|, and the \CEE/ file name by replacing
84the extension by |".c"|, after removing the directory name (if any).
85
86If there is a second file name present among the arguments, it is the
87change file, again either with an extension or without one to get |".ch"|.
88An omitted change file argument means that |"/dev/null"| should be used,
89when no changes are desired.
90@^system dependencies@>
91
92If there's a third file name, it will be the output file.
93
94@<Pred...@>=
95void scan_args();
96
97@ @c
98void
99scan_args()
100{
101 char *dot_pos; /* position of |'.'| in the argument */
102 char *name_pos; /* file name beginning, sans directory */
103 register char *s; /* register for scanning strings */
104 boolean found_web=0,found_change=0,found_out=0;
105 /* have these names have been seen? */
106 boolean flag_change;
107
108 while (--argc > 0) {
109 if ((**(++argv)=='-'||**argv=='+')&&*(*argv+1)) @<Handle flag argument@>@;
110 else {
111 s=name_pos=*argv;@+dot_pos=NULL;
112 while (*s) {
113 if (*s=='.') dot_pos=s++;
114 else if (*s=='/') dot_pos=NULL,name_pos=++s;
115 else s++;
116 }
117 if (!found_web) @<Make
118 |web_file_name|, |tex_file_name| and |C_file_name|@>@;
119 else if (!found_change) @<Make |change_file_name| from |fname|@>@;
120 else if (!found_out) @<Override |tex_file_name| and |C_file_name|@>@;
121 else @<Print usage error message and quit@>;
122 }
123 }
124 if (!found_web) @<Print usage error message and quit@>;
125 if (found_change<=0) strcpy(change_file_name,"/dev/null");
126}
127
128@ We use all of |*argv| for the |web_file_name| if there is a |'.'| in it,
129otherwise we add |".w"|. If this file can't be opened, we prepare an
130|alt_web_file_name| by adding |"web"| after the dot.
131The other file names come from adding other things
132after the dot. We must check that there is enough room in
133|web_file_name| and the other arrays for the argument.
134
135@<Make |web_file_name|...@>=
136{
137 if (s-*argv > max_file_name_length-5)
138 @<Complain about argument length@>;
139 if (dot_pos==NULL)
140 sprintf(web_file_name,"%s.w",*argv);
141 else {
142 strcpy(web_file_name,*argv);
143 *dot_pos=0; /* string now ends where the dot was */
144 }
145 sprintf(alt_web_file_name,"%s.web",*argv);
146 sprintf(tex_file_name,"%s.tex",name_pos); /* strip off directory name */
147 sprintf(idx_file_name,"%s.idx",name_pos);
148 sprintf(scn_file_name,"%s.scn",name_pos);
149 sprintf(C_file_name,"%s.c",name_pos);
150 found_web=1;
151}
152
153@ @<Make |change_file_name|...@>=
154{
155 if (strcmp(*argv,"-")==0) found_change=-1;
156 else {
157 if (s-*argv > max_file_name_length-4)
158 @<Complain about argument length@>;
159 if (dot_pos==NULL)
160 sprintf(change_file_name,"%s.ch",*argv);
161 else strcpy(change_file_name,*argv);
162 found_change=1;
163 }
164}
165
166@ @<Override...@>=
167{
168 if (s-*argv > max_file_name_length-5)
169 @<Complain about argument length@>;
170 if (dot_pos==NULL) {
171 sprintf(tex_file_name,"%s.tex",*argv);
172 sprintf(idx_file_name,"%s.idx",*argv);
173 sprintf(scn_file_name,"%s.scn",*argv);
174 sprintf(C_file_name,"%s.c",*argv);
175 } else {
176 strcpy(tex_file_name,*argv);
177 if (flags['x']) { /* indexes will be generated */
178 if (program==cweave && strcmp(*argv+strlen(*argv)-4,".tex")!=0)
179 fatal("! Output file name should end with .tex\n",*argv);
180@.Output file name...tex@>
181 strcpy(idx_file_name,*argv);
182 strcpy(idx_file_name+strlen(*argv)-4,".idx");
183 strcpy(scn_file_name,*argv);
184 strcpy(scn_file_name+strlen(*argv)-4,".scn");
185 }
186 strcpy(C_file_name,*argv);
187 }
188 found_out=1;
189}
190@y
191@ We now must look at the command line arguments and set the file names
192accordingly. At least one file name must be present: the \.{CWEB}
193file. It may have an extension, or it may omit the extension to get |"_w"| or
194|"_web"| added. The \TEX/ output file name is formed by replacing the \.{CWEB}
195file name extension by |"_tex"|, and the \CEE/ file name by replacing
196the extension by |"_c"|, after removing the directory name (if any).
197
198If there is a second file name present among the arguments, it is the
199change file, again either with an extension or without one to get |"_ch"|.
200An omitted change file argument means that |"NUL"| should be used,
201when no changes are desired.
202@^system dependencies@>
203
204If there's a third file name, it will be the output file.
205
206Because |"_"| is a directory {\em and} extension separator, \.{CWEB} will
207always use the {\em full} name (i.e. with full path). Fortunately the
208routine has been written to search for the last ``dot'', so the altered
209version will search for the last |"_"| (including directory separators),
210so we have what we want.
211
212@<Pred...@>=
213void scan_args();
214
215@ @c
216void
217scan_args()
218{
219 char *dot_pos; /* position of |'_'| in the argument */
220 char *name_pos; /* file name beginning, sans directory */
221 register char *s; /* register for scanning strings */
222 boolean found_web=0,found_change=0,found_out=0;
223 /* have these names have been seen? */
224 boolean flag_change;
225
226 while (--argc > 0) {
227 if ((**(++argv)=='-'||**argv=='+')&&*(*argv+1)) @<Handle flag argument@>@;
228 else {
229 s=name_pos=*argv;@+dot_pos=NULL;
230 while (*s) {
231 if (*s=='_') dot_pos=s++;
232 else if (*s=='_') dot_pos=NULL,name_pos=++s;
233 else s++;
234 }
235 if (!found_web) @<Make
236 |web_file_name|, |tex_file_name| and |C_file_name|@>@;
237 else if (!found_change) @<Make |change_file_name| from |fname|@>@;
238 else if (!found_out) @<Override |tex_file_name| and |C_file_name|@>@;
239 else @<Print usage error message and quit@>;
240 }
241 }
242 if (!found_web) @<Print usage error message and quit@>;
243 if (found_change<=0) strcpy(change_file_name,"NUL");
244}
245
246@ We use all of |*argv| for the |web_file_name| if there is a |'_'| in it,
247otherwise we add |"_w"|. If this file can't be opened, we prepare an
248|alt_web_file_name| by adding |"web"| after the dot.
249The other file names come from adding other things
250after the dot. We must check that there is enough room in
251|web_file_name| and the other arrays for the argument.
252
253If you've read the section before carefully you'll have noticed, that
254QDOS/SMSQ file names contain almost a |"_"|, so this routine will not work,
255i.e. you'll {\em have} to add the |"_w"| always. Nevertheless I adapted
256the routine as if it would work.
257
258@<Make |web_file_name|...@>=
259{
260 if (s-*argv > max_file_name_length-5)
261 @<Complain about argument length@>;
262 if (dot_pos==NULL)
263 sprintf(web_file_name,"%s_w",*argv);
264 else {
265 strcpy(web_file_name,*argv);
266 *dot_pos=0; /* string now ends where the dot was */
267 }
268 sprintf(alt_web_file_name,"%s_web",*argv);
269 sprintf(tex_file_name,"%s_tex",name_pos); /* strip off directory name */
270 sprintf(idx_file_name,"%s_idx",name_pos);
271 sprintf(scn_file_name,"%s_scn",name_pos);
272 sprintf(C_file_name,"%s_c",name_pos);
273 found_web=1;
274}
275
276@ @<Make |change_file_name|...@>=
277{
278 if (strcmp(*argv,"-")==0) found_change=-1;
279 else {
280 if (s-*argv > max_file_name_length-4)
281 @<Complain about argument length@>;
282 if (dot_pos==NULL)
283 sprintf(change_file_name,"%s_ch",*argv);
284 else strcpy(change_file_name,*argv);
285 found_change=1;
286 }
287}
288
289@ @<Override...@>=
290{
291 if (s-*argv > max_file_name_length-5)
292 @<Complain about argument length@>;
293 if (dot_pos==NULL) {
294 sprintf(tex_file_name,"%s_tex",*argv);
295 sprintf(idx_file_name,"%s_idx",*argv);
296 sprintf(scn_file_name,"%s_scn",*argv);
297 sprintf(C_file_name,"%s_c",*argv);
298 } else {
299 strcpy(tex_file_name,*argv);
300 if (flags['x']) { /* indexes will be generated */
301 if (program==cweave && strcmp(*argv+strlen(*argv)-4,"_tex")!=0)
302 fatal("! Output file name should end with _tex\n",*argv);
303@.Output file name...tex@>
304 strcpy(idx_file_name,*argv);
305 strcpy(idx_file_name+strlen(*argv)-4,"_idx");
306 strcpy(scn_file_name,*argv);
307 strcpy(scn_file_name+strlen(*argv)-4,"_scn");
308 }
309 strcpy(C_file_name,*argv);
310 }
311 found_out=1;
312}
313@z
314
315
316@x
317@ @<Print usage error message and quit@>=
318{
319if (program==ctangle)
320 fatal(
321"! Usage: ctangle [options] webfile[.w] [{changefile[.ch]|-} [outfile[.c]]]\n"
322 ,"");
323@.Usage:@>
324else fatal(
325"! Usage: cweave [options] webfile[.w] [{changefile[.ch]|-} [outfile[.tex]]]\n"
326 ,"");
327}
328@y
329@ @<Print usage error message and quit@>=
330{
331if (program==ctangle)
332 fatal(
333"! Usage: ctangle [options] webfile[_w] [{changefile[_ch]|-} [outfile[_c]]]\n"
334 ,"");
335@.Usage:@>
336else fatal(
337"! Usage: cweave [options] webfile[_w] [{changefile[_ch]|-} [outfile[_tex]]]\n"
338 ,"");
339}
340@z
ctang-ql.ch+25−0
@@ -0,0 +1,25 @@
1This is the change file for CWEB's CTANGLE under QDOS/SMSQ
2(Contributed by Robert H. Klein, September 1994)
3
4This change file is intended for use with C68 v4.13 (or later).
5compile with
6ex <dev_>cc;"-v -h -c -=500000 ctangle_c"
7
8
9@x
10\def\title{CTANGLE (Version 3.4)}
11@y
12\def\title{CTANGLE (QL Version 3.4)}
13@z
14
15@x section 1
16@d banner "This is CTANGLE (Version 3.4)\n"
17@y
18@d banner "This is CTANGLE (QL Version 3.4)\n"
19@z
20
21@x
22@i common.h
23@y
24@i common_h
25@z
cweav-ql.ch+32−0
@@ -0,0 +1,32 @@
1This is the change file for CWEB's CWEAVE under QDOS/SMSQ
2(Contributed by Robert H. Klein, September 1994)
3
4This change file is intended for use with C68 v4.14 (or later).
5compile with
6ex <dev_>cc;"-v -h -c =500000 cweave_c"
7
8
9@x
10\def\title{CWEAVE (Version 3.4)}
11@y
12\def\title{CWEAVE (QL Version 3.4)}
13@z
14
15@x section 1
16@d banner "This is CWEAVE (Version 3.4)\n"
17@y
18@d banner "This is CWEAVE (QL Version 3.4)\n"
19@z
20
21@x
22@i common.h
23@y
24@i common_h
25@z
26
27
28@x
29@i prod.w
30@y
31@i prod_w
32@z
readme.ql+84−0
@@ -0,0 +1,84 @@
1This is the readme file for CWEB for QDOS/SMSQ systems
2
3(These instructions are for systems with Toolkit II,
4 please report any problems to me, the address is at the
5 end of the file)
6
7If you want to compile CWEB for your QL system, you must first
8convert the ASCII code to the QL's character set. Therefore you
9can use the little BASIC program appended at the end of the file.
10
11For a first version you have to alter the supplied ctangle_c file.
12Set your DATA_USE to the directory you have the CWEB sources in, and
13the PROG_USE to C68's directory.
14compile it with:
15ex cc;'common_c ctangle_c -bufp500K -octangle'
16
17then ctangle the source files with:
18ex datad$&'ctangle';'common_w comm-ql_ch'
19ex datad$&'ctangle';'ctangle_w ctang-ql_ch'
20ex datad$&'ctangle';'cweave_w cweav-ql_ch'
21
22Compile the following way (C68v4.14 +):
23
24ex cc;'-c common_c'
25ex cc;'-c ctangle_c'
26ex cc;'-c cweave_c'
27ex ld;'-bufp500K common_o ctangle_o -octangle'
28ex ld;'-bufp500K common_o cweave_o -ocweave'
29
30After that copy the ctangle and cweave executables into your
31programs directory (if you want them there).
32
33The DATA default may be used as usual. E.g. if you have
34a file win2_data_test_w and the DATA default set to
35win2_data_ you may call ctangle with
36 ex ctangle;'test'
37assuming that ctangle is in your PROG default.
38
39Please report any problems with the QL version to:
40Robert Klein
41Bluecherstrasse 24
42D-56349 Kaub
43Germany
44
45
46**************** ASCII Conversion program ***************
47With this program you can convert DOS and Unix 7-Bit ASCII
48files to the QL's character set. You'll need Toolkit II.
49The program will take all the files in the source directory
50and put them converted into the destination&source directory,
51e.g. you have as drive1$='win2_', drive2$='win3_',
52path1$='cweb_' and path2$='ql_'. Then the routine will take
53all files in win2_cweb_ (wthout subdirectories!) convert them
54and write them to 'win3_ql_cweb_'. It's only a lousy hack,
55but it'll do it's job.
56
571000 DEFine PROCedure dos2ql (drive1$,path1$,drive2$,path2$)
581002 LOCal zx$,zx%,ishl,ashl
591005 DELETE drive2$&path2$&'dirlist'
601010 OPEN_NEW#5,drive2$&path2$&'dirlist'
611020 DIR#5,drive1$&path1$
621030 CLOSE#5
631040 OPEN_IN#5,drive2$&path2$&'dirlist'
641050 INPUT#5,zx$:INPUT#5,zx$:REMark devicename and sectors
651060 REPeat ashl
661070 IF EOF(#5)THEN EXIT ashl
671080 INPUT#5,zx$
681085 IF '->' INSTR zx$ THEN NEXT ashl
691090 OPEN_IN#3,drive1$&zx$
701100 OPEN_NEW#4,drive2$&path2$&zx$
711110 REPeat ishl
721120 IF EOF(#3)THEN EXIT ishl
731130 BGET#3,zx%
741140 SELect ON zx%
751150 = 13:REMark do nothing (DOS LineFeed)
761155 = 26:REMark do nothing (DOS EOF sign)
771160 = 96: BPUT#4,159:REMark Unix/DOS beginning quote sign
781170 = REMAINDER : BPUT#4,zx%
791180 END SELect
801190 END REPeat ishl
811195 CLOSE#3:CLOSE#4
821200 END REPeat ashl
831205 CLOSE#5
841210 END DEFine dos2ql

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t