New better arena management

master
Allen Webster 2020-03-11 16:22:37 -07:00
parent 7b77702492
commit 73fdc838f1
33 changed files with 390 additions and 329 deletions

View File

@ -194,7 +194,7 @@ App_Init_Sig(app_init){
models->hard_exit = false;
models->config_api = api;
models->virtual_event_arena = reserve_arena(tctx);
models->virtual_event_arena = make_arena_system();
profile_init(&models->profile_list);
@ -640,7 +640,7 @@ App_Step_Sig(app_step){
}
}
linalloc_clear(models->virtual_event_arena);
linalloc_clear(&models->virtual_event_arena);
models->free_virtual_event = 0;
models->first_virtual_event = 0;
models->last_virtual_event = 0;

View File

@ -64,13 +64,13 @@ function void
models_push_virtual_event(Models *models, Input_Event *event){
Model_Input_Event_Node *node = models->free_virtual_event;
if (node == 0){
node = push_array(models->virtual_event_arena, Model_Input_Event_Node, 1);
node = push_array(&models->virtual_event_arena, Model_Input_Event_Node, 1);
}
else{
sll_stack_pop(models->free_virtual_event);
}
sll_queue_push(models->first_virtual_event, models->last_virtual_event, node);
node->event = copy_input_event(models->virtual_event_arena, event);
node->event = copy_input_event(&models->virtual_event_arena, event);
}
function Input_Event
@ -901,7 +901,7 @@ buffer_save(Application_Links *app, Buffer_ID buffer_id, String_Const_u8 file_na
if (!skip_save){
Thread_Context *tctx = app->tctx;
Scratch_Block scratch(app->tctx, Scratch_Share);
Scratch_Block scratch(tctx);
String_Const_u8 name = push_string_copy(scratch, file_name);
save_file_to_name(tctx, models, file, name.str);
result = true;
@ -973,7 +973,7 @@ buffer_reopen(Application_Links *app, Buffer_ID buffer_id, Buffer_Reopen_Flag fl
{
Models *models = (Models*)app->cmd_context;
Thread_Context *tctx = app->tctx;
Scratch_Block scratch(tctx, Scratch_Share);
Scratch_Block scratch(tctx);
Editing_File *file = imp_get_file(models, buffer_id);
Buffer_Reopen_Result result = BufferReopenResult_Failed;
if (api_check_buffer(file)){
@ -1825,7 +1825,7 @@ get_managed_scope_with_multiple_dependencies(Application_Links *app, Managed_Sco
Models *models = (Models*)app->cmd_context;
Lifetime_Allocator *lifetime_allocator = &models->lifetime_allocator;
Scratch_Block scratch(app->tctx, Scratch_Share);
Scratch_Block scratch(app);
// TODO(allen): revisit this
struct Node_Ptr{
@ -2832,7 +2832,6 @@ text_layout_create(Application_Links *app, Buffer_ID buffer_id, Rect_f32 rect, B
if (api_check_buffer(file)){
Thread_Context *tctx = app->tctx;
Scratch_Block scratch(tctx);
Arena *arena = reserve_arena(tctx);
Face *face = file_get_face(models, file);
Gap_Buffer *buffer = &file->state.buffer;
@ -2861,8 +2860,12 @@ text_layout_create(Application_Links *app, Buffer_ID buffer_id, Rect_f32 rect, B
buffer_get_last_pos_from_line_number(buffer, visible_line_number_range.max));
i64 item_count = range_size_inclusive(visible_range);
ARGB_Color *colors_array = push_array_zero(arena, ARGB_Color, item_count);
result = text_layout_new(&models->text_layouts, arena, buffer_id, buffer_point,
Arena arena = make_arena_system();
Arena *arena_ptr = push_array_zero(&arena, Arena, 1);
*arena_ptr = arena;
ARGB_Color *colors_array = push_array_zero(arena_ptr, ARGB_Color, item_count);
result = text_layout_new(&models->text_layouts, arena_ptr, buffer_id, buffer_point,
visible_range, visible_line_number_range, rect, colors_array,
layout_func);
}

View File

@ -82,7 +82,7 @@ struct Models{
Model_View_Command_Function *first_view_cmd_func;
Model_View_Command_Function *last_view_cmd_func;
Arena *virtual_event_arena;
Arena virtual_event_arena;
Model_Input_Event_Node *free_virtual_event;
Model_Input_Event_Node *first_virtual_event;
Model_Input_Event_Node *last_virtual_event;

View File

@ -117,7 +117,7 @@ edit_fix_markers(Thread_Context *tctx, Models *models, Editing_File *file, Batch
}
cursor_max += total_marker_count;
Scratch_Block scratch(tctx, Scratch_Share);
Scratch_Block scratch(tctx);
Cursor_With_Index *cursors = push_array(scratch, Cursor_With_Index, cursor_max);
Cursor_With_Index *r_cursors = push_array(scratch, Cursor_With_Index, cursor_max);
@ -398,7 +398,7 @@ edit_merge_history_range(Thread_Context *tctx, Models *models, Editing_File *fil
}break;
}
}
Scratch_Block scratch(tctx, Scratch_Share);
Scratch_Block scratch(tctx);
history_merge_records(scratch, history, first_index, last_index);
if (current_index >= last_index){
current_index -= (last_index - first_index);

View File

@ -142,7 +142,7 @@ save_file_to_name(Thread_Context *tctx, Models *models, Editing_File *file, u8 *
Gap_Buffer *buffer = &file->state.buffer;
b32 dos_write_mode = file->settings.dos_write_mode;
Scratch_Block scratch(tctx, Scratch_Share);
Scratch_Block scratch(tctx);
if (!using_actual_file_name){
String_Const_u8 s_file_name = SCu8(file_name);
@ -199,7 +199,7 @@ file_get_layout_func(Editing_File *file){
internal void
file_create_from_string(Thread_Context *tctx, Models *models, Editing_File *file, String_Const_u8 val, File_Attributes attributes){
Scratch_Block scratch(tctx, Scratch_Share);
Scratch_Block scratch(tctx);
Base_Allocator *allocator = tctx->allocator;
block_zero_struct(&file->state);

View File

@ -131,7 +131,7 @@ global_history_adjust_edit_grouping_counter(Global_History *global_history, i32
internal void
history_init(Thread_Context *tctx, Models *models, History *history){
history->activated = true;
history->arena = reserve_arena(tctx, KB(32));
history->arena = make_arena_system();
heap_init(&history->heap, tctx->allocator);
history->heap_wrapper = base_allocator_on_heap(&history->heap);
dll_init_sentinel(&history->free_records);
@ -148,7 +148,7 @@ history_is_activated(History *history){
internal void
history_free(Thread_Context *tctx, History *history){
if (history->activated){
release_arena(tctx, history->arena);
linalloc_clear(&history->arena);
heap_free_all(&history->heap);
block_zero_struct(history);
}
@ -248,13 +248,13 @@ history_record_edit(Global_History *global_history, History *history, Gap_Buffer
Record *new_record = history__allocate_record(history);
history__stash_record(history, new_record);
new_record->restore_point = begin_temp(history->arena);
new_record->restore_point = begin_temp(&history->arena);
new_record->edit_number = global_history_get_edit_number(global_history);
new_record->kind = RecordKind_Single;
new_record->single.forward_text = push_string_copy(history->arena, edit.text);
new_record->single.backward_text = buffer_stringify(history->arena, buffer, edit.range);
new_record->single.forward_text = push_string_copy(&history->arena, edit.text);
new_record->single.backward_text = buffer_stringify(&history->arena, buffer, edit.range);
new_record->single.first = edit.range.first;
Assert(history->record_lookup.count == history->record_count);
@ -344,8 +344,8 @@ history__optimize_group(Arena *scratch, History *history, Record *record){
left->edit_number = right->edit_number;
left->single.first = merged_first;
left->single.forward_text = push_string_copy(history->arena, merged_forward);
left->single.backward_text = push_string_copy(history->arena, merged_backward);
left->single.forward_text = push_string_copy(&history->arena, merged_forward);
left->single.backward_text = push_string_copy(&history->arena, merged_backward);
history__free_single_node(history, &right->node);
record->group.count -= 1;

View File

@ -44,7 +44,7 @@ struct Record_Ptr_Lookup_Table{
struct History{
b32 activated;
Arena *arena;
Arena arena;
Heap heap;
Base_Allocator heap_wrapper;
Node free_records;

View File

@ -12,7 +12,7 @@
internal void
text_layout_init(Thread_Context *tctx, Text_Layout_Container *container){
block_zero_struct(container);
container->node_arena = reserve_arena(tctx);
container->node_arena = make_arena_system();
container->table = make_table_u64_u64(tctx->allocator, 20);
}
@ -20,7 +20,7 @@ internal Text_Layout*
text_layout_new__alloc_layout(Text_Layout_Container *container){
Text_Layout *node = container->free_nodes;
if (node == 0){
node = push_array(container->node_arena, Text_Layout, 1);
node = push_array(&container->node_arena, Text_Layout, 1);
}
else{
sll_stack_pop(container->free_nodes);
@ -30,7 +30,8 @@ text_layout_new__alloc_layout(Text_Layout_Container *container){
internal void
text_layout_release(Thread_Context *tctx, Models *models, Text_Layout_Container *container, Text_Layout *layout){
release_arena(tctx, layout->arena);
Arena arena = *layout->arena;
linalloc_clear(&arena);
sll_stack_push(container->free_nodes, layout);
}
@ -105,7 +106,7 @@ text_layout_render(Thread_Context *tctx, Models *models, Text_Layout *layout,
block = block->next){
Layout_Item *item = block->items;
i64 count = block->item_count;
ARGB_Color *item_colors = layout->item_colors;
ARGB_Color *item_colors = layout->item_colors;
for (i32 i = 0; i < count; i += 1, item += 1){
if (item->codepoint != 0){
ARGB_Color color = 0;

View File

@ -21,13 +21,13 @@ union Text_Layout{
Range_i64 visible_range;
Range_i64 visible_line_number_range;
Rect_f32 rect;
ARGB_Color *item_colors;
ARGB_Color *item_colors;
Layout_Function *layout_func;
};
};
struct Text_Layout_Container{
Arena *node_arena;
Arena node_arena;
Text_Layout *free_nodes;
Table_u64_u64 table;
Text_Layout_ID id_counter;

View File

@ -469,12 +469,12 @@ view_set_file(Thread_Context *tctx, Models *models, View *view, Editing_File *fi
function void
view_push_context(View *view, View_Context *ctx){
Temp_Memory pop_me = begin_temp(view->node_arena);
View_Context_Node *node = push_array_zero(view->node_arena, View_Context_Node, 1);
Temp_Memory pop_me = begin_temp(&view->node_arena);
View_Context_Node *node = push_array_zero(&view->node_arena, View_Context_Node, 1);
sll_stack_push(view->ctx, node);
node->pop_me = pop_me;
block_copy_struct(&node->ctx, ctx);
node->delta_rule_memory = push_array_zero(view->node_arena, u8, ctx->delta_rule_memory_size);
node->delta_rule_memory = push_array_zero(&view->node_arena, u8, ctx->delta_rule_memory_size);
}
function void
@ -573,7 +573,7 @@ view_init(Thread_Context *tctx, Models *models, View *view, Editing_File *initia
Custom_Command_Function *event_context_base){
view_set_file(tctx, models, view, initial_buffer);
view->node_arena = reserve_arena(tctx);
view->node_arena = make_arena_system();
View_Context first_ctx = {};
first_ctx.render_caller = models->render_caller;

View File

@ -83,7 +83,7 @@ struct View{
Coroutine *co;
Co_Out co_out;
Arena *node_arena;
Arena node_arena;
View_Context_Node *ctx;
b8 hide_scrollbar;

View File

@ -4,38 +4,28 @@
// TOP
Scratch_Block::Scratch_Block(Application_Links *app, Scratch_Share_Code share){
scratch_block__init(this, get_thread_context(app), share);
}
Scratch_Block::Scratch_Block(Application_Links *app){
scratch_block__init(this, get_thread_context(app), share_code_default);
Thread_Context *t = this->tctx = get_thread_context(app);
this->arena = tctx_reserve(t);
this->temp = begin_temp(this->arena);
}
////////////////////////////////
internal Arena*
reserve_arena(Application_Links *app, u64 chunk_size, u64 align){
Thread_Context *tctx = get_thread_context(app);
return(reserve_arena(tctx, chunk_size, align));
Scratch_Block::Scratch_Block(Application_Links *app, Arena *a1){
Thread_Context *t = this->tctx = get_thread_context(app);
this->arena = tctx_reserve(t, a1);
this->temp = begin_temp(this->arena);
}
internal Arena*
reserve_arena(Application_Links *app, u64 chunk_size){
Thread_Context *tctx = get_thread_context(app);
return(reserve_arena(tctx, chunk_size));
Scratch_Block::Scratch_Block(Application_Links *app, Arena *a1, Arena *a2){
Thread_Context *t = this->tctx = get_thread_context(app);
this->arena = tctx_reserve(t, a1, a2);
this->temp = begin_temp(this->arena);
}
internal Arena*
reserve_arena(Application_Links *app){
Thread_Context *tctx = get_thread_context(app);
return(reserve_arena(tctx));
}
internal void
release_arena(Application_Links *app, Arena *arena){
Thread_Context *tctx = get_thread_context(app);
release_arena(tctx, arena);
Scratch_Block::Scratch_Block(Application_Links *app, Arena *a1, Arena *a2, Arena *a3){
Thread_Context *t = this->tctx = get_thread_context(app);
this->arena = tctx_reserve(t, a1, a2, a3);
this->temp = begin_temp(this->arena);
}
// BOTTOM

View File

@ -1744,7 +1744,7 @@ CUSTOM_DOC("Advances forwards through the undo history of the current buffer.")
CUSTOM_COMMAND_SIG(undo_all_buffers)
CUSTOM_DOC("Advances backward through the undo history in the buffer containing the most recent regular edit.")
{
Scratch_Block scratch(app, Scratch_Share);
Scratch_Block scratch(app);
i32 highest_edit_number = -1;
Buffer_ID first_buffer_match = 0;
Buffer_ID last_buffer_match = 0;
@ -1815,7 +1815,7 @@ CUSTOM_DOC("Advances backward through the undo history in the buffer containing
CUSTOM_COMMAND_SIG(redo_all_buffers)
CUSTOM_DOC("Advances forward through the undo history in the buffer containing the most recent regular edit.")
{
Scratch_Block scratch(app, Scratch_Share);
Scratch_Block scratch(app);
i32 lowest_edit_number = 0x7FFFFFFF;
Buffer_ID first_buffer_match = 0;

View File

@ -3268,87 +3268,137 @@ thread_ctx_release(Thread_Context *tctx){
node = node->next){
linalloc_clear(&node->arena);
}
for (Arena_Node *node = tctx->used_first;
node != 0;
node = node->next){
linalloc_clear(&node->arena);
}
linalloc_clear(&tctx->node_arena);
block_zero_struct(tctx);
}
function Arena*
reserve_arena(Thread_Context *tctx, u64 chunk_size, u64 align){
Arena_Node *node = tctx->free_arenas;
if (node != 0){
function Arena_Node*
tctx__alloc_arena_node(Thread_Context *tctx){
Arena_Node *result = tctx->free_arenas;
if (result != 0){
sll_stack_pop(tctx->free_arenas);
}
else{
node = push_array_zero(&tctx->node_arena, Arena_Node, 1);
result = push_array_zero(&tctx->node_arena, Arena_Node, 1);
result->arena = make_arena(tctx->allocator, KB(16), 8);
}
node->arena = make_arena(tctx->allocator, chunk_size, align);
return(result);
}
function void
tctx__free_arena_node(Thread_Context *tctx, Arena_Node *node){
sll_stack_push(tctx->free_arenas, node);
}
function Arena*
tctx_reserve(Thread_Context *tctx){
Arena_Node *node = tctx->used_first;
if (node == 0){
node = tctx__alloc_arena_node(tctx);
zdll_push_back(tctx->used_first, tctx->used_last, node);
}
node->ref_counter += 1;
return(&node->arena);
}
function Arena*
reserve_arena(Thread_Context *tctx, u64 chunk_size){
return(reserve_arena(tctx, chunk_size, 8));
tctx_reserve(Thread_Context *tctx, Arena *a1){
Arena_Node *node = tctx->used_first;
for (; node != 0; node = node->next){
Arena *na = &node->arena;
if (na != a1){
break;
}
}
if (node == 0){
node = tctx__alloc_arena_node(tctx);
zdll_push_back(tctx->used_first, tctx->used_last, node);
}
node->ref_counter += 1;
return(&node->arena);
}
function Arena*
reserve_arena(Thread_Context *tctx){
return(reserve_arena(tctx, KB(64), 8));
tctx_reserve(Thread_Context *tctx, Arena *a1, Arena *a2){
Arena_Node *node = tctx->used_first;
for (; node != 0; node = node->next){
Arena *na = &node->arena;
if (na != a1 && na != a2){
break;
}
}
if (node == 0){
node = tctx__alloc_arena_node(tctx);
zdll_push_back(tctx->used_first, tctx->used_last, node);
}
node->ref_counter += 1;
return(&node->arena);
}
function Arena*
tctx_reserve(Thread_Context *tctx, Arena *a1, Arena *a2, Arena *a3){
Arena_Node *node = tctx->used_first;
for (; node != 0; node = node->next){
Arena *na = &node->arena;
if (na != a1 && na != a2 && na != a3){
break;
}
}
if (node == 0){
node = tctx__alloc_arena_node(tctx);
zdll_push_back(tctx->used_first, tctx->used_last, node);
}
node->ref_counter += 1;
return(&node->arena);
}
function void
release_arena(Thread_Context *tctx, Arena *arena){
tctx_release(Thread_Context *tctx, Arena *arena){
Arena_Node *node = CastFromMember(Arena_Node, arena, arena);
linalloc_clear(arena);
sll_stack_push(tctx->free_arenas, node);
node->ref_counter -= 1;
if (node->ref_counter == 0){
// TODO(allen): make a version of clear that keeps memory allocated from the sytem level
// but still resets to zero.
linalloc_clear(&node->arena);
zdll_remove(tctx->used_first, tctx->used_last, node);
sll_stack_push(tctx->free_arenas, node);
}
}
////////////////////////////////
function void
scratch_block__init(Scratch_Block *block, Thread_Context *tctx, Scratch_Share_Code share){
Arena *arena = tctx->sharable_scratch;
if (arena != 0){
block->arena = arena;
block->temp = begin_temp(arena);
block->do_full_clear = false;
}
else{
arena = reserve_arena(tctx);
block->arena = arena;
block_zero_struct(&block->temp);
block->do_full_clear = true;
}
block->tctx = tctx;
block->sharable_restore = tctx->sharable_scratch;
if (share == Scratch_Share){
tctx->sharable_scratch = arena;
}
else{
tctx->sharable_scratch = 0;
}
Scratch_Block::Scratch_Block(Thread_Context *t){
this->tctx = t;
this->arena = tctx_reserve(t);
this->temp = begin_temp(this->arena);
}
global_const Scratch_Share_Code share_code_default = Scratch_DontShare;
Scratch_Block::Scratch_Block(Thread_Context *tctx, Scratch_Share_Code share){
scratch_block__init(this, tctx, share);
Scratch_Block::Scratch_Block(Thread_Context *t, Arena *a1){
this->tctx = t;
this->arena = tctx_reserve(t, a1);
this->temp = begin_temp(this->arena);
}
Scratch_Block::Scratch_Block(Thread_Context *tctx){
scratch_block__init(this, tctx, share_code_default);
Scratch_Block::Scratch_Block(Thread_Context *t, Arena *a1, Arena *a2){
this->tctx = t;
this->arena = tctx_reserve(t, a1, a2);
this->temp = begin_temp(this->arena);
}
Scratch_Block::Scratch_Block(Thread_Context *t, Arena *a1, Arena *a2, Arena *a3){
this->tctx = t;
this->arena = tctx_reserve(t, a1, a2, a3);
this->temp = begin_temp(this->arena);
}
Scratch_Block::~Scratch_Block(){
if (this->do_full_clear){
Assert(this->tctx != 0);
release_arena(this->tctx, this->arena);
}
else{
end_temp(this->temp);
}
if (this->tctx != 0){
this->tctx->sharable_scratch = this->sharable_restore;
}
end_temp(this->temp);
tctx_release(this->tctx, this->arena);
}
Scratch_Block::operator Arena*(){
@ -3357,12 +3407,7 @@ Scratch_Block::operator Arena*(){
void
Scratch_Block::restore(void){
if (this->do_full_clear){
linalloc_clear(this->arena);
}
else{
end_temp(this->temp);
}
end_temp(this->temp);
}
Temp_Memory_Block::Temp_Memory_Block(Temp_Memory t){

View File

@ -1305,11 +1305,6 @@ struct Temp_Memory{
};
};
struct Arena_Node{
Arena_Node *next;
Arena arena;
};
////////////////////////////////
typedef u64 Profile_ID;
@ -1348,12 +1343,20 @@ enum{
ThreadKind_AsyncTasks,
};
struct Arena_Node{
Arena_Node *next;
Arena_Node *prev;
Arena arena;
i32 ref_counter;
};
struct Thread_Context{
Thread_Kind kind;
Base_Allocator *allocator;
Arena node_arena;
Arena_Node *used_first;
Arena_Node *used_last;
Arena_Node *free_arenas;
Arena *sharable_scratch;
Base_Allocator *prof_allocator;
Profile_ID prof_id_counter;
@ -1365,23 +1368,19 @@ struct Thread_Context{
void *user_data;
};
typedef i32 Scratch_Share_Code;
enum{
Scratch_DontShare,
Scratch_Share,
};
struct Scratch_Block{
Thread_Context *tctx;
Arena *arena;
Temp_Memory temp;
b32 do_full_clear;
Thread_Context *tctx;
Arena *sharable_restore;
Scratch_Block(struct Thread_Context *tctx, Scratch_Share_Code share);
Scratch_Block(struct Thread_Context *tctx);
Scratch_Block(struct Application_Links *app, Scratch_Share_Code share);
Scratch_Block(struct Thread_Context *tctx, Arena *a1);
Scratch_Block(struct Thread_Context *tctx, Arena *a1, Arena *a2);
Scratch_Block(struct Thread_Context *tctx, Arena *a1, Arena *a2, Arena *a3);
Scratch_Block(struct Application_Links *app);
Scratch_Block(struct Application_Links *app, Arena *a1);
Scratch_Block(struct Application_Links *app, Arena *a1, Arena *a2);
Scratch_Block(struct Application_Links *app, Arena *a1, Arena *a2, Arena *a3);
~Scratch_Block();
operator Arena*();
void restore(void);

View File

@ -210,7 +210,7 @@ write_snippet(Application_Links *app, View_ID view, Buffer_ID buffer,
function Snippet*
get_snippet_from_user(Application_Links *app, Snippet *snippets, i32 snippet_count,
String_Const_u8 query){
Scratch_Block scratch(app, Scratch_Share);
Scratch_Block scratch(app);
Lister_Block lister(app, scratch);
lister_set_query(lister, query);
lister_set_default_handlers(lister);

View File

@ -42,7 +42,7 @@ mapping__alloc_map(Mapping *mapping){
sll_stack_pop(mapping->free_maps);
}
else{
result = push_array(mapping->node_arena, Command_Map, 1);
result = push_array(&mapping->node_arena, Command_Map, 1);
}
zdll_push_back(mapping->first_map, mapping->last_map, result);
return(result);
@ -61,7 +61,7 @@ mapping__alloc_modified_binding(Mapping *mapping){
sll_stack_pop(mapping->free_bindings);
}
else{
result = push_array(mapping->node_arena, Command_Modified_Binding, 1);
result = push_array(&mapping->node_arena, Command_Modified_Binding, 1);
}
return(result);
}
@ -78,7 +78,7 @@ mapping__alloc_binding_list(Mapping *mapping){
sll_stack_pop(mapping->free_lists);
}
else{
result = push_array(mapping->node_arena, Command_Binding_List, 1);
result = push_array(&mapping->node_arena, Command_Binding_List, 1);
}
return(result);
}
@ -117,8 +117,8 @@ map__get_or_make_list(Mapping *mapping, Command_Map *map, u64 key){
function void
mapping_init(Thread_Context *tctx, Mapping *mapping){
block_zero_struct(mapping);
mapping->node_arena = reserve_arena(tctx);
heap_init(&mapping->heap, mapping->node_arena);
mapping->node_arena = make_arena_system();
heap_init(&mapping->heap, &mapping->node_arena);
mapping->heap_wrapper = base_allocator_on_heap(&mapping->heap);
mapping->id_to_map = make_table_u64_u64(tctx->allocator, 10);
mapping->id_counter = 1;
@ -126,10 +126,8 @@ mapping_init(Thread_Context *tctx, Mapping *mapping){
function void
mapping_release(Thread_Context *tctx, Mapping *mapping){
if (mapping->node_arena != 0){
release_arena(tctx, mapping->node_arena);
table_free(&mapping->id_to_map);
}
linalloc_clear(&mapping->node_arena);
table_free(&mapping->id_to_map);
}
function void
@ -235,91 +233,94 @@ map_loose_match(Input_Modifier_Set *binding_mod_set, Input_Modifier_Set *event_m
return(result);
}
function Map_Event_Breakdown
map_get_event_breakdown(Input_Event *event){
Map_Event_Breakdown result = {};
switch (event->kind){
case InputEventKind_KeyStroke:
{
result.key = mapping__key(InputEventKind_KeyStroke, event->key.code);
result.mod_set = &event->key.modifiers;
result.skip_self_mod = event->key.code;
}break;
case InputEventKind_MouseButton:
{
result.key = mapping__key(InputEventKind_MouseButton, event->mouse.code);
result.mod_set = &event->mouse.modifiers;
}break;
case InputEventKind_MouseWheel:
{
result.key = mapping__key(InputEventKind_MouseWheel, 0);
result.mod_set = &event->mouse_wheel.modifiers;
}break;
case InputEventKind_MouseMove:
{
result.key = mapping__key(InputEventKind_MouseMove, 0);
result.mod_set = &event->mouse_move.modifiers;
}break;
case InputEventKind_Core:
{
result.key = mapping__key(InputEventKind_Core, event->core.code);
}break;
}
return(result);
}
function Command_Binding
map_get_binding_non_recursive(Command_Map *map, Input_Event *event){
map_get_binding_non_recursive(Command_Map *map, Input_Event *event, Binding_Match_Rule rule){
Command_Binding result = {};
if (event->kind == InputEventKind_CustomFunction){
result.custom = event->custom_func;
}
else if (map != 0){
b32 do_table_lookup = false;
Input_Modifier_Set *mod_set = 0;
u64 key = 0;
Key_Code skip_self_mod = 0;
// TODO(allen): extract and make sure we only do this once for recursive version.
switch (event->kind){
case InputEventKind_TextInsert:
{
result = map->text_input_command;
}break;
case InputEventKind_KeyStroke:
{
key = mapping__key(InputEventKind_KeyStroke, event->key.code);
do_table_lookup = true;
mod_set = &event->key.modifiers;
skip_self_mod = event->key.code;
}break;
case InputEventKind_MouseButton:
{
key = mapping__key(InputEventKind_MouseButton, event->mouse.code);
do_table_lookup = true;
mod_set = &event->mouse.modifiers;
}break;
case InputEventKind_MouseWheel:
{
key = mapping__key(InputEventKind_MouseWheel, 0);
do_table_lookup = true;
mod_set = &event->mouse_wheel.modifiers;
}break;
case InputEventKind_MouseMove:
{
key = mapping__key(InputEventKind_MouseMove, 0);
do_table_lookup = true;
mod_set = &event->mouse_move.modifiers;
}break;
case InputEventKind_Core:
{
key = mapping__key(InputEventKind_Core, event->core.code);
do_table_lookup = true;
}break;
if (event->kind == InputEventKind_TextInsert){
result = map->text_input_command;
}
if (do_table_lookup){
Table_Lookup lookup = table_lookup(&map->event_code_to_binding_list, key);
else{
Map_Event_Breakdown breakdown = map_get_event_breakdown(event);
Table_Lookup lookup = table_lookup(&map->event_code_to_binding_list, breakdown.key);
if (lookup.found_match){
u64 val = 0;
table_read(&map->event_code_to_binding_list, lookup, &val);
Command_Binding_List *list = (Command_Binding_List*)IntAsPtr(val);
if (mod_set != 0){
for (SNode *node = list->first;
node != 0;
node = node->next){
Command_Modified_Binding *mod_binding = CastFromMember(Command_Modified_Binding, order_node, node);
Input_Modifier_Set *binding_mod_set = &mod_binding->mods;
if (map_strict_match(binding_mod_set, mod_set, skip_self_mod)){
result = mod_binding->binding;
break;
}
}
if (result.custom == 0){
for (SNode *node = list->first;
node != 0;
node = node->next){
Command_Modified_Binding *mod_binding = CastFromMember(Command_Modified_Binding, order_node, node);
Input_Modifier_Set *binding_mod_set = &mod_binding->mods;
if (map_loose_match(binding_mod_set, mod_set)){
result = mod_binding->binding;
break;
if (breakdown.mod_set != 0){
switch (rule){
case BindingMatchRule_Strict:
{
for (SNode *node = list->first;
node != 0;
node = node->next){
Command_Modified_Binding *mod_binding = CastFromMember(Command_Modified_Binding, order_node, node);
Input_Modifier_Set *binding_mod_set = &mod_binding->mods;
if (map_strict_match(binding_mod_set, breakdown.mod_set, breakdown.skip_self_mod)){
result = mod_binding->binding;
goto done;
}
}
}
}break;
case BindingMatchRule_Loose:
{
for (SNode *node = list->first;
node != 0;
node = node->next){
Command_Modified_Binding *mod_binding = CastFromMember(Command_Modified_Binding, order_node, node);
Input_Modifier_Set *binding_mod_set = &mod_binding->mods;
if (map_loose_match(binding_mod_set, breakdown.mod_set)){
result = mod_binding->binding;
goto done;
}
}
}break;
}
done:;
}
else{
Command_Modified_Binding *mod_binding = CastFromMember(Command_Modified_Binding, order_node, list->first);
@ -333,12 +334,21 @@ map_get_binding_non_recursive(Command_Map *map, Input_Event *event){
}
function Command_Binding
map_get_binding_recursive(Mapping *mapping, Command_Map *map, Input_Event *event){
map_get_binding_non_recursive(Command_Map *map, Input_Event *event){
Command_Binding result = map_get_binding_non_recursive(map, event, BindingMatchRule_Strict);
if (result.custom == 0){
result = map_get_binding_non_recursive(map, event, BindingMatchRule_Loose);
}
return(result);
}
function Command_Binding
map_get_binding_recursive(Mapping *mapping, Command_Map *map, Input_Event *event, Binding_Match_Rule rule){
Command_Binding result = {};
for (i32 safety_counter = 0;
map != 0 && safety_counter < 40;
safety_counter += 1){
result = map_get_binding_non_recursive(map, event);
result = map_get_binding_non_recursive(map, event, rule);
if (result.custom != 0){
break;
}
@ -347,6 +357,15 @@ map_get_binding_recursive(Mapping *mapping, Command_Map *map, Input_Event *event
return(result);
}
function Command_Binding
map_get_binding_recursive(Mapping *mapping, Command_Map *map, Input_Event *event){
Command_Binding result = map_get_binding_recursive(mapping, map, event, BindingMatchRule_Strict);
if (result.custom == 0){
result = map_get_binding_recursive(mapping, map, event, BindingMatchRule_Loose);
}
return(result);
}
function void
map_set_parent(Command_Map *map, Command_Map *parent){
if (map != 0 && parent != 0){

View File

@ -24,7 +24,7 @@ struct Command_Trigger_List{
struct Command_Binding{
union{
Custom_Command_Function *custom;
char *name;
char *name;
};
Command_Binding();
@ -67,7 +67,7 @@ struct Command_Map{
};
struct Mapping{
Arena *node_arena;
Arena node_arena;
Heap heap;
Base_Allocator heap_wrapper;
Table_u64_u64 id_to_map;
@ -79,6 +79,18 @@ struct Mapping{
Command_Binding_List *free_lists;
};
typedef i32 Binding_Match_Rule;
enum{
BindingMatchRule_Strict,
BindingMatchRule_Loose,
};
struct Map_Event_Breakdown{
Input_Modifier_Set *mod_set;
u64 key;
Key_Code skip_self_mod;
};
#endif
// BOTTOM

View File

@ -1670,7 +1670,7 @@ CUSTOM_DOC("Parse the current buffer as a theme file and add the theme to the th
function void
load_folder_of_themes_into_live_set(Application_Links *app, String_Const_u8 path){
Scratch_Block scratch(app, Scratch_Share);
Scratch_Block scratch(app);
File_List list = system_get_file_list(scratch, path);
for (File_Info **ptr = list.infos, **end = list.infos + list.count;

View File

@ -221,7 +221,7 @@ ui_fallback_command_dispatch(Application_Links *app, View_ID view, User_Input *i
function void
view_buffer_set(Application_Links *app, Buffer_ID *buffers, i32 *positions, i32 count){
if (count > 0){
Scratch_Block scratch(app, Scratch_Share);
Scratch_Block scratch(app);
struct View_Node{
View_Node *next;
@ -511,7 +511,7 @@ default_4coder_initialize(Application_Links *app, String_Const_u8_Array file_nam
print_message(app, string_u8_litexpr(M));
#undef M
load_config_and_apply(app, global_config_arena, &global_config, override_font_size, override_hinting);
load_config_and_apply(app, &global_config_arena, &global_config, override_font_size, override_hinting);
// open command line files
Scratch_Block scratch(app);
@ -901,7 +901,7 @@ default_framework_init(Application_Links *app){
initialize_managed_id_metadata(app);
set_default_color_scheme(app);
heap_init(&global_heap, tctx->allocator);
global_config_arena = reserve_arena(app);
global_config_arena = make_arena_system();
fade_range_arena = make_arena_system(KB(8));
}

View File

@ -78,7 +78,7 @@ global i32 fcoder_mode = FCoderMode_Original;
global ID_Pos_Jump_Location prev_location = {};
global Arena *global_config_arena = {};
global Arena global_config_arena = {};
global Config_Data global_config = {};
global char previous_isearch_query[256] = {};

View File

@ -6,7 +6,7 @@
function Doc_Page*
get_doc_page_from_user(Application_Links *app, Doc_Cluster *doc, String_Const_u8 query){
Scratch_Block scratch(app, Scratch_Share);
Scratch_Block scratch(app);
Lister_Block lister(app, scratch);
lister_set_query(lister, query);
lister_set_default_handlers(lister);

View File

@ -388,7 +388,7 @@ draw_line_number_margin(Application_Links *app, View_ID view_id, Buffer_ID buffe
i64 line_count = buffer_get_line_count(app, buffer);
i64 line_count_digit_count = digit_count_from_integer(line_count, 10);
Scratch_Block scratch(app, Scratch_Share);
Scratch_Block scratch(app);
Buffer_Cursor cursor = view_compute_cursor(app, view_id, seek_pos(visible_range.first));
i64 line_number = cursor.line;

View File

@ -20,7 +20,7 @@ keyboard_macro_play_single_line(Application_Links *app, String_Const_u8 macro_li
function void
keyboard_macro_play(Application_Links *app, String_Const_u8 macro){
Scratch_Block scratch(app, Scratch_Share);
Scratch_Block scratch(app);
List_String_Const_u8 lines = string_split(scratch, macro, (u8*)"\n", 1);
for (Node_String_Const_u8 *node = lines.first;
node != 0;
@ -47,8 +47,8 @@ CUSTOM_DOC("Start macro recording, do nothing if macro recording is already star
}
Buffer_ID buffer = get_keyboard_log_buffer(app);
global_keyboard_macro_is_recording = true;
global_keyboard_macro_range.first = buffer_get_size(app, buffer);
global_keyboard_macro_is_recording = true;
global_keyboard_macro_range.first = buffer_get_size(app, buffer);
}
CUSTOM_COMMAND_SIG(keyboard_macro_finish_recording)
@ -60,17 +60,17 @@ CUSTOM_DOC("Stop macro recording, do nothing if macro recording is not already s
}
Buffer_ID buffer = get_keyboard_log_buffer(app);
global_keyboard_macro_is_recording = false;
i64 end = buffer_get_size(app, buffer);
Buffer_Cursor cursor = buffer_compute_cursor(app, buffer, seek_pos(end));
Buffer_Cursor back_cursor = buffer_compute_cursor(app, buffer, seek_line_col(cursor.line - 1, 1));
global_keyboard_macro_range.one_past_last = back_cursor.pos;
global_keyboard_macro_is_recording = false;
i64 end = buffer_get_size(app, buffer);
Buffer_Cursor cursor = buffer_compute_cursor(app, buffer, seek_pos(end));
Buffer_Cursor back_cursor = buffer_compute_cursor(app, buffer, seek_line_col(cursor.line - 1, 1));
global_keyboard_macro_range.one_past_last = back_cursor.pos;
#if 0
Scratch_Block scratch(app);
String_Const_u8 macro = push_buffer_range(app, scratch, buffer, global_keyboard_macro_range);
print_message(app, string_u8_litexpr("recorded:\n"));
print_message(app, macro);
Scratch_Block scratch(app);
String_Const_u8 macro = push_buffer_range(app, scratch, buffer, global_keyboard_macro_range);
print_message(app, string_u8_litexpr("recorded:\n"));
print_message(app, macro);
#endif
}
@ -83,12 +83,8 @@ CUSTOM_DOC("Replay the most recently recorded keyboard macro")
}
Buffer_ID buffer = get_keyboard_log_buffer(app);
Scratch_Block scratch(app, Scratch_Share);
Scratch_Block scratch(app);
String_Const_u8 macro = push_buffer_range(app, scratch, buffer, global_keyboard_macro_range);
#if 0
print_message(app, string_u8_litexpr("replaying:\n"));
print_message(app, macro);
#endif
keyboard_macro_play(app, macro);
}

View File

@ -399,7 +399,8 @@ lister_update_selection_values(Lister *lister){
function void
lister_update_filtered_list(Application_Links *app, Lister *lister){
Scratch_Block scratch(app, Scratch_Share);
Arena *arena = lister->arena;
Scratch_Block scratch(app, arena);
Lister_Filtered filtered = lister_get_filtered(scratch, lister);
@ -409,7 +410,6 @@ lister_update_filtered_list(Application_Links *app, Lister *lister){
filtered.substring_matches,
};
Arena *arena = lister->arena;
end_temp(lister->filter_restore_point);
i32 total_count = 0;

View File

@ -15,7 +15,7 @@ generate_all_buffers_list__output_buffer(Application_Links *app, Lister *lister,
case DirtyState_UnloadedChanges: status = string_u8_litexpr("!"); break;
case DirtyState_UnsavedChangesAndUnloadedChanges: status = string_u8_litexpr("*!"); break;
}
Scratch_Block scratch(app);
Scratch_Block scratch(app, lister->arena);
String_Const_u8 buffer_name = push_buffer_unique_name(app, scratch, buffer);
lister_add_item(lister, buffer_name, status, IntAsPtr(buffer), 0);
}
@ -131,7 +131,7 @@ get_command_from_user(Application_Links *app, String_Const_u8 query, i32 *comman
command_id_count = command_one_past_last_id;
}
Scratch_Block scratch(app, Scratch_Share);
Scratch_Block scratch(app);
Lister_Block lister(app, scratch);
lister_set_query(lister, query);
lister_set_default_handlers(lister);
@ -205,7 +205,7 @@ get_color_table_from_user(Application_Links *app, String_Const_u8 query, Color_T
color_table_list = &global_theme_list;
}
Scratch_Block scratch(app, Scratch_Share);
Scratch_Block scratch(app);
Lister_Block lister(app, scratch);
lister_set_query(lister, query);
lister_set_default_handlers(lister);
@ -301,7 +301,7 @@ lister__backspace_text_field__file_path(Application_Links *app){
function void
generate_hot_directory_file_list(Application_Links *app, Lister *lister){
Scratch_Block scratch(app);
Scratch_Block scratch(app, lister->arena);
Temp_Memory temp = begin_temp(lister->arena);
String_Const_u8 hot = push_hot_directory(app, lister->arena);
@ -575,8 +575,7 @@ query_create_folder(Application_Links *app, String_Const_u8 folder_name){
function Lister_Activation_Code
activate_open_or_new__generic(Application_Links *app, View_ID view,
String_Const_u8 path, String_Const_u8 file_name,
b32 is_folder,
String_Const_u8 path, String_Const_u8 file_name, b32 is_folder,
Buffer_Create_Flag flags){
Lister_Activation_Code result = 0;
@ -587,7 +586,7 @@ activate_open_or_new__generic(Application_Links *app, View_ID view,
result = ListerActivation_Finished;
}
else{
Scratch_Block scratch(app, Scratch_Share);
Scratch_Block scratch(app);
String_Const_u8 full_file_name = {};
if (character_is_slash(string_get_character(path, path.size - 1))){
path = string_chop(path, 1);

View File

@ -367,7 +367,7 @@ log_event_array_from_list(Arena *arena, Log_Event_List list){
////////////////////////////////
global View_ID log_view = 0;
global Arena *log_arena = {};
global Arena log_arena = {};
global Log_Parse log_parse = {};
global Log_Graph log_graph = {};
global Log_Filter_Set log_filter_set = {};
@ -438,7 +438,7 @@ log_graph_fill(Application_Links *app, Rect_f32 layout_region, Face_ID face_id){
}
block_zero_struct(&log_graph);
log_graph.holding_temp = true;
log_graph.temp = begin_temp(log_arena);
log_graph.temp = begin_temp(&log_arena);
log_graph.layout_region = layout_region;
log_graph.face_id = face_id;
log_graph.filter_alter_counter = log_filter_set.alter_counter;
@ -465,7 +465,7 @@ log_graph_fill(Application_Links *app, Rect_f32 layout_region, Face_ID face_id){
for (Log_Event *event = log_parse.first_event;
event != 0;
event = event->next){
Log_Event_Ptr_Node *node = push_array(log_arena, Log_Event_Ptr_Node, 1);
Log_Event_Ptr_Node *node = push_array(&log_arena, Log_Event_Ptr_Node, 1);
node->event = event;
sll_queue_push(log_graph.filtered_list.first, log_graph.filtered_list.last, node);
log_graph.filtered_list.count += 1;
@ -489,7 +489,7 @@ log_graph_fill(Application_Links *app, Rect_f32 layout_region, Face_ID face_id){
for (Log_Event_Ptr_Node *node = filter_list->first;
node != 0;
node = node->next){
Log_Event_Ptr_Node *new_node = push_array(log_arena, Log_Event_Ptr_Node, 1);
Log_Event_Ptr_Node *new_node = push_array(&log_arena, Log_Event_Ptr_Node, 1);
new_node->event = node->event;
sll_queue_push(log_graph.filtered_list.first, log_graph.filtered_list.last, new_node);
log_graph.filtered_list.count += 1;
@ -525,9 +525,8 @@ log_graph_fill(Application_Links *app, Rect_f32 layout_region, Face_ID face_id){
}
}
log_graph.event_array = log_event_array_from_list(log_arena,
log_graph.filtered_list);
log_events_sort_by_tag(log_arena, log_graph.event_array, thread_code);
log_graph.event_array = log_event_array_from_list(&log_arena, log_graph.filtered_list);
log_events_sort_by_tag(&log_arena, log_graph.event_array, thread_code);
b32 had_a_tag = true;
u64 thread_id_value = 0;
@ -561,7 +560,7 @@ log_graph_fill(Application_Links *app, Rect_f32 layout_region, Face_ID face_id){
}
if (emit_next_bucket){
Log_Graph_Thread_Bucket *bucket = push_array(log_arena, Log_Graph_Thread_Bucket, 1);
Log_Graph_Thread_Bucket *bucket = push_array(&log_arena, Log_Graph_Thread_Bucket, 1);
sll_queue_push(log_graph.first_bucket, log_graph.last_bucket, bucket);
log_graph.bucket_count += 1;
bucket->range.first = i;
@ -612,7 +611,7 @@ log_graph_fill(Application_Links *app, Rect_f32 layout_region, Face_ID face_id){
bucket_with_next_event->range.first += 1;
Log_Graph_Box *box_node = push_array(log_arena, Log_Graph_Box, 1);
Log_Graph_Box *box_node = push_array(&log_arena, Log_Graph_Box, 1);
sll_queue_push(log_graph.first_box, log_graph.last_box, box_node);
log_graph.box_count += 1;
Rect_f32 rect = Rf32(box_w*bucket_with_next_event_index , y_cursor,
@ -632,17 +631,17 @@ log_graph_fill(Application_Links *app, Rect_f32 layout_region, Face_ID face_id){
internal void
log_parse_fill(Application_Links *app, Buffer_ID buffer){
if (log_arena == 0){
log_arena = reserve_arena(app);
if (log_arena.base_allocator == 0){
log_arena = make_arena_system();
}
linalloc_clear(log_arena);
linalloc_clear(&log_arena);
block_zero_struct(&log_graph);
log_filter_set_init(&log_filter_set);
log_filter_set_init(&log_preview_set);
String_Const_u8 log_text = push_whole_buffer(app, log_arena, buffer);
log_parse = make_log_parse(log_arena, log_text);
String_Const_u8 log_text = push_whole_buffer(app, &log_arena, buffer);
log_parse = make_log_parse(&log_arena, log_text);
}
internal void

View File

@ -5,7 +5,7 @@
// TOP
global Project current_project = {};
global Arena *current_project_arena = {};
global Arena current_project_arena = {};
///////////////////////////////
@ -631,13 +631,13 @@ set_current_project(Application_Links *app, Project *project, Config *parsed){
Scratch_Block scratch(app);
if (parsed != 0 && project != 0){
if (current_project_arena == 0){
current_project_arena = reserve_arena(app);
if (current_project_arena.base_allocator == 0){
current_project_arena = make_arena_system();
}
// Copy project to current_project
linalloc_clear(current_project_arena);
Project new_project = project_deep_copy(current_project_arena, project);
linalloc_clear(&current_project_arena);
Project new_project = project_deep_copy(&current_project_arena, project);
if (new_project.loaded){
current_project = new_project;
@ -728,15 +728,14 @@ set_current_project(Application_Links *app, Project *project, Config *parsed){
function void
set_current_project_from_data(Application_Links *app, String_Const_u8 file_name,
Data data, String_Const_u8 file_dir){
Scratch_Block scratch(app, Scratch_Share);
Project_Parse_Result project_parse = parse_project__data(app, scratch, file_name,
data, file_dir);
Scratch_Block scratch(app);
Project_Parse_Result project_parse = parse_project__data(app, scratch, file_name, data, file_dir);
set_current_project(app, project_parse.project, project_parse.parsed);
}
function void
set_current_project_from_nearest_project_file(Application_Links *app){
Scratch_Block scratch(app, Scratch_Share);
Scratch_Block scratch(app);
Project_Parse_Result project_parse = parse_project__nearest_file(app, scratch);
set_current_project(app, project_parse.project, project_parse.parsed);
}
@ -1256,8 +1255,7 @@ CUSTOM_DOC("Queries the user for several configuration options and initializes a
///////////////////////////////
function Project_Command_Lister_Result
get_project_command_from_user(Application_Links *app, Project *project,
String_Const_u8 query){
get_project_command_from_user(Application_Links *app, Project *project, String_Const_u8 query){
Project_Command_Lister_Result result = {};
if (project != 0){
Scratch_Block scratch(app);

View File

@ -382,13 +382,15 @@ word_complete_iter_is_at_base_slot(Word_Complete_Iterator *it){
function Word_Complete_Iterator*
word_complete_get_shared_iter(Application_Links *app){
local_persist Arena *completion_arena = {};
local_persist Arena completion_arena = {};
local_persist Word_Complete_Iterator it = {};
if (completion_arena == 0){
completion_arena = reserve_arena(app);
local_persist b32 first_call = true;
if (first_call){
first_call = false;
completion_arena = make_arena_system();
}
it.app = app;
it.arena = completion_arena;
it.arena = &completion_arena;
return(&it);
}

View File

@ -286,11 +286,11 @@ static Command_Metadata fcoder_metacmd_table[242] = {
{ PROC_LINKS(click_set_cursor_if_lbutton, 0), false, "click_set_cursor_if_lbutton", 27, "If the mouse left button is pressed, sets the cursor position to the mouse position.", 84, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 243 },
{ PROC_LINKS(click_set_mark, 0), false, "click_set_mark", 14, "Sets the mark position to the mouse position.", 45, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 255 },
{ PROC_LINKS(clipboard_record_clip, 0), false, "clipboard_record_clip", 21, "In response to a new clipboard contents events, saves the new clip onto the clipboard history", 93, "w:\\4ed\\code\\custom\\4coder_clipboard.cpp", 39, 7 },
{ 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, 843 },
{ 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, 842 },
{ 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, 174 },
{ PROC_LINKS(close_panel, 0), false, "close_panel", 11, "Closes the currently active panel if it is not the only panel open.", 67, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 655 },
{ PROC_LINKS(command_documentation, 0), true, "command_documentation", 21, "Prompts the user to select a command then loads a doc buffer for that item", 74, "w:\\4ed\\code\\custom\\4coder_docs.cpp", 34, 190 },
{ PROC_LINKS(command_lister, 0), true, "command_lister", 14, "Opens an interactive list of all registered commands.", 53, "w:\\4ed\\code\\custom\\4coder_lists.cpp", 35, 761 },
{ PROC_LINKS(command_lister, 0), true, "command_lister", 14, "Opens an interactive list of all registered commands.", 53, "w:\\4ed\\code\\custom\\4coder_lists.cpp", 35, 760 },
{ 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(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(copy, 0), false, "copy", 4, "Copy the text in the range from the cursor to the mark onto the clipboard.", 74, "w:\\4ed\\code\\custom\\4coder_clipboard.cpp", 39, 107 },
@ -334,9 +334,9 @@ static Command_Metadata fcoder_metacmd_table[242] = {
{ PROC_LINKS(if_read_only_goto_position_same_panel, 0), false, "if_read_only_goto_position_same_panel", 37, "If the buffer in the active view is writable, inserts a character, otherwise performs goto_jump_at_cursor_same_panel.", 117, "w:\\4ed\\code\\custom\\4coder_jump_sticky.cpp", 41, 581 },
{ PROC_LINKS(increase_face_size, 0), false, "increase_face_size", 18, "Increase the size of the face used by the current buffer.", 57, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 727 },
{ PROC_LINKS(interactive_kill_buffer, 0), true, "interactive_kill_buffer", 23, "Interactively kill an open buffer.", 34, "w:\\4ed\\code\\custom\\4coder_lists.cpp", 35, 520 },
{ PROC_LINKS(interactive_new, 0), true, "interactive_new", 15, "Interactively creates a new file.", 33, "w:\\4ed\\code\\custom\\4coder_lists.cpp", 35, 661 },
{ PROC_LINKS(interactive_open, 0), true, "interactive_open", 16, "Interactively opens a file.", 27, "w:\\4ed\\code\\custom\\4coder_lists.cpp", 35, 715 },
{ PROC_LINKS(interactive_open_or_new, 0), true, "interactive_open_or_new", 23, "Interactively open a file out of the file system.", 49, "w:\\4ed\\code\\custom\\4coder_lists.cpp", 35, 612 },
{ PROC_LINKS(interactive_new, 0), true, "interactive_new", 15, "Interactively creates a new file.", 33, "w:\\4ed\\code\\custom\\4coder_lists.cpp", 35, 660 },
{ PROC_LINKS(interactive_open, 0), true, "interactive_open", 16, "Interactively opens a file.", 27, "w:\\4ed\\code\\custom\\4coder_lists.cpp", 35, 714 },
{ PROC_LINKS(interactive_open_or_new, 0), true, "interactive_open_or_new", 23, "Interactively open a file out of the file system.", 49, "w:\\4ed\\code\\custom\\4coder_lists.cpp", 35, 611 },
{ PROC_LINKS(interactive_switch_buffer, 0), true, "interactive_switch_buffer", 25, "Interactively switch to an open buffer.", 39, "w:\\4ed\\code\\custom\\4coder_lists.cpp", 35, 510 },
{ PROC_LINKS(jump_to_definition, 0), true, "jump_to_definition", 18, "List all definitions in the code index and jump to one chosen by the user.", 74, "w:\\4ed\\code\\custom\\4coder_code_index_listers.cpp", 48, 12 },
{ PROC_LINKS(keyboard_macro_finish_recording, 0), false, "keyboard_macro_finish_recording", 31, "Stop macro recording, do nothing if macro recording is not already started", 74, "w:\\4ed\\code\\custom\\4coder_keyboard_macro.cpp", 44, 54 },
@ -359,7 +359,7 @@ static Command_Metadata fcoder_metacmd_table[242] = {
{ PROC_LINKS(list_all_locations_of_type_definition_of_identifier, 0), false, "list_all_locations_of_type_definition_of_identifier", 51, "Reads a token or word under the cursor and lists all locations of strings that appear to define a type whose name matches it.", 125, "w:\\4ed\\code\\custom\\4coder_search.cpp", 36, 221 },
{ PROC_LINKS(list_all_substring_locations, 0), false, "list_all_substring_locations", 28, "Queries the user for a string and lists all case-sensitive substring matches found in all open buffers.", 103, "w:\\4ed\\code\\custom\\4coder_search.cpp", 36, 171 },
{ PROC_LINKS(list_all_substring_locations_case_insensitive, 0), false, "list_all_substring_locations_case_insensitive", 45, "Queries the user for a string and lists all case-insensitive substring matches found in all open buffers.", 105, "w:\\4ed\\code\\custom\\4coder_search.cpp", 36, 183 },
{ 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, 863 },
{ 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, 862 },
{ PROC_LINKS(load_theme_current_buffer, 0), false, "load_theme_current_buffer", 25, "Parse the current buffer as a theme file and add the theme to the theme list. If the buffer has a .4coder postfix in it's name, it is removed when the name is saved.", 165, "w:\\4ed\\code\\custom\\4coder_config.cpp", 36, 1627 },
{ PROC_LINKS(load_themes_default_folder, 0), false, "load_themes_default_folder", 26, "Loads all the theme files in the default theme folder.", 54, "w:\\4ed\\code\\custom\\4coder_default_framework.cpp", 47, 457 },
{ PROC_LINKS(load_themes_hot_directory, 0), false, "load_themes_hot_directory", 25, "Loads all the theme files in the current hot directory.", 55, "w:\\4ed\\code\\custom\\4coder_default_framework.cpp", 47, 469 },
@ -399,8 +399,8 @@ static Command_Metadata fcoder_metacmd_table[242] = {
{ PROC_LINKS(move_up_to_blank_line_skip_whitespace, 0), false, "move_up_to_blank_line_skip_whitespace", 37, "Seeks the cursor up to the next blank line and places it at the end of the line.", 80, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 413 },
{ PROC_LINKS(multi_paste_interactive, 0), false, "multi_paste_interactive", 23, "Paste multiple lines from the clipboard history, controlled with arrow keys", 75, "w:\\4ed\\code\\custom\\4coder_clipboard.cpp", 39, 364 },
{ PROC_LINKS(multi_paste_interactive_quick, 0), false, "multi_paste_interactive_quick", 29, "Paste multiple lines from the clipboard history, controlled by inputing the number of lines to paste", 100, "w:\\4ed\\code\\custom\\4coder_clipboard.cpp", 39, 373 },
{ 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, 849 },
{ 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, 855 },
{ 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, 848 },
{ 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, 854 },
{ PROC_LINKS(open_file_in_quotes, 0), false, "open_file_in_quotes", 19, "Reads a filename from surrounding '\"' characters and attempts to open the corresponding file.", 94, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1560 },
{ PROC_LINKS(open_in_other, 0), false, "open_in_other", 13, "Interactively opens a file in the other panel.", 46, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1891 },
{ PROC_LINKS(open_long_braces, 0), false, "open_long_braces", 16, "At the cursor, insert a '{' and '}' separated by a blank line.", 62, "w:\\4ed\\code\\custom\\4coder_combined_write_commands.cpp", 53, 46 },
@ -421,9 +421,9 @@ static Command_Metadata fcoder_metacmd_table[242] = {
{ 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, 219 },
{ 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, 212 },
{ 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, 886 },
{ 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, 1290 },
{ 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, 871 },
{ 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, 897 },
{ 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, 1288 },
{ 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, 870 },
{ 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, 896 },
{ PROC_LINKS(query_replace, 0), false, "query_replace", 13, "Queries the user for two strings, and incrementally replaces every occurence of the first string with the second string.", 120, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1251 },
{ PROC_LINKS(query_replace_identifier, 0), false, "query_replace_identifier", 24, "Queries the user for a string, and incrementally replace every occurence of the word or token found at the cursor with the specified string.", 140, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1272 },
{ PROC_LINKS(query_replace_selection, 0), false, "query_replace_selection", 23, "Queries the user for a string, and incrementally replace every occurence of the string found in the selected range with the specified string.", 141, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1288 },
@ -461,20 +461,20 @@ static Command_Metadata fcoder_metacmd_table[242] = {
{ PROC_LINKS(set_mark, 0), false, "set_mark", 8, "Sets the mark to the current position of the cursor.", 52, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 115 },
{ PROC_LINKS(set_mode_to_notepad_like, 0), false, "set_mode_to_notepad_like", 24, "Sets the edit mode to Notepad like.", 35, "w:\\4ed\\code\\custom\\4coder_default_framework.cpp", 47, 427 },
{ PROC_LINKS(set_mode_to_original, 0), false, "set_mode_to_original", 20, "Sets the edit mode to 4coder original.", 38, "w:\\4ed\\code\\custom\\4coder_default_framework.cpp", 47, 421 },
{ 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, 1238 },
{ 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, 1250 },
{ 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, 1244 },
{ 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, 1231 },
{ 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, 1237 },
{ 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, 1249 },
{ 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, 1243 },
{ 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, 1230 },
{ PROC_LINKS(show_filebar, 0), false, "show_filebar", 12, "Sets the current view to show it's filebar.", 43, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 678 },
{ PROC_LINKS(show_scrollbar, 0), false, "show_scrollbar", 14, "Sets the current view to show it's scrollbar.", 45, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 664 },
{ PROC_LINKS(show_the_log_graph, 0), true, "show_the_log_graph", 18, "Parses *log* and displays the 'log graph' UI", 44, "w:\\4ed\\code\\custom\\4coder_log_parser.cpp", 40, 994 },
{ PROC_LINKS(show_the_log_graph, 0), true, "show_the_log_graph", 18, "Parses *log* and displays the 'log graph' UI", 44, "w:\\4ed\\code\\custom\\4coder_log_parser.cpp", 40, 993 },
{ PROC_LINKS(snipe_backward_whitespace_or_token_boundary, 0), false, "snipe_backward_whitespace_or_token_boundary", 43, "Delete a single, whole token on or to the left of the cursor and post it to the clipboard.", 90, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 179 },
{ PROC_LINKS(snipe_forward_whitespace_or_token_boundary, 0), false, "snipe_forward_whitespace_or_token_boundary", 42, "Delete a single, whole token on or to the right of the cursor and post it to the clipboard.", 91, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 187 },
{ PROC_LINKS(snippet_lister, 0), true, "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(string_repeat, 0), false, "string_repeat", 13, "Example of query_user_string and query_user_number", 50, "w:\\4ed\\code\\custom\\4coder_examples.cpp", 38, 176 },
{ PROC_LINKS(suppress_mouse, 0), false, "suppress_mouse", 14, "Hides the mouse and causes all mosue input (clicks, position, wheel) to be ignored.", 83, "w:\\4ed\\code\\custom\\4coder_default_framework.cpp", 47, 403 },
{ PROC_LINKS(swap_panels, 0), false, "swap_panels", 11, "Swaps the active panel with it's sibling.", 41, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1617 },
{ PROC_LINKS(theme_lister, 0), true, "theme_lister", 12, "Opens an interactive list of all registered themes.", 51, "w:\\4ed\\code\\custom\\4coder_lists.cpp", 35, 785 },
{ PROC_LINKS(theme_lister, 0), true, "theme_lister", 12, "Opens an interactive list of all registered themes.", 51, "w:\\4ed\\code\\custom\\4coder_lists.cpp", 35, 784 },
{ PROC_LINKS(to_lowercase, 0), false, "to_lowercase", 12, "Converts all ascii text in the range between the cursor and the mark to lowercase.", 82, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 563 },
{ PROC_LINKS(to_uppercase, 0), false, "to_uppercase", 12, "Converts all ascii text in the range between the cursor and the mark to uppercase.", 82, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 550 },
{ PROC_LINKS(toggle_filebar, 0), false, "toggle_filebar", 14, "Toggles the visibility status of the current view's filebar.", 60, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 692 },
@ -495,8 +495,8 @@ static Command_Metadata fcoder_metacmd_table[242] = {
{ PROC_LINKS(undo_all_buffers, 0), false, "undo_all_buffers", 16, "Advances backward through the undo history in the buffer containing the most recent regular edit.", 97, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1744 },
{ PROC_LINKS(view_buffer_other_panel, 0), false, "view_buffer_other_panel", 23, "Set the other non-active panel to view the buffer that the active panel views, and switch to that panel.", 104, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1605 },
{ PROC_LINKS(view_jump_list_with_lister, 0), false, "view_jump_list_with_lister", 26, "When executed on a buffer with jumps, creates a persistent lister for all the jumps", 83, "w:\\4ed\\code\\custom\\4coder_jump_lister.cpp", 41, 59 },
{ PROC_LINKS(word_complete, 0), false, "word_complete", 13, "Iteratively tries completing the word to the left of the cursor with other words in open buffers that have the same prefix string.", 130, "w:\\4ed\\code\\custom\\4coder_search.cpp", 36, 395 },
{ PROC_LINKS(word_complete_drop_down, 0), false, "word_complete_drop_down", 23, "Word complete with drop down menu.", 34, "w:\\4ed\\code\\custom\\4coder_search.cpp", 36, 642 },
{ PROC_LINKS(word_complete, 0), false, "word_complete", 13, "Iteratively tries completing the word to the left of the cursor with other words in open buffers that have the same prefix string.", 130, "w:\\4ed\\code\\custom\\4coder_search.cpp", 36, 397 },
{ PROC_LINKS(word_complete_drop_down, 0), false, "word_complete_drop_down", 23, "Word complete with drop down menu.", 34, "w:\\4ed\\code\\custom\\4coder_search.cpp", 36, 644 },
{ PROC_LINKS(write_block, 0), false, "write_block", 11, "At the cursor, insert a block comment.", 38, "w:\\4ed\\code\\custom\\4coder_combined_write_commands.cpp", 53, 94 },
{ PROC_LINKS(write_hack, 0), false, "write_hack", 10, "At the cursor, insert a '// HACK' comment, includes user name if it was specified in config.4coder.", 99, "w:\\4ed\\code\\custom\\4coder_combined_write_commands.cpp", 53, 82 },
{ PROC_LINKS(write_note, 0), false, "write_note", 10, "At the cursor, insert a '// NOTE' comment, includes user name if it was specified in config.4coder.", 99, "w:\\4ed\\code\\custom\\4coder_combined_write_commands.cpp", 53, 88 },

6
foo.h
View File

@ -1,6 +0,0 @@
/* date = March 11th 2020 3:30 am */
#ifndef FOO_H
#define FOO_H
#endif //FOO_H

View File

@ -144,7 +144,7 @@ struct Win32_Object{
struct Win32_Vars{
Thread_Context *tctx;
Arena *frame_arena;
Arena frame_arena;
Input_Event *active_key_stroke;
Input_Event *active_text_input;
Win32_Input_Chunk input_chunk;
@ -1146,10 +1146,10 @@ win32_proc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam){
if (key != 0){
add_modifier(mods, key);
Input_Event *event = push_input_event(win32vars.frame_arena, &win32vars.input_chunk.trans.event_list);
Input_Event *event = push_input_event(&win32vars.frame_arena, &win32vars.input_chunk.trans.event_list);
event->kind = InputEventKind_KeyStroke;
event->key.code = key;
event->key.modifiers = copy_modifier_set(win32vars.frame_arena, mods);
event->key.modifiers = copy_modifier_set(&win32vars.frame_arena, mods);
win32vars.active_key_stroke = event;
win32vars.got_useful_event = true;
@ -1161,10 +1161,10 @@ win32_proc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam){
win32vars.got_useful_event = true;
if (key != 0){
Input_Event *event = push_input_event(win32vars.frame_arena, &win32vars.input_chunk.trans.event_list);
Input_Event *event = push_input_event(&win32vars.frame_arena, &win32vars.input_chunk.trans.event_list);
event->kind = InputEventKind_KeyRelease;
event->key.code = key;
event->key.modifiers = copy_modifier_set(win32vars.frame_arena, mods);
event->key.modifiers = copy_modifier_set(&win32vars.frame_arena, mods);
remove_modifier(mods, key);
}
@ -1179,8 +1179,8 @@ win32_proc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam){
}
if (c > 127 || (' ' <= c && c <= '~') || c == '\t' || c == '\n'){
String_Const_u16 str_16 = SCu16(&c, 1);
String_Const_u8 str_8 = string_u8_from_string_u16(win32vars.frame_arena, str_16).string;
Input_Event *event = push_input_event(win32vars.frame_arena, &win32vars.input_chunk.trans.event_list);
String_Const_u8 str_8 = string_u8_from_string_u16(&win32vars.frame_arena, str_16).string;
Input_Event *event = push_input_event(&win32vars.frame_arena, &win32vars.input_chunk.trans.event_list);
event->kind = InputEventKind_TextInsert;
event->text.string = str_8;
event->text.next_text = 0;
@ -1209,11 +1209,11 @@ win32_proc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam){
}
if (c > 127 || (' ' <= c && c <= '~') || c == '\t' || c == '\n'){
String_Const_u32 str_32 = SCu32(&c, 1);
String_Const_u8 str_8 = string_u8_from_string_u32(win32vars.frame_arena, str_32).string;
String_Const_u8 str_8 = string_u8_from_string_u32(&win32vars.frame_arena, str_32).string;
Input_Event event = {};
event.kind = InputEventKind_TextInsert;
event.text.string = str_8;
push_input_event(win32vars.frame_arena, &win32vars.input_chunk.trans.event_list, &event);
push_input_event(&win32vars.frame_arena, &win32vars.input_chunk.trans.event_list, &event);
win32vars.got_useful_event = true;
}
}
@ -1596,7 +1596,7 @@ WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdS
font_api_fill_vtable(&font_vtable);
// NOTE(allen): memory
win32vars.frame_arena = reserve_arena(win32vars.tctx);
win32vars.frame_arena = make_arena_system();
// TODO(allen): *arena;
target.arena = make_arena_system(KB(256));
@ -1625,7 +1625,7 @@ WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdS
App_Functions app = {};
{
App_Get_Functions *get_funcs = 0;
Scratch_Block scratch(win32vars.tctx, Scratch_Share);
Scratch_Block scratch(win32vars.tctx);
Path_Search_List search_list = {};
search_list_add_system_path(scratch, &search_list, SystemPath_Binary);
@ -1654,7 +1654,7 @@ WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdS
Plat_Settings plat_settings = {};
void *base_ptr = 0;
{
Scratch_Block scratch(win32vars.tctx, Scratch_Share);
Scratch_Block scratch(win32vars.tctx);
String_Const_u8 curdir = system_get_path(scratch, SystemPath_CurrentDirectory);
curdir = string_mod_replace_character(curdir, '\\', '/');
char **files = 0;
@ -1681,7 +1681,7 @@ WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdS
char custom_fail_version_msg[] = "Failed to load custom code due to missing version information or a version mismatch. Try rebuilding with buildsuper.";
char custom_fail_init_apis[] = "Failed to load custom code due to missing 'init_apis' symbol. Try rebuilding with buildsuper";
Scratch_Block scratch(win32vars.tctx, Scratch_Share);
Scratch_Block scratch(win32vars.tctx);
String_Const_u8 default_file_name = string_u8_litexpr("custom_4coder.dll");
Path_Search_List search_list = {};
search_list_add_system_path(scratch, &search_list, SystemPath_CurrentDirectory);
@ -1758,14 +1758,14 @@ WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdS
//
if (!AddClipboardFormatListener(win32vars.window_handle)){
Scratch_Block scratch(win32vars.tctx, Scratch_Share);
Scratch_Block scratch(win32vars.tctx);
win32_output_error_string(scratch, ErrorString_UseLog);
}
win32vars.clip_wakeup_timer = system_wake_up_timer_create();
win32vars.clipboard_sequence = GetClipboardSequenceNumber();
if (win32vars.clipboard_sequence == 0){
Scratch_Block scratch(win32vars.tctx, Scratch_Share);
Scratch_Block scratch(win32vars.tctx);
win32_post_clipboard(scratch, "", 0);
win32vars.clipboard_sequence = GetClipboardSequenceNumber();
win32vars.next_clipboard_is_self = 0;
@ -1796,7 +1796,7 @@ WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdS
//
{
Scratch_Block scratch(win32vars.tctx, Scratch_Share);
Scratch_Block scratch(win32vars.tctx);
String_Const_u8 curdir = system_get_path(scratch, SystemPath_CurrentDirectory);
curdir = string_mod_replace_character(curdir, '\\', '/');
app.init(win32vars.tctx, &target, base_ptr, curdir, custom);
@ -1824,7 +1824,7 @@ WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdS
u64 timer_start = system_now_time();
MSG msg;
for (;keep_running;){
linalloc_clear(win32vars.frame_arena);
linalloc_clear(&win32vars.frame_arena);
block_zero_struct(&win32vars.input_chunk.trans);
win32vars.active_key_stroke = 0;
win32vars.active_text_input = 0;

View File

@ -1,4 +1,8 @@
4.1.5
+ MAJOR: Scratch_Blocks now take arena pointer parameters in their constructor to specify arenas that should be treated as having distinct lifetimes, without doing this it is possible that a local scratch and another arena will actually refer to the same allocator and freeing the local scratch will also free memory that was meant to be in a separate arena.
+ New Date_Time system APIs, and Date_Time string formatting
4.1.4
+ MAJOR: The clipboard history is now a fully custom layer implemented system. Users maintaining a customization layer should try to update their call sites to the old clipboard API. #define FCODER_TRANSITION_TO 4001004 to disable the transitional function wrappers when you are ready to make the transition.
+ buildsuper scripts now all come with '-win' '-linux' '-mac' postfixes and pass their OS identifier macro on the build line