diff --git a/4coder_API.html b/4coder_API.html
index 1c42b978..34327fca 100644
--- a/4coder_API.html
+++ b/4coder_API.html
@@ -95,6 +95,49 @@ Coming Soon
§3.2 Type List
§3.3 Function Descriptions
@@ -978,19 +1021,47 @@ when it is no longer in use.
void* app->memory_allocate(
Application_Links *app,
int32_t size
)
-Description
TODO
+Parameters
+
size
+
The size in bytes of the block that should be returned.
+
+Description
This calls to a low level OS allocator which means it is best used
+for infrequent, large allocations. The size of the block must be remembered
+if it will be freed or if it's mem protection status will be changed.
See Also
§3.3.52: memory_set_protection
bool32 app->memory_set_protection(
Application_Links *app,
void *ptr,
int32_t size,
Memory_Protect_Flags flags
)
-
Description
TODO
+Parameters
+
ptr
+
The base of the block on which to set memory protection flags.
+
+
+
size
+
The size that was originally used to allocate this block.
+
+
+
flags
+
The new memory protection flags.
+
+Description
This call sets the memory protection flags of a block of memory that was previously
+allocate by memory_allocate.
See Also
§3.3.53: memory_free
void app->memory_free(
-
Application_Links *app,
void *mem,
int32_t size
)
+
Application_Links *app,
void *ptr,
int32_t size
)
-
Description
TODO
+Parameters
+
mem
+
The base of a block to free.
+
+
+
size
+
The size that was originally used to allocate this block.
+
+Description
This call frees a block of memory that was previously allocated by
+memory_allocate.
See Also
§3.3.54: file_exists
bool32 app->file_exists(
@@ -1067,23 +1138,1202 @@ folders.
void app->toggle_fullscreen(
Application_Links *app
)
-No documentation generated for this function, assume it is non-public.
-
+Description
This call tells 4coder to switch into or out of full screen mode.
+The changes of full screen mode do not take effect until the end of the current frame.
+On Windows this call will not work unless 4coder was started in "stream mode".
+Stream mode can be enabled with -S or -F flags on the command line to 4ed.
§3.3.59: is_fullscreen
bool32 app->is_fullscreen(
Application_Links *app
)
-No documentation generated for this function, assume it is non-public.
-
+See Also
§3.3.60: send_exit_signal
void app->send_exit_signal(
Application_Links *app
)
-No documentation generated for this function, assume it is non-public.
-
+See Also
§3.4 Type Descriptions
+
+
§3.4.1: bool32
+
typedef int32_t bool32;
+
Description
bool32 is an alias name to signal that an integer parameter or field is for
+true/false vales.
+
+
§3.4.2: int_color
+
typedef uint32_t int_color;
+
Description
int_color is an alias name to signal that an integer parameter or field is for
+a color value, colors are specified as 24 bit integers in 3 channels: 0xRRGGBB.
+
+
§3.4.3: Key_Code
+
typedef unsigned char Key_Code;
+
Description
Key_Code is the alias for key codes including raw codes and codes translated
+to textual input that takes modifiers into account.
+
+
§3.4.4: Buffer_ID
+
typedef int32_t Buffer_ID;
+
Description
Buffer_ID is used to name a 4coder buffer. Each buffer has a unique id but
+when a buffer is closed it's id may be recycled by future, different buffers.
+
+
§3.4.5: View_ID
+
typedef int32_t View_ID;
+
Description
View_ID is used to name a 4coder view. Each view has a unique id in
+the interval [1,16].
+
+
§3.4.6: Key_Modifier
+
enum Key_Modifier;
+
Description
A Key_Modifier acts as an index for specifying modifiers in arrays.
Values
+
+
+
+
+
+
MDFR_INDEX_COUNT
+
MDFR_INDEX_COUNT is used to specify the number of modifiers supported.
+
+
+
+
§3.4.7: Command_ID
+
enum Command_ID;
+
Description
A Command_ID is used as a name for commands implemented internally in 4coder.
Values
+
cmdid_null
+
cmdid_null is set aside to always be zero and is not associated with any command.
+
+
+
cmdid_undo
+
cmdid_undo performs a standard undo behavior.
+
+
+
cmdid_redo
+
cmdid_redo reperforms an edit that was undone.
+
+
+
cmdid_history_backward
+
cmdid_history_backward performs a step backwards through the file history, which includes previously lost redo branches.
+
+
+
cmdid_history_forward
+
cmdid_history_forward unperforms the previous cmdid_history_backward step if possib.e
+
+
+
cmdid_interactive_new
+
cmdid_interactive_new begins an interactive dialogue to create a new buffer.
+
+
+
cmdid_interactive_open
+
cmdid_interactive_open begins an interactive dialogue to open a file into a buffer.
+
+
+
cmdid_save_as
+
cmdid_save_as does not currently work and is likely to be removed rather that fixed.
+
+
+
cmdid_interactive_switch_buffer
+
cmdid_interactive_switch_buffer begins an interactive dialogue to choose an open buffer to swap into the active view.
+
+
+
cmdid_interactive_kill_buffer
+
cmdid_interactive_kill_buffer begins an interactive dialogue to choose an open buffer to kill.
+
+
+
cmdid_reopen
+
cmdid_reopen reloads the active buffer's associated file and discards the old buffer contents for the reloaded file.
+
+
+
cmdid_save
+
cmdid_save saves the buffer's contents into the associated file.
+
+
+
cmdid_kill_buffer
+
cmdid_kill_buffer tries to kill the active buffer.
+
+
+
cmdid_open_color_tweaker
+
cmdid_open_color_tweaker opens the theme editing GUI.
+
+
+
cmdid_open_config
+
cmdid_open_config opens the configuration menu.
+
+
+
cmdid_open_menu
+
cmdid_open_menu opens the top level menu.
+
+
+
cmdid_open_debug
+
cmdid_open_debug opens the debug information viewer mode.
+
+
+
+
+
+
§3.4.9: Event_Message_Type_ID
+
enum Event_Message_Type_ID;
+
Description
Event_Message_Type_ID is a part of an unfinished feature.
Values
+
EventMessage_NoMessage
+
+
+
+
EventMessage_OpenView
+
+
+
+
+
EventMessage_CloseView
+
+
+
+
+
§3.4.10: Buffer_Batch_Edit_Type
+
enum Buffer_Batch_Edit_Type;
+
Description
A Buffer_Batch_Edit_Type is a type of batch operation.
Values
+
BatchEdit_Normal
+
The BatchEdit_Normal operation is always correct but does the most work.
+
+
+
BatchEdit_PreserveTokens
+
The BatchEdit_PreserveTokens operation is one in which none of the edits add, delete, or change any tokens.
+ This usually applies when whitespace is being replaced with whitespace.
+
+
+
+
§3.4.11: Buffer_Setting_ID
+
enum Buffer_Setting_ID;
+
Description
A Buffer_Setting_ID names a setting in a buffer.
Values
+
BufferSetting_Null
+
BufferSetting_Null is not a valid setting, it is reserved to detect errors.
+
+
+
BufferSetting_Lex
+
The BufferSetting_Lex setting is used to determine whether to store C++ tokens
+ from with the buffer.
+
+
+
BufferSetting_WrapLine
+
The BufferSetting_WrapLine setting is used to determine whether a buffer prefers
+ to be viewed with wrapped lines, individual views can be set to override this value after
+ being tied to the buffer.
+
+
+
BufferSetting_MapID
+
The BufferSetting_MapID setting specifies the id of the command map that should be
+ active when a buffer is active.
+
+
+
BufferSetting_Eol
+
The BufferSetting_Eol setting specifies how line ends should be saved to the backing file.
+ A 1 indicates dos endings "\r\n" and a 0 indicates nix endings "\n".
+
+
+
BufferSetting_Unimportant
+
The BufferSetting_Unimportant setting marks a buffer so that it's dirty state will be completely
+ ignored. This means the "dirty" star is hidden and the buffer can be closed without presenting an
+ "are you sure" dialogue screen.
+
+
+
BufferSetting_ReadOnly
+
The BufferSetting_ReadOnly setting marks a buffer so that it can only be returned from buffer
+ access calls that include an AccessProtected flag.
+
+
+
+
§3.4.12: View_Setting_ID
+
enum View_Setting_ID;
+
Description
A View_Setting_ID names a setting in a view.
Values
+
ViewSetting_Null
+
ViewSetting_Null is not a valid setting, it is reserved to detect errors.
+
+
+
ViewSetting_WrapLine
+
The ViewSetting_WrapLine setting determines whether the view applies line wrapping
+ at the border of the panel for long lines. Whenever the view switches to a new buffer it
+ will reset this setting to match the 'preferred' line wrapping setting of the buffer.
+
+
+
ViewSetting_ShowWhitespace
+
The ViewSetting_ShowWhitespace setting determines whether the view highlights
+ whitespace in a file. Whenever the view switches to a new buffer this setting is turned off.
+
+
+
ViewSetting_ShowScrollbar
+
The ViewSetting_ShowScrollbar setting determines whether a scroll bar is
+ attached to a view in it's scrollable section.
+
+
+
+
§3.4.13: Mouse_Cursor_Show_Type
+
enum Mouse_Cursor_Show_Type;
+
Description
A Mouse_Cursor_Show_Type value specifes a mode for 4coder to handle the mouse cursor.
Values
+
MouseCursorShow_Never
+
The MouseCursorShow_Never mode never shows the cursor.
+
+
+
MouseCursorShow_Always
+
The MouseCursorShow_Never mode always shows the cursor.
+
+
+
+
§3.4.14: Buffer_Seek_Type
+
enum Buffer_Seek_Type;
+
Description
The Buffer_Seek_Type is is used in a Buffer_Seek to identify which
+coordinates are suppose to be used for the seek.
Values
+
buffer_seek_pos
+
This value indicates absolute positioning where positions are measured as the number of bytes from the start of the file.
+
+
+
buffer_seek_wrapped_xy
+
This value indicates xy positioning with wrapped lines where the x and y values are in pixels.
+
+
+
buffer_seek_unwrapped_xy
+
This value indicates xy positioning with unwrapped lines where the x and y values are in pixels.
+
+
+
buffer_seek_line_char
+
This value indicates line-character, or line-column positioning. These coordinates are 1 based to match standard line numbering.
+
+
See Also
+
+
§3.4.15: View_Split_Position
+
enum View_Split_Position;
+
Description
A View_Split_Position specifies where a new view should be placed as a result of
+a view split operation.
Values
+
ViewSplit_Top
+
This value indicates that the new view should be above the existing view.
+
+
+
ViewSplit_Bottom
+
This value indicates that the new view should be below the existing view.
+
+
+
ViewSplit_Left
+
This value indicates that the new view should be left of the existing view.
+
+
+
ViewSplit_Right
+
This value indicates that the new view should be right of the existing view.
+
+
+
+
§3.4.16: Key_Modifier_Flag
+
enum Key_Modifier_Flag;
+
Description
A Key_Modifier_Flag field is used to specify a specific state of modifiers.
+Flags can be combined with bit or to specify a state with multiple modifiers.
Flags
+
MDFR_NONE = 0x0
+
MDFR_NONE specifies that no modifiers are pressed.
+
+
+
+
+
+
+
§3.4.17: Memory_Protect_Flags
+
enum Memory_Protect_Flags;
+
Description
TODO
Flags
+
MemProtect_Read = 0x1
+
+
+
+
MemProtect_Write = 0x2
+
+
+
+
MemProtect_Execute = 0x4
+
+
+
+
+
§3.4.18: Buffer_Create_Flag
+
enum Buffer_Create_Flag;
+
Description
A Buffer_Create_Flag field specifies how a buffer should be created.
Flags
+
BufferCreate_Background = 0x1
+
BufferCreate_Background is not currently implemented.
+
+
+
BufferCreate_AlwaysNew = 0x2
+
When BufferCreate_AlwaysNew is set it indicates the buffer should be
+ cleared to empty even if it's associated file already has content.
+
+
+
BufferCreate_NeverNew = 0x4
+
When BufferCreate_NeverNew is set it indicates that the buffer should
+ only be created if it is an existing file or an open buffer.
+
+
+
+
§3.4.19: Buffer_Kill_Flag
+
enum Buffer_Kill_Flag;
+
Description
A Buffer_Kill_Flag field specifies how a buffer should be killed.
Flags
+
BufferKill_Background = 0x1
+
BufferKill_Background is not currently implemented.
+
+
+
BufferKill_AlwaysKill = 0x2
+
When BufferKill_AlwaysKill is set it indicates the buffer should be killed
+ without asking, even when the buffer is dirty.
+
+
+
+
§3.4.20: Access_Flag
+
enum Access_Flag;
+
Description
An Access_Flag field specifies what sort of permission you grant to an
+access call. An access call is usually one the returns a summary struct. If a
+4coder object has a particular protection flag set and the corresponding bit is
+not set in the access field, that 4coder object is hidden. On the other hand if
+a protection flag is set in the access parameter and the object does not have
+that protection flag, the object is still returned from the access call.
Flags
+
AccessOpen = 0x0
+
AccessOpen does not include any bits, it indicates that the access should
+ only return objects that have no protection flags set.
+
+
+
AccessProtected = 0x1
+
AccessProtected is set on buffers and views that are "read only" such as
+ the output from an app->exec_system_command call such as *build*. This is to prevent
+ the user from accidentally editing output that they might prefer to keep in tact.
+
+
+
AccessHidden = 0x2
+
AccessHidden is set on any view that is not currently showing it's file, for
+ instance because it is navigating the file system to open a file.
+
+
+
AccessAll = 0xFF
+
AccessAll is a catchall access for cases where an access call should always
+ return an object no matter what it's protection flags are.
+
+
+
+
§3.4.21: Seek_Boundary_Flag
+
enum Seek_Boundary_Flag;
+
Description
A Seek_Boundary_Flag field specifies a set of "boundary" types used in seeks for the
+beginning or end of different types of words.
Flags
+
BoundaryWhitespace = 0x1
+
+
+
+
+
BoundaryAlphanumeric = 0x4
+
+
+
+
BoundaryCamelCase = 0x8
+
+
+
+
+
+
§3.4.23: Auto_Indent_Flag
+
enum Auto_Indent_Flag;
+
Description
An Auto_Indent_Flag field specifies the behavior of an auto indentation operation.
Flags
+
AutoIndent_ClearLine = 0x1
+
If AutoIndent_ClearLine is set, then any line that is only whitespace will
+ be cleared to contain nothing at all. otherwise the line is filled with whitespace
+ to match the nearby indentation.
+
+
+
AutoIndent_UseTab = 0x2
+
If AutoIndent_UseTab is set, then when putting in leading whitespace to align
+ code, as many tabs will be used as possible until the fine grained control of spaces
+ is needed to finish the alignment.
+
+
+
+
§3.4.24: Set_Buffer_Flag
+
enum Set_Buffer_Flag;
+
Description
A Set_Buffer_Flag field specifies the behavior of an operation that sets the buffer of a view.
Flags
+
SetBuffer_KeepOriginalGUI = 0x1
+
If SetBuffer_KeepOriginalGUI then when the file is set, the view will not switch to it
+ if some other GUI was currently up, otherwise any GUI that is up is closed and the view
+ switches to the file.
+
+
+
+
+
§3.4.26: Generic_Command
+
union Generic_Command {
+
+Command_ID cmdid;
+Custom_Command_Function * command;
+
+};
+
+
Description
Generic_Command acts as a name for a command, and can name an
+internal command or a custom command.
Fields
+
cmdid
+
If this Generic_Command represents an internal command the cmdid field
+ will have a value less than cmdid_count, and this field is the command id for the command.
+
+
+
command
+
If this Generic_Command does not represent an internal command the command
+ field is the pointer to the custom command..
+
+
+
+
§3.4.27: Key_Event_Data
+
struct Key_Event_Data {
+
+Key_Code keycode;
+Key_Code character;
+Key_Code character_no_caps_lock;
+char modifiers[MDFR_INDEX_COUNT];
+
+};
+
+
Description
Key_Event_Data describes a key event, including the
+translation to a character, the translation to
+a character ignoring the state of caps lock, and
+an array of all the modifiers that were pressed
+at the time of the event.
Fields
+
keycode
+
This field is the raw keycode which is always non-zero in valid key events.
+
+
+
character
+
This field is the keycode after translation to a character, this is 0 if there is no translation.
+
+
+
character_no_caps_lock
+
This field is like the field character, except that the state of caps lock is ignored in the translation.
+
+
+
modifiers
+
This field is an array indicating the state of modifiers at the time of the key press.
+ The array is indexed using the values of Key_Modifier. A 1 indicates that the corresponding
+ modifier was held, and a 0 indicates that it was not held.
+
+
+
+
§3.4.28: Mouse_State
+
struct Mouse_State {
+
+char l;
+char r;
+char press_l;
+char press_r;
+char release_l;
+char release_r;
+char wheel;
+char out_of_window;
+int32_t x;
+int32_t y;
+
+};
+
+
Description
Mouse_State describes an entire mouse state complete with the position,
+left and right button states, the wheel state, and whether or not the
+mouse if in the window.
Fields
+
l
+
This field indicates that the left button is held.
+
+
+
r
+
This field indicates that the right button is held.
+
+
+
press_l
+
This field indicates that the left button was pressed this frame.
+
+
+
press_r
+
This field indicates that the right button was pressed this frame.
+
+
+
release_l
+
This field indicates that the left button was released this frame.
+
+
+
release_r
+
This field indicates that the right button was released this frame.
+
+
+
wheel
+
This field is 0 when the wheel has not moved, it is 1 for a downward motion and -1 for an upward motion.
+
+
+
out_of_window
+
This field indicates that the mouse is outside of the window.
+
+
+
x
+
This field contains the x position of the mouse relative to the window where the left side is 0.
+
+
+
y
+
This field contains the y position of the mouse relative to the window where the top side is 0.
+
+
+
+
§3.4.29: Range
+
union Range {
+
+struct {
+
+int32_t min;
+int32_t max;
+
+};
+struct {
+
+int32_t start;
+int32_t end;
+
+};
+
+};
+
+
Description
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.
+
+Throughout the API ranges are thought of in the form [min,max
Fields
+
min
+
This is the smaller value in the range, it is also the 'start'.
+
+
+
max
+
This is the larger value in the range, it is also the 'end'.
+
+
+
start
+
This is the start of the range, it is also the 'min'.
+
+
+
end
+
This is the end of the range, it is also the 'max'.
+
+
+
+
§3.4.30: File_Info
+
struct File_Info {
+
+char * filename;
+int32_t filename_len;
+int32_t folder;
+
+};
+
+
Description
File_Info describes the name and type of a file.
Fields
+
filename
+
This field is a null terminated string specifying the name of the file.
+
+
+
filename_len
+
This field specifies the length of the filename string not counting the null terminator.
+
+
+
folder
+
This field indicates that the description is for a folder not a file.
+
+
See Also
+
+
§3.4.31: File_List
+
struct File_List {
+
+void * block;
+File_Info * infos;
+int32_t count;
+int32_t block_size;
+
+};
+
+
Description
File_List is a list of File_Info structs.
Fields
+
block
+
This field is for inernal use.
+
+
+
infos
+
This field is an array of File_Info structs.
+
+
+
count
+
This field specifies the number of struts in the info array.
+
+
+
block_size
+
This field is for internal use.
+
+
+
+
§3.4.32: Buffer_Identifier
+
struct Buffer_Identifier {
+
+char * name;
+int32_t name_len;
+int32_t id;
+
+};
+
+
Description
Buffer_Identifier acts as a loosely typed description of a buffer that
+can either be a name or an id. If the
Fields
+
name
+
This field is the name of the buffer; it need not be null terminated.
+ If id is specified this pointer should be NULL.
+
+
+
name_len
+
This field specifies the length of the name string.
+
+
+
id
+
This field is the id of the buffer. If name is specified this should be 0.
+
+
+
+
+
§3.4.34: Full_Cursor
+
struct Full_Cursor {
+
+int32_t pos;
+int32_t line;
+int32_t character;
+float unwrapped_x;
+float unwrapped_y;
+float wrapped_x;
+float wrapped_y;
+
+};
+
+
Description
Full_Cursor describes the position of a cursor in every buffer
+coordinate system supported by 4coder. This cursor type requires that
+the buffer is associated with a view to give the x/y values meaning.
Fields
+
pos
+
This field contains the cursor's position in absolute positioning.
+
+
+
line
+
This field contains the number of the line where the cursor is located. This field is one based.
+
+
+
character
+
This field contains the number of the column where the cursor is located. This field is one based.
+
+
+
unwrapped_x
+
This field contains the x position measured with unwrapped lines.
+
+
+
unwrapped_y
+
This field contains the y position measured with unwrapped lines.
+
+
+
wrapped_x
+
This field contains the x position measured with wrapped lines.
+
+
+
wrapped_y
+
This field contains the y position measured with wrapped lines.
+
+
See Also
+
+
§3.4.35: Partial_Cursor
+
struct Partial_Cursor {
+
+int32_t pos;
+int32_t line;
+int32_t character;
+
+};
+
+
Description
Partial_Cursor describes the position of a cursor in all of
+the coordinate systems that a invariant to the View. In other words
+the coordinate systems available here can be used on a buffer that is
+not currently associated with a View.
Fields
+
pos
+
This field contains the cursor's position in absolute positioning.
+
+
+
line
+
This field contains the number of the line where the cursor is located. This field is one based.
+
+
+
character
+
This field contains the number of the column where the cursor is located. This field is one based.
+
+
See Also
+
+
§3.4.36: Buffer_Seek
+
struct Buffer_Seek {
+
+Buffer_Seek_Type type;
+union {
+
+struct {
+
+int32_t pos;
+
+};
+struct {
+
+bool32 round_down;
+float x;
+float y;
+
+};
+struct {
+
+int32_t line;
+int32_t character;
+
+};
+
+};
+
+};
+
+
Description
Buffer_Seek describes the destination of a seek operation. There are helpers
+for concisely creating Buffer_Seek structs. They can be found in 4coder_buffer_types.h.
Fields
+
type
+
The type field determines the coordinate system of the seek operation.
+
+
+
pos
+
The pos field specified the pos when the seek is in absolute position.
+
+
+
round_down
+
For xy coordinate seeks, rounding down means that any x in the box of the
+ character lands on that character. For instance when clicking rounding down is the
+ user's expected behavior. Not rounding down means that the right hand portion of
+ the character's box, which is closer to the next character, will land on that next
+ character. The unrounded behavior is the expected behavior when moving vertically
+ and keeping the preferred x.
+
+
+
x
+
The x coordinate for xy type seeks.
+
+
+
y
+
The y coordinate for xy type seeks.
+
+
+
line
+
The line number of a line-character type seek.
+
+
+
character
+
The character number of a line-character type seek.
+
+
See Also
+
+
§3.4.37: Buffer_Edit
+
struct Buffer_Edit {
+
+int32_t str_start;
+int32_t len;
+int32_t start;
+int32_t end;
+
+};
+
+
Description
Buffer_Edit describes a range of a buffer and string to replace that range.
+A Buffer_Edit has to be paired with a string that contains the actual text that
+will be replaced into the buffer.
Fields
+
str_start
+
The str_start field specifies the first character in the accompanying string that corresponds with this edit.
+
+
+
len
+
The len field specifies the length of the string being written into the buffer.
+
+
+
start
+
The start field specifies the start of the range in the buffer to replace in absolute position.
+
+
+
end
+
The end field specifies one past the end of the range in the buffer to replace in absolute position.
+
+
+
+
§3.4.38: Buffer_Summary
+
struct Buffer_Summary {
+
+bool32 exists;
+bool32 ready;
+int32_t buffer_id;
+Access_Flag lock_flags;
+int32_t size;
+int32_t line_count;
+char * file_name;
+int32_t file_name_len;
+char * buffer_name;
+int32_t buffer_name_len;
+bool32 is_lexed;
+int32_t map_id;
+bool32 unwrapped_lines;
+
+};
+
+
Description
Buffer_Summary acts as a handle to a buffer and describes the state of the buffer.
Fields
+
exists
+
This field indicates whether the Buffer_Summary describes a buffer that is open in 4coder.
+ When this field is false the summary is referred to as a "null summary".
+
+
+
ready
+
If this is not a null summary, this field indicates whether the buffer has finished loading.
+
+
+
buffer_id
+
If this is not a null summary this field is the id of the associated buffer.
+ If this is a null summary then buffer_id is 0.
+
+
+
lock_flags
+
If this is not a null summary, this field contains flags describing the protection status of the buffer.
+
+
+
size
+
If this is not a null summary, this field specifies the size of the text in the buffer.
+
+
+
line_count
+
If this is not a null summary, this field specifies the number of lines in the buffer.
+
+
+
file_name
+
If this is not a null summary, this field specifies the file name associated to this buffer.
+
+
+
file_name_len
+
This field specifies the length of the file_name string.
+
+
+
buffer_name
+
If this is not a null summary, this field specifies the name of the buffer.
+
+
+
buffer_name_len
+
This field specifies the length of the buffer_name string.
+
+
+
is_lexed
+
If this is not a null summary, this field indicates whether the buffer is set to lex tokens.
+
+
+
map_id
+
If this is not a null summary, this field specifies the id of the command map for this buffer.
+
+
+
unwrapped_lines
+
If this is not a null summary, this field indicates whether the buffer 'prefers' wrapped lines.
+
+
See Also
+
+
§3.4.39: View_Summary
+
struct View_Summary {
+
+bool32 exists;
+int32_t view_id;
+int32_t buffer_id;
+Access_Flag lock_flags;
+Full_Cursor cursor;
+Full_Cursor mark;
+float preferred_x;
+float line_height;
+bool32 unwrapped_lines;
+bool32 show_whitespace;
+i32_Rect file_region;
+GUI_Scroll_Vars scroll_vars;
+
+};
+
+
Description
View_Summary acts as a handle to a view and describes the state of the view.
Fields
+
exists
+
This field indicates whether the View_Summary describes a view that is open in 4coder.
+ When this field is false the summary is referred to as a "null summary".
+
+
+
view_id
+
If this is not a null summary, this field is the id of the associated view.
+ If this is a null summary then view_id is 0.
+
+
+
buffer_id
+
If this is not a null summary, and this view looks at a buffer, this is the id of the buffer.
+
+
+
lock_flags
+
If this is not a null summary, this field contains flags describing the protection status of the view.
+
+
+
cursor
+
If this is not a null summary, this describes the position of the cursor.
+
+
+
mark
+
If this is not a null summary, this describes the position of the mark.
+
+
+
preferred_x
+
If this is not a null summary, this is the x position that is maintained in vertical navigation.
+
+
+
line_height
+
If this is not a null summary, this specifies the height of a line rendered in the view.
+
+
+
unwrapped_lines
+
If this is not a null summary, this indicates that the view is set to render with unwrapped lines.
+
+
+
show_whitespace
+
If this is not a null summary, this indicates that the view is set to highlight white space.
+
+
+
file_region
+
If this is not a null summary, this describes the screen position in which this view's buffer is displayed.
+
+
+
scroll_vars
+
If this is not a null summary, this describes the scrolling position inside the view.
+
+
See Also
+
+
+
§3.4.41: Query_Bar
+
struct Query_Bar {
+
+String prompt;
+String string;
+
+};
+
+
Description
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.
Fields
+
prompt
+
This specifies the prompt portion of the drop down bar.
+
+
+
string
+
This specifies the main string portion of the drop down bar.
+
+
+
+
§3.4.42: Event_Message
+
struct Event_Message {
+
+int32_t type;
+
+};
+
+
Description
This feature is not implemented.
Fields
+
type
+
This feature is not implemented.
+
+
+
+
§3.4.43: Theme_Color
+
struct Theme_Color {
+
+Style_Tag tag;
+int_color color;
+
+};
+
+
Description
Theme_Color stores a style tag/color pair, for the purpose of setting and getting colors in the theme .
Fields
+
+
See Also
§4 String Library
§4.1 String Intro
diff --git a/4coder_custom_api.h b/4coder_custom_api.h
index b5a51bea..8d30bb89 100644
--- a/4coder_custom_api.h
+++ b/4coder_custom_api.h
@@ -50,7 +50,7 @@
#define FREE_FILE_LIST_SIG(n) void n(Application_Links *app, File_List list)
#define MEMORY_ALLOCATE_SIG(n) void* n(Application_Links *app, int32_t size)
#define MEMORY_SET_PROTECTION_SIG(n) bool32 n(Application_Links *app, void *ptr, int32_t size, Memory_Protect_Flags flags)
-#define MEMORY_FREE_SIG(n) void n(Application_Links *app, void *mem, int32_t size)
+#define MEMORY_FREE_SIG(n) void n(Application_Links *app, void *ptr, int32_t size)
#define FILE_EXISTS_SIG(n) bool32 n(Application_Links *app, char *filename, int32_t len)
#define DIRECTORY_CD_SIG(n) bool32 n(Application_Links *app, char *dir, int32_t *len, int32_t capacity, char *rel_path, int32_t rel_len)
#define GET_4ED_PATH_SIG(n) bool32 n(Application_Links *app, char *out, int32_t capacity)
diff --git a/4coder_types.h b/4coder_types.h
index f04cf17f..3033b9b5 100644
--- a/4coder_types.h
+++ b/4coder_types.h
@@ -1,5 +1,8 @@
+#define ENUM(type,name) typedef type name; enum name##_
+#define FLAGENUM(name) typedef uint32_t name; enum name##_
+
/* DOC(bool32 is an alias name to signal that an integer parameter or field is for
true/false vales.) */
typedef int32_t bool32;
@@ -20,9 +23,6 @@ typedef int32_t Buffer_ID;
the interval [1,16].) */
typedef int32_t View_ID;
-#define ENUM(type,name) typedef type name; enum name##_
-#define FLAGENUM(name) typedef uint32_t name; enum name##_
-
/* DOC(A Key_Modifier acts as an index for specifying modifiers in arrays.) */
ENUM(int32_t, Key_Modifier){
MDFR_SHIFT_INDEX,
diff --git a/4ed_metagen.cpp b/4ed_metagen.cpp
index 63c6c1d7..436d8ad6 100644
--- a/4ed_metagen.cpp
+++ b/4ed_metagen.cpp
@@ -387,9 +387,10 @@ typedef struct Item_Set{
Item_Node *items;
} Item_Set;
-typedef struct Struct_Set{
- Item_Node *structs;
-} Struct_Set;
+typedef struct Parse{
+ String code;
+ Cpp_Token_Stack tokens;
+} Parse;
static Item_Node null_item_node = {0};
@@ -415,6 +416,15 @@ file_dump(char *filename){
return(result);
}
+static Parse
+meta_parse(char *filename){
+ Parse result = {0};
+ result.code = file_dump(filename);
+ result.tokens = cpp_make_token_stack(1024);
+ cpp_lex_file(result.code.str, result.code.size, &result.tokens);
+ return(result);
+}
+
static String
get_first_line(String source){
String line = {0};
@@ -454,9 +464,12 @@ is_comment(String str){
return(result);
}
-typedef struct Parse{
- Cpp_Token_Stack tokens;
-} Parse;
+typedef enum Doc_Note_Type{
+ DOC_PARAM,
+ DOC_RETURN,
+ DOC,
+ DOC_SEE
+} Doc_Note_Type;
static int32_t
check_and_fix_docs(String *lexeme){
@@ -479,13 +492,6 @@ check_and_fix_docs(String *lexeme){
return(result);
}
-typedef enum Doc_Note_Type{
- DOC_PARAM,
- DOC_RETURN,
- DOC,
- DOC_SEE
-} Doc_Note_Type;
-
static String
doc_note_string[] = {
make_lit_string("DOC_PARAM"),
@@ -1163,7 +1169,7 @@ parse_enum(Partition *part, char *data,
int32_t start_i = i;
for (; i < count; ++i, ++token){
- if (token->type == CPP_TOKEN_PARENTHESE_CLOSE){
+ if (token->type == CPP_TOKEN_BRACE_OPEN){
break;
}
}
@@ -1804,24 +1810,15 @@ generate_custom_headers(){
Partition part_ = make_part(mem, size);
Partition *part = &part_;
- String string_code = file_dump("internal_4coder_string.cpp");
- Cpp_Token_Stack string_tokens = {0};
+ Parse string_parse = meta_parse("internal_4coder_string.cpp");
int32_t string_function_count = 0;
{
- String *code = &string_code;
- Cpp_Token_Stack *token_stack = &string_tokens;
+ char *data = string_parse.code.str;
- char *data = code->str;
- int32_t size = code->size;
-
- *token_stack = cpp_make_token_stack(1024);
- cpp_lex_file(data, size, token_stack);
-
-
- int32_t count = token_stack->count;
- Cpp_Token *tokens = token_stack->tokens;
+ int32_t count = string_parse.tokens.count;
+ Cpp_Token *tokens = string_parse.tokens.tokens;
Cpp_Token *token = tokens;
for (int32_t i = 0; i < count; ++i, ++token){
@@ -1850,8 +1847,8 @@ generate_custom_headers(){
int32_t string_sig_count = 0;
{
- String *code = &string_code;
- Cpp_Token_Stack *token_stack = &string_tokens;
+ String *code = &string_parse.code;
+ Cpp_Token_Stack *token_stack = &string_parse.tokens;
char *data = code->str;
@@ -1904,22 +1901,16 @@ generate_custom_headers(){
// App API parsing
//
- String code_data[2];
- code_data[0] = file_dump("4ed_api_implementation.cpp");
- code_data[1] = file_dump("win32_api_impl.cpp");
Parse parses[2];
+ parses[0] = meta_parse("4ed_api_implementation.cpp");
+ parses[1] = meta_parse("win32_api_impl.cpp");
int32_t line_count = 0;
for (int32_t J = 0; J < 2; ++J){
- String *code = &code_data[J];
Parse *parse = &parses[J];
- char *data = code->str;
- int32_t size = code->size;
-
- parse->tokens = cpp_make_token_stack(512);
- cpp_lex_file(data, size, &parse->tokens);
+ char *data = parse->code.str;
int32_t count = parse->tokens.count;
Cpp_Token *tokens = parse->tokens.tokens;
@@ -1944,10 +1935,9 @@ generate_custom_headers(){
int32_t sig_count_per_file[2];
for (int32_t J = 0; J < 2; ++J){
- String *code = &code_data[J];
Parse *parse = &parses[J];
- char *data = code->str;
+ char *data = parse->code.str;
int32_t count = parse->tokens.count;
Cpp_Token *tokens = parse->tokens.tokens;
@@ -2084,14 +2074,14 @@ generate_custom_headers(){
// NOTE(allen): Documentation
{
Item_Set typedef_set = {0};
- Struct_Set struct_set = {0};
+ Item_Set struct_set = {0};
Item_Set flag_set = {0};
Item_Set enum_set = {0};
- String type_code[1];
- type_code[0] = file_dump("4coder_os_types.h");
+ Parse type_parse[1];
+ type_parse[0] = meta_parse("4coder_types.h");
- Cpp_Token_Stack types_token_array[1];
+ int32_t file_count = ArrayCount(type_parse);
int32_t typedef_count = 0;
int32_t struct_count = 0;
@@ -2106,16 +2096,11 @@ generate_custom_headers(){
make_lit_string("FLAGENUM"),
};
- for (int32_t J = 0; J < 1; ++J){
- char *data = type_code[J].str;
- int32_t size = type_code[J].size;
+ for (int32_t J = 0; J < file_count; ++J){
+ char *data = type_parse[J].code.str;
- Cpp_Token_Stack types_tokens = cpp_make_token_stack(512);
- cpp_lex_file(data, size, &types_tokens);
- types_token_array[J] = types_tokens;
-
- int32_t count = types_tokens.count;
- Cpp_Token *tokens = types_tokens.tokens;
+ int32_t count = type_parse[J].tokens.count;
+ Cpp_Token *tokens = type_parse[J].tokens.tokens;
Cpp_Token *token = tokens;
for (int32_t i = 0; i < count; ++i, ++token){
@@ -2150,7 +2135,7 @@ generate_custom_headers(){
}
if (struct_count > 0){
- struct_set.structs = push_array(part, Item_Node, struct_count);
+ struct_set.items = push_array(part, Item_Node, struct_count);
}
if (enum_count > 0){
@@ -2166,10 +2151,9 @@ generate_custom_headers(){
int32_t flag_index = 0;
int32_t enum_index = 0;
- for (int32_t J = 0; J < 1; ++J){
- char *data = type_code[J].str;
-
- Cpp_Token_Stack types_tokens = types_token_array[J];
+ for (int32_t J = 0; J < file_count; ++J){
+ char *data = type_parse[J].code.str;
+ Cpp_Token_Stack types_tokens = type_parse[J].tokens;
int32_t count = types_tokens.count;
Cpp_Token *tokens = types_tokens.tokens;
@@ -2199,7 +2183,7 @@ generate_custom_headers(){
{
if (parse_struct(part, (match_index == 1),
data, tokens, count, &token,
- struct_set.structs + struct_index)){
+ struct_set.items + struct_index)){
++struct_index;
}
i = (int32_t)(token - tokens);
@@ -2242,8 +2226,8 @@ generate_custom_headers(){
file = fopen(STRING_H, "wb");
{
- String *code = &string_code;
- Cpp_Token_Stack *token_stack = &string_tokens;
+ String *code = &string_parse.code;
+ Cpp_Token_Stack *token_stack = &string_parse.tokens;
int32_t start = 0;
@@ -2705,7 +2689,7 @@ generate_custom_headers(){
}
for (int32_t i = 0; i < struct_count; ++i){
- String name = struct_set.structs[i].name;
+ String name = struct_set.items[i].name;
fprintf(file,
"- "
"%.*s"
@@ -2913,7 +2897,7 @@ generate_custom_headers(){
}
for (int32_t i = 0; i < struct_count; ++i, ++I){
- Item_Node *member = &struct_set.structs[i];
+ Item_Node *member = &struct_set.items[i];
String name = member->name;
fprintf(file,
"
\n"
diff --git a/4ed_os_custom_api.h b/4ed_os_custom_api.h
index ff8ef555..012dec43 100644
--- a/4ed_os_custom_api.h
+++ b/4ed_os_custom_api.h
@@ -1,6 +1,6 @@
#define MEMORY_ALLOCATE_SIG(n) void* n(Application_Links *app, int32_t size)
#define MEMORY_SET_PROTECTION_SIG(n) bool32 n(Application_Links *app, void *ptr, int32_t size, Memory_Protect_Flags flags)
-#define MEMORY_FREE_SIG(n) void n(Application_Links *app, void *mem, int32_t size)
+#define MEMORY_FREE_SIG(n) void n(Application_Links *app, void *ptr, int32_t size)
#define FILE_EXISTS_SIG(n) bool32 n(Application_Links *app, char *filename, int32_t len)
#define DIRECTORY_CD_SIG(n) bool32 n(Application_Links *app, char *dir, int32_t *len, int32_t capacity, char *rel_path, int32_t rel_len)
#define GET_4ED_PATH_SIG(n) bool32 n(Application_Links *app, char *out, int32_t capacity)
diff --git a/build.c b/build.c
index 70d3e639..54c6c866 100644
--- a/build.c
+++ b/build.c
@@ -267,7 +267,7 @@ standard_build(char *cdir, uint32_t flags){
#if 1
{
BEGIN_TIME_SECTION();
- build(OPTS, cdir, "fsm_table_generator.cpp",
+ build(OPTS | DEBUG_INFO, cdir, "fsm_table_generator.cpp",
META_DIR, "fsmgen", 0);
END_TIME_SECTION("build fsm generator");
}
diff --git a/win32_api_impl.cpp b/win32_api_impl.cpp
index 13b937f4..d353e762 100644
--- a/win32_api_impl.cpp
+++ b/win32_api_impl.cpp
@@ -13,7 +13,11 @@ as this is the only one that will be used for generating headers and docs.
API_EXPORT void*
Memory_Allocate(Application_Links *app, int32_t size)/*
-DOC(TODO)
+DOC_PARAM(size, The size in bytes of the block that should be returned.)
+DOC(This calls to a low level OS allocator which means it is best used
+for infrequent, large allocations. The size of the block must be remembered
+if it will be freed or if it's mem protection status will be changed.)
+DOC_SEE(memory_free)
*/{
void *result = VirtualAlloc(0, size, MEM_COMMIT | MEM_RESERVE, PAGE_READWRITE);
return(result);
@@ -21,7 +25,13 @@ DOC(TODO)
API_EXPORT bool32
Memory_Set_Protection(Application_Links *app, void *ptr, int32_t size, Memory_Protect_Flags flags)/*
-DOC(TODO)
+DOC_PARAM(ptr, The base of the block on which to set memory protection flags.)
+DOC_PARAM(size, The size that was originally used to allocate this block.)
+DOC_PARAM(flags, The new memory protection flags.)
+DOC(This call sets the memory protection flags of a block of memory that was previously
+allocate by memory_allocate.)
+DOC_SEE(memory_allocate)
+DOC_SEE(Memory_Protect_Flags)
*/{
bool32 result = false;
DWORD old_protect = 0;
@@ -56,10 +66,14 @@ DOC(TODO)
}
API_EXPORT void
-Memory_Free(Application_Links *app, void *mem, int32_t size)/*
-DOC(TODO)
+Memory_Free(Application_Links *app, void *ptr, int32_t size)/*
+DOC_PARAM(mem, The base of a block to free.)
+DOC_PARAM(size, The size that was originally used to allocate this block.)
+DOC(This call frees a block of memory that was previously allocated by
+memory_allocate.)
+DOC_SEE(memory_allocate)
*/{
- VirtualFree(mem, 0, MEM_RELEASE);
+ VirtualFree(ptr, 0, MEM_RELEASE);
}
API_EXPORT bool32
@@ -177,7 +191,12 @@ DOC_SEE(Mouse_Cursor_Show_Type)
}
API_EXPORT void
-Toggle_Fullscreen(Application_Links *app){
+Toggle_Fullscreen(Application_Links *app)/*
+DOC(This call tells 4coder to switch into or out of full screen mode.
+The changes of full screen mode do not take effect until the end of the current frame.
+On Windows this call will not work unless 4coder was started in "stream mode".
+Stream mode can be enabled with -S or -F flags on the command line to 4ed.)
+*/{
/* NOTE(allen): Don't actually change window size now!
Tell the platform layer to do the toggle (or to cancel the toggle)
later when the app.step function isn't running. If the size changes
@@ -193,7 +212,13 @@ Toggle_Fullscreen(Application_Links *app){
}
API_EXPORT bool32
-Is_Fullscreen(Application_Links *app){
+Is_Fullscreen(Application_Links *app)/*
+DOC_SEE(This call returns true if the 4coder is in full screen mode. This call
+takes toggles that have already occured this frame into account. So it may return
+true even though the frame has not ended and actually put 4coder into full screen. If
+it returns true though, 4coder will definitely be full screen by the beginning of the next
+frame if the state is not changed.)
+*/{
/* NOTE(allen): This is a fancy way to say 'full_screen XOR do_toggle'
This way this function can always report the state the fullscreen
will have when the next frame runs, given the number of toggles
@@ -203,7 +228,10 @@ Is_Fullscreen(Application_Links *app){
}
API_EXPORT void
-Send_Exit_Signal(Application_Links *app){
+Send_Exit_Signal(Application_Links *app)/*
+DOC_SEE(This call sends a signal to 4coder to attempt to exit. If there are unsaved
+files this triggers a dialogue ensuring you're okay with closing.)
+*/{
win32vars.send_exit_signal = 1;
}