Using 4coder string functions in code/4ed_api_parser_main.cpp instead of manually creating the strings.

Added "code/" in the string that point to the generator so it's easier to find the correct files.
Regenerated the 4 affected files (just to update the comment string).
This commit is contained in:
Simon Anciaux 2025-01-07 14:24:59 +01:00 committed by Peter Slattery
parent 0e2b8d0df8
commit bd7dac90ac
16 changed files with 23 additions and 51 deletions

View File

@ -37,49 +37,21 @@ main(int argc, char **argv){
exit(1);
}
String_Const_u8 exe = SCu8("4ed_api_parser_main.exe");
u32 command_line_length = exe.size + 1;
String_Const_u8 command_line = { 0 };
String_Const_u8 exe = SCu8("code/4ed_api_parser_main.exe");
u32 command_line_length = exe.size;
for (i32 i = 1; i < argc; i+=1){
command_line_length += cstring_length(argv[i]) + 1;
command_line_length += 1 + cstring_length(argv[i]);
}
command_line = push_data(&arena, command_line_length);
u8* command_line_current = command_line.str;
u8* command_line_end = command_line.str + command_line.size;
{
char* c = ( char* ) exe.str;
while ( *c != 0 && command_line_current < command_line_end ) {
*command_line_current = *c;
command_line_current++;
c++;
}
}
if ( command_line_current < command_line_end ) {
*command_line_current = ' ';
command_line_current++;
}
String_u8 command_line = string_u8_push(&arena, command_line_length );
string_append(&command_line, exe);
API_Definition_List list = {};
for (i32 i = 1; i < argc; i += 1){
char *file_name = argv[i];
char* c = file_name;
while ( *c != 0 && command_line_current < command_line_end ) {
*command_line_current = *c;
command_line_current++;
c++;
}
if ( command_line_current < command_line_end ) {
*command_line_current = ' ';
command_line_current++;
}
string_append_character(&command_line, ' ');
string_append(&command_line, SCu8(argv[i]));
FILE *file = fopen(file_name, "rb");
if (file == 0){
printf("error: could not open input file: '%s'\n", argv[i]);
@ -97,7 +69,7 @@ main(int argc, char **argv){
for (API_Definition *node = list.first;
node != 0;
node = node->next){
api_definition_generate_api_includes(&arena, node, GeneratedGroup_Custom, APIGeneration_NoAPINameOnCallables, command_line);
api_definition_generate_api_includes(&arena, node, GeneratedGroup_Custom, APIGeneration_NoAPINameOnCallables, SCu8(command_line));
}
}

View File

@ -9,7 +9,7 @@
// TOP
#define GENERATED_BY "4ed_font_api.cpp"
#define GENERATED_BY "code/4ed_font_api.cpp"
#include "4ed_api_definition_main.cpp"

View File

@ -9,7 +9,7 @@
// TOP
#define GENERATED_BY "4ed_graphics_api.cpp"
#define GENERATED_BY "code/4ed_graphics_api.cpp"
#include "4ed_api_definition_main.cpp"

View File

@ -9,7 +9,7 @@
// TOP
#define GENERATED_BY "4ed_system_api.cpp"
#define GENERATED_BY "code/4ed_system_api.cpp"
#include "4ed_api_definition_main.cpp"

View File

@ -1,4 +1,4 @@
/* Generated by "4ed_api_parser_main.exe 4ed_api_implementation.cpp " */
/* Generated by "code/4ed_api_parser_main.exe 4ed_api_implementation.cpp" */
function void
custom_api_fill_vtable(API_VTable_custom *vtable){

View File

@ -1,4 +1,4 @@
/* Generated by "4ed_api_parser_main.exe 4ed_api_implementation.cpp " */
/* Generated by "code/4ed_api_parser_main.exe 4ed_api_implementation.cpp" */
#define custom_global_set_setting_sig() b32 custom_global_set_setting(Application_Links* app, Global_Setting_ID setting, i64 value)
#define custom_global_get_screen_rectangle_sig() Rect_f32 custom_global_get_screen_rectangle(Application_Links* app)

View File

@ -1,4 +1,4 @@
/* Generated by "4ed_api_parser_main.exe 4ed_api_implementation.cpp " */
/* Generated by "code/4ed_api_parser_main.exe 4ed_api_implementation.cpp" */
function API_Definition*
custom_api_construct(Arena *arena){

View File

@ -1,4 +1,4 @@
/* Generated by "4ed_api_parser_main.exe 4ed_api_implementation.cpp " */
/* Generated by "code/4ed_api_parser_main.exe 4ed_api_implementation.cpp" */
api(custom) function b32 global_set_setting(Application_Links* app, Global_Setting_ID setting, i64 value);
api(custom) function Rect_f32 global_get_screen_rectangle(Application_Links* app);

View File

@ -1,4 +1,4 @@
/* Generated by "4ed_system_api.cpp" */
/* Generated by "code/4ed_system_api.cpp" */
function void
system_api_fill_vtable(API_VTable_system *vtable){

View File

@ -1,4 +1,4 @@
/* Generated by "4ed_system_api.cpp" */
/* Generated by "code/4ed_system_api.cpp" */
#define system_error_box_sig() void system_error_box(char* msg)
#define system_get_path_sig() String_Const_u8 system_get_path(Arena* arena, System_Path_Code path_code)

View File

@ -1,4 +1,4 @@
/* Generated by "4ed_system_api.cpp" */
/* Generated by "code/4ed_system_api.cpp" */
function API_Definition*
system_api_construct(Arena *arena){

View File

@ -1,4 +1,4 @@
/* Generated by "4ed_system_api.cpp" */
/* Generated by "code/4ed_system_api.cpp" */
api(system) function void error_box(char* msg);
api(system) function String_Const_u8 get_path(Arena* arena, System_Path_Code path_code);

View File

@ -1,4 +1,4 @@
/* Generated by "4ed_font_api.cpp" */
/* Generated by "code/4ed_font_api.cpp" */
function void
font_api_fill_vtable(API_VTable_font *vtable){

View File

@ -1,4 +1,4 @@
/* Generated by "4ed_font_api.cpp" */
/* Generated by "code/4ed_font_api.cpp" */
#define font_make_face_sig() Face* font_make_face(Arena* arena, Face_Description* description, f32 scale_factor)

View File

@ -1,4 +1,4 @@
/* Generated by "4ed_graphics_api.cpp" */
/* Generated by "code/4ed_graphics_api.cpp" */
function void
graphics_api_fill_vtable(API_VTable_graphics *vtable){

View File

@ -1,4 +1,4 @@
/* Generated by "4ed_graphics_api.cpp" */
/* Generated by "code/4ed_graphics_api.cpp" */
#define graphics_get_texture_sig() u32 graphics_get_texture(Vec3_i32 dim, Texture_Kind texture_kind)
#define graphics_fill_texture_sig() b32 graphics_fill_texture(Texture_Kind texture_kind, u32 texture, Vec3_i32 p, Vec3_i32 dim, void* data)