Name change
parent
617804e54d
commit
0c7961fbf0
|
@ -679,8 +679,7 @@ STRUCT View_Summary{
|
|||
GUI_Scroll_Vars scroll_vars;
|
||||
};
|
||||
|
||||
/* DOC(Query_Bar is a struct used to store information in the user's control
|
||||
that will be displayed as a drop down bar durring an interactive command.) */
|
||||
/* DOC(Query_Bar is a struct used to store information in the user's control that will be displayed as a drop down bar durring an interactive command.) */
|
||||
STRUCT Query_Bar{
|
||||
/* DOC(This specifies the prompt portion of the drop down bar.) */
|
||||
String prompt;
|
||||
|
@ -688,12 +687,12 @@ STRUCT Query_Bar{
|
|||
String string;
|
||||
};
|
||||
|
||||
TYPEDEF uint64_t Managed_Group;
|
||||
TYPEDEF int32_t Managed_Variable_ID;
|
||||
TYPEDEF uint64_t Managed_Scope;
|
||||
TYPEDEF uint64_t Managed_Object;
|
||||
|
||||
static Managed_Group ManagedGroup_NULL = 0;
|
||||
static Managed_Variable_ID ManagedVariableIndex_ERROR = -1;
|
||||
static Managed_Scope ManagedScope_NULL = 0;
|
||||
static Managed_Object ManagedObject_NULL = 0;
|
||||
|
||||
ENUM(int16_t, UI_Item_Type){
|
||||
|
@ -703,15 +702,15 @@ ENUM(int16_t, UI_Item_Type){
|
|||
};
|
||||
|
||||
ENUM(int8_t, UI_Activation_Level){
|
||||
UIActivation_None,
|
||||
UIActivation_Hover,
|
||||
UIActivation_Active,
|
||||
UIActivation_None = 0,
|
||||
UIActivation_Hover = 1,
|
||||
UIActivation_Active = 2,
|
||||
};
|
||||
|
||||
ENUM(int8_t, UI_Coordinate_System){
|
||||
UICoordinates_Scrolled,
|
||||
UICoordinates_ViewRelative,
|
||||
UICoordinates_COUNT,
|
||||
UICoordinates_Scrolled = 0,
|
||||
UICoordinates_ViewRelative = 1,
|
||||
UICoordinates_COUNT = 2,
|
||||
};
|
||||
|
||||
STRUCT UI_Item{
|
||||
|
|
|
@ -50,10 +50,10 @@ CUSTOM_DOC("At the cursor, insert the text at the top of the clipboard.")
|
|||
int32_t count = clipboard_count(app, 0);
|
||||
if (count > 0){
|
||||
View_Summary view = get_active_view(app, access);
|
||||
Managed_Scope scope = view_get_managed_scope(app, view.view_id);
|
||||
managed_variable_set(app, scope, view_next_rewrite_loc, RewritePaste);
|
||||
Managed_Group group = view_get_managed_group(app, view.view_id);
|
||||
managed_variable_set(app, group, view_next_rewrite_loc, RewritePaste);
|
||||
int32_t paste_index = 0;
|
||||
managed_variable_set(app, scope, view_paste_index_loc, paste_index);
|
||||
managed_variable_set(app, group, view_paste_index_loc, paste_index);
|
||||
|
||||
int32_t len = clipboard_index(app, 0, paste_index, 0, 0);
|
||||
char *str = 0;
|
||||
|
@ -87,16 +87,16 @@ CUSTOM_DOC("If the previous command was paste or paste_next, replaces the paste
|
|||
int32_t count = clipboard_count(app, 0);
|
||||
if (count > 0){
|
||||
View_Summary view = get_active_view(app, access);
|
||||
Managed_Scope scope = view_get_managed_scope(app, view.view_id);
|
||||
Managed_Group group = view_get_managed_group(app, view.view_id);
|
||||
|
||||
uint64_t rewrite = 0;
|
||||
managed_variable_get(app, scope, view_rewrite_loc, &rewrite);
|
||||
managed_variable_get(app, group, view_rewrite_loc, &rewrite);
|
||||
if (rewrite == RewritePaste){
|
||||
managed_variable_set(app, scope, view_next_rewrite_loc, RewritePaste);
|
||||
managed_variable_set(app, group, view_next_rewrite_loc, RewritePaste);
|
||||
uint64_t prev_paste_index = 0;
|
||||
managed_variable_get(app, scope, view_paste_index_loc, &prev_paste_index);
|
||||
managed_variable_get(app, group, view_paste_index_loc, &prev_paste_index);
|
||||
int32_t paste_index = (int32_t)prev_paste_index + 1;
|
||||
managed_variable_set(app, scope, view_paste_index_loc, paste_index);
|
||||
managed_variable_set(app, group, view_paste_index_loc, paste_index);
|
||||
|
||||
int32_t len = clipboard_index(app, 0, paste_index, 0, 0);
|
||||
char *str = 0;
|
||||
|
|
|
@ -26,18 +26,18 @@ write_named_comment_string(Application_Links *app, char *type_string){
|
|||
|
||||
String name = global_config.user_name;
|
||||
if (name.size > 0){
|
||||
append(&str, "// ");
|
||||
append(&str, type_string);
|
||||
append(&str, "(");
|
||||
append(&str, name);
|
||||
append(&str, "): ");
|
||||
}
|
||||
append(&str, "// ");
|
||||
append(&str, type_string);
|
||||
append(&str, "(");
|
||||
append(&str, name);
|
||||
append(&str, "): ");
|
||||
}
|
||||
else{
|
||||
append(&str, "// ");
|
||||
append(&str, type_string);
|
||||
append(&str, ": ");
|
||||
}
|
||||
|
||||
|
||||
write_string(app, str);
|
||||
}
|
||||
|
||||
|
|
|
@ -56,15 +56,15 @@ new_view_settings(Application_Links *app, View_Summary *view){
|
|||
|
||||
static void
|
||||
view_set_passive(Application_Links *app, View_Summary *view, bool32 value){
|
||||
Managed_Scope scope = view_get_managed_scope(app, view->view_id);
|
||||
managed_variable_set(app, scope, view_is_passive_loc, (uint64_t)value);
|
||||
Managed_Group group = view_get_managed_group(app, view->view_id);
|
||||
managed_variable_set(app, group, view_is_passive_loc, (uint64_t)value);
|
||||
}
|
||||
|
||||
static bool32
|
||||
view_get_is_passive(Application_Links *app, View_Summary *view){
|
||||
Managed_Scope scope = view_get_managed_scope(app, view->view_id);
|
||||
Managed_Group group = view_get_managed_group(app, view->view_id);
|
||||
uint64_t is_passive = 0;
|
||||
managed_variable_get(app, scope, view_is_passive_loc, &is_passive);
|
||||
managed_variable_get(app, group, view_is_passive_loc, &is_passive);
|
||||
return(is_passive != 0);
|
||||
}
|
||||
|
||||
|
|
|
@ -42,12 +42,12 @@ START_HOOK_SIG(default_start){
|
|||
// also relies on this particular command caller hook.
|
||||
COMMAND_CALLER_HOOK(default_command_caller){
|
||||
View_Summary view = get_active_view(app, AccessAll);
|
||||
Managed_Scope scope = view_get_managed_scope(app, view.view_id);
|
||||
managed_variable_set(app, scope, view_next_rewrite_loc, 0);
|
||||
Managed_Group group = view_get_managed_group(app, view.view_id);
|
||||
managed_variable_set(app, group, view_next_rewrite_loc, 0);
|
||||
exec_command(app, cmd);
|
||||
uint64_t next_rewrite = 0;
|
||||
managed_variable_get(app, scope, view_next_rewrite_loc, &next_rewrite);
|
||||
managed_variable_set(app, scope, view_rewrite_loc, next_rewrite);
|
||||
managed_variable_get(app, group, view_next_rewrite_loc, &next_rewrite);
|
||||
managed_variable_set(app, group, view_rewrite_loc, next_rewrite);
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@ struct Application_Links;
|
|||
#define BUFFER_BATCH_EDIT_SIG(n) bool32 n(Application_Links *app, Buffer_Summary *buffer, char *str, int32_t str_len, Buffer_Edit *edits, int32_t edit_count, Buffer_Batch_Edit_Type type)
|
||||
#define BUFFER_GET_SETTING_SIG(n) bool32 n(Application_Links *app, Buffer_Summary *buffer, Buffer_Setting_ID setting, int32_t *value_out)
|
||||
#define BUFFER_SET_SETTING_SIG(n) bool32 n(Application_Links *app, Buffer_Summary *buffer, Buffer_Setting_ID setting, int32_t value)
|
||||
#define BUFFER_GET_MANAGED_SCOPE_SIG(n) Managed_Scope n(Application_Links *app, Buffer_ID buffer_id)
|
||||
#define BUFFER_GET_MANAGED_GROUP_SIG(n) Managed_Group n(Application_Links *app, Buffer_ID buffer_id)
|
||||
#define BUFFER_TOKEN_COUNT_SIG(n) int32_t n(Application_Links *app, Buffer_Summary *buffer)
|
||||
#define BUFFER_READ_TOKENS_SIG(n) bool32 n(Application_Links *app, Buffer_Summary *buffer, int32_t start_token, int32_t end_token, Cpp_Token *tokens_out)
|
||||
#define BUFFER_GET_TOKEN_INDEX_SIG(n) bool32 n(Application_Links *app, Buffer_Summary *buffer, int32_t pos, Cpp_Get_Token_Result *get_result)
|
||||
|
@ -36,7 +36,7 @@ struct Application_Links;
|
|||
#define SET_ACTIVE_VIEW_SIG(n) bool32 n(Application_Links *app, View_Summary *view)
|
||||
#define VIEW_GET_SETTING_SIG(n) bool32 n(Application_Links *app, View_Summary *view, View_Setting_ID setting, int32_t *value_out)
|
||||
#define VIEW_SET_SETTING_SIG(n) bool32 n(Application_Links *app, View_Summary *view, View_Setting_ID setting, int32_t value)
|
||||
#define VIEW_GET_MANAGED_SCOPE_SIG(n) Managed_Scope n(Application_Links *app, View_ID view_id)
|
||||
#define VIEW_GET_MANAGED_GROUP_SIG(n) Managed_Group n(Application_Links *app, View_ID view_id)
|
||||
#define VIEW_SET_SPLIT_PROPORTION_SIG(n) bool32 n(Application_Links *app, View_Summary *view, float t)
|
||||
#define VIEW_COMPUTE_CURSOR_SIG(n) bool32 n(Application_Links *app, View_Summary *view, Buffer_Seek seek, Full_Cursor *cursor_out)
|
||||
#define VIEW_SET_CURSOR_SIG(n) bool32 n(Application_Links *app, View_Summary *view, Buffer_Seek seek, bool32 set_preferred_x)
|
||||
|
@ -49,15 +49,15 @@ struct Application_Links;
|
|||
#define VIEW_END_UI_MODE_SIG(n) int32_t n(Application_Links *app, View_Summary *view)
|
||||
#define VIEW_SET_UI_SIG(n) bool32 n(Application_Links *app, View_Summary *view, UI_Control *control)
|
||||
#define VIEW_GET_UI_COPY_SIG(n) UI_Control n(Application_Links *app, View_Summary *view, struct Partition *part)
|
||||
#define GET_GLOBAL_MANAGED_SCOPE_SIG(n) Managed_Scope n(Application_Links *app)
|
||||
#define GET_INTERSECTED_MANAGED_SCOPE_SIG(n) Managed_Scope n(Application_Links *app, Managed_Scope *intersected_scopes, int32_t count)
|
||||
#define GET_GLOBAL_MANAGED_GROUP_SIG(n) Managed_Group n(Application_Links *app)
|
||||
#define GET_INTERSECTED_MANAGED_GROUP_SIG(n) Managed_Group n(Application_Links *app, Managed_Group *intersected_groups, int32_t count)
|
||||
#define MANAGED_VARIABLE_CREATE_SIG(n) Managed_Variable_ID n(Application_Links *app, char *null_terminated_name, uint64_t default_value)
|
||||
#define MANAGED_VARIABLE_GET_ID_SIG(n) Managed_Variable_ID n(Application_Links *app, char *null_terminated_name)
|
||||
#define MANAGED_VARIABLE_CREATE_OR_GET_ID_SIG(n) int32_t n(Application_Links *app, char *null_terminated_name, uint64_t default_value)
|
||||
#define MANAGED_VARIABLE_SET_SIG(n) bool32 n(Application_Links *app, Managed_Scope scope, Managed_Variable_ID location, uint64_t value)
|
||||
#define MANAGED_VARIABLE_GET_SIG(n) bool32 n(Application_Links *app, Managed_Scope scope, Managed_Variable_ID location, uint64_t *value_out)
|
||||
#define MANAGED_MEMORY_ALLOC_SIG(n) Managed_Object n(Application_Links *app, Managed_Scope scope, int32_t size)
|
||||
#define BUFFER_MARKERS_ALLOC_SIG(n) Managed_Object n(Application_Links *app, Buffer_ID buffer_id, int32_t count, Managed_Scope *scope)
|
||||
#define MANAGED_VARIABLE_CREATE_OR_GET_ID_SIG(n) Managed_Variable_ID n(Application_Links *app, char *null_terminated_name, uint64_t default_value)
|
||||
#define MANAGED_VARIABLE_SET_SIG(n) bool32 n(Application_Links *app, Managed_Group group, Managed_Variable_ID location, uint64_t value)
|
||||
#define MANAGED_VARIABLE_GET_SIG(n) bool32 n(Application_Links *app, Managed_Group group, Managed_Variable_ID location, uint64_t *value_out)
|
||||
#define MANAGED_MEMORY_ALLOC_SIG(n) Managed_Object n(Application_Links *app, Managed_Group group, int32_t size)
|
||||
#define BUFFER_MARKERS_ALLOC_SIG(n) Managed_Object n(Application_Links *app, Buffer_ID buffer_id, int32_t count, Managed_Group *group)
|
||||
#define MANAGED_OBJECT_FREE_SIG(n) bool32 n(Application_Links *app, Managed_Object object)
|
||||
#define MANAGED_OBJECT_WRITE_SIG(n) bool32 n(Application_Links *app, Managed_Object object, uint32_t start, uint32_t size, void *mem)
|
||||
#define MANAGED_OBJECT_READ_SIG(n) bool32 n(Application_Links *app, Managed_Object object, uint32_t start, uint32_t size, void *mem_out)
|
||||
|
@ -120,7 +120,7 @@ typedef BUFFER_COMPUTE_CURSOR_SIG(Buffer_Compute_Cursor_Function);
|
|||
typedef BUFFER_BATCH_EDIT_SIG(Buffer_Batch_Edit_Function);
|
||||
typedef BUFFER_GET_SETTING_SIG(Buffer_Get_Setting_Function);
|
||||
typedef BUFFER_SET_SETTING_SIG(Buffer_Set_Setting_Function);
|
||||
typedef BUFFER_GET_MANAGED_SCOPE_SIG(Buffer_Get_Managed_Scope_Function);
|
||||
typedef BUFFER_GET_MANAGED_GROUP_SIG(Buffer_Get_Managed_Group_Function);
|
||||
typedef BUFFER_TOKEN_COUNT_SIG(Buffer_Token_Count_Function);
|
||||
typedef BUFFER_READ_TOKENS_SIG(Buffer_Read_Tokens_Function);
|
||||
typedef BUFFER_GET_TOKEN_INDEX_SIG(Buffer_Get_Token_Index_Function);
|
||||
|
@ -137,7 +137,7 @@ typedef CLOSE_VIEW_SIG(Close_View_Function);
|
|||
typedef SET_ACTIVE_VIEW_SIG(Set_Active_View_Function);
|
||||
typedef VIEW_GET_SETTING_SIG(View_Get_Setting_Function);
|
||||
typedef VIEW_SET_SETTING_SIG(View_Set_Setting_Function);
|
||||
typedef VIEW_GET_MANAGED_SCOPE_SIG(View_Get_Managed_Scope_Function);
|
||||
typedef VIEW_GET_MANAGED_GROUP_SIG(View_Get_Managed_Group_Function);
|
||||
typedef VIEW_SET_SPLIT_PROPORTION_SIG(View_Set_Split_Proportion_Function);
|
||||
typedef VIEW_COMPUTE_CURSOR_SIG(View_Compute_Cursor_Function);
|
||||
typedef VIEW_SET_CURSOR_SIG(View_Set_Cursor_Function);
|
||||
|
@ -150,8 +150,8 @@ typedef VIEW_START_UI_MODE_SIG(View_Start_UI_Mode_Function);
|
|||
typedef VIEW_END_UI_MODE_SIG(View_End_UI_Mode_Function);
|
||||
typedef VIEW_SET_UI_SIG(View_Set_UI_Function);
|
||||
typedef VIEW_GET_UI_COPY_SIG(View_Get_UI_Copy_Function);
|
||||
typedef GET_GLOBAL_MANAGED_SCOPE_SIG(Get_Global_Managed_Scope_Function);
|
||||
typedef GET_INTERSECTED_MANAGED_SCOPE_SIG(Get_Intersected_Managed_Scope_Function);
|
||||
typedef GET_GLOBAL_MANAGED_GROUP_SIG(Get_Global_Managed_Group_Function);
|
||||
typedef GET_INTERSECTED_MANAGED_GROUP_SIG(Get_Intersected_Managed_Group_Function);
|
||||
typedef MANAGED_VARIABLE_CREATE_SIG(Managed_Variable_Create_Function);
|
||||
typedef MANAGED_VARIABLE_GET_ID_SIG(Managed_Variable_Get_ID_Function);
|
||||
typedef MANAGED_VARIABLE_CREATE_OR_GET_ID_SIG(Managed_Variable_Create_Or_Get_ID_Function);
|
||||
|
@ -223,7 +223,7 @@ Buffer_Compute_Cursor_Function *buffer_compute_cursor;
|
|||
Buffer_Batch_Edit_Function *buffer_batch_edit;
|
||||
Buffer_Get_Setting_Function *buffer_get_setting;
|
||||
Buffer_Set_Setting_Function *buffer_set_setting;
|
||||
Buffer_Get_Managed_Scope_Function *buffer_get_managed_scope;
|
||||
Buffer_Get_Managed_Group_Function *buffer_get_managed_group;
|
||||
Buffer_Token_Count_Function *buffer_token_count;
|
||||
Buffer_Read_Tokens_Function *buffer_read_tokens;
|
||||
Buffer_Get_Token_Index_Function *buffer_get_token_index;
|
||||
|
@ -240,7 +240,7 @@ Close_View_Function *close_view;
|
|||
Set_Active_View_Function *set_active_view;
|
||||
View_Get_Setting_Function *view_get_setting;
|
||||
View_Set_Setting_Function *view_set_setting;
|
||||
View_Get_Managed_Scope_Function *view_get_managed_scope;
|
||||
View_Get_Managed_Group_Function *view_get_managed_group;
|
||||
View_Set_Split_Proportion_Function *view_set_split_proportion;
|
||||
View_Compute_Cursor_Function *view_compute_cursor;
|
||||
View_Set_Cursor_Function *view_set_cursor;
|
||||
|
@ -253,8 +253,8 @@ View_Start_UI_Mode_Function *view_start_ui_mode;
|
|||
View_End_UI_Mode_Function *view_end_ui_mode;
|
||||
View_Set_UI_Function *view_set_ui;
|
||||
View_Get_UI_Copy_Function *view_get_ui_copy;
|
||||
Get_Global_Managed_Scope_Function *get_global_managed_scope;
|
||||
Get_Intersected_Managed_Scope_Function *get_intersected_managed_scope;
|
||||
Get_Global_Managed_Group_Function *get_global_managed_group;
|
||||
Get_Intersected_Managed_Group_Function *get_intersected_managed_group;
|
||||
Managed_Variable_Create_Function *managed_variable_create;
|
||||
Managed_Variable_Get_ID_Function *managed_variable_get_id;
|
||||
Managed_Variable_Create_Or_Get_ID_Function *managed_variable_create_or_get_id;
|
||||
|
@ -325,7 +325,7 @@ Buffer_Compute_Cursor_Function *buffer_compute_cursor_;
|
|||
Buffer_Batch_Edit_Function *buffer_batch_edit_;
|
||||
Buffer_Get_Setting_Function *buffer_get_setting_;
|
||||
Buffer_Set_Setting_Function *buffer_set_setting_;
|
||||
Buffer_Get_Managed_Scope_Function *buffer_get_managed_scope_;
|
||||
Buffer_Get_Managed_Group_Function *buffer_get_managed_group_;
|
||||
Buffer_Token_Count_Function *buffer_token_count_;
|
||||
Buffer_Read_Tokens_Function *buffer_read_tokens_;
|
||||
Buffer_Get_Token_Index_Function *buffer_get_token_index_;
|
||||
|
@ -342,7 +342,7 @@ Close_View_Function *close_view_;
|
|||
Set_Active_View_Function *set_active_view_;
|
||||
View_Get_Setting_Function *view_get_setting_;
|
||||
View_Set_Setting_Function *view_set_setting_;
|
||||
View_Get_Managed_Scope_Function *view_get_managed_scope_;
|
||||
View_Get_Managed_Group_Function *view_get_managed_group_;
|
||||
View_Set_Split_Proportion_Function *view_set_split_proportion_;
|
||||
View_Compute_Cursor_Function *view_compute_cursor_;
|
||||
View_Set_Cursor_Function *view_set_cursor_;
|
||||
|
@ -355,8 +355,8 @@ View_Start_UI_Mode_Function *view_start_ui_mode_;
|
|||
View_End_UI_Mode_Function *view_end_ui_mode_;
|
||||
View_Set_UI_Function *view_set_ui_;
|
||||
View_Get_UI_Copy_Function *view_get_ui_copy_;
|
||||
Get_Global_Managed_Scope_Function *get_global_managed_scope_;
|
||||
Get_Intersected_Managed_Scope_Function *get_intersected_managed_scope_;
|
||||
Get_Global_Managed_Group_Function *get_global_managed_group_;
|
||||
Get_Intersected_Managed_Group_Function *get_intersected_managed_group_;
|
||||
Managed_Variable_Create_Function *managed_variable_create_;
|
||||
Managed_Variable_Get_ID_Function *managed_variable_get_id_;
|
||||
Managed_Variable_Create_Or_Get_ID_Function *managed_variable_create_or_get_id_;
|
||||
|
@ -435,7 +435,7 @@ app_links->buffer_compute_cursor_ = Buffer_Compute_Cursor;\
|
|||
app_links->buffer_batch_edit_ = Buffer_Batch_Edit;\
|
||||
app_links->buffer_get_setting_ = Buffer_Get_Setting;\
|
||||
app_links->buffer_set_setting_ = Buffer_Set_Setting;\
|
||||
app_links->buffer_get_managed_scope_ = Buffer_Get_Managed_Scope;\
|
||||
app_links->buffer_get_managed_group_ = Buffer_Get_Managed_Group;\
|
||||
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;\
|
||||
|
@ -452,7 +452,7 @@ app_links->close_view_ = Close_View;\
|
|||
app_links->set_active_view_ = Set_Active_View;\
|
||||
app_links->view_get_setting_ = View_Get_Setting;\
|
||||
app_links->view_set_setting_ = View_Set_Setting;\
|
||||
app_links->view_get_managed_scope_ = View_Get_Managed_Scope;\
|
||||
app_links->view_get_managed_group_ = View_Get_Managed_Group;\
|
||||
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;\
|
||||
|
@ -465,8 +465,8 @@ app_links->view_start_ui_mode_ = View_Start_UI_Mode;\
|
|||
app_links->view_end_ui_mode_ = View_End_UI_Mode;\
|
||||
app_links->view_set_ui_ = View_Set_UI;\
|
||||
app_links->view_get_ui_copy_ = View_Get_UI_Copy;\
|
||||
app_links->get_global_managed_scope_ = Get_Global_Managed_Scope;\
|
||||
app_links->get_intersected_managed_scope_ = Get_Intersected_Managed_Scope;\
|
||||
app_links->get_global_managed_group_ = Get_Global_Managed_Group;\
|
||||
app_links->get_intersected_managed_group_ = Get_Intersected_Managed_Group;\
|
||||
app_links->managed_variable_create_ = Managed_Variable_Create;\
|
||||
app_links->managed_variable_get_id_ = Managed_Variable_Get_ID;\
|
||||
app_links->managed_variable_create_or_get_id_ = Managed_Variable_Create_Or_Get_ID;\
|
||||
|
@ -537,7 +537,7 @@ static inline bool32 buffer_compute_cursor(Application_Links *app, Buffer_Summar
|
|||
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_get_setting(Application_Links *app, Buffer_Summary *buffer, Buffer_Setting_ID setting, int32_t *value_out){return(app->buffer_get_setting(app, buffer, setting, value_out));}
|
||||
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 Managed_Scope buffer_get_managed_scope(Application_Links *app, Buffer_ID buffer_id){return(app->buffer_get_managed_scope(app, buffer_id));}
|
||||
static inline Managed_Group buffer_get_managed_group(Application_Links *app, Buffer_ID buffer_id){return(app->buffer_get_managed_group(app, buffer_id));}
|
||||
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));}
|
||||
|
@ -554,7 +554,7 @@ static inline bool32 close_view(Application_Links *app, View_Summary *view){retu
|
|||
static inline bool32 set_active_view(Application_Links *app, View_Summary *view){return(app->set_active_view(app, view));}
|
||||
static inline bool32 view_get_setting(Application_Links *app, View_Summary *view, View_Setting_ID setting, int32_t *value_out){return(app->view_get_setting(app, view, setting, value_out));}
|
||||
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 Managed_Scope view_get_managed_scope(Application_Links *app, View_ID view_id){return(app->view_get_managed_scope(app, view_id));}
|
||||
static inline Managed_Group view_get_managed_group(Application_Links *app, View_ID view_id){return(app->view_get_managed_group(app, view_id));}
|
||||
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));}
|
||||
|
@ -567,15 +567,15 @@ static inline int32_t view_start_ui_mode(Application_Links *app, View_Summary *v
|
|||
static inline int32_t view_end_ui_mode(Application_Links *app, View_Summary *view){return(app->view_end_ui_mode(app, view));}
|
||||
static inline bool32 view_set_ui(Application_Links *app, View_Summary *view, UI_Control *control){return(app->view_set_ui(app, view, control));}
|
||||
static inline UI_Control view_get_ui_copy(Application_Links *app, View_Summary *view, struct Partition *part){return(app->view_get_ui_copy(app, view, part));}
|
||||
static inline Managed_Scope get_global_managed_scope(Application_Links *app){return(app->get_global_managed_scope(app));}
|
||||
static inline Managed_Scope get_intersected_managed_scope(Application_Links *app, Managed_Scope *intersected_scopes, int32_t count){return(app->get_intersected_managed_scope(app, intersected_scopes, count));}
|
||||
static inline Managed_Group get_global_managed_group(Application_Links *app){return(app->get_global_managed_group(app));}
|
||||
static inline Managed_Group get_intersected_managed_group(Application_Links *app, Managed_Group *intersected_groups, int32_t count){return(app->get_intersected_managed_group(app, intersected_groups, count));}
|
||||
static inline Managed_Variable_ID managed_variable_create(Application_Links *app, char *null_terminated_name, uint64_t default_value){return(app->managed_variable_create(app, null_terminated_name, default_value));}
|
||||
static inline Managed_Variable_ID managed_variable_get_id(Application_Links *app, char *null_terminated_name){return(app->managed_variable_get_id(app, null_terminated_name));}
|
||||
static inline int32_t managed_variable_create_or_get_id(Application_Links *app, char *null_terminated_name, uint64_t default_value){return(app->managed_variable_create_or_get_id(app, null_terminated_name, default_value));}
|
||||
static inline bool32 managed_variable_set(Application_Links *app, Managed_Scope scope, Managed_Variable_ID location, uint64_t value){return(app->managed_variable_set(app, scope, location, value));}
|
||||
static inline bool32 managed_variable_get(Application_Links *app, Managed_Scope scope, Managed_Variable_ID location, uint64_t *value_out){return(app->managed_variable_get(app, scope, location, value_out));}
|
||||
static inline Managed_Object managed_memory_alloc(Application_Links *app, Managed_Scope scope, int32_t size){return(app->managed_memory_alloc(app, scope, size));}
|
||||
static inline Managed_Object buffer_markers_alloc(Application_Links *app, Buffer_ID buffer_id, int32_t count, Managed_Scope *scope){return(app->buffer_markers_alloc(app, buffer_id, count, scope));}
|
||||
static inline Managed_Variable_ID managed_variable_create_or_get_id(Application_Links *app, char *null_terminated_name, uint64_t default_value){return(app->managed_variable_create_or_get_id(app, null_terminated_name, default_value));}
|
||||
static inline bool32 managed_variable_set(Application_Links *app, Managed_Group group, Managed_Variable_ID location, uint64_t value){return(app->managed_variable_set(app, group, location, value));}
|
||||
static inline bool32 managed_variable_get(Application_Links *app, Managed_Group group, Managed_Variable_ID location, uint64_t *value_out){return(app->managed_variable_get(app, group, location, value_out));}
|
||||
static inline Managed_Object managed_memory_alloc(Application_Links *app, Managed_Group group, int32_t size){return(app->managed_memory_alloc(app, group, size));}
|
||||
static inline Managed_Object buffer_markers_alloc(Application_Links *app, Buffer_ID buffer_id, int32_t count, Managed_Group *group){return(app->buffer_markers_alloc(app, buffer_id, count, group));}
|
||||
static inline bool32 managed_object_free(Application_Links *app, Managed_Object object){return(app->managed_object_free(app, object));}
|
||||
static inline bool32 managed_object_write(Application_Links *app, Managed_Object object, uint32_t start, uint32_t size, void *mem){return(app->managed_object_write(app, object, start, size, mem));}
|
||||
static inline bool32 managed_object_read(Application_Links *app, Managed_Object object, uint32_t start, uint32_t size, void *mem_out){return(app->managed_object_read(app, object, start, size, mem_out));}
|
||||
|
@ -639,7 +639,7 @@ static inline bool32 buffer_compute_cursor(Application_Links *app, Buffer_Summar
|
|||
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_get_setting(Application_Links *app, Buffer_Summary *buffer, Buffer_Setting_ID setting, int32_t *value_out){return(app->buffer_get_setting_(app, buffer, setting, value_out));}
|
||||
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 Managed_Scope buffer_get_managed_scope(Application_Links *app, Buffer_ID buffer_id){return(app->buffer_get_managed_scope_(app, buffer_id));}
|
||||
static inline Managed_Group buffer_get_managed_group(Application_Links *app, Buffer_ID buffer_id){return(app->buffer_get_managed_group_(app, buffer_id));}
|
||||
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));}
|
||||
|
@ -656,7 +656,7 @@ static inline bool32 close_view(Application_Links *app, View_Summary *view){retu
|
|||
static inline bool32 set_active_view(Application_Links *app, View_Summary *view){return(app->set_active_view_(app, view));}
|
||||
static inline bool32 view_get_setting(Application_Links *app, View_Summary *view, View_Setting_ID setting, int32_t *value_out){return(app->view_get_setting_(app, view, setting, value_out));}
|
||||
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 Managed_Scope view_get_managed_scope(Application_Links *app, View_ID view_id){return(app->view_get_managed_scope_(app, view_id));}
|
||||
static inline Managed_Group view_get_managed_group(Application_Links *app, View_ID view_id){return(app->view_get_managed_group_(app, view_id));}
|
||||
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));}
|
||||
|
@ -669,15 +669,15 @@ static inline int32_t view_start_ui_mode(Application_Links *app, View_Summary *v
|
|||
static inline int32_t view_end_ui_mode(Application_Links *app, View_Summary *view){return(app->view_end_ui_mode_(app, view));}
|
||||
static inline bool32 view_set_ui(Application_Links *app, View_Summary *view, UI_Control *control){return(app->view_set_ui_(app, view, control));}
|
||||
static inline UI_Control view_get_ui_copy(Application_Links *app, View_Summary *view, struct Partition *part){return(app->view_get_ui_copy_(app, view, part));}
|
||||
static inline Managed_Scope get_global_managed_scope(Application_Links *app){return(app->get_global_managed_scope_(app));}
|
||||
static inline Managed_Scope get_intersected_managed_scope(Application_Links *app, Managed_Scope *intersected_scopes, int32_t count){return(app->get_intersected_managed_scope_(app, intersected_scopes, count));}
|
||||
static inline Managed_Group get_global_managed_group(Application_Links *app){return(app->get_global_managed_group_(app));}
|
||||
static inline Managed_Group get_intersected_managed_group(Application_Links *app, Managed_Group *intersected_groups, int32_t count){return(app->get_intersected_managed_group_(app, intersected_groups, count));}
|
||||
static inline Managed_Variable_ID managed_variable_create(Application_Links *app, char *null_terminated_name, uint64_t default_value){return(app->managed_variable_create_(app, null_terminated_name, default_value));}
|
||||
static inline Managed_Variable_ID managed_variable_get_id(Application_Links *app, char *null_terminated_name){return(app->managed_variable_get_id_(app, null_terminated_name));}
|
||||
static inline int32_t managed_variable_create_or_get_id(Application_Links *app, char *null_terminated_name, uint64_t default_value){return(app->managed_variable_create_or_get_id_(app, null_terminated_name, default_value));}
|
||||
static inline bool32 managed_variable_set(Application_Links *app, Managed_Scope scope, Managed_Variable_ID location, uint64_t value){return(app->managed_variable_set_(app, scope, location, value));}
|
||||
static inline bool32 managed_variable_get(Application_Links *app, Managed_Scope scope, Managed_Variable_ID location, uint64_t *value_out){return(app->managed_variable_get_(app, scope, location, value_out));}
|
||||
static inline Managed_Object managed_memory_alloc(Application_Links *app, Managed_Scope scope, int32_t size){return(app->managed_memory_alloc_(app, scope, size));}
|
||||
static inline Managed_Object buffer_markers_alloc(Application_Links *app, Buffer_ID buffer_id, int32_t count, Managed_Scope *scope){return(app->buffer_markers_alloc_(app, buffer_id, count, scope));}
|
||||
static inline Managed_Variable_ID managed_variable_create_or_get_id(Application_Links *app, char *null_terminated_name, uint64_t default_value){return(app->managed_variable_create_or_get_id_(app, null_terminated_name, default_value));}
|
||||
static inline bool32 managed_variable_set(Application_Links *app, Managed_Group group, Managed_Variable_ID location, uint64_t value){return(app->managed_variable_set_(app, group, location, value));}
|
||||
static inline bool32 managed_variable_get(Application_Links *app, Managed_Group group, Managed_Variable_ID location, uint64_t *value_out){return(app->managed_variable_get_(app, group, location, value_out));}
|
||||
static inline Managed_Object managed_memory_alloc(Application_Links *app, Managed_Group group, int32_t size){return(app->managed_memory_alloc_(app, group, size));}
|
||||
static inline Managed_Object buffer_markers_alloc(Application_Links *app, Buffer_ID buffer_id, int32_t count, Managed_Group *group){return(app->buffer_markers_alloc_(app, buffer_id, count, group));}
|
||||
static inline bool32 managed_object_free(Application_Links *app, Managed_Object object){return(app->managed_object_free_(app, object));}
|
||||
static inline bool32 managed_object_write(Application_Links *app, Managed_Object object, uint32_t start, uint32_t size, void *mem){return(app->managed_object_write_(app, object, start, size, mem));}
|
||||
static inline bool32 managed_object_read(Application_Links *app, Managed_Object object, uint32_t start, uint32_t size, void *mem_out){return(app->managed_object_read_(app, object, start, size, mem_out));}
|
||||
|
|
|
@ -116,8 +116,8 @@ init_marker_list(Application_Links *app, Partition *scratch, Heap *heap, Buffer_
|
|||
|
||||
Sticky_Jump_Stored *stored = push_array(scratch, Sticky_Jump_Stored, jumps.count);
|
||||
|
||||
Managed_Scope scope_array[2] = {0};
|
||||
scope_array[0] = buffer_get_managed_scope(app, buffer_id);
|
||||
Managed_Group group_array[2] = {0};
|
||||
group_array[0] = buffer_get_managed_group(app, buffer_id);
|
||||
|
||||
for (int32_t i = 0; i < grouped_buffer_ranges.count; i += 1){
|
||||
Range buffer_range_indices = grouped_buffer_ranges.ranges[i];
|
||||
|
@ -147,17 +147,17 @@ init_marker_list(Application_Links *app, Partition *scratch, Heap *heap, Buffer_
|
|||
}
|
||||
}
|
||||
|
||||
scope_array[1] = buffer_get_managed_scope(app, target_buffer_id);
|
||||
Managed_Scope scope = get_intersected_managed_scope(app, scope_array, ArrayCount(scope_array));
|
||||
Managed_Object marker_handle = buffer_markers_alloc(app, target_buffer_id, total_jump_count, &scope);
|
||||
group_array[1] = buffer_get_managed_group(app, target_buffer_id);
|
||||
Managed_Group group = get_intersected_managed_group(app, group_array, ArrayCount(group_array));
|
||||
Managed_Object marker_handle = buffer_markers_alloc(app, target_buffer_id, total_jump_count, &group);
|
||||
managed_object_write(app, marker_handle, 0, total_jump_count*sizeof(Marker), markers);
|
||||
end_temp_memory(marker_temp);
|
||||
|
||||
sticky_jump_marker_handle_loc = managed_variable_create_or_get_id(app, sticky_jump_marker_handle_var, 0);
|
||||
managed_variable_set(app, scope, sticky_jump_marker_handle_loc, marker_handle);
|
||||
managed_variable_set(app, group, sticky_jump_marker_handle_loc, marker_handle);
|
||||
}
|
||||
|
||||
Managed_Object stored_jump_array = managed_memory_alloc(app, scope_array[0], sizeof(Sticky_Jump_Stored)*jumps.count);
|
||||
Managed_Object stored_jump_array = managed_memory_alloc(app, group_array[0], sizeof(Sticky_Jump_Stored)*jumps.count);
|
||||
managed_object_write(app, stored_jump_array, 0, sizeof(Sticky_Jump_Stored)*jumps.count, stored);
|
||||
|
||||
end_temp_memory(temp);
|
||||
|
@ -248,14 +248,14 @@ get_jump_from_list(Application_Links *app, Marker_List *list, int32_t index, ID_
|
|||
if (get_stored_jump_from_list(app, list, index, &stored)){
|
||||
Buffer_ID target_buffer_id = stored.jump_buffer_id;
|
||||
|
||||
Managed_Scope scope_array[2] = {0};
|
||||
scope_array[0] = buffer_get_managed_scope(app, list->buffer_id);
|
||||
scope_array[1] = buffer_get_managed_scope(app, target_buffer_id);
|
||||
Managed_Scope scope = get_intersected_managed_scope(app, scope_array, ArrayCount(scope_array));
|
||||
Managed_Group group_array[2] = {0};
|
||||
group_array[0] = buffer_get_managed_group(app, list->buffer_id);
|
||||
group_array[1] = buffer_get_managed_group(app, target_buffer_id);
|
||||
Managed_Group group = get_intersected_managed_group(app, group_array, ArrayCount(group_array));
|
||||
|
||||
sticky_jump_marker_handle_loc = managed_variable_create_or_get_id(app, sticky_jump_marker_handle_var, 0);
|
||||
Managed_Object marker_array = 0;
|
||||
if (managed_variable_get(app, scope, sticky_jump_marker_handle_loc, &marker_array)){
|
||||
if (managed_variable_get(app, group, sticky_jump_marker_handle_loc, &marker_array)){
|
||||
Marker marker = {0};
|
||||
managed_object_read(app, marker_array, stored.index_into_marker_array*sizeof(Marker), 1*sizeof(Marker), &marker);
|
||||
location->buffer_id = target_buffer_id;
|
||||
|
|
|
@ -834,14 +834,14 @@ CUSTOM_DOC("Iteratively tries completing the word to the left of the cursor with
|
|||
if (buffer.exists){
|
||||
int32_t do_init = false;
|
||||
|
||||
Managed_Scope scope = view_get_managed_scope(app, view.view_id);
|
||||
Managed_Group group = view_get_managed_group(app, view.view_id);
|
||||
|
||||
uint64_t rewrite = 0;
|
||||
managed_variable_get(app, scope, view_rewrite_loc, &rewrite);
|
||||
managed_variable_get(app, group, view_rewrite_loc, &rewrite);
|
||||
if (rewrite != RewriteWordComplete){
|
||||
do_init = true;
|
||||
}
|
||||
managed_variable_set(app, scope, view_next_rewrite_loc, RewriteWordComplete);
|
||||
managed_variable_set(app, group, view_next_rewrite_loc, RewriteWordComplete);
|
||||
if (!complete_state.initialized){
|
||||
do_init = true;
|
||||
}
|
||||
|
|
|
@ -1062,22 +1062,22 @@ DOC_SEE(Buffer_Setting_ID)
|
|||
return(result);
|
||||
}
|
||||
|
||||
internal Managed_Scope
|
||||
buffer_get_managed_scope__inner(Editing_File *file){
|
||||
Managed_Scope lifetime = 0;
|
||||
internal Managed_Group
|
||||
buffer_get_managed_group__inner(Editing_File *file){
|
||||
Managed_Group lifetime = 0;
|
||||
if (file != 0){
|
||||
Assert(file->lifetime_object != 0);
|
||||
lifetime = (Managed_Scope)file->lifetime_object->workspace.scope_id;
|
||||
lifetime = (Managed_Group)file->lifetime_object->workspace.group_id;
|
||||
}
|
||||
return(lifetime);
|
||||
}
|
||||
|
||||
API_EXPORT Managed_Scope
|
||||
Buffer_Get_Managed_Scope(Application_Links *app, Buffer_ID buffer_id)
|
||||
API_EXPORT Managed_Group
|
||||
Buffer_Get_Managed_Group(Application_Links *app, Buffer_ID buffer_id)
|
||||
{
|
||||
Command_Data *cmd = (Command_Data*)app->cmd_context;
|
||||
Editing_File *file = imp_get_file(cmd, buffer_id);
|
||||
return(buffer_get_managed_scope__inner(file));
|
||||
return(buffer_get_managed_group__inner(file));
|
||||
}
|
||||
|
||||
API_EXPORT int32_t
|
||||
|
@ -1811,15 +1811,15 @@ DOC_SEE(View_Setting_ID)
|
|||
return(result);
|
||||
}
|
||||
|
||||
API_EXPORT Managed_Scope
|
||||
View_Get_Managed_Scope(Application_Links *app, View_ID view_id)
|
||||
API_EXPORT Managed_Group
|
||||
View_Get_Managed_Group(Application_Links *app, View_ID view_id)
|
||||
{
|
||||
Command_Data *cmd = (Command_Data*)app->cmd_context;
|
||||
View *view = imp_get_view(cmd, view_id);
|
||||
Managed_Scope lifetime = 0;
|
||||
Managed_Group lifetime = 0;
|
||||
if (view != 0){
|
||||
Assert(view->transient.lifetime_object != 0);
|
||||
lifetime = (Managed_Scope)(view->transient.lifetime_object->workspace.scope_id);
|
||||
lifetime = (Managed_Group)(view->transient.lifetime_object->workspace.group_id);
|
||||
}
|
||||
return(lifetime);
|
||||
}
|
||||
|
@ -2228,26 +2228,25 @@ View_Get_UI_Copy(Application_Links *app, View_Summary *view, struct Partition *p
|
|||
return(result);
|
||||
}
|
||||
|
||||
API_EXPORT Managed_Scope
|
||||
Get_Global_Managed_Scope(Application_Links *app)
|
||||
API_EXPORT Managed_Group
|
||||
Get_Global_Managed_Group(Application_Links *app)
|
||||
{
|
||||
Command_Data *cmd = (Command_Data*)app->cmd_context;
|
||||
Models *models = cmd->models;
|
||||
Managed_Scope scope = (Managed_Scope)models->dynamic_workspace.scope_id;
|
||||
return(scope);
|
||||
return((Managed_Group)models->dynamic_workspace.group_id);
|
||||
}
|
||||
|
||||
internal Dynamic_Workspace*
|
||||
get_dynamic_workspace(Models *models, Managed_Scope handle){
|
||||
u32_Ptr_Lookup_Result lookup_result = lookup_u32_Ptr_table(&models->lifetime_allocator.scope_id_to_scope_ptr_table, (u32)handle);
|
||||
get_dynamic_workspace(Models *models, Managed_Group handle){
|
||||
u32_Ptr_Lookup_Result lookup_result = lookup_u32_Ptr_table(&models->lifetime_allocator.group_id_to_group_ptr_table, (u32)handle);
|
||||
if (!lookup_result.success){
|
||||
return(0);
|
||||
}
|
||||
return((Dynamic_Workspace*)*lookup_result.val);
|
||||
}
|
||||
|
||||
API_EXPORT Managed_Scope
|
||||
Get_Intersected_Managed_Scope(Application_Links *app, Managed_Scope *intersected_scopes, int32_t count)
|
||||
API_EXPORT Managed_Group
|
||||
Get_Intersected_Managed_Group(Application_Links *app, Managed_Group *intersected_groups, int32_t count)
|
||||
{
|
||||
Command_Data *cmd = (Command_Data*)app->cmd_context;
|
||||
Models *models = cmd->models;
|
||||
|
@ -2259,7 +2258,7 @@ Get_Intersected_Managed_Scope(Application_Links *app, Managed_Scope *intersected
|
|||
b32 filled_array = true;
|
||||
Lifetime_Object **object_ptr_array = push_array(scratch, Lifetime_Object*, 0);
|
||||
for (i32 i = 0; i < count; i += 1){
|
||||
Dynamic_Workspace *workspace = get_dynamic_workspace(models, intersected_scopes[i]);
|
||||
Dynamic_Workspace *workspace = get_dynamic_workspace(models, intersected_groups[i]);
|
||||
if (workspace == 0){
|
||||
filled_array = false;
|
||||
break;
|
||||
|
@ -2268,7 +2267,7 @@ Get_Intersected_Managed_Scope(Application_Links *app, Managed_Scope *intersected
|
|||
switch (workspace->user_type){
|
||||
case DynamicWorkspace_Global:
|
||||
{
|
||||
// NOTE(allen): (global_scope INTERSECT X) == X for all X, therefore we emit nothing when a global scope is in the key list.
|
||||
// NOTE(allen): (global_group INTERSECT X) == X for all X, therefore we emit nothing when a global group is in the key list.
|
||||
}break;
|
||||
|
||||
case DynamicWorkspace_Buffer:
|
||||
|
@ -2300,13 +2299,13 @@ Get_Intersected_Managed_Scope(Application_Links *app, Managed_Scope *intersected
|
|||
}
|
||||
}
|
||||
|
||||
Managed_Scope result = 0;
|
||||
Managed_Group result = 0;
|
||||
if (filled_array){
|
||||
i32 member_count = (i32)(push_array(scratch, Lifetime_Object*, 0) - object_ptr_array);
|
||||
member_count = lifetime_sort_and_dedup_object_set(object_ptr_array, member_count);
|
||||
Heap *heap = &models->mem.heap;
|
||||
Lifetime_Key *key = lifetime_get_or_create_intersection_key(heap, lifetime_allocator, object_ptr_array, member_count);
|
||||
result = (Managed_Scope)key->dynamic_workspace.scope_id;
|
||||
result = (Managed_Group)key->dynamic_workspace.group_id;
|
||||
}
|
||||
|
||||
end_temp_memory(temp);
|
||||
|
@ -2335,7 +2334,7 @@ Managed_Variable_Get_ID(Application_Links *app, char *null_terminated_name)
|
|||
return(dynamic_variables_lookup(layout, name));
|
||||
}
|
||||
|
||||
API_EXPORT int32_t
|
||||
API_EXPORT Managed_Variable_ID
|
||||
Managed_Variable_Create_Or_Get_ID(Application_Links *app, char *null_terminated_name, uint64_t default_value)
|
||||
{
|
||||
Command_Data *cmd = (Command_Data*)app->cmd_context;
|
||||
|
@ -2347,7 +2346,7 @@ Managed_Variable_Create_Or_Get_ID(Application_Links *app, char *null_terminated_
|
|||
}
|
||||
|
||||
internal bool32
|
||||
get_dynamic_variable(Command_Data *cmd, Managed_Scope handle, int32_t location, uint64_t **ptr_out){
|
||||
get_dynamic_variable(Command_Data *cmd, Managed_Group handle, int32_t location, uint64_t **ptr_out){
|
||||
Models *models = cmd->models;
|
||||
Heap *heap = &models->mem.heap;
|
||||
Dynamic_Variable_Layout *layout = &models->variable_layout;
|
||||
|
@ -2362,11 +2361,11 @@ get_dynamic_variable(Command_Data *cmd, Managed_Scope handle, int32_t location,
|
|||
}
|
||||
|
||||
API_EXPORT bool32
|
||||
Managed_Variable_Set(Application_Links *app, Managed_Scope scope, Managed_Variable_ID location, uint64_t value)
|
||||
Managed_Variable_Set(Application_Links *app, Managed_Group group, Managed_Variable_ID location, uint64_t value)
|
||||
{
|
||||
Command_Data *cmd = (Command_Data*)app->cmd_context;
|
||||
u64 *ptr = 0;
|
||||
if (get_dynamic_variable(cmd, scope, location, &ptr)){
|
||||
if (get_dynamic_variable(cmd, group, location, &ptr)){
|
||||
*ptr = value;
|
||||
return(true);
|
||||
}
|
||||
|
@ -2374,11 +2373,11 @@ Managed_Variable_Set(Application_Links *app, Managed_Scope scope, Managed_Variab
|
|||
}
|
||||
|
||||
API_EXPORT bool32
|
||||
Managed_Variable_Get(Application_Links *app, Managed_Scope scope, Managed_Variable_ID location, uint64_t *value_out)
|
||||
Managed_Variable_Get(Application_Links *app, Managed_Group group, Managed_Variable_ID location, uint64_t *value_out)
|
||||
{
|
||||
Command_Data *cmd = (Command_Data*)app->cmd_context;
|
||||
u64 *ptr = 0;
|
||||
if (get_dynamic_variable(cmd, scope, location, &ptr)){
|
||||
if (get_dynamic_variable(cmd, group, location, &ptr)){
|
||||
*value_out = *ptr;
|
||||
return(true);
|
||||
}
|
||||
|
@ -2386,12 +2385,12 @@ Managed_Variable_Get(Application_Links *app, Managed_Scope scope, Managed_Variab
|
|||
}
|
||||
|
||||
API_EXPORT Managed_Object
|
||||
Managed_Memory_Alloc(Application_Links *app, Managed_Scope scope, int32_t size)
|
||||
Managed_Memory_Alloc(Application_Links *app, Managed_Group group, int32_t size)
|
||||
{
|
||||
Command_Data *cmd = (Command_Data*)app->cmd_context;
|
||||
Models *models = cmd->models;
|
||||
Heap *heap = &models->mem.heap;
|
||||
Dynamic_Workspace *workspace = get_dynamic_workspace(models, scope);
|
||||
Dynamic_Workspace *workspace = get_dynamic_workspace(models, group);
|
||||
Managed_Object result = 0;
|
||||
if (workspace != 0){
|
||||
void *ptr = dynamic_memory_bank_allocate(heap, &workspace->mem_bank, size + sizeof(Managed_Memory_Header));
|
||||
|
@ -2399,26 +2398,26 @@ Managed_Memory_Alloc(Application_Links *app, Managed_Scope scope, int32_t size)
|
|||
header->type = ManagedObjectType_Memory;
|
||||
header->size = size;
|
||||
u32 id = dynamic_workspace_store_pointer(heap, workspace, ptr);
|
||||
result = ((u64)scope << 32) | (u64)id;
|
||||
result = ((u64)group << 32) | (u64)id;
|
||||
}
|
||||
return(result);
|
||||
}
|
||||
|
||||
API_EXPORT Managed_Object
|
||||
Buffer_Markers_Alloc(Application_Links *app, Buffer_ID buffer_id, int32_t count, Managed_Scope *scope)
|
||||
Buffer_Markers_Alloc(Application_Links *app, Buffer_ID buffer_id, int32_t count, Managed_Group *group)
|
||||
{
|
||||
Command_Data *cmd = (Command_Data*)app->cmd_context;
|
||||
Editing_File *file = imp_get_file(cmd, buffer_id);
|
||||
Managed_Scope markers_scope = buffer_get_managed_scope__inner(file);
|
||||
if (scope != 0){
|
||||
Managed_Object scope_array[2];
|
||||
scope_array[0] = markers_scope;
|
||||
scope_array[1] = *scope;
|
||||
markers_scope = Get_Intersected_Managed_Scope(app, scope_array, 2);
|
||||
Managed_Group markers_group = buffer_get_managed_group__inner(file);
|
||||
if (group != 0){
|
||||
Managed_Object group_array[2];
|
||||
group_array[0] = markers_group;
|
||||
group_array[1] = *group;
|
||||
markers_group = Get_Intersected_Managed_Group(app, group_array, 2);
|
||||
}
|
||||
Models *models = cmd->models;
|
||||
Heap *heap = &models->mem.heap;
|
||||
Dynamic_Workspace *workspace = get_dynamic_workspace(models, markers_scope);
|
||||
Dynamic_Workspace *workspace = get_dynamic_workspace(models, markers_group);
|
||||
Managed_Object result = 0;
|
||||
if (workspace != 0){
|
||||
i32 size = count*sizeof(Marker);
|
||||
|
@ -2431,7 +2430,7 @@ Buffer_Markers_Alloc(Application_Links *app, Buffer_ID buffer_id, int32_t count,
|
|||
header->buffer_id = buffer_id;
|
||||
file->state.total_marker_count += count;
|
||||
u32 id = dynamic_workspace_store_pointer(heap, workspace, ptr);
|
||||
result = ((u64)markers_scope << 32) | (u64)id;
|
||||
result = ((u64)markers_group << 32) | (u64)id;
|
||||
}
|
||||
return(result);
|
||||
}
|
||||
|
|
|
@ -171,15 +171,15 @@ dynamic_workspace_init(Heap *heap, Lifetime_Allocator *lifetime_allocator,
|
|||
if (lifetime_allocator->scope_id_counter == 0){
|
||||
lifetime_allocator->scope_id_counter = 1;
|
||||
}
|
||||
workspace->scope_id = lifetime_allocator->scope_id_counter++;
|
||||
insert_u32_Ptr_table(heap, &lifetime_allocator->scope_id_to_scope_ptr_table, workspace->scope_id, workspace);
|
||||
workspace->group_id = lifetime_allocator->scope_id_counter++;
|
||||
insert_u32_Ptr_table(heap, &lifetime_allocator->group_id_to_group_ptr_table, workspace->group_id, workspace);
|
||||
workspace->user_type = user_type;
|
||||
workspace->user_back_ptr = user_back_ptr;
|
||||
}
|
||||
|
||||
internal void
|
||||
dynamic_workspace_free(Heap *heap, Lifetime_Allocator *lifetime_allocator, Dynamic_Workspace *workspace){
|
||||
erase_u32_Ptr_table(&lifetime_allocator->scope_id_to_scope_ptr_table, workspace->scope_id);
|
||||
erase_u32_Ptr_table(&lifetime_allocator->group_id_to_group_ptr_table, workspace->group_id);
|
||||
dynamic_variables_block_free(heap, &workspace->var_block);
|
||||
dynamic_memory_bank_free_all(heap, &workspace->mem_bank);
|
||||
}
|
||||
|
|
|
@ -94,7 +94,7 @@ struct Dynamic_Workspace{
|
|||
Dynamic_Memory_Bank mem_bank;
|
||||
u32_Ptr_Table object_id_to_object_ptr;
|
||||
u32 object_id_counter;
|
||||
u32 scope_id;
|
||||
u32 group_id;
|
||||
i32 user_type;
|
||||
void *user_back_ptr;
|
||||
Managed_Buffer_Markers_Header_List buffer_markers_list;
|
||||
|
@ -174,7 +174,7 @@ struct Lifetime_Allocator{
|
|||
Lifetime_Key_List free_keys;
|
||||
Lifetime_Key_Table key_table;
|
||||
Ptr_Table key_check_table;
|
||||
u32_Ptr_Table scope_id_to_scope_ptr_table;
|
||||
u32_Ptr_Table group_id_to_group_ptr_table;
|
||||
u32 scope_id_counter;
|
||||
};
|
||||
|
||||
|
|
|
@ -80,7 +80,6 @@ handle_track_out_of_memory(i32 val){
|
|||
internal
|
||||
Sys_Add_Listener_Sig(system_add_listener){
|
||||
b32 result = false;
|
||||
|
||||
for (;;){
|
||||
i32 track_result = add_listener(&shared_vars.track, &shared_vars.scratch, (u8*)filename);
|
||||
if (handle_track_out_of_memory(track_result)){
|
||||
|
@ -90,7 +89,6 @@ Sys_Add_Listener_Sig(system_add_listener){
|
|||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return(result);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue