|
@@ -214,49 +214,49 @@ uint StringData::CountInUse(uint tab) co
|
|
|
{
|
|
|
int i;
|
|
|
for (i = TAB_SIZE; --i >= 0;) if (this->strings[(tab * TAB_SIZE) + i] != NULL) break;
|
|
|
return i + 1;
|
|
|
}
|
|
|
|
|
|
static const char *_cur_ident;
|
|
|
|
|
|
struct CmdPair {
|
|
|
const CmdStruct *a;
|
|
|
const char *v;
|
|
|
};
|
|
|
|
|
|
struct ParsedCommandStruct {
|
|
|
uint np;
|
|
|
CmdPair pairs[32];
|
|
|
const CmdStruct *cmd[32]; // ordered by param #
|
|
|
};
|
|
|
|
|
|
/* Used when generating some advanced commands. */
|
|
|
static ParsedCommandStruct _cur_pcs;
|
|
|
static int _cur_argidx;
|
|
|
|
|
|
/** The buffer for writing a single string. */
|
|
|
struct Buffer : SmallVector<byte, 256> {
|
|
|
struct Buffer : std::vector<byte> {
|
|
|
/**
|
|
|
* Convenience method for adding a byte.
|
|
|
* @param value The value to add.
|
|
|
*/
|
|
|
void AppendByte(byte value)
|
|
|
{
|
|
|
this->push_back(value);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* Add an Unicode character encoded in UTF-8 to the buffer.
|
|
|
* @param value The character to add.
|
|
|
*/
|
|
|
void AppendUtf8(uint32 value)
|
|
|
{
|
|
|
if (value < 0x80) {
|
|
|
this->push_back(value);
|
|
|
} else if (value < 0x800) {
|
|
|
this->push_back(0xC0 + GB(value, 6, 5));
|
|
|
this->push_back(0x80 + GB(value, 0, 6));
|
|
|
} else if (value < 0x10000) {
|
|
|
this->push_back(0xE0 + GB(value, 12, 4));
|
|
|
this->push_back(0x80 + GB(value, 6, 6));
|
|
|
this->push_back(0x80 + GB(value, 0, 6));
|