📄 vmsconfig.com
字号:
! Strip most comments from the makefile, to speed up subsequent processing. POSITION (BEGINNING_OF (makefile_buf)); pat_replace (LINE_BEGIN & "#" & REMAIN & LINE_END, );!# ! Convert directory references to VMS syntax (actually, just strip it).!# pat_replace (" $(srcdir)/", " "); ! Look up the ``COMPILERS=cc1 xyzzy'' Makefile macro and put ! its ``cc1 xyzzy'' value into the compilers buffer. POSITION (BEGINNING_OF (complist_buf));!#--at some point we may want to add this--!# recursive_fetch_tag ("CCCP", "="); ! Include the preprocessor.!# POSITION (END_OF (complist_buf)); recursive_fetch_tag ("COMPILERS", "="); ! Convert all spaces into newlines, then remove any blank lines. pat_replace (SPAN(" "), LINE_END); pat_replace (LINE_BEGIN & LINE_END, );ENDPROCEDURE; !identify_compilers!!PROCEDURE additional_compiler( cname, subdir ) ! ! Load Make-lang.in for compiler CNAME from SUBDIR and append it to the ! end of Makefile.in's buffer. Add CNAME to the "compilers.list" buffer. ! ON_ERROR ! Don't abort if user removes the supporting subdirectory for a ! language she's not interested in. [TPU$_OPENIN]: MESSAGE ("Cannot load " + subdir + "/Make-lang.in for " + '"' + cname + '"' + "; skipping it."); RETURN; ENDON_ERROR; POSITION (END_OF (makefile_buf)); SPLIT_LINE; ! Separate with a blank line. READ_FILE ("[." + subdir + "]Make-lang.in"); ! Load Makefile fragment. ! Make sure that $(xxx_OTH_SRCS) expands to empty string by renaming $(it) pat_replace ("_OTH_SRCS)", "_OTH_SRCS_dummy_)"); ! Convert subdirectory references into VMS syntax. pat_replace ("$(srcdir)/" + subdir + "/", "[." + subdir + "]"); ! Add this name to compilers.list. POSITION (END_OF (complist_buf)); COPY_TEXT (cname); ! Make array entry indexed by compiler's file name; its value is arbitrary. extra_compilers{cname} := subdir;ENDPROCEDURE; !additional_compiler!!PROCEDURE generate_option_file( tag_name, punct, outfile_name ) ! ! Produce a file listing the names of particular object files, for use ! as input to the linker and also for use in finding source names by ! make-cc1.com. Generally, any name suffix will be suppressed. ! LOCAL range1, range2; POSITION (BEGINNING_OF (opt_file_buf)); recursive_fetch_tag (tag_name, punct); ! First fix up for subdirectory/Make-lang.in. IF (pat_replace ("stamp-objlist" & (SPAN(" ")|LINE_END), " ") > 0) THEN recursive_fetch_tag ("stamp-objlist", ":"); ENDIF; ! Now fix up a few things in the output buffer. pat_replace (("bytecode"|"Makefile") & (SPAN(" ")|LINE_END), " ");!# FILL (CURRENT_BUFFER, " ", 1, 80, 0); ! Condense things a bit. pat_replace ("." & ("o"|"c"|"y") & ((SPAN(" ")&LINE_END)|LINE_END), LINE_END); pat_replace ("." & ("o"|"c"|"y") & SPAN(" "), ","); pat_replace (".h" & (SPAN(" ")|LINE_END), ".h,"); ! Remove trailing commas, if present. pat_replace ("," & ((SPAN(" ")&LINE_END)|LINE_END), LINE_END); ! Get rid of spaces and blank lines. pat_replace (SPAN(" "), LINE_END); pat_replace (LINE_BEGIN & LINE_END, ); ! Second fix up for subdirectory/Make-lang.in; ! avoid "sticky defaults" when linker processes the resulting options file. IF (extra_compilers{outfile_name - "-objs.opt"} <> TPU$K_UNSPECIFIED) THEN POSITION (BEGINNING_OF (opt_file_buf)); range1 := CREATE_RANGE (MARK (NONE), END_OF (CURRENT_BUFFER), NONE); LOOP range2 := SEARCH_QUIETLY (LINE_BEGIN | ",", FORWARD, EXACT, range1); EXITIF (range2 = 0); POSITION (BEGINNING_OF (range2)); IF (CURRENT_CHARACTER = ",") THEN MOVE_HORIZONTAL (1); ENDIF; ! If it's not already "[.subdir]name", explicitly make it "[]name". IF (CURRENT_CHARACTER <> "[") THEN COPY_TEXT ("[]"); ENDIF; MOVE_HORIZONTAL (1); MODIFY_RANGE (range1, MARK (NONE), END_OF (range1)); ENDLOOP; ENDIF; ! Now write the output file. SET (OUTPUT_FILE, opt_file_buf, outfile_name); WRITE_FILE (opt_file_buf); ERASE (opt_file_buf); ! Clear buffer out for next opt_file pass.ENDPROCEDURE; !generate_option_file!!PROCEDURE recursive_fetch_tag( tag_n, punct ) ! ! Look up TAG_N, copy it to OPT_FILE_BUF, and then translate any $(...) ! definitions that appear. The translation is put at the current point. ! LOCAL mark1, mark2, range1, tag_range, tag_string; fetch_tag (tag_n, punct); ! Substitute any makefile symbols $(...). POSITION (BEGINNING_OF (CURRENT_BUFFER)); LOOP range1 := SEARCH_QUIETLY ("$(" & SPAN("abcdefghijklmnopqrstuvwxyz_ABCDEFGHIJKLMNOPQRSTUVWXYZ#~0123456789") & ")", FORWARD, EXACT); EXITIF (range1 = 0); POSITION (BEGINNING_OF (range1)); MOVE_HORIZONTAL (2); ! Past opening "$(". mark1 := MARK (NONE); POSITION (END_OF (range1)); MOVE_HORIZONTAL (-1); ! In front of closing ")". mark2 := MARK (NONE); tag_range := CREATE_RANGE (mark1, mark2, NONE); POSITION (END_OF (range1)); tag_string := STR (tag_range); ERASE (range1); fetch_tag (tag_string, "="); POSITION (BEGINNING_OF (CURRENT_BUFFER)); ENDLOOP;ENDPROCEDURE; !recursive_fetch_tag!!PROCEDURE fetch_tag( tag_n, punct ) ! ! Looks up the translation of a tag, and inserts it at the current location ! in the buffer. ! LOCAL mark0, mark1, mark2, range2; mark0 := MARK (NONE); ! Remember where we started; restore before return. POSITION (BEGINNING_OF (makefile_buf)); ! The tag definition always starts in the first column, and might have ! optional space(es) before "=" or ":" punctuation. range2 := SEARCH_QUIETLY (LINE_BEGIN & tag_n & ((SPAN(" ") & punct) | punct), FORWARD, EXACT); IF (range2 = 0) THEN POSITION (mark0); RETURN; ENDIF; POSITION (END_OF (range2)); MOVE_HORIZONTAL (1); ! Move beyond "TAG=". mark1 := MARK (NONE); POSITION (BEGINNING_OF (range2)); LOOP MOVE_VERTICAL (1); MOVE_HORIZONTAL (-2); EXITIF (CURRENT_CHARACTER <> "\"); ERASE_CHARACTER (1); MOVE_HORIZONTAL (1); ENDLOOP; MOVE_HORIZONTAL (1); mark2 := MARK (NONE); range2 := CREATE_RANGE (mark1, mark2, NONE); POSITION (mark0); IF (LENGTH (range2) <> 0) THEN COPY_TEXT (range2); ENDIF;ENDPROCEDURE; !fetch_tag!!PROCEDURE pat_replace( oldstring, newstring ) ! ! Replace all occurrences of a pattern. ! LOCAL range1, range2, kill_it, count; count := 0; kill_it := (GET_INFO (newstring, 'TYPE') = UNSPECIFIED); ! Omitted arg. range1 := CREATE_RANGE (BEGINNING_OF (CURRENT_BUFFER), END_OF (CURRENT_BUFFER), NONE); LOOP range2 := SEARCH_QUIETLY (oldstring, FORWARD, EXACT, range1); EXITIF (range2 = 0); count := count + 1; POSITION (BEGINNING_OF (range2)); ERASE (range2); IF (newstring = LINE_END) THEN SPLIT_LINE; ELSE IF (NOT kill_it) THEN COPY_TEXT (newstring); ENDIF; ENDIF; MODIFY_RANGE (range1, MARK (NONE), END_OF (range1)); ENDLOOP; RETURN count;ENDPROCEDURE; !pat_replace!!!! This is the main routine.!process_makefile ();process_objc_lib (); !this uses a different makefileQUIT; ! All done; don't write any modified buffers.!!$ echo ""$!$! Remove excessive versions of the option files...$!$ purge *.opt,*.list$!$!$!$ if f$search("config.status") .nes. "" then delete config.status.*$ create config.statusLinks are now set up for use with a vax running VMS.$ type config.status$ echo ""$!$ exit$$!$! Construct a header file based on subdirectory contents$!$make_lang_incl: subroutine$ if f$search(p1).nes."" then delete 'p1';*$ create 'p1' !empty file with ordinary text-file attributes$ open/Append ifile$ 'p1'$ write ifile$ "/* ''p1' */"$ hfile = f$search("[]''p1'")$ topdir = f$parse(hfile,,,"DIRECTORY") - "]"$lang_incl_loop:$ hfile = f$search("[.*]lang-''p1'")$ if hfile.eqs."" then goto lang_incl_done$ dir = f$parse(hfile,,,"DIRECTORY") - "]"$! convert absolute path to relative one, yielding "[.subdir]"$ dir = "[" + f$edit(dir - topdir,"LOWERCASE") + "]"$ write ifile$ "#include ""''dir'lang-''p1'"""$ goto lang_incl_loop$lang_incl_done:$ close ifile$$ echo "Created `''p1''."$ endsubroutine !make_lang_incl
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -