Cleaning up the project code more
parent
a8b25adafe
commit
b703a512d7
|
@ -173,7 +173,7 @@ CUSTOM_DOC("Looks for a build.bat, build.sh, or makefile in the current and pare
|
|||
View_Summary view = get_active_view(app, access);
|
||||
Buffer_Summary buffer = get_buffer(app, view.buffer_id, access);
|
||||
execute_standard_build(app, &view, &buffer);
|
||||
prev_location = null_location;
|
||||
memset(&prev_location, 0, sizeof(prev_location));
|
||||
lock_jump_buffer(literal("*compilation*"));
|
||||
}
|
||||
|
||||
|
@ -212,7 +212,7 @@ CUSTOM_DOC("Looks for a build.bat, build.sh, or makefile in the current and pare
|
|||
execute_standard_build(app, &build_view, &buffer);
|
||||
set_fancy_compilation_buffer_font(app);
|
||||
|
||||
prev_location = null_location;
|
||||
memset(&prev_location, 0, sizeof(prev_location));
|
||||
lock_jump_buffer(literal("*compilation*"));
|
||||
}
|
||||
|
||||
|
|
|
@ -248,94 +248,6 @@ CUSTOM_DOC("Toggle fullscreen mode on or off. The change(s) do not take effect
|
|||
}
|
||||
|
||||
|
||||
//
|
||||
// Projects
|
||||
//
|
||||
|
||||
static char *default_extensions[] = {
|
||||
"cpp",
|
||||
"hpp",
|
||||
"c",
|
||||
"h",
|
||||
"cc",
|
||||
"cs"
|
||||
};
|
||||
|
||||
struct Extension_List{
|
||||
char extension_space[256];
|
||||
char *extensions[94];
|
||||
int32_t extension_count;
|
||||
};
|
||||
|
||||
static void
|
||||
set_extensions(Extension_List *extension_list, String src){
|
||||
int32_t mode = 0;
|
||||
int32_t j = 0, k = 0;
|
||||
for (int32_t i = 0; i < src.size; ++i){
|
||||
switch (mode){
|
||||
case 0:
|
||||
{
|
||||
if (src.str[i] == '.'){
|
||||
mode = 1;
|
||||
extension_list->extensions[k++] = &extension_list->extension_space[j];
|
||||
}
|
||||
}break;
|
||||
|
||||
case 1:
|
||||
{
|
||||
if (src.str[i] == '.'){
|
||||
extension_list->extension_space[j++] = 0;
|
||||
extension_list->extensions[k++] = &extension_list->extension_space[j];
|
||||
}
|
||||
else{
|
||||
extension_list->extension_space[j++] = src.str[i];
|
||||
}
|
||||
}break;
|
||||
}
|
||||
}
|
||||
extension_list->extension_space[j++] = 0;
|
||||
extension_list->extension_count = k;
|
||||
}
|
||||
|
||||
struct Fkey_Command{
|
||||
char command[128];
|
||||
char out[128];
|
||||
bool32 use_build_panel;
|
||||
bool32 save_dirty_buffers;
|
||||
};
|
||||
|
||||
struct Project{
|
||||
char dir_space[256];
|
||||
char *dir;
|
||||
int32_t dir_len;
|
||||
|
||||
Extension_List extension_list;
|
||||
Fkey_Command fkey_commands[16];
|
||||
|
||||
bool32 close_all_code_when_this_project_closes;
|
||||
bool32 close_all_files_when_project_opens;
|
||||
|
||||
bool32 open_recursively;
|
||||
|
||||
bool32 loaded;
|
||||
};
|
||||
|
||||
static Project null_project = {0};
|
||||
static Project current_project = {0};
|
||||
|
||||
static char**
|
||||
get_current_project_extensions(int32_t *extension_count_out){
|
||||
char **extension_list = default_extensions;
|
||||
int32_t extension_count = ArrayCount(default_extensions);
|
||||
if (current_project.dir != 0){
|
||||
extension_list = current_project.extension_list.extensions;
|
||||
extension_count = current_project.extension_list.extension_count;
|
||||
}
|
||||
*extension_count_out = extension_count;
|
||||
return(extension_list);
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// Location Jumping State
|
||||
//
|
||||
|
@ -346,7 +258,6 @@ struct ID_Based_Jump_Location{
|
|||
int32_t column;
|
||||
};
|
||||
|
||||
static ID_Based_Jump_Location null_location = {0};
|
||||
static ID_Based_Jump_Location prev_location = {0};
|
||||
|
||||
|
||||
|
@ -776,8 +687,6 @@ static String default_font_name = make_fixed_width_string(default_font_name_spac
|
|||
static char user_name_space[256] = {0};
|
||||
static String user_name = make_fixed_width_string(user_name_space);
|
||||
|
||||
static Extension_List treat_as_code_exts = {0};
|
||||
|
||||
static bool32 automatically_load_project = false;
|
||||
|
||||
static char default_compiler_bat_space[256];
|
||||
|
@ -805,7 +714,7 @@ get_current_name(char **name_out, int32_t *len_out){
|
|||
}
|
||||
|
||||
static String
|
||||
get_default_theme_name(){
|
||||
get_default_theme_name(void){
|
||||
String str = default_theme_name;
|
||||
if (str.size == 0){
|
||||
str = make_lit_string("4coder");
|
||||
|
@ -814,7 +723,7 @@ get_default_theme_name(){
|
|||
}
|
||||
|
||||
static String
|
||||
get_default_font_name(){
|
||||
get_default_font_name(void){
|
||||
String str = default_font_name;
|
||||
if (str.size == 0){
|
||||
str = make_lit_string("Liberation Mono");
|
||||
|
@ -822,47 +731,259 @@ get_default_font_name(){
|
|||
return(str);
|
||||
}
|
||||
|
||||
static char**
|
||||
get_current_code_extensions(int32_t *extension_count_out){
|
||||
char **extension_list = default_extensions;
|
||||
int32_t extension_count = ArrayCount(default_extensions);
|
||||
if (treat_as_code_exts.extension_count != 0){
|
||||
extension_list = treat_as_code_exts.extensions;
|
||||
extension_count = treat_as_code_exts.extension_count;
|
||||
struct Extension_List{
|
||||
char space[256];
|
||||
char *exts[94];
|
||||
int32_t count;
|
||||
};
|
||||
|
||||
struct CString_Array{
|
||||
char **strings;
|
||||
int32_t count;
|
||||
};
|
||||
|
||||
static char *default_extensions[] = {
|
||||
"cpp",
|
||||
"hpp",
|
||||
"c",
|
||||
"h",
|
||||
"cc",
|
||||
"cs",
|
||||
};
|
||||
|
||||
static Extension_List treat_as_code_exts = {0};
|
||||
|
||||
static CString_Array
|
||||
get_code_extensions(Extension_List *list){
|
||||
CString_Array array = {0};
|
||||
array.strings = default_extensions;
|
||||
array.count = ArrayCount(default_extensions);
|
||||
if (list->count != 0){
|
||||
array.strings = list->exts;
|
||||
array.count = list->count;
|
||||
}
|
||||
*extension_count_out = extension_count;
|
||||
return(extension_list);
|
||||
return(array);
|
||||
}
|
||||
|
||||
static void
|
||||
parse_extension_line_to_extension_list(String str, Extension_List *list){
|
||||
int32_t mode = 0;
|
||||
int32_t j = 0, k = 0;
|
||||
for (int32_t i = 0; i < str.size; ++i){
|
||||
switch (mode){
|
||||
case 0:
|
||||
{
|
||||
if (str.str[i] == '.'){
|
||||
mode = 1;
|
||||
list->exts[k++] = &list->space[j];
|
||||
}
|
||||
}break;
|
||||
|
||||
case 1:
|
||||
{
|
||||
if (str.str[i] == '.'){
|
||||
list->space[j++] = 0;
|
||||
list->exts[k++] = &list->space[j];
|
||||
}
|
||||
else{
|
||||
list->space[j++] = str.str[i];
|
||||
}
|
||||
}break;
|
||||
}
|
||||
}
|
||||
list->space[j++] = 0;
|
||||
list->count = k;
|
||||
}
|
||||
|
||||
// TODO(allen): Stop handling files this way! My own API should be able to do this!!?!?!?!!?!?!!!!?
|
||||
// NOTE(allen): Actually need binary buffers for some stuff to work, but not this parsing thing here.
|
||||
#include <stdio.h>
|
||||
|
||||
static bool32
|
||||
file_handle_dump(Partition *part, FILE *file, char **mem_ptr, int32_t *size_ptr){
|
||||
bool32 success = 0;
|
||||
static String
|
||||
dump_file_handle(Partition *arena, FILE *file){
|
||||
String str = {0};
|
||||
if (file != 0){
|
||||
fseek(file, 0, SEEK_END);
|
||||
int32_t size = ftell(file);
|
||||
char *mem = push_array(arena, char, size + 1);
|
||||
push_align(arena, 8);
|
||||
if (mem != 0){
|
||||
fseek(file, 0, SEEK_SET);
|
||||
fread(mem, 1, size, file);
|
||||
mem[size] = 0;
|
||||
str = make_string_cap(mem, size, size + 1);
|
||||
}
|
||||
}
|
||||
return(str);
|
||||
}
|
||||
|
||||
static FILE*
|
||||
open_file_search_up_path(Partition *scratch, String path, String file_name){
|
||||
Temp_Memory temp = begin_temp_memory(scratch);
|
||||
|
||||
fseek(file, 0, SEEK_END);
|
||||
int32_t size = ftell(file);
|
||||
char *mem = (char*)push_block(part, size+1);
|
||||
fseek(file, 0, SEEK_SET);
|
||||
int32_t check_size = (int32_t)fread(mem, 1, size, file);
|
||||
if (check_size == size){
|
||||
mem[size] = 0;
|
||||
success = 1;
|
||||
int32_t cap = path.size + file_name.size + 2;
|
||||
char *space = push_array(scratch, char, cap);
|
||||
String name_str = make_string_cap(space, 0, cap);
|
||||
append(&name_str, path);
|
||||
if (name_str.size == 0 || !char_is_slash(name_str.str[name_str.size - 1])){
|
||||
append(&name_str, "/");
|
||||
}
|
||||
|
||||
*mem_ptr = mem;
|
||||
*size_ptr = size;
|
||||
FILE *file = 0;
|
||||
for (;;){
|
||||
int32_t base_size = name_str.size;
|
||||
append(&name_str, file_name);
|
||||
terminate_with_null(&name_str);
|
||||
file = fopen(name_str.str, "rb");
|
||||
if (file != 0){
|
||||
break;
|
||||
}
|
||||
|
||||
name_str.size = base_size;
|
||||
remove_last_folder(&name_str);
|
||||
if (name_str.size >= base_size){
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return(success);
|
||||
end_temp_memory(temp);
|
||||
return(file);
|
||||
}
|
||||
|
||||
static char*
|
||||
get_null_terminated(Partition *scratch, String name){
|
||||
char *name_terminated = 0;
|
||||
if (name.size < name.memory_size){
|
||||
terminate_with_null(&name);
|
||||
name_terminated = name.str;
|
||||
}
|
||||
else{
|
||||
name_terminated = push_array(scratch, char, name.size + 1);
|
||||
if (name_terminated != 0){
|
||||
memcpy(name_terminated, name.str, name.size);
|
||||
name_terminated[name.size] = 0;
|
||||
}
|
||||
}
|
||||
return(name_terminated);
|
||||
}
|
||||
|
||||
static FILE*
|
||||
open_file(Partition *scratch, String name){
|
||||
FILE *file = 0;
|
||||
Temp_Memory temp = begin_temp_memory(scratch);
|
||||
char *name_terminated = get_null_terminated(scratch, name);
|
||||
if (name_terminated != 0){
|
||||
file = fopen(name_terminated, "rb");
|
||||
}
|
||||
end_temp_memory(temp);
|
||||
return(file);
|
||||
}
|
||||
|
||||
static String
|
||||
dump_file(Partition *arena, String name){
|
||||
String result = {0};
|
||||
FILE *file = open_file(arena, name);
|
||||
if (file != 0){
|
||||
result = dump_file_handle(arena, file);
|
||||
fclose(file);
|
||||
}
|
||||
return(result);
|
||||
}
|
||||
|
||||
static String
|
||||
dump_file_search_up_path(Partition *arena, String path, String file_name){
|
||||
String result = {0};
|
||||
FILE *file = open_file_search_up_path(arena, path, file_name);
|
||||
if (file != 0){
|
||||
result = dump_file_handle(arena, file);
|
||||
fclose(file);
|
||||
}
|
||||
return(result);
|
||||
}
|
||||
|
||||
///////////////////////////////
|
||||
|
||||
static void
|
||||
process_config_data(Application_Links *app, Partition *scratch, String data){
|
||||
|
||||
Cpp_Token_Array array = {0};
|
||||
array.count = 0;
|
||||
array.max_count = (1 << 20)/sizeof(Cpp_Token);
|
||||
array.tokens = push_array(scratch, Cpp_Token, array.max_count);
|
||||
|
||||
if (array.tokens != 0){
|
||||
Cpp_Keyword_Table kw_table = {0};
|
||||
Cpp_Keyword_Table pp_table = {0};
|
||||
lexer_keywords_default_init(scratch, &kw_table, &pp_table);
|
||||
|
||||
Cpp_Lex_Data S = cpp_lex_data_init(false, kw_table, pp_table);
|
||||
Cpp_Lex_Result result = cpp_lex_step(&S, data.str, data.size + 1, HAS_NULL_TERM, &array, NO_OUT_LIMIT);
|
||||
|
||||
if (result == LexResult_Finished){
|
||||
int32_t new_wrap_width = default_wrap_width;
|
||||
int32_t new_min_base_width = default_min_base_width;
|
||||
bool32 lalt_lctrl_is_altgr = false;
|
||||
|
||||
for (int32_t i = 0; i < array.count; ++i){
|
||||
Config_Line config_line = read_config_line(array, &i, data.str);
|
||||
|
||||
if (config_line.read_success){
|
||||
Config_Item item = get_config_item(config_line, data.str, array);
|
||||
|
||||
config_bool_var(item, "enable_code_wrapping", 0, &enable_code_wrapping);
|
||||
config_bool_var(item, "automatically_adjust_wrapping", 0, &automatically_adjust_wrapping);
|
||||
config_bool_var(item, "automatically_indent_text_on_save", 0, &automatically_indent_text_on_save);
|
||||
config_bool_var(item, "automatically_save_changes_on_build", 0, &automatically_save_changes_on_build);
|
||||
|
||||
config_int_var(item, "default_wrap_width", 0, &new_wrap_width);
|
||||
config_int_var(item, "default_min_base_width", 0, &new_min_base_width);
|
||||
|
||||
config_string_var(item, "default_theme_name", 0, &default_theme_name);
|
||||
config_string_var(item, "default_font_name", 0, &default_font_name);
|
||||
config_string_var(item, "user_name", 0, &user_name);
|
||||
|
||||
config_string_var(item, "default_compiler_bat", 0, &default_compiler_bat);
|
||||
config_string_var(item, "default_flags_bat", 0, &default_flags_bat);
|
||||
config_string_var(item, "default_compiler_sh", 0, &default_compiler_sh);
|
||||
config_string_var(item, "default_flags_sh", 0, &default_flags_sh);
|
||||
|
||||
char str_space[512];
|
||||
String str = make_fixed_width_string(str_space);
|
||||
if (config_string_var(item, "mapping", 0, &str)){
|
||||
change_mapping(app, str);
|
||||
}
|
||||
|
||||
if (config_string_var(item, "treat_as_code", 0, &str)){
|
||||
parse_extension_line_to_extension_list(str, &treat_as_code_exts);
|
||||
}
|
||||
|
||||
config_bool_var(item, "automatically_load_project", 0, &automatically_load_project);
|
||||
|
||||
config_bool_var(item, "lalt_lctrl_is_altgr", 0, &lalt_lctrl_is_altgr);
|
||||
}
|
||||
else if (config_line.error_str.str != 0){
|
||||
char space[2048];
|
||||
String str = make_fixed_width_string(space);
|
||||
copy(&str, "WARNING: bad syntax in 4coder.config at ");
|
||||
append(&str, config_line.error_str);
|
||||
append(&str, "\n");
|
||||
print_message(app, str.str, str.size);
|
||||
}
|
||||
}
|
||||
|
||||
adjust_all_buffer_wrap_widths(app, new_wrap_width, new_min_base_width);
|
||||
default_wrap_width = new_wrap_width;
|
||||
default_min_base_width = new_min_base_width;
|
||||
global_set_setting(app, GlobalSetting_LAltLCtrlIsAltGr, lalt_lctrl_is_altgr);
|
||||
}
|
||||
}
|
||||
else{
|
||||
print_message(app, literal("Ran out of memory processing config.4coder\n"));
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
process_config_file(Application_Links *app){
|
||||
Partition *part = &global_part;
|
||||
FILE *file = fopen("config.4coder", "rb");
|
||||
|
||||
static bool32 has_initialized = false;
|
||||
if (!has_initialized){
|
||||
has_initialized = true;
|
||||
|
@ -872,6 +993,9 @@ process_config_file(Application_Links *app){
|
|||
copy(&default_flags_bat, "");
|
||||
}
|
||||
|
||||
Partition *part = &global_part;
|
||||
FILE *file = fopen("config.4coder", "rb");
|
||||
|
||||
if (file == 0){
|
||||
char space[256];
|
||||
int32_t size = get_4ed_path(app, space, sizeof(space));
|
||||
|
@ -884,91 +1008,12 @@ process_config_file(Application_Links *app){
|
|||
|
||||
if (file != 0){
|
||||
Temp_Memory temp = begin_temp_memory(part);
|
||||
|
||||
char *mem = 0;
|
||||
int32_t size = 0;
|
||||
bool32 file_read_success = file_handle_dump(part, file, &mem, &size);
|
||||
|
||||
if (file_read_success){
|
||||
fclose(file);
|
||||
|
||||
Cpp_Token_Array array = {0};
|
||||
array.count = 0;
|
||||
array.max_count = (1 << 20)/sizeof(Cpp_Token);
|
||||
array.tokens = push_array(part, Cpp_Token, array.max_count);
|
||||
|
||||
if (array.tokens != 0){
|
||||
Cpp_Keyword_Table kw_table = {0};
|
||||
Cpp_Keyword_Table pp_table = {0};
|
||||
lexer_keywords_default_init(part, &kw_table, &pp_table);
|
||||
|
||||
Cpp_Lex_Data S = cpp_lex_data_init(false, kw_table, pp_table);
|
||||
Cpp_Lex_Result result = cpp_lex_step(&S, mem, size + 1, HAS_NULL_TERM, &array, NO_OUT_LIMIT);
|
||||
|
||||
if (result == LexResult_Finished){
|
||||
int32_t new_wrap_width = default_wrap_width;
|
||||
int32_t new_min_base_width = default_min_base_width;
|
||||
bool32 lalt_lctrl_is_altgr = false;
|
||||
|
||||
for (int32_t i = 0; i < array.count; ++i){
|
||||
Config_Line config_line = read_config_line(array, &i, mem);
|
||||
|
||||
if (config_line.read_success){
|
||||
Config_Item item = get_config_item(config_line, mem, array);
|
||||
|
||||
config_bool_var(item, "enable_code_wrapping", 0, &enable_code_wrapping);
|
||||
config_bool_var(item, "automatically_adjust_wrapping", 0, &automatically_adjust_wrapping);
|
||||
config_bool_var(item, "automatically_indent_text_on_save", 0, &automatically_indent_text_on_save);
|
||||
config_bool_var(item, "automatically_save_changes_on_build", 0, &automatically_save_changes_on_build);
|
||||
|
||||
config_int_var(item, "default_wrap_width", 0, &new_wrap_width);
|
||||
config_int_var(item, "default_min_base_width", 0, &new_min_base_width);
|
||||
|
||||
config_string_var(item, "default_theme_name", 0, &default_theme_name);
|
||||
config_string_var(item, "default_font_name", 0, &default_font_name);
|
||||
config_string_var(item, "user_name", 0, &user_name);
|
||||
|
||||
config_string_var(item, "default_compiler_bat", 0, &default_compiler_bat);
|
||||
config_string_var(item, "default_flags_bat", 0, &default_flags_bat);
|
||||
config_string_var(item, "default_compiler_sh", 0, &default_compiler_sh);
|
||||
config_string_var(item, "default_flags_sh", 0, &default_flags_sh);
|
||||
|
||||
char str_space[512];
|
||||
String str = make_fixed_width_string(str_space);
|
||||
if (config_string_var(item, "mapping", 0, &str)){
|
||||
change_mapping(app, str);
|
||||
}
|
||||
|
||||
if (config_string_var(item, "treat_as_code", 0, &str)){
|
||||
set_extensions(&treat_as_code_exts, str);
|
||||
}
|
||||
|
||||
config_bool_var(item, "automatically_load_project", 0, &automatically_load_project);
|
||||
|
||||
config_bool_var(item, "lalt_lctrl_is_altgr", 0, &lalt_lctrl_is_altgr);
|
||||
}
|
||||
else if (config_line.error_str.str != 0){
|
||||
char space[2048];
|
||||
String str = make_fixed_width_string(space);
|
||||
copy(&str, "WARNING: bad syntax in 4coder.config at ");
|
||||
append(&str, config_line.error_str);
|
||||
append(&str, "\n");
|
||||
print_message(app, str.str, str.size);
|
||||
}
|
||||
}
|
||||
|
||||
adjust_all_buffer_wrap_widths(app, new_wrap_width, new_min_base_width);
|
||||
default_wrap_width = new_wrap_width;
|
||||
default_min_base_width = new_min_base_width;
|
||||
global_set_setting(app, GlobalSetting_LAltLCtrlIsAltGr, lalt_lctrl_is_altgr);
|
||||
}
|
||||
}
|
||||
else{
|
||||
print_message(app, literal("Ran out of memory processing config.4coder\n"));
|
||||
}
|
||||
String data = dump_file_handle(part, file);
|
||||
if (data.str != 0){
|
||||
process_config_data(app, part, data);
|
||||
}
|
||||
|
||||
end_temp_memory(temp);
|
||||
fclose(file);
|
||||
}
|
||||
else{
|
||||
print_message(app, literal("Did not find config.4coder, using default settings\n"));
|
||||
|
@ -979,12 +1024,85 @@ process_config_file(Application_Links *app){
|
|||
// Color Theme
|
||||
//
|
||||
|
||||
static bool32
|
||||
load_color_theme_data(Application_Links *app, Partition *scratch,
|
||||
char *file_name, String data){
|
||||
bool32 success = false;
|
||||
|
||||
Cpp_Token_Array array;
|
||||
array.count = 0;
|
||||
array.max_count = (1 << 20)/sizeof(Cpp_Token);
|
||||
array.tokens = push_array(scratch, Cpp_Token, array.max_count);
|
||||
|
||||
Cpp_Keyword_Table kw_table = {0};
|
||||
Cpp_Keyword_Table pp_table = {0};
|
||||
lexer_keywords_default_init(scratch, &kw_table, &pp_table);
|
||||
|
||||
Cpp_Lex_Data S = cpp_lex_data_init(false, kw_table, pp_table);
|
||||
Cpp_Lex_Result result = cpp_lex_step(&S, data.str, data.size + 1, HAS_NULL_TERM, &array, NO_OUT_LIMIT);
|
||||
|
||||
if (result == LexResult_Finished){
|
||||
success = true;
|
||||
|
||||
char name_space[512];
|
||||
String name_str = make_fixed_width_string(name_space);
|
||||
Theme theme;
|
||||
init_theme_zero(&theme);
|
||||
|
||||
for (int32_t i = 0; i < array.count; ++i){
|
||||
Config_Line config_line = read_config_line(array, &i, data.str);
|
||||
if (config_line.read_success){
|
||||
Config_Item item = get_config_item(config_line, data.str, array);
|
||||
config_string_var(item, "name", 0, &name_str);
|
||||
|
||||
for (int32_t tag = 0; tag < ArrayCount(style_tag_names); ++tag){
|
||||
char *name = style_tag_names[tag];
|
||||
int_color color = 0;
|
||||
if (config_uint_var(item, name, 0, &color)){
|
||||
int_color *color_slot = &theme.colors[tag];
|
||||
*color_slot = color;
|
||||
}
|
||||
else{
|
||||
char var_space[512];
|
||||
String var_str = make_fixed_width_string(var_space);
|
||||
if (config_identifier_var(item, name, 0, &var_str)){
|
||||
for (int32_t eq_tag = 0; eq_tag < ArrayCount(style_tag_names); ++eq_tag){
|
||||
if (match(var_str, style_tag_names[eq_tag])){
|
||||
int_color *color_slot = &theme.colors[tag];
|
||||
*color_slot = theme.colors[eq_tag];
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (config_line.error_str.str != 0){
|
||||
char space[2048];
|
||||
String str = make_fixed_width_string(space);
|
||||
copy(&str, "WARNING: bad syntax in 4coder.config at ");
|
||||
append(&str, config_line.error_str);
|
||||
append(&str, "\n");
|
||||
print_message(app, str.str, str.size);
|
||||
}
|
||||
}
|
||||
|
||||
if (name_str.size == 0){
|
||||
copy(&name_str, file_name);
|
||||
}
|
||||
|
||||
create_theme(app, &theme, name_str.str, name_str.size);
|
||||
}
|
||||
|
||||
return(success);
|
||||
}
|
||||
|
||||
static void
|
||||
load_color_theme_file(Application_Links *app, char *file_name){
|
||||
Partition *part = &global_part;
|
||||
FILE *file = fopen(file_name, "rb");
|
||||
|
||||
if (!file){
|
||||
if (file == 0){
|
||||
char space[256];
|
||||
int32_t size = get_4ed_path(app, space, sizeof(space));
|
||||
String str = make_string_cap(space, size, sizeof(space));
|
||||
|
@ -996,80 +1114,13 @@ load_color_theme_file(Application_Links *app, char *file_name){
|
|||
|
||||
if (file != 0){
|
||||
Temp_Memory temp = begin_temp_memory(part);
|
||||
|
||||
char *mem = 0;
|
||||
int32_t size = 0;
|
||||
bool32 file_read_success = file_handle_dump(part, file, &mem, &size);
|
||||
fclose(file);
|
||||
String data = dump_file_handle(part, file);
|
||||
bool32 success = false;
|
||||
|
||||
if (file_read_success){
|
||||
Cpp_Token_Array array;
|
||||
array.count = 0;
|
||||
array.max_count = (1 << 20)/sizeof(Cpp_Token);
|
||||
array.tokens = push_array(&global_part, Cpp_Token, array.max_count);
|
||||
|
||||
Cpp_Keyword_Table kw_table = {0};
|
||||
Cpp_Keyword_Table pp_table = {0};
|
||||
lexer_keywords_default_init(part, &kw_table, &pp_table);
|
||||
|
||||
Cpp_Lex_Data S = cpp_lex_data_init(false, kw_table, pp_table);
|
||||
Cpp_Lex_Result result = cpp_lex_step(&S, mem, size + 1, HAS_NULL_TERM, &array, NO_OUT_LIMIT);
|
||||
|
||||
if (result == LexResult_Finished){
|
||||
success = true;
|
||||
|
||||
char name_space[512];
|
||||
String name_str = make_fixed_width_string(name_space);
|
||||
Theme theme;
|
||||
init_theme_zero(&theme);
|
||||
|
||||
for (int32_t i = 0; i < array.count; ++i){
|
||||
Config_Line config_line = read_config_line(array, &i, mem);
|
||||
if (config_line.read_success){
|
||||
Config_Item item = get_config_item(config_line, mem, array);
|
||||
config_string_var(item, "name", 0, &name_str);
|
||||
|
||||
for (int32_t tag = 0; tag < ArrayCount(style_tag_names); ++tag){
|
||||
char *name = style_tag_names[tag];
|
||||
int_color color = 0;
|
||||
if (config_uint_var(item, name, 0, &color)){
|
||||
int_color *color_slot = &theme.colors[tag];
|
||||
*color_slot = color;
|
||||
}
|
||||
else{
|
||||
char var_space[512];
|
||||
String var_str = make_fixed_width_string(var_space);
|
||||
if (config_identifier_var(item, name, 0, &var_str)){
|
||||
for (int32_t eq_tag = 0; eq_tag < ArrayCount(style_tag_names); ++eq_tag){
|
||||
if (match(var_str, style_tag_names[eq_tag])){
|
||||
int_color *color_slot = &theme.colors[tag];
|
||||
*color_slot = theme.colors[eq_tag];
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (config_line.error_str.str != 0){
|
||||
char space[2048];
|
||||
String str = make_fixed_width_string(space);
|
||||
copy(&str, "WARNING: bad syntax in 4coder.config at ");
|
||||
append(&str, config_line.error_str);
|
||||
append(&str, "\n");
|
||||
print_message(app, str.str, str.size);
|
||||
}
|
||||
}
|
||||
|
||||
if (name_str.size == 0){
|
||||
copy(&name_str, file_name);
|
||||
}
|
||||
|
||||
create_theme(app, &theme, name_str.str, name_str.size);
|
||||
}
|
||||
if (data.str != 0){
|
||||
success = load_color_theme_data(app, part, file_name, data);
|
||||
}
|
||||
end_temp_memory(temp);
|
||||
fclose(file);
|
||||
|
||||
if (!success){
|
||||
char space[256];
|
||||
|
|
|
@ -205,16 +205,15 @@ OPEN_FILE_HOOK_SIG(default_file_settings){
|
|||
bool32 wrap_lines = true;
|
||||
bool32 lex_without_strings = false;
|
||||
|
||||
int32_t extension_count = 0;
|
||||
char **extension_list = get_current_code_extensions(&extension_count);
|
||||
CString_Array extensions = get_code_extensions(&treat_as_code_exts);
|
||||
|
||||
Parse_Context_ID parse_context_id = 0;
|
||||
|
||||
if (buffer.file_name != 0 && buffer.size < (16 << 20)){
|
||||
String name = make_string(buffer.file_name, buffer.file_name_len);
|
||||
String ext = file_extension(name);
|
||||
for (int32_t i = 0; i < extension_count; ++i){
|
||||
if (match(ext, extension_list[i])){
|
||||
for (int32_t i = 0; i < extensions.count; ++i){
|
||||
if (match(ext, extensions.strings[i])){
|
||||
treat_as_code = true;
|
||||
|
||||
if (match(ext, "cs")){
|
||||
|
|
|
@ -22,7 +22,6 @@ TYPE: 'major-system-include'
|
|||
#include "4coder_clipboard.cpp"
|
||||
#include "4coder_system_command.cpp"
|
||||
#include "4coder_build_commands.cpp"
|
||||
#include "4coder_open_all_close_all.cpp"
|
||||
#include "4coder_project_commands.cpp"
|
||||
#include "4coder_function_list.cpp"
|
||||
#include "4coder_scope_commands.cpp"
|
||||
|
|
|
@ -219,7 +219,7 @@ static Command_Metadata fcoder_metacmd_table[194] = {
|
|||
{ PROC_LINKS(auto_tab_range, 0), "auto_tab_range", 14, "Auto-indents the range between the cursor and the mark.", 55, "C:\\work\\4ed\\code\\4coder_auto_indent.cpp", 43, 759 },
|
||||
{ PROC_LINKS(auto_tab_whole_file, 0), "auto_tab_whole_file", 19, "Audo-indents the entire current buffer.", 39, "C:\\work\\4ed\\code\\4coder_auto_indent.cpp", 43, 738 },
|
||||
{ PROC_LINKS(backspace_char, 0), "backspace_char", 14, "Deletes the character to the left of the cursor.", 48, "C:\\work\\4ed\\code\\4coder_base_commands.cpp", 45, 81 },
|
||||
{ PROC_LINKS(backspace_word, 0), "backspace_word", 14, "Delete characters between the cursor position and the first alphanumeric boundary to the left.", 94, "C:\\work\\4ed\\code\\4coder_default_include.cpp", 47, 148 },
|
||||
{ PROC_LINKS(backspace_word, 0), "backspace_word", 14, "Delete characters between the cursor position and the first alphanumeric boundary to the left.", 94, "C:\\work\\4ed\\code\\4coder_default_include.cpp", 47, 147 },
|
||||
{ PROC_LINKS(basic_change_active_panel, 0), "basic_change_active_panel", 25, "Change the currently active panel, moving to the panel with the next highest view_id. Will not skipe the build panel if it is open.", 132, "C:\\work\\4ed\\code\\4coder_base_commands.cpp", 45, 543 },
|
||||
{ PROC_LINKS(build_in_build_panel, 0), "build_in_build_panel", 20, "Looks for a build.bat, build.sh, or makefile in the current and parent directories. Runs the first that it finds and prints the output to *compilation*. Puts the *compilation* buffer in a panel at the footer of the current view.", 230, "C:\\work\\4ed\\code\\4coder_build_commands.cpp", 46, 203 },
|
||||
{ PROC_LINKS(build_search, 0), "build_search", 12, "Looks for a build.bat, build.sh, or makefile in the current and parent directories. Runs the first that it finds and prints the output to *compilation*.", 153, "C:\\work\\4ed\\code\\4coder_build_commands.cpp", 46, 169 },
|
||||
|
@ -230,7 +230,7 @@ static Command_Metadata fcoder_metacmd_table[194] = {
|
|||
{ PROC_LINKS(clean_all_lines, 0), "clean_all_lines", 15, "Removes trailing whitespace from all lines in the current buffer.", 65, "C:\\work\\4ed\\code\\4coder_base_commands.cpp", 45, 475 },
|
||||
{ PROC_LINKS(click_set_cursor, 0), "click_set_cursor", 16, "Sets the cursor position to the mouse position.", 47, "C:\\work\\4ed\\code\\4coder_base_commands.cpp", 45, 190 },
|
||||
{ PROC_LINKS(click_set_mark, 0), "click_set_mark", 14, "Sets the mark position to the mouse position.", 45, "C:\\work\\4ed\\code\\4coder_base_commands.cpp", 45, 203 },
|
||||
{ PROC_LINKS(close_all_code, 0), "close_all_code", 14, "Closes any buffer with a filename ending with an extension configured to be recognized as a code file type.", 107, "C:\\work\\4ed\\code\\4coder_open_all_close_all.cpp", 50, 154 },
|
||||
{ PROC_LINKS(close_all_code, 0), "close_all_code", 14, "Closes any buffer with a filename ending with an extension configured to be recognized as a code file type.", 107, "C:\\work\\4ed\\code\\4coder_project_commands.cpp", 48, 150 },
|
||||
{ PROC_LINKS(close_build_panel, 0), "close_build_panel", 17, "If the special build panel is open, closes it.", 46, "C:\\work\\4ed\\code\\4coder_build_commands.cpp", 46, 219 },
|
||||
{ PROC_LINKS(close_panel, 0), "close_panel", 11, "Closes the currently active panel if it is not the only panel open.", 67, "C:\\work\\4ed\\code\\4coder_base_commands.cpp", 45, 551 },
|
||||
{ PROC_LINKS(copy, 0), "copy", 4, "Copy the text in the range from the cursor to the mark onto the clipboard.", 74, "C:\\work\\4ed\\code\\4coder_clipboard.cpp", 41, 52 },
|
||||
|
@ -241,14 +241,14 @@ static Command_Metadata fcoder_metacmd_table[194] = {
|
|||
{ PROC_LINKS(delete_char, 0), "delete_char", 11, "Deletes the character to the right of the cursor.", 49, "C:\\work\\4ed\\code\\4coder_base_commands.cpp", 45, 63 },
|
||||
{ PROC_LINKS(delete_current_scope, 0), "delete_current_scope", 20, "Deletes the braces surrounding the currently selected scope. Leaves the contents within the scope.", 99, "C:\\work\\4ed\\code\\4coder_scope_commands.cpp", 46, 492 },
|
||||
{ PROC_LINKS(delete_file_query, 0), "delete_file_query", 17, "Deletes the file of the current buffer if 4coder has the appropriate access rights. Will ask the user for confirmation first.", 125, "C:\\work\\4ed\\code\\4coder_base_commands.cpp", 45, 1091 },
|
||||
{ PROC_LINKS(delete_line, 0), "delete_line", 11, "Delete the line the on which the cursor sits.", 45, "C:\\work\\4ed\\code\\4coder_default_include.cpp", 47, 392 },
|
||||
{ PROC_LINKS(delete_line, 0), "delete_line", 11, "Delete the line the on which the cursor sits.", 45, "C:\\work\\4ed\\code\\4coder_default_include.cpp", 47, 391 },
|
||||
{ PROC_LINKS(delete_range, 0), "delete_range", 12, "Deletes the text in the range between the cursor and the mark.", 62, "C:\\work\\4ed\\code\\4coder_base_commands.cpp", 45, 121 },
|
||||
{ PROC_LINKS(delete_word, 0), "delete_word", 11, "Delete characters between the cursor position and the first alphanumeric boundary to the right.", 95, "C:\\work\\4ed\\code\\4coder_default_include.cpp", 47, 168 },
|
||||
{ PROC_LINKS(duplicate_line, 0), "duplicate_line", 14, "Create a copy of the line on which the cursor sits.", 51, "C:\\work\\4ed\\code\\4coder_default_include.cpp", 47, 370 },
|
||||
{ PROC_LINKS(delete_word, 0), "delete_word", 11, "Delete characters between the cursor position and the first alphanumeric boundary to the right.", 95, "C:\\work\\4ed\\code\\4coder_default_include.cpp", 47, 167 },
|
||||
{ PROC_LINKS(duplicate_line, 0), "duplicate_line", 14, "Create a copy of the line on which the cursor sits.", 51, "C:\\work\\4ed\\code\\4coder_default_include.cpp", 47, 369 },
|
||||
{ PROC_LINKS(eol_dosify, 0), "eol_dosify", 10, "Puts the buffer in DOS line ending mode.", 40, "C:\\work\\4ed\\code\\4coder_base_commands.cpp", 45, 674 },
|
||||
{ PROC_LINKS(eol_nixify, 0), "eol_nixify", 10, "Puts the buffer in NIX line ending mode.", 40, "C:\\work\\4ed\\code\\4coder_base_commands.cpp", 45, 682 },
|
||||
{ PROC_LINKS(execute_any_cli, 0), "execute_any_cli", 15, "Queries for an output buffer name and system command, runs the system command as a CLI and prints the output to the specified buffer.", 133, "C:\\work\\4ed\\code\\4coder_system_command.cpp", 46, 30 },
|
||||
{ PROC_LINKS(execute_arbitrary_command, 0), "execute_arbitrary_command", 25, "Execute a 'long form' command.", 30, "C:\\work\\4ed\\code\\4coder_default_include.cpp", 47, 784 },
|
||||
{ PROC_LINKS(execute_arbitrary_command, 0), "execute_arbitrary_command", 25, "Execute a 'long form' command.", 30, "C:\\work\\4ed\\code\\4coder_default_include.cpp", 47, 783 },
|
||||
{ PROC_LINKS(execute_previous_cli, 0), "execute_previous_cli", 20, "If the command execute_any_cli has already been used, this will execute a CLI reusing the most recent buffer name and command.", 126, "C:\\work\\4ed\\code\\4coder_system_command.cpp", 46, 14 },
|
||||
{ PROC_LINKS(exit_4coder, 0), "exit_4coder", 11, "Attempts to close 4coder.", 25, "C:\\work\\4ed\\code\\4coder_base_commands.cpp", 45, 690 },
|
||||
{ PROC_LINKS(goto_beginning_of_file, 0), "goto_beginning_of_file", 22, "Sets the cursor to the beginning of the file.", 45, "C:\\work\\4ed\\code\\4coder_base_commands.cpp", 45, 416 },
|
||||
|
@ -274,7 +274,7 @@ static Command_Metadata fcoder_metacmd_table[194] = {
|
|||
{ PROC_LINKS(highlight_next_scope_absolute, 0), "highlight_next_scope_absolute", 29, "Finds the first scope started by '{' after the cursor and puts the cursor and mark on the '{' and '}'.", 102, "C:\\work\\4ed\\code\\4coder_scope_commands.cpp", 46, 368 },
|
||||
{ PROC_LINKS(highlight_prev_scope_absolute, 0), "highlight_prev_scope_absolute", 29, "Finds the first scope started by '{' before the cursor and puts the cursor and mark on the '{' and '}'.", 103, "C:\\work\\4ed\\code\\4coder_scope_commands.cpp", 46, 387 },
|
||||
{ PROC_LINKS(highlight_surrounding_scope, 0), "highlight_surrounding_scope", 27, "Finds the scope enclosed by '{' '}' surrounding the cursor and puts the cursor and mark on the '{' and '}'.", 107, "C:\\work\\4ed\\code\\4coder_scope_commands.cpp", 46, 346 },
|
||||
{ PROC_LINKS(if0_off, 0), "if0_off", 7, "Surround the range between the cursor and mark with an '#if 0' and an '#endif'", 78, "C:\\work\\4ed\\code\\4coder_default_include.cpp", 47, 571 },
|
||||
{ PROC_LINKS(if0_off, 0), "if0_off", 7, "Surround the range between the cursor and mark with an '#if 0' and an '#endif'", 78, "C:\\work\\4ed\\code\\4coder_default_include.cpp", 47, 570 },
|
||||
{ PROC_LINKS(increase_face_size, 0), "increase_face_size", 18, "Increase the size of the face used by the current buffer.", 57, "C:\\work\\4ed\\code\\4coder_base_commands.cpp", 45, 632 },
|
||||
{ PROC_LINKS(increase_line_wrap, 0), "increase_line_wrap", 18, "Increases the current buffer's width for line wrapping.", 55, "C:\\work\\4ed\\code\\4coder_base_commands.cpp", 45, 610 },
|
||||
{ PROC_LINKS(interactive_kill_buffer, 0), "interactive_kill_buffer", 23, "Interactively kill an open buffer.", 34, "C:\\work\\4ed\\code\\4coder_base_commands.cpp", 45, 1270 },
|
||||
|
@ -292,11 +292,11 @@ static Command_Metadata fcoder_metacmd_table[194] = {
|
|||
{ PROC_LINKS(list_all_locations_of_identifier_case_insensitive, 0), "list_all_locations_of_identifier_case_insensitive", 49, "Reads a token or word under the cursor and lists all exact case-insensitive mathces in all open buffers.", 104, "C:\\work\\4ed\\code\\4coder_search.cpp", 38, 792 },
|
||||
{ PROC_LINKS(list_all_locations_of_selection, 0), "list_all_locations_of_selection", 31, "Reads the string in the selected range and lists all exact case-sensitive mathces in all open buffers.", 102, "C:\\work\\4ed\\code\\4coder_search.cpp", 38, 834 },
|
||||
{ PROC_LINKS(list_all_locations_of_selection_case_insensitive, 0), "list_all_locations_of_selection_case_insensitive", 48, "Reads the string in the selected range and lists all exact case-insensitive mathces in all open buffers.", 104, "C:\\work\\4ed\\code\\4coder_search.cpp", 38, 840 },
|
||||
{ PROC_LINKS(list_all_locations_of_type_definition, 0), "list_all_locations_of_type_definition", 37, "Queries user for string, lists all locations of strings that appear to define a type whose name matches the input string.", 121, "C:\\work\\4ed\\code\\4coder_default_include.cpp", 47, 486 },
|
||||
{ PROC_LINKS(list_all_locations_of_type_definition_of_identifier, 0), "list_all_locations_of_type_definition_of_identifier", 51, "Reads a token or word under the cursor and lists all locations of strings that appear to define a type whose name matches it.", 125, "C:\\work\\4ed\\code\\4coder_default_include.cpp", 47, 498 },
|
||||
{ PROC_LINKS(list_all_locations_of_type_definition, 0), "list_all_locations_of_type_definition", 37, "Queries user for string, lists all locations of strings that appear to define a type whose name matches the input string.", 121, "C:\\work\\4ed\\code\\4coder_default_include.cpp", 47, 485 },
|
||||
{ PROC_LINKS(list_all_locations_of_type_definition_of_identifier, 0), "list_all_locations_of_type_definition_of_identifier", 51, "Reads a token or word under the cursor and lists all locations of strings that appear to define a type whose name matches it.", 125, "C:\\work\\4ed\\code\\4coder_default_include.cpp", 47, 497 },
|
||||
{ PROC_LINKS(list_all_substring_locations, 0), "list_all_substring_locations", 28, "Queries the user for a string and lists all case-sensitive substring matches found in all open buffers.", 103, "C:\\work\\4ed\\code\\4coder_search.cpp", 38, 712 },
|
||||
{ PROC_LINKS(list_all_substring_locations_case_insensitive, 0), "list_all_substring_locations_case_insensitive", 45, "Queries the user for a string and lists all case-insensitive substring matches found in all open buffers.", 105, "C:\\work\\4ed\\code\\4coder_search.cpp", 38, 732 },
|
||||
{ PROC_LINKS(load_project, 0), "load_project", 12, "Looks for a project.4coder file in the current directory and tries to load it. Looks in parent directories until a project file is found or there are no more parents.", 167, "C:\\work\\4ed\\code\\4coder_project_commands.cpp", 48, 344 },
|
||||
{ PROC_LINKS(load_project, 0), "load_project", 12, "Looks for a project.4coder file in the current directory and tries to load it. Looks in parent directories until a project file is found or there are no more parents.", 167, "C:\\work\\4ed\\code\\4coder_project_commands.cpp", 48, 439 },
|
||||
{ PROC_LINKS(make_directory_query, 0), "make_directory_query", 20, "Queries the user for a name and creates a new directory with the given name.", 76, "C:\\work\\4ed\\code\\4coder_base_commands.cpp", 45, 1199 },
|
||||
{ PROC_LINKS(miblo_decrement_basic, 0), "miblo_decrement_basic", 21, "Decrement an integer under the cursor by one.", 45, "C:\\work\\4ed\\code\\power\\4coder_miblo_numbers.cpp", 52, 119 },
|
||||
{ PROC_LINKS(miblo_decrement_time_stamp, 0), "miblo_decrement_time_stamp", 26, "Decrement a time stamp under the cursor by one second. (format [m]m:ss or h:mm:ss", 81, "C:\\work\\4ed\\code\\power\\4coder_miblo_numbers.cpp", 52, 392 },
|
||||
|
@ -306,10 +306,10 @@ static Command_Metadata fcoder_metacmd_table[194] = {
|
|||
{ PROC_LINKS(miblo_increment_time_stamp_minute, 0), "miblo_increment_time_stamp_minute", 33, "Increment a time stamp under the cursor by one minute. (format [m]m:ss or h:mm:ss", 81, "C:\\work\\4ed\\code\\power\\4coder_miblo_numbers.cpp", 52, 398 },
|
||||
{ PROC_LINKS(move_down, 0), "move_down", 9, "Moves the cursor down one line.", 31, "C:\\work\\4ed\\code\\4coder_base_commands.cpp", 45, 248 },
|
||||
{ PROC_LINKS(move_down_10, 0), "move_down_10", 12, "Moves the cursor down ten lines.", 32, "C:\\work\\4ed\\code\\4coder_base_commands.cpp", 45, 260 },
|
||||
{ PROC_LINKS(move_down_textual, 0), "move_down_textual", 17, "Moves down to the next line of actual text, regardless of line wrapping.", 72, "C:\\work\\4ed\\code\\4coder_default_include.cpp", 47, 336 },
|
||||
{ PROC_LINKS(move_down_textual, 0), "move_down_textual", 17, "Moves down to the next line of actual text, regardless of line wrapping.", 72, "C:\\work\\4ed\\code\\4coder_default_include.cpp", 47, 335 },
|
||||
{ PROC_LINKS(move_left, 0), "move_left", 9, "Moves the cursor one character to the left.", 43, "C:\\work\\4ed\\code\\4coder_base_commands.cpp", 45, 301 },
|
||||
{ PROC_LINKS(move_line_down, 0), "move_line_down", 14, "Swaps the line under the cursor with the line below it, and moves the cursor down with it.", 90, "C:\\work\\4ed\\code\\4coder_default_include.cpp", 47, 347 },
|
||||
{ PROC_LINKS(move_line_up, 0), "move_line_up", 12, "Swaps the line under the cursor with the line above it, and moves the cursor up with it.", 88, "C:\\work\\4ed\\code\\4coder_default_include.cpp", 47, 272 },
|
||||
{ PROC_LINKS(move_line_down, 0), "move_line_down", 14, "Swaps the line under the cursor with the line below it, and moves the cursor down with it.", 90, "C:\\work\\4ed\\code\\4coder_default_include.cpp", 47, 346 },
|
||||
{ PROC_LINKS(move_line_up, 0), "move_line_up", 12, "Swaps the line under the cursor with the line above it, and moves the cursor up with it.", 88, "C:\\work\\4ed\\code\\4coder_default_include.cpp", 47, 271 },
|
||||
{ PROC_LINKS(move_right, 0), "move_right", 10, "Moves the cursor one character to the right.", 44, "C:\\work\\4ed\\code\\4coder_base_commands.cpp", 45, 310 },
|
||||
{ PROC_LINKS(move_up, 0), "move_up", 7, "Moves the cursor up one line.", 29, "C:\\work\\4ed\\code\\4coder_base_commands.cpp", 45, 242 },
|
||||
{ PROC_LINKS(move_up_10, 0), "move_up_10", 10, "Moves the cursor up ten lines.", 30, "C:\\work\\4ed\\code\\4coder_base_commands.cpp", 45, 254 },
|
||||
|
@ -318,32 +318,32 @@ static Command_Metadata fcoder_metacmd_table[194] = {
|
|||
{ PROC_LINKS(newline_or_goto_position_same_panel_direct, 0), "newline_or_goto_position_same_panel_direct", 42, "If the buffer in the active view is writable, inserts a character, otherwise performs goto_jump_at_cursor_same_panel.", 117, "C:\\work\\4ed\\code\\4coder_jump_direct.cpp", 43, 132 },
|
||||
{ PROC_LINKS(newline_or_goto_position_same_panel_sticky, 0), "newline_or_goto_position_same_panel_sticky", 42, "If the buffer in the active view is writable, inserts a character, otherwise performs goto_jump_at_cursor_same_panel.", 117, "C:\\work\\4ed\\code\\4coder_jump_sticky.cpp", 43, 624 },
|
||||
{ PROC_LINKS(newline_or_goto_position_sticky, 0), "newline_or_goto_position_sticky", 31, "If the buffer in the active view is writable, inserts a character, otherwise performs goto_jump_at_cursor.", 106, "C:\\work\\4ed\\code\\4coder_jump_sticky.cpp", 43, 609 },
|
||||
{ PROC_LINKS(open_all_code, 0), "open_all_code", 13, "Open all code in the current directory. File types are determined by extensions. An extension is considered code based on the extensions specified in 4coder.config.", 164, "C:\\work\\4ed\\code\\4coder_open_all_close_all.cpp", 50, 138 },
|
||||
{ PROC_LINKS(open_all_code_recursive, 0), "open_all_code_recursive", 23, "Works as open_all_code but also runs in all subdirectories.", 59, "C:\\work\\4ed\\code\\4coder_open_all_close_all.cpp", 50, 146 },
|
||||
{ PROC_LINKS(open_all_code, 0), "open_all_code", 13, "Open all code in the current directory. File types are determined by extensions. An extension is considered code based on the extensions specified in 4coder.config.", 164, "C:\\work\\4ed\\code\\4coder_project_commands.cpp", 48, 157 },
|
||||
{ PROC_LINKS(open_all_code_recursive, 0), "open_all_code_recursive", 23, "Works as open_all_code but also runs in all subdirectories.", 59, "C:\\work\\4ed\\code\\4coder_project_commands.cpp", 48, 164 },
|
||||
{ PROC_LINKS(open_color_tweaker, 0), "open_color_tweaker", 18, "Opens the 4coder colors and fonts selector menu.", 48, "C:\\work\\4ed\\code\\4coder_base_commands.cpp", 45, 1294 },
|
||||
{ PROC_LINKS(open_file_in_quotes, 0), "open_file_in_quotes", 19, "Reads a filename from surrounding '\"' characters and attempts to open the corresponding file.", 94, "C:\\work\\4ed\\code\\4coder_default_include.cpp", 47, 668 },
|
||||
{ PROC_LINKS(open_in_other, 0), "open_in_other", 13, "Reads a filename from surrounding '\"' characters and attempts to open the corresponding file, displaying it in the other view.", 127, "C:\\work\\4ed\\code\\4coder_default_include.cpp", 47, 685 },
|
||||
{ PROC_LINKS(open_long_braces, 0), "open_long_braces", 16, "At the cursor, insert a '{' and '}' separated by a blank line.", 62, "C:\\work\\4ed\\code\\4coder_default_include.cpp", 47, 547 },
|
||||
{ PROC_LINKS(open_long_braces_break, 0), "open_long_braces_break", 22, "At the cursor, insert a '{' and '}break;' separated by a blank line.", 68, "C:\\work\\4ed\\code\\4coder_default_include.cpp", 47, 563 },
|
||||
{ PROC_LINKS(open_long_braces_semicolon, 0), "open_long_braces_semicolon", 26, "At the cursor, insert a '{' and '};' separated by a blank line.", 63, "C:\\work\\4ed\\code\\4coder_default_include.cpp", 47, 555 },
|
||||
{ PROC_LINKS(open_matching_file_cpp, 0), "open_matching_file_cpp", 22, "If the current file is a *.cpp or *.h, attempts to open the corresponding *.h or *.cpp file in the other view.", 110, "C:\\work\\4ed\\code\\4coder_default_include.cpp", 47, 741 },
|
||||
{ PROC_LINKS(open_file_in_quotes, 0), "open_file_in_quotes", 19, "Reads a filename from surrounding '\"' characters and attempts to open the corresponding file.", 94, "C:\\work\\4ed\\code\\4coder_default_include.cpp", 47, 667 },
|
||||
{ PROC_LINKS(open_in_other, 0), "open_in_other", 13, "Reads a filename from surrounding '\"' characters and attempts to open the corresponding file, displaying it in the other view.", 127, "C:\\work\\4ed\\code\\4coder_default_include.cpp", 47, 684 },
|
||||
{ PROC_LINKS(open_long_braces, 0), "open_long_braces", 16, "At the cursor, insert a '{' and '}' separated by a blank line.", 62, "C:\\work\\4ed\\code\\4coder_default_include.cpp", 47, 546 },
|
||||
{ PROC_LINKS(open_long_braces_break, 0), "open_long_braces_break", 22, "At the cursor, insert a '{' and '}break;' separated by a blank line.", 68, "C:\\work\\4ed\\code\\4coder_default_include.cpp", 47, 562 },
|
||||
{ PROC_LINKS(open_long_braces_semicolon, 0), "open_long_braces_semicolon", 26, "At the cursor, insert a '{' and '};' separated by a blank line.", 63, "C:\\work\\4ed\\code\\4coder_default_include.cpp", 47, 554 },
|
||||
{ PROC_LINKS(open_matching_file_cpp, 0), "open_matching_file_cpp", 22, "If the current file is a *.cpp or *.h, attempts to open the corresponding *.h or *.cpp file in the other view.", 110, "C:\\work\\4ed\\code\\4coder_default_include.cpp", 47, 740 },
|
||||
{ PROC_LINKS(open_panel_hsplit, 0), "open_panel_hsplit", 17, "Create a new panel by horizontally splitting the active panel.", 62, "C:\\work\\4ed\\code\\4coder_default_framework.h", 47, 170 },
|
||||
{ PROC_LINKS(open_panel_vsplit, 0), "open_panel_vsplit", 17, "Create a new panel by vertically splitting the active panel.", 60, "C:\\work\\4ed\\code\\4coder_default_framework.h", 47, 161 },
|
||||
{ PROC_LINKS(page_down, 0), "page_down", 9, "Scrolls the view down one view height and moves the cursor down one view height.", 80, "C:\\work\\4ed\\code\\4coder_base_commands.cpp", 45, 291 },
|
||||
{ PROC_LINKS(page_up, 0), "page_up", 7, "Scrolls the view up one view height and moves the cursor up one view height.", 76, "C:\\work\\4ed\\code\\4coder_base_commands.cpp", 45, 282 },
|
||||
{ PROC_LINKS(paste, 0), "paste", 5, "At the cursor, insert the text at the top of the clipboard.", 59, "C:\\work\\4ed\\code\\4coder_clipboard.cpp", 41, 70 },
|
||||
{ PROC_LINKS(paste_and_indent, 0), "paste_and_indent", 16, "Paste from the top of clipboard and run auto-indent on the newly pasted text.", 77, "C:\\work\\4ed\\code\\4coder_default_include.cpp", 47, 423 },
|
||||
{ PROC_LINKS(paste_and_indent, 0), "paste_and_indent", 16, "Paste from the top of clipboard and run auto-indent on the newly pasted text.", 77, "C:\\work\\4ed\\code\\4coder_default_include.cpp", 47, 422 },
|
||||
{ PROC_LINKS(paste_next, 0), "paste_next", 10, "If the previous command was paste or paste_next, replaces the paste range with the next text down on the clipboard, otherwise operates as the paste command.", 156, "C:\\work\\4ed\\code\\4coder_clipboard.cpp", 41, 108 },
|
||||
{ PROC_LINKS(paste_next_and_indent, 0), "paste_next_and_indent", 21, "Paste the next item on the clipboard and run auto-indent on the newly pasted text.", 82, "C:\\work\\4ed\\code\\4coder_default_include.cpp", 47, 430 },
|
||||
{ PROC_LINKS(paste_next_and_indent, 0), "paste_next_and_indent", 21, "Paste the next item on the clipboard and run auto-indent on the newly pasted text.", 82, "C:\\work\\4ed\\code\\4coder_default_include.cpp", 47, 429 },
|
||||
{ PROC_LINKS(place_in_scope, 0), "place_in_scope", 14, "Wraps the code contained in the range between cursor and mark with a new curly brace scope.", 91, "C:\\work\\4ed\\code\\4coder_scope_commands.cpp", 46, 486 },
|
||||
{ PROC_LINKS(project_fkey_command, 0), "project_fkey_command", 20, "Run an 'fkey command' configured in a project.4coder file. Determines the index of the 'fkey command' by which function key or numeric key was pressed to trigger the command.", 175, "C:\\work\\4ed\\code\\4coder_project_commands.cpp", 48, 426 },
|
||||
{ PROC_LINKS(project_go_to_root_directory, 0), "project_go_to_root_directory", 28, "Changes 4coder's hot directory to the root directory of the currently loaded project. With no loaded project nothing hapepns.", 125, "C:\\work\\4ed\\code\\4coder_project_commands.cpp", 48, 452 },
|
||||
{ PROC_LINKS(project_fkey_command, 0), "project_fkey_command", 20, "Run an 'fkey command' configured in a project.4coder file. Determines the index of the 'fkey command' by which function key or numeric key was pressed to trigger the command.", 175, "C:\\work\\4ed\\code\\4coder_project_commands.cpp", 48, 510 },
|
||||
{ PROC_LINKS(project_go_to_root_directory, 0), "project_go_to_root_directory", 28, "Changes 4coder's hot directory to the root directory of the currently loaded project. With no loaded project nothing hapepns.", 125, "C:\\work\\4ed\\code\\4coder_project_commands.cpp", 48, 535 },
|
||||
{ PROC_LINKS(query_replace, 0), "query_replace", 13, "Queries the user for two strings, and incrementally replaces every occurence of the first string with the second string.", 120, "C:\\work\\4ed\\code\\4coder_base_commands.cpp", 45, 1012 },
|
||||
{ PROC_LINKS(query_replace_identifier, 0), "query_replace_identifier", 24, "Queries the user for a string, and incrementally replace every occurence of the word or token found at the cursor with the specified string.", 140, "C:\\work\\4ed\\code\\4coder_base_commands.cpp", 45, 1033 },
|
||||
{ PROC_LINKS(query_replace_selection, 0), "query_replace_selection", 23, "Queries the user for a string, and incrementally replace every occurence of the string found in the selected range with the specified string.", 141, "C:\\work\\4ed\\code\\4coder_default_include.cpp", 47, 241 },
|
||||
{ PROC_LINKS(query_replace_selection, 0), "query_replace_selection", 23, "Queries the user for a string, and incrementally replace every occurence of the string found in the selected range with the specified string.", 141, "C:\\work\\4ed\\code\\4coder_default_include.cpp", 47, 240 },
|
||||
{ PROC_LINKS(redo, 0), "redo", 4, "Advances forewards through the undo history.", 44, "C:\\work\\4ed\\code\\4coder_base_commands.cpp", 45, 1240 },
|
||||
{ PROC_LINKS(reload_current_project, 0), "reload_current_project", 22, "If a project file has already been loaded, reloads the same file. Useful for when the project configuration is changed.", 120, "C:\\work\\4ed\\code\\4coder_project_commands.cpp", 48, 383 },
|
||||
{ PROC_LINKS(remap_interactive, 0), "remap_interactive", 17, "Switch to a named key binding map.", 34, "C:\\work\\4ed\\code\\4coder_default_framework.h", 47, 743 },
|
||||
{ PROC_LINKS(reload_current_project, 0), "reload_current_project", 22, "If a project file has already been loaded, reloads the same file. Useful for when the project configuration is changed.", 120, "C:\\work\\4ed\\code\\4coder_project_commands.cpp", 48, 478 },
|
||||
{ PROC_LINKS(remap_interactive, 0), "remap_interactive", 17, "Switch to a named key binding map.", 34, "C:\\work\\4ed\\code\\4coder_default_framework.h", 47, 654 },
|
||||
{ PROC_LINKS(rename_file_query, 0), "rename_file_query", 17, "Queries the user for a new name and renames the file of the current buffer, altering the buffer's name too.", 107, "C:\\work\\4ed\\code\\4coder_base_commands.cpp", 45, 1157 },
|
||||
{ PROC_LINKS(rename_parameter, 0), "rename_parameter", 16, "If the cursor is found to be on the name of a function parameter in the signature of a function definition, all occurences within the scope of the function will be replaced with a new provided string.", 200, "C:\\work\\4ed\\code\\power\\4coder_experiments.cpp", 50, 387 },
|
||||
{ PROC_LINKS(reopen, 0), "reopen", 6, "Reopen the current buffer from the hard drive.", 46, "C:\\work\\4ed\\code\\4coder_base_commands.cpp", 45, 1276 },
|
||||
|
@ -357,22 +357,22 @@ static Command_Metadata fcoder_metacmd_table[194] = {
|
|||
{ PROC_LINKS(scope_absorb_down, 0), "scope_absorb_down", 17, "If a scope is currently selected, and a statement or block statement is present below the current scope, the statement is moved into the scope.", 143, "C:\\work\\4ed\\code\\4coder_scope_commands.cpp", 46, 751 },
|
||||
{ PROC_LINKS(search, 0), "search", 6, "Begins an incremental search down through the current buffer for a user specified string.", 89, "C:\\work\\4ed\\code\\4coder_base_commands.cpp", 45, 873 },
|
||||
{ PROC_LINKS(search_identifier, 0), "search_identifier", 17, "Begins an incremental search down through the current buffer for the word or token under the cursor.", 100, "C:\\work\\4ed\\code\\4coder_base_commands.cpp", 45, 887 },
|
||||
{ PROC_LINKS(seek_alphanumeric_left, 0), "seek_alphanumeric_left", 22, "Seek left for boundary between alphanumeric characters and non-alphanumeric characters.", 87, "C:\\work\\4ed\\code\\4coder_default_include.cpp", 47, 129 },
|
||||
{ PROC_LINKS(seek_alphanumeric_or_camel_left, 0), "seek_alphanumeric_or_camel_left", 31, "Seek left for boundary between alphanumeric characters or camel case word and non-alphanumeric characters.", 106, "C:\\work\\4ed\\code\\4coder_default_include.cpp", 47, 137 },
|
||||
{ PROC_LINKS(seek_alphanumeric_or_camel_right, 0), "seek_alphanumeric_or_camel_right", 32, "Seek right for boundary between alphanumeric characters or camel case word and non-alphanumeric characters.", 107, "C:\\work\\4ed\\code\\4coder_default_include.cpp", 47, 133 },
|
||||
{ PROC_LINKS(seek_alphanumeric_right, 0), "seek_alphanumeric_right", 23, "Seek right for boundary between alphanumeric characters and non-alphanumeric characters.", 88, "C:\\work\\4ed\\code\\4coder_default_include.cpp", 47, 125 },
|
||||
{ PROC_LINKS(seek_alphanumeric_left, 0), "seek_alphanumeric_left", 22, "Seek left for boundary between alphanumeric characters and non-alphanumeric characters.", 87, "C:\\work\\4ed\\code\\4coder_default_include.cpp", 47, 128 },
|
||||
{ PROC_LINKS(seek_alphanumeric_or_camel_left, 0), "seek_alphanumeric_or_camel_left", 31, "Seek left for boundary between alphanumeric characters or camel case word and non-alphanumeric characters.", 106, "C:\\work\\4ed\\code\\4coder_default_include.cpp", 47, 136 },
|
||||
{ PROC_LINKS(seek_alphanumeric_or_camel_right, 0), "seek_alphanumeric_or_camel_right", 32, "Seek right for boundary between alphanumeric characters or camel case word and non-alphanumeric characters.", 107, "C:\\work\\4ed\\code\\4coder_default_include.cpp", 47, 132 },
|
||||
{ PROC_LINKS(seek_alphanumeric_right, 0), "seek_alphanumeric_right", 23, "Seek right for boundary between alphanumeric characters and non-alphanumeric characters.", 88, "C:\\work\\4ed\\code\\4coder_default_include.cpp", 47, 124 },
|
||||
{ PROC_LINKS(seek_beginning_of_line, 0), "seek_beginning_of_line", 22, "Seeks the cursor to the beginning of the visual line.", 53, "C:\\work\\4ed\\code\\4coder_base_commands.cpp", 45, 376 },
|
||||
{ PROC_LINKS(seek_beginning_of_textual_line, 0), "seek_beginning_of_textual_line", 30, "Seeks the cursor to the beginning of the line across all text.", 62, "C:\\work\\4ed\\code\\4coder_base_commands.cpp", 45, 354 },
|
||||
{ PROC_LINKS(seek_end_of_line, 0), "seek_end_of_line", 16, "Seeks the cursor to the end of the visual line.", 47, "C:\\work\\4ed\\code\\4coder_base_commands.cpp", 45, 389 },
|
||||
{ PROC_LINKS(seek_end_of_textual_line, 0), "seek_end_of_textual_line", 24, "Seeks the cursor to the end of the line across all text.", 56, "C:\\work\\4ed\\code\\4coder_base_commands.cpp", 45, 365 },
|
||||
{ PROC_LINKS(seek_token_left, 0), "seek_token_left", 15, "Seek left for the next beginning of a token.", 44, "C:\\work\\4ed\\code\\4coder_default_include.cpp", 47, 113 },
|
||||
{ PROC_LINKS(seek_token_right, 0), "seek_token_right", 16, "Seek right for the next end of a token.", 39, "C:\\work\\4ed\\code\\4coder_default_include.cpp", 47, 109 },
|
||||
{ PROC_LINKS(seek_white_or_token_left, 0), "seek_white_or_token_left", 24, "Seek left for the next end of a token or boundary between whitespace and non-whitespace.", 88, "C:\\work\\4ed\\code\\4coder_default_include.cpp", 47, 121 },
|
||||
{ PROC_LINKS(seek_white_or_token_right, 0), "seek_white_or_token_right", 25, "Seek right for the next end of a token or boundary between whitespace and non-whitespace.", 89, "C:\\work\\4ed\\code\\4coder_default_include.cpp", 47, 117 },
|
||||
{ PROC_LINKS(seek_token_left, 0), "seek_token_left", 15, "Seek left for the next beginning of a token.", 44, "C:\\work\\4ed\\code\\4coder_default_include.cpp", 47, 112 },
|
||||
{ PROC_LINKS(seek_token_right, 0), "seek_token_right", 16, "Seek right for the next end of a token.", 39, "C:\\work\\4ed\\code\\4coder_default_include.cpp", 47, 108 },
|
||||
{ PROC_LINKS(seek_white_or_token_left, 0), "seek_white_or_token_left", 24, "Seek left for the next end of a token or boundary between whitespace and non-whitespace.", 88, "C:\\work\\4ed\\code\\4coder_default_include.cpp", 47, 120 },
|
||||
{ PROC_LINKS(seek_white_or_token_right, 0), "seek_white_or_token_right", 25, "Seek right for the next end of a token or boundary between whitespace and non-whitespace.", 89, "C:\\work\\4ed\\code\\4coder_default_include.cpp", 47, 116 },
|
||||
{ PROC_LINKS(seek_whitespace_down, 0), "seek_whitespace_down", 20, "Seeks the cursor down to the next blank line.", 45, "C:\\work\\4ed\\code\\4coder_base_commands.cpp", 45, 343 },
|
||||
{ PROC_LINKS(seek_whitespace_down_end_line, 0), "seek_whitespace_down_end_line", 29, "Seeks the cursor down to the next blank line and places it at the end of the line.", 82, "C:\\work\\4ed\\code\\4coder_base_commands.cpp", 45, 409 },
|
||||
{ PROC_LINKS(seek_whitespace_left, 0), "seek_whitespace_left", 20, "Seek left for the next boundary between whitespace and non-whitespace.", 70, "C:\\work\\4ed\\code\\4coder_default_include.cpp", 47, 105 },
|
||||
{ PROC_LINKS(seek_whitespace_right, 0), "seek_whitespace_right", 21, "Seek right for the next boundary between whitespace and non-whitespace.", 71, "C:\\work\\4ed\\code\\4coder_default_include.cpp", 47, 101 },
|
||||
{ PROC_LINKS(seek_whitespace_left, 0), "seek_whitespace_left", 20, "Seek left for the next boundary between whitespace and non-whitespace.", 70, "C:\\work\\4ed\\code\\4coder_default_include.cpp", 47, 104 },
|
||||
{ PROC_LINKS(seek_whitespace_right, 0), "seek_whitespace_right", 21, "Seek right for the next boundary between whitespace and non-whitespace.", 71, "C:\\work\\4ed\\code\\4coder_default_include.cpp", 47, 100 },
|
||||
{ PROC_LINKS(seek_whitespace_up, 0), "seek_whitespace_up", 18, "Seeks the cursor up to the next blank line.", 43, "C:\\work\\4ed\\code\\4coder_base_commands.cpp", 45, 332 },
|
||||
{ PROC_LINKS(seek_whitespace_up_end_line, 0), "seek_whitespace_up_end_line", 27, "Seeks the cursor up to the next blank line and places it at the end of the line.", 80, "C:\\work\\4ed\\code\\4coder_base_commands.cpp", 45, 402 },
|
||||
{ PROC_LINKS(select_all, 0), "select_all", 10, "Puts the cursor at the top of the file, and the mark at the bottom of the file.", 79, "C:\\work\\4ed\\code\\4coder_base_commands.cpp", 45, 319 },
|
||||
|
@ -380,13 +380,13 @@ static Command_Metadata fcoder_metacmd_table[194] = {
|
|||
{ PROC_LINKS(set_bindings_default, 0), "set_bindings_default", 20, "Remap keybindings using the 'default' mapping rule.", 51, "C:\\work\\4ed\\code\\4coder_remapping_commands.cpp", 50, 63 },
|
||||
{ PROC_LINKS(set_bindings_mac_default, 0), "set_bindings_mac_default", 24, "Remap keybindings using the 'mac-default' mapping rule.", 55, "C:\\work\\4ed\\code\\4coder_remapping_commands.cpp", 50, 77 },
|
||||
{ PROC_LINKS(set_mark, 0), "set_mark", 8, "Sets the mark to the current position of the cursor.", 52, "C:\\work\\4ed\\code\\4coder_base_commands.cpp", 45, 100 },
|
||||
{ PROC_LINKS(setup_new_project, 0), "setup_new_project", 17, "Queries the user for several configuration options and initializes a new 4coder project with build scripts for every OS.", 120, "C:\\work\\4ed\\code\\4coder_project_commands.cpp", 48, 500 },
|
||||
{ PROC_LINKS(setup_new_project, 0), "setup_new_project", 17, "Queries the user for several configuration options and initializes a new 4coder project with build scripts for every OS.", 120, "C:\\work\\4ed\\code\\4coder_project_commands.cpp", 48, 582 },
|
||||
{ PROC_LINKS(show_filebar, 0), "show_filebar", 12, "Sets the current view to show it's filebar.", 43, "C:\\work\\4ed\\code\\4coder_base_commands.cpp", 45, 577 },
|
||||
{ PROC_LINKS(show_scrollbar, 0), "show_scrollbar", 14, "Sets the current view to show it's scrollbar.", 45, "C:\\work\\4ed\\code\\4coder_base_commands.cpp", 45, 563 },
|
||||
{ PROC_LINKS(snipe_token_or_word, 0), "snipe_token_or_word", 19, "Delete a single, whole token on or to the left of the cursor and post it to the clipboard.", 90, "C:\\work\\4ed\\code\\4coder_default_include.cpp", 47, 188 },
|
||||
{ PROC_LINKS(snipe_token_or_word_right, 0), "snipe_token_or_word_right", 25, "Delete a single, whole token on or to the right of the cursor and post it to the clipboard.", 91, "C:\\work\\4ed\\code\\4coder_default_include.cpp", 47, 212 },
|
||||
{ PROC_LINKS(snipe_token_or_word, 0), "snipe_token_or_word", 19, "Delete a single, whole token on or to the left of the cursor and post it to the clipboard.", 90, "C:\\work\\4ed\\code\\4coder_default_include.cpp", 47, 187 },
|
||||
{ PROC_LINKS(snipe_token_or_word_right, 0), "snipe_token_or_word_right", 25, "Delete a single, whole token on or to the right of the cursor and post it to the clipboard.", 91, "C:\\work\\4ed\\code\\4coder_default_include.cpp", 47, 211 },
|
||||
{ PROC_LINKS(suppress_mouse, 0), "suppress_mouse", 14, "Hides the mouse and causes all mosue input (clicks, position, wheel) to be ignored.", 83, "C:\\work\\4ed\\code\\4coder_default_framework.h", 47, 226 },
|
||||
{ PROC_LINKS(swap_buffers_between_panels, 0), "swap_buffers_between_panels", 27, "Set the other non-active panel to view the buffer that the active panel views, and switch to that panel.", 104, "C:\\work\\4ed\\code\\4coder_default_include.cpp", 47, 765 },
|
||||
{ PROC_LINKS(swap_buffers_between_panels, 0), "swap_buffers_between_panels", 27, "Set the other non-active panel to view the buffer that the active panel views, and switch to that panel.", 104, "C:\\work\\4ed\\code\\4coder_default_include.cpp", 47, 764 },
|
||||
{ PROC_LINKS(to_lowercase, 0), "to_lowercase", 12, "Converts all ascii text in the range between the cursor and the mark to lowercase.", 82, "C:\\work\\4ed\\code\\4coder_base_commands.cpp", 45, 455 },
|
||||
{ PROC_LINKS(to_uppercase, 0), "to_uppercase", 12, "Converts all ascii text in the range between the cursor and the mark to uppercase.", 82, "C:\\work\\4ed\\code\\4coder_base_commands.cpp", 45, 435 },
|
||||
{ PROC_LINKS(toggle_filebar, 0), "toggle_filebar", 14, "Toggles the visibility status of the current view's filebar.", 60, "C:\\work\\4ed\\code\\4coder_base_commands.cpp", 45, 591 },
|
||||
|
@ -396,18 +396,18 @@ static Command_Metadata fcoder_metacmd_table[194] = {
|
|||
{ PROC_LINKS(toggle_show_whitespace, 0), "toggle_show_whitespace", 22, "Toggles the current buffer's whitespace visibility status.", 58, "C:\\work\\4ed\\code\\4coder_base_commands.cpp", 45, 667 },
|
||||
{ PROC_LINKS(toggle_virtual_whitespace, 0), "toggle_virtual_whitespace", 25, "Toggles the current buffer's virtual whitespace status.", 55, "C:\\work\\4ed\\code\\4coder_base_commands.cpp", 45, 656 },
|
||||
{ PROC_LINKS(undo, 0), "undo", 4, "Advances backwards through the undo history.", 44, "C:\\work\\4ed\\code\\4coder_base_commands.cpp", 45, 1234 },
|
||||
{ PROC_LINKS(view_buffer_other_panel, 0), "view_buffer_other_panel", 23, "Set the other non-active panel to view the buffer that the active panel views, and switch to that panel.", 104, "C:\\work\\4ed\\code\\4coder_default_include.cpp", 47, 755 },
|
||||
{ PROC_LINKS(view_buffer_other_panel, 0), "view_buffer_other_panel", 23, "Set the other non-active panel to view the buffer that the active panel views, and switch to that panel.", 104, "C:\\work\\4ed\\code\\4coder_default_include.cpp", 47, 754 },
|
||||
{ PROC_LINKS(word_complete, 0), "word_complete", 13, "Iteratively tries completing the word to the left of the cursor with other words in open buffers that have the same prefix string.", 130, "C:\\work\\4ed\\code\\4coder_search.cpp", 38, 863 },
|
||||
{ PROC_LINKS(write_and_auto_tab, 0), "write_and_auto_tab", 18, "Inserts a character and auto-indents the line on which the cursor sits.", 71, "C:\\work\\4ed\\code\\4coder_auto_indent.cpp", 43, 771 },
|
||||
{ PROC_LINKS(write_block, 0), "write_block", 11, "At the cursor, insert a block comment.", 38, "C:\\work\\4ed\\code\\4coder_default_include.cpp", 47, 618 },
|
||||
{ PROC_LINKS(write_block, 0), "write_block", 11, "At the cursor, insert a block comment.", 38, "C:\\work\\4ed\\code\\4coder_default_include.cpp", 47, 617 },
|
||||
{ PROC_LINKS(write_character, 0), "write_character", 15, "Inserts whatever character was used to trigger this command.", 60, "C:\\work\\4ed\\code\\4coder_base_commands.cpp", 45, 47 },
|
||||
{ PROC_LINKS(write_explicit_enum_flags, 0), "write_explicit_enum_flags", 25, "If the cursor is found to be on the '{' of an enum definition, the values of the enum will be filled in to give each a unique power of 2 value, starting from 1. Existing values are overwritten.", 194, "C:\\work\\4ed\\code\\power\\4coder_experiments.cpp", 50, 709 },
|
||||
{ PROC_LINKS(write_explicit_enum_values, 0), "write_explicit_enum_values", 26, "If the cursor is found to be on the '{' of an enum definition, the values of the enum will be filled in sequentially starting from zero. Existing values are overwritten.", 170, "C:\\work\\4ed\\code\\power\\4coder_experiments.cpp", 50, 703 },
|
||||
{ PROC_LINKS(write_hack, 0), "write_hack", 10, "At the cursor, insert a '// HACK' comment, includes user name if it was specified in config.4coder.", 99, "C:\\work\\4ed\\code\\4coder_default_include.cpp", 47, 606 },
|
||||
{ PROC_LINKS(write_note, 0), "write_note", 10, "At the cursor, insert a '// NOTE' comment, includes user name if it was specified in config.4coder.", 99, "C:\\work\\4ed\\code\\4coder_default_include.cpp", 47, 612 },
|
||||
{ PROC_LINKS(write_todo, 0), "write_todo", 10, "At the cursor, insert a '// TODO' comment, includes user name if it was specified in config.4coder.", 99, "C:\\work\\4ed\\code\\4coder_default_include.cpp", 47, 600 },
|
||||
{ PROC_LINKS(write_hack, 0), "write_hack", 10, "At the cursor, insert a '// HACK' comment, includes user name if it was specified in config.4coder.", 99, "C:\\work\\4ed\\code\\4coder_default_include.cpp", 47, 605 },
|
||||
{ PROC_LINKS(write_note, 0), "write_note", 10, "At the cursor, insert a '// NOTE' comment, includes user name if it was specified in config.4coder.", 99, "C:\\work\\4ed\\code\\4coder_default_include.cpp", 47, 611 },
|
||||
{ PROC_LINKS(write_todo, 0), "write_todo", 10, "At the cursor, insert a '// TODO' comment, includes user name if it was specified in config.4coder.", 99, "C:\\work\\4ed\\code\\4coder_default_include.cpp", 47, 599 },
|
||||
{ PROC_LINKS(write_underscore, 0), "write_underscore", 16, "Inserts an underscore.", 22, "C:\\work\\4ed\\code\\4coder_base_commands.cpp", 45, 56 },
|
||||
{ PROC_LINKS(write_zero_struct, 0), "write_zero_struct", 17, "At the cursor, insert a ' = {0};'.", 34, "C:\\work\\4ed\\code\\4coder_default_include.cpp", 47, 624 },
|
||||
{ PROC_LINKS(write_zero_struct, 0), "write_zero_struct", 17, "At the cursor, insert a ' = {0};'.", 34, "C:\\work\\4ed\\code\\4coder_default_include.cpp", 47, 623 },
|
||||
};
|
||||
static int32_t fcoder_metacmd_ID_allow_mouse = 0;
|
||||
static int32_t fcoder_metacmd_ID_auto_tab_line_at_cursor = 1;
|
||||
|
|
|
@ -36,6 +36,10 @@ max_f32_proc(void){
|
|||
#define max_f32 max_f32_proc()
|
||||
#endif
|
||||
|
||||
#if !defined(ArrayCount)
|
||||
# define ArrayCount(a) (sizeof(a)/sizeof(a[0]))
|
||||
#endif
|
||||
|
||||
#include "4coder_seek_types.h"
|
||||
#include "4coder_lib/4coder_utf8.h"
|
||||
|
||||
|
@ -472,8 +476,4 @@ get_range(View_Summary *view){
|
|||
return(range);
|
||||
}
|
||||
|
||||
#if !defined(ArrayCount)
|
||||
# define ArrayCount(a) (sizeof(a)/sizeof(a[0]))
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
|
|
@ -104,7 +104,7 @@ CUSTOM_DOC("If a buffer containing jump locations has been locked in, goes to th
|
|||
View_Summary view = get_view_for_locked_jump_buffer(app);
|
||||
if (view.exists){
|
||||
view_set_cursor(app, &view, seek_pos(0), true);
|
||||
prev_location = null_location;
|
||||
memset(&prev_location, 0, sizeof(prev_location));
|
||||
seek_jump(app, &global_part, false, true, 1);
|
||||
}
|
||||
end_temp_memory(temp);
|
||||
|
|
|
@ -1,165 +0,0 @@
|
|||
/*
|
||||
4coder_open_all_close_all.cpp - commands for opening and closing lots of files together.
|
||||
|
||||
type: 'drop-in-command-pack'
|
||||
*/
|
||||
|
||||
// TOP
|
||||
|
||||
#if !defined(FCODER_OPEN_ALL_CLOSE_ALL_CPP)
|
||||
#define FCODER_OPEN_ALL_CLOSE_ALL_CPP
|
||||
|
||||
#include "4coder_default_framework.h"
|
||||
|
||||
enum{
|
||||
OpenAllFilesFlag_Recursive = 1,
|
||||
};
|
||||
|
||||
///////////////////////////////
|
||||
|
||||
static void
|
||||
close_all_files_with_extension(Application_Links *app, Partition *scratch_part, char **extension_list, int32_t extension_count){
|
||||
Temp_Memory temp = begin_temp_memory(scratch_part);
|
||||
|
||||
int32_t buffers_to_close_max = partition_remaining(scratch_part)/sizeof(int32_t);
|
||||
int32_t *buffers_to_close = push_array(scratch_part, int32_t, buffers_to_close_max);
|
||||
|
||||
int32_t buffers_to_close_count = 0;
|
||||
bool32 do_repeat = 0;
|
||||
do{
|
||||
buffers_to_close_count = 0;
|
||||
do_repeat = 0;
|
||||
|
||||
uint32_t access = AccessAll;
|
||||
Buffer_Summary buffer = {0};
|
||||
for (buffer = get_buffer_first(app, access);
|
||||
buffer.exists;
|
||||
get_buffer_next(app, &buffer, access)){
|
||||
|
||||
bool32 is_match = 1;
|
||||
if (extension_count > 0){
|
||||
is_match = 0;
|
||||
if (buffer.file_name != 0){
|
||||
String extension = file_extension(make_string(buffer.file_name, buffer.file_name_len));
|
||||
for (int32_t i = 0; i < extension_count; ++i){
|
||||
if (match(extension, extension_list[i])){
|
||||
is_match = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (is_match){
|
||||
if (buffers_to_close_count >= buffers_to_close_max){
|
||||
do_repeat = 1;
|
||||
break;
|
||||
}
|
||||
buffers_to_close[buffers_to_close_count++] = buffer.buffer_id;
|
||||
}
|
||||
}
|
||||
|
||||
for (int32_t i = 0; i < buffers_to_close_count; ++i){
|
||||
kill_buffer(app, buffer_identifier(buffers_to_close[i]), true, 0);
|
||||
}
|
||||
}while(do_repeat);
|
||||
|
||||
end_temp_memory(temp);
|
||||
}
|
||||
|
||||
static void
|
||||
open_all_files_in_directory_with_extension(Application_Links *app, String dir,
|
||||
char **extension_list, int32_t extension_count,
|
||||
uint32_t flags){
|
||||
File_List list = get_file_list(app, dir.str, dir.size);
|
||||
int32_t dir_size = dir.size;
|
||||
|
||||
for (uint32_t i = 0; i < list.count; ++i){
|
||||
File_Info *info = list.infos + i;
|
||||
if (info->folder){
|
||||
if (((flags&OpenAllFilesFlag_Recursive) != 0) && info->filename[0] != '.'){
|
||||
dir.size = dir_size;
|
||||
append(&dir, info->filename);
|
||||
append(&dir, "/");
|
||||
open_all_files_in_directory_with_extension(app, dir,
|
||||
extension_list, extension_count,
|
||||
flags);
|
||||
}
|
||||
}
|
||||
else{
|
||||
bool32 is_match = true;
|
||||
if (extension_count > 0){
|
||||
is_match = false;
|
||||
String extension = make_string_cap(info->filename, info->filename_len, info->filename_len + 1);
|
||||
extension = file_extension(extension);
|
||||
for (int32_t j = 0; j < extension_count; ++j){
|
||||
if (match(extension, extension_list[j])){
|
||||
is_match = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (is_match){
|
||||
dir.size = dir_size;
|
||||
append(&dir, info->filename);
|
||||
create_buffer(app, dir.str, dir.size, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
free_file_list(app, list);
|
||||
}
|
||||
|
||||
static void
|
||||
open_all_files_with_extension_in_hot(Application_Links *app, Partition *scratch,
|
||||
char **extension_list, int32_t extension_count,
|
||||
uint32_t flags){
|
||||
Temp_Memory temp = begin_temp_memory(scratch);
|
||||
int32_t max_size = 4096;
|
||||
char *memory = push_array(scratch, char, max_size);
|
||||
String dir = make_string_cap(memory, 0, max_size);
|
||||
dir.size = directory_get_hot(app, dir.str, dir.memory_size);
|
||||
open_all_files_in_directory_with_extension(app, dir,
|
||||
extension_list, extension_count,
|
||||
flags);
|
||||
end_temp_memory(temp);
|
||||
}
|
||||
|
||||
static void
|
||||
open_all_code_with_project_extensions_in_directory(Application_Links *app, String dir, uint32_t flags){
|
||||
int32_t extension_count = 0;
|
||||
char **extension_list = get_current_project_extensions(&extension_count);
|
||||
open_all_files_in_directory_with_extension(app, dir,
|
||||
extension_list, extension_count,
|
||||
flags);
|
||||
}
|
||||
|
||||
CUSTOM_COMMAND_SIG(open_all_code)
|
||||
CUSTOM_DOC("Open all code in the current directory. File types are determined by extensions. An extension is considered code based on the extensions specified in 4coder.config.")
|
||||
{
|
||||
int32_t extension_count = 0;
|
||||
char **extension_list = get_current_project_extensions(&extension_count);
|
||||
open_all_files_with_extension_in_hot(app, &global_part, extension_list, extension_count, 0);
|
||||
}
|
||||
|
||||
CUSTOM_COMMAND_SIG(open_all_code_recursive)
|
||||
CUSTOM_DOC("Works as open_all_code but also runs in all subdirectories.")
|
||||
{
|
||||
int32_t extension_count = 0;
|
||||
char **extension_list = get_current_project_extensions(&extension_count);
|
||||
open_all_files_with_extension_in_hot(app, &global_part, extension_list, extension_count, OpenAllFilesFlag_Recursive);
|
||||
}
|
||||
|
||||
CUSTOM_COMMAND_SIG(close_all_code)
|
||||
CUSTOM_DOC("Closes any buffer with a filename ending with an extension configured to be recognized as a code file type.")
|
||||
{
|
||||
int32_t extension_count = 0;
|
||||
char **extension_list = get_current_project_extensions(&extension_count);
|
||||
close_all_files_with_extension(app, &global_part, extension_list, extension_count);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
// BOTTOM
|
||||
|
|
@ -9,76 +9,171 @@ type: 'drop-in-command-pack'
|
|||
#if !defined(FCODER_PROJECT_COMMANDS_CPP)
|
||||
#define FCODER_PROJECT_COMMANDS_CPP
|
||||
|
||||
#include "4coder_default_framework.h"
|
||||
#include "4coder_lib/4coder_mem.h"
|
||||
#include "4coder_project_commands.h"
|
||||
|
||||
#include "4coder_build_commands.cpp"
|
||||
#include "4coder_open_all_close_all.cpp"
|
||||
|
||||
///////////////////////////////
|
||||
|
||||
// TODO(allen): promote to helper status
|
||||
static FILE*
|
||||
open_file_search_up_path(Partition *scratch, String path, String file_name){
|
||||
Temp_Memory temp = begin_temp_memory(scratch);
|
||||
|
||||
int32_t cap = path.size + file_name.size + 2;
|
||||
char *space = push_array(scratch, char, cap);
|
||||
String name_str = make_string_cap(space, 0, cap);
|
||||
append(&name_str, path);
|
||||
if (name_str.size == 0 || !char_is_slash(name_str.str[name_str.size - 1])){
|
||||
append(&name_str, "/");
|
||||
}
|
||||
|
||||
FILE *file = 0;
|
||||
for (;;){
|
||||
int32_t base_size = name_str.size;
|
||||
append(&name_str, file_name);
|
||||
terminate_with_null(&name_str);
|
||||
file = fopen(name_str.str, "rb");
|
||||
if (file != 0){
|
||||
break;
|
||||
}
|
||||
|
||||
name_str.size = base_size;
|
||||
remove_last_folder(&name_str);
|
||||
if (name_str.size >= base_size){
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
end_temp_memory(temp);
|
||||
return(file);
|
||||
}
|
||||
|
||||
static String
|
||||
dump_file_search_up_path(Partition *arena, String path, String file_name){
|
||||
FILE *file = open_file_search_up_path(arena, path, file_name);
|
||||
String result = {0};
|
||||
if (file != 0){
|
||||
char *m = 0;
|
||||
int32_t s = 0;
|
||||
bool32 success = file_handle_dump(arena, file, &m, &s);
|
||||
if (success){
|
||||
result.str = m;
|
||||
result.size = s;
|
||||
result.memory_size = s;
|
||||
}
|
||||
}
|
||||
return(result);
|
||||
}
|
||||
static Project current_project = {0};
|
||||
|
||||
///////////////////////////////
|
||||
|
||||
struct Project_Setup_Status{
|
||||
bool32 bat_exists;
|
||||
bool32 sh_exists;
|
||||
bool32 project_exists;
|
||||
bool32 everything_exists;
|
||||
};
|
||||
static CString_Array
|
||||
get_project_extensions(Project *project){
|
||||
CString_Array array = {0};
|
||||
array.strings = default_extensions;
|
||||
array.count = ArrayCount(default_extensions);
|
||||
if (project->loaded){
|
||||
array.strings = project->extension_list.exts;
|
||||
array.count = project->extension_list.count;
|
||||
}
|
||||
return(array);
|
||||
}
|
||||
|
||||
///////////////////////////////
|
||||
|
||||
static void
|
||||
load_project_from_config_data(Application_Links *app, Partition *scrtach, char *config_data, int32_t config_data_size, String project_dir){
|
||||
close_all_files_with_extension(Application_Links *app, Partition *scratch_part,
|
||||
CString_Array extension_array){
|
||||
Temp_Memory temp = begin_temp_memory(scratch_part);
|
||||
|
||||
int32_t buffers_to_close_max = partition_remaining(scratch_part)/sizeof(int32_t);
|
||||
int32_t *buffers_to_close = push_array(scratch_part, int32_t, buffers_to_close_max);
|
||||
|
||||
int32_t buffers_to_close_count = 0;
|
||||
bool32 do_repeat = 0;
|
||||
do{
|
||||
buffers_to_close_count = 0;
|
||||
do_repeat = 0;
|
||||
|
||||
uint32_t access = AccessAll;
|
||||
Buffer_Summary buffer = {0};
|
||||
for (buffer = get_buffer_first(app, access);
|
||||
buffer.exists;
|
||||
get_buffer_next(app, &buffer, access)){
|
||||
|
||||
bool32 is_match = 1;
|
||||
if (extension_array.count > 0){
|
||||
is_match = 0;
|
||||
if (buffer.file_name != 0){
|
||||
String extension = file_extension(make_string(buffer.file_name, buffer.file_name_len));
|
||||
for (int32_t i = 0; i < extension_array.count; ++i){
|
||||
if (match(extension, extension_array.strings[i])){
|
||||
is_match = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (is_match){
|
||||
if (buffers_to_close_count >= buffers_to_close_max){
|
||||
do_repeat = 1;
|
||||
break;
|
||||
}
|
||||
buffers_to_close[buffers_to_close_count++] = buffer.buffer_id;
|
||||
}
|
||||
}
|
||||
|
||||
for (int32_t i = 0; i < buffers_to_close_count; ++i){
|
||||
kill_buffer(app, buffer_identifier(buffers_to_close[i]), true, 0);
|
||||
}
|
||||
}while(do_repeat);
|
||||
|
||||
end_temp_memory(temp);
|
||||
}
|
||||
|
||||
static void
|
||||
open_all_files_in_directory_with_extension(Application_Links *app, String dir,
|
||||
CString_Array extension_array,
|
||||
uint32_t flags){
|
||||
File_List list = get_file_list(app, dir.str, dir.size);
|
||||
int32_t dir_size = dir.size;
|
||||
|
||||
for (uint32_t i = 0; i < list.count; ++i){
|
||||
File_Info *info = list.infos + i;
|
||||
if (info->folder){
|
||||
if (((flags&OpenAllFilesFlag_Recursive) != 0) && info->filename[0] != '.'){
|
||||
dir.size = dir_size;
|
||||
append(&dir, info->filename);
|
||||
append(&dir, "/");
|
||||
open_all_files_in_directory_with_extension(app, dir, extension_array, flags);
|
||||
}
|
||||
}
|
||||
else{
|
||||
bool32 is_match = true;
|
||||
if (extension_array.count > 0){
|
||||
is_match = false;
|
||||
String ext = make_string_cap(info->filename, info->filename_len, info->filename_len + 1);
|
||||
ext = file_extension(ext);
|
||||
for (int32_t j = 0; j < extension_array.count; ++j){
|
||||
if (match(ext, extension_array.strings[j])){
|
||||
is_match = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (is_match){
|
||||
dir.size = dir_size;
|
||||
append(&dir, info->filename);
|
||||
create_buffer(app, dir.str, dir.size, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
free_file_list(app, list);
|
||||
}
|
||||
|
||||
static void
|
||||
open_all_files_with_extension_in_hot(Application_Links *app, Partition *scratch,
|
||||
CString_Array extensions_array,
|
||||
uint32_t flags){
|
||||
Temp_Memory temp = begin_temp_memory(scratch);
|
||||
int32_t max_size = 4096;
|
||||
char *memory = push_array(scratch, char, max_size);
|
||||
String dir = make_string_cap(memory, 0, max_size);
|
||||
dir.size = directory_get_hot(app, dir.str, dir.memory_size);
|
||||
open_all_files_in_directory_with_extension(app, dir, extensions_array, flags);
|
||||
end_temp_memory(temp);
|
||||
}
|
||||
|
||||
static void
|
||||
open_all_code_with_project_extensions_in_directory(Application_Links *app, String dir, uint32_t flags){
|
||||
CString_Array array = get_project_extensions(¤t_project);
|
||||
open_all_files_in_directory_with_extension(app, dir, array, flags);
|
||||
}
|
||||
|
||||
////////////////////////////////
|
||||
|
||||
CUSTOM_COMMAND_SIG(close_all_code)
|
||||
CUSTOM_DOC("Closes any buffer with a filename ending with an extension configured to be recognized as a code file type.")
|
||||
{
|
||||
CString_Array extensions = get_project_extensions(¤t_project);
|
||||
close_all_files_with_extension(app, &global_part, extensions);
|
||||
}
|
||||
|
||||
CUSTOM_COMMAND_SIG(open_all_code)
|
||||
CUSTOM_DOC("Open all code in the current directory. File types are determined by extensions. An extension is considered code based on the extensions specified in 4coder.config.")
|
||||
{
|
||||
CString_Array extensions = get_project_extensions(¤t_project);
|
||||
open_all_files_with_extension_in_hot(app, &global_part, extensions, 0);
|
||||
}
|
||||
|
||||
CUSTOM_COMMAND_SIG(open_all_code_recursive)
|
||||
CUSTOM_DOC("Works as open_all_code but also runs in all subdirectories.")
|
||||
{
|
||||
CString_Array extensions = get_project_extensions(¤t_project);
|
||||
open_all_files_with_extension_in_hot(app, &global_part, extensions, OpenAllFilesFlag_Recursive);
|
||||
}
|
||||
|
||||
///////////////////////////////
|
||||
|
||||
static void
|
||||
load_project_from_data(Application_Links *app, Partition *scrtach,
|
||||
char *config_data, int32_t config_data_size,
|
||||
String project_dir){
|
||||
Temp_Memory temp = begin_temp_memory(scrtach);
|
||||
|
||||
char *mem = config_data;
|
||||
|
@ -101,7 +196,7 @@ load_project_from_config_data(Application_Links *app, Partition *scrtach, char *
|
|||
if (current_project.close_all_code_when_this_project_closes){
|
||||
exec_command(app, close_all_code);
|
||||
}
|
||||
current_project = null_project;
|
||||
memset(¤t_project, 0, sizeof(current_project));
|
||||
current_project.loaded = true;
|
||||
|
||||
// Set new project directory
|
||||
|
@ -123,8 +218,8 @@ load_project_from_config_data(Application_Links *app, Partition *scrtach, char *
|
|||
char str_space[512];
|
||||
String str = make_fixed_width_string(str_space);
|
||||
if (config_string_var(item, "extensions", 0, &str)){
|
||||
if (str.size < sizeof(current_project.extension_list.extension_space)){
|
||||
set_extensions(¤t_project.extension_list, str);
|
||||
if (str.size < sizeof(current_project.extension_list.space)){
|
||||
parse_extension_line_to_extension_list(str, ¤t_project.extension_list);
|
||||
print_message(app, str.str, str.size);
|
||||
print_message(app, "\n", 1);
|
||||
}
|
||||
|
@ -264,7 +359,8 @@ load_project_from_config_data(Application_Links *app, Partition *scrtach, char *
|
|||
}
|
||||
|
||||
if (current_project.close_all_files_when_project_opens){
|
||||
close_all_files_with_extension(app, scrtach, 0, 0);
|
||||
CString_Array extension_array = {0};
|
||||
close_all_files_with_extension(app, scrtach, extension_array);
|
||||
}
|
||||
|
||||
// Open all project files
|
||||
|
@ -302,8 +398,8 @@ exec_project_fkey_command(Application_Links *app, int32_t command_ind){
|
|||
|
||||
int32_t command_len = str_size(command);
|
||||
|
||||
View_Summary view_ = {0};
|
||||
View_Summary *view = 0;
|
||||
View_Summary view = {0};
|
||||
View_Summary *view_ptr = 0;
|
||||
Buffer_Identifier buffer_id = {0};
|
||||
uint32_t flags = CLI_OverlapWithConflict;
|
||||
|
||||
|
@ -312,19 +408,18 @@ exec_project_fkey_command(Application_Links *app, int32_t command_ind){
|
|||
int32_t out_len = str_size(out);
|
||||
buffer_id = buffer_identifier(out, out_len);
|
||||
|
||||
view = &view_;
|
||||
|
||||
if (use_build_panel){
|
||||
view_ = get_or_open_build_panel(app);
|
||||
view = get_or_open_build_panel(app);
|
||||
if (match(out, "*compilation*")){
|
||||
set_fancy_font = true;
|
||||
}
|
||||
}
|
||||
else{
|
||||
view_ = get_active_view(app, AccessAll);
|
||||
view = get_active_view(app, AccessAll);
|
||||
}
|
||||
view_ptr = &view;
|
||||
|
||||
prev_location = null_location;
|
||||
memset(&prev_location, 0, sizeof(prev_location));
|
||||
lock_jump_buffer(out, out_len);
|
||||
}
|
||||
else{
|
||||
|
@ -332,7 +427,7 @@ exec_project_fkey_command(Application_Links *app, int32_t command_ind){
|
|||
buffer_id = buffer_identifier(literal("*dump*"));
|
||||
}
|
||||
|
||||
exec_system_command(app, view, buffer_id, current_project.dir, current_project.dir_len, command, command_len, flags);
|
||||
exec_system_command(app, view_ptr, buffer_id, current_project.dir, current_project.dir_len, command, command_len, flags);
|
||||
if (set_fancy_font){
|
||||
set_fancy_compilation_buffer_font(app);
|
||||
}
|
||||
|
@ -345,11 +440,11 @@ CUSTOM_COMMAND_SIG(load_project)
|
|||
CUSTOM_DOC("Looks for a project.4coder file in the current directory and tries to load it. Looks in parent directories until a project file is found or there are no more parents.")
|
||||
{
|
||||
Partition *part = &global_part;
|
||||
save_all_dirty_buffers(app);
|
||||
|
||||
Temp_Memory temp = begin_temp_memory(part);
|
||||
char project_file_space[512];
|
||||
String project_path = make_fixed_width_string(project_file_space);
|
||||
save_all_dirty_buffers(app);
|
||||
char space[512];
|
||||
String project_path = make_fixed_width_string(space);
|
||||
project_path.size = directory_get_hot(app, project_path.str, project_path.memory_size);
|
||||
if (project_path.size >= project_path.memory_size){
|
||||
print_message(app, literal("Hot directory longer than hard coded path buffer.\n"));
|
||||
|
@ -360,20 +455,20 @@ CUSTOM_DOC("Looks for a project.4coder file in the current directory and tries t
|
|||
else{
|
||||
String data = dump_file_search_up_path(part, project_path, make_lit_string("project.4coder"));
|
||||
if (data.str != 0){
|
||||
load_project_from_config_data(app, part, data.str, data.size, project_path);
|
||||
load_project_from_data(app, part, data.str, data.size, project_path);
|
||||
}
|
||||
else{
|
||||
char message_space[512];
|
||||
String message = make_fixed_width_string(message_space);
|
||||
append_sc(&message, "Did not find project.4coder. ");
|
||||
append(&message, "Did not find project.4coder. ");
|
||||
if (current_project.dir != 0){
|
||||
append_sc(&message, "Continuing with: ");
|
||||
append_sc(&message, current_project.dir);
|
||||
append(&message, "Continuing with: ");
|
||||
append(&message, current_project.dir);
|
||||
}
|
||||
else{
|
||||
append_sc(&message, "Continuing without a project");
|
||||
append(&message, "Continuing without a project");
|
||||
}
|
||||
append_s_char(&message, '\n');
|
||||
append(&message, '\n');
|
||||
print_message(app, message.str, message.size);
|
||||
}
|
||||
}
|
||||
|
@ -383,46 +478,35 @@ CUSTOM_DOC("Looks for a project.4coder file in the current directory and tries t
|
|||
CUSTOM_COMMAND_SIG(reload_current_project)
|
||||
CUSTOM_DOC("If a project file has already been loaded, reloads the same file. Useful for when the project configuration is changed.")
|
||||
{
|
||||
Partition *part = &global_part;
|
||||
|
||||
if (current_project.loaded){
|
||||
save_all_dirty_buffers(app);
|
||||
|
||||
char space[512];
|
||||
String project_path = make_fixed_width_string(space);
|
||||
append(&project_path, make_string(current_project.dir, current_project.dir_len));
|
||||
if (project_path.size < 1 || !char_is_slash(project_path.str[project_path.size - 1])){
|
||||
if (project_path.size == 0 || !char_is_slash(project_path.str[project_path.size - 1])){
|
||||
append(&project_path, "/");
|
||||
}
|
||||
int32_t path_size = project_path.size;
|
||||
append(&project_path, "project.4coder");
|
||||
terminate_with_null(&project_path);
|
||||
|
||||
FILE *file = fopen(project_path.str, "rb");
|
||||
if (file != 0){
|
||||
project_path.size = path_size;
|
||||
terminate_with_null(&project_path);
|
||||
|
||||
Partition *part = &global_part;
|
||||
Temp_Memory temp = begin_temp_memory(part);
|
||||
|
||||
char *mem = 0;
|
||||
int32_t size = 0;
|
||||
bool32 file_read_success = file_handle_dump(part, file, &mem, &size);
|
||||
fclose(file);
|
||||
|
||||
if (file_read_success){
|
||||
load_project_from_config_data(app, part, mem, size, project_path);
|
||||
String data = dump_file_handle(part, file);
|
||||
if (data.str != 0){
|
||||
load_project_from_data(app, part, data.str, data.size, project_path);
|
||||
}
|
||||
|
||||
end_temp_memory(temp);
|
||||
fclose(file);
|
||||
}
|
||||
else{
|
||||
print_message(app, literal("project.4coder file not found. Previous configuration left unchanged."));
|
||||
print_message(app, literal("project.4coder file not found. Project configuration unchanged."));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
///////////////////////////////
|
||||
|
||||
CUSTOM_COMMAND_SIG(project_fkey_command)
|
||||
CUSTOM_DOC("Run an 'fkey command' configured in a project.4coder file. Determines the index of the 'fkey command' by which function key or numeric key was pressed to trigger the command.")
|
||||
{
|
||||
|
@ -442,7 +526,6 @@ CUSTOM_DOC("Run an 'fkey command' configured in a project.4coder file. Determin
|
|||
ind = 9;
|
||||
got_ind = true;
|
||||
}
|
||||
|
||||
if (got_ind){
|
||||
exec_project_fkey_command(app, ind);
|
||||
}
|
||||
|
@ -496,7 +579,6 @@ project_is_setup(Application_Links *app, char *dir, int32_t dir_len, int32_t dir
|
|||
return(result);
|
||||
}
|
||||
|
||||
#include <stdio.h>
|
||||
CUSTOM_COMMAND_SIG(setup_new_project)
|
||||
CUSTOM_DOC("Queries the user for several configuration options and initializes a new 4coder project with build scripts for every OS.")
|
||||
{
|
||||
|
|
|
@ -0,0 +1,56 @@
|
|||
/*
|
||||
4coder_project_commands.h - type header paired with 4coder_project_commands.cpp
|
||||
|
||||
type: 'type-header'
|
||||
*/
|
||||
|
||||
// TOP
|
||||
|
||||
#if !defined(FCODER_PROJECT_COMMANDS_H)
|
||||
#define FCODER_PROJECT_COMMANDS_H
|
||||
|
||||
#include "4coder_default_framework.h"
|
||||
#include "4coder_lib/4coder_mem.h"
|
||||
|
||||
enum{
|
||||
OpenAllFilesFlag_Recursive = 1,
|
||||
};
|
||||
|
||||
///////////////////////////////
|
||||
|
||||
struct Fkey_Command{
|
||||
char command[128];
|
||||
char out[128];
|
||||
bool32 use_build_panel;
|
||||
bool32 save_dirty_buffers;
|
||||
};
|
||||
|
||||
struct Project{
|
||||
char dir_space[256];
|
||||
char *dir;
|
||||
int32_t dir_len;
|
||||
|
||||
Extension_List extension_list;
|
||||
Fkey_Command fkey_commands[16];
|
||||
|
||||
bool32 close_all_code_when_this_project_closes;
|
||||
bool32 close_all_files_when_project_opens;
|
||||
|
||||
bool32 open_recursively;
|
||||
|
||||
bool32 loaded;
|
||||
};
|
||||
|
||||
///////////////////////////////
|
||||
|
||||
struct Project_Setup_Status{
|
||||
bool32 bat_exists;
|
||||
bool32 sh_exists;
|
||||
bool32 project_exists;
|
||||
bool32 everything_exists;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
// BOTTOM
|
||||
|
|
@ -240,7 +240,7 @@ build(u32 flags, u32 arch, char *code_path, char **code_files, char *out_path, c
|
|||
|
||||
if (flags & ICON){
|
||||
// TODO(allen): Get this icon in the non-source repository to avoid having to work around it in the future.
|
||||
//fm_add_to_line(line, CL_ICON);
|
||||
fm_add_to_line(line, CL_ICON);
|
||||
}
|
||||
|
||||
if (flags & DEBUG_INFO){
|
||||
|
|
|
@ -66,7 +66,7 @@ internal
|
|||
Sys_File_Can_Be_Made_Sig(system_file_can_be_made){
|
||||
HANDLE file = CreateFile_utf8(filename, FILE_APPEND_DATA, 0, 0, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, 0);
|
||||
b32 result = false;
|
||||
if (file != 0 && file != INVALID_HANDLE_VALUE){
|
||||
if (file != INVALID_HANDLE_VALUE){
|
||||
CloseHandle(file);
|
||||
result = true;
|
||||
}
|
||||
|
@ -317,6 +317,9 @@ Sys_Load_Handle_Sig(system_load_handle){
|
|||
*(HANDLE*)handle_out = file;
|
||||
result = true;
|
||||
}
|
||||
else{
|
||||
win32_output_error_string(true);
|
||||
}
|
||||
|
||||
return(result);
|
||||
}
|
||||
|
|
|
@ -2,27 +2,27 @@
|
|||
#if !defined(FTECH_INTEGERS)
|
||||
#define FTECH_INTEGERS
|
||||
#include <stdint.h>
|
||||
typedef int8_t i8_4ed;
|
||||
typedef int16_t i16_4ed;
|
||||
typedef int32_t i32_4ed;
|
||||
typedef int64_t i64_4ed;
|
||||
typedef int8_t i8_4tech;
|
||||
typedef int16_t i16_4tech;
|
||||
typedef int32_t i32_4tech;
|
||||
typedef int64_t i64_4tech;
|
||||
|
||||
typedef uint8_t u8_4ed;
|
||||
typedef uint16_t u16_4ed;
|
||||
typedef uint32_t u32_4ed;
|
||||
typedef uint64_t u64_4ed;
|
||||
typedef uint8_t u8_4tech;
|
||||
typedef uint16_t u16_4tech;
|
||||
typedef uint32_t u32_4tech;
|
||||
typedef uint64_t u64_4tech;
|
||||
|
||||
#if defined(FTECH_32_BIT)
|
||||
typedef u32_4ed umem_4ed;
|
||||
typedef u32_4tech umem_4tech;
|
||||
#else
|
||||
typedef u64_4ed umem_4ed;
|
||||
typedef u64_4tech umem_4tech;
|
||||
#endif
|
||||
|
||||
typedef float f32_4ed;
|
||||
typedef double f64_4ed;
|
||||
typedef float f32_4tech;
|
||||
typedef double f64_4tech;
|
||||
|
||||
typedef int8_t b8_4ed;
|
||||
typedef int32_t b32_4ed;
|
||||
typedef int8_t b8_4tech;
|
||||
typedef int32_t b32_4tech;
|
||||
#endif
|
||||
|
||||
#if !defined(Assert)
|
||||
|
|
Loading…
Reference in New Issue