removed parameter stack, autogenerate more API stuff

master
Allen Webster 2016-06-13 12:56:33 -04:00
parent 3bde12d039
commit 33c8339c92
9 changed files with 730 additions and 1061 deletions

View File

@ -10,6 +10,11 @@
#include "4coder_buffer_types.h" #include "4coder_buffer_types.h"
#include "4coder_gui.h" #include "4coder_gui.h"
#define MDFR_NONE 0x0
#define MDFR_CTRL 0x1
#define MDFR_ALT 0x2
#define MDFR_SHIFT 0x4
#ifndef FRED_STRING_STRUCT #ifndef FRED_STRING_STRUCT
#define FRED_STRING_STRUCT #define FRED_STRING_STRUCT
typedef struct String{ typedef struct String{
@ -40,7 +45,6 @@ typedef struct Key_Event_Data{
Code keycode; Code keycode;
Code character; Code character;
Code character_no_caps_lock; Code character_no_caps_lock;
char modifiers[MDFR_INDEX_COUNT]; char modifiers[MDFR_INDEX_COUNT];
} Key_Event_Data; } Key_Event_Data;
inline Key_Event_Data inline Key_Event_Data
@ -58,7 +62,6 @@ typedef struct Mouse_State{
int x, y; int x, y;
} Mouse_State; } Mouse_State;
typedef union Range{ typedef union Range{
struct{ struct{
int min, max; int min, max;
@ -83,72 +86,6 @@ make_range(int p1, int p2){
} }
typedef enum Dynamic_Type{
dynamic_type_int,
dynamic_type_string,
// never below this
dynamic_type_count
} Dynamic_Type;
typedef struct Dynamic{
int type;
union{
struct{
int str_len;
char *str_value;
};
int int_value;
};
} Dynamic;
inline Dynamic
dynamic_int(int x){
Dynamic result;
result.type = dynamic_type_int;
result.int_value = x;
return result;
}
inline Dynamic
dynamic_string(const char *string, int len){
Dynamic result;
result.type = dynamic_type_string;
result.str_len = len;
result.str_value = (char*)(string);
return result;
}
inline int
dynamic_to_int(Dynamic *dynamic){
int result = 0;
if (dynamic->type == dynamic_type_int){
result = dynamic->int_value;
}
return result;
}
inline char*
dynamic_to_string(Dynamic *dynamic, int *len){
char *result = 0;
if (dynamic->type == dynamic_type_string){
result = dynamic->str_value;
*len = dynamic->str_len;
}
return result;
}
inline int
dynamic_to_bool(Dynamic *dynamic){
int result = 0;
if (dynamic->type == dynamic_type_int){
result = (dynamic->int_value != 0);
}
else{
result = 1;
}
return result;
}
typedef struct File_Info{ typedef struct File_Info{
String filename; String filename;
int folder; int folder;
@ -166,17 +103,18 @@ typedef struct File_List{
int block_size; int block_size;
} File_List; } File_List;
#define MDFR_NONE 0x0 // NOTE(allen|a4.0.7): This is used to identify which buffer
#define MDFR_CTRL 0x1 // an operation should work on when you might want to
#define MDFR_ALT 0x2 // identify it by id or by name.
#define MDFR_SHIFT 0x4 typedef struct Buffer_Identifier{
char *name;
int name_len;
int id;
} Buffer_Identifier;
enum Command_ID{ enum Command_ID{
cmdid_null, cmdid_null,
cmdid_seek_left,
cmdid_seek_right,
cmdid_center_view, cmdid_center_view,
cmdid_left_adjust_view, cmdid_left_adjust_view,
@ -196,6 +134,7 @@ enum Command_ID{
cmdid_interactive_open, cmdid_interactive_open,
cmdid_reopen, cmdid_reopen,
cmdid_save, cmdid_save,
cmdid_save_as,
cmdid_interactive_switch_buffer, cmdid_interactive_switch_buffer,
cmdid_interactive_kill_buffer, cmdid_interactive_kill_buffer,
cmdid_kill_buffer, cmdid_kill_buffer,
@ -207,7 +146,6 @@ enum Command_ID{
cmdid_toggle_show_whitespace, cmdid_toggle_show_whitespace,
cmdid_clean_all_lines, cmdid_clean_all_lines,
cmdid_auto_tab_range,
cmdid_eol_dosify, cmdid_eol_dosify,
cmdid_eol_nixify, cmdid_eol_nixify,
@ -227,36 +165,26 @@ enum Command_ID{
cmdid_hide_scrollbar, cmdid_hide_scrollbar,
cmdid_show_scrollbar, cmdid_show_scrollbar,
cmdid_set_settings,
cmdid_command_line,
// //
cmdid_count cmdid_count
}; };
enum Param_ID{ enum{
par_range_start, CLI_OverlapWithConflict = 0x1,
par_range_end, CLI_AlwaysBindToView = 0x2,
par_name,
par_buffer_id,
par_do_in_background,
par_flags,
par_lex_as_cpp_file,
par_wrap_lines,
par_key_mapid,
par_show_whitespace,
par_cli_path,
par_cli_command,
par_clear_blank_lines,
par_use_tabs,
par_save_update_name,
// never below this
par_type_count
}; };
#define CLI_OverlapWithConflict 0x1 enum{
#define CLI_AlwaysBindToView 0x2 BufferSetting_Null,
BufferSetting_Lex,
BufferSetting_WrapLine,
BufferSetting_MapID,
};
enum{
AutoTab_ClearLine = 0x1,
AutoTab_UseTab = 0x2
};
// These are regular hooks, any of them can be set to any function // These are regular hooks, any of them can be set to any function
// that matches the HOOK_SIG pattern. // that matches the HOOK_SIG pattern.

View File

@ -1,7 +1,5 @@
#define PUSH_PARAMETER_SIG(n) void n(Application_Links *app, Dynamic param, Dynamic value) #define EXEC_COMMAND_SIG(n) void n(Application_Links *app, int command_id)
#define PUSH_MEMORY_SIG(n) char* n(Application_Links *app, int len) #define EXEC_SYSTEM_COMMAND_SIG(n) int n(Application_Links *app, View_Summary *view, Buffer_Identifier buffer, char *path, int path_len, char *command, int command_len, unsigned int flags)
#define EXEC_COMMAND_KEEP_STACK_SIG(n) void n(Application_Links *app, int command_id)
#define CLEAR_PARAMETERS_SIG(n) void n(Application_Links *app)
#define DIRECTORY_GET_HOT_SIG(n) int n(Application_Links *app, char *out, int capacity) #define DIRECTORY_GET_HOT_SIG(n) int n(Application_Links *app, char *out, int capacity)
#define GET_4ED_PATH_SIG(n) int n(Application_Links *app, char *out, int capacity) #define GET_4ED_PATH_SIG(n) int n(Application_Links *app, char *out, int capacity)
#define FILE_EXISTS_SIG(n) int n(Application_Links *app, char *filename, int len) #define FILE_EXISTS_SIG(n) int n(Application_Links *app, char *filename, int len)
@ -16,17 +14,21 @@
#define REFRESH_BUFFER_SIG(n) int n(Application_Links *app, Buffer_Summary *buffer) #define REFRESH_BUFFER_SIG(n) int n(Application_Links *app, Buffer_Summary *buffer)
#define BUFFER_READ_RANGE_SIG(n) int n(Application_Links *app, Buffer_Summary *buffer, int start, int end, char *out) #define BUFFER_READ_RANGE_SIG(n) int n(Application_Links *app, Buffer_Summary *buffer, int start, int end, char *out)
#define BUFFER_REPLACE_RANGE_SIG(n) int n(Application_Links *app, Buffer_Summary *buffer, int start, int end, char *str, int len) #define BUFFER_REPLACE_RANGE_SIG(n) int n(Application_Links *app, Buffer_Summary *buffer, int start, int end, char *str, int len)
#define BUFFER_SET_POS_SIG(n) int n(Application_Links *app, Buffer_Summary *buffer, int pos) #define BUFFER_SEEK_SIG(n) int n(Application_Links *app, Buffer_Summary *buffer, int start_pos, int seek_forward, unsigned int flags)
#define BUFFER_SET_SETTING_SIG(n) int n(Application_Links *app, Buffer_Summary *buffer, int setting, int value)
#define GET_VIEW_FIRST_SIG(n) View_Summary n(Application_Links *app) #define GET_VIEW_FIRST_SIG(n) View_Summary n(Application_Links *app)
#define GET_VIEW_NEXT_SIG(n) void n(Application_Links *app, View_Summary *view) #define GET_VIEW_NEXT_SIG(n) void n(Application_Links *app, View_Summary *view)
#define GET_VIEW_SIG(n) View_Summary n(Application_Links *app, int index) #define GET_VIEW_SIG(n) View_Summary n(Application_Links *app, int index)
#define GET_ACTIVE_VIEW_SIG(n) View_Summary n(Application_Links *app) #define GET_ACTIVE_VIEW_SIG(n) View_Summary n(Application_Links *app)
#define REFRESH_VIEW_SIG(n) int n(Application_Links *app, View_Summary *view) #define REFRESH_VIEW_SIG(n) int n(Application_Links *app, View_Summary *view)
#define VIEW_AUTO_TAB_SIG(n) int n(Application_Links *app, View_Summary *view, int start, int end, int tab_width, unsigned int flags)
#define VIEW_COMPUTE_CURSOR_SIG(n) Full_Cursor n(Application_Links *app, View_Summary *view, Buffer_Seek seek) #define VIEW_COMPUTE_CURSOR_SIG(n) Full_Cursor n(Application_Links *app, View_Summary *view, Buffer_Seek seek)
#define VIEW_SET_CURSOR_SIG(n) int n(Application_Links *app, View_Summary *view, Buffer_Seek seek, int set_preferred_x) #define VIEW_SET_CURSOR_SIG(n) int n(Application_Links *app, View_Summary *view, Buffer_Seek seek, int set_preferred_x)
#define VIEW_SET_MARK_SIG(n) int n(Application_Links *app, View_Summary *view, Buffer_Seek seek) #define VIEW_SET_MARK_SIG(n) int n(Application_Links *app, View_Summary *view, Buffer_Seek seek)
#define VIEW_SET_HIGHLIGHT_SIG(n) int n(Application_Links *app, View_Summary *view, int start, int end, int turn_on) #define VIEW_SET_HIGHLIGHT_SIG(n) int n(Application_Links *app, View_Summary *view, int start, int end, int turn_on)
#define VIEW_SET_BUFFER_SIG(n) int n(Application_Links *app, View_Summary *view, int buffer_id) #define VIEW_SET_BUFFER_SIG(n) int n(Application_Links *app, View_Summary *view, int buffer_id)
#define VIEW_OPEN_FILE_SIG(n) int n(Application_Links *app, View_Summary *view, char *filename, int filename_len, int do_in_background)
#define VIEW_KILL_FILE_SIG(n) int n(Application_Links *app, View_Summary *view, Buffer_Identifier buffer)
#define GET_USER_INPUT_SIG(n) User_Input n(Application_Links *app, unsigned int get_type, unsigned int abort_type) #define GET_USER_INPUT_SIG(n) User_Input n(Application_Links *app, unsigned int get_type, unsigned int abort_type)
#define GET_COMMAND_INPUT_SIG(n) User_Input n(Application_Links *app) #define GET_COMMAND_INPUT_SIG(n) User_Input n(Application_Links *app)
#define GET_EVENT_MESSAGE_SIG(n) Event_Message n(Application_Links *app) #define GET_EVENT_MESSAGE_SIG(n) Event_Message n(Application_Links *app)
@ -34,16 +36,12 @@
#define START_QUERY_BAR_SIG(n) int n(Application_Links *app, Query_Bar *bar, unsigned int flags) #define START_QUERY_BAR_SIG(n) int n(Application_Links *app, Query_Bar *bar, unsigned int flags)
#define END_QUERY_BAR_SIG(n) void n(Application_Links *app, Query_Bar *bar, unsigned int flags) #define END_QUERY_BAR_SIG(n) void n(Application_Links *app, Query_Bar *bar, unsigned int flags)
#define PRINT_MESSAGE_SIG(n) void n(Application_Links *app, char *string, int len) #define PRINT_MESSAGE_SIG(n) void n(Application_Links *app, char *string, int len)
#define GET_GUI_FUNCTIONS_SIG(n) GUI_Functions* n(Application_Links *app)
#define GET_GUI_SIG(n) GUI* n(Application_Links *app, int view_id)
#define CHANGE_THEME_SIG(n) void n(Application_Links *app, char *name, int len) #define CHANGE_THEME_SIG(n) void n(Application_Links *app, char *name, int len)
#define CHANGE_FONT_SIG(n) void n(Application_Links *app, char *name, int len) #define CHANGE_FONT_SIG(n) void n(Application_Links *app, char *name, int len)
#define SET_THEME_COLORS_SIG(n) void n(Application_Links *app, Theme_Color *colors, int count) #define SET_THEME_COLORS_SIG(n) void n(Application_Links *app, Theme_Color *colors, int count)
extern "C"{ extern "C"{
typedef PUSH_PARAMETER_SIG(Push_Parameter_Function); typedef EXEC_COMMAND_SIG(Exec_Command_Function);
typedef PUSH_MEMORY_SIG(Push_Memory_Function); typedef EXEC_SYSTEM_COMMAND_SIG(Exec_System_Command_Function);
typedef EXEC_COMMAND_KEEP_STACK_SIG(Exec_Command_Keep_Stack_Function);
typedef CLEAR_PARAMETERS_SIG(Clear_Parameters_Function);
typedef DIRECTORY_GET_HOT_SIG(Directory_Get_Hot_Function); typedef DIRECTORY_GET_HOT_SIG(Directory_Get_Hot_Function);
typedef GET_4ED_PATH_SIG(Get_4ed_Path_Function); typedef GET_4ED_PATH_SIG(Get_4ed_Path_Function);
typedef FILE_EXISTS_SIG(File_Exists_Function); typedef FILE_EXISTS_SIG(File_Exists_Function);
@ -58,17 +56,21 @@ extern "C"{
typedef REFRESH_BUFFER_SIG(Refresh_Buffer_Function); typedef REFRESH_BUFFER_SIG(Refresh_Buffer_Function);
typedef BUFFER_READ_RANGE_SIG(Buffer_Read_Range_Function); typedef BUFFER_READ_RANGE_SIG(Buffer_Read_Range_Function);
typedef BUFFER_REPLACE_RANGE_SIG(Buffer_Replace_Range_Function); typedef BUFFER_REPLACE_RANGE_SIG(Buffer_Replace_Range_Function);
typedef BUFFER_SET_POS_SIG(Buffer_Set_Pos_Function); typedef BUFFER_SEEK_SIG(Buffer_Seek_Function);
typedef BUFFER_SET_SETTING_SIG(Buffer_Set_Setting_Function);
typedef GET_VIEW_FIRST_SIG(Get_View_First_Function); typedef GET_VIEW_FIRST_SIG(Get_View_First_Function);
typedef GET_VIEW_NEXT_SIG(Get_View_Next_Function); typedef GET_VIEW_NEXT_SIG(Get_View_Next_Function);
typedef GET_VIEW_SIG(Get_View_Function); typedef GET_VIEW_SIG(Get_View_Function);
typedef GET_ACTIVE_VIEW_SIG(Get_Active_View_Function); typedef GET_ACTIVE_VIEW_SIG(Get_Active_View_Function);
typedef REFRESH_VIEW_SIG(Refresh_View_Function); typedef REFRESH_VIEW_SIG(Refresh_View_Function);
typedef VIEW_AUTO_TAB_SIG(View_Auto_Tab_Function);
typedef VIEW_COMPUTE_CURSOR_SIG(View_Compute_Cursor_Function); typedef VIEW_COMPUTE_CURSOR_SIG(View_Compute_Cursor_Function);
typedef VIEW_SET_CURSOR_SIG(View_Set_Cursor_Function); typedef VIEW_SET_CURSOR_SIG(View_Set_Cursor_Function);
typedef VIEW_SET_MARK_SIG(View_Set_Mark_Function); typedef VIEW_SET_MARK_SIG(View_Set_Mark_Function);
typedef VIEW_SET_HIGHLIGHT_SIG(View_Set_Highlight_Function); typedef VIEW_SET_HIGHLIGHT_SIG(View_Set_Highlight_Function);
typedef VIEW_SET_BUFFER_SIG(View_Set_Buffer_Function); typedef VIEW_SET_BUFFER_SIG(View_Set_Buffer_Function);
typedef VIEW_OPEN_FILE_SIG(View_Open_File_Function);
typedef VIEW_KILL_FILE_SIG(View_Kill_File_Function);
typedef GET_USER_INPUT_SIG(Get_User_Input_Function); typedef GET_USER_INPUT_SIG(Get_User_Input_Function);
typedef GET_COMMAND_INPUT_SIG(Get_Command_Input_Function); typedef GET_COMMAND_INPUT_SIG(Get_Command_Input_Function);
typedef GET_EVENT_MESSAGE_SIG(Get_Event_Message_Function); typedef GET_EVENT_MESSAGE_SIG(Get_Event_Message_Function);
@ -76,8 +78,6 @@ extern "C"{
typedef START_QUERY_BAR_SIG(Start_Query_Bar_Function); typedef START_QUERY_BAR_SIG(Start_Query_Bar_Function);
typedef END_QUERY_BAR_SIG(End_Query_Bar_Function); typedef END_QUERY_BAR_SIG(End_Query_Bar_Function);
typedef PRINT_MESSAGE_SIG(Print_Message_Function); typedef PRINT_MESSAGE_SIG(Print_Message_Function);
typedef GET_GUI_FUNCTIONS_SIG(Get_GUI_Functions_Function);
typedef GET_GUI_SIG(Get_GUI_Function);
typedef CHANGE_THEME_SIG(Change_Theme_Function); typedef CHANGE_THEME_SIG(Change_Theme_Function);
typedef CHANGE_FONT_SIG(Change_Font_Function); typedef CHANGE_FONT_SIG(Change_Font_Function);
typedef SET_THEME_COLORS_SIG(Set_Theme_Colors_Function); typedef SET_THEME_COLORS_SIG(Set_Theme_Colors_Function);
@ -85,10 +85,8 @@ extern "C"{
struct Application_Links{ struct Application_Links{
void *memory; void *memory;
int memory_size; int memory_size;
Push_Parameter_Function *push_parameter; Exec_Command_Function *exec_command;
Push_Memory_Function *push_memory; Exec_System_Command_Function *exec_system_command;
Exec_Command_Keep_Stack_Function *exec_command_keep_stack;
Clear_Parameters_Function *clear_parameters;
Directory_Get_Hot_Function *directory_get_hot; Directory_Get_Hot_Function *directory_get_hot;
Get_4ed_Path_Function *get_4ed_path; Get_4ed_Path_Function *get_4ed_path;
File_Exists_Function *file_exists; File_Exists_Function *file_exists;
@ -103,17 +101,21 @@ struct Application_Links{
Refresh_Buffer_Function *refresh_buffer; Refresh_Buffer_Function *refresh_buffer;
Buffer_Read_Range_Function *buffer_read_range; Buffer_Read_Range_Function *buffer_read_range;
Buffer_Replace_Range_Function *buffer_replace_range; Buffer_Replace_Range_Function *buffer_replace_range;
Buffer_Set_Pos_Function *buffer_set_pos; Buffer_Seek_Function *buffer_seek;
Buffer_Set_Setting_Function *buffer_set_setting;
Get_View_First_Function *get_view_first; Get_View_First_Function *get_view_first;
Get_View_Next_Function *get_view_next; Get_View_Next_Function *get_view_next;
Get_View_Function *get_view; Get_View_Function *get_view;
Get_Active_View_Function *get_active_view; Get_Active_View_Function *get_active_view;
Refresh_View_Function *refresh_view; Refresh_View_Function *refresh_view;
View_Auto_Tab_Function *view_auto_tab;
View_Compute_Cursor_Function *view_compute_cursor; View_Compute_Cursor_Function *view_compute_cursor;
View_Set_Cursor_Function *view_set_cursor; View_Set_Cursor_Function *view_set_cursor;
View_Set_Mark_Function *view_set_mark; View_Set_Mark_Function *view_set_mark;
View_Set_Highlight_Function *view_set_highlight; View_Set_Highlight_Function *view_set_highlight;
View_Set_Buffer_Function *view_set_buffer; View_Set_Buffer_Function *view_set_buffer;
View_Open_File_Function *view_open_file;
View_Kill_File_Function *view_kill_file;
Get_User_Input_Function *get_user_input; Get_User_Input_Function *get_user_input;
Get_Command_Input_Function *get_command_input; Get_Command_Input_Function *get_command_input;
Get_Event_Message_Function *get_event_message; Get_Event_Message_Function *get_event_message;
@ -121,8 +123,6 @@ struct Application_Links{
Start_Query_Bar_Function *start_query_bar; Start_Query_Bar_Function *start_query_bar;
End_Query_Bar_Function *end_query_bar; End_Query_Bar_Function *end_query_bar;
Print_Message_Function *print_message; Print_Message_Function *print_message;
Get_GUI_Functions_Function *get_gui_functions;
Get_GUI_Function *get_gui;
Change_Theme_Function *change_theme; Change_Theme_Function *change_theme;
Change_Font_Function *change_font; Change_Font_Function *change_font;
Set_Theme_Colors_Function *set_theme_colors; Set_Theme_Colors_Function *set_theme_colors;
@ -131,3 +131,45 @@ struct Application_Links{
void *current_coroutine; void *current_coroutine;
int type_coroutine; int type_coroutine;
}; };
#define FillAppLinksAPI(app_links) do{\
app_links->exec_command = external_exec_command;\
app_links->exec_system_command = external_exec_system_command;\
app_links->directory_get_hot = external_directory_get_hot;\
app_links->get_4ed_path = external_get_4ed_path;\
app_links->file_exists = external_file_exists;\
app_links->directory_cd = external_directory_cd;\
app_links->get_file_list = external_get_file_list;\
app_links->free_file_list = external_free_file_list;\
app_links->get_buffer_first = external_get_buffer_first;\
app_links->get_buffer_next = external_get_buffer_next;\
app_links->get_buffer = external_get_buffer;\
app_links->get_parameter_buffer = external_get_parameter_buffer;\
app_links->get_buffer_by_name = external_get_buffer_by_name;\
app_links->refresh_buffer = external_refresh_buffer;\
app_links->buffer_read_range = external_buffer_read_range;\
app_links->buffer_replace_range = external_buffer_replace_range;\
app_links->buffer_seek = external_buffer_seek;\
app_links->buffer_set_setting = external_buffer_set_setting;\
app_links->get_view_first = external_get_view_first;\
app_links->get_view_next = external_get_view_next;\
app_links->get_view = external_get_view;\
app_links->get_active_view = external_get_active_view;\
app_links->refresh_view = external_refresh_view;\
app_links->view_auto_tab = external_view_auto_tab;\
app_links->view_compute_cursor = external_view_compute_cursor;\
app_links->view_set_cursor = external_view_set_cursor;\
app_links->view_set_mark = external_view_set_mark;\
app_links->view_set_highlight = external_view_set_highlight;\
app_links->view_set_buffer = external_view_set_buffer;\
app_links->view_open_file = external_view_open_file;\
app_links->view_kill_file = external_view_kill_file;\
app_links->get_user_input = external_get_user_input;\
app_links->get_command_input = external_get_command_input;\
app_links->get_event_message = external_get_event_message;\
app_links->get_mouse_state = external_get_mouse_state;\
app_links->start_query_bar = external_start_query_bar;\
app_links->end_query_bar = external_end_query_bar;\
app_links->print_message = external_print_message;\
app_links->change_theme = external_change_theme;\
app_links->change_font = external_change_font;\
app_links->set_theme_colors = external_set_theme_colors; } while(false)

View File

@ -94,78 +94,21 @@ CUSTOM_COMMAND_SIG(rewrite_as_single_caps){
} }
CUSTOM_COMMAND_SIG(open_my_files){ CUSTOM_COMMAND_SIG(open_my_files){
// NOTE(allen|a3.1): EXAMPLE probably not useful in practice. // TODO(allen|a4.0.8): comment
// View_Summary view = app->get_active_view(app);
// The command cmdid_interactive_open can now open app->view_open_file(app, &view, literal("w:/4ed/data/test/basic.cpp"), false);
// a file specified on the parameter stack. If the file does not exist
// cmdid_interactive_open behaves as usual. If par_do_in_background
// is set to true the command is prevented from changing the view under
// any circumstance.
push_parameter(app, par_name, literal("w:/4ed/data/test/basic.cpp"));
exec_command(app, cmdid_interactive_open);
#if 0
exec_command(app, cmdid_change_active_panel);
char my_file[256];
int my_file_len;
my_file_len = sizeof("w:/4ed/data/test/basic.txt") - 1;
for (int i = 0; i < my_file_len; ++i){
my_file[i] = ("w:/4ed/data/test/basic.txt")[i];
}
// NOTE(allen|a3.1): null terminators are not needed for strings.
push_parameter(app, par_name, my_file, my_file_len);
exec_command(app, cmdid_interactive_open);
exec_command(app, cmdid_change_active_panel);
#endif
} }
CUSTOM_COMMAND_SIG(build_at_launch_location){ CUSTOM_COMMAND_SIG(build_at_launch_location){
// NOTE(allen|a3.3): EXAMPLE probably not all that useful in practice. // TODO(allen|a4.0.8): comment
// View_Summary view = app->get_active_view(app);
// An example of calling build by setting all app->exec_system_command(app, &view,
// parameters directly. This only works if build.bat can be called buffer_identifier(literal("*compilation*")),
// from the directory the application is launched at. literal("."),
push_parameter(app, par_flags, CLI_OverlapWithConflict); literal("build"),
push_parameter(app, par_name, literal("*compilation*")); CLI_OverlapWithConflict);
push_parameter(app, par_cli_path, literal("."));
push_parameter(app, par_cli_command, literal("build"));
exec_command(app, cmdid_command_line);
} }
#if 0
// NOTE(allen|a4) See 4coder_styles.h for a list of available style tags.
// There are style tags corresponding to every color in the theme editor.
CUSTOM_COMMAND_SIG(improve_theme){
Theme_Color colors[] = {
{Stag_Bar, 0xFF0088},
{Stag_Margin, 0x880088},
{Stag_Margin_Hover, 0xAA0088},
{Stag_Margin_Active, 0xDD0088},
{Stag_Cursor, 0xFF0000},
};
int count = ArrayCount(colors);
app->set_theme_colors(app, colors, count);
}
CUSTOM_COMMAND_SIG(ruin_theme){
Theme_Color colors[] = {
{Stag_Bar, 0x888888},
{Stag_Margin, 0x181818},
{Stag_Margin_Hover, 0x252525},
{Stag_Margin_Active, 0x323232},
{Stag_Cursor, 0x00EE00},
};
int count = ArrayCount(colors);
app->set_theme_colors(app, colors, count);
}
#endif
HOOK_SIG(my_start){ HOOK_SIG(my_start){
exec_command(app, cmdid_open_panel_vsplit); exec_command(app, cmdid_open_panel_vsplit);
exec_command(app, cmdid_change_active_panel); exec_command(app, cmdid_change_active_panel);
@ -220,12 +163,11 @@ HOOK_SIG(my_file_settings){
// NOTE(allen|a4.0.5): Unlike previous versions the command cmdid_set_settings // NOTE(allen|a4.0.5): Unlike previous versions the command cmdid_set_settings
// no longer automatically effects the active buffer. This command will actually be // no longer automatically effects the active buffer. This command will actually be
// phased out in favor of an app call soon. // phased out in favor of an app call soon.
push_parameter(app, par_buffer_id, buffer.buffer_id);
push_parameter(app, par_lex_as_cpp_file, treat_as_code); // TODO(allen): also eliminate this hook if you can.
push_parameter(app, par_wrap_lines, wrap_lines); app->buffer_set_setting(app, &buffer, BufferSetting_Lex, treat_as_code);
push_parameter(app, par_key_mapid, (treat_as_code)?((int)my_code_map):((int)mapid_file)); app->buffer_set_setting(app, &buffer, BufferSetting_WrapLine, wrap_lines);
exec_command(app, cmdid_set_settings); app->buffer_set_setting(app, &buffer, BufferSetting_MapID, (treat_as_code)?((int)my_code_map):((int)mapid_file));
// no meaning for return // no meaning for return
return(0); return(0);
@ -292,7 +234,7 @@ default_keys(Bind_Helper *context){
bind(context, '#', MDFR_NONE, write_and_auto_tab); bind(context, '#', MDFR_NONE, write_and_auto_tab);
bind(context, '\t', MDFR_NONE, cmdid_word_complete); bind(context, '\t', MDFR_NONE, cmdid_word_complete);
bind(context, '\t', MDFR_CTRL, cmdid_auto_tab_range); bind(context, '\t', MDFR_CTRL, auto_tab_range);
bind(context, '\t', MDFR_SHIFT, auto_tab_line_at_cursor); bind(context, '\t', MDFR_SHIFT, auto_tab_line_at_cursor);
bind(context, '=', MDFR_CTRL, write_increment); bind(context, '=', MDFR_CTRL, write_increment);

View File

@ -443,24 +443,32 @@ CUSTOM_COMMAND_SIG(seek_beginning_of_line){
} }
static void static void
basic_seek(Application_Links *app, Command_ID seek_type, unsigned int flags){ basic_seek(Application_Links *app, int seek_type, unsigned int flags){
push_parameter(app, par_flags, flags); View_Summary view = app->get_active_view(app);
exec_command(app, seek_type); Buffer_Summary buffer = app->get_buffer(app, view.locked_buffer_id);
int pos = app->buffer_seek(app, &buffer, view.cursor.pos, seek_type, flags);
app->view_set_cursor(app, &view, seek_pos(pos), true);
} }
#define SEEK_COMMAND(n, dir, flags)\ #define SEEK_COMMAND(n, dir, flags)\
CUSTOM_COMMAND_SIG(seek_##n##_##dir){ basic_seek(app, cmdid_seek_##dir, flags); } CUSTOM_COMMAND_SIG(seek_##n##_##dir){ basic_seek(app, dir, flags); }
SEEK_COMMAND(whitespace, right, BoundryWhitespace) #define right true
SEEK_COMMAND(whitespace, left, BoundryWhitespace) #define left false
SEEK_COMMAND(token, right, BoundryToken)
SEEK_COMMAND(token, left, BoundryToken) SEEK_COMMAND(whitespace, right, BoundryWhitespace)
SEEK_COMMAND(white_or_token, right, BoundryToken | BoundryWhitespace) SEEK_COMMAND(whitespace, left, BoundryWhitespace)
SEEK_COMMAND(white_or_token, left, BoundryToken | BoundryWhitespace) SEEK_COMMAND(token, right, BoundryToken)
SEEK_COMMAND(alphanumeric, right, BoundryAlphanumeric) SEEK_COMMAND(token, left, BoundryToken)
SEEK_COMMAND(alphanumeric, left, BoundryAlphanumeric) SEEK_COMMAND(white_or_token, right, BoundryToken | BoundryWhitespace)
SEEK_COMMAND(white_or_token, left, BoundryToken | BoundryWhitespace)
SEEK_COMMAND(alphanumeric, right, BoundryAlphanumeric)
SEEK_COMMAND(alphanumeric, left, BoundryAlphanumeric)
SEEK_COMMAND(alphanumeric_or_camel, right, BoundryAlphanumeric | BoundryCamelCase) SEEK_COMMAND(alphanumeric_or_camel, right, BoundryAlphanumeric | BoundryCamelCase)
SEEK_COMMAND(alphanumeric_or_camel, left, BoundryAlphanumeric | BoundryCamelCase) SEEK_COMMAND(alphanumeric_or_camel, left, BoundryAlphanumeric | BoundryCamelCase)
#undef right
#undef left
// //
@ -479,23 +487,27 @@ CUSTOM_COMMAND_SIG(write_increment){
write_string(app, make_lit_string("++")); write_string(app, make_lit_string("++"));
} }
#ifndef DEF_TAB_WIDTH
# define DEF_TAB_WIDTH 4
#endif
static void static void
long_braces(Application_Links *app, char *text, int size){ long_braces(Application_Links *app, char *text, int size){
View_Summary view; View_Summary view;
Buffer_Summary buffer; Buffer_Summary buffer;
int pos; int pos;
view = app->get_active_view(app); view = app->get_active_view(app);
buffer = app->get_buffer(app, view.buffer_id); buffer = app->get_buffer(app, view.buffer_id);
pos = view.cursor.pos; pos = view.cursor.pos;
app->buffer_replace_range(app, &buffer, pos, pos, text, size); app->buffer_replace_range(app, &buffer, pos, pos, text, size);
app->view_set_cursor(app, &view, seek_pos(pos + 2), 1); app->view_set_cursor(app, &view, seek_pos(pos + 2), true);
push_parameter(app, par_range_start, pos); app->view_auto_tab(app, &view,
push_parameter(app, par_range_end, pos + size); pos, pos + size,
push_parameter(app, par_clear_blank_lines, 0); DEF_TAB_WIDTH,
exec_command(app, cmdid_auto_tab_range); 0);
} }
CUSTOM_COMMAND_SIG(open_long_braces){ CUSTOM_COMMAND_SIG(open_long_braces){
@ -539,9 +551,10 @@ CUSTOM_COMMAND_SIG(if0_off){
app->buffer_replace_range(app, &buffer, pos, pos, text1, size1); app->buffer_replace_range(app, &buffer, pos, pos, text1, size1);
push_parameter(app, par_range_start, pos); app->view_auto_tab(app, &view,
push_parameter(app, par_range_end, pos); pos, pos,
exec_command(app, cmdid_auto_tab_range); DEF_TAB_WIDTH,
0);
app->refresh_view(app, &view); app->refresh_view(app, &view);
range = get_range(&view); range = get_range(&view);
@ -549,9 +562,10 @@ CUSTOM_COMMAND_SIG(if0_off){
app->buffer_replace_range(app, &buffer, pos, pos, text2, size2); app->buffer_replace_range(app, &buffer, pos, pos, text2, size2);
push_parameter(app, par_range_start, pos); app->view_auto_tab(app, &view,
push_parameter(app, par_range_end, pos); pos, pos,
exec_command(app, cmdid_auto_tab_range); DEF_TAB_WIDTH,
0);
} }
CUSTOM_COMMAND_SIG(backspace_word){ CUSTOM_COMMAND_SIG(backspace_word){
@ -592,19 +606,13 @@ CUSTOM_COMMAND_SIG(snipe_token_or_word){
int pos1, pos2; int pos1, pos2;
view = app->get_active_view(app); view = app->get_active_view(app);
buffer = app->get_buffer(app, view.buffer_id);
push_parameter(app, par_flags, BoundryToken | BoundryWhitespace); pos1 = app->buffer_seek(app, &buffer, view.cursor.pos, false, BoundryToken | BoundryWhitespace);
exec_command(app, cmdid_seek_left);
app->refresh_view(app, &view);
pos1 = view.cursor.pos;
push_parameter(app, par_flags, BoundryToken | BoundryWhitespace); pos2 = app->buffer_seek(app, &buffer, pos1, true, BoundryToken | BoundryWhitespace);
exec_command(app, cmdid_seek_right);
app->refresh_view(app, &view);
pos2 = view.cursor.pos;
Range range = make_range(pos1, pos2); Range range = make_range(pos1, pos2);
buffer = app->get_buffer(app, view.buffer_id);
app->buffer_replace_range(app, &buffer, range.start, range.end, 0, 0); app->buffer_replace_range(app, &buffer, range.start, range.end, 0, 0);
} }
@ -636,14 +644,12 @@ CUSTOM_COMMAND_SIG(open_file_in_quotes){
append(&file_name, make_string(short_file_name, size)); append(&file_name, make_string(short_file_name, size));
exec_command(app, cmdid_change_active_panel); exec_command(app, cmdid_change_active_panel);
push_parameter(app, par_name, expand_str(file_name)); app->view_open_file(app, &view, expand_str(file_name), false);
exec_command(app, cmdid_interactive_open);
} }
} }
CUSTOM_COMMAND_SIG(save_as){ CUSTOM_COMMAND_SIG(save_as){
push_parameter(app, par_save_update_name, 1); exec_command(app, cmdid_save_as);
exec_command(app, cmdid_save);
} }
CUSTOM_COMMAND_SIG(goto_line){ CUSTOM_COMMAND_SIG(goto_line){
@ -919,9 +925,10 @@ CUSTOM_COMMAND_SIG(close_all_code){
} }
} }
View_Summary view = app->get_active_view(app);
for (int i = 0; i < buffers_to_close_count; ++i){ for (int i = 0; i < buffers_to_close_count; ++i){
push_parameter(app, par_buffer_id, buffers_to_close[i]); app->view_kill_file(app, &view, buffer_identifier(buffers_to_close[i]));
exec_command(app, cmdid_kill_buffer);
} }
} }
@ -953,8 +960,6 @@ CUSTOM_COMMAND_SIG(open_all_code){
// was originally, so that new appends overwrite old ones. // was originally, so that new appends overwrite old ones.
dir.size = dir_size; dir.size = dir_size;
append(&dir, info->filename); append(&dir, info->filename);
push_parameter(app, par_name, dir.str, dir.size);
//push_parameter(app, par_do_in_background, 1);
exec_command(app, cmdid_interactive_open); exec_command(app, cmdid_interactive_open);
} }
} }
@ -968,27 +973,32 @@ char out_buffer_space[1024], command_space[1024], hot_directory_space[1024];
CUSTOM_COMMAND_SIG(execute_any_cli){ CUSTOM_COMMAND_SIG(execute_any_cli){
Query_Bar bar_out, bar_cmd; Query_Bar bar_out, bar_cmd;
String hot_directory; String hot_directory;
bar_out.prompt = make_lit_string("Output Buffer: "); bar_out.prompt = make_lit_string("Output Buffer: ");
bar_out.string = make_fixed_width_string(out_buffer_space); bar_out.string = make_fixed_width_string(out_buffer_space);
if (!query_user_string(app, &bar_out)) return; if (!query_user_string(app, &bar_out)) return;
bar_cmd.prompt = make_lit_string("Command: "); bar_cmd.prompt = make_lit_string("Command: ");
bar_cmd.string = make_fixed_width_string(command_space); bar_cmd.string = make_fixed_width_string(command_space);
if (!query_user_string(app, &bar_cmd)) return; if (!query_user_string(app, &bar_cmd)) return;
hot_directory = make_fixed_width_string(hot_directory_space); hot_directory = make_fixed_width_string(hot_directory_space);
hot_directory.size = app->directory_get_hot(app, hot_directory.str, hot_directory.memory_size); hot_directory.size = app->directory_get_hot(app, hot_directory.str, hot_directory.memory_size);
push_parameter(app, par_flags, CLI_OverlapWithConflict);
push_parameter(app, par_name, bar_out.string.str, bar_out.string.size);
push_parameter(app, par_cli_path, hot_directory.str, hot_directory.size);
push_parameter(app, par_cli_command, bar_cmd.string.str, bar_cmd.string.size);
exec_command(app, cmdid_command_line);
// TODO(allen): provide command line call
View_Summary view = app->get_active_view(app);
// TODO(allen): Make this work without null terminators
terminate_with_null(&bar_out.string); terminate_with_null(&bar_out.string);
terminate_with_null(&bar_cmd.string); terminate_with_null(&bar_cmd.string);
terminate_with_null(&hot_directory); terminate_with_null(&hot_directory);
app->exec_system_command(app, &view,
buffer_identifier(bar_out.string.str, bar_out.string.size),
hot_directory.str, hot_directory.size,
bar_cmd.string.str, bar_cmd.string.size,
CLI_OverlapWithConflict);
} }
CUSTOM_COMMAND_SIG(execute_previous_cli){ CUSTOM_COMMAND_SIG(execute_previous_cli){
@ -999,11 +1009,13 @@ CUSTOM_COMMAND_SIG(execute_previous_cli){
hot_directory = make_string_slowly(hot_directory_space); hot_directory = make_string_slowly(hot_directory_space);
if (out_buffer.size > 0 && cmd.size > 0 && hot_directory.size > 0){ if (out_buffer.size > 0 && cmd.size > 0 && hot_directory.size > 0){
push_parameter(app, par_flags, CLI_OverlapWithConflict); View_Summary view = app->get_active_view(app);
push_parameter(app, par_name, out_buffer.str, out_buffer.size);
push_parameter(app, par_cli_path, hot_directory.str, hot_directory.size); app->exec_system_command(app, &view,
push_parameter(app, par_cli_command, cmd.str, cmd.size); buffer_identifier(out_buffer.str, out_buffer.size),
exec_command(app, cmdid_command_line); hot_directory.str, hot_directory.size,
cmd.str, cmd.size,
CLI_OverlapWithConflict);
} }
} }
@ -1088,32 +1100,40 @@ CUSTOM_COMMAND_SIG(build_search){
int keep_going = 1; int keep_going = 1;
int old_size; int old_size;
String dir = make_string(app->memory, 0, app->memory_size); int size = app->memory_size/2;
String dir = make_string(app->memory, 0, size);
dir.size = app->directory_get_hot(app, dir.str, dir.memory_size); dir.size = app->directory_get_hot(app, dir.str, dir.memory_size);
String command = make_string((char*)app->memory + size, 0, size);
append(&command, '"');
while (keep_going){ while (keep_going){
append(&command, dir);
old_size = dir.size; old_size = dir.size;
append(&dir, "build.bat"); append(&dir, "build.bat");
if (app->file_exists(app, dir.str, dir.size)){ if (app->file_exists(app, dir.str, dir.size)){
dir.size = old_size; dir.size = old_size;
append(&command, "build");
push_parameter(app, par_flags, CLI_OverlapWithConflict); append(&command, '"');
push_parameter(app, par_name, literal("*compilation*"));
push_parameter(app, par_cli_path, dir.str, dir.size); View_Summary view = app->get_active_view(app);
if (append(&dir, "build")){ terminate_with_null(&dir);
push_parameter(app, par_cli_command, dir.str, dir.size); terminate_with_null(&command);
exec_command(app, cmdid_command_line);
} app->exec_system_command(app, &view,
else{ buffer_identifier(literal("*compilation*")),
app->clear_parameters(app); dir.str, dir.size,
} command.str, command.size,
CLI_OverlapWithConflict);
return; return;
} }
dir.size = old_size; dir.size = old_size;
if (app->directory_cd(app, dir.str, &dir.size, dir.memory_size, literal("..")) == 0){ if (app->directory_cd(app, dir.str, &dir.size, dir.memory_size, literal("..")) == 0){
keep_going = 0; keep_going = 0;
} }
@ -1124,17 +1144,31 @@ CUSTOM_COMMAND_SIG(build_search){
CUSTOM_COMMAND_SIG(auto_tab_line_at_cursor){ CUSTOM_COMMAND_SIG(auto_tab_line_at_cursor){
View_Summary view = app->get_active_view(app); View_Summary view = app->get_active_view(app);
push_parameter(app, par_range_start, view.cursor.pos);
push_parameter(app, par_range_end, view.cursor.pos); app->view_auto_tab(app, &view,
push_parameter(app, par_clear_blank_lines, 0); view.cursor.pos, view.cursor.pos,
exec_command(app, cmdid_auto_tab_range); DEF_TAB_WIDTH,
0);
} }
CUSTOM_COMMAND_SIG(auto_tab_whole_file){ CUSTOM_COMMAND_SIG(auto_tab_whole_file){
Buffer_Summary buffer = get_active_buffer(app); View_Summary view = app->get_active_view(app);
push_parameter(app, par_range_start, 0); Buffer_Summary buffer = app->get_buffer(app, view.buffer_id);
push_parameter(app, par_range_end, buffer.size);
exec_command(app, cmdid_auto_tab_range); app->view_auto_tab(app, &view,
0, buffer.size,
DEF_TAB_WIDTH,
0);
}
CUSTOM_COMMAND_SIG(auto_tab_range){
View_Summary view = app->get_active_view(app);
Range range = get_range(&view);
app->view_auto_tab(app, &view,
range.min, range.max,
DEF_TAB_WIDTH,
0);
} }
CUSTOM_COMMAND_SIG(write_and_auto_tab){ CUSTOM_COMMAND_SIG(write_and_auto_tab){

View File

@ -194,40 +194,6 @@ end_bind_helper(Bind_Helper *helper){
return(result); return(result);
} }
// NOTE(allen): Useful functions and overloads on app links
inline void
push_parameter(Application_Links *app, int param, int value){
app->push_parameter(app, dynamic_int(param), dynamic_int(value));
}
inline void
push_parameter(Application_Links *app, int param, const char *value, int value_len){
char *value_copy = app->push_memory(app, value_len+1);
copy(value_copy, value, value_len);
value_copy[value_len] = 0;
app->push_parameter(app, dynamic_int(param), dynamic_string(value_copy, value_len));
}
inline void
push_parameter(Application_Links *app, const char *param, int param_len, int value){
char *param_copy = app->push_memory(app, param_len+1);
copy(param_copy, param, param_len);
param_copy[param_len] = 0;
app->push_parameter(app, dynamic_string(param_copy, param_len), dynamic_int(value));
}
inline void
push_parameter(Application_Links *app, const char *param, int param_len, const char *value, int value_len){
char *param_copy = app->push_memory(app, param_len+1);
char *value_copy = app->push_memory(app, value_len+1);
copy(param_copy, param, param_len);
copy(value_copy, value, value_len);
value_copy[value_len] = 0;
param_copy[param_len] = 0;
app->push_parameter(app, dynamic_string(param_copy, param_len), dynamic_string(value_copy, value_len));
}
inline Range inline Range
get_range(View_Summary *view){ get_range(View_Summary *view){
Range range; Range range;
@ -266,14 +232,12 @@ get_rect(View_Summary *view){
inline void inline void
exec_command(Application_Links *app, Command_ID id){ exec_command(Application_Links *app, Command_ID id){
app->exec_command_keep_stack(app, id); app->exec_command(app, id);
app->clear_parameters(app);
} }
inline void inline void
exec_command(Application_Links *app, Custom_Command_Function *func){ exec_command(Application_Links *app, Custom_Command_Function *func){
func(app); func(app);
app->clear_parameters(app);
} }
inline void inline void
@ -743,4 +707,22 @@ buffer_seek_string_insensitive_backward(Application_Links *app, Buffer_Summary *
} }
} }
inline Buffer_Identifier
buffer_identifier(char *str, int len){
Buffer_Identifier identifier;
identifier.name = str;
identifier.name_len = len;
identifier.id = 0;
return(identifier);
}
inline Buffer_Identifier
buffer_identifier(int id){
Buffer_Identifier identifier;
identifier.name = 0;
identifier.name_len = 0;
identifier.id = id;
return(identifier);
}

View File

@ -1,6 +1,6 @@
#define MAJOR 4 #define MAJOR 4
#define MINOR 0 #define MINOR 0
#define PATCH 7 #define PATCH 8
#define VN__(a,b,c) #a"."#b"."#c #define VN__(a,b,c) #a"."#b"."#c
#define VN_(a,b,c) VN__(a,b,c) #define VN_(a,b,c) VN__(a,b,c)

1192
4ed.cpp

File diff suppressed because it is too large Load Diff

View File

@ -500,9 +500,8 @@ generate_custom_headers(){
); );
fprintf(file, "};\n"); fprintf(file, "};\n");
// TODO(allen): Generate app->function(app, ...) to function(app, ...) wrappers. fprintf(file,
// Need to parse parameter names to do this. "#define FillAppLinksAPI(app_links) do{");
#if 0
for (int i = 0; i < sig_count; ++i){ for (int i = 0; i < sig_count; ++i){
Function_Signature *sig = sigs + i; Function_Signature *sig = sigs + i;
@ -511,12 +510,12 @@ generate_custom_headers(){
to_lower(name_buffer, name_buffer); to_lower(name_buffer, name_buffer);
fprintf(file, fprintf(file,
"inline %.*s\n" "\\\n"
"%s%.*s{ app->%s(", "app_links->%s = external_%s;",
sig->name.size, sig->name.str, name_buffer, name_buffer
name_buffer); );
} }
#endif fprintf(file," } while(false)\n");
fclose(file); fclose(file);

View File

@ -1,9 +1,7 @@
// Command exectuion // Command exectuion
void Push_Parameter(Application_Links *app, Dynamic param, Dynamic value) void Exec_Command(Application_Links *app, int command_id)
char* Push_Memory(Application_Links *app, int len) int Exec_System_Command(Application_Links *app, View_Summary *view, Buffer_Identifier buffer, char *path, int path_len, char *command, int command_len, unsigned int flags)
void Exec_Command_Keep_Stack(Application_Links *app, int command_id)
void Clear_Parameters(Application_Links *app)
// File system navigation // File system navigation
int Directory_Get_Hot(Application_Links *app, char *out, int capacity) int Directory_Get_Hot(Application_Links *app, char *out, int capacity)
@ -21,16 +19,15 @@ Buffer_Summary Get_Buffer(Application_Links *app, int index)
Buffer_Summary Get_Parameter_Buffer(Application_Links *app, int param_index) Buffer_Summary Get_Parameter_Buffer(Application_Links *app, int param_index)
Buffer_Summary Get_Buffer_By_Name(Application_Links *app, char *filename, int len) Buffer_Summary Get_Buffer_By_Name(Application_Links *app, char *filename, int len)
//int Buffer_Seek_Delimiter(Application_Links *app, Buffer_Summary *buffer, int start, char delim, int seek_forward, int *out)
//int Buffer_Seek_String(Application_Links *app, Buffer_Summary *buffer, int start, char *str, int len, int seek_forward, int *out)
//int Buffer_Seek_String_Insensitive(Application_Links *app, Buffer_Summary *buffer, int start, char *str, int len, int seek_forward, int *out)
int Refresh_Buffer(Application_Links *app, Buffer_Summary *buffer) int Refresh_Buffer(Application_Links *app, Buffer_Summary *buffer)
int Buffer_Read_Range(Application_Links *app, Buffer_Summary *buffer, int start, int end, char *out) int Buffer_Read_Range(Application_Links *app, Buffer_Summary *buffer, int start, int end, char *out)
int Buffer_Replace_Range(Application_Links *app, Buffer_Summary *buffer, int start, int end, char *str, int len) int Buffer_Replace_Range(Application_Links *app, Buffer_Summary *buffer, int start, int end, char *str, int len)
int Buffer_Set_Pos(Application_Links *app, Buffer_Summary *buffer, int pos) //int Buffer_Set_Pos(Application_Links *app, Buffer_Summary *buffer, int pos)
// File view manipulation int Buffer_Seek(Application_Links *app, Buffer_Summary *buffer, int start_pos, int seek_forward, unsigned int flags)
int Buffer_Set_Setting(Application_Links *app, Buffer_Summary *buffer, int setting, int value)
// View manipulation
View_Summary Get_View_First(Application_Links *app) View_Summary Get_View_First(Application_Links *app)
void Get_View_Next(Application_Links *app, View_Summary *view) void Get_View_Next(Application_Links *app, View_Summary *view)
@ -38,12 +35,17 @@ View_Summary Get_View(Application_Links *app, int index)
View_Summary Get_Active_View(Application_Links *app) View_Summary Get_Active_View(Application_Links *app)
int Refresh_View(Application_Links *app, View_Summary *view) int Refresh_View(Application_Links *app, View_Summary *view)
int View_Auto_Tab(Application_Links *app, View_Summary *view, int start, int end, int tab_width, unsigned int flags)
Full_Cursor View_Compute_Cursor(Application_Links *app, View_Summary *view, Buffer_Seek seek) Full_Cursor View_Compute_Cursor(Application_Links *app, View_Summary *view, Buffer_Seek seek)
int View_Set_Cursor(Application_Links *app, View_Summary *view, Buffer_Seek seek, int set_preferred_x) int View_Set_Cursor(Application_Links *app, View_Summary *view, Buffer_Seek seek, int set_preferred_x)
int View_Set_Mark(Application_Links *app, View_Summary *view, Buffer_Seek seek) int View_Set_Mark(Application_Links *app, View_Summary *view, Buffer_Seek seek)
int View_Set_Highlight(Application_Links *app, View_Summary *view, int start, int end, int turn_on) int View_Set_Highlight(Application_Links *app, View_Summary *view, int start, int end, int turn_on)
int View_Set_Buffer(Application_Links *app, View_Summary *view, int buffer_id) int View_Set_Buffer(Application_Links *app, View_Summary *view, int buffer_id)
int View_Open_File(Application_Links *app, View_Summary *view, char *filename, int filename_len, int do_in_background)
int View_Kill_File(Application_Links *app, View_Summary *view, Buffer_Identifier buffer)
// Directly get user input // Directly get user input
User_Input Get_User_Input(Application_Links *app, unsigned int get_type, unsigned int abort_type) User_Input Get_User_Input(Application_Links *app, unsigned int get_type, unsigned int abort_type)
User_Input Get_Command_Input(Application_Links *app) User_Input Get_Command_Input(Application_Links *app)
@ -54,8 +56,8 @@ Mouse_State Get_Mouse_State(Application_Links *app)
int Start_Query_Bar(Application_Links *app, Query_Bar *bar, unsigned int flags) int Start_Query_Bar(Application_Links *app, Query_Bar *bar, unsigned int flags)
void End_Query_Bar(Application_Links *app, Query_Bar *bar, unsigned int flags) void End_Query_Bar(Application_Links *app, Query_Bar *bar, unsigned int flags)
void Print_Message(Application_Links *app, char *string, int len) void Print_Message(Application_Links *app, char *string, int len)
GUI_Functions* Get_GUI_Functions(Application_Links *app) //GUI_Functions* Get_GUI_Functions(Application_Links *app)
GUI* Get_GUI(Application_Links *app, int view_id) //GUI* Get_GUI(Application_Links *app, int view_id)
// Color settings // Color settings
void Change_Theme(Application_Links *app, char *name, int len) void Change_Theme(Application_Links *app, char *name, int len)