Re-add _non_virtual and add _unedited for methods

This commit is contained in:
Bigjango13 2024-04-07 21:41:40 -07:00
parent 67c4adaa77
commit db3879f7a5
3 changed files with 25 additions and 2 deletions

View File

@ -212,6 +212,7 @@ export class Struct {
for (const method of this.#methods) {
out += method.generateTypedef();
out += `extern ${method.generateDefinition()}`;
out += `extern ${method.generateDefinition('_unedited')}`;
out += method.generateNewMethodTest(this.#directParent, '', '');
}
@ -288,6 +289,8 @@ export class Struct {
for (const method of this.#methods) {
init += `${INDENT}${method.getName()} = (${method.getType()}) ${toHex(method.address)};\n`;
declarations += method.generateDefinition();
init += `${INDENT}${method.getName()}_unedited = (${method.getType()}) ${toHex(method.address)};\n`;
declarations += method.generateDefinition('_unedited');
}
// VTable

View File

@ -126,6 +126,7 @@ export class VTable implements Property {
if (info) {
const type = `${info.getType()} *`;
out += `extern ${type}${info.getName()}_vtable_addr;\n`;
out += `extern ${info.generateDefinition('_non_virtual')}`;
out += info.generateNewMethodTest(directParent, '*', '_vtable_addr');
}
}
@ -161,6 +162,8 @@ export class VTable implements Property {
const type = `${info.getType()} *`;
init += `${INDENT}${info.getName()}_vtable_addr = (${type}) ${toHex(vtableAddress)};\n`;
declarations += `${type}${info.getName()}_vtable_addr;\n`;
init += `${INDENT}${info.getName()}_non_virtual = *${info.getName()}_vtable_addr;\n`;
declarations += info.generateDefinition('_non_virtual');
}
}
}

View File

@ -1,17 +1,34 @@
syntax def "\.def$"
comment "//"
# Mistakes
# Missing semicolon
color red "[^;]$"
# Missing type
color red "^(((static|virtual)-)?method|property|static-property(-array)?) [a-zA-Z_][a-zA-Z0-9_]* ?(\(|=)"
# Missing prefix
color red "^[^ ]+"
# Missing vtable
color red "^(vtable(-size|-destructor-offset))? .+$"
# Reset
color normal "(\(|\))"
# Commands
color magenta "\<(extends|size|vtable(-size|-destructor-offset)?|property|static-property(-array)?|((static|virtual)-)?method|constructor)\>"
color magenta "^(extends|size|vtable(-size|-destructor-offset)?|property|static-property(-array)?|((static|virtual)-)?method|constructor)\>"
# Types
color green "\<(char|uchar|short|ushort|int|uint|float|bool|void|std::(string|vector|map))\>"
color green "\<((u?(char|short|int))|float|bool|void|std::(string|vector|map))\>"
# Numbers
color yellow "0x[a-f0-9]+"
# Non-hex numbers
color red " [0-9][a-f0-9]+;"
# Comments
color brightblue "//.*"
# Whitespace.
color normal "[[:space:]]+"
# Trailing whitespace.
color ,green "[[:space:]]+$"