OSDN Git Service

[Refactor] #39964 Removed the dependency from read-pref-file to autopick-pref-processor
[hengband/hengband.git] / src / init.h
1 /*!
2  * @file init.h
3  * @brief ゲームデータ初期化処理のヘッダファイル
4  * @date 2015/01/02
5  * @author
6  * Copyright (c) 2000 Robert Ruehlmann
7  * @details
8  * This software may be copied and distributed for educational, research,
9  * and not for profit purposes provided that this copyright and statement
10  * are included in all such copies.
11  */
12
13 #ifndef INCLUDED_INIT_H
14 #define INCLUDED_INIT_H
15
16 #include "h-basic.h"
17
18 typedef struct header header;
19
20 typedef errr(*parse_info_txt_func)(char *buf, header *head);
21
22 /*
23  * Size of memory reserved for initialization of some arrays
24  */
25 #define FAKE_NAME_SIZE  40 * 1024L /*!< ゲーム情報の種別毎に用意される名前用バッファの容量 */
26 #define FAKE_TEXT_SIZE 150 * 1024L /*!< ゲーム情報の種別毎に用意されるテキスト用バッファの容量 */
27 #define FAKE_TAG_SIZE   10 * 1024L /*!< ゲーム情報の種別毎に用意されるタグ用バッファの容量 */
28
29 #define VER_INFO_ROW 3   //!< タイトル表記(行)
30
31  /*!
32   * @brief マクロ登録の最大数 / Maximum number of macros (see "io.c")
33   * @note Default: assume at most 256 macros are used
34   */
35 #define MACRO_MAX       256
36
37
38   /*!
39    * @struct header
40    * @brief 各初期データ用ヘッダ構造体 / Template file header information (see "init.c").  16 bytes.
41    * @details
42    * Note that the sizes of many of the "arrays" are between 32768 and
43    * 65535, and so we must use "unsigned" values to hold the "sizes" of
44    * these arrays below.  Normally, I try to avoid using unsigned values,
45    * since they can cause all sorts of bizarre problems, but I have no
46    * choice here, at least, until the "race" array is split into "normal"
47    * and "unique" monsters, which may or may not actually help.
48    *
49    * Note that, on some machines, for example, the Macintosh, the standard
50    * "read()" and "write()" functions cannot handle more than 32767 bytes
51    * at one time, so we need replacement functions, see "util.c" for details.
52    *
53    * Note that, on some machines, for example, the Macintosh, the standard
54    * "malloc()" function cannot handle more than 32767 bytes at one time,
55    * but we may assume that the "ralloc()" function can handle up to 65535
56    * butes at one time.  We should not, however, assume that the "ralloc()"
57    * function can handle more than 65536 bytes at a time, since this might
58    * result in segmentation problems on certain older machines, and in fact,
59    * we should not assume that it can handle exactly 65536 bytes at a time,
60    * since the internal functions may use an unsigned short to specify size.
61    *
62    * In general, these problems occur only on machines (such as most personal
63    * computers) which use 2 byte "int" values, and which use "int" for the
64    * arguments to the relevent functions.
65    */
66 struct header
67 {
68         byte v_major;           /* Version -- major */
69         byte v_minor;           /* Version -- minor */
70         byte v_patch;           /* Version -- patch */
71         byte v_extra;           /* Version -- extra */
72
73         u16b info_num;          /* Number of "info" records */
74         int info_len;           /* Size of each "info" record */
75         u16b head_size;         /* Size of the "header" in bytes */
76
77         STR_OFFSET info_size;           /* Size of the "info" array in bytes */
78         STR_OFFSET name_size;           /* Size of the "name" array in bytes */
79         STR_OFFSET text_size;           /* Size of the "text" array in bytes */
80         STR_OFFSET tag_size;            /* Size of the "tag" array in bytes */
81
82         void *info_ptr;
83         char *name_ptr;
84         char *text_ptr;
85         char *tag_ptr;
86
87         parse_info_txt_func parse_info_txt;
88
89         void(*retouch)(header *head);
90 };
91
92 extern errr init_info_txt(FILE *fp, char *buf, header *head,
93         parse_info_txt_func parse_info_txt_line);
94
95 extern errr parse_v_info(char *buf, header *head);
96 extern errr parse_f_info(char *buf, header *head);
97 extern void retouch_f_info(header *head);
98 extern errr parse_k_info(char *buf, header *head);
99 extern errr parse_a_info(char *buf, header *head);
100 extern errr parse_e_info(char *buf, header *head);
101 extern errr parse_r_info(char *buf, header *head);
102 extern errr parse_d_info(char *buf, header *head);
103 extern errr parse_s_info(char *buf, header *head);
104 extern errr parse_m_info(char *buf, header *head);
105
106 /*
107  * Error tracking
108  */
109 extern int error_idx;
110 extern int error_line;
111
112 /*
113  * File headers
114  */
115 extern header z_head;
116 extern header v_head;
117 extern header f_head;
118 extern header k_head;
119 extern header a_head;
120 extern header e_head;
121 extern header r_head;
122 extern header p_head;
123 extern header h_head;
124 extern header b_head;
125 extern header g_head;
126
127 #endif /* INCLUDED_INIT_H */
128
129 extern s16b f_tag_to_index(concptr str);
130 extern s16b f_tag_to_index_in_init(concptr str);
131 extern void init_angband(player_type *player_ptr, void(*process_autopick_file_command)(char*));
132 extern concptr get_check_sum(void);
133 extern void init_file_paths(char *path);