1 $ ! sys/vms/spec_lev.com -- preprocess anethack's special level compiler code
3 $ ! $ANH-Date: 1465133393 2016/06/05 13:29:53 $ $ANH-Branch: aNetHack-3.6.0 $:$ANH-Revision: 1.4 $
5 $ ! This operation needs to be performed prior to executing vmsbuild.com.
6 $ ! Process the scanning and parsing code for aNetHack's special level
7 $ ! and dungeon compilers. *.l and *.y are converted into *'.c and *.h.
10 $ ! setup yacc/bison and lex/flex;
11 $ ! (Uncomment the alternatives appropriate for your site;
12 $ ! if yacc and lex are not defined, the pre-processed files
13 $ ! distributed in sys/share will be copied and used.)
14 $ ! yacc := bison /Define !native bison (w/ DCL CLD)
15 $ ! yacc := $bison$dir:bison -y -d !'foreign' bison (w/o CLD)
16 $ ! yacc := posix /Run/Input=nl: posix$bin:yacc. """-d
17 $ ! yacc := $shell$exe:yacc -d !yacc from DEC/Shell
18 $ ! lex := $flex$dir:flex !flex
19 $ ! lex := posix /Run/Input=nl: posix$bin:lex. """
20 $ ! lex := $shell$exe:lex
21 $ ! (Nothing below this line should need to be changed.)
23 $ rename := rename/New_Vers
24 $ mung := call mung ! not to be confused with teco :-)
25 $ delete := delete/noConfirm
26 $ search := search/Exact
27 $ copy := copy/noConcat
28 $ ! start from a known location -- [.sys.vms], then move to [-.-.util]
29 $ cur_dir = f$environment("DEFAULT")
30 $ set default 'f$parse(f$environment("PROCEDURE"),,,"DIRECTORY")'
31 $ set default [-.-.util] !move to utility directory
34 $ ! kludge to strip bogus #module directives from POSIX-processed files
35 $ ! in lieu of $ rename 'p1' 'p2'
36 $ search/Match=NOR 'p1' "#module" /Output='p2'
40 $ ! first cleanup any old intermediate files (to safely handle blind renaming)
41 $ if f$search("*tab.%").nes."" then delete *tab.%;* !yacc & bison
42 $ if f$search("*yy.c") .nes."" then delete *yy.c;* !lex & flex
44 $ ! process lev_comp.y into lev_yacc.c and ../include/lev_comp.h
45 $ if f$type(yacc).eqs."STRING"
48 $ if f$search("y_tab.%").nes."" then rename y_tab.% lev_comp_tab.*
49 $ if f$search("ytab.%") .nes."" then rename ytab.% lev_comp_tab.*
50 $ else ! use preprocessed files
51 $ copy [-.sys.share]lev_yacc.c,lev_comp.h []lev_comp_tab.*
53 $ mung lev_comp_tab.c lev_yacc.c
54 $ rename lev_comp_tab.h [-.include]lev_comp.h
56 $ ! process lev_comp.l into lev_lex.c
57 $ if f$type(lex).eqs."STRING"
60 $ if f$search("lexyy.c").nes."" then rename lexyy.c lex_yy.*
61 $ else ! use preprocessed file
62 $ copy [-.sys.share]lev_lex.c []lex_yy.*
64 $ mung lex_yy.c lev_lex.c
66 $ ! process dgn_comp.y into dgn_yacc.c and ../include/dgn_comp.h
67 $ if f$type(yacc).eqs."STRING"
70 $ if f$search("y_tab.%").nes."" then rename y_tab.% dgn_comp_tab.*
71 $ if f$search("ytab.%") .nes."" then rename ytab.% dgn_comp_tab.*
73 $ copy [-.sys.share]dgn_yacc.c,dgn_comp.h []dgn_comp_tab.*
75 $ mung dgn_comp_tab.c dgn_yacc.c
76 $ rename dgn_comp_tab.h [-.include]dgn_comp.h
78 $ ! process dgn_comp.l into dgn_lex.c
79 $ if f$type(lex).eqs."STRING"
82 $ if f$search("lexyy.c").nes."" then rename lexyy.c lex_yy.*
84 $ copy [-.sys.share]dgn_lex.c []lex_yy.*
86 $ mung lex_yy.c dgn_lex.c
89 $ set default 'cur_dir'