Freeciv-3.3
Loading...
Searching...
No Matches
Macros | Typedefs | Enumerations | Functions
inputfile.h File Reference
#include "ioz.h"
#include "log.h"
#include "support.h"

Go to the source code of this file.

Macros

#define INF_TOK_FIRST   INF_TOK_SECTION_NAME
 

Typedefs

typedef const char *(* datafilename_fn_t) (const char *filename)
 

Enumerations

enum  inf_token_type {
  INF_TOK_SECTION_NAME , INF_TOK_ENTRY_NAME , INF_TOK_EOL , INF_TOK_TABLE_START ,
  INF_TOK_TABLE_END , INF_TOK_COMMA , INF_TOK_VALUE , INF_TOK_LAST
}
 

Functions

struct inputfileinf_from_file (const char *filename, datafilename_fn_t datafn)
 
struct inputfileinf_from_stream (fz_FILE *stream, datafilename_fn_t datafn)
 
void inf_close (struct inputfile *inf)
 
bool inf_at_eof (struct inputfile *inf)
 
const charinf_token (struct inputfile *inf, enum inf_token_type type)
 
int inf_discard_tokens (struct inputfile *inf, enum inf_token_type type)
 
charinf_log_str (struct inputfile *inf, const char *message,...) fc__attribute((__format__(__printf__
 

Macro Definition Documentation

◆ INF_TOK_FIRST

#define INF_TOK_FIRST   INF_TOK_SECTION_NAME

Definition at line 52 of file inputfile.h.

Typedef Documentation

◆ datafilename_fn_t

typedef const char *(* datafilename_fn_t) (const char *filename)

Definition at line 33 of file inputfile.h.

Enumeration Type Documentation

◆ inf_token_type

Enumerator
INF_TOK_SECTION_NAME 
INF_TOK_ENTRY_NAME 
INF_TOK_EOL 
INF_TOK_TABLE_START 
INF_TOK_TABLE_END 
INF_TOK_COMMA 
INF_TOK_VALUE 
INF_TOK_LAST 

Definition at line 42 of file inputfile.h.

Function Documentation

◆ inf_at_eof()

bool inf_at_eof ( struct inputfile inf)

Return TRUE if current pos is at end of file.

Definition at line 349 of file inputfile.c.

Referenced by secfile_from_input_file().

◆ inf_close()

void inf_close ( struct inputfile inf)

Close the file and free associated memory, included any partially recursed included files, and the memory allocated for 'inf' itself. Should only be used on an actually open inputfile. After this, the pointer should not be used.

Definition at line 303 of file inputfile.c.

Referenced by inf_close(), and secfile_from_input_file().

◆ inf_discard_tokens()

int inf_discard_tokens ( struct inputfile inf,
enum inf_token_type  type 
)

Read as many tokens of specified type as possible, discarding the results; returns number of such tokens read and discarded.

Definition at line 650 of file inputfile.c.

Referenced by secfile_from_input_file().

◆ inf_from_file()

struct inputfile * inf_from_file ( const char filename,
datafilename_fn_t  datafn 
)

Open the file, and return an allocated, initialized structure. Returns nullptr if the file could not be opened.

Definition at line 220 of file inputfile.c.

Referenced by check_include(), and secfile_load_section().

◆ inf_from_stream()

struct inputfile * inf_from_stream ( fz_FILE stream,
datafilename_fn_t  datafn 
)

Open the stream, and return an allocated, initialized structure. Returns nullptr if the file could not be opened.

Definition at line 244 of file inputfile.c.

Referenced by inf_from_file(), and secfile_from_stream().

◆ inf_log_str()

char * inf_log_str ( struct inputfile inf,
const char message,
  ... 
)

◆ inf_token()

const char * inf_token ( struct inputfile inf,
enum inf_token_type  type 
)

Returns token of given type from given inputfile.

Definition at line 611 of file inputfile.c.

Referenced by inf_discard_tokens(), and secfile_from_input_file().