Files
@ r19317:bb90f9299b07
Branch filter:
Location: cpp/openttd-patchpack/source/src/table/strgen_tables.h - annotation
r19317:bb90f9299b07
12.7 KiB
text/x-c
(svn r24220) -Change: Adopt ICU version detection to also deal with the new versioning scheme since ICU 49
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 | r11728:6ea57f11e4d4 r11728:6ea57f11e4d4 r12768:980ae0491352 r12768:980ae0491352 r12768:980ae0491352 r12768:980ae0491352 r12768:980ae0491352 r12768:980ae0491352 r12768:980ae0491352 r11728:6ea57f11e4d4 r11728:6ea57f11e4d4 r11728:6ea57f11e4d4 r11728:6ea57f11e4d4 r11728:6ea57f11e4d4 r14592:4ad80b2e3423 r14592:4ad80b2e3423 r14592:4ad80b2e3423 r14592:4ad80b2e3423 r11728:6ea57f11e4d4 r14900:c679fdaeebe6 r11728:6ea57f11e4d4 r18710:759428ffd8c8 r18710:759428ffd8c8 r11728:6ea57f11e4d4 r11728:6ea57f11e4d4 r11728:6ea57f11e4d4 r11728:6ea57f11e4d4 r11728:6ea57f11e4d4 r11728:6ea57f11e4d4 r11728:6ea57f11e4d4 r11728:6ea57f11e4d4 r11728:6ea57f11e4d4 r18718:5bbab0953a81 r18718:5bbab0953a81 r18718:5bbab0953a81 r11728:6ea57f11e4d4 r11728:6ea57f11e4d4 r11728:6ea57f11e4d4 r18417:d063e7cb7d51 r18417:d063e7cb7d51 r11728:6ea57f11e4d4 r18669:0e60752c306f r18417:d063e7cb7d51 r18417:d063e7cb7d51 r18417:d063e7cb7d51 r18417:d063e7cb7d51 r18417:d063e7cb7d51 r18417:d063e7cb7d51 r18417:d063e7cb7d51 r18417:d063e7cb7d51 r18417:d063e7cb7d51 r18417:d063e7cb7d51 r18417:d063e7cb7d51 r18417:d063e7cb7d51 r18417:d063e7cb7d51 r18417:d063e7cb7d51 r18417:d063e7cb7d51 r18417:d063e7cb7d51 r18417:d063e7cb7d51 r11728:6ea57f11e4d4 r18417:d063e7cb7d51 r11728:6ea57f11e4d4 r18417:d063e7cb7d51 r18417:d063e7cb7d51 r18417:d063e7cb7d51 r18417:d063e7cb7d51 r18417:d063e7cb7d51 r18941:8b8e5486e2f8 r18941:8b8e5486e2f8 r11728:6ea57f11e4d4 r18417:d063e7cb7d51 r18417:d063e7cb7d51 r18417:d063e7cb7d51 r18417:d063e7cb7d51 r18443:ceff9a227677 r19142:e5c38d8d6bba r18417:d063e7cb7d51 r18417:d063e7cb7d51 r18417:d063e7cb7d51 r18417:d063e7cb7d51 r18417:d063e7cb7d51 r18417:d063e7cb7d51 r18417:d063e7cb7d51 r18417:d063e7cb7d51 r11728:6ea57f11e4d4 r18417:d063e7cb7d51 r18417:d063e7cb7d51 r11728:6ea57f11e4d4 r18417:d063e7cb7d51 r18417:d063e7cb7d51 r18417:d063e7cb7d51 r18417:d063e7cb7d51 r11728:6ea57f11e4d4 r18417:d063e7cb7d51 r18417:d063e7cb7d51 r11728:6ea57f11e4d4 r11728:6ea57f11e4d4 r18417:d063e7cb7d51 r18417:d063e7cb7d51 r18417:d063e7cb7d51 r18417:d063e7cb7d51 r18417:d063e7cb7d51 r18417:d063e7cb7d51 r11728:6ea57f11e4d4 r18417:d063e7cb7d51 r18417:d063e7cb7d51 r11728:6ea57f11e4d4 r18417:d063e7cb7d51 r18417:d063e7cb7d51 r18417:d063e7cb7d51 r18417:d063e7cb7d51 r18417:d063e7cb7d51 r18417:d063e7cb7d51 r18417:d063e7cb7d51 r18417:d063e7cb7d51 r18417:d063e7cb7d51 r18417:d063e7cb7d51 r18417:d063e7cb7d51 r11728:6ea57f11e4d4 r18417:d063e7cb7d51 r18417:d063e7cb7d51 r18417:d063e7cb7d51 r18417:d063e7cb7d51 r18417:d063e7cb7d51 r18417:d063e7cb7d51 r18417:d063e7cb7d51 r18417:d063e7cb7d51 r18417:d063e7cb7d51 r18417:d063e7cb7d51 r18417:d063e7cb7d51 r18417:d063e7cb7d51 r18417:d063e7cb7d51 r18417:d063e7cb7d51 r18417:d063e7cb7d51 r18417:d063e7cb7d51 r18417:d063e7cb7d51 r18417:d063e7cb7d51 r18417:d063e7cb7d51 r18417:d063e7cb7d51 r18417:d063e7cb7d51 r18417:d063e7cb7d51 r18417:d063e7cb7d51 r11728:6ea57f11e4d4 r11728:6ea57f11e4d4 r11728:6ea57f11e4d4 r18417:d063e7cb7d51 r18417:d063e7cb7d51 r18417:d063e7cb7d51 r18417:d063e7cb7d51 r18417:d063e7cb7d51 r18417:d063e7cb7d51 r18417:d063e7cb7d51 r11728:6ea57f11e4d4 r11728:6ea57f11e4d4 r11728:6ea57f11e4d4 r11728:6ea57f11e4d4 r11728:6ea57f11e4d4 r11728:6ea57f11e4d4 r11728:6ea57f11e4d4 r11728:6ea57f11e4d4 r11728:6ea57f11e4d4 r11728:6ea57f11e4d4 r11728:6ea57f11e4d4 r11728:6ea57f11e4d4 r11728:6ea57f11e4d4 r11728:6ea57f11e4d4 r15023:b5ed4df055c0 r11728:6ea57f11e4d4 r11728:6ea57f11e4d4 r11728:6ea57f11e4d4 r11728:6ea57f11e4d4 r11728:6ea57f11e4d4 r11728:6ea57f11e4d4 r12372:db29caf51ece r15023:b5ed4df055c0 r11728:6ea57f11e4d4 r11750:95be9306ca47 r11750:95be9306ca47 r11750:95be9306ca47 r11750:95be9306ca47 r11750:95be9306ca47 r11750:95be9306ca47 r11750:95be9306ca47 r11750:95be9306ca47 r11750:95be9306ca47 r11750:95be9306ca47 r11750:95be9306ca47 r11750:95be9306ca47 r11750:95be9306ca47 r11750:95be9306ca47 r13086:71e929261037 r11750:95be9306ca47 r11750:95be9306ca47 r11750:95be9306ca47 r11750:95be9306ca47 r11750:95be9306ca47 r11750:95be9306ca47 r11750:95be9306ca47 r11750:95be9306ca47 r12687:28f71c3eb732 r11750:95be9306ca47 r11750:95be9306ca47 r11750:95be9306ca47 r11750:95be9306ca47 r11750:95be9306ca47 | /* $Id$ */
/*
* This file is part of OpenTTD.
* OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
* OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
*/
/** @file table/strgen_tables.h Tables of commands for strgen */
#include "../core/enum_type.hpp"
enum CmdFlags {
C_NONE = 0x0, ///< Nothing special about this command
C_DONTCOUNT = 0x1, ///< These commands aren't counted for comparison
C_CASE = 0x2, ///< These commands support cases
C_GENDER = 0x4, ///< These commands support genders
};
DECLARE_ENUM_AS_BIT_SET(CmdFlags)
struct Buffer;
typedef void (*ParseCmdProc)(Buffer *buffer, char *buf, int value);
struct CmdStruct {
const char *cmd;
ParseCmdProc proc;
long value;
uint8 consumes;
CmdFlags flags;
};
extern void EmitSingleChar(Buffer *buffer, char *buf, int value);
extern void EmitPlural(Buffer *buffer, char *buf, int value);
extern void EmitGender(Buffer *buffer, char *buf, int value);
static const CmdStruct _cmd_structs[] = {
/* Font size */
{"TINY_FONT", EmitSingleChar, SCC_TINYFONT, 0, C_NONE},
{"BIG_FONT", EmitSingleChar, SCC_BIGFONT, 0, C_NONE},
/* Colours */
{"BLUE", EmitSingleChar, SCC_BLUE, 0, C_NONE},
{"SILVER", EmitSingleChar, SCC_SILVER, 0, C_NONE},
{"GOLD", EmitSingleChar, SCC_GOLD, 0, C_NONE},
{"RED", EmitSingleChar, SCC_RED, 0, C_NONE},
{"PURPLE", EmitSingleChar, SCC_PURPLE, 0, C_NONE},
{"LTBROWN", EmitSingleChar, SCC_LTBROWN, 0, C_NONE},
{"ORANGE", EmitSingleChar, SCC_ORANGE, 0, C_NONE},
{"GREEN", EmitSingleChar, SCC_GREEN, 0, C_NONE},
{"YELLOW", EmitSingleChar, SCC_YELLOW, 0, C_NONE},
{"DKGREEN", EmitSingleChar, SCC_DKGREEN, 0, C_NONE},
{"CREAM", EmitSingleChar, SCC_CREAM, 0, C_NONE},
{"BROWN", EmitSingleChar, SCC_BROWN, 0, C_NONE},
{"WHITE", EmitSingleChar, SCC_WHITE, 0, C_NONE},
{"LTBLUE", EmitSingleChar, SCC_LTBLUE, 0, C_NONE},
{"GRAY", EmitSingleChar, SCC_GRAY, 0, C_NONE},
{"DKBLUE", EmitSingleChar, SCC_DKBLUE, 0, C_NONE},
{"BLACK", EmitSingleChar, SCC_BLACK, 0, C_NONE},
{"REV", EmitSingleChar, SCC_REVISION, 0, C_NONE}, // openttd revision string
{"STRING1", EmitSingleChar, SCC_STRING1, 2, C_CASE | C_GENDER}, // included string that consumes the string id and ONE argument
{"STRING2", EmitSingleChar, SCC_STRING2, 3, C_CASE | C_GENDER}, // included string that consumes the string id and TWO arguments
{"STRING3", EmitSingleChar, SCC_STRING3, 4, C_CASE | C_GENDER}, // included string that consumes the string id and THREE arguments
{"STRING4", EmitSingleChar, SCC_STRING4, 5, C_CASE | C_GENDER}, // included string that consumes the string id and FOUR arguments
{"STRING5", EmitSingleChar, SCC_STRING5, 6, C_CASE | C_GENDER}, // included string that consumes the string id and FIVE arguments
{"STRING6", EmitSingleChar, SCC_STRING6, 7, C_CASE | C_GENDER}, // included string that consumes the string id and SIX arguments
{"STRING7", EmitSingleChar, SCC_STRING7, 8, C_CASE | C_GENDER}, // included string that consumes the string id and SEVEN arguments
{"STATION_FEATURES", EmitSingleChar, SCC_STATION_FEATURES, 1, C_NONE}, // station features string, icons of the features
{"INDUSTRY", EmitSingleChar, SCC_INDUSTRY_NAME, 1, C_CASE | C_GENDER}, // industry, takes an industry #, can have cases
{"CARGO_LONG", EmitSingleChar, SCC_CARGO_LONG, 2, C_NONE | C_GENDER},
{"CARGO_SHORT", EmitSingleChar, SCC_CARGO_SHORT, 2, C_NONE}, // short cargo description, only ### tons, or ### litres
{"CARGO_TINY", EmitSingleChar, SCC_CARGO_TINY, 2, C_NONE}, // tiny cargo description with only the amount, not a specifier for the amount or the actual cargo name
{"CARGO_LIST", EmitSingleChar, SCC_CARGO_LIST, 1, C_CASE},
{"POWER", EmitSingleChar, SCC_POWER, 1, C_NONE},
{"VOLUME_LONG", EmitSingleChar, SCC_VOLUME_LONG, 1, C_NONE},
{"VOLUME_SHORT", EmitSingleChar, SCC_VOLUME_SHORT, 1, C_NONE},
{"WEIGHT_LONG", EmitSingleChar, SCC_WEIGHT_LONG, 1, C_NONE},
{"WEIGHT_SHORT", EmitSingleChar, SCC_WEIGHT_SHORT, 1, C_NONE},
{"FORCE", EmitSingleChar, SCC_FORCE, 1, C_NONE},
{"VELOCITY", EmitSingleChar, SCC_VELOCITY, 1, C_NONE},
{"HEIGHT", EmitSingleChar, SCC_HEIGHT, 1, C_NONE},
{"P", EmitPlural, 0, 0, C_DONTCOUNT}, // plural specifier
{"G", EmitGender, 0, 0, C_DONTCOUNT}, // gender specifier
{"DATE_TINY", EmitSingleChar, SCC_DATE_TINY, 1, C_NONE},
{"DATE_SHORT", EmitSingleChar, SCC_DATE_SHORT, 1, C_CASE},
{"DATE_LONG", EmitSingleChar, SCC_DATE_LONG, 1, C_CASE},
{"DATE_ISO", EmitSingleChar, SCC_DATE_ISO, 1, C_NONE},
{"STRING", EmitSingleChar, SCC_STRING, 1, C_CASE | C_GENDER},
{"RAW_STRING", EmitSingleChar, SCC_RAW_STRING_POINTER, 1, C_NONE | C_GENDER},
/* Numbers */
{"COMMA", EmitSingleChar, SCC_COMMA, 1, C_NONE}, // Number with comma
{"DECIMAL", EmitSingleChar, SCC_DECIMAL, 2, C_NONE}, // Number with comma and fractional part. Second parameter is number of fractional digits, first parameter is number times 10**(second parameter).
{"NUM", EmitSingleChar, SCC_NUM, 1, C_NONE}, // Signed number
{"ZEROFILL_NUM", EmitSingleChar, SCC_ZEROFILL_NUM, 2, C_NONE}, // Unsigned number with zero fill, e.g. "02". First parameter is number, second minimum length
{"BYTES", EmitSingleChar, SCC_BYTES, 1, C_NONE}, // Unsigned number with "bytes", i.e. "1.02 MiB or 123 KiB"
{"HEX", EmitSingleChar, SCC_HEX, 1, C_NONE}, // Hexadecimally printed number
{"CURRENCY_LONG", EmitSingleChar, SCC_CURRENCY_LONG, 1, C_NONE},
{"CURRENCY_SHORT", EmitSingleChar, SCC_CURRENCY_SHORT, 1, C_NONE}, // compact currency
{"WAYPOINT", EmitSingleChar, SCC_WAYPOINT_NAME, 1, C_NONE | C_GENDER}, // waypoint name
{"STATION", EmitSingleChar, SCC_STATION_NAME, 1, C_NONE | C_GENDER},
{"DEPOT", EmitSingleChar, SCC_DEPOT_NAME, 2, C_NONE | C_GENDER},
{"TOWN", EmitSingleChar, SCC_TOWN_NAME, 1, C_NONE | C_GENDER},
{"GROUP", EmitSingleChar, SCC_GROUP_NAME, 1, C_NONE | C_GENDER},
{"SIGN", EmitSingleChar, SCC_SIGN_NAME, 1, C_NONE | C_GENDER},
{"ENGINE", EmitSingleChar, SCC_ENGINE_NAME, 1, C_NONE | C_GENDER},
{"VEHICLE", EmitSingleChar, SCC_VEHICLE_NAME, 1, C_NONE | C_GENDER},
{"COMPANY", EmitSingleChar, SCC_COMPANY_NAME, 1, C_NONE | C_GENDER},
{"COMPANY_NUM", EmitSingleChar, SCC_COMPANY_NUM, 1, C_NONE},
{"PRESIDENT_NAME", EmitSingleChar, SCC_PRESIDENT_NAME, 1, C_NONE | C_GENDER},
{"", EmitSingleChar, '\n', 0, C_DONTCOUNT},
{"{", EmitSingleChar, '{', 0, C_DONTCOUNT},
{"UP_ARROW", EmitSingleChar, SCC_UP_ARROW, 0, C_DONTCOUNT},
{"SMALL_UP_ARROW", EmitSingleChar, SCC_SMALL_UP_ARROW, 0, C_DONTCOUNT},
{"SMALL_DOWN_ARROW", EmitSingleChar, SCC_SMALL_DOWN_ARROW, 0, C_DONTCOUNT},
{"TRAIN", EmitSingleChar, SCC_TRAIN, 0, C_DONTCOUNT},
{"LORRY", EmitSingleChar, SCC_LORRY, 0, C_DONTCOUNT},
{"BUS", EmitSingleChar, SCC_BUS, 0, C_DONTCOUNT},
{"PLANE", EmitSingleChar, SCC_PLANE, 0, C_DONTCOUNT},
{"SHIP", EmitSingleChar, SCC_SHIP, 0, C_DONTCOUNT},
{"NBSP", EmitSingleChar, 0xA0, 0, C_DONTCOUNT},
{"CENT", EmitSingleChar, 0xA2, 0, C_DONTCOUNT},
{"POUND_SIGN", EmitSingleChar, 0xA3, 0, C_DONTCOUNT},
{"EURO", EmitSingleChar, 0x20AC, 0, C_DONTCOUNT},
{"YEN_SIGN", EmitSingleChar, 0xA5, 0, C_DONTCOUNT},
{"COPYRIGHT", EmitSingleChar, 0xA9, 0, C_DONTCOUNT},
{"DOWN_ARROW", EmitSingleChar, SCC_DOWN_ARROW, 0, C_DONTCOUNT},
{"CHECKMARK", EmitSingleChar, SCC_CHECKMARK, 0, C_DONTCOUNT},
{"CROSS", EmitSingleChar, SCC_CROSS, 0, C_DONTCOUNT},
{"REGISTERED", EmitSingleChar, 0xAE, 0, C_DONTCOUNT},
{"RIGHT_ARROW", EmitSingleChar, SCC_RIGHT_ARROW, 0, C_DONTCOUNT},
{"SMALL_LEFT_ARROW", EmitSingleChar, SCC_LESS_THAN, 0, C_DONTCOUNT},
{"SMALL_RIGHT_ARROW", EmitSingleChar, SCC_GREATER_THAN, 0, C_DONTCOUNT},
/* The following are directional formatting codes used to get the RTL strings right:
* http://www.unicode.org/unicode/reports/tr9/#Directional_Formatting_Codes */
{"LRM", EmitSingleChar, CHAR_TD_LRM, 0, C_DONTCOUNT},
{"RLM", EmitSingleChar, CHAR_TD_RLM, 0, C_DONTCOUNT},
{"LRE", EmitSingleChar, CHAR_TD_LRE, 0, C_DONTCOUNT},
{"RLE", EmitSingleChar, CHAR_TD_RLE, 0, C_DONTCOUNT},
{"LRO", EmitSingleChar, CHAR_TD_LRO, 0, C_DONTCOUNT},
{"RLO", EmitSingleChar, CHAR_TD_RLO, 0, C_DONTCOUNT},
{"PDF", EmitSingleChar, CHAR_TD_PDF, 0, C_DONTCOUNT},
};
/** Description of a plural form */
struct PluralForm {
int plural_count; ///< The number of plural forms
const char *description; ///< Human readable description of the form
};
/** All plural forms used */
static const PluralForm _plural_forms[] = {
{ 2, "Two forms, singular used for 1 only" },
{ 1, "Only one form" },
{ 2, "Two forms, singular used for zero and 1" },
{ 3, "Three forms, special case for 0 and ending in 1, except those ending in 11" },
{ 5, "Five forms, special case for one, two, 3 to 6 and 7 to 10" },
{ 3, "Three forms, special case for numbers ending in 1[2-9]" },
{ 3, "Three forms, special cases for numbers ending in 1 and 2, 3, 4, except those ending in 1[1-4]" },
{ 3, "Three forms, special case for 1 and some numbers ending in 2, 3, or 4" },
{ 4, "Four forms, special case for 1 and all numbers ending in 02, 03, or 04" },
{ 2, "Two forms, singular used for everything ending in 1 but not in 11" },
{ 3, "Three forms, special case for 1 and 2, 3, or 4" },
{ 2, "Two forms, cases for numbers ending with a consonant and with a vowel" },
{ 4, "Four forms: one, 0 and everything ending in 02..10, everything ending in 11..19" },
};
/* Flags:
* 0 = nothing
* t = translator editable
* l = ltr/rtl choice
* p = plural choice
* d = separator char (replace spaces with {NBSP})
* x1 = hexadecimal number of 1 byte
* x2 = hexadecimal number of 2 bytes
* g = gender
* c = cases
* a = array, i.e. list of strings
*/
/** All pragmas used */
static const char * const _pragmas[][4] = {
/* name flags default description */
{ "name", "0", "", "English name for the language" },
{ "ownname", "t", "", "Localised name for the language" },
{ "isocode", "0", "", "ISO code for the language" },
{ "plural", "tp", "0", "Plural form to use" },
{ "textdir", "tl", "ltr", "Text direction. Either ltr (left-to-right) or rtl (right-to-left)" },
{ "digitsep", "td", ",", "Digit grouping separator for non-currency numbers" },
{ "digitsepcur", "td", ",", "Digit grouping seprarator for currency numbers" },
{ "decimalsep", "td", ".", "Decimal separator" },
{ "winlangid", "x2", "0x0000", "Language ID for Windows" },
{ "grflangid", "x1", "0x00", "Language ID for NewGRFs" },
{ "gender", "tag", "", "List of genders" },
{ "case", "tac", "", "List of cases" },
};
|