#include "../stdafx.h"
#include "../core/alloc_func.hpp"
#include "../core/endian_func.hpp"
#include "../string_func.h"
#include "../strings_type.h"
#include "strgen.h"
#include "../table/control_codes.h"
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <stdarg.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
Go to the source code of this file.
Data Structures | |
struct | CmdStruct |
struct | Case |
struct | LangString |
struct | CmdPair |
struct | ParsedCommandStruct |
Defines | |
#define | HASH_SIZE 32767 |
#define | MAX_NUM_GENDER 8 |
#define | MAX_NUM_CASES 50 |
#define | LINE_NUM_FMT ":%d" |
Typedefs | |
typedef void(* | ParseCmdProc )(char *buf, int value) |
Enumerations | |
enum | { C_DONTCOUNT = 1, C_CASE = 2 } |
Functions | |
static uint | HashStr (const char *s) |
static void | HashAdd (const char *s, LangString *ls) |
static LangString * | HashFind (const char *s) |
static void CDECL | strgen_warning (const char *s,...) |
static void CDECL | strgen_error (const char *s,...) |
void NORETURN CDECL | error (const char *s,...) |
Error handling for fatal non-user errors. | |
static void | PutByte (byte c) |
static void | PutUtf8 (uint32 value) |
size_t | Utf8Validate (const char *s) |
static void | EmitSingleChar (char *buf, int value) |
static void | EmitSetX (char *buf, int value) |
static void | EmitSetXY (char *buf, int value) |
bool | ParseRelNum (char **buf, int *value) |
char * | ParseWord (char **buf) |
static int | TranslateArgumentIdx (int arg) |
static void | EmitWordList (const char *const *words, uint nw) |
static void | EmitPlural (char *buf, int value) |
static void | EmitGender (char *buf, int value) |
static const CmdStruct * | FindCmd (const char *s, int len) |
static uint | ResolveCaseName (const char *str, uint len) |
static const CmdStruct * | ParseCommandString (const char **str, char *param, int *argno, int *casei) |
static void | HandlePragma (char *str) |
static void | ExtractCommandString (ParsedCommandStruct *p, const char *s, bool warnings) |
static const CmdStruct * | TranslateCmdForCompare (const CmdStruct *a) |
static bool | CheckCommandsMatch (char *a, char *b, const char *name) |
static void | HandleString (char *str, bool master) |
static void | rstrip (char *buf) |
static void | ParseFile (const char *file, bool english) |
static uint32 | MyHashStr (uint32 hash, const char *s) |
static void | MakeHashOfStrings () |
static uint | CountInUse (uint grp) |
bool | CompareFiles (const char *n1, const char *n2) |
static void | WriteStringsH (const char *filename) |
static void | PutArgidxCommand () |
static void | PutCommandString (const char *str) |
static void | WriteLength (FILE *f, uint length) |
static void | WriteLangfile (const char *filename) |
static void | ottd_mkdir (const char *directory) |
Multi-OS mkdirectory function. | |
static char * | mkpath (char *buf, size_t buflen, const char *path, const char *file) |
Create a path consisting of an already existing path, a possible path seperator and the filename. | |
static char * | replace_pathsep (char *s) |
int CDECL | main (int argc, char *argv[]) |
Variables | |
static bool | _masterlang |
static bool | _translated |
static const char * | _file = "(unknown file)" |
static int | _cur_line |
static int | _errors |
static int | _warnings |
static int | _show_todo |
static LangString * | _strings [65536] |
static uint16 | _hash_head [HASH_SIZE] |
static byte | _put_buf [4096] |
static int | _put_pos |
static int | _next_string_id |
static uint32 | _hash |
static char | _lang_name [32] |
static char | _lang_ownname [32] |
static char | _lang_isocode [16] |
static byte | _lang_pluralform |
static byte | _lang_textdir |
static uint16 | _lang_winlangid |
static char | _genders [MAX_NUM_GENDER][16] |
static uint | _numgenders |
static char | _cases [MAX_NUM_CASES][16] |
static uint | _numcases |
static const byte | _plural_form_counts [] = { 2, 1, 2, 3, 3, 3, 3, 3, 4, 2 } |
static const char * | _cur_ident |
static ParsedCommandStruct | _cur_pcs |
static int | _cur_argidx |
static const CmdStruct | _cmd_structs [] |
Definition in file strgen.cpp.
void NORETURN CDECL error | ( | const char * | s, | |
... | ||||
) |
Error handling for fatal non-user errors.
s | the string to print. |
Definition at line 175 of file strgen.cpp.
static char* mkpath | ( | char * | buf, | |
size_t | buflen, | |||
const char * | path, | |||
const char * | file | |||
) | [inline, static] |
Create a path consisting of an already existing path, a possible path seperator and the filename.
The seperator is only appended if the path does not already end with a seperator
Definition at line 1287 of file strgen.cpp.
References ttd_strlcpy().