From 05230ad6691c06cd2ca9cf58478e981abd0c6faf Mon Sep 17 00:00:00 2001 From: Allen Webster Date: Thu, 31 Mar 2016 00:05:47 -0400 Subject: [PATCH] scroll bar 99 ready --- 4coder_default.cpp | 4 - 4coder_default_bindings.cpp | 1 - 4cpp_lexer_types.h | 65 ++-- 4ed.cpp | 6 +- 4ed_file_view.cpp | 630 ++++++++++++++++++++++++++++++----- 4ed_gui.cpp | 351 +++++++++++++++++-- 4ed_gui_old.cpp | 256 +++++++------- 4ed_math.cpp | 37 +- 4ed_style.cpp | 55 --- test/4cpp_lexer_fsms.h | 10 +- test/4cpp_lexer_tables.c | 374 ++++++++++++--------- test/4cpp_new_lexer.h | 123 ++----- test/experiment.cpp | 2 +- test/fsm_table_generator.cpp | 423 +++++++++++++++++++++-- win32_4ed.cpp | 2 +- 15 files changed, 1682 insertions(+), 657 deletions(-) diff --git a/4coder_default.cpp b/4coder_default.cpp index ac9256e4..682db180 100644 --- a/4coder_default.cpp +++ b/4coder_default.cpp @@ -17,10 +17,6 @@ CUSTOM_COMMAND_SIG(write_increment){ write_string(app, make_lit_string("++")); } -CUSTOM_COMMAND_SIG(write_decrement){ - write_string(app, make_lit_string("--")); -} - static void basic_seek(Application_Links *app, Command_ID seek_type, unsigned int flags){ push_parameter(app, par_flags, flags); diff --git a/4coder_default_bindings.cpp b/4coder_default_bindings.cpp index 6f0419c4..87fa7582 100644 --- a/4coder_default_bindings.cpp +++ b/4coder_default_bindings.cpp @@ -386,7 +386,6 @@ void default_get_bindings(Bind_Helper *context, int set_hooks){ bind(context, '\t', MDFR_SHIFT, auto_tab_line_at_cursor); bind(context, '=', MDFR_CTRL, write_increment); - bind(context, '-', MDFR_CTRL, write_decrement); bind(context, 't', MDFR_ALT, write_allen_todo); bind(context, 'n', MDFR_ALT, write_allen_note); bind(context, '[', MDFR_CTRL, open_long_braces); diff --git a/4cpp_lexer_types.h b/4cpp_lexer_types.h index 65c2043a..a33bd3c3 100644 --- a/4cpp_lexer_types.h +++ b/4cpp_lexer_types.h @@ -8,6 +8,24 @@ enum Cpp_Token_Type{ CPP_TOKEN_JUNK, CPP_TOKEN_COMMENT, + CPP_PP_INCLUDE, + CPP_PP_DEFINE, + CPP_PP_UNDEF, + CPP_PP_IF, + CPP_PP_IFDEF, + CPP_PP_IFNDEF, + CPP_PP_ELSE, + CPP_PP_ELIF, + CPP_PP_ENDIF, + CPP_PP_ERROR, + CPP_PP_IMPORT, + CPP_PP_USING, + CPP_PP_LINE, + CPP_PP_PRAGMA, + CPP_PP_STRINGIFY, + CPP_PP_CONCAT, + CPP_PP_UNKNOWN, + CPP_TOKEN_KEY_TYPE, CPP_TOKEN_KEY_MODIFIER, CPP_TOKEN_KEY_QUALIFIER, @@ -142,29 +160,14 @@ enum Cpp_Token_Type{ // NOTE(allen): Precedence 16, LtoR CPP_TOKEN_COMMA, - CPP_PP_INCLUDE, - CPP_PP_DEFINE, - CPP_PP_UNDEF, - CPP_PP_IF, - CPP_PP_IFDEF, - CPP_PP_IFNDEF, - CPP_PP_ELSE, - CPP_PP_ELIF, - CPP_PP_ENDIF, - CPP_PP_ERROR, - CPP_PP_IMPORT, - CPP_PP_USING, - CPP_PP_LINE, - CPP_PP_PRAGMA, - CPP_PP_STRINGIFY, - CPP_PP_CONCAT, - CPP_PP_UNKNOWN, CPP_TOKEN_DEFINED, CPP_TOKEN_INCLUDE_FILE, CPP_TOKEN_ERROR_MESSAGE, // NOTE(allen): used in the parser - CPP_TOKEN_EOF + CPP_TOKEN_EOF, + + CPP_TOKEN_TYPE_COUNT }; // TODO(allen): This is a dumb redundant type... probably just @@ -176,9 +179,9 @@ struct Cpp_File{ struct Cpp_Token{ Cpp_Token_Type type; - fcpp_i32 start, size; - fcpp_u16 state_flags; - fcpp_u16 flags; + int start, size; + unsigned short state_flags; + unsigned short flags; }; enum Cpp_Token_Flag{ @@ -208,15 +211,15 @@ enum Cpp_Preprocessor_State{ struct Cpp_Lex_Data{ Cpp_Preprocessor_State pp_state; - fcpp_i32 pos; - fcpp_bool32 complete; + int pos; + int complete; }; struct Cpp_Read_Result{ Cpp_Token token; - fcpp_i32 pos; - fcpp_bool8 newline; - fcpp_bool8 has_result; + int pos; + char newline; + char has_result; }; struct Cpp_Token_Stack{ @@ -226,17 +229,17 @@ struct Cpp_Token_Stack{ struct Cpp_Token_Merge{ Cpp_Token new_token; - fcpp_bool32 did_merge; + int did_merge; }; struct Seek_Result{ - fcpp_i32 pos; - fcpp_bool32 new_line; + int pos; + int new_line; }; struct Cpp_Get_Token_Result{ - fcpp_i32 token_index; - fcpp_bool32 in_whitespace; + int token_index; + int in_whitespace; }; struct Cpp_Relex_State{ diff --git a/4ed.cpp b/4ed.cpp index c30db684..e8668b6e 100644 --- a/4ed.cpp +++ b/4ed.cpp @@ -864,6 +864,8 @@ COMMAND_DECL(interactive_open){ // calls so that they still allocate the buffer right away. This way // it's still possible to get at the buffer if so wished in the API. // The switch for this view doesn't need to happen until the file is ready. + // + // Alternatively... fuck all delayed actions. Please make them go away. delayed_open(delay, string, panel); } } @@ -3954,7 +3956,7 @@ App_Step_Sig(app_step){ for (dll_items(panel, used_panels)){ view = panel->view; active = (panel == cmd->panel); - if (step_file_view(view, active)){ + if (step_file_view(system, view, active)){ app_result.redraw = 1; } } @@ -4404,7 +4406,7 @@ App_Step_Sig(app_step){ } // TODO(allen): We could handle the case where someone tries to save the same thing // twice... that would be nice to have under control. - if (file && buffer_needs_save(file)){ + if (file && buffer_get_sync(file) != SYNC_GOOD){ i32 sys_id = file_save(system, exchange, mem, file, file->name.source_path.str); if (sys_id){ if (act->type == DACT_SAVE_AS){ diff --git a/4ed_file_view.cpp b/4ed_file_view.cpp index 82952387..86b42cbc 100644 --- a/4ed_file_view.cpp +++ b/4ed_file_view.cpp @@ -75,14 +75,16 @@ struct View{ Command_Map *map; Editing_File *file; + f32 prev_wrap_width; View_UI showing_ui; GUI_Target gui_target; - -#if 0 - // interactive stuff + Interactive_Interaction interaction; Interactive_Action action; + +#if 0 + // interactive stuff b32 finished; char query_[256]; char dest_[256]; @@ -151,10 +153,13 @@ view_lock_level(View *view){ return(result); } +// TODO(allen): need to be able to get this from a gui interpretation loop somehow. inline f32 -view_compute_width(View *view){ +view_wrap_width(View *view){ Panel *panel = view->panel; - return (f32)(panel->inner.x1 - panel->inner.x0); + f32 result = (f32)(panel->inner.x1 - panel->inner.x0); + result -= GUIScrollbarWidth; + return (result); } inline f32 @@ -472,7 +477,7 @@ view_compute_lowest_line(View *view){ else{ f32 wrap_y = view->line_wrap_y[last_line]; lowest_line = FLOOR32(wrap_y / view->font_height); - f32 max_width = view_compute_width(view); + f32 max_width = view_wrap_width(view); Editing_File *file = view->file; Assert(!file->state.is_dummy); @@ -506,7 +511,7 @@ view_measure_wraps(System_Functions *system, } f32 line_height = (f32)view->font_height; - f32 max_width = view_compute_width(view); + f32 max_width = view_wrap_width(view); buffer_measure_wrap_y(buffer, view->line_wrap_y, line_height, max_width); view->line_count = line_count; @@ -1123,7 +1128,7 @@ view_compute_cursor_from_pos(View *view, i32 pos){ Full_Cursor result = {}; if (font){ - f32 max_width = view_compute_width(view); + f32 max_width = view_wrap_width(view); result = buffer_cursor_from_pos(&file->state.buffer, pos, view->line_wrap_y, max_width, (f32)view->font_height, font->advance_data); } @@ -1138,10 +1143,9 @@ view_compute_cursor_from_unwrapped_xy(View *view, f32 seek_x, f32 seek_y, b32 ro Full_Cursor result = {}; if (font){ - f32 max_width = view_compute_width(view); + f32 max_width = view_wrap_width(view); result = buffer_cursor_from_unwrapped_xy(&file->state.buffer, seek_x, seek_y, - round_down, view->line_wrap_y, - max_width, (f32)view->font_height, font->advance_data); + round_down, view->line_wrap_y, max_width, (f32)view->font_height, font->advance_data); } return result; @@ -1155,7 +1159,7 @@ view_compute_cursor_from_wrapped_xy(View *view, f32 seek_x, f32 seek_y, b32 roun Full_Cursor result = {}; if (font){ - f32 max_width = view_compute_width(view); + f32 max_width = view_wrap_width(view); result = buffer_cursor_from_wrapped_xy(&file->state.buffer, seek_x, seek_y, round_down, view->line_wrap_y, max_width, (f32)view->font_height, font->advance_data); @@ -1172,7 +1176,7 @@ view_compute_cursor_from_line_pos(View *view, i32 line, i32 pos){ Full_Cursor result = {}; if (font){ - f32 max_width = view_compute_width(view); + f32 max_width = view_wrap_width(view); result = buffer_cursor_from_line_character(&file->state.buffer, line, pos, view->line_wrap_y, max_width, (f32)view->font_height, font->advance_data); } @@ -2481,6 +2485,7 @@ style_get_color(Style *style, Cpp_Token token){ default: result = &style->main.default_color; + break; } } return result; @@ -2488,8 +2493,9 @@ style_get_color(Style *style, Cpp_Token token){ inline f32 view_compute_max_target_y(i32 lowest_line, i32 line_height, f32 view_height){ - real32 max_target_y = ((lowest_line+.5f)*line_height) - view_height*.5f; - return max_target_y; + f32 max_target_y = ((lowest_line+.5f)*line_height) - view_height*.5f; + if (max_target_y < 0) max_target_y = 0; + return(max_target_y); } internal f32 @@ -2499,7 +2505,7 @@ view_compute_max_target_y(View *view){ f32 view_height = view_compute_height(view); f32 max_target_y = view_compute_max_target_y( lowest_line, line_height, view_height); - return max_target_y; + return(max_target_y); } internal void @@ -2613,8 +2619,6 @@ view_show_interactive(System_Functions *system, View *view, Command_Map *gui_map view->map_for_file = view->map; view->map = gui_map; view->showing_ui = VUI_Interactive; - view->action = action; - view->interaction = interaction; view->finished = 0; copy(&view->query, query); @@ -2646,7 +2650,17 @@ view_show_config(View *view, Command_Map *gui_map){} inline void view_show_interactive(System_Functions *system, View *view, Command_Map *gui_map, Interactive_Action action, - Interactive_Interaction interaction, String query){} + Interactive_Interaction interaction, String query){ + + Models *models = view->models; + + view->showing_ui = VUI_Interactive; + view->action = action; + view->interaction = interaction; + + hot_directory_clean_end(&models->hot_directory); + hot_directory_reload(system, &models->hot_directory, &models->working_set); +} inline void view_show_theme(View *view, Command_Map *gui_map){} @@ -2663,9 +2677,8 @@ view_show_file(View *view, Command_Map *file_map){ view->showing_ui = VUI_None; } -#if 0 internal void -interactive_view_complete(View *view){ +interactive_view_complete(View *view, String dest, i32 user_action){ Models *models = view->models; Panel *panel = view->panel; Editing_File *old_file = view->file; @@ -2688,16 +2701,16 @@ interactive_view_complete(View *view){ break; case IAct_Switch: - delayed_switch(&models->delay1, view->dest, panel); + delayed_switch(&models->delay1, dest, panel); delayed_touch_file(&models->delay1, old_file); break; case IAct_Kill: - delayed_try_kill(&models->delay1, view->dest); + delayed_try_kill(&models->delay1, dest); break; case IAct_Sure_To_Close: - switch (view->user_action){ + switch (user_action){ case 0: delayed_close(&models->delay1); break; @@ -2712,9 +2725,9 @@ interactive_view_complete(View *view){ break; case IAct_Sure_To_Kill: - switch (view->user_action){ + switch (user_action){ case 0: - delayed_kill(&models->delay1, view->dest); + delayed_kill(&models->delay1, dest); break; case 1: @@ -2723,8 +2736,8 @@ interactive_view_complete(View *view){ case 2: // TODO(allen): This is fishy! What if the save doesn't happen this time around? // We need to ensure delayed acts happen in order I think. - delayed_save(&models->delay1, view->dest); - delayed_kill(&models->delay1, view->dest); + delayed_save(&models->delay1, dest); + delayed_kill(&models->delay1, dest); break; } break; @@ -2735,7 +2748,6 @@ interactive_view_complete(View *view){ // underlying file which is a giant pain. view->file = 0; } -#endif #if 0 internal void @@ -3424,7 +3436,7 @@ view_reinit_scrolling(View *view){ cursor_x = view_get_cursor_x(view); cursor_y = view_get_cursor_y(view); - w = view_compute_width(view); + w = view_wrap_width(view); h = view_compute_height(view); if (cursor_x >= target_x + w){ @@ -3455,32 +3467,16 @@ file_step(View *view, i32_Rect region, Input_Summary *user_input, b32 is_active) f32 delta_y = 3.f*line_height; - f32 max_y = (f32)(region.y1 - region.y0); + // TODO(allen): Would prefer to use this commented version, + // but then it disagrees with other values of max_y... + //f32 max_y = (f32)(region.y1 - region.y0); + f32 max_y = view_compute_height(view); f32 max_x = (f32)(region.x1 - region.x0); f32 max_target_y = view_compute_max_target_y(lowest_line, (i32)line_height, max_y); - - if (user_input->mouse.wheel != 0){ - f32 wheel_multiplier = 3.f; - f32 delta_target_y = delta_y*user_input->mouse.wheel*wheel_multiplier; - target_y += delta_target_y; + f32 cursor_max_y = max_y - view->font_height * 3; - if (target_y < view->scroll_min_limit) target_y = view->scroll_min_limit; - if (target_y > max_target_y) target_y = max_target_y; - - f32 old_cursor_y = cursor_y; - if (cursor_y >= target_y + max_y) cursor_y = target_y + max_y; - if (cursor_y < target_y - view->scroll_min_limit) cursor_y = target_y - view->scroll_min_limit; - - if (cursor_y != old_cursor_y){ - view->cursor = - view_compute_cursor_from_xy(view, view->preferred_x, cursor_y); - } - - result = 1; - } - - if (cursor_y > target_y + max_y){ - target_y = cursor_y - max_y + delta_y; + if (cursor_y > target_y + cursor_max_y){ + target_y = cursor_y - cursor_max_y + delta_y; } if (cursor_y < target_y - view->scroll_min_limit){ target_y = cursor_y - delta_y + view->scroll_min_limit; @@ -3550,33 +3546,277 @@ view_do_queries(View *view, GUI_Target *target){ } } -internal i32 -step_file_view(View *view, b32 is_active){ - gui_begin_top_level(&view->gui_target); +internal void +do_widget(View *view, GUI_Target *target){ + gui_begin_serial_section(target); { - gui_do_top_bar(&view->gui_target); - - gui_begin_overlap(&view->gui_target); - { - gui_begin_serial_section(&view->gui_target); - { - view_do_queries(view, &view->gui_target); - } - gui_end_serial_section(&view->gui_target); + view_do_queries(view, target); + } + gui_end_serial_section(target); +} - gui_begin_serial_section(&view->gui_target); +internal i32 +step_file_view(System_Functions *system, View *view, b32 is_active){ + GUI_Target *target = &view->gui_target; + Models *models = view->models; + + f32 max_y = view_compute_height(view); + + i32 lowest_line = view_compute_lowest_line(view); + f32 min_target_y = view->scroll_min_limit; + f32 max_target_y = view_compute_max_target_y(lowest_line, view->font_height, max_y); + + + gui_begin_top_level(target); + { + gui_do_top_bar(target); + + if (view->showing_ui == VUI_None){ + gui_begin_overlap(target); + do_widget(view, target); + + gui_begin_serial_section(target); + { + f32 v = unlerp(min_target_y, view->target_y, max_target_y); + f32 old_cursor_y = view_get_cursor_y(view); + f32 cursor_y = old_cursor_y; + f32 cursor_max_y = max_y - view->font_height * 3; + + f32 delta = 9.f * view->font_height; + f32 lerp_space_delta = (delta); + if (max_target_y > min_target_y){ + lerp_space_delta /= (max_target_y - min_target_y); + } + + if (gui_start_scrollable(target, &v, lerp_space_delta)){ + view->target_y = lerp(min_target_y, v, max_target_y); + + if (view->target_y < min_target_y) view->target_y = min_target_y; + if (view->target_y > max_target_y) view->target_y = max_target_y; + + if (cursor_y > view->target_y + cursor_max_y) cursor_y = view->target_y + cursor_max_y; + if (cursor_y < view->target_y - view->scroll_min_limit) cursor_y = view->target_y - view->scroll_min_limit; + + if (cursor_y != old_cursor_y){ + if (cursor_y > old_cursor_y){ + cursor_y += view->font_height; + } + else{ + cursor_y -= view->font_height; + } + view->cursor = view_compute_cursor_from_xy(view, view->preferred_x, cursor_y); + } + } + + if (view->scroll_y < min_target_y) view->scroll_y = min_target_y; + if (view->scroll_y > max_target_y) view->scroll_y = max_target_y; + + gui_do_file(target); + } + gui_end_serial_section(target); + + gui_end_overlap(target); + } + else{ + do_widget(view, target); + switch (view->showing_ui){ + case VUI_Interactive: + switch (view->interaction){ + case IInt_Sys_File_List: + { + persist String p4c_extension = make_lit_string("p4c"); + persist String message_loaded = make_lit_string(" LOADED"); + persist String message_unsaved = make_lit_string(" LOADED *"); + persist String message_unsynced = make_lit_string(" LOADED !"); + persist String message_nothing = {}; + + char front_name_space[256]; + String front_name = make_fixed_width_string(front_name_space); + + char full_path_[256]; + String full_path = make_fixed_width_string(full_path_); + + Absolutes absolutes; + + i32 i, r; + Hot_Directory *hdir = &models->hot_directory; + File_List *files = &hdir->file_list; + File_Info *info = files->infos; + Editing_File *file = 0; + GUI_id file_option_id; + + get_front_of_directory(&front_name, hdir->string); + get_absolutes(front_name, &absolutes, 1, 1); + + get_path_of_directory(&full_path, hdir->string); + r = full_path.size; + + String message = {0}; + String text = {0}; + switch (view->action){ + case IAct_Open: message = make_lit_string("Open: "); break; + case IAct_Save_As: message = make_lit_string("Save As: "); break; + case IAct_New: message = make_lit_string("New: "); break; + } + gui_do_text_field(target, message, text); + + gui_start_scrollable(target, 0, 3.f); + for (i = 0; i < files->count; ++i, ++info){ + append(&full_path, info->filename); + terminate_with_null(&full_path); + file = working_set_contains(system, &models->working_set, full_path); + full_path.size = r; + + b8 is_folder = (info->folder != 0); + b8 name_match = (filename_match(front_name, &absolutes, info->filename, 0) != 0); + b8 is_loaded = (file != 0 && file_is_ready(file)); + + String message = message_nothing; + if (is_loaded){ + switch (buffer_get_sync(file)){ + case SYNC_GOOD: message = message_loaded; break; + case SYNC_BEHIND_OS: message = message_unsynced; break; + case SYNC_UNSAVED: message = message_unsaved; break; + } + } + + if (name_match){ + file_option_id.id[0] = (u64)(info); + if (gui_do_file_option(target, file_option_id, info->filename, is_folder, message)){ + // TODO(allen): actually perform whatever action we need + } + } + } + }break; + }break; + } + } + } + gui_end_top_level(target); + +#if 0 + gui_begin_top_level(target); + { + gui_begin_overlap(target); + { + gui_begin_serial_section(target); + { + view_do_queries(view, target); + } + gui_end_serial_section(target); + + gui_begin_serial_section(target); { switch (view->showing_ui){ case VUI_None: - gui_do_file(&view->gui_target); - break; + { + f32 v = unlerp(min_target_y, view->target_y, max_target_y); + f32 old_cursor_y = view_get_cursor_y(view); + f32 cursor_y = old_cursor_y; + + f32 delta = 9.f * view->font_height; + f32 lerp_space_delta = (delta); + if (max_target_y > min_target_y){ + lerp_space_delta /= (max_target_y - min_target_y); + } + + if (gui_start_scrollable(target, &v, lerp_space_delta)){ + view->target_y = lerp(min_target_y, v, max_target_y); + + if (view->target_y < min_target_y) view->target_y = min_target_y; + if (view->target_y > max_target_y) view->target_y = max_target_y; + + if (cursor_y >= view->target_y + max_y) cursor_y = view->target_y + max_y; + if (cursor_y < view->target_y - view->scroll_min_limit) cursor_y = view->target_y - view->scroll_min_limit; + + if (cursor_y != old_cursor_y){ + view->cursor = view_compute_cursor_from_xy(view, view->preferred_x, cursor_y); + } + } + + if (view->scroll_y < min_target_y) view->scroll_y = min_target_y; + if (view->scroll_y > max_target_y) view->scroll_y = max_target_y; + + gui_do_file(target); + }break; + + case VUI_Interactive: + switch (view->interaction){ + case IInt_Sys_File_List: + { + persist String p4c_extension = make_lit_string("p4c"); + persist String message_loaded = make_lit_string(" LOADED"); + persist String message_unsaved = make_lit_string(" LOADED *"); + persist String message_unsynced = make_lit_string(" LOADED !"); + persist String message_nothing = {}; + + char front_name_space[256]; + String front_name = make_fixed_width_string(front_name_space); + + char full_path_[256]; + String full_path = make_fixed_width_string(full_path_); + + Absolutes absolutes; + + i32 i, r; + Hot_Directory *hdir = &models->hot_directory; + File_List *files = &hdir->file_list; + File_Info *info = files->infos; + Editing_File *file = 0; + GUI_id file_option_id; + + get_front_of_directory(&front_name, hdir->string); + get_absolutes(front_name, &absolutes, 1, 1); + + get_path_of_directory(&full_path, hdir->string); + r = full_path.size; + + String message = {0}; + String text = {0}; + switch (view->action){ + case IAct_Open: message = make_lit_string("Open: "); break; + case IAct_Save_As: message = make_lit_string("Save As: "); break; + case IAct_New: message = make_lit_string("New: "); break; + } + gui_do_text_field(target, message, text); + + gui_start_scrollable(target, 0, 3.f); + for (i = 0; i < files->count; ++i, ++info){ + append(&full_path, info->filename); + terminate_with_null(&full_path); + file = working_set_contains(system, &models->working_set, full_path); + full_path.size = r; + + b8 is_folder = (info->folder != 0); + b8 name_match = (filename_match(front_name, &absolutes, info->filename, 0) != 0); + b8 is_loaded = (file != 0 && file_is_ready(file)); + + String message = message_nothing; + if (is_loaded){ + switch (buffer_get_sync(file)){ + case SYNC_GOOD: message = message_loaded; break; + case SYNC_BEHIND_OS: message = message_unsynced; break; + case SYNC_UNSAVED: message = message_unsaved; break; + } + } + + if (name_match){ + file_option_id.id[0] = (u64)(info); + if (gui_do_file_option(target, file_option_id, info->filename, is_folder, message)){ + // TODO(allen): actually perform whatever action we need + } + } + } + }break; + }break; } } - gui_end_serial_section(&view->gui_target); + gui_end_serial_section(target); } - gui_end_overlap(&view->gui_target); + gui_end_overlap(target); } - gui_end_top_level(&view->gui_target); + gui_end_top_level(target); +#endif return(1); } @@ -3584,18 +3824,21 @@ step_file_view(View *view, b32 is_active){ internal i32 do_input_file_view(System_Functions *system, Exchange *exchange, View *view, i32_Rect rect, b32 is_active, Input_Summary *user_input){ - + i32 result = 0; - + GUI_Session gui_session; GUI_Header *h; - + GUI_Target *target = &view->gui_target; + gui_session_init(&gui_session, rect, view->font_height); - for (h = (GUI_Header*)view->gui_target.push.base; + target->active = {0}; + + for (h = (GUI_Header*)target->push.base; h->type; h = NextHeader(h)){ - if (gui_interpret(&gui_session, h)){ + if (gui_interpret(target, &gui_session, h)){ switch (h->type){ case guicom_top_bar: break; @@ -3611,16 +3854,117 @@ do_input_file_view(System_Functions *system, Exchange *exchange, }break; case guicom_text_field: break; + + case guicom_file_option: + { + GUI_Interactive *b = (GUI_Interactive*)h; + i32 mx = user_input->mouse.x; + i32 my = user_input->mouse.y; + + if (hit_check(mx, my, gui_session.rect)){ + target->hover = b->id; + if (user_input->mouse.press_l){ + target->hot = b->id; + } + if (user_input->mouse.release_l && gui_id_eq(target->hot, b->id)){ + target->active = b->id; + target->hot = {0}; + } + } + else if (gui_id_eq(target->hover, b->id)){ + target->hover = {0}; + } + }break; + + case guicom_scrollable_top: + { + GUI_id id = gui_id_scrollbar_top(); + i32 mx = user_input->mouse.x; + i32 my = user_input->mouse.y; + + if (hit_check(mx, my, gui_session.rect)){ + target->hover = id; + if (user_input->mouse.press_l){ + target->hot = id; + } + if (user_input->mouse.release_l && gui_id_eq(target->hot, id)){ + target->active = gui_id_scrollbar(); + target->hot = {0}; + target->scroll_v -= target->scroll_delta; + if (target->scroll_v < 0) target->scroll_v = 0; + } + } + else if (gui_id_eq(target->hover, id)){ + target->hover = {0}; + } + }break; + + case guicom_scrollable_slider: + { + GUI_id id = gui_id_scrollbar_slider(); + i32 mx = user_input->mouse.x; + i32 my = user_input->mouse.y; + + if (hit_check(mx, my, gui_session.rect)){ + target->hover = id; + if (user_input->mouse.press_l){ + target->hot = id; + } + } + else if (gui_id_eq(target->hover, id)){ + target->hover = {0}; + } + + if (gui_id_eq(target->hot, id)){ + target->active = gui_id_scrollbar(); + target->scroll_v = unlerp(gui_session.scroll_top, (f32)my, gui_session.scroll_bottom); + if (target->scroll_v < 0) target->scroll_v = 0; + if (target->scroll_v > 1) target->scroll_v = 1; + } + + if (user_input->mouse.wheel != 0){ + target->active = gui_id_scrollbar(); + target->scroll_v += user_input->mouse.wheel*target->scroll_delta; + if (target->scroll_v < 0) target->scroll_v = 0; + if (target->scroll_v > 1) target->scroll_v = 1; + } + }break; + + case guicom_scrollable_bottom: + { + GUI_id id = gui_id_scrollbar_bottom(); + i32 mx = user_input->mouse.x; + i32 my = user_input->mouse.y; + + if (hit_check(mx, my, gui_session.rect)){ + target->hover = id; + if (user_input->mouse.press_l){ + target->hot = id; + } + if (user_input->mouse.release_l && gui_id_eq(target->hot, id)){ + target->active = gui_id_scrollbar(); + target->hot = {0}; + target->scroll_v += target->scroll_delta; + if (target->scroll_v > 1) target->scroll_v = 1; + } + } + else if (gui_id_eq(target->hover, id)){ + target->hover = {0}; + } + }break; } } } - + + if (!user_input->mouse.l){ + target->hot = {0}; + } + return(result); - + #if 0 Models *models = view->models; i32 result = 0; - i32 widget_height = 0; AllowLocal(models); @@ -3899,14 +4243,14 @@ do_render_text_field(Render_Target *target, View *view, i32_Rect rect, String p, u32 text2_color = style->main.file_info_style.pop1_color; i32 x = rect.x0; - i32 y = rect.y0; + i32 y = rect.y0 + 3; i16 font_id = models->global_font.font_id; if (target){ draw_rectangle(target, rect, back_color); - x = draw_string(target, font_id, p, x, y + 1, text2_color); - draw_string(target, font_id, t, x, y + 1, text1_color); + x = draw_string(target, font_id, p, x, y, text2_color); + draw_string(target, font_id, t, x, y, text1_color); } } @@ -3983,6 +4327,46 @@ do_render_file_bar(Render_Target *target, View *view, Editing_File *file, i32_Re } } +internal void +draw_fat_option_block(GUI_Target *gui_target, Render_Target *target, View *view, i32_Rect rect, GUI_id id, String text, String pop){ + Models *models = view->models; + Style *style = &models->style; + + i32 active_level = gui_active_level(gui_target, id); + i16 font_id = models->global_font.font_id; + + i32_Rect inner = get_inner_rect(rect, 3); + + u32 margin; + u32 back = style->main.back_color; + u32 text_color = style->main.default_color; + u32 pop_color = style->main.special_character_color; + + i32 h = view->font_height; + i32 x = inner.x0 + 3; + i32 y = inner.y0 + h/2 - 1; + + switch (active_level){ + case 0: + margin = style->main.margin_color; + break; + + case 1: case 2: + margin = style->main.margin_hover_color; + break; + + default: + margin = style->main.margin_active_color; + break; + } + + draw_rectangle(target, inner, back); + draw_margin(target, rect, inner, margin); + + x = draw_string(target, font_id, text, x, y, text_color); + draw_string(target, font_id, pop, x, y, pop_color); +} + internal i32 do_render_file_view(System_Functions *system, Exchange *exchange, View *view, View *active, i32_Rect rect, b32 is_active, @@ -3993,13 +4377,14 @@ do_render_file_view(System_Functions *system, Exchange *exchange, GUI_Session gui_session = {0}; GUI_Header *h; + GUI_Target *gui_target = &view->gui_target; gui_session_init(&gui_session, rect, view->font_height); - for (h = (GUI_Header*)view->gui_target.push.base; + for (h = (GUI_Header*)gui_target->push.base; h->type; h = NextHeader(h)){ - if (gui_interpret(&gui_session, h)){ + if (gui_interpret(&view->gui_target, &gui_session, h)){ switch (h->type){ case guicom_top_bar: { @@ -4027,6 +4412,83 @@ do_render_file_view(System_Functions *system, Exchange *exchange, String t = gui_read_string(&ptr); do_render_text_field(target, view, gui_session.rect, p, t); }break; + + case guicom_file_option: + { + GUI_Interactive *b = (GUI_Interactive*)h; + void *ptr = (b + 1); + b32 folder = gui_read_integer(&ptr); + String f = gui_read_string(&ptr); + String m = gui_read_string(&ptr); + + if (folder){ + append(&f, system->slash); + } + + draw_fat_option_block(gui_target, target, view, gui_session.rect, b->id, f, m); + }break; + + case guicom_scrollable: + { + Models *models = view->models; + Style *style = &models->style; + + u32 back; + u32 outline; + + i32_Rect bar = gui_session.rect; + + back = style->main.back_color; + if (is_active){ + outline = style->main.margin_active_color; + } + else{ + outline = style->main.margin_color; + } + + draw_rectangle(target, bar, back); + draw_rectangle_outline(target, bar, outline); + }break; + + case guicom_scrollable_top: + case guicom_scrollable_slider: + case guicom_scrollable_bottom: + { + GUI_id id; + Models *models = view->models; + Style *style = &models->style; + + i32 active_level; + + u32 back; + u32 outline; + + i32_Rect box = gui_session.rect; + + switch (h->type){ + case guicom_scrollable_top: id = gui_id_scrollbar_top(); break; + case guicom_scrollable_bottom: id = gui_id_scrollbar_bottom(); break; + default: id = gui_id_scrollbar_slider(); break; + } + + active_level = gui_active_level(gui_target, id); + + switch (active_level){ + case 0: back = style->main.back_color; break; + case 1: case 2: back = style->main.margin_hover_color; break; + default: back = style->main.margin_active_color; break; + } + + if (is_active){ + outline = style->main.margin_active_color; + } + else{ + outline = style->main.margin_color; + } + + draw_rectangle(target, box, back); + draw_rectangle_outline(target, box, outline); + }break; } } } diff --git a/4ed_gui.cpp b/4ed_gui.cpp index 382b9361..31ddc3d9 100644 --- a/4ed_gui.cpp +++ b/4ed_gui.cpp @@ -70,9 +70,19 @@ struct Super_Color{ u32 *out; }; +struct GUI_id{ + u64 id[1]; +}; + struct GUI_Target{ Partition push; - b32 show_file; + + GUI_id active; + GUI_id hot; + GUI_id hover; + + f32 scroll_v; + f32 scroll_delta; }; struct GUI_Header{ @@ -80,6 +90,11 @@ struct GUI_Header{ i32 size; }; +struct GUI_Interactive{ + GUI_Header h; + GUI_id id; +}; + enum GUI_Command_Type{ guicom_null, guicom_begin_overlap, @@ -88,13 +103,50 @@ enum GUI_Command_Type{ guicom_end_serial, guicom_top_bar, guicom_file, - guicom_text_field + guicom_text_field, + guicom_file_option, + guicom_scrollable, + guicom_scrollable_top, + guicom_scrollable_slider, + guicom_scrollable_bottom, }; +internal b32 +gui_id_eq(GUI_id id1, GUI_id id2){ + b32 result = (id1.id[0] == id2.id[0]); + return(result); +} + +internal b32 +gui_id_is_null(GUI_id id){ + b32 result = (id.id[0] == 0); + return(result); +} + +internal i32 +gui_active_level(GUI_Target *target, GUI_id id){ + i32 level = 0; + if (gui_id_eq(target->active, id)){ + level = 4; + } + else if (gui_id_eq(target->hot, id)){ + if (gui_id_eq(target->hover, id)){ + level = 3; + } + else{ + level = 2; + } + } + else if (gui_id_eq(target->hover, id) && gui_id_is_null(target->hot)){ + level = 1; + } + return(level); +} + internal void* -gui_push_command(GUI_Target *target, void *item, i32 size){ +gui_push_item(GUI_Target *target, void *item, i32 size){ void *dest = partition_allocate(&target->push, size); - if (dest){ + if (dest && item){ memcpy(dest, item, size); } return(dest); @@ -108,13 +160,48 @@ gui_align(GUI_Target *target){ return(ptr); } +internal void* +gui_push_aligned_item(GUI_Target *target, GUI_Header *h, void *item, i32 size){ + char *start, *end; + start = (char*)partition_allocate(&target->push, size); + if (start){ + memcpy(start, item, size); + } + end = (char*)gui_align(target); + size = (i32)(end - start); + h->size += size; + return(start); +} + +internal void* +gui_push_item(GUI_Target *target, GUI_Header *h, void *item, i32 size){ + void *ptr; + ptr = (char*)partition_allocate(&target->push, size); + if (ptr){ + memcpy(ptr, item, size); + } + h->size += size; + return(ptr); +} + internal GUI_Header* gui_push_simple_command(GUI_Target *target, i32 type){ GUI_Header *result = 0; GUI_Header item; item.type = type; item.size = sizeof(item); - result = (GUI_Header*)gui_push_command(target, &item, item.size); + result = (GUI_Header*)gui_push_item(target, &item, sizeof(item)); + return(result); +} + +internal GUI_Interactive* +gui_push_button_command(GUI_Target *target, i32 type, GUI_id id){ + GUI_Interactive *result = 0; + GUI_Interactive item; + item.h.type = type; + item.h.size = sizeof(item); + item.id = id; + result = (GUI_Interactive*)gui_push_item(target, &item, sizeof(item)); return(result); } @@ -122,8 +209,20 @@ internal void gui_push_string(GUI_Target *target, GUI_Header *h, String s){ u8 *start, *end; i32 size; - start = (u8*)gui_push_command(target, &s.size, sizeof(s.size)); - gui_push_command(target, s.str, s.size); + start = (u8*)gui_push_item(target, &s.size, sizeof(s.size)); + gui_push_item(target, s.str, s.size); + end = (u8*)gui_align(target); + size = (i32)(end - start); + h->size += size; +} + +internal void +gui_push_string(GUI_Target *target, GUI_Header *h, String s, i32 extra){ + u8 *start, *end; + i32 size; + start = (u8*)gui_push_item(target, &s.size, sizeof(s.size)); + gui_push_item(target, s.str, s.size); + gui_push_item(target, 0, extra); end = (u8*)gui_align(target); size = (i32)(end - start); h->size += size; @@ -131,8 +230,8 @@ gui_push_string(GUI_Target *target, GUI_Header *h, String s){ internal void gui_begin_top_level(GUI_Target *target){ - target->show_file = 0; target->push.pos = 0; + target->scroll_delta = 0; } internal void @@ -168,34 +267,106 @@ gui_do_top_bar(GUI_Target *target){ internal void gui_do_file(GUI_Target *target){ gui_push_simple_command(target, guicom_file); - target->show_file = 1; } internal void -gui_do_text_field(GUI_Target *target, String p, String t){ +gui_do_text_field(GUI_Target *target, String prompt, String text){ GUI_Header *h = gui_push_simple_command(target, guicom_text_field); - gui_push_string(target, h, p); - gui_push_string(target, h, t); + gui_push_string(target, h, prompt); + gui_push_string(target, h, text); +} + +internal b32 +gui_do_file_option(GUI_Target *target, GUI_id file_id, String filename, b32 is_folder, String message){ + b32 result = 0; + + GUI_Interactive *b = gui_push_button_command(target, guicom_file_option, file_id); + GUI_Header *h = (GUI_Header*)b; + gui_push_item(target, h, &is_folder, sizeof(is_folder)); + gui_push_string(target, h, filename, 1); + gui_push_string(target, h, message); + + if (gui_id_eq(file_id, target->active)){ + result = 1; + } + + return(result); +} + +internal GUI_id +gui_id_scrollbar(){ + GUI_id id; + id.id[0] = max_u64; + return(id); +} + +internal GUI_id +gui_id_scrollbar_top(){ + GUI_id id; + id.id[0] = max_u64 - 1; + return(id); +} + +internal GUI_id +gui_id_scrollbar_slider(){ + GUI_id id; + id.id[0] = max_u64 - 2; + return(id); +} + +internal GUI_id +gui_id_scrollbar_bottom(){ + GUI_id id; + id.id[0] = max_u64 - 3; + return(id); +} + +internal b32 +gui_start_scrollable(GUI_Target *target, f32 *v, f32 d){ + b32 result = 0; + GUI_Header *h; + + target->scroll_delta = d; + h = gui_push_simple_command(target, guicom_scrollable); + if (gui_id_eq(gui_id_scrollbar(), target->active)){ + if (v) *v = target->scroll_v; + result = 1; + } + else{ + if (v) target->scroll_v = *v; + } + + gui_push_simple_command(target, guicom_scrollable_top); + gui_push_simple_command(target, guicom_scrollable_slider); + gui_push_simple_command(target, guicom_scrollable_bottom); + + return(result); } struct GUI_Section{ b32 overlapped; - i32 v; - i32 max_v; + i32 max_v, v; }; struct GUI_Session{ i32_Rect full_rect; - i32_Rect rect; i32_Rect clip_rect; + i32_Rect rect; i32 line_height; + i32 scroll_bar_w; + b32 is_scrollable; + + i32_Rect scroll_rect; + f32 scroll_top, scroll_bottom; GUI_Section sections[64]; i32 t; }; +#define GUIScrollbarWidth 16 + internal void gui_session_init(GUI_Session *session, i32_Rect full_rect, i32 line_height){ GUI_Section *section; @@ -203,6 +374,7 @@ gui_session_init(GUI_Session *session, i32_Rect full_rect, i32 line_height){ *session = {0}; session->full_rect = full_rect; session->line_height = line_height; + session->scroll_bar_w = GUIScrollbarWidth; section = &session->sections[0]; section->v = full_rect.y0; @@ -217,8 +389,69 @@ gui_section_end_item(GUI_Section *section, i32 v){ section->max_v = v; } +inline i32_Rect +gui_layout_top_bottom(GUI_Session *session, i32 y0, i32 y1){ + i32_Rect rect; + i32_Rect full_rect = session->full_rect; + rect.y0 = y0; + rect.y1 = y1; + rect.x0 = full_rect.x0; + rect.x1 = full_rect.x1; + if (session->is_scrollable){ + rect.x1 -= session->scroll_bar_w; + } + return(rect); +} + +inline i32_Rect +gui_layout_fixed_h(GUI_Session *session, i32 y, i32 h){ + i32_Rect rect; + rect = gui_layout_top_bottom(session, y, y + h); + return(rect); +} + +internal void +gui_scrollbar_top(i32_Rect bar, i32_Rect *top){ + i32 w = (bar.x1 - bar.x0); + + top->x0 = bar.x0; + top->x1 = bar.x1; + top->y0 = bar.y0; + top->y1 = top->y0 + w; +} + +internal void +gui_scrollbar_slider(i32_Rect bar, i32_Rect *slider, f32 s, f32 *min_out, f32 *max_out){ + i32 w = (bar.x1 - bar.x0); + i32 min, max, pos; + + slider->x0 = bar.x0; + slider->x1 = bar.x1; + + min = bar.y0 + w + w/2; + max = bar.y1 - w - w/2; + + pos = lerp(min, s, max); + + slider->y0 = pos - w/2; + slider->y1 = slider->y0 + w; + + *min_out = (f32)min; + *max_out = (f32)max; +} + +internal void +gui_scrollbar_bottom(i32_Rect bar, i32_Rect *bottom){ + i32 w = (bar.x1 - bar.x0); + + bottom->x0 = bar.x0; + bottom->x1 = bar.x1; + bottom->y1 = bar.y1; + bottom->y0 = bottom->y1 - w; +} + internal b32 -gui_interpret(GUI_Session *session, GUI_Header *h){ +gui_interpret(GUI_Target *target, GUI_Session *session, GUI_Header *h){ GUI_Section *section = 0; GUI_Section *new_section = 0; GUI_Section *prev_section = 0; @@ -242,6 +475,7 @@ gui_interpret(GUI_Session *session, GUI_Header *h){ new_section = &session->sections[session->t]; new_section->overlapped = 1; new_section->v = y; + new_section->max_v = y; break; case guicom_end_overlap: @@ -258,6 +492,7 @@ gui_interpret(GUI_Session *session, GUI_Header *h){ new_section = &session->sections[session->t]; new_section->overlapped = 0; new_section->v = y; + new_section->max_v = y; break; case guicom_end_serial: @@ -270,33 +505,64 @@ gui_interpret(GUI_Session *session, GUI_Header *h){ case guicom_top_bar: give_to_user = 1; - rect.y0 = y; - rect.y1 = rect.y0 + session->line_height + 2; - rect.x0 = session->full_rect.x0; - rect.x1 = session->full_rect.x1; + rect = gui_layout_fixed_h(session, y, session->line_height + 2); end_v = rect.y1; end_section = section; break; - + case guicom_file: give_to_user = 1; - rect.y0 = y; - rect.y1 = session->full_rect.y1; - rect.x0 = session->full_rect.x0; - rect.x1 = session->full_rect.x1; + rect = gui_layout_top_bottom(session, y, session->full_rect.y1); end_v = rect.y1; end_section = section; break; case guicom_text_field: give_to_user = 1; - rect.y0 = y; - rect.y1 = rect.y0 + session->line_height + 2; - rect.x0 = session->full_rect.x0; - rect.x1 = session->full_rect.x1; + rect = gui_layout_fixed_h(session, y, session->line_height + 2); end_v = rect.y1; end_section = section; break; + + case guicom_file_option: + give_to_user = 1; + rect = gui_layout_fixed_h(session, y, session->line_height * 2); + end_v = rect.y1; + end_section = section; + break; + + case guicom_scrollable: + Assert(session->is_scrollable == 0); + Assert(!section->overlapped); + give_to_user = 1; + rect.x1 = session->full_rect.x1; + rect.x0 = rect.x1 - session->scroll_bar_w; + rect.y0 = y; + rect.y1 = session->full_rect.y1; + session->scroll_rect = rect; + session->is_scrollable = 1; + break; + + case guicom_scrollable_top: + Assert(session->is_scrollable); + Assert(!section->overlapped); + give_to_user = 1; + gui_scrollbar_top(session->scroll_rect, &rect); + break; + + case guicom_scrollable_slider: + Assert(session->is_scrollable); + Assert(!section->overlapped); + give_to_user = 1; + gui_scrollbar_slider(session->scroll_rect, &rect, target->scroll_v, &session->scroll_top, &session->scroll_bottom); + break; + + case guicom_scrollable_bottom: + Assert(session->is_scrollable); + Assert(!section->overlapped); + give_to_user = 1; + gui_scrollbar_bottom(session->scroll_rect, &rect); + break; } if (give_to_user){ @@ -307,21 +573,19 @@ gui_interpret(GUI_Session *session, GUI_Header *h){ for (i = 0; i <= session->t; ++i, ++section){ if (section->overlapped){ max_v = Max(max_v, section->max_v); - } - } + } + } session->rect = rect; - if (rect.y0 < max_v){ rect.y0 = max_v; - } - + } session->clip_rect = rect; } if (end_section){ gui_section_end_item(end_section, end_v); - } + } } return(give_to_user); @@ -329,6 +593,22 @@ gui_interpret(GUI_Session *session, GUI_Header *h){ #define NextHeader(h) ((GUI_Header*)((char*)(h) + (h)->size)) +internal i32 +gui_read_integer(void **ptr){ + i32 result; + result = *(i32*)*ptr; + *ptr = ((char*)*ptr) + 4; + return(result); +} + +internal f32 +gui_read_float(void **ptr){ + f32 result; + result = *(f32*)*ptr; + *ptr = ((char*)*ptr) + 4; + return(result); +} + internal String gui_read_string(void **ptr){ String result; @@ -344,6 +624,7 @@ gui_read_string(void **ptr){ size = (i32)(end - start); size = (size + 7) & (~7); + result.memory_size = size; *ptr = ((char*)start) + size; return(result); diff --git a/4ed_gui_old.cpp b/4ed_gui_old.cpp index 1a6ec093..233656e3 100644 --- a/4ed_gui_old.cpp +++ b/4ed_gui_old.cpp @@ -155,20 +155,20 @@ app_single_file_input_step(System_Functions *system, mode.fast_folder_select = fast_folder_select; mode.try_to_match = try_to_match; mode.case_sensitive = case_sensitive; - return app_single_line_input_core(system, working_set, key, mode); + return app_single_line_input_core(system, working_set, key, mode); } inline Single_Line_Input_Step app_single_number_input_step(System_Functions *system, Key_Event_Data key, String *string){ Single_Line_Input_Step result = {}; - Single_Line_Mode mode = {}; - mode.type = SINGLE_LINE_STRING; - mode.string = string; - + Single_Line_Mode mode = {}; + mode.type = SINGLE_LINE_STRING; + mode.string = string; + char c = (char)key.character; if (c == 0 || c == '\n' || char_is_numeric(c)) result = app_single_line_input_core(system, 0, key, mode); - return result; + return result; } struct Widget_ID{ @@ -192,13 +192,13 @@ struct UI_State{ Key_Summary *keys; Working_Set *working_set; i16 font_id; - + Widget_ID selected, hover, hot; b32 activate_me; b32 redraw; b32 input_stage; i32 sub_id1_change; - + f32 height, view_y; }; @@ -249,7 +249,7 @@ struct UI_Layout{ i32 row_count; i32 row_item_width; i32 row_max_item_height; - + i32_Rect rect; i32 x, y; }; @@ -346,15 +346,15 @@ get_colors(UI_State *state, u32 *back, u32 *fore, Widget_ID wid, UI_Style style) b32 hot = is_hot(state, wid); i32 level = hot + hover; switch (level){ - case 2: + case 2: *back = style.bright; *fore = style.dark; break; - case 1: + case 1: *back = style.dim; *fore = style.bright; break; - case 0: + case 0: *back = style.dark; *fore = style.bright; break; @@ -367,13 +367,13 @@ get_pop_color(UI_State *state, u32 *pop, Widget_ID wid, UI_Style style){ b32 hot = is_hot(state, wid); i32 level = hot + hover; switch (level){ - case 2: + case 2: *pop = style.pop1; break; - case 1: + case 1: *pop = style.pop1; break; - case 0: + case 0: *pop = style.pop1; break; } @@ -382,7 +382,7 @@ get_pop_color(UI_State *state, u32 *pop, Widget_ID wid, UI_Style style){ internal UI_State ui_state_init(UI_State *state_in, Render_Target *target, Input_Summary *user_input, Style *style, i16 font_id, Font_Set *font_set, Working_Set *working_set, b32 input_stage){ - + UI_State state = {}; state.target = target; state.style = style; @@ -414,18 +414,18 @@ ui_state_match(UI_State a, UI_State b){ internal b32 ui_finish_frame(UI_State *persist_state, UI_State *state, UI_Layout *layout, i32_Rect rect, - b32 do_wheel, b32 *did_activation){ + b32 do_wheel, b32 *did_activation){ b32 result = 0; f32 h = layout->y + persist_state->view_y - rect.y0; f32 max_y = h - (rect.y1 - rect.y0); - + persist_state->height = h; persist_state->view_y = state->view_y; - + if (state->input_stage){ Mouse_State *mouse = state->mouse; Font_Set *font_set = state->font_set; - + if (mouse->wheel != 0 && do_wheel){ i32 height = get_font_info(font_set, state->font_id)->height; persist_state->view_y += mouse->wheel*height; @@ -440,14 +440,14 @@ ui_finish_frame(UI_State *persist_state, UI_State *state, UI_Layout *layout, i32 if (!mouse->l && !mouse->r){ state->hot = {}; } - + if (!ui_state_match(*persist_state, *state) || state->redraw){ result = 1; } - + *persist_state = *state; } - + if (persist_state->view_y >= max_y) persist_state->view_y = max_y; if (persist_state->view_y < 0) persist_state->view_y = 0; @@ -487,7 +487,7 @@ ui_do_subdivided_button_input(UI_State *state, i32_Rect rect, i32 parts, Widget_ sub_rect.y0 = rect.y0; sub_rect.y1 = rect.y1; x1 = (real32)rect.x0; - + for (i32 i = 0; i < parts; ++i){ x0 = x1; x1 = x1 + sub_width; @@ -499,14 +499,14 @@ ui_do_subdivided_button_input(UI_State *state, i32_Rect rect, i32 parts, Widget_ break; } } - + return result; } internal real32 ui_do_vscroll_input(UI_State *state, i32_Rect top, i32_Rect bottom, i32_Rect slider, - Widget_ID id, real32 val, real32 step_amount, - real32 smin, real32 smax, real32 vmin, real32 vmax){ + Widget_ID id, real32 val, real32 step_amount, + real32 smin, real32 smax, real32 vmin, real32 vmax){ Mouse_State *mouse = state->mouse; i32 mx = mouse->x; i32 my = mouse->y; @@ -569,21 +569,21 @@ ui_do_text_field_input(UI_State *state, String *str){ internal b32 ui_do_file_field_input(System_Functions *system, UI_State *state, - Hot_Directory *hot_dir, b32 try_to_match, b32 case_sensitive){ + Hot_Directory *hot_dir, b32 try_to_match, b32 case_sensitive){ Key_Event_Data key; Single_Line_Input_Step step; String *str = &hot_dir->string; Key_Summary *keys = state->keys; i32 key_i; b32 result = 0; - + terminate_with_null(str); - + for (key_i = 0; key_i < keys->count; ++key_i){ key = get_single_key(keys, key_i); step = app_single_file_input_step(system, state->working_set, key, str, - hot_dir, 1, try_to_match, case_sensitive); + hot_dir, 1, try_to_match, case_sensitive); if ((step.hit_newline || step.hit_ctrl_newline) && !step.no_file_match) result = 1; } return result; @@ -591,7 +591,7 @@ ui_do_file_field_input(System_Functions *system, UI_State *state, internal b32 ui_do_line_field_input(System_Functions *system, - UI_State *state, String *string){ + UI_State *state, String *string){ b32 result = 0; Key_Summary *keys = state->keys; for (i32 key_i = 0; key_i < keys->count; ++key_i){ @@ -606,7 +606,7 @@ ui_do_line_field_input(System_Functions *system, internal b32 ui_do_slider_input(UI_State *state, i32_Rect rect, Widget_ID wid, - real32 min, real32 max, real32 *v){ + real32 min, real32 max, real32 *v){ b32 result = 0; ui_do_button_input(state, rect, wid, 0); Mouse_State *mouse = state->mouse; @@ -624,7 +624,7 @@ do_text_field(Widget_ID wid, UI_State *state, UI_Layout *layout, String prompt, i32 character_h = get_font_info(state->font_set, state->font_id)->height; i32_Rect rect = layout_rect(layout, character_h); - + if (state->input_stage){ ui_do_button_input(state, rect, wid, 1); if (is_selected(state, wid)){ @@ -639,9 +639,9 @@ do_text_field(Widget_ID wid, UI_State *state, UI_Layout *layout, String prompt, u32 back, fore, prompt_pop; get_colors(state, &back, &fore, wid, ui_style); get_pop_color(state, &prompt_pop, wid, ui_style); - + draw_rectangle(target, rect, back); - + i32 x = draw_string(target, state->font_id, prompt, rect.x0, rect.y0 + 1, prompt_pop); draw_string(target, state->font_id, dest, x, rect.y0 + 1, ui_style.base); } @@ -651,7 +651,7 @@ do_text_field(Widget_ID wid, UI_State *state, UI_Layout *layout, String prompt, internal b32 do_button(i32 id, UI_State *state, UI_Layout *layout, char *text, i32 height_mult, - b32 is_toggle = 0, b32 on = 0){ + b32 is_toggle = 0, b32 on = 0){ b32 result = 0; i16 font_id = state->font_id; i32 character_h = get_font_info(state->font_set, font_id)->height; @@ -662,9 +662,9 @@ do_button(i32 id, UI_State *state, UI_Layout *layout, char *text, i32 height_mul btn_rect.x0 += 2; btn_rect.x1 -= 2; } - + Widget_ID wid = make_id(state, id); - + if (state->input_stage){ if (ui_do_button_input(state, btn_rect, wid, 0)){ result = 1; @@ -676,7 +676,7 @@ do_button(i32 id, UI_State *state, UI_Layout *layout, char *text, i32 height_mul u32 back, fore, outline; outline = ui_style.bright; get_colors(state, &back, &fore, wid, ui_style); - + draw_rectangle(target, btn_rect, back); draw_rectangle_outline(target, btn_rect, outline); real32 text_width = font_string_width(target, font_id, text); @@ -684,17 +684,17 @@ do_button(i32 id, UI_State *state, UI_Layout *layout, char *text, i32 height_mul i32 box_height = btn_rect.y1 - btn_rect.y0; i32 x_pos = TRUNC32(btn_rect.x0 + (box_width - text_width)*.5f); draw_string(target, font_id, text, x_pos, btn_rect.y0 + (box_height - character_h) / 2, fore); - + if (is_toggle){ i32_Rect on_box = get_inner_rect(btn_rect, character_h/2); on_box.x1 = on_box.x0 + (on_box.y1 - on_box.y0); - + if (on) draw_rectangle(target, on_box, fore); else draw_rectangle(target, on_box, back); draw_rectangle_outline(target, on_box, fore); } } - + return result; } @@ -703,15 +703,15 @@ do_undo_slider(Widget_ID wid, UI_State *state, UI_Layout *layout, i32 max, i32 v b32 result = 0; i16 font_id = state->font_id; i32 character_h = get_font_info(state->font_set, font_id)->height; - + i32_Rect containing_rect = layout_rect(layout, character_h); - + i32_Rect click_rect; click_rect.x0 = containing_rect.x0 + character_h - 1; click_rect.x1 = containing_rect.x1 - character_h + 1; click_rect.y0 = containing_rect.y0 + 2; click_rect.y1 = containing_rect.y1 - 2; - + if (state->input_stage){ real32 l; if (ui_do_slider_input(state, click_rect, wid, (real32)click_rect.x0, (real32)click_rect.x1, &l)){ @@ -725,18 +725,18 @@ do_undo_slider(Widget_ID wid, UI_State *state, UI_Layout *layout, i32 max, i32 v Render_Target *target = state->target; if (max > 0){ UI_Style ui_style = get_ui_style_upper(state->style); - + real32 L = unlerp(0.f, (real32)v, (real32)max); i32 x = FLOOR32(lerp((real32)click_rect.x0, L, (real32)click_rect.x1)); - + i32 bar_top = ((click_rect.y0 + click_rect.y1) >> 1) - 1; i32 bar_bottom = bar_top + 2; - + bool32 show_bar = 1; real32 tick_step = (click_rect.x1 - click_rect.x0) / (real32)max; bool32 show_ticks = 1; if (tick_step <= 5.f) show_ticks = 0; - + if (undo == 0){ if (show_bar){ i32_Rect slider_rect; @@ -744,27 +744,27 @@ do_undo_slider(Widget_ID wid, UI_State *state, UI_Layout *layout, i32 max, i32 v slider_rect.x1 = x; slider_rect.y0 = bar_top; slider_rect.y1 = bar_bottom; - + draw_rectangle(target, slider_rect, ui_style.dim); - + slider_rect.x0 = x; slider_rect.x1 = click_rect.x1; draw_rectangle(target, slider_rect, ui_style.pop1); } - + if (show_ticks){ f32_Rect tick; tick.x0 = (real32)click_rect.x0 - 1; tick.x1 = (real32)click_rect.x0 + 1; tick.y0 = (real32)bar_top - 3; tick.y1 = (real32)bar_bottom + 3; - + for (i32 i = 0; i < v; ++i){ draw_rectangle(target, tick, ui_style.dim); tick.x0 += tick_step; tick.x1 += tick_step; } - + for (i32 i = v; i <= max; ++i){ draw_rectangle(target, tick, ui_style.pop1); tick.x0 += tick_step; @@ -778,16 +778,16 @@ do_undo_slider(Widget_ID wid, UI_State *state, UI_Layout *layout, i32 max, i32 v slider_rect.x0 = click_rect.x0; slider_rect.y0 = bar_top; slider_rect.y1 = bar_bottom; - + Edit_Step *history = undo->history.edits; i32 block_count = undo->history_block_count; Edit_Step *step = history; for (i32 i = 0; i < block_count; ++i){ u32 color; if (step->type == ED_REDO || - step->type == ED_UNDO) color = ui_style.pop1; + step->type == ED_UNDO) color = ui_style.pop1; else color = ui_style.dim; - + real32 L; if (i + 1 == block_count){ L = 1.f; @@ -797,15 +797,15 @@ do_undo_slider(Widget_ID wid, UI_State *state, UI_Layout *layout, i32 max, i32 v } if (L > 1.f) L = 1.f; i32 x = FLOOR32(lerp((real32)click_rect.x0, L, (real32)click_rect.x1)); - + slider_rect.x1 = x; draw_rectangle(target, slider_rect, color); slider_rect.x0 = slider_rect.x1; - + if (L == 1.f) break; } } - + if (show_ticks){ f32_Rect tick; tick.x0 = (real32)click_rect.x0 - 1; @@ -819,7 +819,7 @@ do_undo_slider(Widget_ID wid, UI_State *state, UI_Layout *layout, i32 max, i32 v if (i != max){ if (history[i].type == ED_REDO) color = ui_style.pop1; else if (history[i].type == ED_UNDO || - history[i].type == ED_NORMAL) color = ui_style.pop2; + history[i].type == ED_NORMAL) color = ui_style.pop2; else color = ui_style.dim; } draw_rectangle(target, tick, color); @@ -828,17 +828,17 @@ do_undo_slider(Widget_ID wid, UI_State *state, UI_Layout *layout, i32 max, i32 v } } } - + i32_Rect slider_handle; slider_handle.x0 = x - 2; slider_handle.x1 = x + 2; slider_handle.y0 = click_rect.y0; slider_handle.y1 = click_rect.y1; - + draw_rectangle(target, slider_handle, ui_style.bright); } } - + return result; } @@ -848,7 +848,7 @@ do_label(UI_State *state, UI_Layout *layout, char *text, int text_size, f32 heig i16 font_id = state->font_id; i32 line_height = get_font_info(state->font_set, font_id)->height; i32_Rect label = layout_rect(layout, FLOOR32(line_height * height)); - + if (!state->input_stage){ Render_Target *target = state->target; u32 back = style->main.margin_color; @@ -858,7 +858,7 @@ do_label(UI_State *state, UI_Layout *layout, char *text, int text_size, f32 heig String textstr = make_string(text, text_size); draw_string(target, font_id, textstr, label.x0, - label.y0 + (height - line_height)/2, fore); + label.y0 + (height - line_height)/2, fore); } } @@ -872,65 +872,65 @@ do_scroll_bar(UI_State *state, i32_Rect rect){ i32 id = 1; i32 w = (rect.x1 - rect.x0); i32 h = (rect.y1 - rect.y0); - + i32_Rect top_arrow, bottom_arrow; top_arrow.x0 = rect.x0; top_arrow.x1 = rect.x1; top_arrow.y0 = rect.y0; top_arrow.y1 = top_arrow.y0 + w; - + bottom_arrow.x0 = rect.x0; bottom_arrow.x1 = rect.x1; bottom_arrow.y1 = rect.y1; bottom_arrow.y0 = bottom_arrow.y1 - w; - + f32 space_h = (f32)(bottom_arrow.y0 - top_arrow.y1); if (space_h <= w) return; - + i32 slider_h = w; - + f32 view_hmin = 0; f32 view_hmax = state->height - h; f32 L = unlerp(view_hmin, state->view_y, view_hmax); - + f32 slider_hmin = (f32)top_arrow.y1; f32 slider_hmax = (f32)bottom_arrow.y0 - slider_h; f32 S = lerp(slider_hmin, L, slider_hmax); - + i32_Rect slider; slider.x0 = rect.x0; slider.x1 = rect.x1; slider.y0 = FLOOR32(S); slider.y1 = slider.y0 + slider_h; - + Widget_ID wid = make_id(state, id); - + if (state->input_stage){ state->view_y = ui_do_vscroll_input(state, top_arrow, bottom_arrow, slider, wid, state->view_y, - (f32)(get_font_info(state->font_set, state->font_id)->height), - slider_hmin, slider_hmax, view_hmin, view_hmax); + (f32)(get_font_info(state->font_set, state->font_id)->height), + slider_hmin, slider_hmax, view_hmin, view_hmax); } else{ Render_Target *target = state->target; - + f32 x0, y0, x1, y1, x2, y2; f32 w_1_2 = w*.5f; f32 w_1_3 = w*.333333f; f32 w_2_3 = w*.666667f; - - + + UI_Style ui_style = get_ui_style(state->style); u32 outline, back, fore; - + outline = ui_style.bright; wid.sub_id2 = 0; - + x0 = (w_1_2 + top_arrow.x0); x1 = (w_1_3 + top_arrow.x0); x2 = (w_2_3 + top_arrow.x0); - + ++wid.sub_id2; y0 = (w_1_3 + top_arrow.y0); y1 = (w_2_3 + top_arrow.y0); @@ -938,7 +938,7 @@ do_scroll_bar(UI_State *state, i32_Rect rect){ get_colors(state, &back, &fore, wid, ui_style); draw_rectangle(target, top_arrow, back); draw_rectangle_outline(target, top_arrow, outline); - + ++wid.sub_id2; y0 = (w_2_3 + bottom_arrow.y0); y1 = (w_1_3 + bottom_arrow.y0); @@ -946,19 +946,19 @@ do_scroll_bar(UI_State *state, i32_Rect rect){ get_colors(state, &back, &fore, wid, ui_style); draw_rectangle(target, bottom_arrow, back); draw_rectangle_outline(target, bottom_arrow, outline); - + ++wid.sub_id2; get_colors(state, &back, &fore, wid, ui_style); draw_rectangle(target, slider, back); draw_rectangle_outline(target, slider, outline); - + draw_rectangle_outline(target, rect, outline); } } internal void draw_gradient_slider(Render_Target *target, Vec4 base, i32 channel, - i32 steps, f32 top, f32_Rect slider, b32 hsla){ + i32 steps, f32 top, f32_Rect slider, b32 hsla){ Vec4 low, high; f32 *lowv, *highv; f32 x; @@ -966,14 +966,14 @@ draw_gradient_slider(Render_Target *target, Vec4 base, i32 channel, f32 x_step; f32 v_step; f32 m; - + x = (real32)slider.x0; x_step = (real32)(slider.x1 - slider.x0) / steps; v_step = top / steps; m = 1.f / top; lowv = &low.v[channel]; highv = &high.v[channel]; - + if (hsla){ for (i32 i = 0; i < steps; ++i){ low = high = base; @@ -983,7 +983,7 @@ draw_gradient_slider(Render_Target *target, Vec4 base, i32 channel, *highv *= m; low = hsla_to_rgba(low); high = hsla_to_rgba(high); - + next_x = x + x_step; draw_gradient_2corner_clipped( target, x, slider.y0, next_x, slider.y1, @@ -998,7 +998,7 @@ draw_gradient_slider(Render_Target *target, Vec4 base, i32 channel, *highv = *lowv + v_step; *lowv *= m; *highv *= m; - + next_x = x + x_step; draw_gradient_2corner_clipped( target, x, slider.y0, next_x, slider.y1, @@ -1022,7 +1022,7 @@ draw_rgb_slider(Render_Target *target, Vec4 base, i32 channel, internal b32 do_main_file_box(System_Functions *system, UI_State *state, UI_Layout *layout, - Hot_Directory *hot_directory, b32 try_to_match, b32 case_sensitive, char *end){ + Hot_Directory *hot_directory, b32 try_to_match, b32 case_sensitive, char *end){ b32 result = 0; Style *style = state->style; String *string = &hot_directory->string; @@ -1030,7 +1030,7 @@ do_main_file_box(System_Functions *system, UI_State *state, UI_Layout *layout, i16 font_id = state->font_id; i32 line_height = get_font_info(state->font_set, font_id)->height; i32_Rect box = layout_rect(layout, line_height + 2); - + if (state->input_stage){ if (ui_do_file_field_input(system, state, hot_directory, try_to_match, case_sensitive)){ result = 1; @@ -1046,7 +1046,7 @@ do_main_file_box(System_Functions *system, UI_State *state, UI_Layout *layout, x = draw_string(target, font_id, string->str, x, box.y0, fore); if (end) draw_string(target, font_id, end, x, box.y0, special); } - + layout->y = box.y1; return result; } @@ -1055,11 +1055,11 @@ internal b32 do_main_string_box(System_Functions *system, UI_State *state, UI_Layout *layout, String *string){ b32 result = 0; Style *style = state->style; - + i16 font_id = state->font_id; i32 line_height = get_font_info(state->font_set, font_id)->height; i32_Rect box = layout_rect(layout, line_height + 2); - + if (state->input_stage){ if (ui_do_line_field_input(system, state, string)){ result = 1; @@ -1073,7 +1073,7 @@ do_main_string_box(System_Functions *system, UI_State *state, UI_Layout *layout, i32 x = box.x0; x = draw_string(target, font_id, string->str, x, box.y0, fore); } - + layout->y = box.y1; return result; } @@ -1082,13 +1082,13 @@ internal b32 do_list_option(i32 id, UI_State *state, UI_Layout *layout, String text){ b32 result = 0; Style *style = state->style; - + i16 font_id = state->font_id; i32 character_h = get_font_info(state->font_set, font_id)->height; - + i32_Rect box = layout_rect(layout, character_h*2); Widget_ID wid = make_id(state, id); - + if (state->input_stage){ if (ui_do_button_input(state, box, wid, 0)){ result = 1; @@ -1103,13 +1103,13 @@ do_list_option(i32 id, UI_State *state, UI_Layout *layout, String text){ pop = style->main.file_info_style.pop2_color; if (is_hover(state, wid)) outline = style->main.margin_active_color; else outline = style->main.margin_color; - + draw_rectangle(target, inner, back); i32 x = inner.x0, y = box.y0 + character_h/2; x = draw_string(target, font_id, text, x, y, fore); draw_margin(target, box, inner, outline); } - + layout->y = box.y1; return result; } @@ -1118,13 +1118,13 @@ internal b32 do_checkbox_list_option(i32 id, UI_State *state, UI_Layout *layout, String text, b32 is_on){ b32 result = 0; Style *style = state->style; - + i16 font_id = state->font_id; i32 character_h = get_font_info(state->font_set, font_id)->height; - + i32_Rect box = layout_rect(layout, character_h*2); Widget_ID wid = make_id(state, id); - + if (state->input_stage){ if (ui_do_button_input(state, box, wid, 0)){ result = 1; @@ -1140,21 +1140,21 @@ do_checkbox_list_option(i32 id, UI_State *state, UI_Layout *layout, String text, if (is_hover(state, wid)) outline = style->main.margin_active_color; else outline = style->main.margin_color; box_color = style->main.margin_active_color; - + draw_rectangle(target, inner, back); - + i32_Rect square; square = get_inner_rect(inner, character_h/3); square.x1 = square.x0 + (square.y1 - square.y0); if (is_on) draw_rectangle(target, square, box_color); else draw_margin(target, square, 1, box_color); - + i32 x = square.x1 + 3; i32 y = box.y0 + character_h/2; x = draw_string(target, font_id, text, x, y, fore); draw_margin(target, box, inner, outline); } - + layout->y = box.y1; return result; } @@ -1167,10 +1167,10 @@ do_file_option(i32 id, UI_State *state, UI_Layout *layout, String filename, b32 i16 font_id = state->font_id; i32 character_h = get_font_info(state->font_set, font_id)->height; char slash_buf[2] = { slash, 0 }; - + i32_Rect box = layout_rect(layout, character_h*2); Widget_ID wid = make_id(state, id); - + if (state->input_stage){ if (ui_do_button_input(state, box, wid, 0)){ result = 1; @@ -1185,7 +1185,7 @@ do_file_option(i32 id, UI_State *state, UI_Layout *layout, String filename, b32 pop = style->main.file_info_style.pop2_color; if (is_hover(state, wid)) outline = style->main.margin_active_color; else outline = style->main.margin_color; - + draw_rectangle(target, inner, back); i32 x = inner.x0, y = box.y0 + character_h/2; x = draw_string(target, font_id, filename, x, y, fore); @@ -1193,7 +1193,7 @@ do_file_option(i32 id, UI_State *state, UI_Layout *layout, String filename, b32 draw_string(target, font_id, extra, x, y, pop); draw_margin(target, box, inner, outline); } - + layout->y = box.y1; return result; } @@ -1215,45 +1215,45 @@ do_file_list_box(System_Functions *system, UI_State *state, UI_Layout *layout, persist String message_unsaved = make_lit_string(" LOADED *"); persist String message_unsynced = make_lit_string(" LOADED !"); persist String message_nothing = {}; - + char front_name_space[256]; String front_name = make_fixed_width_string(front_name_space); get_front_of_directory(&front_name, hot_dir->string); - + Absolutes absolutes; get_absolutes(front_name, &absolutes, 1, 1); - + char full_path_[256]; String full_path = make_fixed_width_string(full_path_); get_path_of_directory(&full_path, hot_dir->string); i32 restore_size = full_path.size; - + i32 i; File_Info *info, *end; end = files->infos + files->count; for (info = files->infos, i = 0; info != end; ++info, ++i){ String filename = info->filename; - + append(&full_path, filename); terminate_with_null(&full_path); - + Editing_File *file = working_set_contains(system, state->working_set, full_path); full_path.size = restore_size; - + b8 is_folder = (info->folder != 0); b8 ext_match = (match(file_extension(filename), p4c_extension) != 0); b8 name_match = (filename_match(front_name, &absolutes, filename, case_sensitive) != 0); b8 is_loaded = (file != 0 && file_is_ready(file)); - + String message = message_nothing; if (is_loaded){ switch (buffer_get_sync(file)){ - case SYNC_GOOD: message = message_loaded; break; - case SYNC_BEHIND_OS: message = message_unsynced; break; - case SYNC_UNSAVED: message = message_unsaved; break; + case SYNC_GOOD: message = message_loaded; break; + case SYNC_BEHIND_OS: message = message_unsynced; break; + case SYNC_UNSAVED: message = message_unsaved; break; } } - + if ((is_folder || !has_filter || ext_match) && name_match){ if (do_file_option(100+i, state, layout, filename, is_folder, message, system->slash)){ result = 1; @@ -1271,13 +1271,13 @@ do_file_list_box(System_Functions *system, UI_State *state, UI_Layout *layout, } } } - + return result; } internal b32 do_live_file_list_box(System_Functions *system, UI_State *state, UI_Layout *layout, - Working_Set *working_set, String *string, b32 *selected){ + Working_Set *working_set, String *string, b32 *selected){ b32 result = 0; if (do_main_string_box(system, state, layout, string)){ diff --git a/4ed_math.cpp b/4ed_math.cpp index 6892e94a..9138485a 100644 --- a/4ed_math.cpp +++ b/4ed_math.cpp @@ -590,33 +590,42 @@ invert(Matrix2 m){ * Lerps, Clamps, Thresholds, Etc */ -inline real32 -lerp(real32 a, real32 t, real32 b){ - return a + (b-a)*t; +inline f32 +lerp(f32 a, f32 t, f32 b){ + return(a + (b-a)*t); +} + +inline i32 +lerp(i32 a, f32 t, i32 b){ + return ((i32)(lerp((f32)a, t, (f32)b))); } inline Vec2 -lerp(Vec2 a, real32 t, Vec2 b){ - return a + (b-a)*t; +lerp(Vec2 a, f32 t, Vec2 b){ + return(a + (b-a)*t); } inline Vec3 -lerp(Vec3 a, real32 t, Vec3 b){ - return a + (b-a)*t; +lerp(Vec3 a, f32 t, Vec3 b){ + return(a + (b-a)*t); } inline Vec4 -lerp(Vec4 a, real32 t, Vec4 b){ - return a + (b-a)*t; +lerp(Vec4 a, f32 t, Vec4 b){ + return(a + (b-a)*t); } -inline real32 -unlerp(real32 a, real32 x, real32 b){ - return (x - a) / (b - a); +inline f32 +unlerp(f32 a, f32 x, f32 b){ + f32 r = x; + if (b > a){ + r = (x - a) / (b - a); + } + return(r); } -inline real32 -clamp(real32 a, real32 n, real32 z){ +inline f32 +clamp(f32 a, f32 n, f32 z){ return (nz)?(z):n); } diff --git a/4ed_style.cpp b/4ed_style.cpp index 903f8c15..4fcb259c 100644 --- a/4ed_style.cpp +++ b/4ed_style.cpp @@ -43,60 +43,5 @@ struct Style_Library{ i32 count, max; }; -#if 0 -struct Style_File_Format{ - i32 name_size; - char name[24]; - - i32 color_specifier_count; -}; - -internal b32 -style_library_add(Style_Library *library, Style *style){ - b32 result = 0; - i32 count = library->count; - String my_name = style->name; - Style *ostyle = library->styles; - Style *out = 0; - // TODO(allen): hashtable for name lookup? - for (i32 i = 0; i < count; ++i, ++ostyle){ - if (match(my_name, ostyle->name)){ - out = ostyle; - break; - } - } - if (!out && count < library->max){ - out = library->styles + library->count++; - } - if (out){ - style_copy(out, style); - result = 1; - } - return result; -} - -internal Style_File_Format* -style_format_for_file(Font_Set *set, Style *style, Style_File_Format *out){ - out->name_size = style->name.size; - memcpy(out->name, style->name.str, ArrayCount(out->name)); - - Style_Color_Specifier *spec = (Style_Color_Specifier*)(out + 1); - i32 count = 0; - - for (u32 i = 0; i < Stag_Count; ++i){ - u32 *color = style_index_by_tag(style, i); - if (color){ - spec->tag = i; - spec->color = *color; - ++count; - ++spec; - } - } - out->color_specifier_count = count; - - return (Style_File_Format*)spec; -} -#endif - // BOTTOM diff --git a/test/4cpp_lexer_fsms.h b/test/4cpp_lexer_fsms.h index 4bb73af6..338fb8d5 100644 --- a/test/4cpp_lexer_fsms.h +++ b/test/4cpp_lexer_fsms.h @@ -6,6 +6,11 @@ // TOP +struct String_And_Flag{ + char *str; + unsigned int flags; +}; + enum Lex_State{ LS_default, LS_identifier, @@ -91,7 +96,10 @@ struct Whitespace_FSM{ struct Lex_FSM{ unsigned char state; - unsigned char int_state; + union{ + unsigned char int_state; + unsigned char directive_state; + }; unsigned char emit_token; unsigned char multi_line; }; diff --git a/test/4cpp_lexer_tables.c b/test/4cpp_lexer_tables.c index c7944363..5b231e08 100644 --- a/test/4cpp_lexer_tables.c +++ b/test/4cpp_lexer_tables.c @@ -28,42 +28,41 @@ unsigned char multiline_state_table[] = { }; unsigned short main_fsm_eq_classes[] = { - 0,39,39,39,39,39,39,39,39,78,117,156,156,156,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,78,195,234,273,312,351,390,429,312,312,468,507,312,546,585,624,663,702,702,702,702,702,702,702,702,702,741,312,780,819,858,312,312,897,897,897,897,897,897,936,936,936,936,936,936,936,936,936,936,936,936,936,936,936,936,936,936,936,936,312,975,312,1014,936,39,897,897,897,897,1053,897,936,936,936,936,936,936,936,936,936,936,936,936,936,936,936,936,936,1092,936,936,312,1131,312,312,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39, + 0,39,39,39,39,39,39,39,39,39,78,117,117,117,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,156,195,234,273,312,351,390,273,273,429,468,273,507,546,585,624,663,663,663,663,663,663,663,663,663,702,273,741,780,819,273,273,858,858,858,858,858,858,897,897,897,897,897,897,897,897,897,897,897,897,897,897,897,897,897,897,897,897,273,936,273,975,897,39,858,858,858,858,1014,858,897,897,897,897,897,897,897,897,897,897,897,897,897,897,897,897,897,1053,897,897,273,1092,273,273,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39, }; -const int num_main_fsm_eq_classes = 30; +const int num_main_fsm_eq_classes = 29; unsigned char main_fsm_table[] = { 39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77, - 0,40, 3,42, 4, 5, 4, 7, 8, 7,49,50,51,52,53,54,55,17,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, - 0,40, 2,42, 4, 5, 4, 7, 8, 7,49,50,51,52,53,54,55,17,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, - 0,40,41,42, 4, 5, 5, 7, 8, 8,49,50,51,52,53,54,55,56,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, - 0,40, 2,42, 4, 5, 6, 7, 8, 9,49,50,51,52,53,54,55,17,18,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, -37,40, 3,42, 4, 5, 4, 7, 8, 7,49,50,51,52,53,54,55,17,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, - 7,40, 3,42, 4, 5, 4,46,47, 7,49,50,51,52,53,54,55,17,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, - 2,40, 3,42, 4, 5, 4, 7, 8, 7,49,50,51,52,53,54,55,17,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, -39,40, 3,42, 4, 5, 4, 7, 8, 7,49,50,51,52,53,54,55,17,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, -34,40, 3,42, 4, 5, 4, 7, 8, 7,49,50,51,52,53,54,55,17,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, -29,40, 3,42, 4, 5, 4, 7, 8, 7,49,50,51,52,53,54,55,17,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, - 4,40, 3,42,43,44, 4, 7, 8, 7,49,50,51,52,53,54,55,17,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, -33,40, 3,42, 4, 5, 4, 7, 8, 7,49,50,51,52,53,54,19,17,17,20,20,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, -31,40, 3,42, 4, 5, 4, 7, 8, 7,49,50,51,52,53,54,55,17,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, -27,40, 3,42, 4, 5, 4, 7, 8, 7,49,50,51,14,53,54,55,17,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, -21,40, 3,42, 4, 5, 4, 7, 8, 7,12,12,51,52,53,54,55,17,17,19,19,22,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, -16,40, 3,42, 4, 5, 4, 7, 8, 7,49,50,51,52,53,54,17,17,17,19,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, -11, 1, 3, 3, 4, 5, 4, 7, 8, 7,10,10,12,14,14,15,55,17,17,19,19,12,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, -10, 1, 3, 3, 4, 5, 4, 7, 8, 7,10,10,12,14,14,15,55,17,17,19,19,12,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, -32,40, 3,42, 4, 5, 4, 7, 8, 7,49,50,51,52,53,54,55,17,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, -23,40, 3,42, 4, 5, 4, 7, 8, 7,49,50,51,52,53,54,55,17,17,19,19,60,61,24,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, -36,40, 3,42, 4, 5, 4, 7, 8, 7,49,50,51,52,53,54,55,17,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, -25,40, 3,42, 4, 5, 4, 7, 8, 7,49,50,51,52,53,54,55,17,17,19,19,60,61,62,63,26,65,28,67,68,69,70,71,72,73,74,75,76,38, - 1, 1, 3, 3, 4, 5, 4, 7, 8, 7,49,50,51,52,53,15,55,17,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, - 1, 1, 3, 3, 4, 5, 4, 7, 8, 7,49,50,51,52,53,54,55,17,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, -39,40, 3,42, 6, 6, 4, 9, 9, 7,49,50,51,52,53,54,55,18,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, -35,40, 3,42, 4, 5, 4, 7, 8, 7,49,50,51,52,53,54,55,17,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, - 1, 1, 3, 3, 4, 5, 4, 7, 8, 7,49,50,13,52,53,15,55,17,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, - 1, 1, 3, 3, 4, 5, 4, 7, 8, 7,49,15,51,52,53,54,55,17,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, -30,40, 3,42, 4, 5, 4, 7, 8, 7,49,50,51,52,53,54,55,17,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, + 0,40,41, 3, 4, 5, 4, 7, 8, 7,49,50,51,52,53,54,55,17,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, + 0,40,41, 3, 4, 5, 5, 7, 8, 8,49,50,51,52,53,54,55,56,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, + 0,40,41, 3, 4, 5, 6, 7, 8, 9,49,50,51,52,53,54,55,17,18,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, +37,40,41, 3, 4, 5, 4, 7, 8, 7,49,50,51,52,53,54,55,17,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, + 7,40,41, 3, 4, 5, 4,46,47, 7,49,50,51,52,53,54,55,17,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, +42,40,41, 3, 4, 5, 4, 7, 8, 7,49,50,51,52,53,54,55,17,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, +39,40,41, 3, 4, 5, 4, 7, 8, 7,49,50,51,52,53,54,55,17,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, +34,40,41, 3, 4, 5, 4, 7, 8, 7,49,50,51,52,53,54,55,17,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, +29,40,41, 3, 4, 5, 4, 7, 8, 7,49,50,51,52,53,54,55,17,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, + 4,40,41, 3,43,44, 4, 7, 8, 7,49,50,51,52,53,54,55,17,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, +33,40,41, 3, 4, 5, 4, 7, 8, 7,49,50,51,52,53,54,19,17,17,20,20,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, +31,40,41, 3, 4, 5, 4, 7, 8, 7,49,50,51,52,53,54,55,17,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, +27,40,41, 3, 4, 5, 4, 7, 8, 7,49,50,51,14,53,54,55,17,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, +21,40,41, 3, 4, 5, 4, 7, 8, 7,12,12,51,52,53,54,55,17,17,19,19,22,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, +16,40,41, 3, 4, 5, 4, 7, 8, 7,49,50,51,52,53,54,17,17,17,19,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, +11, 1,41, 3, 4, 5, 4, 7, 8, 7,10,10,12,14,14,15,55,17,17,19,19,12,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, +10, 1,41, 3, 4, 5, 4, 7, 8, 7,10,10,12,14,14,15,55,17,17,19,19,12,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, +32,40,41, 3, 4, 5, 4, 7, 8, 7,49,50,51,52,53,54,55,17,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, +23,40,41, 3, 4, 5, 4, 7, 8, 7,49,50,51,52,53,54,55,17,17,19,19,60,61,24,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, +36,40,41, 3, 4, 5, 4, 7, 8, 7,49,50,51,52,53,54,55,17,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, +25,40,41, 3, 4, 5, 4, 7, 8, 7,49,50,51,52,53,54,55,17,17,19,19,60,61,62,63,26,65,28,67,68,69,70,71,72,73,74,75,76,38, + 1, 1,41, 3, 4, 5, 4, 7, 8, 7,49,50,51,52,53,15,55,17,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, + 1, 1,41, 3, 4, 5, 4, 7, 8, 7,49,50,51,52,53,54,55,17,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, +39,40,41, 3, 6, 6, 4, 9, 9, 7,49,50,51,52,53,54,55,18,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, +35,40,41, 3, 4, 5, 4, 7, 8, 7,49,50,51,52,53,54,55,17,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, + 1, 1,41, 3, 4, 5, 4, 7, 8, 7,49,50,13,52,53,15,55,17,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, + 1, 1,41, 3, 4, 5, 4, 7, 8, 7,49,15,51,52,53,54,55,17,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, +30,40,41, 3, 4, 5, 4, 7, 8, 7,49,50,51,52,53,54,55,17,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, }; unsigned short pp_include_fsm_eq_classes[] = { @@ -89,34 +88,34 @@ const int num_pp_macro_fsm_eq_classes = 29; unsigned char pp_macro_fsm_table[] = { 39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77, - 0,40,41,42, 4, 5, 4, 7, 8, 7,49,50,51,52,53,54,55,17,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, - 0,40,41,42, 4, 5, 5, 7, 8, 8,49,50,51,52,53,54,55,56,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, - 0,40,41,42, 4, 5, 6, 7, 8, 9,49,50,51,52,53,54,55,17,18,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, -37,40,41,42, 4, 5, 4, 7, 8, 7,49,50,51,52,53,54,55,17,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, - 7,40,41,42, 4, 5, 4,46,47, 7,49,50,51,52,53,54,55,17,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, - 2,40,41,42, 4, 5, 4, 7, 8, 7,49,50,51,52,53,54,55,17,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, -39,40,41,42, 4, 5, 4, 7, 8, 7,49,50,51,52,53,54,55,17,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, -34,40,41,42, 4, 5, 4, 7, 8, 7,49,50,51,52,53,54,55,17,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, -29,40,41,42, 4, 5, 4, 7, 8, 7,49,50,51,52,53,54,55,17,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, - 4,40,41,42,43,44, 4, 7, 8, 7,49,50,51,52,53,54,55,17,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, -33,40,41,42, 4, 5, 4, 7, 8, 7,49,50,51,52,53,54,19,17,17,20,20,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, -31,40,41,42, 4, 5, 4, 7, 8, 7,49,50,51,52,53,54,55,17,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, -27,40,41,42, 4, 5, 4, 7, 8, 7,49,50,51,14,53,54,55,17,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, -21,40,41,42, 4, 5, 4, 7, 8, 7,12,12,51,52,53,54,55,17,17,19,19,22,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, -16,40,41,42, 4, 5, 4, 7, 8, 7,49,50,51,52,53,54,17,17,17,19,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, + 0,40,41, 3, 4, 5, 4, 7, 8, 7,49,50,51,52,53,54,55,17,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, + 0,40,41, 3, 4, 5, 5, 7, 8, 8,49,50,51,52,53,54,55,56,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, + 0,40,41, 3, 4, 5, 6, 7, 8, 9,49,50,51,52,53,54,55,17,18,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, +37,40,41, 3, 4, 5, 4, 7, 8, 7,49,50,51,52,53,54,55,17,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, + 7,40,41, 3, 4, 5, 4,46,47, 7,49,50,51,52,53,54,55,17,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, + 2,40,41, 3, 4, 5, 4, 7, 8, 7,49,50,51,52,53,54,55,17,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, +39,40,41, 3, 4, 5, 4, 7, 8, 7,49,50,51,52,53,54,55,17,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, +34,40,41, 3, 4, 5, 4, 7, 8, 7,49,50,51,52,53,54,55,17,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, +29,40,41, 3, 4, 5, 4, 7, 8, 7,49,50,51,52,53,54,55,17,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, + 4,40,41, 3,43,44, 4, 7, 8, 7,49,50,51,52,53,54,55,17,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, +33,40,41, 3, 4, 5, 4, 7, 8, 7,49,50,51,52,53,54,19,17,17,20,20,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, +31,40,41, 3, 4, 5, 4, 7, 8, 7,49,50,51,52,53,54,55,17,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, +27,40,41, 3, 4, 5, 4, 7, 8, 7,49,50,51,14,53,54,55,17,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, +21,40,41, 3, 4, 5, 4, 7, 8, 7,12,12,51,52,53,54,55,17,17,19,19,22,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, +16,40,41, 3, 4, 5, 4, 7, 8, 7,49,50,51,52,53,54,17,17,17,19,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, 11, 1,41, 3, 4, 5, 4, 7, 8, 7,10,10,12,14,14,15,55,17,17,19,19,12,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, 10, 1,41, 3, 4, 5, 4, 7, 8, 7,10,10,12,14,14,15,55,17,17,19,19,12,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, -32,40,41,42, 4, 5, 4, 7, 8, 7,49,50,51,52,53,54,55,17,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, -23,40,41,42, 4, 5, 4, 7, 8, 7,49,50,51,52,53,54,55,17,17,19,19,60,61,24,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, -36,40,41,42, 4, 5, 4, 7, 8, 7,49,50,51,52,53,54,55,17,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, -25,40,41,42, 4, 5, 4, 7, 8, 7,49,50,51,52,53,54,55,17,17,19,19,60,61,62,63,26,65,28,67,68,69,70,71,72,73,74,75,76,38, +32,40,41, 3, 4, 5, 4, 7, 8, 7,49,50,51,52,53,54,55,17,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, +23,40,41, 3, 4, 5, 4, 7, 8, 7,49,50,51,52,53,54,55,17,17,19,19,60,61,24,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, +36,40,41, 3, 4, 5, 4, 7, 8, 7,49,50,51,52,53,54,55,17,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, +25,40,41, 3, 4, 5, 4, 7, 8, 7,49,50,51,52,53,54,55,17,17,19,19,60,61,62,63,26,65,28,67,68,69,70,71,72,73,74,75,76,38, 1, 1,41, 3, 4, 5, 4, 7, 8, 7,49,50,51,52,53,15,55,17,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, 1, 1,41, 3, 4, 5, 4, 7, 8, 7,49,50,51,52,53,54,55,17,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, -39,40,41,42, 6, 6, 4, 9, 9, 7,49,50,51,52,53,54,55,18,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, -35,40,41,42, 4, 5, 4, 7, 8, 7,49,50,51,52,53,54,55,17,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, +39,40,41, 3, 6, 6, 4, 9, 9, 7,49,50,51,52,53,54,55,18,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, +35,40,41, 3, 4, 5, 4, 7, 8, 7,49,50,51,52,53,54,55,17,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, 1, 1,41, 3, 4, 5, 4, 7, 8, 7,49,50,13,52,53,15,55,17,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, 1, 1,41, 3, 4, 5, 4, 7, 8, 7,49,15,51,52,53,54,55,17,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, -30,40,41,42, 4, 5, 4, 7, 8, 7,49,50,51,52,53,54,55,17,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, +30,40,41, 3, 4, 5, 4, 7, 8, 7,49,50,51,52,53,54,55,17,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, }; unsigned short pp_identifier_fsm_eq_classes[] = { @@ -127,34 +126,34 @@ const int num_pp_identifier_fsm_eq_classes = 29; unsigned char pp_identifier_fsm_table[] = { 39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77, - 0,40,41,42, 4, 5, 4, 7, 8, 7,49,50,51,52,53,54,55,17,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, - 0,40,41,42, 4, 5, 5, 7, 8, 8,49,50,51,52,53,54,55,56,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, - 0,40,41,42, 4, 5, 6, 7, 8, 9,49,50,51,52,53,54,55,17,18,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, -37,40,41,42, 4, 5, 4, 7, 8, 7,49,50,51,52,53,54,55,17,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, - 7,40,41,42, 4, 5, 4,46,47, 7,49,50,51,52,53,54,55,17,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, - 2,40,41,42, 4, 5, 4, 7, 8, 7,49,50,51,52,53,54,55,17,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, -39,40,41,42, 4, 5, 4, 7, 8, 7,49,50,51,52,53,54,55,17,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, -34,40,41,42, 4, 5, 4, 7, 8, 7,49,50,51,52,53,54,55,17,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, -29,40,41,42, 4, 5, 4, 7, 8, 7,49,50,51,52,53,54,55,17,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, - 4,40,41,42,43,44, 4, 7, 8, 7,49,50,51,52,53,54,55,17,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, -33,40,41,42, 4, 5, 4, 7, 8, 7,49,50,51,52,53,54,19,17,17,20,20,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, -31,40,41,42, 4, 5, 4, 7, 8, 7,49,50,51,52,53,54,55,17,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, -27,40,41,42, 4, 5, 4, 7, 8, 7,49,50,51,14,53,54,55,17,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, -21,40,41,42, 4, 5, 4, 7, 8, 7,12,12,51,52,53,54,55,17,17,19,19,22,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, -16,40,41,42, 4, 5, 4, 7, 8, 7,49,50,51,52,53,54,17,17,17,19,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, + 0,40,41, 3, 4, 5, 4, 7, 8, 7,49,50,51,52,53,54,55,17,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, + 0,40,41, 3, 4, 5, 5, 7, 8, 8,49,50,51,52,53,54,55,56,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, + 0,40,41, 3, 4, 5, 6, 7, 8, 9,49,50,51,52,53,54,55,17,18,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, +37,40,41, 3, 4, 5, 4, 7, 8, 7,49,50,51,52,53,54,55,17,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, + 7,40,41, 3, 4, 5, 4,46,47, 7,49,50,51,52,53,54,55,17,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, + 2,40,41, 3, 4, 5, 4, 7, 8, 7,49,50,51,52,53,54,55,17,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, +39,40,41, 3, 4, 5, 4, 7, 8, 7,49,50,51,52,53,54,55,17,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, +34,40,41, 3, 4, 5, 4, 7, 8, 7,49,50,51,52,53,54,55,17,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, +29,40,41, 3, 4, 5, 4, 7, 8, 7,49,50,51,52,53,54,55,17,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, + 4,40,41, 3,43,44, 4, 7, 8, 7,49,50,51,52,53,54,55,17,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, +33,40,41, 3, 4, 5, 4, 7, 8, 7,49,50,51,52,53,54,19,17,17,20,20,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, +31,40,41, 3, 4, 5, 4, 7, 8, 7,49,50,51,52,53,54,55,17,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, +27,40,41, 3, 4, 5, 4, 7, 8, 7,49,50,51,14,53,54,55,17,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, +21,40,41, 3, 4, 5, 4, 7, 8, 7,12,12,51,52,53,54,55,17,17,19,19,22,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, +16,40,41, 3, 4, 5, 4, 7, 8, 7,49,50,51,52,53,54,17,17,17,19,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, 11, 1,41, 3, 4, 5, 4, 7, 8, 7,10,10,12,14,14,15,55,17,17,19,19,12,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, 10, 1,41, 3, 4, 5, 4, 7, 8, 7,10,10,12,14,14,15,55,17,17,19,19,12,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, -32,40,41,42, 4, 5, 4, 7, 8, 7,49,50,51,52,53,54,55,17,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, -23,40,41,42, 4, 5, 4, 7, 8, 7,49,50,51,52,53,54,55,17,17,19,19,60,61,24,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, -36,40,41,42, 4, 5, 4, 7, 8, 7,49,50,51,52,53,54,55,17,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, -25,40,41,42, 4, 5, 4, 7, 8, 7,49,50,51,52,53,54,55,17,17,19,19,60,61,62,63,26,65,28,67,68,69,70,71,72,73,74,75,76,38, +32,40,41, 3, 4, 5, 4, 7, 8, 7,49,50,51,52,53,54,55,17,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, +23,40,41, 3, 4, 5, 4, 7, 8, 7,49,50,51,52,53,54,55,17,17,19,19,60,61,24,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, +36,40,41, 3, 4, 5, 4, 7, 8, 7,49,50,51,52,53,54,55,17,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, +25,40,41, 3, 4, 5, 4, 7, 8, 7,49,50,51,52,53,54,55,17,17,19,19,60,61,62,63,26,65,28,67,68,69,70,71,72,73,74,75,76,38, 1, 1,41, 3, 4, 5, 4, 7, 8, 7,49,50,51,52,53,15,55,17,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, 1, 1,41, 3, 4, 5, 4, 7, 8, 7,49,50,51,52,53,54,55,17,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, -39,40,41,42, 6, 6, 4, 9, 9, 7,49,50,51,52,53,54,55,18,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, -35,40,41,42, 4, 5, 4, 7, 8, 7,49,50,51,52,53,54,55,17,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, +39,40,41, 3, 6, 6, 4, 9, 9, 7,49,50,51,52,53,54,55,18,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, +35,40,41, 3, 4, 5, 4, 7, 8, 7,49,50,51,52,53,54,55,17,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, 1, 1,41, 3, 4, 5, 4, 7, 8, 7,49,50,13,52,53,15,55,17,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, 1, 1,41, 3, 4, 5, 4, 7, 8, 7,49,15,51,52,53,54,55,17,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, -30,40,41,42, 4, 5, 4, 7, 8, 7,49,50,51,52,53,54,55,17,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, +30,40,41, 3, 4, 5, 4, 7, 8, 7,49,50,51,52,53,54,55,17,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, }; unsigned short pp_body_if_fsm_eq_classes[] = { @@ -165,34 +164,34 @@ const int num_pp_body_if_fsm_eq_classes = 29; unsigned char pp_body_if_fsm_table[] = { 39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77, - 0,40,41,42, 4, 5, 4, 7, 8, 7,49,50,51,52,53,54,55,17,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, - 0,40,41,42, 4, 5, 5, 7, 8, 8,49,50,51,52,53,54,55,56,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, - 0,40,41,42, 4, 5, 6, 7, 8, 9,49,50,51,52,53,54,55,17,18,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, -37,40,41,42, 4, 5, 4, 7, 8, 7,49,50,51,52,53,54,55,17,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, - 7,40,41,42, 4, 5, 4,46,47, 7,49,50,51,52,53,54,55,17,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, - 2,40,41,42, 4, 5, 4, 7, 8, 7,49,50,51,52,53,54,55,17,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, -39,40,41,42, 4, 5, 4, 7, 8, 7,49,50,51,52,53,54,55,17,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, -34,40,41,42, 4, 5, 4, 7, 8, 7,49,50,51,52,53,54,55,17,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, -29,40,41,42, 4, 5, 4, 7, 8, 7,49,50,51,52,53,54,55,17,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, - 4,40,41,42,43,44, 4, 7, 8, 7,49,50,51,52,53,54,55,17,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, -33,40,41,42, 4, 5, 4, 7, 8, 7,49,50,51,52,53,54,19,17,17,20,20,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, -31,40,41,42, 4, 5, 4, 7, 8, 7,49,50,51,52,53,54,55,17,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, -27,40,41,42, 4, 5, 4, 7, 8, 7,49,50,51,14,53,54,55,17,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, -21,40,41,42, 4, 5, 4, 7, 8, 7,12,12,51,52,53,54,55,17,17,19,19,22,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, -16,40,41,42, 4, 5, 4, 7, 8, 7,49,50,51,52,53,54,17,17,17,19,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, + 0,40,41, 3, 4, 5, 4, 7, 8, 7,49,50,51,52,53,54,55,17,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, + 0,40,41, 3, 4, 5, 5, 7, 8, 8,49,50,51,52,53,54,55,56,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, + 0,40,41, 3, 4, 5, 6, 7, 8, 9,49,50,51,52,53,54,55,17,18,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, +37,40,41, 3, 4, 5, 4, 7, 8, 7,49,50,51,52,53,54,55,17,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, + 7,40,41, 3, 4, 5, 4,46,47, 7,49,50,51,52,53,54,55,17,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, + 2,40,41, 3, 4, 5, 4, 7, 8, 7,49,50,51,52,53,54,55,17,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, +39,40,41, 3, 4, 5, 4, 7, 8, 7,49,50,51,52,53,54,55,17,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, +34,40,41, 3, 4, 5, 4, 7, 8, 7,49,50,51,52,53,54,55,17,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, +29,40,41, 3, 4, 5, 4, 7, 8, 7,49,50,51,52,53,54,55,17,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, + 4,40,41, 3,43,44, 4, 7, 8, 7,49,50,51,52,53,54,55,17,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, +33,40,41, 3, 4, 5, 4, 7, 8, 7,49,50,51,52,53,54,19,17,17,20,20,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, +31,40,41, 3, 4, 5, 4, 7, 8, 7,49,50,51,52,53,54,55,17,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, +27,40,41, 3, 4, 5, 4, 7, 8, 7,49,50,51,14,53,54,55,17,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, +21,40,41, 3, 4, 5, 4, 7, 8, 7,12,12,51,52,53,54,55,17,17,19,19,22,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, +16,40,41, 3, 4, 5, 4, 7, 8, 7,49,50,51,52,53,54,17,17,17,19,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, 11, 1,41, 3, 4, 5, 4, 7, 8, 7,10,10,12,14,14,15,55,17,17,19,19,12,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, 10, 1,41, 3, 4, 5, 4, 7, 8, 7,10,10,12,14,14,15,55,17,17,19,19,12,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, -32,40,41,42, 4, 5, 4, 7, 8, 7,49,50,51,52,53,54,55,17,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, -23,40,41,42, 4, 5, 4, 7, 8, 7,49,50,51,52,53,54,55,17,17,19,19,60,61,24,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, -36,40,41,42, 4, 5, 4, 7, 8, 7,49,50,51,52,53,54,55,17,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, -25,40,41,42, 4, 5, 4, 7, 8, 7,49,50,51,52,53,54,55,17,17,19,19,60,61,62,63,26,65,28,67,68,69,70,71,72,73,74,75,76,38, +32,40,41, 3, 4, 5, 4, 7, 8, 7,49,50,51,52,53,54,55,17,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, +23,40,41, 3, 4, 5, 4, 7, 8, 7,49,50,51,52,53,54,55,17,17,19,19,60,61,24,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, +36,40,41, 3, 4, 5, 4, 7, 8, 7,49,50,51,52,53,54,55,17,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, +25,40,41, 3, 4, 5, 4, 7, 8, 7,49,50,51,52,53,54,55,17,17,19,19,60,61,62,63,26,65,28,67,68,69,70,71,72,73,74,75,76,38, 1, 1,41, 3, 4, 5, 4, 7, 8, 7,49,50,51,52,53,15,55,17,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, 1, 1,41, 3, 4, 5, 4, 7, 8, 7,49,50,51,52,53,54,55,17,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, -39,40,41,42, 6, 6, 4, 9, 9, 7,49,50,51,52,53,54,55,18,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, -35,40,41,42, 4, 5, 4, 7, 8, 7,49,50,51,52,53,54,55,17,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, +39,40,41, 3, 6, 6, 4, 9, 9, 7,49,50,51,52,53,54,55,18,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, +35,40,41, 3, 4, 5, 4, 7, 8, 7,49,50,51,52,53,54,55,17,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, 1, 1,41, 3, 4, 5, 4, 7, 8, 7,49,50,13,52,53,15,55,17,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, 1, 1,41, 3, 4, 5, 4, 7, 8, 7,49,15,51,52,53,54,55,17,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, -30,40,41,42, 4, 5, 4, 7, 8, 7,49,50,51,52,53,54,55,17,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, +30,40,41, 3, 4, 5, 4, 7, 8, 7,49,50,51,52,53,54,55,17,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, }; unsigned short pp_body_fsm_eq_classes[] = { @@ -203,34 +202,34 @@ const int num_pp_body_fsm_eq_classes = 29; unsigned char pp_body_fsm_table[] = { 39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77, - 0,40,41,42, 4, 5, 4, 7, 8, 7,49,50,51,52,53,54,55,17,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, - 0,40,41,42, 4, 5, 5, 7, 8, 8,49,50,51,52,53,54,55,56,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, - 0,40,41,42, 4, 5, 6, 7, 8, 9,49,50,51,52,53,54,55,17,18,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, -37,40,41,42, 4, 5, 4, 7, 8, 7,49,50,51,52,53,54,55,17,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, - 7,40,41,42, 4, 5, 4,46,47, 7,49,50,51,52,53,54,55,17,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, - 2,40,41,42, 4, 5, 4, 7, 8, 7,49,50,51,52,53,54,55,17,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, -39,40,41,42, 4, 5, 4, 7, 8, 7,49,50,51,52,53,54,55,17,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, -34,40,41,42, 4, 5, 4, 7, 8, 7,49,50,51,52,53,54,55,17,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, -29,40,41,42, 4, 5, 4, 7, 8, 7,49,50,51,52,53,54,55,17,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, - 4,40,41,42,43,44, 4, 7, 8, 7,49,50,51,52,53,54,55,17,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, -33,40,41,42, 4, 5, 4, 7, 8, 7,49,50,51,52,53,54,19,17,17,20,20,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, -31,40,41,42, 4, 5, 4, 7, 8, 7,49,50,51,52,53,54,55,17,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, -27,40,41,42, 4, 5, 4, 7, 8, 7,49,50,51,14,53,54,55,17,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, -21,40,41,42, 4, 5, 4, 7, 8, 7,12,12,51,52,53,54,55,17,17,19,19,22,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, -16,40,41,42, 4, 5, 4, 7, 8, 7,49,50,51,52,53,54,17,17,17,19,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, + 0,40,41, 3, 4, 5, 4, 7, 8, 7,49,50,51,52,53,54,55,17,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, + 0,40,41, 3, 4, 5, 5, 7, 8, 8,49,50,51,52,53,54,55,56,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, + 0,40,41, 3, 4, 5, 6, 7, 8, 9,49,50,51,52,53,54,55,17,18,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, +37,40,41, 3, 4, 5, 4, 7, 8, 7,49,50,51,52,53,54,55,17,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, + 7,40,41, 3, 4, 5, 4,46,47, 7,49,50,51,52,53,54,55,17,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, + 2,40,41, 3, 4, 5, 4, 7, 8, 7,49,50,51,52,53,54,55,17,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, +39,40,41, 3, 4, 5, 4, 7, 8, 7,49,50,51,52,53,54,55,17,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, +34,40,41, 3, 4, 5, 4, 7, 8, 7,49,50,51,52,53,54,55,17,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, +29,40,41, 3, 4, 5, 4, 7, 8, 7,49,50,51,52,53,54,55,17,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, + 4,40,41, 3,43,44, 4, 7, 8, 7,49,50,51,52,53,54,55,17,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, +33,40,41, 3, 4, 5, 4, 7, 8, 7,49,50,51,52,53,54,19,17,17,20,20,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, +31,40,41, 3, 4, 5, 4, 7, 8, 7,49,50,51,52,53,54,55,17,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, +27,40,41, 3, 4, 5, 4, 7, 8, 7,49,50,51,14,53,54,55,17,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, +21,40,41, 3, 4, 5, 4, 7, 8, 7,12,12,51,52,53,54,55,17,17,19,19,22,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, +16,40,41, 3, 4, 5, 4, 7, 8, 7,49,50,51,52,53,54,17,17,17,19,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, 11, 1,41, 3, 4, 5, 4, 7, 8, 7,10,10,12,14,14,15,55,17,17,19,19,12,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, 10, 1,41, 3, 4, 5, 4, 7, 8, 7,10,10,12,14,14,15,55,17,17,19,19,12,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, -32,40,41,42, 4, 5, 4, 7, 8, 7,49,50,51,52,53,54,55,17,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, -23,40,41,42, 4, 5, 4, 7, 8, 7,49,50,51,52,53,54,55,17,17,19,19,60,61,24,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, -36,40,41,42, 4, 5, 4, 7, 8, 7,49,50,51,52,53,54,55,17,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, -25,40,41,42, 4, 5, 4, 7, 8, 7,49,50,51,52,53,54,55,17,17,19,19,60,61,62,63,26,65,28,67,68,69,70,71,72,73,74,75,76,38, +32,40,41, 3, 4, 5, 4, 7, 8, 7,49,50,51,52,53,54,55,17,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, +23,40,41, 3, 4, 5, 4, 7, 8, 7,49,50,51,52,53,54,55,17,17,19,19,60,61,24,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, +36,40,41, 3, 4, 5, 4, 7, 8, 7,49,50,51,52,53,54,55,17,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, +25,40,41, 3, 4, 5, 4, 7, 8, 7,49,50,51,52,53,54,55,17,17,19,19,60,61,62,63,26,65,28,67,68,69,70,71,72,73,74,75,76,38, 1, 1,41, 3, 4, 5, 4, 7, 8, 7,49,50,51,52,53,15,55,17,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, 1, 1,41, 3, 4, 5, 4, 7, 8, 7,49,50,51,52,53,54,55,17,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, -39,40,41,42, 6, 6, 4, 9, 9, 7,49,50,51,52,53,54,55,18,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, -35,40,41,42, 4, 5, 4, 7, 8, 7,49,50,51,52,53,54,55,17,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, +39,40,41, 3, 6, 6, 4, 9, 9, 7,49,50,51,52,53,54,55,18,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, +35,40,41, 3, 4, 5, 4, 7, 8, 7,49,50,51,52,53,54,55,17,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, 1, 1,41, 3, 4, 5, 4, 7, 8, 7,49,50,13,52,53,15,55,17,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, 1, 1,41, 3, 4, 5, 4, 7, 8, 7,49,15,51,52,53,54,55,17,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, -30,40,41,42, 4, 5, 4, 7, 8, 7,49,50,51,52,53,54,55,17,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, +30,40,41, 3, 4, 5, 4, 7, 8, 7,49,50,51,52,53,54,55,17,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, }; unsigned short pp_number_fsm_eq_classes[] = { @@ -241,34 +240,34 @@ const int num_pp_number_fsm_eq_classes = 29; unsigned char pp_number_fsm_table[] = { 39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77, - 0,40,41,42, 4, 5, 4, 7, 8, 7,49,50,51,52,53,54,55,17,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, - 0,40,41,42, 4, 5, 5, 7, 8, 8,49,50,51,52,53,54,55,56,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, - 0,40,41,42, 4, 5, 6, 7, 8, 9,49,50,51,52,53,54,55,17,18,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, -37,40,41,42, 4, 5, 4, 7, 8, 7,49,50,51,52,53,54,55,17,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, - 7,40,41,42, 4, 5, 4,46,47, 7,49,50,51,52,53,54,55,17,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, - 2,40,41,42, 4, 5, 4, 7, 8, 7,49,50,51,52,53,54,55,17,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, -39,40,41,42, 4, 5, 4, 7, 8, 7,49,50,51,52,53,54,55,17,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, -34,40,41,42, 4, 5, 4, 7, 8, 7,49,50,51,52,53,54,55,17,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, -29,40,41,42, 4, 5, 4, 7, 8, 7,49,50,51,52,53,54,55,17,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, - 4,40,41,42,43,44, 4, 7, 8, 7,49,50,51,52,53,54,55,17,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, -33,40,41,42, 4, 5, 4, 7, 8, 7,49,50,51,52,53,54,19,17,17,20,20,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, -31,40,41,42, 4, 5, 4, 7, 8, 7,49,50,51,52,53,54,55,17,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, -27,40,41,42, 4, 5, 4, 7, 8, 7,49,50,51,14,53,54,55,17,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, -21,40,41,42, 4, 5, 4, 7, 8, 7,12,12,51,52,53,54,55,17,17,19,19,22,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, -16,40,41,42, 4, 5, 4, 7, 8, 7,49,50,51,52,53,54,17,17,17,19,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, + 0,40,41, 3, 4, 5, 4, 7, 8, 7,49,50,51,52,53,54,55,17,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, + 0,40,41, 3, 4, 5, 5, 7, 8, 8,49,50,51,52,53,54,55,56,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, + 0,40,41, 3, 4, 5, 6, 7, 8, 9,49,50,51,52,53,54,55,17,18,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, +37,40,41, 3, 4, 5, 4, 7, 8, 7,49,50,51,52,53,54,55,17,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, + 7,40,41, 3, 4, 5, 4,46,47, 7,49,50,51,52,53,54,55,17,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, + 2,40,41, 3, 4, 5, 4, 7, 8, 7,49,50,51,52,53,54,55,17,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, +39,40,41, 3, 4, 5, 4, 7, 8, 7,49,50,51,52,53,54,55,17,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, +34,40,41, 3, 4, 5, 4, 7, 8, 7,49,50,51,52,53,54,55,17,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, +29,40,41, 3, 4, 5, 4, 7, 8, 7,49,50,51,52,53,54,55,17,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, + 4,40,41, 3,43,44, 4, 7, 8, 7,49,50,51,52,53,54,55,17,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, +33,40,41, 3, 4, 5, 4, 7, 8, 7,49,50,51,52,53,54,19,17,17,20,20,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, +31,40,41, 3, 4, 5, 4, 7, 8, 7,49,50,51,52,53,54,55,17,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, +27,40,41, 3, 4, 5, 4, 7, 8, 7,49,50,51,14,53,54,55,17,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, +21,40,41, 3, 4, 5, 4, 7, 8, 7,12,12,51,52,53,54,55,17,17,19,19,22,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, +16,40,41, 3, 4, 5, 4, 7, 8, 7,49,50,51,52,53,54,17,17,17,19,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, 11, 1,41, 3, 4, 5, 4, 7, 8, 7,10,10,12,14,14,15,55,17,17,19,19,12,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, 10, 1,41, 3, 4, 5, 4, 7, 8, 7,10,10,12,14,14,15,55,17,17,19,19,12,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, -32,40,41,42, 4, 5, 4, 7, 8, 7,49,50,51,52,53,54,55,17,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, -23,40,41,42, 4, 5, 4, 7, 8, 7,49,50,51,52,53,54,55,17,17,19,19,60,61,24,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, -36,40,41,42, 4, 5, 4, 7, 8, 7,49,50,51,52,53,54,55,17,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, -25,40,41,42, 4, 5, 4, 7, 8, 7,49,50,51,52,53,54,55,17,17,19,19,60,61,62,63,26,65,28,67,68,69,70,71,72,73,74,75,76,38, +32,40,41, 3, 4, 5, 4, 7, 8, 7,49,50,51,52,53,54,55,17,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, +23,40,41, 3, 4, 5, 4, 7, 8, 7,49,50,51,52,53,54,55,17,17,19,19,60,61,24,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, +36,40,41, 3, 4, 5, 4, 7, 8, 7,49,50,51,52,53,54,55,17,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, +25,40,41, 3, 4, 5, 4, 7, 8, 7,49,50,51,52,53,54,55,17,17,19,19,60,61,62,63,26,65,28,67,68,69,70,71,72,73,74,75,76,38, 1, 1,41, 3, 4, 5, 4, 7, 8, 7,49,50,51,52,53,15,55,17,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, 1, 1,41, 3, 4, 5, 4, 7, 8, 7,49,50,51,52,53,54,55,17,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, -39,40,41,42, 6, 6, 4, 9, 9, 7,49,50,51,52,53,54,55,18,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, -35,40,41,42, 4, 5, 4, 7, 8, 7,49,50,51,52,53,54,55,17,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, +39,40,41, 3, 6, 6, 4, 9, 9, 7,49,50,51,52,53,54,55,18,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, +35,40,41, 3, 4, 5, 4, 7, 8, 7,49,50,51,52,53,54,55,17,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, 1, 1,41, 3, 4, 5, 4, 7, 8, 7,49,50,13,52,53,15,55,17,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, 1, 1,41, 3, 4, 5, 4, 7, 8, 7,49,15,51,52,53,54,55,17,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, -30,40,41,42, 4, 5, 4, 7, 8, 7,49,50,51,52,53,54,55,17,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, +30,40,41, 3, 4, 5, 4, 7, 8, 7,49,50,51,52,53,54,55,17,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, }; unsigned short pp_error_fsm_eq_classes[] = { @@ -291,34 +290,34 @@ const int num_pp_junk_fsm_eq_classes = 29; unsigned char pp_junk_fsm_table[] = { 39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77, - 0,40,41,42, 4, 5, 4, 7, 8, 7,49,50,51,52,53,54,55,17,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, - 0,40,41,42, 4, 5, 5, 7, 8, 8,49,50,51,52,53,54,55,56,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, - 0,40,41,42, 4, 5, 6, 7, 8, 9,49,50,51,52,53,54,55,17,18,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, -37,40,41,42, 4, 5, 4, 7, 8, 7,49,50,51,52,53,54,55,17,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, - 7,40,41,42, 4, 5, 4,46,47, 7,49,50,51,52,53,54,55,17,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, - 2,40,41,42, 4, 5, 4, 7, 8, 7,49,50,51,52,53,54,55,17,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, -39,40,41,42, 4, 5, 4, 7, 8, 7,49,50,51,52,53,54,55,17,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, -34,40,41,42, 4, 5, 4, 7, 8, 7,49,50,51,52,53,54,55,17,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, -29,40,41,42, 4, 5, 4, 7, 8, 7,49,50,51,52,53,54,55,17,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, - 4,40,41,42,43,44, 4, 7, 8, 7,49,50,51,52,53,54,55,17,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, -33,40,41,42, 4, 5, 4, 7, 8, 7,49,50,51,52,53,54,19,17,17,20,20,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, -31,40,41,42, 4, 5, 4, 7, 8, 7,49,50,51,52,53,54,55,17,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, -27,40,41,42, 4, 5, 4, 7, 8, 7,49,50,51,14,53,54,55,17,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, -21,40,41,42, 4, 5, 4, 7, 8, 7,12,12,51,52,53,54,55,17,17,19,19,22,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, -16,40,41,42, 4, 5, 4, 7, 8, 7,49,50,51,52,53,54,17,17,17,19,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, + 0,40,41, 3, 4, 5, 4, 7, 8, 7,49,50,51,52,53,54,55,17,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, + 0,40,41, 3, 4, 5, 5, 7, 8, 8,49,50,51,52,53,54,55,56,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, + 0,40,41, 3, 4, 5, 6, 7, 8, 9,49,50,51,52,53,54,55,17,18,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, +37,40,41, 3, 4, 5, 4, 7, 8, 7,49,50,51,52,53,54,55,17,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, + 7,40,41, 3, 4, 5, 4,46,47, 7,49,50,51,52,53,54,55,17,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, + 2,40,41, 3, 4, 5, 4, 7, 8, 7,49,50,51,52,53,54,55,17,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, +39,40,41, 3, 4, 5, 4, 7, 8, 7,49,50,51,52,53,54,55,17,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, +34,40,41, 3, 4, 5, 4, 7, 8, 7,49,50,51,52,53,54,55,17,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, +29,40,41, 3, 4, 5, 4, 7, 8, 7,49,50,51,52,53,54,55,17,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, + 4,40,41, 3,43,44, 4, 7, 8, 7,49,50,51,52,53,54,55,17,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, +33,40,41, 3, 4, 5, 4, 7, 8, 7,49,50,51,52,53,54,19,17,17,20,20,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, +31,40,41, 3, 4, 5, 4, 7, 8, 7,49,50,51,52,53,54,55,17,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, +27,40,41, 3, 4, 5, 4, 7, 8, 7,49,50,51,14,53,54,55,17,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, +21,40,41, 3, 4, 5, 4, 7, 8, 7,12,12,51,52,53,54,55,17,17,19,19,22,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, +16,40,41, 3, 4, 5, 4, 7, 8, 7,49,50,51,52,53,54,17,17,17,19,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, 11, 1,41, 3, 4, 5, 4, 7, 8, 7,10,10,12,14,14,15,55,17,17,19,19,12,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, 10, 1,41, 3, 4, 5, 4, 7, 8, 7,10,10,12,14,14,15,55,17,17,19,19,12,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, -32,40,41,42, 4, 5, 4, 7, 8, 7,49,50,51,52,53,54,55,17,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, -23,40,41,42, 4, 5, 4, 7, 8, 7,49,50,51,52,53,54,55,17,17,19,19,60,61,24,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, -36,40,41,42, 4, 5, 4, 7, 8, 7,49,50,51,52,53,54,55,17,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, -25,40,41,42, 4, 5, 4, 7, 8, 7,49,50,51,52,53,54,55,17,17,19,19,60,61,62,63,26,65,28,67,68,69,70,71,72,73,74,75,76,38, +32,40,41, 3, 4, 5, 4, 7, 8, 7,49,50,51,52,53,54,55,17,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, +23,40,41, 3, 4, 5, 4, 7, 8, 7,49,50,51,52,53,54,55,17,17,19,19,60,61,24,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, +36,40,41, 3, 4, 5, 4, 7, 8, 7,49,50,51,52,53,54,55,17,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, +25,40,41, 3, 4, 5, 4, 7, 8, 7,49,50,51,52,53,54,55,17,17,19,19,60,61,62,63,26,65,28,67,68,69,70,71,72,73,74,75,76,38, 1, 1,41, 3, 4, 5, 4, 7, 8, 7,49,50,51,52,53,15,55,17,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, 1, 1,41, 3, 4, 5, 4, 7, 8, 7,49,50,51,52,53,54,55,17,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, -39,40,41,42, 6, 6, 4, 9, 9, 7,49,50,51,52,53,54,55,18,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, -35,40,41,42, 4, 5, 4, 7, 8, 7,49,50,51,52,53,54,55,17,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, +39,40,41, 3, 6, 6, 4, 9, 9, 7,49,50,51,52,53,54,55,18,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, +35,40,41, 3, 4, 5, 4, 7, 8, 7,49,50,51,52,53,54,55,17,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, 1, 1,41, 3, 4, 5, 4, 7, 8, 7,49,50,13,52,53,15,55,17,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, 1, 1,41, 3, 4, 5, 4, 7, 8, 7,49,15,51,52,53,54,55,17,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, -30,40,41,42, 4, 5, 4, 7, 8, 7,49,50,51,52,53,54,55,17,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, +30,40,41, 3, 4, 5, 4, 7, 8, 7,49,50,51,52,53,54,55,17,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38, }; unsigned short * get_eq_classes[] = { @@ -345,3 +344,52 @@ pp_error_fsm_table, pp_junk_fsm_table, }; +unsigned short pp_directive_eq_classes[] = { + 0, 0, 0, 0, 0, 0, 0, 0, 0,119, 0,119,119,119, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,119, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,238, 0,357,476,595,714,833, 0,952, 0, 0,1071,1190,1309,1428,1547, 0,1666,1785,1904,2023, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,2142, 0,2261,2380,2499,2618,2737, 0,2856, 0, 0,2975,3094,3213,3332,3451, 0,3570,3689,3808,3927, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, +}; + +const int num_pp_directive_eq_classes = 34; + +unsigned char pp_directive_table[] = { +200,200,200,200,200,200,200,200,200,200,200,200,200,200,205,200,200,200,200,200,202,200,200,200,200,207,200,206,200,200,200,212,200,205,200,200,200,200,200,202,200,200,200,200,207,200,206,200,200,200,212,200,200,200,200,203,200,200,200,200,203,200,200,200,200,215,200,200,200,200,215,200,200,200,200,204,200,200,213,200,200,200,200,204,200,200,213,200,200,200,200,200,210,200,200,211,200,200,208,209,200,200,200,200,200,210,200,200,211,200,200,208,209,200,200,214,200,200,214, + 0,200,200,200,200,200,200,200,200,200,200,200,200,200,205,200,200,200,200,200,202,200,200,200,200,207,200,206,200,200,200,212,200,205,200,200,200,200,200,202,200,200,200,200,207,200,206,200,200,200,212,200,200,200,200,203,200,200,200,200,203,200,200,200,200,215,200,200,200,200,215,200,200,200,200,204,200,200,213,200,200,200,200,204,200,200,213,200,200,200,200,200,210,200,200,211,200,200,208,209,200,200,200,200,200,210,200,200,211,200,200,208,209,200,200,214,200,200,214, +200,200,200,200,200,200,200,200,200,200,200,200,200,200,205,200,200,200,200,200,202,200,200,200,200,207,200,206,200,200,200,212,200,205,200,200,200,200,200,202,200,200,200,200,207,200,206,200,200,200,212,200,200,200,200,203,200,200,200,200,203,200,200,200,200,215,67,200,200,70,215,200,200,200,200,204,200,200,213,200,200,200,200,204,200,200,213,200,200,200,200,200,210,200,200,211,200,200,208,209,200,200,200,200,200,210,200,200,211,200,200,208,209,200,200,214,200,200,214, +200,200,200,200,200,200,200,200,200,200,200,200,200,200,205,200,200,200,200,200,202,200,200,200,200,207,200,206,200,200,200,212,35,205,200,200,200,200,200,202,200,200,200,200,207,200,206,200,200,200,212,200,200,200,200,203,200,200,200,200,203,200,200,200,200,215,200,200,200,200,215,200,200,200,200,204,200,200,213,200,200,200,200,204,200,200,213,200,200,200,200,200,210,200,200,211,200,200,208,209,200,200,200,200,200,210,200,200,211,200,200,208,209,200,200,214,200,200,214, + 4,200,200,200,200,200,200,200,200,200,200,200,200,200,205,200,200,200,200,200,202,200,200,200,200,207,200,206,200,200,200,212,200,41,200,200,200,38,200,202,42,200,200,200,207,200,206,200,200,200,212,200,200,200,200,203,200,200,200,200,203,200,200,200,200,215,200,200,200,200,215,200,200,200,200,204,200,200,213,81,200,200,200,204,200,200,213,200,200,200,200,200,210,200,200,211,200,200,208,209,103,200,200,200,200,210,200,200,211,200,200,208,209,200,200,214,200,200,214, +10,200,200,200,56,200,200,200,200,200,200,200,200,200,205,200,200,200,200,200,202,200,200,200,200,207,200,206,200,200,200,212,200,205,200,200,200,200,39,202,200,45,43,200,207,200,206,200,200,200,212,200,200,200,200,203,200,200,200,60,203,200,200,200,200,215,200,200,200,200,215,200,200,200,200,204,200,200,213,200,200,82,200,204,200,200,213,200,200,200,200,200,210,200,200,211,200,200,208,209,200,200,200,200,200,210,200,200,211,111,200,208,209,200,200,214,200,118,214, +200,200,33,200,200,200,200,200,200,200,200,200,200,200,205,200,200,200,200,200,202,200,200,200,200,207,200,206,200,200,200,212,200,205,200,200,200,200,200,202,200,200,200,44,207,46,206,200,200,200,212,200,200,200,200,203,57,200,200,200,203,200,200,200,200,215,200,200,200,200,215,200,200,200,200,204,200,200,213,200,200,200,83,204,200,200,213,200,200,200,200,200,210,200,200,211,200,200,208,209,200,200,200,200,105,210,200,200,211,200,112,208,209,200,200,214,200,200,214, +200,200,200,200,200,200,200,200,200,200,200,200,200,200,205,200,200,200,200,200,202,200,200,200,200,207,200,206,200,200,200,212,200,205,200,200,200,200,200,202,200,200,200,200,207,200,206,200,200,200,212,200,200,200,200,203,200,200,200,200,203,200,200,200,200,215,200,68,200,200,215,200,200,200,200,204,200,200,213,200,200,200,200,204,200,86,213,200,200,200,200,200,210,200,200,211,200,200,208,209,200,200,200,200,200,210,200,200,211,200,200,208,209,200,200,214,200,200,214, + 2,200,200,200,200,200,200,200,200,200,200,200,116,200,205,200,200,200,200,200,202,200,200,200,200,207,200,206,200,200,200,212,200,205,200,200,200,200,200,202,200,200,200,200,207,200,206,200,200,200,212,200,200,200,200,203,200,58,200,200,203,200,200,200,200,215,200,200,200,200,215,200,200,200,200,204,200,200,213,200,84,200,200,204,200,200,213,200,200,200,200,200,210,200,200,211,200,200,208,209,200,200,110,104,200,210,200,200,211,200,200,208,209,200,200,214,200,200,214, +12,200,200,200,200,200,200,200,200,200,102,200,200,200,205,200,200,200,200,200,202,200,200,200,200,207,200,206,200,200,200,212,200,205,200,36,200,200,200,202,200,200,200,200,207,200,206,200,200,200,212,200,200,200,200,203,200,200,200,200,203,200,200,200,200,215,200,200,200,200,215,200,200,200,200,204,200,200,213,200,200,200,200,204,200,200,213,200,200,200,200,200,210,200,200,211,200,200,208,209,200,200,200,200,200,210,200,200,211,200,200,208,209,200,200,214,200,200,214, +200,200,34,200,200,200,200,200,200,200,200,200,200,200,205,200,200,200,200,200,202,200,200,200,200,207,200,206,200,200,200,212,200,205,200,200,200,200,200,202,200,200,200,200,207,200,206,200,200,200,212,200,200,200,200,203,200,200,200,200,203,200,200,200,200,215,200,200,69,200,215,200,200,200,200,204,200,200,213,200,200,200,200,204,200,200,213,200,200,200,200,200,210,200,200,211,200,200,208,209,200,200,200,200,200,210,200,200,211,200,200,208,209,200,200,214,200,200,214, +200,200,32,200,200,200,200,200,79,200,100,200,200,200,205,200,200,200,200,200,202,200,200,200,200,207,200,206,200,200,200,212,200,40,200,200,200,200,200,202,200,200,200,200,207,200,206,200,200,200,212,200,200,200,200,203,200,200,59,200,203,200,200,200,200,215,200,200,200,200,215,200,200,200,200,204,200,200,213,200,200,200,200,204,85,200,213,200,200,200,200,200,210,200,200,211,200,200,208,209,200,200,200,200,200,210,200,200,211,200,200,208,209,200,200,214,117,200,214, +200,200,200,200,200,200,200,200,200,200,200,200,200,200,205,200,200,200,200,200,202,200,200,200,200,207,200,206,200,200,200,212,200,205,200,200,200,200,200,202,200,200,200,200,207,200,206,48,200,200,212,200,200,200,200,203,200,200,200,200,203,200,200,200,200,215,200,200,200,200,215,200,200,200,200,204,200,200,213,200,200,200,200,204,200,200,213,200,200,200,200,200,210,200,200,211,200,200,208,209,200,200,200,200,200,210,107,200,211,200,200,208,209,200,200,214,200,200,214, + 6,200,200,200,200,200,200,200,200,200,200,200,200,200,205,200,200,200,200,200,202,200,200,200,200,207,200,206,200,200,200,212,200,205,47,200,200,200,200,202,200,200,200,200,207,200,206,200,200,200,212,200,200,200,200,203,200,200,200,200,203,200,200,200,200,215,200,200,200,200,215,200,200,200,200,204,200,200,213,200,200,200,200,204,200,200,213,200,200,200,200,200,210,200,200,211,200,200,208,209,200,200,200,200,200,210,200,200,211,200,200,208,209,200,200,214,200,200,214, +200,200,200,200,200,200,66,200,200,200,101,200,200,200,205,200,200,200,200,200,202,200,200,200,200,207,200,206,200,200,200,212,200,205,200,200,200,200,200,202,200,200,200,200,207,200,206,200,49,200,212,200,200,200,200,203,200,200,200,200,203,200,200,200,200,215,200,200,200,200,215,200,200,200,200,204,200,200,213,200,200,200,200,204,200,200,213,200,200,200,200,200,210,200,200,211,200,200,208,209,200,106,200,200,200,210,200,108,211,200,200,208,209,200,200,214,200,200,214, +200,200,200,200,200,200,200,200,80,200,200,200,200,200,205,200,200,200,200,200,202,200,200,200,200,207,200,206,200,200,200,212,200,205,200,200,200,200,200,202,200,200,200,200,207,200,206,200,200,200,212,200,200,200,200,203,200,200,200,200,203,200,200,200,200,215,200,200,200,200,215,200,200,200,200,204,200,200,213,200,200,200,200,204,200,200,213,200,200,200,200,200,210,200,200,211,200,200,208,209,200,200,109,200,200,210,200,200,211,200,200,208,209,200,200,214,200,200,214, +200,200,200,200,200,200,200,200,200,200,200,200,200,200,205,200,200,200,200,200,202,200,200,200,200,207,200,206,200,200,200,212,200,205,200,200,200,200,200,202,200,200,200,200,207,200,206,200,200,50,212,200,200,200,200,203,200,200,200,200,203,200,200,200,200,215,200,200,200,200,215,200,200,200,200,204,200,200,213,200,200,200,200,204,200,200,213,200,200,200,200,200,210,200,200,211,200,200,208,209,200,200,200,200,200,210,200,200,211,200,200,208,209,200,200,214,200,200,214, + 8,200,200,200,200,200,200,200,200,200,200,200,200,200,205,200,200,200,200,200,202,200,200,200,200,207,200,206,200,200,200,212,200,205,200,200,37,200,200,202,200,200,200,200,207,200,206,200,200,200,212,200,200,200,200,203,200,200,200,200,203,200,200,200,200,215,200,200,200,200,215,200,200,200,200,204,200,200,213,200,200,200,200,204,200,200,213,200,200,200,200,200,210,200,200,211,200,200,208,209,200,200,200,200,200,210,200,200,211,200,200,208,209,200,200,214,200,200,214, +200,200,200,200,200,200,200,200,200,200,200,200,200,200,205,200,200,200,200,200,202,200,200,200,200,207,200,206,200,200,200,212,200,205,200,200,200,200,200,202,200,200,200,200,207,200,206,200,200,200,212,200,200,200,200,203,200,200,200,200,203,62,200,200,65,215,200,200,200,200,215,200,200,200,200,204,200,200,213,200,200,200,200,204,200,200,213,200,200,200,200,200,210,200,200,211,200,200,208,209,200,200,200,200,200,210,200,200,211,200,200,208,209,200,200,214,200,200,214, +200,200,200,200,200,200,200,200,200,200,200,200,200,16,205,200,200,200,200,200,202,200,200,200,200,207,200,206,200,200,200,212,200,205,200,200,200,200,200,202,200,200,200,200,207,200,206,200,200,200,212,200,200,200,200,203,200,200,200,200,203,200,200,200,200,215,200,200,200,200,215,200,200,200,200,204,200,200,213,200,200,200,200,204,200,200,213,200,200,200,200,200,210,200,200,211,200,200,208,209,200,200,200,200,200,210,200,200,211,200,200,208,209,200,200,214,200,200,214, + 3,200,200,200,200,200,200,200,200,200,200,200,200,200,22,200,200,200,19,200,202,23,200,200,200,207,200,206,200,200,200,212,200,205,200,200,200,200,200,202,200,200,200,200,207,200,206,200,200,200,212,200,200,200,200,203,200,200,200,200,203,200,200,200,200,215,200,200,200,200,215,73,200,200,200,204,200,200,213,200,200,200,200,204,200,200,213,90,200,200,200,200,210,200,200,211,200,200,208,209,200,200,200,200,200,210,200,200,211,200,200,208,209,200,200,214,200,200,214, + 9,200,200,51,200,200,200,200,200,200,200,200,200,200,205,200,200,200,200,20,202,200,26,24,200,207,200,206,200,200,200,212,200,205,200,200,200,200,200,202,200,200,200,200,207,200,206,200,200,200,212,200,200,200,55,203,200,200,200,200,203,200,200,200,200,215,200,200,200,200,215,200,200,74,200,204,200,200,213,200,200,200,200,204,200,200,213,200,200,200,200,200,210,200,200,211,98,200,208,209,200,200,200,200,200,210,200,200,211,200,200,208,209,200,115,214,200,200,214, +200,14,200,200,200,200,200,200,200,200,200,200,200,200,205,200,200,200,200,200,202,200,200,200,25,207,27,206,200,200,200,212,200,205,200,200,200,200,200,202,200,200,200,200,207,200,206,200,200,200,212,52,200,200,200,203,200,200,200,200,203,200,200,200,200,215,200,200,200,200,215,200,200,200,75,204,200,200,213,200,200,200,200,204,200,200,213,200,200,200,200,92,210,200,200,211,200,99,208,209,200,200,200,200,200,210,200,200,211,200,200,208,209,200,200,214,200,200,214, +200,200,200,200,200,200,200,200,200,200,200,200,200,200,205,200,200,200,200,200,202,200,200,200,200,207,200,206,200,200,200,212,200,205,200,200,200,200,200,202,200,200,200,200,207,200,206,200,200,200,212,200,200,200,200,203,200,200,200,200,203,200,63,200,200,215,200,200,200,200,215,200,200,200,200,204,200,78,213,200,200,200,200,204,200,200,213,200,200,200,200,200,210,200,200,211,200,200,208,209,200,200,200,200,200,210,200,200,211,200,200,208,209,200,200,214,200,200,214, + 1,200,200,200,200,200,200,200,200,200,200,113,200,200,205,200,200,200,200,200,202,200,200,200,200,207,200,206,200,200,200,212,200,205,200,200,200,200,200,202,200,200,200,200,207,200,206,200,200,200,212,200,53,200,200,203,200,200,200,200,203,200,200,200,200,215,200,200,200,200,215,200,76,200,200,204,200,200,213,200,200,200,200,204,200,200,213,200,200,97,91,200,210,200,200,211,200,200,208,209,200,200,200,200,200,210,200,200,211,200,200,208,209,200,200,214,200,200,214, +11,200,200,200,200,200,200,200,200,89,200,200,200,200,205,200,17,200,200,200,202,200,200,200,200,207,200,206,200,200,200,212,200,205,200,200,200,200,200,202,200,200,200,200,207,200,206,200,200,200,212,200,200,200,200,203,200,200,200,200,203,200,200,200,200,215,200,200,200,200,215,200,200,200,200,204,200,200,213,200,200,200,200,204,200,200,213,200,200,200,200,200,210,200,200,211,200,200,208,209,200,200,200,200,200,210,200,200,211,200,200,208,209,200,200,214,200,200,214, +200,15,200,200,200,200,200,200,200,200,200,200,200,200,205,200,200,200,200,200,202,200,200,200,200,207,200,206,200,200,200,212,200,205,200,200,200,200,200,202,200,200,200,200,207,200,206,200,200,200,212,200,200,200,200,203,200,200,200,200,203,200,200,64,200,215,200,200,200,200,215,200,200,200,200,204,200,200,213,200,200,200,200,204,200,200,213,200,200,200,200,200,210,200,200,211,200,200,208,209,200,200,200,200,200,210,200,200,211,200,200,208,209,200,200,214,200,200,214, +200,13,200,200,200,200,200,71,200,87,200,200,200,200,21,200,200,200,200,200,202,200,200,200,200,207,200,206,200,200,200,212,200,205,200,200,200,200,200,202,200,200,200,200,207,200,206,200,200,200,212,200,200,54,200,203,200,200,200,200,203,200,200,200,200,215,200,200,200,200,215,200,200,200,200,204,77,200,213,200,200,200,200,204,200,200,213,200,200,200,200,200,210,200,200,211,200,200,208,209,200,200,200,200,200,210,200,200,211,200,200,208,209,114,200,214,200,200,214, +200,200,200,200,200,200,200,200,200,200,200,200,200,200,205,200,200,200,200,200,202,200,200,200,200,207,200,206,29,200,200,212,200,205,200,200,200,200,200,202,200,200,200,200,207,200,206,200,200,200,212,200,200,200,200,203,200,200,200,200,203,200,200,200,200,215,200,200,200,200,215,200,200,200,200,204,200,200,213,200,200,200,200,204,200,200,213,200,200,200,200,200,210,94,200,211,200,200,208,209,200,200,200,200,200,210,200,200,211,200,200,208,209,200,200,214,200,200,214, + 5,200,200,200,200,200,200,200,200,200,200,200,200,200,205,28,200,200,200,200,202,200,200,200,200,207,200,206,200,200,200,212,200,205,200,200,200,200,200,202,200,200,200,200,207,200,206,200,200,200,212,200,200,200,200,203,200,200,200,200,203,200,200,200,200,215,200,200,200,200,215,200,200,200,200,204,200,200,213,200,200,200,200,204,200,200,213,200,200,200,200,200,210,200,200,211,200,200,208,209,200,200,200,200,200,210,200,200,211,200,200,208,209,200,200,214,200,200,214, +200,200,200,200,200,61,200,200,200,88,200,200,200,200,205,200,200,200,200,200,202,200,200,200,200,207,200,206,200,30,200,212,200,205,200,200,200,200,200,202,200,200,200,200,207,200,206,200,200,200,212,200,200,200,200,203,200,200,200,200,203,200,200,200,200,215,200,200,200,200,215,200,200,200,200,204,200,200,213,200,200,200,200,204,200,200,213,200,93,200,200,200,210,200,95,211,200,200,208,209,200,200,200,200,200,210,200,200,211,200,200,208,209,200,200,214,200,200,214, +200,200,200,200,200,200,200,72,200,200,200,200,200,200,205,200,200,200,200,200,202,200,200,200,200,207,200,206,200,200,200,212,200,205,200,200,200,200,200,202,200,200,200,200,207,200,206,200,200,200,212,200,200,200,200,203,200,200,200,200,203,200,200,200,200,215,200,200,200,200,215,200,200,200,200,204,200,200,213,200,200,200,200,204,200,200,213,200,200,96,200,200,210,200,200,211,200,200,208,209,200,200,200,200,200,210,200,200,211,200,200,208,209,200,200,214,200,200,214, +200,200,200,200,200,200,200,200,200,200,200,200,200,200,205,200,200,200,200,200,202,200,200,200,200,207,200,206,200,200,31,212,200,205,200,200,200,200,200,202,200,200,200,200,207,200,206,200,200,200,212,200,200,200,200,203,200,200,200,200,203,200,200,200,200,215,200,200,200,200,215,200,200,200,200,204,200,200,213,200,200,200,200,204,200,200,213,200,200,200,200,200,210,200,200,211,200,200,208,209,200,200,200,200,200,210,200,200,211,200,200,208,209,200,200,214,200,200,214, + 7,200,200,200,200,200,200,200,200,200,200,200,200,200,205,200,200,18,200,200,202,200,200,200,200,207,200,206,200,200,200,212,200,205,200,200,200,200,200,202,200,200,200,200,207,200,206,200,200,200,212,200,200,200,200,203,200,200,200,200,203,200,200,200,200,215,200,200,200,200,215,200,200,200,200,204,200,200,213,200,200,200,200,204,200,200,213,200,200,200,200,200,210,200,200,211,200,200,208,209,200,200,200,200,200,210,200,200,211,200,200,208,209,200,200,214,200,200,214, +}; + +unsigned char LSDIR_default = 0; + +unsigned char LSDIR_count = 119; + +unsigned char pp_directive_terminal_base = 200; + diff --git a/test/4cpp_new_lexer.h b/test/4cpp_new_lexer.h index db49a4b2..5daf29bd 100644 --- a/test/4cpp_new_lexer.h +++ b/test/4cpp_new_lexer.h @@ -10,11 +10,6 @@ #define lexer_link static // TODO(allen): revisit this keyword data declaration system -struct String_And_Flag{ - char *str; - fcpp_u32 flags; -}; - struct String_List{ String_And_Flag *data; int count; @@ -25,26 +20,8 @@ struct Sub_Match_List_Result{ fcpp_i32 new_pos; }; - -// TODO(allen): shift towards storing in a context -static String_And_Flag int_suf_strings[] = { - {"ull"}, {"ULL"}, - {"llu"}, {"LLU"}, - {"ll"}, {"LL"}, - {"l"}, {"L"}, - {"u"}, {"U"} -}; - #define lexer_string_list(x) {x, (sizeof(x)/sizeof(*x))} -static String_List int_sufs = lexer_string_list(int_suf_strings); - -static String_And_Flag float_suf_strings[] = { - {"f"}, {"F"}, - {"l"}, {"L"} -}; -static String_List float_sufs = lexer_string_list(float_suf_strings); - static String_And_Flag bool_lit_strings[] = { {"true"}, {"false"} }; @@ -138,65 +115,6 @@ static String_And_Flag keyword_strings[] = { }; static String_List keywords = lexer_string_list(keyword_strings); -static String_And_Flag op_strings[] = { - {"...", CPP_TOKEN_ELLIPSIS}, - {"<<=", CPP_TOKEN_LSHIFTEQ}, - {">>=", CPP_TOKEN_RSHIFTEQ}, - {"->*", CPP_TOKEN_PTRARROW}, - {"<<", CPP_TOKEN_LSHIFT}, - {">>", CPP_TOKEN_RSHIFT}, - {"&&", CPP_TOKEN_AND}, - {"||", CPP_TOKEN_OR}, - {"->", CPP_TOKEN_ARROW}, - {"++", CPP_TOKEN_INCREMENT}, - {"--", CPP_TOKEN_DECREMENT}, - {"::", CPP_TOKEN_SCOPE}, - {"+=", CPP_TOKEN_ADDEQ}, - {"-=", CPP_TOKEN_SUBEQ}, - {"*=", CPP_TOKEN_MULEQ}, - {"/=", CPP_TOKEN_DIVEQ}, - {"%=", CPP_TOKEN_MODEQ}, - {"&=", CPP_TOKEN_ANDEQ}, - {"|=", CPP_TOKEN_OREQ}, - {"^=", CPP_TOKEN_XOREQ}, - {"==", CPP_TOKEN_EQEQ}, - {">=", CPP_TOKEN_GRTREQ}, - {"<=", CPP_TOKEN_LESSEQ}, - {"!=", CPP_TOKEN_NOTEQ}, - {".*", CPP_TOKEN_PTRDOT}, - {"{", CPP_TOKEN_BRACE_OPEN}, - {"}", CPP_TOKEN_BRACE_CLOSE}, - {"[", CPP_TOKEN_BRACKET_OPEN}, - {"]", CPP_TOKEN_BRACKET_CLOSE}, - {"(", CPP_TOKEN_PARENTHESE_OPEN}, - {")", CPP_TOKEN_PARENTHESE_CLOSE}, - {"<", CPP_TOKEN_LESS}, - {">", CPP_TOKEN_GRTR}, - {"+", CPP_TOKEN_PLUS}, - {"-", CPP_TOKEN_MINUS}, - {"!", CPP_TOKEN_NOT}, - {"~", CPP_TOKEN_TILDE}, - {"*", CPP_TOKEN_STAR}, - {"&", CPP_TOKEN_AMPERSAND}, - {"|", CPP_TOKEN_BIT_OR}, - {"^", CPP_TOKEN_BIT_XOR}, - {"=", CPP_TOKEN_EQ}, - {",", CPP_TOKEN_COMMA}, - {":", CPP_TOKEN_COLON}, - {";", CPP_TOKEN_SEMICOLON}, - {"/", CPP_TOKEN_DIV}, - {"?", CPP_TOKEN_TERNARY_QMARK}, - {"%", CPP_TOKEN_MOD}, - {".", CPP_TOKEN_DOT}, -}; -static String_List ops = lexer_string_list(op_strings); - -static String_And_Flag pp_op_strings[] = { - {"##", CPP_PP_CONCAT}, - {"#", CPP_PP_STRINGIFY}, -}; -static String_List pp_ops = lexer_string_list(pp_op_strings); - static String_And_Flag preprop_strings[] = { {"include", CPP_PP_INCLUDE}, {"INCLUDE", CPP_PP_INCLUDE}, @@ -467,6 +385,7 @@ cpp_lex_nonalloc(Lex_Data *S_ptr, char *chunk, int size, Cpp_Token_Stack *token_ DrCase(3); DrCase(4); DrCase(5); + DrCase(6); } for (;;){ @@ -641,29 +560,31 @@ cpp_lex_nonalloc(Lex_Data *S_ptr, char *chunk, int size, Cpp_Token_Stack *token_ case LS_pp: { - --S.pos; - int start = 1; + S.fsm.directive_state = LSDIR_default; + S.fsm.emit_token = 0; + for (;;){ + for (; S.fsm.directive_state < LSDIR_count && S.pos < end_pos;){ + c = chunk[S.pos++]; + S.fsm.directive_state = pp_directive_table[S.fsm.directive_state + pp_directive_eq_classes[c]]; + } + S.fsm.emit_token = (S.fsm.int_state >= LSDIR_count); - c = S.tb[start]; - while (start < S.tb_pos && (c == ' ' || c == '\t' || c == '\r' || c == '\v' || c == '\f')){ - ++start; - c = S.tb[start]; + if (S.fsm.emit_token == 0){ + DrYield(6, 1); + } + else break; } - - int word_size = S.tb_pos - start - 1; - Sub_Match_List_Result match; - match = sub_match_list(S.tb, S.tb_pos, start, preprops, word_size); - - if (match.index != -1){ - String_And_Flag data = preprops.data[match.index]; - S.token.type = (Cpp_Token_Type)data.flags; + --S.pos; + + Cpp_Token_Type type = (Cpp_Token_Type)(S.fsm.directive_state - pp_directive_terminal_base); + S.token.type = type; + if (type == CPP_TOKEN_JUNK){ + S.token.flags = 0; + } + else{ S.token.flags = CPP_TFLAG_PP_DIRECTIVE; S.pp_state = (unsigned char)cpp_pp_directive_to_state(S.token.type); - } - else{ - S.token.type = CPP_TOKEN_JUNK; - S.token.flags = 0; - } + } }break; case LS_number: diff --git a/test/experiment.cpp b/test/experiment.cpp index 14426e4c..dac51945 100644 --- a/test/experiment.cpp +++ b/test/experiment.cpp @@ -341,7 +341,7 @@ int main(){ int verbose_level = -1; int chunk_start = 0; int chunk_end = 0; -#define TEST_FILE "autotab.cpp" +#define TEST_FILE "junk.cpp" #define SINGLE_ITEM 0 int chunks = (chunk_start > 0 && chunk_start <= chunk_end); diff --git a/test/fsm_table_generator.cpp b/test/fsm_table_generator.cpp index 23b32bfa..fc207f0b 100644 --- a/test/fsm_table_generator.cpp +++ b/test/fsm_table_generator.cpp @@ -7,6 +7,21 @@ // TOP +/* TODO(allen): + +1. Reduce away states that only ever show up as terminal states. +2. Reduce away states that cannot ever be reached. +3. Output new enum that only includes the reduced states. +4. How to name these things so that we can deal with different + pp_states that want very similar fsm main states? + 4.a. Perhaps a lookup table to convert back to canonical enum + values after the fsm is finished? + +5. How can we eliminate S.tb for keywords?? They are too long for + building into an FSM table... (state,index,input) -> state ??? + +*/ + #include #include #include @@ -14,8 +29,317 @@ #define ArrayCount(a) (sizeof(a)/sizeof(*a)) +#include "../4cpp_lexer_types.h" #include "4cpp_lexer_fsms.h" +static String_And_Flag preprop_strings[] = { + {"include", CPP_PP_INCLUDE}, + {"INCLUDE", CPP_PP_INCLUDE}, + {"ifndef", CPP_PP_IFNDEF}, + {"IFNDEF", CPP_PP_IFNDEF}, + {"define", CPP_PP_DEFINE}, + {"DEFINE", CPP_PP_DEFINE}, + {"import", CPP_PP_IMPORT}, + {"IMPORT", CPP_PP_IMPORT}, + {"pragma", CPP_PP_PRAGMA}, + {"PRAGMA", CPP_PP_PRAGMA}, + {"undef", CPP_PP_UNDEF}, + {"UNDEF", CPP_PP_UNDEF}, + {"endif", CPP_PP_ENDIF}, + {"ENDIF", CPP_PP_ENDIF}, + {"error", CPP_PP_ERROR}, + {"ERROR", CPP_PP_ERROR}, + {"ifdef", CPP_PP_IFDEF}, + {"IFDEF", CPP_PP_IFDEF}, + {"using", CPP_PP_USING}, + {"USING", CPP_PP_USING}, + {"else", CPP_PP_ELSE}, + {"ELSE", CPP_PP_ELSE}, + {"elif", CPP_PP_ELIF}, + {"ELIF", CPP_PP_ELIF}, + {"line", CPP_PP_LINE}, + {"LINE", CPP_PP_LINE}, + {"if", CPP_PP_IF}, + {"IF", CPP_PP_IF}, +}; +static String_And_Flag keyword_strings[] = { + {"and", CPP_TOKEN_AND}, + {"and_eq", CPP_TOKEN_ANDEQ}, + {"bitand", CPP_TOKEN_BIT_AND}, + {"bitor", CPP_TOKEN_BIT_OR}, + {"or", CPP_TOKEN_OR}, + {"or_eq", CPP_TOKEN_OREQ}, + {"sizeof", CPP_TOKEN_SIZEOF}, + {"alignof", CPP_TOKEN_ALIGNOF}, + {"decltype", CPP_TOKEN_DECLTYPE}, + {"throw", CPP_TOKEN_THROW}, + {"new", CPP_TOKEN_NEW}, + {"delete", CPP_TOKEN_DELETE}, + {"xor", CPP_TOKEN_BIT_XOR}, + {"xor_eq", CPP_TOKEN_XOREQ}, + {"not", CPP_TOKEN_NOT}, + {"not_eq", CPP_TOKEN_NOTEQ}, + {"typeid", CPP_TOKEN_TYPEID}, + {"compl", CPP_TOKEN_BIT_NOT}, + + {"void", CPP_TOKEN_KEY_TYPE}, + {"bool", CPP_TOKEN_KEY_TYPE}, + {"char", CPP_TOKEN_KEY_TYPE}, + {"int", CPP_TOKEN_KEY_TYPE}, + {"float", CPP_TOKEN_KEY_TYPE}, + {"double", CPP_TOKEN_KEY_TYPE}, + + {"long", CPP_TOKEN_KEY_MODIFIER}, + {"short", CPP_TOKEN_KEY_MODIFIER}, + {"unsigned", CPP_TOKEN_KEY_MODIFIER}, + + {"const", CPP_TOKEN_KEY_QUALIFIER}, + {"volatile", CPP_TOKEN_KEY_QUALIFIER}, + + {"asm", CPP_TOKEN_KEY_CONTROL_FLOW}, + {"break", CPP_TOKEN_KEY_CONTROL_FLOW}, + {"case", CPP_TOKEN_KEY_CONTROL_FLOW}, + {"catch", CPP_TOKEN_KEY_CONTROL_FLOW}, + {"continue", CPP_TOKEN_KEY_CONTROL_FLOW}, + {"default", CPP_TOKEN_KEY_CONTROL_FLOW}, + {"do", CPP_TOKEN_KEY_CONTROL_FLOW}, + {"else", CPP_TOKEN_KEY_CONTROL_FLOW}, + {"for", CPP_TOKEN_KEY_CONTROL_FLOW}, + {"goto", CPP_TOKEN_KEY_CONTROL_FLOW}, + {"if", CPP_TOKEN_KEY_CONTROL_FLOW}, + {"return", CPP_TOKEN_KEY_CONTROL_FLOW}, + {"switch", CPP_TOKEN_KEY_CONTROL_FLOW}, + {"try", CPP_TOKEN_KEY_CONTROL_FLOW}, + {"while", CPP_TOKEN_KEY_CONTROL_FLOW}, + {"static_assert", CPP_TOKEN_KEY_CONTROL_FLOW}, + + {"const_cast", CPP_TOKEN_KEY_CAST}, + {"dynamic_cast", CPP_TOKEN_KEY_CAST}, + {"reinterpret_cast", CPP_TOKEN_KEY_CAST}, + {"static_cast", CPP_TOKEN_KEY_CAST}, + + {"class", CPP_TOKEN_KEY_TYPE_DECLARATION}, + {"enum", CPP_TOKEN_KEY_TYPE_DECLARATION}, + {"struct", CPP_TOKEN_KEY_TYPE_DECLARATION}, + {"typedef", CPP_TOKEN_KEY_TYPE_DECLARATION}, + {"union", CPP_TOKEN_KEY_TYPE_DECLARATION}, + {"template", CPP_TOKEN_KEY_TYPE_DECLARATION}, + {"typename", CPP_TOKEN_KEY_TYPE_DECLARATION}, + + {"friend", CPP_TOKEN_KEY_ACCESS}, + {"namespace", CPP_TOKEN_KEY_ACCESS}, + {"private", CPP_TOKEN_KEY_ACCESS}, + {"protected", CPP_TOKEN_KEY_ACCESS}, + {"public", CPP_TOKEN_KEY_ACCESS}, + {"using", CPP_TOKEN_KEY_ACCESS}, + + {"extern", CPP_TOKEN_KEY_LINKAGE}, + {"export", CPP_TOKEN_KEY_LINKAGE}, + {"inline", CPP_TOKEN_KEY_LINKAGE}, + {"static", CPP_TOKEN_KEY_LINKAGE}, + {"virtual", CPP_TOKEN_KEY_LINKAGE}, + + {"alignas", CPP_TOKEN_KEY_OTHER}, + {"explicit", CPP_TOKEN_KEY_OTHER}, + {"noexcept", CPP_TOKEN_KEY_OTHER}, + {"nullptr", CPP_TOKEN_KEY_OTHER}, + {"operator", CPP_TOKEN_KEY_OTHER}, + {"register", CPP_TOKEN_KEY_OTHER}, + {"this", CPP_TOKEN_KEY_OTHER}, + {"thread_local", CPP_TOKEN_KEY_OTHER}, +}; + +#define TerminalBase 200 + +struct FSM_State{ + unsigned char transition_rule[256]; +}; + +struct FSM{ + FSM_State *states; + unsigned short count, max; +}; + +struct Match_Node{ + Match_Node *first_child; + Match_Node *next_sibling; + + int *words; + int count, max; + int index; + + FSM_State *state; +}; + +struct Match_Tree{ + Match_Node *nodes; + int count, max; +}; + +Match_Node* +match_get_node(Match_Tree *tree){ + Match_Node *result; + assert(tree->count < tree->max); + result = &tree->nodes[tree->count++]; + return(result); +} + +void +match_init_node(Match_Node *node, int match_count){ + *node = {}; + node->words = (int*)malloc(sizeof(int)*match_count); + node->max = match_count; +} + +void +match_add_word(Match_Node *node, int word){ + assert(node->count < node->max); + node->words[node->count++] = word; +} + +FSM_State* +fsm_get_state(FSM *fsm){ + FSM_State *result; + unsigned short i; + assert(fsm->count < fsm->max); + result = &fsm->states[fsm->count++]; + for (i = 0; i < 256; ++i){ + result->transition_rule[i] = TerminalBase; + } + return(result); +} + +unsigned char +fsm_index(FSM *fsm, FSM_State *s){ + unsigned char result; + result = (unsigned char)(unsigned long long)(s - fsm->states); + return(result); +} + +void +fsm_add_transition(FSM_State *state, char c, unsigned char dest){ + state->transition_rule[c] = dest; +} + +struct Terminal_Lookup_Table{ + unsigned int state_to_type[60]; + unsigned char type_to_state[CPP_TOKEN_TYPE_COUNT]; + unsigned char state_count; +}; + +void +process_match_node(String_And_Flag *input, Match_Node *node, Match_Tree *tree, FSM *fsm, Terminal_Lookup_Table *terminal_table = 0){ + int next_index = node->index + 1; + int match_count = node->count; + FSM_State *this_state = node->state; + + int i, j, *words = node->words; + + String_And_Flag saf; + int l; + + char c; + Match_Node *next_nodes[256]; + Match_Node *newest_child = 0; + Match_Node *n; + int count = 0; + + unsigned char unjunkify = 0; + + memset(next_nodes, 0, sizeof(next_nodes)); + + for (i = 0; i < match_count; ++i){ + j = words[i]; + saf = input[j]; + l = (int)strlen(saf.str); + + if (next_index < l){ + c = saf.str[next_index]; + + if (next_nodes[c] == 0){ + next_nodes[c] = match_get_node(tree); + match_init_node(next_nodes[c], match_count); + next_nodes[c]->state = fsm_get_state(fsm); + next_nodes[c]->index = next_index; + if (newest_child == 0){ + assert(node->first_child == 0); + node->first_child = next_nodes[c]; + } + else{ + assert(newest_child->next_sibling == 0); + newest_child->next_sibling = next_nodes[c]; + } + newest_child = next_nodes[c]; + ++count; + } + + match_add_word(next_nodes[c], j); + fsm_add_transition(this_state, c, fsm_index(fsm, next_nodes[c]->state)); + } + else if (next_index == l){ + assert(unjunkify == 0); + if (terminal_table == 0){ + unjunkify = (unsigned char)saf.flags; + } + else{ + unjunkify = terminal_table->type_to_state[saf.flags]; + } + assert(unjunkify < 55); + } + } + + if (unjunkify){ + for (i = 0; i < 256; ++i){ + if (this_state->transition_rule[i] == TerminalBase){ + this_state->transition_rule[i] = TerminalBase + unjunkify; + } + } + } + + for (n = node->first_child; n; n = n->next_sibling){ + process_match_node(input, n, tree, fsm, terminal_table); + } +} + +FSM +generate_pp_directive_fsm(){ + Match_Tree tree; + Match_Node *root_node; + FSM fsm; + FSM_State *root_state; + int memsize; + + fsm.max = 200; + fsm.count = 0; + memsize = sizeof(FSM_State)*fsm.max; + fsm.states = (FSM_State*)malloc(memsize); + + tree.max = 200; + tree.count = 0; + memsize = sizeof(Match_Node)*tree.max; + tree.nodes = (Match_Node*)malloc(memsize); + + root_state = fsm_get_state(&fsm); + + root_node = match_get_node(&tree); + match_init_node(root_node, ArrayCount(preprop_strings)); + for (int i = 0; i < ArrayCount(preprop_strings); ++i){ + root_node->words[i] = i; + } + root_node->count = ArrayCount(preprop_strings); + root_node->state = root_state; + root_node->index = -1; + process_match_node(preprop_strings, root_node, &tree, &fsm); + + root_state->transition_rule[' '] = 0; + root_state->transition_rule['\t'] = 0; + root_state->transition_rule['\r'] = 0; + root_state->transition_rule['\v'] = 0; + root_state->transition_rule['\f'] = 0; + + return(fsm); +} + Whitespace_FSM whitespace_skip_fsm(Whitespace_FSM wfsm, char c){ if (wfsm.pp_state != LSPP_default){ @@ -165,7 +489,15 @@ main_fsm(Lex_FSM fsm, unsigned char pp_state, unsigned char c){ case '=': fsm.state = LS_eq; break; case '!': fsm.state = LS_bang; break; - case '#': fsm.state = LS_pound; break; + case '#': + if (pp_state == LSPP_default){ + fsm.state = LS_pp; + fsm.emit_token = 1; + } + else{ + fsm.state = LS_pound; + } + break; #define OperCase(op,type) case op: fsm.emit_token = 1; break; OperCase('{', CPP_TOKEN_BRACE_OPEN); @@ -196,29 +528,18 @@ main_fsm(Lex_FSM fsm, unsigned char pp_state, unsigned char c){ break; case LS_pound: - if (pp_state == LSPP_default){ - if (c == ' ' || c == '\t' || c == '\r' || c == '\f' || c == '\v'){ - fsm.state = LS_pound; - } - else if (c == '\n'){ - fsm.emit_token = 1; - } - else{ - fsm.state = LS_pp; - } - } - else{ - switch (c){ - case '#': fsm.emit_token = 1; break; - default: fsm.emit_token = 1; break; - } + switch (c){ + case '#': fsm.emit_token = 1; break; + default: fsm.emit_token = 1; break; } break; case LS_pp: +#if 0 if (!((c >= '0' && c <= '9') || (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || c == '_')){ fsm.emit_token = 1; } +#endif break; case LS_char: @@ -528,6 +849,16 @@ struct FSM_Tables{ unsigned short state_count; }; +void +allocate_full_tables(FSM_Tables *table, unsigned char state_count){ + table->full_transition_table = (unsigned char*)malloc(state_count * 256); + table->marks = (unsigned char*)malloc(state_count * 256); + table->eq_class = (unsigned char*)malloc(state_count * 256); + table->eq_class_rep = (unsigned char*)malloc(state_count * 256); + table->state_count = state_count; + memset(table->marks, 0, 256); +} + void do_table_reduction(FSM_Tables *table, unsigned short state_count){ { @@ -566,12 +897,7 @@ FSM_Tables generate_whitespace_skip_table(){ unsigned char state_count = LSPP_count; FSM_Tables table; - table.full_transition_table = (unsigned char*)malloc(state_count * 256); - table.marks = (unsigned char*)malloc(state_count * 256); - table.eq_class = (unsigned char*)malloc(state_count * 256); - table.eq_class_rep = (unsigned char*)malloc(state_count * 256); - table.state_count = state_count; - memset(table.marks, 0, 256); + allocate_full_tables(&table, state_count); int i = 0; Whitespace_FSM wfsm = {0}; @@ -594,12 +920,7 @@ FSM_Tables generate_int_table(){ unsigned char state_count = LSINT_count; FSM_Tables table; - table.full_transition_table = (unsigned char*)malloc(state_count * 256); - table.marks = (unsigned char*)malloc(state_count * 256); - table.eq_class = (unsigned char*)malloc(state_count * 256); - table.eq_class_rep = (unsigned char*)malloc(state_count * 256); - table.state_count = state_count; - memset(table.marks, 0, 256); + allocate_full_tables(&table, state_count); int i = 0; Lex_FSM fsm = {0}; @@ -622,12 +943,7 @@ FSM_Tables generate_fsm_table(unsigned char pp_state){ unsigned char state_count = LS_count; FSM_Tables table; - table.full_transition_table = (unsigned char*)malloc(state_count * 256); - table.marks = (unsigned char*)malloc(state_count * 256); - table.eq_class = (unsigned char*)malloc(state_count * 256); - table.eq_class_rep = (unsigned char*)malloc(state_count * 256); - table.state_count = state_count; - memset(table.marks, 0, 256); + allocate_full_tables(&table, state_count); int i = 0; Lex_FSM fsm = {0}; @@ -668,6 +984,11 @@ render_fsm_table(FILE *file, FSM_Tables tables, char *group_name){ end_table(file); } +void +render_variable(FILE *file, char *type, char *variable, unsigned int x){ + fprintf(file, "%s %s = %d;\n\n", type, variable, x); +} + struct PP_Names{ unsigned char pp_state; char *name; @@ -685,7 +1006,29 @@ PP_Names pp_names[] = { {LSPP_junk, "pp_junk_fsm"}, }; -int main(){ +FSM_Tables +generate_table_from_abstract_fsm(FSM fsm){ + unsigned char state_count = (unsigned char)fsm.count; + FSM_Tables table; + allocate_full_tables(&table, state_count); + + int i = 0; + unsigned char new_state; + for (unsigned short c = 0; c < 256; ++c){ + for (unsigned char state = 0; state < state_count; ++state){ + new_state = fsm.states[state].transition_rule[c]; + table.full_transition_table[i++] = new_state; + } + } + + do_table_reduction(&table, state_count); + + return(table); +} + + +int +main(){ FILE *file; file = fopen("4cpp_lexer_tables.c", "wb"); @@ -722,6 +1065,14 @@ int main(){ } end_table(file); + FSM pp_directive_fsm = generate_pp_directive_fsm(); + FSM_Tables pp_directive_tables = generate_table_from_abstract_fsm(pp_directive_fsm); + + render_fsm_table(file, pp_directive_tables, "pp_directive"); + render_variable(file, "unsigned char", "LSDIR_default", 0); + render_variable(file, "unsigned char", "LSDIR_count", pp_directive_fsm.count); + render_variable(file, "unsigned char", "pp_directive_terminal_base", TerminalBase); + fclose(file); return(0); } diff --git a/win32_4ed.cpp b/win32_4ed.cpp index 72a441f3..377c9dad 100644 --- a/win32_4ed.cpp +++ b/win32_4ed.cpp @@ -1444,7 +1444,7 @@ Win32Callback(HWND hwnd, UINT uMsg, } Font_Load_Parameters *params = win32vars.fnt.params + lParam; - i32 oversample = DpiMultiplier(2, win32vars.target.dpi); + i32 oversample = 2; for (b32 success = 0; success == 0;){ success = draw_font_load(win32vars.fnt.part.base,