NHDT->ANH, nethack->anethack, nhdat->anhdat
[aNetHack.git] / sys / vms / spec_lev.com
blob8d02f0e66446f2c33dc9f518bfac76080179328f
1 $ ! sys/vms/spec_lev.com -- preprocess anethack's special level compiler code
2 $ !
3 $ ! $ANH-Date: 1465133393 2016/06/05 13:29:53 $  $ANH-Branch: aNetHack-3.6.0 $:$ANH-Revision: 1.4 $
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.
8 $ !
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.)
22 $ ! additional setup
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
33 $mung: subroutine
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'
37 $       delete 'p1';*
38 $ endsubroutine !mung
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"
46 $ then
47 $  yacc lev_comp.y
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.*
52 $ endif
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"
58 $ then
59 $  lex lev_comp.l
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.*
63 $ endif
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"
68 $ then
69 $  yacc dgn_comp.y
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.*
72 $ else
73 $  copy [-.sys.share]dgn_yacc.c,dgn_comp.h []dgn_comp_tab.*
74 $ endif
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"
80 $ then
81 $  lex dgn_comp.l
82 $  if f$search("lexyy.c").nes."" then  rename lexyy.c lex_yy.*
83 $ else
84 $  copy [-.sys.share]dgn_lex.c []lex_yy.*
85 $ endif
86 $  mung   lex_yy.c dgn_lex.c
88 $ ! done
89 $  set default 'cur_dir'
90 $ exit