Perseus's statue location on medusa-3 and medusa-4
[NetHack.git] / include / hacklib.h
blob79e86585a41b10ec0c93a2424ae3b345fb0fadfe
1 /* NetHack 3.7 hacklib.h $NHDT-Date: 1657918089 2022/07/15 20:48:09 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.1132 $ */
2 /* Copyright (c) Steve Creps, 1988. */
3 /* NetHack may be freely redistributed. See license for details. */
5 #ifndef HACKLIB_H
6 #define HACKLIB_H
8 /*
9 * hacklib true library functions
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 *, const char *) NONNULL NONNULLPTRS;
39 extern char *stripdigits(char *) NONNULL NONNULLARG1;
40 extern char *strsubst(char *, const char *, const char *) NONNULL NONNULLPTRS;
41 extern int strNsubst(char *, const char *, const char *, int) NONNULLPTRS;
42 extern const char *findword(const char *, const char *, int,
43 boolean) NONNULLARG2;
44 extern const char *ordin(int) NONNULL;
45 extern char *sitoa(int) NONNULL;
46 extern int sgn(int);
47 extern int distmin(coordxy, coordxy, coordxy, coordxy);
48 extern int dist2(coordxy, coordxy, coordxy, coordxy);
49 extern int isqrt(int);
50 extern boolean online2(coordxy, coordxy, coordxy, coordxy);
51 #ifndef STRNCMPI
52 extern int strncmpi(const char *, const char *, int) NONNULLPTRS;
53 #endif
54 #ifndef STRSTRI
55 extern char *strstri(const char *, const char *) NONNULLPTRS;
56 #endif
57 #define FITSint(x) FITSint_(x, __func__, __LINE__)
58 extern int FITSint_(long long, const char *, int);
59 #define FITSuint(x) FITSuint_(x, __func__, __LINE__)
60 extern unsigned FITSuint_(unsigned long long, const char *, int);
61 extern int case_insensitive_comp(const char *, const char *);
62 extern boolean fuzzymatch(const char *, const char *,
63 const char *, boolean) NONNULLPTRS;
64 extern int swapbits(int, int, int);
65 /* note: the snprintf CPP wrapper includes the "fmt" argument in "..."
66 (__VA_ARGS__) to allow for zero arguments after fmt */
67 extern void nh_snprintf(const char *func, int line, char *str,
68 size_t size, const char *fmt, ...) PRINTF_F(5, 6);
69 extern void nh_snprintf_w_impossible(const char *func, int line, char *str,
70 size_t size, const char *fmt, ...) PRINTF_F(5, 6);
72 #define Snprintf(str, size, ...) \
73 nh_snprintf(__func__, __LINE__, str, size, __VA_ARGS__)
75 #if 0
76 /*#define Strlen(s) Strlen_(s, __func__, __LINE__)*/
77 extern unsigned Strlen_(const char *, const char *, int) NONNULLPTRS;
78 #endif
79 extern int unicodeval_to_utf8str(int, uint8 *, size_t);
82 #endif /* HACKLIB_H */