Support changing players' science box in the editor.
[freeciv.git] / utility / inputfile.h
blob3bd9c0e4bbd4d1532940f37bfd334ccc09b8ab88
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)
6 any later version.
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
22 #ifdef __cplusplus
23 extern "C" {
24 #endif /* __cplusplus */
26 #include "ioz.h"
27 #include "log.h" /* enum log_level */
28 #include "support.h" /* bool type and fc__attribute */
30 struct inputfile; /* opaque */
32 typedef const char *(*datafilename_fn_t)(const char *filename);
34 struct inputfile *inf_from_file(const char *filename,
35 datafilename_fn_t datafn);
36 struct inputfile *inf_from_stream(fz_FILE * stream,
37 datafilename_fn_t datafn);
38 void inf_close(struct inputfile *inf);
39 bool inf_at_eof(struct inputfile *inf);
41 enum inf_token_type {
42 INF_TOK_SECTION_NAME,
43 INF_TOK_ENTRY_NAME,
44 INF_TOK_EOL,
45 INF_TOK_TABLE_START,
46 INF_TOK_TABLE_END,
47 INF_TOK_COMMA,
48 INF_TOK_VALUE,
49 INF_TOK_LAST
51 #define INF_TOK_FIRST INF_TOK_SECTION_NAME
53 const char *inf_token(struct inputfile *inf, enum inf_token_type type);
54 int inf_discard_tokens(struct inputfile *inf, enum inf_token_type type);
56 char *inf_log_str(struct inputfile *inf, const char *message, ...)
57 fc__attribute((__format__ (__printf__, 2, 3)));
59 #ifdef __cplusplus
61 #endif /* __cplusplus */
63 #endif /* FC__INPUTFILE_H */