4.0.11 ready

master
Allen Webster 2016-09-16 20:03:09 -04:00
parent 7a23c72d11
commit be735f84f0
14 changed files with 738 additions and 477 deletions

View File

@ -34,7 +34,9 @@ The seek position must be one of the types supported by Partial_Cursor. Those
types are absolute position and line,column position.<br><br></div><div style='margin-top: 3mm; margin-bottom: 3mm; color: #309030;'><b><i>See Also</i></b></div><div style='margin-left: 5mm; margin-right: 5mm;'><a href='#Buffer_Seek_doc'>Buffer_Seek</a></div><div style='margin-left: 5mm; margin-right: 5mm;'><a href='#Partial_Cursor_doc'>Partial_Cursor</a></div></div><hr><div id='buffer_batch_edit_doc' style='margin-bottom: 1cm;'><h4>&sect;3.3.14: buffer_batch_edit</h4><div style='font-family: "Courier New", Courier, monospace; text-align: left; margin-top: 3mm; margin-bottom: 3mm; font-size: .95em; background: #DFDFDF; padding: 0.25em;'>bool32 app->buffer_batch_edit(<div style='margin-left: 4mm;'>Application_Links *app,<br>Buffer_Summary *buffer,<br>char *str,<br>int32_t str_len,<br>Buffer_Edit *edits,<br>int32_t edit_count,<br>Buffer_Batch_Edit_Type type<br></div>)</div><div style='margin-top: 3mm; margin-bottom: 3mm; color: #309030;'><b><i>Parameters</i></b></div><div><div style='font-weight: 600;'>str</div><div style='margin-bottom: 6mm;'><div style='margin-left: 5mm; margin-right: 5mm;'>This parameter provides all of the source string for the edits in the batch.</div></div></div><div><div style='font-weight: 600;'>str_len</div><div style='margin-bottom: 6mm;'><div style='margin-left: 5mm; margin-right: 5mm;'>This parameter specifies the length of the str string.</div></div></div><div><div style='font-weight: 600;'>edits</div><div style='margin-bottom: 6mm;'><div style='margin-left: 5mm; margin-right: 5mm;'>This parameter provides about the source string and destination range of each edit as an array.</div></div></div><div><div style='font-weight: 600;'>edit_count</div><div style='margin-bottom: 6mm;'><div style='margin-left: 5mm; margin-right: 5mm;'>This parameter specifies the number of Buffer_Edit structs in edits.</div></div></div><div><div style='font-weight: 600;'>type</div><div style='margin-bottom: 6mm;'><div style='margin-left: 5mm; margin-right: 5mm;'>This prameter specifies what type of batch edit to execute.</div></div></div><div style='margin-top: 3mm; margin-bottom: 3mm; color: #309030;'><b><i>Return</i></b></div><div style='margin-left: 5mm; margin-right: 5mm;'>This call returns non-zero if the batch edit succeeds. This call can fail if the provided
buffer summary does not refer to an actual buffer in 4coder.</div><div style='margin-top: 3mm; margin-bottom: 3mm; color: #309030;'><b><i>Description</i></b></div><div style='margin-left: 5mm; margin-right: 5mm;'>TODO<br><br></div><div style='margin-top: 3mm; margin-bottom: 3mm; color: #309030;'><b><i>See Also</i></b></div><div style='margin-left: 5mm; margin-right: 5mm;'><a href='#Buffer_Edit_doc'>Buffer_Edit</a></div><div style='margin-left: 5mm; margin-right: 5mm;'><a href='#Buffer_Batch_Edit_Type_doc'>Buffer_Batch_Edit_Type</a></div></div><hr><div id='buffer_set_setting_doc' style='margin-bottom: 1cm;'><h4>&sect;3.3.15: buffer_set_setting</h4><div style='font-family: "Courier New", Courier, monospace; text-align: left; margin-top: 3mm; margin-bottom: 3mm; font-size: .95em; background: #DFDFDF; padding: 0.25em;'>bool32 app->buffer_set_setting(<div style='margin-left: 4mm;'>Application_Links *app,<br>Buffer_Summary *buffer,<br>Buffer_Setting_ID setting,<br>int32_t value<br></div>)</div><div style='margin-top: 3mm; margin-bottom: 3mm; color: #309030;'><b><i>Parameters</i></b></div><div><div style='font-weight: 600;'>buffer</div><div style='margin-bottom: 6mm;'><div style='margin-left: 5mm; margin-right: 5mm;'>The buffer parameter specifies the buffer on which to set a setting.</div></div></div><div><div style='font-weight: 600;'>setting</div><div style='margin-bottom: 6mm;'><div style='margin-left: 5mm; margin-right: 5mm;'>The setting parameter identifies the setting that shall be changed.</div></div></div><div><div style='font-weight: 600;'>value</div><div style='margin-bottom: 6mm;'><div style='margin-left: 5mm; margin-right: 5mm;'>The value parameter specifies the value to which the setting shall be changed.</div></div></div><div style='margin-top: 3mm; margin-bottom: 3mm; color: #309030;'><b><i>See Also</i></b></div><div style='margin-left: 5mm; margin-right: 5mm;'><a href='#Buffer_Setting_ID_doc'>Buffer_Setting_ID</a></div></div><hr><div id='buffer_token_count_doc' style='margin-bottom: 1cm;'><h4>&sect;3.3.16: buffer_token_count</h4><div style='font-family: "Courier New", Courier, monospace; text-align: left; margin-top: 3mm; margin-bottom: 3mm; font-size: .95em; background: #DFDFDF; padding: 0.25em;'>int32_t app->buffer_token_count(<div style='margin-left: 4mm;'>Application_Links *app,<br>Buffer_Summary *buffer<br></div>)</div><div style='margin-top: 3mm; margin-bottom: 3mm; color: #309030;'><b><i>Parameters</i></b></div><div><div style='font-weight: 600;'>buffer</div><div style='margin-bottom: 6mm;'><div style='margin-left: 5mm; margin-right: 5mm;'>Specifies the buffer from which to read the token count.</div></div></div><div style='margin-top: 3mm; margin-bottom: 3mm; color: #309030;'><b><i>Return</i></b></div><div style='margin-left: 5mm; margin-right: 5mm;'>If tokens are available for the buffer, the number of tokens on the buffer is returned.
If the buffer does not exist or if it is not a lexed buffer, the return is zero.</div></div><hr><div id='buffer_read_tokens_doc' style='margin-bottom: 1cm;'><h4>&sect;3.3.17: buffer_read_tokens</h4><div style='font-family: "Courier New", Courier, monospace; text-align: left; margin-top: 3mm; margin-bottom: 3mm; font-size: .95em; background: #DFDFDF; padding: 0.25em;'>bool32 app->buffer_read_tokens(<div style='margin-left: 4mm;'>Application_Links *app,<br>Buffer_Summary *buffer,<br>int32_t start_token,<br>int32_t end_token,<br>Cpp_Token *tokens_out<br></div>)</div><div style='margin-top: 3mm; margin-bottom: 3mm; color: #309030;'><b><i>Parameters</i></b></div><div><div style='font-weight: 600;'>buffer</div><div style='margin-bottom: 6mm;'><div style='margin-left: 5mm; margin-right: 5mm;'>Specifies the buffer from which to read tokens.</div></div></div><div><div style='font-weight: 600;'>first_token</div><div style='margin-bottom: 6mm;'><div style='margin-left: 5mm; margin-right: 5mm;'>Specifies the index of the first token to read.</div></div></div><div><div style='font-weight: 600;'>end_token</div><div style='margin-bottom: 6mm;'><div style='margin-left: 5mm; margin-right: 5mm;'>Specifies the token to stop reading at.</div></div></div><div><div style='font-weight: 600;'>tokens_out</div><div style='margin-bottom: 6mm;'><div style='margin-left: 5mm; margin-right: 5mm;'>The memory that will store the tokens read from the buffer.</div></div></div><div style='margin-top: 3mm; margin-bottom: 3mm; color: #309030;'><b><i>Return</i></b></div><div style='margin-left: 5mm; margin-right: 5mm;'>Returns non-zero on success. This call can fail if the buffer doesn't
exist or doesn't have tokens ready, or if either the first or last index is out of bounds.</div><div style='margin-top: 3mm; margin-bottom: 3mm; color: #309030;'><b><i>Description</i></b></div><div style='margin-left: 5mm; margin-right: 5mm;'>Puts the data for the tokens with the indices [first_token,last_token<br><br></div></div><hr><div id='buffer_get_token_index_doc' style='margin-bottom: 1cm;'><h4>&sect;3.3.18: buffer_get_token_index</h4><div style='font-family: "Courier New", Courier, monospace; text-align: left; margin-top: 3mm; margin-bottom: 3mm; font-size: .95em; background: #DFDFDF; padding: 0.25em;'>bool32 app->buffer_get_token_index(<div style='margin-left: 4mm;'>Application_Links *app,<br>Buffer_Summary *buffer,<br>int32_t pos,<br>Cpp_Get_Token_Result *get_result<br></div>)</div>No documentation generated for this function.</div><hr><div id='create_buffer_doc' style='margin-bottom: 1cm;'><h4>&sect;3.3.19: create_buffer</h4><div style='font-family: "Courier New", Courier, monospace; text-align: left; margin-top: 3mm; margin-bottom: 3mm; font-size: .95em; background: #DFDFDF; padding: 0.25em;'>Buffer_Summary app->create_buffer(<div style='margin-left: 4mm;'>Application_Links *app,<br>char *filename,<br>int32_t filename_len,<br>Buffer_Create_Flag flags<br></div>)</div><div style='margin-top: 3mm; margin-bottom: 3mm; color: #309030;'><b><i>Parameters</i></b></div><div><div style='font-weight: 600;'>filename</div><div style='margin-bottom: 6mm;'><div style='margin-left: 5mm; margin-right: 5mm;'>The filename parameter specifies the name of the file to be opened or created;
exist or doesn't have tokens ready, or if either the first or last index is out of bounds.</div><div style='margin-top: 3mm; margin-bottom: 3mm; color: #309030;'><b><i>Description</i></b></div><div style='margin-left: 5mm; margin-right: 5mm;'>Puts the data for the tokens with the indices [first_token,last_token<br><br></div></div><hr><div id='buffer_get_token_index_doc' style='margin-bottom: 1cm;'><h4>&sect;3.3.18: buffer_get_token_index</h4><div style='font-family: "Courier New", Courier, monospace; text-align: left; margin-top: 3mm; margin-bottom: 3mm; font-size: .95em; background: #DFDFDF; padding: 0.25em;'>bool32 app->buffer_get_token_index(<div style='margin-left: 4mm;'>Application_Links *app,<br>Buffer_Summary *buffer,<br>int32_t pos,<br>Cpp_Get_Token_Result *get_result<br></div>)</div><div style='margin-top: 3mm; margin-bottom: 3mm; color: #309030;'><b><i>Parameters</i></b></div><div><div style='font-weight: 600;'>buffer</div><div style='margin-bottom: 6mm;'><div style='margin-left: 5mm; margin-right: 5mm;'>The buffer from which to get a token.</div></div></div><div><div style='font-weight: 600;'>pos</div><div style='margin-bottom: 6mm;'><div style='margin-left: 5mm; margin-right: 5mm;'>The position in the buffer in absolute coordinates.</div></div></div><div><div style='font-weight: 600;'>get_result</div><div style='margin-bottom: 6mm;'><div style='margin-left: 5mm; margin-right: 5mm;'>The output struct specifying which token contains pos.</div></div></div><div style='margin-top: 3mm; margin-bottom: 3mm; color: #309030;'><b><i>Return</i></b></div><div style='margin-left: 5mm; margin-right: 5mm;'>Returns non-zero on success. This call can fail if the buffer doesn't exist,
or if the buffer doesn't have tokens ready.</div><div style='margin-top: 3mm; margin-bottom: 3mm; color: #309030;'><b><i>Description</i></b></div><div style='margin-left: 5mm; margin-right: 5mm;'>This call finds the token that contains a particular position, or if the position is in between
tokens it finds the index of the token to the left of the position.<br><br></div><div style='margin-top: 3mm; margin-bottom: 3mm; color: #309030;'><b><i>See Also</i></b></div><div style='margin-left: 5mm; margin-right: 5mm;'><a href='#Cpp_Get_Token_Result_doc'>Cpp_Get_Token_Result</a></div><div style='margin-left: 5mm; margin-right: 5mm;'><a href='#cpp_get_token_doc'>cpp_get_token</a></div></div><hr><div id='create_buffer_doc' style='margin-bottom: 1cm;'><h4>&sect;3.3.19: create_buffer</h4><div style='font-family: "Courier New", Courier, monospace; text-align: left; margin-top: 3mm; margin-bottom: 3mm; font-size: .95em; background: #DFDFDF; padding: 0.25em;'>Buffer_Summary app->create_buffer(<div style='margin-left: 4mm;'>Application_Links *app,<br>char *filename,<br>int32_t filename_len,<br>Buffer_Create_Flag flags<br></div>)</div><div style='margin-top: 3mm; margin-bottom: 3mm; color: #309030;'><b><i>Parameters</i></b></div><div><div style='font-weight: 600;'>filename</div><div style='margin-bottom: 6mm;'><div style='margin-left: 5mm; margin-right: 5mm;'>The filename parameter specifies the name of the file to be opened or created;
it need not be null terminated.</div></div></div><div><div style='font-weight: 600;'>filename_len</div><div style='margin-bottom: 6mm;'><div style='margin-left: 5mm; margin-right: 5mm;'>The filename_len parameter spcifies the length of the filename string.</div></div></div><div><div style='font-weight: 600;'>flags</div><div style='margin-bottom: 6mm;'><div style='margin-left: 5mm; margin-right: 5mm;'>The flags parameter specifies behaviors for buffer creation.</div></div></div><div style='margin-top: 3mm; margin-bottom: 3mm; color: #309030;'><b><i>Return</i></b></div><div style='margin-left: 5mm; margin-right: 5mm;'>This call returns the summary of the created buffer.</div><div style='margin-top: 3mm; margin-bottom: 3mm; color: #309030;'><b><i>Description</i></b></div><div style='margin-left: 5mm; margin-right: 5mm;'>Tries to create a new buffer and associate it to the given filename. If such a buffer
already exists the existing buffer is returned in the Buffer_Summary and no new buffer is
created. If the buffer does not exist a new buffer is created and named after the given

