OSDN Git Service

[Refactor] #37353 macro__* の宣言を util.h へ移動.
[hengband/hengband.git] / src / util.h
1 #pragma once
2
3 /*
4  * Sort-array element
5  */
6 typedef struct tag_type tag_type;
7
8 struct tag_type
9 {
10         int tag;
11         int index;
12 };
13
14 /*
15  * An entry for the object/monster allocation functions
16  *
17  * Pass 1 is determined from allocation information
18  * Pass 2 is determined from allocation restriction
19  * Pass 3 is determined from allocation calculation
20  */
21
22 typedef struct alloc_entry alloc_entry;
23
24 struct alloc_entry
25 {
26         KIND_OBJECT_IDX index;          /* The actual index */
27
28         DEPTH level;            /* Base dungeon level */
29         PROB prob1;             /* Probability, pass 1 */
30         PROB prob2;             /* Probability, pass 2 */
31         PROB prob3;             /* Probability, pass 3 */
32
33         u16b total;             /* Unused for now */
34 };
35
36 extern u32b message__next;
37 extern u32b message__last;
38 extern u32b message__head;
39 extern u32b message__tail;
40 extern u32b *message__ptr;
41 extern char *message__buf;
42
43 extern s16b macro__num;
44 extern concptr *macro__pat;
45 extern concptr *macro__act;
46 extern bool *macro__cmd;
47 extern char *macro__buf;
48
49 /*
50  * Hack -- conditional (or "bizarre") externs
51  */
52
53 #ifdef SET_UID
54 extern void user_name(char *buf, int id);
55 #endif
56
57 #if 0
58 #ifndef HAS_STRICMP
59 extern int stricmp(concptr a, concptr b);
60 #endif
61 #endif
62
63 #ifndef HAVE_USLEEP
64 extern int usleep(huge usecs);
65 #endif
66
67 /* util.c */
68 extern errr path_parse(char *buf, int max, concptr file);
69 extern errr path_build(char *buf, int max, concptr path, concptr file);
70 extern FILE *my_fopen(concptr file, concptr mode);
71 extern FILE *my_fopen_temp(char *buf, int max);
72 extern errr my_fgets(FILE *fff, char *buf, huge n);
73 extern errr my_fputs(FILE *fff, concptr buf, huge n);
74 extern errr my_fclose(FILE *fff);
75 extern errr fd_kill(concptr file);
76 extern errr fd_move(concptr file, concptr what);
77 extern errr fd_copy(concptr file, concptr what);
78 extern int fd_make(concptr file, BIT_FLAGS mode);
79 extern int fd_open(concptr file, int flags);
80 extern errr fd_lock(int fd, int what);
81 extern errr fd_seek(int fd, huge n);
82 extern errr fd_chop(int fd, huge n);
83 extern errr fd_read(int fd, char *buf, huge n);
84 extern errr fd_write(int fd, concptr buf, huge n);
85 extern errr fd_close(int fd);
86 extern void flush(void);
87 extern void bell(void);
88 extern errr play_music(int type, int num);
89 extern void select_floor_music(void);
90 extern void sound(int num);
91 extern void move_cursor(int row, int col);
92 extern void text_to_ascii(char *buf, concptr str);
93 extern void ascii_to_text(char *buf, concptr str);
94 extern errr macro_add(concptr pat, concptr act);
95 extern sint macro_find_exact(concptr pat);
96 extern char inkey(void);
97 extern concptr quark_str(STR_OFFSET num);
98 extern void quark_init(void);
99 extern u16b quark_add(concptr str);
100 extern s32b message_num(void);
101 extern concptr message_str(int age);
102 extern void message_add(concptr msg);
103 extern void msg_erase(void);
104 extern void msg_print(concptr msg);
105 extern void msg_print_wizard(int cheat_type, concptr msg);
106 #ifndef SWIG
107 extern void msg_format(concptr fmt, ...);
108 extern void msg_format_wizard(int cheat_type, concptr fmt, ...);
109 #endif /* SWIG */
110 extern void screen_save(void);
111 extern void screen_load(void);
112 extern void c_put_str(TERM_COLOR attr, concptr str, TERM_LEN row, TERM_LEN col);
113 extern void put_str(concptr str, TERM_LEN row, TERM_LEN col);
114 extern void c_prt(TERM_COLOR attr, concptr str, TERM_LEN row, TERM_LEN col);
115 extern void prt(concptr str, TERM_LEN row, TERM_LEN col);
116 extern void c_roff(TERM_COLOR attr, concptr str);
117 extern void roff(concptr str);
118 extern void clear_from(int row);
119 extern bool askfor_aux(char *buf, int len, bool numpad_cursor);
120 extern bool askfor(char *buf, int len);
121 extern bool get_string(concptr prompt, char *buf, int len);
122 extern bool get_check(concptr prompt);
123 extern bool get_check_strict(concptr prompt, BIT_FLAGS mode);
124 extern bool get_com(concptr prompt, char *command, bool z_escape);
125 extern QUANTITY get_quantity(concptr prompt, QUANTITY max);
126 extern void pause_line(int row);
127 extern void request_command(int shopping);
128 extern bool is_a_vowel(int ch);
129 extern int get_keymap_dir(char ch);
130 extern errr type_string(concptr str, uint len);
131 extern void roff_to_buf(concptr str, int wlen, char *tbuf, size_t bufsize);
132
133 #ifdef SORT_R_INFO
134 extern void tag_sort(tag_type elements[], int number);
135 #endif /* SORT_R_INFO */
136
137 #ifdef SUPPORT_GAMMA
138 extern byte gamma_table[256];
139 extern void build_gamma_table(int gamma);
140 #endif /* SUPPORT_GAMMA */
141
142 extern size_t my_strcpy(char *buf, concptr src, size_t bufsize);
143 extern size_t my_strcat(char *buf, concptr src, size_t bufsize);
144 extern char *my_strstr(concptr haystack, concptr needle);
145 extern char *my_strchr(concptr ptr, char ch);
146 extern void str_tolower(char *str);
147 extern int inkey_special(bool numpad_cursor);
148
149 /* util.c */
150 extern void repeat_push(COMMAND_CODE what);
151 extern bool repeat_pull(COMMAND_CODE *what);
152 extern void repeat_check(void);