Thread: Macro Help
View Single Post
Old February 25, 2015, 22:40   #7
AnonymousHero
Veteran
 
AnonymousHero's Avatar
 
Join Date: Jun 2007
Posts: 1,367
AnonymousHero is on a distinguished road
Quote:
Originally Posted by chris View Post
OK, thanks again for tips.

Today I learned that the "escape delay" on the curses port has nothing whatsoever to do with ESCDELAY in curses. Not a thing! It actually has to do with multi-character macros setup in pref-gcu.pref to map the multi-character sequences that curses generates for certain keystrokes. Like, you press '2' on the num pad and curses sends \e[B (3 calls to getch()). pref-gcu.pref sets up a macro to translate this back to '2' for the game engine. Now, when the user presses \e (say, to dismiss a menu), our code (not curses!) is pausing to see if the user really wants to type \e[B by hand! Fun stuff, I just had to share
Yeah, maddening, isn't it? The input/macro/keymap system is truly bizarre -- just people adding onto other people's work without any true understanding, just hacking until "it works". (I'm going by the probably-reasonable assumption that Hengband's system is similar to Zangband's which is probably similar to ToME 2.x.)

Quote:
Originally Posted by chris View Post
Anyway, today's question relates to setting up compiler options in the build. For instance, if I want -fsanitize=address to be set, then this should only happen for me, not for other people who download and compile on linux (as they may use an older gcc or some other compiler). What I came up with was doing a
Code:
./configure CFLAGS=-fsanitize=address LDFLAGS=-fsanitize=address --with-no-install
which is a bit cumbersome. Is there a better way?

On a similar note, sometimes I want a debug build (-O0 -g) and sometimes not (-O3). I gather that changing src/Makefile (which is under version control) is not the best way to do this ... Help?
Personally, I wouldn't shy away from changing the Makefile. I just try to careful about what I merge (note: not "commit"). My workflow is usually heavily rebase-oriented so I just: a) branch, b) commit ad libitum (including makefile changes), c) commit some more (xN), d) rebase + squash branch appropriately on current master, e) excise undesirable parts of the squashed commit(s) using "git gui" (in amend mode) or "git rebase -i". And finally, f) merge (fast-forward, preferably).
AnonymousHero is offline   Reply With Quote