[Complex Test Layouts] Change String to use UTF-32 encoding on all platforms.

This commit is contained in:
bruvzg
2020-07-27 13:43:20 +03:00
parent 87f2ca7d57
commit 87f5ff9391
3 changed files with 34 additions and 34 deletions

View File

@@ -1060,7 +1060,7 @@ void VisualScriptBuiltinFunc::exec_func(BuiltinFunc p_func, const Variant **p_in
} break; } break;
case VisualScriptBuiltinFunc::TEXT_CHAR: { case VisualScriptBuiltinFunc::TEXT_CHAR: {
CharType result[2] = { *p_inputs[0], 0 }; char32_t result[2] = { *p_inputs[0], 0 };
*r_return = String(result); *r_return = String(result);

View File

@@ -187,7 +187,7 @@ Error VisualScriptExpression::_get_token(Token &r_token) {
while (true) { while (true) {
#define GET_CHAR() (str_ofs >= expression.length() ? 0 : expression[str_ofs++]) #define GET_CHAR() (str_ofs >= expression.length() ? 0 : expression[str_ofs++])
CharType cchar = GET_CHAR(); char32_t cchar = GET_CHAR();
if (cchar == 0) { if (cchar == 0) {
r_token.type = TK_EOF; r_token.type = TK_EOF;
return OK; return OK;
@@ -329,7 +329,7 @@ Error VisualScriptExpression::_get_token(Token &r_token) {
case '"': { case '"': {
String str; String str;
while (true) { while (true) {
CharType ch = GET_CHAR(); char32_t ch = GET_CHAR();
if (ch == 0) { if (ch == 0) {
_set_error("Unterminated String"); _set_error("Unterminated String");
@@ -340,13 +340,13 @@ Error VisualScriptExpression::_get_token(Token &r_token) {
} else if (ch == '\\') { } else if (ch == '\\') {
//escaped characters... //escaped characters...
CharType next = GET_CHAR(); char32_t next = GET_CHAR();
if (next == 0) { if (next == 0) {
_set_error("Unterminated String"); _set_error("Unterminated String");
r_token.type = TK_ERROR; r_token.type = TK_ERROR;
return ERR_PARSE_ERROR; return ERR_PARSE_ERROR;
} }
CharType res = 0; char32_t res = 0;
switch (next) { switch (next) {
case 'b': case 'b':
@@ -367,7 +367,7 @@ Error VisualScriptExpression::_get_token(Token &r_token) {
case 'u': { case 'u': {
// hex number // hex number
for (int j = 0; j < 4; j++) { for (int j = 0; j < 4; j++) {
CharType c = GET_CHAR(); char32_t c = GET_CHAR();
if (c == 0) { if (c == 0) {
_set_error("Unterminated String"); _set_error("Unterminated String");
@@ -379,7 +379,7 @@ Error VisualScriptExpression::_get_token(Token &r_token) {
r_token.type = TK_ERROR; r_token.type = TK_ERROR;
return ERR_PARSE_ERROR; return ERR_PARSE_ERROR;
} }
CharType v; char32_t v;
if (c >= '0' && c <= '9') { if (c >= '0' && c <= '9') {
v = c - '0'; v = c - '0';
} else if (c >= 'a' && c <= 'f') { } else if (c >= 'a' && c <= 'f') {
@@ -431,7 +431,7 @@ Error VisualScriptExpression::_get_token(Token &r_token) {
#define READING_DONE 4 #define READING_DONE 4
int reading = READING_INT; int reading = READING_INT;
CharType c = cchar; char32_t c = cchar;
bool exp_sign = false; bool exp_sign = false;
bool exp_beg = false; bool exp_beg = false;
bool is_float = false; bool is_float = false;

View File

@@ -933,36 +933,36 @@ static const char *op_names[] = {
}; };
String VisualScriptOperator::get_caption() const { String VisualScriptOperator::get_caption() const {
static const wchar_t *op_names[] = { static const char32_t *op_names[] = {
//comparison //comparison
L"A = B", //OP_EQUAL, U"A = B", //OP_EQUAL,
L"A \u2260 B", //OP_NOT_EQUAL, U"A \u2260 B", //OP_NOT_EQUAL,
L"A < B", //OP_LESS, U"A < B", //OP_LESS,
L"A \u2264 B", //OP_LESS_EQUAL, U"A \u2264 B", //OP_LESS_EQUAL,
L"A > B", //OP_GREATER, U"A > B", //OP_GREATER,
L"A \u2265 B", //OP_GREATER_EQUAL, U"A \u2265 B", //OP_GREATER_EQUAL,
//mathematic //mathematic
L"A + B", //OP_ADD, U"A + B", //OP_ADD,
L"A - B", //OP_SUBTRACT, U"A - B", //OP_SUBTRACT,
L"A \u00D7 B", //OP_MULTIPLY, U"A \u00D7 B", //OP_MULTIPLY,
L"A \u00F7 B", //OP_DIVIDE, U"A \u00F7 B", //OP_DIVIDE,
L"\u00AC A", //OP_NEGATE, U"\u00AC A", //OP_NEGATE,
L"+ A", //OP_POSITIVE, U"+ A", //OP_POSITIVE,
L"A mod B", //OP_MODULE, U"A mod B", //OP_MODULE,
L"A .. B", //OP_STRING_CONCAT, U"A .. B", //OP_STRING_CONCAT,
//bitwise //bitwise
L"A << B", //OP_SHIFT_LEFT, U"A << B", //OP_SHIFT_LEFT,
L"A >> B", //OP_SHIFT_RIGHT, U"A >> B", //OP_SHIFT_RIGHT,
L"A & B", //OP_BIT_AND, U"A & B", //OP_BIT_AND,
L"A | B", //OP_BIT_OR, U"A | B", //OP_BIT_OR,
L"A ^ B", //OP_BIT_XOR, U"A ^ B", //OP_BIT_XOR,
L"~A", //OP_BIT_NEGATE, U"~A", //OP_BIT_NEGATE,
//logic //logic
L"A and B", //OP_AND, U"A and B", //OP_AND,
L"A or B", //OP_OR, U"A or B", //OP_OR,
L"A xor B", //OP_XOR, U"A xor B", //OP_XOR,
L"not A", //OP_NOT, U"not A", //OP_NOT,
L"A in B", //OP_IN, U"A in B", //OP_IN,
}; };
return op_names[op]; return op_names[op];