Return string length for enum strings
This commit is contained in:
parent
a38ef363db
commit
40f72c576e
@ -266,8 +266,8 @@ struct DqnInspect_Struct
|
|||||||
};
|
};
|
||||||
|
|
||||||
// NOTE(doyle): For compiler testing
|
// NOTE(doyle): For compiler testing
|
||||||
#include "../Data/DqnInspect_TestData.h"
|
// #include "../Data/DqnInspect_TestData.h"
|
||||||
#include "../Data/DqnInspect_TestDataGenerated.cpp"
|
// #include "../Data/DqnInspect_TestDataGenerated.cpp"
|
||||||
|
|
||||||
#ifdef DQN_INSPECT_EXECUTABLE_IMPLEMENTATION
|
#ifdef DQN_INSPECT_EXECUTABLE_IMPLEMENTATION
|
||||||
#define _CRT_SECURE_NO_WARNINGS
|
#define _CRT_SECURE_NO_WARNINGS
|
||||||
@ -1662,7 +1662,7 @@ int main(int argc, char *argv[])
|
|||||||
// Write InspectEnumString Function
|
// Write InspectEnumString Function
|
||||||
//
|
//
|
||||||
{
|
{
|
||||||
CPPTokeniser_SprintfToFile(&tokeniser, "char const *DqnInspect_EnumString(%.*s val)\n{\n", parsed_enum->name.len, parsed_enum->name.str);
|
CPPTokeniser_SprintfToFile(&tokeniser, "char const *DqnInspect_EnumString(%.*s val, int *len = nullptr)\n{\n", parsed_enum->name.len, parsed_enum->name.str);
|
||||||
tokeniser.indent_level++;
|
tokeniser.indent_level++;
|
||||||
DEFER
|
DEFER
|
||||||
{
|
{
|
||||||
@ -1717,10 +1717,10 @@ int main(int argc, char *argv[])
|
|||||||
int padding = longest_decl_len - src_code_ptr->value.decl.len;
|
int padding = longest_decl_len - src_code_ptr->value.decl.len;
|
||||||
CPPTokeniser_SprintfToFile(&tokeniser, "%.*s%*s", src_code_ptr->value.decl.len, src_code_ptr->value.decl.str, padding, "");
|
CPPTokeniser_SprintfToFile(&tokeniser, "%.*s%*s", src_code_ptr->value.decl.len, src_code_ptr->value.decl.str, padding, "");
|
||||||
CPPTokeniser_SprintfToFileNoIndenting(&tokeniser,
|
CPPTokeniser_SprintfToFileNoIndenting(&tokeniser,
|
||||||
"return DqnInspect_%.*s_Strings[%d]; // \"%.*s\"\n",
|
"{ if (len) *len = CHAR_COUNT(\"%.*s\"); return DqnInspect_%.*s_Strings[%d]; }\n",
|
||||||
|
enum_value.len, enum_value.str,
|
||||||
parsed_enum->name.len, parsed_enum->name.str,
|
parsed_enum->name.len, parsed_enum->name.str,
|
||||||
enum_index,
|
enum_index);
|
||||||
enum_value.len, enum_value.str);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user