update code gen

This commit is contained in:
yyc12345 2023-11-26 20:36:25 +08:00
parent 562b44c7aa
commit 279fa1eccb
3 changed files with 10 additions and 6 deletions

View File

@ -171,7 +171,7 @@ public class GeneralWriter {
// write implements // write implements
for (EnumsHelper.Enum_t enum_t : prog.mEnums) { for (EnumsHelper.Enum_t enum_t : prog.mEnums) {
// write enum desc header // write enum desc header
indent.printf("g_Annotation_%s: dict[int, AnnotationData] = {", enum_t.mEnumName); indent.printf("g_Annotation_%s: dict[int, EnumAnnotation] = {", enum_t.mEnumName);
indent.inc(); indent.inc();
// write enum desc entries // write enum desc entries
@ -181,7 +181,7 @@ public class GeneralWriter {
comment = CommonHelper.escapeString(enumEntry_t.mEntryComment); comment = CommonHelper.escapeString(enumEntry_t.mEntryComment);
} }
indent.printf("%s.%s.value: AnnotationData(\"%s\", \"%s\"),", enum_t.mEnumName, enumEntry_t.mEntryName, indent.printf("%s.%s.value: EnumAnnotation(\"%s\", \"%s\"),", enum_t.mEnumName, enumEntry_t.mEntryName,
extractHumanReadableEntryName(enumEntry_t.mEntryName), comment); extractHumanReadableEntryName(enumEntry_t.mEntryName), comment);
} }

View File

@ -35,7 +35,8 @@ def GetTmplOperOffset(sname: str, svars: tuple[str]) -> str:
\t\t\t{sp.join(map(lambda x: f'case {x}: return {svars[x]};', range(len(svars))))} \t\t\t{sp.join(map(lambda x: f'case {x}: return {svars[x]};', range(len(svars))))}
\t\t\tdefault: return {svars[0]}; \t\t\tdefault: return {svars[0]};
\t\t}} \t\t}}
\t}}\tconst CKFLOAT& operator[](size_t i) const {{ \t}}
\tconst CKFLOAT& operator[](size_t i) const {{
\t\tswitch (i) {{ \t\tswitch (i) {{
\t\t\t{sp.join(map(lambda x: f'case {x}: return {svars[x]};', range(len(svars))))} \t\t\t{sp.join(map(lambda x: f'case {x}: return {svars[x]};', range(len(svars))))}
\t\t\tdefault: return {svars[0]}; \t\t\tdefault: return {svars[0]};

View File

@ -36,7 +36,8 @@ namespace LibCmo::VxMath {
case 1: return y; case 1: return y;
default: return x; default: return x;
} }
} const CKFLOAT& operator[](size_t i) const { }
const CKFLOAT& operator[](size_t i) const {
switch (i) { switch (i) {
case 0: return x; case 0: return x;
case 1: return y; case 1: return y;
@ -120,7 +121,8 @@ namespace LibCmo::VxMath {
case 2: return z; case 2: return z;
default: return x; default: return x;
} }
} const CKFLOAT& operator[](size_t i) const { }
const CKFLOAT& operator[](size_t i) const {
switch (i) { switch (i) {
case 0: return x; case 0: return x;
case 1: return y; case 1: return y;
@ -211,7 +213,8 @@ namespace LibCmo::VxMath {
case 3: return w; case 3: return w;
default: return x; default: return x;
} }
} const CKFLOAT& operator[](size_t i) const { }
const CKFLOAT& operator[](size_t i) const {
switch (i) { switch (i) {
case 0: return x; case 0: return x;
case 1: return y; case 1: return y;