Freeciv-3.1: /fast/freeciv/nightly/S3_1/utility/inputfile.h File Reference

Freeciv-3.1

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 inputfile * | inf_from_file (const char *filename, datafilename_fn_t datafn)
struct inputfile * | inf_from_stream (fz_FILE *stream, datafilename_fn_t datafn)
void | inf_close (struct inputfile *inf)
bool | inf_at_eof (struct inputfile *inf)
const char * | inf_token (struct inputfile *inf, enum inf_token_type type)
int | inf_discard_tokens (struct inputfile *inf, enum inf_token_type type)
char * | inf_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

enum 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 346 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 300 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 645 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 NULL if the file could not be opened.

Definition at line 219 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 NULL if the file could not be opened.

Definition at line 241 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 607 of file inputfile.c.

Referenced by inf_discard_tokens(), and secfile_from_input_file().