Difference between revisions of "Source diving"

From NetHackWiki
Jump to navigation Jump to search
(tips)
(no need to link to an archived page when we have a copy on the wiki)
Line 8: Line 8:
 
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]].
 
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==
+
==See also==
* [https://web.archive.org/web/20160802031704/http://members.shaw.ca/rob.ellwood/sources.txt Beginner's Guide to NetHack Sources]
+
* [[Beginner's guide to NetHack sources]] -- note that the .des level file format described here has been replaced with LUA in current versions.
  
 
[[Category:Development]]
 
[[Category:Development]]

Revision as of 16:48, 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.

See also