View File

@ -146,7 +146,7 @@ set_line_indents(Application_Links *app, Partition *part, Buffer_Summary *buffer
make_batch_from_indent_marks(app, part, buffer, line_start, line_end, indent_marks, opts);
if (batch.edit_count > 0){
app->buffer_batch_edit(app, buffer, batch.str, batch.str_len,
buffer_batch_edit(app, buffer, batch.str, batch.str_len,
batch.edits, batch.edit_count, BatchEdit_PreserveTokens);
}
}
@ -554,10 +554,10 @@ buffer_auto_indent(Application_Links *app, Partition *part, Buffer_Summary *buff
// Stage 1: Read the tokens to be used for indentation.
Cpp_Token_Array tokens;
tokens.count = app->buffer_token_count(app, buffer);
tokens.count = buffer_token_count(app, buffer);
tokens.max_count = tokens.count;
tokens.tokens = push_array(part, Cpp_Token, tokens.count);
app->buffer_read_tokens(app, buffer, 0, tokens.count, tokens.tokens);
buffer_read_tokens(app, buffer, 0, tokens.count, tokens.tokens);
// Stage 2: Decide where the first and last lines are.
// The lines in the range [line_start,line_end) will be indented.

View File

@ -121,6 +121,7 @@ typedef TOGGLE_FULLSCREEN_SIG(Toggle_Fullscreen_Function);
typedef IS_FULLSCREEN_SIG(Is_Fullscreen_Function);
typedef SEND_EXIT_SIGNAL_SIG(Send_Exit_Signal_Function);
struct Application_Links{
#if defined(ALLOW_DEP_4CODER)
Exec_Command_Function *exec_command;
Exec_System_Command_Function *exec_system_command;
Clipboard_Post_Function *clipboard_post;
@ -182,6 +183,69 @@ Show_Mouse_Cursor_Function *show_mouse_cursor;
Toggle_Fullscreen_Function *toggle_fullscreen;
Is_Fullscreen_Function *is_fullscreen;
Send_Exit_Signal_Function *send_exit_signal;
#else
Exec_Command_Function *exec_command_;
Exec_System_Command_Function *exec_system_command_;
Clipboard_Post_Function *clipboard_post_;
Clipboard_Count_Function *clipboard_count_;
Clipboard_Index_Function *clipboard_index_;
Get_Buffer_Count_Function *get_buffer_count_;
Get_Buffer_First_Function *get_buffer_first_;
Get_Buffer_Next_Function *get_buffer_next_;
Get_Buffer_Function *get_buffer_;
Get_Buffer_By_Name_Function *get_buffer_by_name_;
Buffer_Read_Range_Function *buffer_read_range_;
Buffer_Replace_Range_Function *buffer_replace_range_;
Buffer_Compute_Cursor_Function *buffer_compute_cursor_;
Buffer_Batch_Edit_Function *buffer_batch_edit_;
Buffer_Set_Setting_Function *buffer_set_setting_;
Buffer_Token_Count_Function *buffer_token_count_;
Buffer_Read_Tokens_Function *buffer_read_tokens_;
Buffer_Get_Token_Index_Function *buffer_get_token_index_;
Create_Buffer_Function *create_buffer_;
Save_Buffer_Function *save_buffer_;
Kill_Buffer_Function *kill_buffer_;
Get_View_First_Function *get_view_first_;
Get_View_Next_Function *get_view_next_;
Get_View_Function *get_view_;
Get_Active_View_Function *get_active_view_;
Open_View_Function *open_view_;
Close_View_Function *close_view_;
Set_Active_View_Function *set_active_view_;
View_Set_Setting_Function *view_set_setting_;
View_Set_Split_Proportion_Function *view_set_split_proportion_;
View_Compute_Cursor_Function *view_compute_cursor_;
View_Set_Cursor_Function *view_set_cursor_;
View_Set_Scroll_Function *view_set_scroll_;
View_Set_Mark_Function *view_set_mark_;
View_Set_Highlight_Function *view_set_highlight_;
View_Set_Buffer_Function *view_set_buffer_;
View_Post_Fade_Function *view_post_fade_;
Get_User_Input_Function *get_user_input_;
Get_Command_Input_Function *get_command_input_;
Get_Mouse_State_Function *get_mouse_state_;
Start_Query_Bar_Function *start_query_bar_;
End_Query_Bar_Function *end_query_bar_;
Print_Message_Function *print_message_;
Change_Theme_Function *change_theme_;
Change_Font_Function *change_font_;
Buffer_Set_Font_Function *buffer_set_font_;
Set_Theme_Colors_Function *set_theme_colors_;
Get_Theme_Colors_Function *get_theme_colors_;
Directory_Get_Hot_Function *directory_get_hot_;
Get_File_List_Function *get_file_list_;
Free_File_List_Function *free_file_list_;
Memory_Allocate_Function *memory_allocate_;
Memory_Set_Protection_Function *memory_set_protection_;
Memory_Free_Function *memory_free_;
File_Exists_Function *file_exists_;
Directory_CD_Function *directory_cd_;
Get_4ed_Path_Function *get_4ed_path_;
Show_Mouse_Cursor_Function *show_mouse_cursor_;
Toggle_Fullscreen_Function *toggle_fullscreen_;
Is_Fullscreen_Function *is_fullscreen_;
Send_Exit_Signal_Function *send_exit_signal_;
#endif
void *memory;
int32_t memory_size;
void *cmd_context;
@ -190,64 +254,189 @@ void *current_coroutine;
int32_t type_coroutine;
};
#define FillAppLinksAPI(app_links) do{\
app_links->exec_command = Exec_Command;\
app_links->exec_system_command = Exec_System_Command;\
app_links->clipboard_post = Clipboard_Post;\
app_links->clipboard_count = Clipboard_Count;\
app_links->clipboard_index = Clipboard_Index;\
app_links->get_buffer_count = Get_Buffer_Count;\
app_links->get_buffer_first = Get_Buffer_First;\
app_links->get_buffer_next = Get_Buffer_Next;\
app_links->get_buffer = Get_Buffer;\
app_links->get_buffer_by_name = Get_Buffer_By_Name;\
app_links->buffer_read_range = Buffer_Read_Range;\
app_links->buffer_replace_range = Buffer_Replace_Range;\
app_links->buffer_compute_cursor = Buffer_Compute_Cursor;\
app_links->buffer_batch_edit = Buffer_Batch_Edit;\
app_links->buffer_set_setting = Buffer_Set_Setting;\
app_links->buffer_token_count = Buffer_Token_Count;\
app_links->buffer_read_tokens = Buffer_Read_Tokens;\
app_links->buffer_get_token_index = Buffer_Get_Token_Index;\
app_links->create_buffer = Create_Buffer;\
app_links->save_buffer = Save_Buffer;\
app_links->kill_buffer = Kill_Buffer;\
app_links->get_view_first = Get_View_First;\
app_links->get_view_next = Get_View_Next;\
app_links->get_view = Get_View;\
app_links->get_active_view = Get_Active_View;\
app_links->open_view = Open_View;\
app_links->close_view = Close_View;\
app_links->set_active_view = Set_Active_View;\
app_links->view_set_setting = View_Set_Setting;\
app_links->view_set_split_proportion = View_Set_Split_Proportion;\
app_links->view_compute_cursor = View_Compute_Cursor;\
app_links->view_set_cursor = View_Set_Cursor;\
app_links->view_set_scroll = View_Set_Scroll;\
app_links->view_set_mark = View_Set_Mark;\
app_links->view_set_highlight = View_Set_Highlight;\
app_links->view_set_buffer = View_Set_Buffer;\
app_links->view_post_fade = View_Post_Fade;\
app_links->get_user_input = Get_User_Input;\
app_links->get_command_input = Get_Command_Input;\
app_links->get_mouse_state = Get_Mouse_State;\
app_links->start_query_bar = Start_Query_Bar;\
app_links->end_query_bar = End_Query_Bar;\
app_links->print_message = Print_Message;\
app_links->change_theme = Change_Theme;\
app_links->change_font = Change_Font;\
app_links->buffer_set_font = Buffer_Set_Font;\
app_links->set_theme_colors = Set_Theme_Colors;\
app_links->get_theme_colors = Get_Theme_Colors;\
app_links->directory_get_hot = Directory_Get_Hot;\
app_links->get_file_list = Get_File_List;\
app_links->free_file_list = Free_File_List;\
app_links->memory_allocate = Memory_Allocate;\
app_links->memory_set_protection = Memory_Set_Protection;\
app_links->memory_free = Memory_Free;\
app_links->file_exists = File_Exists;\
app_links->directory_cd = Directory_CD;\
app_links->get_4ed_path = Get_4ed_Path;\
app_links->show_mouse_cursor = Show_Mouse_Cursor;\
app_links->toggle_fullscreen = Toggle_Fullscreen;\
app_links->is_fullscreen = Is_Fullscreen;\
app_links->send_exit_signal = Send_Exit_Signal;} while(false)
app_links->exec_command_ = Exec_Command;\
app_links->exec_system_command_ = Exec_System_Command;\
app_links->clipboard_post_ = Clipboard_Post;\
app_links->clipboard_count_ = Clipboard_Count;\
app_links->clipboard_index_ = Clipboard_Index;\
app_links->get_buffer_count_ = Get_Buffer_Count;\
app_links->get_buffer_first_ = Get_Buffer_First;\
app_links->get_buffer_next_ = Get_Buffer_Next;\
app_links->get_buffer_ = Get_Buffer;\
app_links->get_buffer_by_name_ = Get_Buffer_By_Name;\
app_links->buffer_read_range_ = Buffer_Read_Range;\
app_links->buffer_replace_range_ = Buffer_Replace_Range;\
app_links->buffer_compute_cursor_ = Buffer_Compute_Cursor;\
app_links->buffer_batch_edit_ = Buffer_Batch_Edit;\
app_links->buffer_set_setting_ = Buffer_Set_Setting;\
app_links->buffer_token_count_ = Buffer_Token_Count;\
app_links->buffer_read_tokens_ = Buffer_Read_Tokens;\
app_links->buffer_get_token_index_ = Buffer_Get_Token_Index;\
app_links->create_buffer_ = Create_Buffer;\
app_links->save_buffer_ = Save_Buffer;\
app_links->kill_buffer_ = Kill_Buffer;\
app_links->get_view_first_ = Get_View_First;\
app_links->get_view_next_ = Get_View_Next;\
app_links->get_view_ = Get_View;\
app_links->get_active_view_ = Get_Active_View;\
app_links->open_view_ = Open_View;\
app_links->close_view_ = Close_View;\
app_links->set_active_view_ = Set_Active_View;\
app_links->view_set_setting_ = View_Set_Setting;\
app_links->view_set_split_proportion_ = View_Set_Split_Proportion;\
app_links->view_compute_cursor_ = View_Compute_Cursor;\
app_links->view_set_cursor_ = View_Set_Cursor;\
app_links->view_set_scroll_ = View_Set_Scroll;\
app_links->view_set_mark_ = View_Set_Mark;\
app_links->view_set_highlight_ = View_Set_Highlight;\
app_links->view_set_buffer_ = View_Set_Buffer;\
app_links->view_post_fade_ = View_Post_Fade;\
app_links->get_user_input_ = Get_User_Input;\
app_links->get_command_input_ = Get_Command_Input;\
app_links->get_mouse_state_ = Get_Mouse_State;\
app_links->start_query_bar_ = Start_Query_Bar;\
app_links->end_query_bar_ = End_Query_Bar;\
app_links->print_message_ = Print_Message;\
app_links->change_theme_ = Change_Theme;\
app_links->change_font_ = Change_Font;\
app_links->buffer_set_font_ = Buffer_Set_Font;\
app_links->set_theme_colors_ = Set_Theme_Colors;\
app_links->get_theme_colors_ = Get_Theme_Colors;\
app_links->directory_get_hot_ = Directory_Get_Hot;\
app_links->get_file_list_ = Get_File_List;\
app_links->free_file_list_ = Free_File_List;\
app_links->memory_allocate_ = Memory_Allocate;\
app_links->memory_set_protection_ = Memory_Set_Protection;\
app_links->memory_free_ = Memory_Free;\
app_links->file_exists_ = File_Exists;\
app_links->directory_cd_ = Directory_CD;\
app_links->get_4ed_path_ = Get_4ed_Path;\
app_links->show_mouse_cursor_ = Show_Mouse_Cursor;\
app_links->toggle_fullscreen_ = Toggle_Fullscreen;\
app_links->is_fullscreen_ = Is_Fullscreen;\
app_links->send_exit_signal_ = Send_Exit_Signal;} while(false)
#if defined(ALLOW_DEP_4CODER)
static inline bool32 exec_command(Application_Links *app, Command_ID command_id){return(app->exec_command(app, command_id));}
static inline bool32 exec_system_command(Application_Links *app, View_Summary *view, Buffer_Identifier buffer, char *path, int32_t path_len, char *command, int32_t command_len, Command_Line_Interface_Flag flags){return(app->exec_system_command(app, view, buffer, path, path_len, command, command_len, flags));}
static inline void clipboard_post(Application_Links *app, int32_t clipboard_id, char *str, int32_t len){(app->clipboard_post(app, clipboard_id, str, len));}
static inline int32_t clipboard_count(Application_Links *app, int32_t clipboard_id){return(app->clipboard_count(app, clipboard_id));}
static inline int32_t clipboard_index(Application_Links *app, int32_t clipboard_id, int32_t item_index, char *out, int32_t len){return(app->clipboard_index(app, clipboard_id, item_index, out, len));}
static inline int32_t get_buffer_count(Application_Links *app){return(app->get_buffer_count(app));}
static inline Buffer_Summary get_buffer_first(Application_Links *app, Access_Flag access){return(app->get_buffer_first(app, access));}
static inline void get_buffer_next(Application_Links *app, Buffer_Summary *buffer, Access_Flag access){(app->get_buffer_next(app, buffer, access));}
static inline Buffer_Summary get_buffer(Application_Links *app, Buffer_ID buffer_id, Access_Flag access){return(app->get_buffer(app, buffer_id, access));}
static inline Buffer_Summary get_buffer_by_name(Application_Links *app, char *name, int32_t len, Access_Flag access){return(app->get_buffer_by_name(app, name, len, access));}
static inline bool32 buffer_read_range(Application_Links *app, Buffer_Summary *buffer, int32_t start, int32_t end, char *out){return(app->buffer_read_range(app, buffer, start, end, out));}
static inline bool32 buffer_replace_range(Application_Links *app, Buffer_Summary *buffer, int32_t start, int32_t end, char *str, int32_t len){return(app->buffer_replace_range(app, buffer, start, end, str, len));}
static inline bool32 buffer_compute_cursor(Application_Links *app, Buffer_Summary *buffer, Buffer_Seek seek, Partial_Cursor *cursor_out){return(app->buffer_compute_cursor(app, buffer, seek, cursor_out));}
static inline bool32 buffer_batch_edit(Application_Links *app, Buffer_Summary *buffer, char *str, int32_t str_len, Buffer_Edit *edits, int32_t edit_count, Buffer_Batch_Edit_Type type){return(app->buffer_batch_edit(app, buffer, str, str_len, edits, edit_count, type));}
static inline bool32 buffer_set_setting(Application_Links *app, Buffer_Summary *buffer, Buffer_Setting_ID setting, int32_t value){return(app->buffer_set_setting(app, buffer, setting, value));}
static inline int32_t buffer_token_count(Application_Links *app, Buffer_Summary *buffer){return(app->buffer_token_count(app, buffer));}
static inline bool32 buffer_read_tokens(Application_Links *app, Buffer_Summary *buffer, int32_t start_token, int32_t end_token, Cpp_Token *tokens_out){return(app->buffer_read_tokens(app, buffer, start_token, end_token, tokens_out));}
static inline bool32 buffer_get_token_index(Application_Links *app, Buffer_Summary *buffer, int32_t pos, Cpp_Get_Token_Result *get_result){return(app->buffer_get_token_index(app, buffer, pos, get_result));}
static inline Buffer_Summary create_buffer(Application_Links *app, char *filename, int32_t filename_len, Buffer_Create_Flag flags){return(app->create_buffer(app, filename, filename_len, flags));}
static inline bool32 save_buffer(Application_Links *app, Buffer_Summary *buffer, char *filename, int32_t filename_len, uint32_t flags){return(app->save_buffer(app, buffer, filename, filename_len, flags));}
static inline bool32 kill_buffer(Application_Links *app, Buffer_Identifier buffer, View_ID view_id, Buffer_Kill_Flag flags){return(app->kill_buffer(app, buffer, view_id, flags));}
static inline View_Summary get_view_first(Application_Links *app, Access_Flag access){return(app->get_view_first(app, access));}
static inline void get_view_next(Application_Links *app, View_Summary *view, Access_Flag access){(app->get_view_next(app, view, access));}
static inline View_Summary get_view(Application_Links *app, View_ID view_id, Access_Flag access){return(app->get_view(app, view_id, access));}
static inline View_Summary get_active_view(Application_Links *app, Access_Flag access){return(app->get_active_view(app, access));}
static inline View_Summary open_view(Application_Links *app, View_Summary *view_location, View_Split_Position position){return(app->open_view(app, view_location, position));}
static inline bool32 close_view(Application_Links *app, View_Summary *view){return(app->close_view(app, view));}
static inline bool32 set_active_view(Application_Links *app, View_Summary *view){return(app->set_active_view(app, view));}
static inline bool32 view_set_setting(Application_Links *app, View_Summary *view, View_Setting_ID setting, int32_t value){return(app->view_set_setting(app, view, setting, value));}
static inline bool32 view_set_split_proportion(Application_Links *app, View_Summary *view, float t){return(app->view_set_split_proportion(app, view, t));}
static inline bool32 view_compute_cursor(Application_Links *app, View_Summary *view, Buffer_Seek seek, Full_Cursor *cursor_out){return(app->view_compute_cursor(app, view, seek, cursor_out));}
static inline bool32 view_set_cursor(Application_Links *app, View_Summary *view, Buffer_Seek seek, bool32 set_preferred_x){return(app->view_set_cursor(app, view, seek, set_preferred_x));}
static inline bool32 view_set_scroll(Application_Links *app, View_Summary *view, GUI_Scroll_Vars scroll){return(app->view_set_scroll(app, view, scroll));}
static inline bool32 view_set_mark(Application_Links *app, View_Summary *view, Buffer_Seek seek){return(app->view_set_mark(app, view, seek));}
static inline bool32 view_set_highlight(Application_Links *app, View_Summary *view, int32_t start, int32_t end, bool32 turn_on){return(app->view_set_highlight(app, view, start, end, turn_on));}
static inline bool32 view_set_buffer(Application_Links *app, View_Summary *view, Buffer_ID buffer_id, Set_Buffer_Flag flags){return(app->view_set_buffer(app, view, buffer_id, flags));}
static inline bool32 view_post_fade(Application_Links *app, View_Summary *view, float seconds, int32_t start, int32_t end, int_color color){return(app->view_post_fade(app, view, seconds, start, end, color));}
static inline User_Input get_user_input(Application_Links *app, Input_Type_Flag get_type, Input_Type_Flag abort_type){return(app->get_user_input(app, get_type, abort_type));}
static inline User_Input get_command_input(Application_Links *app){return(app->get_command_input(app));}
static inline Mouse_State get_mouse_state(Application_Links *app){return(app->get_mouse_state(app));}
static inline bool32 start_query_bar(Application_Links *app, Query_Bar *bar, uint32_t flags){return(app->start_query_bar(app, bar, flags));}
static inline void end_query_bar(Application_Links *app, Query_Bar *bar, uint32_t flags){(app->end_query_bar(app, bar, flags));}
static inline void print_message(Application_Links *app, char *str, int32_t len){(app->print_message(app, str, len));}
static inline void change_theme(Application_Links *app, char *name, int32_t len){(app->change_theme(app, name, len));}
static inline void change_font(Application_Links *app, char *name, int32_t len, bool32 apply_to_all_files){(app->change_font(app, name, len, apply_to_all_files));}
static inline void buffer_set_font(Application_Links *app, Buffer_Summary *buffer, char *name, int32_t len){(app->buffer_set_font(app, buffer, name, len));}
static inline void set_theme_colors(Application_Links *app, Theme_Color *colors, int32_t count){(app->set_theme_colors(app, colors, count));}
static inline void get_theme_colors(Application_Links *app, Theme_Color *colors, int32_t count){(app->get_theme_colors(app, colors, count));}
static inline int32_t directory_get_hot(Application_Links *app, char *out, int32_t capacity){return(app->directory_get_hot(app, out, capacity));}
static inline File_List get_file_list(Application_Links *app, char *dir, int32_t len){return(app->get_file_list(app, dir, len));}
static inline void free_file_list(Application_Links *app, File_List list){(app->free_file_list(app, list));}
static inline void* memory_allocate(Application_Links *app, int32_t size){return(app->memory_allocate(app, size));}
static inline bool32 memory_set_protection(Application_Links *app, void *ptr, int32_t size, Memory_Protect_Flags flags){return(app->memory_set_protection(app, ptr, size, flags));}
static inline void memory_free(Application_Links *app, void *ptr, int32_t size){(app->memory_free(app, ptr, size));}
static inline bool32 file_exists(Application_Links *app, char *filename, int32_t len){return(app->file_exists(app, filename, len));}
static inline bool32 directory_cd(Application_Links *app, char *dir, int32_t *len, int32_t capacity, char *rel_path, int32_t rel_len){return(app->directory_cd(app, dir, len, capacity, rel_path, rel_len));}
static inline bool32 get_4ed_path(Application_Links *app, char *out, int32_t capacity){return(app->get_4ed_path(app, out, capacity));}
static inline void show_mouse_cursor(Application_Links *app, Mouse_Cursor_Show_Type show){(app->show_mouse_cursor(app, show));}
static inline void toggle_fullscreen(Application_Links *app){(app->toggle_fullscreen(app));}
static inline bool32 is_fullscreen(Application_Links *app){return(app->is_fullscreen(app));}
static inline void send_exit_signal(Application_Links *app){(app->send_exit_signal(app));}
#else
static inline bool32 exec_command(Application_Links *app, Command_ID command_id){return(app->exec_command_(app, command_id));}
static inline bool32 exec_system_command(Application_Links *app, View_Summary *view, Buffer_Identifier buffer, char *path, int32_t path_len, char *command, int32_t command_len, Command_Line_Interface_Flag flags){return(app->exec_system_command_(app, view, buffer, path, path_len, command, command_len, flags));}
static inline void clipboard_post(Application_Links *app, int32_t clipboard_id, char *str, int32_t len){(app->clipboard_post_(app, clipboard_id, str, len));}
static inline int32_t clipboard_count(Application_Links *app, int32_t clipboard_id){return(app->clipboard_count_(app, clipboard_id));}
static inline int32_t clipboard_index(Application_Links *app, int32_t clipboard_id, int32_t item_index, char *out, int32_t len){return(app->clipboard_index_(app, clipboard_id, item_index, out, len));}
static inline int32_t get_buffer_count(Application_Links *app){return(app->get_buffer_count_(app));}
static inline Buffer_Summary get_buffer_first(Application_Links *app, Access_Flag access){return(app->get_buffer_first_(app, access));}
static inline void get_buffer_next(Application_Links *app, Buffer_Summary *buffer, Access_Flag access){(app->get_buffer_next_(app, buffer, access));}
static inline Buffer_Summary get_buffer(Application_Links *app, Buffer_ID buffer_id, Access_Flag access){return(app->get_buffer_(app, buffer_id, access));}
static inline Buffer_Summary get_buffer_by_name(Application_Links *app, char *name, int32_t len, Access_Flag access){return(app->get_buffer_by_name_(app, name, len, access));}
static inline bool32 buffer_read_range(Application_Links *app, Buffer_Summary *buffer, int32_t start, int32_t end, char *out){return(app->buffer_read_range_(app, buffer, start, end, out));}
static inline bool32 buffer_replace_range(Application_Links *app, Buffer_Summary *buffer, int32_t start, int32_t end, char *str, int32_t len){return(app->buffer_replace_range_(app, buffer, start, end, str, len));}
static inline bool32 buffer_compute_cursor(Application_Links *app, Buffer_Summary *buffer, Buffer_Seek seek, Partial_Cursor *cursor_out){return(app->buffer_compute_cursor_(app, buffer, seek, cursor_out));}
static inline bool32 buffer_batch_edit(Application_Links *app, Buffer_Summary *buffer, char *str, int32_t str_len, Buffer_Edit *edits, int32_t edit_count, Buffer_Batch_Edit_Type type){return(app->buffer_batch_edit_(app, buffer, str, str_len, edits, edit_count, type));}
static inline bool32 buffer_set_setting(Application_Links *app, Buffer_Summary *buffer, Buffer_Setting_ID setting, int32_t value){return(app->buffer_set_setting_(app, buffer, setting, value));}
static inline int32_t buffer_token_count(Application_Links *app, Buffer_Summary *buffer){return(app->buffer_token_count_(app, buffer));}
static inline bool32 buffer_read_tokens(Application_Links *app, Buffer_Summary *buffer, int32_t start_token, int32_t end_token, Cpp_Token *tokens_out){return(app->buffer_read_tokens_(app, buffer, start_token, end_token, tokens_out));}
static inline bool32 buffer_get_token_index(Application_Links *app, Buffer_Summary *buffer, int32_t pos, Cpp_Get_Token_Result *get_result){return(app->buffer_get_token_index_(app, buffer, pos, get_result));}
static inline Buffer_Summary create_buffer(Application_Links *app, char *filename, int32_t filename_len, Buffer_Create_Flag flags){return(app->create_buffer_(app, filename, filename_len, flags));}
static inline bool32 save_buffer(Application_Links *app, Buffer_Summary *buffer, char *filename, int32_t filename_len, uint32_t flags){return(app->save_buffer_(app, buffer, filename, filename_len, flags));}
static inline bool32 kill_buffer(Application_Links *app, Buffer_Identifier buffer, View_ID view_id, Buffer_Kill_Flag flags){return(app->kill_buffer_(app, buffer, view_id, flags));}
static inline View_Summary get_view_first(Application_Links *app, Access_Flag access){return(app->get_view_first_(app, access));}
static inline void get_view_next(Application_Links *app, View_Summary *view, Access_Flag access){(app->get_view_next_(app, view, access));}
static inline View_Summary get_view(Application_Links *app, View_ID view_id, Access_Flag access){return(app->get_view_(app, view_id, access));}
static inline View_Summary get_active_view(Application_Links *app, Access_Flag access){return(app->get_active_view_(app, access));}
static inline View_Summary open_view(Application_Links *app, View_Summary *view_location, View_Split_Position position){return(app->open_view_(app, view_location, position));}
static inline bool32 close_view(Application_Links *app, View_Summary *view){return(app->close_view_(app, view));}
static inline bool32 set_active_view(Application_Links *app, View_Summary *view){return(app->set_active_view_(app, view));}
static inline bool32 view_set_setting(Application_Links *app, View_Summary *view, View_Setting_ID setting, int32_t value){return(app->view_set_setting_(app, view, setting, value));}
static inline bool32 view_set_split_proportion(Application_Links *app, View_Summary *view, float t){return(app->view_set_split_proportion_(app, view, t));}
static inline bool32 view_compute_cursor(Application_Links *app, View_Summary *view, Buffer_Seek seek, Full_Cursor *cursor_out){return(app->view_compute_cursor_(app, view, seek, cursor_out));}
static inline bool32 view_set_cursor(Application_Links *app, View_Summary *view, Buffer_Seek seek, bool32 set_preferred_x){return(app->view_set_cursor_(app, view, seek, set_preferred_x));}
static inline bool32 view_set_scroll(Application_Links *app, View_Summary *view, GUI_Scroll_Vars scroll){return(app->view_set_scroll_(app, view, scroll));}
static inline bool32 view_set_mark(Application_Links *app, View_Summary *view, Buffer_Seek seek){return(app->view_set_mark_(app, view, seek));}
static inline bool32 view_set_highlight(Application_Links *app, View_Summary *view, int32_t start, int32_t end, bool32 turn_on){return(app->view_set_highlight_(app, view, start, end, turn_on));}
static inline bool32 view_set_buffer(Application_Links *app, View_Summary *view, Buffer_ID buffer_id, Set_Buffer_Flag flags){return(app->view_set_buffer_(app, view, buffer_id, flags));}
static inline bool32 view_post_fade(Application_Links *app, View_Summary *view, float seconds, int32_t start, int32_t end, int_color color){return(app->view_post_fade_(app, view, seconds, start, end, color));}
static inline User_Input get_user_input(Application_Links *app, Input_Type_Flag get_type, Input_Type_Flag abort_type){return(app->get_user_input_(app, get_type, abort_type));}
static inline User_Input get_command_input(Application_Links *app){return(app->get_command_input_(app));}
static inline Mouse_State get_mouse_state(Application_Links *app){return(app->get_mouse_state_(app));}
static inline bool32 start_query_bar(Application_Links *app, Query_Bar *bar, uint32_t flags){return(app->start_query_bar_(app, bar, flags));}
static inline void end_query_bar(Application_Links *app, Query_Bar *bar, uint32_t flags){(app->end_query_bar_(app, bar, flags));}
static inline void print_message(Application_Links *app, char *str, int32_t len){(app->print_message_(app, str, len));}
static inline void change_theme(Application_Links *app, char *name, int32_t len){(app->change_theme_(app, name, len));}
static inline void change_font(Application_Links *app, char *name, int32_t len, bool32 apply_to_all_files){(app->change_font_(app, name, len, apply_to_all_files));}
static inline void buffer_set_font(Application_Links *app, Buffer_Summary *buffer, char *name, int32_t len){(app->buffer_set_font_(app, buffer, name, len));}
static inline void set_theme_colors(Application_Links *app, Theme_Color *colors, int32_t count){(app->set_theme_colors_(app, colors, count));}
static inline void get_theme_colors(Application_Links *app, Theme_Color *colors, int32_t count){(app->get_theme_colors_(app, colors, count));}
static inline int32_t directory_get_hot(Application_Links *app, char *out, int32_t capacity){return(app->directory_get_hot_(app, out, capacity));}
static inline File_List get_file_list(Application_Links *app, char *dir, int32_t len){return(app->get_file_list_(app, dir, len));}
static inline void free_file_list(Application_Links *app, File_List list){(app->free_file_list_(app, list));}
static inline void* memory_allocate(Application_Links *app, int32_t size){return(app->memory_allocate_(app, size));}
static inline bool32 memory_set_protection(Application_Links *app, void *ptr, int32_t size, Memory_Protect_Flags flags){return(app->memory_set_protection_(app, ptr, size, flags));}
static inline void memory_free(Application_Links *app, void *ptr, int32_t size){(app->memory_free_(app, ptr, size));}
static inline bool32 file_exists(Application_Links *app, char *filename, int32_t len){return(app->file_exists_(app, filename, len));}
static inline bool32 directory_cd(Application_Links *app, char *dir, int32_t *len, int32_t capacity, char *rel_path, int32_t rel_len){return(app->directory_cd_(app, dir, len, capacity, rel_path, rel_len));}
static inline bool32 get_4ed_path(Application_Links *app, char *out, int32_t capacity){return(app->get_4ed_path_(app, out, capacity));}
static inline void show_mouse_cursor(Application_Links *app, Mouse_Cursor_Show_Type show){(app->show_mouse_cursor_(app, show));}
static inline void toggle_fullscreen(Application_Links *app){(app->toggle_fullscreen_(app));}
static inline bool32 is_fullscreen(Application_Links *app){return(app->is_fullscreen_(app));}
static inline void send_exit_signal(Application_Links *app){(app->send_exit_signal_(app));}
#endif

