Progress on batch edit optimizations; core profiling

master
Allen Webster 2019-10-26 13:48:50 -07:00
parent 529ef3928e
commit f2097ac6bc
24 changed files with 756 additions and 569 deletions

View File

@ -323,6 +323,8 @@ App_Init_Sig(app_init){
models->config_api = api;
profile_init(&models->profile_list);
API_VTable_custom custom_vtable = {};
custom_api_fill_vtable(&custom_vtable);
API_VTable_system system_vtable = {};

View File

@ -2961,4 +2961,12 @@ buffer_find_all_matches(Application_Links *app, Arena *arena, Buffer_ID buffer,
return(list);
}
////////////////////////////////
api(custom) function Profile_Global_List*
get_core_profile_list(Application_Links *app){
Models *models = (Models*)app->cmd_context;
return(&models->profile_list);
}
// BOTTOM

View File

@ -96,6 +96,8 @@ struct Models{
u32 next_animate_delay;
b32 animate_next_frame;
Profile_Global_List profile_list;
// Last frame state
Vec2_i32 prev_p;
Panel *prev_mouse_panel;

View File

@ -32,6 +32,8 @@
#define DYNAMIC_LINK_API
#include "generated/font_api.h"
#include "4coder_profile.h"
#include "4ed_render_target.h"
#include "4ed.h"
#include "4ed_buffer_model.h"
@ -65,6 +67,7 @@
#include "4coder_stringf.cpp"
#include "4coder_app_links_allocator.cpp"
#include "4coder_system_allocator.cpp"
#include "4coder_profile.cpp"
#include "4coder_hash_functions.cpp"
#include "4coder_table.cpp"
#include "4coder_log.cpp"

View File

@ -20,85 +20,152 @@ write_cursor_with_index(Cursor_With_Index *positions, i32 *count, i64 pos){
++(*count);
}
// TODO(allen): Rewrite this without being a dumbass.
// TODO(allen): Rewrite this without being a dumbass.
// TODO(allen): Rewrite this without being a dumbass.
#define CursorSwap__(a,b) { Cursor_With_Index t = a; a = b; b = t; }
// TODO(allen): Rewrite this without being a dumbass.
internal void
buffer_quick_sort_cursors(Cursor_With_Index *positions, i32 start, i32 pivot){
i32 mid = start;
i64 pivot_pos = positions[pivot].pos;
for (i32 i = mid; i < pivot; ++i){
if (positions[i].pos < pivot_pos){
CursorSwap__(positions[mid], positions[i]);
++mid;
buffer_quick_sort_cursors(Cursor_With_Index *positions, i32 first, i32 one_past_last){
if (first + 1 < one_past_last){
i32 pivot = one_past_last - 1;
i64 pivot_pos = positions[pivot].pos;
i32 j = first;
for (i32 i = first; i < pivot; i += 1){
i64 pos = positions[i].pos;
if (pos < pivot_pos){
Swap(Cursor_With_Index, positions[j], positions[i]);
j += 1;
}
}
}
CursorSwap__(positions[mid], positions[pivot]);
if (start < mid - 1){
buffer_quick_sort_cursors(positions, start, mid - 1);
}
if (mid + 1 < pivot){
buffer_quick_sort_cursors(positions, mid + 1, pivot);
Swap(Cursor_With_Index, positions[j], positions[pivot]);
buffer_quick_sort_cursors(positions, first, j);
buffer_quick_sort_cursors(positions, j + 1, one_past_last);
}
}
// TODO(allen): Rewrite this without being a dumbass.
internal void
buffer_quick_unsort_cursors(Cursor_With_Index *positions, i32 start, i32 pivot){
i32 mid = start;
i32 pivot_index = positions[pivot].index;
for (i32 i = mid; i < pivot; ++i){
if (positions[i].index < pivot_index){
CursorSwap__(positions[mid], positions[i]);
++mid;
}
}
CursorSwap__(positions[mid], positions[pivot]);
if (start < mid - 1) buffer_quick_unsort_cursors(positions, start, mid - 1);
if (mid + 1 < pivot) buffer_quick_unsort_cursors(positions, mid + 1, pivot);
}
#undef CursorSwap__
internal void
buffer_sort_cursors(Cursor_With_Index *positions, i32 count){
if (count > 0){
buffer_quick_sort_cursors(positions, 0, count - 1);
buffer_quick_sort_cursors(positions, 0, count);
}
}
internal void
buffer_unsort_cursors(Cursor_With_Index *positions, i32 count){
if (count > 0){
buffer_quick_unsort_cursors(positions, 0, count - 1);
i32 i = 0;
for (;;){
if (positions[i].index == i){
i += 1;
if (i >= count){
break;
}
}
else{
i32 j = positions[i].index;
Swap(Cursor_With_Index, positions[i], positions[j]);
}
}
}
}
#if 0
function void
buffer_sort_batch(Edit *batch, i32 first, i32 one_past_last){
if (first + 1 < one_past_last){
i32 pivot = one_past_last - 1;
i64 pivot_pos = batch[pivot].range.first;
i32 j = first;
for (i32 i = first; i < pivot; i += 1){
i64 pos = batch[i].range.first;
if (pos < pivot_pos){
Swap(Edit, batch[j], batch[i]);
j += 1;
}
}
Swap(Edit, batch[j], batch[pivot]);
buffer_sort_batch(batch, first, j);
buffer_sort_batch(batch, j + 1, one_past_last);
}
}
function Edit_Array
buffer_batch_array_from_linked_list(Arena *arena, Batch_Edit *batch, i32 count){
Edit_Array result = {};
result.count = count;
result.vals = push_array(arena, Edit, count);
i32 counter = 0;
for (Batch_Edit *node = batch;
counter < count && node != 0;
node = node->next){
result.vals[counter] = node->edit;
counter += 1;
}
return(result);
}
function Edit_Array
buffer_sort_batch(Arena *arena, Batch_Edit *batch, i32 count){
Edit_Array result = buffer_batch_array_from_linked_list(arena, batch, count);
buffer_sort_batch(result.vals, 0, result.count);
return(result);
}
#endif
internal void
buffer_update_cursors_lean_l(Cursor_With_Index *sorted_positions, i32 count,
Batch_Edit *batch){
Cursor_With_Index *pos = sorted_positions;
Cursor_With_Index *end_pos = sorted_positions + count;
i64 shift_amount = 0;
for (; batch != 0 && pos < end_pos;
batch = batch->next){
Range_i64 range = batch->edit.range;
i64 len = batch->edit.text.size;
if (shift_amount != 0){
for (;pos < end_pos && pos->pos < range.first; pos += 1){
pos->pos += shift_amount;
}
}
else{
for (;pos < end_pos && pos->pos < range.first; pos += 1);
}
i64 new_pos = range.first + shift_amount;
for (;pos < end_pos && pos->pos <= range.one_past_last; pos += 1){
pos->pos = new_pos;
}
shift_amount += len - (range.one_past_last - range.first);
}
if (shift_amount != 0){
for (;pos < end_pos; pos += 1){
pos->pos += shift_amount;
}
}
}
internal void
buffer_update_cursors(Cursor_With_Index *sorted_positions, i32 count,
i64 start, i64 end, i64 len, b32 lean_right){
i64 shift_amount = replace_range_shift(start, end, len);
Cursor_With_Index *position = sorted_positions + count - 1;
if (lean_right){
for (; position >= sorted_positions && position->pos > end; --position){
position->pos += shift_amount;
buffer_update_cursors_lean_r(Cursor_With_Index *sorted_positions, i32 count,
Batch_Edit *batch){
Cursor_With_Index *pos = sorted_positions;
Cursor_With_Index *end_pos = sorted_positions + count;
i64 shift_amount = 0;
for (; batch != 0 && pos < end_pos;
batch = batch->next){
Range_i64 range = batch->edit.range;
i64 len = batch->edit.text.size;
if (shift_amount != 0){
for (;pos < end_pos && pos->pos < range.first; pos += 1){
pos->pos += shift_amount;
}
}
for (; position >= sorted_positions && position->pos >= start; --position){
position->pos = start + len;
else{
for (;pos < end_pos && pos->pos < range.first; pos += 1);
}
i64 new_pos = range.first + len + shift_amount;
for (;pos < end_pos && pos->pos < range.one_past_last; pos += 1){
pos->pos = new_pos;
}
shift_amount += len - (range.one_past_last - range.first);
}
else{
for (; position >= sorted_positions && position->pos > end; --position){
position->pos += shift_amount;
}
for (; position >= sorted_positions && position->pos >= start; --position){
position->pos = start;
if (shift_amount != 0){
for (;pos < end_pos; pos += 1){
pos->pos += shift_amount;
}
}
}

View File

@ -72,6 +72,13 @@ struct Buffer_Layout_Item_List{
Interval_i64 index_range;
};
#if 0
struct Edit_Array{
Edit *vals;
i32 count;
};
#endif
#endif
// BOTTOM

View File

@ -90,7 +90,8 @@ edit_fix_markers__compute_scroll_y(i32 line_height, i32 old_y_val, f32 new_y_val
}
internal void
edit_fix_markers(Thread_Context *tctx, Models *models, Editing_File *file, Edit edit){
edit_fix_markers(Thread_Context *tctx, Models *models, Editing_File *file,
Batch_Edit *batch){
Layout *layout = &models->layout;
Lifetime_Object *file_lifetime_object = file->lifetime_object;
@ -159,12 +160,8 @@ edit_fix_markers(Thread_Context *tctx, Models *models, Editing_File *file, Edit
buffer_sort_cursors( cursors, cursor_count);
buffer_sort_cursors(r_cursors, r_cursor_count);
buffer_update_cursors( cursors, cursor_count,
edit.range.first, edit.range.one_past_last,
edit.text.size, false);
buffer_update_cursors(r_cursors, r_cursor_count,
edit.range.first, edit.range.one_past_last,
edit.text.size, true);
buffer_update_cursors_lean_l( cursors, cursor_count, batch);
buffer_update_cursors_lean_r(r_cursors, r_cursor_count, batch);
buffer_unsort_cursors( cursors, cursor_count);
buffer_unsort_cursors(r_cursors, r_cursor_count);
@ -248,14 +245,13 @@ edit__apply(Thread_Context *tctx, Models *models, Editing_File *file,
i64 line_start = buffer_get_line_index(buffer, edit.range.first);
i64 line_end = buffer_get_line_index(buffer, edit.range.one_past_last);
i64 replaced_line_count = line_end - line_start;
i64 new_line_count = buffer_count_newlines(scratch, buffer, edit.range.first, edit.range.first + edit.text.size);
i64 new_line_count = buffer_count_newlines(scratch, buffer, edit.range.first,
edit.range.first + edit.text.size);
i64 line_shift = new_line_count - replaced_line_count;
file_clear_layout_cache(file);
buffer_remeasure_starts(scratch, buffer, Ii64(line_start, line_end + 1), line_shift, shift_amount);
// NOTE(allen): cursor fixing
edit_fix_markers(tctx, models, file, edit);
buffer_remeasure_starts(scratch, buffer, Ii64(line_start, line_end + 1),
line_shift, shift_amount);
}
internal void
@ -266,6 +262,11 @@ edit_single(Thread_Context *tctx, Models *models, Editing_File *file,
edit__apply(tctx, models, file, range, string, behaviors);
Batch_Edit batch = {};
batch.edit.text = string;
batch.edit.range = range;
edit_fix_markers(tctx, models, file, &batch);
post_edit_call_hook(tctx, models, file,
Ii64_size(range.first, string.size), range_size(range));
}
@ -412,66 +413,101 @@ edit_merge_history_range(Thread_Context *tctx, Models *models, Editing_File *fil
return(result);
}
#include "4coder_profile_static_enable.cpp"
function b32
edit_batch_check(Thread_Context *tctx, Profile_Global_List *list, Batch_Edit *batch){
ProfileTLScope(tctx, list, "batch check");
b32 result = true;
Range_i64 prev_range = Ii64(-1, 0);
for (;batch != 0;
batch = batch->next){
if (batch->edit.range.first <= prev_range.first ||
batch->edit.range.first < prev_range.one_past_last){
result = false;
break;
}
}
return(result);
}
internal b32
edit_batch(Thread_Context *tctx, Models *models, Editing_File *file,
Batch_Edit *batch, Edit_Behaviors behaviors){
b32 result = true;
if (batch != 0){
pre_edit_state_change(models, file);
pre_edit_history_prep(file, behaviors);
History_Record_Index start_index = 0;
if (history_is_activated(&file->state.history)){
start_index = file->state.current_record_index;
if (!edit_batch_check(tctx, &models->profile_list, batch)){
result = false;
}
Range_i64 old_range = Ii64_neg_inf;
Range_i64 new_range = Ii64_neg_inf;
i64 shift = 0;
for (Batch_Edit *edit = batch;
edit != 0;
edit = edit->next){
String_Const_u8 insert_string = edit->edit.text;
else{
ProfileTLScope(tctx, &models->profile_list, "batch apply");
Range_i64 edit_range = edit->edit.range;
old_range.min = min(old_range.min, edit_range.min);
old_range.max = max(old_range.max, edit_range.max);
pre_edit_state_change(models, file);
pre_edit_history_prep(file, behaviors);
edit_range.first += shift;
edit_range.one_past_last += shift;
new_range.min = min(new_range.min, edit_range.min);
i64 new_max = (i64)(edit_range.min + insert_string.size);
new_range.max = max(new_range.max, new_max);
i64 size = buffer_size(&file->state.buffer);
if (0 <= edit_range.first &&
edit_range.first <= edit_range.one_past_last &&
edit_range.one_past_last <= size){
edit__apply(tctx, models, file, edit_range, insert_string, behaviors);
shift += replace_range_shift(edit_range, insert_string.size);
History_Record_Index start_index = 0;
if (history_is_activated(&file->state.history)){
start_index = file->state.current_record_index;
}
else{
result = false;
break;
Range_i64 old_range = Ii64_neg_inf;
Range_i64 new_range = Ii64_neg_inf;
ProfileTLBlockNamed(tctx, &models->profile_list, "batch text edits", profile_edits);
i32 batch_count = 0;
i64 shift = 0;
for (Batch_Edit *edit = batch;
edit != 0;
edit = edit->next){
String_Const_u8 insert_string = edit->edit.text;
Range_i64 edit_range = edit->edit.range;
old_range.min = min(old_range.min, edit_range.min);
old_range.max = max(old_range.max, edit_range.max);
edit_range.first += shift;
edit_range.one_past_last += shift;
new_range.min = min(new_range.min, edit_range.min);
i64 new_max = (i64)(edit_range.min + insert_string.size);
new_range.max = max(new_range.max, new_max);
i64 size = buffer_size(&file->state.buffer);
if (0 <= edit_range.first &&
edit_range.first <= edit_range.one_past_last &&
edit_range.one_past_last <= size){
edit__apply(tctx, models, file, edit_range, insert_string,
behaviors);
shift += replace_range_shift(edit_range, insert_string.size);
batch_count += 1;
}
else{
result = false;
break;
}
}
ProfileCloseNow(profile_edits);
if (history_is_activated(&file->state.history)){
History_Record_Index last_index = file->state.current_record_index;
if (start_index + 1 < last_index){
edit_merge_history_range(tctx, models, file,
start_index + 1, last_index,
RecordMergeFlag_StateInRange_ErrorOut);
}
}
edit_fix_markers(tctx, models, file, batch);
post_edit_call_hook(tctx, models, file, new_range, range_size(old_range));
}
if (history_is_activated(&file->state.history)){
History_Record_Index last_index = file->state.current_record_index;
if (start_index + 1 < last_index){
edit_merge_history_range(tctx, models, file, start_index + 1, last_index, RecordMergeFlag_StateInRange_ErrorOut);
}
}
post_edit_call_hook(tctx, models, file, new_range, range_size(old_range));
}
return(result);
}
#include "4coder_profile_static_disable.cpp"
////////////////////////////////
internal Editing_File*

View File

@ -66,14 +66,16 @@ async_task_thread(void *thread_ptr){
Thread_Context *tctx = &tctx_;
thread_ctx_init(tctx, ThreadKind_AsyncTasks, allocator, allocator);
ProfileThreadName(tctx, string_u8_litexpr("async"));
Async_Thread *thread = (Async_Thread*)thread_ptr;
Async_System *async_system = thread->async_system;
Application_Links app = {};
app.tctx = tctx;
app.cmd_context = async_system->cmd_context;
Profile_Global_List *list = get_core_profile_list(&app);
ProfileThreadName(tctx, list, string_u8_litexpr("async"));
Async_Context ctx = {&app, thread};
for (;;){

View File

@ -1159,15 +1159,8 @@ enum{
ProfileEnable_InspectBit = 0x2,
};
struct Profile_Global_List{
Arena node_arena;
Arena_Node *first_arena;
Arena_Node *last_arena;
Profile_Thread *first_thread;
Profile_Thread *last_thread;
i32 thread_count;
Profile_Enable_Flag disable_bits;
};
// NOTE(allen): full definition in 4coder_profile.h, due to dependency on System_Mutex.
struct Profile_Global_List;
////////////////////////////////

View File

@ -198,13 +198,15 @@ static Snippet default_snippets[] = {
function void
write_snippet(Application_Links *app, View_ID view, Buffer_ID buffer,
i64 pos, Snippet *snippet){
String_Const_u8 snippet_text = SCu8(snippet->text);
buffer_replace_range(app, buffer, Ii64(pos), snippet_text);
i64 new_cursor = pos + snippet->cursor_offset;
view_set_cursor_and_preferred_x(app, view, seek_pos(new_cursor));
i64 new_mark = pos + snippet->mark_offset;
view_set_mark(app, view, seek_pos(new_mark));
auto_indent_buffer(app, buffer, Ii64_size(pos, snippet_text.size));
if (snippet != 0){
String_Const_u8 snippet_text = SCu8(snippet->text);
buffer_replace_range(app, buffer, Ii64(pos), snippet_text);
i64 new_cursor = pos + snippet->cursor_offset;
view_set_cursor_and_preferred_x(app, view, seek_pos(new_cursor));
i64 new_mark = pos + snippet->mark_offset;
view_set_mark(app, view, seek_pos(new_mark));
auto_indent_buffer(app, buffer, Ii64_size(pos, snippet_text.size));
}
}
function Snippet*

View File

@ -18,10 +18,10 @@ custom_layer_init(Application_Links *app){
Thread_Context *tctx = get_thread_context(app);
mapping_init(tctx, &framework_mapping);
setup_default_mapping(&framework_mapping);
global_prof_init();
async_task_handler_init(app, &global_async_system);
ProfileThreadName(tctx, string_u8_litexpr("main"));
Profile_Global_List *list = get_core_profile_list(app);
ProfileThreadName(tctx, list, string_u8_litexpr("main"));
}
#endif

View File

@ -64,7 +64,9 @@ CUSTOM_DOC("Input consumption loop for default view behavior")
View_ID view = get_active_view(app, Access_Always);
String_Const_u8 name = push_u8_stringf(scratch, "view %d", view);
ProfileThreadName(tctx, name);
Profile_Global_List *list = get_core_profile_list(app);
ProfileThreadName(tctx, list, name);
View_Context ctx = view_current_context(app, view);
ctx.mapping = &framework_mapping;
@ -131,7 +133,7 @@ CUSTOM_DOC("Input consumption loop for default view behavior")
}
}
view_input_profile.close_now();
ProfileCloseNow(view_input_profile);
// NOTE(allen): call the command
binding.custom(app);
@ -843,7 +845,7 @@ BUFFER_EDIT_RANGE_SIG(default_buffer_edit_range){
Token_Relex relex = token_relex(relex_list, relex_range.first - text_shift,
ptr->tokens, token_index_first, token_index_resync_guess);
profile_attempt_resync.close_now();
ProfileCloseNow(profile_attempt_resync);
if (relex.successful_resync){
ProfileBlock(app, "apply resync");
@ -881,7 +883,7 @@ BUFFER_EDIT_RANGE_SIG(default_buffer_edit_range){
do_full_relex = true;
}
}
if (do_full_relex){
base_free(allocator, ptr->tokens);
block_zero_struct(ptr);

View File

@ -47,7 +47,7 @@ rewrite_lines_to_crlf(Application_Links *app, Buffer_ID buffer){
edit->edit.range = Ii64(pos);
}
}
profile_batch.close_now();
ProfileCloseNow(profile_batch);
buffer_batch_edit(app, buffer, first);
}
@ -76,7 +76,7 @@ rewrite_lines_to_lf(Application_Links *app, Buffer_ID buffer){
edit->edit.text = string_u8_litexpr("");
edit->edit.range = match.range;
}
profile_batch.close_now();
ProfileCloseNow(profile_batch);
buffer_batch_edit(app, buffer, first);
}

View File

@ -4,20 +4,16 @@
// TOP
global Profile_Global_List global_prof_list = {};
global System_Mutex global_prof_mutex = {};
function void
global_prof_init(void){
global_prof_mutex = system_mutex_make();
global_prof_list.node_arena = make_arena(get_base_allocator_system(),
KB(4));
profile_init(Profile_Global_List *list){
list->mutex = system_mutex_make();
list->node_arena = make_arena_system(KB(4));
}
function Profile_Thread*
global_prof_get_thread(i32 thread_id){
prof__get_thread(Profile_Global_List *list, i32 thread_id){
Profile_Thread *result = 0;
for (Profile_Thread *node = global_prof_list.first_thread;
for (Profile_Thread *node = list->first_thread;
node != 0;
node = node->next){
if (thread_id == node->thread_id){
@ -26,43 +22,42 @@ global_prof_get_thread(i32 thread_id){
}
}
if (result == 0){
result = push_array_zero(&global_prof_list.node_arena, Profile_Thread, 1);
sll_queue_push(global_prof_list.first_thread, global_prof_list.last_thread, result);
global_prof_list.thread_count += 1;
result = push_array_zero(&list->node_arena, Profile_Thread, 1);
sll_queue_push(list->first_thread, list->last_thread, result);
list->thread_count += 1;
result->thread_id = thread_id;
}
return(result);
}
function void
global_prof_clear(void){
Mutex_Lock lock(global_prof_mutex);
for (Arena_Node *node = global_prof_list.first_arena;
profile_clear(Profile_Global_List *list){
Mutex_Lock lock(list->mutex);
for (Arena_Node *node = list->first_arena;
node != 0;
node = node->next){
linalloc_clear(&node->arena);
}
global_prof_list.first_arena = 0;
global_prof_list.last_arena = 0;
list->first_arena = 0;
list->last_arena = 0;
linalloc_clear(&global_prof_list.node_arena);
global_prof_list.first_thread = 0;
global_prof_list.last_thread = 0;
global_prof_list.thread_count = 0;
linalloc_clear(&list->node_arena);
list->first_thread = 0;
list->last_thread = 0;
list->thread_count = 0;
}
function void
thread_profile_flush(Thread_Context *tctx){
profile_thread_flush(Thread_Context *tctx, Profile_Global_List *list){
if (tctx->prof_record_count > 0){
Mutex_Lock lock(global_prof_mutex);
if (global_prof_list.disable_bits == 0){
Profile_Thread* thread = global_prof_get_thread(system_thread_get_id());
Mutex_Lock lock(list->mutex);
if (list->disable_bits == 0){
Profile_Thread* thread = prof__get_thread(list, system_thread_get_id());
Arena_Node* node = push_array(&global_prof_list.node_arena, Arena_Node, 1);
sll_queue_push(global_prof_list.first_arena, global_prof_list.last_arena,
node);
Arena_Node* node = push_array(&list->node_arena, Arena_Node, 1);
sll_queue_push(list->first_arena, list->last_arena, node);
node->arena = tctx->prof_arena;
tctx->prof_arena = make_arena(get_base_allocator_system(), KB(4));
tctx->prof_arena = make_arena_system(KB(4));
if (thread->first_record == 0){
thread->first_record = tctx->prof_first;
@ -82,21 +77,22 @@ thread_profile_flush(Thread_Context *tctx){
}
function void
thread_set_name(Thread_Context *tctx, String_Const_u8 name){
Profile_Thread* thread = global_prof_get_thread(system_thread_get_id());
profile_thread_set_name(Thread_Context *tctx, Profile_Global_List *list, String_Const_u8 name){
Mutex_Lock lock(list->mutex);
Profile_Thread* thread = prof__get_thread(list, system_thread_get_id());
thread->name = name;
}
#define ProfileThreadName(tctx,name) thread_set_name((tctx), (name))
#define ProfileThreadName(tctx,list,name) profile_thread_set_name((tctx), (list), (name))
function void
global_prof_set_enabled(b32 value, Profile_Enable_Flag flag){
Mutex_Lock lock(global_prof_mutex);
profile_set_enabled(Profile_Global_List *list, b32 value, Profile_Enable_Flag flag){
Mutex_Lock lock(list->mutex);
if (value){
RemFlag(global_prof_list.disable_bits, flag);
RemFlag(list->disable_bits, flag);
}
else{
AddFlag(global_prof_list.disable_bits, flag);
AddFlag(list->disable_bits, flag);
}
}
@ -142,29 +138,34 @@ thread_profile_record_pop(Application_Links *app, u64 time, Profile_ID id){
////////////////////////////////
function void
profile_block__init(Thread_Context *tctx, String_Const_u8 name,
String_Const_u8 location, Profile_Block *block){
profile_block__init(Thread_Context *tctx, Profile_Global_List *list,
String_Const_u8 name, String_Const_u8 location, Profile_Block *block){
block->tctx = tctx;
block->list = list;
block->is_closed = false;
block->id = thread_profile_record_push(tctx, system_now_time(), name, location);
}
function void
profile_block__init(Thread_Context *tctx, String_Const_u8 name,
String_Const_u8 location, Profile_Scope_Block *block){
profile_block__init(Thread_Context *tctx, Profile_Global_List *list,
String_Const_u8 name, String_Const_u8 location,
Profile_Scope_Block *block){
block->tctx = tctx;
block->list = list;
block->is_closed = false;
block->id = thread_profile_record_push(tctx, system_now_time(), name, location);
}
////////
Profile_Block::Profile_Block(Thread_Context *tctx, String_Const_u8 name,
String_Const_u8 location){
profile_block__init(tctx, name, location, this);
Profile_Block::Profile_Block(Thread_Context *tctx, Profile_Global_List *list,
String_Const_u8 name, String_Const_u8 location){
profile_block__init(tctx, list, name, location, this);
}
Profile_Block::Profile_Block(Application_Links *app, String_Const_u8 name,
String_Const_u8 location){
profile_block__init(get_thread_context(app), name, location, this);
Thread_Context *v_tctx = get_thread_context(app);
Profile_Global_List *v_list = get_core_profile_list(app);
profile_block__init(v_tctx, v_list, name, location, this);
}
Profile_Block::~Profile_Block(){
this->close_now();
@ -179,17 +180,19 @@ Profile_Block::close_now(){
////////
Profile_Scope_Block::Profile_Scope_Block(Thread_Context *tctx, String_Const_u8 name,
String_Const_u8 location){
profile_block__init(tctx, name, location, this);
Profile_Scope_Block::Profile_Scope_Block(Thread_Context *tctx, Profile_Global_List *list,
String_Const_u8 name, String_Const_u8 location){
profile_block__init(tctx, list, name, location, this);
}
Profile_Scope_Block::Profile_Scope_Block(Application_Links *app, String_Const_u8 name,
String_Const_u8 location){
profile_block__init(get_thread_context(app), name, location, this);
Thread_Context *v_tctx = get_thread_context(app);
Profile_Global_List *v_list = get_core_profile_list(app);
profile_block__init(v_tctx, v_list, name, location, this);
}
Profile_Scope_Block::~Profile_Scope_Block(){
this->close_now();
thread_profile_flush(this->tctx);
profile_thread_flush(this->tctx, this->list);
}
void
Profile_Scope_Block::close_now(){
@ -204,19 +207,22 @@ Profile_Scope_Block::close_now(){
CUSTOM_COMMAND_SIG(profile_enable)
CUSTOM_DOC("Allow 4coder's self profiler to gather new profiling information.")
{
global_prof_set_enabled(true, ProfileEnable_UserBit);
Profile_Global_List *list = get_core_profile_list(app);
profile_set_enabled(list, true, ProfileEnable_UserBit);
}
CUSTOM_COMMAND_SIG(profile_disable)
CUSTOM_DOC("Prevent 4coder's self profiler from gathering new profiling information.")
{
global_prof_set_enabled(false, ProfileEnable_UserBit);
Profile_Global_List *list = get_core_profile_list(app);
profile_set_enabled(list, false, ProfileEnable_UserBit);
}
CUSTOM_COMMAND_SIG(profile_clear)
CUSTOM_DOC("Clear all profiling information from 4coder's self profiler.")
{
global_prof_clear();
Profile_Global_List *list = get_core_profile_list(app);
profile_clear(list);
}
// BOTTOM

View File

@ -7,12 +7,25 @@
#if !defined(FCODER_PROFILE_H)
#define FCODER_PROFILE_H
struct Profile_Global_List{
System_Mutex mutex;
Arena node_arena;
Arena_Node *first_arena;
Arena_Node *last_arena;
Profile_Thread *first_thread;
Profile_Thread *last_thread;
i32 thread_count;
Profile_Enable_Flag disable_bits;
};
struct Profile_Block{
Thread_Context *tctx;
Profile_Global_List *list;
b32 is_closed;
Profile_ID id;
Profile_Block(Thread_Context *tctx, String_Const_u8 name, String_Const_u8 location);
Profile_Block(Thread_Context *tctx, Profile_Global_List *list,
String_Const_u8 name, String_Const_u8 location);
Profile_Block(Application_Links *app, String_Const_u8 name, String_Const_u8 location);
~Profile_Block();
void close_now();
@ -20,11 +33,13 @@ struct Profile_Block{
struct Profile_Scope_Block{
Thread_Context *tctx;
Profile_Global_List *list;
b32 is_closed;
Profile_ID id;
Profile_Scope_Block(Thread_Context *tctx, Profile_Global_List *list,
String_Const_u8 name, String_Const_u8 location);
Profile_Scope_Block(Application_Links *app, String_Const_u8 name, String_Const_u8 location);
Profile_Scope_Block(Thread_Context *tctx, String_Const_u8 name, String_Const_u8 location);
~Profile_Scope_Block();
void close_now();
};

View File

@ -125,9 +125,8 @@ profile_parse_record(Arena *arena, Profile_Inspection *insp,
}
function Profile_Inspection
profile_parse(Arena *arena){
Mutex_Lock lock(global_prof_mutex);
Profile_Global_List *src = &global_prof_list;
profile_parse(Arena *arena, Profile_Global_List *src){
Mutex_Lock lock(src->mutex);
Profile_Inspection result = {};
@ -155,7 +154,7 @@ profile_parse(Arena *arena){
for (Profile_Node *prof_node = insp_thread->root.first_child;
prof_node != 0;
prof_node = prof_node->next){
prof_node = prof_node->next){
insp_thread->active_time += range_size(prof_node->time);
}
}
@ -777,14 +776,15 @@ profile_inspect__left_click(Application_Links *app, View_ID view,
CUSTOM_UI_COMMAND_SIG(profile_inspect)
CUSTOM_DOC("Inspect all currently collected profiling information in 4coder's self profiler.")
{
if (HasFlag(global_prof_list.disable_bits, ProfileEnable_InspectBit)){
Profile_Global_List *list = get_core_profile_list(app);
if (HasFlag(list->disable_bits, ProfileEnable_InspectBit)){
return;
}
global_prof_set_enabled(false, ProfileEnable_InspectBit);
profile_set_enabled(list, false, ProfileEnable_InspectBit);
Scratch_Block scratch(app);
global_profile_inspection = profile_parse(scratch);
global_profile_inspection = profile_parse(scratch, list);
Profile_Inspection *insp = &global_profile_inspection;
View_ID view = get_active_view(app, Access_Always);
@ -824,7 +824,7 @@ CUSTOM_DOC("Inspect all currently collected profiling information in 4coder's se
}
}
global_prof_set_enabled(true, ProfileEnable_InspectBit);
profile_set_enabled(list, true, ProfileEnable_InspectBit);
view_pop_context(app, view);
}

View File

@ -5,21 +5,31 @@
// TOP
#if defined(ProfileBegin)
#undef ProfileBegin
#undef ProfileEnd
#if defined(ProfileBlock)
#undef ProfileBlock
#undef ProfileScope
#undef ProfileBlockNamed
#undef ProfileScopeNamed
#undef ProfileTLBlock
#undef ProfileTLScope
#undef ProfileTLBlockNamed
#undef ProfileTLScopeNamed
#undef ProfileCloseNow
#endif
#define ProfileBegin(T,N)
#define ProfileEnd(T,I)
#define ProfileBlock(T,N)
#define ProfileScope(T,N)
#define ProfileBlockNamed(T,N,M)
#define ProfileScopeNamed(T,N,M)
#define ProfileTLBlock(T,L,N)
#define ProfileTLScope(T,L,N)
#define ProfileTLBlockNamed(T,L,N,M)
#define ProfileTLScopeNamed(T,L,N,M)
#define ProfileCloseNow(O)
// BOTTOM

View File

@ -4,21 +4,20 @@
// TOP
#if defined(ProfileBegin)
#undef ProfileBegin
#undef ProfileEnd
#if defined(ProfileBlock)
#undef ProfileBlock
#undef ProfileScope
#undef ProfileBlockNamed
#undef ProfileScopeNamed
#undef ProfileTLBlock
#undef ProfileTLScope
#undef ProfileTLBlockNamed
#undef ProfileTLScopeNamed
#undef ProfileCloseNow
#endif
#define ProfileBegin(T,N) \
thread_profile_record_push((T), system_now_time(), \
string_u8_litexpr(N), string_u8_litexpr(file_name_line_number))
#define ProfileEnd(T,I) thread_profile_record_pop((T), system_now_time(), (I))
#define ProfileBlock(T,N) \
Profile_Block glue(profile_block_, __LINE__) \
((T), string_u8_litexpr(N), string_u8_litexpr(file_name_line_number))
@ -35,5 +34,27 @@ Profile_Block M \
Profile_Scope_Block M \
((T), string_u8_litexpr(N), string_u8_litexpr(file_name_line_number))
#define ProfileTLBlock(T,L,N) \
Profile_Block glue(profile_block_, __LINE__) \
((T), (L), string_u8_litexpr(N), string_u8_litexpr(file_name_line_number))
#define ProfileTLScope(T,L,N) \
Profile_Scope_Block glue(profile_block_, __LINE__) \
((T), (L), string_u8_litexpr(N), string_u8_litexpr(file_name_line_number))
#define ProfileTLBlockNamed(T,L,N,M) \
Profile_Block M \
((T), (L), string_u8_litexpr(N), string_u8_litexpr(file_name_line_number))
#define ProfileTLScopeNamed(T,L,N,M) \
Profile_Scope_Block M \
((T), (L), string_u8_litexpr(N), string_u8_litexpr(file_name_line_number))
#define ProfileCloseNow(B) ((B).close_now())
// BOTTOM

View File

@ -91,9 +91,9 @@ open_files_pattern_match__recursive(Application_Links *app, String_Const_u8 path
u32 flags){
Scratch_Block scratch(app);
Profile_ID get_file_list_id = ProfileBegin(app, "get file list");
ProfileScopeNamed(app, "get file list", profile_get_file_list);
File_List list = system_get_file_list(scratch, path);
ProfileEnd(app, get_file_list_id);
ProfileCloseNow(profile_get_file_list);
File_Info **info = list.infos;
for (u32 i = 0; i < list.count; ++i, ++info){
@ -107,7 +107,7 @@ open_files_pattern_match__recursive(Application_Links *app, String_Const_u8 path
string_expand(path),
string_expand(file_name));
open_files_pattern_match__recursive(app, new_path,
whitelist, blacklist, flags);
whitelist, blacklist, flags);
}
else{
if (!match_in_pattern_array(file_name, whitelist)){
@ -120,9 +120,8 @@ open_files_pattern_match__recursive(Application_Links *app, String_Const_u8 path
String_Const_u8 full_path = push_u8_stringf(scratch, "%.*s%.*s",
string_expand(path),
string_expand(file_name));
Profile_ID create_buffer_id = ProfileBegin(app, "create buffer");
create_buffer(app, full_path, 0);
ProfileEnd(app, create_buffer_id);
}
}
}

View File

@ -236,9 +236,9 @@ i32 line_number;
};
static Command_Metadata fcoder_metacmd_table[213] = {
{ PROC_LINKS(default_view_input_handler, 0), false, "default_view_input_handler", 26, "Input consumption loop for default view behavior", 48, "w:\\4ed\\code\\custom\\4coder_default_hooks.cpp", 43, 57 },
{ PROC_LINKS(profile_enable, 0), false, "profile_enable", 14, "Allow 4coder's self profiler to gather new profiling information.", 65, "w:\\4ed\\code\\custom\\4coder_profile.cpp", 37, 204 },
{ PROC_LINKS(profile_disable, 0), false, "profile_disable", 15, "Prevent 4coder's self profiler from gathering new profiling information.", 72, "w:\\4ed\\code\\custom\\4coder_profile.cpp", 37, 210 },
{ PROC_LINKS(profile_clear, 0), false, "profile_clear", 13, "Clear all profiling information from 4coder's self profiler.", 60, "w:\\4ed\\code\\custom\\4coder_profile.cpp", 37, 216 },
{ PROC_LINKS(profile_enable, 0), false, "profile_enable", 14, "Allow 4coder's self profiler to gather new profiling information.", 65, "w:\\4ed\\code\\custom\\4coder_profile.cpp", 37, 207 },
{ PROC_LINKS(profile_disable, 0), false, "profile_disable", 15, "Prevent 4coder's self profiler from gathering new profiling information.", 72, "w:\\4ed\\code\\custom\\4coder_profile.cpp", 37, 214 },
{ PROC_LINKS(profile_clear, 0), false, "profile_clear", 13, "Clear all profiling information from 4coder's self profiler.", 60, "w:\\4ed\\code\\custom\\4coder_profile.cpp", 37, 221 },
{ PROC_LINKS(seek_beginning_of_textual_line, 0), false, "seek_beginning_of_textual_line", 30, "Seeks the cursor to the beginning of the line across all text.", 62, "w:\\4ed\\code\\custom\\4coder_helper.cpp", 36, 2106 },
{ PROC_LINKS(seek_end_of_textual_line, 0), false, "seek_end_of_textual_line", 24, "Seeks the cursor to the end of the line across all text.", 56, "w:\\4ed\\code\\custom\\4coder_helper.cpp", 36, 2112 },
{ PROC_LINKS(seek_beginning_of_line, 0), false, "seek_beginning_of_line", 22, "Seeks the cursor to the beginning of the visual line.", 53, "w:\\4ed\\code\\custom\\4coder_helper.cpp", 36, 2118 },
@ -403,17 +403,17 @@ static Command_Metadata fcoder_metacmd_table[213] = {
{ PROC_LINKS(build_in_build_panel, 0), false, "build_in_build_panel", 20, "Looks for a build.bat, build.sh, or makefile in the current and parent directories. Runs the first that it finds and prints the output to *compilation*. Puts the *compilation* buffer in a panel at the footer of the current view.", 230, "w:\\4ed\\code\\custom\\4coder_build_commands.cpp", 44, 163 },
{ PROC_LINKS(close_build_panel, 0), false, "close_build_panel", 17, "If the special build panel is open, closes it.", 46, "w:\\4ed\\code\\custom\\4coder_build_commands.cpp", 44, 178 },
{ PROC_LINKS(change_to_build_panel, 0), false, "change_to_build_panel", 21, "If the special build panel is open, makes the build panel the active panel.", 75, "w:\\4ed\\code\\custom\\4coder_build_commands.cpp", 44, 184 },
{ PROC_LINKS(close_all_code, 0), false, "close_all_code", 14, "Closes any buffer with a filename ending with an extension configured to be recognized as a code file type.", 107, "w:\\4ed\\code\\custom\\4coder_project_commands.cpp", 46, 931 },
{ PROC_LINKS(open_all_code, 0), false, "open_all_code", 13, "Open all code in the current directory. File types are determined by extensions. An extension is considered code based on the extensions specified in 4coder.config.", 164, "w:\\4ed\\code\\custom\\4coder_project_commands.cpp", 46, 937 },
{ PROC_LINKS(open_all_code_recursive, 0), false, "open_all_code_recursive", 23, "Works as open_all_code but also runs in all subdirectories.", 59, "w:\\4ed\\code\\custom\\4coder_project_commands.cpp", 46, 943 },
{ PROC_LINKS(load_project, 0), false, "load_project", 12, "Looks for a project.4coder file in the current directory and tries to load it. Looks in parent directories until a project file is found or there are no more parents.", 167, "w:\\4ed\\code\\custom\\4coder_project_commands.cpp", 46, 951 },
{ PROC_LINKS(project_fkey_command, 0), false, "project_fkey_command", 20, "Run an 'fkey command' configured in a project.4coder file. Determines the index of the 'fkey command' by which function key or numeric key was pressed to trigger the command.", 175, "w:\\4ed\\code\\custom\\4coder_project_commands.cpp", 46, 959 },
{ PROC_LINKS(project_go_to_root_directory, 0), false, "project_go_to_root_directory", 28, "Changes 4coder's hot directory to the root directory of the currently loaded project. With no loaded project nothing hapepns.", 125, "w:\\4ed\\code\\custom\\4coder_project_commands.cpp", 46, 985 },
{ PROC_LINKS(setup_new_project, 0), false, "setup_new_project", 17, "Queries the user for several configuration options and initializes a new 4coder project with build scripts for every OS.", 120, "w:\\4ed\\code\\custom\\4coder_project_commands.cpp", 46, 1319 },
{ PROC_LINKS(setup_build_bat, 0), false, "setup_build_bat", 15, "Queries the user for several configuration options and initializes a new build batch script.", 92, "w:\\4ed\\code\\custom\\4coder_project_commands.cpp", 46, 1326 },
{ PROC_LINKS(setup_build_sh, 0), false, "setup_build_sh", 14, "Queries the user for several configuration options and initializes a new build shell script.", 92, "w:\\4ed\\code\\custom\\4coder_project_commands.cpp", 46, 1332 },
{ PROC_LINKS(setup_build_bat_and_sh, 0), false, "setup_build_bat_and_sh", 22, "Queries the user for several configuration options and initializes a new build batch script.", 92, "w:\\4ed\\code\\custom\\4coder_project_commands.cpp", 46, 1338 },
{ PROC_LINKS(project_command_lister, 0), false, "project_command_lister", 22, "Open a lister of all commands in the currently loaded project.", 62, "w:\\4ed\\code\\custom\\4coder_project_commands.cpp", 46, 1378 },
{ PROC_LINKS(close_all_code, 0), false, "close_all_code", 14, "Closes any buffer with a filename ending with an extension configured to be recognized as a code file type.", 107, "w:\\4ed\\code\\custom\\4coder_project_commands.cpp", 46, 930 },
{ PROC_LINKS(open_all_code, 0), false, "open_all_code", 13, "Open all code in the current directory. File types are determined by extensions. An extension is considered code based on the extensions specified in 4coder.config.", 164, "w:\\4ed\\code\\custom\\4coder_project_commands.cpp", 46, 936 },
{ PROC_LINKS(open_all_code_recursive, 0), false, "open_all_code_recursive", 23, "Works as open_all_code but also runs in all subdirectories.", 59, "w:\\4ed\\code\\custom\\4coder_project_commands.cpp", 46, 942 },
{ PROC_LINKS(load_project, 0), false, "load_project", 12, "Looks for a project.4coder file in the current directory and tries to load it. Looks in parent directories until a project file is found or there are no more parents.", 167, "w:\\4ed\\code\\custom\\4coder_project_commands.cpp", 46, 950 },
{ PROC_LINKS(project_fkey_command, 0), false, "project_fkey_command", 20, "Run an 'fkey command' configured in a project.4coder file. Determines the index of the 'fkey command' by which function key or numeric key was pressed to trigger the command.", 175, "w:\\4ed\\code\\custom\\4coder_project_commands.cpp", 46, 958 },
{ PROC_LINKS(project_go_to_root_directory, 0), false, "project_go_to_root_directory", 28, "Changes 4coder's hot directory to the root directory of the currently loaded project. With no loaded project nothing hapepns.", 125, "w:\\4ed\\code\\custom\\4coder_project_commands.cpp", 46, 984 },
{ PROC_LINKS(setup_new_project, 0), false, "setup_new_project", 17, "Queries the user for several configuration options and initializes a new 4coder project with build scripts for every OS.", 120, "w:\\4ed\\code\\custom\\4coder_project_commands.cpp", 46, 1318 },
{ PROC_LINKS(setup_build_bat, 0), false, "setup_build_bat", 15, "Queries the user for several configuration options and initializes a new build batch script.", 92, "w:\\4ed\\code\\custom\\4coder_project_commands.cpp", 46, 1325 },
{ PROC_LINKS(setup_build_sh, 0), false, "setup_build_sh", 14, "Queries the user for several configuration options and initializes a new build shell script.", 92, "w:\\4ed\\code\\custom\\4coder_project_commands.cpp", 46, 1331 },
{ PROC_LINKS(setup_build_bat_and_sh, 0), false, "setup_build_bat_and_sh", 22, "Queries the user for several configuration options and initializes a new build batch script.", 92, "w:\\4ed\\code\\custom\\4coder_project_commands.cpp", 46, 1337 },
{ PROC_LINKS(project_command_lister, 0), false, "project_command_lister", 22, "Open a lister of all commands in the currently loaded project.", 62, "w:\\4ed\\code\\custom\\4coder_project_commands.cpp", 46, 1377 },
{ PROC_LINKS(list_all_functions_current_buffer, 0), false, "list_all_functions_current_buffer", 33, "Creates a jump list of lines of the current buffer that appear to define or declare functions.", 94, "w:\\4ed\\code\\custom\\4coder_function_list.cpp", 43, 267 },
{ PROC_LINKS(list_all_functions_current_buffer_lister, 0), false, "list_all_functions_current_buffer_lister", 40, "Creates a lister of locations that look like function definitions and declarations in the buffer.", 97, "w:\\4ed\\code\\custom\\4coder_function_list.cpp", 43, 277 },
{ PROC_LINKS(list_all_functions_all_buffers, 0), false, "list_all_functions_all_buffers", 30, "Creates a jump list of lines from all buffers that appear to define or declare functions.", 89, "w:\\4ed\\code\\custom\\4coder_function_list.cpp", 43, 295 },
@ -438,14 +438,14 @@ static Command_Metadata fcoder_metacmd_table[213] = {
{ PROC_LINKS(comment_line, 0), false, "comment_line", 12, "Insert '//' at the beginning of the line after leading whitespace.", 66, "w:\\4ed\\code\\custom\\4coder_combined_write_commands.cpp", 53, 125 },
{ PROC_LINKS(uncomment_line, 0), false, "uncomment_line", 14, "If present, delete '//' at the beginning of the line after leading whitespace.", 78, "w:\\4ed\\code\\custom\\4coder_combined_write_commands.cpp", 53, 137 },
{ PROC_LINKS(comment_line_toggle, 0), false, "comment_line_toggle", 19, "Turns uncommented lines into commented lines and vice versa for comments starting with '//'.", 92, "w:\\4ed\\code\\custom\\4coder_combined_write_commands.cpp", 53, 149 },
{ PROC_LINKS(snippet_lister, 0), false, "snippet_lister", 14, "Opens a snippet lister for inserting whole pre-written snippets of text.", 72, "w:\\4ed\\code\\custom\\4coder_combined_write_commands.cpp", 53, 237 },
{ PROC_LINKS(snippet_lister, 0), false, "snippet_lister", 14, "Opens a snippet lister for inserting whole pre-written snippets of text.", 72, "w:\\4ed\\code\\custom\\4coder_combined_write_commands.cpp", 53, 239 },
{ PROC_LINKS(miblo_increment_basic, 0), false, "miblo_increment_basic", 21, "Increment an integer under the cursor by one.", 45, "w:\\4ed\\code\\custom\\4coder_miblo_numbers.cpp", 43, 29 },
{ PROC_LINKS(miblo_decrement_basic, 0), false, "miblo_decrement_basic", 21, "Decrement an integer under the cursor by one.", 45, "w:\\4ed\\code\\custom\\4coder_miblo_numbers.cpp", 43, 44 },
{ PROC_LINKS(miblo_increment_time_stamp, 0), false, "miblo_increment_time_stamp", 26, "Increment a time stamp under the cursor by one second. (format [m]m:ss or h:mm:ss", 81, "w:\\4ed\\code\\custom\\4coder_miblo_numbers.cpp", 43, 231 },
{ PROC_LINKS(miblo_decrement_time_stamp, 0), false, "miblo_decrement_time_stamp", 26, "Decrement a time stamp under the cursor by one second. (format [m]m:ss or h:mm:ss", 81, "w:\\4ed\\code\\custom\\4coder_miblo_numbers.cpp", 43, 237 },
{ PROC_LINKS(miblo_increment_time_stamp_minute, 0), false, "miblo_increment_time_stamp_minute", 33, "Increment a time stamp under the cursor by one minute. (format [m]m:ss or h:mm:ss", 81, "w:\\4ed\\code\\custom\\4coder_miblo_numbers.cpp", 43, 243 },
{ PROC_LINKS(miblo_decrement_time_stamp_minute, 0), false, "miblo_decrement_time_stamp_minute", 33, "Decrement a time stamp under the cursor by one minute. (format [m]m:ss or h:mm:ss", 81, "w:\\4ed\\code\\custom\\4coder_miblo_numbers.cpp", 43, 249 },
{ PROC_LINKS(profile_inspect, 0), true, "profile_inspect", 15, "Inspect all currently collected profiling information in 4coder's self profiler.", 80, "w:\\4ed\\code\\custom\\4coder_profile_inspect.cpp", 45, 777 },
{ PROC_LINKS(profile_inspect, 0), true, "profile_inspect", 15, "Inspect all currently collected profiling information in 4coder's self profiler.", 80, "w:\\4ed\\code\\custom\\4coder_profile_inspect.cpp", 45, 776 },
{ PROC_LINKS(default_startup, 0), false, "default_startup", 15, "Default command for responding to a startup event", 49, "w:\\4ed\\code\\custom\\4coder_default_hooks.cpp", 43, 7 },
{ PROC_LINKS(default_try_exit, 0), false, "default_try_exit", 16, "Default command for responding to a try-exit event", 50, "w:\\4ed\\code\\custom\\4coder_default_hooks.cpp", 43, 22 },
};

View File

@ -171,6 +171,7 @@ vtable->draw_text_layout = draw_text_layout;
vtable->open_color_picker = open_color_picker;
vtable->animate_in_n_milliseconds = animate_in_n_milliseconds;
vtable->buffer_find_all_matches = buffer_find_all_matches;
vtable->get_core_profile_list = get_core_profile_list;
}
#if defined(DYNAMIC_LINK_API)
function void
@ -346,6 +347,7 @@ draw_text_layout = vtable->draw_text_layout;
open_color_picker = vtable->open_color_picker;
animate_in_n_milliseconds = vtable->animate_in_n_milliseconds;
buffer_find_all_matches = vtable->buffer_find_all_matches;
get_core_profile_list = vtable->get_core_profile_list;
}
#undef DYNAMIC_LINK_API
#endif

View File

@ -169,6 +169,7 @@
#define custom_open_color_picker_sig() void custom_open_color_picker(Application_Links* app, Color_Picker* picker)
#define custom_animate_in_n_milliseconds_sig() void custom_animate_in_n_milliseconds(Application_Links* app, u32 n)
#define custom_buffer_find_all_matches_sig() String_Match_List custom_buffer_find_all_matches(Application_Links* app, Arena* arena, Buffer_ID buffer, i32 string_id, Range_i64 range, String_Const_u8 needle, Character_Predicate* predicate, Scan_Direction direction)
#define custom_get_core_profile_list_sig() Profile_Global_List* custom_get_core_profile_list(Application_Links* app)
typedef b32 custom_global_set_setting_type(Application_Links* app, Global_Setting_ID setting, i64 value);
typedef Rect_f32 custom_global_get_screen_rectangle_type(Application_Links* app);
typedef Thread_Context* custom_get_thread_context_type(Application_Links* app);
@ -340,6 +341,7 @@ typedef void custom_draw_text_layout_type(Application_Links* app, Text_Layout_ID
typedef void custom_open_color_picker_type(Application_Links* app, Color_Picker* picker);
typedef void custom_animate_in_n_milliseconds_type(Application_Links* app, u32 n);
typedef String_Match_List custom_buffer_find_all_matches_type(Application_Links* app, Arena* arena, Buffer_ID buffer, i32 string_id, Range_i64 range, String_Const_u8 needle, Character_Predicate* predicate, Scan_Direction direction);
typedef Profile_Global_List* custom_get_core_profile_list_type(Application_Links* app);
struct API_VTable_custom{
custom_global_set_setting_type *global_set_setting;
custom_global_get_screen_rectangle_type *global_get_screen_rectangle;
@ -512,6 +514,7 @@ custom_draw_text_layout_type *draw_text_layout;
custom_open_color_picker_type *open_color_picker;
custom_animate_in_n_milliseconds_type *animate_in_n_milliseconds;
custom_buffer_find_all_matches_type *buffer_find_all_matches;
custom_get_core_profile_list_type *get_core_profile_list;
};
#if defined(STATIC_LINK_API)
internal b32 global_set_setting(Application_Links* app, Global_Setting_ID setting, i64 value);
@ -685,6 +688,7 @@ internal void draw_text_layout(Application_Links* app, Text_Layout_ID layout_id)
internal void open_color_picker(Application_Links* app, Color_Picker* picker);
internal void animate_in_n_milliseconds(Application_Links* app, u32 n);
internal String_Match_List buffer_find_all_matches(Application_Links* app, Arena* arena, Buffer_ID buffer, i32 string_id, Range_i64 range, String_Const_u8 needle, Character_Predicate* predicate, Scan_Direction direction);
internal Profile_Global_List* get_core_profile_list(Application_Links* app);
#undef STATIC_LINK_API
#elif defined(DYNAMIC_LINK_API)
global custom_global_set_setting_type *global_set_setting = 0;
@ -858,5 +862,6 @@ global custom_draw_text_layout_type *draw_text_layout = 0;
global custom_open_color_picker_type *open_color_picker = 0;
global custom_animate_in_n_milliseconds_type *animate_in_n_milliseconds = 0;
global custom_buffer_find_all_matches_type *buffer_find_all_matches = 0;
global custom_get_core_profile_list_type *get_core_profile_list = 0;
#undef DYNAMIC_LINK_API
#endif

View File

@ -169,3 +169,4 @@ api(custom) function void draw_text_layout(Application_Links* app, Text_Layout_I
api(custom) function void open_color_picker(Application_Links* app, Color_Picker* picker);
api(custom) function void animate_in_n_milliseconds(Application_Links* app, u32 n);
api(custom) function String_Match_List buffer_find_all_matches(Application_Links* app, Arena* arena, Buffer_ID buffer, i32 string_id, Range_i64 range, String_Const_u8 needle, Character_Predicate* predicate, Scan_Direction direction);
api(custom) function Profile_Global_List* get_core_profile_list(Application_Links* app);

View File

@ -43,435 +43,439 @@ lexeme_table_lookup(u64 *hash_array, String_Const_u8 *key_array,
}
#endif
u64 main_keys_hash_array[121] = {
0xbfcba771fdc3ff37,0x0000000000000000,0x482b4e92d9750a9d,0x9cd567764c09a875,
0x2ddccf057a6f0469,0xe68abf205eb2e863,0x0000000000000000,0x0000000000000000,
0x0000000000000000,0x0000000000000000,0xd6aa0bac121748eb,0xd6aa0bac1109048d,
0x0000000000000000,0xd6aa0bac11196a39,0xd6aa0bac12221e01,0x0000000000000000,
0xe68aac478bd4d0db,0xbfcbab347eb1538b,0x0000000000000000,0x8f60fef7e554164b,
0xd6aa0bac10fe54db,0x9cd567764c0e1c93,0x8f60feee11d7dd39,0x0000000000000000,
0x0000000000000000,0x482b4e92d1dc4f83,0x0000000000000000,0xd6aa0bac12177a23,
0x482b4e93169498b9,0x8f60fefc139c5187,0xbfcbab625d9024fd,0x0000000000000000,
0x8f60feed59f98803,0x482b4e92d2f527c3,0x0000000000000000,0x9cd567764c0e7049,
0xa11bf1f9effe8ff5,0x482b4e92d9410e2b,0xbfcba7fab26f1df3,0x0000000000000000,
0xb2c2203ec742c8f9,0x0000000000000000,0x0000000000000000,0x0000000000000000,
0x482b4e9313bc8ef9,0x0000000000000000,0x0000000000000000,0x0000000000000000,
0xbfcbab347eb17811,0x0000000000000000,0x0000000000000000,0x0000000000000000,
0x0000000000000000,0x0000000000000000,0xe68b93f55069f805,0x0000000000000000,
0x8f60fef7e54b83e5,0x0000000000000000,0x0000000000000000,0x0000000000000000,
0xd6aa0bac12244e49,0xbfcba7dfbc5d3575,0x0000000000000000,0x0000000000000000,
0x0000000000000000,0xe6f47c713b150d87,0x8f60feefdaffe809,0x0000000000000000,
0xe68b8cadaf88313b,0x0000000000000000,0x0000000000000000,0xe68aa235a8c8f37d,
0x482b4e93102aeddd,0x0000000000000000,0x0000000000000000,0x496c5c19e3ebd8b9,
0xe68b8be5cd1165b3,0x9bb247cc8a92628f,0x0000000000000000,0x0000000000000000,
0x0000000000000000,0x0000000000000000,0x0000000000000000,0xe68b8c5878fdf7e5,
0x9cd567764c09163f,0x06ce5e2ad58e50b9,0xe6f44f88499927eb,0x0000000000000000,
0x0000000000000000,0x0000000000000000,0x0000000000000000,0xd6aa0bac122eeac3,
0x8f60fef796abac39,0x8f60feffda51df2d,0x8f60fef797eb8201,0xe68b89d89c6dd7c3,
0x0000000000000000,0x8f60fefded2bd701,0x482b4e92af827e09,0x9cd567764c099b97,
0xce45dbf5e933e8f9,0x8f60fef79fcb7fdd,0x0000000000000000,0xd6aa0bac10fe3491,
0xbfcba797d431f6ff,0x0000000000000000,0x8f60feee76a24423,0x8f60feefdaac9887,
0x0000000000000000,0xd6aa0bac122e92eb,0x8f60feeebfaa1a5b,0xa1f16a0b9a90fcab,
0x0000000000000000,0x482b4e92d003f5d9,0x0000000000000000,0x9bb247cc8a9263a9,
0x482b4e9313a45d19,0x0000000000000000,0x0000000000000000,0x7f82e4d7b9ad98b5,
0x0000000000000000,
u64 main_keys_hash_array[123] = {
0xa5174af9e5acfd23,0x62d0071e0a57a75b,0x0000000000000000,0x0000000000000000,
0x5735af6bbcfea769,0x83fddb4fd7cdadd5,0x0000000000000000,0x0000000000000000,
0x0000000000000000,0xc151a8a18f477403,0xe38aad9a01167cb5,0xa5174af97617c0eb,
0x5735af6bbcfd98ef,0x0000000000000000,0xcfd6be6ea1b2a7bf,0xcfd151bf07843d41,
0x83fddb4fd7fde331,0xcfd767b43c3e11dd,0x0000000000000000,0x0000000000000000,
0x611da3dabf677403,0x0000000000000000,0x0000000000000000,0xcfd4588c9eb4a541,
0x62d0071ee15b1a15,0xe38ab724554f65c7,0x0000000000000000,0x62d0073c7214c6a5,
0x0000000000000000,0x62d0071f18d5035b,0x0000000000000000,0x0000000000000000,
0x0000000000000000,0x62d00711e8b931ef,0x0000000000000000,0xa5174af9ee837aab,
0x6e325dff33928eb3,0x0000000000000000,0xe38ab67ce02990c3,0x83fddb4fd7ca21e1,
0x5735af6bbcfdfdf1,0x0000000000000000,0x0000000000000000,0x5735af6bbcfe10b1,
0xa5174af9748e6587,0x0000000000000000,0x57f47cf8791c54e5,0x0000000000000000,
0xa5174af97420112f,0x0000000000000000,0x0000000000000000,0x5735af6bbcfe0dd7,
0xcfeb8c9d37d8f951,0x57f47cf8791c57cf,0xe38aaf51e16edffb,0x0000000000000000,
0x0000000000000000,0x0000000000000000,0xcfd4406da6833331,0x83fddb4fd7e2773b,
0xe38ab67ce029ec9d,0x0000000000000000,0xa5174af9eeeed96d,0xcfd153a826747599,
0x0000000000000000,0x83fddb4fd7fc1889,0x0000000000000000,0x62d0071f47376ce3,
0x0000000000000000,0x0000000000000000,0x0000000000000000,0x0000000000000000,
0xa5174af9e657f81f,0x0000000000000000,0xa5174af9747df723,0x640a5826bf599e9f,
0x83fddb4fd622dfab,0x0000000000000000,0x0000000000000000,0x83fddb4fd607fee3,
0x62d0073c78ecd0c1,0x0000000000000000,0x83fddb4fd7ee652f,0x0000000000000000,
0x0000000000000000,0x0000000000000000,0x62d0071e16b681d3,0xe38aa0cc894c5b21,
0x0000000000000000,0x0000000000000000,0x0000000000000000,0x62d0071e0aa9cf43,
0x83fddb4fd619b23d,0x83fddb4fd611e56b,0x0000000000000000,0x0000000000000000,
0x0000000000000000,0x0000000000000000,0x0000000000000000,0x0000000000000000,
0xa5174af9e93d0031,0x62d0071e15f32755,0xcfd14a56950b19d3,0xcfd5a5541d69313d,
0x62d0073c70d8cd9f,0x0000000000000000,0x3344fcef5e557e2b,0x6e319be7d2bc1ab1,
0xcfea4eb2af414b53,0x0000000000000000,0x62d0071e2c2e7a17,0x0000000000000000,
0x0000000000000000,0x0000000000000000,0x62d0073761790621,0xa5174af9e5170e61,
0x62d007108d3afea5,0x0000000000000000,0x0000000000000000,0xdb73e81e9100c203,
0x651be698df06f803,0x0000000000000000,0xe38aa0151c891a39,
};
u8 main_keys_key_array_0[] = {0x74,0x79,0x70,0x65,0x64,0x65,0x66,};
u8 main_keys_key_array_2[] = {0x66,0x6c,0x6f,0x61,0x74,};
u8 main_keys_key_array_3[] = {0x6e,0x65,0x77,};
u8 main_keys_key_array_4[] = {0x73,0x74,0x61,0x74,0x69,0x63,0x5f,0x61,0x73,0x73,0x65,0x72,0x74,};
u8 main_keys_key_array_5[] = {0x64,0x65,0x63,0x6c,0x74,0x79,0x70,0x65,};
u8 main_keys_key_array_10[] = {0x63,0x61,0x73,0x65,};
u8 main_keys_key_array_11[] = {0x76,0x6f,0x69,0x64,};
u8 main_keys_key_array_13[] = {0x6c,0x6f,0x6e,0x67,};
u8 main_keys_key_array_14[] = {0x62,0x6f,0x6f,0x6c,};
u8 main_keys_key_array_16[] = {0x63,0x6f,0x6e,0x74,0x69,0x6e,0x75,0x65,};
u8 main_keys_key_array_17[] = {0x61,0x6c,0x69,0x67,0x6e,0x6f,0x66,};
u8 main_keys_key_array_19[] = {0x73,0x69,0x7a,0x65,0x6f,0x66,};
u8 main_keys_key_array_20[] = {0x74,0x72,0x75,0x65,};
u8 main_keys_key_array_21[] = {0x61,0x73,0x6d,};
u8 main_keys_key_array_22[] = {0x66,0x72,0x69,0x65,0x6e,0x64,};
u8 main_keys_key_array_25[] = {0x75,0x6e,0x69,0x6f,0x6e,};
u8 main_keys_key_array_27[] = {0x63,0x68,0x61,0x72,};
u8 main_keys_key_array_28[] = {0x62,0x72,0x65,0x61,0x6b,};
u8 main_keys_key_array_29[] = {0x72,0x65,0x74,0x75,0x72,0x6e,};
u8 main_keys_key_array_30[] = {0x64,0x65,0x66,0x61,0x75,0x6c,0x74,};
u8 main_keys_key_array_32[] = {0x64,0x6f,0x75,0x62,0x6c,0x65,};
u8 main_keys_key_array_33[] = {0x77,0x68,0x69,0x6c,0x65,};
u8 main_keys_key_array_35[] = {0x69,0x6e,0x74,};
u8 main_keys_key_array_0[] = {0x66,0x6c,0x6f,0x61,0x74,};
u8 main_keys_key_array_1[] = {0x73,0x74,0x61,0x74,0x69,0x63,};
u8 main_keys_key_array_4[] = {0x61,0x73,0x6d,};
u8 main_keys_key_array_5[] = {0x65,0x6e,0x75,0x6d,};
u8 main_keys_key_array_9[] = {0x72,0x65,0x69,0x6e,0x74,0x65,0x72,0x70,0x72,0x65,0x74,0x5f,0x63,0x61,0x73,0x74,};
u8 main_keys_key_array_10[] = {0x74,0x79,0x70,0x65,0x64,0x65,0x66,};
u8 main_keys_key_array_11[] = {0x62,0x72,0x65,0x61,0x6b,};
u8 main_keys_key_array_12[] = {0x6e,0x65,0x77,};
u8 main_keys_key_array_14[] = {0x6e,0x6f,0x65,0x78,0x63,0x65,0x70,0x74,};
u8 main_keys_key_array_15[] = {0x72,0x65,0x67,0x69,0x73,0x74,0x65,0x72,};
u8 main_keys_key_array_16[] = {0x63,0x61,0x73,0x65,};
u8 main_keys_key_array_17[] = {0x63,0x6f,0x6e,0x74,0x69,0x6e,0x75,0x65,};
u8 main_keys_key_array_20[] = {0x63,0x6f,0x6e,0x73,0x74,0x5f,0x63,0x61,0x73,0x74,};
u8 main_keys_key_array_23[] = {0x74,0x65,0x6d,0x70,0x6c,0x61,0x74,0x65,};
u8 main_keys_key_array_24[] = {0x69,0x6e,0x6c,0x69,0x6e,0x65,};
u8 main_keys_key_array_25[] = {0x64,0x65,0x66,0x61,0x75,0x6c,0x74,};
u8 main_keys_key_array_27[] = {0x65,0x78,0x74,0x65,0x72,0x6e,};
u8 main_keys_key_array_29[] = {0x70,0x75,0x62,0x6c,0x69,0x63,};
u8 main_keys_key_array_33[] = {0x73,0x77,0x69,0x74,0x63,0x68,};
u8 main_keys_key_array_35[] = {0x75,0x73,0x69,0x6e,0x67,};
u8 main_keys_key_array_36[] = {0x70,0x72,0x6f,0x74,0x65,0x63,0x74,0x65,0x64,};
u8 main_keys_key_array_37[] = {0x66,0x61,0x6c,0x73,0x65,};
u8 main_keys_key_array_38[] = {0x70,0x72,0x69,0x76,0x61,0x74,0x65,};
u8 main_keys_key_array_40[] = {0x72,0x65,0x69,0x6e,0x74,0x65,0x72,0x70,0x72,0x65,0x74,0x5f,0x63,0x61,0x73,0x74,};
u8 main_keys_key_array_44[] = {0x63,0x6f,0x6e,0x73,0x74,};
u8 main_keys_key_array_48[] = {0x61,0x6c,0x69,0x67,0x6e,0x61,0x73,};
u8 main_keys_key_array_54[] = {0x6e,0x6f,0x65,0x78,0x63,0x65,0x70,0x74,};
u8 main_keys_key_array_56[] = {0x73,0x69,0x67,0x6e,0x65,0x64,};
u8 main_keys_key_array_60[] = {0x67,0x6f,0x74,0x6f,};
u8 main_keys_key_array_61[] = {0x76,0x69,0x72,0x74,0x75,0x61,0x6c,};
u8 main_keys_key_array_65[] = {0x6f,0x70,0x65,0x72,0x61,0x74,0x6f,0x72,};
u8 main_keys_key_array_66[] = {0x65,0x78,0x70,0x6f,0x72,0x74,};
u8 main_keys_key_array_68[] = {0x74,0x79,0x70,0x65,0x6e,0x61,0x6d,0x65,};
u8 main_keys_key_array_71[] = {0x65,0x78,0x70,0x6c,0x69,0x63,0x69,0x74,};
u8 main_keys_key_array_72[] = {0x63,0x61,0x74,0x63,0x68,};
u8 main_keys_key_array_75[] = {0x73,0x74,0x61,0x74,0x69,0x63,0x5f,0x63,0x61,0x73,0x74,};
u8 main_keys_key_array_76[] = {0x74,0x65,0x6d,0x70,0x6c,0x61,0x74,0x65,};
u8 main_keys_key_array_77[] = {0x69,0x66,};
u8 main_keys_key_array_83[] = {0x75,0x6e,0x73,0x69,0x67,0x6e,0x65,0x64,};
u8 main_keys_key_array_84[] = {0x74,0x72,0x79,};
u8 main_keys_key_array_85[] = {0x64,0x79,0x6e,0x61,0x6d,0x69,0x63,0x5f,0x63,0x61,0x73,0x74,};
u8 main_keys_key_array_86[] = {0x72,0x65,0x67,0x69,0x73,0x74,0x65,0x72,};
u8 main_keys_key_array_91[] = {0x65,0x6e,0x75,0x6d,};
u8 main_keys_key_array_92[] = {0x73,0x74,0x72,0x75,0x63,0x74,};
u8 main_keys_key_array_93[] = {0x74,0x79,0x70,0x65,0x69,0x64,};
u8 main_keys_key_array_94[] = {0x73,0x74,0x61,0x74,0x69,0x63,};
u8 main_keys_key_array_95[] = {0x76,0x6f,0x6c,0x61,0x74,0x69,0x6c,0x65,};
u8 main_keys_key_array_97[] = {0x70,0x75,0x62,0x6c,0x69,0x63,};
u8 main_keys_key_array_98[] = {0x73,0x68,0x6f,0x72,0x74,};
u8 main_keys_key_array_99[] = {0x66,0x6f,0x72,};
u8 main_keys_key_array_100[] = {0x63,0x6f,0x6e,0x73,0x74,0x5f,0x63,0x61,0x73,0x74,};
u8 main_keys_key_array_101[] = {0x73,0x77,0x69,0x74,0x63,0x68,};
u8 main_keys_key_array_103[] = {0x74,0x68,0x69,0x73,};
u8 main_keys_key_array_104[] = {0x6e,0x75,0x6c,0x6c,0x70,0x74,0x72,};
u8 main_keys_key_array_106[] = {0x64,0x65,0x6c,0x65,0x74,0x65,};
u8 main_keys_key_array_107[] = {0x65,0x78,0x74,0x65,0x72,0x6e,};
u8 main_keys_key_array_109[] = {0x65,0x6c,0x73,0x65,};
u8 main_keys_key_array_110[] = {0x69,0x6e,0x6c,0x69,0x6e,0x65,};
u8 main_keys_key_array_111[] = {0x6e,0x61,0x6d,0x65,0x73,0x70,0x61,0x63,0x65,};
u8 main_keys_key_array_113[] = {0x75,0x73,0x69,0x6e,0x67,};
u8 main_keys_key_array_115[] = {0x64,0x6f,};
u8 main_keys_key_array_116[] = {0x63,0x6c,0x61,0x73,0x73,};
u8 main_keys_key_array_119[] = {0x74,0x68,0x72,0x65,0x61,0x64,0x5f,0x6c,0x6f,0x63,0x61,0x6c,};
String_Const_u8 main_keys_key_array[121] = {
{main_keys_key_array_0, 7},
u8 main_keys_key_array_38[] = {0x61,0x6c,0x69,0x67,0x6e,0x61,0x73,};
u8 main_keys_key_array_39[] = {0x65,0x6c,0x73,0x65,};
u8 main_keys_key_array_40[] = {0x74,0x72,0x79,};
u8 main_keys_key_array_43[] = {0x66,0x6f,0x72,};
u8 main_keys_key_array_44[] = {0x63,0x6c,0x61,0x73,0x73,};
u8 main_keys_key_array_46[] = {0x69,0x66,};
u8 main_keys_key_array_48[] = {0x63,0x61,0x74,0x63,0x68,};
u8 main_keys_key_array_51[] = {0x69,0x6e,0x74,};
u8 main_keys_key_array_52[] = {0x64,0x65,0x63,0x6c,0x74,0x79,0x70,0x65,};
u8 main_keys_key_array_53[] = {0x64,0x6f,};
u8 main_keys_key_array_54[] = {0x76,0x69,0x72,0x74,0x75,0x61,0x6c,};
u8 main_keys_key_array_58[] = {0x76,0x6f,0x6c,0x61,0x74,0x69,0x6c,0x65,};
u8 main_keys_key_array_59[] = {0x62,0x6f,0x6f,0x6c,};
u8 main_keys_key_array_60[] = {0x61,0x6c,0x69,0x67,0x6e,0x6f,0x66,};
u8 main_keys_key_array_62[] = {0x75,0x6e,0x69,0x6f,0x6e,};
u8 main_keys_key_array_63[] = {0x6f,0x70,0x65,0x72,0x61,0x74,0x6f,0x72,};
u8 main_keys_key_array_65[] = {0x63,0x68,0x61,0x72,};
u8 main_keys_key_array_67[] = {0x74,0x79,0x70,0x65,0x69,0x64,};
u8 main_keys_key_array_72[] = {0x73,0x68,0x6f,0x72,0x74,};
u8 main_keys_key_array_74[] = {0x63,0x6f,0x6e,0x73,0x74,};
u8 main_keys_key_array_75[] = {0x73,0x74,0x61,0x74,0x69,0x63,0x5f,0x61,0x73,0x73,0x65,0x72,0x74,};
u8 main_keys_key_array_76[] = {0x74,0x68,0x69,0x73,};
u8 main_keys_key_array_79[] = {0x76,0x6f,0x69,0x64,};
u8 main_keys_key_array_80[] = {0x64,0x6f,0x75,0x62,0x6c,0x65,};
u8 main_keys_key_array_82[] = {0x67,0x6f,0x74,0x6f,};
u8 main_keys_key_array_86[] = {0x73,0x69,0x67,0x6e,0x65,0x64,};
u8 main_keys_key_array_87[] = {0x70,0x72,0x69,0x76,0x61,0x74,0x65,};
u8 main_keys_key_array_91[] = {0x73,0x74,0x72,0x75,0x63,0x74,};
u8 main_keys_key_array_92[] = {0x74,0x72,0x75,0x65,};
u8 main_keys_key_array_93[] = {0x6c,0x6f,0x6e,0x67,};
u8 main_keys_key_array_100[] = {0x77,0x68,0x69,0x6c,0x65,};
u8 main_keys_key_array_101[] = {0x73,0x69,0x7a,0x65,0x6f,0x66,};
u8 main_keys_key_array_102[] = {0x75,0x6e,0x73,0x69,0x67,0x6e,0x65,0x64,};
u8 main_keys_key_array_103[] = {0x74,0x79,0x70,0x65,0x6e,0x61,0x6d,0x65,};
u8 main_keys_key_array_104[] = {0x65,0x78,0x70,0x6f,0x72,0x74,};
u8 main_keys_key_array_106[] = {0x74,0x68,0x72,0x65,0x61,0x64,0x5f,0x6c,0x6f,0x63,0x61,0x6c,};
u8 main_keys_key_array_107[] = {0x6e,0x61,0x6d,0x65,0x73,0x70,0x61,0x63,0x65,};
u8 main_keys_key_array_108[] = {0x65,0x78,0x70,0x6c,0x69,0x63,0x69,0x74,};
u8 main_keys_key_array_110[] = {0x66,0x72,0x69,0x65,0x6e,0x64,};
u8 main_keys_key_array_114[] = {0x64,0x65,0x6c,0x65,0x74,0x65,};
u8 main_keys_key_array_115[] = {0x66,0x61,0x6c,0x73,0x65,};
u8 main_keys_key_array_116[] = {0x72,0x65,0x74,0x75,0x72,0x6e,};
u8 main_keys_key_array_119[] = {0x73,0x74,0x61,0x74,0x69,0x63,0x5f,0x63,0x61,0x73,0x74,};
u8 main_keys_key_array_120[] = {0x64,0x79,0x6e,0x61,0x6d,0x69,0x63,0x5f,0x63,0x61,0x73,0x74,};
u8 main_keys_key_array_122[] = {0x6e,0x75,0x6c,0x6c,0x70,0x74,0x72,};
String_Const_u8 main_keys_key_array[123] = {
{main_keys_key_array_0, 5},
{main_keys_key_array_1, 6},
{0, 0},
{main_keys_key_array_2, 5},
{main_keys_key_array_3, 3},
{main_keys_key_array_4, 13},
{main_keys_key_array_5, 8},
{0, 0},
{main_keys_key_array_4, 3},
{main_keys_key_array_5, 4},
{0, 0},
{0, 0},
{0, 0},
{main_keys_key_array_9, 16},
{main_keys_key_array_10, 7},
{main_keys_key_array_11, 5},
{main_keys_key_array_12, 3},
{0, 0},
{main_keys_key_array_10, 4},
{main_keys_key_array_11, 4},
{0, 0},
{main_keys_key_array_13, 4},
{main_keys_key_array_14, 4},
{0, 0},
{main_keys_key_array_16, 8},
{main_keys_key_array_17, 7},
{0, 0},
{main_keys_key_array_19, 6},
{main_keys_key_array_20, 4},
{main_keys_key_array_21, 3},
{main_keys_key_array_22, 6},
{main_keys_key_array_14, 8},
{main_keys_key_array_15, 8},
{main_keys_key_array_16, 4},
{main_keys_key_array_17, 8},
{0, 0},
{0, 0},
{main_keys_key_array_25, 5},
{main_keys_key_array_20, 10},
{0, 0},
{0, 0},
{main_keys_key_array_23, 8},
{main_keys_key_array_24, 6},
{main_keys_key_array_25, 7},
{0, 0},
{main_keys_key_array_27, 6},
{0, 0},
{main_keys_key_array_27, 4},
{main_keys_key_array_28, 5},
{main_keys_key_array_29, 6},
{main_keys_key_array_30, 7},
{0, 0},
{main_keys_key_array_32, 6},
{main_keys_key_array_33, 5},
{0, 0},
{main_keys_key_array_35, 3},
{0, 0},
{main_keys_key_array_33, 6},
{0, 0},
{main_keys_key_array_35, 5},
{main_keys_key_array_36, 9},
{main_keys_key_array_37, 5},
{0, 0},
{main_keys_key_array_38, 7},
{0, 0},
{main_keys_key_array_40, 16},
{0, 0},
{main_keys_key_array_39, 4},
{main_keys_key_array_40, 3},
{0, 0},
{0, 0},
{main_keys_key_array_43, 3},
{main_keys_key_array_44, 5},
{0, 0},
{main_keys_key_array_46, 2},
{0, 0},
{main_keys_key_array_48, 5},
{0, 0},
{0, 0},
{main_keys_key_array_48, 7},
{main_keys_key_array_51, 3},
{main_keys_key_array_52, 8},
{main_keys_key_array_53, 2},
{main_keys_key_array_54, 7},
{0, 0},
{0, 0},
{0, 0},
{main_keys_key_array_58, 8},
{main_keys_key_array_59, 4},
{main_keys_key_array_60, 7},
{0, 0},
{main_keys_key_array_62, 5},
{main_keys_key_array_63, 8},
{0, 0},
{main_keys_key_array_65, 4},
{0, 0},
{main_keys_key_array_67, 6},
{0, 0},
{0, 0},
{0, 0},
{0, 0},
{0, 0},
{main_keys_key_array_54, 8},
{0, 0},
{main_keys_key_array_56, 6},
{0, 0},
{0, 0},
{0, 0},
{main_keys_key_array_60, 4},
{main_keys_key_array_61, 7},
{0, 0},
{0, 0},
{0, 0},
{main_keys_key_array_65, 8},
{main_keys_key_array_66, 6},
{0, 0},
{main_keys_key_array_68, 8},
{0, 0},
{0, 0},
{main_keys_key_array_71, 8},
{main_keys_key_array_72, 5},
{0, 0},
{main_keys_key_array_74, 5},
{main_keys_key_array_75, 13},
{main_keys_key_array_76, 4},
{0, 0},
{main_keys_key_array_75, 11},
{main_keys_key_array_76, 8},
{main_keys_key_array_77, 2},
{0, 0},
{main_keys_key_array_79, 4},
{main_keys_key_array_80, 6},
{0, 0},
{main_keys_key_array_82, 4},
{0, 0},
{0, 0},
{0, 0},
{main_keys_key_array_86, 6},
{main_keys_key_array_87, 7},
{0, 0},
{0, 0},
{0, 0},
{main_keys_key_array_91, 6},
{main_keys_key_array_92, 4},
{main_keys_key_array_93, 4},
{0, 0},
{0, 0},
{0, 0},
{0, 0},
{0, 0},
{main_keys_key_array_83, 8},
{main_keys_key_array_84, 3},
{main_keys_key_array_85, 12},
{main_keys_key_array_86, 8},
{0, 0},
{0, 0},
{0, 0},
{0, 0},
{main_keys_key_array_91, 4},
{main_keys_key_array_92, 6},
{main_keys_key_array_93, 6},
{main_keys_key_array_94, 6},
{main_keys_key_array_95, 8},
{0, 0},
{main_keys_key_array_97, 6},
{main_keys_key_array_98, 5},
{main_keys_key_array_99, 3},
{main_keys_key_array_100, 10},
{main_keys_key_array_100, 5},
{main_keys_key_array_101, 6},
{main_keys_key_array_102, 8},
{main_keys_key_array_103, 8},
{main_keys_key_array_104, 6},
{0, 0},
{main_keys_key_array_103, 4},
{main_keys_key_array_104, 7},
{main_keys_key_array_106, 12},
{main_keys_key_array_107, 9},
{main_keys_key_array_108, 8},
{0, 0},
{main_keys_key_array_106, 6},
{main_keys_key_array_107, 6},
{0, 0},
{main_keys_key_array_109, 4},
{main_keys_key_array_110, 6},
{main_keys_key_array_111, 9},
{0, 0},
{main_keys_key_array_113, 5},
{0, 0},
{main_keys_key_array_115, 2},
{main_keys_key_array_116, 5},
{0, 0},
{0, 0},
{main_keys_key_array_119, 12},
{0, 0},
{main_keys_key_array_114, 6},
{main_keys_key_array_115, 5},
{main_keys_key_array_116, 6},
{0, 0},
{0, 0},
{main_keys_key_array_119, 11},
{main_keys_key_array_120, 12},
{0, 0},
{main_keys_key_array_122, 7},
};
Lexeme_Table_Value main_keys_value_array[121] = {
{4, TokenCppKind_Typedef},
{0, 0},
Lexeme_Table_Value main_keys_value_array[123] = {
{4, TokenCppKind_Float},
{4, TokenCppKind_New},
{4, TokenCppKind_StaticAssert},
{4, TokenCppKind_DeclType},
{4, TokenCppKind_Static},
{0, 0},
{0, 0},
{0, 0},
{0, 0},
{4, TokenCppKind_Case},
{4, TokenCppKind_Void},
{0, 0},
{4, TokenCppKind_Long},
{4, TokenCppKind_Bool},
{0, 0},
{4, TokenCppKind_Continue},
{4, TokenCppKind_AlignOf},
{0, 0},
{4, TokenCppKind_SizeOf},
{8, TokenCppKind_LiteralTrue},
{4, TokenCppKind_Asm},
{4, TokenCppKind_Friend},
{4, TokenCppKind_Enum},
{0, 0},
{0, 0},
{4, TokenCppKind_Union},
{0, 0},
{4, TokenCppKind_Char},
{4, TokenCppKind_Break},
{4, TokenCppKind_Return},
{4, TokenCppKind_Default},
{0, 0},
{4, TokenCppKind_Double},
{4, TokenCppKind_While},
{0, 0},
{4, TokenCppKind_Int},
{4, TokenCppKind_Protected},
{8, TokenCppKind_LiteralFalse},
{4, TokenCppKind_Private},
{0, 0},
{4, TokenCppKind_ReinterpretCast},
{0, 0},
{0, 0},
{0, 0},
{4, TokenCppKind_Const},
{0, 0},
{0, 0},
{0, 0},
{4, TokenCppKind_AlignAs},
{0, 0},
{0, 0},
{0, 0},
{0, 0},
{4, TokenCppKind_Typedef},
{4, TokenCppKind_Break},
{4, TokenCppKind_New},
{0, 0},
{4, TokenCppKind_NoExcept},
{4, TokenCppKind_Register},
{4, TokenCppKind_Case},
{4, TokenCppKind_Continue},
{0, 0},
{4, TokenCppKind_Signed},
{0, 0},
{4, TokenCppKind_ConstCast},
{0, 0},
{0, 0},
{4, TokenCppKind_Template},
{4, TokenCppKind_Inline},
{4, TokenCppKind_Default},
{0, 0},
{4, TokenCppKind_Extern},
{0, 0},
{4, TokenCppKind_Public},
{0, 0},
{0, 0},
{0, 0},
{4, TokenCppKind_Goto},
{4, TokenCppKind_Switch},
{0, 0},
{4, TokenCppKind_Using},
{4, TokenCppKind_Protected},
{0, 0},
{4, TokenCppKind_AlignAs},
{4, TokenCppKind_Else},
{4, TokenCppKind_Try},
{0, 0},
{0, 0},
{4, TokenCppKind_For},
{4, TokenCppKind_Class},
{0, 0},
{4, TokenCppKind_If},
{0, 0},
{4, TokenCppKind_Catch},
{0, 0},
{0, 0},
{4, TokenCppKind_Int},
{4, TokenCppKind_DeclType},
{4, TokenCppKind_Do},
{4, TokenCppKind_Virtual},
{0, 0},
{0, 0},
{0, 0},
{4, TokenCppKind_Volatile},
{4, TokenCppKind_Bool},
{4, TokenCppKind_AlignOf},
{0, 0},
{4, TokenCppKind_Union},
{4, TokenCppKind_Operator},
{0, 0},
{4, TokenCppKind_Char},
{0, 0},
{4, TokenCppKind_TypeID},
{0, 0},
{0, 0},
{0, 0},
{0, 0},
{4, TokenCppKind_Short},
{0, 0},
{4, TokenCppKind_Const},
{4, TokenCppKind_StaticAssert},
{4, TokenCppKind_This},
{0, 0},
{0, 0},
{4, TokenCppKind_Void},
{4, TokenCppKind_Double},
{0, 0},
{4, TokenCppKind_Goto},
{0, 0},
{0, 0},
{0, 0},
{4, TokenCppKind_Signed},
{4, TokenCppKind_Private},
{0, 0},
{0, 0},
{0, 0},
{4, TokenCppKind_Struct},
{8, TokenCppKind_LiteralTrue},
{4, TokenCppKind_Long},
{0, 0},
{0, 0},
{0, 0},
{0, 0},
{0, 0},
{0, 0},
{4, TokenCppKind_While},
{4, TokenCppKind_SizeOf},
{4, TokenCppKind_Unsigned},
{4, TokenCppKind_Typename},
{4, TokenCppKind_Export},
{0, 0},
{4, TokenCppKind_Typename},
{0, 0},
{0, 0},
{4, TokenCppKind_ThreadLocal},
{4, TokenCppKind_Namespace},
{4, TokenCppKind_Explicit},
{4, TokenCppKind_Catch},
{0, 0},
{4, TokenCppKind_Friend},
{0, 0},
{0, 0},
{0, 0},
{4, TokenCppKind_Delete},
{8, TokenCppKind_LiteralFalse},
{4, TokenCppKind_Return},
{0, 0},
{0, 0},
{4, TokenCppKind_StaticCast},
{4, TokenCppKind_Template},
{4, TokenCppKind_If},
{0, 0},
{0, 0},
{0, 0},
{0, 0},
{0, 0},
{4, TokenCppKind_Unsigned},
{4, TokenCppKind_Try},
{4, TokenCppKind_DynamicCast},
{4, TokenCppKind_Register},
{0, 0},
{0, 0},
{0, 0},
{0, 0},
{4, TokenCppKind_Enum},
{4, TokenCppKind_Struct},
{4, TokenCppKind_TypeID},
{4, TokenCppKind_Static},
{4, TokenCppKind_Volatile},
{0, 0},
{4, TokenCppKind_Public},
{4, TokenCppKind_Short},
{4, TokenCppKind_For},
{4, TokenCppKind_ConstCast},
{4, TokenCppKind_Switch},
{0, 0},
{4, TokenCppKind_This},
{4, TokenCppKind_NullPtr},
{0, 0},
{4, TokenCppKind_Delete},
{4, TokenCppKind_Extern},
{0, 0},
{4, TokenCppKind_Else},
{4, TokenCppKind_Inline},
{4, TokenCppKind_Namespace},
{0, 0},
{4, TokenCppKind_Using},
{0, 0},
{4, TokenCppKind_Do},
{4, TokenCppKind_Class},
{0, 0},
{0, 0},
{4, TokenCppKind_ThreadLocal},
{0, 0},
};
i32 main_keys_slot_count = 121;
u64 main_keys_seed = 0x25509496d6df2725;
i32 main_keys_slot_count = 123;
u64 main_keys_seed = 0xbb69064fdc5ac64f;
u64 pp_directives_hash_array[25] = {
0x0000000000000000,0xa14a48a955ec8363,0x0000000000000000,0x7136ce53f348205b,
0x37ce6c4c8b78b22f,0x37ce6c4cbe897123,0x0000000000000000,0x0000000000000000,
0x34cc7d0370d48693,0x0000000000000000,0x85a685922339fb23,0x0000000000000000,
0xa14a48a95710f7e3,0x0000000000000000,0x34cc7d0370d49bc9,0x34cc7d0370df735f,
0x713637c0adca7df7,0x0000000000000000,0x0000000000000000,0xa14a48a9743d0c09,
0x37ce6c4c19255fdf,0xa14a48aa88a0f2e3,0x0000000000000000,0xa14a48a958e03643,
0x37ce6c4e49825775,
0x0000000000000000,0x37166567f6e8bac5,0x0000000000000000,0x8fb3486b4bb39405,
0x0000000000000000,0x0000000000000000,0x8fb35fd552e30d69,0x9440e597bcae24e9,
0x94401adc37f37bb7,0x37166567f6e99221,0x0000000000000000,0x94401aa078ed7699,
0x37166562cf1c063b,0x0000000000000000,0x0000000000000000,0x9f4ed70ee1674f6b,
0x37166562c9efabe1,0x0000000000000000,0x9f4ed70ee1500e99,0x37166562c58e23e1,
0x9f4ed70ee1674d31,0x0000000000000000,0x77bed727ba8f4101,0x94401add6737cfe1,
0x0000000000000000,
};
u8 pp_directives_key_array_1[] = {0x69,0x66,0x64,0x65,0x66,};
u8 pp_directives_key_array_3[] = {0x76,0x65,0x72,0x73,0x69,0x6f,0x6e,};
u8 pp_directives_key_array_4[] = {0x69,0x6d,0x70,0x6f,0x72,0x74,};
u8 pp_directives_key_array_5[] = {0x69,0x66,0x6e,0x64,0x65,0x66,};
u8 pp_directives_key_array_8[] = {0x65,0x6c,0x69,0x66,};
u8 pp_directives_key_array_10[] = {0x69,0x66,};
u8 pp_directives_key_array_12[] = {0x65,0x6e,0x64,0x69,0x66,};
u8 pp_directives_key_array_14[] = {0x65,0x6c,0x73,0x65,};
u8 pp_directives_key_array_15[] = {0x6c,0x69,0x6e,0x65,};
u8 pp_directives_key_array_16[] = {0x69,0x6e,0x63,0x6c,0x75,0x64,0x65,};
u8 pp_directives_key_array_19[] = {0x75,0x73,0x69,0x6e,0x67,};
u8 pp_directives_key_array_20[] = {0x64,0x65,0x66,0x69,0x6e,0x65,};
u8 pp_directives_key_array_21[] = {0x75,0x6e,0x64,0x65,0x66,};
u8 pp_directives_key_array_23[] = {0x65,0x72,0x72,0x6f,0x72,};
u8 pp_directives_key_array_24[] = {0x70,0x72,0x61,0x67,0x6d,0x61,};
u8 pp_directives_key_array_1[] = {0x65,0x72,0x72,0x6f,0x72,};
u8 pp_directives_key_array_3[] = {0x69,0x6e,0x63,0x6c,0x75,0x64,0x65,};
u8 pp_directives_key_array_6[] = {0x76,0x65,0x72,0x73,0x69,0x6f,0x6e,};
u8 pp_directives_key_array_7[] = {0x69,0x6d,0x70,0x6f,0x72,0x74,};
u8 pp_directives_key_array_8[] = {0x70,0x72,0x61,0x67,0x6d,0x61,};
u8 pp_directives_key_array_9[] = {0x65,0x6e,0x64,0x69,0x66,};
u8 pp_directives_key_array_11[] = {0x64,0x65,0x66,0x69,0x6e,0x65,};
u8 pp_directives_key_array_12[] = {0x75,0x73,0x69,0x6e,0x67,};
u8 pp_directives_key_array_15[] = {0x65,0x6c,0x73,0x65,};
u8 pp_directives_key_array_16[] = {0x69,0x66,0x64,0x65,0x66,};
u8 pp_directives_key_array_18[] = {0x6c,0x69,0x6e,0x65,};
u8 pp_directives_key_array_19[] = {0x75,0x6e,0x64,0x65,0x66,};
u8 pp_directives_key_array_20[] = {0x65,0x6c,0x69,0x66,};
u8 pp_directives_key_array_22[] = {0x69,0x66,};
u8 pp_directives_key_array_23[] = {0x69,0x66,0x6e,0x64,0x65,0x66,};
String_Const_u8 pp_directives_key_array[25] = {
{0, 0},
{pp_directives_key_array_1, 5},
{0, 0},
{pp_directives_key_array_3, 7},
{pp_directives_key_array_4, 6},
{pp_directives_key_array_5, 6},
{0, 0},
{0, 0},
{pp_directives_key_array_8, 4},
{0, 0},
{pp_directives_key_array_10, 2},
{pp_directives_key_array_6, 7},
{pp_directives_key_array_7, 6},
{pp_directives_key_array_8, 6},
{pp_directives_key_array_9, 5},
{0, 0},
{pp_directives_key_array_11, 6},
{pp_directives_key_array_12, 5},
{0, 0},
{pp_directives_key_array_14, 4},
{0, 0},
{pp_directives_key_array_15, 4},
{pp_directives_key_array_16, 7},
{0, 0},
{pp_directives_key_array_16, 5},
{0, 0},
{pp_directives_key_array_18, 4},
{pp_directives_key_array_19, 5},
{pp_directives_key_array_20, 6},
{pp_directives_key_array_21, 5},
{pp_directives_key_array_20, 4},
{0, 0},
{pp_directives_key_array_22, 2},
{pp_directives_key_array_23, 6},
{0, 0},
{pp_directives_key_array_23, 5},
{pp_directives_key_array_24, 6},
};
Lexeme_Table_Value pp_directives_value_array[25] = {
{0, 0},
{5, TokenCppKind_PPIfDef},
{5, TokenCppKind_PPError},
{0, 0},
{5, TokenCppKind_PPVersion},
{5, TokenCppKind_PPImport},
{5, TokenCppKind_PPIfNDef},
{0, 0},
{0, 0},
{5, TokenCppKind_PPElIf},
{0, 0},
{5, TokenCppKind_PPIf},
{0, 0},
{5, TokenCppKind_PPEndIf},
{0, 0},
{5, TokenCppKind_PPElse},
{5, TokenCppKind_PPLine},
{5, TokenCppKind_PPInclude},
{0, 0},
{0, 0},
{5, TokenCppKind_PPUsing},
{5, TokenCppKind_PPDefine},
{5, TokenCppKind_PPUndef},
{0, 0},
{5, TokenCppKind_PPError},
{5, TokenCppKind_PPVersion},
{5, TokenCppKind_PPImport},
{5, TokenCppKind_PPPragma},
{5, TokenCppKind_PPEndIf},
{0, 0},
{5, TokenCppKind_PPDefine},
{5, TokenCppKind_PPUsing},
{0, 0},
{0, 0},
{5, TokenCppKind_PPElse},
{5, TokenCppKind_PPIfDef},
{0, 0},
{5, TokenCppKind_PPLine},
{5, TokenCppKind_PPUndef},
{5, TokenCppKind_PPElIf},
{0, 0},
{5, TokenCppKind_PPIf},
{5, TokenCppKind_PPIfNDef},
{0, 0},
};
i32 pp_directives_slot_count = 25;
u64 pp_directives_seed = 0x6a6565df267ce22a;
u64 pp_directives_seed = 0xf12d21fb24c582d4;
u64 pp_keys_hash_array[2] = {
0x0000000000000000,0xa92d334d98f81307,
0x0000000000000000,0x9a4e1c5cf21f8e6f,
};
u8 pp_keys_key_array_1[] = {0x64,0x65,0x66,0x69,0x6e,0x65,0x64,};
String_Const_u8 pp_keys_key_array[2] = {
@ -483,7 +487,7 @@ Lexeme_Table_Value pp_keys_value_array[2] = {
{4, TokenCppKind_PPDefined},
};
i32 pp_keys_slot_count = 2;
u64 pp_keys_seed = 0x0a7073ccb09f1aa3;
u64 pp_keys_seed = 0x8c801800db46fd2b;
struct Lex_State_Cpp{
u32 flags_ZF0;
u32 flags_KF0;