Angband
datafile.h
Go to the documentation of this file.
1 
19 #ifndef DATAFILE_H
20 #define DATAFILE_H
21 
22 #include "object.h"
23 #include "parser.h"
24 
25 struct file_parser {
26  const char *name;
27  struct parser *(*init)(void);
28  errr (*run)(struct parser *p);
29  errr (*finish)(struct parser *p);
31 };
32 
33 extern const char *parser_error_str[PARSE_ERROR_MAX];
34 
35 errr run_parser(struct file_parser *fp);
36 errr parse_file_quit_not_found(struct parser *p, const char *filename);
37 errr parse_file(struct parser *p, const char *filename);
38 void cleanup_parser(struct file_parser *fp);
39 int lookup_flag(const char **flag_table, const char *flag_name);
40 errr grab_rand_value(random_value *value, const char **value_type,
41  const char *name_and_value);
42 errr grab_int_value(int *value, const char **value_type,
43  const char *name_and_value);
44 errr grab_index_and_int(int *value, int *index, const char **value_type,
45  const char *prefix, const char *name_and_value);
46 errr grab_base_and_int(int *value, char **base, const char *name_and_value);
47 errr grab_name(const char *from, const char *what, const char *list[], int max,
48  int *num);
49 errr grab_flag(bitflag *flags, const size_t size, const char **flag_table,
50  const char *flag_name);
51 errr remove_flag(bitflag *flags, const size_t size, const char **flag_table,
52  const char *flag_name);
53 
54 void write_flags(ang_file *fff, const char *intro_text, bitflag *flags,
55  int flag_size, const char *names[]);
56 void write_mods(ang_file *fff, const int values[]);
57 void write_elements(ang_file *fff, const struct element_info *el_info);
58 void file_archive(char *fname, char *append);
59 void activate_randart_file(void);
60 void deactivate_randart_file(void);
61 
62 #endif /* !DATAFILE_H */
void cleanup_parser(struct file_parser *fp)
Definition: datafile.c:113
Definition: parser.h:106
typedef void(PNGAPI *png_error_ptr) PNGARG((png_structp
errr(* finish)(struct parser *p)
Definition: datafile.h:29
Definition: z-file.c:261
void write_mods(ang_file *fff, const int values[])
bool prefix(const char *s, const char *t)
Determine if string "t" is a prefix of string "s".
Definition: z-util.c:257
errr run_parser(struct file_parser *fp)
Definition: datafile.c:48
int errr
ANSI C headers.
Definition: h-basic.h:164
errr grab_rand_value(random_value *value, const char **value_type, const char *name_and_value)
Get the random value argument from a value expression and put it into the appropriate place in an arr...
Definition: datafile.c:170
int lookup_flag(const char **flag_table, const char *flag_name)
Definition: datafile.c:118
const char * name
Definition: datafile.h:26
errr grab_int_value(int *value, const char **value_type, const char *name_and_value)
Get the integer argument from a value expression and put it into the appropriate place in an array...
Definition: datafile.c:211
Info file parser.
errr parse_file(struct parser *p, const char *filename)
The basic file parsing function.
Definition: datafile.c:81
png_uint_32 int flags
Definition: libpng12/png.h:1681
errr(* run)(struct parser *p)
Definition: datafile.h:28
int num
Definition: libpng12/png.h:1527
void activate_randart_file(void)
Prepare the randart file for the current seed to be loaded.
Definition: datafile.c:510
const char ** p[]
Definition: name.c:40
byte bitflag
Definition: z-bitflag.h:27
void(* cleanup)(void)
Definition: datafile.h:30
errr remove_flag(bitflag *flags, const size_t size, const char **flag_table, const char *flag_name)
Definition: datafile.c:330
const char * parser_error_str[PARSE_ERROR_MAX]
Definition: datafile.c:28
Element info type.
Definition: object.h:108
A struct representing a strategy for making a dice roll.
Definition: z-rand.h:40
errr grab_index_and_int(int *value, int *index, const char **value_type, const char *prefix, const char *name_and_value)
Get the integer argument from a value expression and the index in the value_type array of the suffix ...
Definition: datafile.c:243
Definition: datafile.h:25
void file_archive(char *fname, char *append)
Archive a data file from ANGBAND_DIR_USER into ANGBAND_DIR_ARCHIVE.
Definition: datafile.c:482
void deactivate_randart_file(void)
Move the randart file to the archive directory.
Definition: datafile.c:527
png_FILE_p fp
Definition: libpng12/png.h:1978
void write_flags(ang_file *fff, const char *intro_text, bitflag *flags, int flag_size, const char *names[])
Angband datafile writing routines
Definition: datafile.c:349
basic object structs and enums
void write_elements(ang_file *fff, const struct element_info *el_info)
Definition: parser.c:74
errr grab_name(const char *from, const char *what, const char *list[], int max, int *num)
Definition: datafile.c:300
png_uint_32 size
Definition: libpng12/png.h:1546
errr parse_file_quit_not_found(struct parser *p, const char *filename)
The basic file parsing function.
Definition: datafile.c:69
errr grab_base_and_int(int *value, char **base, const char *name_and_value)
Get the integer argument from a slay value expression and the monster base name it is slaying...
Definition: datafile.c:279
png_voidp int value
Definition: libpng12/png.h:2145
int index
Definition: obj-info.c:68
errr grab_flag(bitflag *flags, const size_t size, const char **flag_table, const char *flag_name)
Definition: datafile.c:320
const char * names[]
Definition: name.c:26