Difference between revisions of "Source diving"

From NetHackWiki
Jump to navigation Jump to search
(Fixed broken link)
(Tag: adds external links)
(tips)
Line 4: Line 4:
  
 
[[Grep]], [[GEMA]], [[AWK]], and [http://www.stack.nl/~dimitri/doxygen/index.html Doxygen] are useful tools when source diving.
 
[[Grep]], [[GEMA]], [[AWK]], and [http://www.stack.nl/~dimitri/doxygen/index.html Doxygen] are useful tools when source diving.
 +
 +
==Tips==
 +
Most function declarations are in [[Source:NetHack_3.6.1/include/extern.h|extern.h]], sorted by the .c file they're defined in. If you're looking for a function's definition, you can search for the function name in extern.h, then scroll up to the comment giving the file name. Note that some things that look like functions, such as <code>resists_fire(mon)</code>, are actually preprocessor macros; most of those are defined in other header files such as [[Source:NetHack_3.6.1/include/youprop.h|youprop.h]] or [[Source:NetHack_3.6.1/include/mondata.h|mondata.h]].
  
 
==External links==
 
==External links==

Revision as of 16:42, 4 July 2021

Source diving is the action of examining the source code of NetHack. A person who practices source diving is called a source diver. The source code is freely available for anyone, unlike in most commercial programs.

Source diving is usually done when someone wants to know how something really works in the game. Source divers may also program their own patches to the game. Some people may just want to look for easter eggs or interesting comments in the source.

Grep, GEMA, AWK, and Doxygen are useful tools when source diving.

Tips

Most function declarations are in extern.h, sorted by the .c file they're defined in. If you're looking for a function's definition, you can search for the function name in extern.h, then scroll up to the comment giving the file name. Note that some things that look like functions, such as resists_fire(mon), are actually preprocessor macros; most of those are defined in other header files such as youprop.h or mondata.h.

External links