Add (u)short #7

Merged
TheBrokenRail merged 2 commits from :short into master 2024-01-21 23:47:06 +00:00
4 changed files with 10 additions and 1 deletions
Showing only changes of commit 6b4d6d9239 - Show all commits

View File

@ -154,6 +154,7 @@ function makeMainHeader(output: string) {
result += '#pragma GCC diagnostic ignored "-Wunused-function"\n';
result += '\n// Shortcuts\n';
result += 'typedef unsigned char uchar;\n';
result += 'typedef unsigned short ushort;\n';
result += 'typedef unsigned int uint;\n';
result += '\n// Forward Declarations\n';
for (const name in STRUCTURE_FILES) {

View File

@ -52,6 +52,9 @@ export class SimpleProperty implements Property {
} else if (this.#type === 'char' || this.#type === 'uchar') {
// Character
return 1;
} else if (this.#type === 'short' || this.#type === 'ushort') {
// Short
return 2;
} else if (this.#type.startsWith('std::vector<')) {
// C++ Vector
return 12;
@ -82,6 +85,9 @@ export class SimpleProperty implements Property {
} else if (this.#type === 'char' || this.#type === 'uchar') {
// Character
return 1;
} else if (this.#type === 'short' || this.#type === 'ushort') {
// Short
return 1;
bigjango13 marked this conversation as resolved Outdated

This should be 2. You can determine alignment by adding ERR("Alignment: %i", _Alignof(short)); to a file.

This should be `2`. You can determine alignment by adding `ERR("Alignment: %i", _Alignof(short));` to a file.

Whoops, I forgot to change that one, should be fixed now, odd that it didn't give me any errors.

Whoops, I forgot to change that one, should be fixed now, odd that it didn't give me any errors.
} else if (this.#type.startsWith('std::vector<')) {
// C++ Vector
return 4;

View File

@ -5,7 +5,7 @@ comment "//"
color magenta "\<(extends|size|vtable(-size)?|property|static-property(-array)?|((static|virtual)-)?method|constructor)\>"
# Types
color green "\<(char|uchar|int|uint|float|bool|void|std::(string|vector|map))\>"
color green "\<(char|uchar|short|ushort|int|uint|float|bool|void|std::(string|vector|map))\>"
# Numbers
color yellow "0x[a-f0-9]+"

View File

@ -17,6 +17,8 @@
<list name="types">
<item>char</item>
<item>uchar</item>
<item>short</item>
<item>ushort</item>
<item>int</item>
<item>uint</item>
<item>float</item>