WINCHAIN - a framework allowing multiple processors between core and winport

This is the code I built trying to figure out the large window size issue.
It completely compiles out if not needed (see -DWINCHAIN in hints/macos10.7)
and except for one call during setup has zero overhead if compiled in and
not used.  See window.doc for more info.

Defs for UNUSED parms.  I know this has been controversial, so use is isolated
to the chain code and windows.c (where it shouldn't be intrusive and saves about
50 warnings).

Hints file for 10.7, but the build process still needs to be migrated from
the branch.
This commit is contained in:
keni
2012-01-11 18:23:35 +00:00
parent 586e2cb67e
commit 7f6ee2f759
14 changed files with 3280 additions and 65 deletions

View File

@@ -22,6 +22,7 @@ Contents:
VII. Game startup
VIII. Conventions
IX. Implementation and Multi-window support
X. WINCHAIN
I. Window Types and Terminology
@@ -994,3 +995,33 @@ One caveat. Unfortunately, if you incorrectly specify the
DEFAULT_WINDOW_SYS, NetHack will dump core (or whatever) without
printing any message, because raw_print() cannot function without first
setting the window-port.
X. WINCHAIN
WINCHAIN is an optional facility that allows the SYSCF_FILE to specify a
series of processors that will see each call from the core to the window
port (and the resulting return chain). Processors are specified one at a
time from the start of the chain (the core end) towards the window port as:
OPTIONS=windowchain:+PROC
where PROC is the name of the processor to add to the chain. The '+' is
required and is part of the name of the processor (this distinguishes
processors from window ports; in addition the '-' character is reserved for
WINCHAIN internals).
If WINCHAIN is not compiled into the NetHack binary, there is no overhead.
If WINCHAIN is compiled into the NetHack binary but not used, overhead is
limited to one function call during game setup and a trivial amount of data.
Note that raw_print* calls will not go through the chain until initialization
is complete (when *main.c calls commit_windowchain()).
The only processor currently available is '+trace' which is a debugging
facility for window ports. See the code in win/chain/wc_trace.c for
details on where to find the log file and how to write to it from other parts
of the code.
A processor may be specified more than once; this is expected to be most
useful for surrounding a processor being developed with before and after
calls to +trace.