Angband
z-util.h
Go to the documentation of this file.
1 
19 #ifndef INCLUDED_Z_UTIL_H
20 #define INCLUDED_Z_UTIL_H
21 
22 #include "h-basic.h"
23 
24 
34 extern char *argv0;
35 
36 
40 size_t (*text_mbcs_hook)(wchar_t *dest, const char *src, int n);
41 extern void (*plog_aux)(const char *);
42 extern void (*quit_aux)(const char *);
43 
44 
54 #define PLURAL(n) ((n) == 1 ? "" : "s")
55 
59 #define VERB_AGREEMENT(count, singular, plural) (((count) == 1) ? (singular) : (plural))
60 
61 
65 extern int my_stricmp(const char *s1, const char *s2);
66 
70 extern int my_strnicmp(const char *a, const char *b, int n);
71 
75 extern char *my_stristr(const char *string, const char *pattern);
76 
87 extern size_t my_strcpy(char *buf, const char *src, size_t bufsize);
88 
100 extern size_t my_strcat(char *buf, const char *src, size_t bufsize);
101 
105 void my_strcap(char *buf);
106 
110 extern bool streq(const char *s, const char *t);
111 extern bool prefix(const char *s, const char *t);
112 extern bool prefix_i(const char *s, const char *t);
113 extern bool suffix(const char *s, const char *t);
114 
115 #define streq(s, t) (!strcmp(s, t))
116 
120 extern void strskip(char *s, const char c);
121 extern void strescape(char *s, const char c);
122 
126 bool contains_only_spaces(const char* s);
127 
131 bool is_a_vowel(int ch);
132 
133 
137 size_t text_mbstowcs(wchar_t *dest, const char *src, int n);
138 
142 extern void plog(const char *str);
143 
147 extern void quit(const char *str);
148 
149 
153 extern void sort(void *array, size_t nmemb, size_t smemb,
154  int (*comp)(const void *a, const void *b));
155 
159 int mean(int *nums, int size);
160 int variance(int *nums, int size);
161 
162 #endif /* INCLUDED_Z_UTIL_H */