diff --git a/custom/4coder_config.cpp b/custom/4coder_config.cpp index 3b5f429d..b013bb91 100644 --- a/custom/4coder_config.cpp +++ b/custom/4coder_config.cpp @@ -34,6 +34,32 @@ parse_extension_line_to_extension_list(Application_Links *app, //////////////////////////////// +function void +setup_built_in_mapping(Application_Links *app, String_Const_u8 name, Mapping *mapping, i64 global_id, i64 file_id, i64 code_id){ + Thread_Context *tctx = get_thread_context(app); + if (string_match(name, string_u8_litexpr("default"))){ + mapping_release(tctx, mapping); + mapping_init(tctx, mapping); + setup_default_mapping(mapping, global_id, file_id, code_id); + } + else if (string_match(name, string_u8_litexpr("mac-default"))){ + mapping_release(tctx, mapping); + mapping_init(tctx, mapping); + setup_mac_mapping(mapping, global_id, file_id, code_id); + } + else if (string_match(name, string_u8_litexpr("choose"))){ + mapping_release(tctx, mapping); + mapping_init(tctx, mapping); +#if OS_MAC + setup_mac_mapping(mapping, global_id, file_id, code_id); +#else + setup_default_mapping(mapping, global_id, file_id, code_id); +#endif + } +} + +//////////////////////////////// + function Error_Location get_error_location(Application_Links *app, u8 *base, u8 *pos){ ProfileScope(app, "get error location"); diff --git a/custom/4coder_default_bindings.cpp b/custom/4coder_default_bindings.cpp index d4e34071..a2c2866c 100644 --- a/custom/4coder_default_bindings.cpp +++ b/custom/4coder_default_bindings.cpp @@ -11,8 +11,6 @@ // NOTE(allen): Users can declare their own managed IDs here. -#include "4coder_default_map.cpp" -#include "4coder_mac_map.cpp" #include "generated/managed_id_metadata.cpp" void @@ -34,30 +32,6 @@ custom_layer_init(Application_Links *app){ setup_default_mapping(&framework_mapping, mapid_global, mapid_file, mapid_code); } -function void -setup_built_in_mapping(Application_Links *app, String_Const_u8 name, Mapping *mapping, i64 global_id, i64 file_id, i64 code_id){ - Thread_Context *tctx = get_thread_context(app); - if (string_match(name, string_u8_litexpr("default"))){ - mapping_release(tctx, mapping); - mapping_init(tctx, mapping); - setup_default_mapping(mapping, global_id, file_id, code_id); - } - else if (string_match(name, string_u8_litexpr("mac-default"))){ - mapping_release(tctx, mapping); - mapping_init(tctx, mapping); - setup_mac_mapping(mapping, global_id, file_id, code_id); - } - else if (string_match(name, string_u8_litexpr("choose"))){ - mapping_release(tctx, mapping); - mapping_init(tctx, mapping); -#if OS_MAC - setup_mac_mapping(mapping, global_id, file_id, code_id); -#else - setup_default_mapping(mapping, global_id, file_id, code_id); -#endif - } -} - #endif //FCODER_DEFAULT_BINDINGS // BOTTOM diff --git a/custom/4coder_default_framework.h b/custom/4coder_default_framework.h index be49d9c7..b1daa3e2 100644 --- a/custom/4coder_default_framework.h +++ b/custom/4coder_default_framework.h @@ -114,11 +114,6 @@ struct Fade_Range_List{ i32 count; }; -//////////////////////////////// - -function void -setup_built_in_mapping(Application_Links *app, String_Const_u8 name, Mapping *mapping, i64 global_id, i64 file_id, i64 code_id); - #endif // BOTTOM diff --git a/custom/4coder_default_include.cpp b/custom/4coder_default_include.cpp index 51ee72b2..063567c6 100644 --- a/custom/4coder_default_include.cpp +++ b/custom/4coder_default_include.cpp @@ -78,6 +78,8 @@ #include "4coder_token.cpp" #include "generated/lexer_cpp.cpp" #include "4coder_command_map.cpp" +#include "4coder_default_map.cpp" +#include "4coder_mac_map.cpp" #include "4coder_default_framework_variables.cpp" #include "4coder_default_colors.cpp" #include "4coder_helper.cpp"