home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Source Code 1993 July / THE_SOURCE_CODE_CD_ROM.iso / gnu / nethack-3.1 / sys / vms / spec_lev.com < prev    next >
Encoding:
Text File  |  1993-01-24  |  2.9 KB  |  86 lines

  1. $ ! sys/vms/spec_lev.com -- preprocess nethack's special level compiler code
  2. $ !
  3. $ ! This operation needs to be performed prior to executing vmsbuild.com.
  4. $ ! Process the scanning and parsing code for NetHack's special level
  5. $ ! and dungeon compilers.  *.l and *.y are converted into *'.c and *.h.
  6. $ !
  7. $
  8. $ ! setup yacc/bison and lex/flex;
  9. $ !      (Uncomment the alternatives appropriate for your site;
  10. $ !       if yacc and lex are not defined, the pre-processed files
  11. $ !       distributed in sys/share will be copied and used.)
  12. $     ! yacc := bison /Define            !native bison (w/ DCL CLD)
  13. $     ! yacc := $bison$dir:bison -y -d        !'foreign' bison (w/o CLD)
  14. $     ! yacc := posix /Run/Input=nl: posix$bin:yacc. """-d 
  15. $     ! yacc := $shell$exe:yacc -d        !yacc from DECshell
  16. $     ! lex  := $flex$dir:flex            !flex
  17. $     ! lex  := posix /Run/Input=nl: posix$bin:lex. """
  18. $     ! lex  := $shell$exe:lex
  19. $ !      (Nothing below this line should need to be changed.)
  20. $ ! additional setup
  21. $    rename    := rename/New_Vers
  22. $    mung    := call mung    ! not to be confused with teco :-)
  23. $    delete    := delete/noConfirm
  24. $    copy    := copy/noConcat
  25. $    ! start from a known location -- [.sys.vms], then move to [-.-.util]
  26. $    cur_dir = f$environment("DEFAULT")
  27. $    set default 'f$parse(f$environment("PROCEDURE"),,,"DIRECTORY")'
  28. $    set default [-.-.util]    !move to utility directory
  29. $
  30. $mung: subroutine
  31. $ ! kludge to strip bogus #module directives from POSIX-processed files
  32. $ !   in lieu of $ rename 'p1' 'p2'
  33. $    search/Exact/Match=NOR 'p1' "#module" /Output='p2'
  34. $    delete 'p1';*
  35. $ endsubroutine !mung
  36. $
  37. $ ! first some cleanup (to keep things safe for unknown yacc vs bison)
  38. $  if f$search("y_tab.%").nes."" then  delete y_tab.%;* !old yacc
  39. $  if f$search("ytab.%") .nes."" then  delete ytab.%;*    !VMS POSIX yacc
  40. $
  41. $ ! process lev_comp.y into lev_yacc.c and ../include/lev_comp.h
  42. $ if f$type(yacc).eqs."STRING"
  43. $ then
  44. $  yacc lev_comp.y
  45. $  if f$search("y_tab.%").nes."" then  rename y_tab.% lev_comp.*
  46. $  if f$search("ytab.%") .nes."" then  rename ytab.% lev_comp.*
  47. $ else        ! use preprocessed files
  48. $  copy [-.sys.share]lev_yacc.c,lev_comp.h []lev_comp.*
  49. $ endif
  50. $  mung   lev_comp.c lev_yacc.c
  51. $  rename lev_comp.h [-.include]lev_comp.h
  52. $
  53. $ ! process lev_comp.l into lev_lex.c
  54. $ if f$type(lex).eqs."STRING"
  55. $ then
  56. $  lex lev_comp.l
  57. $ else        ! use preprocessed file
  58. $  copy [-.sys.share]lev_lex.c []lex_yy.*
  59. $ endif
  60. $  mung   lex_yy.c lev_lex.c
  61. $
  62. $ ! process dgn_comp.y into dgn_yacc.c and ../include/dgn_comp.h
  63. $ if f$type(yacc).eqs."STRING"
  64. $ then
  65. $  yacc dgn_comp.y
  66. $  if f$search("y_tab.%").nes."" then  rename y_tab.% dgn_comp.*
  67. $  if f$search("ytab.%") .nes."" then  rename ytab.% dgn_comp.*
  68. $ else
  69. $  copy [-.sys.share]dgn_yacc.c,dgn_comp.h []dgn_comp.*
  70. $ endif
  71. $  mung   dgn_comp.c dgn_yacc.c
  72. $  rename dgn_comp.h [-.include]dgn_comp.h
  73. $
  74. $ ! process dgn_comp.l into dgn_lex.c
  75. $ if f$type(lex).eqs."STRING"
  76. $ then
  77. $  lex dgn_comp.l
  78. $ else
  79. $  copy [-.sys.share]dgn_lex.c []lex_yy.*
  80. $ endif
  81. $  mung   lex_yy.c dgn_lex.c
  82. $
  83. $ ! done
  84. $  set default 'cur_dir'
  85. $ exit
  86.