15 #include "../language.h" 23 Case(
int caseidx,
const char *
string,
Case *next);
37 LangString(
const char *name,
const char *english,
int index,
int line);
39 void FreeTranslation();
52 void FreeTranslation();
53 uint HashStr(
const char *s)
const;
56 uint VersionHashStr(uint hash,
const char *s)
const;
58 uint CountInUse(uint tab)
const;
70 void HandleString(
char *str);
78 virtual char *ReadLine(
char *buffer,
const char *last) = 0;
84 virtual void HandlePragma(
char *str);
89 virtual void ParseFile();
99 virtual void WriteStringID(
const char *name,
int stringid) = 0;
105 virtual void Finalise(
const StringData &data) = 0;
127 virtual void Write(
const byte *buffer,
size_t length) = 0;
132 virtual void Finalise() = 0;
137 virtual void WriteLength(uint length);
138 virtual void WriteLang(
const StringData &data);
141 void CDECL strgen_warning(
const char *s, ...) WARN_FORMAT(1, 2);
142 void CDECL strgen_error(
const char *s, ...) WARN_FORMAT(1, 2);
143 void NORETURN CDECL strgen_fatal(
const char *s, ...) WARN_FORMAT(1, 2);
144 char *ParseWord(
char **buf);
146 extern const char *
_file;
148 extern int _errors, _warnings, _show_todo;
size_t max_strings
The maximum number of strings.
Container for the different cases of a string.
virtual ~LanguageWriter()
Especially destroy the subclasses.
int _cur_line
The current line we're parsing in the input file.
bool master
Are we reading the master file?
char * translated
Translated text.
Information about the currently known strings.
~Case()
Free everything we allocated.
char * english
English text.
bool translation
Are we reading a translation, implies !master. However, the base translation will have this false...
LangString ** strings
Array of all known strings.
int caseidx
The index of the case.
Information about a single string.
char * name
Name of the string.
Case * next
The next, chained, case.
const char * file
The file we are reading.
LanguagePackHeader _lang
Header information about a language.
char * string
The translation of the case.
Case * translated_case
Cases of the translation.
const char * _file
The filename of the input, so we can refer to it in errors/warnings.
StringData & data
The data to fill during reading.
Base class for all language writers.
size_t tabs
The number of 'tabs' of strings.
uint16 * hash_heads
Hash table for the strings.
int next_string_id
The next string ID to allocate.
uint16 hash_next
Next hash entry.
int line
Line of string in source-file.
uint16 index
The index in the language file.
Helper for reading strings.
Case(int caseidx, const char *string, Case *next)
Create a new case.