View File

@ -32,7 +32,7 @@ CUSTOM_COMMAND_SIG(write_zero_struct){
}
CUSTOM_COMMAND_SIG(write_capital){
User_Input command_in = app->get_command_input(app);
User_Input command_in = get_command_input(app);
char c = command_in.key.character_no_caps_lock;
if (c != 0){
c = char_to_upper(c);
@ -46,15 +46,15 @@ CUSTOM_COMMAND_SIG(switch_to_compilation){
int32_t name_size = sizeof(name)-1;
uint32_t access = AccessOpen;
View_Summary view = app->get_active_view(app, access);
Buffer_Summary buffer = app->get_buffer_by_name(app, name, name_size, access);
View_Summary view = get_active_view(app, access);
Buffer_Summary buffer = get_buffer_by_name(app, name, name_size, access);
app->view_set_buffer(app, &view, buffer.buffer_id, 0);
view_set_buffer(app, &view, buffer.buffer_id, 0);
}
CUSTOM_COMMAND_SIG(rewrite_as_single_caps){
uint32_t access = AccessOpen;
View_Summary view = app->get_active_view(app, access);
View_Summary view = get_active_view(app, access);
Full_Cursor cursor = view.cursor;
// TODO(allen): This can be rewritten now without moving the
@ -73,8 +73,8 @@ CUSTOM_COMMAND_SIG(rewrite_as_single_caps){
string.size = range.max - range.min;
assert(string.size < app->memory_size);
Buffer_Summary buffer = app->get_buffer(app, view.buffer_id, access);
app->buffer_read_range(app, &buffer, range.min, range.max, string.str);
Buffer_Summary buffer = get_buffer(app, view.buffer_id, access);
buffer_read_range(app, &buffer, range.min, range.max, string.str);
int32_t is_first = true;
for (int32_t i = 0; i < string.size; ++i){
@ -91,23 +91,23 @@ CUSTOM_COMMAND_SIG(rewrite_as_single_caps){
}
}
app->buffer_replace_range(app, &buffer, range.min, range.max, string.str, string.size);
buffer_replace_range(app, &buffer, range.min, range.max, string.str, string.size);
app->view_set_cursor(app, &view,
view_set_cursor(app, &view,
seek_line_char(cursor.line+1, cursor.character),
true);
}
CUSTOM_COMMAND_SIG(open_my_files){
uint32_t access = AccessAll;
View_Summary view = app->get_active_view(app, access);
View_Summary view = get_active_view(app, access);
view_open_file(app, &view, literal("w:/4ed/data/test/basic.cpp"), true);
}
CUSTOM_COMMAND_SIG(build_at_launch_location){
uint32_t access = AccessAll;
View_Summary view = app->get_active_view(app, access);
app->exec_system_command(app, &view,
View_Summary view = get_active_view(app, access);
exec_system_command(app, &view,
buffer_identifier(literal("*compilation*")),
literal("."),
literal("build"),
@ -127,8 +127,8 @@ CUSTOM_COMMAND_SIG(seek_whitespace_down_end_line){
HOOK_SIG(my_start){
init_memory(app);
app->change_theme(app, literal("4coder"));
app->change_font(app, literal("Liberation Sans"), true);
change_theme(app, literal("4coder"));
change_font(app, literal("Liberation Sans"), true);
exec_command(app, open_panel_vsplit);
exec_command(app, hide_scrollbar);
@ -159,8 +159,8 @@ HOOK_SIG(my_exit){
}
CUSTOM_COMMAND_SIG(newline_or_goto_position){
View_Summary view = app->get_active_view(app, AccessProtected);
Buffer_Summary buffer = app->get_buffer(app, view.buffer_id, AccessProtected);
View_Summary view = get_active_view(app, AccessProtected);
Buffer_Summary buffer = get_buffer(app, view.buffer_id, AccessProtected);
if (buffer.lock_flags & AccessProtected){
exec_command(app, goto_jump_at_cursor);
@ -173,11 +173,11 @@ CUSTOM_COMMAND_SIG(newline_or_goto_position){
// TODO(allen): Eliminate this hook if you can.
OPEN_FILE_HOOK_SIG(my_file_settings){
// NOTE(allen|a4.0.8): The app->get_parameter_buffer was eliminated
// NOTE(allen|a4.0.8): The get_parameter_buffer was eliminated
// and instead the buffer is passed as an explicit parameter through
// the function call. That is where buffer_id comes from here.
uint32_t access = AccessProtected|AccessHidden;
Buffer_Summary buffer = app->get_buffer(app, buffer_id, access);
Buffer_Summary buffer = get_buffer(app, buffer_id, access);
assert(buffer.exists);
int32_t treat_as_code = 0;
@ -198,9 +198,9 @@ OPEN_FILE_HOOK_SIG(my_file_settings){
wrap_lines = 0;
}
app->buffer_set_setting(app, &buffer, BufferSetting_Lex, treat_as_code);
app->buffer_set_setting(app, &buffer, BufferSetting_WrapLine, wrap_lines);
app->buffer_set_setting(app, &buffer, BufferSetting_MapID,
buffer_set_setting(app, &buffer, BufferSetting_Lex, treat_as_code);
buffer_set_setting(app, &buffer, BufferSetting_WrapLine, wrap_lines);
buffer_set_setting(app, &buffer, BufferSetting_MapID,
(treat_as_code)?((int32_t)my_code_map):((int32_t)mapid_file));
// no meaning for return
@ -226,11 +226,11 @@ static void
set_mouse_suppression(Application_Links *app, int32_t suppress){
if (suppress){
suppressing_mouse = true;
app->show_mouse_cursor(app, MouseCursorShow_Never);
show_mouse_cursor(app, MouseCursorShow_Never);
}
else{
suppressing_mouse = false;
app->show_mouse_cursor(app, MouseCursorShow_Always);
show_mouse_cursor(app, MouseCursorShow_Always);
}
}

File diff suppressed because it is too large Load Diff

View File

@ -246,11 +246,6 @@ get_rect(View_Summary *view){
return(rect);
}
inline void
exec_command(Application_Links *app, Command_ID id){
app->exec_command(app, id);
}
inline void
exec_command(Application_Links *app, Custom_Command_Function *func){
func(app);
@ -269,12 +264,12 @@ exec_command(Application_Links *app, Generic_Command cmd){
inline void
active_view_to_line(Application_Links *app, uint32_t access, int32_t line_number){
View_Summary view;
view = app->get_active_view(app, access);
view = get_active_view(app, access);
// NOTE(allen|a3.4.4): We don't have to worry about whether this is a valid line number.
// When it's not possible to place a cursor at the position for whatever reason it will set the
// cursor to a nearby valid position.
app->view_set_cursor(app, &view, seek_line_char(line_number, 0), 1);
view_set_cursor(app, &view, seek_line_char(line_number, 0), 1);
}
inline View_Summary
@ -284,11 +279,11 @@ get_first_view_with_buffer(Application_Links *app, int32_t buffer_id){
if (buffer_id != 0){
uint32_t access = AccessAll;
for(test = app->get_view_first(app, access);
for(test = get_view_first(app, access);
test.exists;
app->get_view_next(app, &test, access)){
get_view_next(app, &test, access)){
Buffer_Summary buffer = app->get_buffer(app, test.buffer_id, access);
Buffer_Summary buffer = get_buffer(app, test.buffer_id, access);
if(buffer.buffer_id == buffer_id){
result = test;
@ -318,14 +313,14 @@ query_user_general(Application_Links *app, Query_Bar *bar, int32_t force_number)
// user, if this command starts intercepting input even though no prompt is shown.
// This will only happen if you have a lot of bars open already or if the current view
// doesn't support query bars.
if (app->start_query_bar(app, bar, 0) == 0) return 0;
if (start_query_bar(app, bar, 0) == 0) return 0;
while (1){
// NOTE(allen|a3.4.4): This call will block until the user does one of the input
// types specified in the flags. The first set of flags are inputs you'd like to intercept
// that you don't want to abort on. The second set are inputs that you'd like to cause
// the command to abort. If an event satisfies both flags, it is treated as an abort.
in = app->get_user_input(app, EventOnAnyKey, EventOnEsc | EventOnButton);
in = get_user_input(app, EventOnAnyKey, EventOnEsc | EventOnButton);
// NOTE(allen|a3.4.4): The responsible thing to do on abort is to end the command
// without waiting on get_user_input again.
@ -385,17 +380,17 @@ query_user_number(Application_Links *app, Query_Bar *bar){
inline Buffer_Summary
get_active_buffer(Application_Links *app, uint32_t access){
View_Summary view = app->get_active_view(app, access);
Buffer_Summary buffer = app->get_buffer(app, view.buffer_id, access);
View_Summary view = get_active_view(app, access);
Buffer_Summary buffer = get_buffer(app, view.buffer_id, access);
return(buffer);
}
inline char
buffer_get_char(Application_Links *app, Buffer_Summary *buffer, int32_t pos){
char result = ' ';
*buffer = app->get_buffer(app, buffer->buffer_id, AccessAll);
*buffer = get_buffer(app, buffer->buffer_id, AccessAll);
if (pos >= 0 && pos < buffer->size){
app->buffer_read_range(app, buffer, pos, pos+1, &result);
buffer_read_range(app, buffer, pos, pos+1, &result);
}
return(result);
}

View File

@ -18,7 +18,7 @@ static ID_Based_Jump_Location null_location = {0};
static void
jump_to_location(Application_Links *app, View_Summary *view, Name_Based_Jump_Location *l){
if (view_open_file(app, view, l->file.str, l->file.size, true)){
app->view_set_cursor(app, view, seek_line_char(l->line, l->column), true);
view_set_cursor(app, view, seek_line_char(l->line, l->column), true);
}
}
@ -168,7 +168,7 @@ parse_jump_from_buffer_line(Application_Links *app,
int32_t result = false;
String line_str = {0};
Buffer_Summary buffer = app->get_buffer(app, buffer_id, AccessAll);
Buffer_Summary buffer = get_buffer(app, buffer_id, AccessAll);
if (read_line(app, part, &buffer, line, &line_str)){
int32_t colon_char = 0;
if (parse_jump_location(line_str, location, skip_sub_errors, &colon_char)){
@ -181,7 +181,7 @@ parse_jump_from_buffer_line(Application_Links *app,
CUSTOM_COMMAND_SIG(goto_jump_at_cursor){
Temp_Memory temp = begin_temp_memory(&global_part);
View_Summary view = app->get_active_view(app, AccessProtected);
View_Summary view = get_active_view(app, AccessProtected);
Name_Based_Jump_Location location = {0};
if (parse_jump_from_buffer_line(app, &global_part,
@ -189,7 +189,7 @@ CUSTOM_COMMAND_SIG(goto_jump_at_cursor){
&location)){
exec_command(app, change_active_panel);
view = app->get_active_view(app, AccessAll);
view = get_active_view(app, AccessAll);
jump_to_location(app, &view, &location);
}
@ -217,7 +217,7 @@ seek_next_jump_in_buffer(Application_Links *app,
int32_t result = false;
int32_t line = first_line;
String line_str = {0};
Buffer_Summary buffer = app->get_buffer(app, buffer_id, AccessAll);
Buffer_Summary buffer = get_buffer(app, buffer_id, AccessAll);
for (;;){
if (read_line(app, part, &buffer, line, &line_str)){
if (parse_jump_location(line_str, location_out, skip_sub_errors, colon_index_out)){
@ -244,7 +244,7 @@ static ID_Based_Jump_Location
convert_name_based_to_id_based(Application_Links *app, Name_Based_Jump_Location loc){
ID_Based_Jump_Location result = {0};
Buffer_Summary buffer =
app->get_buffer_by_name(app, loc.file.str, loc.file.size, AccessAll);
get_buffer_by_name(app, loc.file.str, loc.file.size, AccessAll);
if (buffer.exists){
result.buffer_id = buffer.buffer_id;
@ -326,7 +326,7 @@ advance_cursor_in_jump_view(Application_Links *app,
if (result){
*location_out = location;
app->view_set_cursor(app, view, seek_line_char(line, colon_index+1), true);
view_set_cursor(app, view, seek_line_char(line, colon_index+1), true);
}
prev_location = jump;
@ -357,7 +357,7 @@ get_view_for_locked_jump_buffer(Application_Links *app){
View_Summary view = {0};
if (locked_buffer.size > 0){
Buffer_Summary buffer = app->get_buffer_by_name(app, locked_buffer.str, locked_buffer.size, AccessAll);
Buffer_Summary buffer = get_buffer_by_name(app, locked_buffer.str, locked_buffer.size, AccessAll);
if (buffer.exists){
view = get_first_view_with_buffer(app, buffer.buffer_id);
}
@ -384,10 +384,10 @@ seek_error(Application_Links *app,
if (advance_cursor_in_jump_view(app, &global_part, &view,
skip_repeats, skip_sub_errors, direction,
&location)){
View_Summary active_view = app->get_active_view(app, AccessAll);
View_Summary active_view = get_active_view(app, AccessAll);
if (active_view.view_id == view.view_id){
exec_command(app, change_active_panel);
active_view = app->get_active_view(app, AccessAll);
active_view = get_active_view(app, AccessAll);
}
jump_to_location(app, &active_view, &location);
@ -432,7 +432,7 @@ CUSTOM_COMMAND_SIG(goto_first_jump){
View_Summary view = get_view_for_locked_jump_buffer(app);
if (view.exists){
app->view_set_cursor(app, &view, seek_pos(0), true);
view_set_cursor(app, &view, seek_pos(0), true);
prev_location = null_location;
seek_error(app, &global_part, false, true, 1);

View File

@ -282,7 +282,7 @@ search_front_to_back_step(Application_Links *app,
int32_t case_insensitive = (range->flags & SearchFlag_CaseInsensitive);
result.buffer = app->get_buffer(app, range->buffer, AccessAll);
result.buffer = get_buffer(app, range->buffer, AccessAll);
if (case_insensitive){
buffer_seek_string_insensitive_forward(app, &result.buffer,
start_pos, end_pos,
@ -344,7 +344,7 @@ search_back_to_front_step(Application_Links *app,
if (*pos > range->start){
int32_t start_pos = *pos;
result.buffer = app->get_buffer(app, range->buffer, AccessAll);
result.buffer = get_buffer(app, range->buffer, AccessAll);
buffer_seek_string_backward(app, &result.buffer,
start_pos, range->start,
word.str, word.size,

View File

@ -176,7 +176,7 @@ DOC_SEE(Command_ID)
result = true;
}
else{
app->print_message(app, literal("WARNING: An invalid Command_ID was passed to exec_command."));
print_message(app, literal("WARNING: An invalid Command_ID was passed to exec_command."));
}
return(result);
@ -703,7 +703,8 @@ DOC_SEE(Buffer_Batch_Edit_Type)
}
API_EXPORT bool32
Buffer_Set_Setting(Application_Links *app, Buffer_Summary *buffer, Buffer_Setting_ID setting, int32_t value)/*
Buffer_Set_Setting(Application_Links *app, Buffer_Summary *buffer, Buffer_Setting_ID setting, int32_t value)
/*
DOC_PARAM(buffer, The buffer parameter specifies the buffer on which to set a setting.)
DOC_PARAM(setting, The setting parameter identifies the setting that shall be changed.)
DOC_PARAM(value, The value parameter specifies the value to which the setting shall be changed.)
@ -799,7 +800,8 @@ DOC_SEE(Buffer_Setting_ID)
}
API_EXPORT int32_t
Buffer_Token_Count(Application_Links *app, Buffer_Summary *buffer)/*
Buffer_Token_Count(Application_Links *app, Buffer_Summary *buffer)
/*
DOC_PARAM(buffer, Specifies the buffer from which to read the token count.)
DOC_RETURN(If tokens are available for the buffer, the number of tokens on the buffer is returned.
If the buffer does not exist or if it is not a lexed buffer, the return is zero.)
@ -817,7 +819,8 @@ If the buffer does not exist or if it is not a lexed buffer, the return is zero.
}
API_EXPORT bool32
Buffer_Read_Tokens(Application_Links *app, Buffer_Summary *buffer, int32_t start_token, int32_t end_token, Cpp_Token *tokens_out)/*
Buffer_Read_Tokens(Application_Links *app, Buffer_Summary *buffer, int32_t start_token, int32_t end_token, Cpp_Token *tokens_out)
/*
DOC_PARAM(buffer, Specifies the buffer from which to read tokens.)
DOC_PARAM(first_token, Specifies the index of the first token to read.)
DOC_PARAM(end_token, Specifies the token to stop reading at.)
@ -843,7 +846,18 @@ The number of output tokens will be end_token - start_token.)
}
API_EXPORT bool32
Buffer_Get_Token_Index(Application_Links *app, Buffer_Summary *buffer, int32_t pos, Cpp_Get_Token_Result *get_result){
Buffer_Get_Token_Index(Application_Links *app, Buffer_Summary *buffer, int32_t pos, Cpp_Get_Token_Result *get_result)
/*
DOC_PARAM(buffer, The buffer from which to get a token.)
DOC_PARAM(pos, The position in the buffer in absolute coordinates.)
DOC_PARAM(get_result, The output struct specifying which token contains pos.)
DOC_RETURN(Returns non-zero on success. This call can fail if the buffer doesn't exist,
or if the buffer doesn't have tokens ready.)
DOC(This call finds the token that contains a particular position, or if the position is in between
tokens it finds the index of the token to the left of the position.)
DOC_SEE(Cpp_Get_Token_Result)
DOC_SEE(cpp_get_token)
*/{
Command_Data *cmd = (Command_Data*)app->cmd_context;
Editing_File *file = imp_get_file(cmd, buffer);
Cpp_Token_Array token_array = file->state.token_array;
@ -1027,7 +1041,7 @@ DOC_SEE(Buffer_Identifier)
}
else{
#define MESSAGE "CUSTOM WARNING: the buffer is dirty and no view was specified for a dialogue.\n"
app->print_message(app, literal(MESSAGE));
print_message(app, literal(MESSAGE));
#undef MESSAGE
}
}

View File

@ -2601,9 +2601,10 @@ generate_custom_headers(){
append_sc(&out, "_Function);\n");
}
append_sc(&out,
"struct Application_Links{\n");
append_sc(&out, "struct Application_Links{\n");
append_sc(&out, "#if defined(ALLOW_DEP_4CODER)\n");
for (int32_t i = 0; i < unit_custom.set.count; ++i){
append_ss(&out, unit_custom.set.items[i].name);
append_sc(&out, "_Function *");
@ -2611,6 +2612,16 @@ generate_custom_headers(){
append_sc(&out, ";\n");
}
append_sc(&out, "#else\n");
for (int32_t i = 0; i < unit_custom.set.count; ++i){
append_ss(&out, unit_custom.set.items[i].name);
append_sc(&out, "_Function *");
append_ss(&out, func_4ed_names.names[i].public_name);
append_sc(&out, "_;\n");
}
append_sc(&out, "#endif\n");
append_sc(&out,
"void *memory;\n"
"int32_t memory_size;\n"
@ -2621,16 +2632,66 @@ generate_custom_headers(){
"};\n");
append_sc(&out, "#define FillAppLinksAPI(app_links) do{");
for (int32_t i = 0; i < unit_custom.set.count; ++i){
append_sc(&out, "\\\napp_links->");
append_ss(&out, func_4ed_names.names[i].public_name);
append_sc(&out, " = ");
append_sc(&out, "_ = ");
append_ss(&out, unit_custom.set.items[i].name);
append_s_char(&out, ';');
}
append_sc(&out, "} while(false)\n");
append_sc(&out, "#if defined(ALLOW_DEP_4CODER)\n");
for (int32_t use_dep = 1; use_dep >= 0; --use_dep){
for (int32_t i = 0; i < unit_custom.set.count; ++i){
Argument_Breakdown breakdown = unit_custom.set.items[i].breakdown;
String ret = unit_custom.set.items[i].ret;
String public_name = func_4ed_names.names[i].public_name;
append_sc(&out, "static inline ");
append_ss(&out, ret);
append_sc(&out, " ");
append_ss(&out, public_name);
append_sc(&out, "(");
for (int32_t j = 0; j < breakdown.count; ++j){
append_ss(&out, breakdown.args[j].param_string);
if (j+1 != breakdown.count){
append_sc(&out, ", ");
}
}
append_sc(&out, "){");
if (match_ss(ret, make_lit_string("void"))){
append_sc(&out, "(");
}
else{
append_sc(&out, "return(");
}
append_sc(&out, "app->");
append_ss(&out, public_name);
if (!use_dep){
append_sc(&out, "_");
}
append_sc(&out, "(");
for (int32_t j = 0; j < breakdown.count; ++j){
append_ss(&out, breakdown.args[j].param_name);
if (j+1 != breakdown.count){
append_sc(&out, ", ");
}
}
append_sc(&out, ")");
append_sc(&out, ");}\n");
}
if (use_dep == 1){
append_sc(&out, "#else\n");
}
}
append_sc(&out, "#endif\n");
end_file_out(context);
}
else{

View File

@ -10,19 +10,16 @@ if "%SRC%" == "" SET SRC=4coder_default_bindings.cpp
SET OPTS=/W4 /wd4310 /wd4100 /wd4201 /wd4505 /wd4996 /wd4127 /wd4510 /wd4512 /wd4610 /WX
SET OPTS=%OPTS% /GR- /nologo /FC
SET DEBUG=/Zi
set BUILD_DLL=/LD /link /INCREMENTAL:NO /OPT:REF
SET BUILD_DLL=/LD /link /INCREMENTAL:NO /OPT:REF
SET EXPORTS=/EXPORT:get_bindings /EXPORT:get_alpha_4coder_version
REM SET LINKS=user32.lib gdi32.lib
SET LINKS=
REM This stores the path of the buildsuper.bat script
REM in CODE_HOME. This way you can always include the
REM default files no matter where you store your code.
REM And no matter how you call buildsuper.bat.
SET CODE_HOME=%~dp0
cl /I%CODE_HOME% %OPTS% %DEBUG% %SRC% %LINKS% /Fe4coder_custom %BUILD_DLL% %EXPORTS%
cl /I%CODE_HOME% %OPTS% %DEBUG% %SRC% /Fe4coder_custom %BUILD_DLL% %EXPORTS%
REM file spammation preventation
del *.exp

View File

@ -37,7 +37,7 @@ CUSTOM_COMMAND_SIG(load_lots_of_files){
// I set the goal of 10M for all tests.
TEST_TIME_B(10000000);
File_List list = app->get_file_list(app, literal(LOTS_OF_FILES));
File_List list = get_file_list(app, literal(LOTS_OF_FILES));
File_Info *info = list.infos;
char space[1024];
@ -49,14 +49,14 @@ CUSTOM_COMMAND_SIG(load_lots_of_files){
for (int32_t i = 0; i < list.count; ++i, ++info){
if (!info->folder){
append_ss(&str, make_string(info->filename, info->filename_len));
Buffer_Summary buffer = app->create_buffer(app, str.str, str.size,
Buffer_Summary buffer = create_buffer(app, str.str, str.size,
BufferCreate_Background);
assert(buffer.size != 0);
str.size = size;
}
}
app->free_file_list(app, list);
free_file_list(app, list);
// TODO(allen): Pass this time test!
//TEST_TIME_E();
@ -67,9 +67,9 @@ CUSTOM_COMMAND_SIG(reopen_test){
// based on 4GHz and 60fps
TEST_TIME_B(700000);
Buffer_Summary buffer = app->create_buffer(app, literal(TEST_FILES "/basic.cpp"), 0);
View_Summary view = app->get_active_view(app, AccessAll);
app->view_set_buffer(app, &view, buffer.buffer_id, 0);
Buffer_Summary buffer = create_buffer(app, literal(TEST_FILES "/basic.cpp"), 0);
View_Summary view = get_active_view(app, AccessAll);
view_set_buffer(app, &view, buffer.buffer_id, 0);
exec_command(app, cmdid_reopen);
@ -78,9 +78,9 @@ CUSTOM_COMMAND_SIG(reopen_test){
}
CUSTOM_COMMAND_SIG(generate_stop_spots_test_data){
Buffer_Summary buffer = app->create_buffer(app, literal(LOTS_OF_FILES "/4ed.cpp"), 0);
View_Summary view = app->get_active_view(app, AccessAll);
app->view_set_buffer(app, &view, buffer.buffer_id, 0);
Buffer_Summary buffer = create_buffer(app, literal(LOTS_OF_FILES "/4ed.cpp"), 0);
View_Summary view = get_active_view(app, AccessAll);
view_set_buffer(app, &view, buffer.buffer_id, 0);
FILE *file = fopen(TEST_FILES "/stop_spots_data", "wb");
@ -88,14 +88,14 @@ CUSTOM_COMMAND_SIG(generate_stop_spots_test_data){
Partial_Cursor curs;
int32_t pos;
app->buffer_compute_cursor(app, &buffer, seek_line_char(316, 29), &curs);
buffer_compute_cursor(app, &buffer, seek_line_char(316, 29), &curs);
fwrite(&curs.pos, 4, 1, file);
for (int32_t i = 0; i < 10; ++i){
Query_Bar bar = {0};
bar.prompt = make_lit_string("Do something to continue the test");
if (app->start_query_bar(app, &bar, 0)){
app->get_user_input(app, EventAll, EventAll);
if (start_query_bar(app, &bar, 0)){
get_user_input(app, EventAll, EventAll);
}
refresh_buffer(app, &buffer);
if (buffer.tokens_are_ready){
@ -135,9 +135,9 @@ fcheck(int32_t x, FILE *file){
}
CUSTOM_COMMAND_SIG(stop_spots_test){
Buffer_Summary buffer = app->create_buffer(app, literal(LOTS_OF_FILES "/4ed.cpp"), 0);
View_Summary view = app->get_active_view(app, AccessAll);
app->view_set_buffer(app, &view, buffer.buffer_id, 0);
Buffer_Summary buffer = create_buffer(app, literal(LOTS_OF_FILES "/4ed.cpp"), 0);
View_Summary view = get_active_view(app, AccessAll);
view_set_buffer(app, &view, buffer.buffer_id, 0);
FILE *file = fopen(TEST_FILES "/stop_spots_data", "rb");
@ -145,14 +145,14 @@ CUSTOM_COMMAND_SIG(stop_spots_test){
Partial_Cursor curs;
int32_t pos;
app->buffer_compute_cursor(app, &buffer, seek_line_char(316, 29), &curs);
buffer_compute_cursor(app, &buffer, seek_line_char(316, 29), &curs);
fcheck(curs.pos, file);
for (int32_t i = 0; i < 10; ++i){
Query_Bar bar = {0};
bar.prompt = make_lit_string("Do something to continue the test");
if (app->start_query_bar(app, &bar, 0)){
app->get_user_input(app, EventAll, EventAll);
if (start_query_bar(app, &bar, 0)){
get_user_input(app, EventAll, EventAll);
}
refresh_buffer(app, &buffer);
if (buffer.tokens_are_ready){
@ -185,11 +185,11 @@ CUSTOM_COMMAND_SIG(stop_spots_test){
}
CUSTOM_COMMAND_SIG(load_unicode_file){
Buffer_Summary buffer = app->create_buffer(app, literal(TEST_FILES "/mod_markov.c"), 0);
View_Summary view = app->get_active_view(app, AccessAll);
app->view_set_buffer(app, &view, buffer.buffer_id, 0);
Buffer_Summary buffer = create_buffer(app, literal(TEST_FILES "/mod_markov.c"), 0);
View_Summary view = get_active_view(app, AccessAll);
view_set_buffer(app, &view, buffer.buffer_id, 0);
app->view_set_cursor(app, &view, seek_line_char(230, 25), 1);
view_set_cursor(app, &view, seek_line_char(230, 25), 1);
}
CUSTOM_COMMAND_SIG(run_all_tests){

View File

@ -13,8 +13,8 @@
#include <string.h>
CUSTOM_COMMAND_SIG(kill_rect){
View_Summary view = app->get_active_view(app, AccessOpen);
Buffer_Summary buffer = app->get_buffer(app, view.buffer_id, AccessOpen);
View_Summary view = get_active_view(app, AccessOpen);
Buffer_Summary buffer = get_buffer(app, view.buffer_id, AccessOpen);
Buffer_Rect rect = get_rect(&view);
@ -26,15 +26,15 @@ CUSTOM_COMMAND_SIG(kill_rect){
Full_Cursor cursor = {0};
success = success &&
app->view_compute_cursor(app, &view, seek_line_char(line, rect.char0), &cursor);
view_compute_cursor(app, &view, seek_line_char(line, rect.char0), &cursor);
start = cursor.pos;
success = success &&
app->view_compute_cursor(app, &view, seek_line_char(line, rect.char1), &cursor);
view_compute_cursor(app, &view, seek_line_char(line, rect.char1), &cursor);
end = cursor.pos;
if (success){
app->buffer_replace_range(app, &buffer, start, end, 0, 0);
buffer_replace_range(app, &buffer, start, end, 0, 0);
}
}
}
@ -46,15 +46,15 @@ pad_buffer_line(Application_Links *app, Partition *part,
Partial_Cursor start = {0};
Partial_Cursor end = {0};
if (app->buffer_compute_cursor(app, buffer, seek_line_char(line, 1), &start)){
if (app->buffer_compute_cursor(app, buffer, seek_line_char(line, 65536), &end)){
if (buffer_compute_cursor(app, buffer, seek_line_char(line, 1), &start)){
if (buffer_compute_cursor(app, buffer, seek_line_char(line, 65536), &end)){
if (start.line == line){
if (end.character-1 < target){
Temp_Memory temp = begin_temp_memory(part);
int size = target - (end.character-1);
char *str = push_array(part, char, size);
memset(str, ' ', size);
app->buffer_replace_range(app, buffer, end.pos, end.pos, str, size);
buffer_replace_range(app, buffer, end.pos, end.pos, str, size);
end_temp_memory(temp);
}
}
@ -100,8 +100,8 @@ doing multi-cursor for now.
CUSTOM_COMMAND_SIG(multi_line_edit){
Partition *part = &global_part;
View_Summary view = app->get_active_view(app, AccessOpen);
Buffer_Summary buffer = app->get_buffer(app, view.buffer_id, AccessOpen);
View_Summary view = get_active_view(app, AccessOpen);
Buffer_Summary buffer = get_buffer(app, view.buffer_id, AccessOpen);
Buffer_Rect rect = get_rect(&view);
@ -115,7 +115,7 @@ CUSTOM_COMMAND_SIG(multi_line_edit){
int line_count = rect.line1 - rect.line0 + 1;
for (;;){
User_Input in = app->get_user_input(app, EventOnAnyKey, EventOnEsc | EventOnButton);
User_Input in = get_user_input(app, EventOnAnyKey, EventOnEsc | EventOnButton);
if (in.abort) break;
if (in.key.character && key_is_unmodified(&in.key)){
@ -128,7 +128,7 @@ CUSTOM_COMMAND_SIG(multi_line_edit){
for (int i = rect.line0; i <= rect.line1; ++i){
Partial_Cursor cursor = {0};
if (app->buffer_compute_cursor(app, &buffer, seek_line_char(i, pos+1), &cursor)){
if (buffer_compute_cursor(app, &buffer, seek_line_char(i, pos+1), &cursor)){
edit->str_start = 0;
edit->len = 1;
edit->start = cursor.pos;
@ -138,13 +138,13 @@ CUSTOM_COMMAND_SIG(multi_line_edit){
}
int edit_count = (int)(edit - edits);
app->buffer_batch_edit(app, &buffer, &str, 1, edits, edit_count, BatchEdit_Normal);
buffer_batch_edit(app, &buffer, &str, 1, edits, edit_count, BatchEdit_Normal);
end_temp_memory(temp);
++pos;
app->view_set_cursor(app, &view, seek_line_char(start_line, pos+1), true);
view_set_cursor(app, &view, seek_line_char(start_line, pos+1), true);
}
else if (in.key.keycode == key_back){
if (pos > 0){
@ -156,7 +156,7 @@ CUSTOM_COMMAND_SIG(multi_line_edit){
for (int i = rect.line0; i <= rect.line1; ++i){
Partial_Cursor cursor = {0};
if (app->buffer_compute_cursor(app, &buffer, seek_line_char(i, pos+1), &cursor)){
if (buffer_compute_cursor(app, &buffer, seek_line_char(i, pos+1), &cursor)){
edit->str_start = 0;
edit->len = 0;
edit->start = cursor.pos-1;
@ -166,7 +166,7 @@ CUSTOM_COMMAND_SIG(multi_line_edit){
}
int edit_count = (int)(edit - edits);
app->buffer_batch_edit(app, &buffer, 0, 0, edits, edit_count, BatchEdit_Normal);
buffer_batch_edit(app, &buffer, 0, 0, edits, edit_count, BatchEdit_Normal);
end_temp_memory(temp);
@ -184,8 +184,8 @@ CUSTOM_COMMAND_SIG(multi_line_edit){
// if the API exposed access to the tokens in a code file.
CUSTOM_COMMAND_SIG(mark_matching_brace){
uint32_t access = AccessProtected;
View_Summary view = app->get_active_view(app, access);
Buffer_Summary buffer = app->get_buffer(app, view.buffer_id, access);
View_Summary view = get_active_view(app, access);
Buffer_Summary buffer = get_buffer(app, view.buffer_id, access);
int32_t start_pos = view.cursor.pos;
@ -259,14 +259,14 @@ CUSTOM_COMMAND_SIG(mark_matching_brace){
finished:
if (found_result){
app->view_set_mark(app, &view, seek_pos(result+1));
view_set_mark(app, &view, seek_pos(result+1));
}
}
CUSTOM_COMMAND_SIG(cursor_to_surrounding_scope){
unsigned int access = AccessProtected;
View_Summary view = app->get_active_view(app, access);
Buffer_Summary buffer = app->get_buffer(app, view.buffer_id, access);
View_Summary view = get_active_view(app, access);
Buffer_Summary buffer = get_buffer(app, view.buffer_id, access);
int start_pos = view.cursor.pos - 1;
@ -305,7 +305,7 @@ CUSTOM_COMMAND_SIG(cursor_to_surrounding_scope){
finished:
if (found_result){
app->view_set_cursor(app, &view, seek_pos(result), 0);
view_set_cursor(app, &view, seek_pos(result), 0);
}
}
@ -313,15 +313,15 @@ CUSTOM_COMMAND_SIG(cursor_to_surrounding_scope){
CUSTOM_COMMAND_SIG(rename_parameter){
uint32_t access = AccessOpen;
View_Summary view = app->get_active_view(app, access);
Buffer_Summary buffer = app->get_buffer(app, view.buffer_id, access);
View_Summary view = get_active_view(app, access);
Buffer_Summary buffer = get_buffer(app, view.buffer_id, access);
Partition *part = &global_part;
Temp_Memory temp = begin_temp_memory(part);
Cpp_Get_Token_Result result;
if (app->buffer_get_token_index(app, &buffer, view.cursor.pos, &result)){
if (buffer_get_token_index(app, &buffer, view.cursor.pos, &result)){
if (!result.in_whitespace){
Cpp_Token stream_space[32];
Stream_Tokens stream = {0};
@ -338,7 +338,7 @@ CUSTOM_COMMAND_SIG(rename_parameter){
if (token.size < sizeof(old_lexeme_base)){
Cpp_Token original_token = token;
old_lexeme.size = token.size;
app->buffer_read_range(app, &buffer, token.start,
buffer_read_range(app, &buffer, token.start,
token.start+token.size,
old_lexeme.str);
@ -406,7 +406,7 @@ CUSTOM_COMMAND_SIG(rename_parameter){
char other_lexeme_base[128];
String other_lexeme = make_fixed_width_string(other_lexeme_base);
other_lexeme.size = old_lexeme.size;
app->buffer_read_range(app, &buffer, token_ptr->start,
buffer_read_range(app, &buffer, token_ptr->start,
token_ptr->start+token_ptr->size,
other_lexeme.str);
@ -450,7 +450,7 @@ CUSTOM_COMMAND_SIG(rename_parameter){
doublebreak2:;
if (closed_correctly){
app->buffer_batch_edit(app, &buffer, replace_string.str, replace_string.size,
buffer_batch_edit(app, &buffer, replace_string.str, replace_string.size,
edits, edit_count, BatchEdit_Normal);
}
}
@ -465,15 +465,15 @@ CUSTOM_COMMAND_SIG(rename_parameter){
CUSTOM_COMMAND_SIG(write_explicit_enum_values){
uint32_t access = AccessOpen;
View_Summary view = app->get_active_view(app, access);
Buffer_Summary buffer = app->get_buffer(app, view.buffer_id, access);
View_Summary view = get_active_view(app, access);
Buffer_Summary buffer = get_buffer(app, view.buffer_id, access);
Partition *part = &global_part;
Temp_Memory temp = begin_temp_memory(part);
Cpp_Get_Token_Result result;
if (app->buffer_get_token_index(app, &buffer, view.cursor.pos, &result)){
if (buffer_get_token_index(app, &buffer, view.cursor.pos, &result)){
if (!result.in_whitespace){
Cpp_Token stream_space[32];
Stream_Tokens stream = {0};
@ -595,7 +595,7 @@ CUSTOM_COMMAND_SIG(write_explicit_enum_values){
finished:;
if (closed_correctly){
app->buffer_batch_edit(app, &buffer, string_base, string.size,
buffer_batch_edit(app, &buffer, string_base, string.size,
edits, edit_count, BatchEdit_Normal);
}
}
@ -622,8 +622,8 @@ CUSTOM_COMMAND_SIG(save_theme_settings){
fclose(file);
app->change_theme(app, theme_name, strlen(theme_name));
app->change_font(app, font_name, strlen(font_name));
change_theme(app, theme_name, strlen(theme_name));
change_font(app, font_name, strlen(font_name));
}
}
#endif
@ -641,7 +641,7 @@ HOOK_SIG(experimental_start){
if (!file){
char module_path[512];
int len = app->get_4ed_path(app, module_path, 448);
int len = get_4ed_path(app, module_path, 448);
memcpy(module_path+len, SETTINGS_FILE, sizeof(SETTINGS_FILE));
file = fopen(module_path, "rb");
}
@ -660,8 +660,8 @@ HOOK_SIG(experimental_start){
int theme_len = (int)strlen(theme_name);
int font_len = (int)strlen(font_name);
app->change_theme(app, theme_name, theme_len);
app->change_font(app, font_name, font_len, true);
change_theme(app, theme_name, theme_len);
change_font(app, font_name, font_len, true);
exec_command(app, open_panel_vsplit);
exec_command(app, hide_scrollbar);

View File

@ -162,7 +162,8 @@ folders.
}
API_EXPORT bool32
Get_4ed_Path(Application_Links *app, char *out, int32_t capacity)/*
Get_4ed_Path(Application_Links *app, char *out, int32_t capacity)
/*
DOC_PARAM(out, This parameter provides a character buffer that receives the path to the 4ed executable file.)
DOC_PARAM(capacity, This parameter specifies the maximum capacity of the out buffer.)
DOC_RETURN(This call returns non-zero on success.)
@ -173,7 +174,8 @@ DOC_RETURN(This call returns non-zero on success.)
// TODO(allen): add a "shown but auto-hides on timer" setting here.
API_EXPORT void
Show_Mouse_Cursor(Application_Links *app, Mouse_Cursor_Show_Type show)/*
Show_Mouse_Cursor(Application_Links *app, Mouse_Cursor_Show_Type show)
/*
DOC_PARAM(show, This parameter specifies the new state of the mouse cursor.)
DOC_SEE(Mouse_Cursor_Show_Type)
*/{
@ -191,7 +193,8 @@ DOC_SEE(Mouse_Cursor_Show_Type)
}
API_EXPORT void
Toggle_Fullscreen(Application_Links *app)/*
Toggle_Fullscreen(Application_Links *app)
/*
DOC(This call tells 4coder to switch into or out of full screen mode.
The changes of full screen mode do not take effect until the end of the current frame.
On Windows this call will not work unless 4coder was started in "stream mode".
@ -207,12 +210,13 @@ Stream mode can be enabled with -S or -F flags on the command line to 4ed.)
win32vars.do_toggle = !win32vars.do_toggle;
}
else{
app->print_message(app, literal("WARNING: Cannot go full screen unless 4coder is in stream mode\n Use the flag -S to put 4coder in stream mode.\n"));
print_message(app, literal("WARNING: Cannot go full screen unless 4coder is in stream mode\n Use the flag -S to put 4coder in stream mode.\n"));
}
}
API_EXPORT bool32
Is_Fullscreen(Application_Links *app)/*
Is_Fullscreen(Application_Links *app)
/*
DOC(This call returns true if the 4coder is in full screen mode. This call
takes toggles that have already occured this frame into account. So it may return
true even though the frame has not ended and actually put 4coder into full screen. If
@ -228,7 +232,8 @@ frame if the state is not changed.)
}
API_EXPORT void
Send_Exit_Signal(Application_Links *app)/*
Send_Exit_Signal(Application_Links *app)
/*
DOC(This call sends a signal to 4coder to attempt to exit. If there are unsaved
files this triggers a dialogue ensuring you're okay with closing.)
*/{