Source:NetHack 5.0.0/include/hacklib.h

From NetHackWiki
Jump to navigation Jump to search

Below is the full text to hacklib.h from the source code of NetHack 5.0.0. To link to a particular line, write [[Source:NetHack 5.0.0/include/hacklib.h#line12]], for example.

The NetHack General Public License applies to screenshots, source code and other content from NetHack.

This content was modified from the original NetHack source code distribution (by splitting up NetHack content between wiki pages, and possibly further editing). See the page history for a list of who changed it, and on what dates.

1. /* NetHack 5.0	hacklib.h	$NHDT-Date: 1725653010 2024/09/06 20:03:30 $  $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.0 $ */
2. /* Copyright (c) Steve Creps, 1988.                               */
3. /* NetHack may be freely redistributed.  See license for details. */
4. 
5. #ifndef HACKLIB_H
6. #define HACKLIB_H
7. 
8. /*
9.  * hacklib true library functions
10.  */
11. extern boolean digit(char);
12. extern boolean letter(char);
13. extern char highc(char);
14. extern char lowc(char);
15. extern char *lcase(char *) NONNULL NONNULLARG1;
16. extern char *ucase(char *) NONNULL NONNULLARG1;
17. extern char *upstart(char *); /* ought to be changed to NONNULL NONNULLARG1
18.                                * and the code changed to not allow NULL arg */
19. extern char *upwords(char *) NONNULL NONNULLARG1;
20. extern char *mungspaces(char *) NONNULL NONNULLARG1;
21. extern char *trimspaces(char *) NONNULL NONNULLARG1;
22. extern char *strip_newline(char *) NONNULL NONNULLARG1;
23. extern char *eos(char *) NONNULL NONNULLARG1;
24. extern const char *c_eos(const char *) NONNULL NONNULLARG1;
25. extern boolean str_start_is(const char *, const char *, boolean) NONNULLPTRS;
26. extern boolean str_end_is(const char *, const char *) NONNULLPTRS;
27. extern int str_lines_maxlen(const char *);
28. extern char *strkitten(char *, char) NONNULL NONNULLARG1;
29. extern void copynchars(char *, const char *, int) NONNULLARG12;
30. extern char chrcasecpy(int, int);
31. extern char *strcasecpy(char *, const char *) NONNULL NONNULLPTRS;
32. extern char *s_suffix(const char *) NONNULL NONNULLARG1;
33. extern char *ing_suffix(const char *) NONNULL NONNULLARG1;
34. extern char *xcrypt(const char *, char *) NONNULL NONNULLPTRS;
35. extern boolean onlyspace(const char *) NONNULLARG1;
36. extern char *tabexpand(char *) NONNULL NONNULLARG1;
37. extern char *visctrl(char) NONNULL;
38. extern char *stripchars(char *, const char *,
39.                                             const char *) NONNULL NONNULLPTRS;
40. extern char *stripdigits(char *) NONNULL NONNULLARG1;
41. extern char *strsubst(char *, const char *, const char *) NONNULL NONNULLPTRS;
42. extern int strNsubst(char *, const char *, const char *, int) NONNULLPTRS;
43. extern const char *findword(const char *, const char *, int,
44.                                                          boolean) NONNULLARG2;
45. extern const char *ordin(int) NONNULL;
46. extern char *sitoa(int) NONNULL;
47. extern int sgn(int);
48. extern int distmin(coordxy, coordxy, coordxy, coordxy);
49. extern int dist2(coordxy, coordxy, coordxy, coordxy);
50. extern int isqrt(int);
51. extern boolean online2(coordxy, coordxy, coordxy, coordxy);
52. #ifndef STRNCMPI
53. extern int strncmpi(const char *, const char *, int) NONNULLPTRS;
54. #endif
55. #ifndef STRSTRI
56. extern char *strstri(const char *, const char *) NONNULLPTRS;
57. #endif
58. #define FITSint(x) FITSint_(x, __func__, __LINE__)
59. extern int FITSint_(long long, const char *, int);
60. #define FITSuint(x) FITSuint_(x, __func__, __LINE__)
61. extern unsigned FITSuint_(unsigned long long, const char *, int);
62. extern int case_insensitive_comp(const char *, const char *);
63. extern boolean fuzzymatch(const char *, const char *,
64.                           const char *, boolean) NONNULLPTRS;
65. extern int swapbits(int, int, int);
66. /* note: the snprintf CPP wrapper includes the "fmt" argument in "..."
67.    (__VA_ARGS__) to allow for zero arguments after fmt */
68. extern void nh_snprintf(const char *func, int line, char *str,
69.                         size_t size, const char *fmt, ...) PRINTF_F(5, 6);
70. extern void nh_snprintf_w_impossible(const char *func, int line, char *str,
71.                         size_t size, const char *fmt, ...) PRINTF_F(5, 6);
72. 
73. #define Snprintf(str, size, ...) \
74.     nh_snprintf(__func__, __LINE__, str, size, __VA_ARGS__)
75. 
76. #if 0
77. /*#define Strlen(s) Strlen_(s, __func__, __LINE__)*/
78. extern unsigned Strlen_(const char *, const char *, int) NONNULLPTRS;
79. #endif
80. extern int unicodeval_to_utf8str(int, uint8 *, size_t);
81. extern boolean copy_bytes(int, int);
82. extern const char *datamodel(int);
83. extern const char *what_datamodel_is_this(int, int, int, int, int, int);
84. 
85. #endif /* HACKLIB_H */
86.