1 | $ ! |
---|
2 | $ ! Set up to compile GCC on VAX/VMS |
---|
3 | $ ! |
---|
4 | $! Set the def dir to proper place for use in batch. Works for interactive too. |
---|
5 | $flnm = f$enviroment("PROCEDURE") ! get current procedure name |
---|
6 | $set default 'f$parse(flnm,,,"DEVICE")''f$parse(flnm,,,"DIRECTORY")' |
---|
7 | $ ! |
---|
8 | $set symbol/scope=(nolocal,noglobal) |
---|
9 | $if f$trnlnm("IFILE$").nes."" then close/noLog ifile$ |
---|
10 | $ ! |
---|
11 | $ echo = "write sys$output" |
---|
12 | $ ! |
---|
13 | $ if f$search("config.h") .nes. "" then delete config.h.* |
---|
14 | $ copy [.config.vax]xm-vms.h []config.h |
---|
15 | $ echo "Linked `config.h' to `[.config.vax]xm-vms.h'. |
---|
16 | $ ! |
---|
17 | $ if f$search("tconfig.h") .nes. "" then delete tconfig.h.* |
---|
18 | $ create []tconfig.h |
---|
19 | $DECK |
---|
20 | /* tconfig.h == config.h :: target and host configurations are the same */ |
---|
21 | #include "config.h" |
---|
22 | $EOD |
---|
23 | $ echo "Created `tconfig.h'. |
---|
24 | $ ! |
---|
25 | $ if f$search("hconfig.h") .nes. "" then delete hconfig.h.* |
---|
26 | $ create []hconfig.h |
---|
27 | $DECK |
---|
28 | /* hconfig.h == config.h :: host and target configurations are the same */ |
---|
29 | #include "config.h" |
---|
30 | $EOD |
---|
31 | $ echo "Created `hconfig.h'. |
---|
32 | $ ! |
---|
33 | $ if f$search("tm.h") .nes. "" then delete tm.h.* |
---|
34 | $!! copy [.config.vax]vms.h []tm.h |
---|
35 | $ edit/tpu/nojournal/nosection/nodisplay/command=sys$input - |
---|
36 | [.config.vax]vms.h /output=[]tm.h |
---|
37 | $DECK |
---|
38 | ! |
---|
39 | ! Copy file, changing lines of the form |
---|
40 | ! #include "vax/*" |
---|
41 | ! into |
---|
42 | ! #include "config-*" |
---|
43 | ! |
---|
44 | file := CREATE_BUFFER("file", GET_INFO(COMMAND_LINE, "file_name")); |
---|
45 | targ := LINE_BEGIN & '#include' & SPAN(ASCII(32)+ASCII(9)) & '"vax/'; |
---|
46 | rang := CREATE_RANGE(BEGINNING_OF(file), END_OF(file)); |
---|
47 | LOOP |
---|
48 | incl := SEARCH_QUIETLY(targ, FORWARD, EXACT, rang); |
---|
49 | EXITIF incl = 0; |
---|
50 | POSITION(BEGINNING_OF(incl)); |
---|
51 | ERASE(incl); |
---|
52 | COPY_TEXT('#include "config-'); |
---|
53 | rang := CREATE_RANGE(END_OF(incl), END_OF(file)); |
---|
54 | ENDLOOP; |
---|
55 | WRITE_FILE(file, GET_INFO(COMMAND_LINE, "output_file")); |
---|
56 | QUIT |
---|
57 | $EOD |
---|
58 | $ echo "Generated `tm.h' from `[.config.vax]vms.h'. |
---|
59 | $ ! |
---|
60 | $ !crude hack to allow compiling from [.cp] subdirectory |
---|
61 | $ if f$search("config-vax.h") .nes. "" then delete config-vax.h;* |
---|
62 | $ copy [.config.vax]vax.h []config-vax.h |
---|
63 | $ echo "Linked `config-vax.h' to `[.config.vax]vax.h' for `tm.h'." |
---|
64 | $ ! |
---|
65 | $ call make_lang_incl "options.h" |
---|
66 | $ ! |
---|
67 | $ call make_lang_incl "specs.h" |
---|
68 | $ ! |
---|
69 | $ if f$search("vax.md") .nes. "" then delete vax.md;* |
---|
70 | $ copy [.config.vax]vax.md []vax.md |
---|
71 | $ echo "Copied `vax.md' from `[.config.vax]vax.md'." |
---|
72 | $ ! |
---|
73 | $ if f$search("aux-output.c") .nes. "" then delete aux-output.c.* |
---|
74 | $ copy [.config.vax]vax.c []aux-output.c |
---|
75 | $ echo "Linked `aux-output.c' to `[.config.vax]vax.c'. |
---|
76 | $ ! |
---|
77 | $! |
---|
78 | $! |
---|
79 | $! Create the file version.opt, which helps identify the executable. |
---|
80 | $! |
---|
81 | $search version.c version_string,"="/match=and/output=t.tmp |
---|
82 | $open ifile$ t.tmp |
---|
83 | $read ifile$ line |
---|
84 | $close ifile$ |
---|
85 | $delete t.tmp; |
---|
86 | $ijk=f$locate("""",line)+1 |
---|
87 | $line=f$extract(ijk,f$length(line)-ijk,line) |
---|
88 | $ijk=f$locate("""",line) |
---|
89 | $line=f$extract(0,ijk,line) |
---|
90 | $ijk=f$locate("\n",line) |
---|
91 | $line=f$extract(0,ijk,line) |
---|
92 | $! |
---|
93 | $i=0 |
---|
94 | $loop: |
---|
95 | $elm=f$element(i," ",line) |
---|
96 | $if elm.eqs."" then goto no_ident |
---|
97 | $if (elm.les."9").and.(elm.ges."0") then goto write_ident |
---|
98 | $i=i+1 |
---|
99 | $goto loop |
---|
100 | $! |
---|
101 | $no_ident: |
---|
102 | $elm="?.??" |
---|
103 | $! |
---|
104 | $! |
---|
105 | $write_ident: |
---|
106 | $open ifile$ version.opt/write |
---|
107 | $write ifile$ "ident="+""""+elm+"""" |
---|
108 | $close ifile$ |
---|
109 | $purge version.opt |
---|
110 | $! |
---|
111 | $! |
---|
112 | $! create linker options files that lists all of the components for all |
---|
113 | $! possible compilers. We do this by editing the file Makefile.in, and |
---|
114 | $! generating the relevant files from it. |
---|
115 | $! |
---|
116 | $! |
---|
117 | $! Make a copy of the makefile if the sources are on a disk that is NFS |
---|
118 | $! mounted on a unix machine. |
---|
119 | $if f$search("Makefile.in").eqs."" .and. f$search("$M$akefile.in").nes."" - |
---|
120 | then copy $M$akefile.in Makefile.in |
---|
121 | $! This should be automated across all front-end subdirectories. |
---|
122 | $! For now, it's hardcoded. |
---|
123 | $if f$search("[.cp]Makefile.in").eqs."" .and. f$search("[.cp]$M$akefile.in").nes."" - |
---|
124 | then copy [.cp]$M$akefile.in [.cp]Makefile.in |
---|
125 | $! |
---|
126 | $! |
---|
127 | $echo "Now processing Makefile.in to generate linker option files." |
---|
128 | $edit/TPU/noJournal/noSection/noDisplay/Command=sys$input: Makefile.in |
---|
129 | !! |
---|
130 | VARIABLE makefile_buf, opt_file_buf, complist_buf, extra_compilers; ! Globals. |
---|
131 | |
---|
132 | !! |
---|
133 | PROCEDURE process_makefile( ) |
---|
134 | ! |
---|
135 | ! Interpret Makefile.in and subsidiary Make-lang.in templates. |
---|
136 | ! |
---|
137 | LOCAL range1, cmark, makefilename; |
---|
138 | |
---|
139 | makefilename := GET_INFO (COMMAND_LINE, 'FILE_NAME'); ! "Makefile.in" |
---|
140 | makefile_buf := CREATE_BUFFER ("makefile", makefilename); |
---|
141 | opt_file_buf := CREATE_BUFFER ("opt_file"); |
---|
142 | complist_buf := CREATE_BUFFER ("complist"); |
---|
143 | extra_compilers := CREATE_ARRAY; |
---|
144 | ! |
---|
145 | SET (NO_WRITE, makefile_buf, ON); ! Used as workspace; don't save it. |
---|
146 | SET (OUTPUT_FILE, complist_buf, "compilers.list"); |
---|
147 | ! |
---|
148 | ! Make some textual substitutions. |
---|
149 | ! |
---|
150 | configure_makefile (); |
---|
151 | ! |
---|
152 | ! Collect a list of supported compilers (``COMPILERS=xxx'' macro). |
---|
153 | ! |
---|
154 | identify_compilers (); |
---|
155 | ! |
---|
156 | ! Plus other known compilers described by Make-lang.in makefile fragments. |
---|
157 | ! Add new entries as needed; args are (target name, subdirectory name). |
---|
158 | ! |
---|
159 | additional_compiler ("cc1plus", "cp"); |
---|
160 | ! |
---|
161 | WRITE_FILE (complist_buf); ! Now save "compilers.list". |
---|
162 | ! |
---|
163 | ! Add to this list, as required. The file "Makefile.in" is searched for |
---|
164 | ! a tag that looks like "LINE_BEGIN + 'tag + (optional space) + "="". |
---|
165 | ! The contents are assumed to be a list of object files, and from this |
---|
166 | ! list a VMS linker options file is generated. |
---|
167 | ! |
---|
168 | generate_option_file ("OBJS", "=", "independent.opt"); |
---|
169 | generate_option_file ("LIB2FUNCS", "=", "libgcc2.list"); |
---|
170 | generate_option_file ("BC_ALL", "=", "bc_all.list"); |
---|
171 | generate_option_file ("BI_OBJ", "=", "bi_all.opt"); |
---|
172 | ! |
---|
173 | ! Now change OBJS in the Makefile, so each language specific options file |
---|
174 | ! does not pick up all of the language independent files. |
---|
175 | ! |
---|
176 | POSITION (BEGINNING_OF (makefile_buf)); |
---|
177 | COPY_TEXT ("OBJS="); ! New copy with empty value, seen before real OBJS. |
---|
178 | SPLIT_LINE; |
---|
179 | ! |
---|
180 | ! Lastly, process each compiler-specific object dependency list. |
---|
181 | ! |
---|
182 | POSITION (BEGINNING_OF (complist_buf)); |
---|
183 | LOOP |
---|
184 | cmark := MARK (NONE); |
---|
185 | EXITIF (cmark = END_OF (complist_buf)); |
---|
186 | ! The current line contains the name of a compiler target, such as "cc1". |
---|
187 | MESSAGE (CURRENT_LINE); ! Give some interactive feedback. |
---|
188 | generate_option_file (CURRENT_LINE, ":", CURRENT_LINE + "-objs.opt"); |
---|
189 | POSITION (cmark); |
---|
190 | MOVE_VERTICAL (1); ! Go to the next line. |
---|
191 | ENDLOOP; |
---|
192 | ENDPROCEDURE; !process_makefile |
---|
193 | !! |
---|
194 | |
---|
195 | PROCEDURE process_objc_lib( ) |
---|
196 | ! |
---|
197 | ! Interpret objc/Makefile, after finishing the top makefile. |
---|
198 | ! |
---|
199 | ON_ERROR |
---|
200 | [TPU$_OPENIN]: |
---|
201 | MESSAGE ("Cannot load objc/Makefile for ""ObjClib""; skipping it."); |
---|
202 | RETURN; |
---|
203 | ENDON_ERROR; |
---|
204 | |
---|
205 | ERASE (makefile_buf); !discard top Makefile |
---|
206 | POSITION (END_OF (makefile_buf)); |
---|
207 | READ_FILE ("[.objc]Makefile"); !load objc one |
---|
208 | MESSAGE ("objclib"); |
---|
209 | pat_replace (ASCII(9), " "); !change any <tab> to <space> |
---|
210 | generate_option_file ("OBJC_O", "=", "objc-objs.opt"); |
---|
211 | POSITION (BEGINNING_OF (makefile_buf)); |
---|
212 | ! Join any continuation lines; we want the header list to be one line. |
---|
213 | pat_replace ("\" & LINE_END, ); |
---|
214 | generate_option_file ("OBJC_H", "=", "objc-hdrs.list"); |
---|
215 | ENDPROCEDURE; !process_objc_lib |
---|
216 | !! |
---|
217 | |
---|
218 | PROCEDURE configure_makefile( ) |
---|
219 | ! |
---|
220 | ! Plug in some values normally handled by `configure'. Rather than |
---|
221 | ! replacing the dummy entries, insert the real entries before them. |
---|
222 | ! |
---|
223 | POSITION (BEGINNING_OF (makefile_buf)); |
---|
224 | COPY_TEXT ("target=vax-vms"); SPLIT_LINE; |
---|
225 | COPY_TEXT ("out_file=aux-output.c"); SPLIT_LINE; ! vax/vax.c |
---|
226 | COPY_TEXT ("out_object_file=aux-output.o"); SPLIT_LINE; ! aux-output.obj |
---|
227 | COPY_TEXT ("md_file=vax.md"); SPLIT_LINE; ! vax/vax.md |
---|
228 | COPY_TEXT ("tm_file=tm.h"); SPLIT_LINE; ! vax/tm-vms.h |
---|
229 | ENDPROCEDURE; !configure_makefile |
---|
230 | !! |
---|
231 | |
---|
232 | PROCEDURE identify_compilers( ) |
---|
233 | ! |
---|
234 | ! Retrieve the list of supported compilers from Makefile.in, and put them |
---|
235 | ! into file "compilers.list", one per line, for subsequent access from DCL. |
---|
236 | ! |
---|
237 | LOCAL range1; |
---|
238 | |
---|
239 | ! Strip most comments from the makefile, to speed up subsequent processing. |
---|
240 | POSITION (BEGINNING_OF (makefile_buf)); |
---|
241 | pat_replace (LINE_BEGIN & "#" & REMAIN & LINE_END, ); |
---|
242 | !# ! Convert directory references to VMS syntax (actually, just strip it). |
---|
243 | !# pat_replace (" $(srcdir)/", " "); |
---|
244 | ! Look up the ``COMPILERS=cc1 xyzzy'' Makefile macro and put |
---|
245 | ! its ``cc1 xyzzy'' value into the compilers buffer. |
---|
246 | POSITION (BEGINNING_OF (complist_buf)); |
---|
247 | !#--at some point we may want to add this-- |
---|
248 | !# recursive_fetch_tag ("CCCP", "="); ! Include the preprocessor. |
---|
249 | !# POSITION (END_OF (complist_buf)); |
---|
250 | recursive_fetch_tag ("COMPILERS", "="); |
---|
251 | ! Convert all spaces into newlines, then remove any blank lines. |
---|
252 | pat_replace (SPAN(" "), LINE_END); |
---|
253 | pat_replace (LINE_BEGIN & LINE_END, ); |
---|
254 | ENDPROCEDURE; !identify_compilers |
---|
255 | !! |
---|
256 | |
---|
257 | PROCEDURE additional_compiler( cname, subdir ) |
---|
258 | ! |
---|
259 | ! Load Make-lang.in for compiler CNAME from SUBDIR and append it to the |
---|
260 | ! end of Makefile.in's buffer. Add CNAME to the "compilers.list" buffer. |
---|
261 | ! |
---|
262 | ON_ERROR |
---|
263 | ! Don't abort if user removes the supporting subdirectory for a |
---|
264 | ! language she's not interested in. |
---|
265 | [TPU$_OPENIN]: |
---|
266 | MESSAGE ("Cannot load " + subdir + "/Make-lang.in for " |
---|
267 | + '"' + cname + '"' + "; skipping it."); |
---|
268 | RETURN; |
---|
269 | ENDON_ERROR; |
---|
270 | |
---|
271 | POSITION (END_OF (makefile_buf)); |
---|
272 | SPLIT_LINE; ! Separate with a blank line. |
---|
273 | READ_FILE ("[." + subdir + "]Make-lang.in"); ! Load Makefile fragment. |
---|
274 | ! Make sure that $(xxx_OTH_SRCS) expands to empty string by renaming $(it) |
---|
275 | pat_replace ("_OTH_SRCS)", "_OTH_SRCS_dummy_)"); |
---|
276 | ! Convert subdirectory references into VMS syntax. |
---|
277 | pat_replace ("$(srcdir)/" + subdir + "/", "[." + subdir + "]"); |
---|
278 | ! Add this name to compilers.list. |
---|
279 | POSITION (END_OF (complist_buf)); |
---|
280 | COPY_TEXT (cname); |
---|
281 | ! Make array entry indexed by compiler's file name; its value is arbitrary. |
---|
282 | extra_compilers{cname} := subdir; |
---|
283 | ENDPROCEDURE; !additional_compiler |
---|
284 | !! |
---|
285 | |
---|
286 | PROCEDURE generate_option_file( tag_name, punct, outfile_name ) |
---|
287 | ! |
---|
288 | ! Produce a file listing the names of particular object files, for use |
---|
289 | ! as input to the linker and also for use in finding source names by |
---|
290 | ! make-cc1.com. Generally, any name suffix will be suppressed. |
---|
291 | ! |
---|
292 | LOCAL range1, range2; |
---|
293 | |
---|
294 | POSITION (BEGINNING_OF (opt_file_buf)); |
---|
295 | recursive_fetch_tag (tag_name, punct); |
---|
296 | ! First fix up for subdirectory/Make-lang.in. |
---|
297 | IF (pat_replace ("stamp-objlist" & (SPAN(" ")|LINE_END), " ") > 0) THEN |
---|
298 | recursive_fetch_tag ("stamp-objlist", ":"); |
---|
299 | ENDIF; |
---|
300 | ! Now fix up a few things in the output buffer. |
---|
301 | pat_replace (("bytecode"|"Makefile") & (SPAN(" ")|LINE_END), " "); |
---|
302 | !# FILL (CURRENT_BUFFER, " ", 1, 80, 0); ! Condense things a bit. |
---|
303 | pat_replace ("." & ("o"|"c"|"y") & ((SPAN(" ")&LINE_END)|LINE_END), LINE_END); |
---|
304 | pat_replace ("." & ("o"|"c"|"y") & SPAN(" "), ","); |
---|
305 | pat_replace (".h" & (SPAN(" ")|LINE_END), ".h,"); |
---|
306 | ! Remove trailing commas, if present. |
---|
307 | pat_replace ("," & ((SPAN(" ")&LINE_END)|LINE_END), LINE_END); |
---|
308 | ! Get rid of spaces and blank lines. |
---|
309 | pat_replace (SPAN(" "), LINE_END); |
---|
310 | pat_replace (LINE_BEGIN & LINE_END, ); |
---|
311 | ! Second fix up for subdirectory/Make-lang.in; |
---|
312 | ! avoid "sticky defaults" when linker processes the resulting options file. |
---|
313 | IF (extra_compilers{outfile_name - "-objs.opt"} <> TPU$K_UNSPECIFIED) THEN |
---|
314 | POSITION (BEGINNING_OF (opt_file_buf)); |
---|
315 | range1 := CREATE_RANGE (MARK (NONE), END_OF (CURRENT_BUFFER), NONE); |
---|
316 | LOOP |
---|
317 | range2 := SEARCH_QUIETLY (LINE_BEGIN | ",", FORWARD, EXACT, range1); |
---|
318 | EXITIF (range2 = 0); |
---|
319 | POSITION (BEGINNING_OF (range2)); |
---|
320 | IF (CURRENT_CHARACTER = ",") THEN MOVE_HORIZONTAL (1); ENDIF; |
---|
321 | ! If it's not already "[.subdir]name", explicitly make it "[]name". |
---|
322 | IF (CURRENT_CHARACTER <> "[") THEN COPY_TEXT ("[]"); ENDIF; |
---|
323 | MOVE_HORIZONTAL (1); |
---|
324 | MODIFY_RANGE (range1, MARK (NONE), END_OF (range1)); |
---|
325 | ENDLOOP; |
---|
326 | ENDIF; |
---|
327 | ! Now write the output file. |
---|
328 | SET (OUTPUT_FILE, opt_file_buf, outfile_name); |
---|
329 | WRITE_FILE (opt_file_buf); |
---|
330 | ERASE (opt_file_buf); ! Clear buffer out for next opt_file pass. |
---|
331 | ENDPROCEDURE; !generate_option_file |
---|
332 | !! |
---|
333 | |
---|
334 | PROCEDURE recursive_fetch_tag( tag_n, punct ) |
---|
335 | ! |
---|
336 | ! Look up TAG_N, copy it to OPT_FILE_BUF, and then translate any $(...) |
---|
337 | ! definitions that appear. The translation is put at the current point. |
---|
338 | ! |
---|
339 | LOCAL mark1, mark2, range1, tag_range, tag_string; |
---|
340 | |
---|
341 | fetch_tag (tag_n, punct); |
---|
342 | ! Substitute any makefile symbols $(...). |
---|
343 | POSITION (BEGINNING_OF (CURRENT_BUFFER)); |
---|
344 | LOOP |
---|
345 | range1 := SEARCH_QUIETLY ("$(" & |
---|
346 | SPAN("abcdefghijklmnopqrstuvwxyz_ABCDEFGHIJKLMNOPQRSTUVWXYZ#~0123456789") |
---|
347 | & ")", FORWARD, EXACT); |
---|
348 | EXITIF (range1 = 0); |
---|
349 | POSITION (BEGINNING_OF (range1)); |
---|
350 | MOVE_HORIZONTAL (2); ! Past opening "$(". |
---|
351 | mark1 := MARK (NONE); |
---|
352 | POSITION (END_OF (range1)); |
---|
353 | MOVE_HORIZONTAL (-1); ! In front of closing ")". |
---|
354 | mark2 := MARK (NONE); |
---|
355 | tag_range := CREATE_RANGE (mark1, mark2, NONE); |
---|
356 | POSITION (END_OF (range1)); |
---|
357 | tag_string := STR (tag_range); |
---|
358 | ERASE (range1); |
---|
359 | fetch_tag (tag_string, "="); |
---|
360 | POSITION (BEGINNING_OF (CURRENT_BUFFER)); |
---|
361 | ENDLOOP; |
---|
362 | ENDPROCEDURE; !recursive_fetch_tag |
---|
363 | !! |
---|
364 | |
---|
365 | PROCEDURE fetch_tag( tag_n, punct ) |
---|
366 | ! |
---|
367 | ! Looks up the translation of a tag, and inserts it at the current location |
---|
368 | ! in the buffer. |
---|
369 | ! |
---|
370 | LOCAL mark0, mark1, mark2, range2; |
---|
371 | |
---|
372 | mark0 := MARK (NONE); ! Remember where we started; restore before return. |
---|
373 | POSITION (BEGINNING_OF (makefile_buf)); |
---|
374 | ! The tag definition always starts in the first column, and might have |
---|
375 | ! optional space(es) before "=" or ":" punctuation. |
---|
376 | range2 := SEARCH_QUIETLY (LINE_BEGIN & tag_n & ((SPAN(" ") & punct) | punct), |
---|
377 | FORWARD, EXACT); |
---|
378 | IF (range2 = 0) THEN |
---|
379 | POSITION (mark0); |
---|
380 | RETURN; |
---|
381 | ENDIF; |
---|
382 | POSITION (END_OF (range2)); |
---|
383 | MOVE_HORIZONTAL (1); ! Move beyond "TAG=". |
---|
384 | mark1 := MARK (NONE); |
---|
385 | POSITION (BEGINNING_OF (range2)); |
---|
386 | LOOP |
---|
387 | MOVE_VERTICAL (1); |
---|
388 | MOVE_HORIZONTAL (-2); |
---|
389 | EXITIF (CURRENT_CHARACTER <> "\"); |
---|
390 | ERASE_CHARACTER (1); |
---|
391 | MOVE_HORIZONTAL (1); |
---|
392 | ENDLOOP; |
---|
393 | MOVE_HORIZONTAL (1); |
---|
394 | mark2 := MARK (NONE); |
---|
395 | range2 := CREATE_RANGE (mark1, mark2, NONE); |
---|
396 | POSITION (mark0); |
---|
397 | IF (LENGTH (range2) <> 0) THEN |
---|
398 | COPY_TEXT (range2); |
---|
399 | ENDIF; |
---|
400 | ENDPROCEDURE; !fetch_tag |
---|
401 | !! |
---|
402 | |
---|
403 | PROCEDURE pat_replace( oldstring, newstring ) |
---|
404 | ! |
---|
405 | ! Replace all occurrences of a pattern. |
---|
406 | ! |
---|
407 | LOCAL range1, range2, kill_it, count; |
---|
408 | |
---|
409 | count := 0; |
---|
410 | kill_it := (GET_INFO (newstring, 'TYPE') = UNSPECIFIED); ! Omitted arg. |
---|
411 | range1 := CREATE_RANGE (BEGINNING_OF (CURRENT_BUFFER), |
---|
412 | END_OF (CURRENT_BUFFER), NONE); |
---|
413 | LOOP |
---|
414 | range2 := SEARCH_QUIETLY (oldstring, FORWARD, EXACT, range1); |
---|
415 | EXITIF (range2 = 0); |
---|
416 | count := count + 1; |
---|
417 | POSITION (BEGINNING_OF (range2)); |
---|
418 | ERASE (range2); |
---|
419 | IF (newstring = LINE_END) THEN |
---|
420 | SPLIT_LINE; |
---|
421 | ELSE IF (NOT kill_it) THEN |
---|
422 | COPY_TEXT (newstring); |
---|
423 | ENDIF; ENDIF; |
---|
424 | MODIFY_RANGE (range1, MARK (NONE), END_OF (range1)); |
---|
425 | ENDLOOP; |
---|
426 | RETURN count; |
---|
427 | ENDPROCEDURE; !pat_replace |
---|
428 | !! |
---|
429 | |
---|
430 | ! |
---|
431 | ! This is the main routine. |
---|
432 | ! |
---|
433 | process_makefile (); |
---|
434 | process_objc_lib (); !this uses a different makefile |
---|
435 | QUIT; ! All done; don't write any modified buffers. |
---|
436 | !! |
---|
437 | $ echo "" |
---|
438 | $! |
---|
439 | $! Remove excessive versions of the option files... |
---|
440 | $! |
---|
441 | $ purge *.opt,*.list |
---|
442 | $! |
---|
443 | $! |
---|
444 | $! |
---|
445 | $ if f$search("config.status") .nes. "" then delete config.status.* |
---|
446 | $ create config.status |
---|
447 | Links are now set up for use with a vax running VMS. |
---|
448 | $ type config.status |
---|
449 | $ echo "" |
---|
450 | $! |
---|
451 | $ exit |
---|
452 | $ |
---|
453 | $! |
---|
454 | $! Construct a header file based on subdirectory contents |
---|
455 | $! |
---|
456 | $make_lang_incl: subroutine |
---|
457 | $ if f$search(p1).nes."" then delete 'p1';* |
---|
458 | $ create 'p1' !empty file with ordinary text-file attributes |
---|
459 | $ open/Append ifile$ 'p1' |
---|
460 | $ write ifile$ "/* ''p1' */" |
---|
461 | $ hfile = f$search("[]''p1'") |
---|
462 | $ topdir = f$parse(hfile,,,"DIRECTORY") - "]" |
---|
463 | $lang_incl_loop: |
---|
464 | $ hfile = f$search("[.*]lang-''p1'") |
---|
465 | $ if hfile.eqs."" then goto lang_incl_done |
---|
466 | $ dir = f$parse(hfile,,,"DIRECTORY") - "]" |
---|
467 | $! convert absolute path to relative one, yielding "[.subdir]" |
---|
468 | $ dir = "[" + f$edit(dir - topdir,"LOWERCASE") + "]" |
---|
469 | $ write ifile$ "#include ""''dir'lang-''p1'""" |
---|
470 | $ goto lang_incl_loop |
---|
471 | $lang_incl_done: |
---|
472 | $ close ifile$ |
---|
473 | $ echo "Created `''p1''." |
---|
474 | $ endsubroutine !make_lang_incl |
---|