strgen: Split non-upstream english.txt strings into separate file
This commit is contained in:
@@ -12,6 +12,10 @@
|
||||
|
||||
#include "../language.h"
|
||||
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
/** Container for the different cases of a string. */
|
||||
struct Case {
|
||||
int caseidx; ///< The index of the case.
|
||||
@@ -27,12 +31,14 @@ struct LangString {
|
||||
char *name; ///< Name of the string.
|
||||
char *english; ///< English text.
|
||||
char *translated; ///< Translated text.
|
||||
size_t hash_next; ///< Next hash entry.
|
||||
size_t index; ///< The index in the language file.
|
||||
LangString *hash_next; ///< Next hash entry.
|
||||
int index; ///< The index in the language file.
|
||||
int line; ///< Line of string in source-file.
|
||||
Case *translated_case; ///< Cases of the translation.
|
||||
std::unique_ptr<LangString> chain_next;
|
||||
|
||||
LangString(const char *name, const char *english, size_t index, int line);
|
||||
void ReplaceDefinition(const char *name, const char *english, int line);
|
||||
~LangString();
|
||||
void FreeTranslation();
|
||||
};
|
||||
@@ -40,10 +46,14 @@ struct LangString {
|
||||
/** Information about the currently known strings. */
|
||||
struct StringData {
|
||||
LangString **strings; ///< Array of all known strings.
|
||||
size_t *hash_heads; ///< Hash table for the strings.
|
||||
LangString **hash_heads; ///< Hash table for the strings.
|
||||
size_t tabs; ///< The number of 'tabs' of strings.
|
||||
size_t max_strings; ///< The maximum number of strings.
|
||||
size_t next_string_id;///< The next string ID to allocate.
|
||||
int next_string_id; ///< The next string ID to allocate.
|
||||
|
||||
std::vector<std::unique_ptr<LangString>> string_store;
|
||||
LangString *insert_after = nullptr;
|
||||
bool override_mode = false;
|
||||
|
||||
StringData(size_t tabs);
|
||||
~StringData();
|
||||
@@ -59,7 +69,7 @@ struct StringData {
|
||||
/** Helper for reading strings. */
|
||||
struct StringReader {
|
||||
StringData &data; ///< The data to fill during reading.
|
||||
const char *file; ///< The file we are reading.
|
||||
std::string file; ///< The file we are reading.
|
||||
bool master; ///< Are we reading the master file?
|
||||
bool translation; ///< Are we reading a translation, implies !master. However, the base translation will have this false.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user