set_command_input

This commit is contained in:
Allen Webster 2018-10-06 08:26:20 -07:00
parent 1ca1dc1395
commit d30be67d22
7 changed files with 336 additions and 121 deletions

View File

@ -212,10 +212,16 @@ ENUM(uint32_t, Buffer_Kill_Flag){
BufferKill_AlwaysKill = 0x2, BufferKill_AlwaysKill = 0x2,
}; };
/* DOC(A status enumeration returned by kill_buffer.)
DOC_SEE(kill_buffer) */
ENUM(int32_t, Buffer_Kill_Result){ ENUM(int32_t, Buffer_Kill_Result){
/* DOC(The buffer was successfully killed.) */
BufferKillResult_Killed = 0, BufferKillResult_Killed = 0,
/* DOC(The buffer was not killed because it is dirty. This can be overriden with the flag BufferKill_AlwaysKill. This result is usually followed up by launching a "sure to kill" dialogue, but that is entirely optional.) */
BufferKillResult_Dirty = 1, BufferKillResult_Dirty = 1,
/* DOC(The buffer was not killed because it is unkillable. Unkillable buffers are the buffers that must be open for the core's purposes. *messages* and *scratch* are unkillable buffers.) */
BufferKillResult_Unkillable = 2, BufferKillResult_Unkillable = 2,
/* DOC(The specified buffer does not exist.) */
BufferKillResult_DoesNotExist = 3, BufferKillResult_DoesNotExist = 3,
}; };
@ -311,7 +317,8 @@ ENUM(int32_t, Mouse_Cursor_Show_Type){
MouseCursorShow_Never, MouseCursorShow_Never,
/* DOC(The MouseCursorShow_Never mode always shows the cursor.) */ /* DOC(The MouseCursorShow_Never mode always shows the cursor.) */
MouseCursorShow_Always, MouseCursorShow_Always,
// MouseCursorShow_WhenActive,// TODO(allen): coming soon // TODO(allen): coming soon
// MouseCursorShow_WhenActive,
}; };
/* DOC(A View_Split_Position specifies where a new view should be placed as a result of a view split operation.) */ /* DOC(A View_Split_Position specifies where a new view should be placed as a result of a view split operation.) */
@ -382,7 +389,7 @@ STRUCT Mouse_State{
GLOBAL_VAR Mouse_State null_mouse_state = {0}; GLOBAL_VAR Mouse_State null_mouse_state = {0};
/* DOC(Range describes an integer range typically used for ranges within a buffer. Ranges tend are usually not passed as a Range struct into the API, but this struct is used to return ranges. /* DOC(Range describes an integer range typically used for ranges within a buffer. Ranges are not used to pass into the API, but this struct is used for returns.
Throughout the API ranges are thought of in the form [min,max) where max is "one past the end" of the range that is actually read/edited/modified.) */ Throughout the API ranges are thought of in the form [min,max) where max is "one past the end" of the range that is actually read/edited/modified.) */
UNION Range{ UNION Range{
@ -406,8 +413,11 @@ UNION Range{
}; };
}; };
/* DOC(An array of ranges. This is just a plain pointer bundled with a count, no additional special structure.) */
STRUCT Range_Array{ STRUCT Range_Array{
/* DOC(A pointer to the array of ranges.) */
Range *ranges; Range *ranges;
/* DOC(The number of ranges in the array.) */
int32_t count; int32_t count;
}; };
@ -680,55 +690,127 @@ STRUCT View_Summary{
GUI_Scroll_Vars scroll_vars; GUI_Scroll_Vars scroll_vars;
}; };
/* DOC(The enumeration of types of managed objects.) */
ENUM(int32_t, Managed_Object_Type) ENUM(int32_t, Managed_Object_Type)
{ {
/* DOC(This type value indicates that the specified object for an operation is not a valid managed object.
A handle for a managed object can "go bad" when it's scope is cleared, or when it is freed, so it is possible to store handles and check them for validity on use. However, all managed object APIs do the necessary checks on their parameters and return appropriate failure results on bad handles.) */
ManagedObjectType_Error = 0, ManagedObjectType_Error = 0,
/* DOC(A memory object is used for straightforward memory allocation in a managed scope. These objects have no special cleanup, no extra operations, and their memory storage is never touched by the core.) */
ManagedObjectType_Memory = 1, ManagedObjectType_Memory = 1,
/* DOC(A marker object is used to place markers into buffers that move along with the text upon which they are placed. A marker object has a specific buffer to which it is attached, and must be allocated in a scope dependent upon the lifetime of that buffer. Marker objects always use the Marker type for their items, and their item size is always sizeof(Marker). When a marker object is freed, all of the marker visuals attached to it are also freed and the specific buffer of the object no longer adjusts the marker data when edits occur.) */
ManagedObjectType_Markers = 2, ManagedObjectType_Markers = 2,
ManagedObjectType_COUNT = 3, ManagedObjectType_COUNT = 3,
}; };
/* DOC(A handle to a managed scope. A managed scope contains variables and objects all of which can be freed and reset in optimized bulk operations. Many managed scopes are created and destroyed by the core to track the lifetime of entities like buffers and views. Because a managed scope contains it's own copy of the managed variables, managed scopes can also be used as a keying mechanism to store and retrieve special information related to entities like buffers and views.) */
TYPEDEF uint64_t Managed_Scope; TYPEDEF uint64_t Managed_Scope;
/* DOC(An id refering to a managed variable. Managed variables are created globally, but each managed scope has it's own set of values for the managed variables. Managed variables are created via a unique string. Attempting to create a variable with the same name as an existing variable fails. When naming variables it is recommended that you place a 'module name' followed by a '.' and then a descriptive variable name to distinguish your variables from variables written by other 4coder users that might someday need to work together in the same configuration. Example: "MyUniqueCustomization.variable_name"). The variable's id is used to set and get the value from managed scopes. */
TYPEDEF int32_t Managed_Variable_ID; TYPEDEF int32_t Managed_Variable_ID;
/* DOC(A handle to a managed object. Managed objects have various behaviors and special uses depending on their type. All managed objects share the property of being tied to a managed scope, so that they are cleaned up and freed when that scope's contents are cleared or when the scope is destroyed, they all support store and load operations, although not all with the exact same meanings and implications, and they can all be freed individually instead of with the entire scope.) */
TYPEDEF uint64_t Managed_Object; TYPEDEF uint64_t Managed_Object;
static Managed_Scope ManagedScope_NULL = 0; static Managed_Scope ManagedScope_NULL = 0;
static Managed_Variable_ID ManagedVariableIndex_ERROR = -1; static Managed_Variable_ID ManagedVariableIndex_ERROR = -1;
static Managed_Object ManagedObject_NULL = 0; static Managed_Object ManagedObject_NULL = 0;
/* DOC(A multi-member identifier for a marker visual. A marker visual is attached to a marker object (Marker_Object), it is freed when the marker object is freed or when it is specifically destroyed. Multiple marker visuals can be placed on a single marker object.)
DOC_SEE(Marker_Visual_Type)
DOC_SEE(Marker_Visual_Symbolic_Color)
DOC_SEE(Marker_Visual_Text_Style)
DOC_SEE(Marker_Visual_Take_Rule)
DOC_SEE(Marker_Visual_Priority_Level)
*/
STRUCT Marker_Visual{ STRUCT Marker_Visual{
Managed_Scope scope; Managed_Scope scope;
uint32_t slot_id; uint32_t slot_id;
uint32_t gen_id; uint32_t gen_id;
}; };
/*
DOC(The enumeration of visual effects that a marker visual can create. All effects have a color aspect and text_color aspect. The exact meaning of these aspects depends upon the effect's type.
There are several effect styles, two effect styles never conflict with one another, each style can be applied to each character. If two effects of the same style are applied to the same character, then the effect with the higher priority is rendered, and the lower priority effect is ignored. The render order for effects is:
Highlight Style
Wire Frame Style
I-Bar Style
Some effects are character oriented, meaning they have an effect on the individual character/characters that the markers specify. Other effects are line oriented, meaning that they effect the entire line on which their markers are placed. Line oriented highlight style effects are always overriden by character oriented highlight style effects of the same style, regardless of relative priority levels.
Single marked effects use each marker to specify a single point at which an effect is applied. Range marked effects take pairs of markers to specify a left inclusive right eclusive range to effect.
In range marked effects, two conflicting effects with the same priority level are further resolved by prefering the effect with the higher-index starting position. This means that if range A completely contains range B and they have the same priority level, then range B will be visible, and range A will be visible wherever range B is not.
)
*/
ENUM(int32_t, Marker_Visual_Type) ENUM(int32_t, Marker_Visual_Type)
{ {
/* DOC(No visual effect, with this type it is as if the marker visual does not exist.) */
VisualType_Invisible = 0, VisualType_Invisible = 0,
/* DOC(Shows a block around the background of each marked character. The color aspect determines the color of the block behind the characters, the text_color aspect determines the color of the characters.
This is a character oriented highlight style single marked effect.) */
VisualType_CharacterBlocks = 1, VisualType_CharacterBlocks = 1,
/* DOC(Shows a rectangle outline around each marked character. The color aspect determines the color of the rectangle, the text_color aspect is ignored.
This is a character oriented wire frame style single marked effect.) */
VisualType_CharacterWireFrames = 2, VisualType_CharacterWireFrames = 2,
/* DOC(Shows a single pixel line on the left side of each marked character. The color aspect determines the color of the line, the text_color aspect is ignored.
This is a character oriented wire frame style single marked effect.) */
VisualType_CharacterIBars = 3, VisualType_CharacterIBars = 3,
/* DOC(Shows a block in the background of the entire line on which the marker is placed. The color aspect determines the color of the highlight, the text_color aspect is ignored.
This is a line oriented highlight style single marked effect.) */
VisualType_LineHighlights = 4, VisualType_LineHighlights = 4,
/* DOC(Shows a block around the background of each character between the range pairs. The color aspect determines the color of the highlight, the text_color aspect is ignored.
This is a character oriented highlight style range marked effect.) */
VisualType_CharacterHighlightRanges = 5, VisualType_CharacterHighlightRanges = 5,
/* DOC(Shows a block in the background of the entire line on each line within the range. The color aspect determines the color of the highlight, the text_color aspect is ignored.
This is a line oriented highlight style range marked effect.) */
VisualType_LineHighlightRanges = 6, VisualType_LineHighlightRanges = 6,
VisualType_COUNT = 7, VisualType_COUNT = 7,
}; };
/* DOC(Special codes that can be used as the color aspects of marker visual effects. These special codes are for convenience and in some cases effects that could not be expressed as 32-bit colors.) */
ENUM(uint32_t, Marker_Visual_Symbolic_Color) ENUM(uint32_t, Marker_Visual_Symbolic_Color)
{ {
/* DOC(When default is used for text_color aspect, the text is unchanged from the coloring the core would apply to it. For all effects, the default value of the color aspect for all effects is the same as transparent. For convenience it is guaranteed this will always be the zero value, so that users may simply pass 0 to color aspects they do not wish to set.) */
SymbolicColor_Default = 0, SymbolicColor_Default = 0,
/* DOC(Since all symbolic color codes have their alpha channel set to zero, this code is reserved to get the effect one would get for using a tranparent 32-bit color.) */
SymbolicColor_Transparent = 1, SymbolicColor_Transparent = 1,
/* DOC(This flag bit-ored with a style tag will be reevaluated at render time to the color of the specific tag in the currently active palette. The macro SymbolicColorFromPalette(Stag_CODE) applies the bit-or to Stag_CODE. For example SymbolicColorFromPalette(Stag_Cursor) will always evaluate to the color of the current cursor. Note that this evaluation happens at render time, so that if the palette changes, the evaluated color will also change.) */
SymbolicColor__StagColorFlag = 0x00800000, SymbolicColor__StagColorFlag = 0x00800000,
}; };
#define SymbolicColorFromPalette(x) ((x)|SymbolicColor__StagColorFlag) #define SymbolicColorFromPalette(x) ((x)|SymbolicColor__StagColorFlag)
/* DOC(Not implemented, but reserved for future use. Where this type is used in the API the value passed should always be zero for now.) */
ENUM(int32_t, Marker_Visual_Text_Style) ENUM(int32_t, Marker_Visual_Text_Style)
{ {
MARKER_TEXT_STYLE_NOT_YET_IMPLEMENTED, MARKER_TEXT_STYLE_NOT_YET_IMPLEMENTED,
}; };
/* DOC(The take rule of a marker visual specifies how to iterate the markers in the marker object when applying the visual effect. For range marked effects, which use a pair of markers to specify a left inclusive right exclusive range, it is not necessary that two markers be adjacent in the marker object when they are taken. The first taken marker is paired to the second taken marker, the third to the fourth, etc, regardless of any gaps between the consecutively taken markers. If the take rule overflows the marker object, the effect is still applied, but the iteration is cut short as soon as it would overflow.) */
STRUCT Marker_Visual_Take_Rule{ STRUCT Marker_Visual_Take_Rule{
/* DOC(The index of the first marker to take. Indices are zero based. The default value is zero.) */
int32_t first_index; int32_t first_index;
/* DOC(From the start of a "step" take_count_per_step markers. Markers taken in the same step have consectuive indices. For example, if the first marker taken has index = 0, and the take_count_per_step = 2, then the second marker taken will have index = 1. The default value is 1.) */
int32_t take_count_per_step; int32_t take_count_per_step;
/* DOC(The stride between each "step". After taking take_count_per_step markers from the current step, the iteation advances to the next step counting from the start of current step. So if 2 markers are taken per step, and the stride is 3, then the pattern of taken markers will be **.**.**.**. where * is a tken marker. The core automatically adjusts this field to be at least equal to take_count_per_step before using it to iterate. The default value is 1.) */
int32_t step_stride_in_marker_count; int32_t step_stride_in_marker_count;
/* DOC(The maximum number of markers to be taken durring iteration. Since overflow does not cause the visual effect to fail, and is prevented internally, this field can be set to the max value of a signed 32-bit integer and will take as many markers as possible until it hits the end of the marker object. If the maximum count is reached mid-step, the iteration stops without completeing the step.) */
int32_t maximum_number_of_markers; int32_t maximum_number_of_markers;
}; };
/* DOC(A helper enumeration for common priority levels. Although any unsigned integer is a valid priority level, the following five levels are used to establish a standard convention. Highest priority is given to effects immediately at the cursor, mark, and highlighted range. Default priority is given to actively attached effects like compilation error highlights. Passive effects like scope highlighting go to Lowest priority.
This system is considered a temporary measure and will eventually be replaced with a priority level brokering system to enable cooperation between modules [note made 4.0.29].) */
ENUM(uint32_t, Marker_Visual_Priority_Level){ ENUM(uint32_t, Marker_Visual_Priority_Level){
VisualPriority_Lowest = 0, VisualPriority_Lowest = 0,
VisualPriority_Low = 1000, VisualPriority_Low = 1000,
@ -745,59 +827,86 @@ STRUCT Query_Bar{
String string; String string;
}; };
/* DOC(An enumeration of the types of UI widget items that can be placed in a UI.) */
ENUM(int16_t, UI_Item_Type){ ENUM(int16_t, UI_Item_Type){
/* DOC(An 'option' is a rectangle with a margin that can be highlighted, and a main string in default text color, and a secondary string in pop2 color, on a single line centered vertically in the item rectangle.) */
UIType_Option = 0, UIType_Option = 0,
/* DOC(A 'text field' is a rectangle with a query string in pop1 color, and a main string in default text color, on a single line centered verticall in the item rectangle.) */
UIType_TextField = 1, UIType_TextField = 1,
/* DOC(A 'color theme' is a rectangle that ignores the active color palette and previews a specified color palette, with a specified string on the first line. This item is particularly meant for creating the color theme lister, but could be reused for anything, however there is no way to remove all the sample text in the widget added alongside the main string.) */
UIType_ColorTheme = 2, UIType_ColorTheme = 2,
}; };
/* DOC(An enumeration of the levels of activation that can be placed on an item in a UI, this can effect the appearance of some widgets.) */
ENUM(int8_t, UI_Activation_Level){ ENUM(int8_t, UI_Activation_Level){
UIActivation_None = 0, UIActivation_None = 0,
UIActivation_Hover = 1, UIActivation_Hover = 1,
UIActivation_Active = 2, UIActivation_Active = 2,
}; };
/* DOC(An enumeration of the coordinate systems in which an item's rectangle can be specified. This is not always a convenience feature as it means after scrolling the widget data does not necessarily needed to be updated, thus saving extra work. All coordiante systems are in pixels, with y increasing downward, and x increasing rightward.) */
ENUM(int8_t, UI_Coordinate_System){ ENUM(int8_t, UI_Coordinate_System){
/* DOC(The 'scrolled' coordiante system is effected by the scroll value of the view. If the y scroll value is at 100 and an item is placed with a vertical range from 50 to 90, the item is not visible. When the y scroll value is at 0, this coordinate system aligns with the view relative coordiante system.) */
UICoordinates_Scrolled = 0, UICoordinates_Scrolled = 0,
/* DOC(The 'view relative' coordiante system is only effected by the screen coordinates of the view. (0,0) is always the top left corner of space inside the view margin.) */
UICoordinates_ViewRelative = 1, UICoordinates_ViewRelative = 1,
UICoordinates_COUNT = 2, UICoordinates_COUNT = 2,
}; };
/* DOC(A UI_Item is essentially the data to specify a single widget. The exact appearance and qualities of a displayed widget are determined by the item's type.)
DOC_SEE(UI_Item_Type)
DOC_SEE(UI_Activation_Level)
DOC_SEE(UI_Coordinate_System)
*/
STRUCT UI_Item{ STRUCT UI_Item{
/* DOC(The type of the item.) */
UI_Item_Type type; UI_Item_Type type;
/* DOC(The activation level of the item.) */
UI_Activation_Level activation_level; UI_Activation_Level activation_level;
/* DOC(The coordinate system in which the item's rectanlge is expressed.) */
UI_Coordinate_System coordinates; UI_Coordinate_System coordinates;
/* DOC(The rectangle of an item, combined with it's coordinate system, specify where on the screen the widget will be rendered.) */
i32_Rect rectangle;
// 32-bits of padding to fill here // 32-bits of padding to fill here
union{ union{
struct{ struct{
/* DOC(The main string of an 'option' widget.) */
String string; String string;
/* DOC(The secondary string of an 'option' widget.) */
String status; String status;
} option; } option;
struct{ struct{
/* DOC(The query string of a 'text field' widget.) */
String query; String query;
/* DOC(The main string of an 'text field' widget.) */
String string; String string;
} text_field; } text_field;
struct{ struct{
/* DOC(The custom first line string of the color theme preview block.) */
String string; String string;
/* DOC(The index of the color theme to be used with the preview block.) */
int32_t index; int32_t index;
} color_theme; } color_theme;
}; };
/* DOC(All items can have an attached user_data pointer to associate the item back to whatever user space data or object is needed for interactign with the item.) */
void *user_data; void *user_data;
i32_Rect rectangle;
}; };
/* DOC(Wraps a UI_Item in a doubly linked list node.) */
STRUCT UI_Item_Node{ STRUCT UI_Item_Node{
UI_Item_Node *next; UI_Item_Node *next;
UI_Item_Node *prev; UI_Item_Node *prev;
UI_Item fixed; UI_Item fixed;
}; };
/* DOC(A zero-ended doubly linked list object.) */
STRUCT UI_List{ STRUCT UI_List{
UI_Item_Node *first; UI_Item_Node *first;
UI_Item_Node *last; UI_Item_Node *last;
int32_t count; int32_t count;
}; };
/* DOC(An array of UI_Items and a set of bounding boxes that store the union item rectangle per coordiante system, used to optimize activation and re-render operations.) */
STRUCT UI_Control{ STRUCT UI_Control{
UI_Item *items; UI_Item *items;
int32_t count; int32_t count;

View File

@ -79,6 +79,7 @@ struct Application_Links;
#define MANAGED_OBJECT_LOAD_DATA_SIG(n) bool32 n(Application_Links *app, Managed_Object object, uint32_t first_index, uint32_t count, void *mem_out) #define MANAGED_OBJECT_LOAD_DATA_SIG(n) bool32 n(Application_Links *app, Managed_Object object, uint32_t first_index, uint32_t count, void *mem_out)
#define GET_USER_INPUT_SIG(n) User_Input n(Application_Links *app, Input_Type_Flag get_type, Input_Type_Flag abort_type) #define GET_USER_INPUT_SIG(n) User_Input n(Application_Links *app, Input_Type_Flag get_type, Input_Type_Flag abort_type)
#define GET_COMMAND_INPUT_SIG(n) User_Input n(Application_Links *app) #define GET_COMMAND_INPUT_SIG(n) User_Input n(Application_Links *app)
#define SET_COMMAND_INPUT_SIG(n) void n(Application_Links *app, Key_Event_Data key_data)
#define GET_MOUSE_STATE_SIG(n) Mouse_State n(Application_Links *app) #define GET_MOUSE_STATE_SIG(n) Mouse_State n(Application_Links *app)
#define START_QUERY_BAR_SIG(n) bool32 n(Application_Links *app, Query_Bar *bar, uint32_t flags) #define START_QUERY_BAR_SIG(n) bool32 n(Application_Links *app, Query_Bar *bar, uint32_t flags)
#define END_QUERY_BAR_SIG(n) void n(Application_Links *app, Query_Bar *bar, uint32_t flags) #define END_QUERY_BAR_SIG(n) void n(Application_Links *app, Query_Bar *bar, uint32_t flags)
@ -196,6 +197,7 @@ typedef MANAGED_OBJECT_STORE_DATA_SIG(Managed_Object_Store_Data_Function);
typedef MANAGED_OBJECT_LOAD_DATA_SIG(Managed_Object_Load_Data_Function); typedef MANAGED_OBJECT_LOAD_DATA_SIG(Managed_Object_Load_Data_Function);
typedef GET_USER_INPUT_SIG(Get_User_Input_Function); typedef GET_USER_INPUT_SIG(Get_User_Input_Function);
typedef GET_COMMAND_INPUT_SIG(Get_Command_Input_Function); typedef GET_COMMAND_INPUT_SIG(Get_Command_Input_Function);
typedef SET_COMMAND_INPUT_SIG(Set_Command_Input_Function);
typedef GET_MOUSE_STATE_SIG(Get_Mouse_State_Function); typedef GET_MOUSE_STATE_SIG(Get_Mouse_State_Function);
typedef START_QUERY_BAR_SIG(Start_Query_Bar_Function); typedef START_QUERY_BAR_SIG(Start_Query_Bar_Function);
typedef END_QUERY_BAR_SIG(End_Query_Bar_Function); typedef END_QUERY_BAR_SIG(End_Query_Bar_Function);
@ -315,6 +317,7 @@ Managed_Object_Store_Data_Function *managed_object_store_data;
Managed_Object_Load_Data_Function *managed_object_load_data; Managed_Object_Load_Data_Function *managed_object_load_data;
Get_User_Input_Function *get_user_input; Get_User_Input_Function *get_user_input;
Get_Command_Input_Function *get_command_input; Get_Command_Input_Function *get_command_input;
Set_Command_Input_Function *set_command_input;
Get_Mouse_State_Function *get_mouse_state; Get_Mouse_State_Function *get_mouse_state;
Start_Query_Bar_Function *start_query_bar; Start_Query_Bar_Function *start_query_bar;
End_Query_Bar_Function *end_query_bar; End_Query_Bar_Function *end_query_bar;
@ -433,6 +436,7 @@ Managed_Object_Store_Data_Function *managed_object_store_data_;
Managed_Object_Load_Data_Function *managed_object_load_data_; Managed_Object_Load_Data_Function *managed_object_load_data_;
Get_User_Input_Function *get_user_input_; Get_User_Input_Function *get_user_input_;
Get_Command_Input_Function *get_command_input_; Get_Command_Input_Function *get_command_input_;
Set_Command_Input_Function *set_command_input_;
Get_Mouse_State_Function *get_mouse_state_; Get_Mouse_State_Function *get_mouse_state_;
Start_Query_Bar_Function *start_query_bar_; Start_Query_Bar_Function *start_query_bar_;
End_Query_Bar_Function *end_query_bar_; End_Query_Bar_Function *end_query_bar_;
@ -559,6 +563,7 @@ app_links->managed_object_store_data_ = Managed_Object_Store_Data;\
app_links->managed_object_load_data_ = Managed_Object_Load_Data;\ app_links->managed_object_load_data_ = Managed_Object_Load_Data;\
app_links->get_user_input_ = Get_User_Input;\ app_links->get_user_input_ = Get_User_Input;\
app_links->get_command_input_ = Get_Command_Input;\ app_links->get_command_input_ = Get_Command_Input;\
app_links->set_command_input_ = Set_Command_Input;\
app_links->get_mouse_state_ = Get_Mouse_State;\ app_links->get_mouse_state_ = Get_Mouse_State;\
app_links->start_query_bar_ = Start_Query_Bar;\ app_links->start_query_bar_ = Start_Query_Bar;\
app_links->end_query_bar_ = End_Query_Bar;\ app_links->end_query_bar_ = End_Query_Bar;\
@ -677,6 +682,7 @@ static inline bool32 managed_object_store_data(Application_Links *app, Managed_O
static inline bool32 managed_object_load_data(Application_Links *app, Managed_Object object, uint32_t first_index, uint32_t count, void *mem_out){return(app->managed_object_load_data(app, object, first_index, count, mem_out));} static inline bool32 managed_object_load_data(Application_Links *app, Managed_Object object, uint32_t first_index, uint32_t count, void *mem_out){return(app->managed_object_load_data(app, object, first_index, count, mem_out));}
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_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 User_Input get_command_input(Application_Links *app){return(app->get_command_input(app));}
static inline void set_command_input(Application_Links *app, Key_Event_Data key_data){(app->set_command_input(app, key_data));}
static inline Mouse_State get_mouse_state(Application_Links *app){return(app->get_mouse_state(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 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 end_query_bar(Application_Links *app, Query_Bar *bar, uint32_t flags){(app->end_query_bar(app, bar, flags));}
@ -795,6 +801,7 @@ static inline bool32 managed_object_store_data(Application_Links *app, Managed_O
static inline bool32 managed_object_load_data(Application_Links *app, Managed_Object object, uint32_t first_index, uint32_t count, void *mem_out){return(app->managed_object_load_data_(app, object, first_index, count, mem_out));} static inline bool32 managed_object_load_data(Application_Links *app, Managed_Object object, uint32_t first_index, uint32_t count, void *mem_out){return(app->managed_object_load_data_(app, object, first_index, count, mem_out));}
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_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 User_Input get_command_input(Application_Links *app){return(app->get_command_input_(app));}
static inline void set_command_input(Application_Links *app, Key_Event_Data key_data){(app->set_command_input_(app, key_data));}
static inline Mouse_State get_mouse_state(Application_Links *app){return(app->get_mouse_state_(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 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 end_query_bar(Application_Links *app, Query_Bar *bar, uint32_t flags){(app->end_query_bar_(app, bar, flags));}

View File

@ -2504,7 +2504,7 @@ Managed_Variable_Create(Application_Links *app, char *null_terminated_name, uint
/* /*
DOC_PARAM(null_terminated_name, The unique name for this managed variable.) DOC_PARAM(null_terminated_name, The unique name for this managed variable.)
DOC_PARAM(default_value, The default value that this variable will have in a scope that has not set this variable.) DOC_PARAM(default_value, The default value that this variable will have in a scope that has not set this variable.)
DOC_RETURN(Returns the Managed_Variable_ID for the new variable on success or zero on failure. This call fails when a variable with the given name alraedy exists.) DOC_RETURN(Returns the Managed_Variable_ID for the new variable on success and zero on failure. This call fails when a variable with the given name alraedy exists.)
DOC(Variables are stored in scopes but creating a variable does not mean that all scopes will allocate space for this variable. Space for variables is allocated sparsly on demand in each scope. Once a variable exists it will exist for the entire duration of the 4coder session and will never have a different id. The id will be used to set and get the value of the variable in managed scopes.) DOC(Variables are stored in scopes but creating a variable does not mean that all scopes will allocate space for this variable. Space for variables is allocated sparsly on demand in each scope. Once a variable exists it will exist for the entire duration of the 4coder session and will never have a different id. The id will be used to set and get the value of the variable in managed scopes.)
DOC_SEE(managed_variable_get_id) DOC_SEE(managed_variable_get_id)
DOC_SEE(managed_variable_create_or_get_id) DOC_SEE(managed_variable_create_or_get_id)
@ -2522,7 +2522,7 @@ API_EXPORT Managed_Variable_ID
Managed_Variable_Get_ID(Application_Links *app, char *null_terminated_name) Managed_Variable_Get_ID(Application_Links *app, char *null_terminated_name)
/* /*
DOC_PARAM(null_terminated_name, The unique name for this managed variable.) DOC_PARAM(null_terminated_name, The unique name for this managed variable.)
DOC_RETURN(Returns the Managed_Variable_ID for the variable on success or zero on failure. This call fails when no variable that already exists has the given name.) DOC_RETURN(Returns the Managed_Variable_ID for the variable on success and zero on failure. This call fails when no variable that already exists has the given name.)
DOC_SEE(managed_variable_create) DOC_SEE(managed_variable_create)
DOC_SEE(managed_variable_create_or_get_id) DOC_SEE(managed_variable_create_or_get_id)
*/ */
@ -2610,7 +2610,7 @@ Alloc_Managed_Memory_In_Scope(Application_Links *app, Managed_Scope scope, int32
DOC_PARAM(scope, A handle to the scope in which the new object will be allocated.) DOC_PARAM(scope, A handle to the scope in which the new object will be allocated.)
DOC_PARAM(item_size, The size, in bytes, of a single 'item' in this memory object. This effects the size of the allocation, and the indexing of the memory in the store and load calls.) DOC_PARAM(item_size, The size, in bytes, of a single 'item' in this memory object. This effects the size of the allocation, and the indexing of the memory in the store and load calls.)
DOC_PARAM(count, The number of 'items' allocated for this memory object. The total memory size is item_size*count.) DOC_PARAM(count, The number of 'items' allocated for this memory object. The total memory size is item_size*count.)
DOC_RETURN(Returns the handle to the new object on success, or zero on failure. This call fails if scope does not refer to a valid managed scope.) DOC_RETURN(Returns the handle to the new object on success, and zero on failure. This call fails if scope does not refer to a valid managed scope.)
DOC(Managed objects allocate memory that is tied to the scope. When the scope is cleared or destroyed all of the memory allocated in it is freed in bulk and the handles to the objects never again become valid. Thus the handle returned by this call will only ever refer to this memory allocation.) DOC(Managed objects allocate memory that is tied to the scope. When the scope is cleared or destroyed all of the memory allocated in it is freed in bulk and the handles to the objects never again become valid. Thus the handle returned by this call will only ever refer to this memory allocation.)
*/ */
{ {
@ -2638,7 +2638,7 @@ Alloc_Buffer_Markers_On_Buffer(Application_Links *app, Buffer_ID buffer_id, int3
DOC_PARAM(buffer_id, The id for the buffer onto which these markers will be attached. The markers will live in the scope of the buffer, or in another scope dependent on this buffer, thus guaranteeing that when the buffer is closed, all attached markers are freed in bulk with it.) DOC_PARAM(buffer_id, The id for the buffer onto which these markers will be attached. The markers will live in the scope of the buffer, or in another scope dependent on this buffer, thus guaranteeing that when the buffer is closed, all attached markers are freed in bulk with it.)
DOC_PARAM(count, The number of Marker items allocated in this object. The total memory size is sizeof(Marker)*count.) DOC_PARAM(count, The number of Marker items allocated in this object. The total memory size is sizeof(Marker)*count.)
DOC_PARAM(optional_extra_scope, If this pointer is non-null, then it is treated as a scope with additional dependencies for the allocated markers. In this case, the scope of buffer and extra scope are unioned via get_managed_scope_with_multiple_dependencies and marker object lives in the resulting scope.) DOC_PARAM(optional_extra_scope, If this pointer is non-null, then it is treated as a scope with additional dependencies for the allocated markers. In this case, the scope of buffer and extra scope are unioned via get_managed_scope_with_multiple_dependencies and marker object lives in the resulting scope.)
DOC_RETURN(Returns the handle to the new object on succes, or zero on failure. This call fails if buffer_id does not refer to a valid buffer, or optional_extra_scope does not refer to a valid scope.) DOC_RETURN(Returns the handle to the new object on succes, and zero on failure. This call fails if buffer_id does not refer to a valid buffer, or optional_extra_scope does not refer to a valid scope.)
DOC(The created managed object is essentially a memory object with item size equal to sizeof(Marker). The primary difference is that if the buffer referred to by buffer_id is edited, the position of all markers attached to that buffer can be changed by the core. Thus this not a memory storage so much as position marking and tracking in a buffer.) DOC(The created managed object is essentially a memory object with item size equal to sizeof(Marker). The primary difference is that if the buffer referred to by buffer_id is edited, the position of all markers attached to that buffer can be changed by the core. Thus this not a memory storage so much as position marking and tracking in a buffer.)
DOC_SEE(alloc_managed_memory_in_scope) DOC_SEE(alloc_managed_memory_in_scope)
DOC_SEE(Marker) DOC_SEE(Marker)
@ -2698,7 +2698,7 @@ API_EXPORT Marker_Visual
Create_Marker_Visual(Application_Links *app, Managed_Object object) Create_Marker_Visual(Application_Links *app, Managed_Object object)
/* /*
DOC_PARAM(object, A handle to the marker object on which the new visual will be attached.) DOC_PARAM(object, A handle to the marker object on which the new visual will be attached.)
DOC_RETURN(Returns the handle to the newly created marker visual on success, or zero on failure. This call fails when object does not refer to a valid marker object.) DOC_RETURN(Returns the handle to the newly created marker visual on success, and zero on failure. This call fails when object does not refer to a valid marker object.)
DOC(A marker visual adds graphical effects to markers such as cursors, highlight ranges, text colors, etc. A marker object can have any number of attached visuals. The memory in the 4coder core for visuals is stored in the same scope as the object.) DOC(A marker visual adds graphical effects to markers such as cursors, highlight ranges, text colors, etc. A marker object can have any number of attached visuals. The memory in the 4coder core for visuals is stored in the same scope as the object.)
DOC_SEE(destroy_marker_visuals) DOC_SEE(destroy_marker_visuals)
*/ */
@ -2735,7 +2735,19 @@ get_marker_visual_pointer(Models *models, Marker_Visual visual){
} }
API_EXPORT bool32 API_EXPORT bool32
Marker_Visual_Set_Effect(Application_Links *app, Marker_Visual visual, Marker_Visual_Type type, int_color color, int_color text_color, Marker_Visual_Text_Style text_style){ Marker_Visual_Set_Effect(Application_Links *app, Marker_Visual visual, Marker_Visual_Type type, int_color color, int_color text_color, Marker_Visual_Text_Style text_style)
/*
DOC_PARAM(visual, A handle to the marker visual to be modified by this call.)
DOC_PARAM(type, The new type of visual effect this marker visual will create.)
DOC_PARAM(color, The new color aspect of the effect, exact meaning depends on the type.)
DOC_PARAM(text_color, The new text color aspect of the effect, exact meaning depends on the type.)
DOC_PARAM(text_style, This feature is not yet implemented and the parameter should always be 0.)
DOC_RETURN(Returns non-zero on success, and zero on failure. This call fails when the visual handle does not refer to a valid marker visual.)
DOC(Each effect type uses the color and text_color aspects differently. These aspects can be specified as 32-bit colors, or as "symbolic coloes" which are special values small enough that their alpha channels would be zero as 32-bit color codes. Valid symbolic color values have special rules for evaluation, and sometimes their meaning depends on the effect type too.)
DOC_SEE(Marker_Visuals_Type)
DOC_SEE(Marker_Visuals_Symbolic_Color)
*/
{
Command_Data *cmd = (Command_Data*)app->cmd_context; Command_Data *cmd = (Command_Data*)app->cmd_context;
Models *models = cmd->models; Models *models = cmd->models;
Marker_Visual_Data *data = get_marker_visual_pointer(models, visual); Marker_Visual_Data *data = get_marker_visual_pointer(models, visual);
@ -2744,12 +2756,21 @@ Marker_Visual_Set_Effect(Application_Links *app, Marker_Visual visual, Marker_Vi
data->color = color; data->color = color;
data->text_color = text_color; data->text_color = text_color;
data->text_style = text_style; data->text_style = text_style;
return(true);
} }
return(false); return(false);
} }
API_EXPORT bool32 API_EXPORT bool32
Marker_Visual_Set_Take_Rule(Application_Links *app, Marker_Visual visual, Marker_Visual_Take_Rule take_rule){ Marker_Visual_Set_Take_Rule(Application_Links *app, Marker_Visual visual, Marker_Visual_Take_Rule take_rule)
/*
DOC_PARAM(visual, A handle to the marker visual to be modified by this call.)
DOC_PARAM(take_rule, The new take rule for the marker visual.)
DOC_RETURN(Returns non-zero on success, and zero on failure. This call fails when the visual handle does not refer to a valid marker visual.)
DOC(Marker visuals have take rules so that they do not necessarily effect every marker in the marker object they were created to visualize. The take rule can effect the start of the run of markers, the total number of markers, and the stride of the markers, "taken" by this visual when applying it's effect. The word "take" should not be thought of as reserving a marker to the particular marker visual, multiple visuals may add effects to a single marker. See the documentation for Marker_Visual_Take_Rule for specifics about how the take rule can be configured.)
DOC_SEE(Marker_Visual_Take_Rule)
*/
{
Command_Data *cmd = (Command_Data*)app->cmd_context; Command_Data *cmd = (Command_Data*)app->cmd_context;
Models *models = cmd->models; Models *models = cmd->models;
Marker_Visual_Data *data = get_marker_visual_pointer(models, visual); Marker_Visual_Data *data = get_marker_visual_pointer(models, visual);
@ -2768,48 +2789,84 @@ Marker_Visual_Set_Take_Rule(Application_Links *app, Marker_Visual visual, Marker
else{ else{
data->one_past_last_take_index = max_i32; data->one_past_last_take_index = max_i32;
} }
return(true);
} }
return(false); return(false);
} }
API_EXPORT bool32 API_EXPORT bool32
Marker_Visual_Set_Priority(Application_Links *app, Marker_Visual visual, Marker_Visual_Priority_Level priority){ Marker_Visual_Set_Priority(Application_Links *app, Marker_Visual visual, Marker_Visual_Priority_Level priority)
/*
DOC_PARAM(visual, A handle to the marker visual to be modified by this call.)
DOC_PARAM(priority, The new priority level for this marker visual.)
DOC_RETURN(Returns non-zero on success, and zero on failure. This call fails when the visual handle does not refer to a valid marker visual.)
DOC(Multiple visuals effecting the same position, whether they are on the same marker object, or different marker objects, are sorted by their priority level, so that higher priority levels are displayed when they are in conflict with lower priority levels. Some effects have implicit priorities over other effects which does not take priority level into account, other effects may occur in the same position without being considered "in conflict". See the documentation for each effect for more information these relationships.)
*/
{
Command_Data *cmd = (Command_Data*)app->cmd_context; Command_Data *cmd = (Command_Data*)app->cmd_context;
Models *models = cmd->models; Models *models = cmd->models;
Marker_Visual_Data *data = get_marker_visual_pointer(models, visual); Marker_Visual_Data *data = get_marker_visual_pointer(models, visual);
if (data != 0){ if (data != 0){
data->priority = priority; data->priority = priority;
return(true);
} }
return(false); return(false);
} }
API_EXPORT bool32 API_EXPORT bool32
Marker_Visual_Set_View_Key(Application_Links *app, Marker_Visual visual, View_ID key_view_id){ Marker_Visual_Set_View_Key(Application_Links *app, Marker_Visual visual, View_ID key_view_id)
/*
DOC_PARAM(visual, A handle to the marker visual to be modified by this call.)
DOC_PARAM(key_view_id, The new value of the marker visual's view keying.)
DOC_RETURN(Returns non-zero on success, and zero on failure. This call fails when the visual handle does notrefer to a valid marker visual.)
DOC(View keying allows a marker visual to declare that it only appears in one view. For instance, if a buffer is opened in two views side-by-side, and each view has it's own cursor position, this can be used to make sure that the cursor for one view does not appear in the other view.)
*/
{
Command_Data *cmd = (Command_Data*)app->cmd_context; Command_Data *cmd = (Command_Data*)app->cmd_context;
Models *models = cmd->models; Models *models = cmd->models;
Marker_Visual_Data *data = get_marker_visual_pointer(models, visual); Marker_Visual_Data *data = get_marker_visual_pointer(models, visual);
if (data != 0){ if (data != 0){
data->key_view_id = key_view_id; data->key_view_id = key_view_id;
return(true);
} }
return(false); return(false);
} }
API_EXPORT bool32 API_EXPORT bool32
Destroy_Marker_Visual(Application_Links *app, Marker_Visual visual){ Destroy_Marker_Visual(Application_Links *app, Marker_Visual visual)
/*
DOC_PARAM(visual, A handle to the marker visual to be destroyed.)
DOC_RETURN(Returns non-zero on success, and zero on failure. This call fails when the visual handle does not refer to a valid marker visual.)
*/
{
Command_Data *cmd = (Command_Data*)app->cmd_context; Command_Data *cmd = (Command_Data*)app->cmd_context;
Models *models = cmd->models; Models *models = cmd->models;
Dynamic_Workspace *workspace = get_dynamic_workspace(models, visual.scope); Dynamic_Workspace *workspace = get_dynamic_workspace(models, visual.scope);
if (workspace != 0){ if (workspace != 0){
Marker_Visual_Data *data = dynamic_workspace_get_visual_pointer(workspace, visual.slot_id, visual.gen_id); Marker_Visual_Data *data = dynamic_workspace_get_visual_pointer(workspace, visual.slot_id, visual.gen_id);
if (data != 0){ if (data != 0){
marker_visual_free(&workspace->visual_allocator, data); void *ptr = dynamic_workspace_get_pointer(workspace, data->owner_object&max_u32);
Managed_Object_Standard_Header *header = (Managed_Object_Standard_Header*)ptr;
if (header != 0){
Assert(header->type == ManagedObjectType_Markers);
Managed_Buffer_Markers_Header *markers = (Managed_Buffer_Markers_Header*)header;
zdll_remove(markers->visual_first, markers->visual_last, data);
markers->visual_count -= 1;
marker_visual_free(&workspace->visual_allocator, data);
return(true);
}
} }
} }
return(false); return(false);
} }
API_EXPORT int32_t API_EXPORT int32_t
Buffer_Markers_Get_Attached_Visual_Count(Application_Links *app, Managed_Object object){ Buffer_Markers_Get_Attached_Visual_Count(Application_Links *app, Managed_Object object)
/*
DOC_PARAM(object, The handle to the marker object to be queried.)
DOC_RETURN(Returns the number of marker visuals that are currently attached to the given object. If the object handle does not refer to a valid marker object, then this call returns zero.)
*/
{
Command_Data *cmd = (Command_Data*)app->cmd_context; Command_Data *cmd = (Command_Data*)app->cmd_context;
Models *models = cmd->models; Models *models = cmd->models;
Managed_Object_Ptr_And_Workspace object_ptrs = get_dynamic_object_ptrs(models, object); Managed_Object_Ptr_And_Workspace object_ptrs = get_dynamic_object_ptrs(models, object);
@ -2821,7 +2878,13 @@ Buffer_Markers_Get_Attached_Visual_Count(Application_Links *app, Managed_Object
} }
API_EXPORT Marker_Visual* API_EXPORT Marker_Visual*
Buffer_Markers_Get_Attached_Visual(Application_Links *app, Partition *part, Managed_Object object){ Buffer_Markers_Get_Attached_Visual(Application_Links *app, Partition *part, Managed_Object object)
/*
DOC_PARAM(part, The arena to be used to allocate the returned array.)
DOC_PARAM(object, The handle to the marker object to be queried.)
DOC_RETURN(Pushes an array onto part containing the handle to every marker visual attached to this object, and returns the pointer to it's base. If the object does not refer to a valid marker object or there is not enough space in part to allocate the array, then a null pointer is returned.)
*/
{
Command_Data *cmd = (Command_Data*)app->cmd_context; Command_Data *cmd = (Command_Data*)app->cmd_context;
Models *models = cmd->models; Models *models = cmd->models;
Managed_Object_Ptr_And_Workspace object_ptrs = get_dynamic_object_ptrs(models, object); Managed_Object_Ptr_And_Workspace object_ptrs = get_dynamic_object_ptrs(models, object);
@ -2858,6 +2921,10 @@ get_dynamic_object_memory_ptr(Managed_Object_Standard_Header *header){
API_EXPORT uint32_t API_EXPORT uint32_t
Managed_Object_Get_Item_Size(Application_Links *app, Managed_Object object) Managed_Object_Get_Item_Size(Application_Links *app, Managed_Object object)
/*
DOC_PARAM(object, The handle to the managed object to be queried.)
DOC_RETURN(Returns the size, in bytes, of a single item in the managed object. Item size is multiplied by the indices in store and load calls, and it is multiplied by item count to discover the total memory size of the managed object. If object does not refer to a valid managed object, this call returns zero.)
*/
{ {
Command_Data *cmd = (Command_Data*)app->cmd_context; Command_Data *cmd = (Command_Data*)app->cmd_context;
Models *models = cmd->models; Models *models = cmd->models;
@ -2870,6 +2937,10 @@ Managed_Object_Get_Item_Size(Application_Links *app, Managed_Object object)
API_EXPORT uint32_t API_EXPORT uint32_t
Managed_Object_Get_Item_Count(Application_Links *app, Managed_Object object) Managed_Object_Get_Item_Count(Application_Links *app, Managed_Object object)
/*
DOC_PARAM(object, The handle to the managed object to be queried.)
DOC_RETURN(Returns the count of items this object can store, this count is used to range check the indices in store and load calls. If object does not refer to a valid managed object, this call returns zero.)
*/
{ {
Command_Data *cmd = (Command_Data*)app->cmd_context; Command_Data *cmd = (Command_Data*)app->cmd_context;
Models *models = cmd->models; Models *models = cmd->models;
@ -2882,6 +2953,11 @@ Managed_Object_Get_Item_Count(Application_Links *app, Managed_Object object)
API_EXPORT Managed_Object_Type API_EXPORT Managed_Object_Type
Managed_Object_Get_Type(Application_Links *app, Managed_Object object) Managed_Object_Get_Type(Application_Links *app, Managed_Object object)
/*
DOC_PARAM(object, The handle to the managed object to be queried.)
DOC_RETURN(Returns the type of the managed object, see Managed_Object_Type for the enumeration of possible values and their special meanings. If object does not refer to a valid managed object, this call returns ManagedObjectType_Error.)
DOC_SEE(Managed_Object_Type)
*/
{ {
Command_Data *cmd = (Command_Data*)app->cmd_context; Command_Data *cmd = (Command_Data*)app->cmd_context;
Models *models = cmd->models; Models *models = cmd->models;
@ -2898,6 +2974,10 @@ Managed_Object_Get_Type(Application_Links *app, Managed_Object object)
API_EXPORT Managed_Scope API_EXPORT Managed_Scope
Managed_Object_Get_Containing_Scope(Application_Links *app, Managed_Object object) Managed_Object_Get_Containing_Scope(Application_Links *app, Managed_Object object)
/*
DOC_PARAM(object, The handle to the managed object to be queried.)
DOC_RETURN(Returns a handle to the managed scope in which this object is allocated, or zero if object does not refer to a valid managed object.)
*/
{ {
Command_Data *cmd = (Command_Data*)app->cmd_context; Command_Data *cmd = (Command_Data*)app->cmd_context;
Models *models = cmd->models; Models *models = cmd->models;
@ -2911,6 +2991,11 @@ Managed_Object_Get_Containing_Scope(Application_Links *app, Managed_Object objec
API_EXPORT bool32 API_EXPORT bool32
Managed_Object_Free(Application_Links *app, Managed_Object object) Managed_Object_Free(Application_Links *app, Managed_Object object)
/*
DOC_PARAM(object, The handle to the managed object to be freed.)
DOC_RETURN(Returns non-zero on success and zero on failure. This call fails when object does not refer to a valid managed object.)
DOC(Permanently frees the specified object. Not only does this free up the memory this object had allocated, but it also triggers cleanup for some types of managed objects. For instance after markers are freed, any visual effects from the markers are removed as well. See Managed_Object_Type for more information about what cleanup each type performs when it is freed.)
*/
{ {
Command_Data *cmd = (Command_Data*)app->cmd_context; Command_Data *cmd = (Command_Data*)app->cmd_context;
Models *models = cmd->models; Models *models = cmd->models;
@ -2938,6 +3023,16 @@ Managed_Object_Free(Application_Links *app, Managed_Object object)
API_EXPORT bool32 API_EXPORT bool32
Managed_Object_Store_Data(Application_Links *app, Managed_Object object, uint32_t first_index, uint32_t count, void *mem) Managed_Object_Store_Data(Application_Links *app, Managed_Object object, uint32_t first_index, uint32_t count, void *mem)
/*
DOC_PARAM(object, The handle to the managed object in which data will be stored.)
DOC_PARAM(first_index, The first index of the range in the managed object to be stored. Managed object indics are zero based.)
DOC_PARAM(count, The number of items in the managed object to be stored.)
DOC_PARAM(mem, A pointer to the data to be stored, it is expected that the size of this memory is item_size*count, item_size can be queried with managed_object_get_item_size.)
DOC_RETURN(Returns non-zero on success and zero on failure. This call fails when object does not refer to a valid managed object, and when the range of indices overflows the range of this managed object. The range of the managed object can be queried with managed_object_get_item_count.)
DOC(All managed objects, in addition to whatever special behaviors they have, have the ability to store and load data. This storage can have special properties in certain managed object types, for instance, the data stored in marker objects are edited by the core when the buffer to which they are attached is edited. This call stores the data pointed to by mem into the item range specified by first_index and count.)
DOC_SEE(managed_object_get_item_size)
DOC_SEE(managed_object_get_item_count)
*/
{ {
Command_Data *cmd = (Command_Data*)app->cmd_context; Command_Data *cmd = (Command_Data*)app->cmd_context;
Models *models = cmd->models; Models *models = cmd->models;
@ -2957,6 +3052,16 @@ Managed_Object_Store_Data(Application_Links *app, Managed_Object object, uint32_
API_EXPORT bool32 API_EXPORT bool32
Managed_Object_Load_Data(Application_Links *app, Managed_Object object, uint32_t first_index, uint32_t count, void *mem_out) Managed_Object_Load_Data(Application_Links *app, Managed_Object object, uint32_t first_index, uint32_t count, void *mem_out)
/*
DOC_PARAM(object, The handle to the managed object from which data will be loaded.)
DOC_PARAM(first_index, The first index of the range in the managed object to be loaded. Managed object indics are zero based.)
DOC_PARAM(count, The number of items in the managed object to be loaded.)
DOC_PARAM(mem_out, A pointer to the memory where loaded data will be written, it is expected that the size of this memory is item_size*count, item_size can be queried with managed_object_get_item_size.)
DOC_RETURN(Returns non-zero on success and zero on failure. This call fails when object does not refer to a valid managed object, and when the range of indices overflows the range of this managed object. The range of the managed object can be queried with managed_object_get_item_count.)
DOC(All managed objects, in addition to whatever special behaviors they have, have the ability to store and load data. This storage can have special properties in certain managed object types, for instance, the data stored in marker objects are edited by the core when the buffer to which they are attached is edited. This call loads the data from the item range specified by first_index and count into mem_out.)
DOC_SEE(managed_object_get_item_size)
DOC_SEE(managed_object_get_item_count)
*/
{ {
Command_Data *cmd = (Command_Data*)app->cmd_context; Command_Data *cmd = (Command_Data*)app->cmd_context;
Models *models = cmd->models; Models *models = cmd->models;
@ -3013,7 +3118,7 @@ DOC_RETURN(This call returns the input that triggered the currently executing co
DOC_SEE(User_Input) DOC_SEE(User_Input)
*/{ */{
Command_Data *cmd = (Command_Data*)app->cmd_context; Command_Data *cmd = (Command_Data*)app->cmd_context;
User_Input result; User_Input result = {0};
result.type = UserInputKey; result.type = UserInputKey;
result.abort = 0; result.abort = 0;
result.key = cmd->key; result.key = cmd->key;
@ -3021,6 +3126,15 @@ DOC_SEE(User_Input)
return(result); return(result);
} }
API_EXPORT void
Set_Command_Input(Application_Links *app, Key_Event_Data key_data)
/*
DOC_PARAM(key_data, The new value of the "command input". Setting this effects the result returned by get_command_input until the end of this command.)
*/{
Command_Data *cmd = (Command_Data*)app->cmd_context;
cmd->key = key_data;
}
API_EXPORT Mouse_State API_EXPORT Mouse_State
Get_Mouse_State(Application_Links *app) Get_Mouse_State(Application_Links *app)
/* /*
@ -3085,6 +3199,9 @@ DOC(This call posts a string to the *messages* buffer.)
API_EXPORT int32_t API_EXPORT int32_t
Get_Theme_Count(Application_Links *app) Get_Theme_Count(Application_Links *app)
/*
DOC_RETURN(Returns the number of themes that currently exist in the core.)
*/
{ {
Command_Data *cmd = (Command_Data*)app->cmd_context; Command_Data *cmd = (Command_Data*)app->cmd_context;
Style_Library *library = &cmd->models->styles; Style_Library *library = &cmd->models->styles;
@ -3093,10 +3210,14 @@ Get_Theme_Count(Application_Links *app)
API_EXPORT String API_EXPORT String
Get_Theme_Name(Application_Links *app, struct Partition *arena, int32_t index) Get_Theme_Name(Application_Links *app, struct Partition *arena, int32_t index)
/*
DOC_PARAM(arena, The arena which will be used to allocate the returned string.)
DOC_PARAM(index, The index of the theme to query. Index zero always refers to the active theme, all other indices refer to the static copies of available themes.)
DOC_RETURN(On success this call returns a string allocated on arena that is the name of the queried theme, on failure a null string is returned. This call fails when index is not less than the total number of themes, and when there is not enough space in arena to allocate the return string.)
*/
{ {
Command_Data *cmd = (Command_Data*)app->cmd_context; Command_Data *cmd = (Command_Data*)app->cmd_context;
Style_Library *library = &cmd->models->styles; Style_Library *library = &cmd->models->styles;
String str = {0}; String str = {0};
if (0 <= index && index < library->count){ if (0 <= index && index < library->count){
Style *style = &library->styles[index]; Style *style = &library->styles[index];
@ -3109,7 +3230,6 @@ Get_Theme_Name(Application_Links *app, struct Partition *arena, int32_t index)
str.str[str.size] = 0; str.str[str.size] = 0;
} }
} }
return(str); return(str);
} }
@ -3168,6 +3288,10 @@ DOC(This call changes 4coder's color pallet to one of the built in themes.)
API_EXPORT bool32 API_EXPORT bool32
Change_Theme_By_Index(Application_Links *app, int32_t index) Change_Theme_By_Index(Application_Links *app, int32_t index)
/*
DOC_PARAM(index, The index parameter specifies the index of theme to begin using.)
DOC_RETURN(Returns non-zero on success and zero on failure. This call fails when index is not less than the total number of themes.)
*/
{ {
Command_Data *cmd = (Command_Data*)app->cmd_context; Command_Data *cmd = (Command_Data*)app->cmd_context;
Style_Library *styles = &cmd->models->styles; Style_Library *styles = &cmd->models->styles;

View File

@ -56,24 +56,6 @@ enum{
MDFR_SHIFT = 0x8, MDFR_SHIFT = 0x8,
}; };
global char long_commands_str[] = R"foo(
\SECTION{4coder Long Command}
Long name commands that can be typed in after using the "long command" command for infrequently triggered commands.
\LIST
\ITEM \STYLE{code} "load project" \END Load a project.4coder file, ditching any previously loaded project
\ITEM \STYLE{code} "open all code" \END Open all code files in the current directory, extensions set in config.4coder, default to C/C++ extensions
\ITEM \STYLE{code} "open all code recursive" \END Like \STYLE{code} "open all code" \END but recurses through folders
\ITEM \STYLE{code} "dos lines" \END Switch the buffer to 'dos' line ending mode CRLF
\ITEM \STYLE{code} "nix lines" \END Switch the buffer to 'nix' line ending mode LF
\ITEM \STYLE{code} "remap" \END Change to one of the built in command bindings
\ITEM \STYLE{code} "new project" \END Setup a new project.4coder and accompanying build scripts
\ITEM \STYLE{code} "delete file" \END Delete the file attached to the current buffer and close the buffer
\ITEM \STYLE{code} "rename file" \END Rename the file attached to the current buffer and reopen the buffer
\ITEM \STYLE{code} "mkdir" \END Make a new directory in 4coder's hot directory
\END
\END
)foo";
internal void internal void
generate_binding_list(char *code_directory, char *src_directory){ generate_binding_list(char *code_directory, char *src_directory){
char full_path[512]; char full_path[512];
@ -104,8 +86,6 @@ generate_binding_list(char *code_directory, char *src_directory){
} }
fprintf(out, "\\END\n"); fprintf(out, "\\END\n");
fprintf(out, long_commands_str);
for (i32 i = 0; i < ArrayCount(fcoder_meta_maps); ++i){ for (i32 i = 0; i < ArrayCount(fcoder_meta_maps); ++i){
Meta_Mapping *mapping = &fcoder_meta_maps[i]; Meta_Mapping *mapping = &fcoder_meta_maps[i];

View File

@ -1,3 +1,4 @@
\INCLUDE{site_header.txt} \INCLUDE{site_header.txt}
4coder version \VERSION 4coder version \VERSION
@ -6,22 +7,6 @@
\ITEM \STYLE{code} "default" \END The default 4coder bindings - typically good for Windows and Linux \ITEM \STYLE{code} "default" \END The default 4coder bindings - typically good for Windows and Linux
\ITEM \STYLE{code} "mac-default" \END Default 4coder bindings on a Mac keyboard \ITEM \STYLE{code} "mac-default" \END Default 4coder bindings on a Mac keyboard
\END \END
\SECTION{4coder Long Command}
Long name commands that can be typed in after using the "long command" command for infrequently triggered commands.
\LIST
\ITEM \STYLE{code} "load project" \END Load a project.4coder file, ditching any previously loaded project
\ITEM \STYLE{code} "open all code" \END Open all code files in the current directory, extensions set in config.4coder, default to C/C++ extensions
\ITEM \STYLE{code} "open all code recursive" \END Like \STYLE{code} "open all code" \END but recurses through folders
\ITEM \STYLE{code} "dos lines" \END Switch the buffer to 'dos' line ending mode CRLF
\ITEM \STYLE{code} "nix lines" \END Switch the buffer to 'nix' line ending mode LF
\ITEM \STYLE{code} "remap" \END Change to one of the built in command bindings
\ITEM \STYLE{code} "new project" \END Setup a new project.4coder and accompanying build scripts
\ITEM \STYLE{code} "delete file" \END Delete the file attached to the current buffer and close the buffer
\ITEM \STYLE{code} "rename file" \END Rename the file attached to the current buffer and reopen the buffer
\ITEM \STYLE{code} "mkdir" \END Make a new directory in 4coder's hot directory
\END
\END
\SECTION{Map: default} \SECTION{Map: default}
\SECTION{mapid-global} \SECTION{mapid-global}
The following bindings apply in all situations. The following bindings apply in all situations.
@ -223,7 +208,7 @@ The following bindings apply in all situations.
\ITEM \STYLE{code} <ctrl N> \END If a buffer containing jump locations has been locked in, goes to the previous jump in the buffer, skipping sub jump locations. \ITEM \STYLE{code} <ctrl N> \END If a buffer containing jump locations has been locked in, goes to the previous jump in the buffer, skipping sub jump locations.
\ITEM \STYLE{code} <ctrl M> \END If a buffer containing jump locations has been locked in, goes to the first jump in the buffer. \ITEM \STYLE{code} <ctrl M> \END If a buffer containing jump locations has been locked in, goes to the first jump in the buffer.
\ITEM \STYLE{code} <ctrl m> \END Looks for a build.bat, build.sh, or makefile in the current and parent directories. Runs the first that it finds and prints the output to *compilation*. Puts the *compilation* buffer in a panel at the footer of the current view. \ITEM \STYLE{code} <ctrl m> \END Looks for a build.bat, build.sh, or makefile in the current and parent directories. Runs the first that it finds and prints the output to *compilation*. Puts the *compilation* buffer in a panel at the footer of the current view.
\ITEM \STYLE{code} <alt b> \END Toggles the visibility status of the current view's filebar. \ITEM \STYLE{code} <ctrl b> \END Toggles the visibility status of the current view's filebar.
\ITEM \STYLE{code} <ctrl z> \END Queries for an output buffer name and system command, runs the system command as a CLI and prints the output to the specified buffer. \ITEM \STYLE{code} <ctrl z> \END Queries for an output buffer name and system command, runs the system command as a CLI and prints the output to the specified buffer.
\ITEM \STYLE{code} <ctrl Z> \END If the command execute_any_cli has already been used, this will execute a CLI reusing the most recent buffer name and command. \ITEM \STYLE{code} <ctrl Z> \END If the command execute_any_cli has already been used, this will execute a CLI reusing the most recent buffer name and command.
\ITEM \STYLE{code} <ctrl x> \END Opens an interactive list of all registered commands. \ITEM \STYLE{code} <ctrl x> \END Opens an interactive list of all registered commands.

View File

@ -1240,7 +1240,19 @@ non-zero if dest does not run out of space in the underlying memory.) */{
// //
API_EXPORT FSTRING_LINK void API_EXPORT FSTRING_LINK void
string_interpret_escapes(String src, char *dst){ string_interpret_escapes(String src, char *dst)
/* DOC(Rewrites a string with escape sequences into a flattened string. In particular:
"\\" becomes "\"
"\n" becomes LF
"\t" becomes TAB
"\"" becomes """
"0" becomes NULL
) */{
i32_4tech mode = 0; i32_4tech mode = 0;
i32_4tech j = 0; i32_4tech j = 0;
for (i32_4tech i = 0; i < src.size; ++i){ for (i32_4tech i = 0; i < src.size; ++i){

126
todo.txt
View File

@ -3,16 +3,11 @@
Features Features
{ {
[] Declarative system for keyword direct coloring [] Declarative system for keyword direct coloring
[] set_command_input
} }
Bugs Bugs
{ {
[x] Before '.' name matches don't sort to the top like they're supposed to.
[x] notepad like mode - select scope range snap shouldn't happen
[x] highlight high priority vs block low priority should win
[x] new files don't get their automatically inserted comments anymore
[x] nodepad like mode - when moving the cursor in a non-active view, there is no marker snap
[x] notepad like mode - can't tell which view is active, only highlight line in active view?
Repro Needed Repro Needed
{ {
} }
@ -24,64 +19,6 @@
Documentation Documentation
{ {
[x] buffer_get_managed_scope
[x] view_get_managed_scope
[x] view_start_ui_mode
[x] view_end_ui_mode
[x] view_set_ui
[x] view_get_ui_copy
[x] create_user_managed_scope
[x] destroy_user_managed_scope
[x] get_global_managed_scope
[x] get_managed_scope_with_multiple_dependencies
[x] managed_scope_clear_contents
[x] clear_managed_scope_and_all_dependent_scopes
[x] managed_variable_create
[x] managed_variable_get_id
[x] managed_variable_create_or_get_id
[x] managed_variable_set
[x] managed_variable_get
[x] alloc_managed_memory_in_scope
[x] alloc_buffer_markers_on_buffer
[x] create_marker_visuals
[] marker_visuals_set_look
[] marker_visuals_set_take_rule
[] marker_visuals_set_priority
[] marker_visuals_set_view_key
[] destroy_marker_visuals
[] buffer_markers_get_attached_visuals_count
[] buffer_markers_get_attached_visuals
[] managed_object_get_item_size
[] managed_object_get_item_count
[] managed_object_get_type
[] managed_object_get_containing_scope
[] managed_object_free
[] managed_object_store_data
[] managed_object_load_data
[] get_theme_count
[] get_theme_name
[] change_theme_by_index
[] Buffer_Kill_Result
[] Range_Array
[] Managed_Object_Type
[] Managed_Scope
[] Managed_Variable_ID
[] Managed_Object
[] Marker_Visuals
[] Marker_Visuals_Type
[] Marker_Visuals_Symbolic_Color
[] Marker_Visuals_Text_Style
[] Marker_Visuals_Take_Rule
[] Marker_Visuals_Priority_Level
[] UI_Item_Type
[] UI_Activation_Level
[] UI_Coordinate_System
[] UI_Item
[] UI_Item_Node
[] UI_List
[] UI_Control
[] Buffer_Name_Conflict_Entry
[] string_interpret_escapes
} }
} }
@ -195,5 +132,66 @@ Change Log
[x] Cleanup names in Marker_Visuals API [x] Cleanup names in Marker_Visuals API
} }
NEW THINGS
{
[x] buffer_get_managed_scope
[x] view_get_managed_scope
[x] view_start_ui_mode
[x] view_end_ui_mode
[x] view_set_ui
[x] view_get_ui_copy
[x] create_user_managed_scope
[x] destroy_user_managed_scope
[x] get_global_managed_scope
[x] get_managed_scope_with_multiple_dependencies
[x] managed_scope_clear_contents
[x] clear_managed_scope_and_all_dependent_scopes
[x] managed_variable_create
[x] managed_variable_get_id
[x] managed_variable_create_or_get_id
[x] managed_variable_set
[x] managed_variable_get
[x] alloc_managed_memory_in_scope
[x] alloc_buffer_markers_on_buffer
[x] create_marker_visuals
[x] marker_visuals_set_look
[x] marker_visuals_set_take_rule
[x] marker_visuals_set_priority
[x] marker_visuals_set_view_key
[x] destroy_marker_visuals
[x] buffer_markers_get_attached_visuals_count
[x] buffer_markers_get_attached_visuals
[x] managed_object_get_item_size
[x] managed_object_get_item_count
[x] managed_object_get_type
[x] managed_object_get_containing_scope
[x] managed_object_free
[x] managed_object_store_data
[x] managed_object_load_data
[x] get_theme_count
[x] get_theme_name
[x] change_theme_by_index
[x] Buffer_Kill_Result
[x] Range_Array
[x] Managed_Object_Type
[x] Managed_Scope
[x] Managed_Variable_ID
[x] Managed_Object
[x] Marker_Visuals
[x] Marker_Visuals_Type
[x] Marker_Visuals_Symbolic_Color
[x] Marker_Visuals_Text_Style
[x] Marker_Visuals_Take_Rule
[x] Marker_Visuals_Priority_Level
[x] UI_Item_Type
[x] UI_Activation_Level
[x] UI_Coordinate_System
[x] UI_Item
[x] UI_Item_Node
[x] UI_List
[x] UI_Control
[x] string_interpret_escapes
}
} }