2019-04-01 02:41:39 +00:00
|
|
|
/*
|
|
|
|
* Helpers for the API transition from 4.0.30 to 4.0.31
|
|
|
|
*
|
|
|
|
* In order to keep your layer on the old API you don't have to do anything, this provides wrappers
|
|
|
|
* idential to the 4.0.30 API.
|
|
|
|
* In order to transition your entire layer over to the 4.0.31 API define 'REMOVE_TRANSITION_HELPER_31' and fix errors.
|
|
|
|
* Or you can do it step by step by removing a few wrappers at a time.
|
|
|
|
* This transition helper will be removed in a future version so it is recommended to get off sooner or laster.
|
|
|
|
*
|
|
|
|
* Tips on transitioning:
|
|
|
|
*
|
|
|
|
* Wrather than just try to inline this code everywhere, you can simplify things quite a lot by storing references
|
|
|
|
* to buffers and views and Buffer_ID and View_ID instead of Buffer_Summary and View_Summary.
|
|
|
|
* Just get the summaries when you need information in those structures.
|
|
|
|
*
|
|
|
|
* You will make your code simpler if you stick to String as much as possible, but whenever you want to you can switch
|
|
|
|
* to any string type you have to String by calling make_string(char_ptr, length) or make_string_slowly(null_terminated_c_str).
|
|
|
|
* To pull the char ptr and length out of a String named "string": string.str and str.size.
|
|
|
|
* If you need a null terminated string from a String use get_null_terminated in 4coder_helper.cpp
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
// TOP
|
|
|
|
|
|
|
|
#if !defined(REMOVE_TRANSITION_HELPER_31)
|
|
|
|
|
|
|
|
static char
|
|
|
|
buffer_get_char(Application_Links *app, Buffer_Summary *buffer, i32 pos){
|
|
|
|
return(buffer==0?0:buffer_get_char(app, buffer->buffer_id, pos));
|
|
|
|
}
|
|
|
|
|
|
|
|
static i32
|
|
|
|
buffer_get_line_start(Application_Links *app, Buffer_Summary *buffer, i32 line){
|
|
|
|
return(buffer==0?0:buffer_get_line_start(app, buffer->buffer_id, line));
|
|
|
|
}
|
|
|
|
|
|
|
|
static i32
|
|
|
|
buffer_get_line_end(Application_Links *app, Buffer_Summary *buffer, i32 line){
|
|
|
|
return(buffer==0?0:buffer_get_line_end(app, buffer->buffer_id, line));
|
|
|
|
}
|
|
|
|
|
|
|
|
static Cpp_Token*
|
|
|
|
get_first_token_at_line(Application_Links *app, Buffer_Summary *buffer, Cpp_Token_Array tokens, i32 line){
|
|
|
|
return(buffer==0?0:get_first_token_at_line(app, buffer->buffer_id, tokens, line));
|
|
|
|
}
|
|
|
|
|
|
|
|
static b32
|
|
|
|
read_line(Application_Links *app, Partition *part, Buffer_Summary *buffer, i32 line, String *str,
|
|
|
|
Partial_Cursor *start_out, Partial_Cursor *one_past_last_out){
|
|
|
|
return(buffer==0?0:read_line(app, part, buffer->buffer_id, line, str, start_out, one_past_last_out));
|
|
|
|
}
|
|
|
|
|
|
|
|
static b32
|
|
|
|
read_line(Application_Links *app, Partition *part, Buffer_Summary *buffer, i32 line, String *str){
|
|
|
|
return(buffer==0?0:read_line(app, part, buffer->buffer_id, line, str));
|
|
|
|
}
|
|
|
|
|
2019-04-04 08:25:16 +00:00
|
|
|
|
2019-04-01 02:41:39 +00:00
|
|
|
static b32
|
|
|
|
init_stream_chunk(Stream_Chunk *chunk, Application_Links *app, Buffer_Summary *buffer, i32 pos, char *data, u32 size){
|
|
|
|
return(buffer==0?0:init_stream_chunk(chunk, app, buffer->buffer_id, pos, data, size));
|
|
|
|
}
|
|
|
|
|
|
|
|
static b32
|
|
|
|
init_stream_tokens(Stream_Tokens_DEP *stream, Application_Links *app, Buffer_Summary *buffer, i32 pos, Cpp_Token *data, i32 count){
|
|
|
|
return(buffer==0?0:init_stream_tokens(stream, app, buffer->buffer_id, pos, data, count));
|
|
|
|
}
|
|
|
|
|
2019-04-04 08:25:16 +00:00
|
|
|
static String
|
|
|
|
token_get_lexeme(Application_Links *app, Buffer_Summary *buffer, Cpp_Token *token, char *out_buffer, i32 out_buffer_size){
|
|
|
|
String result = {};
|
|
|
|
if (buffer != 0){
|
|
|
|
result = token_get_lexeme(app, buffer->buffer_id, token, out_buffer, out_buffer_size);
|
|
|
|
}
|
|
|
|
return(result);
|
|
|
|
}
|
|
|
|
|
|
|
|
static String
|
|
|
|
token_get_lexeme(Application_Links *app, Partition *part, Buffer_Summary *buffer, Cpp_Token *token){
|
|
|
|
String result = {};
|
|
|
|
if (buffer != 0){
|
|
|
|
result = token_get_lexeme(app, part, buffer->buffer_id, token);
|
|
|
|
}
|
|
|
|
return(result);
|
|
|
|
}
|
|
|
|
|
|
|
|
static String
|
|
|
|
get_token_or_word_under_pos(Application_Links *app, Buffer_Summary *buffer, i32 pos, char *space, i32 capacity){
|
|
|
|
String result = {};
|
|
|
|
if (buffer != 0){
|
|
|
|
result = get_token_or_word_under_pos(app, buffer->buffer_id, pos, space, capacity);
|
|
|
|
}
|
|
|
|
return(result);
|
|
|
|
}
|
|
|
|
|
2019-04-01 02:41:39 +00:00
|
|
|
static i32
|
|
|
|
seek_line_end(Application_Links *app, Buffer_Summary *buffer, i32 pos){
|
|
|
|
return(buffer==0?0:seek_line_end(app, buffer->buffer_id, pos));
|
|
|
|
}
|
|
|
|
|
|
|
|
static i32
|
|
|
|
seek_line_beginning(Application_Links *app, Buffer_Summary *buffer, i32 pos){
|
|
|
|
return(buffer==0?0:seek_line_beginning(app, buffer->buffer_id, pos));
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
move_past_lead_whitespace(Application_Links *app, View_Summary *view, Buffer_Summary *buffer){
|
2019-04-06 21:13:49 +00:00
|
|
|
move_past_lead_whitespace(app, view!=0?0:view->view_id, buffer!=0?0:buffer->buffer_id);
|
2019-04-01 02:41:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static i32
|
|
|
|
buffer_seek_whitespace_up(Application_Links *app, Buffer_Summary *buffer, i32 pos){
|
|
|
|
return(buffer==0?0:buffer_seek_whitespace_up(app, buffer->buffer_id, pos));
|
|
|
|
}
|
|
|
|
|
|
|
|
static i32
|
|
|
|
buffer_seek_whitespace_down(Application_Links *app, Buffer_Summary *buffer, i32 pos){
|
|
|
|
return(buffer==0?0:buffer_seek_whitespace_down(app, buffer->buffer_id, pos));
|
|
|
|
}
|
|
|
|
|
|
|
|
static i32
|
|
|
|
buffer_seek_whitespace_right(Application_Links *app, Buffer_Summary *buffer, i32 pos){
|
|
|
|
return(buffer==0?0:buffer_seek_whitespace_right(app, buffer->buffer_id, pos));
|
|
|
|
}
|
|
|
|
|
|
|
|
static i32
|
|
|
|
buffer_seek_whitespace_left(Application_Links *app, Buffer_Summary *buffer, i32 pos){
|
|
|
|
return(buffer==0?0:buffer_seek_whitespace_left(app, buffer->buffer_id, pos));
|
|
|
|
}
|
|
|
|
|
|
|
|
static i32
|
|
|
|
buffer_seek_alphanumeric_right(Application_Links *app, Buffer_Summary *buffer, i32 pos){
|
|
|
|
return(buffer==0?0:buffer_seek_alphanumeric_right(app, buffer->buffer_id, pos));
|
|
|
|
}
|
|
|
|
|
|
|
|
static i32
|
|
|
|
buffer_seek_alphanumeric_left(Application_Links *app, Buffer_Summary *buffer, i32 pos){
|
|
|
|
return(buffer==0?0:buffer_seek_alphanumeric_left(app, buffer->buffer_id, pos));
|
|
|
|
}
|
|
|
|
|
|
|
|
static i32
|
|
|
|
buffer_seek_alphanumeric_or_underscore_right(Application_Links *app, Buffer_Summary *buffer, i32 pos){
|
|
|
|
return(buffer==0?0:buffer_seek_alphanumeric_or_underscore_right(app, buffer->buffer_id, pos));
|
|
|
|
}
|
|
|
|
|
|
|
|
static i32
|
|
|
|
buffer_seek_alphanumeric_or_underscore_left(Application_Links *app, Buffer_Summary *buffer, i32 pos){
|
|
|
|
return(buffer==0?0:buffer_seek_alphanumeric_or_underscore_left(app, buffer->buffer_id, pos));
|
|
|
|
}
|
|
|
|
|
|
|
|
static i32
|
|
|
|
buffer_seek_range_camel_right(Application_Links *app, Buffer_Summary *buffer, i32 pos, i32 an_pos){
|
|
|
|
return(buffer==0?0:buffer_seek_range_camel_right(app, buffer->buffer_id, pos, an_pos));
|
|
|
|
}
|
|
|
|
|
|
|
|
static i32
|
|
|
|
buffer_seek_range_camel_left(Application_Links *app, Buffer_Summary *buffer, i32 pos, i32 an_pos){
|
|
|
|
return(buffer==0?0:buffer_seek_range_camel_left(app, buffer->buffer_id, pos, an_pos));
|
|
|
|
}
|
|
|
|
|
|
|
|
static i32
|
|
|
|
buffer_seek_alphanumeric_or_camel_right(Application_Links *app, Buffer_Summary *buffer, i32 pos){
|
|
|
|
return(buffer==0?0:buffer_seek_alphanumeric_or_camel_right(app, buffer->buffer_id, pos));
|
|
|
|
}
|
|
|
|
|
|
|
|
static i32
|
|
|
|
buffer_seek_alphanumeric_or_camel_left(Application_Links *app, Buffer_Summary *buffer, i32 pos){
|
|
|
|
return(buffer==0?0:buffer_seek_alphanumeric_or_camel_left(app, buffer->buffer_id, pos));
|
|
|
|
}
|
|
|
|
|
2019-04-02 20:06:49 +00:00
|
|
|
static i32
|
|
|
|
buffer_seek_alpha_numeric_end(Application_Links *app, Buffer_Summary *buffer, int32_t pos){
|
|
|
|
return(buffer!=0?0:buffer_seek_alpha_numeric_end(app, buffer->buffer_id, pos));
|
|
|
|
}
|
|
|
|
|
2019-04-01 02:41:39 +00:00
|
|
|
static Cpp_Token_Array
|
|
|
|
buffer_get_all_tokens(Application_Links *app, Partition *part, Buffer_Summary *buffer){
|
|
|
|
Cpp_Token_Array result = {};
|
|
|
|
if (buffer != 0){
|
|
|
|
result = buffer_get_all_tokens(app, part, buffer->buffer_id);
|
|
|
|
}
|
|
|
|
return(result);
|
|
|
|
}
|
|
|
|
|
|
|
|
static i32
|
|
|
|
buffer_boundary_seek(Application_Links *app, Buffer_Summary *buffer, Partition *part, i32 start_pos, b32 seek_forward, Seek_Boundary_Flag flags){
|
|
|
|
return(buffer==0?0:buffer_boundary_seek(app, buffer->buffer_id, part, start_pos, seek_forward, flags));
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
buffer_seek_delimiter_forward(Application_Links *app, Buffer_Summary *buffer, i32 pos, char delim, i32 *result){
|
|
|
|
if (buffer != 0){
|
|
|
|
buffer_seek_delimiter_forward(app, buffer->buffer_id, pos, delim, result);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
buffer_seek_delimiter_backward(Application_Links *app, Buffer_Summary *buffer, i32 pos, char delim, i32 *result){
|
|
|
|
if (buffer != 0){
|
|
|
|
buffer_seek_delimiter_backward(app, buffer->buffer_id, pos, delim, result);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
buffer_seek_string_forward(Application_Links *app, Buffer_Summary *buffer, i32 pos, i32 end, char *str, i32 size, i32 *result){
|
|
|
|
if (buffer != 0){
|
|
|
|
buffer_seek_string_forward(app, buffer->buffer_id, pos, end, str, size, result);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
buffer_seek_string_backward(Application_Links *app, Buffer_Summary *buffer, i32 pos, i32 end, char *str, i32 size, i32 *result){
|
|
|
|
if (buffer != 0){
|
|
|
|
buffer_seek_string_backward(app, buffer->buffer_id, pos, end, str, size, result);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
buffer_seek_string_insensitive_forward(Application_Links *app, Buffer_Summary *buffer, i32 pos, i32 end, char *str, i32 size, i32 *result){
|
|
|
|
if (buffer != 0){
|
|
|
|
buffer_seek_string_insensitive_forward(app, buffer->buffer_id, pos, end, str, size, result);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
buffer_seek_string_insensitive_backward(Application_Links *app, Buffer_Summary *buffer, i32 pos, i32 end, char *str, i32 size, i32 *result){
|
|
|
|
if (buffer != 0){
|
|
|
|
buffer_seek_string_insensitive_backward(app, buffer->buffer_id, pos, end, str, size, result);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
buffer_seek_string(Application_Links *app, Buffer_Summary *buffer, i32 pos, i32 end, i32 min, char *str, i32 size, i32 *result, Buffer_Seek_String_Flags flags){
|
|
|
|
if (buffer != 0){
|
|
|
|
buffer_seek_string(app, buffer->buffer_id, pos, end, min, str, size, result, flags);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static b32
|
|
|
|
buffer_line_is_blank(Application_Links *app, Buffer_Summary *buffer, i32 line){
|
|
|
|
return(buffer==0?0:buffer_line_is_blank(app, buffer->buffer_id, line));
|
|
|
|
}
|
|
|
|
|
|
|
|
static String
|
|
|
|
read_identifier_at_pos(Application_Links *app, Buffer_Summary *buffer, i32 pos, char *space, i32 max, Range *range_out){
|
|
|
|
String result = {};
|
|
|
|
if (buffer != 0){
|
|
|
|
result = read_identifier_at_pos(app, buffer->buffer_id, pos, space, max, range_out);
|
|
|
|
}
|
|
|
|
return(result);
|
|
|
|
}
|
|
|
|
|
|
|
|
static i32
|
|
|
|
buffer_boundary_seek(Application_Links *app, Buffer_Summary *buffer, i32 start_pos, i32 dir, Seek_Boundary_Flag flags){
|
|
|
|
return(buffer==0?0:buffer_boundary_seek(app, buffer->buffer_id, start_pos, dir, flags));
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
view_buffer_boundary_seek_set_pos(Application_Links *app, View_Summary *view, Buffer_Summary *buffer, i32 dir, u32 flags){
|
2019-04-06 21:13:49 +00:00
|
|
|
view_buffer_boundary_seek_set_pos(app, view==0?0:view->view_id, buffer==0?0:buffer->buffer_id, dir, flags);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
view_boundary_seek_set_pos(Application_Links *app, View_Summary *view, i32 dir, u32 flags){
|
|
|
|
view_boundary_seek_set_pos(app, view==0?0:view->view_id, dir, flags);
|
2019-04-01 02:41:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static Range
|
|
|
|
view_buffer_boundary_range(Application_Links *app, View_Summary *view, Buffer_Summary *buffer, i32 dir, u32 flags){
|
2019-04-06 21:13:49 +00:00
|
|
|
return(view_buffer_boundary_range(app, view==0?0:view->view_id, buffer==0?0:buffer->buffer_id, dir, flags));
|
2019-04-01 02:41:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static Range
|
|
|
|
view_buffer_snipe_range(Application_Links *app, View_Summary *view, Buffer_Summary *buffer, i32 dir, u32 flags){
|
2019-04-06 21:13:49 +00:00
|
|
|
return(view_buffer_snipe_range(app, view==0?0:view->view_id, buffer==0?0:buffer->buffer_id, dir, flags));
|
2019-04-01 02:41:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
query_replace_base(Application_Links *app, View_Summary *view, Buffer_Summary *buffer, i32 pos, String r, String w){
|
2019-04-06 23:36:53 +00:00
|
|
|
query_replace_base(app, view==0?0:view->view_id, buffer==0?0:buffer->buffer_id, pos, r, w);
|
2019-04-01 02:41:39 +00:00
|
|
|
}
|
|
|
|
|
2019-04-04 08:25:16 +00:00
|
|
|
static Statement_Parser
|
|
|
|
make_statement_parser(Application_Links *app, Buffer_Summary *buffer, i32 token_index){
|
|
|
|
Statement_Parser parser = {};
|
|
|
|
if (buffer != 0){
|
|
|
|
parser = make_statement_parser(app, buffer->buffer_id, token_index);
|
|
|
|
}
|
|
|
|
return(parser);
|
|
|
|
}
|
|
|
|
|
|
|
|
static b32
|
|
|
|
find_whole_statement_down(Application_Links *app, Buffer_Summary *buffer, i32 pos, i32 *start_out, i32 *end_out){
|
|
|
|
return(buffer==0?false:find_whole_statement_down(app, buffer->buffer_id, pos, start_out, end_out));
|
|
|
|
}
|
|
|
|
|
|
|
|
static b32
|
|
|
|
find_scope_top(Application_Links *app, Buffer_Summary *buffer, i32 start_pos, u32 flags, i32 *end_pos_out){
|
|
|
|
return(buffer==0?false:find_scope_top(app, buffer->buffer_id, start_pos, flags, end_pos_out));
|
|
|
|
}
|
|
|
|
|
|
|
|
static b32
|
|
|
|
find_scope_bottom(Application_Links *app, Buffer_Summary *buffer, i32 start_pos, u32 flags, i32 *end_pos_out){
|
|
|
|
return(buffer==0?false:find_scope_bottom(app, buffer->buffer_id, start_pos, flags, end_pos_out));
|
|
|
|
}
|
|
|
|
|
|
|
|
static b32
|
|
|
|
find_scope_range(Application_Links *app, Buffer_Summary *buffer, i32 start_pos, Range *range_out, u32 flags){
|
|
|
|
return(buffer==0?false:find_scope_range(app, buffer->buffer_id, start_pos, range_out, flags));
|
|
|
|
}
|
|
|
|
|
|
|
|
static b32
|
|
|
|
find_next_scope(Application_Links *app, Buffer_Summary *buffer, i32 start_pos, u32 flags, i32 *end_pos_out){
|
|
|
|
return(buffer==0?false:find_next_scope(app, buffer->buffer_id, start_pos, flags, end_pos_out));
|
|
|
|
}
|
|
|
|
|
|
|
|
static b32
|
|
|
|
find_prev_scope(Application_Links *app, Buffer_Summary *buffer, i32 start_pos, u32 flags, i32 *end_pos_out){
|
|
|
|
return(buffer==0?false:find_prev_scope(app, buffer->buffer_id, start_pos, flags, end_pos_out));
|
|
|
|
}
|
|
|
|
|
|
|
|
static Range_Array
|
|
|
|
get_enclosure_ranges(Application_Links *app, Partition *part, Buffer_Summary *buffer, i32 pos, u32 flags){
|
|
|
|
Range_Array result = {};
|
|
|
|
if (buffer != 0){
|
|
|
|
result = get_enclosure_ranges(app, part, buffer->buffer_id, pos, flags);
|
|
|
|
}
|
|
|
|
return(result);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
mark_enclosures(Application_Links *app, Partition *scratch, Managed_Scope render_scope, Buffer_Summary *buffer, i32 pos, u32 flags, Marker_Visual_Type type, int_color *back_colors, int_color *fore_colors, i32 color_count){
|
|
|
|
if (buffer != 0){
|
|
|
|
mark_enclosures(app, scratch, render_scope, buffer->buffer_id, pos, flags, type, back_colors, fore_colors, color_count);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static Hard_Start_Result
|
|
|
|
buffer_find_hard_start(Application_Links *app, Buffer_Summary *buffer, i32 line_start, i32 tab_width){
|
|
|
|
Hard_Start_Result result = {};
|
|
|
|
if (buffer != 0){
|
|
|
|
buffer_find_hard_start(app, buffer->buffer_id, line_start, tab_width);
|
|
|
|
}
|
|
|
|
return(result);
|
|
|
|
}
|
|
|
|
|
|
|
|
static Buffer_Batch_Edit
|
|
|
|
make_batch_from_indent_marks(Application_Links *app, Partition *arena, Buffer_Summary *buffer, i32 first_line, i32 one_past_last_line, i32 *indent_marks, Indent_Options opts){
|
|
|
|
Buffer_Batch_Edit result = {};
|
|
|
|
if (buffer != 0){
|
|
|
|
make_batch_from_indent_marks(app, arena, buffer->buffer_id, first_line, one_past_last_line, indent_marks, opts);
|
|
|
|
}
|
|
|
|
return(result);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
set_line_indents(Application_Links *app, Partition *part, Buffer_Summary *buffer, i32 first_line, i32 one_past_last_line, i32 *indent_marks, Indent_Options opts){
|
|
|
|
if (buffer != 0){
|
|
|
|
set_line_indents(app, part, buffer->buffer_id, first_line, one_past_last_line, indent_marks, opts);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static Indent_Anchor_Position
|
|
|
|
find_anchor_token(Application_Links *app, Buffer_Summary *buffer, Cpp_Token_Array tokens, i32 line_start, i32 tab_width){
|
|
|
|
Indent_Anchor_Position result = {};
|
|
|
|
if (buffer != 0){
|
|
|
|
result = find_anchor_token(app, buffer->buffer_id, tokens, line_start, tab_width);
|
|
|
|
}
|
|
|
|
return(result);
|
|
|
|
}
|
|
|
|
|
|
|
|
static i32*
|
|
|
|
get_indentation_marks(Application_Links *app, Partition *arena, Buffer_Summary *buffer,
|
|
|
|
Cpp_Token_Array tokens, i32 first_line, i32 one_past_last_line,
|
|
|
|
b32 exact_align, i32 tab_width){
|
|
|
|
return(buffer==0?0:get_indentation_marks(app, arena, buffer->buffer_id, tokens, first_line, one_past_last_line, exact_align, tab_width));
|
|
|
|
}
|
|
|
|
|
|
|
|
static i32
|
|
|
|
buffer_get_line_number(Application_Links *app, Buffer_Summary *buffer, i32 pos){
|
|
|
|
return(buffer==0?0:buffer_get_line_number(app, buffer->buffer_id, pos));
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
get_indent_lines_minimum(Application_Links *app, Buffer_Summary *buffer, i32 start_pos, i32 end_pos, i32 *line_start_out, i32 *line_end_out){
|
|
|
|
if (buffer != 0){
|
|
|
|
get_indent_lines_minimum(app, buffer->buffer_id, start_pos, end_pos, line_start_out, line_end_out);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
get_indent_lines_whole_tokens(Application_Links *app, Buffer_Summary *buffer, Cpp_Token_Array tokens, i32 start_pos, i32 end_pos, i32 *line_start_out, i32 *line_end_out){
|
|
|
|
if (buffer != 0){
|
|
|
|
get_indent_lines_whole_tokens(app, buffer->buffer_id, tokens, start_pos, end_pos, line_start_out, line_end_out);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static b32
|
|
|
|
buffer_auto_indent(Application_Links *app, Partition *part, Buffer_Summary *buffer, i32 start, i32 end, i32 tab_width, Auto_Indent_Flag flags){
|
|
|
|
return(buffer==0?0:buffer_auto_indent(app, part, buffer->buffer_id, start, end, tab_width, flags));
|
|
|
|
}
|
|
|
|
|
|
|
|
static b32
|
|
|
|
buffer_auto_indent(Application_Links *app, Buffer_Summary *buffer, i32 start, i32 end, i32 tab_width, Auto_Indent_Flag flags){
|
|
|
|
return(buffer==0?0:buffer_auto_indent(app, buffer->buffer_id, start, end, tab_width, flags));
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
print_positions_buffered(Application_Links *app, Buffer_Summary *buffer, Function_Positions *positions_array, i32 positions_count, Buffered_Write_Stream *stream){
|
|
|
|
if (buffer != 0){
|
|
|
|
print_positions_buffered(app, buffer->buffer_id, positions_array, positions_count, stream);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static Get_Positions_Results
|
|
|
|
get_function_positions(Application_Links *app, Buffer_Summary *buffer, i32 first_token_index, Function_Positions *positions_array, i32 positions_max){
|
|
|
|
Get_Positions_Results result = {};
|
|
|
|
if (buffer != 0){
|
|
|
|
result = get_function_positions(app, buffer->buffer_id, first_token_index, positions_array, positions_max);
|
|
|
|
}
|
|
|
|
return(result);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
list_all_functions(Application_Links *app, Partition *part, Buffer_Summary *optional_target_buffer){
|
|
|
|
if (optional_target_buffer != 0){
|
|
|
|
list_all_functions(app, part, optional_target_buffer->buffer_id);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static i32
|
|
|
|
get_start_of_line_at_cursor(Application_Links *app, View_Summary *view, Buffer_Summary *buffer){
|
2019-04-06 21:13:49 +00:00
|
|
|
return(get_start_of_line_at_cursor(app, view==0?0:view->view_id, buffer==0?0:buffer->buffer_id));
|
2019-04-04 08:25:16 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static b32
|
|
|
|
c_line_comment_starts_at_position(Application_Links *app, Buffer_Summary *buffer, i32 pos){
|
|
|
|
return(buffer==0?0:c_line_comment_starts_at_position(app, buffer->buffer_id, pos));
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
write_string(Application_Links *app, View_Summary *view, Buffer_Summary *buffer, String string){
|
2019-04-06 21:13:49 +00:00
|
|
|
write_string(app, view==0?0:view->view_id, buffer==0?0:buffer->buffer_id, string);
|
2019-04-04 08:25:16 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static b32
|
|
|
|
open_file(Application_Links *app, Buffer_Summary *buffer_out, char *filename, i32 filename_len, b32 background, b32 never_new){
|
|
|
|
b32 result = false;
|
|
|
|
Buffer_ID id_out = 0;
|
|
|
|
result = open_file(app, &id_out, filename, filename_len, background, never_new);
|
|
|
|
if (result && buffer_out != 0){
|
|
|
|
get_buffer_summary(app, id_out, AccessAll, buffer_out);
|
|
|
|
}
|
|
|
|
return(result);
|
|
|
|
}
|
|
|
|
|
|
|
|
static b32
|
|
|
|
get_cpp_matching_file(Application_Links *app, Buffer_Summary buffer, Buffer_Summary *buffer_out){
|
|
|
|
b32 result = false;
|
|
|
|
if (buffer.exists){
|
|
|
|
Buffer_ID id_out = 0;
|
|
|
|
result = get_cpp_matching_file(app, buffer.buffer_id, &id_out);
|
|
|
|
if (result && buffer_out != 0){
|
|
|
|
get_buffer_summary(app, id_out, AccessAll, buffer_out);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return(result);
|
|
|
|
}
|
|
|
|
|
|
|
|
static b32
|
|
|
|
get_jump_buffer(Application_Links *app, Buffer_Summary *buffer, Name_Line_Column_Location *location){
|
|
|
|
Buffer_ID id = 0;
|
|
|
|
b32 result = get_jump_buffer(app, &id, location);
|
|
|
|
if (result){
|
|
|
|
get_buffer_summary(app, id, AccessAll, buffer);
|
|
|
|
}
|
|
|
|
return(result);
|
|
|
|
}
|
|
|
|
|
|
|
|
static b32
|
|
|
|
get_jump_buffer(Application_Links *app, Buffer_Summary *buffer, ID_Pos_Jump_Location *location, Access_Flag access){
|
|
|
|
Buffer_ID id = 0;
|
|
|
|
b32 result = get_jump_buffer(app, &id, location, access);
|
|
|
|
if (result){
|
|
|
|
get_buffer_summary(app, id, AccessAll, buffer);
|
|
|
|
}
|
|
|
|
return(result);
|
|
|
|
}
|
|
|
|
|
|
|
|
static b32
|
|
|
|
get_jump_buffer(Application_Links *app, Buffer_Summary *buffer, ID_Pos_Jump_Location *location){
|
|
|
|
Buffer_ID id = 0;
|
|
|
|
b32 result = get_jump_buffer(app, &id, location);
|
|
|
|
if (result){
|
|
|
|
get_buffer_summary(app, id, AccessAll, buffer);
|
|
|
|
}
|
|
|
|
return(result);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
switch_to_existing_view(Application_Links *app, View_Summary *view, Buffer_Summary *buffer){
|
2019-04-06 19:40:36 +00:00
|
|
|
View_ID result = switch_to_existing_view(app, view==0?0:view->view_id, buffer==0?0:buffer->buffer_id);
|
|
|
|
if (view != 0 && result != 0){
|
|
|
|
get_view_summary(app, result, AccessAll, view);
|
2019-04-04 08:25:16 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
set_view_to_location(Application_Links *app, View_Summary *view, Buffer_Summary *buffer, Buffer_Seek seek){
|
2019-04-06 19:40:36 +00:00
|
|
|
set_view_to_location(app, view==0?0:view->view_id, buffer==0?0:buffer->buffer_id, seek);
|
2019-04-04 08:25:16 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2019-04-06 19:40:36 +00:00
|
|
|
jump_to_location(Application_Links *app, View_Summary *view, Buffer_ID buffer, Name_Line_Column_Location location){
|
|
|
|
jump_to_location(app, view==0?0:view->view_id, buffer, location);
|
2019-04-04 08:25:16 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2019-04-06 19:40:36 +00:00
|
|
|
jump_to_location(Application_Links *app, View_Summary *view, Buffer_ID buffer, ID_Pos_Jump_Location location){
|
|
|
|
jump_to_location(app, view==0?0:view->view_id, buffer, location);
|
2019-04-04 08:25:16 +00:00
|
|
|
}
|
|
|
|
|
2019-04-05 02:03:36 +00:00
|
|
|
static Buffer_Summary
|
|
|
|
buffer_identifier_to_buffer_summary(Application_Links *app, Buffer_Identifier identifier, Access_Flag access){
|
|
|
|
Buffer_Summary buffer = {};
|
|
|
|
if (identifier.id != 0){
|
|
|
|
buffer = get_buffer(app, identifier.id, access);
|
|
|
|
}
|
|
|
|
else{
|
|
|
|
buffer = get_buffer_by_name(app, identifier.name, identifier.name_len, access);
|
|
|
|
if (!buffer.exists){
|
|
|
|
buffer = get_buffer_by_file_name(app, identifier.name, identifier.name_len, access);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return(buffer);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
refresh_buffer(Application_Links *app, Buffer_Summary *buffer){
|
|
|
|
get_buffer_summary(app, buffer->buffer_id, AccessAll, buffer);
|
|
|
|
}
|
|
|
|
|
|
|
|
static Sticky_Jump_Array
|
|
|
|
parse_buffer_to_jump_array(Application_Links *app, Partition *arena, Buffer_Summary buffer){
|
|
|
|
return(parse_buffer_to_jump_array(app, arena, buffer.buffer_id));
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
lock_jump_buffer(Buffer_Summary buffer){
|
|
|
|
lock_jump_buffer(buffer.buffer_name, buffer.buffer_name_len);
|
|
|
|
}
|
|
|
|
|
|
|
|
static Face_Description
|
|
|
|
get_buffer_face_description(Application_Links *app, Buffer_Summary *buffer){
|
|
|
|
Face_Description result = {};
|
|
|
|
if (buffer != 0){
|
|
|
|
result = get_buffer_face_description(app, buffer->buffer_id);
|
|
|
|
}
|
|
|
|
return(result);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
set_buffer_face_by_name(Application_Links *app, Buffer_Summary *buffer, char *name, i32 len){
|
|
|
|
if (buffer != 0){
|
|
|
|
set_buffer_face_by_name(app, buffer->buffer_id, name, len);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static i32
|
|
|
|
get_build_directory(Application_Links *app, Buffer_Summary *buffer, String *dir_out){
|
|
|
|
return(get_build_directory(app, buffer==0?0:buffer->buffer_id, dir_out));
|
|
|
|
}
|
|
|
|
|
2019-04-06 19:40:36 +00:00
|
|
|
static i32
|
|
|
|
standard_build_search(Application_Links *app, View_Summary *view, String *dir, String *command, b32 perform_backup, b32 use_path_in_command, String filename, String command_name){
|
|
|
|
return(standard_build_search(app, view==0?0:view->view_id, dir, command, perform_backup, use_path_in_command, filename, command_name));
|
|
|
|
}
|
|
|
|
|
|
|
|
static i32
|
|
|
|
execute_standard_build_search(Application_Links *app, View_Summary *view, String *dir, String *command, i32 perform_backup){
|
|
|
|
return(execute_standard_build_search(app, view==0?0:view->view_id, dir, command, perform_backup));
|
|
|
|
}
|
|
|
|
|
2019-04-05 02:03:36 +00:00
|
|
|
static void
|
2019-04-06 19:40:36 +00:00
|
|
|
execute_standard_build(Application_Links *app, View_Summary *view, Buffer_ID active_buffer){
|
|
|
|
execute_standard_build(app, view==0?0:view->view_id, active_buffer);
|
2019-04-05 02:03:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static b32
|
|
|
|
post_buffer_range_to_clipboard(Application_Links *app, Partition *scratch, i32 clipboard_index, Buffer_Summary *buffer, i32 first, i32 one_past_last){
|
|
|
|
return(post_buffer_range_to_clipboard(app, scratch, clipboard_index, buffer==0?0:buffer->buffer_id, first, one_past_last));
|
|
|
|
}
|
|
|
|
|
2019-04-06 19:40:36 +00:00
|
|
|
static void
|
|
|
|
view_set_vertical_focus(Application_Links *app, View_Summary *view, i32 y_top, i32 y_bot){
|
|
|
|
view_set_vertical_focus(app, view==0?0:view->view_id, y_top, y_bot);
|
|
|
|
}
|
|
|
|
|
|
|
|
static b32
|
|
|
|
advance_cursor_in_jump_view(Application_Links *app, Partition *part, View_Summary *view, i32 skip_repeats, i32 skip_sub_error, i32 direction, Name_Line_Column_Location *location_out){
|
|
|
|
return(advance_cursor_in_jump_view(app, part, view==0?0:view->view_id, skip_repeats, skip_sub_error, direction, location_out));
|
|
|
|
}
|
|
|
|
|
|
|
|
static Parsed_Jump
|
|
|
|
seek_next_jump_in_view(Application_Links *app, Partition *part, View_Summary *view, i32 skip_sub_errors, i32 direction, i32 *line_out){
|
|
|
|
return(seek_next_jump_in_view(app, part, view==0?0:view->view_id, skip_sub_errors, direction, line_out));
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
goto_next_filtered_jump(Application_Links *app, Marker_List *list, View_Summary *jump_view, i32 list_index, i32 direction, b32 skip_repeats, b32 skip_sub_errors){
|
|
|
|
goto_next_filtered_jump(app, list, jump_view==0?0:jump_view->view_id, list_index, direction, skip_repeats, skip_sub_errors);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
goto_jump_in_order(Application_Links *app, Marker_List *list, View_Summary *jump_view, ID_Pos_Jump_Location location){
|
|
|
|
goto_jump_in_order(app, list, jump_view==0?0:jump_view->view_id, location);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
open_jump_lister(Application_Links *app, Partition *scratch, Heap *heap, View_Summary *ui_view, Buffer_ID list_buffer_id, Jump_Lister_Activation_Rule activation_rule, View_Summary *optional_target_view){
|
|
|
|
open_jump_lister(app, scratch, heap, ui_view==0?0:ui_view->view_id, list_buffer_id, activation_rule, optional_target_view==0?0:optional_target_view->view_id);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
activate_project_command(Application_Links *app, Partition *scratch, Heap *heap, View_Summary *view, Lister_State *state, String text_field, void *user_data, b32 activated_by_mouse){
|
|
|
|
activate_project_command(app, scratch, heap, view==0?0:view->view_id, state, text_field, user_data, activated_by_mouse);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
activate_snippet(Application_Links *app, Partition *scratch, Heap *heap, View_Summary *view, struct Lister_State *state, String text_field, void *user_data, b32 activated_by_mouse){
|
|
|
|
activate_snippet(app, scratch, heap, view==0?0:view->view_id, state, text_field, user_data, activated_by_mouse);
|
|
|
|
}
|
|
|
|
|
2019-04-06 21:13:49 +00:00
|
|
|
static void
|
|
|
|
view_set_to_region(Application_Links *app, View_Summary *view, i32 major_pos, i32 minor_pos, f32 normalized_threshold){
|
|
|
|
view_set_to_region(app, view==0?0:view->view_id, major_pos, minor_pos, normalized_threshold);
|
|
|
|
}
|
|
|
|
|
2019-04-06 23:36:53 +00:00
|
|
|
static i32
|
|
|
|
character_pos_to_pos(Application_Links *app, View_Summary *view, i32 character_pos){
|
|
|
|
return(character_pos_to_pos(app, view==0?0:view->view_id, character_pos));
|
|
|
|
}
|
|
|
|
|
|
|
|
static b32
|
|
|
|
view_open_file(Application_Links *app, View_Summary *view, char *filename, i32 filename_len, b32 never_new){
|
|
|
|
return(view_open_file(app, view==0?0:view->view_id, filename, filename_len, never_new));
|
|
|
|
}
|
|
|
|
|
|
|
|
static f32
|
|
|
|
get_page_jump(Application_Links *app, View_Summary *view){
|
|
|
|
return(get_page_jump(app, view==0?0:view->view_id));
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
isearch__update_highlight(Application_Links *app, View_Summary *view, Managed_Object highlight, i32 start, i32 end){
|
|
|
|
isearch__update_highlight(app, view==0?0:view->view_id, highlight, start, end);
|
|
|
|
}
|
|
|
|
|
2019-04-01 02:41:39 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
// BOTTOM
|
|
|
|
|