eliminate entry point 'mode'/type; just gather argc/argv as part of command line parse

This commit is contained in:
Ryan Fleury
2024-11-08 10:33:28 -08:00
parent 0773b6d282
commit 158dd742ad
9 changed files with 31 additions and 29 deletions
+5 -3
View File
@@ -46,9 +46,11 @@ load_paths =
commands =
{
//- rjf: fkey command slots (change locally but do not commit)
.f1 = { .win = "build raddbg telemetry", .linux = "", .out = "*compilation*", .footer_panel = true, .save_dirty_files = true, .cursor_at_end = false, },
.f2 = { .win = "build rdi_from_pdb", .linux = "", .out = "*compilation*", .footer_panel = true, .save_dirty_files = true, .cursor_at_end = false, },
.f3 = { .win = "pushd build && raddbg.exe --user:local_dev.raddbg_user --project:local_dev.raddbg_project --xuto_run && popd",.linux = "", .out = "*compilation*", .footer_panel = true, .save_dirty_files = true, .cursor_at_end = false, },
// .f1 = { .win = "build raddbg telemetry", .linux = "", .out = "*compilation*", .footer_panel = true, .save_dirty_files = true, .cursor_at_end = false, },
// .f2 = { .win = "build rdi_from_pdb", .linux = "", .out = "*compilation*", .footer_panel = true, .save_dirty_files = true, .cursor_at_end = false, },
// .f3 = { .win = "pushd build && raddbg.exe --user:local_dev.raddbg_user --project:local_dev.raddbg_project --xuto_run && popd",.linux = "", .out = "*compilation*", .footer_panel = true, .save_dirty_files = true, .cursor_at_end = false, },
.f1 = { .win = "build ryan_scratch release telemetry", .linux = "", .out = "*compilation*", .footer_panel = true, .save_dirty_files = true, .cursor_at_end = false, },
.f3 = { .win = "pushd build && ryan_scratch.exe --capture && popd",.linux = "", .out = "*compilation*", .footer_panel = true, .save_dirty_files = true, .cursor_at_end = false, },
//- rjf: local target builds
.build_raddbg = { .win = "build raddbg", .linux = "", .out = "*compilation*", .footer_panel = true, .save_dirty_files = true, .cursor_at_end = false, },
+12
View File
@@ -190,6 +190,18 @@ cmd_line_from_string_list(Arena *arena, String8List command_line)
}
}
// rjf: fill argc/argv
parsed.argc = command_line.node_count;
parsed.argv = push_array(arena, char *, parsed.argc);
{
U64 idx = 0;
for(String8Node *n = command_line.first; n != 0; n = n->next)
{
parsed.argv[idx] = (char *)push_str8_copy(arena, n->string).str;
idx += 1;
}
}
return parsed;
}
+2
View File
@@ -34,6 +34,8 @@ struct CmdLine
String8List inputs;
U64 option_table_size;
CmdLineOpt **option_table;
U64 argc;
char **argv;
};
////////////////////////////////
+6 -10
View File
@@ -4,7 +4,7 @@
global U64 global_update_tick_idx = 0;
internal void
main_thread_base_entry_point(EntryPoint entry_point, int argc, char **argv)
main_thread_base_entry_point(int arguments_count, char **arguments)
{
Temp scratch = scratch_begin(0, 0);
ThreadNameF("[main thread]");
@@ -18,7 +18,7 @@ main_thread_base_entry_point(EntryPoint entry_point, int argc, char **argv)
#endif
//- rjf: parse command line
String8List command_line_argument_strings = os_string_list_from_argcv(scratch.arena, argc, argv);
String8List command_line_argument_strings = os_string_list_from_argcv(scratch.arena, arguments_count, arguments);
CmdLine cmdline = cmd_line_from_string_list(scratch.arena, command_line_argument_strings);
//- rjf: begin captures
@@ -27,7 +27,7 @@ main_thread_base_entry_point(EntryPoint entry_point, int argc, char **argv)
{
ProfBeginCapture(arguments[0]);
}
#if PROFILE_TELEMETRY
tmMessage(0, TMMF_ICON_NOTE, BUILD_TITLE);
#endif
@@ -87,21 +87,17 @@ main_thread_base_entry_point(EntryPoint entry_point, int argc, char **argv)
#if defined(RADDBG_CORE_H) && !defined(RD_INIT_MANUAL)
rd_init(&cmdline);
#endif
//- rjf: call into entry point
#if BASE_ENTRY_POINT_ARGCV
scratch_end(scratch); // release command line memory
entry_point(argc, argv);
#else
entry_point(&cmdline);
scratch_end(scratch);
#endif
//- rjf: end captures
if(capture)
{
ProfEndCapture();
}
scratch_end(scratch);
}
internal void
+1 -7
View File
@@ -4,13 +4,7 @@
#ifndef BASE_ENTRY_POINT_H
#define BASE_ENTRY_POINT_H
#if BASE_ENTRY_POINT_ARGCV
typedef void (*EntryPoint)(int argc, char **argv);
#else
typedef void (*EntryPoint)(CmdLine *cmdline);
#endif
internal void main_thread_base_entry_point(EntryPoint entry_point, int argc, char **argv);
internal void main_thread_base_entry_point(int argc, char **argv);
internal void supplement_thread_base_entry_point(void (*entry_point)(void *params), void *params);
internal U64 update_tick_idx(void);
internal B32 update(void);
+2 -2
View File
@@ -4352,9 +4352,9 @@ l.count += 1; \
}
internal void
entry_point(int argc, char **argv)
entry_point(CmdLine *cmdline)
{
lnk_init_error_handler();
lnk_run(argc, argv);
lnk_run(cmdline->argc, cmdline->argv);
}
+1 -1
View File
@@ -1259,5 +1259,5 @@ main(int argc, char **argv)
}
//- rjf: call into "real" entry point
main_thread_base_entry_point(entry_point, argc, argv);
main_thread_base_entry_point(arguments_count, arguments);
}
-4
View File
@@ -326,11 +326,7 @@ internal Guid os_make_guid(void);
// into the standard codebase program entry points, named "entry_point".
#if BUILD_ENTRY_DEFINING_UNIT
# if BASE_ENTRY_POINT_ARGCV
internal void entry_point(int argc, char **argv);
# else
internal void entry_point(CmdLine *cmdline);
#endif
#endif
#endif // OS_CORE_H
+2 -2
View File
@@ -98,7 +98,7 @@ os_w32_unix_time_from_file_time(FILETIME file_time)
Assert(unix_time64 <= max_U32);
U32 unix_time32 = (U32)unix_time64;
return unix_time32;
}
@@ -1721,7 +1721,7 @@ w32_entry_point_caller(int argc, WCHAR **wargv)
os_w32_state.entity_arena = arena_alloc();
//- rjf: call into "real" entry point
main_thread_base_entry_point(entry_point, argc, argv);
main_thread_base_entry_point(argc, argv);
}
#if BUILD_CONSOLE_INTERFACE