mirror of
https://github.com/Ed94/raddebugger.git
synced 2026-07-29 18:50:03 +00:00
eliminate entry point 'mode'/type; just gather argc/argv as part of command line parse
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -34,6 +34,8 @@ struct CmdLine
|
||||
String8List inputs;
|
||||
U64 option_table_size;
|
||||
CmdLineOpt **option_table;
|
||||
U64 argc;
|
||||
char **argv;
|
||||
};
|
||||
|
||||
////////////////////////////////
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user