OpenTTD
Data Structures | Functions | Variables
strgen_base.cpp File Reference

Tool to create computer readable (stand-alone) translation files. More...

#include "../stdafx.h"
#include "../core/endian_func.hpp"
#include "../string_func.h"
#include "../table/control_codes.h"
#include "strgen.h"
#include "../table/strgen_tables.h"
#include "../safeguards.h"

Go to the source code of this file.

Data Structures

struct  CmdPair
struct  ParsedCommandStruct
struct  Buffer
 The buffer for writing a single string. More...

Functions

static const CmdStructParseCommandString (const char **str, char *param, int *argno, int *casei)
size_t Utf8Validate (const char *s)
void EmitSingleChar (Buffer *buffer, char *buf, int value)
bool ParseRelNum (char **buf, int *value, int *offset)
char * ParseWord (char **buf)
static int TranslateArgumentIdx (int arg, int offset=0)
static void EmitWordList (Buffer *buffer, const char *const *words, uint nw)
void EmitPlural (Buffer *buffer, char *buf, int value)
void EmitGender (Buffer *buffer, char *buf, int value)
static const CmdStructFindCmd (const char *s, int len)
static uint ResolveCaseName (const char *str, size_t len)
static void ExtractCommandString (ParsedCommandStruct *p, const char *s, bool warnings)
static const CmdStructTranslateCmdForCompare (const CmdStruct *a)
static bool CheckCommandsMatch (char *a, char *b, const char *name)
static void rstrip (char *buf)
static void PutArgidxCommand (Buffer *buffer)
static void PutCommandString (Buffer *buffer, const char *str)

Variables

static bool _translated
 Whether the current language is not the master language.
static bool _translation
 Is the current file actually a translation or not.
const char * _file = "(unknown file)"
 The filename of the input, so we can refer to it in errors/warnings.
int _cur_line
 The current line we're parsing in the input file.
int _errors
int _warnings
int _show_todo
LanguagePackHeader _lang
 Header information about a language.
static const ptrdiff_t MAX_COMMAND_PARAM_SIZE = 100
 Maximum size of every command block, not counting the name of the command itself.
static const char * _cur_ident
static ParsedCommandStruct _cur_pcs
static int _cur_argidx

Detailed Description

Tool to create computer readable (stand-alone) translation files.

Definition in file strgen_base.cpp.