1 /**********************************************************************
2 Freeciv - Copyright (C) 1996 - A Kjeldberg, L Gregersen, P Unold
3 This program is free software; you can redistribute it and/or modify
4 it under the terms of the GNU General Public License as published by
5 the Free Software Foundation; either version 2, or (at your option)
8 This program is distributed in the hope that it will be useful,
9 but WITHOUT ANY WARRANTY; without even the implied warranty of
10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 GNU General Public License for more details.
12 ***********************************************************************/
14 /**********************************************************************
15 A low-level object for reading a registry-format file.
16 See comments in inputfile.c
17 ***********************************************************************/
19 #ifndef FC__INPUTFILE_H
20 #define FC__INPUTFILE_H
24 #endif /* __cplusplus */
28 #include "log.h" /* enum log_level */
29 #include "support.h" /* bool type and fc__attribute */
31 struct inputfile
; /* opaque */
33 typedef const char *(*datafilename_fn_t
)(const char *filename
);
35 struct inputfile
*inf_from_file(const char *filename
,
36 datafilename_fn_t datafn
);
37 struct inputfile
*inf_from_stream(fz_FILE
* stream
,
38 datafilename_fn_t datafn
);
39 void inf_close(struct inputfile
*inf
);
40 bool inf_at_eof(struct inputfile
*inf
);
52 #define INF_TOK_FIRST INF_TOK_SECTION_NAME
54 const char *inf_token(struct inputfile
*inf
, enum inf_token_type type
);
55 int inf_discard_tokens(struct inputfile
*inf
, enum inf_token_type type
);
57 char *inf_log_str(struct inputfile
*inf
, const char *message
, ...)
58 fc__attribute((__format__ (__printf__
, 2, 3)));
62 #endif /* __cplusplus */
64 #endif /* FC__INPUTFILE_H */