Re: levcomp kicking my butt
- From: Darshan Shaligram <scintilla@xxxxxxxxx>
- Date: Fri, 24 Apr 2009 01:17:54 +0530
Chris Morales <chrismorale@xxxxxxxxx> writes:
On Apr 22, 11:45 pm, pa...@xxxxxxx (Pasi Kallinen) wrote:[lev_comp.l changes]
Hm. Are you using Windows? I seem to recall that compiling on Windows,
the compile process automagically uses a pregenerated lex file, in
sys/share/lev_lex.c, iirc. I can't remember where or how it's determined
whether to generate a new one or use the pregenerated one, though...
It's probably in one of the Makefiles.
I'm compiling on Windows Vista; using Visual C++. Most of what Visual
C++ does between me hitting "Rebuild" and the build finishing could be
magic for all I know about it.
If you're building from the Visual Studio IDE, you're probably using the
MSVC project files under win/win32. When you run sys/winnt/nhsetup.bat,
the nethack.dsw (Visual Studio workspace file) goes to your top level NH
directory, and the .dsp (project) files go into $NH/build.
Your problem is that you haven't told the makefile that's responsible
for the level compiler to actually rebuild the level compiler from your
new *.l and *.y files using lex and yacc (flex and bison). The changes
to your .l files are being ignored, as Pasi notes.
Here's what you likely need to do (I'm not on Windows, these steps are
not tested):
- Install flex and bison. You need flex to process your changed *.l, and
bison for your modifications to *.y. You can get flex and bison for
Windows at:
http://gnuwin32.sourceforge.net/packages.html
You should be able to just drop the executables somewhere in your
PATH.
- Edit win/win32/levstuff.mak and edit the first two lines to point at
your flex and bison (make sure they're in your PATH, or that you refer
to them with absolute paths):
YACC = bison -y
LEX = flex
bison usually needs the -y to make it behave like a classic POSIX
yacc. You could also get byacc from gnuwin32 and use that instead of
bison, in which case you should leave off the -y (YACC = byacc).
- Run sys/winnt/nhsetup.bat again to push your changed .mak to the right
place. This is important. :-)
I do have a lev_lex.c file. Visual C++ seems to generate a new one as
part of the rebuild process, since any changes I make are deleted
during the build process.
There's a canned lev_lex.c and friends in sys/share. That's what is used
(copied into util) unless you tell levstuff.mak the paths to your lex
and yacc.
Visual C++ seems to use the lev_comp.l file to generate the lev_lex.c
file, since when I rename lev_comp.l, that part of the build fails
The makefile depends on lev_comp.l, but if you don't have lex, it
doesn't actually *use* your modified lev_comp.l. However, it should say
"Using pre-built lev_lex.c" somewhere in your build output if it's
ignoring your changed lev_comp.l file.
However, the "<MAPC>[-|}{+ABCISHKPLYWTF\\#. 0123456789]*\r?\n {" line
is not in lev_lex.c, and I don't see any similar lines.
You won't see a recognisable corresponding line, since the generated
lexer will contain only state tables that are not human-readable.
--
Darshan Shaligram <scintilla@xxxxxxxxx> Deus vult
.
- References:
- levcomp kicking my butt
- From: Chris Morales
- Re: levcomp kicking my butt
- From: Pasi Kallinen
- Re: levcomp kicking my butt
- From: Chris Morales
- Re: levcomp kicking my butt
- From: Pasi Kallinen
- Re: levcomp kicking my butt
- From: Chris Morales
- levcomp kicking my butt
- Prev by Date: Re: levcomp kicking my butt
- Next by Date: Re: levcomp kicking my butt
- Previous by thread: Re: levcomp kicking my butt
- Next by thread: Re: levcomp kicking my butt
- Index(es):
Relevant Pages
|