Fixed random crashes and misbehaviors

This commit is contained in:
Allen Webster 2020-01-15 10:42:02 -08:00
parent e977d1d312
commit 0bbafd636e
5 changed files with 5120 additions and 5102 deletions

View File

@ -1108,7 +1108,7 @@ get_view_prev__inner(Layout *layout, View *view){
} }
} }
else{ else{
Panel *panel = layout_get_first_open_panel(layout); Panel *panel = layout_get_last_open_panel(layout);
view = panel->view; view = panel->view;
} }
return(view); return(view);

View File

@ -123,6 +123,16 @@ layout_get_first_open_panel(Layout *layout){
return(panel); return(panel);
} }
internal Panel*
layout_get_last_open_panel(Layout *layout){
Panel *panel = CastFromMember(Panel, node, layout->open_panels.prev);
if (panel != 0 && &panel->node == &layout->open_panels){
panel = 0;
}
AssertImplies(panel != 0, panel->kind == PanelKind_Final);
return(panel);
}
internal Panel* internal Panel*
layout_get_next_open_panel(Layout *layout, Panel *panel){ layout_get_next_open_panel(Layout *layout, Panel *panel){
panel = CastFromMember(Panel, node, panel->node.next); panel = CastFromMember(Panel, node, panel->node.next);

File diff suppressed because it is too large Load Diff

View File

@ -3181,7 +3181,7 @@ gen_keyword_table(Arena *scratch, Token_Kind_Set tokens, Keyword_Set keywords, F
Temp_Memory temp = begin_temp(scratch); Temp_Memory temp = begin_temp(scratch);
Keyword_Layout key_layout = opt_key_layout(scratch, keywords); Keyword_Layout key_layout = opt_key_layout(scratch, keywords);
fprintf(out, "u64 %.*s_hash_array[%d] = {\n", fprintf(out, "u64 " LANG_NAME_LOWER_STR "_%.*s_hash_array[%d] = {\n",
string_expand(keywords.pretty_name), key_layout.slot_count); string_expand(keywords.pretty_name), key_layout.slot_count);
for (i32 i = 0; i < key_layout.slot_count; i += 1){ for (i32 i = 0; i < key_layout.slot_count; i += 1){
if (key_layout.slots[i] == 0){ if (key_layout.slots[i] == 0){
@ -3198,7 +3198,7 @@ gen_keyword_table(Arena *scratch, Token_Kind_Set tokens, Keyword_Set keywords, F
for (i32 i = 0; i < key_layout.slot_count; i += 1){ for (i32 i = 0; i < key_layout.slot_count; i += 1){
if (key_layout.slots[i] != 0){ if (key_layout.slots[i] != 0){
fprintf(out, "u8 %.*s_key_array_%d[] = {", fprintf(out, "u8 " LANG_NAME_LOWER_STR "_%.*s_key_array_%d[] = {",
string_expand(keywords.pretty_name), i); string_expand(keywords.pretty_name), i);
String_Const_u8 lexeme = key_layout.slots[i]->lexeme; String_Const_u8 lexeme = key_layout.slots[i]->lexeme;
for (u64 j = 0; j < lexeme.size; j += 1){ for (u64 j = 0; j < lexeme.size; j += 1){
@ -3208,20 +3208,20 @@ gen_keyword_table(Arena *scratch, Token_Kind_Set tokens, Keyword_Set keywords, F
} }
} }
fprintf(out, "String_Const_u8 %.*s_key_array[%d] = {\n", fprintf(out, "String_Const_u8 " LANG_NAME_LOWER_STR "_%.*s_key_array[%d] = {\n",
string_expand(keywords.pretty_name), key_layout.slot_count); string_expand(keywords.pretty_name), key_layout.slot_count);
for (i32 i = 0; i < key_layout.slot_count; i += 1){ for (i32 i = 0; i < key_layout.slot_count; i += 1){
if (key_layout.slots[i] == 0){ if (key_layout.slots[i] == 0){
fprintf(out, "{0, 0},\n"); fprintf(out, "{0, 0},\n");
} }
else{ else{
fprintf(out, "{%.*s_key_array_%d, %llu},\n", fprintf(out, "{" LANG_NAME_LOWER_STR "_%.*s_key_array_%d, %llu},\n",
string_expand(keywords.pretty_name), i, key_layout.slots[i]->lexeme.size); string_expand(keywords.pretty_name), i, key_layout.slots[i]->lexeme.size);
} }
} }
fprintf(out, "};\n"); fprintf(out, "};\n");
fprintf(out, "Lexeme_Table_Value %.*s_value_array[%d] = {\n", fprintf(out, "Lexeme_Table_Value " LANG_NAME_LOWER_STR "_%.*s_value_array[%d] = {\n",
string_expand(keywords.pretty_name), key_layout.slot_count); string_expand(keywords.pretty_name), key_layout.slot_count);
for (i32 i = 0; i < key_layout.slot_count; i += 1){ for (i32 i = 0; i < key_layout.slot_count; i += 1){
if (key_layout.slots[i] == 0){ if (key_layout.slots[i] == 0){
@ -3245,9 +3245,9 @@ gen_keyword_table(Arena *scratch, Token_Kind_Set tokens, Keyword_Set keywords, F
} }
fprintf(out, "};\n"); fprintf(out, "};\n");
fprintf(out, "i32 %.*s_slot_count = %d;\n", fprintf(out, "i32 " LANG_NAME_LOWER_STR "_%.*s_slot_count = %d;\n",
string_expand(keywords.pretty_name), key_layout.slot_count); string_expand(keywords.pretty_name), key_layout.slot_count);
fprintf(out, "u64 %.*s_seed = 0x%016llx;\n", fprintf(out, "u64 " LANG_NAME_LOWER_STR "_%.*s_seed = 0x%016llx;\n",
string_expand(keywords.pretty_name), key_layout.seed); string_expand(keywords.pretty_name), key_layout.seed);
end_temp(temp); end_temp(temp);
@ -3453,8 +3453,12 @@ gen_SLOW_action_list__cont_flow(Arena *scratch, Token_Kind_Set tokens, Flag_Set
{ {
Keyword_Set *keywords = handler->keywords; Keyword_Set *keywords = handler->keywords;
fprintf(out, "Lexeme_Table_Lookup lookup = " fprintf(out, "Lexeme_Table_Lookup lookup = "
"lexeme_table_lookup(%.*s_hash_array, %.*s_key_array, " "lexeme_table_lookup("
"%.*s_value_array, %.*s_slot_count, %.*s_seed, " LANG_NAME_LOWER_STR "_%.*s_hash_array, "
LANG_NAME_LOWER_STR "_%.*s_key_array, "
LANG_NAME_LOWER_STR "_%.*s_value_array, "
LANG_NAME_LOWER_STR "_%.*s_slot_count, "
LANG_NAME_LOWER_STR "_%.*s_seed, "
"state.emit_ptr, token.size);\n", "state.emit_ptr, token.size);\n",
string_expand(keywords->pretty_name), string_expand(keywords->pretty_name),
string_expand(keywords->pretty_name), string_expand(keywords->pretty_name),
@ -3477,8 +3481,12 @@ gen_SLOW_action_list__cont_flow(Arena *scratch, Token_Kind_Set tokens, Flag_Set
{ {
Keyword_Set *keywords = handler->keywords; Keyword_Set *keywords = handler->keywords;
fprintf(out, "Lexeme_Table_Lookup lookup = " fprintf(out, "Lexeme_Table_Lookup lookup = "
"lexeme_table_lookup(%.*s_hash_array, %.*s_key_array, " "lexeme_table_lookup("
"%.*s_value_array, %.*s_slot_count, %.*s_seed, " LANG_NAME_LOWER_STR "_%.*s_hash_array, "
LANG_NAME_LOWER_STR "_%.*s_key_array, "
LANG_NAME_LOWER_STR "_%.*s_value_array, "
LANG_NAME_LOWER_STR "_%.*s_slot_count, "
LANG_NAME_LOWER_STR "_%.*s_seed, "
"state.delim_first, (state.delim_one_past_last - state.delim_first));\n", "state.delim_first, (state.delim_one_past_last - state.delim_first));\n",
string_expand(keywords->pretty_name), string_expand(keywords->pretty_name),
string_expand(keywords->pretty_name), string_expand(keywords->pretty_name),