Token transition in progress
parent
352cb27b73
commit
8bd7c2fd67
|
@ -12,8 +12,6 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
#include "4coder_base_types.h"
|
#include "4coder_base_types.h"
|
||||||
#include "4coder_lib/4coder_heap.h"
|
|
||||||
#include "4coder_lib/4coder_string.h"
|
|
||||||
#include "4coder_lib/4cpp_lexer_types.h"
|
#include "4coder_lib/4cpp_lexer_types.h"
|
||||||
#include "4coder_API/4coder_version.h"
|
#include "4coder_API/4coder_version.h"
|
||||||
#include "4coder_API/4coder_keycodes.h"
|
#include "4coder_API/4coder_keycodes.h"
|
||||||
|
|
|
@ -13,23 +13,16 @@
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* DOC(argb_color is an alias name to signal that an integer parameter or field is for a color value,
|
|
||||||
colors are specified as 32 bit integers with 4 channels: 0xAARRGGBB.) */
|
|
||||||
TYPEDEF u32 argb_color;
|
TYPEDEF u32 argb_color;
|
||||||
|
|
||||||
TYPEDEF u32 int_color;
|
TYPEDEF u32 int_color;
|
||||||
|
|
||||||
TYPEDEF u16 id_color;
|
TYPEDEF u16 id_color;
|
||||||
|
|
||||||
/* DOC(Parse_Context_ID identifies a parse context, which is a guiding rule for the parser. Each buffer sets which parse context to use when it is parsed.) */
|
|
||||||
TYPEDEF u32 Parse_Context_ID;
|
|
||||||
|
|
||||||
TYPEDEF u32 Child_Process_ID;
|
TYPEDEF u32 Child_Process_ID;
|
||||||
|
|
||||||
/* DOC(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.) */
|
|
||||||
TYPEDEF i32 Buffer_ID;
|
TYPEDEF i32 Buffer_ID;
|
||||||
|
|
||||||
/* DOC(View_ID is used to name a 4coder view. Each view has a unique id in the interval [1,16].) */
|
|
||||||
TYPEDEF i32 View_ID;
|
TYPEDEF i32 View_ID;
|
||||||
|
|
||||||
TYPEDEF i32 Panel_ID;
|
TYPEDEF i32 Panel_ID;
|
||||||
|
@ -58,27 +51,21 @@ ENUM(u32, Child_Process_Set_Target_Flags){
|
||||||
ChildProcessSet_CursorAtEnd = 4,
|
ChildProcessSet_CursorAtEnd = 4,
|
||||||
};
|
};
|
||||||
|
|
||||||
/* DOC(A Key_Modifier_Index acts as an index for specifying modifiers in arrays.) */
|
|
||||||
ENUM(i32, Key_Modifier_Index){
|
ENUM(i32, Key_Modifier_Index){
|
||||||
MDFR_SHIFT_INDEX,
|
MDFR_SHIFT_INDEX,
|
||||||
MDFR_CONTROL_INDEX,
|
MDFR_CONTROL_INDEX,
|
||||||
MDFR_ALT_INDEX,
|
MDFR_ALT_INDEX,
|
||||||
MDFR_COMMAND_INDEX,
|
MDFR_COMMAND_INDEX,
|
||||||
|
|
||||||
/* DOC(MDFR_INDEX_BINDABLE_COUNT is used to specify the number of supported modifiers that can be used in key bindings.) */
|
|
||||||
MDFR_INDEX_BINDABLE_COUNT,
|
MDFR_INDEX_BINDABLE_COUNT,
|
||||||
|
|
||||||
MDFR_CAPS_INDEX = MDFR_INDEX_BINDABLE_COUNT,
|
MDFR_CAPS_INDEX = MDFR_INDEX_BINDABLE_COUNT,
|
||||||
MDFR_HOLD_INDEX,
|
MDFR_HOLD_INDEX,
|
||||||
|
|
||||||
/* DOC(MDFR_INDEX_COUNT is used to specify the number of modifiers supported.) */
|
|
||||||
MDFR_INDEX_COUNT
|
MDFR_INDEX_COUNT
|
||||||
};
|
};
|
||||||
|
|
||||||
/* DOC(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.) */
|
|
||||||
ENUM(u32, Key_Modifier_Flag){
|
ENUM(u32, Key_Modifier_Flag){
|
||||||
/* DOC(MDFR_NONE specifies that no modifiers are pressed.) */
|
|
||||||
MDFR_NONE = 0x0,
|
MDFR_NONE = 0x0,
|
||||||
MDFR_CTRL = 0x1,
|
MDFR_CTRL = 0x1,
|
||||||
MDFR_ALT = 0x2,
|
MDFR_ALT = 0x2,
|
||||||
|
@ -86,79 +73,30 @@ ENUM(u32, Key_Modifier_Flag){
|
||||||
MDFR_SHIFT = 0x8,
|
MDFR_SHIFT = 0x8,
|
||||||
};
|
};
|
||||||
|
|
||||||
/* DOC(Flags for describing the memory protection status of pages that come back from memory allocate. Some combinations may not be available on some platforms, but you are gauranteed to get back a page with at least the permissions you requested. For example if you request just write permission, you may get back a page with read and write permission, but you will never get back a page that doesn't have write permission.) */
|
|
||||||
ENUM(u32, Memory_Protect_Flags){
|
ENUM(u32, Memory_Protect_Flags){
|
||||||
/* DOC(Allows the page to be read.) */
|
|
||||||
MemProtect_Read = 0x1,
|
MemProtect_Read = 0x1,
|
||||||
/* DOC(Allows the page to be written.) */
|
|
||||||
MemProtect_Write = 0x2,
|
MemProtect_Write = 0x2,
|
||||||
/* DOC(Allows the page to be executed.) */
|
|
||||||
MemProtect_Execute = 0x4,
|
MemProtect_Execute = 0x4,
|
||||||
};
|
};
|
||||||
|
|
||||||
/* DOC(A Wrap_Indicator_Mode is used in the buffer setting BufferSetting_WrapIndicator to specify how to indicate that line has been wrapped.) */
|
|
||||||
ENUM(i32, Wrap_Indicator_Mode){
|
ENUM(i32, Wrap_Indicator_Mode){
|
||||||
/* DOC(WrapIndicator_Hide tells the buffer rendering system not to put any indicator on wrapped lines.) */
|
|
||||||
WrapIndicator_Hide,
|
WrapIndicator_Hide,
|
||||||
|
|
||||||
/* DOC(WrapIndicator_Show_After_Line tells the buffer rendering system to put a backslash indicator on wrapped lines right after the last character of the line.) */
|
|
||||||
WrapIndicator_Show_After_Line,
|
WrapIndicator_Show_After_Line,
|
||||||
|
|
||||||
/* DOC(WrapIndicator_Show_At_Wrap_Edge tells the buffer rendering system to put a backslash indicator on wrapped lines aligned with the wrap position for that line.) */
|
|
||||||
WrapIndicator_Show_At_Wrap_Edge,
|
WrapIndicator_Show_At_Wrap_Edge,
|
||||||
};
|
};
|
||||||
|
|
||||||
/* DOC(A Global_Setting_ID names a setting.) */
|
|
||||||
ENUM(i32, Global_Setting_ID){
|
ENUM(i32, Global_Setting_ID){
|
||||||
/* DOC(GlobalSetting_Null is not a valid setting, it is reserved to detect errors.) */
|
|
||||||
GlobalSetting_Null,
|
GlobalSetting_Null,
|
||||||
|
|
||||||
/* DOC(When GlobalSetting_LAltLCtrlIsAltGr is enabled, keyboard layouts with AltGr will also interpret the left alt and control keys as AltGr. If you do not use a keyboard with AltGr you should have this turned off. This setting is only relevant on Windows and has no effect on other systems.) */
|
|
||||||
GlobalSetting_LAltLCtrlIsAltGr,
|
GlobalSetting_LAltLCtrlIsAltGr,
|
||||||
};
|
};
|
||||||
|
|
||||||
/* DOC(A Buffer_Setting_ID names a setting in a buffer.) */
|
|
||||||
ENUM(i32, Buffer_Setting_ID){
|
ENUM(i32, Buffer_Setting_ID){
|
||||||
/* DOC(BufferSetting_Null is not a valid setting, it is reserved to detect errors.) */
|
|
||||||
BufferSetting_Null,
|
BufferSetting_Null,
|
||||||
|
|
||||||
/* DOC(The BufferSetting_Lex setting is used to determine whether to store C++ tokens from with the buffer.) */
|
|
||||||
BufferSetting_Lex,
|
|
||||||
|
|
||||||
/* DOC(The BufferSetting_LexWithoutStrings tells the system to treat string and character marks as identifiers instead of strings. This settings does nothing if the buffer does not have lexing turned on.) */
|
|
||||||
BufferSetting_LexWithoutStrings,
|
|
||||||
|
|
||||||
/* DOC(The BufferSetting_ParserContext setting determines the parser context that guides the parser for the contents of this buffer. By default the value is 0, which represents the default C++ context.) */
|
|
||||||
BufferSetting_ParserContext,
|
|
||||||
|
|
||||||
/* DOC(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_WrapLine,
|
|
||||||
|
|
||||||
/* DOC(The BufferSetting_WrapPosition setting determines after how many pixels a line will wrap. A view set's this value from the global default value when the view is created. This value cannot be set to less than 48, any value passed below 48 will cause the position to be set to 48. This is a potentially expensive operation because the wrap positions of the file have to be reindexed. For best behavior try to only set this setting once per frame, if possible.) */
|
|
||||||
BufferSetting_WrapPosition,
|
|
||||||
|
|
||||||
/* DOC(The BufferSetting_MinimumBaseWrapPosition setting is used to increase the with in pixels allotted to a line for wrapping, by setting a minimum position away from the base of the line. The base of a line is always 0, or the left hand side of the view, in text files. In code files the base of a line is the amount the line is shifted to the right due to brace nesting. This setting allows for deeply nested code to remain readable by ensuring lines deep in the nesting get some minimum base width which may be more wrapping space than the non base adjusted wrap position would have allowed. In any case where the (default wrapping position) is greater than (the base + minimum base position), the larger ) the default will still be used. */
|
|
||||||
BufferSetting_MinimumBaseWrapPosition,
|
|
||||||
|
|
||||||
/* DOC(The BufferSetting_WrapIndicator setting is used to specify how wrapped lines should be marked so the user can see that they have been wrapped. The value should be one of the values in the Wrap_Indicator_Mode enum.) DOC_SEE(Wrap_Indicator_Mode) */
|
|
||||||
BufferSetting_WrapIndicator,
|
|
||||||
|
|
||||||
/* DOC(The BufferSetting_MapID setting specifies the id of the command map that should be active when a buffer is active.) */
|
|
||||||
BufferSetting_MapID,
|
BufferSetting_MapID,
|
||||||
|
|
||||||
/* DOC(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_Eol,
|
BufferSetting_Eol,
|
||||||
|
|
||||||
/* DOC(The BufferSetting_Unimportant setting marks a buffer so that its dirty state will be forced to stay at DirtyState_UpToDate when the buffer is edited or when the buffer's paired file, if it has one, is edited.) */
|
|
||||||
BufferSetting_Unimportant,
|
BufferSetting_Unimportant,
|
||||||
|
|
||||||
/* DOC(The BufferSetting_ReadOnly setting marks a buffer so that it can only be returned from buffer access calls that include an AccessProtected flag. By convention this means that edit commands that should not be applied to read only buffers will not edit this buffer.) */
|
|
||||||
BufferSetting_ReadOnly,
|
BufferSetting_ReadOnly,
|
||||||
|
|
||||||
/* DOC(The BufferSetting_VirtualWhitespace setting enables virtual whitespace on a buffer. Text buffers with virtual whitespace will set the indentation of every line to zero. Buffers with lexing enabled will use virtual white space to present the code with appealing indentation.) */
|
|
||||||
BufferSetting_VirtualWhitespace,
|
BufferSetting_VirtualWhitespace,
|
||||||
|
|
||||||
/* DOC(TODO) */
|
|
||||||
BufferSetting_RecordsHistory,
|
BufferSetting_RecordsHistory,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -166,196 +104,99 @@ STRUCT Character_Predicate{
|
||||||
u8 b[32];
|
u8 b[32];
|
||||||
};
|
};
|
||||||
|
|
||||||
/* DOC(A View_Setting_ID names an adjustable setting in a view.) */
|
|
||||||
ENUM(i32, View_Setting_ID){
|
ENUM(i32, View_Setting_ID){
|
||||||
/* DOC(ViewSetting_Null is not a valid setting, it is reserved to detect errors.) */
|
|
||||||
ViewSetting_Null,
|
ViewSetting_Null,
|
||||||
|
|
||||||
/* DOC(Determines whether the view highlights whitespace in a file. Whenever the view switches to a new buffer this setting is turned off.) */
|
|
||||||
ViewSetting_ShowWhitespace,
|
ViewSetting_ShowWhitespace,
|
||||||
|
|
||||||
/* DOC(Determines whether a scroll bar is attached to a view in it's scrollable section.) */
|
|
||||||
ViewSetting_ShowScrollbar,
|
ViewSetting_ShowScrollbar,
|
||||||
|
|
||||||
/* DOC(Determines whether to show the file bar.) */
|
|
||||||
ViewSetting_ShowFileBar,
|
ViewSetting_ShowFileBar,
|
||||||
|
|
||||||
/* DOC(Determines what command map the view uses when it is in ui mode.) */
|
|
||||||
ViewSetting_UICommandMap
|
ViewSetting_UICommandMap
|
||||||
};
|
};
|
||||||
|
|
||||||
/* DOC(A Buffer_Create_Flag field specifies how a buffer should be created.) */
|
|
||||||
ENUM(u32, Buffer_Create_Flag){
|
ENUM(u32, Buffer_Create_Flag){
|
||||||
/* DOC(BufferCreate_Background is not currently implemented.) */
|
|
||||||
BufferCreate_Background = 0x1,
|
BufferCreate_Background = 0x1,
|
||||||
/* DOC(When BufferCreate_AlwaysNew is set it indicates the buffer should be cleared to empty even if it's associated file already has content.) */
|
|
||||||
BufferCreate_AlwaysNew = 0x2,
|
BufferCreate_AlwaysNew = 0x2,
|
||||||
/* DOC(When BufferCreate_NeverNew is set it indicates that the buffer should only be created if it is an existing file or if a buffer with the given name is already open.) */
|
|
||||||
BufferCreate_NeverNew = 0x4,
|
BufferCreate_NeverNew = 0x4,
|
||||||
/* DOC(When BufferCreate_JustChangedFile is set it indicates that the file to load has just been saved in the same frame and a change notification for the file should be ignored.) */
|
|
||||||
BufferCreate_JustChangedFile = 0x8,
|
BufferCreate_JustChangedFile = 0x8,
|
||||||
/* DOC(Indicates that when create_buffer searches for already existing buffers that match the name parameter, it should only search by file name, and that if it cannot create the buffer with the file attached, it should not create the buffer at all.) */
|
|
||||||
BufferCreate_MustAttachToFile = 0x10,
|
BufferCreate_MustAttachToFile = 0x10,
|
||||||
/* DOC(Indicates that when create_buffer searches for already existing buffers that match the name parameter, it should only search by buffer name, and that it should not attach a file to the buffer even if it can. Caution! Buffers that don't have attached files cannot be saved.) */
|
|
||||||
BufferCreate_NeverAttachToFile = 0x20,
|
BufferCreate_NeverAttachToFile = 0x20,
|
||||||
/* DOC(Normally the new file hook is called on any created buffer. Passing this flag will prevent the new file hook from being called automatically by the core.) */
|
|
||||||
BufferCreate_SuppressNewFileHook = 0x40,
|
BufferCreate_SuppressNewFileHook = 0x40,
|
||||||
};
|
};
|
||||||
|
|
||||||
/* DOC(Buffer_Creation_Data is a struct used as a local handle for the creation of a buffer. )
|
|
||||||
HIDE_MEMBERS() */
|
|
||||||
STRUCT Buffer_Creation_Data{
|
|
||||||
Buffer_Create_Flag flags;
|
|
||||||
char fname_space [256];
|
|
||||||
i32 fname_len;
|
|
||||||
};
|
|
||||||
|
|
||||||
/* DOC(A Buffer_Save_Flag field specifies buffer saving behavior.) */
|
|
||||||
ENUM(u32, Buffer_Save_Flag){
|
ENUM(u32, Buffer_Save_Flag){
|
||||||
/* DOC(BufferSave_IgnoreDirtyFlag tells the save procedure not to check the dirty flag of the buffer. Usually buffers not marked dirty will not be saved, but sometimes it is useful to force it to save anyway. ) */
|
|
||||||
BufferSave_IgnoreDirtyFlag = 0x1,
|
BufferSave_IgnoreDirtyFlag = 0x1,
|
||||||
};
|
};
|
||||||
|
|
||||||
/* DOC(A Buffer_Kill_Flag field specifies how a buffer should be killed.) */
|
|
||||||
ENUM(u32, Buffer_Kill_Flag){
|
ENUM(u32, Buffer_Kill_Flag){
|
||||||
/* DOC(When BufferKill_AlwaysKill is set it indicates the buffer should be killed
|
|
||||||
without asking, even when the buffer is dirty.) */
|
|
||||||
BufferKill_AlwaysKill = 0x2,
|
BufferKill_AlwaysKill = 0x2,
|
||||||
};
|
};
|
||||||
|
|
||||||
/* DOC(A Buffer_Reopen_Flag field specifies how a buffer should be reopened -- currently no flags are provided.) */
|
|
||||||
ENUM(u32, Buffer_Reopen_Flag){};
|
ENUM(u32, Buffer_Reopen_Flag){};
|
||||||
|
|
||||||
/* DOC(A status enumeration returned by kill_buffer.)
|
|
||||||
DOC_SEE(kill_buffer) */
|
|
||||||
ENUM(i32, Buffer_Kill_Result){
|
ENUM(i32, 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,
|
||||||
};
|
};
|
||||||
|
|
||||||
/* DOC(A status enumeration returned by reopen_buffer.)
|
|
||||||
DOC_SEE(kill_buffer) */
|
|
||||||
ENUM(i32, Buffer_Reopen_Result){
|
ENUM(i32, Buffer_Reopen_Result){
|
||||||
/* DOC(The buffer was successfully reopened.) */
|
|
||||||
BufferReopenResult_Reopened = 0,
|
BufferReopenResult_Reopened = 0,
|
||||||
/* DOC(The buffer was not reopened, because either the buffer has no attached file, or the attached file could not be loaded.) */
|
|
||||||
BufferReopenResult_Failed = 1,
|
BufferReopenResult_Failed = 1,
|
||||||
};
|
};
|
||||||
|
|
||||||
/* DOC(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.) */
|
|
||||||
ENUM(u32, Access_Flag){
|
ENUM(u32, Access_Flag){
|
||||||
/* DOC(AccessOpen does not include any bits, it indicates that the access should only return objects that have no protection flags set.) */
|
|
||||||
AccessOpen = 0x0,
|
AccessOpen = 0x0,
|
||||||
/* DOC(AccessProtected is set on buffers and views that are "read only" such as the output from an exec_system_command call into *build*. This is to prevent the user from accidentally editing output that they might prefer to keep in tact.) */
|
|
||||||
AccessProtected = 0x1,
|
AccessProtected = 0x1,
|
||||||
/* DOC(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.) */
|
|
||||||
AccessHidden = 0x2,
|
AccessHidden = 0x2,
|
||||||
/* DOC(AccessAll is a catchall access for cases where an access call should always return an object no matter what it's protection flags are.) */
|
|
||||||
AccessAll = 0xFF
|
AccessAll = 0xFF
|
||||||
};
|
};
|
||||||
|
|
||||||
/* DOC(A Dirty_State value describes whether changes have been made to a buffer or to an underlying
|
|
||||||
file since the last sync time between the two. Saving a buffer to it's file or loading the buffer
|
|
||||||
from the file both act as sync points.) */
|
|
||||||
ENUM(u32, Dirty_State){
|
ENUM(u32, Dirty_State){
|
||||||
/* DOC(DirtyState_UpToDate indicates that there are no unsaved changes and the underlying
|
|
||||||
system file still agrees with the buffer's state.) */
|
|
||||||
DirtyState_UpToDate = 0,
|
DirtyState_UpToDate = 0,
|
||||||
|
|
||||||
/* DOC(DirtyState_UnsavedChanges indicates that there have been changes in the buffer since
|
|
||||||
the last sync point.) */
|
|
||||||
DirtyState_UnsavedChanges = 1,
|
DirtyState_UnsavedChanges = 1,
|
||||||
|
|
||||||
/* DOC(DirtyStateUnloadedChanges indicates that the underlying file has been edited since
|
|
||||||
the last sync point .) */
|
|
||||||
DirtyState_UnloadedChanges = 2,
|
DirtyState_UnloadedChanges = 2,
|
||||||
|
|
||||||
/* DOC(TODO) */
|
|
||||||
DirtyState_UnsavedChangesAndUnloadedChanges = 3,
|
DirtyState_UnsavedChangesAndUnloadedChanges = 3,
|
||||||
};
|
};
|
||||||
|
|
||||||
/* DOC(A Command_Line_Interface_Flag field specifies the behavior of a call to a command line interface.) */
|
|
||||||
ENUM(u32, Command_Line_Interface_Flag){
|
ENUM(u32, Command_Line_Interface_Flag){
|
||||||
/* DOC(If CLI_OverlapWithConflict is set if output buffer of the new command is already in use by another command which is still executing, the older command relinquishes control of the buffer and both operate simultaneously with only the newer command outputting to the buffer.) */
|
|
||||||
CLI_OverlapWithConflict = 0x1,
|
CLI_OverlapWithConflict = 0x1,
|
||||||
/* DOC(If CLI_AlwaysBindToView is set the output buffer will always be set in the active view even if it is already set in another open view.) */
|
|
||||||
CLI_AlwaysBindToView = 0x2,
|
CLI_AlwaysBindToView = 0x2,
|
||||||
/* DOC(If CLI_CursorAtEnd is set the cursor will be kept at the end of the output buffer, otherwise the cursor is kept at the beginning.) */
|
|
||||||
CLI_CursorAtEnd = 0x4,
|
CLI_CursorAtEnd = 0x4,
|
||||||
/* DOC(TODO) */
|
|
||||||
CLI_SendEndSignal = 0x8,
|
CLI_SendEndSignal = 0x8,
|
||||||
};
|
};
|
||||||
|
|
||||||
/* DOC(An Auto_Indent_Flag field specifies the behavior of an auto indentation operation.) */
|
|
||||||
ENUM(u32, Auto_Indent_Flag){
|
ENUM(u32, Auto_Indent_Flag){
|
||||||
/* DOC(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_ClearLine = 0x1,
|
AutoIndent_ClearLine = 0x1,
|
||||||
/* DOC(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.) */
|
|
||||||
AutoIndent_UseTab = 0x2,
|
AutoIndent_UseTab = 0x2,
|
||||||
/* DOC(If AutoIndent_ExactAlignBlock is set, then block comments are indented by putting the first non-whitespace character of the line in line with the beginning of the comment.) */
|
|
||||||
AutoIndent_ExactAlignBlock = 0x4,
|
AutoIndent_ExactAlignBlock = 0x4,
|
||||||
/* DOC(If AutoIndent_FullTokens is set, then the set of lines that are indented is automatically expanded so that any token spanning multiple lines gets entirely indented.) */
|
|
||||||
AutoIndent_FullTokens = 0x8,
|
AutoIndent_FullTokens = 0x8,
|
||||||
};
|
};
|
||||||
|
|
||||||
/* DOC(A Set_Buffer_Flag field specifies the behavior of an operation that sets the buffer of a view.) */
|
|
||||||
ENUM(u32, Set_Buffer_Flag){
|
ENUM(u32, Set_Buffer_Flag){
|
||||||
/* DOC(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.) */
|
|
||||||
SetBuffer_KeepOriginalGUI = 0x1
|
SetBuffer_KeepOriginalGUI = 0x1
|
||||||
};
|
};
|
||||||
|
|
||||||
/* DOC(A Input_Type_Flag field specifies a set of input event types.) */
|
|
||||||
ENUM(u32, Input_Type_Flag){
|
ENUM(u32, Input_Type_Flag){
|
||||||
/* DOC(If EventOnAnyKey is set, all keyboard events are included in the set.) */
|
|
||||||
EventOnAnyKey = 0x1,
|
EventOnAnyKey = 0x1,
|
||||||
/* DOC(If EventOnEsc is set, any press of the escape key is included in the set.) */
|
|
||||||
EventOnEsc = 0x2,
|
EventOnEsc = 0x2,
|
||||||
|
|
||||||
/* DOC(If EventOnLeftButton is set, left clicks and releases are included in the set.) */
|
|
||||||
EventOnMouseLeftButton = 0x4,
|
EventOnMouseLeftButton = 0x4,
|
||||||
/* DOC(If EventOnRightButton is set, right clicks and releases are included in the set.) */
|
|
||||||
EventOnMouseRightButton = 0x8,
|
EventOnMouseRightButton = 0x8,
|
||||||
/* DOC(If EventOnWheel is set, any wheel movement is included in the set.) */
|
|
||||||
EventOnMouseWheel = 0x10,
|
EventOnMouseWheel = 0x10,
|
||||||
/* DOC(If EventOnMouseMove is set, mouse movement events are included in the set.) */
|
|
||||||
EventOnMouseMove = 0x20,
|
EventOnMouseMove = 0x20,
|
||||||
|
|
||||||
/* DOC(If EventOnAnimate is set, animate events are included in the set.) */
|
|
||||||
EventOnAnimate = 0x40,
|
EventOnAnimate = 0x40,
|
||||||
/* DOC(If EventOnViewActivation is set, view activation and deactivation events are included in the set.) */
|
|
||||||
EventOnViewActivation = 0x80,
|
EventOnViewActivation = 0x80,
|
||||||
|
|
||||||
/* DOC(EventAll is a catch all name for including all possible events in the set.) */
|
|
||||||
EventAll = 0xFFFFFFFF,
|
EventAll = 0xFFFFFFFF,
|
||||||
};
|
};
|
||||||
|
|
||||||
/* DOC(A Mouse_Cursor_Show_Type value specifes a mode for 4coder to handle the mouse cursor.) */
|
|
||||||
ENUM(i32, Mouse_Cursor_Show_Type){
|
ENUM(i32, Mouse_Cursor_Show_Type){
|
||||||
/* DOC(The MouseCursorShow_Never mode never shows the cursor.) */
|
|
||||||
MouseCursorShow_Never,
|
MouseCursorShow_Never,
|
||||||
/* DOC(The MouseCursorShow_Never mode always shows the cursor.) */
|
|
||||||
MouseCursorShow_Always,
|
MouseCursorShow_Always,
|
||||||
// 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.) */
|
|
||||||
ENUM(i32, View_Split_Position){
|
ENUM(i32, View_Split_Position){
|
||||||
/* DOC(This value indicates that the new view should be above the existing view.) */
|
|
||||||
ViewSplit_Top,
|
ViewSplit_Top,
|
||||||
/* DOC(This value indicates that the new view should be below the existing view.) */
|
|
||||||
ViewSplit_Bottom,
|
ViewSplit_Bottom,
|
||||||
/* DOC(This value indicates that the new view should be left of the existing view.) */
|
|
||||||
ViewSplit_Left,
|
ViewSplit_Left,
|
||||||
/* DOC(This value indicates that the new view should be right of the existing view.) */
|
|
||||||
ViewSplit_Right,
|
ViewSplit_Right,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -376,76 +217,43 @@ ENUM(i32, Panel_Child){
|
||||||
PanelChild_Max = 1,
|
PanelChild_Max = 1,
|
||||||
};
|
};
|
||||||
|
|
||||||
/* DOC(Key_Code is the alias for key codes including raw codes and codes translated to textual input that takes modifiers into account.) */
|
|
||||||
TYPEDEF u32 Key_Code;
|
TYPEDEF u32 Key_Code;
|
||||||
|
|
||||||
/* DOC(Key_Modifier is the alias for flags that represent keyboard modifiers, ctrl, alt, shift, etc.)
|
TYPEDEF u8 Key_Modifier;
|
||||||
DOC_SEE(Key_Modifier_Flag) */
|
|
||||||
TYPEDEF uint8_t Key_Modifier;
|
|
||||||
|
|
||||||
/* DOC(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.)
|
|
||||||
DOC_SEE(Key_Modifier_Index)
|
|
||||||
*/
|
|
||||||
STRUCT Key_Event_Data{
|
STRUCT Key_Event_Data{
|
||||||
/* DOC(This field is the raw keycode which is always non-zero in valid key events.) */
|
|
||||||
Key_Code keycode;
|
Key_Code keycode;
|
||||||
|
|
||||||
/* DOC(This field is the keycode after translation to a character, this is 0 if there is no translation.) */
|
|
||||||
Key_Code character;
|
Key_Code character;
|
||||||
|
|
||||||
/* DOC(This field is like the field character, except that the state of caps lock is ignored in the translation.) */
|
|
||||||
Key_Code character_no_caps_lock;
|
Key_Code character_no_caps_lock;
|
||||||
|
i8 modifiers[MDFR_INDEX_COUNT];
|
||||||
/* DOC(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_Index.
|
|
||||||
1 indicates that the corresponding modifier was held, and a 0 indicates that it was not held.)
|
|
||||||
DOC_SEE(Key_Modifier) */
|
|
||||||
int8_t modifiers[MDFR_INDEX_COUNT];
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// TODO(allen): GLOBAL_VAR meta parsing
|
|
||||||
GLOBAL_VAR Key_Event_Data null_key_event_data = {};
|
GLOBAL_VAR Key_Event_Data null_key_event_data = {};
|
||||||
|
|
||||||
/* DOC(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.) */
|
|
||||||
STRUCT Mouse_State{
|
STRUCT Mouse_State{
|
||||||
/* DOC(Left button is down.) */
|
|
||||||
int8_t l;
|
int8_t l;
|
||||||
/* DOC(Right button is down.) */
|
|
||||||
int8_t r;
|
int8_t r;
|
||||||
/* DOC(Left button was pressed this frame.) */
|
|
||||||
int8_t press_l;
|
int8_t press_l;
|
||||||
/* DOC(Right button was pressed this frame.) */
|
|
||||||
int8_t press_r;
|
int8_t press_r;
|
||||||
/* DOC(Left button was released this frame.) */
|
|
||||||
int8_t release_l;
|
int8_t release_l;
|
||||||
/* DOC(Right button was released this frame.) */
|
|
||||||
int8_t release_r;
|
int8_t release_r;
|
||||||
/* DOC(Mouse is outside of the window.) */
|
|
||||||
int8_t out_of_window;
|
int8_t out_of_window;
|
||||||
/* DOC(The motion of the wheel. Zero indicates no motion. Positive indicates downard scrolling. Negative indicates upward scrolling. The magnitude corresponds to the number of pixels of scroll that would be applied at standard scroll speeds.) */
|
|
||||||
i32 wheel;
|
i32 wheel;
|
||||||
UNION{
|
UNION{
|
||||||
STRUCT{
|
STRUCT{
|
||||||
/* DOC(X position of the mouse where the left of the window is x = 0, and x grows to the right.) */
|
|
||||||
i32 x;
|
i32 x;
|
||||||
/* DOC(Y position of the mouse where the top of the window is y = 0, and y grows to downward.) */
|
|
||||||
i32 y;
|
i32 y;
|
||||||
};
|
};
|
||||||
/* DOC(TODO) */
|
|
||||||
Vec2_i32 p;
|
Vec2_i32 p;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
/* DOC(Parser_String_And_Type contains a string and type integer used to specify information about keywords to the parser.) */
|
|
||||||
STRUCT Parser_String_And_Type{
|
STRUCT Parser_String_And_Type{
|
||||||
/* DOC(The string specified by the pair, it need not be null terminated.) */
|
|
||||||
char *str;
|
char *str;
|
||||||
/* DOC(The number of bytes in the string str.) */
|
|
||||||
u32 length;
|
u32 length;
|
||||||
/* DOC(The type integer.) */
|
|
||||||
u32 type;
|
u32 type;
|
||||||
};
|
};
|
||||||
|
|
||||||
/* DOC(Microsecond_Time_Stamp is a typedef of an unsigned 64 bit integer used to signify that the value is an arbitrary for a moment in time.) */
|
|
||||||
TYPEDEF u64 Microsecond_Time_Stamp;
|
TYPEDEF u64 Microsecond_Time_Stamp;
|
||||||
|
|
||||||
ENUM(u32, File_Attribute_Flag){
|
ENUM(u32, File_Attribute_Flag){
|
||||||
|
@ -469,13 +277,9 @@ STRUCT File_List{
|
||||||
u32 count;
|
u32 count;
|
||||||
};
|
};
|
||||||
|
|
||||||
/* DOC(Buffer_Identifier acts as a loosely typed description of a buffer that can either be a name or an id.) */
|
|
||||||
STRUCT Buffer_Identifier{
|
STRUCT Buffer_Identifier{
|
||||||
/* DOC(This field is the name of the buffer; it need not be null terminated. If id is specified this pointer should be NULL.) */
|
|
||||||
char *name;
|
char *name;
|
||||||
/* DOC(This field specifies the length of the name string.) */
|
|
||||||
i32 name_len;
|
i32 name_len;
|
||||||
/* DOC(This field is the id of the buffer. If name is specified this should be 0.) */
|
|
||||||
Buffer_ID id;
|
Buffer_ID id;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -532,161 +336,46 @@ STRUCT Range_Cursor{
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
|
||||||
DOC(A markers is a location in a buffer that, once placed, is effected by edits the same way characters are effected. In particular if an edit occurs in a location in the buffer before a marker, the marker is shifted forward or backward so that it remains on the same character.)
|
|
||||||
DOC_SEE(buffer_add_markers)
|
|
||||||
*/
|
|
||||||
STRUCT Marker{
|
STRUCT Marker{
|
||||||
/* DOC(The current position of the marker measure in absolute byte positioning coordinates.) */
|
|
||||||
i64 pos;
|
i64 pos;
|
||||||
/* DOC(When a marker is inside a range that gets edited, by default the marker 'leans_left' which means it goes to the beginning of the edited range. If the field lean_right is set to true, the marker will lean right with edits and will go to the end of edited range.) */
|
|
||||||
b32 lean_right;
|
b32 lean_right;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/* DOC(The enumeration of types of managed objects.) */
|
|
||||||
ENUM(i32, Managed_Object_Type)
|
ENUM(i32, 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,
|
||||||
/* DOC(TODO) */
|
|
||||||
ManagedObjectType_Arena = 3,
|
|
||||||
|
|
||||||
|
|
||||||
ManagedObjectType_COUNT = 4,
|
ManagedObjectType_COUNT = 4,
|
||||||
};
|
};
|
||||||
|
|
||||||
/* 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 u64 Managed_ID;
|
||||||
|
|
||||||
TYPEDEF u64 Managed_Scope;
|
TYPEDEF u64 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 i32 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 u64 Managed_Object;
|
TYPEDEF u64 Managed_Object;
|
||||||
|
|
||||||
static Managed_Scope ManagedScope_NULL = 0;
|
static Managed_Scope ManagedScope_NULL = 0;
|
||||||
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.)
|
static Managed_ID ManagedIndex_ERROR = 0;
|
||||||
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;
|
||||||
u32 slot_id;
|
u32 slot_id;
|
||||||
u32 gen_id;
|
u32 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(i32, Marker_Visual_Type)
|
|
||||||
{
|
|
||||||
/* DOC(No visual effect, with this type it is as if the marker visual does not exist.) */
|
|
||||||
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,
|
|
||||||
/* 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,
|
|
||||||
/* 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,
|
|
||||||
/* 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,
|
|
||||||
/* 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,
|
|
||||||
/* 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_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(u32, 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,
|
|
||||||
/* 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,
|
|
||||||
};
|
|
||||||
|
|
||||||
/* 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(i32, Marker_Visual_Text_Style)
|
|
||||||
{
|
|
||||||
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{
|
|
||||||
/* DOC(The index of the first marker to take. Indices are zero based. The default value is zero.) */
|
|
||||||
i32 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.) */
|
|
||||||
i32 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.) */
|
|
||||||
i32 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.) */
|
|
||||||
i32 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(u32, Marker_Visual_Priority_Level){
|
|
||||||
VisualPriority_Lowest = 0,
|
|
||||||
VisualPriority_Low = 1000,
|
|
||||||
VisualPriority_Default = 2000,
|
|
||||||
VisualPriority_High = 3000,
|
|
||||||
VisualPriority_Highest = 4000,
|
|
||||||
};
|
|
||||||
|
|
||||||
/* DOC(Flags that control how font glyphs are modified before drawing.) */
|
|
||||||
ENUM(u32, Glyph_Flag){
|
ENUM(u32, Glyph_Flag){
|
||||||
GlyphFlag_None = 0x0,
|
GlyphFlag_None = 0x0,
|
||||||
GlyphFlag_Rotate90 = 0x1,
|
GlyphFlag_Rotate90 = 0x1,
|
||||||
};
|
};
|
||||||
|
|
||||||
/* DOC(Query_Bar is a struct used to store information in the user's control that will be displayed as a drop down bar durring an interactive command.) */
|
|
||||||
STRUCT Query_Bar{
|
STRUCT Query_Bar{
|
||||||
/* DOC(This specifies the prompt portion of the drop down bar.) */
|
|
||||||
String_Const_u8 prompt;
|
String_Const_u8 prompt;
|
||||||
/* DOC(This specifies the main string portion of the drop down bar.) */
|
|
||||||
String_Const_u8 string;
|
String_Const_u8 string;
|
||||||
/* DOC(This specifies the memory capacity allocated for string.) */
|
|
||||||
umem string_capacity;
|
umem string_capacity;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -698,58 +387,30 @@ STRUCT Query_Bar_Ptr_Array{
|
||||||
TYPEDEF_FUNC void UI_Quit_Function_Type(struct Application_Links *app, View_ID view);
|
TYPEDEF_FUNC void UI_Quit_Function_Type(struct Application_Links *app, View_ID view);
|
||||||
#define UI_QUIT_FUNCTION(name) void name(struct Application_Links *app, View_ID view)
|
#define UI_QUIT_FUNCTION(name) void name(struct Application_Links *app, View_ID view)
|
||||||
|
|
||||||
/*
|
|
||||||
DOC(Theme_Color stores a style tag/color pair, for the purpose of setting and getting colors in the theme.)
|
|
||||||
DOC_SEE(Style_Tag)
|
|
||||||
DOC_SEE(int_color)
|
|
||||||
*/
|
|
||||||
STRUCT Theme_Color{
|
STRUCT Theme_Color{
|
||||||
/* DOC(The style slot in the style palette.) */
|
|
||||||
id_color tag;
|
id_color tag;
|
||||||
/* DOC(The color in the slot.) */
|
|
||||||
argb_color color;
|
argb_color color;
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
|
||||||
DOC(Theme lists every color that makes up a standard color scheme.)
|
|
||||||
DOC_SEE(int_color)
|
|
||||||
*/
|
|
||||||
//STRUCT Theme{
|
//STRUCT Theme{
|
||||||
/* DOC(The colors array. Every style tag, beginning with "Stag", is an index into it's corresponding color in the array.) */
|
|
||||||
//int_color colors[Stag_COUNT];
|
//int_color colors[Stag_COUNT];
|
||||||
//};
|
//};
|
||||||
|
|
||||||
/*
|
|
||||||
DOC(Every face is assigned a unique and consistent Face_ID for it's life time. This represents a slot in which a face can exist. The face in the slot is always valid once it exists, but the face might be changed or released durring it's lifetime. A Face_ID value of zero is reserved for the meaning "not a valid face".)
|
|
||||||
*/
|
|
||||||
TYPEDEF u32 Face_ID;
|
TYPEDEF u32 Face_ID;
|
||||||
|
|
||||||
// TODO(allen): redocument
|
|
||||||
STRUCT Font_Load_Location{
|
STRUCT Font_Load_Location{
|
||||||
String_Const_u8 file_name;
|
String_Const_u8 file_name;
|
||||||
b32 in_4coder_font_folder;
|
b32 in_4coder_font_folder;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
// TODO(allen): redocument
|
|
||||||
STRUCT Face_Load_Parameters{
|
STRUCT Face_Load_Parameters{
|
||||||
/* DOC(Indicates the size for the face. Valid values must be greater than 0. Different fonts with the same pt_size do not necessarily have the same line height.) */
|
|
||||||
u32 pt_size;
|
u32 pt_size;
|
||||||
|
|
||||||
/* DOC(Indicates whether the face tries to use a bold style.) */
|
|
||||||
b32 bold;
|
b32 bold;
|
||||||
|
|
||||||
/* DOC(Indicates whether the face tries to use an italic style.) */
|
|
||||||
b32 italic;
|
b32 italic;
|
||||||
|
|
||||||
/* DOC(Indicates whether the face tries to underline text.) */
|
|
||||||
b32 underline;
|
b32 underline;
|
||||||
|
|
||||||
/* DOC(Indicates whether the face tries to apply hinting.) */
|
|
||||||
b32 hinting;
|
b32 hinting;
|
||||||
};
|
};
|
||||||
|
|
||||||
// TODO(allen): redocument
|
|
||||||
STRUCT Face_Description{
|
STRUCT Face_Description{
|
||||||
Font_Load_Location font;
|
Font_Load_Location font;
|
||||||
Face_Load_Parameters parameters;
|
Face_Load_Parameters parameters;
|
||||||
|
@ -809,7 +470,6 @@ STRUCT Record_Info{
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
/* DOC(Custom_Command_Function is a function type which matches the signature used for commands. To declare a command use CUSTOM_COMMAND_SIG.) DOC_SEE(CUSTOM_COMMAND_SIG) */
|
|
||||||
TYPEDEF void Custom_Command_Function(struct Application_Links *app);
|
TYPEDEF void Custom_Command_Function(struct Application_Links *app);
|
||||||
|
|
||||||
#if defined(CUSTOM_COMMAND_SIG) || defined(CUSTOM_DOC) || defined(CUSTOM_ALIAS)
|
#if defined(CUSTOM_COMMAND_SIG) || defined(CUSTOM_DOC) || defined(CUSTOM_ALIAS)
|
||||||
|
@ -826,27 +486,14 @@ TYPEDEF void Custom_Command_Function(struct Application_Links *app);
|
||||||
#define CUSTOM_ALIAS(x) CUSTOM_ALIAS(x)
|
#define CUSTOM_ALIAS(x) CUSTOM_ALIAS(x)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* DOC(Generic_Command acts as a name for a command, and can name an internal command or a custom command.) */
|
|
||||||
UNION Generic_Command{
|
UNION Generic_Command{
|
||||||
/* DOC(If this Generic_Command does not represent an internal command the command field is the pointer to the custom command..) */
|
|
||||||
Custom_Command_Function *command;
|
Custom_Command_Function *command;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
DOC(User_Input describes an event, such as key presses, mouse button presses, mouse moves,
|
|
||||||
and also non-input related events like animation frames, and view activation changes.)
|
|
||||||
DOC_SEE(Generic_Command)
|
|
||||||
DOC_SEE(Key_Event_Data)
|
|
||||||
*/
|
|
||||||
STRUCT User_Input{
|
STRUCT User_Input{
|
||||||
/* DOC(The description of the event.) */
|
|
||||||
Key_Event_Data key;
|
Key_Event_Data key;
|
||||||
/* DOC(If this event would trigger a command, this field specifies what the command would be.) */
|
|
||||||
Generic_Command command;
|
Generic_Command command;
|
||||||
/* DOC(This field indicates that an abort event has occurred and the command needs to shut down.
|
|
||||||
This can be set even if key and command are also set, in which case the command still needs to abort, and the key and command simply reflect
|
|
||||||
what event triggered the abort event.) */
|
|
||||||
b32 abort;
|
b32 abort;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -858,52 +505,30 @@ STRUCT Frame_Info{
|
||||||
|
|
||||||
TYPEDEF_FUNC void Render_Callback(struct Application_Links *app);
|
TYPEDEF_FUNC void Render_Callback(struct Application_Links *app);
|
||||||
|
|
||||||
/* DOC(Hook_IDs name the various hooks in 4coder, these hooks use the Hook_Function signature.)
|
|
||||||
DOC_SEE(Hook_Function) */
|
|
||||||
ENUM(i32, Hook_ID){
|
ENUM(i32, Hook_ID){
|
||||||
/* DOC(TODO) */
|
|
||||||
hook_file_out_of_sync,
|
hook_file_out_of_sync,
|
||||||
/* DOC(TODO) */
|
|
||||||
hook_exit,
|
hook_exit,
|
||||||
/* DOC(TODO) */
|
|
||||||
hook_buffer_viewer_update,
|
hook_buffer_viewer_update,
|
||||||
// never below this
|
// never below this
|
||||||
hook_type_count
|
hook_type_count
|
||||||
};
|
};
|
||||||
|
|
||||||
/* DOC(Special_Hook_IDs name special hooks that use specialized signatures.) */
|
|
||||||
ENUM(i32, Special_Hook_ID){
|
ENUM(i32, Special_Hook_ID){
|
||||||
/* DOC(TODO) */
|
|
||||||
special_hook_scroll_rule = hook_type_count,
|
special_hook_scroll_rule = hook_type_count,
|
||||||
/* DOC(TODO) */
|
|
||||||
special_hook_new_file,
|
special_hook_new_file,
|
||||||
/* DOC(TODO) */
|
|
||||||
special_hook_open_file,
|
special_hook_open_file,
|
||||||
/* DOC(TODO) */
|
|
||||||
special_hook_save_file,
|
special_hook_save_file,
|
||||||
/* DOC(TODO) */
|
|
||||||
special_hook_end_file,
|
special_hook_end_file,
|
||||||
/* DOC(TODO) */
|
|
||||||
special_hook_file_edit_range,
|
special_hook_file_edit_range,
|
||||||
/* DOC(TODO) */
|
|
||||||
special_hook_file_edit_finished,
|
special_hook_file_edit_finished,
|
||||||
/* DOC(TODO) */
|
|
||||||
special_hook_file_externally_modified,
|
special_hook_file_externally_modified,
|
||||||
/* DOC(TODO) */
|
|
||||||
special_hook_command_caller,
|
special_hook_command_caller,
|
||||||
/* DOC(TODO) */
|
|
||||||
special_hook_render_caller,
|
special_hook_render_caller,
|
||||||
/* DOC(TODO) */
|
|
||||||
special_hook_input_filter,
|
special_hook_input_filter,
|
||||||
/* DOC(TODO) */
|
|
||||||
special_hook_start,
|
special_hook_start,
|
||||||
/* DOC(TODO) */
|
|
||||||
special_hook_buffer_name_resolver,
|
special_hook_buffer_name_resolver,
|
||||||
/* DOC(TODO) */
|
|
||||||
special_hook_modify_color_table,
|
special_hook_modify_color_table,
|
||||||
/* DOC(TODO) */
|
|
||||||
special_hook_clipboard_change,
|
special_hook_clipboard_change,
|
||||||
/* DOC(TODO) */
|
|
||||||
special_hook_get_view_buffer_region,
|
special_hook_get_view_buffer_region,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -916,8 +541,8 @@ TYPEDEF_FUNC void Render_Caller_Function(struct Application_Links *app, Frame_In
|
||||||
TYPEDEF_FUNC i32 Hook_Function(struct Application_Links *app);
|
TYPEDEF_FUNC i32 Hook_Function(struct Application_Links *app);
|
||||||
#define HOOK_SIG(name) i32 name(struct Application_Links *app)
|
#define HOOK_SIG(name) i32 name(struct Application_Links *app)
|
||||||
|
|
||||||
TYPEDEF_FUNC i32 Open_File_Hook_Function(struct Application_Links *app, Buffer_ID buffer_id);
|
TYPEDEF_FUNC i32 Buffer_Hook_Function(struct Application_Links *app, Buffer_ID buffer_id);
|
||||||
#define OPEN_FILE_HOOK_SIG(name) i32 name(struct Application_Links *app, Buffer_ID buffer_id)
|
#define BUFFER_HOOK_SIG(name) i32 name(struct Application_Links *app, Buffer_ID buffer_id)
|
||||||
|
|
||||||
TYPEDEF_FUNC i32 File_Edit_Range_Function(struct Application_Links *app, Buffer_ID buffer_id,
|
TYPEDEF_FUNC i32 File_Edit_Range_Function(struct Application_Links *app, Buffer_ID buffer_id,
|
||||||
Interval_i64 range, String_Const_u8 text);
|
Interval_i64 range, String_Const_u8 text);
|
||||||
|
@ -975,10 +600,7 @@ TYPEDEF_FUNC i32 Get_Binding_Data_Function(void *data, i32 size);
|
||||||
// NOTE(allen): Definitions for the format that Get_Binding_Data uses to launch 4coder.
|
// NOTE(allen): Definitions for the format that Get_Binding_Data uses to launch 4coder.
|
||||||
// TODO(allen): Transition to a more dynamic Command_Map system.
|
// TODO(allen): Transition to a more dynamic Command_Map system.
|
||||||
|
|
||||||
/*
|
|
||||||
DOC(Values for the type field in the discriminated union Binding_Unit.)
|
|
||||||
DOC_SEE(Binding_Unit)
|
|
||||||
*/
|
|
||||||
ENUM(i32, Binding_Unit_Type){
|
ENUM(i32, Binding_Unit_Type){
|
||||||
unit_header,
|
unit_header,
|
||||||
unit_map_begin,
|
unit_map_begin,
|
||||||
|
@ -987,7 +609,6 @@ ENUM(i32, Binding_Unit_Type){
|
||||||
unit_hook
|
unit_hook
|
||||||
};
|
};
|
||||||
|
|
||||||
/* DOC(Values for built in command maps.) */
|
|
||||||
ENUM(i32, Map_ID){
|
ENUM(i32, Map_ID){
|
||||||
mapid_global = (1 << 24),
|
mapid_global = (1 << 24),
|
||||||
mapid_file,
|
mapid_file,
|
||||||
|
@ -996,8 +617,6 @@ ENUM(i32, Map_ID){
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
DOC(Describes a unit of information for setting up key bindings. A unit can set a key binding, switch the active map, set the inherited map, or set a hook.) */
|
|
||||||
STRUCT Binding_Unit{
|
STRUCT Binding_Unit{
|
||||||
Binding_Unit_Type type;
|
Binding_Unit_Type type;
|
||||||
UNION{
|
UNION{
|
||||||
|
@ -1045,5 +664,43 @@ STRUCT Process_State{
|
||||||
i64 return_code;
|
i64 return_code;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
ENUM(i16, Token_Base_Kind){
|
||||||
|
TokenBaseKind_EOF,
|
||||||
|
TokenBaseKind_Whitespace,
|
||||||
|
TokenBaseKind_LexError,
|
||||||
|
TokenBaseKind_Comment,
|
||||||
|
TokenBaseKind_Keyword,
|
||||||
|
TokenBaseKind_Identifier,
|
||||||
|
TokenBaseKind_Operator,
|
||||||
|
TokenBaseKind_LiteralInteger,
|
||||||
|
TokenBaseKind_LiteralFloat,
|
||||||
|
TokenBaseKind_LiteralString,
|
||||||
|
TokenBaseKind_ScopeOpen,
|
||||||
|
TokenBaseKind_ScopeClose,
|
||||||
|
TokenBaseKind_ParentheticalOpen,
|
||||||
|
TokenBaseKind_ParentheticalClose,
|
||||||
|
|
||||||
|
TokenBaseKind_COUNT,
|
||||||
|
};
|
||||||
|
|
||||||
|
ENUM(u16, Token_Base_Flags){
|
||||||
|
TokenBaseFlag_PreProcessorBody = 1,
|
||||||
|
};
|
||||||
|
|
||||||
|
STRUCT Token{
|
||||||
|
i64 pos;
|
||||||
|
i64 size;
|
||||||
|
Token_Base_Kind kind;
|
||||||
|
Token_Base_Flags flags;
|
||||||
|
i16 sub_kind;
|
||||||
|
u16 sub_flags;
|
||||||
|
};
|
||||||
|
|
||||||
|
STRUCT Token_Array{
|
||||||
|
Token *tokens;
|
||||||
|
i64 count;
|
||||||
|
i64 max;
|
||||||
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -63,20 +63,20 @@ set_line_indents(Application_Links *app, Arena *arena, Buffer_ID buffer, i64 fir
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
internal Cpp_Token*
|
internal Token*
|
||||||
seek_matching_token_backwards(Cpp_Token_Array tokens, Cpp_Token *token,
|
seek_matching_token_backwards(Token_Array tokens, Token *token,
|
||||||
Cpp_Token_Type open_type, Cpp_Token_Type close_type){
|
Token_Base_Kind open, Token_Base_Kind close){
|
||||||
if (token <= tokens.tokens){
|
if (token <= tokens.tokens){
|
||||||
token = tokens.tokens;
|
token = tokens.tokens;
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
i32 nesting_level = 0;
|
i32 nesting_level = 0;
|
||||||
for (; token > tokens.tokens; --token){
|
for (; token > tokens.tokens; --token){
|
||||||
if (!(token->flags & CPP_TFLAG_PP_BODY)){
|
if (!HasFlag(token->flags, TokenBaseFlag_PreProcessorBody)){
|
||||||
if (token->type == close_type){
|
if (token->kind == close){
|
||||||
++nesting_level;
|
++nesting_level;
|
||||||
}
|
}
|
||||||
else if (token->type == open_type){
|
else if (token->kind == open){
|
||||||
if (nesting_level == 0){
|
if (nesting_level == 0){
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -91,17 +91,17 @@ seek_matching_token_backwards(Cpp_Token_Array tokens, Cpp_Token *token,
|
||||||
}
|
}
|
||||||
|
|
||||||
internal Indent_Anchor_Position
|
internal Indent_Anchor_Position
|
||||||
find_anchor_token(Application_Links *app, Buffer_ID buffer, Cpp_Token_Array tokens, i64 line_start, i32 tab_width){
|
find_anchor_token(Application_Links *app, Buffer_ID buffer, Token_Array tokens, i64 line_start, i32 tab_width){
|
||||||
Indent_Anchor_Position anchor = {};
|
Indent_Anchor_Position anchor = {};
|
||||||
if (tokens.count > 0){
|
if (tokens.count > 0){
|
||||||
Cpp_Token *first_invalid_token = get_first_token_from_line(app, buffer, tokens, line_start);
|
Token *first_invalid_token = get_first_token_from_line(app, buffer, tokens, line_start);
|
||||||
if (first_invalid_token <= tokens.tokens){
|
if (first_invalid_token <= tokens.tokens){
|
||||||
anchor.token = tokens.tokens;
|
anchor.token = tokens.tokens;
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
i32 stack[256];
|
i32 stack[256];
|
||||||
i32 top = -1;
|
i32 top = -1;
|
||||||
Cpp_Token *token_it = tokens.tokens;
|
Token *token_it = tokens.tokens;
|
||||||
i64 highest_checked_line_number = -1;
|
i64 highest_checked_line_number = -1;
|
||||||
for (; token_it < first_invalid_token; ++token_it){
|
for (; token_it < first_invalid_token; ++token_it){
|
||||||
i64 line_number = get_line_number_from_pos(app, buffer, token_it->start);
|
i64 line_number = get_line_number_from_pos(app, buffer, token_it->start);
|
||||||
|
@ -169,7 +169,7 @@ find_anchor_token(Application_Links *app, Buffer_ID buffer, Cpp_Token_Array toke
|
||||||
|
|
||||||
internal i64*
|
internal i64*
|
||||||
get_indentation_marks(Application_Links *app, Arena *arena, Buffer_ID buffer,
|
get_indentation_marks(Application_Links *app, Arena *arena, Buffer_ID buffer,
|
||||||
Cpp_Token_Array tokens, i64 first_line, i64 one_past_last_line,
|
Token_Array tokens, i64 first_line, i64 one_past_last_line,
|
||||||
b32 exact_align, i32 tab_width){
|
b32 exact_align, i32 tab_width){
|
||||||
i64 indent_mark_count = one_past_last_line - first_line;
|
i64 indent_mark_count = one_past_last_line - first_line;
|
||||||
i64 *indent_marks = push_array(arena, i64, indent_mark_count);
|
i64 *indent_marks = push_array(arena, i64, indent_mark_count);
|
||||||
|
@ -178,7 +178,7 @@ get_indentation_marks(Application_Links *app, Arena *arena, Buffer_ID buffer,
|
||||||
|
|
||||||
// Decide where to start indentation parsing.
|
// Decide where to start indentation parsing.
|
||||||
Indent_Anchor_Position anchor = find_anchor_token(app, buffer, tokens, first_line, tab_width);
|
Indent_Anchor_Position anchor = find_anchor_token(app, buffer, tokens, first_line, tab_width);
|
||||||
Cpp_Token *token_ptr = anchor.token;
|
Token *token_ptr = anchor.token;
|
||||||
Indent_Parse_State indent = {};
|
Indent_Parse_State indent = {};
|
||||||
indent.current_indent = anchor.indentation;
|
indent.current_indent = anchor.indentation;
|
||||||
|
|
||||||
|
@ -199,8 +199,8 @@ get_indentation_marks(Application_Links *app, Arena *arena, Buffer_ID buffer,
|
||||||
|
|
||||||
i64 next_line_start_pos = get_line_start_pos(app, buffer, line_number);
|
i64 next_line_start_pos = get_line_start_pos(app, buffer, line_number);
|
||||||
indent.previous_line_indent = indent.current_indent;
|
indent.previous_line_indent = indent.current_indent;
|
||||||
Cpp_Token prev_token = {};
|
Token prev_token = {};
|
||||||
Cpp_Token token = {};
|
Token token = {};
|
||||||
if (token_ptr < tokens.tokens + tokens.count){
|
if (token_ptr < tokens.tokens + tokens.count){
|
||||||
token = *token_ptr;
|
token = *token_ptr;
|
||||||
}
|
}
|
||||||
|
@ -295,8 +295,8 @@ get_indentation_marks(Application_Links *app, Arena *arena, Buffer_ID buffer,
|
||||||
if (indent.current_indent > 0){
|
if (indent.current_indent > 0){
|
||||||
b32 statement_complete = false;
|
b32 statement_complete = false;
|
||||||
|
|
||||||
Cpp_Token *prev_usable_token_ptr = token_ptr - 1;
|
Token *prev_usable_token_ptr = token_ptr - 1;
|
||||||
Cpp_Token prev_usable_token = {};
|
Token prev_usable_token = {};
|
||||||
if (prev_usable_token_ptr >= tokens.tokens){
|
if (prev_usable_token_ptr >= tokens.tokens){
|
||||||
prev_usable_token = *prev_usable_token_ptr;
|
prev_usable_token = *prev_usable_token_ptr;
|
||||||
}
|
}
|
||||||
|
@ -441,13 +441,13 @@ get_indent_lines_minimum(Application_Links *app, Buffer_ID buffer, i64 start_pos
|
||||||
}
|
}
|
||||||
|
|
||||||
internal void
|
internal void
|
||||||
get_indent_lines_whole_tokens(Application_Links *app, Buffer_ID buffer, Cpp_Token_Array tokens, i64 start_pos, i64 end_pos, i64 *line_start_out, i64 *line_end_out){
|
get_indent_lines_whole_tokens(Application_Links *app, Buffer_ID buffer, Token_Array tokens, i64 start_pos, i64 end_pos, i64 *line_start_out, i64 *line_end_out){
|
||||||
i64 line_start = get_line_number_from_pos(app, buffer, start_pos);
|
i64 line_start = get_line_number_from_pos(app, buffer, start_pos);
|
||||||
i64 line_end = get_line_number_from_pos(app, buffer, end_pos);
|
i64 line_end = get_line_number_from_pos(app, buffer, end_pos);
|
||||||
|
|
||||||
for (;line_start > 1;){
|
for (;line_start > 1;){
|
||||||
i64 line_start_pos = get_line_start_pos(app, buffer, line_start);
|
i64 line_start_pos = get_line_start_pos(app, buffer, line_start);
|
||||||
Cpp_Token *token = get_first_token_from_pos(tokens, line_start_pos);
|
Token *token = get_first_token_from_pos(tokens, line_start_pos);
|
||||||
if (token != 0 && token->start < line_start_pos){
|
if (token != 0 && token->start < line_start_pos){
|
||||||
line_start = get_line_number_from_pos(app, buffer, token->start);
|
line_start = get_line_number_from_pos(app, buffer, token->start);
|
||||||
}
|
}
|
||||||
|
@ -460,7 +460,7 @@ get_indent_lines_whole_tokens(Application_Links *app, Buffer_ID buffer, Cpp_Toke
|
||||||
|
|
||||||
for (;line_end < line_count;){
|
for (;line_end < line_count;){
|
||||||
i64 next_line_start_pos = get_line_start_pos(app, buffer, line_end + 1);
|
i64 next_line_start_pos = get_line_start_pos(app, buffer, line_end + 1);
|
||||||
Cpp_Token *token = get_first_token_from_pos(tokens, next_line_start_pos);
|
Token *token = get_first_token_from_pos(tokens, next_line_start_pos);
|
||||||
if (token != 0 && token->start < next_line_start_pos){
|
if (token != 0 && token->start < next_line_start_pos){
|
||||||
line_end = get_line_number_from_pos(app, buffer, token->start + token->size);
|
line_end = get_line_number_from_pos(app, buffer, token->start + token->size);
|
||||||
}
|
}
|
||||||
|
@ -479,16 +479,14 @@ get_indent_lines_whole_tokens(Application_Links *app, Buffer_ID buffer, Cpp_Toke
|
||||||
internal b32
|
internal b32
|
||||||
buffer_auto_indent(Application_Links *app, Buffer_ID buffer, i64 start, i64 end, i32 tab_width, Auto_Indent_Flag flags){
|
buffer_auto_indent(Application_Links *app, Buffer_ID buffer, i64 start, i64 end, i32 tab_width, Auto_Indent_Flag flags){
|
||||||
b32 result = false;
|
b32 result = false;
|
||||||
if (buffer_exists(app, buffer) && buffer_tokens_are_ready(app, buffer)){
|
|
||||||
result = true;
|
|
||||||
|
|
||||||
|
Managed_Scope scope = buffer_get_managed_scope(app, buffer);
|
||||||
|
|
||||||
|
Token_Array *tokens_ptr = scope_attachment(app, scope, attachment_tokens, Token_Array);
|
||||||
|
if (tokens_ptr != 0 && tokens_ptr->count != 0){
|
||||||
Scratch_Block scratch(app);
|
Scratch_Block scratch(app);
|
||||||
|
Token_Array tokens = *token_ptr;
|
||||||
|
|
||||||
// Stage 1: Read the tokens to be used for indentation.
|
|
||||||
Cpp_Token_Array tokens = buffer_get_token_array(app, buffer);
|
|
||||||
|
|
||||||
// Stage 2: Decide where the first and last lines are.
|
|
||||||
// The lines in the range [line_start,line_end) will be indented.
|
|
||||||
i64 line_start = 0;
|
i64 line_start = 0;
|
||||||
i64 line_end = 0;
|
i64 line_end = 0;
|
||||||
if (HasFlag(flags, AutoIndent_FullTokens)){
|
if (HasFlag(flags, AutoIndent_FullTokens)){
|
||||||
|
@ -498,18 +496,16 @@ buffer_auto_indent(Application_Links *app, Buffer_ID buffer, i64 start, i64 end,
|
||||||
get_indent_lines_minimum(app, buffer, start, end, &line_start, &line_end);
|
get_indent_lines_minimum(app, buffer, start, end, &line_start, &line_end);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Stage 3: Decide Indent Amounts
|
|
||||||
// Get an array representing how much each line in
|
|
||||||
// the range [line_start,line_end) should be indented.
|
|
||||||
i64 *indent_marks = get_indentation_marks(app, scratch, buffer, tokens, line_start, line_end, (flags & AutoIndent_ExactAlignBlock), tab_width);
|
i64 *indent_marks = get_indentation_marks(app, scratch, buffer, tokens, line_start, line_end, (flags & AutoIndent_ExactAlignBlock), tab_width);
|
||||||
|
|
||||||
// Stage 4: Set the Line Indents
|
|
||||||
Indent_Options opts = {};
|
Indent_Options opts = {};
|
||||||
opts.empty_blank_lines = (flags & AutoIndent_ClearLine);
|
opts.empty_blank_lines = (flags & AutoIndent_ClearLine);
|
||||||
opts.use_tabs = (flags & AutoIndent_UseTab);
|
opts.use_tabs = (flags & AutoIndent_UseTab);
|
||||||
opts.tab_width = tab_width;
|
opts.tab_width = tab_width;
|
||||||
|
|
||||||
set_line_indents(app, scratch, buffer, line_start, line_end, indent_marks, opts);
|
set_line_indents(app, scratch, buffer, line_start, line_end, indent_marks, opts);
|
||||||
|
|
||||||
|
result = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return(result);
|
return(result);
|
||||||
|
|
|
@ -23,7 +23,7 @@ struct Indent_Parse_State{
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Indent_Anchor_Position{
|
struct Indent_Anchor_Position{
|
||||||
Cpp_Token *token;
|
Token *token;
|
||||||
i32 indentation;
|
i32 indentation;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -695,11 +695,14 @@ CUSTOM_DOC("Toggles the visibility status of the current view's filebar.")
|
||||||
CUSTOM_COMMAND_SIG(toggle_line_wrap)
|
CUSTOM_COMMAND_SIG(toggle_line_wrap)
|
||||||
CUSTOM_DOC("Toggles the current buffer's line wrapping status.")
|
CUSTOM_DOC("Toggles the current buffer's line wrapping status.")
|
||||||
{
|
{
|
||||||
|
NotImplemented;
|
||||||
|
#if 0
|
||||||
View_ID view = get_active_view(app, AccessProtected);
|
View_ID view = get_active_view(app, AccessProtected);
|
||||||
Buffer_ID buffer = view_get_buffer(app, view, AccessProtected);
|
Buffer_ID buffer = view_get_buffer(app, view, AccessProtected);
|
||||||
b32 wrapped;
|
b32 wrapped;
|
||||||
buffer_get_setting(app, buffer, BufferSetting_WrapLine, &wrapped);
|
buffer_get_setting(app, buffer, BufferSetting_WrapLine, &wrapped);
|
||||||
buffer_set_setting(app, buffer, BufferSetting_WrapLine, !wrapped);
|
buffer_set_setting(app, buffer, BufferSetting_WrapLine, !wrapped);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
CUSTOM_COMMAND_SIG(toggle_fps_meter)
|
CUSTOM_COMMAND_SIG(toggle_fps_meter)
|
||||||
|
@ -711,21 +714,27 @@ CUSTOM_DOC("Toggles the visibility of the FPS performance meter")
|
||||||
CUSTOM_COMMAND_SIG(increase_line_wrap)
|
CUSTOM_COMMAND_SIG(increase_line_wrap)
|
||||||
CUSTOM_DOC("Increases the current buffer's width for line wrapping.")
|
CUSTOM_DOC("Increases the current buffer's width for line wrapping.")
|
||||||
{
|
{
|
||||||
|
NotImplemented;
|
||||||
|
#if 0
|
||||||
View_ID view = get_active_view(app, AccessProtected);
|
View_ID view = get_active_view(app, AccessProtected);
|
||||||
Buffer_ID buffer = view_get_buffer(app, view, AccessProtected);
|
Buffer_ID buffer = view_get_buffer(app, view, AccessProtected);
|
||||||
i32 wrap = 0;
|
i32 wrap = 0;
|
||||||
buffer_get_setting(app, buffer, BufferSetting_WrapPosition, &wrap);
|
buffer_get_setting(app, buffer, BufferSetting_WrapPosition, &wrap);
|
||||||
buffer_set_setting(app, buffer, BufferSetting_WrapPosition, wrap + 10);
|
buffer_set_setting(app, buffer, BufferSetting_WrapPosition, wrap + 10);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
CUSTOM_COMMAND_SIG(decrease_line_wrap)
|
CUSTOM_COMMAND_SIG(decrease_line_wrap)
|
||||||
CUSTOM_DOC("Decrases the current buffer's width for line wrapping.")
|
CUSTOM_DOC("Decrases the current buffer's width for line wrapping.")
|
||||||
{
|
{
|
||||||
|
NotImplemented;
|
||||||
|
#if 0
|
||||||
View_ID view = get_active_view(app, AccessProtected);
|
View_ID view = get_active_view(app, AccessProtected);
|
||||||
Buffer_ID buffer = view_get_buffer(app, view, AccessProtected);
|
Buffer_ID buffer = view_get_buffer(app, view, AccessProtected);
|
||||||
i32 wrap = 0;
|
i32 wrap = 0;
|
||||||
buffer_get_setting(app, buffer, BufferSetting_WrapPosition, &wrap);
|
buffer_get_setting(app, buffer, BufferSetting_WrapPosition, &wrap);
|
||||||
buffer_set_setting(app, buffer, BufferSetting_WrapPosition, wrap - 10);
|
buffer_set_setting(app, buffer, BufferSetting_WrapPosition, wrap - 10);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
CUSTOM_COMMAND_SIG(increase_face_size)
|
CUSTOM_COMMAND_SIG(increase_face_size)
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1107,6 +1107,34 @@ struct Scratch_Block{
|
||||||
Temp_Memory temp;
|
Temp_Memory temp;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
////////////////////////////////
|
||||||
|
|
||||||
|
struct Heap_Basic_Node{
|
||||||
|
Heap_Basic_Node *next;
|
||||||
|
Heap_Basic_Node *prev;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct Heap_Node{
|
||||||
|
union{
|
||||||
|
struct{
|
||||||
|
Heap_Basic_Node order;
|
||||||
|
Heap_Basic_Node alloc;
|
||||||
|
umem size;
|
||||||
|
};
|
||||||
|
u8 force_size__[64];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
struct Heap{
|
||||||
|
Arena arena;
|
||||||
|
Heap_Basic_Node in_order;
|
||||||
|
Heap_Basic_Node free_nodes;
|
||||||
|
umem used_space;
|
||||||
|
umem total_space;
|
||||||
|
};
|
||||||
|
|
||||||
|
//#define DO_HEAP_CHECKS
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// BOTTOM
|
// BOTTOM
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -45,13 +45,14 @@ CUSTOM_DOC("At the cursor, insert the text at the top of the clipboard.")
|
||||||
if_view_has_highlighted_range_delete_range(app, view);
|
if_view_has_highlighted_range_delete_range(app, view);
|
||||||
|
|
||||||
Managed_Scope scope = view_get_managed_scope(app, view);
|
Managed_Scope scope = view_get_managed_scope(app, view);
|
||||||
managed_variable_set(app, scope, view_next_rewrite_loc, RewritePaste);
|
Rewrite_Type *rewrite = scope_attachment(app, scope, view_next_rewrite_loc, Rewrite_Type);
|
||||||
i32 paste_index = 0;
|
*rewrite = Rewrite_Paste;
|
||||||
managed_variable_set(app, scope, view_paste_index_loc, paste_index);
|
i32 *paste_index = scope_attachment(app, scope, view_paste_index_loc, i32);
|
||||||
|
*paste_index = 0;
|
||||||
|
|
||||||
Scratch_Block scratch(app);
|
Scratch_Block scratch(app);
|
||||||
|
|
||||||
String_Const_u8 string = push_clipboard_index(app, scratch, 0, paste_index);
|
String_Const_u8 string = push_clipboard_index(app, scratch, 0, *paste_index);
|
||||||
if (string.size > 0){
|
if (string.size > 0){
|
||||||
Buffer_ID buffer = view_get_buffer(app, view, AccessOpen);
|
Buffer_ID buffer = view_get_buffer(app, view, AccessOpen);
|
||||||
|
|
||||||
|
@ -80,14 +81,13 @@ CUSTOM_DOC("If the previous command was paste or paste_next, replaces the paste
|
||||||
Managed_Scope scope = view_get_managed_scope(app, view);
|
Managed_Scope scope = view_get_managed_scope(app, view);
|
||||||
no_mark_snap_to_cursor(app, scope);
|
no_mark_snap_to_cursor(app, scope);
|
||||||
|
|
||||||
u64 rewrite = 0;
|
Rewrite_Type *rewrite = scope_attachment(app, scope, view_next_rewrite_loc, Rewrite_Type);
|
||||||
managed_variable_get(app, scope, view_rewrite_loc, &rewrite);
|
if (*rewrite == Rewrite_Paste){
|
||||||
if (rewrite == RewritePaste){
|
Rewrite_Type *next_rewrite = scope_attachment(app, scope, view_next_rewrite_loc, Rewrite_Type);
|
||||||
managed_variable_set(app, scope, view_next_rewrite_loc, RewritePaste);
|
*next_rewrite = Rewrite_Paste;
|
||||||
u64 prev_paste_index = 0;
|
i32 *paste_index_ptr = scope_attachment(app, scope, view_paste_index_loc, i32);
|
||||||
managed_variable_get(app, scope, view_paste_index_loc, &prev_paste_index);
|
i32 paste_index = (*paste_index_ptr) + 1;
|
||||||
i32 paste_index = (i32)prev_paste_index + 1;
|
*paste_index_ptr = paste_index;
|
||||||
managed_variable_set(app, scope, view_paste_index_loc, paste_index);
|
|
||||||
|
|
||||||
String_Const_u8 string = push_clipboard_index(app, scratch, 0, paste_index);
|
String_Const_u8 string = push_clipboard_index(app, scratch, 0, paste_index);
|
||||||
|
|
||||||
|
|
|
@ -72,8 +72,8 @@ config_stringize_errors(Arena *arena, Config *parsed){
|
||||||
|
|
||||||
static void
|
static void
|
||||||
config_parser__advance_to_next(Config_Parser *ctx){
|
config_parser__advance_to_next(Config_Parser *ctx){
|
||||||
Cpp_Token *t = ctx->token;
|
Token *t = ctx->token;
|
||||||
Cpp_Token *e = ctx->end;
|
Token *e = ctx->end;
|
||||||
for (t += 1; t < e && t->type == CPP_TOKEN_COMMENT; t += 1);
|
for (t += 1; t < e && t->type == CPP_TOKEN_COMMENT; t += 1);
|
||||||
ctx->token = t;
|
ctx->token = t;
|
||||||
}
|
}
|
||||||
|
@ -1147,8 +1147,8 @@ text_data_to_token_array(Arena *arena, String_Const_u8 data){
|
||||||
b32 success = false;
|
b32 success = false;
|
||||||
Temp_Memory restore_point = begin_temp(arena);
|
Temp_Memory restore_point = begin_temp(arena);
|
||||||
Cpp_Token_Array array = {};
|
Cpp_Token_Array array = {};
|
||||||
i32 max_count = (1 << 20)/sizeof(Cpp_Token);
|
i32 max_count = (1 << 20)/sizeof(Token);
|
||||||
array.tokens = push_array(arena, Cpp_Token, max_count);
|
array.tokens = push_array(arena, Token, max_count);
|
||||||
array.max_count = max_count;
|
array.max_count = max_count;
|
||||||
Cpp_Keyword_Table kw_table = {};
|
Cpp_Keyword_Table kw_table = {};
|
||||||
Cpp_Keyword_Table pp_table = {};
|
Cpp_Keyword_Table pp_table = {};
|
||||||
|
@ -1518,7 +1518,6 @@ load_config_and_apply(Application_Links *app, Arena *out_arena, Config_Data *con
|
||||||
do_matching_enclosure_highlight = config->use_scope_highlight;
|
do_matching_enclosure_highlight = config->use_scope_highlight;
|
||||||
do_matching_paren_highlight = config->use_paren_helper;
|
do_matching_paren_highlight = config->use_paren_helper;
|
||||||
do_colored_comment_keywords = config->use_comment_keyword;
|
do_colored_comment_keywords = config->use_comment_keyword;
|
||||||
adjust_all_buffer_wrap_widths(app, config->default_wrap_width, config->default_min_base_width);
|
|
||||||
global_set_setting(app, GlobalSetting_LAltLCtrlIsAltGr, config->lalt_lctrl_is_altgr);
|
global_set_setting(app, GlobalSetting_LAltLCtrlIsAltGr, config->lalt_lctrl_is_altgr);
|
||||||
|
|
||||||
//change_theme(app, config->default_theme_name.str, config->default_theme_name.size);
|
//change_theme(app, config->default_theme_name.str, config->default_theme_name.size);
|
||||||
|
|
|
@ -31,9 +31,9 @@ struct Config_Error_List{
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Config_Parser{
|
struct Config_Parser{
|
||||||
Cpp_Token *start;
|
Token *start;
|
||||||
Cpp_Token *token;
|
Token *token;
|
||||||
Cpp_Token *end;
|
Token *end;
|
||||||
|
|
||||||
String_Const_u8 file_name;
|
String_Const_u8 file_name;
|
||||||
String_Const_u8 data;
|
String_Const_u8 data;
|
||||||
|
|
|
@ -68,15 +68,15 @@ new_view_settings(Application_Links *app, View_ID view){
|
||||||
static void
|
static void
|
||||||
view_set_passive(Application_Links *app, View_ID view_id, b32 value){
|
view_set_passive(Application_Links *app, View_ID view_id, b32 value){
|
||||||
Managed_Scope scope = view_get_managed_scope(app, view_id);
|
Managed_Scope scope = view_get_managed_scope(app, view_id);
|
||||||
managed_variable_set(app, scope, view_is_passive_loc, (u64)value);
|
b32 *is_passive = scope_attachment(app, scope, view_is_passive_loc, b32);
|
||||||
|
*is_passive = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
static b32
|
static b32
|
||||||
view_get_is_passive(Application_Links *app, View_ID view_id){
|
view_get_is_passive(Application_Links *app, View_ID view_id){
|
||||||
Managed_Scope scope = view_get_managed_scope(app, view_id);
|
Managed_Scope scope = view_get_managed_scope(app, view_id);
|
||||||
u64 is_passive = 0;
|
b32 *is_passive = scope_attachment(app, scope, view_is_passive_loc, b32);
|
||||||
managed_variable_get(app, scope, view_is_passive_loc, &is_passive);
|
return(*is_passive);
|
||||||
return(is_passive != 0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static View_ID
|
static View_ID
|
||||||
|
@ -267,7 +267,9 @@ create_or_switch_to_buffer_and_clear_by_name(Application_Links *app, String_Cons
|
||||||
search_buffer = create_buffer(app, name_string, BufferCreate_AlwaysNew);
|
search_buffer = create_buffer(app, name_string, BufferCreate_AlwaysNew);
|
||||||
buffer_set_setting(app, search_buffer, BufferSetting_Unimportant, true);
|
buffer_set_setting(app, search_buffer, BufferSetting_Unimportant, true);
|
||||||
buffer_set_setting(app, search_buffer, BufferSetting_ReadOnly, true);
|
buffer_set_setting(app, search_buffer, BufferSetting_ReadOnly, true);
|
||||||
|
#if 0
|
||||||
buffer_set_setting(app, search_buffer, BufferSetting_WrapLine, false);
|
buffer_set_setting(app, search_buffer, BufferSetting_WrapLine, false);
|
||||||
|
#endif
|
||||||
view_set_buffer(app, default_target_view, search_buffer, 0);
|
view_set_buffer(app, default_target_view, search_buffer, 0);
|
||||||
view_set_active(app, default_target_view);
|
view_set_active(app, default_target_view);
|
||||||
}
|
}
|
||||||
|
@ -361,10 +363,8 @@ CUSTOM_DOC("Switch to a named key binding map.")
|
||||||
|
|
||||||
static void
|
static void
|
||||||
default_4coder_initialize(Application_Links *app, char **command_line_files, i32 file_count, i32 override_font_size, b32 override_hinting){
|
default_4coder_initialize(Application_Links *app, char **command_line_files, i32 file_count, i32 override_font_size, b32 override_hinting){
|
||||||
i32 heap_size = (4 << 20);
|
Base_Allocator *allocator = context_get_base_allocator(app);
|
||||||
void *heap_mem = memory_allocate(app, heap_size);
|
heap_init(&global_heap, allocator);
|
||||||
heap_init(&global_heap);
|
|
||||||
heap_extend(&global_heap, heap_mem, heap_size);
|
|
||||||
|
|
||||||
#define M \
|
#define M \
|
||||||
"Welcome to " VERSION "\n" \
|
"Welcome to " VERSION "\n" \
|
||||||
|
@ -382,17 +382,17 @@ default_4coder_initialize(Application_Links *app, char **command_line_files, i32
|
||||||
global_config_arena = make_arena_app_links(app);
|
global_config_arena = make_arena_app_links(app);
|
||||||
load_config_and_apply(app, &global_config_arena, &global_config, override_font_size, override_hinting);
|
load_config_and_apply(app, &global_config_arena, &global_config, override_font_size, override_hinting);
|
||||||
|
|
||||||
view_rewrite_loc = managed_variable_create_or_get_id(app, "DEFAULT.rewrite" , 0);
|
view_rewrite_loc = managed_id_declare(app, SCu8("DEFAULT.rewrite" ));
|
||||||
view_next_rewrite_loc = managed_variable_create_or_get_id(app, "DEFAULT.next_rewrite" , 0);
|
view_next_rewrite_loc = managed_id_declare(app, SCu8("DEFAULT.next_rewrite" ));
|
||||||
view_paste_index_loc = managed_variable_create_or_get_id(app, "DEFAULT.paste_index" , 0);
|
view_paste_index_loc = managed_id_declare(app, SCu8("DEFAULT.paste_index" ));
|
||||||
view_is_passive_loc = managed_variable_create_or_get_id(app, "DEFAULT.is_passive" , 0);
|
view_is_passive_loc = managed_id_declare(app, SCu8("DEFAULT.is_passive" ));
|
||||||
view_snap_mark_to_cursor = managed_variable_create_or_get_id(app, "DEFAULT.mark_to_cursor", 0);
|
view_snap_mark_to_cursor = managed_id_declare(app, SCu8("DEFAULT.mark_to_cursor"));
|
||||||
view_ui_data = managed_variable_create_or_get_id(app, "DEFAULT.ui_data" , 0);
|
view_ui_data = managed_id_declare(app, SCu8("DEFAULT.ui_data" ));
|
||||||
view_highlight_range = managed_variable_create_or_get_id(app, "DEFAULT.highlight" , 0);
|
view_highlight_range = managed_id_declare(app, SCu8("DEFAULT.highlight" ));
|
||||||
view_highlight_buffer = managed_variable_create_or_get_id(app, "DEFAULT.highlight_buf" , 0);
|
view_highlight_buffer = managed_id_declare(app, SCu8("DEFAULT.highlight_buf" ));
|
||||||
view_render_hook = managed_variable_create_or_get_id(app, "DEFAULT.render" , 0);
|
view_render_hook = managed_id_declare(app, SCu8("DEFAULT.render" ));
|
||||||
|
sticky_jump_marker_handle = managed_id_declare(app, SCu8("DEFAULT.sticky_jump_marker_handle"));
|
||||||
sticky_jump_marker_handle = managed_variable_create_or_get_id(app, "DEFAULT.sticky_jump_marker_handle", 0);
|
attachment_tokens = managed_id_declare(app, SCu8("DEFAULT.tokens"));
|
||||||
|
|
||||||
// open command line files
|
// open command line files
|
||||||
Arena *scratch = context_get_arena(app);
|
Arena *scratch = context_get_arena(app);
|
||||||
|
|
|
@ -16,10 +16,11 @@ enum Default_Maps{
|
||||||
|
|
||||||
////////////////////////////////
|
////////////////////////////////
|
||||||
|
|
||||||
enum Rewrite_Type{
|
typedef i64 Rewrite_Type;
|
||||||
RewriteNone,
|
enum{
|
||||||
RewritePaste,
|
Rewrite_None,
|
||||||
RewriteWordComplete
|
Rewrite_Paste,
|
||||||
|
Rewrite_WordComplete
|
||||||
};
|
};
|
||||||
|
|
||||||
////////////////////////////////
|
////////////////////////////////
|
||||||
|
|
|
@ -34,17 +34,19 @@ global String_Const_u8 locked_buffer = {};
|
||||||
global View_ID build_footer_panel_view_id = 0;
|
global View_ID build_footer_panel_view_id = 0;
|
||||||
|
|
||||||
|
|
||||||
global Managed_Variable_ID view_rewrite_loc = 0;
|
global Managed_ID view_rewrite_loc = 0;
|
||||||
global Managed_Variable_ID view_next_rewrite_loc = 0;
|
global Managed_ID view_next_rewrite_loc = 0;
|
||||||
global Managed_Variable_ID view_paste_index_loc = 0;
|
global Managed_ID view_paste_index_loc = 0;
|
||||||
global Managed_Variable_ID view_is_passive_loc = 0;
|
global Managed_ID view_is_passive_loc = 0;
|
||||||
global Managed_Variable_ID view_snap_mark_to_cursor = 0;
|
global Managed_ID view_snap_mark_to_cursor = 0;
|
||||||
global Managed_Variable_ID view_ui_data = 0;
|
global Managed_ID view_ui_data = 0;
|
||||||
global Managed_Variable_ID view_highlight_range = 0;
|
global Managed_ID view_highlight_range = 0;
|
||||||
global Managed_Variable_ID view_highlight_buffer = 0;
|
global Managed_ID view_highlight_buffer = 0;
|
||||||
global Managed_Variable_ID view_render_hook = 0;
|
global Managed_ID view_render_hook = 0;
|
||||||
|
|
||||||
global Managed_Variable_ID sticky_jump_marker_handle = 0;
|
global Managed_ID sticky_jump_marker_handle = 0;
|
||||||
|
|
||||||
|
global Managed_ID attachment_tokens = 0;
|
||||||
|
|
||||||
global u8 out_buffer_space[1024];
|
global u8 out_buffer_space[1024];
|
||||||
global u8 command_space[1024];
|
global u8 command_space[1024];
|
||||||
|
@ -61,6 +63,7 @@ global b32 cursor_is_hidden = false;
|
||||||
|
|
||||||
global b32 show_fps_hud = false;
|
global b32 show_fps_hud = false;
|
||||||
|
|
||||||
|
// TODO(allen): REMOVE THIS!
|
||||||
global Heap global_heap;
|
global Heap global_heap;
|
||||||
|
|
||||||
enum{
|
enum{
|
||||||
|
|
|
@ -80,29 +80,32 @@ START_HOOK_SIG(default_start){
|
||||||
COMMAND_CALLER_HOOK(default_command_caller){
|
COMMAND_CALLER_HOOK(default_command_caller){
|
||||||
View_ID view = get_active_view(app, AccessAll);
|
View_ID view = get_active_view(app, AccessAll);
|
||||||
Managed_Scope scope = view_get_managed_scope(app, view);
|
Managed_Scope scope = view_get_managed_scope(app, view);
|
||||||
managed_variable_set(app, scope, view_next_rewrite_loc, 0);
|
Rewrite_Type *next_rewrite = scope_attachment(app, scope, view_next_rewrite_loc, Rewrite_Type);
|
||||||
|
*next_rewrite = Rewrite_None;
|
||||||
if (fcoder_mode == FCoderMode_NotepadLike){
|
if (fcoder_mode == FCoderMode_NotepadLike){
|
||||||
for (View_ID view_it = get_view_next(app, 0, AccessAll);
|
for (View_ID view_it = get_view_next(app, 0, AccessAll);
|
||||||
view_it != 0;
|
view_it != 0;
|
||||||
view_it = get_view_next(app, view_it, AccessAll)){
|
view_it = get_view_next(app, view_it, AccessAll)){
|
||||||
Managed_Scope scope_it = view_get_managed_scope(app, view_it);
|
Managed_Scope scope_it = view_get_managed_scope(app, view_it);
|
||||||
managed_variable_set(app, scope_it, view_snap_mark_to_cursor, true);
|
b32 *snap_mark_to_cursor = scope_attachment(app, scope_it, view_snap_mark_to_cursor, b32);
|
||||||
|
*snap_mark_to_cursor = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
cmd.command(app);
|
cmd.command(app);
|
||||||
|
|
||||||
u64 next_rewrite = 0;
|
|
||||||
managed_variable_get(app, scope, view_next_rewrite_loc, &next_rewrite);
|
next_rewrite = scope_attachment(app, scope, view_next_rewrite_loc, Rewrite_Type);
|
||||||
managed_variable_set(app, scope, view_rewrite_loc, next_rewrite);
|
if (next_rewrite != 0){
|
||||||
|
Rewrite_Type *rewrite = scope_attachment(app, scope, view_rewrite_loc, Rewrite_Type);
|
||||||
|
*rewrite = *next_rewrite;
|
||||||
if (fcoder_mode == FCoderMode_NotepadLike){
|
if (fcoder_mode == FCoderMode_NotepadLike){
|
||||||
for (View_ID view_it = get_view_next(app, 0, AccessAll);
|
for (View_ID view_it = get_view_next(app, 0, AccessAll);
|
||||||
view_it != 0;
|
view_it != 0;
|
||||||
view_it = get_view_next(app, view_it, AccessAll)){
|
view_it = get_view_next(app, view_it, AccessAll)){
|
||||||
Managed_Scope scope_it = view_get_managed_scope(app, view_it);
|
Managed_Scope scope_it = view_get_managed_scope(app, view_it);
|
||||||
u64 val = 0;
|
b32 *snap_mark_to_cursor = scope_attachment(app, scope_it, view_snap_mark_to_cursor, b32);
|
||||||
if (managed_variable_get(app, scope_it, view_snap_mark_to_cursor, &val)){
|
if (*snap_mark_to_cursor){
|
||||||
if (val != 0){
|
|
||||||
i64 pos = view_get_cursor_pos(app, view_it);
|
i64 pos = view_get_cursor_pos(app, view_it);
|
||||||
view_set_mark(app, view_it, seek_pos(pos));
|
view_set_mark(app, view_it, seek_pos(pos));
|
||||||
}
|
}
|
||||||
|
@ -172,6 +175,7 @@ internal void
|
||||||
draw_enclosures(Application_Links *app, Text_Layout_ID text_layout_id, Buffer_ID buffer,
|
draw_enclosures(Application_Links *app, Text_Layout_ID text_layout_id, Buffer_ID buffer,
|
||||||
i64 pos, u32 flags, Range_Highlight_Kind kind,
|
i64 pos, u32 flags, Range_Highlight_Kind kind,
|
||||||
int_color *back_colors, int_color *fore_colors, i32 color_count){
|
int_color *back_colors, int_color *fore_colors, i32 color_count){
|
||||||
|
#if 0
|
||||||
Scratch_Block scratch(app);
|
Scratch_Block scratch(app);
|
||||||
Range_i64_Array ranges = get_enclosure_ranges(app, scratch, buffer, pos, flags);
|
Range_i64_Array ranges = get_enclosure_ranges(app, scratch, buffer, pos, flags);
|
||||||
|
|
||||||
|
@ -225,6 +229,7 @@ draw_enclosures(Application_Links *app, Text_Layout_ID text_layout_id, Buffer_ID
|
||||||
color_index += 1;
|
color_index += 1;
|
||||||
color_index = (color_index%color_count);
|
color_index = (color_index%color_count);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
static argb_color default_colors[Stag_COUNT] = {};
|
static argb_color default_colors[Stag_COUNT] = {};
|
||||||
|
@ -418,12 +423,12 @@ default_buffer_render_caller(Application_Links *app, Frame_Info frame_info, View
|
||||||
scopes[0] = buffer_get_managed_scope(app, compilation_buffer);
|
scopes[0] = buffer_get_managed_scope(app, compilation_buffer);
|
||||||
scopes[1] = buffer_get_managed_scope(app, buffer);
|
scopes[1] = buffer_get_managed_scope(app, buffer);
|
||||||
Managed_Scope scope = get_managed_scope_with_multiple_dependencies(app, scopes, ArrayCount(scopes));
|
Managed_Scope scope = get_managed_scope_with_multiple_dependencies(app, scopes, ArrayCount(scopes));
|
||||||
Managed_Object markers_object = 0;
|
Managed_Object *markers_object = scope_attachment(app, scope, sticky_jump_marker_handle, Managed_Object);
|
||||||
if (managed_variable_get(app, scope, sticky_jump_marker_handle, &markers_object)){
|
|
||||||
Temp_Memory temp = begin_temp(scratch);
|
Temp_Memory temp = begin_temp(scratch);
|
||||||
i32 count = managed_object_get_item_count(app, markers_object);
|
i32 count = managed_object_get_item_count(app, *markers_object);
|
||||||
Marker *markers = push_array(scratch, Marker, count);
|
Marker *markers = push_array(scratch, Marker, count);
|
||||||
managed_object_load_data(app, markers_object, 0, count, markers);
|
managed_object_load_data(app, *markers_object, 0, count, markers);
|
||||||
for (i32 i = 0; i < count; i += 1){
|
for (i32 i = 0; i < count; i += 1){
|
||||||
i64 line_number = get_line_number_from_pos(app, buffer, markers[i].pos);
|
i64 line_number = get_line_number_from_pos(app, buffer, markers[i].pos);
|
||||||
draw_line_highlight(app, text_layout_id, line_number,
|
draw_line_highlight(app, text_layout_id, line_number,
|
||||||
|
@ -432,7 +437,6 @@ default_buffer_render_caller(Application_Links *app, Frame_Info frame_info, View
|
||||||
end_temp(temp);
|
end_temp(temp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// NOTE(allen): Color parens
|
// NOTE(allen): Color parens
|
||||||
if (do_matching_paren_highlight){
|
if (do_matching_paren_highlight){
|
||||||
|
@ -465,20 +469,17 @@ default_buffer_render_caller(Application_Links *app, Frame_Info frame_info, View
|
||||||
b32 has_highlight_range = false;
|
b32 has_highlight_range = false;
|
||||||
{
|
{
|
||||||
Managed_Scope scope = view_get_managed_scope(app, view_id);
|
Managed_Scope scope = view_get_managed_scope(app, view_id);
|
||||||
u64 highlight_buffer = 0;
|
Buffer_ID *highlight_buffer = scope_attachment(app, scope, view_highlight_buffer, Buffer_ID);
|
||||||
managed_variable_get(app, scope, view_highlight_buffer, &highlight_buffer);
|
if (*highlight_buffer != 0){
|
||||||
if (highlight_buffer != 0){
|
if (*highlight_buffer != buffer){
|
||||||
if ((Buffer_ID)highlight_buffer != buffer){
|
|
||||||
view_disable_highlight_range(app, view_id);
|
view_disable_highlight_range(app, view_id);
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
has_highlight_range = true;
|
has_highlight_range = true;
|
||||||
Managed_Object highlight = 0;
|
Managed_Object *highlight = scope_attachment(app, scope, view_highlight_range, Managed_Object);
|
||||||
managed_variable_get(app, scope, view_highlight_range, &highlight);
|
|
||||||
Marker marker_range[2];
|
Marker marker_range[2];
|
||||||
if (managed_object_load_data(app, highlight, 0, 2, marker_range)){
|
if (managed_object_load_data(app, *highlight, 0, 2, marker_range)){
|
||||||
Range_i64 range = Ii64(marker_range[0].pos,
|
Range_i64 range = Ii64(marker_range[0].pos, marker_range[1].pos);
|
||||||
marker_range[1].pos);
|
|
||||||
draw_character_block(app, text_layout_id, range, Stag_Highlight);
|
draw_character_block(app, text_layout_id, range, Stag_Highlight);
|
||||||
paint_text_color(app, text_layout_id, range, Stag_At_Highlight);
|
paint_text_color(app, text_layout_id, range, Stag_At_Highlight);
|
||||||
}
|
}
|
||||||
|
@ -788,9 +789,9 @@ default_render_view(Application_Links *app, Frame_Info frame_info, View_ID view,
|
||||||
draw_coordinate_center_push(app, inner.p0);
|
draw_coordinate_center_push(app, inner.p0);
|
||||||
|
|
||||||
Managed_Scope scope = view_get_managed_scope(app, view);
|
Managed_Scope scope = view_get_managed_scope(app, view);
|
||||||
u64 render_hook_value = 0;
|
View_Render_Hook **hook_ptr = scope_attachment(app, scope, view_render_hook, View_Render_Hook*);
|
||||||
if (managed_variable_get(app, scope, view_render_hook, &render_hook_value)){
|
|
||||||
if (render_hook_value == 0){
|
if (*hook_ptr == 0){
|
||||||
if (view_is_in_ui_mode(app, view)){
|
if (view_is_in_ui_mode(app, view)){
|
||||||
default_ui_render_caller(app, view);
|
default_ui_render_caller(app, view);
|
||||||
}
|
}
|
||||||
|
@ -799,15 +800,9 @@ default_render_view(Application_Links *app, Frame_Info frame_info, View_ID view,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
// TODO(allen): This doesn't actually work.
|
View_Render_Hook *hook = *hook_ptr;
|
||||||
// We aren't supposed to assume that a function
|
|
||||||
// pointer is 64-bits I don't think. How
|
|
||||||
// should we attach a user named hook to a scope
|
|
||||||
// easily?
|
|
||||||
View_Render_Hook *hook = (View_Render_Hook*)render_hook_value;
|
|
||||||
hook(app, view, frame_info, inner);
|
hook(app, view, frame_info, inner);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
draw_clip_pop(app);
|
draw_clip_pop(app);
|
||||||
draw_coordinate_center_pop(app);
|
draw_coordinate_center_pop(app);
|
||||||
|
@ -848,30 +843,9 @@ HOOK_SIG(default_exit){
|
||||||
return(result);
|
return(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO(allen): how to deal with multiple sizes on a single view
|
|
||||||
// TODO(allen): expected character advance.
|
|
||||||
HOOK_SIG(default_view_adjust){
|
HOOK_SIG(default_view_adjust){
|
||||||
for (View_ID view = get_view_next(app, 0, AccessAll);
|
// NOTE(allen): Called whenever the view layout/sizes have been modified, including
|
||||||
view != 0;
|
// by full window resize.
|
||||||
view = get_view_next(app, view, AccessAll)){
|
|
||||||
Buffer_ID buffer = view_get_buffer(app, view, AccessAll);
|
|
||||||
|
|
||||||
Rect_f32 screen_rect = view_get_screen_rect(app, view);
|
|
||||||
f32 view_width = rect_width(screen_rect);
|
|
||||||
|
|
||||||
Face_ID face_id = get_face_id(app, buffer);
|
|
||||||
f32 em = get_string_advance(app, face_id, string_u8_litexpr("m"));
|
|
||||||
|
|
||||||
f32 wrap_width = view_width - 2.0f*em;
|
|
||||||
f32 min_width = 40.0f*em;
|
|
||||||
if (wrap_width < min_width){
|
|
||||||
wrap_width = min_width;
|
|
||||||
}
|
|
||||||
|
|
||||||
f32 min_base_width = 20.0f*em;
|
|
||||||
buffer_set_setting(app, buffer, BufferSetting_WrapPosition, (i32)(wrap_width));
|
|
||||||
buffer_set_setting(app, buffer, BufferSetting_MinimumBaseWrapPosition, (i32)(min_base_width));
|
|
||||||
}
|
|
||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -986,25 +960,32 @@ BUFFER_NAME_RESOLVER_SIG(default_buffer_name_resolution){
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
OPEN_FILE_HOOK_SIG(default_file_settings){
|
BUFFER_HOOK_SIG(default_file_settings){
|
||||||
b32 treat_as_code = false;
|
b32 treat_as_code = false;
|
||||||
b32 treat_as_todo = false;
|
|
||||||
b32 lex_without_strings = false;
|
b32 lex_without_strings = false;
|
||||||
|
(void)(lex_without_strings);
|
||||||
|
|
||||||
String_Const_u8_Array extensions = global_config.code_exts;
|
String_Const_u8_Array extensions = global_config.code_exts;
|
||||||
|
|
||||||
Parse_Context_ID parse_context_id = 0;
|
|
||||||
|
|
||||||
Arena *scratch = context_get_arena(app);
|
Arena *scratch = context_get_arena(app);
|
||||||
Temp_Memory temp = begin_temp(scratch);
|
Temp_Memory temp = begin_temp(scratch);
|
||||||
|
|
||||||
String_Const_u8 file_name = push_buffer_file_name(app, scratch, buffer_id);
|
String_Const_u8 file_name = push_buffer_file_name(app, scratch, buffer_id);
|
||||||
i32 buffer_size = (i32)buffer_get_size(app, buffer_id);
|
|
||||||
|
|
||||||
if (file_name.size > 0 && buffer_size < MB(32)){
|
if (file_name.size > 0){
|
||||||
String_Const_u8 ext = string_file_extension(file_name);
|
String_Const_u8 ext = string_file_extension(file_name);
|
||||||
for (i32 i = 0; i < extensions.count; ++i){
|
for (i32 i = 0; i < extensions.count; ++i){
|
||||||
if (string_match(ext, extensions.strings[i])){
|
if (string_match(ext, extensions.strings[i])){
|
||||||
|
|
||||||
|
if (string_match(ext, string_u8_litexpr("cpp")) ||
|
||||||
|
string_match(ext, string_u8_litexpr("h")) ||
|
||||||
|
string_match(ext, string_u8_litexpr("c")) ||
|
||||||
|
string_match(ext, string_u8_litexpr("hpp")) ||
|
||||||
|
string_match(ext, string_u8_litexpr("cc"))){
|
||||||
|
treat_as_code = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
#if 0
|
||||||
treat_as_code = true;
|
treat_as_code = true;
|
||||||
|
|
||||||
if (string_match(ext, string_u8_litexpr("cs"))){
|
if (string_match(ext, string_u8_litexpr("cs"))){
|
||||||
|
@ -1055,15 +1036,11 @@ OPEN_FILE_HOOK_SIG(default_file_settings){
|
||||||
}
|
}
|
||||||
parse_context_id = parse_context_language_cpp;
|
parse_context_id = parse_context_language_cpp;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!treat_as_code){
|
|
||||||
treat_as_todo = string_match_insensitive(string_front_of_path(file_name),
|
|
||||||
string_u8_litexpr("todo.txt"));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
i32 map_id = (treat_as_code)?((i32)default_code_map):((i32)mapid_file);
|
i32 map_id = (treat_as_code)?((i32)default_code_map):((i32)mapid_file);
|
||||||
|
@ -1073,24 +1050,23 @@ OPEN_FILE_HOOK_SIG(default_file_settings){
|
||||||
buffer_get_setting(app, buffer_id, BufferSetting_MapID, &map_id_query);
|
buffer_get_setting(app, buffer_id, BufferSetting_MapID, &map_id_query);
|
||||||
Assert(map_id_query == default_lister_ui_map);
|
Assert(map_id_query == default_lister_ui_map);
|
||||||
|
|
||||||
|
// TODO(allen): kill all concepts of wrap width as settings
|
||||||
|
#if 0
|
||||||
buffer_set_setting(app, buffer_id, BufferSetting_WrapPosition, global_config.default_wrap_width);
|
buffer_set_setting(app, buffer_id, BufferSetting_WrapPosition, global_config.default_wrap_width);
|
||||||
buffer_set_setting(app, buffer_id, BufferSetting_MinimumBaseWrapPosition, global_config.default_min_base_width);
|
buffer_set_setting(app, buffer_id, BufferSetting_MinimumBaseWrapPosition, global_config.default_min_base_width);
|
||||||
|
#endif
|
||||||
buffer_set_setting(app, buffer_id, BufferSetting_MapID, map_id);
|
buffer_set_setting(app, buffer_id, BufferSetting_MapID, map_id);
|
||||||
buffer_get_setting(app, buffer_id, BufferSetting_MapID, &map_id_query);
|
buffer_get_setting(app, buffer_id, BufferSetting_MapID, &map_id_query);
|
||||||
Assert(map_id_query == map_id);
|
Assert(map_id_query == map_id);
|
||||||
|
#if 0
|
||||||
buffer_set_setting(app, buffer_id, BufferSetting_ParserContext, parse_context_id);
|
buffer_set_setting(app, buffer_id, BufferSetting_ParserContext, parse_context_id);
|
||||||
|
#endif
|
||||||
|
|
||||||
// NOTE(allen): Decide buffer settings
|
// NOTE(allen): Decide buffer settings
|
||||||
b32 wrap_lines = true;
|
b32 wrap_lines = true;
|
||||||
b32 use_virtual_whitespace = false;
|
b32 use_virtual_whitespace = false;
|
||||||
b32 use_lexer = false;
|
b32 use_lexer = false;
|
||||||
if (treat_as_todo){
|
if (treat_as_code){
|
||||||
lex_without_strings = true;
|
|
||||||
wrap_lines = true;
|
|
||||||
use_virtual_whitespace = true;
|
|
||||||
use_lexer = true;
|
|
||||||
}
|
|
||||||
else if (treat_as_code){
|
|
||||||
wrap_lines = global_config.enable_code_wrapping;
|
wrap_lines = global_config.enable_code_wrapping;
|
||||||
use_virtual_whitespace = global_config.enable_virtual_whitespace;
|
use_virtual_whitespace = global_config.enable_virtual_whitespace;
|
||||||
use_lexer = true;
|
use_lexer = true;
|
||||||
|
@ -1100,11 +1076,21 @@ OPEN_FILE_HOOK_SIG(default_file_settings){
|
||||||
if (string_match(buffer_name, string_u8_litexpr("*compilation*"))){
|
if (string_match(buffer_name, string_u8_litexpr("*compilation*"))){
|
||||||
wrap_lines = false;
|
wrap_lines = false;
|
||||||
}
|
}
|
||||||
if (buffer_size >= (1 << 20)){
|
|
||||||
wrap_lines = false;
|
if (use_lexer){
|
||||||
use_virtual_whitespace = false;
|
Temp_Memory temp = begin_temp(scratch);
|
||||||
|
String_Const_u8 contents = push_whole_buffer(app, scratch, buffer_id);
|
||||||
|
Managed_Scope scope = buffer_get_managed_scope(app, buffer_id);
|
||||||
|
Base_Allocator *allocator = managed_scope_allocator(app, scope);
|
||||||
|
Token_Array tokens = lex_cpp_initial(allocator, contents);
|
||||||
|
|
||||||
|
Token_Array *tokens_ptr = scope_attachment(app, scope, attachment_tokens, Token_Array);
|
||||||
|
block_copy_struct(tokens_ptr, &tokens);
|
||||||
|
|
||||||
|
end_temp(temp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if 0
|
||||||
// NOTE(allen|a4.0.12): There is a little bit of grossness going on here.
|
// NOTE(allen|a4.0.12): There is a little bit of grossness going on here.
|
||||||
// If we set BufferSetting_Lex to true, it will launch a lexing job.
|
// If we set BufferSetting_Lex to true, it will launch a lexing job.
|
||||||
// If a lexing job is active when we set BufferSetting_VirtualWhitespace, the call can fail.
|
// If a lexing job is active when we set BufferSetting_VirtualWhitespace, the call can fail.
|
||||||
|
@ -1115,6 +1101,7 @@ OPEN_FILE_HOOK_SIG(default_file_settings){
|
||||||
buffer_set_setting(app, buffer_id, BufferSetting_WrapLine, wrap_lines);
|
buffer_set_setting(app, buffer_id, BufferSetting_WrapLine, wrap_lines);
|
||||||
buffer_set_setting(app, buffer_id, BufferSetting_VirtualWhitespace, use_virtual_whitespace);
|
buffer_set_setting(app, buffer_id, BufferSetting_VirtualWhitespace, use_virtual_whitespace);
|
||||||
buffer_set_setting(app, buffer_id, BufferSetting_Lex, use_lexer);
|
buffer_set_setting(app, buffer_id, BufferSetting_Lex, use_lexer);
|
||||||
|
#endif
|
||||||
|
|
||||||
end_temp(temp);
|
end_temp(temp);
|
||||||
|
|
||||||
|
@ -1122,13 +1109,13 @@ OPEN_FILE_HOOK_SIG(default_file_settings){
|
||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
OPEN_FILE_HOOK_SIG(default_new_file){
|
BUFFER_HOOK_SIG(default_new_file){
|
||||||
// no meaning for return
|
// no meaning for return
|
||||||
// buffer_id
|
// buffer_id
|
||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
OPEN_FILE_HOOK_SIG(default_file_save){
|
BUFFER_HOOK_SIG(default_file_save){
|
||||||
b32 is_virtual = false;
|
b32 is_virtual = false;
|
||||||
if (global_config.automatically_indent_text_on_save &&
|
if (global_config.automatically_indent_text_on_save &&
|
||||||
buffer_get_setting(app, buffer_id, BufferSetting_VirtualWhitespace, &is_virtual)){
|
buffer_get_setting(app, buffer_id, BufferSetting_VirtualWhitespace, &is_virtual)){
|
||||||
|
@ -1167,7 +1154,7 @@ FILE_EXTERNALLY_MODIFIED_SIG(default_file_externally_modified){
|
||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
OPEN_FILE_HOOK_SIG(default_end_file){
|
BUFFER_HOOK_SIG(default_end_file){
|
||||||
Scratch_Block scratch(app);
|
Scratch_Block scratch(app);
|
||||||
String_Const_u8 buffer_name = push_buffer_unique_name(app, scratch, buffer_id);
|
String_Const_u8 buffer_name = push_buffer_unique_name(app, scratch, buffer_id);
|
||||||
String_Const_u8 str = push_u8_stringf(scratch, "Ending file: %s\n", buffer_name.str);
|
String_Const_u8 str = push_u8_stringf(scratch, "Ending file: %s\n", buffer_name.str);
|
||||||
|
|
|
@ -15,10 +15,6 @@
|
||||||
#include "4coder_stringf.cpp"
|
#include "4coder_stringf.cpp"
|
||||||
#include "4coder_app_links_allocator.cpp"
|
#include "4coder_app_links_allocator.cpp"
|
||||||
|
|
||||||
#include "4coder_lib/4coder_heap.cpp"
|
|
||||||
|
|
||||||
#define FSTRING_IMPLEMENTATION
|
|
||||||
#include "4coder_lib/4coder_string.h"
|
|
||||||
#include "4coder_lib/4coder_utf8.h"
|
#include "4coder_lib/4coder_utf8.h"
|
||||||
#include "4coder_lib/4cpp_lexer.h"
|
#include "4coder_lib/4cpp_lexer.h"
|
||||||
#include "4coder_table.h"
|
#include "4coder_table.h"
|
||||||
|
|
|
@ -22,14 +22,13 @@ CUSTOM_COMMAND_SIG(multi_paste){
|
||||||
View_ID view = get_active_view(app, AccessOpen);
|
View_ID view = get_active_view(app, AccessOpen);
|
||||||
Managed_Scope scope = view_get_managed_scope(app, view);
|
Managed_Scope scope = view_get_managed_scope(app, view);
|
||||||
|
|
||||||
u64 rewrite = 0;
|
Rewrite_Type *rewrite = scope_attachment(app, scope, view_rewrite_loc, Rewrite_Type);
|
||||||
managed_variable_get(app, scope, view_rewrite_loc, &rewrite);
|
if (*rewrite == Rewrite_Paste){
|
||||||
if (rewrite == RewritePaste){
|
Rewrite_Type *next_rewrite = scope_attachment(app, scope, view_next_rewrite_loc, Rewrite_Type);
|
||||||
managed_variable_set(app, scope, view_next_rewrite_loc, RewritePaste);
|
*next_rewrite = Rewrite_Paste;
|
||||||
u64 prev_paste_index = 0;
|
i32 *paste_index_ptr = scope_attachment(app, scope, view_paste_index_loc, i32);
|
||||||
managed_variable_get(app, scope, view_paste_index_loc, &prev_paste_index);
|
i32 paste_index = (*paste_index_ptr) + 1;
|
||||||
i32 paste_index = (i32)prev_paste_index + 1;
|
*paste_index_ptr = paste_index;
|
||||||
managed_variable_set(app, scope, view_paste_index_loc, paste_index);
|
|
||||||
|
|
||||||
String_Const_u8 string = push_clipboard_index(app, scratch, 0, paste_index);
|
String_Const_u8 string = push_clipboard_index(app, scratch, 0, paste_index);
|
||||||
|
|
||||||
|
@ -41,7 +40,6 @@ CUSTOM_COMMAND_SIG(multi_paste){
|
||||||
view_set_mark(app, view, seek_pos(range.max + 1));
|
view_set_mark(app, view, seek_pos(range.max + 1));
|
||||||
view_set_cursor_and_preferred_x(app, view, seek_pos(range.max + insert_string.size));
|
view_set_cursor_and_preferred_x(app, view, seek_pos(range.max + insert_string.size));
|
||||||
|
|
||||||
// TODO(allen): Send this to all views.
|
|
||||||
Theme_Color paste = {};
|
Theme_Color paste = {};
|
||||||
paste.tag = Stag_Paste;
|
paste.tag = Stag_Paste;
|
||||||
get_theme_colors(app, &paste, 1);
|
get_theme_colors(app, &paste, 1);
|
||||||
|
@ -202,15 +200,15 @@ CUSTOM_DOC("If the cursor is found to be on the name of a function parameter in
|
||||||
if (get_token_from_pos(app, buffer, cursor_pos, &result)){
|
if (get_token_from_pos(app, buffer, cursor_pos, &result)){
|
||||||
if (!result.in_whitespace_after_token){
|
if (!result.in_whitespace_after_token){
|
||||||
static const i32 stream_space_size = 512;
|
static const i32 stream_space_size = 512;
|
||||||
Cpp_Token stream_space[stream_space_size];
|
Token stream_space[stream_space_size];
|
||||||
Stream_Tokens_DEP stream = {};
|
Stream_Tokens_DEP stream = {};
|
||||||
|
|
||||||
if (init_stream_tokens(&stream, app, buffer, result.token_index, stream_space, stream_space_size)){
|
if (init_stream_tokens(&stream, app, buffer, result.token_index, stream_space, stream_space_size)){
|
||||||
i32 token_index = result.token_index;
|
i32 token_index = result.token_index;
|
||||||
Cpp_Token token = stream.tokens[token_index];
|
Token token = stream.tokens[token_index];
|
||||||
|
|
||||||
if (token.type == CPP_TOKEN_IDENTIFIER){
|
if (token.type == CPP_TOKEN_IDENTIFIER){
|
||||||
Cpp_Token original_token = token;
|
Token original_token = token;
|
||||||
String_Const_u8 old_lexeme = push_token_lexeme(app, scratch, buffer, token);
|
String_Const_u8 old_lexeme = push_token_lexeme(app, scratch, buffer, token);
|
||||||
|
|
||||||
i32 proc_body_found = 0;
|
i32 proc_body_found = 0;
|
||||||
|
@ -219,7 +217,7 @@ CUSTOM_DOC("If the cursor is found to be on the name of a function parameter in
|
||||||
++token_index;
|
++token_index;
|
||||||
do{
|
do{
|
||||||
for (; token_index < stream.end; ++token_index){
|
for (; token_index < stream.end; ++token_index){
|
||||||
Cpp_Token *token_ptr = stream.tokens + token_index;
|
Token *token_ptr = stream.tokens + token_index;
|
||||||
switch (token_ptr->type){
|
switch (token_ptr->type){
|
||||||
case CPP_TOKEN_BRACE_OPEN:
|
case CPP_TOKEN_BRACE_OPEN:
|
||||||
{
|
{
|
||||||
|
@ -271,7 +269,7 @@ CUSTOM_DOC("If the cursor is found to be on the name of a function parameter in
|
||||||
still_looping = 0;
|
still_looping = 0;
|
||||||
do{
|
do{
|
||||||
for (; token_index < stream.end; ++token_index){
|
for (; token_index < stream.end; ++token_index){
|
||||||
Cpp_Token *token_ptr = stream.tokens + token_index;
|
Token *token_ptr = stream.tokens + token_index;
|
||||||
switch (token_ptr->type){
|
switch (token_ptr->type){
|
||||||
case CPP_TOKEN_IDENTIFIER:
|
case CPP_TOKEN_IDENTIFIER:
|
||||||
{
|
{
|
||||||
|
@ -349,12 +347,12 @@ write_explicit_enum_values_parameters(Application_Links *app, Write_Explicit_Enu
|
||||||
Cpp_Get_Token_Result result = {};
|
Cpp_Get_Token_Result result = {};
|
||||||
if (get_token_from_pos(app, buffer, pos, &result)){
|
if (get_token_from_pos(app, buffer, pos, &result)){
|
||||||
if (!result.in_whitespace_after_token){
|
if (!result.in_whitespace_after_token){
|
||||||
Cpp_Token stream_space[32];
|
Token stream_space[32];
|
||||||
Stream_Tokens_DEP stream = {};
|
Stream_Tokens_DEP stream = {};
|
||||||
|
|
||||||
if (init_stream_tokens(&stream, app, buffer, result.token_index, stream_space, 32)){
|
if (init_stream_tokens(&stream, app, buffer, result.token_index, stream_space, 32)){
|
||||||
i32 token_index = result.token_index;
|
i32 token_index = result.token_index;
|
||||||
Cpp_Token token = stream.tokens[token_index];
|
Token token = stream.tokens[token_index];
|
||||||
|
|
||||||
if (token.type == CPP_TOKEN_BRACE_OPEN){
|
if (token.type == CPP_TOKEN_BRACE_OPEN){
|
||||||
++token_index;
|
++token_index;
|
||||||
|
@ -366,7 +364,7 @@ write_explicit_enum_values_parameters(Application_Links *app, Write_Explicit_Enu
|
||||||
b32 still_looping = false;
|
b32 still_looping = false;
|
||||||
do{
|
do{
|
||||||
for (; seeker_index < stream.end; ++seeker_index){
|
for (; seeker_index < stream.end; ++seeker_index){
|
||||||
Cpp_Token *token_seeker = stream.tokens + seeker_index;
|
Token *token_seeker = stream.tokens + seeker_index;
|
||||||
switch (token_seeker->type){
|
switch (token_seeker->type){
|
||||||
case CPP_TOKEN_BRACE_CLOSE:
|
case CPP_TOKEN_BRACE_CLOSE:
|
||||||
closed_correctly = true;
|
closed_correctly = true;
|
||||||
|
@ -398,7 +396,7 @@ write_explicit_enum_values_parameters(Application_Links *app, Write_Explicit_Enu
|
||||||
|
|
||||||
do{
|
do{
|
||||||
for (;token_index < stream.end; ++token_index){
|
for (;token_index < stream.end; ++token_index){
|
||||||
Cpp_Token *token_ptr = stream.tokens + token_index;
|
Token *token_ptr = stream.tokens + token_index;
|
||||||
switch (token_ptr->type){
|
switch (token_ptr->type){
|
||||||
case CPP_TOKEN_IDENTIFIER:
|
case CPP_TOKEN_IDENTIFIER:
|
||||||
{
|
{
|
||||||
|
|
|
@ -8,8 +8,6 @@
|
||||||
#define FCODER_FILE_ENUMERATOR_CPP
|
#define FCODER_FILE_ENUMERATOR_CPP
|
||||||
|
|
||||||
#include "4coder_base_types.h"
|
#include "4coder_base_types.h"
|
||||||
#define FSTRING_IMPLEMENTATION
|
|
||||||
#include "4coder_lib/4coder_string.h"
|
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
|
@ -14,6 +14,8 @@ static Get_Positions_Results
|
||||||
get_function_positions(Application_Links *app, Buffer_ID buffer, i32 first_token_index, Function_Positions *positions_array, i32 positions_max){
|
get_function_positions(Application_Links *app, Buffer_ID buffer, i32 first_token_index, Function_Positions *positions_array, i32 positions_max){
|
||||||
Get_Positions_Results result = {};
|
Get_Positions_Results result = {};
|
||||||
|
|
||||||
|
NotImplemented;
|
||||||
|
#if 0
|
||||||
Token_Range token_range = buffer_get_token_range(app, buffer);
|
Token_Range token_range = buffer_get_token_range(app, buffer);
|
||||||
if (token_range.first != 0){
|
if (token_range.first != 0){
|
||||||
Token_Iterator token_it = make_token_iterator(token_range, first_token_index);
|
Token_Iterator token_it = make_token_iterator(token_range, first_token_index);
|
||||||
|
@ -21,7 +23,7 @@ get_function_positions(Application_Links *app, Buffer_ID buffer, i32 first_token
|
||||||
i32 nest_level = 0;
|
i32 nest_level = 0;
|
||||||
i32 paren_nest_level = 0;
|
i32 paren_nest_level = 0;
|
||||||
|
|
||||||
Cpp_Token *first_paren = 0;
|
Token *first_paren = 0;
|
||||||
i32 first_paren_index = 0;
|
i32 first_paren_index = 0;
|
||||||
i32 first_paren_position = 0;
|
i32 first_paren_position = 0;
|
||||||
i32 last_paren_index = 0;
|
i32 last_paren_index = 0;
|
||||||
|
@ -33,7 +35,7 @@ get_function_positions(Application_Links *app, Buffer_ID buffer, i32 first_token
|
||||||
first_paren_index = 0;
|
first_paren_index = 0;
|
||||||
first_paren_position = 0;
|
first_paren_position = 0;
|
||||||
last_paren_index = 0;
|
last_paren_index = 0;
|
||||||
for (Cpp_Token *token = token_iterator_current(&token_it);
|
for (Token *token = token_iterator_current(&token_it);
|
||||||
token != 0;
|
token != 0;
|
||||||
token = token_iterator_goto_next(&token_it)){
|
token = token_iterator_goto_next(&token_it)){
|
||||||
if (!(token->flags & CPP_TFLAG_PP_BODY)){
|
if (!(token->flags & CPP_TFLAG_PP_BODY)){
|
||||||
|
@ -67,7 +69,7 @@ get_function_positions(Application_Links *app, Buffer_ID buffer, i32 first_token
|
||||||
// Look for a closing parenthese to mark the end of a function signature.
|
// Look for a closing parenthese to mark the end of a function signature.
|
||||||
paren_mode1:
|
paren_mode1:
|
||||||
paren_nest_level = 0;
|
paren_nest_level = 0;
|
||||||
for (Cpp_Token *token = token_iterator_current(&token_it);
|
for (Token *token = token_iterator_current(&token_it);
|
||||||
token != 0;
|
token != 0;
|
||||||
token = token_iterator_goto_next(&token_it)){
|
token = token_iterator_goto_next(&token_it)){
|
||||||
if (!(token->flags & CPP_TFLAG_PP_BODY)){
|
if (!(token->flags & CPP_TFLAG_PP_BODY)){
|
||||||
|
@ -93,11 +95,11 @@ get_function_positions(Application_Links *app, Buffer_ID buffer, i32 first_token
|
||||||
// Look backwards from an open parenthese to find the start of a function signature.
|
// Look backwards from an open parenthese to find the start of a function signature.
|
||||||
paren_mode2:
|
paren_mode2:
|
||||||
{
|
{
|
||||||
Cpp_Token *restore_point = token_iterator_current(&token_it);
|
Token *restore_point = token_iterator_current(&token_it);
|
||||||
|
|
||||||
token_iterator_set(&token_it, first_paren);
|
token_iterator_set(&token_it, first_paren);
|
||||||
i32 signature_start_index = 0;
|
i32 signature_start_index = 0;
|
||||||
for (Cpp_Token *token = token_iterator_current(&token_it);
|
for (Token *token = token_iterator_current(&token_it);
|
||||||
token != 0;
|
token != 0;
|
||||||
token = token_iterator_goto_prev(&token_it)){
|
token = token_iterator_goto_prev(&token_it)){
|
||||||
if ((token->flags & CPP_TFLAG_PP_BODY) || (token->flags & CPP_TFLAG_PP_DIRECTIVE) ||
|
if ((token->flags & CPP_TFLAG_PP_BODY) || (token->flags & CPP_TFLAG_PP_DIRECTIVE) ||
|
||||||
|
@ -136,12 +138,15 @@ get_function_positions(Application_Links *app, Buffer_ID buffer, i32 first_token
|
||||||
end:;
|
end:;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
return(result);
|
return(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
print_positions_buffered(Application_Links *app, Buffer_Insertion *out, Buffer_ID buffer, Function_Positions *positions_array, i32 positions_count){
|
print_positions_buffered(Application_Links *app, Buffer_Insertion *out, Buffer_ID buffer, Function_Positions *positions_array, i32 positions_count){
|
||||||
|
NotImplemented;
|
||||||
|
#if 0
|
||||||
Arena *scratch = context_get_arena(app);
|
Arena *scratch = context_get_arena(app);
|
||||||
Temp_Memory temp = begin_temp(scratch);
|
Temp_Memory temp = begin_temp(scratch);
|
||||||
|
|
||||||
|
@ -161,9 +166,9 @@ print_positions_buffered(Application_Links *app, Buffer_Insertion *out, Buffer_I
|
||||||
if (token_range.first != 0){
|
if (token_range.first != 0){
|
||||||
insertf(out, "%.*s:%lld: ", string_expand(buffer_name), line_number);
|
insertf(out, "%.*s:%lld: ", string_expand(buffer_name), line_number);
|
||||||
|
|
||||||
Cpp_Token prev_token = {};
|
Token prev_token = {};
|
||||||
Token_Iterator token_it = make_token_iterator(token_range, start_index);
|
Token_Iterator token_it = make_token_iterator(token_range, start_index);
|
||||||
for (Cpp_Token *token = token_iterator_current(&token_it);
|
for (Token *token = token_iterator_current(&token_it);
|
||||||
token != 0 && token_iterator_current_index(&token_it) <= end_index;
|
token != 0 && token_iterator_current_index(&token_it) <= end_index;
|
||||||
token = token_iterator_goto_next_raw(&token_it)){
|
token = token_iterator_goto_next_raw(&token_it)){
|
||||||
if ((token->flags & CPP_TFLAG_PP_BODY) == 0 && token->type != CPP_TOKEN_COMMENT){
|
if ((token->flags & CPP_TFLAG_PP_BODY) == 0 && token->type != CPP_TOKEN_COMMENT){
|
||||||
|
@ -194,10 +199,14 @@ print_positions_buffered(Application_Links *app, Buffer_Insertion *out, Buffer_I
|
||||||
}
|
}
|
||||||
|
|
||||||
end_temp(temp);
|
end_temp(temp);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
list_all_functions(Application_Links *app, Buffer_ID optional_target_buffer){
|
list_all_functions(Application_Links *app, Buffer_ID optional_target_buffer){
|
||||||
|
|
||||||
|
NotImplemented;
|
||||||
|
#if 0
|
||||||
// TODO(allen): Use create or switch to buffer and clear here?
|
// TODO(allen): Use create or switch to buffer and clear here?
|
||||||
String_Const_u8 decls_name = string_u8_litexpr("*decls*");
|
String_Const_u8 decls_name = string_u8_litexpr("*decls*");
|
||||||
Buffer_ID decls_buffer = get_buffer_by_name(app, decls_name, AccessAll);
|
Buffer_ID decls_buffer = get_buffer_by_name(app, decls_name, AccessAll);
|
||||||
|
@ -260,6 +269,7 @@ list_all_functions(Application_Links *app, Buffer_ID optional_target_buffer){
|
||||||
lock_jump_buffer(app, decls_name);
|
lock_jump_buffer(app, decls_name);
|
||||||
|
|
||||||
end_temp(temp);
|
end_temp(temp);
|
||||||
|
#endif
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -12,7 +12,6 @@ struct Application_Links;
|
||||||
#define CLIPBOARD_POST_SIG(n) b32 n(Application_Links *app, i32 clipboard_id, String_Const_u8 string)
|
#define CLIPBOARD_POST_SIG(n) b32 n(Application_Links *app, i32 clipboard_id, String_Const_u8 string)
|
||||||
#define CLIPBOARD_COUNT_SIG(n) i32 n(Application_Links *app, i32 clipboard_id)
|
#define CLIPBOARD_COUNT_SIG(n) i32 n(Application_Links *app, i32 clipboard_id)
|
||||||
#define PUSH_CLIPBOARD_INDEX_SIG(n) String_Const_u8 n(Application_Links *app, Arena *arena, i32 clipboard_id, i32 item_index)
|
#define PUSH_CLIPBOARD_INDEX_SIG(n) String_Const_u8 n(Application_Links *app, Arena *arena, i32 clipboard_id, i32 item_index)
|
||||||
#define CREATE_PARSE_CONTEXT_SIG(n) Parse_Context_ID n(Application_Links *app, Parser_String_And_Type *kw, u32 kw_count, Parser_String_And_Type *pp, u32 pp_count)
|
|
||||||
#define GET_BUFFER_COUNT_SIG(n) i32 n(Application_Links *app)
|
#define GET_BUFFER_COUNT_SIG(n) i32 n(Application_Links *app)
|
||||||
#define GET_BUFFER_NEXT_SIG(n) Buffer_ID n(Application_Links *app, Buffer_ID buffer_id, Access_Flag access)
|
#define GET_BUFFER_NEXT_SIG(n) Buffer_ID n(Application_Links *app, Buffer_ID buffer_id, Access_Flag access)
|
||||||
#define GET_BUFFER_BY_NAME_SIG(n) Buffer_ID n(Application_Links *app, String_Const_u8 name, Access_Flag access)
|
#define GET_BUFFER_BY_NAME_SIG(n) Buffer_ID n(Application_Links *app, String_Const_u8 name, Access_Flag access)
|
||||||
|
@ -44,11 +43,9 @@ struct Application_Links;
|
||||||
#define PUSH_BUFFER_FILE_NAME_SIG(n) String_Const_u8 n(Application_Links *app, Arena *arena, Buffer_ID buffer_id)
|
#define PUSH_BUFFER_FILE_NAME_SIG(n) String_Const_u8 n(Application_Links *app, Arena *arena, Buffer_ID buffer_id)
|
||||||
#define BUFFER_GET_DIRTY_STATE_SIG(n) Dirty_State n(Application_Links *app, Buffer_ID buffer_id)
|
#define BUFFER_GET_DIRTY_STATE_SIG(n) Dirty_State n(Application_Links *app, Buffer_ID buffer_id)
|
||||||
#define BUFFER_SET_DIRTY_STATE_SIG(n) b32 n(Application_Links *app, Buffer_ID buffer_id, Dirty_State dirty_state)
|
#define BUFFER_SET_DIRTY_STATE_SIG(n) b32 n(Application_Links *app, Buffer_ID buffer_id, Dirty_State dirty_state)
|
||||||
#define BUFFER_TOKENS_ARE_READY_SIG(n) b32 n(Application_Links *app, Buffer_ID buffer_id)
|
|
||||||
#define BUFFER_GET_SETTING_SIG(n) b32 n(Application_Links *app, Buffer_ID buffer_id, Buffer_Setting_ID setting, i32 *value_out)
|
#define BUFFER_GET_SETTING_SIG(n) b32 n(Application_Links *app, Buffer_ID buffer_id, Buffer_Setting_ID setting, i32 *value_out)
|
||||||
#define BUFFER_SET_SETTING_SIG(n) b32 n(Application_Links *app, Buffer_ID buffer_id, Buffer_Setting_ID setting, i32 value)
|
#define BUFFER_SET_SETTING_SIG(n) b32 n(Application_Links *app, Buffer_ID buffer_id, Buffer_Setting_ID setting, i32 value)
|
||||||
#define BUFFER_GET_MANAGED_SCOPE_SIG(n) Managed_Scope n(Application_Links *app, Buffer_ID buffer_id)
|
#define BUFFER_GET_MANAGED_SCOPE_SIG(n) Managed_Scope n(Application_Links *app, Buffer_ID buffer_id)
|
||||||
#define BUFFER_GET_TOKEN_ARRAY_SIG(n) Cpp_Token_Array n(Application_Links *app, Buffer_ID buffer_id)
|
|
||||||
#define BUFFER_SEND_END_SIGNAL_SIG(n) b32 n(Application_Links *app, Buffer_ID buffer_id)
|
#define BUFFER_SEND_END_SIGNAL_SIG(n) b32 n(Application_Links *app, Buffer_ID buffer_id)
|
||||||
#define CREATE_BUFFER_SIG(n) Buffer_ID n(Application_Links *app, String_Const_u8 file_name, Buffer_Create_Flag flags)
|
#define CREATE_BUFFER_SIG(n) Buffer_ID n(Application_Links *app, String_Const_u8 file_name, Buffer_Create_Flag flags)
|
||||||
#define BUFFER_SAVE_SIG(n) b32 n(Application_Links *app, Buffer_ID buffer_id, String_Const_u8 file_name, Buffer_Save_Flag flags)
|
#define BUFFER_SAVE_SIG(n) b32 n(Application_Links *app, Buffer_ID buffer_id, String_Const_u8 file_name, Buffer_Save_Flag flags)
|
||||||
|
@ -105,16 +102,15 @@ struct Application_Links;
|
||||||
#define GET_MANAGED_SCOPE_WITH_MULTIPLE_DEPENDENCIES_SIG(n) Managed_Scope n(Application_Links *app, Managed_Scope *scopes, i32 count)
|
#define GET_MANAGED_SCOPE_WITH_MULTIPLE_DEPENDENCIES_SIG(n) Managed_Scope n(Application_Links *app, Managed_Scope *scopes, i32 count)
|
||||||
#define MANAGED_SCOPE_CLEAR_CONTENTS_SIG(n) b32 n(Application_Links *app, Managed_Scope scope)
|
#define MANAGED_SCOPE_CLEAR_CONTENTS_SIG(n) b32 n(Application_Links *app, Managed_Scope scope)
|
||||||
#define MANAGED_SCOPE_CLEAR_SELF_ALL_DEPENDENT_SCOPES_SIG(n) b32 n(Application_Links *app, Managed_Scope scope)
|
#define MANAGED_SCOPE_CLEAR_SELF_ALL_DEPENDENT_SCOPES_SIG(n) b32 n(Application_Links *app, Managed_Scope scope)
|
||||||
#define MANAGED_VARIABLE_CREATE_SIG(n) Managed_Variable_ID n(Application_Links *app, char *null_terminated_name, u64 default_value)
|
#define MANAGED_SCOPE_ALLOCATOR_SIG(n) Base_Allocator* n(Application_Links *app, Managed_Scope scope)
|
||||||
#define MANAGED_VARIABLE_GET_ID_SIG(n) Managed_Variable_ID n(Application_Links *app, char *null_terminated_name)
|
#define MANAGED_ID_DECLARE_SIG(n) Managed_ID n(Application_Links *app, String_Const_u8 name)
|
||||||
#define MANAGED_VARIABLE_CREATE_OR_GET_ID_SIG(n) Managed_Variable_ID n(Application_Links *app, char *null_terminated_name, u64 default_value)
|
#define MANAGED_SCOPE_GET_ATTACHMENT_SIG(n) void* n(Application_Links *app, Managed_Scope scope, Managed_ID id, umem size)
|
||||||
#define MANAGED_VARIABLE_SET_SIG(n) b32 n(Application_Links *app, Managed_Scope scope, Managed_Variable_ID id, u64 value)
|
#define MANAGED_SCOPE_ATTACHMENT_ERASE_SIG(n) void* n(Application_Links *app, Managed_Scope scope, Managed_ID id)
|
||||||
#define MANAGED_VARIABLE_GET_SIG(n) b32 n(Application_Links *app, Managed_Scope scope, Managed_Variable_ID id, u64 *value_out)
|
|
||||||
#define ALLOC_MANAGED_MEMORY_IN_SCOPE_SIG(n) Managed_Object n(Application_Links *app, Managed_Scope scope, i32 item_size, i32 count)
|
#define ALLOC_MANAGED_MEMORY_IN_SCOPE_SIG(n) Managed_Object n(Application_Links *app, Managed_Scope scope, i32 item_size, i32 count)
|
||||||
#define ALLOC_BUFFER_MARKERS_ON_BUFFER_SIG(n) Managed_Object n(Application_Links *app, Buffer_ID buffer_id, i32 count, Managed_Scope *optional_extra_scope)
|
#define ALLOC_BUFFER_MARKERS_ON_BUFFER_SIG(n) Managed_Object n(Application_Links *app, Buffer_ID buffer_id, i32 count, Managed_Scope *optional_extra_scope)
|
||||||
#define ALLOC_MANAGED_ARENA_IN_SCOPE_SIG(n) Managed_Object n(Application_Links *app, Managed_Scope scope, i32 page_size)
|
|
||||||
#define MANAGED_OBJECT_GET_ITEM_SIZE_SIG(n) u32 n(Application_Links *app, Managed_Object object)
|
#define MANAGED_OBJECT_GET_ITEM_SIZE_SIG(n) u32 n(Application_Links *app, Managed_Object object)
|
||||||
#define MANAGED_OBJECT_GET_ITEM_COUNT_SIG(n) u32 n(Application_Links *app, Managed_Object object)
|
#define MANAGED_OBJECT_GET_ITEM_COUNT_SIG(n) u32 n(Application_Links *app, Managed_Object object)
|
||||||
|
#define MANAGED_OBJECT_GET_POINTER_SIG(n) void* n(Application_Links *app, Managed_Object object)
|
||||||
#define MANAGED_OBJECT_GET_TYPE_SIG(n) Managed_Object_Type n(Application_Links *app, Managed_Object object)
|
#define MANAGED_OBJECT_GET_TYPE_SIG(n) Managed_Object_Type n(Application_Links *app, Managed_Object object)
|
||||||
#define MANAGED_OBJECT_GET_CONTAINING_SCOPE_SIG(n) Managed_Scope n(Application_Links *app, Managed_Object object)
|
#define MANAGED_OBJECT_GET_CONTAINING_SCOPE_SIG(n) Managed_Scope n(Application_Links *app, Managed_Object object)
|
||||||
#define MANAGED_OBJECT_FREE_SIG(n) b32 n(Application_Links *app, Managed_Object object)
|
#define MANAGED_OBJECT_FREE_SIG(n) b32 n(Application_Links *app, Managed_Object object)
|
||||||
|
@ -198,7 +194,6 @@ typedef CHILD_PROCESS_GET_STATE_SIG(Child_Process_Get_State_Function);
|
||||||
typedef CLIPBOARD_POST_SIG(Clipboard_Post_Function);
|
typedef CLIPBOARD_POST_SIG(Clipboard_Post_Function);
|
||||||
typedef CLIPBOARD_COUNT_SIG(Clipboard_Count_Function);
|
typedef CLIPBOARD_COUNT_SIG(Clipboard_Count_Function);
|
||||||
typedef PUSH_CLIPBOARD_INDEX_SIG(Push_Clipboard_Index_Function);
|
typedef PUSH_CLIPBOARD_INDEX_SIG(Push_Clipboard_Index_Function);
|
||||||
typedef CREATE_PARSE_CONTEXT_SIG(Create_Parse_Context_Function);
|
|
||||||
typedef GET_BUFFER_COUNT_SIG(Get_Buffer_Count_Function);
|
typedef GET_BUFFER_COUNT_SIG(Get_Buffer_Count_Function);
|
||||||
typedef GET_BUFFER_NEXT_SIG(Get_Buffer_Next_Function);
|
typedef GET_BUFFER_NEXT_SIG(Get_Buffer_Next_Function);
|
||||||
typedef GET_BUFFER_BY_NAME_SIG(Get_Buffer_By_Name_Function);
|
typedef GET_BUFFER_BY_NAME_SIG(Get_Buffer_By_Name_Function);
|
||||||
|
@ -230,11 +225,9 @@ typedef PUSH_BUFFER_UNIQUE_NAME_SIG(Push_Buffer_Unique_Name_Function);
|
||||||
typedef PUSH_BUFFER_FILE_NAME_SIG(Push_Buffer_File_Name_Function);
|
typedef PUSH_BUFFER_FILE_NAME_SIG(Push_Buffer_File_Name_Function);
|
||||||
typedef BUFFER_GET_DIRTY_STATE_SIG(Buffer_Get_Dirty_State_Function);
|
typedef BUFFER_GET_DIRTY_STATE_SIG(Buffer_Get_Dirty_State_Function);
|
||||||
typedef BUFFER_SET_DIRTY_STATE_SIG(Buffer_Set_Dirty_State_Function);
|
typedef BUFFER_SET_DIRTY_STATE_SIG(Buffer_Set_Dirty_State_Function);
|
||||||
typedef BUFFER_TOKENS_ARE_READY_SIG(Buffer_Tokens_Are_Ready_Function);
|
|
||||||
typedef BUFFER_GET_SETTING_SIG(Buffer_Get_Setting_Function);
|
typedef BUFFER_GET_SETTING_SIG(Buffer_Get_Setting_Function);
|
||||||
typedef BUFFER_SET_SETTING_SIG(Buffer_Set_Setting_Function);
|
typedef BUFFER_SET_SETTING_SIG(Buffer_Set_Setting_Function);
|
||||||
typedef BUFFER_GET_MANAGED_SCOPE_SIG(Buffer_Get_Managed_Scope_Function);
|
typedef BUFFER_GET_MANAGED_SCOPE_SIG(Buffer_Get_Managed_Scope_Function);
|
||||||
typedef BUFFER_GET_TOKEN_ARRAY_SIG(Buffer_Get_Token_Array_Function);
|
|
||||||
typedef BUFFER_SEND_END_SIGNAL_SIG(Buffer_Send_End_Signal_Function);
|
typedef BUFFER_SEND_END_SIGNAL_SIG(Buffer_Send_End_Signal_Function);
|
||||||
typedef CREATE_BUFFER_SIG(Create_Buffer_Function);
|
typedef CREATE_BUFFER_SIG(Create_Buffer_Function);
|
||||||
typedef BUFFER_SAVE_SIG(Buffer_Save_Function);
|
typedef BUFFER_SAVE_SIG(Buffer_Save_Function);
|
||||||
|
@ -291,16 +284,15 @@ typedef GET_GLOBAL_MANAGED_SCOPE_SIG(Get_Global_Managed_Scope_Function);
|
||||||
typedef GET_MANAGED_SCOPE_WITH_MULTIPLE_DEPENDENCIES_SIG(Get_Managed_Scope_With_Multiple_Dependencies_Function);
|
typedef GET_MANAGED_SCOPE_WITH_MULTIPLE_DEPENDENCIES_SIG(Get_Managed_Scope_With_Multiple_Dependencies_Function);
|
||||||
typedef MANAGED_SCOPE_CLEAR_CONTENTS_SIG(Managed_Scope_Clear_Contents_Function);
|
typedef MANAGED_SCOPE_CLEAR_CONTENTS_SIG(Managed_Scope_Clear_Contents_Function);
|
||||||
typedef MANAGED_SCOPE_CLEAR_SELF_ALL_DEPENDENT_SCOPES_SIG(Managed_Scope_Clear_Self_All_Dependent_Scopes_Function);
|
typedef MANAGED_SCOPE_CLEAR_SELF_ALL_DEPENDENT_SCOPES_SIG(Managed_Scope_Clear_Self_All_Dependent_Scopes_Function);
|
||||||
typedef MANAGED_VARIABLE_CREATE_SIG(Managed_Variable_Create_Function);
|
typedef MANAGED_SCOPE_ALLOCATOR_SIG(Managed_Scope_Allocator_Function);
|
||||||
typedef MANAGED_VARIABLE_GET_ID_SIG(Managed_Variable_Get_ID_Function);
|
typedef MANAGED_ID_DECLARE_SIG(Managed_Id_Declare_Function);
|
||||||
typedef MANAGED_VARIABLE_CREATE_OR_GET_ID_SIG(Managed_Variable_Create_Or_Get_ID_Function);
|
typedef MANAGED_SCOPE_GET_ATTACHMENT_SIG(Managed_Scope_Get_Attachment_Function);
|
||||||
typedef MANAGED_VARIABLE_SET_SIG(Managed_Variable_Set_Function);
|
typedef MANAGED_SCOPE_ATTACHMENT_ERASE_SIG(Managed_Scope_Attachment_Erase_Function);
|
||||||
typedef MANAGED_VARIABLE_GET_SIG(Managed_Variable_Get_Function);
|
|
||||||
typedef ALLOC_MANAGED_MEMORY_IN_SCOPE_SIG(Alloc_Managed_Memory_In_Scope_Function);
|
typedef ALLOC_MANAGED_MEMORY_IN_SCOPE_SIG(Alloc_Managed_Memory_In_Scope_Function);
|
||||||
typedef ALLOC_BUFFER_MARKERS_ON_BUFFER_SIG(Alloc_Buffer_Markers_On_Buffer_Function);
|
typedef ALLOC_BUFFER_MARKERS_ON_BUFFER_SIG(Alloc_Buffer_Markers_On_Buffer_Function);
|
||||||
typedef ALLOC_MANAGED_ARENA_IN_SCOPE_SIG(Alloc_Managed_Arena_In_Scope_Function);
|
|
||||||
typedef MANAGED_OBJECT_GET_ITEM_SIZE_SIG(Managed_Object_Get_Item_Size_Function);
|
typedef MANAGED_OBJECT_GET_ITEM_SIZE_SIG(Managed_Object_Get_Item_Size_Function);
|
||||||
typedef MANAGED_OBJECT_GET_ITEM_COUNT_SIG(Managed_Object_Get_Item_Count_Function);
|
typedef MANAGED_OBJECT_GET_ITEM_COUNT_SIG(Managed_Object_Get_Item_Count_Function);
|
||||||
|
typedef MANAGED_OBJECT_GET_POINTER_SIG(Managed_Object_Get_Pointer_Function);
|
||||||
typedef MANAGED_OBJECT_GET_TYPE_SIG(Managed_Object_Get_Type_Function);
|
typedef MANAGED_OBJECT_GET_TYPE_SIG(Managed_Object_Get_Type_Function);
|
||||||
typedef MANAGED_OBJECT_GET_CONTAINING_SCOPE_SIG(Managed_Object_Get_Containing_Scope_Function);
|
typedef MANAGED_OBJECT_GET_CONTAINING_SCOPE_SIG(Managed_Object_Get_Containing_Scope_Function);
|
||||||
typedef MANAGED_OBJECT_FREE_SIG(Managed_Object_Free_Function);
|
typedef MANAGED_OBJECT_FREE_SIG(Managed_Object_Free_Function);
|
||||||
|
@ -386,7 +378,6 @@ Child_Process_Get_State_Function *child_process_get_state;
|
||||||
Clipboard_Post_Function *clipboard_post;
|
Clipboard_Post_Function *clipboard_post;
|
||||||
Clipboard_Count_Function *clipboard_count;
|
Clipboard_Count_Function *clipboard_count;
|
||||||
Push_Clipboard_Index_Function *push_clipboard_index;
|
Push_Clipboard_Index_Function *push_clipboard_index;
|
||||||
Create_Parse_Context_Function *create_parse_context;
|
|
||||||
Get_Buffer_Count_Function *get_buffer_count;
|
Get_Buffer_Count_Function *get_buffer_count;
|
||||||
Get_Buffer_Next_Function *get_buffer_next;
|
Get_Buffer_Next_Function *get_buffer_next;
|
||||||
Get_Buffer_By_Name_Function *get_buffer_by_name;
|
Get_Buffer_By_Name_Function *get_buffer_by_name;
|
||||||
|
@ -418,11 +409,9 @@ Push_Buffer_Unique_Name_Function *push_buffer_unique_name;
|
||||||
Push_Buffer_File_Name_Function *push_buffer_file_name;
|
Push_Buffer_File_Name_Function *push_buffer_file_name;
|
||||||
Buffer_Get_Dirty_State_Function *buffer_get_dirty_state;
|
Buffer_Get_Dirty_State_Function *buffer_get_dirty_state;
|
||||||
Buffer_Set_Dirty_State_Function *buffer_set_dirty_state;
|
Buffer_Set_Dirty_State_Function *buffer_set_dirty_state;
|
||||||
Buffer_Tokens_Are_Ready_Function *buffer_tokens_are_ready;
|
|
||||||
Buffer_Get_Setting_Function *buffer_get_setting;
|
Buffer_Get_Setting_Function *buffer_get_setting;
|
||||||
Buffer_Set_Setting_Function *buffer_set_setting;
|
Buffer_Set_Setting_Function *buffer_set_setting;
|
||||||
Buffer_Get_Managed_Scope_Function *buffer_get_managed_scope;
|
Buffer_Get_Managed_Scope_Function *buffer_get_managed_scope;
|
||||||
Buffer_Get_Token_Array_Function *buffer_get_token_array;
|
|
||||||
Buffer_Send_End_Signal_Function *buffer_send_end_signal;
|
Buffer_Send_End_Signal_Function *buffer_send_end_signal;
|
||||||
Create_Buffer_Function *create_buffer;
|
Create_Buffer_Function *create_buffer;
|
||||||
Buffer_Save_Function *buffer_save;
|
Buffer_Save_Function *buffer_save;
|
||||||
|
@ -479,16 +468,15 @@ Get_Global_Managed_Scope_Function *get_global_managed_scope;
|
||||||
Get_Managed_Scope_With_Multiple_Dependencies_Function *get_managed_scope_with_multiple_dependencies;
|
Get_Managed_Scope_With_Multiple_Dependencies_Function *get_managed_scope_with_multiple_dependencies;
|
||||||
Managed_Scope_Clear_Contents_Function *managed_scope_clear_contents;
|
Managed_Scope_Clear_Contents_Function *managed_scope_clear_contents;
|
||||||
Managed_Scope_Clear_Self_All_Dependent_Scopes_Function *managed_scope_clear_self_all_dependent_scopes;
|
Managed_Scope_Clear_Self_All_Dependent_Scopes_Function *managed_scope_clear_self_all_dependent_scopes;
|
||||||
Managed_Variable_Create_Function *managed_variable_create;
|
Managed_Scope_Allocator_Function *managed_scope_allocator;
|
||||||
Managed_Variable_Get_ID_Function *managed_variable_get_id;
|
Managed_Id_Declare_Function *managed_id_declare;
|
||||||
Managed_Variable_Create_Or_Get_ID_Function *managed_variable_create_or_get_id;
|
Managed_Scope_Get_Attachment_Function *managed_scope_get_attachment;
|
||||||
Managed_Variable_Set_Function *managed_variable_set;
|
Managed_Scope_Attachment_Erase_Function *managed_scope_attachment_erase;
|
||||||
Managed_Variable_Get_Function *managed_variable_get;
|
|
||||||
Alloc_Managed_Memory_In_Scope_Function *alloc_managed_memory_in_scope;
|
Alloc_Managed_Memory_In_Scope_Function *alloc_managed_memory_in_scope;
|
||||||
Alloc_Buffer_Markers_On_Buffer_Function *alloc_buffer_markers_on_buffer;
|
Alloc_Buffer_Markers_On_Buffer_Function *alloc_buffer_markers_on_buffer;
|
||||||
Alloc_Managed_Arena_In_Scope_Function *alloc_managed_arena_in_scope;
|
|
||||||
Managed_Object_Get_Item_Size_Function *managed_object_get_item_size;
|
Managed_Object_Get_Item_Size_Function *managed_object_get_item_size;
|
||||||
Managed_Object_Get_Item_Count_Function *managed_object_get_item_count;
|
Managed_Object_Get_Item_Count_Function *managed_object_get_item_count;
|
||||||
|
Managed_Object_Get_Pointer_Function *managed_object_get_pointer;
|
||||||
Managed_Object_Get_Type_Function *managed_object_get_type;
|
Managed_Object_Get_Type_Function *managed_object_get_type;
|
||||||
Managed_Object_Get_Containing_Scope_Function *managed_object_get_containing_scope;
|
Managed_Object_Get_Containing_Scope_Function *managed_object_get_containing_scope;
|
||||||
Managed_Object_Free_Function *managed_object_free;
|
Managed_Object_Free_Function *managed_object_free;
|
||||||
|
@ -573,7 +561,6 @@ Child_Process_Get_State_Function *child_process_get_state_;
|
||||||
Clipboard_Post_Function *clipboard_post_;
|
Clipboard_Post_Function *clipboard_post_;
|
||||||
Clipboard_Count_Function *clipboard_count_;
|
Clipboard_Count_Function *clipboard_count_;
|
||||||
Push_Clipboard_Index_Function *push_clipboard_index_;
|
Push_Clipboard_Index_Function *push_clipboard_index_;
|
||||||
Create_Parse_Context_Function *create_parse_context_;
|
|
||||||
Get_Buffer_Count_Function *get_buffer_count_;
|
Get_Buffer_Count_Function *get_buffer_count_;
|
||||||
Get_Buffer_Next_Function *get_buffer_next_;
|
Get_Buffer_Next_Function *get_buffer_next_;
|
||||||
Get_Buffer_By_Name_Function *get_buffer_by_name_;
|
Get_Buffer_By_Name_Function *get_buffer_by_name_;
|
||||||
|
@ -605,11 +592,9 @@ Push_Buffer_Unique_Name_Function *push_buffer_unique_name_;
|
||||||
Push_Buffer_File_Name_Function *push_buffer_file_name_;
|
Push_Buffer_File_Name_Function *push_buffer_file_name_;
|
||||||
Buffer_Get_Dirty_State_Function *buffer_get_dirty_state_;
|
Buffer_Get_Dirty_State_Function *buffer_get_dirty_state_;
|
||||||
Buffer_Set_Dirty_State_Function *buffer_set_dirty_state_;
|
Buffer_Set_Dirty_State_Function *buffer_set_dirty_state_;
|
||||||
Buffer_Tokens_Are_Ready_Function *buffer_tokens_are_ready_;
|
|
||||||
Buffer_Get_Setting_Function *buffer_get_setting_;
|
Buffer_Get_Setting_Function *buffer_get_setting_;
|
||||||
Buffer_Set_Setting_Function *buffer_set_setting_;
|
Buffer_Set_Setting_Function *buffer_set_setting_;
|
||||||
Buffer_Get_Managed_Scope_Function *buffer_get_managed_scope_;
|
Buffer_Get_Managed_Scope_Function *buffer_get_managed_scope_;
|
||||||
Buffer_Get_Token_Array_Function *buffer_get_token_array_;
|
|
||||||
Buffer_Send_End_Signal_Function *buffer_send_end_signal_;
|
Buffer_Send_End_Signal_Function *buffer_send_end_signal_;
|
||||||
Create_Buffer_Function *create_buffer_;
|
Create_Buffer_Function *create_buffer_;
|
||||||
Buffer_Save_Function *buffer_save_;
|
Buffer_Save_Function *buffer_save_;
|
||||||
|
@ -666,16 +651,15 @@ Get_Global_Managed_Scope_Function *get_global_managed_scope_;
|
||||||
Get_Managed_Scope_With_Multiple_Dependencies_Function *get_managed_scope_with_multiple_dependencies_;
|
Get_Managed_Scope_With_Multiple_Dependencies_Function *get_managed_scope_with_multiple_dependencies_;
|
||||||
Managed_Scope_Clear_Contents_Function *managed_scope_clear_contents_;
|
Managed_Scope_Clear_Contents_Function *managed_scope_clear_contents_;
|
||||||
Managed_Scope_Clear_Self_All_Dependent_Scopes_Function *managed_scope_clear_self_all_dependent_scopes_;
|
Managed_Scope_Clear_Self_All_Dependent_Scopes_Function *managed_scope_clear_self_all_dependent_scopes_;
|
||||||
Managed_Variable_Create_Function *managed_variable_create_;
|
Managed_Scope_Allocator_Function *managed_scope_allocator_;
|
||||||
Managed_Variable_Get_ID_Function *managed_variable_get_id_;
|
Managed_Id_Declare_Function *managed_id_declare_;
|
||||||
Managed_Variable_Create_Or_Get_ID_Function *managed_variable_create_or_get_id_;
|
Managed_Scope_Get_Attachment_Function *managed_scope_get_attachment_;
|
||||||
Managed_Variable_Set_Function *managed_variable_set_;
|
Managed_Scope_Attachment_Erase_Function *managed_scope_attachment_erase_;
|
||||||
Managed_Variable_Get_Function *managed_variable_get_;
|
|
||||||
Alloc_Managed_Memory_In_Scope_Function *alloc_managed_memory_in_scope_;
|
Alloc_Managed_Memory_In_Scope_Function *alloc_managed_memory_in_scope_;
|
||||||
Alloc_Buffer_Markers_On_Buffer_Function *alloc_buffer_markers_on_buffer_;
|
Alloc_Buffer_Markers_On_Buffer_Function *alloc_buffer_markers_on_buffer_;
|
||||||
Alloc_Managed_Arena_In_Scope_Function *alloc_managed_arena_in_scope_;
|
|
||||||
Managed_Object_Get_Item_Size_Function *managed_object_get_item_size_;
|
Managed_Object_Get_Item_Size_Function *managed_object_get_item_size_;
|
||||||
Managed_Object_Get_Item_Count_Function *managed_object_get_item_count_;
|
Managed_Object_Get_Item_Count_Function *managed_object_get_item_count_;
|
||||||
|
Managed_Object_Get_Pointer_Function *managed_object_get_pointer_;
|
||||||
Managed_Object_Get_Type_Function *managed_object_get_type_;
|
Managed_Object_Get_Type_Function *managed_object_get_type_;
|
||||||
Managed_Object_Get_Containing_Scope_Function *managed_object_get_containing_scope_;
|
Managed_Object_Get_Containing_Scope_Function *managed_object_get_containing_scope_;
|
||||||
Managed_Object_Free_Function *managed_object_free_;
|
Managed_Object_Free_Function *managed_object_free_;
|
||||||
|
@ -768,7 +752,6 @@ app_links->child_process_get_state_ = Child_Process_Get_State;\
|
||||||
app_links->clipboard_post_ = Clipboard_Post;\
|
app_links->clipboard_post_ = Clipboard_Post;\
|
||||||
app_links->clipboard_count_ = Clipboard_Count;\
|
app_links->clipboard_count_ = Clipboard_Count;\
|
||||||
app_links->push_clipboard_index_ = Push_Clipboard_Index;\
|
app_links->push_clipboard_index_ = Push_Clipboard_Index;\
|
||||||
app_links->create_parse_context_ = Create_Parse_Context;\
|
|
||||||
app_links->get_buffer_count_ = Get_Buffer_Count;\
|
app_links->get_buffer_count_ = Get_Buffer_Count;\
|
||||||
app_links->get_buffer_next_ = Get_Buffer_Next;\
|
app_links->get_buffer_next_ = Get_Buffer_Next;\
|
||||||
app_links->get_buffer_by_name_ = Get_Buffer_By_Name;\
|
app_links->get_buffer_by_name_ = Get_Buffer_By_Name;\
|
||||||
|
@ -800,11 +783,9 @@ app_links->push_buffer_unique_name_ = Push_Buffer_Unique_Name;\
|
||||||
app_links->push_buffer_file_name_ = Push_Buffer_File_Name;\
|
app_links->push_buffer_file_name_ = Push_Buffer_File_Name;\
|
||||||
app_links->buffer_get_dirty_state_ = Buffer_Get_Dirty_State;\
|
app_links->buffer_get_dirty_state_ = Buffer_Get_Dirty_State;\
|
||||||
app_links->buffer_set_dirty_state_ = Buffer_Set_Dirty_State;\
|
app_links->buffer_set_dirty_state_ = Buffer_Set_Dirty_State;\
|
||||||
app_links->buffer_tokens_are_ready_ = Buffer_Tokens_Are_Ready;\
|
|
||||||
app_links->buffer_get_setting_ = Buffer_Get_Setting;\
|
app_links->buffer_get_setting_ = Buffer_Get_Setting;\
|
||||||
app_links->buffer_set_setting_ = Buffer_Set_Setting;\
|
app_links->buffer_set_setting_ = Buffer_Set_Setting;\
|
||||||
app_links->buffer_get_managed_scope_ = Buffer_Get_Managed_Scope;\
|
app_links->buffer_get_managed_scope_ = Buffer_Get_Managed_Scope;\
|
||||||
app_links->buffer_get_token_array_ = Buffer_Get_Token_Array;\
|
|
||||||
app_links->buffer_send_end_signal_ = Buffer_Send_End_Signal;\
|
app_links->buffer_send_end_signal_ = Buffer_Send_End_Signal;\
|
||||||
app_links->create_buffer_ = Create_Buffer;\
|
app_links->create_buffer_ = Create_Buffer;\
|
||||||
app_links->buffer_save_ = Buffer_Save;\
|
app_links->buffer_save_ = Buffer_Save;\
|
||||||
|
@ -861,16 +842,15 @@ app_links->get_global_managed_scope_ = Get_Global_Managed_Scope;\
|
||||||
app_links->get_managed_scope_with_multiple_dependencies_ = Get_Managed_Scope_With_Multiple_Dependencies;\
|
app_links->get_managed_scope_with_multiple_dependencies_ = Get_Managed_Scope_With_Multiple_Dependencies;\
|
||||||
app_links->managed_scope_clear_contents_ = Managed_Scope_Clear_Contents;\
|
app_links->managed_scope_clear_contents_ = Managed_Scope_Clear_Contents;\
|
||||||
app_links->managed_scope_clear_self_all_dependent_scopes_ = Managed_Scope_Clear_Self_All_Dependent_Scopes;\
|
app_links->managed_scope_clear_self_all_dependent_scopes_ = Managed_Scope_Clear_Self_All_Dependent_Scopes;\
|
||||||
app_links->managed_variable_create_ = Managed_Variable_Create;\
|
app_links->managed_scope_allocator_ = Managed_Scope_Allocator;\
|
||||||
app_links->managed_variable_get_id_ = Managed_Variable_Get_ID;\
|
app_links->managed_id_declare_ = Managed_Id_Declare;\
|
||||||
app_links->managed_variable_create_or_get_id_ = Managed_Variable_Create_Or_Get_ID;\
|
app_links->managed_scope_get_attachment_ = Managed_Scope_Get_Attachment;\
|
||||||
app_links->managed_variable_set_ = Managed_Variable_Set;\
|
app_links->managed_scope_attachment_erase_ = Managed_Scope_Attachment_Erase;\
|
||||||
app_links->managed_variable_get_ = Managed_Variable_Get;\
|
|
||||||
app_links->alloc_managed_memory_in_scope_ = Alloc_Managed_Memory_In_Scope;\
|
app_links->alloc_managed_memory_in_scope_ = Alloc_Managed_Memory_In_Scope;\
|
||||||
app_links->alloc_buffer_markers_on_buffer_ = Alloc_Buffer_Markers_On_Buffer;\
|
app_links->alloc_buffer_markers_on_buffer_ = Alloc_Buffer_Markers_On_Buffer;\
|
||||||
app_links->alloc_managed_arena_in_scope_ = Alloc_Managed_Arena_In_Scope;\
|
|
||||||
app_links->managed_object_get_item_size_ = Managed_Object_Get_Item_Size;\
|
app_links->managed_object_get_item_size_ = Managed_Object_Get_Item_Size;\
|
||||||
app_links->managed_object_get_item_count_ = Managed_Object_Get_Item_Count;\
|
app_links->managed_object_get_item_count_ = Managed_Object_Get_Item_Count;\
|
||||||
|
app_links->managed_object_get_pointer_ = Managed_Object_Get_Pointer;\
|
||||||
app_links->managed_object_get_type_ = Managed_Object_Get_Type;\
|
app_links->managed_object_get_type_ = Managed_Object_Get_Type;\
|
||||||
app_links->managed_object_get_containing_scope_ = Managed_Object_Get_Containing_Scope;\
|
app_links->managed_object_get_containing_scope_ = Managed_Object_Get_Containing_Scope;\
|
||||||
app_links->managed_object_free_ = Managed_Object_Free;\
|
app_links->managed_object_free_ = Managed_Object_Free;\
|
||||||
|
@ -955,7 +935,6 @@ static Process_State child_process_get_state(Application_Links *app, Child_Proce
|
||||||
static b32 clipboard_post(Application_Links *app, i32 clipboard_id, String_Const_u8 string){return(app->clipboard_post(app, clipboard_id, string));}
|
static b32 clipboard_post(Application_Links *app, i32 clipboard_id, String_Const_u8 string){return(app->clipboard_post(app, clipboard_id, string));}
|
||||||
static i32 clipboard_count(Application_Links *app, i32 clipboard_id){return(app->clipboard_count(app, clipboard_id));}
|
static i32 clipboard_count(Application_Links *app, i32 clipboard_id){return(app->clipboard_count(app, clipboard_id));}
|
||||||
static String_Const_u8 push_clipboard_index(Application_Links *app, Arena *arena, i32 clipboard_id, i32 item_index){return(app->push_clipboard_index(app, arena, clipboard_id, item_index));}
|
static String_Const_u8 push_clipboard_index(Application_Links *app, Arena *arena, i32 clipboard_id, i32 item_index){return(app->push_clipboard_index(app, arena, clipboard_id, item_index));}
|
||||||
static Parse_Context_ID create_parse_context(Application_Links *app, Parser_String_And_Type *kw, u32 kw_count, Parser_String_And_Type *pp, u32 pp_count){return(app->create_parse_context(app, kw, kw_count, pp, pp_count));}
|
|
||||||
static i32 get_buffer_count(Application_Links *app){return(app->get_buffer_count(app));}
|
static i32 get_buffer_count(Application_Links *app){return(app->get_buffer_count(app));}
|
||||||
static Buffer_ID get_buffer_next(Application_Links *app, Buffer_ID buffer_id, Access_Flag access){return(app->get_buffer_next(app, buffer_id, access));}
|
static Buffer_ID get_buffer_next(Application_Links *app, Buffer_ID buffer_id, Access_Flag access){return(app->get_buffer_next(app, buffer_id, access));}
|
||||||
static Buffer_ID get_buffer_by_name(Application_Links *app, String_Const_u8 name, Access_Flag access){return(app->get_buffer_by_name(app, name, access));}
|
static Buffer_ID get_buffer_by_name(Application_Links *app, String_Const_u8 name, Access_Flag access){return(app->get_buffer_by_name(app, name, access));}
|
||||||
|
@ -987,11 +966,9 @@ static String_Const_u8 push_buffer_unique_name(Application_Links *app, Arena *ou
|
||||||
static String_Const_u8 push_buffer_file_name(Application_Links *app, Arena *arena, Buffer_ID buffer_id){return(app->push_buffer_file_name(app, arena, buffer_id));}
|
static String_Const_u8 push_buffer_file_name(Application_Links *app, Arena *arena, Buffer_ID buffer_id){return(app->push_buffer_file_name(app, arena, buffer_id));}
|
||||||
static Dirty_State buffer_get_dirty_state(Application_Links *app, Buffer_ID buffer_id){return(app->buffer_get_dirty_state(app, buffer_id));}
|
static Dirty_State buffer_get_dirty_state(Application_Links *app, Buffer_ID buffer_id){return(app->buffer_get_dirty_state(app, buffer_id));}
|
||||||
static b32 buffer_set_dirty_state(Application_Links *app, Buffer_ID buffer_id, Dirty_State dirty_state){return(app->buffer_set_dirty_state(app, buffer_id, dirty_state));}
|
static b32 buffer_set_dirty_state(Application_Links *app, Buffer_ID buffer_id, Dirty_State dirty_state){return(app->buffer_set_dirty_state(app, buffer_id, dirty_state));}
|
||||||
static b32 buffer_tokens_are_ready(Application_Links *app, Buffer_ID buffer_id){return(app->buffer_tokens_are_ready(app, buffer_id));}
|
|
||||||
static b32 buffer_get_setting(Application_Links *app, Buffer_ID buffer_id, Buffer_Setting_ID setting, i32 *value_out){return(app->buffer_get_setting(app, buffer_id, setting, value_out));}
|
static b32 buffer_get_setting(Application_Links *app, Buffer_ID buffer_id, Buffer_Setting_ID setting, i32 *value_out){return(app->buffer_get_setting(app, buffer_id, setting, value_out));}
|
||||||
static b32 buffer_set_setting(Application_Links *app, Buffer_ID buffer_id, Buffer_Setting_ID setting, i32 value){return(app->buffer_set_setting(app, buffer_id, setting, value));}
|
static b32 buffer_set_setting(Application_Links *app, Buffer_ID buffer_id, Buffer_Setting_ID setting, i32 value){return(app->buffer_set_setting(app, buffer_id, setting, value));}
|
||||||
static Managed_Scope buffer_get_managed_scope(Application_Links *app, Buffer_ID buffer_id){return(app->buffer_get_managed_scope(app, buffer_id));}
|
static Managed_Scope buffer_get_managed_scope(Application_Links *app, Buffer_ID buffer_id){return(app->buffer_get_managed_scope(app, buffer_id));}
|
||||||
static Cpp_Token_Array buffer_get_token_array(Application_Links *app, Buffer_ID buffer_id){return(app->buffer_get_token_array(app, buffer_id));}
|
|
||||||
static b32 buffer_send_end_signal(Application_Links *app, Buffer_ID buffer_id){return(app->buffer_send_end_signal(app, buffer_id));}
|
static b32 buffer_send_end_signal(Application_Links *app, Buffer_ID buffer_id){return(app->buffer_send_end_signal(app, buffer_id));}
|
||||||
static Buffer_ID create_buffer(Application_Links *app, String_Const_u8 file_name, Buffer_Create_Flag flags){return(app->create_buffer(app, file_name, flags));}
|
static Buffer_ID create_buffer(Application_Links *app, String_Const_u8 file_name, Buffer_Create_Flag flags){return(app->create_buffer(app, file_name, flags));}
|
||||||
static b32 buffer_save(Application_Links *app, Buffer_ID buffer_id, String_Const_u8 file_name, Buffer_Save_Flag flags){return(app->buffer_save(app, buffer_id, file_name, flags));}
|
static b32 buffer_save(Application_Links *app, Buffer_ID buffer_id, String_Const_u8 file_name, Buffer_Save_Flag flags){return(app->buffer_save(app, buffer_id, file_name, flags));}
|
||||||
|
@ -1048,16 +1025,15 @@ static Managed_Scope get_global_managed_scope(Application_Links *app){return(app
|
||||||
static Managed_Scope get_managed_scope_with_multiple_dependencies(Application_Links *app, Managed_Scope *scopes, i32 count){return(app->get_managed_scope_with_multiple_dependencies(app, scopes, count));}
|
static Managed_Scope get_managed_scope_with_multiple_dependencies(Application_Links *app, Managed_Scope *scopes, i32 count){return(app->get_managed_scope_with_multiple_dependencies(app, scopes, count));}
|
||||||
static b32 managed_scope_clear_contents(Application_Links *app, Managed_Scope scope){return(app->managed_scope_clear_contents(app, scope));}
|
static b32 managed_scope_clear_contents(Application_Links *app, Managed_Scope scope){return(app->managed_scope_clear_contents(app, scope));}
|
||||||
static b32 managed_scope_clear_self_all_dependent_scopes(Application_Links *app, Managed_Scope scope){return(app->managed_scope_clear_self_all_dependent_scopes(app, scope));}
|
static b32 managed_scope_clear_self_all_dependent_scopes(Application_Links *app, Managed_Scope scope){return(app->managed_scope_clear_self_all_dependent_scopes(app, scope));}
|
||||||
static Managed_Variable_ID managed_variable_create(Application_Links *app, char *null_terminated_name, u64 default_value){return(app->managed_variable_create(app, null_terminated_name, default_value));}
|
static Base_Allocator* managed_scope_allocator(Application_Links *app, Managed_Scope scope){return(app->managed_scope_allocator(app, scope));}
|
||||||
static Managed_Variable_ID managed_variable_get_id(Application_Links *app, char *null_terminated_name){return(app->managed_variable_get_id(app, null_terminated_name));}
|
static Managed_ID managed_id_declare(Application_Links *app, String_Const_u8 name){return(app->managed_id_declare(app, name));}
|
||||||
static Managed_Variable_ID managed_variable_create_or_get_id(Application_Links *app, char *null_terminated_name, u64 default_value){return(app->managed_variable_create_or_get_id(app, null_terminated_name, default_value));}
|
static void* managed_scope_get_attachment(Application_Links *app, Managed_Scope scope, Managed_ID id, umem size){return(app->managed_scope_get_attachment(app, scope, id, size));}
|
||||||
static b32 managed_variable_set(Application_Links *app, Managed_Scope scope, Managed_Variable_ID id, u64 value){return(app->managed_variable_set(app, scope, id, value));}
|
static void* managed_scope_attachment_erase(Application_Links *app, Managed_Scope scope, Managed_ID id){return(app->managed_scope_attachment_erase(app, scope, id));}
|
||||||
static b32 managed_variable_get(Application_Links *app, Managed_Scope scope, Managed_Variable_ID id, u64 *value_out){return(app->managed_variable_get(app, scope, id, value_out));}
|
|
||||||
static Managed_Object alloc_managed_memory_in_scope(Application_Links *app, Managed_Scope scope, i32 item_size, i32 count){return(app->alloc_managed_memory_in_scope(app, scope, item_size, count));}
|
static Managed_Object alloc_managed_memory_in_scope(Application_Links *app, Managed_Scope scope, i32 item_size, i32 count){return(app->alloc_managed_memory_in_scope(app, scope, item_size, count));}
|
||||||
static Managed_Object alloc_buffer_markers_on_buffer(Application_Links *app, Buffer_ID buffer_id, i32 count, Managed_Scope *optional_extra_scope){return(app->alloc_buffer_markers_on_buffer(app, buffer_id, count, optional_extra_scope));}
|
static Managed_Object alloc_buffer_markers_on_buffer(Application_Links *app, Buffer_ID buffer_id, i32 count, Managed_Scope *optional_extra_scope){return(app->alloc_buffer_markers_on_buffer(app, buffer_id, count, optional_extra_scope));}
|
||||||
static Managed_Object alloc_managed_arena_in_scope(Application_Links *app, Managed_Scope scope, i32 page_size){return(app->alloc_managed_arena_in_scope(app, scope, page_size));}
|
|
||||||
static u32 managed_object_get_item_size(Application_Links *app, Managed_Object object){return(app->managed_object_get_item_size(app, object));}
|
static u32 managed_object_get_item_size(Application_Links *app, Managed_Object object){return(app->managed_object_get_item_size(app, object));}
|
||||||
static u32 managed_object_get_item_count(Application_Links *app, Managed_Object object){return(app->managed_object_get_item_count(app, object));}
|
static u32 managed_object_get_item_count(Application_Links *app, Managed_Object object){return(app->managed_object_get_item_count(app, object));}
|
||||||
|
static void* managed_object_get_pointer(Application_Links *app, Managed_Object object){return(app->managed_object_get_pointer(app, object));}
|
||||||
static Managed_Object_Type managed_object_get_type(Application_Links *app, Managed_Object object){return(app->managed_object_get_type(app, object));}
|
static Managed_Object_Type managed_object_get_type(Application_Links *app, Managed_Object object){return(app->managed_object_get_type(app, object));}
|
||||||
static Managed_Scope managed_object_get_containing_scope(Application_Links *app, Managed_Object object){return(app->managed_object_get_containing_scope(app, object));}
|
static Managed_Scope managed_object_get_containing_scope(Application_Links *app, Managed_Object object){return(app->managed_object_get_containing_scope(app, object));}
|
||||||
static b32 managed_object_free(Application_Links *app, Managed_Object object){return(app->managed_object_free(app, object));}
|
static b32 managed_object_free(Application_Links *app, Managed_Object object){return(app->managed_object_free(app, object));}
|
||||||
|
@ -1142,7 +1118,6 @@ static Process_State child_process_get_state(Application_Links *app, Child_Proce
|
||||||
static b32 clipboard_post(Application_Links *app, i32 clipboard_id, String_Const_u8 string){return(app->clipboard_post_(app, clipboard_id, string));}
|
static b32 clipboard_post(Application_Links *app, i32 clipboard_id, String_Const_u8 string){return(app->clipboard_post_(app, clipboard_id, string));}
|
||||||
static i32 clipboard_count(Application_Links *app, i32 clipboard_id){return(app->clipboard_count_(app, clipboard_id));}
|
static i32 clipboard_count(Application_Links *app, i32 clipboard_id){return(app->clipboard_count_(app, clipboard_id));}
|
||||||
static String_Const_u8 push_clipboard_index(Application_Links *app, Arena *arena, i32 clipboard_id, i32 item_index){return(app->push_clipboard_index_(app, arena, clipboard_id, item_index));}
|
static String_Const_u8 push_clipboard_index(Application_Links *app, Arena *arena, i32 clipboard_id, i32 item_index){return(app->push_clipboard_index_(app, arena, clipboard_id, item_index));}
|
||||||
static Parse_Context_ID create_parse_context(Application_Links *app, Parser_String_And_Type *kw, u32 kw_count, Parser_String_And_Type *pp, u32 pp_count){return(app->create_parse_context_(app, kw, kw_count, pp, pp_count));}
|
|
||||||
static i32 get_buffer_count(Application_Links *app){return(app->get_buffer_count_(app));}
|
static i32 get_buffer_count(Application_Links *app){return(app->get_buffer_count_(app));}
|
||||||
static Buffer_ID get_buffer_next(Application_Links *app, Buffer_ID buffer_id, Access_Flag access){return(app->get_buffer_next_(app, buffer_id, access));}
|
static Buffer_ID get_buffer_next(Application_Links *app, Buffer_ID buffer_id, Access_Flag access){return(app->get_buffer_next_(app, buffer_id, access));}
|
||||||
static Buffer_ID get_buffer_by_name(Application_Links *app, String_Const_u8 name, Access_Flag access){return(app->get_buffer_by_name_(app, name, access));}
|
static Buffer_ID get_buffer_by_name(Application_Links *app, String_Const_u8 name, Access_Flag access){return(app->get_buffer_by_name_(app, name, access));}
|
||||||
|
@ -1174,11 +1149,9 @@ static String_Const_u8 push_buffer_unique_name(Application_Links *app, Arena *ou
|
||||||
static String_Const_u8 push_buffer_file_name(Application_Links *app, Arena *arena, Buffer_ID buffer_id){return(app->push_buffer_file_name_(app, arena, buffer_id));}
|
static String_Const_u8 push_buffer_file_name(Application_Links *app, Arena *arena, Buffer_ID buffer_id){return(app->push_buffer_file_name_(app, arena, buffer_id));}
|
||||||
static Dirty_State buffer_get_dirty_state(Application_Links *app, Buffer_ID buffer_id){return(app->buffer_get_dirty_state_(app, buffer_id));}
|
static Dirty_State buffer_get_dirty_state(Application_Links *app, Buffer_ID buffer_id){return(app->buffer_get_dirty_state_(app, buffer_id));}
|
||||||
static b32 buffer_set_dirty_state(Application_Links *app, Buffer_ID buffer_id, Dirty_State dirty_state){return(app->buffer_set_dirty_state_(app, buffer_id, dirty_state));}
|
static b32 buffer_set_dirty_state(Application_Links *app, Buffer_ID buffer_id, Dirty_State dirty_state){return(app->buffer_set_dirty_state_(app, buffer_id, dirty_state));}
|
||||||
static b32 buffer_tokens_are_ready(Application_Links *app, Buffer_ID buffer_id){return(app->buffer_tokens_are_ready_(app, buffer_id));}
|
|
||||||
static b32 buffer_get_setting(Application_Links *app, Buffer_ID buffer_id, Buffer_Setting_ID setting, i32 *value_out){return(app->buffer_get_setting_(app, buffer_id, setting, value_out));}
|
static b32 buffer_get_setting(Application_Links *app, Buffer_ID buffer_id, Buffer_Setting_ID setting, i32 *value_out){return(app->buffer_get_setting_(app, buffer_id, setting, value_out));}
|
||||||
static b32 buffer_set_setting(Application_Links *app, Buffer_ID buffer_id, Buffer_Setting_ID setting, i32 value){return(app->buffer_set_setting_(app, buffer_id, setting, value));}
|
static b32 buffer_set_setting(Application_Links *app, Buffer_ID buffer_id, Buffer_Setting_ID setting, i32 value){return(app->buffer_set_setting_(app, buffer_id, setting, value));}
|
||||||
static Managed_Scope buffer_get_managed_scope(Application_Links *app, Buffer_ID buffer_id){return(app->buffer_get_managed_scope_(app, buffer_id));}
|
static Managed_Scope buffer_get_managed_scope(Application_Links *app, Buffer_ID buffer_id){return(app->buffer_get_managed_scope_(app, buffer_id));}
|
||||||
static Cpp_Token_Array buffer_get_token_array(Application_Links *app, Buffer_ID buffer_id){return(app->buffer_get_token_array_(app, buffer_id));}
|
|
||||||
static b32 buffer_send_end_signal(Application_Links *app, Buffer_ID buffer_id){return(app->buffer_send_end_signal_(app, buffer_id));}
|
static b32 buffer_send_end_signal(Application_Links *app, Buffer_ID buffer_id){return(app->buffer_send_end_signal_(app, buffer_id));}
|
||||||
static Buffer_ID create_buffer(Application_Links *app, String_Const_u8 file_name, Buffer_Create_Flag flags){return(app->create_buffer_(app, file_name, flags));}
|
static Buffer_ID create_buffer(Application_Links *app, String_Const_u8 file_name, Buffer_Create_Flag flags){return(app->create_buffer_(app, file_name, flags));}
|
||||||
static b32 buffer_save(Application_Links *app, Buffer_ID buffer_id, String_Const_u8 file_name, Buffer_Save_Flag flags){return(app->buffer_save_(app, buffer_id, file_name, flags));}
|
static b32 buffer_save(Application_Links *app, Buffer_ID buffer_id, String_Const_u8 file_name, Buffer_Save_Flag flags){return(app->buffer_save_(app, buffer_id, file_name, flags));}
|
||||||
|
@ -1235,16 +1208,15 @@ static Managed_Scope get_global_managed_scope(Application_Links *app){return(app
|
||||||
static Managed_Scope get_managed_scope_with_multiple_dependencies(Application_Links *app, Managed_Scope *scopes, i32 count){return(app->get_managed_scope_with_multiple_dependencies_(app, scopes, count));}
|
static Managed_Scope get_managed_scope_with_multiple_dependencies(Application_Links *app, Managed_Scope *scopes, i32 count){return(app->get_managed_scope_with_multiple_dependencies_(app, scopes, count));}
|
||||||
static b32 managed_scope_clear_contents(Application_Links *app, Managed_Scope scope){return(app->managed_scope_clear_contents_(app, scope));}
|
static b32 managed_scope_clear_contents(Application_Links *app, Managed_Scope scope){return(app->managed_scope_clear_contents_(app, scope));}
|
||||||
static b32 managed_scope_clear_self_all_dependent_scopes(Application_Links *app, Managed_Scope scope){return(app->managed_scope_clear_self_all_dependent_scopes_(app, scope));}
|
static b32 managed_scope_clear_self_all_dependent_scopes(Application_Links *app, Managed_Scope scope){return(app->managed_scope_clear_self_all_dependent_scopes_(app, scope));}
|
||||||
static Managed_Variable_ID managed_variable_create(Application_Links *app, char *null_terminated_name, u64 default_value){return(app->managed_variable_create_(app, null_terminated_name, default_value));}
|
static Base_Allocator* managed_scope_allocator(Application_Links *app, Managed_Scope scope){return(app->managed_scope_allocator_(app, scope));}
|
||||||
static Managed_Variable_ID managed_variable_get_id(Application_Links *app, char *null_terminated_name){return(app->managed_variable_get_id_(app, null_terminated_name));}
|
static Managed_ID managed_id_declare(Application_Links *app, String_Const_u8 name){return(app->managed_id_declare_(app, name));}
|
||||||
static Managed_Variable_ID managed_variable_create_or_get_id(Application_Links *app, char *null_terminated_name, u64 default_value){return(app->managed_variable_create_or_get_id_(app, null_terminated_name, default_value));}
|
static void* managed_scope_get_attachment(Application_Links *app, Managed_Scope scope, Managed_ID id, umem size){return(app->managed_scope_get_attachment_(app, scope, id, size));}
|
||||||
static b32 managed_variable_set(Application_Links *app, Managed_Scope scope, Managed_Variable_ID id, u64 value){return(app->managed_variable_set_(app, scope, id, value));}
|
static void* managed_scope_attachment_erase(Application_Links *app, Managed_Scope scope, Managed_ID id){return(app->managed_scope_attachment_erase_(app, scope, id));}
|
||||||
static b32 managed_variable_get(Application_Links *app, Managed_Scope scope, Managed_Variable_ID id, u64 *value_out){return(app->managed_variable_get_(app, scope, id, value_out));}
|
|
||||||
static Managed_Object alloc_managed_memory_in_scope(Application_Links *app, Managed_Scope scope, i32 item_size, i32 count){return(app->alloc_managed_memory_in_scope_(app, scope, item_size, count));}
|
static Managed_Object alloc_managed_memory_in_scope(Application_Links *app, Managed_Scope scope, i32 item_size, i32 count){return(app->alloc_managed_memory_in_scope_(app, scope, item_size, count));}
|
||||||
static Managed_Object alloc_buffer_markers_on_buffer(Application_Links *app, Buffer_ID buffer_id, i32 count, Managed_Scope *optional_extra_scope){return(app->alloc_buffer_markers_on_buffer_(app, buffer_id, count, optional_extra_scope));}
|
static Managed_Object alloc_buffer_markers_on_buffer(Application_Links *app, Buffer_ID buffer_id, i32 count, Managed_Scope *optional_extra_scope){return(app->alloc_buffer_markers_on_buffer_(app, buffer_id, count, optional_extra_scope));}
|
||||||
static Managed_Object alloc_managed_arena_in_scope(Application_Links *app, Managed_Scope scope, i32 page_size){return(app->alloc_managed_arena_in_scope_(app, scope, page_size));}
|
|
||||||
static u32 managed_object_get_item_size(Application_Links *app, Managed_Object object){return(app->managed_object_get_item_size_(app, object));}
|
static u32 managed_object_get_item_size(Application_Links *app, Managed_Object object){return(app->managed_object_get_item_size_(app, object));}
|
||||||
static u32 managed_object_get_item_count(Application_Links *app, Managed_Object object){return(app->managed_object_get_item_count_(app, object));}
|
static u32 managed_object_get_item_count(Application_Links *app, Managed_Object object){return(app->managed_object_get_item_count_(app, object));}
|
||||||
|
static void* managed_object_get_pointer(Application_Links *app, Managed_Object object){return(app->managed_object_get_pointer_(app, object));}
|
||||||
static Managed_Object_Type managed_object_get_type(Application_Links *app, Managed_Object object){return(app->managed_object_get_type_(app, object));}
|
static Managed_Object_Type managed_object_get_type(Application_Links *app, Managed_Object object){return(app->managed_object_get_type_(app, object));}
|
||||||
static Managed_Scope managed_object_get_containing_scope(Application_Links *app, Managed_Object object){return(app->managed_object_get_containing_scope_(app, object));}
|
static Managed_Scope managed_object_get_containing_scope(Application_Links *app, Managed_Object object){return(app->managed_object_get_containing_scope_(app, object));}
|
||||||
static b32 managed_object_free(Application_Links *app, Managed_Object object){return(app->managed_object_free_(app, object));}
|
static b32 managed_object_free(Application_Links *app, Managed_Object object){return(app->managed_object_free_(app, object));}
|
||||||
|
|
|
@ -254,7 +254,7 @@ int32_t source_name_len;
|
||||||
int32_t line_number;
|
int32_t line_number;
|
||||||
};
|
};
|
||||||
static Command_Metadata fcoder_metacmd_table[233] = {
|
static Command_Metadata fcoder_metacmd_table[233] = {
|
||||||
{ PROC_LINKS(write_explicit_enum_flags, 0), "write_explicit_enum_flags", 25, "If the cursor is found to be on the '{' of an enum definition, the values of the enum will be filled in to give each a unique power of 2 value, starting from 1. Existing values are overwritten.", 194, "w:\\4ed\\code\\4coder_experiments.cpp", 34, 504 },
|
{ PROC_LINKS(write_explicit_enum_flags, 0), "write_explicit_enum_flags", 25, "If the cursor is found to be on the '{' of an enum definition, the values of the enum will be filled in to give each a unique power of 2 value, starting from 1. Existing values are overwritten.", 194, "w:\\4ed\\code\\4coder_experiments.cpp", 34, 502 },
|
||||||
{ PROC_LINKS(seek_beginning_of_textual_line, 0), "seek_beginning_of_textual_line", 30, "Seeks the cursor to the beginning of the line across all text.", 62, "w:\\4ed\\code\\4coder_seek.cpp", 27, 29 },
|
{ PROC_LINKS(seek_beginning_of_textual_line, 0), "seek_beginning_of_textual_line", 30, "Seeks the cursor to the beginning of the line across all text.", 62, "w:\\4ed\\code\\4coder_seek.cpp", 27, 29 },
|
||||||
{ PROC_LINKS(seek_end_of_textual_line, 0), "seek_end_of_textual_line", 24, "Seeks the cursor to the end of the line across all text.", 56, "w:\\4ed\\code\\4coder_seek.cpp", 27, 35 },
|
{ PROC_LINKS(seek_end_of_textual_line, 0), "seek_end_of_textual_line", 24, "Seeks the cursor to the end of the line across all text.", 56, "w:\\4ed\\code\\4coder_seek.cpp", 27, 35 },
|
||||||
{ PROC_LINKS(seek_beginning_of_line, 0), "seek_beginning_of_line", 22, "Seeks the cursor to the beginning of the visual line.", 53, "w:\\4ed\\code\\4coder_seek.cpp", 27, 41 },
|
{ PROC_LINKS(seek_beginning_of_line, 0), "seek_beginning_of_line", 22, "Seeks the cursor to the beginning of the visual line.", 53, "w:\\4ed\\code\\4coder_seek.cpp", 27, 41 },
|
||||||
|
@ -265,16 +265,16 @@ static Command_Metadata fcoder_metacmd_table[233] = {
|
||||||
{ PROC_LINKS(change_active_panel_backwards, 0), "change_active_panel_backwards", 29, "Change the currently active panel, moving to the panel with the next lowest view_id.", 84, "w:\\4ed\\code\\4coder_default_framework.cpp", 40, 211 },
|
{ PROC_LINKS(change_active_panel_backwards, 0), "change_active_panel_backwards", 29, "Change the currently active panel, moving to the panel with the next lowest view_id.", 84, "w:\\4ed\\code\\4coder_default_framework.cpp", 40, 211 },
|
||||||
{ PROC_LINKS(open_panel_vsplit, 0), "open_panel_vsplit", 17, "Create a new panel by vertically splitting the active panel.", 60, "w:\\4ed\\code\\4coder_default_framework.cpp", 40, 221 },
|
{ PROC_LINKS(open_panel_vsplit, 0), "open_panel_vsplit", 17, "Create a new panel by vertically splitting the active panel.", 60, "w:\\4ed\\code\\4coder_default_framework.cpp", 40, 221 },
|
||||||
{ PROC_LINKS(open_panel_hsplit, 0), "open_panel_hsplit", 17, "Create a new panel by horizontally splitting the active panel.", 62, "w:\\4ed\\code\\4coder_default_framework.cpp", 40, 231 },
|
{ PROC_LINKS(open_panel_hsplit, 0), "open_panel_hsplit", 17, "Create a new panel by horizontally splitting the active panel.", 62, "w:\\4ed\\code\\4coder_default_framework.cpp", 40, 231 },
|
||||||
{ PROC_LINKS(suppress_mouse, 0), "suppress_mouse", 14, "Hides the mouse and causes all mosue input (clicks, position, wheel) to be ignored.", 83, "w:\\4ed\\code\\4coder_default_framework.cpp", 40, 292 },
|
{ PROC_LINKS(suppress_mouse, 0), "suppress_mouse", 14, "Hides the mouse and causes all mosue input (clicks, position, wheel) to be ignored.", 83, "w:\\4ed\\code\\4coder_default_framework.cpp", 40, 294 },
|
||||||
{ PROC_LINKS(allow_mouse, 0), "allow_mouse", 11, "Shows the mouse and causes all mouse input to be processed normally.", 68, "w:\\4ed\\code\\4coder_default_framework.cpp", 40, 298 },
|
{ PROC_LINKS(allow_mouse, 0), "allow_mouse", 11, "Shows the mouse and causes all mouse input to be processed normally.", 68, "w:\\4ed\\code\\4coder_default_framework.cpp", 40, 300 },
|
||||||
{ PROC_LINKS(toggle_mouse, 0), "toggle_mouse", 12, "Toggles the mouse suppression mode, see suppress_mouse and allow_mouse.", 71, "w:\\4ed\\code\\4coder_default_framework.cpp", 40, 304 },
|
{ PROC_LINKS(toggle_mouse, 0), "toggle_mouse", 12, "Toggles the mouse suppression mode, see suppress_mouse and allow_mouse.", 71, "w:\\4ed\\code\\4coder_default_framework.cpp", 40, 306 },
|
||||||
{ PROC_LINKS(set_mode_to_original, 0), "set_mode_to_original", 20, "Sets the edit mode to 4coder original.", 38, "w:\\4ed\\code\\4coder_default_framework.cpp", 40, 310 },
|
{ PROC_LINKS(set_mode_to_original, 0), "set_mode_to_original", 20, "Sets the edit mode to 4coder original.", 38, "w:\\4ed\\code\\4coder_default_framework.cpp", 40, 312 },
|
||||||
{ PROC_LINKS(set_mode_to_notepad_like, 0), "set_mode_to_notepad_like", 24, "Sets the edit mode to Notepad like.", 35, "w:\\4ed\\code\\4coder_default_framework.cpp", 40, 316 },
|
{ PROC_LINKS(set_mode_to_notepad_like, 0), "set_mode_to_notepad_like", 24, "Sets the edit mode to Notepad like.", 35, "w:\\4ed\\code\\4coder_default_framework.cpp", 40, 318 },
|
||||||
{ PROC_LINKS(toggle_highlight_line_at_cursor, 0), "toggle_highlight_line_at_cursor", 31, "Toggles the line highlight at the cursor.", 41, "w:\\4ed\\code\\4coder_default_framework.cpp", 40, 322 },
|
{ PROC_LINKS(toggle_highlight_line_at_cursor, 0), "toggle_highlight_line_at_cursor", 31, "Toggles the line highlight at the cursor.", 41, "w:\\4ed\\code\\4coder_default_framework.cpp", 40, 324 },
|
||||||
{ PROC_LINKS(toggle_highlight_enclosing_scopes, 0), "toggle_highlight_enclosing_scopes", 33, "In code files scopes surrounding the cursor are highlighted with distinguishing colors.", 87, "w:\\4ed\\code\\4coder_default_framework.cpp", 40, 328 },
|
{ PROC_LINKS(toggle_highlight_enclosing_scopes, 0), "toggle_highlight_enclosing_scopes", 33, "In code files scopes surrounding the cursor are highlighted with distinguishing colors.", 87, "w:\\4ed\\code\\4coder_default_framework.cpp", 40, 330 },
|
||||||
{ PROC_LINKS(toggle_paren_matching_helper, 0), "toggle_paren_matching_helper", 28, "In code files matching parentheses pairs are colored with distinguishing colors.", 80, "w:\\4ed\\code\\4coder_default_framework.cpp", 40, 334 },
|
{ PROC_LINKS(toggle_paren_matching_helper, 0), "toggle_paren_matching_helper", 28, "In code files matching parentheses pairs are colored with distinguishing colors.", 80, "w:\\4ed\\code\\4coder_default_framework.cpp", 40, 336 },
|
||||||
{ PROC_LINKS(toggle_fullscreen, 0), "toggle_fullscreen", 17, "Toggle fullscreen mode on or off. The change(s) do not take effect until the next frame.", 89, "w:\\4ed\\code\\4coder_default_framework.cpp", 40, 340 },
|
{ PROC_LINKS(toggle_fullscreen, 0), "toggle_fullscreen", 17, "Toggle fullscreen mode on or off. The change(s) do not take effect until the next frame.", 89, "w:\\4ed\\code\\4coder_default_framework.cpp", 40, 342 },
|
||||||
{ PROC_LINKS(remap_interactive, 0), "remap_interactive", 17, "Switch to a named key binding map.", 34, "w:\\4ed\\code\\4coder_default_framework.cpp", 40, 348 },
|
{ PROC_LINKS(remap_interactive, 0), "remap_interactive", 17, "Switch to a named key binding map.", 34, "w:\\4ed\\code\\4coder_default_framework.cpp", 40, 350 },
|
||||||
{ PROC_LINKS(write_character, 0), "write_character", 15, "Inserts whatever character was used to trigger this command.", 60, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 57 },
|
{ PROC_LINKS(write_character, 0), "write_character", 15, "Inserts whatever character was used to trigger this command.", 60, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 57 },
|
||||||
{ PROC_LINKS(write_underscore, 0), "write_underscore", 16, "Inserts an underscore.", 22, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 66 },
|
{ PROC_LINKS(write_underscore, 0), "write_underscore", 16, "Inserts an underscore.", 22, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 66 },
|
||||||
{ PROC_LINKS(delete_char, 0), "delete_char", 11, "Deletes the character to the right of the cursor.", 49, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 73 },
|
{ PROC_LINKS(delete_char, 0), "delete_char", 11, "Deletes the character to the right of the cursor.", 49, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 73 },
|
||||||
|
@ -330,50 +330,50 @@ static Command_Metadata fcoder_metacmd_table[233] = {
|
||||||
{ PROC_LINKS(hide_filebar, 0), "hide_filebar", 12, "Sets the current view to hide it's filebar.", 43, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 679 },
|
{ PROC_LINKS(hide_filebar, 0), "hide_filebar", 12, "Sets the current view to hide it's filebar.", 43, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 679 },
|
||||||
{ PROC_LINKS(toggle_filebar, 0), "toggle_filebar", 14, "Toggles the visibility status of the current view's filebar.", 60, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 686 },
|
{ PROC_LINKS(toggle_filebar, 0), "toggle_filebar", 14, "Toggles the visibility status of the current view's filebar.", 60, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 686 },
|
||||||
{ PROC_LINKS(toggle_line_wrap, 0), "toggle_line_wrap", 16, "Toggles the current buffer's line wrapping status.", 50, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 695 },
|
{ PROC_LINKS(toggle_line_wrap, 0), "toggle_line_wrap", 16, "Toggles the current buffer's line wrapping status.", 50, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 695 },
|
||||||
{ PROC_LINKS(toggle_fps_meter, 0), "toggle_fps_meter", 16, "Toggles the visibility of the FPS performance meter", 51, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 705 },
|
{ PROC_LINKS(toggle_fps_meter, 0), "toggle_fps_meter", 16, "Toggles the visibility of the FPS performance meter", 51, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 708 },
|
||||||
{ PROC_LINKS(increase_line_wrap, 0), "increase_line_wrap", 18, "Increases the current buffer's width for line wrapping.", 55, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 711 },
|
{ PROC_LINKS(increase_line_wrap, 0), "increase_line_wrap", 18, "Increases the current buffer's width for line wrapping.", 55, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 714 },
|
||||||
{ PROC_LINKS(decrease_line_wrap, 0), "decrease_line_wrap", 18, "Decrases the current buffer's width for line wrapping.", 54, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 721 },
|
{ PROC_LINKS(decrease_line_wrap, 0), "decrease_line_wrap", 18, "Decrases the current buffer's width for line wrapping.", 54, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 727 },
|
||||||
{ PROC_LINKS(increase_face_size, 0), "increase_face_size", 18, "Increase the size of the face used by the current buffer.", 57, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 731 },
|
{ PROC_LINKS(increase_face_size, 0), "increase_face_size", 18, "Increase the size of the face used by the current buffer.", 57, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 740 },
|
||||||
{ PROC_LINKS(decrease_face_size, 0), "decrease_face_size", 18, "Decrease the size of the face used by the current buffer.", 57, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 742 },
|
{ PROC_LINKS(decrease_face_size, 0), "decrease_face_size", 18, "Decrease the size of the face used by the current buffer.", 57, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 751 },
|
||||||
{ PROC_LINKS(mouse_wheel_change_face_size, 0), "mouse_wheel_change_face_size", 28, "Reads the state of the mouse wheel and uses it to either increase or decrease the face size.", 92, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 753 },
|
{ PROC_LINKS(mouse_wheel_change_face_size, 0), "mouse_wheel_change_face_size", 28, "Reads the state of the mouse wheel and uses it to either increase or decrease the face size.", 92, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 762 },
|
||||||
{ PROC_LINKS(toggle_virtual_whitespace, 0), "toggle_virtual_whitespace", 25, "Toggles the current buffer's virtual whitespace status.", 55, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 770 },
|
{ PROC_LINKS(toggle_virtual_whitespace, 0), "toggle_virtual_whitespace", 25, "Toggles the current buffer's virtual whitespace status.", 55, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 779 },
|
||||||
{ PROC_LINKS(toggle_show_whitespace, 0), "toggle_show_whitespace", 22, "Toggles the current buffer's whitespace visibility status.", 58, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 780 },
|
{ PROC_LINKS(toggle_show_whitespace, 0), "toggle_show_whitespace", 22, "Toggles the current buffer's whitespace visibility status.", 58, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 789 },
|
||||||
{ PROC_LINKS(toggle_line_numbers, 0), "toggle_line_numbers", 19, "Toggles the left margin line numbers.", 37, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 789 },
|
{ PROC_LINKS(toggle_line_numbers, 0), "toggle_line_numbers", 19, "Toggles the left margin line numbers.", 37, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 798 },
|
||||||
{ PROC_LINKS(eol_dosify, 0), "eol_dosify", 10, "Puts the buffer in DOS line ending mode.", 40, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 795 },
|
{ PROC_LINKS(eol_dosify, 0), "eol_dosify", 10, "Puts the buffer in DOS line ending mode.", 40, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 804 },
|
||||||
{ PROC_LINKS(eol_nixify, 0), "eol_nixify", 10, "Puts the buffer in NIX line ending mode.", 40, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 803 },
|
{ PROC_LINKS(eol_nixify, 0), "eol_nixify", 10, "Puts the buffer in NIX line ending mode.", 40, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 812 },
|
||||||
{ PROC_LINKS(exit_4coder, 0), "exit_4coder", 11, "Attempts to close 4coder.", 25, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 811 },
|
{ PROC_LINKS(exit_4coder, 0), "exit_4coder", 11, "Attempts to close 4coder.", 25, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 820 },
|
||||||
{ PROC_LINKS(goto_line, 0), "goto_line", 9, "Queries the user for a number, and jumps the cursor to the corresponding line.", 78, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 819 },
|
{ PROC_LINKS(goto_line, 0), "goto_line", 9, "Queries the user for a number, and jumps the cursor to the corresponding line.", 78, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 828 },
|
||||||
{ PROC_LINKS(search, 0), "search", 6, "Begins an incremental search down through the current buffer for a user specified string.", 89, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1030 },
|
{ PROC_LINKS(search, 0), "search", 6, "Begins an incremental search down through the current buffer for a user specified string.", 89, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1039 },
|
||||||
{ PROC_LINKS(reverse_search, 0), "reverse_search", 14, "Begins an incremental search up through the current buffer for a user specified string.", 87, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1036 },
|
{ PROC_LINKS(reverse_search, 0), "reverse_search", 14, "Begins an incremental search up through the current buffer for a user specified string.", 87, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1045 },
|
||||||
{ PROC_LINKS(search_identifier, 0), "search_identifier", 17, "Begins an incremental search down through the current buffer for the word or token under the cursor.", 100, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1042 },
|
{ PROC_LINKS(search_identifier, 0), "search_identifier", 17, "Begins an incremental search down through the current buffer for the word or token under the cursor.", 100, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1051 },
|
||||||
{ PROC_LINKS(reverse_search_identifier, 0), "reverse_search_identifier", 25, "Begins an incremental search up through the current buffer for the word or token under the cursor.", 98, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1053 },
|
{ PROC_LINKS(reverse_search_identifier, 0), "reverse_search_identifier", 25, "Begins an incremental search up through the current buffer for the word or token under the cursor.", 98, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1062 },
|
||||||
{ PROC_LINKS(replace_in_range, 0), "replace_in_range", 16, "Queries the user for a needle and string. Replaces all occurences of needle with string in the range between cursor and the mark in the active buffer.", 150, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1104 },
|
{ PROC_LINKS(replace_in_range, 0), "replace_in_range", 16, "Queries the user for a needle and string. Replaces all occurences of needle with string in the range between cursor and the mark in the active buffer.", 150, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1113 },
|
||||||
{ PROC_LINKS(replace_in_buffer, 0), "replace_in_buffer", 17, "Queries the user for a needle and string. Replaces all occurences of needle with string in the active buffer.", 109, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1113 },
|
{ PROC_LINKS(replace_in_buffer, 0), "replace_in_buffer", 17, "Queries the user for a needle and string. Replaces all occurences of needle with string in the active buffer.", 109, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1122 },
|
||||||
{ PROC_LINKS(replace_in_all_buffers, 0), "replace_in_all_buffers", 22, "Queries the user for a needle and string. Replaces all occurences of needle with string in all editable buffers.", 112, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1122 },
|
{ PROC_LINKS(replace_in_all_buffers, 0), "replace_in_all_buffers", 22, "Queries the user for a needle and string. Replaces all occurences of needle with string in all editable buffers.", 112, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1131 },
|
||||||
{ PROC_LINKS(query_replace, 0), "query_replace", 13, "Queries the user for two strings, and incrementally replaces every occurence of the first string with the second string.", 120, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1210 },
|
{ PROC_LINKS(query_replace, 0), "query_replace", 13, "Queries the user for two strings, and incrementally replaces every occurence of the first string with the second string.", 120, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1219 },
|
||||||
{ PROC_LINKS(query_replace_identifier, 0), "query_replace_identifier", 24, "Queries the user for a string, and incrementally replace every occurence of the word or token found at the cursor with the specified string.", 140, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1230 },
|
{ PROC_LINKS(query_replace_identifier, 0), "query_replace_identifier", 24, "Queries the user for a string, and incrementally replace every occurence of the word or token found at the cursor with the specified string.", 140, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1239 },
|
||||||
{ PROC_LINKS(query_replace_selection, 0), "query_replace_selection", 23, "Queries the user for a string, and incrementally replace every occurence of the string found in the selected range with the specified string.", 141, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1246 },
|
{ PROC_LINKS(query_replace_selection, 0), "query_replace_selection", 23, "Queries the user for a string, and incrementally replace every occurence of the string found in the selected range with the specified string.", 141, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1255 },
|
||||||
{ PROC_LINKS(save_all_dirty_buffers, 0), "save_all_dirty_buffers", 22, "Saves all buffers marked dirty (showing the '*' indicator).", 59, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1281 },
|
{ PROC_LINKS(save_all_dirty_buffers, 0), "save_all_dirty_buffers", 22, "Saves all buffers marked dirty (showing the '*' indicator).", 59, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1290 },
|
||||||
{ PROC_LINKS(delete_file_query, 0), "delete_file_query", 17, "Deletes the file of the current buffer if 4coder has the appropriate access rights. Will ask the user for confirmation first.", 125, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1306 },
|
{ PROC_LINKS(delete_file_query, 0), "delete_file_query", 17, "Deletes the file of the current buffer if 4coder has the appropriate access rights. Will ask the user for confirmation first.", 125, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1315 },
|
||||||
{ PROC_LINKS(save_to_query, 0), "save_to_query", 13, "Queries the user for a file name and saves the contents of the current buffer, altering the buffer's name too.", 110, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1344 },
|
{ PROC_LINKS(save_to_query, 0), "save_to_query", 13, "Queries the user for a file name and saves the contents of the current buffer, altering the buffer's name too.", 110, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1353 },
|
||||||
{ PROC_LINKS(rename_file_query, 0), "rename_file_query", 17, "Queries the user for a new name and renames the file of the current buffer, altering the buffer's name too.", 107, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1379 },
|
{ PROC_LINKS(rename_file_query, 0), "rename_file_query", 17, "Queries the user for a new name and renames the file of the current buffer, altering the buffer's name too.", 107, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1388 },
|
||||||
{ PROC_LINKS(make_directory_query, 0), "make_directory_query", 20, "Queries the user for a name and creates a new directory with the given name.", 76, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1419 },
|
{ PROC_LINKS(make_directory_query, 0), "make_directory_query", 20, "Queries the user for a name and creates a new directory with the given name.", 76, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1428 },
|
||||||
{ PROC_LINKS(move_line_up, 0), "move_line_up", 12, "Swaps the line under the cursor with the line above it, and moves the cursor up with it.", 88, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1452 },
|
{ PROC_LINKS(move_line_up, 0), "move_line_up", 12, "Swaps the line under the cursor with the line above it, and moves the cursor up with it.", 88, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1461 },
|
||||||
{ PROC_LINKS(move_line_down, 0), "move_line_down", 14, "Swaps the line under the cursor with the line below it, and moves the cursor down with it.", 90, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1458 },
|
{ PROC_LINKS(move_line_down, 0), "move_line_down", 14, "Swaps the line under the cursor with the line below it, and moves the cursor down with it.", 90, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1467 },
|
||||||
{ PROC_LINKS(duplicate_line, 0), "duplicate_line", 14, "Create a copy of the line on which the cursor sits.", 51, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1464 },
|
{ PROC_LINKS(duplicate_line, 0), "duplicate_line", 14, "Create a copy of the line on which the cursor sits.", 51, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1473 },
|
||||||
{ PROC_LINKS(delete_line, 0), "delete_line", 11, "Delete the line the on which the cursor sits.", 45, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1478 },
|
{ PROC_LINKS(delete_line, 0), "delete_line", 11, "Delete the line the on which the cursor sits.", 45, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1487 },
|
||||||
{ PROC_LINKS(open_file_in_quotes, 0), "open_file_in_quotes", 19, "Reads a filename from surrounding '\"' characters and attempts to open the corresponding file.", 94, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1543 },
|
{ PROC_LINKS(open_file_in_quotes, 0), "open_file_in_quotes", 19, "Reads a filename from surrounding '\"' characters and attempts to open the corresponding file.", 94, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1552 },
|
||||||
{ PROC_LINKS(open_matching_file_cpp, 0), "open_matching_file_cpp", 22, "If the current file is a *.cpp or *.h, attempts to open the corresponding *.h or *.cpp file in the other view.", 110, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1575 },
|
{ PROC_LINKS(open_matching_file_cpp, 0), "open_matching_file_cpp", 22, "If the current file is a *.cpp or *.h, attempts to open the corresponding *.h or *.cpp file in the other view.", 110, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1584 },
|
||||||
{ PROC_LINKS(view_buffer_other_panel, 0), "view_buffer_other_panel", 23, "Set the other non-active panel to view the buffer that the active panel views, and switch to that panel.", 104, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1588 },
|
{ PROC_LINKS(view_buffer_other_panel, 0), "view_buffer_other_panel", 23, "Set the other non-active panel to view the buffer that the active panel views, and switch to that panel.", 104, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1597 },
|
||||||
{ PROC_LINKS(swap_buffers_between_panels, 0), "swap_buffers_between_panels", 27, "Set the other non-active panel to view the buffer that the active panel views, and switch to that panel.", 104, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1600 },
|
{ PROC_LINKS(swap_buffers_between_panels, 0), "swap_buffers_between_panels", 27, "Set the other non-active panel to view the buffer that the active panel views, and switch to that panel.", 104, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1609 },
|
||||||
{ PROC_LINKS(kill_buffer, 0), "kill_buffer", 11, "Kills the current buffer.", 25, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1636 },
|
{ PROC_LINKS(kill_buffer, 0), "kill_buffer", 11, "Kills the current buffer.", 25, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1645 },
|
||||||
{ PROC_LINKS(save, 0), "save", 4, "Saves the current buffer.", 25, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1644 },
|
{ PROC_LINKS(save, 0), "save", 4, "Saves the current buffer.", 25, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1653 },
|
||||||
{ PROC_LINKS(reopen, 0), "reopen", 6, "Reopen the current buffer from the hard drive.", 46, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1656 },
|
{ PROC_LINKS(reopen, 0), "reopen", 6, "Reopen the current buffer from the hard drive.", 46, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1665 },
|
||||||
{ PROC_LINKS(undo, 0), "undo", 4, "Advances backwards through the undo history of the current buffer.", 66, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1714 },
|
{ PROC_LINKS(undo, 0), "undo", 4, "Advances backwards through the undo history of the current buffer.", 66, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1723 },
|
||||||
{ PROC_LINKS(redo, 0), "redo", 4, "Advances forwards through the undo history of the current buffer.", 65, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1727 },
|
{ PROC_LINKS(redo, 0), "redo", 4, "Advances forwards through the undo history of the current buffer.", 65, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1736 },
|
||||||
{ PROC_LINKS(undo_all_buffers, 0), "undo_all_buffers", 16, "Advances backward through the undo history in the buffer containing the most recent regular edit.", 97, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1741 },
|
{ PROC_LINKS(undo_all_buffers, 0), "undo_all_buffers", 16, "Advances backward through the undo history in the buffer containing the most recent regular edit.", 97, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1750 },
|
||||||
{ PROC_LINKS(redo_all_buffers, 0), "redo_all_buffers", 16, "Advances forward through the undo history in the buffer containing the most recent regular edit.", 96, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1815 },
|
{ PROC_LINKS(redo_all_buffers, 0), "redo_all_buffers", 16, "Advances forward through the undo history in the buffer containing the most recent regular edit.", 96, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1824 },
|
||||||
{ PROC_LINKS(open_in_other, 0), "open_in_other", 13, "Interactively opens a file in the other panel.", 46, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1918 },
|
{ PROC_LINKS(open_in_other, 0), "open_in_other", 13, "Interactively opens a file in the other panel.", 46, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1927 },
|
||||||
{ PROC_LINKS(lister__quit, 0), "lister__quit", 12, "A lister mode command that quits the list without executing any actions.", 72, "w:\\4ed\\code\\4coder_lists.cpp", 28, 8 },
|
{ PROC_LINKS(lister__quit, 0), "lister__quit", 12, "A lister mode command that quits the list without executing any actions.", 72, "w:\\4ed\\code\\4coder_lists.cpp", 28, 8 },
|
||||||
{ PROC_LINKS(lister__activate, 0), "lister__activate", 16, "A lister mode command that activates the list's action on the highlighted item.", 79, "w:\\4ed\\code\\4coder_lists.cpp", 28, 15 },
|
{ PROC_LINKS(lister__activate, 0), "lister__activate", 16, "A lister mode command that activates the list's action on the highlighted item.", 79, "w:\\4ed\\code\\4coder_lists.cpp", 28, 15 },
|
||||||
{ PROC_LINKS(lister__write_character, 0), "lister__write_character", 23, "A lister mode command that dispatches to the lister's write character handler.", 78, "w:\\4ed\\code\\4coder_lists.cpp", 28, 30 },
|
{ PROC_LINKS(lister__write_character, 0), "lister__write_character", 23, "A lister mode command that dispatches to the lister's write character handler.", 78, "w:\\4ed\\code\\4coder_lists.cpp", 28, 30 },
|
||||||
|
@ -397,10 +397,10 @@ static Command_Metadata fcoder_metacmd_table[233] = {
|
||||||
{ PROC_LINKS(interactive_new, 0), "interactive_new", 15, "Interactively creates a new file.", 33, "w:\\4ed\\code\\4coder_lists.cpp", 28, 854 },
|
{ PROC_LINKS(interactive_new, 0), "interactive_new", 15, "Interactively creates a new file.", 33, "w:\\4ed\\code\\4coder_lists.cpp", 28, 854 },
|
||||||
{ PROC_LINKS(interactive_open, 0), "interactive_open", 16, "Interactively opens a file.", 27, "w:\\4ed\\code\\4coder_lists.cpp", 28, 887 },
|
{ PROC_LINKS(interactive_open, 0), "interactive_open", 16, "Interactively opens a file.", 27, "w:\\4ed\\code\\4coder_lists.cpp", 28, 887 },
|
||||||
{ PROC_LINKS(command_lister, 0), "command_lister", 14, "Opens an interactive list of all registered commands.", 53, "w:\\4ed\\code\\4coder_lists.cpp", 28, 969 },
|
{ PROC_LINKS(command_lister, 0), "command_lister", 14, "Opens an interactive list of all registered commands.", 53, "w:\\4ed\\code\\4coder_lists.cpp", 28, 969 },
|
||||||
{ PROC_LINKS(auto_tab_whole_file, 0), "auto_tab_whole_file", 19, "Audo-indents the entire current buffer.", 39, "w:\\4ed\\code\\4coder_auto_indent.cpp", 34, 530 },
|
{ PROC_LINKS(auto_tab_whole_file, 0), "auto_tab_whole_file", 19, "Audo-indents the entire current buffer.", 39, "w:\\4ed\\code\\4coder_auto_indent.cpp", 34, 526 },
|
||||||
{ PROC_LINKS(auto_tab_line_at_cursor, 0), "auto_tab_line_at_cursor", 23, "Auto-indents the line on which the cursor sits.", 47, "w:\\4ed\\code\\4coder_auto_indent.cpp", 34, 539 },
|
{ PROC_LINKS(auto_tab_line_at_cursor, 0), "auto_tab_line_at_cursor", 23, "Auto-indents the line on which the cursor sits.", 47, "w:\\4ed\\code\\4coder_auto_indent.cpp", 34, 535 },
|
||||||
{ PROC_LINKS(auto_tab_range, 0), "auto_tab_range", 14, "Auto-indents the range between the cursor and the mark.", 55, "w:\\4ed\\code\\4coder_auto_indent.cpp", 34, 549 },
|
{ PROC_LINKS(auto_tab_range, 0), "auto_tab_range", 14, "Auto-indents the range between the cursor and the mark.", 55, "w:\\4ed\\code\\4coder_auto_indent.cpp", 34, 545 },
|
||||||
{ PROC_LINKS(write_and_auto_tab, 0), "write_and_auto_tab", 18, "Inserts a character and auto-indents the line on which the cursor sits.", 71, "w:\\4ed\\code\\4coder_auto_indent.cpp", 34, 559 },
|
{ PROC_LINKS(write_and_auto_tab, 0), "write_and_auto_tab", 18, "Inserts a character and auto-indents the line on which the cursor sits.", 71, "w:\\4ed\\code\\4coder_auto_indent.cpp", 34, 555 },
|
||||||
{ PROC_LINKS(list_all_locations, 0), "list_all_locations", 18, "Queries the user for a string and lists all exact case-sensitive matches found in all open buffers.", 99, "w:\\4ed\\code\\4coder_search.cpp", 29, 166 },
|
{ PROC_LINKS(list_all_locations, 0), "list_all_locations", 18, "Queries the user for a string and lists all exact case-sensitive matches found in all open buffers.", 99, "w:\\4ed\\code\\4coder_search.cpp", 29, 166 },
|
||||||
{ PROC_LINKS(list_all_substring_locations, 0), "list_all_substring_locations", 28, "Queries the user for a string and lists all case-sensitive substring matches found in all open buffers.", 103, "w:\\4ed\\code\\4coder_search.cpp", 29, 172 },
|
{ PROC_LINKS(list_all_substring_locations, 0), "list_all_substring_locations", 28, "Queries the user for a string and lists all case-sensitive substring matches found in all open buffers.", 103, "w:\\4ed\\code\\4coder_search.cpp", 29, 172 },
|
||||||
{ PROC_LINKS(list_all_locations_case_insensitive, 0), "list_all_locations_case_insensitive", 35, "Queries the user for a string and lists all exact case-insensitive matches found in all open buffers.", 101, "w:\\4ed\\code\\4coder_search.cpp", 29, 178 },
|
{ PROC_LINKS(list_all_locations_case_insensitive, 0), "list_all_locations_case_insensitive", 35, "Queries the user for a string and lists all exact case-insensitive matches found in all open buffers.", 101, "w:\\4ed\\code\\4coder_search.cpp", 29, 178 },
|
||||||
|
@ -412,28 +412,28 @@ static Command_Metadata fcoder_metacmd_table[233] = {
|
||||||
{ PROC_LINKS(list_all_locations_of_type_definition, 0), "list_all_locations_of_type_definition", 37, "Queries user for string, lists all locations of strings that appear to define a type whose name matches the input string.", 121, "w:\\4ed\\code\\4coder_search.cpp", 29, 214 },
|
{ PROC_LINKS(list_all_locations_of_type_definition, 0), "list_all_locations_of_type_definition", 37, "Queries user for string, lists all locations of strings that appear to define a type whose name matches the input string.", 121, "w:\\4ed\\code\\4coder_search.cpp", 29, 214 },
|
||||||
{ PROC_LINKS(list_all_locations_of_type_definition_of_identifier, 0), "list_all_locations_of_type_definition_of_identifier", 51, "Reads a token or word under the cursor and lists all locations of strings that appear to define a type whose name matches it.", 125, "w:\\4ed\\code\\4coder_search.cpp", 29, 222 },
|
{ PROC_LINKS(list_all_locations_of_type_definition_of_identifier, 0), "list_all_locations_of_type_definition_of_identifier", 51, "Reads a token or word under the cursor and lists all locations of strings that appear to define a type whose name matches it.", 125, "w:\\4ed\\code\\4coder_search.cpp", 29, 222 },
|
||||||
{ PROC_LINKS(word_complete, 0), "word_complete", 13, "Iteratively tries completing the word to the left of the cursor with other words in open buffers that have the same prefix string.", 130, "w:\\4ed\\code\\4coder_search.cpp", 29, 376 },
|
{ PROC_LINKS(word_complete, 0), "word_complete", 13, "Iteratively tries completing the word to the left of the cursor with other words in open buffers that have the same prefix string.", 130, "w:\\4ed\\code\\4coder_search.cpp", 29, 376 },
|
||||||
{ PROC_LINKS(goto_jump_at_cursor, 0), "goto_jump_at_cursor", 19, "If the cursor is found to be on a jump location, parses the jump location and brings up the file and position in another view and changes the active panel to the view containing the jump.", 187, "w:\\4ed\\code\\4coder_jump_sticky.cpp", 34, 352 },
|
{ PROC_LINKS(goto_jump_at_cursor, 0), "goto_jump_at_cursor", 19, "If the cursor is found to be on a jump location, parses the jump location and brings up the file and position in another view and changes the active panel to the view containing the jump.", 187, "w:\\4ed\\code\\4coder_jump_sticky.cpp", 34, 353 },
|
||||||
{ PROC_LINKS(goto_jump_at_cursor_same_panel, 0), "goto_jump_at_cursor_same_panel", 30, "If the cursor is found to be on a jump location, parses the jump location and brings up the file and position in this view, losing the compilation output or jump list.", 167, "w:\\4ed\\code\\4coder_jump_sticky.cpp", 34, 379 },
|
{ PROC_LINKS(goto_jump_at_cursor_same_panel, 0), "goto_jump_at_cursor_same_panel", 30, "If the cursor is found to be on a jump location, parses the jump location and brings up the file and position in this view, losing the compilation output or jump list.", 167, "w:\\4ed\\code\\4coder_jump_sticky.cpp", 34, 380 },
|
||||||
{ PROC_LINKS(goto_next_jump, 0), "goto_next_jump", 14, "If a buffer containing jump locations has been locked in, goes to the next jump in the buffer, skipping sub jump locations.", 123, "w:\\4ed\\code\\4coder_jump_sticky.cpp", 34, 468 },
|
{ PROC_LINKS(goto_next_jump, 0), "goto_next_jump", 14, "If a buffer containing jump locations has been locked in, goes to the next jump in the buffer, skipping sub jump locations.", 123, "w:\\4ed\\code\\4coder_jump_sticky.cpp", 34, 469 },
|
||||||
{ PROC_LINKS(goto_prev_jump, 0), "goto_prev_jump", 14, "If a buffer containing jump locations has been locked in, goes to the previous jump in the buffer, skipping sub jump locations.", 127, "w:\\4ed\\code\\4coder_jump_sticky.cpp", 34, 485 },
|
{ PROC_LINKS(goto_prev_jump, 0), "goto_prev_jump", 14, "If a buffer containing jump locations has been locked in, goes to the previous jump in the buffer, skipping sub jump locations.", 127, "w:\\4ed\\code\\4coder_jump_sticky.cpp", 34, 486 },
|
||||||
{ PROC_LINKS(goto_next_jump_no_skips, 0), "goto_next_jump_no_skips", 23, "If a buffer containing jump locations has been locked in, goes to the next jump in the buffer, and does not skip sub jump locations.", 132, "w:\\4ed\\code\\4coder_jump_sticky.cpp", 34, 498 },
|
{ PROC_LINKS(goto_next_jump_no_skips, 0), "goto_next_jump_no_skips", 23, "If a buffer containing jump locations has been locked in, goes to the next jump in the buffer, and does not skip sub jump locations.", 132, "w:\\4ed\\code\\4coder_jump_sticky.cpp", 34, 499 },
|
||||||
{ PROC_LINKS(goto_prev_jump_no_skips, 0), "goto_prev_jump_no_skips", 23, "If a buffer containing jump locations has been locked in, goes to the previous jump in the buffer, and does not skip sub jump locations.", 136, "w:\\4ed\\code\\4coder_jump_sticky.cpp", 34, 515 },
|
{ PROC_LINKS(goto_prev_jump_no_skips, 0), "goto_prev_jump_no_skips", 23, "If a buffer containing jump locations has been locked in, goes to the previous jump in the buffer, and does not skip sub jump locations.", 136, "w:\\4ed\\code\\4coder_jump_sticky.cpp", 34, 516 },
|
||||||
{ PROC_LINKS(goto_first_jump, 0), "goto_first_jump", 15, "If a buffer containing jump locations has been locked in, goes to the first jump in the buffer.", 95, "w:\\4ed\\code\\4coder_jump_sticky.cpp", 34, 529 },
|
{ PROC_LINKS(goto_first_jump, 0), "goto_first_jump", 15, "If a buffer containing jump locations has been locked in, goes to the first jump in the buffer.", 95, "w:\\4ed\\code\\4coder_jump_sticky.cpp", 34, 530 },
|
||||||
{ PROC_LINKS(goto_first_jump_same_panel_sticky, 0), "goto_first_jump_same_panel_sticky", 33, "If a buffer containing jump locations has been locked in, goes to the first jump in the buffer and views the buffer in the panel where the jump list was.", 153, "w:\\4ed\\code\\4coder_jump_sticky.cpp", 34, 546 },
|
{ PROC_LINKS(goto_first_jump_same_panel_sticky, 0), "goto_first_jump_same_panel_sticky", 33, "If a buffer containing jump locations has been locked in, goes to the first jump in the buffer and views the buffer in the panel where the jump list was.", 153, "w:\\4ed\\code\\4coder_jump_sticky.cpp", 34, 547 },
|
||||||
{ PROC_LINKS(newline_or_goto_position, 0), "newline_or_goto_position", 24, "If the buffer in the active view is writable, inserts a character, otherwise performs goto_jump_at_cursor.", 106, "w:\\4ed\\code\\4coder_jump_sticky.cpp", 34, 568 },
|
{ PROC_LINKS(newline_or_goto_position, 0), "newline_or_goto_position", 24, "If the buffer in the active view is writable, inserts a character, otherwise performs goto_jump_at_cursor.", 106, "w:\\4ed\\code\\4coder_jump_sticky.cpp", 34, 569 },
|
||||||
{ PROC_LINKS(newline_or_goto_position_same_panel, 0), "newline_or_goto_position_same_panel", 35, "If the buffer in the active view is writable, inserts a character, otherwise performs goto_jump_at_cursor_same_panel.", 117, "w:\\4ed\\code\\4coder_jump_sticky.cpp", 34, 585 },
|
{ PROC_LINKS(newline_or_goto_position_same_panel, 0), "newline_or_goto_position_same_panel", 35, "If the buffer in the active view is writable, inserts a character, otherwise performs goto_jump_at_cursor_same_panel.", 117, "w:\\4ed\\code\\4coder_jump_sticky.cpp", 34, 586 },
|
||||||
{ PROC_LINKS(view_jump_list_with_lister, 0), "view_jump_list_with_lister", 26, "When executed on a buffer with jumps, creates a persistent lister for all the jumps", 83, "w:\\4ed\\code\\4coder_jump_lister.cpp", 34, 104 },
|
{ PROC_LINKS(view_jump_list_with_lister, 0), "view_jump_list_with_lister", 26, "When executed on a buffer with jumps, creates a persistent lister for all the jumps", 83, "w:\\4ed\\code\\4coder_jump_lister.cpp", 34, 104 },
|
||||||
{ PROC_LINKS(log_graph__escape, 0), "log_graph__escape", 17, "Ends the log grapher", 20, "w:\\4ed\\code\\4coder_log_parser.cpp", 33, 906 },
|
{ PROC_LINKS(log_graph__escape, 0), "log_graph__escape", 17, "Ends the log grapher", 20, "w:\\4ed\\code\\4coder_log_parser.cpp", 33, 906 },
|
||||||
{ PROC_LINKS(log_graph__scroll_wheel, 0), "log_graph__scroll_wheel", 23, "Scrolls the log graph", 21, "w:\\4ed\\code\\4coder_log_parser.cpp", 33, 917 },
|
{ PROC_LINKS(log_graph__scroll_wheel, 0), "log_graph__scroll_wheel", 23, "Scrolls the log graph", 21, "w:\\4ed\\code\\4coder_log_parser.cpp", 33, 915 },
|
||||||
{ PROC_LINKS(log_graph__page_up, 0), "log_graph__page_up", 18, "Scroll the log graph up one whole page", 38, "w:\\4ed\\code\\4coder_log_parser.cpp", 33, 928 },
|
{ PROC_LINKS(log_graph__page_up, 0), "log_graph__page_up", 18, "Scroll the log graph up one whole page", 38, "w:\\4ed\\code\\4coder_log_parser.cpp", 33, 926 },
|
||||||
{ PROC_LINKS(log_graph__page_down, 0), "log_graph__page_down", 20, "Scroll the log graph down one whole page", 40, "w:\\4ed\\code\\4coder_log_parser.cpp", 33, 936 },
|
{ PROC_LINKS(log_graph__page_down, 0), "log_graph__page_down", 20, "Scroll the log graph down one whole page", 40, "w:\\4ed\\code\\4coder_log_parser.cpp", 33, 934 },
|
||||||
{ PROC_LINKS(log_graph__click_select_event, 0), "log_graph__click_select_event", 29, "Select the event record at the mouse point in the log graph", 59, "w:\\4ed\\code\\4coder_log_parser.cpp", 33, 970 },
|
{ PROC_LINKS(log_graph__click_select_event, 0), "log_graph__click_select_event", 29, "Select the event record at the mouse point in the log graph", 59, "w:\\4ed\\code\\4coder_log_parser.cpp", 33, 968 },
|
||||||
{ PROC_LINKS(log_graph__click_jump_to_event_source, 0), "log_graph__click_jump_to_event_source", 37, "Jump to the code that logged the event record at the mouse point in the log graph", 81, "w:\\4ed\\code\\4coder_log_parser.cpp", 33, 989 },
|
{ PROC_LINKS(log_graph__click_jump_to_event_source, 0), "log_graph__click_jump_to_event_source", 37, "Jump to the code that logged the event record at the mouse point in the log graph", 81, "w:\\4ed\\code\\4coder_log_parser.cpp", 33, 987 },
|
||||||
{ PROC_LINKS(show_the_log_graph, 0), "show_the_log_graph", 18, "Parser *log* and displays the 'log graph' UI", 44, "w:\\4ed\\code\\4coder_log_parser.cpp", 33, 1037 },
|
{ PROC_LINKS(show_the_log_graph, 0), "show_the_log_graph", 18, "Parser *log* and displays the 'log graph' UI", 44, "w:\\4ed\\code\\4coder_log_parser.cpp", 33, 1035 },
|
||||||
{ PROC_LINKS(copy, 0), "copy", 4, "Copy the text in the range from the cursor to the mark onto the clipboard.", 74, "w:\\4ed\\code\\4coder_clipboard.cpp", 32, 19 },
|
{ PROC_LINKS(copy, 0), "copy", 4, "Copy the text in the range from the cursor to the mark onto the clipboard.", 74, "w:\\4ed\\code\\4coder_clipboard.cpp", 32, 19 },
|
||||||
{ PROC_LINKS(cut, 0), "cut", 3, "Cut the text in the range from the cursor to the mark onto the clipboard.", 73, "w:\\4ed\\code\\4coder_clipboard.cpp", 32, 28 },
|
{ PROC_LINKS(cut, 0), "cut", 3, "Cut the text in the range from the cursor to the mark onto the clipboard.", 73, "w:\\4ed\\code\\4coder_clipboard.cpp", 32, 28 },
|
||||||
{ PROC_LINKS(paste, 0), "paste", 5, "At the cursor, insert the text at the top of the clipboard.", 59, "w:\\4ed\\code\\4coder_clipboard.cpp", 32, 39 },
|
{ PROC_LINKS(paste, 0), "paste", 5, "At the cursor, insert the text at the top of the clipboard.", 59, "w:\\4ed\\code\\4coder_clipboard.cpp", 32, 39 },
|
||||||
{ PROC_LINKS(paste_next, 0), "paste_next", 10, "If the previous command was paste or paste_next, replaces the paste range with the next text down on the clipboard, otherwise operates as the paste command.", 156, "w:\\4ed\\code\\4coder_clipboard.cpp", 32, 72 },
|
{ PROC_LINKS(paste_next, 0), "paste_next", 10, "If the previous command was paste or paste_next, replaces the paste range with the next text down on the clipboard, otherwise operates as the paste command.", 156, "w:\\4ed\\code\\4coder_clipboard.cpp", 32, 73 },
|
||||||
{ PROC_LINKS(paste_and_indent, 0), "paste_and_indent", 16, "Paste from the top of clipboard and run auto-indent on the newly pasted text.", 77, "w:\\4ed\\code\\4coder_clipboard.cpp", 32, 114 },
|
{ PROC_LINKS(paste_and_indent, 0), "paste_and_indent", 16, "Paste from the top of clipboard and run auto-indent on the newly pasted text.", 77, "w:\\4ed\\code\\4coder_clipboard.cpp", 32, 114 },
|
||||||
{ PROC_LINKS(paste_next_and_indent, 0), "paste_next_and_indent", 21, "Paste the next item on the clipboard and run auto-indent on the newly pasted text.", 82, "w:\\4ed\\code\\4coder_clipboard.cpp", 32, 121 },
|
{ PROC_LINKS(paste_next_and_indent, 0), "paste_next_and_indent", 21, "Paste the next item on the clipboard and run auto-indent on the newly pasted text.", 82, "w:\\4ed\\code\\4coder_clipboard.cpp", 32, 121 },
|
||||||
{ PROC_LINKS(execute_previous_cli, 0), "execute_previous_cli", 20, "If the command execute_any_cli has already been used, this will execute a CLI reusing the most recent buffer name and command.", 126, "w:\\4ed\\code\\4coder_system_command.cpp", 37, 7 },
|
{ PROC_LINKS(execute_previous_cli, 0), "execute_previous_cli", 20, "If the command execute_any_cli has already been used, this will execute a CLI reusing the most recent buffer name and command.", 126, "w:\\4ed\\code\\4coder_system_command.cpp", 37, 7 },
|
||||||
|
@ -453,16 +453,16 @@ static Command_Metadata fcoder_metacmd_table[233] = {
|
||||||
{ PROC_LINKS(setup_build_sh, 0), "setup_build_sh", 14, "Queries the user for several configuration options and initializes a new build shell script.", 92, "w:\\4ed\\code\\4coder_project_commands.cpp", 39, 1319 },
|
{ PROC_LINKS(setup_build_sh, 0), "setup_build_sh", 14, "Queries the user for several configuration options and initializes a new build shell script.", 92, "w:\\4ed\\code\\4coder_project_commands.cpp", 39, 1319 },
|
||||||
{ PROC_LINKS(setup_build_bat_and_sh, 0), "setup_build_bat_and_sh", 22, "Queries the user for several configuration options and initializes a new build batch script.", 92, "w:\\4ed\\code\\4coder_project_commands.cpp", 39, 1325 },
|
{ PROC_LINKS(setup_build_bat_and_sh, 0), "setup_build_bat_and_sh", 22, "Queries the user for several configuration options and initializes a new build batch script.", 92, "w:\\4ed\\code\\4coder_project_commands.cpp", 39, 1325 },
|
||||||
{ PROC_LINKS(project_command_lister, 0), "project_command_lister", 22, "Open a lister of all commands in the currently loaded project.", 62, "w:\\4ed\\code\\4coder_project_commands.cpp", 39, 1340 },
|
{ PROC_LINKS(project_command_lister, 0), "project_command_lister", 22, "Open a lister of all commands in the currently loaded project.", 62, "w:\\4ed\\code\\4coder_project_commands.cpp", 39, 1340 },
|
||||||
{ PROC_LINKS(list_all_functions_current_buffer, 0), "list_all_functions_current_buffer", 33, "Creates a jump list of lines of the current buffer that appear to define or declare functions.", 94, "w:\\4ed\\code\\4coder_function_list.cpp", 36, 266 },
|
{ PROC_LINKS(list_all_functions_current_buffer, 0), "list_all_functions_current_buffer", 33, "Creates a jump list of lines of the current buffer that appear to define or declare functions.", 94, "w:\\4ed\\code\\4coder_function_list.cpp", 36, 276 },
|
||||||
{ PROC_LINKS(list_all_functions_current_buffer_lister, 0), "list_all_functions_current_buffer_lister", 40, "Creates a lister of locations that look like function definitions and declarations in the buffer.", 97, "w:\\4ed\\code\\4coder_function_list.cpp", 36, 276 },
|
{ PROC_LINKS(list_all_functions_current_buffer_lister, 0), "list_all_functions_current_buffer_lister", 40, "Creates a lister of locations that look like function definitions and declarations in the buffer.", 97, "w:\\4ed\\code\\4coder_function_list.cpp", 36, 286 },
|
||||||
{ PROC_LINKS(list_all_functions_all_buffers, 0), "list_all_functions_all_buffers", 30, "Creates a jump list of lines from all buffers that appear to define or declare functions.", 89, "w:\\4ed\\code\\4coder_function_list.cpp", 36, 288 },
|
{ PROC_LINKS(list_all_functions_all_buffers, 0), "list_all_functions_all_buffers", 30, "Creates a jump list of lines from all buffers that appear to define or declare functions.", 89, "w:\\4ed\\code\\4coder_function_list.cpp", 36, 298 },
|
||||||
{ PROC_LINKS(list_all_functions_all_buffers_lister, 0), "list_all_functions_all_buffers_lister", 37, "Creates a lister of locations that look like function definitions and declarations all buffers.", 95, "w:\\4ed\\code\\4coder_function_list.cpp", 36, 294 },
|
{ PROC_LINKS(list_all_functions_all_buffers_lister, 0), "list_all_functions_all_buffers_lister", 37, "Creates a lister of locations that look like function definitions and declarations all buffers.", 95, "w:\\4ed\\code\\4coder_function_list.cpp", 36, 304 },
|
||||||
{ PROC_LINKS(select_surrounding_scope, 0), "select_surrounding_scope", 24, "Finds the scope enclosed by '{' '}' surrounding the cursor and puts the cursor and mark on the '{' and '}'.", 107, "w:\\4ed\\code\\4coder_scope_commands.cpp", 37, 341 },
|
{ PROC_LINKS(select_surrounding_scope, 0), "select_surrounding_scope", 24, "Finds the scope enclosed by '{' '}' surrounding the cursor and puts the cursor and mark on the '{' and '}'.", 107, "w:\\4ed\\code\\4coder_scope_commands.cpp", 37, 352 },
|
||||||
{ PROC_LINKS(select_next_scope_absolute, 0), "select_next_scope_absolute", 26, "Finds the first scope started by '{' after the cursor and puts the cursor and mark on the '{' and '}'.", 102, "w:\\4ed\\code\\4coder_scope_commands.cpp", 37, 356 },
|
{ PROC_LINKS(select_next_scope_absolute, 0), "select_next_scope_absolute", 26, "Finds the first scope started by '{' after the cursor and puts the cursor and mark on the '{' and '}'.", 102, "w:\\4ed\\code\\4coder_scope_commands.cpp", 37, 367 },
|
||||||
{ PROC_LINKS(select_prev_scope_absolute, 0), "select_prev_scope_absolute", 26, "Finds the first scope started by '{' before the cursor and puts the cursor and mark on the '{' and '}'.", 103, "w:\\4ed\\code\\4coder_scope_commands.cpp", 37, 375 },
|
{ PROC_LINKS(select_prev_scope_absolute, 0), "select_prev_scope_absolute", 26, "Finds the first scope started by '{' before the cursor and puts the cursor and mark on the '{' and '}'.", 103, "w:\\4ed\\code\\4coder_scope_commands.cpp", 37, 386 },
|
||||||
{ PROC_LINKS(place_in_scope, 0), "place_in_scope", 14, "Wraps the code contained in the range between cursor and mark with a new curly brace scope.", 91, "w:\\4ed\\code\\4coder_scope_commands.cpp", 37, 449 },
|
{ PROC_LINKS(place_in_scope, 0), "place_in_scope", 14, "Wraps the code contained in the range between cursor and mark with a new curly brace scope.", 91, "w:\\4ed\\code\\4coder_scope_commands.cpp", 37, 460 },
|
||||||
{ PROC_LINKS(delete_current_scope, 0), "delete_current_scope", 20, "Deletes the braces surrounding the currently selected scope. Leaves the contents within the scope.", 99, "w:\\4ed\\code\\4coder_scope_commands.cpp", 37, 455 },
|
{ PROC_LINKS(delete_current_scope, 0), "delete_current_scope", 20, "Deletes the braces surrounding the currently selected scope. Leaves the contents within the scope.", 99, "w:\\4ed\\code\\4coder_scope_commands.cpp", 37, 466 },
|
||||||
{ PROC_LINKS(scope_absorb_down, 0), "scope_absorb_down", 17, "If a scope is currently selected, and a statement or block statement is present below the current scope, the statement is moved into the scope.", 143, "w:\\4ed\\code\\4coder_scope_commands.cpp", 37, 672 },
|
{ PROC_LINKS(scope_absorb_down, 0), "scope_absorb_down", 17, "If a scope is currently selected, and a statement or block statement is present below the current scope, the statement is moved into the scope.", 143, "w:\\4ed\\code\\4coder_scope_commands.cpp", 37, 698 },
|
||||||
{ PROC_LINKS(open_long_braces, 0), "open_long_braces", 16, "At the cursor, insert a '{' and '}' separated by a blank line.", 62, "w:\\4ed\\code\\4coder_combined_write_commands.cpp", 46, 46 },
|
{ PROC_LINKS(open_long_braces, 0), "open_long_braces", 16, "At the cursor, insert a '{' and '}' separated by a blank line.", 62, "w:\\4ed\\code\\4coder_combined_write_commands.cpp", 46, 46 },
|
||||||
{ PROC_LINKS(open_long_braces_semicolon, 0), "open_long_braces_semicolon", 26, "At the cursor, insert a '{' and '};' separated by a blank line.", 63, "w:\\4ed\\code\\4coder_combined_write_commands.cpp", 46, 54 },
|
{ PROC_LINKS(open_long_braces_semicolon, 0), "open_long_braces_semicolon", 26, "At the cursor, insert a '{' and '};' separated by a blank line.", 63, "w:\\4ed\\code\\4coder_combined_write_commands.cpp", 46, 54 },
|
||||||
{ PROC_LINKS(open_long_braces_break, 0), "open_long_braces_break", 22, "At the cursor, insert a '{' and '}break;' separated by a blank line.", 68, "w:\\4ed\\code\\4coder_combined_write_commands.cpp", 46, 62 },
|
{ PROC_LINKS(open_long_braces_break, 0), "open_long_braces_break", 22, "At the cursor, insert a '{' and '}break;' separated by a blank line.", 68, "w:\\4ed\\code\\4coder_combined_write_commands.cpp", 46, 62 },
|
||||||
|
@ -485,8 +485,8 @@ static Command_Metadata fcoder_metacmd_table[233] = {
|
||||||
{ PROC_LINKS(miblo_decrement_time_stamp, 0), "miblo_decrement_time_stamp", 26, "Decrement a time stamp under the cursor by one second. (format [m]m:ss or h:mm:ss", 81, "w:\\4ed\\code\\4coder_miblo_numbers.cpp", 36, 237 },
|
{ PROC_LINKS(miblo_decrement_time_stamp, 0), "miblo_decrement_time_stamp", 26, "Decrement a time stamp under the cursor by one second. (format [m]m:ss or h:mm:ss", 81, "w:\\4ed\\code\\4coder_miblo_numbers.cpp", 36, 237 },
|
||||||
{ PROC_LINKS(miblo_increment_time_stamp_minute, 0), "miblo_increment_time_stamp_minute", 33, "Increment a time stamp under the cursor by one minute. (format [m]m:ss or h:mm:ss", 81, "w:\\4ed\\code\\4coder_miblo_numbers.cpp", 36, 243 },
|
{ PROC_LINKS(miblo_increment_time_stamp_minute, 0), "miblo_increment_time_stamp_minute", 33, "Increment a time stamp under the cursor by one minute. (format [m]m:ss or h:mm:ss", 81, "w:\\4ed\\code\\4coder_miblo_numbers.cpp", 36, 243 },
|
||||||
{ PROC_LINKS(miblo_decrement_time_stamp_minute, 0), "miblo_decrement_time_stamp_minute", 33, "Decrement a time stamp under the cursor by one minute. (format [m]m:ss or h:mm:ss", 81, "w:\\4ed\\code\\4coder_miblo_numbers.cpp", 36, 249 },
|
{ PROC_LINKS(miblo_decrement_time_stamp_minute, 0), "miblo_decrement_time_stamp_minute", 33, "Decrement a time stamp under the cursor by one minute. (format [m]m:ss or h:mm:ss", 81, "w:\\4ed\\code\\4coder_miblo_numbers.cpp", 36, 249 },
|
||||||
{ PROC_LINKS(rename_parameter, 0), "rename_parameter", 16, "If the cursor is found to be on the name of a function parameter in the signature of a function definition, all occurences within the scope of the function will be replaced with a new provided string.", 200, "w:\\4ed\\code\\4coder_experiments.cpp", 34, 189 },
|
{ PROC_LINKS(rename_parameter, 0), "rename_parameter", 16, "If the cursor is found to be on the name of a function parameter in the signature of a function definition, all occurences within the scope of the function will be replaced with a new provided string.", 200, "w:\\4ed\\code\\4coder_experiments.cpp", 34, 187 },
|
||||||
{ PROC_LINKS(write_explicit_enum_values, 0), "write_explicit_enum_values", 26, "If the cursor is found to be on the '{' of an enum definition, the values of the enum will be filled in sequentially starting from zero. Existing values are overwritten.", 170, "w:\\4ed\\code\\4coder_experiments.cpp", 34, 498 },
|
{ PROC_LINKS(write_explicit_enum_values, 0), "write_explicit_enum_values", 26, "If the cursor is found to be on the '{' of an enum definition, the values of the enum will be filled in sequentially starting from zero. Existing values are overwritten.", 170, "w:\\4ed\\code\\4coder_experiments.cpp", 34, 496 },
|
||||||
};
|
};
|
||||||
static int32_t fcoder_metacmd_ID_write_explicit_enum_flags = 0;
|
static int32_t fcoder_metacmd_ID_write_explicit_enum_flags = 0;
|
||||||
static int32_t fcoder_metacmd_ID_seek_beginning_of_textual_line = 1;
|
static int32_t fcoder_metacmd_ID_seek_beginning_of_textual_line = 1;
|
||||||
|
|
|
@ -4,6 +4,10 @@
|
||||||
|
|
||||||
// TOP
|
// TOP
|
||||||
|
|
||||||
|
#define scope_attachment(app,S,I,T) ((T*)managed_scope_get_attachment((app), (S), (I), sizeof(T)))
|
||||||
|
|
||||||
|
////////////////////////////////
|
||||||
|
|
||||||
internal Binding_Unit*
|
internal Binding_Unit*
|
||||||
write_unit(Bind_Helper *helper, Binding_Unit unit){
|
write_unit(Bind_Helper *helper, Binding_Unit unit){
|
||||||
Binding_Unit *p = 0;
|
Binding_Unit *p = 0;
|
||||||
|
@ -162,7 +166,7 @@ set_get_view_buffer_region_hook(Bind_Helper *helper, Get_View_Buffer_Region_Func
|
||||||
}
|
}
|
||||||
|
|
||||||
internal void
|
internal void
|
||||||
set_new_file_hook(Bind_Helper *helper, Open_File_Hook_Function *func){
|
set_new_file_hook(Bind_Helper *helper, Buffer_Hook_Function *func){
|
||||||
Binding_Unit unit = {};
|
Binding_Unit unit = {};
|
||||||
unit.type = unit_hook;
|
unit.type = unit_hook;
|
||||||
unit.hook.hook_id = special_hook_new_file;
|
unit.hook.hook_id = special_hook_new_file;
|
||||||
|
@ -180,7 +184,7 @@ set_start_hook(Bind_Helper *helper, Start_Hook_Function *func){
|
||||||
}
|
}
|
||||||
|
|
||||||
internal void
|
internal void
|
||||||
set_open_file_hook(Bind_Helper *helper, Open_File_Hook_Function *func){
|
set_open_file_hook(Bind_Helper *helper, Buffer_Hook_Function *func){
|
||||||
Binding_Unit unit = {};
|
Binding_Unit unit = {};
|
||||||
unit.type = unit_hook;
|
unit.type = unit_hook;
|
||||||
unit.hook.hook_id = special_hook_open_file;
|
unit.hook.hook_id = special_hook_open_file;
|
||||||
|
@ -189,7 +193,7 @@ set_open_file_hook(Bind_Helper *helper, Open_File_Hook_Function *func){
|
||||||
}
|
}
|
||||||
|
|
||||||
internal void
|
internal void
|
||||||
set_save_file_hook(Bind_Helper *helper, Open_File_Hook_Function *func){
|
set_save_file_hook(Bind_Helper *helper, Buffer_Hook_Function *func){
|
||||||
Binding_Unit unit = {};
|
Binding_Unit unit = {};
|
||||||
unit.type = unit_hook;
|
unit.type = unit_hook;
|
||||||
unit.hook.hook_id = special_hook_save_file;
|
unit.hook.hook_id = special_hook_save_file;
|
||||||
|
@ -198,7 +202,7 @@ set_save_file_hook(Bind_Helper *helper, Open_File_Hook_Function *func){
|
||||||
}
|
}
|
||||||
|
|
||||||
internal void
|
internal void
|
||||||
set_end_file_hook(Bind_Helper *helper, Open_File_Hook_Function *func){
|
set_end_file_hook(Bind_Helper *helper, Buffer_Hook_Function *func){
|
||||||
Binding_Unit unit = {};
|
Binding_Unit unit = {};
|
||||||
unit.type = unit_hook;
|
unit.type = unit_hook;
|
||||||
unit.hook.hook_id = special_hook_end_file;
|
unit.hook.hook_id = special_hook_end_file;
|
||||||
|
@ -597,21 +601,25 @@ get_line_end_pos_from_pos(Application_Links *app, Buffer_ID buffer, i64 pos){
|
||||||
return(get_line_side_pos_from_pos(app, buffer, pos, Side_Max));
|
return(get_line_side_pos_from_pos(app, buffer, pos, Side_Max));
|
||||||
}
|
}
|
||||||
|
|
||||||
internal Cpp_Token*
|
internal Token*
|
||||||
get_first_token_from_pos(Cpp_Token_Array tokens, i64 pos){
|
get_first_token_from_pos(Token_Array tokens, i64 pos){
|
||||||
Cpp_Get_Token_Result get_token = cpp_get_token(tokens, (i32)pos);
|
NotImplemented;
|
||||||
|
Token *result = 0;
|
||||||
|
#if 0
|
||||||
|
Get_Token_Result get_token = cpp_get_token(tokens, (i32)pos);
|
||||||
if (get_token.in_whitespace_after_token){
|
if (get_token.in_whitespace_after_token){
|
||||||
get_token.token_index += 1;
|
get_token.token_index += 1;
|
||||||
}
|
}
|
||||||
Cpp_Token *result = 0;
|
Token *result = 0;
|
||||||
if (get_token.token_index < tokens.count){
|
if (get_token.token_index < tokens.count){
|
||||||
result = tokens.tokens + get_token.token_index;
|
result = tokens.tokens + get_token.token_index;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
return(result);
|
return(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
internal Cpp_Token*
|
internal Token*
|
||||||
get_first_token_from_line(Application_Links *app, Buffer_ID buffer, Cpp_Token_Array tokens, i64 line){
|
get_first_token_from_line(Application_Links *app, Buffer_ID buffer, Token_Array tokens, i64 line){
|
||||||
i64 line_start = get_line_start_pos(app, buffer, line);
|
i64 line_start = get_line_start_pos(app, buffer, line);
|
||||||
return(get_first_token_from_pos(tokens, line_start));
|
return(get_first_token_from_pos(tokens, line_start));
|
||||||
}
|
}
|
||||||
|
@ -792,18 +800,20 @@ boundary_inside_quotes(Application_Links *app, Buffer_ID buffer, Side side, Scan
|
||||||
|
|
||||||
internal i64
|
internal i64
|
||||||
boundary_token(Application_Links *app, Buffer_ID buffer, Side side, Scan_Direction direction, i64 pos){
|
boundary_token(Application_Links *app, Buffer_ID buffer, Side side, Scan_Direction direction, i64 pos){
|
||||||
i64 result = 0;
|
i64 result = boundary_non_whitespace(app, buffer, side, direction, pos);
|
||||||
|
NotImplemented;
|
||||||
|
#if 0
|
||||||
if (!buffer_tokens_are_ready(app, buffer)){
|
if (!buffer_tokens_are_ready(app, buffer)){
|
||||||
result = boundary_non_whitespace(app, buffer, side, direction, pos);
|
result = boundary_non_whitespace(app, buffer, side, direction, pos);
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
Cpp_Token_Array tokens = buffer_get_token_array(app, buffer);
|
Token_Array tokens = buffer_get_token_array(app, buffer);
|
||||||
switch (direction){
|
switch (direction){
|
||||||
case Scan_Forward:
|
case Scan_Forward:
|
||||||
{
|
{
|
||||||
i32 buffer_size = (i32)buffer_get_size(app, buffer);
|
i32 buffer_size = (i32)buffer_get_size(app, buffer);
|
||||||
if (tokens.count > 0){
|
if (tokens.count > 0){
|
||||||
Cpp_Token *token = get_first_token_from_pos(tokens, pos);
|
Token *token = get_first_token_from_pos(tokens, pos);
|
||||||
if (token != 0){
|
if (token != 0){
|
||||||
if (side == Side_Max){
|
if (side == Side_Max){
|
||||||
result = token->start + token->size;
|
result = token->start + token->size;
|
||||||
|
@ -835,7 +845,7 @@ boundary_token(Application_Links *app, Buffer_ID buffer, Side side, Scan_Directi
|
||||||
case Scan_Backward:
|
case Scan_Backward:
|
||||||
{
|
{
|
||||||
if (tokens.count > 0){
|
if (tokens.count > 0){
|
||||||
Cpp_Token *token = get_first_token_from_pos(tokens, pos);
|
Token *token = get_first_token_from_pos(tokens, pos);
|
||||||
if (side == Side_Min){
|
if (side == Side_Min){
|
||||||
if (token == 0){
|
if (token == 0){
|
||||||
token = tokens.tokens + tokens.count - 1;
|
token = tokens.tokens + tokens.count - 1;
|
||||||
|
@ -881,7 +891,7 @@ boundary_token(Application_Links *app, Buffer_ID buffer, Side side, Scan_Directi
|
||||||
}break;
|
}break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
return(result);
|
return(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1191,8 +1201,8 @@ push_buffer_range(Application_Links *app, Arena *arena, Buffer_ID buffer, Range_
|
||||||
}
|
}
|
||||||
|
|
||||||
internal String_Const_u8
|
internal String_Const_u8
|
||||||
push_token_lexeme(Application_Links *app, Arena *arena, Buffer_ID buffer, Cpp_Token token){
|
push_token_lexeme(Application_Links *app, Arena *arena, Buffer_ID buffer, Token token){
|
||||||
return(push_buffer_range(app, arena, buffer, Ii64(token.start, token.start + token.size)));
|
return(push_buffer_range(app, arena, buffer, Ii64(token.pos, token.pos + token.size)));
|
||||||
}
|
}
|
||||||
|
|
||||||
internal String_Const_u8
|
internal String_Const_u8
|
||||||
|
@ -1243,7 +1253,7 @@ buffer_get_char(Application_Links *app, Buffer_ID buffer_id, i64 pos){
|
||||||
}
|
}
|
||||||
|
|
||||||
internal b32
|
internal b32
|
||||||
token_lexeme_string_match(Application_Links *app, Buffer_ID buffer, Cpp_Token token, String_Const_u8 b){
|
token_lexeme_string_match(Application_Links *app, Buffer_ID buffer, Token token, String_Const_u8 b){
|
||||||
Scratch_Block scratch(app);
|
Scratch_Block scratch(app);
|
||||||
return(string_match(push_token_lexeme(app, scratch, buffer, token), b));
|
return(string_match(push_token_lexeme(app, scratch, buffer, token), b));
|
||||||
}
|
}
|
||||||
|
@ -1727,16 +1737,6 @@ buffer_identifier_to_id_create_out_buffer(Application_Links *app, Buffer_Identif
|
||||||
|
|
||||||
////////////////////////////////
|
////////////////////////////////
|
||||||
|
|
||||||
internal void
|
|
||||||
adjust_all_buffer_wrap_widths(Application_Links *app, i32 wrap_width, i32 min_base_width){
|
|
||||||
for (Buffer_ID buffer = get_buffer_next(app, 0, AccessAll);
|
|
||||||
buffer != 0;
|
|
||||||
buffer = get_buffer_next(app, buffer, AccessAll)){
|
|
||||||
buffer_set_setting(app, buffer, BufferSetting_WrapPosition, wrap_width);
|
|
||||||
buffer_set_setting(app, buffer, BufferSetting_MinimumBaseWrapPosition, min_base_width);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
internal View_ID
|
internal View_ID
|
||||||
open_view(Application_Links *app, View_ID view_location, View_Split_Position position){
|
open_view(Application_Links *app, View_ID view_location, View_Split_Position position){
|
||||||
View_ID result = 0;
|
View_ID result = 0;
|
||||||
|
@ -1817,12 +1817,12 @@ view_open_file(Application_Links *app, View_ID view, String_Const_u8 file_name,
|
||||||
internal void
|
internal void
|
||||||
view_disable_highlight_range(Application_Links *app, View_ID view){
|
view_disable_highlight_range(Application_Links *app, View_ID view){
|
||||||
Managed_Scope scope = view_get_managed_scope(app, view);
|
Managed_Scope scope = view_get_managed_scope(app, view);
|
||||||
Managed_Object highlight = 0;
|
Managed_Object *highlight = scope_attachment(app, scope, view_highlight_range, Managed_Object);
|
||||||
if (managed_variable_get(app, scope, view_highlight_range, &highlight)){
|
if (*highlight != 0){
|
||||||
managed_object_free(app, highlight);
|
managed_object_free(app, *highlight);
|
||||||
}
|
}
|
||||||
managed_variable_set(app, scope, view_highlight_range, 0);
|
managed_scope_attachment_erase(app, scope, view_highlight_range);
|
||||||
managed_variable_set(app, scope, view_highlight_buffer, 0);
|
managed_scope_attachment_erase(app, scope, view_highlight_buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
internal void
|
internal void
|
||||||
|
@ -1831,13 +1831,14 @@ view_set_highlight_range(Application_Links *app, View_ID view, Range_i64 range){
|
||||||
|
|
||||||
Buffer_ID buffer = view_get_buffer(app, view, AccessAll);
|
Buffer_ID buffer = view_get_buffer(app, view, AccessAll);
|
||||||
Managed_Scope scope = view_get_managed_scope(app, view);
|
Managed_Scope scope = view_get_managed_scope(app, view);
|
||||||
Managed_Object highlight = alloc_buffer_markers_on_buffer(app, buffer, 2, &scope);
|
Managed_Object *highlight = scope_attachment(app, scope, view_highlight_range, Managed_Object);
|
||||||
managed_variable_set(app, scope, view_highlight_range, highlight);
|
*highlight = alloc_buffer_markers_on_buffer(app, buffer, 2, &scope);
|
||||||
Marker markers[2] = {};
|
Marker markers[2] = {};
|
||||||
markers[0].pos = (i32)range.min;
|
markers[0].pos = range.min;
|
||||||
markers[1].pos = (i32)range.max;
|
markers[1].pos = range.max;
|
||||||
managed_object_store_data(app, highlight, 0, 2, markers);
|
managed_object_store_data(app, *highlight, 0, 2, markers);
|
||||||
managed_variable_set(app, scope, view_highlight_buffer, buffer);
|
Buffer_ID *highlight_buffer = scope_attachment(app, scope, view_highlight_buffer, Buffer_ID);
|
||||||
|
*highlight_buffer = buffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////
|
////////////////////////////////
|
||||||
|
@ -1873,212 +1874,130 @@ try_buffer_kill(Application_Links *app, Buffer_ID buffer, View_ID gui_view_id, B
|
||||||
|
|
||||||
////////////////////////////////
|
////////////////////////////////
|
||||||
|
|
||||||
internal b32
|
|
||||||
init_stream_chunk(Stream_Chunk *chunk, Application_Links *app, Buffer_ID buffer_id,
|
|
||||||
i32 pos, char *data, u32 size){
|
|
||||||
b32 result = false;
|
|
||||||
|
|
||||||
i32 buffer_size = (i32)buffer_get_size(app, buffer_id);
|
|
||||||
if (0 <= pos && pos < buffer_size && size > 0){
|
|
||||||
chunk->app = app;
|
|
||||||
chunk->buffer_id = buffer_id;
|
|
||||||
chunk->base_data = data;
|
|
||||||
chunk->data_size = size;
|
|
||||||
chunk->start = round_down_i32(pos, size);
|
|
||||||
chunk->end = round_up_i32(pos, size);
|
|
||||||
|
|
||||||
if (chunk->max_end > buffer_size || chunk->max_end == 0){
|
|
||||||
chunk->max_end = buffer_size;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (chunk->max_end && chunk->max_end < chunk->end){
|
|
||||||
chunk->end = chunk->max_end;
|
|
||||||
}
|
|
||||||
if (chunk->min_start && chunk->min_start > chunk->start){
|
|
||||||
chunk->start = chunk->min_start;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (chunk->start < chunk->end){
|
|
||||||
buffer_read_range(app, buffer_id, Ii64(chunk->start, chunk->end), chunk->base_data);
|
|
||||||
chunk->data = chunk->base_data - chunk->start;
|
|
||||||
result = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return(result);
|
|
||||||
}
|
|
||||||
|
|
||||||
internal b32
|
|
||||||
forward_stream_chunk(Stream_Chunk *chunk){
|
|
||||||
Application_Links *app = chunk->app;
|
|
||||||
Buffer_ID buffer_id = chunk->buffer_id;
|
|
||||||
b32 result = 0;
|
|
||||||
|
|
||||||
i32 buffer_size = (i32)buffer_get_size(app, buffer_id);
|
|
||||||
if (chunk->end < buffer_size){
|
|
||||||
chunk->start = chunk->end;
|
|
||||||
chunk->end += chunk->data_size;
|
|
||||||
|
|
||||||
if (chunk->max_end && chunk->max_end < chunk->end){
|
|
||||||
chunk->end = chunk->max_end;
|
|
||||||
}
|
|
||||||
if (chunk->min_start && chunk->min_start > chunk->start){
|
|
||||||
chunk->start = chunk->min_start;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (chunk->start < chunk->end){
|
|
||||||
buffer_read_range(app, buffer_id, Ii64(chunk->start, chunk->end), chunk->base_data);
|
|
||||||
chunk->data = chunk->base_data - chunk->start;
|
|
||||||
result = 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
else if (chunk->add_null && chunk->end + 1 < buffer_size){
|
|
||||||
chunk->start = buffer_size;
|
|
||||||
chunk->end = buffer_size + 1;
|
|
||||||
chunk->base_data[0] = 0;
|
|
||||||
chunk->data = chunk->base_data - chunk->start;
|
|
||||||
result = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
return(result);
|
|
||||||
}
|
|
||||||
|
|
||||||
internal b32
|
|
||||||
backward_stream_chunk(Stream_Chunk *chunk){
|
|
||||||
Application_Links *app = chunk->app;
|
|
||||||
Buffer_ID buffer_id = chunk->buffer_id;
|
|
||||||
b32 result = false;
|
|
||||||
|
|
||||||
if (chunk->start > 0){
|
|
||||||
chunk->end = chunk->start;
|
|
||||||
chunk->start -= chunk->data_size;
|
|
||||||
|
|
||||||
if (chunk->max_end && chunk->max_end < chunk->end){
|
|
||||||
chunk->end = chunk->max_end;
|
|
||||||
}
|
|
||||||
if (chunk->min_start && chunk->min_start > chunk->start){
|
|
||||||
chunk->start = chunk->min_start;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (chunk->start < chunk->end){
|
|
||||||
buffer_read_range(app, buffer_id, Ii64(chunk->start, chunk->end), chunk->base_data);
|
|
||||||
chunk->data = chunk->base_data - chunk->start;
|
|
||||||
result = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
else if (chunk->add_null && chunk->start > -1){
|
|
||||||
chunk->start = -1;
|
|
||||||
chunk->end = 0;
|
|
||||||
chunk->base_data[0] = 0;
|
|
||||||
chunk->data = chunk->base_data - chunk->start;
|
|
||||||
result = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return(result);
|
|
||||||
}
|
|
||||||
|
|
||||||
////////////////////////////////
|
|
||||||
|
|
||||||
internal Token_Range
|
|
||||||
buffer_get_token_range(Application_Links *app, Buffer_ID buffer){
|
|
||||||
Cpp_Token_Array array = buffer_get_token_array(app, buffer);
|
|
||||||
Token_Range range = {};
|
|
||||||
range.first = array.tokens;
|
|
||||||
range.one_past_last = array.tokens + array.count;
|
|
||||||
return(range);
|
|
||||||
}
|
|
||||||
|
|
||||||
internal Token_Iterator
|
internal Token_Iterator
|
||||||
make_token_iterator(Token_Range range, Cpp_Token *token){
|
make_token_iter(Buffer_ID buffer, Token_Array array, Token *token){
|
||||||
Token_Iterator iterator = {};
|
Token_Iterator iterator = {buffer, array.tokens, array.tokens + array.count, token};
|
||||||
if (range.first != 0 && range.one_past_last != 0){
|
|
||||||
if (token == 0 || token < range.first){
|
|
||||||
token = range.first;
|
|
||||||
}
|
|
||||||
if (token > range.one_past_last){
|
|
||||||
token = range.one_past_last;
|
|
||||||
}
|
|
||||||
iterator.token = token;
|
|
||||||
iterator.range = range;
|
|
||||||
}
|
|
||||||
return(iterator);
|
return(iterator);
|
||||||
}
|
}
|
||||||
|
|
||||||
internal Token_Iterator
|
internal Token_Iterator
|
||||||
make_token_iterator(Token_Range range, i32 index){
|
|
||||||
return(make_token_iterator(range, range.first + index));
|
|
||||||
}
|
|
||||||
|
|
||||||
internal void
|
make_token_iter(Buffer_ID buffer, Token_Array array, i64 pos){
|
||||||
token_iterator_set(Token_Iterator *iterator, Cpp_Token *token){
|
i64 first = 0;
|
||||||
*iterator = make_token_iterator(iterator->range, token);
|
i64 one_past_last = array.count;
|
||||||
}
|
i64 token_index = 0;
|
||||||
|
for (;;){
|
||||||
internal Cpp_Token*
|
i64 i = (first + one_past_last)/2;
|
||||||
token_range_check(Token_Range range, Cpp_Token *token){
|
Token *token = array.tokens + i;
|
||||||
if (token < range.first || range.one_past_last <= token){
|
if (token->pos + token->size <= pos){
|
||||||
token = 0;
|
first = i + 1;
|
||||||
}
|
}
|
||||||
|
else if (pos < token->pos){
|
||||||
|
one_past_last = i;
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
token_index = i;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (first + 1 >= one_past_last){
|
||||||
|
token_index = first;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return(make_token_iter(buffer, array, array.tokens + token_index));
|
||||||
|
}
|
||||||
|
|
||||||
|
internal Token*
|
||||||
|
token_iter_current(Token_Iterator *iter){
|
||||||
|
return(iter->token);
|
||||||
|
}
|
||||||
|
|
||||||
|
internal Token*
|
||||||
|
token_iter_next_all(Token_Iterator *iter){
|
||||||
|
Token *token = iter->token + 1;
|
||||||
|
Token *one_past_last = iter->one_past_last;
|
||||||
|
if (token > one_past_last){
|
||||||
|
token = one_past_last;
|
||||||
|
}
|
||||||
|
iter->token = token;
|
||||||
return(token);
|
return(token);
|
||||||
}
|
}
|
||||||
|
|
||||||
internal Cpp_Token*
|
internal Token*
|
||||||
token_iterator_current(Token_Iterator *iterator){
|
token_iter_next_non_whitespace(Token_Iterator *iter){
|
||||||
return(token_range_check(iterator->range, iterator->token));
|
Token *token = iter->token;
|
||||||
}
|
Token *one_past_last = iter->one_past_last;
|
||||||
|
|
||||||
internal i32
|
|
||||||
token_iterator_current_index(Token_Iterator *iterator){
|
|
||||||
i32 index = -1;
|
|
||||||
Cpp_Token *token = token_iterator_current(iterator);
|
|
||||||
if (token != 0 && iterator->range.first <= token && token <= iterator->range.one_past_last){
|
|
||||||
index = (i32)(token - iterator->range.first);
|
|
||||||
}
|
|
||||||
return(index);
|
|
||||||
}
|
|
||||||
|
|
||||||
internal Cpp_Token*
|
|
||||||
token_iterator_goto_next(Token_Iterator *iterator){
|
|
||||||
Cpp_Token *token = iterator->token;
|
|
||||||
Cpp_Token *one_past_last = iterator->range.one_past_last;
|
|
||||||
for (token += 1; token < one_past_last; token += 1){
|
for (token += 1; token < one_past_last; token += 1){
|
||||||
if (token->type != CPP_TOKEN_COMMENT){
|
if (token->kind != TokenBaseKind_Whitespace){
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Cpp_Token *result = token_range_check(iterator->range, token);
|
if (token > one_past_last){
|
||||||
*iterator = make_token_iterator(iterator->range, token);
|
token = one_past_last;
|
||||||
return(result);
|
}
|
||||||
|
iter->token = token;
|
||||||
|
return(token);
|
||||||
}
|
}
|
||||||
|
|
||||||
internal Cpp_Token*
|
internal Token*
|
||||||
token_iterator_goto_next_raw(Token_Iterator *iterator){
|
token_iter_next(Token_Iterator *iter){
|
||||||
Cpp_Token *result = token_range_check(iterator->range, iterator->token + 1);
|
Token *token = iter->token;
|
||||||
*iterator = make_token_iterator(iterator->range, iterator->token + 1);
|
Token *one_past_last = iter->one_past_last;
|
||||||
return(result);
|
for (token += 1; token < one_past_last; token += 1){
|
||||||
|
if (token->kind != TokenBaseKind_Whitespace &&
|
||||||
|
token->kind != TokenBaseKind_Comment){
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (token > one_past_last){
|
||||||
|
token = one_past_last;
|
||||||
|
}
|
||||||
|
iter->token = token;
|
||||||
|
return(token);
|
||||||
}
|
}
|
||||||
|
|
||||||
internal Cpp_Token*
|
internal Token*
|
||||||
token_iterator_goto_prev(Token_Iterator *iterator){
|
token_iter_prev_all(Token_Iterator *iter){
|
||||||
Cpp_Token *token = iterator->token;
|
Token *token = iter->token - 1;
|
||||||
Cpp_Token *first = iterator->range.first;
|
Token *first = iter->first;
|
||||||
|
if (token < first){
|
||||||
|
token = first;
|
||||||
|
}
|
||||||
|
iter->token = token;
|
||||||
|
return(token);
|
||||||
|
}
|
||||||
|
|
||||||
|
internal Token*
|
||||||
|
token_iter_prev_non_whitespace(Token_Iterator *iter){
|
||||||
|
Token *token = iter->token;
|
||||||
|
Token *first = iter->first;
|
||||||
for (token -= 1; token >= first; token -= 1){
|
for (token -= 1; token >= first; token -= 1){
|
||||||
if (token->type != CPP_TOKEN_COMMENT){
|
if (token->kind != TokenBaseKind_Whitespace){
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Cpp_Token *result = token_range_check(iterator->range, token);
|
if (token < first){
|
||||||
*iterator = make_token_iterator(iterator->range, token);
|
token = first;
|
||||||
return(result);
|
}
|
||||||
|
iter->token = token;
|
||||||
|
return(token);
|
||||||
}
|
}
|
||||||
|
|
||||||
internal Cpp_Token*
|
internal Token*
|
||||||
token_iterator_goto_prev_raw(Token_Iterator *iterator){
|
token_iter_prev(Token_Iterator *iter){
|
||||||
Cpp_Token *result = token_range_check(iterator->range, iterator->token - 1);
|
Token *token = iter->token;
|
||||||
*iterator = make_token_iterator(iterator->range, iterator->token - 1);
|
Token *first = iter->first;
|
||||||
return(result);
|
for (token -= 1; token >= first; token -= 1){
|
||||||
|
if (token->kind != TokenBaseKind_Whitespace &&
|
||||||
|
token->kind != TokenBaseKind_Comment){
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (token < first){
|
||||||
|
token = first;
|
||||||
|
}
|
||||||
|
iter->token = token;
|
||||||
|
return(token);
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////
|
////////////////////////////////
|
||||||
|
@ -2098,18 +2017,23 @@ get_query_string(Application_Links *app, char *query_str, u8 *string_space, i32
|
||||||
internal b32
|
internal b32
|
||||||
get_token_from_pos(Application_Links *app, Buffer_ID buffer, u64 pos, Cpp_Get_Token_Result *result){
|
get_token_from_pos(Application_Links *app, Buffer_ID buffer, u64 pos, Cpp_Get_Token_Result *result){
|
||||||
b32 success = false;
|
b32 success = false;
|
||||||
Cpp_Token_Array array = buffer_get_token_array(app, buffer);
|
NotImplemented;
|
||||||
|
#if 0
|
||||||
|
Token_Array array = buffer_get_token_array(app, buffer);
|
||||||
if (array.count > 0){
|
if (array.count > 0){
|
||||||
success = true;
|
success = true;
|
||||||
*result = cpp_get_token(array, (i32)pos);
|
*result = cpp_get_token(array, (i32)pos);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
return(success);
|
return(success);
|
||||||
}
|
}
|
||||||
|
|
||||||
internal String_Const_u8
|
internal String_Const_u8
|
||||||
push_token_or_word_under_pos(Application_Links *app, Arena *arena, Buffer_ID buffer, u64 pos){
|
push_token_or_word_under_pos(Application_Links *app, Arena *arena, Buffer_ID buffer, u64 pos){
|
||||||
String_Const_u8 result = {};
|
String_Const_u8 result = {};
|
||||||
Cpp_Get_Token_Result get_result = {};
|
NotImplemented;
|
||||||
|
#if 0
|
||||||
|
Get_Token_Result get_result = {};
|
||||||
b32 success = get_token_from_pos(app, buffer, (i32)pos, &get_result);
|
b32 success = get_token_from_pos(app, buffer, (i32)pos, &get_result);
|
||||||
if (success && !get_result.in_whitespace_after_token){
|
if (success && !get_result.in_whitespace_after_token){
|
||||||
umem size = get_result.token_one_past_last - get_result.token_start;
|
umem size = get_result.token_one_past_last - get_result.token_start;
|
||||||
|
@ -2117,6 +2041,7 @@ push_token_or_word_under_pos(Application_Links *app, Arena *arena, Buffer_ID buf
|
||||||
result = push_buffer_range(app, arena, buffer, Ii64(get_result.token_start, get_result.token_one_past_last));
|
result = push_buffer_range(app, arena, buffer, Ii64(get_result.token_start, get_result.token_one_past_last));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
return(result);
|
return(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2309,7 +2234,8 @@ get_ranges_of_duplicate_keys(Arena *arena, i32 *keys, i32 stride, i32 count){
|
||||||
|
|
||||||
internal void
|
internal void
|
||||||
no_mark_snap_to_cursor(Application_Links *app, Managed_Scope view_scope){
|
no_mark_snap_to_cursor(Application_Links *app, Managed_Scope view_scope){
|
||||||
managed_variable_set(app, view_scope, view_snap_mark_to_cursor, false);
|
b32 *snap_to_cursor = scope_attachment(app, view_scope, view_snap_mark_to_cursor, b32);
|
||||||
|
*snap_to_cursor = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
internal void
|
internal void
|
||||||
|
@ -2543,7 +2469,8 @@ get_dpi_scaling_value(Application_Links *app){
|
||||||
|
|
||||||
UI_QUIT_FUNCTION(ui_quit_clear_render_hook){
|
UI_QUIT_FUNCTION(ui_quit_clear_render_hook){
|
||||||
Managed_Scope scope = view_get_managed_scope(app, view);
|
Managed_Scope scope = view_get_managed_scope(app, view);
|
||||||
managed_variable_set(app, scope, view_render_hook, 0);
|
View_Render_Hook **hook = scope_attachment(app, scope, view_render_hook, View_Render_Hook*);
|
||||||
|
*hook = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////
|
////////////////////////////////
|
||||||
|
|
|
@ -144,30 +144,11 @@ struct Indent_Info{
|
||||||
|
|
||||||
////////////////////////////////
|
////////////////////////////////
|
||||||
|
|
||||||
struct Stream_Chunk{
|
|
||||||
Application_Links *app;
|
|
||||||
Buffer_ID buffer_id;
|
|
||||||
|
|
||||||
char *base_data;
|
|
||||||
i32 start;
|
|
||||||
i32 end;
|
|
||||||
i32 min_start;
|
|
||||||
i32 max_end;
|
|
||||||
b32 add_null;
|
|
||||||
u32 data_size;
|
|
||||||
|
|
||||||
char *data;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct Token_Range{
|
|
||||||
Cpp_Token *first;
|
|
||||||
Cpp_Token *one_past_last;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct Token_Iterator{
|
struct Token_Iterator{
|
||||||
// TODO(allen): source buffer
|
Buffer_ID buffer;
|
||||||
Cpp_Token *token;
|
Token *first;
|
||||||
Token_Range range;
|
Token *one_past_last;
|
||||||
|
Token *token;
|
||||||
};
|
};
|
||||||
|
|
||||||
////////////////////////////////
|
////////////////////////////////
|
||||||
|
|
|
@ -171,7 +171,8 @@ init_marker_list(Application_Links *app, Heap *heap, Buffer_ID buffer, Marker_Li
|
||||||
Assert(managed_object_get_item_count(app, marker_handle) == total_jump_count);
|
Assert(managed_object_get_item_count(app, marker_handle) == total_jump_count);
|
||||||
Assert(managed_object_get_type(app, marker_handle) == ManagedObjectType_Markers);
|
Assert(managed_object_get_type(app, marker_handle) == ManagedObjectType_Markers);
|
||||||
|
|
||||||
managed_variable_set(app, scope, sticky_jump_marker_handle, marker_handle);
|
Managed_Object *marker_handle_ptr = scope_attachment(app, scope, sticky_jump_marker_handle, Managed_Object);
|
||||||
|
*marker_handle_ptr = marker_handle;
|
||||||
}
|
}
|
||||||
|
|
||||||
Managed_Object stored_jump_array = alloc_managed_memory_in_scope(app, scope_array[0], sizeof(Sticky_Jump_Stored), jumps.count);
|
Managed_Object stored_jump_array = alloc_managed_memory_in_scope(app, scope_array[0], sizeof(Sticky_Jump_Stored), jumps.count);
|
||||||
|
@ -280,10 +281,10 @@ get_jump_from_list(Application_Links *app, Marker_List *list, i32 index, ID_Pos_
|
||||||
scope_array[1] = buffer_get_managed_scope(app, target_buffer_id);
|
scope_array[1] = buffer_get_managed_scope(app, target_buffer_id);
|
||||||
Managed_Scope scope = get_managed_scope_with_multiple_dependencies(app, scope_array, ArrayCount(scope_array));
|
Managed_Scope scope = get_managed_scope_with_multiple_dependencies(app, scope_array, ArrayCount(scope_array));
|
||||||
|
|
||||||
Managed_Object marker_array = 0;
|
Managed_Object *marker_array = scope_attachment(app, scope, sticky_jump_marker_handle, Managed_Object);
|
||||||
if (managed_variable_get(app, scope, sticky_jump_marker_handle, &marker_array)){
|
if (*marker_array != 0){
|
||||||
Marker marker = {};
|
Marker marker = {};
|
||||||
managed_object_load_data(app, marker_array, stored.index_into_marker_array, 1, &marker);
|
managed_object_load_data(app, *marker_array, stored.index_into_marker_array, 1, &marker);
|
||||||
location->buffer_id = target_buffer_id;
|
location->buffer_id = target_buffer_id;
|
||||||
location->pos = marker.pos;
|
location->pos = marker.pos;
|
||||||
result = true;
|
result = true;
|
||||||
|
@ -603,8 +604,8 @@ CUSTOM_DOC("If the buffer in the active view is writable, inserts a character, o
|
||||||
// End File Hook
|
// End File Hook
|
||||||
//
|
//
|
||||||
|
|
||||||
OPEN_FILE_HOOK_SIG(default_end_file);
|
BUFFER_HOOK_SIG(default_end_file);
|
||||||
OPEN_FILE_HOOK_SIG(end_file_close_jump_list){
|
BUFFER_HOOK_SIG(end_file_close_jump_list){
|
||||||
Marker_List *list = get_marker_list_for_buffer(buffer_id);
|
Marker_List *list = get_marker_list_for_buffer(buffer_id);
|
||||||
if (list != 0){
|
if (list != 0){
|
||||||
delete_marker_list(list);
|
delete_marker_list(list);
|
||||||
|
|
|
@ -1,143 +0,0 @@
|
||||||
/*
|
|
||||||
4coder_heap.cpp - Preversioning
|
|
||||||
no warranty implied; use at your own risk
|
|
||||||
|
|
||||||
This software is in the public domain. Where that dedication is not
|
|
||||||
recognized, you are granted a perpetual, irrevocable license to copy,
|
|
||||||
distribute, and modify this file as you see fit.
|
|
||||||
*/
|
|
||||||
|
|
||||||
// TOP
|
|
||||||
|
|
||||||
#define heap__sent_init(s) (s)->next=(s)->prev=(s)
|
|
||||||
#define heap__insert_next(p,n) ((n)->next=(p)->next,(n)->prev=(p),(n)->next->prev=(n),(p)->next=(n))
|
|
||||||
#define heap__insert_prev(p,n) ((n)->prev=(p)->prev,(n)->next=(p),(n)->prev->next=(n),(p)->prev=(n))
|
|
||||||
#define heap__remove(n) ((n)->next->prev=(n)->prev,(n)->prev->next=(n)->next)
|
|
||||||
|
|
||||||
#if defined(DO_HEAP_CHECKS)
|
|
||||||
static void
|
|
||||||
heap_assert_good(Heap *heap){
|
|
||||||
if (heap->in_order.next != 0){
|
|
||||||
Assert(heap->in_order.prev != 0);
|
|
||||||
Assert(heap->free_nodes.next != 0);
|
|
||||||
Assert(heap->free_nodes.prev != 0);
|
|
||||||
for (Heap_Basic_Node *node = &heap->in_order;;){
|
|
||||||
Assert(node->next->prev == node);
|
|
||||||
Assert(node->prev->next == node);
|
|
||||||
node = node->next;
|
|
||||||
if (node == &heap->in_order){
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
for (Heap_Basic_Node *node = &heap->free_nodes;;){
|
|
||||||
Assert(node->next->prev == node);
|
|
||||||
Assert(node->prev->next == node);
|
|
||||||
node = node->next;
|
|
||||||
if (node == &heap->free_nodes){
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
#define heap_assert_good(heap) ((void)(heap))
|
|
||||||
#endif
|
|
||||||
|
|
||||||
static void
|
|
||||||
heap_init(Heap *heap){
|
|
||||||
heap__sent_init(&heap->in_order);
|
|
||||||
heap__sent_init(&heap->free_nodes);
|
|
||||||
heap->used_space = 0;
|
|
||||||
heap->total_space = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
heap_extend(Heap *heap, void *memory, i32 size){
|
|
||||||
heap_assert_good(heap);
|
|
||||||
if (size >= sizeof(Heap_Node)){
|
|
||||||
Heap_Node *new_node = (Heap_Node*)memory;
|
|
||||||
heap__insert_prev(&heap->in_order, &new_node->order);
|
|
||||||
heap__insert_next(&heap->free_nodes, &new_node->alloc);
|
|
||||||
new_node->size = size - sizeof(*new_node);
|
|
||||||
heap->total_space += (umem)size;
|
|
||||||
}
|
|
||||||
heap_assert_good(heap);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void*
|
|
||||||
heap__reserve_chunk(Heap *heap, Heap_Node *node, i32 size){
|
|
||||||
u8 *ptr = (u8*)(node + 1);
|
|
||||||
i32 left_over_size = node->size - size;
|
|
||||||
if (left_over_size > sizeof(*node)){
|
|
||||||
i32 new_node_size = left_over_size - sizeof(*node);
|
|
||||||
Heap_Node *new_node = (Heap_Node*)(ptr + size);
|
|
||||||
heap__insert_next(&node->order, &new_node->order);
|
|
||||||
heap__insert_next(&node->alloc, &new_node->alloc);
|
|
||||||
new_node->size = new_node_size;
|
|
||||||
}
|
|
||||||
heap__remove(&node->alloc);
|
|
||||||
node->alloc.next = 0;
|
|
||||||
node->alloc.prev = 0;
|
|
||||||
node->size = size;
|
|
||||||
heap->used_space += sizeof(*node) + size;
|
|
||||||
return(ptr);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void*
|
|
||||||
heap_allocate(Heap *heap, i32 size){
|
|
||||||
if (heap->in_order.next != 0){
|
|
||||||
heap_assert_good(heap);
|
|
||||||
i32 aligned_size = (size + sizeof(Heap_Node) - 1);
|
|
||||||
aligned_size = aligned_size - (aligned_size%sizeof(Heap_Node));
|
|
||||||
for (Heap_Basic_Node *n = heap->free_nodes.next;
|
|
||||||
n != &heap->free_nodes;
|
|
||||||
n = n->next){
|
|
||||||
Heap_Node *node = CastFromMember(Heap_Node, alloc, n);
|
|
||||||
if (node->size >= aligned_size){
|
|
||||||
void *ptr = heap__reserve_chunk(heap, node, aligned_size);
|
|
||||||
heap_assert_good(heap);
|
|
||||||
return(ptr);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
heap_assert_good(heap);
|
|
||||||
}
|
|
||||||
return(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
heap__merge(Heap *heap, Heap_Node *l, Heap_Node *r){
|
|
||||||
if (&l->order != &heap->in_order && &r->order != &heap->in_order &&
|
|
||||||
l->alloc.next != 0 && l->alloc.prev != 0 &&
|
|
||||||
r->alloc.next != 0 && r->alloc.prev != 0){
|
|
||||||
u8 *ptr = (u8*)(l + 1) + l->size;
|
|
||||||
if (PtrDif(ptr, r) == 0){
|
|
||||||
heap__remove(&r->order);
|
|
||||||
heap__remove(&r->alloc);
|
|
||||||
heap__remove(&l->alloc);
|
|
||||||
l->size += r->size + sizeof(*r);
|
|
||||||
heap__insert_next(&heap->free_nodes, &l->alloc);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
heap_free(Heap *heap, void *memory){
|
|
||||||
if (heap->in_order.next != 0 && memory != 0){
|
|
||||||
Heap_Node *node = ((Heap_Node*)memory) - 1;
|
|
||||||
Assert(node->alloc.next == 0);
|
|
||||||
Assert(node->alloc.prev == 0);
|
|
||||||
heap->used_space -= sizeof(*node) + node->size;
|
|
||||||
heap_assert_good(heap);
|
|
||||||
heap__insert_next(&heap->free_nodes, &node->alloc);
|
|
||||||
heap_assert_good(heap);
|
|
||||||
heap__merge(heap, node, CastFromMember(Heap_Node, order, node->order.next));
|
|
||||||
heap_assert_good(heap);
|
|
||||||
heap__merge(heap, CastFromMember(Heap_Node, order, node->order.prev), node);
|
|
||||||
heap_assert_good(heap);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#define heap_array(g, T, size) (T*)heap_allocate(g, (i32)(sizeof(T)*(size)))
|
|
||||||
|
|
||||||
// BOTTOM
|
|
||||||
|
|
|
@ -1,43 +0,0 @@
|
||||||
/*
|
|
||||||
4coder_heap.h - Preversioning
|
|
||||||
no warranty implied; use at your own risk
|
|
||||||
|
|
||||||
This software is in the public domain. Where that dedication is not
|
|
||||||
recognized, you are granted a perpetual, irrevocable license to copy,
|
|
||||||
distribute, and modify this file as you see fit.
|
|
||||||
*/
|
|
||||||
|
|
||||||
// TOP
|
|
||||||
|
|
||||||
#if !defined(FCODER_HEAP_H)
|
|
||||||
#define FCODER_HEAP_H
|
|
||||||
|
|
||||||
struct Heap_Basic_Node{
|
|
||||||
Heap_Basic_Node *next;
|
|
||||||
Heap_Basic_Node *prev;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct Heap_Node{
|
|
||||||
union{
|
|
||||||
struct{
|
|
||||||
Heap_Basic_Node order;
|
|
||||||
Heap_Basic_Node alloc;
|
|
||||||
i32 size;
|
|
||||||
};
|
|
||||||
u8 force_size__[64];
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
struct Heap{
|
|
||||||
Heap_Basic_Node in_order;
|
|
||||||
Heap_Basic_Node free_nodes;
|
|
||||||
i32 used_space;
|
|
||||||
i32 total_space;
|
|
||||||
};
|
|
||||||
|
|
||||||
//#define DO_HEAP_CHECKS
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// BOTTOM
|
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -907,8 +907,6 @@ CUSTOM_COMMAND_SIG(log_graph__escape)
|
||||||
CUSTOM_DOC("Ends the log grapher")
|
CUSTOM_DOC("Ends the log grapher")
|
||||||
{
|
{
|
||||||
if (log_view != 0){
|
if (log_view != 0){
|
||||||
Managed_Scope scope = view_get_managed_scope(app, log_view);
|
|
||||||
managed_variable_set(app, scope, view_render_hook, 0);
|
|
||||||
view_end_ui_mode(app, log_view);
|
view_end_ui_mode(app, log_view);
|
||||||
log_view = 0;
|
log_view = 0;
|
||||||
}
|
}
|
||||||
|
@ -1044,8 +1042,8 @@ CUSTOM_DOC("Parser *log* and displays the 'log graph' UI")
|
||||||
log_view = get_active_view(app, AccessAll);
|
log_view = get_active_view(app, AccessAll);
|
||||||
}
|
}
|
||||||
Managed_Scope scope = view_get_managed_scope(app, log_view);
|
Managed_Scope scope = view_get_managed_scope(app, log_view);
|
||||||
u64 render_hook_value = (u64)PtrAsInt(log_graph_render);
|
View_Render_Hook **hook = scope_attachment(app, scope, view_render_hook, View_Render_Hook*);
|
||||||
managed_variable_set(app, scope, view_render_hook, render_hook_value);
|
*hook = log_graph_render;
|
||||||
view_set_setting(app, log_view, ViewSetting_UICommandMap, default_log_graph_map);
|
view_set_setting(app, log_view, ViewSetting_UICommandMap, default_log_graph_map);
|
||||||
view_begin_ui_mode(app, log_view);
|
view_begin_ui_mode(app, log_view);
|
||||||
view_set_quit_ui_handler(app, log_view, ui_quit_clear_render_hook);
|
view_set_quit_ui_handler(app, log_view, ui_quit_clear_render_hook);
|
||||||
|
|
|
@ -8,8 +8,6 @@
|
||||||
|
|
||||||
#include "4coder_base_types.h"
|
#include "4coder_base_types.h"
|
||||||
|
|
||||||
#include "4coder_lib/4coder_string.h"
|
|
||||||
|
|
||||||
#include "4coder_base_types.cpp"
|
#include "4coder_base_types.cpp"
|
||||||
#include "4coder_stringf.cpp"
|
#include "4coder_stringf.cpp"
|
||||||
#include "4coder_malloc_allocator.cpp"
|
#include "4coder_malloc_allocator.cpp"
|
||||||
|
@ -77,13 +75,13 @@ struct Reader{
|
||||||
Arena *error_arena;
|
Arena *error_arena;
|
||||||
char *source_name;
|
char *source_name;
|
||||||
String_Const_char text;
|
String_Const_char text;
|
||||||
Cpp_Token_Array tokens;
|
Token_Array tokens;
|
||||||
Cpp_Token *ptr;
|
Token *ptr;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Temp_Read{
|
struct Temp_Read{
|
||||||
Reader *reader;
|
Reader *reader;
|
||||||
Cpp_Token *pos;
|
Token *pos;
|
||||||
};
|
};
|
||||||
|
|
||||||
static Reader
|
static Reader
|
||||||
|
@ -96,9 +94,9 @@ make_reader(Cpp_Token_Array array, char *source_name, String_Const_char text){
|
||||||
return(reader);
|
return(reader);
|
||||||
}
|
}
|
||||||
|
|
||||||
static Cpp_Token
|
static Token
|
||||||
prev_token(Reader *reader){
|
prev_token(Reader *reader){
|
||||||
Cpp_Token result = {};
|
Token result = {};
|
||||||
|
|
||||||
for (;;){
|
for (;;){
|
||||||
if (reader->ptr > reader->tokens.tokens + reader->tokens.count){
|
if (reader->ptr > reader->tokens.tokens + reader->tokens.count){
|
||||||
|
@ -123,9 +121,9 @@ prev_token(Reader *reader){
|
||||||
return(result);
|
return(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
static Cpp_Token
|
static Token
|
||||||
get_token(Reader *reader){
|
get_token(Reader *reader){
|
||||||
Cpp_Token result = {};
|
Token result = {};
|
||||||
|
|
||||||
for (;;){
|
for (;;){
|
||||||
if (reader->ptr < reader->tokens.tokens){
|
if (reader->ptr < reader->tokens.tokens){
|
||||||
|
@ -151,9 +149,9 @@ get_token(Reader *reader){
|
||||||
return(result);
|
return(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
static Cpp_Token
|
static Token
|
||||||
peek_token(Reader *reader){
|
peek_token(Reader *reader){
|
||||||
Cpp_Token result = {};
|
Token result = {};
|
||||||
|
|
||||||
if (reader->ptr < reader->tokens.tokens){
|
if (reader->ptr < reader->tokens.tokens){
|
||||||
reader->ptr = reader->tokens.tokens;
|
reader->ptr = reader->tokens.tokens;
|
||||||
|
@ -171,7 +169,7 @@ peek_token(Reader *reader){
|
||||||
|
|
||||||
static int32_t
|
static int32_t
|
||||||
peek_pos(Reader *reader){
|
peek_pos(Reader *reader){
|
||||||
Cpp_Token token = peek_token(reader);
|
Token token = peek_token(reader);
|
||||||
return(token.start);
|
return(token.start);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -202,7 +200,7 @@ end_temp_read(Temp_Read temp){
|
||||||
///////////////////////////////
|
///////////////////////////////
|
||||||
|
|
||||||
static String_Const_char
|
static String_Const_char
|
||||||
token_str(String_Const_char text, Cpp_Token token){
|
token_str(String_Const_char text, Token token){
|
||||||
String_Const_char str = string_prefix(string_skip(text, token.start), token.size);
|
String_Const_char str = string_prefix(string_skip(text, token.start), token.size);
|
||||||
return(str);
|
return(str);
|
||||||
}
|
}
|
||||||
|
@ -306,7 +304,7 @@ require_key_identifier(Reader *reader, char *str, int32_t *opt_pos_out = 0){
|
||||||
|
|
||||||
String_Const_char string = SCchar(str);
|
String_Const_char string = SCchar(str);
|
||||||
|
|
||||||
Cpp_Token token = get_token(reader);
|
Token token = get_token(reader);
|
||||||
if (token.type == CPP_TOKEN_IDENTIFIER){
|
if (token.type == CPP_TOKEN_IDENTIFIER){
|
||||||
String_Const_char lexeme = token_str(reader->text, token);
|
String_Const_char lexeme = token_str(reader->text, token);
|
||||||
if (string_match(lexeme, string)){
|
if (string_match(lexeme, string)){
|
||||||
|
@ -331,7 +329,7 @@ static b32
|
||||||
require_open_parenthese(Reader *reader, int32_t *opt_pos_out = 0){
|
require_open_parenthese(Reader *reader, int32_t *opt_pos_out = 0){
|
||||||
b32 success = false;
|
b32 success = false;
|
||||||
|
|
||||||
Cpp_Token token = get_token(reader);
|
Token token = get_token(reader);
|
||||||
if (token.type == CPP_TOKEN_PARENTHESE_OPEN){
|
if (token.type == CPP_TOKEN_PARENTHESE_OPEN){
|
||||||
success = true;
|
success = true;
|
||||||
if (opt_pos_out != 0){
|
if (opt_pos_out != 0){
|
||||||
|
@ -350,7 +348,7 @@ static b32
|
||||||
require_close_parenthese(Reader *reader, int32_t *opt_pos_out = 0){
|
require_close_parenthese(Reader *reader, int32_t *opt_pos_out = 0){
|
||||||
b32 success = false;
|
b32 success = false;
|
||||||
|
|
||||||
Cpp_Token token = get_token(reader);
|
Token token = get_token(reader);
|
||||||
if (token.type == CPP_TOKEN_PARENTHESE_CLOSE){
|
if (token.type == CPP_TOKEN_PARENTHESE_CLOSE){
|
||||||
success = true;
|
success = true;
|
||||||
if (opt_pos_out != 0){
|
if (opt_pos_out != 0){
|
||||||
|
@ -369,7 +367,7 @@ static b32
|
||||||
require_comma(Reader *reader, int32_t *opt_pos_out = 0){
|
require_comma(Reader *reader, int32_t *opt_pos_out = 0){
|
||||||
b32 success = false;
|
b32 success = false;
|
||||||
|
|
||||||
Cpp_Token token = get_token(reader);
|
Token token = get_token(reader);
|
||||||
if (token.type == CPP_TOKEN_COMMA){
|
if (token.type == CPP_TOKEN_COMMA){
|
||||||
success = true;
|
success = true;
|
||||||
if (opt_pos_out != 0){
|
if (opt_pos_out != 0){
|
||||||
|
@ -388,7 +386,7 @@ static b32
|
||||||
require_define(Reader *reader, int32_t *opt_pos_out = 0){
|
require_define(Reader *reader, int32_t *opt_pos_out = 0){
|
||||||
b32 success = false;
|
b32 success = false;
|
||||||
|
|
||||||
Cpp_Token token = get_token(reader);
|
Token token = get_token(reader);
|
||||||
if (token.type == CPP_PP_DEFINE){
|
if (token.type == CPP_PP_DEFINE){
|
||||||
success = true;
|
success = true;
|
||||||
if (opt_pos_out != 0){
|
if (opt_pos_out != 0){
|
||||||
|
@ -407,7 +405,7 @@ static b32
|
||||||
extract_identifier(Reader *reader, String_Const_char *str_out, int32_t *opt_pos_out = 0){
|
extract_identifier(Reader *reader, String_Const_char *str_out, int32_t *opt_pos_out = 0){
|
||||||
b32 success = false;
|
b32 success = false;
|
||||||
|
|
||||||
Cpp_Token token = get_token(reader);
|
Token token = get_token(reader);
|
||||||
if (token.type == CPP_TOKEN_IDENTIFIER){
|
if (token.type == CPP_TOKEN_IDENTIFIER){
|
||||||
String_Const_char lexeme = token_str(reader->text, token);
|
String_Const_char lexeme = token_str(reader->text, token);
|
||||||
*str_out = lexeme;
|
*str_out = lexeme;
|
||||||
|
@ -428,7 +426,7 @@ static b32
|
||||||
extract_integer(Reader *reader, String_Const_char *str_out, int32_t *opt_pos_out = 0){
|
extract_integer(Reader *reader, String_Const_char *str_out, int32_t *opt_pos_out = 0){
|
||||||
b32 success = false;
|
b32 success = false;
|
||||||
|
|
||||||
Cpp_Token token = get_token(reader);
|
Token token = get_token(reader);
|
||||||
if (token.type == CPP_TOKEN_INTEGER_CONSTANT){
|
if (token.type == CPP_TOKEN_INTEGER_CONSTANT){
|
||||||
String_Const_char lexeme = token_str(reader->text, token);
|
String_Const_char lexeme = token_str(reader->text, token);
|
||||||
*str_out = lexeme;
|
*str_out = lexeme;
|
||||||
|
@ -449,7 +447,7 @@ static b32
|
||||||
extract_string(Reader *reader, String_Const_char *str_out, int32_t *opt_pos_out = 0){
|
extract_string(Reader *reader, String_Const_char *str_out, int32_t *opt_pos_out = 0){
|
||||||
b32 success = false;
|
b32 success = false;
|
||||||
|
|
||||||
Cpp_Token token = get_token(reader);
|
Token token = get_token(reader);
|
||||||
if (token.type == CPP_TOKEN_STRING_CONSTANT){
|
if (token.type == CPP_TOKEN_STRING_CONSTANT){
|
||||||
String_Const_char lexeme = token_str(reader->text, token);
|
String_Const_char lexeme = token_str(reader->text, token);
|
||||||
*str_out = lexeme;
|
*str_out = lexeme;
|
||||||
|
@ -598,14 +596,14 @@ parse_alias(Arena *arena, Meta_Command_Entry_Arrays *arrays, Reader *reader){
|
||||||
|
|
||||||
static void
|
static void
|
||||||
parse_text(Arena *arena, Meta_Command_Entry_Arrays *entry_arrays, char *source_name, String_Const_char text){
|
parse_text(Arena *arena, Meta_Command_Entry_Arrays *entry_arrays, char *source_name, String_Const_char text){
|
||||||
Cpp_Token_Array array = cpp_make_token_array(1024);
|
Token_Array array = cpp_make_token_array(1024);
|
||||||
cpp_lex_file(text.str, (i32)text.size, &array);
|
cpp_lex_file(text.str, (i32)text.size, &array);
|
||||||
|
|
||||||
Reader reader_ = make_reader(array, source_name, text);
|
Reader reader_ = make_reader(array, source_name, text);
|
||||||
Reader *reader = &reader_;
|
Reader *reader = &reader_;
|
||||||
|
|
||||||
for (;;){
|
for (;;){
|
||||||
Cpp_Token token = get_token(reader);
|
Token token = get_token(reader);
|
||||||
|
|
||||||
if (token.type == CPP_TOKEN_IDENTIFIER){
|
if (token.type == CPP_TOKEN_IDENTIFIER){
|
||||||
String_Const_char lexeme = token_str(text, token);
|
String_Const_char lexeme = token_str(text, token);
|
||||||
|
@ -617,7 +615,7 @@ parse_text(Arena *arena, Meta_Command_Entry_Arrays *entry_arrays, char *source_n
|
||||||
|
|
||||||
b32 found_start_pos = false;
|
b32 found_start_pos = false;
|
||||||
for (int32_t R = 0; R < 10; ++R){
|
for (int32_t R = 0; R < 10; ++R){
|
||||||
Cpp_Token p_token = prev_token(reader);
|
Token p_token = prev_token(reader);
|
||||||
if (p_token.type == CPP_TOKEN_IDENTIFIER){
|
if (p_token.type == CPP_TOKEN_IDENTIFIER){
|
||||||
String_Const_char p_lexeme = token_str(text, p_token);
|
String_Const_char p_lexeme = token_str(text, p_token);
|
||||||
if (string_match(p_lexeme, string_litexpr("CUSTOM_COMMAND_SIG"))){
|
if (string_match(p_lexeme, string_litexpr("CUSTOM_COMMAND_SIG"))){
|
||||||
|
@ -644,7 +642,7 @@ parse_text(Arena *arena, Meta_Command_Entry_Arrays *entry_arrays, char *source_n
|
||||||
|
|
||||||
b32 found_start_pos = false;
|
b32 found_start_pos = false;
|
||||||
for (int32_t R = 0; R < 3; ++R){
|
for (int32_t R = 0; R < 3; ++R){
|
||||||
Cpp_Token p_token = prev_token(reader);
|
Token p_token = prev_token(reader);
|
||||||
if (p_token.type == CPP_PP_DEFINE){
|
if (p_token.type == CPP_PP_DEFINE){
|
||||||
if (R == 2){
|
if (R == 2){
|
||||||
found_start_pos = true;
|
found_start_pos = true;
|
||||||
|
|
|
@ -4,12 +4,12 @@
|
||||||
|
|
||||||
// TOP
|
// TOP
|
||||||
|
|
||||||
static b32 parse_statement_down(Application_Links *app, Statement_Parser *parser, Cpp_Token *token_out);
|
static b32 parse_statement_down(Application_Links *app, Statement_Parser *parser, Token *token_out);
|
||||||
|
|
||||||
////////////////////////////////
|
////////////////////////////////
|
||||||
|
|
||||||
static Find_Scope_Token_Type
|
static Find_Scope_Token_Type
|
||||||
find_scope_get_token_type(u32 flags, Cpp_Token_Type token_type){
|
find_scope_get_token_type(u32 flags, Token_Type token_type){
|
||||||
Find_Scope_Token_Type type = FindScopeTokenType_None;
|
Find_Scope_Token_Type type = FindScopeTokenType_None;
|
||||||
if (flags & FindScope_Brace){
|
if (flags & FindScope_Brace){
|
||||||
switch (token_type){
|
switch (token_type){
|
||||||
|
@ -40,8 +40,10 @@ find_scope_get_token_type(u32 flags, Cpp_Token_Type token_type){
|
||||||
|
|
||||||
static b32
|
static b32
|
||||||
find_scope_top(Application_Links *app, Buffer_ID buffer, i64 start_pos, u32 flags, i64 *end_pos_out){
|
find_scope_top(Application_Links *app, Buffer_ID buffer, i64 start_pos, u32 flags, i64 *end_pos_out){
|
||||||
Cpp_Get_Token_Result get_result = {};
|
|
||||||
b32 success = false;
|
b32 success = false;
|
||||||
|
NotImplemented;
|
||||||
|
#if 0
|
||||||
|
Cpp_Get_Token_Result get_result = {};
|
||||||
i32 position = 0;
|
i32 position = 0;
|
||||||
if (get_token_from_pos(app, buffer, start_pos, &get_result)){
|
if (get_token_from_pos(app, buffer, start_pos, &get_result)){
|
||||||
i32 token_index = get_result.token_index;
|
i32 token_index = get_result.token_index;
|
||||||
|
@ -56,7 +58,7 @@ find_scope_top(Application_Links *app, Buffer_ID buffer, i64 start_pos, u32 flag
|
||||||
if (token_range.first != 0){
|
if (token_range.first != 0){
|
||||||
Token_Iterator token_it = make_token_iterator(token_range, token_index);
|
Token_Iterator token_it = make_token_iterator(token_range, token_index);
|
||||||
i32 nest_level = 0;
|
i32 nest_level = 0;
|
||||||
for (Cpp_Token *token = token_iterator_current(&token_it);
|
for (Token *token = token_iterator_current(&token_it);
|
||||||
token != 0;
|
token != 0;
|
||||||
token = token_iterator_goto_prev(&token_it)){
|
token = token_iterator_goto_prev(&token_it)){
|
||||||
Find_Scope_Token_Type type = find_scope_get_token_type(flags, token->type);
|
Find_Scope_Token_Type type = find_scope_get_token_type(flags, token->type);
|
||||||
|
@ -86,13 +88,15 @@ find_scope_top(Application_Links *app, Buffer_ID buffer, i64 start_pos, u32 flag
|
||||||
}
|
}
|
||||||
finished:;
|
finished:;
|
||||||
*end_pos_out = position;
|
*end_pos_out = position;
|
||||||
|
#endif
|
||||||
return(success);
|
return(success);
|
||||||
}
|
}
|
||||||
|
|
||||||
static b32
|
static b32
|
||||||
find_scope_bottom(Application_Links *app, Buffer_ID buffer, i64 start_pos, u32 flags, i64 *end_pos_out){
|
find_scope_bottom(Application_Links *app, Buffer_ID buffer, i64 start_pos, u32 flags, i64 *end_pos_out){
|
||||||
Cpp_Get_Token_Result get_result = {};
|
|
||||||
b32 success = false;
|
b32 success = false;
|
||||||
|
#if 0
|
||||||
|
Cpp_Get_Token_Result get_result = {};
|
||||||
i32 position = 0;
|
i32 position = 0;
|
||||||
if (get_token_from_pos(app, buffer, start_pos, &get_result)){
|
if (get_token_from_pos(app, buffer, start_pos, &get_result)){
|
||||||
i32 token_index = get_result.token_index + 1;
|
i32 token_index = get_result.token_index + 1;
|
||||||
|
@ -107,7 +111,7 @@ find_scope_bottom(Application_Links *app, Buffer_ID buffer, i64 start_pos, u32 f
|
||||||
if (token_range.first != 0){
|
if (token_range.first != 0){
|
||||||
Token_Iterator token_it = make_token_iterator(token_range, token_index);
|
Token_Iterator token_it = make_token_iterator(token_range, token_index);
|
||||||
i32 nest_level = 0;
|
i32 nest_level = 0;
|
||||||
for (Cpp_Token *token = token_iterator_current(&token_it);
|
for (Token *token = token_iterator_current(&token_it);
|
||||||
token != 0;
|
token != 0;
|
||||||
token = token_iterator_goto_next(&token_it)){
|
token = token_iterator_goto_next(&token_it)){
|
||||||
Find_Scope_Token_Type type = find_scope_get_token_type(flags, token->type);
|
Find_Scope_Token_Type type = find_scope_get_token_type(flags, token->type);
|
||||||
|
@ -137,13 +141,16 @@ find_scope_bottom(Application_Links *app, Buffer_ID buffer, i64 start_pos, u32 f
|
||||||
}
|
}
|
||||||
finished:;
|
finished:;
|
||||||
*end_pos_out = position;
|
*end_pos_out = position;
|
||||||
|
#endif
|
||||||
return(success);
|
return(success);
|
||||||
}
|
}
|
||||||
|
|
||||||
static b32
|
static b32
|
||||||
find_next_scope(Application_Links *app, Buffer_ID buffer, i64 start_pos, u32 flags, i64 *end_pos_out){
|
find_next_scope(Application_Links *app, Buffer_ID buffer, i64 start_pos, u32 flags, i64 *end_pos_out){
|
||||||
|
b32 success = false;
|
||||||
|
NotImplemented;
|
||||||
|
#if 0
|
||||||
Cpp_Get_Token_Result get_result = {};
|
Cpp_Get_Token_Result get_result = {};
|
||||||
b32 success = 0;
|
|
||||||
i64 position = 0;
|
i64 position = 0;
|
||||||
if (get_token_from_pos(app, buffer, start_pos, &get_result)){
|
if (get_token_from_pos(app, buffer, start_pos, &get_result)){
|
||||||
i32 token_index = get_result.token_index + 1;
|
i32 token_index = get_result.token_index + 1;
|
||||||
|
@ -153,7 +160,7 @@ find_next_scope(Application_Links *app, Buffer_ID buffer, i64 start_pos, u32 fla
|
||||||
Token_Iterator token_it = make_token_iterator(token_range, token_index);
|
Token_Iterator token_it = make_token_iterator(token_range, token_index);
|
||||||
if (HasFlag(flags, FindScope_NextSibling)){
|
if (HasFlag(flags, FindScope_NextSibling)){
|
||||||
i32 nest_level = 1;
|
i32 nest_level = 1;
|
||||||
for (Cpp_Token *token = token_iterator_current(&token_it);
|
for (Token *token = token_iterator_current(&token_it);
|
||||||
token != 0;
|
token != 0;
|
||||||
token = token_iterator_goto_next(&token_it)){
|
token = token_iterator_goto_next(&token_it)){
|
||||||
Find_Scope_Token_Type type = find_scope_get_token_type(flags, token->type);
|
Find_Scope_Token_Type type = find_scope_get_token_type(flags, token->type);
|
||||||
|
@ -184,7 +191,7 @@ find_next_scope(Application_Links *app, Buffer_ID buffer, i64 start_pos, u32 fla
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
for (Cpp_Token *token = token_iterator_current(&token_it);
|
for (Token *token = token_iterator_current(&token_it);
|
||||||
token != 0;
|
token != 0;
|
||||||
token = token_iterator_goto_next(&token_it)){
|
token = token_iterator_goto_next(&token_it)){
|
||||||
Find_Scope_Token_Type type = find_scope_get_token_type(flags, token->type);
|
Find_Scope_Token_Type type = find_scope_get_token_type(flags, token->type);
|
||||||
|
@ -203,13 +210,16 @@ find_next_scope(Application_Links *app, Buffer_ID buffer, i64 start_pos, u32 fla
|
||||||
}
|
}
|
||||||
finished:;
|
finished:;
|
||||||
*end_pos_out = position;
|
*end_pos_out = position;
|
||||||
|
#endif
|
||||||
return(success);
|
return(success);
|
||||||
}
|
}
|
||||||
|
|
||||||
static b32
|
static b32
|
||||||
find_prev_scope(Application_Links *app, Buffer_ID buffer, i64 start_pos, u32 flags, i64 *end_pos_out){
|
find_prev_scope(Application_Links *app, Buffer_ID buffer, i64 start_pos, u32 flags, i64 *end_pos_out){
|
||||||
Cpp_Get_Token_Result get_result = {};
|
|
||||||
b32 success = false;
|
b32 success = false;
|
||||||
|
NotImplemented;
|
||||||
|
#if 0
|
||||||
|
Cpp_Get_Token_Result get_result = {};
|
||||||
i64 position = 0;
|
i64 position = 0;
|
||||||
if (get_token_from_pos(app, buffer, start_pos, &get_result)){
|
if (get_token_from_pos(app, buffer, start_pos, &get_result)){
|
||||||
i32 token_index = get_result.token_index - 1;
|
i32 token_index = get_result.token_index - 1;
|
||||||
|
@ -219,7 +229,7 @@ find_prev_scope(Application_Links *app, Buffer_ID buffer, i64 start_pos, u32 fla
|
||||||
Token_Iterator token_it = make_token_iterator(token_range, token_index);
|
Token_Iterator token_it = make_token_iterator(token_range, token_index);
|
||||||
if (flags & FindScope_NextSibling){
|
if (flags & FindScope_NextSibling){
|
||||||
i32 nest_level = -1;
|
i32 nest_level = -1;
|
||||||
for (Cpp_Token *token = token_iterator_current(&token_it);
|
for (Token *token = token_iterator_current(&token_it);
|
||||||
token != 0;
|
token != 0;
|
||||||
token = token_iterator_goto_prev(&token_it)){
|
token = token_iterator_goto_prev(&token_it)){
|
||||||
Find_Scope_Token_Type type = find_scope_get_token_type(flags, token->type);
|
Find_Scope_Token_Type type = find_scope_get_token_type(flags, token->type);
|
||||||
|
@ -250,7 +260,7 @@ find_prev_scope(Application_Links *app, Buffer_ID buffer, i64 start_pos, u32 fla
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
for (Cpp_Token *token = token_iterator_current(&token_it);
|
for (Token *token = token_iterator_current(&token_it);
|
||||||
token != 0;
|
token != 0;
|
||||||
token = token_iterator_goto_prev(&token_it)){
|
token = token_iterator_goto_prev(&token_it)){
|
||||||
Find_Scope_Token_Type type = find_scope_get_token_type(flags, token->type);
|
Find_Scope_Token_Type type = find_scope_get_token_type(flags, token->type);
|
||||||
|
@ -269,6 +279,7 @@ find_prev_scope(Application_Links *app, Buffer_ID buffer, i64 start_pos, u32 fla
|
||||||
}
|
}
|
||||||
finished:;
|
finished:;
|
||||||
*end_pos_out = position;
|
*end_pos_out = position;
|
||||||
|
#endif
|
||||||
return(success);
|
return(success);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -483,15 +494,17 @@ CUSTOM_DOC("Deletes the braces surrounding the currently selected scope. Leaves
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static Cpp_Token*
|
static Token*
|
||||||
parser_next_token(Statement_Parser *parser){
|
parser_next_token(Statement_Parser *parser){
|
||||||
return(token_iterator_goto_next(&parser->token_iterator));
|
return(token_iter_next(&parser->token_iterator));
|
||||||
}
|
}
|
||||||
|
|
||||||
static b32
|
static b32
|
||||||
parse_for_down(Application_Links *app, Statement_Parser *parser, Cpp_Token *token_out){
|
parse_for_down(Application_Links *app, Statement_Parser *parser, Token *token_out){
|
||||||
b32 success = false;
|
b32 success = false;
|
||||||
Cpp_Token *token = parser_next_token(parser);
|
NotImplemented;
|
||||||
|
#if 0
|
||||||
|
Token *token = parser_next_token(parser);
|
||||||
|
|
||||||
i32 paren_level = 0;
|
i32 paren_level = 0;
|
||||||
for (;token != 0;){
|
for (;token != 0;){
|
||||||
|
@ -520,13 +533,16 @@ parse_for_down(Application_Links *app, Statement_Parser *parser, Cpp_Token *toke
|
||||||
}
|
}
|
||||||
|
|
||||||
finished:;
|
finished:;
|
||||||
|
#endif
|
||||||
return(success);
|
return(success);
|
||||||
}
|
}
|
||||||
|
|
||||||
static b32
|
static b32
|
||||||
parse_if_down(Application_Links *app, Statement_Parser *parser, Cpp_Token *token_out){
|
parse_if_down(Application_Links *app, Statement_Parser *parser, Token *token_out){
|
||||||
b32 success = false;
|
b32 success = false;
|
||||||
Cpp_Token *token = parser_next_token(parser);
|
NotImplemented;
|
||||||
|
#if 0
|
||||||
|
Token *token = parser_next_token(parser);
|
||||||
if (token != 0){
|
if (token != 0){
|
||||||
success = parse_statement_down(app, parser, token_out);
|
success = parse_statement_down(app, parser, token_out);
|
||||||
if (success){
|
if (success){
|
||||||
|
@ -536,13 +552,16 @@ parse_if_down(Application_Links *app, Statement_Parser *parser, Cpp_Token *token
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
return(success);
|
return(success);
|
||||||
}
|
}
|
||||||
|
|
||||||
static b32
|
static b32
|
||||||
parse_block_down(Application_Links *app, Statement_Parser *parser, Cpp_Token *token_out){
|
parse_block_down(Application_Links *app, Statement_Parser *parser, Token *token_out){
|
||||||
b32 success = false;
|
b32 success = false;
|
||||||
Cpp_Token *token = parser_next_token(parser);
|
NotImplemented;
|
||||||
|
#if 0
|
||||||
|
Token *token = parser_next_token(parser);
|
||||||
|
|
||||||
i32 nest_level = 0;
|
i32 nest_level = 0;
|
||||||
while (token != 0){
|
while (token != 0){
|
||||||
|
@ -566,13 +585,16 @@ parse_block_down(Application_Links *app, Statement_Parser *parser, Cpp_Token *to
|
||||||
}
|
}
|
||||||
|
|
||||||
finished:;
|
finished:;
|
||||||
|
#endif
|
||||||
return(success);
|
return(success);
|
||||||
}
|
}
|
||||||
|
|
||||||
static b32
|
static b32
|
||||||
parse_statement_down(Application_Links *app, Statement_Parser *parser, Cpp_Token *token_out){
|
parse_statement_down(Application_Links *app, Statement_Parser *parser, Token *token_out){
|
||||||
b32 success = false;
|
b32 success = false;
|
||||||
Cpp_Token *token = parser_next_token(parser);
|
NotImplemented;
|
||||||
|
#if 0
|
||||||
|
Token *token = parser_next_token(parser);
|
||||||
|
|
||||||
if (token != 0){
|
if (token != 0){
|
||||||
b32 not_getting_block = false;
|
b32 not_getting_block = false;
|
||||||
|
@ -628,17 +650,21 @@ parse_statement_down(Application_Links *app, Statement_Parser *parser, Cpp_Token
|
||||||
}
|
}
|
||||||
|
|
||||||
finished:;
|
finished:;
|
||||||
|
#endif
|
||||||
return(success);
|
return(success);
|
||||||
}
|
}
|
||||||
|
|
||||||
static Statement_Parser
|
static Statement_Parser
|
||||||
make_statement_parser(Application_Links *app, Buffer_ID buffer, i32 token_index){
|
make_statement_parser(Application_Links *app, Buffer_ID buffer, i32 token_index){
|
||||||
Statement_Parser parser = {};
|
Statement_Parser parser = {};
|
||||||
|
NotImplemented;
|
||||||
|
#if 0
|
||||||
Token_Range token_range = buffer_get_token_range(app, buffer);
|
Token_Range token_range = buffer_get_token_range(app, buffer);
|
||||||
if (token_range.first != 0){
|
if (token_range.first != 0){
|
||||||
parser.token_iterator = make_token_iterator(token_range, token_index);
|
parser.token_iterator = make_token_iterator(token_range, token_index);
|
||||||
parser.buffer = buffer;
|
parser.buffer = buffer;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
return(parser);
|
return(parser);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -656,7 +682,7 @@ find_whole_statement_down(Application_Links *app, Buffer_ID buffer, i64 pos, i64
|
||||||
parser_next_token(&parser);
|
parser_next_token(&parser);
|
||||||
}
|
}
|
||||||
|
|
||||||
Cpp_Token end_token = {};
|
Token end_token = {};
|
||||||
if (parse_statement_down(app, &parser, &end_token)){
|
if (parse_statement_down(app, &parser, &end_token)){
|
||||||
end = end_token.start + end_token.size;
|
end = end_token.start + end_token.size;
|
||||||
result = true;
|
result = true;
|
||||||
|
|
|
@ -382,12 +382,11 @@ CUSTOM_DOC("Iteratively tries completing the word to the left of the cursor with
|
||||||
Managed_Scope scope = view_get_managed_scope(app, view);
|
Managed_Scope scope = view_get_managed_scope(app, view);
|
||||||
|
|
||||||
b32 first_completion = false;
|
b32 first_completion = false;
|
||||||
u64 rewrite = 0;
|
Rewrite_Type *rewrite = scope_attachment(app, scope, view_rewrite_loc, Rewrite_Type);
|
||||||
managed_variable_get(app, scope, view_rewrite_loc, &rewrite);
|
if (*rewrite != Rewrite_WordComplete){
|
||||||
if (rewrite != RewriteWordComplete){
|
|
||||||
first_completion = true;
|
first_completion = true;
|
||||||
}
|
}
|
||||||
managed_variable_set(app, scope, view_next_rewrite_loc, RewriteWordComplete);
|
*rewrite = Rewrite_WordComplete;
|
||||||
|
|
||||||
local_persist Arena completion_arena = {};
|
local_persist Arena completion_arena = {};
|
||||||
if (completion_arena.base_allocator == 0){
|
if (completion_arena.base_allocator == 0){
|
||||||
|
|
|
@ -171,7 +171,7 @@ table_erase(Table_u64_u64 *table, u64 key){
|
||||||
return(table_erase(table, lookup));
|
return(table_erase(table, lookup));
|
||||||
}
|
}
|
||||||
|
|
||||||
internal b32
|
internal void
|
||||||
table_clear(Table_u64_u64 *table){
|
table_clear(Table_u64_u64 *table){
|
||||||
block_zero_dynamic_array(table->keys, table->slot_count);
|
block_zero_dynamic_array(table->keys, table->slot_count);
|
||||||
block_zero_dynamic_array(table->vals, table->slot_count);
|
block_zero_dynamic_array(table->vals, table->slot_count);
|
||||||
|
@ -324,7 +324,7 @@ table_erase(Table_u32_u16 *table, u32 key){
|
||||||
return(table_erase(table, lookup));
|
return(table_erase(table, lookup));
|
||||||
}
|
}
|
||||||
|
|
||||||
internal b32
|
internal void
|
||||||
table_clear(Table_u32_u16 *table){
|
table_clear(Table_u32_u16 *table){
|
||||||
block_zero_dynamic_array(table->keys, table->slot_count);
|
block_zero_dynamic_array(table->keys, table->slot_count);
|
||||||
block_zero_dynamic_array(table->vals, table->slot_count);
|
block_zero_dynamic_array(table->vals, table->slot_count);
|
||||||
|
@ -480,7 +480,7 @@ table_erase(Table_Data_u64 *table, Data key){
|
||||||
return(result);
|
return(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
internal b32
|
internal void
|
||||||
table_clear(Table_Data_u64 *table){
|
table_clear(Table_Data_u64 *table){
|
||||||
block_zero_dynamic_array(table->keys, table->slot_count);
|
block_zero_dynamic_array(table->keys, table->slot_count);
|
||||||
block_zero_dynamic_array(table->vals, table->slot_count);
|
block_zero_dynamic_array(table->vals, table->slot_count);
|
||||||
|
@ -634,7 +634,7 @@ table_erase(Table_u64_Data *table, u64 key){
|
||||||
return(result);
|
return(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
internal b32
|
internal void
|
||||||
table_clear(Table_u64_Data *table){
|
table_clear(Table_u64_Data *table){
|
||||||
block_zero_dynamic_array(table->keys, table->slot_count);
|
block_zero_dynamic_array(table->keys, table->slot_count);
|
||||||
block_zero_dynamic_array(table->vals, table->slot_count);
|
block_zero_dynamic_array(table->vals, table->slot_count);
|
||||||
|
@ -785,7 +785,7 @@ table_erase(Table_Data_Data *table, Data key){
|
||||||
return(result);
|
return(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
internal b32
|
internal void
|
||||||
table_clear(Table_Data_Data *table){
|
table_clear(Table_Data_Data *table){
|
||||||
block_zero_dynamic_array(table->keys, table->slot_count);
|
block_zero_dynamic_array(table->keys, table->slot_count);
|
||||||
block_zero_dynamic_array(table->vals, table->slot_count);
|
block_zero_dynamic_array(table->vals, table->slot_count);
|
||||||
|
|
|
@ -4,10 +4,6 @@
|
||||||
|
|
||||||
// TOP
|
// TOP
|
||||||
|
|
||||||
// TODO(allen): documentation comment here
|
|
||||||
|
|
||||||
////////////////////////////////
|
|
||||||
|
|
||||||
typedef u32 View_Get_UI_Flags;
|
typedef u32 View_Get_UI_Flags;
|
||||||
enum{
|
enum{
|
||||||
ViewGetUIFlag_KeepDataAsIs = 0,
|
ViewGetUIFlag_KeepDataAsIs = 0,
|
||||||
|
@ -19,25 +15,26 @@ view_get_ui_data(Application_Links *app, View_ID view_id, View_Get_UI_Flags flag
|
||||||
b32 result = false;
|
b32 result = false;
|
||||||
Managed_Scope scope = view_get_managed_scope(app, view_id);
|
Managed_Scope scope = view_get_managed_scope(app, view_id);
|
||||||
if (scope != 0){
|
if (scope != 0){
|
||||||
Managed_Object ui_data_object = 0;
|
Managed_Object *ui_data_object_ptr = scope_attachment(app, scope, view_ui_data, Managed_Object);
|
||||||
if (managed_variable_get(app, scope, view_ui_data, &ui_data_object)){
|
Managed_Object ui_data_object = *ui_data_object_ptr;
|
||||||
if (ui_data_object == 0){
|
if (ui_data_object == 0){
|
||||||
Managed_Object new_ui_data_object = alloc_managed_memory_in_scope(app, scope, sizeof(UI_Storage), 1);
|
Managed_Object new_ui_data_object = alloc_managed_memory_in_scope(app, scope, sizeof(UI_Storage), 1);
|
||||||
Managed_Object arena_object = alloc_managed_arena_in_scope(app, scope, (8 << 10));
|
|
||||||
Arena *arena = 0;
|
Base_Allocator *allocator = managed_scope_allocator(app, scope);
|
||||||
if (managed_object_load_data(app, arena_object, 0, 1, &arena)){
|
Arena arena_temp = make_arena(allocator, KB(8));
|
||||||
|
Arena *arena = push_array(&arena_temp, Arena, 1);
|
||||||
|
block_copy_struct(arena, &arena_temp);
|
||||||
|
|
||||||
UI_Data *ui_data = push_array(arena, UI_Data, 1);
|
UI_Data *ui_data = push_array(arena, UI_Data, 1);
|
||||||
UI_Storage storage = {};
|
UI_Storage storage = {};
|
||||||
storage.data = ui_data;
|
storage.data = ui_data;
|
||||||
storage.arena = arena;
|
storage.arena = arena;
|
||||||
storage.arena_object = arena_object;
|
|
||||||
storage.temp = begin_temp(arena);
|
storage.temp = begin_temp(arena);
|
||||||
if (managed_object_store_data(app, new_ui_data_object, 0, 1, &storage)){
|
if (managed_object_store_data(app, new_ui_data_object, 0, 1, &storage)){
|
||||||
if (managed_variable_set(app, scope, view_ui_data, new_ui_data_object)){
|
*ui_data_object_ptr = new_ui_data_object;
|
||||||
ui_data_object = new_ui_data_object;
|
ui_data_object = new_ui_data_object;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (ui_data_object != 0){
|
if (ui_data_object != 0){
|
||||||
UI_Storage storage = {};
|
UI_Storage storage = {};
|
||||||
|
@ -51,7 +48,6 @@ view_get_ui_data(Application_Links *app, View_ID view_id, View_Get_UI_Flags flag
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return(result);
|
return(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -60,19 +56,19 @@ view_clear_ui_data(Application_Links *app, View_ID view_id){
|
||||||
b32 result = false;
|
b32 result = false;
|
||||||
Managed_Scope scope = view_get_managed_scope(app, view_id);
|
Managed_Scope scope = view_get_managed_scope(app, view_id);
|
||||||
if (scope != 0){
|
if (scope != 0){
|
||||||
Managed_Object ui_data_object = 0;
|
Managed_Object *ui_data_object_ptr = scope_attachment(app, scope, view_ui_data, Managed_Object);
|
||||||
if (managed_variable_get(app, scope, view_ui_data, &ui_data_object)){
|
Managed_Object ui_data_object = *ui_data_object_ptr;
|
||||||
if (ui_data_object != 0){
|
if (ui_data_object != 0){
|
||||||
UI_Storage storage = {};
|
UI_Storage storage = {};
|
||||||
if (managed_object_load_data(app, ui_data_object, 0, 1, &storage)){
|
if (managed_object_load_data(app, ui_data_object, 0, 1, &storage)){
|
||||||
managed_object_free(app, storage.arena_object);
|
Arena arena_temp = *storage.arena;
|
||||||
|
linalloc_clear(&arena_temp);
|
||||||
managed_object_free(app, ui_data_object);
|
managed_object_free(app, ui_data_object);
|
||||||
managed_variable_set(app, scope, view_ui_data, 0);
|
*ui_data_object_ptr = 0;
|
||||||
result = true;
|
result = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return(result);
|
return(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -47,7 +47,6 @@ struct UI_Data{
|
||||||
struct UI_Storage{
|
struct UI_Storage{
|
||||||
UI_Data *data;
|
UI_Data *data;
|
||||||
Arena *arena;
|
Arena *arena;
|
||||||
Managed_Object arena_object;
|
|
||||||
Temp_Memory temp;
|
Temp_Memory temp;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
31
4ed.cpp
31
4ed.cpp
|
@ -361,22 +361,22 @@ interpret_binding_buffer(Models *models, void *buffer, i32 size){
|
||||||
switch (hook_id){
|
switch (hook_id){
|
||||||
case special_hook_open_file:
|
case special_hook_open_file:
|
||||||
{
|
{
|
||||||
models->hook_open_file = (Open_File_Hook_Function*)unit->hook.func;
|
models->hook_open_file = (Buffer_Hook_Function*)unit->hook.func;
|
||||||
}break;
|
}break;
|
||||||
|
|
||||||
case special_hook_new_file:
|
case special_hook_new_file:
|
||||||
{
|
{
|
||||||
models->hook_new_file = (Open_File_Hook_Function*)unit->hook.func;
|
models->hook_new_file = (Buffer_Hook_Function*)unit->hook.func;
|
||||||
}break;
|
}break;
|
||||||
|
|
||||||
case special_hook_save_file:
|
case special_hook_save_file:
|
||||||
{
|
{
|
||||||
models->hook_save_file = (Open_File_Hook_Function*)unit->hook.func;
|
models->hook_save_file = (Buffer_Hook_Function*)unit->hook.func;
|
||||||
}break;
|
}break;
|
||||||
|
|
||||||
case special_hook_end_file:
|
case special_hook_end_file:
|
||||||
{
|
{
|
||||||
models->hook_end_file = (Open_File_Hook_Function*)unit->hook.func;
|
models->hook_end_file = (Buffer_Hook_Function*)unit->hook.func;
|
||||||
}break;
|
}break;
|
||||||
|
|
||||||
case special_hook_file_edit_range:
|
case special_hook_file_edit_range:
|
||||||
|
@ -735,8 +735,7 @@ app_setup_memory(System_Functions *system, Application_Memory *memory){
|
||||||
Models *models = push_array_zero(&cursor, Models, 1);
|
Models *models = push_array_zero(&cursor, Models, 1);
|
||||||
models->mem.arena = make_arena_system(system);
|
models->mem.arena = make_arena_system(system);
|
||||||
models->base_allocator = models->mem.arena.base_allocator;
|
models->base_allocator = models->mem.arena.base_allocator;
|
||||||
heap_init(&models->mem.heap);
|
heap_init(&models->mem.heap, models->base_allocator);
|
||||||
heap_extend(&models->mem.heap, memory->target_memory, memory->target_memory_size);
|
|
||||||
return(models);
|
return(models);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -877,13 +876,6 @@ App_Init_Sig(app_init){
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
|
||||||
umem memsize = KB(8);
|
|
||||||
void *mem = push_array(arena, u8, (i32)memsize);
|
|
||||||
parse_context_init_memory(&models->parse_context_memory, mem, memsize);
|
|
||||||
parse_context_add_default(&models->parse_context_memory, &models->mem.heap);
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
{
|
||||||
Assert(models->config_api.get_bindings != 0);
|
Assert(models->config_api.get_bindings != 0);
|
||||||
i32 wanted_size = models->config_api.get_bindings(models->app_links.memory, models->app_links.memory_size);
|
i32 wanted_size = models->config_api.get_bindings(models->app_links.memory, models->app_links.memory_size);
|
||||||
|
@ -892,8 +884,9 @@ App_Init_Sig(app_init){
|
||||||
memset(models->app_links.memory, 0, wanted_size);
|
memset(models->app_links.memory, 0, wanted_size);
|
||||||
}
|
}
|
||||||
|
|
||||||
dynamic_variables_init(&models->variable_layout);
|
managed_ids_init(models->base_allocator, &models->managed_id_set);
|
||||||
dynamic_workspace_init(&models->mem.heap, &models->lifetime_allocator, DynamicWorkspace_Global, 0, &models->dynamic_workspace);
|
lifetime_allocator_init(models->base_allocator, &models->lifetime_allocator);
|
||||||
|
dynamic_workspace_init(&models->lifetime_allocator, DynamicWorkspace_Global, 0, &models->dynamic_workspace);
|
||||||
|
|
||||||
// NOTE(allen): file setup
|
// NOTE(allen): file setup
|
||||||
working_set_init(models, &models->working_set);
|
working_set_init(models, &models->working_set);
|
||||||
|
@ -946,7 +939,7 @@ App_Init_Sig(app_init){
|
||||||
Heap *heap = &models->mem.heap;
|
Heap *heap = &models->mem.heap;
|
||||||
for (i32 i = 0; i < ArrayCount(init_files); ++i){
|
for (i32 i = 0; i < ArrayCount(init_files); ++i){
|
||||||
Editing_File *file = working_set_allocate_file(&models->working_set, &models->lifetime_allocator);
|
Editing_File *file = working_set_allocate_file(&models->working_set, &models->lifetime_allocator);
|
||||||
buffer_bind_name(models, heap, arena, &models->working_set, file, init_files[i].name);
|
buffer_bind_name(models, arena, &models->working_set, file, init_files[i].name);
|
||||||
|
|
||||||
if (init_files[i].ptr != 0){
|
if (init_files[i].ptr != 0){
|
||||||
*init_files[i].ptr = file;
|
*init_files[i].ptr = file;
|
||||||
|
@ -956,7 +949,7 @@ App_Init_Sig(app_init){
|
||||||
file_create_from_string(models, file, SCu8(), attributes);
|
file_create_from_string(models, file, SCu8(), attributes);
|
||||||
if (init_files[i].read_only){
|
if (init_files[i].read_only){
|
||||||
file->settings.read_only = true;
|
file->settings.read_only = true;
|
||||||
history_free(&models->mem.heap, &file->state.history);
|
history_free(&file->state.history);
|
||||||
}
|
}
|
||||||
|
|
||||||
file->settings.never_kill = true;
|
file->settings.never_kill = true;
|
||||||
|
@ -966,13 +959,13 @@ App_Init_Sig(app_init){
|
||||||
// NOTE(allen): setup first panel
|
// NOTE(allen): setup first panel
|
||||||
{
|
{
|
||||||
Panel *panel = layout_initialize(arena, &models->layout);
|
Panel *panel = layout_initialize(arena, &models->layout);
|
||||||
View *new_view = live_set_alloc_view(&models->mem.heap, &models->lifetime_allocator, &models->live_set, panel);
|
View *new_view = live_set_alloc_view(&models->lifetime_allocator, &models->live_set, panel);
|
||||||
view_set_file(system, models, new_view, models->scratch_buffer);
|
view_set_file(system, models, new_view, models->scratch_buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
// NOTE(allen): miscellaneous init
|
// NOTE(allen): miscellaneous init
|
||||||
hot_directory_init(system, arena, &models->hot_directory, current_directory);
|
hot_directory_init(system, arena, &models->hot_directory, current_directory);
|
||||||
child_process_container_init(&models->child_processes, models);
|
child_process_container_init(models->base_allocator, &models->child_processes);
|
||||||
models->user_up_key = key_up;
|
models->user_up_key = key_up;
|
||||||
models->user_down_key = key_down;
|
models->user_down_key = key_down;
|
||||||
models->period_wakeup_timer = system->wake_up_timer_create();
|
models->period_wakeup_timer = system->wake_up_timer_create();
|
||||||
|
|
|
@ -28,11 +28,6 @@ api_check_buffer(Editing_File *file){
|
||||||
return(file != 0);
|
return(file != 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
internal b32
|
|
||||||
api_check_buffer_and_tokens(Editing_File *file){
|
|
||||||
return(api_check_buffer(file) && file->state.token_array.tokens != 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
internal b32
|
internal b32
|
||||||
api_check_buffer(Editing_File *file, Access_Flag access){
|
api_check_buffer(Editing_File *file, Access_Flag access){
|
||||||
return(api_check_buffer(file) && access_test(file_get_access_flags(file), access));
|
return(api_check_buffer(file) && access_test(file_get_access_flags(file), access));
|
||||||
|
@ -173,14 +168,6 @@ Push_Clipboard_Index(Application_Links *app, Arena *arena, i32 clipboard_id, i32
|
||||||
return(result);
|
return(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
API_EXPORT Parse_Context_ID
|
|
||||||
Create_Parse_Context(Application_Links *app, Parser_String_And_Type *kw, u32 kw_count, Parser_String_And_Type *pp, u32 pp_count)
|
|
||||||
{
|
|
||||||
Models *models = (Models*)app->cmd_context;
|
|
||||||
Parse_Context_ID id = parse_context_add(&models->parse_context_memory, &models->mem.heap, kw, kw_count, pp, pp_count);
|
|
||||||
return(id);
|
|
||||||
}
|
|
||||||
|
|
||||||
API_EXPORT i32
|
API_EXPORT i32
|
||||||
Get_Buffer_Count(Application_Links *app)
|
Get_Buffer_Count(Application_Links *app)
|
||||||
{
|
{
|
||||||
|
@ -645,17 +632,6 @@ Buffer_Set_Dirty_State(Application_Links *app, Buffer_ID buffer_id, Dirty_State
|
||||||
return(result);
|
return(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
API_EXPORT b32
|
|
||||||
Buffer_Tokens_Are_Ready(Application_Links *app, Buffer_ID buffer_id){
|
|
||||||
Models *models = (Models*)app->cmd_context;
|
|
||||||
Editing_File *file = imp_get_file(models, buffer_id);
|
|
||||||
b32 result = false;
|
|
||||||
if (api_check_buffer(file)){
|
|
||||||
result = file_tokens_are_ready(file);
|
|
||||||
}
|
|
||||||
return(result);
|
|
||||||
}
|
|
||||||
|
|
||||||
API_EXPORT b32
|
API_EXPORT b32
|
||||||
Buffer_Get_Setting(Application_Links *app, Buffer_ID buffer_id, Buffer_Setting_ID setting, i32 *value_out)
|
Buffer_Get_Setting(Application_Links *app, Buffer_ID buffer_id, Buffer_Setting_ID setting, i32 *value_out)
|
||||||
{
|
{
|
||||||
|
@ -665,36 +641,6 @@ Buffer_Get_Setting(Application_Links *app, Buffer_ID buffer_id, Buffer_Setting_I
|
||||||
if (api_check_buffer(file)){
|
if (api_check_buffer(file)){
|
||||||
result = true;
|
result = true;
|
||||||
switch (setting){
|
switch (setting){
|
||||||
case BufferSetting_Lex:
|
|
||||||
{
|
|
||||||
*value_out = file->settings.tokens_exist;
|
|
||||||
}break;
|
|
||||||
|
|
||||||
case BufferSetting_LexWithoutStrings:
|
|
||||||
{
|
|
||||||
*value_out = file->settings.tokens_without_strings;
|
|
||||||
}break;
|
|
||||||
|
|
||||||
case BufferSetting_ParserContext:
|
|
||||||
{
|
|
||||||
*value_out = file->settings.parse_context_id;
|
|
||||||
}break;
|
|
||||||
|
|
||||||
case BufferSetting_WrapLine:
|
|
||||||
{
|
|
||||||
//*value_out = !file->settings.unwrapped_lines;
|
|
||||||
}break;
|
|
||||||
|
|
||||||
case BufferSetting_WrapPosition:
|
|
||||||
{
|
|
||||||
//*value_out = file->settings.display_width;
|
|
||||||
}break;
|
|
||||||
|
|
||||||
case BufferSetting_MinimumBaseWrapPosition:
|
|
||||||
{
|
|
||||||
//*value_out = file->settings.minimum_base_display_width;
|
|
||||||
}break;
|
|
||||||
|
|
||||||
case BufferSetting_MapID:
|
case BufferSetting_MapID:
|
||||||
{
|
{
|
||||||
*value_out = file->settings.base_map_id;
|
*value_out = file->settings.base_map_id;
|
||||||
|
@ -715,13 +661,6 @@ Buffer_Get_Setting(Application_Links *app, Buffer_ID buffer_id, Buffer_Setting_I
|
||||||
*value_out = file->settings.read_only;
|
*value_out = file->settings.read_only;
|
||||||
}break;
|
}break;
|
||||||
|
|
||||||
case BufferSetting_VirtualWhitespace:
|
|
||||||
{
|
|
||||||
#if 0
|
|
||||||
*value_out = file->settings.virtual_white;
|
|
||||||
#endif
|
|
||||||
}break;
|
|
||||||
|
|
||||||
case BufferSetting_RecordsHistory:
|
case BufferSetting_RecordsHistory:
|
||||||
{
|
{
|
||||||
*value_out = history_is_activated(&file->state.history);
|
*value_out = history_is_activated(&file->state.history);
|
||||||
|
@ -746,94 +685,6 @@ Buffer_Set_Setting(Application_Links *app, Buffer_ID buffer_id, Buffer_Setting_I
|
||||||
if (api_check_buffer(file)){
|
if (api_check_buffer(file)){
|
||||||
result = true;
|
result = true;
|
||||||
switch (setting){
|
switch (setting){
|
||||||
case BufferSetting_Lex:
|
|
||||||
{
|
|
||||||
if (file->settings.tokens_exist){
|
|
||||||
if (!value){
|
|
||||||
file_kill_tokens(system, &models->mem.heap, file);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
if (value){
|
|
||||||
file_first_lex(system, models, file);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}break;
|
|
||||||
|
|
||||||
case BufferSetting_LexWithoutStrings:
|
|
||||||
{
|
|
||||||
if (file->settings.tokens_exist){
|
|
||||||
if ((b8)value != file->settings.tokens_without_strings){
|
|
||||||
file_kill_tokens(system, &models->mem.heap, file);
|
|
||||||
file->settings.tokens_without_strings = (b8)value;
|
|
||||||
file_first_lex(system, models, file);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
file->settings.tokens_without_strings = (b8)value;
|
|
||||||
}
|
|
||||||
}break;
|
|
||||||
|
|
||||||
case BufferSetting_ParserContext:
|
|
||||||
{
|
|
||||||
u32 fixed_value = parse_context_valid_id(&models->parse_context_memory, (u32)value);
|
|
||||||
|
|
||||||
if (file->settings.tokens_exist){
|
|
||||||
if (fixed_value != file->settings.parse_context_id){
|
|
||||||
file_kill_tokens(system, &models->mem.heap, file);
|
|
||||||
file->settings.parse_context_id = fixed_value;
|
|
||||||
file_first_lex(system, models, file);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
file->settings.parse_context_id = fixed_value;
|
|
||||||
}
|
|
||||||
}break;
|
|
||||||
|
|
||||||
case BufferSetting_WrapLine:
|
|
||||||
{
|
|
||||||
//file->settings.unwrapped_lines = !value;
|
|
||||||
}break;
|
|
||||||
|
|
||||||
case BufferSetting_WrapPosition:
|
|
||||||
{
|
|
||||||
#if 0
|
|
||||||
i32 new_value = value;
|
|
||||||
if (new_value < 48){
|
|
||||||
new_value = 48;
|
|
||||||
}
|
|
||||||
if (new_value != file->settings.display_width){
|
|
||||||
Face *face = font_set_face_from_id(&models->font_set, file->settings.font_id);
|
|
||||||
file->settings.display_width = new_value;
|
|
||||||
file_measure_wraps(system, &models->mem, file, face);
|
|
||||||
adjust_views_looking_at_file_to_new_cursor(system, models, file);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}break;
|
|
||||||
|
|
||||||
case BufferSetting_MinimumBaseWrapPosition:
|
|
||||||
{
|
|
||||||
#if 0
|
|
||||||
i32 new_value = value;
|
|
||||||
if (new_value < 0){
|
|
||||||
new_value = 0;
|
|
||||||
}
|
|
||||||
if (new_value != file->settings.minimum_base_display_width){
|
|
||||||
Face *face = font_set_face_from_id(&models->font_set, file->settings.font_id);
|
|
||||||
file->settings.minimum_base_display_width = new_value;
|
|
||||||
file_measure_wraps(system, &models->mem, file, face);
|
|
||||||
adjust_views_looking_at_file_to_new_cursor(system, models, file);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}break;
|
|
||||||
|
|
||||||
case BufferSetting_WrapIndicator:
|
|
||||||
{
|
|
||||||
#if 0
|
|
||||||
file->settings.wrap_indicator = value;
|
|
||||||
#endif
|
|
||||||
}break;
|
|
||||||
|
|
||||||
case BufferSetting_MapID:
|
case BufferSetting_MapID:
|
||||||
{
|
{
|
||||||
if (value < mapid_global){
|
if (value < mapid_global){
|
||||||
|
@ -914,7 +765,7 @@ Buffer_Set_Setting(Application_Links *app, Buffer_ID buffer_id, Buffer_Setting_I
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
if (history_is_activated(&file->state.history)){
|
if (history_is_activated(&file->state.history)){
|
||||||
history_free(&models->mem.heap, &file->state.history);
|
history_free(&file->state.history);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}break;
|
}break;
|
||||||
|
@ -941,18 +792,6 @@ Buffer_Get_Managed_Scope(Application_Links *app, Buffer_ID buffer_id)
|
||||||
return(result);
|
return(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
API_EXPORT Cpp_Token_Array
|
|
||||||
Buffer_Get_Token_Array(Application_Links *app, Buffer_ID buffer_id)
|
|
||||||
{
|
|
||||||
Models *models = (Models*)app->cmd_context;
|
|
||||||
Editing_File *file = imp_get_file(models, buffer_id);
|
|
||||||
Cpp_Token_Array result = {};
|
|
||||||
if (api_check_buffer_and_tokens(file)){
|
|
||||||
result = file->state.token_array;
|
|
||||||
}
|
|
||||||
return(result);
|
|
||||||
}
|
|
||||||
|
|
||||||
API_EXPORT b32
|
API_EXPORT b32
|
||||||
Buffer_Send_End_Signal(Application_Links *app, Buffer_ID buffer_id)
|
Buffer_Send_End_Signal(Application_Links *app, Buffer_ID buffer_id)
|
||||||
{
|
{
|
||||||
|
@ -1027,7 +866,7 @@ Buffer_Kill(Application_Links *app, Buffer_ID buffer_id, Buffer_Kill_Flag flags)
|
||||||
if (file->canon.name_size != 0){
|
if (file->canon.name_size != 0){
|
||||||
buffer_unbind_file(system, working_set, file);
|
buffer_unbind_file(system, working_set, file);
|
||||||
}
|
}
|
||||||
file_free(system, &models->mem.heap, &models->lifetime_allocator, working_set, file);
|
file_free(system, &models->lifetime_allocator, working_set, file);
|
||||||
working_set_free_file(&models->mem.heap, working_set, file);
|
working_set_free_file(&models->mem.heap, working_set, file);
|
||||||
|
|
||||||
Layout *layout = &models->layout;
|
Layout *layout = &models->layout;
|
||||||
|
@ -1109,7 +948,7 @@ Buffer_Reopen(Application_Links *app, Buffer_ID buffer_id, Buffer_Reopen_Flag fl
|
||||||
}
|
}
|
||||||
|
|
||||||
Working_Set *working_set = &models->working_set;
|
Working_Set *working_set = &models->working_set;
|
||||||
file_free(system, &models->mem.heap, &models->lifetime_allocator, working_set, file);
|
file_free(system, &models->lifetime_allocator, working_set, file);
|
||||||
working_set_file_default_settings(working_set, file);
|
working_set_file_default_settings(working_set, file);
|
||||||
file_create_from_string(models, file, SCu8(file_memory, attributes.size), attributes);
|
file_create_from_string(models, file, SCu8(file_memory, attributes.size), attributes);
|
||||||
|
|
||||||
|
@ -1404,7 +1243,7 @@ Panel_Split(Application_Links *app, Panel_ID panel_id, Panel_Split_Orientation o
|
||||||
Panel *new_panel = 0;
|
Panel *new_panel = 0;
|
||||||
if (layout_split_panel(layout, panel, (orientation == PanelSplit_LeftAndRight), &new_panel)){
|
if (layout_split_panel(layout, panel, (orientation == PanelSplit_LeftAndRight), &new_panel)){
|
||||||
Live_Views *live_set = &models->live_set;
|
Live_Views *live_set = &models->live_set;
|
||||||
View *new_view = live_set_alloc_view(&models->mem.heap, &models->lifetime_allocator, live_set, new_panel);
|
View *new_view = live_set_alloc_view(&models->lifetime_allocator, live_set, new_panel);
|
||||||
view_set_file(models->system, models, new_view, models->scratch_buffer);
|
view_set_file(models->system, models, new_view, models->scratch_buffer);
|
||||||
result = true;
|
result = true;
|
||||||
}
|
}
|
||||||
|
@ -1542,7 +1381,7 @@ View_Close(Application_Links *app, View_ID view_id)
|
||||||
b32 result = false;
|
b32 result = false;
|
||||||
if (api_check_view(view)){
|
if (api_check_view(view)){
|
||||||
if (layout_close_panel(layout, view->panel)){
|
if (layout_close_panel(layout, view->panel)){
|
||||||
live_set_free_view(&models->mem.heap, &models->lifetime_allocator, &models->live_set, view);
|
live_set_free_view(&models->lifetime_allocator, &models->live_set, view);
|
||||||
result = true;
|
result = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1902,19 +1741,21 @@ View_Get_Quit_UI_Handler(Application_Links *app, View_ID view_id, UI_Quit_Functi
|
||||||
|
|
||||||
internal Dynamic_Workspace*
|
internal Dynamic_Workspace*
|
||||||
get_dynamic_workspace(Models *models, Managed_Scope handle){
|
get_dynamic_workspace(Models *models, Managed_Scope handle){
|
||||||
u32_Ptr_Lookup_Result lookup_result = lookup_u32_Ptr_table(&models->lifetime_allocator.scope_id_to_scope_ptr_table, (u32)handle);
|
Dynamic_Workspace *result = 0;
|
||||||
if (!lookup_result.success){
|
Table_Lookup lookup = table_lookup(&models->lifetime_allocator.scope_id_to_scope_ptr_table, handle);
|
||||||
return(0);
|
if (lookup.found_match){
|
||||||
|
u64 val = 0;
|
||||||
|
table_read(&models->lifetime_allocator.scope_id_to_scope_ptr_table, lookup, &val);
|
||||||
|
result = (Dynamic_Workspace*)IntAsPtr(val);
|
||||||
}
|
}
|
||||||
return((Dynamic_Workspace*)*lookup_result.val);
|
return(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
API_EXPORT Managed_Scope
|
API_EXPORT Managed_Scope
|
||||||
Create_User_Managed_Scope(Application_Links *app)
|
Create_User_Managed_Scope(Application_Links *app)
|
||||||
{
|
{
|
||||||
Models *models = (Models*)app->cmd_context;
|
Models *models = (Models*)app->cmd_context;
|
||||||
Heap *heap = &models->mem.heap;
|
Lifetime_Object *object = lifetime_alloc_object(&models->lifetime_allocator, DynamicWorkspace_Unassociated, 0);
|
||||||
Lifetime_Object *object = lifetime_alloc_object(heap, &models->lifetime_allocator, DynamicWorkspace_Unassociated, 0);
|
|
||||||
object->workspace.user_back_ptr = object;
|
object->workspace.user_back_ptr = object;
|
||||||
Managed_Scope scope = (Managed_Scope)object->workspace.scope_id;
|
Managed_Scope scope = (Managed_Scope)object->workspace.scope_id;
|
||||||
return(scope);
|
return(scope);
|
||||||
|
@ -1928,7 +1769,7 @@ Destroy_User_Managed_Scope(Application_Links *app, Managed_Scope scope)
|
||||||
b32 result = false;
|
b32 result = false;
|
||||||
if (workspace != 0 && workspace->user_type == DynamicWorkspace_Unassociated){
|
if (workspace != 0 && workspace->user_type == DynamicWorkspace_Unassociated){
|
||||||
Lifetime_Object *lifetime_object = (Lifetime_Object*)workspace->user_back_ptr;
|
Lifetime_Object *lifetime_object = (Lifetime_Object*)workspace->user_back_ptr;
|
||||||
lifetime_free_object(&models->mem.heap, &models->lifetime_allocator, lifetime_object);
|
lifetime_free_object(&models->lifetime_allocator, lifetime_object);
|
||||||
result = true;
|
result = true;
|
||||||
}
|
}
|
||||||
return(result);
|
return(result);
|
||||||
|
@ -2045,8 +1886,7 @@ Get_Managed_Scope_With_Multiple_Dependencies(Application_Links *app, Managed_Sco
|
||||||
index += 1;
|
index += 1;
|
||||||
}
|
}
|
||||||
member_count = lifetime_sort_and_dedup_object_set(object_ptr_array, member_count);
|
member_count = lifetime_sort_and_dedup_object_set(object_ptr_array, member_count);
|
||||||
Heap *heap = &models->mem.heap;
|
Lifetime_Key *key = lifetime_get_or_create_intersection_key(lifetime_allocator, object_ptr_array, member_count);
|
||||||
Lifetime_Key *key = lifetime_get_or_create_intersection_key(heap, lifetime_allocator, object_ptr_array, member_count);
|
|
||||||
result = (Managed_Scope)key->dynamic_workspace.scope_id;
|
result = (Managed_Scope)key->dynamic_workspace.scope_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2062,7 +1902,7 @@ Managed_Scope_Clear_Contents(Application_Links *app, Managed_Scope scope)
|
||||||
Dynamic_Workspace *workspace = get_dynamic_workspace(models, scope);
|
Dynamic_Workspace *workspace = get_dynamic_workspace(models, scope);
|
||||||
b32 result = false;
|
b32 result = false;
|
||||||
if (workspace != 0){
|
if (workspace != 0){
|
||||||
dynamic_workspace_clear_contents(&models->mem.heap, workspace);
|
dynamic_workspace_clear_contents(workspace);
|
||||||
result = true;
|
result = true;
|
||||||
}
|
}
|
||||||
return(result);
|
return(result);
|
||||||
|
@ -2077,74 +1917,60 @@ Managed_Scope_Clear_Self_All_Dependent_Scopes(Application_Links *app, Managed_Sc
|
||||||
if (workspace != 0 && workspace->user_type != DynamicWorkspace_Global && workspace->user_type != DynamicWorkspace_Intersected){
|
if (workspace != 0 && workspace->user_type != DynamicWorkspace_Global && workspace->user_type != DynamicWorkspace_Intersected){
|
||||||
Lifetime_Object *object = get_lifetime_object_from_workspace(workspace);
|
Lifetime_Object *object = get_lifetime_object_from_workspace(workspace);
|
||||||
Assert(object != 0);
|
Assert(object != 0);
|
||||||
lifetime_object_reset(&models->mem.heap, &models->lifetime_allocator, object);
|
lifetime_object_reset(&models->lifetime_allocator, object);
|
||||||
result = true;
|
result = true;
|
||||||
}
|
}
|
||||||
return(result);
|
return(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
API_EXPORT Managed_Variable_ID
|
API_EXPORT Base_Allocator*
|
||||||
Managed_Variable_Create(Application_Links *app, char *null_terminated_name, u64 default_value)
|
Managed_Scope_Allocator(Application_Links *app, Managed_Scope scope)
|
||||||
{
|
{
|
||||||
Models *models = (Models*)app->cmd_context;
|
Models *models = (Models*)app->cmd_context;
|
||||||
Heap *heap = &models->mem.heap;
|
Dynamic_Workspace *workspace = get_dynamic_workspace(models, scope);
|
||||||
Dynamic_Variable_Layout *layout = &models->variable_layout;
|
Base_Allocator *result = 0;
|
||||||
return(dynamic_variables_create(heap, layout, SCu8(null_terminated_name), default_value));
|
|
||||||
}
|
|
||||||
|
|
||||||
API_EXPORT Managed_Variable_ID
|
|
||||||
Managed_Variable_Get_ID(Application_Links *app, char *null_terminated_name)
|
|
||||||
{
|
|
||||||
Models *models = (Models*)app->cmd_context;
|
|
||||||
Dynamic_Variable_Layout *layout = &models->variable_layout;
|
|
||||||
return(dynamic_variables_lookup(layout, SCu8(null_terminated_name)));
|
|
||||||
}
|
|
||||||
|
|
||||||
API_EXPORT Managed_Variable_ID
|
|
||||||
Managed_Variable_Create_Or_Get_ID(Application_Links *app, char *null_terminated_name, u64 default_value)
|
|
||||||
{
|
|
||||||
Models *models = (Models*)app->cmd_context;
|
|
||||||
Heap *heap = &models->mem.heap;
|
|
||||||
Dynamic_Variable_Layout *layout = &models->variable_layout;
|
|
||||||
return(dynamic_variables_lookup_or_create(heap, layout, SCu8(null_terminated_name), default_value));
|
|
||||||
}
|
|
||||||
|
|
||||||
internal b32
|
|
||||||
get_dynamic_variable__internal(Models *models, Managed_Scope handle, i32 location, u64 **ptr_out){
|
|
||||||
Heap *heap = &models->mem.heap;
|
|
||||||
Dynamic_Variable_Layout *layout = &models->variable_layout;
|
|
||||||
Dynamic_Workspace *workspace = get_dynamic_workspace(models, handle);
|
|
||||||
b32 result = false;
|
|
||||||
if (workspace != 0){
|
if (workspace != 0){
|
||||||
if (dynamic_variables_get_ptr(heap, &workspace->mem_bank, layout, &workspace->var_block, location, ptr_out)){
|
result = &workspace->heap_wrapper;
|
||||||
result = true;
|
}
|
||||||
|
return(result);
|
||||||
|
}
|
||||||
|
|
||||||
|
API_EXPORT Managed_ID
|
||||||
|
Managed_Id_Declare(Application_Links *app, String_Const_u8 name)
|
||||||
|
{
|
||||||
|
Models *models = (Models*)app->cmd_context;
|
||||||
|
Managed_ID_Set *set = &models->managed_id_set;
|
||||||
|
return(managed_ids_declare(set, name));
|
||||||
|
}
|
||||||
|
|
||||||
|
API_EXPORT void*
|
||||||
|
Managed_Scope_Get_Attachment(Application_Links *app, Managed_Scope scope, Managed_ID id, umem size){
|
||||||
|
Models *models = (Models*)app->cmd_context;
|
||||||
|
Dynamic_Workspace *workspace = get_dynamic_workspace(models, scope);
|
||||||
|
void *result = 0;
|
||||||
|
if (workspace != 0){
|
||||||
|
Dynamic_Variable_Block *var_block = &workspace->var_block;
|
||||||
|
Data data = dynamic_variable_get(var_block, id, size);
|
||||||
|
if (data.size >= size){
|
||||||
|
result = data.data;
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
#define M \
|
||||||
|
"ERROR: scope attachment already exists with a size smaller than the requested size; no attachment pointer can returned."
|
||||||
|
print_message(app, string_u8_litexpr(M));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return(result);
|
return(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
API_EXPORT b32
|
API_EXPORT void*
|
||||||
Managed_Variable_Set(Application_Links *app, Managed_Scope scope, Managed_Variable_ID id, u64 value)
|
Managed_Scope_Attachment_Erase(Application_Links *app, Managed_Scope scope, Managed_ID id){
|
||||||
{
|
|
||||||
Models *models = (Models*)app->cmd_context;
|
Models *models = (Models*)app->cmd_context;
|
||||||
u64 *ptr = 0;
|
Dynamic_Workspace *workspace = get_dynamic_workspace(models, scope);
|
||||||
b32 result = false;
|
void *result = 0;
|
||||||
if (get_dynamic_variable__internal(models, scope, id, &ptr)){
|
if (workspace != 0){
|
||||||
*ptr = value;
|
Dynamic_Variable_Block *var_block = &workspace->var_block;
|
||||||
result = true;
|
dynamic_variable_erase(var_block, id);
|
||||||
}
|
|
||||||
return(result);
|
|
||||||
}
|
|
||||||
|
|
||||||
API_EXPORT b32
|
|
||||||
Managed_Variable_Get(Application_Links *app, Managed_Scope scope, Managed_Variable_ID id, u64 *value_out)
|
|
||||||
{
|
|
||||||
Models *models = (Models*)app->cmd_context;
|
|
||||||
u64 *ptr = 0;
|
|
||||||
b32 result = false;
|
|
||||||
if (get_dynamic_variable__internal(models, scope, id, &ptr)){
|
|
||||||
*value_out = *ptr;
|
|
||||||
result = true;
|
|
||||||
}
|
}
|
||||||
return(result);
|
return(result);
|
||||||
}
|
}
|
||||||
|
@ -2156,7 +1982,7 @@ Alloc_Managed_Memory_In_Scope(Application_Links *app, Managed_Scope scope, i32 i
|
||||||
Dynamic_Workspace *workspace = get_dynamic_workspace(models, scope);
|
Dynamic_Workspace *workspace = get_dynamic_workspace(models, scope);
|
||||||
Managed_Object result = 0;
|
Managed_Object result = 0;
|
||||||
if (workspace != 0){
|
if (workspace != 0){
|
||||||
result = managed_object_alloc_managed_memory(&models->mem.heap, workspace, item_size, count, 0);
|
result = managed_object_alloc_managed_memory(workspace, item_size, count, 0);
|
||||||
}
|
}
|
||||||
return(result);
|
return(result);
|
||||||
}
|
}
|
||||||
|
@ -2176,18 +2002,7 @@ Alloc_Buffer_Markers_On_Buffer(Application_Links *app, Buffer_ID buffer_id, i32
|
||||||
Dynamic_Workspace *workspace = get_dynamic_workspace(models, markers_scope);
|
Dynamic_Workspace *workspace = get_dynamic_workspace(models, markers_scope);
|
||||||
Managed_Object result = 0;
|
Managed_Object result = 0;
|
||||||
if (workspace != 0){
|
if (workspace != 0){
|
||||||
result = managed_object_alloc_buffer_markers(&models->mem.heap, workspace, buffer_id, count, 0);
|
result = managed_object_alloc_buffer_markers(workspace, buffer_id, count, 0);
|
||||||
}
|
|
||||||
return(result);
|
|
||||||
}
|
|
||||||
|
|
||||||
API_EXPORT Managed_Object
|
|
||||||
Alloc_Managed_Arena_In_Scope(Application_Links *app, Managed_Scope scope, i32 page_size){
|
|
||||||
Models *models = (Models*)app->cmd_context;
|
|
||||||
Dynamic_Workspace *workspace = get_dynamic_workspace(models, scope);
|
|
||||||
Managed_Object result = 0;
|
|
||||||
if (workspace != 0){
|
|
||||||
result = managed_object_alloc_managed_arena_in_scope(&models->mem.heap, workspace, app, page_size, 0);
|
|
||||||
}
|
}
|
||||||
return(result);
|
return(result);
|
||||||
}
|
}
|
||||||
|
@ -2232,6 +2047,14 @@ Managed_Object_Get_Item_Count(Application_Links *app, Managed_Object object)
|
||||||
return(result);
|
return(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
API_EXPORT void*
|
||||||
|
Managed_Object_Get_Pointer(Application_Links *app, Managed_Object object)
|
||||||
|
{
|
||||||
|
Models *models = (Models*)app->cmd_context;
|
||||||
|
Managed_Object_Ptr_And_Workspace object_ptrs = get_dynamic_object_ptrs(models, object);
|
||||||
|
return(get_dynamic_object_memory_ptr(object_ptrs.header));
|
||||||
|
}
|
||||||
|
|
||||||
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)
|
||||||
{
|
{
|
||||||
|
@ -2272,6 +2095,7 @@ Managed_Object_Free(Application_Links *app, Managed_Object object)
|
||||||
return(result);
|
return(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO(allen): ELIMINATE STORE & LOAD
|
||||||
API_EXPORT b32
|
API_EXPORT b32
|
||||||
Managed_Object_Store_Data(Application_Links *app, Managed_Object object, u32 first_index, u32 count, void *mem)
|
Managed_Object_Store_Data(Application_Links *app, Managed_Object object, u32 first_index, u32 count, void *mem)
|
||||||
{
|
{
|
||||||
|
@ -2284,7 +2108,7 @@ Managed_Object_Store_Data(Application_Links *app, Managed_Object object, u32 fir
|
||||||
if (0 <= first_index && first_index + count <= item_count){
|
if (0 <= first_index && first_index + count <= item_count){
|
||||||
u32 item_size = object_ptrs.header->item_size;
|
u32 item_size = object_ptrs.header->item_size;
|
||||||
memcpy(ptr + first_index*item_size, mem, count*item_size);
|
memcpy(ptr + first_index*item_size, mem, count*item_size);
|
||||||
heap_assert_good(&object_ptrs.workspace->mem_bank.heap);
|
heap_assert_good(&object_ptrs.workspace->heap);
|
||||||
result = true;
|
result = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2303,7 +2127,7 @@ Managed_Object_Load_Data(Application_Links *app, Managed_Object object, u32 firs
|
||||||
if (0 <= first_index && first_index + count <= item_count){
|
if (0 <= first_index && first_index + count <= item_count){
|
||||||
u32 item_size = object_ptrs.header->item_size;
|
u32 item_size = object_ptrs.header->item_size;
|
||||||
memcpy(mem_out, ptr + first_index*item_size, count*item_size);
|
memcpy(mem_out, ptr + first_index*item_size, count*item_size);
|
||||||
heap_assert_good(&object_ptrs.workspace->mem_bank.heap);
|
heap_assert_good(&object_ptrs.workspace->heap);
|
||||||
result = true;
|
result = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -58,10 +58,10 @@ struct Models{
|
||||||
|
|
||||||
Hook_Function *hooks[hook_type_count];
|
Hook_Function *hooks[hook_type_count];
|
||||||
Start_Hook_Function *hook_start;
|
Start_Hook_Function *hook_start;
|
||||||
Open_File_Hook_Function *hook_open_file;
|
Buffer_Hook_Function *hook_open_file;
|
||||||
Open_File_Hook_Function *hook_new_file;
|
Buffer_Hook_Function *hook_new_file;
|
||||||
Open_File_Hook_Function *hook_save_file;
|
Buffer_Hook_Function *hook_save_file;
|
||||||
Open_File_Hook_Function *hook_end_file;
|
Buffer_Hook_Function *hook_end_file;
|
||||||
File_Edit_Range_Function *hook_file_edit_range;
|
File_Edit_Range_Function *hook_file_edit_range;
|
||||||
File_Edit_Finished_Function *hook_file_edit_finished;
|
File_Edit_Finished_Function *hook_file_edit_finished;
|
||||||
File_Externally_Modified_Function *hook_file_externally_modified;
|
File_Externally_Modified_Function *hook_file_externally_modified;
|
||||||
|
@ -85,7 +85,7 @@ struct Models{
|
||||||
Text_Layout_Container text_layouts;
|
Text_Layout_Container text_layouts;
|
||||||
Font_Set font_set;
|
Font_Set font_set;
|
||||||
|
|
||||||
Dynamic_Variable_Layout variable_layout;
|
Managed_ID_Set managed_id_set;
|
||||||
Dynamic_Workspace dynamic_workspace;
|
Dynamic_Workspace dynamic_workspace;
|
||||||
Lifetime_Allocator lifetime_allocator;
|
Lifetime_Allocator lifetime_allocator;
|
||||||
|
|
||||||
|
|
|
@ -30,9 +30,6 @@
|
||||||
#include "4coder_hash_functions.cpp"
|
#include "4coder_hash_functions.cpp"
|
||||||
#include "4coder_table.cpp"
|
#include "4coder_table.cpp"
|
||||||
|
|
||||||
#include "4coder_lib/4coder_heap.cpp"
|
|
||||||
#define FSTRING_IMPLEMENTATION
|
|
||||||
#include "4coder_lib/4coder_string.h"
|
|
||||||
#include "4coder_lib/4coder_utf8.h"
|
#include "4coder_lib/4coder_utf8.h"
|
||||||
|
|
||||||
// TODO(allen): stop this nonsense
|
// TODO(allen): stop this nonsense
|
||||||
|
@ -49,8 +46,6 @@ struct Mem_Options{
|
||||||
#define FCPP_FORBID_MALLOC
|
#define FCPP_FORBID_MALLOC
|
||||||
#include "4coder_lib/4cpp_lexer.h"
|
#include "4coder_lib/4cpp_lexer.h"
|
||||||
|
|
||||||
#include "4ed_ptr_check.h"
|
|
||||||
#include "4ed_memory_bank.h"
|
|
||||||
#include "4ed_dynamic_variables.h"
|
#include "4ed_dynamic_variables.h"
|
||||||
|
|
||||||
#include "4ed_buffer_model.h"
|
#include "4ed_buffer_model.h"
|
||||||
|
@ -78,10 +73,7 @@ struct Mem_Options{
|
||||||
#include "4coder_log.cpp"
|
#include "4coder_log.cpp"
|
||||||
#include "4ed_coroutine.cpp"
|
#include "4ed_coroutine.cpp"
|
||||||
#include "4ed_mem.cpp"
|
#include "4ed_mem.cpp"
|
||||||
#include "4ed_ptr_check.cpp"
|
|
||||||
#include "4ed_memory_bank.cpp"
|
|
||||||
#include "4ed_dynamic_variables.cpp"
|
#include "4ed_dynamic_variables.cpp"
|
||||||
#include "4ed_parse_context.cpp"
|
|
||||||
#include "4ed_font_face.cpp"
|
#include "4ed_font_face.cpp"
|
||||||
#include "4ed_font_set.cpp"
|
#include "4ed_font_set.cpp"
|
||||||
#include "4ed_translation.cpp"
|
#include "4ed_translation.cpp"
|
||||||
|
@ -90,7 +82,6 @@ struct Mem_Options{
|
||||||
#include "4ed_buffer.cpp"
|
#include "4ed_buffer.cpp"
|
||||||
#include "4ed_string_matching.cpp"
|
#include "4ed_string_matching.cpp"
|
||||||
#include "4ed_history.cpp"
|
#include "4ed_history.cpp"
|
||||||
#include "4ed_file_lex.cpp"
|
|
||||||
#include "4ed_file.cpp"
|
#include "4ed_file.cpp"
|
||||||
#include "4ed_working_set.cpp"
|
#include "4ed_working_set.cpp"
|
||||||
#include "4ed_hot_directory.cpp"
|
#include "4ed_hot_directory.cpp"
|
||||||
|
|
30
4ed_cli.cpp
30
4ed_cli.cpp
|
@ -10,18 +10,20 @@
|
||||||
// TOP
|
// TOP
|
||||||
|
|
||||||
internal void
|
internal void
|
||||||
child_process_container_init(Child_Process_Container *container, Models *models){
|
child_process_container_init(Base_Allocator *allocator, Child_Process_Container *container){
|
||||||
container->arena = make_arena_app_links(&models->app_links);
|
container->arena = make_arena(allocator);
|
||||||
dll_init_sentinel(&container->child_process_active_list);
|
dll_init_sentinel(&container->child_process_active_list);
|
||||||
dll_init_sentinel(&container->child_process_free_list);
|
dll_init_sentinel(&container->child_process_free_list);
|
||||||
|
container->active_child_process_count = 0;
|
||||||
container->child_process_id_counter = 0;
|
container->child_process_id_counter = 0;
|
||||||
block_zero_struct(&container->id_to_ptr_table);
|
container->id_to_ptr_table = make_table_u64_u64(allocator, 10);
|
||||||
|
container->id_to_return_code_table = make_table_u64_u64(allocator, 10);
|
||||||
}
|
}
|
||||||
|
|
||||||
internal void
|
internal void
|
||||||
child_process_container_release(Child_Process_Container *container, Models *models){
|
child_process_container_release(Child_Process_Container *container, Models *models){
|
||||||
linalloc_clear(&container->arena);
|
linalloc_clear(&container->arena);
|
||||||
heap_free(&models->mem.heap, container->id_to_ptr_table.mem);
|
table_free(&container->id_to_ptr_table);
|
||||||
block_zero_struct(container);
|
block_zero_struct(container);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -42,7 +44,7 @@ child_process_alloc_new(Models *models, Child_Process_Container *container){
|
||||||
block_zero_struct(new_process);
|
block_zero_struct(new_process);
|
||||||
dll_insert_back(&container->child_process_active_list, &new_process->node);
|
dll_insert_back(&container->child_process_active_list, &new_process->node);
|
||||||
new_process->id = new_id;
|
new_process->id = new_id;
|
||||||
insert_u32_Ptr_table(&models->mem.heap, &container->id_to_ptr_table, new_id, new_process);
|
table_insert(&container->id_to_ptr_table, new_id, (u64)PtrAsInt(new_process));
|
||||||
container->active_child_process_count += 1;
|
container->active_child_process_count += 1;
|
||||||
|
|
||||||
result.process = new_process;
|
result.process = new_process;
|
||||||
|
@ -52,8 +54,13 @@ child_process_alloc_new(Models *models, Child_Process_Container *container){
|
||||||
|
|
||||||
internal Child_Process*
|
internal Child_Process*
|
||||||
child_process_from_id(Child_Process_Container *container, Child_Process_ID id){
|
child_process_from_id(Child_Process_Container *container, Child_Process_ID id){
|
||||||
|
Table_Lookup lookup = table_lookup(&container->id_to_ptr_table, id);
|
||||||
Child_Process *process = 0;
|
Child_Process *process = 0;
|
||||||
lookup_u32_Ptr_table(&container->id_to_ptr_table, &id, (void**)&process);
|
if (lookup.found_match){
|
||||||
|
u64 val = 0;
|
||||||
|
table_read(&container->id_to_ptr_table, lookup, &val);
|
||||||
|
process = (Child_Process*)IntAsPtr(val);
|
||||||
|
}
|
||||||
return(process);
|
return(process);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -62,7 +69,7 @@ child_process_free(Child_Process_Container *container, Child_Process_ID id){
|
||||||
b32 result = false;
|
b32 result = false;
|
||||||
Child_Process *process = child_process_from_id(container, id);
|
Child_Process *process = child_process_from_id(container, id);
|
||||||
if (process != 0){
|
if (process != 0){
|
||||||
erase_u32_Ptr_table(&container->id_to_ptr_table, &id);
|
table_erase(&container->id_to_ptr_table, id);
|
||||||
dll_remove(&process->node);
|
dll_remove(&process->node);
|
||||||
dll_insert(&container->child_process_free_list, &process->node);
|
dll_insert(&container->child_process_free_list, &process->node);
|
||||||
container->active_child_process_count -= 1;
|
container->active_child_process_count -= 1;
|
||||||
|
@ -73,17 +80,16 @@ child_process_free(Child_Process_Container *container, Child_Process_ID id){
|
||||||
|
|
||||||
internal b32
|
internal b32
|
||||||
child_process_set_return_code(Models *models, Child_Process_Container *container, Child_Process_ID id, i64 val){
|
child_process_set_return_code(Models *models, Child_Process_Container *container, Child_Process_ID id, i64 val){
|
||||||
void *val_as_ptr = IntAsPtr(val);
|
table_insert(&container->id_to_return_code_table, id, val);
|
||||||
insert_u32_Ptr_table(&models->mem.heap, &container->id_to_return_code_table, id, val_as_ptr);
|
|
||||||
return(true);
|
return(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
internal b32
|
internal b32
|
||||||
child_process_lookup_return_code(Child_Process_Container *container, Child_Process_ID id, i64 *out){
|
child_process_lookup_return_code(Child_Process_Container *container, Child_Process_ID id, i64 *out){
|
||||||
b32 result = false;
|
b32 result = false;
|
||||||
void *val_as_ptr = 0;
|
Table_Lookup lookup = table_lookup(&container->id_to_return_code_table, id);
|
||||||
if (lookup_u32_Ptr_table(&container->id_to_return_code_table, &id, &val_as_ptr)){
|
if (lookup.found_match){
|
||||||
*out = (u64)PtrAsInt(val_as_ptr);
|
table_read(&container->id_to_return_code_table, lookup, (u64*)out);
|
||||||
result = true;
|
result = true;
|
||||||
}
|
}
|
||||||
return(result);
|
return(result);
|
||||||
|
|
|
@ -26,8 +26,8 @@ struct Child_Process_Container{
|
||||||
Node child_process_free_list;
|
Node child_process_free_list;
|
||||||
i32 active_child_process_count;
|
i32 active_child_process_count;
|
||||||
u32 child_process_id_counter;
|
u32 child_process_id_counter;
|
||||||
u32_Ptr_Table id_to_ptr_table;
|
Table_u64_u64 id_to_ptr_table;
|
||||||
u32_Ptr_Table id_to_return_code_table;
|
Table_u64_u64 id_to_return_code_table;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Child_Process_And_ID{
|
struct Child_Process_And_ID{
|
||||||
|
|
|
@ -10,413 +10,147 @@
|
||||||
// TOP
|
// TOP
|
||||||
|
|
||||||
internal void
|
internal void
|
||||||
dynamic_variables_init(Dynamic_Variable_Layout *layout){
|
managed_ids_init(Base_Allocator *allocator, Managed_ID_Set *set){
|
||||||
dll_init_sentinel(&layout->sentinel);
|
set->arena = make_arena(allocator, KB(4), 8);
|
||||||
layout->location_counter = 1;
|
set->name_to_id_table = make_table_Data_u64(allocator, 40);
|
||||||
|
set->id_counter = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
internal Managed_Variable_ID
|
internal Managed_ID
|
||||||
dynamic_variables_lookup(Dynamic_Variable_Layout *layout, String_Const_u8 name){
|
managed_ids_declare(Managed_ID_Set *set, String_Const_u8 name){
|
||||||
for (Dynamic_Variable_Slot *slot = layout->sentinel.next;
|
Managed_ID result = 0;
|
||||||
slot != &layout->sentinel;
|
Data data = make_data(name.str, name.size);
|
||||||
slot = slot->next){
|
Table_Lookup lookup = table_lookup(&set->name_to_id_table, data);
|
||||||
if (string_match(slot->name, name)){
|
if (lookup.found_match){
|
||||||
return(slot->location);
|
table_read(&set->name_to_id_table, lookup, &result);
|
||||||
}
|
|
||||||
}
|
|
||||||
return(ManagedVariableIndex_ERROR);
|
|
||||||
}
|
|
||||||
|
|
||||||
internal Managed_Variable_ID
|
|
||||||
dynamic_variables_create__always(Heap *heap, Dynamic_Variable_Layout *layout, String_Const_u8 name, u64 default_value){
|
|
||||||
i32 alloc_size = (i32)(name.size + 1 + sizeof(Dynamic_Variable_Slot));
|
|
||||||
void *ptr = heap_allocate(heap, alloc_size);
|
|
||||||
Managed_Variable_ID result = ManagedVariableIndex_ERROR;
|
|
||||||
if (ptr != 0){
|
|
||||||
Dynamic_Variable_Slot *new_slot = (Dynamic_Variable_Slot*)ptr;
|
|
||||||
char *c_str = (char*)(new_slot + 1);
|
|
||||||
block_copy(c_str, name.str, name.size);
|
|
||||||
c_str[name.size] = 0;
|
|
||||||
new_slot->name = SCu8(c_str, name.size);
|
|
||||||
new_slot->default_value = default_value;
|
|
||||||
new_slot->location = layout->location_counter++;
|
|
||||||
dll_insert_back(&layout->sentinel, new_slot);
|
|
||||||
result = new_slot->location;
|
|
||||||
}
|
|
||||||
return(result);
|
|
||||||
}
|
|
||||||
|
|
||||||
internal Managed_Variable_ID
|
|
||||||
dynamic_variables_lookup_or_create(Heap *heap, Dynamic_Variable_Layout *layout, String_Const_u8 name, u64 default_value){
|
|
||||||
Managed_Variable_ID lookup_id = dynamic_variables_lookup(layout, name);
|
|
||||||
if (lookup_id == ManagedVariableIndex_ERROR){
|
|
||||||
lookup_id = dynamic_variables_create__always(heap, layout, name, default_value);
|
|
||||||
}
|
|
||||||
return(lookup_id);
|
|
||||||
}
|
|
||||||
|
|
||||||
internal i32
|
|
||||||
dynamic_variables_create(Heap *heap, Dynamic_Variable_Layout *layout, String_Const_u8 name, u64 default_value){
|
|
||||||
Managed_Variable_ID lookup_id = dynamic_variables_lookup(layout, name);
|
|
||||||
if (lookup_id == ManagedVariableIndex_ERROR){
|
|
||||||
return(dynamic_variables_create__always(heap, layout, name, default_value));
|
|
||||||
}
|
|
||||||
return(ManagedVariableIndex_ERROR);
|
|
||||||
}
|
|
||||||
|
|
||||||
////////////////////////////////
|
|
||||||
|
|
||||||
internal void
|
|
||||||
dynamic_variables_block_init(Dynamic_Variable_Block *block){
|
|
||||||
block->val_array = 0;
|
|
||||||
block->count = 0;
|
|
||||||
block->max = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
internal void
|
|
||||||
dynamic_variables_block_grow_max_to(Heap *heap, Memory_Bank *mem_bank, i32 new_max, Dynamic_Variable_Block *block){
|
|
||||||
i32 new_size = new_max*sizeof(u64);
|
|
||||||
u64 *new_array = (u64*)memory_bank_allocate(heap, mem_bank, new_size);
|
|
||||||
if (block->val_array != 0){
|
|
||||||
memcpy(new_array, block->val_array, sizeof(u64)*block->count);
|
|
||||||
memory_bank_free(mem_bank, block->val_array);
|
|
||||||
}
|
|
||||||
block->val_array = new_array;
|
|
||||||
}
|
|
||||||
|
|
||||||
internal void
|
|
||||||
dynamic_variables_block_fill_unset_values(Dynamic_Variable_Layout *layout, Dynamic_Variable_Block *block, i32 one_past_last_index){
|
|
||||||
i32 first_location = block->count + 1;
|
|
||||||
i32 one_past_last_location = one_past_last_index + 1;
|
|
||||||
block->count = one_past_last_index;
|
|
||||||
for (Dynamic_Variable_Slot *slot = layout->sentinel.next;
|
|
||||||
slot != &layout->sentinel;
|
|
||||||
slot = slot->next){
|
|
||||||
if (first_location <= slot->location && slot->location < one_past_last_location){
|
|
||||||
block->val_array[slot->location - 1] = slot->default_value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
internal b32
|
|
||||||
dynamic_variables_get_ptr(Heap *heap, Memory_Bank *mem_bank,
|
|
||||||
Dynamic_Variable_Layout *layout, Dynamic_Variable_Block *block,
|
|
||||||
i32 location, u64 **ptr_out){
|
|
||||||
b32 result = false;
|
|
||||||
if (location > 0 && location < layout->location_counter){
|
|
||||||
i32 index = location - 1;
|
|
||||||
if (index >= block->count){
|
|
||||||
i32 minimum_max = layout->location_counter - 1;
|
|
||||||
if (block->max < minimum_max){
|
|
||||||
dynamic_variables_block_grow_max_to(heap, mem_bank, minimum_max*2, block);
|
|
||||||
}
|
|
||||||
dynamic_variables_block_fill_unset_values(layout, block, index + 1);
|
|
||||||
}
|
|
||||||
*ptr_out = block->val_array + index;
|
|
||||||
result = true;
|
|
||||||
}
|
|
||||||
return(result);
|
|
||||||
}
|
|
||||||
|
|
||||||
////////////////////////////////
|
|
||||||
|
|
||||||
internal void
|
|
||||||
insert_u32_Ptr_table(Heap *heap, Memory_Bank *mem_bank, u32_Ptr_Table *table, u32 key, void* val){
|
|
||||||
if (at_max_u32_Ptr_table(table)){
|
|
||||||
i32 new_max = (table->max + 1)*2;
|
|
||||||
i32 new_mem_size = max_to_memsize_u32_Ptr_table(new_max);
|
|
||||||
void *new_mem = memory_bank_allocate(heap, mem_bank, new_mem_size);
|
|
||||||
u32_Ptr_Table new_table = make_u32_Ptr_table(new_mem, new_mem_size);
|
|
||||||
if (table->mem != 0){
|
|
||||||
b32 result = move_u32_Ptr_table(&new_table, table);
|
|
||||||
Assert(result);
|
|
||||||
memory_bank_free(mem_bank, table->mem);
|
|
||||||
}
|
|
||||||
*table = new_table;
|
|
||||||
}
|
|
||||||
b32 result = insert_u32_Ptr_table(table, &key, &val);
|
|
||||||
Assert(result);
|
|
||||||
}
|
|
||||||
|
|
||||||
////////////////////////////////
|
|
||||||
|
|
||||||
internal void
|
|
||||||
marker_visual_allocator_init(Marker_Visual_Allocator *allocator){
|
|
||||||
memset(allocator, 0, sizeof(*allocator));
|
|
||||||
}
|
|
||||||
|
|
||||||
internal Marker_Visual_Data*
|
|
||||||
dynamic_workspace_alloc_visual(Heap *heap, Memory_Bank *mem_bank, Dynamic_Workspace *workspace){
|
|
||||||
Marker_Visual_Allocator *allocator = &workspace->visual_allocator;
|
|
||||||
if (allocator->free_count == 0){
|
|
||||||
i32 new_slots_count = clamp_bot(16, allocator->total_visual_count);
|
|
||||||
i32 memsize = new_slots_count*sizeof(Marker_Visual_Data);
|
|
||||||
void *new_slots_memory = memory_bank_allocate(heap, mem_bank, memsize);
|
|
||||||
memset(new_slots_memory, 0, memsize);
|
|
||||||
Marker_Visual_Data *new_slot = (Marker_Visual_Data*)new_slots_memory;
|
|
||||||
allocator->free_count += new_slots_count;
|
|
||||||
allocator->total_visual_count += new_slots_count;
|
|
||||||
for (i32 i = 0; i < new_slots_count; i += 1, new_slot += 1){
|
|
||||||
zdll_push_back(allocator->free_first, allocator->free_last, new_slot);
|
|
||||||
new_slot->slot_id = ++workspace->visual_id_counter;
|
|
||||||
insert_u32_Ptr_table(heap, mem_bank, &allocator->id_to_ptr_table, new_slot->slot_id, new_slot);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Marker_Visual_Data *data = allocator->free_first;
|
|
||||||
zdll_remove(allocator->free_first, allocator->free_last, data);
|
|
||||||
allocator->free_count -= 1;
|
|
||||||
data->gen_id += 1;
|
|
||||||
return(data);
|
|
||||||
}
|
|
||||||
|
|
||||||
internal void
|
|
||||||
marker_visual_free(Marker_Visual_Allocator *allocator, Marker_Visual_Data *data){
|
|
||||||
zdll_push_back(allocator->free_first, allocator->free_last, data);
|
|
||||||
allocator->free_count += 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
internal void
|
|
||||||
marker_visual_free_chain(Marker_Visual_Allocator *allocator, Marker_Visual_Data *first, Marker_Visual_Data *last, i32 count){
|
|
||||||
if (allocator->free_first == 0){
|
|
||||||
allocator->free_first = first;
|
|
||||||
allocator->free_last = last;
|
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
allocator->free_last->next = first;
|
result = set->id_counter;
|
||||||
first->prev = allocator->free_last;
|
set->id_counter += 1;
|
||||||
allocator->free_last = last;
|
data = push_data_copy(&set->arena, data);
|
||||||
|
table_insert(&set->name_to_id_table, data, result);
|
||||||
}
|
}
|
||||||
allocator->free_count += count;
|
return(result);
|
||||||
}
|
|
||||||
|
|
||||||
internal void
|
|
||||||
marker_visual_defaults(Marker_Visual_Data *data){
|
|
||||||
data->type = VisualType_Invisible;
|
|
||||||
data->color = 0;
|
|
||||||
data->text_color = 0;
|
|
||||||
data->text_style = 0;
|
|
||||||
data->take_rule.first_index = 0;
|
|
||||||
data->take_rule.take_count_per_step = 1;
|
|
||||||
data->take_rule.step_stride_in_marker_count = 1;
|
|
||||||
data->take_rule.maximum_number_of_markers = max_i32;
|
|
||||||
data->one_past_last_take_index = max_i32;
|
|
||||||
data->priority = VisualPriority_Default;
|
|
||||||
data->key_view_id = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////
|
////////////////////////////////
|
||||||
|
|
||||||
internal void
|
internal void
|
||||||
dynamic_workspace_init(Heap *heap, Lifetime_Allocator *lifetime_allocator, i32 user_type, void *user_back_ptr, Dynamic_Workspace *workspace){
|
dynamic_variable_block_init(Base_Allocator *allocator, Dynamic_Variable_Block *block){
|
||||||
memset(workspace, 0, sizeof(*workspace));
|
block->arena = make_arena(allocator, KB(4), 8);
|
||||||
memory_bank_init(&workspace->mem_bank);
|
block->id_to_data_table = make_table_u64_Data(allocator, 20);
|
||||||
dynamic_variables_block_init(&workspace->var_block);
|
}
|
||||||
marker_visual_allocator_init(&workspace->visual_allocator);
|
|
||||||
|
internal Data
|
||||||
|
dynamic_variable_get(Dynamic_Variable_Block *block, Managed_ID id, umem size){
|
||||||
|
Data result = {};
|
||||||
|
Table_Lookup lookup = table_lookup(&block->id_to_data_table, id);
|
||||||
|
if (lookup.found_match){
|
||||||
|
table_read(&block->id_to_data_table, lookup, &result);
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
result = push_data(&block->arena, size);
|
||||||
|
block_zero(result);
|
||||||
|
table_insert(&block->id_to_data_table, id, result);
|
||||||
|
}
|
||||||
|
return(result);
|
||||||
|
}
|
||||||
|
|
||||||
|
internal void
|
||||||
|
dynamic_variable_erase(Dynamic_Variable_Block *block, Managed_ID id){
|
||||||
|
table_erase(&block->id_to_data_table, id);
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////
|
||||||
|
|
||||||
|
internal void
|
||||||
|
lifetime_allocator_init(Base_Allocator *base_allocator, Lifetime_Allocator *lifetime_allocator){
|
||||||
|
block_zero_struct(lifetime_allocator);
|
||||||
|
lifetime_allocator->allocator = base_allocator;
|
||||||
|
lifetime_allocator->key_table = make_table_Data_u64(base_allocator, 100);
|
||||||
|
lifetime_allocator->key_check_table = make_table_u64_u64(base_allocator, 100);
|
||||||
|
lifetime_allocator->scope_id_to_scope_ptr_table = make_table_u64_u64(base_allocator, 100);
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////
|
||||||
|
|
||||||
|
internal void
|
||||||
|
dynamic_workspace_init(Lifetime_Allocator *lifetime_allocator, i32 user_type, void *user_back_ptr, Dynamic_Workspace *workspace){
|
||||||
|
block_zero_struct(workspace);
|
||||||
|
heap_init(&workspace->heap, lifetime_allocator->allocator);
|
||||||
|
workspace->heap_wrapper = base_allocator_on_heap(&workspace->heap);
|
||||||
|
workspace->object_id_to_object_ptr = make_table_u64_u64(&workspace->heap_wrapper, 10);
|
||||||
|
dynamic_variable_block_init(&workspace->heap_wrapper, &workspace->var_block);
|
||||||
if (lifetime_allocator->scope_id_counter == 0){
|
if (lifetime_allocator->scope_id_counter == 0){
|
||||||
lifetime_allocator->scope_id_counter = 1;
|
lifetime_allocator->scope_id_counter = 1;
|
||||||
}
|
}
|
||||||
workspace->scope_id = lifetime_allocator->scope_id_counter++;
|
workspace->scope_id = lifetime_allocator->scope_id_counter++;
|
||||||
insert_u32_Ptr_table(heap, &lifetime_allocator->scope_id_to_scope_ptr_table, workspace->scope_id, workspace);
|
table_insert(&lifetime_allocator->scope_id_to_scope_ptr_table,
|
||||||
|
workspace->scope_id, (u64)PtrAsInt(workspace));
|
||||||
workspace->user_type = user_type;
|
workspace->user_type = user_type;
|
||||||
workspace->user_back_ptr = user_back_ptr;
|
workspace->user_back_ptr = user_back_ptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
internal void
|
internal void
|
||||||
dynamic_workspace_free(Heap *heap, Lifetime_Allocator *lifetime_allocator, Dynamic_Workspace *workspace){
|
dynamic_workspace_free(Lifetime_Allocator *lifetime_allocator, Dynamic_Workspace *workspace){
|
||||||
erase_u32_Ptr_table(&lifetime_allocator->scope_id_to_scope_ptr_table, workspace->scope_id);
|
table_erase(&lifetime_allocator->scope_id_to_scope_ptr_table, workspace->scope_id);
|
||||||
memory_bank_free_all(heap, &workspace->mem_bank);
|
heap_free_all(&workspace->heap);
|
||||||
}
|
}
|
||||||
|
|
||||||
internal void
|
internal void
|
||||||
dynamic_workspace_clear_contents(Heap *heap, Dynamic_Workspace *workspace){
|
dynamic_workspace_clear_contents(Dynamic_Workspace *workspace){
|
||||||
memory_bank_free_all(heap, &workspace->mem_bank);
|
Base_Allocator *base_allocator = heap_free_all(&workspace->heap);
|
||||||
memory_bank_init(&workspace->mem_bank);
|
heap_init(&workspace->heap, base_allocator);
|
||||||
|
workspace->heap_wrapper = base_allocator_on_heap(&workspace->heap);
|
||||||
dynamic_variables_block_init(&workspace->var_block);
|
workspace->object_id_to_object_ptr = make_table_u64_u64(&workspace->heap_wrapper, 10);
|
||||||
marker_visual_allocator_init(&workspace->visual_allocator);
|
dynamic_variable_block_init(&workspace->heap_wrapper, &workspace->var_block);
|
||||||
memset(&workspace->object_id_to_object_ptr, 0, sizeof(workspace->object_id_to_object_ptr));
|
block_zero_struct(&workspace->buffer_markers_list);
|
||||||
memset(&workspace->buffer_markers_list, 0, sizeof(workspace->buffer_markers_list));
|
|
||||||
workspace->total_marker_count = 0;
|
workspace->total_marker_count = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
internal u32
|
internal u32
|
||||||
dynamic_workspace_store_pointer(Heap *heap, Dynamic_Workspace *workspace, void *ptr){
|
dynamic_workspace_store_pointer(Dynamic_Workspace *workspace, void *ptr){
|
||||||
if (workspace->object_id_counter == 0){
|
if (workspace->object_id_counter == 0){
|
||||||
workspace->object_id_counter = 1;
|
workspace->object_id_counter = 1;
|
||||||
}
|
}
|
||||||
u32 id = workspace->object_id_counter++;
|
u32 id = workspace->object_id_counter++;
|
||||||
insert_u32_Ptr_table(heap, &workspace->mem_bank, &workspace->object_id_to_object_ptr, id, ptr);
|
table_insert(&workspace->object_id_to_object_ptr, id, (u64)PtrAsInt(ptr));
|
||||||
return(id);
|
return(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
internal void
|
internal void
|
||||||
dynamic_workspace_erase_pointer(Dynamic_Workspace *workspace, u32 id){
|
dynamic_workspace_erase_pointer(Dynamic_Workspace *workspace, u32 id){
|
||||||
erase_u32_Ptr_table(&workspace->object_id_to_object_ptr, id);
|
table_erase(&workspace->object_id_to_object_ptr, id);
|
||||||
}
|
}
|
||||||
|
|
||||||
internal void*
|
internal void*
|
||||||
dynamic_workspace_get_pointer(Dynamic_Workspace *workspace, u32 id){
|
dynamic_workspace_get_pointer(Dynamic_Workspace *workspace, u32 id){
|
||||||
u32_Ptr_Lookup_Result lookup = lookup_u32_Ptr_table(&workspace->object_id_to_object_ptr, id);
|
void *result = 0;
|
||||||
if (lookup.success){
|
Table_Lookup lookup = table_lookup(&workspace->object_id_to_object_ptr, id);
|
||||||
return(*lookup.val);
|
if (lookup.found_match){
|
||||||
|
u64 val = 0;
|
||||||
|
table_read(&workspace->object_id_to_object_ptr, lookup, &val);
|
||||||
|
result = IntAsPtr(val);
|
||||||
}
|
}
|
||||||
return(0);
|
return(result);
|
||||||
}
|
|
||||||
|
|
||||||
internal Marker_Visual_Data*
|
|
||||||
dynamic_workspace_get_visual_pointer(Dynamic_Workspace *workspace, u32 slot_id, u32 gen_id){
|
|
||||||
void *data_ptr = 0;
|
|
||||||
if (lookup_u32_Ptr_table(&workspace->visual_allocator.id_to_ptr_table, slot_id, &data_ptr)){
|
|
||||||
Marker_Visual_Data *data = (Marker_Visual_Data*)data_ptr;
|
|
||||||
if (data->gen_id == gen_id){
|
|
||||||
void *object_ptr = dynamic_workspace_get_pointer(workspace, data->owner_object&max_u32);
|
|
||||||
if (object_ptr != 0){
|
|
||||||
return(data);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return(0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////
|
////////////////////////////////
|
||||||
|
|
||||||
internal u64
|
internal Data
|
||||||
lifetime__key_hash(Lifetime_Object **object_ptr_array, i32 count){
|
lifetime__key_as_data(Lifetime_Object **members, i32 count){
|
||||||
u64 hash = bit_1;
|
return(make_data(members, sizeof(*members)*count));
|
||||||
for (i32 i = 0; i < count; i += 1){
|
|
||||||
u64 x = (u64)(PtrAsInt(object_ptr_array[i]));
|
|
||||||
x >>= 3;
|
|
||||||
hash = (hash + ((hash << 37) ^ (((x) >> (x&1)))));
|
|
||||||
}
|
|
||||||
return(hash | bit_63);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
internal Lifetime_Key*
|
internal Data
|
||||||
lifetime__key_table_lookup(Lifetime_Key_Table *table, u64 hash, Lifetime_Object **object_ptr_array, i32 count){
|
lifetime__key_as_data(Lifetime_Key *key){
|
||||||
u32 max = table->max;
|
return(lifetime__key_as_data(key->members, key->count));
|
||||||
if (max > 0 && table->count > 0){
|
|
||||||
u32 first_index = hash%max;
|
|
||||||
u32 index = first_index;
|
|
||||||
u64 *hashes = table->hashes;
|
|
||||||
umem set_size = count*sizeof(Lifetime_Object*);
|
|
||||||
for (;;){
|
|
||||||
if (hashes[index] == hash){
|
|
||||||
Lifetime_Key *key = table->keys[index];
|
|
||||||
if (key->count == count &&
|
|
||||||
memcmp(object_ptr_array, key->members, set_size) == 0){
|
|
||||||
return(key);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (hashes[index] == LifetimeKeyHash_Empty){
|
|
||||||
return(0);
|
|
||||||
}
|
|
||||||
index += 1;
|
|
||||||
if (index == max){
|
|
||||||
index = 0;
|
|
||||||
}
|
|
||||||
if (index == first_index){
|
|
||||||
return(0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
internal Lifetime_Key_Table
|
|
||||||
lifetime__key_table_copy(Heap *heap, Lifetime_Key_Table table, u32 new_max);
|
|
||||||
|
|
||||||
internal void
|
|
||||||
lifetime__key_table_insert(Heap *heap, Lifetime_Key_Table *table, u64 hash, Lifetime_Key *key){
|
|
||||||
{
|
|
||||||
u32 max = table->max;
|
|
||||||
u32 count = table->count;
|
|
||||||
if (max == 0 || (count + 1)*6 > max*5){
|
|
||||||
Assert(heap != 0);
|
|
||||||
Lifetime_Key_Table new_table = lifetime__key_table_copy(heap, *table, max*2);
|
|
||||||
heap_free(heap, table->mem_ptr);
|
|
||||||
*table = new_table;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
u32 max = table->max;
|
|
||||||
if (max > 0){
|
|
||||||
u32 first_index = hash%max;
|
|
||||||
u32 index = first_index;
|
|
||||||
u64 *hashes = table->hashes;
|
|
||||||
for (;;){
|
|
||||||
if (hashes[index] == LifetimeKeyHash_Empty ||
|
|
||||||
hashes[index] == LifetimeKeyHash_Deleted){
|
|
||||||
hashes[index] = hash;
|
|
||||||
table->keys[index] = key;
|
|
||||||
table->count += 1;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
index += 1;
|
|
||||||
if (index == max){
|
|
||||||
index = 0;
|
|
||||||
}
|
|
||||||
if (index == first_index){
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
internal void
|
internal void
|
||||||
lifetime__key_table_erase(Lifetime_Key_Table *table, Lifetime_Key *erase_key){
|
lifetime__free_key(Lifetime_Allocator *lifetime_allocator, Lifetime_Key *key, Lifetime_Object *skip_object){
|
||||||
u32 max = table->max;
|
|
||||||
if (max > 0 && table->count > 0){
|
|
||||||
u64 hash = lifetime__key_hash(erase_key->members, erase_key->count);
|
|
||||||
u32 first_index = hash%max;
|
|
||||||
u32 index = first_index;
|
|
||||||
u64 *hashes = table->hashes;
|
|
||||||
for (;;){
|
|
||||||
if (hashes[index] == hash){
|
|
||||||
Lifetime_Key *key = table->keys[index];
|
|
||||||
if (erase_key == key){
|
|
||||||
hashes[index] = LifetimeKeyHash_Deleted;
|
|
||||||
table->keys[index] = 0;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (hashes[index] == LifetimeKeyHash_Empty){
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
index += 1;
|
|
||||||
if (index == max){
|
|
||||||
index = 0;
|
|
||||||
}
|
|
||||||
if (index == first_index){
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
internal Lifetime_Key_Table
|
|
||||||
lifetime__key_table_copy(Heap *heap, Lifetime_Key_Table table, u32 new_max){
|
|
||||||
Lifetime_Key_Table new_table = {};
|
|
||||||
new_table.max = clamp_bot(table.max, new_max);
|
|
||||||
new_table.max = clamp_bot(307, new_table.max);
|
|
||||||
i32 item_size = sizeof(*new_table.hashes) + sizeof(*new_table.keys);
|
|
||||||
new_table.mem_ptr = heap_allocate(heap, item_size*new_table.max);
|
|
||||||
memset(new_table.mem_ptr, 0, item_size*new_table.max);
|
|
||||||
new_table.hashes = (u64*)(new_table.mem_ptr);
|
|
||||||
new_table.keys = (Lifetime_Key**)(new_table.hashes + new_table.max);
|
|
||||||
for (u32 i = 0; i < table.max; i += 1){
|
|
||||||
if ((table.hashes[i]&bit_63) != 0){
|
|
||||||
lifetime__key_table_insert(0, &new_table, table.hashes[i], table.keys[i]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return(new_table);
|
|
||||||
}
|
|
||||||
|
|
||||||
internal void
|
|
||||||
lifetime__free_key(Heap *heap, Lifetime_Allocator *lifetime_allocator, Lifetime_Key *key, Lifetime_Object *skip_object){
|
|
||||||
// Deinit
|
// Deinit
|
||||||
dynamic_workspace_free(heap, lifetime_allocator, &key->dynamic_workspace);
|
dynamic_workspace_free(lifetime_allocator, &key->dynamic_workspace);
|
||||||
|
|
||||||
// Remove From Objects
|
// Remove From Objects
|
||||||
i32 count = key->count;
|
i32 count = key->count;
|
||||||
|
@ -458,20 +192,22 @@ lifetime__free_key(Heap *heap, Lifetime_Allocator *lifetime_allocator, Lifetime_
|
||||||
}
|
}
|
||||||
|
|
||||||
// Free
|
// Free
|
||||||
lifetime__key_table_erase(&lifetime_allocator->key_table, key);
|
Data key_data = lifetime__key_as_data(key);
|
||||||
erase_Ptr_table(&lifetime_allocator->key_check_table, key);
|
table_erase(&lifetime_allocator->key_table, key_data);
|
||||||
heap_free(heap, key->members);
|
table_erase(&lifetime_allocator->key_check_table, (u64)PtrAsInt(key));
|
||||||
|
base_free(lifetime_allocator->allocator, key->members);
|
||||||
zdll_push_back(lifetime_allocator->free_keys.first, lifetime_allocator->free_keys.last, key);
|
zdll_push_back(lifetime_allocator->free_keys.first, lifetime_allocator->free_keys.last, key);
|
||||||
}
|
}
|
||||||
|
|
||||||
internal Lifetime_Key_Ref_Node*
|
internal Lifetime_Key_Ref_Node*
|
||||||
lifetime__alloc_key_reference_node(Heap *heap, Lifetime_Allocator *lifetime_allocator){
|
lifetime__alloc_key_reference_node(Lifetime_Allocator *lifetime_allocator){
|
||||||
Assert(lifetime_allocator != 0);
|
Assert(lifetime_allocator != 0);
|
||||||
Lifetime_Key_Ref_Node *result = lifetime_allocator->free_key_references.first;
|
Lifetime_Key_Ref_Node *result = lifetime_allocator->free_key_references.first;
|
||||||
if (result == 0){
|
if (result == 0){
|
||||||
i32 new_node_count = 32;
|
i32 new_node_count = 32;
|
||||||
Lifetime_Key_Ref_Node *new_nodes = heap_array(heap, Lifetime_Key_Ref_Node, new_node_count);
|
umem new_memory_size = new_node_count*sizeof(Lifetime_Key_Ref_Node);
|
||||||
Assert(new_nodes != 0);
|
Data new_memory = base_allocate(lifetime_allocator->allocator, new_memory_size);
|
||||||
|
Lifetime_Key_Ref_Node *new_nodes = (Lifetime_Key_Ref_Node*)new_memory.data;
|
||||||
Lifetime_Key_Ref_Node *new_node_ptr = new_nodes;
|
Lifetime_Key_Ref_Node *new_node_ptr = new_nodes;
|
||||||
for (i32 i = 0; i < new_node_count; i += 1, new_node_ptr += 1){
|
for (i32 i = 0; i < new_node_count; i += 1, new_node_ptr += 1){
|
||||||
zdll_push_back(lifetime_allocator->free_key_references.first,
|
zdll_push_back(lifetime_allocator->free_key_references.first,
|
||||||
|
@ -486,8 +222,7 @@ lifetime__alloc_key_reference_node(Heap *heap, Lifetime_Allocator *lifetime_allo
|
||||||
}
|
}
|
||||||
|
|
||||||
internal void
|
internal void
|
||||||
lifetime__object_add_key(Heap *heap, Lifetime_Allocator *lifetime_allocator,
|
lifetime__object_add_key(Lifetime_Allocator *lifetime_allocator, Lifetime_Object *object, Lifetime_Key *key){
|
||||||
Lifetime_Object *object, Lifetime_Key *key){
|
|
||||||
Lifetime_Key_Ref_Node *last_node = object->key_node_last;
|
Lifetime_Key_Ref_Node *last_node = object->key_node_last;
|
||||||
b32 insert_on_new_node = false;
|
b32 insert_on_new_node = false;
|
||||||
if (last_node == 0){
|
if (last_node == 0){
|
||||||
|
@ -504,20 +239,22 @@ lifetime__object_add_key(Heap *heap, Lifetime_Allocator *lifetime_allocator,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (insert_on_new_node){
|
if (insert_on_new_node){
|
||||||
Lifetime_Key_Ref_Node *new_node = lifetime__alloc_key_reference_node(heap, lifetime_allocator);
|
Lifetime_Key_Ref_Node *new_node = lifetime__alloc_key_reference_node(lifetime_allocator);
|
||||||
zdll_push_back(object->key_node_first, object->key_node_last, new_node);
|
zdll_push_back(object->key_node_first, object->key_node_last, new_node);
|
||||||
memset(new_node->keys, 0, sizeof(new_node->keys));
|
block_zero_struct(new_node->keys);
|
||||||
new_node->keys[0] = key;
|
new_node->keys[0] = key;
|
||||||
object->key_count += 1;
|
object->key_count += 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
internal Lifetime_Object*
|
internal Lifetime_Object*
|
||||||
lifetime_alloc_object(Heap *heap, Lifetime_Allocator *lifetime_allocator, i32 user_type, void *user_back_ptr){
|
lifetime_alloc_object(Lifetime_Allocator *lifetime_allocator, i32 user_type, void *user_back_ptr){
|
||||||
Lifetime_Object *object = lifetime_allocator->free_objects.first;
|
Lifetime_Object *object = lifetime_allocator->free_objects.first;
|
||||||
if (object == 0){
|
if (object == 0){
|
||||||
i32 new_object_count = 256;
|
i32 new_object_count = 256;
|
||||||
Lifetime_Object *new_objects = heap_array(heap, Lifetime_Object, new_object_count);
|
umem new_memory_size = new_object_count*sizeof(Lifetime_Object);
|
||||||
|
Data new_memory = base_allocate(lifetime_allocator->allocator, new_memory_size);
|
||||||
|
Lifetime_Object *new_objects = (Lifetime_Object*)new_memory.data;
|
||||||
Lifetime_Object *new_object_ptr = new_objects;
|
Lifetime_Object *new_object_ptr = new_objects;
|
||||||
for (i32 i = 0; i < new_object_count; i += 1, new_object_ptr += 1){
|
for (i32 i = 0; i < new_object_count; i += 1, new_object_ptr += 1){
|
||||||
zdll_push_back(lifetime_allocator->free_objects.first, lifetime_allocator->free_objects.last, new_object_ptr);
|
zdll_push_back(lifetime_allocator->free_objects.first, lifetime_allocator->free_objects.last, new_object_ptr);
|
||||||
|
@ -529,21 +266,21 @@ lifetime_alloc_object(Heap *heap, Lifetime_Allocator *lifetime_allocator, i32 us
|
||||||
zdll_remove(lifetime_allocator->free_objects.first, lifetime_allocator->free_objects.last, object);
|
zdll_remove(lifetime_allocator->free_objects.first, lifetime_allocator->free_objects.last, object);
|
||||||
lifetime_allocator->free_objects.count -= 1;
|
lifetime_allocator->free_objects.count -= 1;
|
||||||
|
|
||||||
memset(object, 0, sizeof(*object));
|
block_zero_struct(object);
|
||||||
dynamic_workspace_init(heap, lifetime_allocator, user_type, user_back_ptr, &object->workspace);
|
dynamic_workspace_init(lifetime_allocator, user_type, user_back_ptr, &object->workspace);
|
||||||
|
|
||||||
return(object);
|
return(object);
|
||||||
}
|
}
|
||||||
|
|
||||||
internal void
|
internal void
|
||||||
lifetime__object_free_all_keys(Heap *heap, Lifetime_Allocator *lifetime_allocator, Lifetime_Object *lifetime_object){
|
lifetime__object_free_all_keys(Lifetime_Allocator *lifetime_allocator, Lifetime_Object *lifetime_object){
|
||||||
i32 key_i = 0;
|
i32 key_i = 0;
|
||||||
for (Lifetime_Key_Ref_Node *node = lifetime_object->key_node_first;
|
for (Lifetime_Key_Ref_Node *node = lifetime_object->key_node_first;
|
||||||
node != 0;
|
node != 0;
|
||||||
node = node->next){
|
node = node->next){
|
||||||
i32 one_past_last = clamp_top(ArrayCount(node->keys), lifetime_object->key_count - key_i);
|
i32 one_past_last = clamp_top(ArrayCount(node->keys), lifetime_object->key_count - key_i);
|
||||||
for (i32 i = 0; i < one_past_last; i += 1){
|
for (i32 i = 0; i < one_past_last; i += 1){
|
||||||
lifetime__free_key(heap, lifetime_allocator, node->keys[i], lifetime_object);
|
lifetime__free_key(lifetime_allocator, node->keys[i], lifetime_object);
|
||||||
}
|
}
|
||||||
key_i += one_past_last;
|
key_i += one_past_last;
|
||||||
}
|
}
|
||||||
|
@ -557,7 +294,7 @@ lifetime__object_free_all_keys(Heap *heap, Lifetime_Allocator *lifetime_allocato
|
||||||
}
|
}
|
||||||
|
|
||||||
internal void
|
internal void
|
||||||
lifetime__object_clear_all_keys(Heap *heap, Lifetime_Allocator *lifetime_allocator, Lifetime_Object *lifetime_object){
|
lifetime__object_clear_all_keys(Lifetime_Allocator *lifetime_allocator, Lifetime_Object *lifetime_object){
|
||||||
i32 key_i = 0;
|
i32 key_i = 0;
|
||||||
for (Lifetime_Key_Ref_Node *node = lifetime_object->key_node_first;
|
for (Lifetime_Key_Ref_Node *node = lifetime_object->key_node_first;
|
||||||
node != 0;
|
node != 0;
|
||||||
|
@ -565,23 +302,23 @@ lifetime__object_clear_all_keys(Heap *heap, Lifetime_Allocator *lifetime_allocat
|
||||||
i32 one_past_last = clamp_top(ArrayCount(node->keys), lifetime_object->key_count - key_i);
|
i32 one_past_last = clamp_top(ArrayCount(node->keys), lifetime_object->key_count - key_i);
|
||||||
Lifetime_Key **key_ptr = node->keys;
|
Lifetime_Key **key_ptr = node->keys;
|
||||||
for (i32 i = 0; i < one_past_last; i += 1, key_ptr += 1){
|
for (i32 i = 0; i < one_past_last; i += 1, key_ptr += 1){
|
||||||
dynamic_workspace_clear_contents(heap, &(*key_ptr)->dynamic_workspace);
|
dynamic_workspace_clear_contents(&(*key_ptr)->dynamic_workspace);
|
||||||
}
|
}
|
||||||
key_i += one_past_last;
|
key_i += one_past_last;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
internal void
|
internal void
|
||||||
lifetime_free_object(Heap *heap, Lifetime_Allocator *lifetime_allocator, Lifetime_Object *lifetime_object){
|
lifetime_free_object(Lifetime_Allocator *lifetime_allocator, Lifetime_Object *lifetime_object){
|
||||||
lifetime__object_free_all_keys(heap, lifetime_allocator, lifetime_object);
|
lifetime__object_free_all_keys(lifetime_allocator, lifetime_object);
|
||||||
dynamic_workspace_free(heap, lifetime_allocator, &lifetime_object->workspace);
|
dynamic_workspace_free(lifetime_allocator, &lifetime_object->workspace);
|
||||||
zdll_push_back(lifetime_allocator->free_objects.first, lifetime_allocator->free_objects.last, lifetime_object);
|
zdll_push_back(lifetime_allocator->free_objects.first, lifetime_allocator->free_objects.last, lifetime_object);
|
||||||
}
|
}
|
||||||
|
|
||||||
internal void
|
internal void
|
||||||
lifetime_object_reset(Heap *heap, Lifetime_Allocator *lifetime_allocator, Lifetime_Object *lifetime_object){
|
lifetime_object_reset(Lifetime_Allocator *lifetime_allocator, Lifetime_Object *lifetime_object){
|
||||||
lifetime__object_clear_all_keys(heap, lifetime_allocator, lifetime_object);
|
lifetime__object_clear_all_keys(lifetime_allocator, lifetime_object);
|
||||||
dynamic_workspace_clear_contents(heap, &lifetime_object->workspace);
|
dynamic_workspace_clear_contents(&lifetime_object->workspace);
|
||||||
}
|
}
|
||||||
|
|
||||||
internal i32
|
internal i32
|
||||||
|
@ -624,21 +361,24 @@ lifetime_sort_and_dedup_object_set(Lifetime_Object **ptr_array, i32 count){
|
||||||
}
|
}
|
||||||
|
|
||||||
internal Lifetime_Key*
|
internal Lifetime_Key*
|
||||||
lifetime_get_or_create_intersection_key(Heap *heap, Lifetime_Allocator *lifetime_allocator, Lifetime_Object **object_ptr_array, i32 count){
|
lifetime_get_or_create_intersection_key(Lifetime_Allocator *lifetime_allocator, Lifetime_Object **object_ptr_array, i32 count){
|
||||||
u64 hash = lifetime__key_hash(object_ptr_array, count);
|
{
|
||||||
|
Data key_data = lifetime__key_as_data(object_ptr_array, count);
|
||||||
// Lookup
|
Table_Lookup lookup = table_lookup(&lifetime_allocator->key_table, key_data);
|
||||||
Lifetime_Key *existing_key = lifetime__key_table_lookup(&lifetime_allocator->key_table, hash,
|
if (lookup.found_match){
|
||||||
object_ptr_array, count);
|
u64 val = 0;
|
||||||
if (existing_key != 0){
|
table_read(&lifetime_allocator->key_table, lookup, &val);
|
||||||
return(existing_key);
|
return((Lifetime_Key*)IntAsPtr(val));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Allocate
|
// Allocate
|
||||||
Lifetime_Key *new_key = lifetime_allocator->free_keys.first;
|
Lifetime_Key *new_key = lifetime_allocator->free_keys.first;
|
||||||
if (new_key == 0){
|
if (new_key == 0){
|
||||||
i32 new_key_count = 256;
|
i32 new_key_count = 256;
|
||||||
Lifetime_Key *new_keys = heap_array(heap, Lifetime_Key, new_key_count);
|
umem new_memory_size = new_key_count*sizeof(Lifetime_Key);
|
||||||
|
Data new_memory = base_allocate(lifetime_allocator->allocator, new_memory_size);
|
||||||
|
Lifetime_Key *new_keys = (Lifetime_Key*)new_memory.data;
|
||||||
Lifetime_Key *new_key_ptr = new_keys;
|
Lifetime_Key *new_key_ptr = new_keys;
|
||||||
for (i32 i = 0; i < new_key_count; i += 1, new_key_ptr += 1){
|
for (i32 i = 0; i < new_key_count; i += 1, new_key_ptr += 1){
|
||||||
zdll_push_back(lifetime_allocator->free_keys.first, lifetime_allocator->free_keys.last, new_key_ptr);
|
zdll_push_back(lifetime_allocator->free_keys.first, lifetime_allocator->free_keys.last, new_key_ptr);
|
||||||
|
@ -647,32 +387,39 @@ lifetime_get_or_create_intersection_key(Heap *heap, Lifetime_Allocator *lifetime
|
||||||
new_key = lifetime_allocator->free_keys.first;
|
new_key = lifetime_allocator->free_keys.first;
|
||||||
}
|
}
|
||||||
zdll_remove(lifetime_allocator->free_keys.first, lifetime_allocator->free_keys.last, new_key);
|
zdll_remove(lifetime_allocator->free_keys.first, lifetime_allocator->free_keys.last, new_key);
|
||||||
memset(new_key, 0, sizeof(*new_key));
|
block_zero_struct(new_key);
|
||||||
|
|
||||||
// Add to Objects
|
// Add to Objects
|
||||||
Lifetime_Object **object_ptr = object_ptr_array;
|
Lifetime_Object **object_ptr = object_ptr_array;
|
||||||
for (i32 i = 0; i < count; i += 1, object_ptr += 1){
|
for (i32 i = 0; i < count; i += 1, object_ptr += 1){
|
||||||
Lifetime_Object *object = *object_ptr;
|
Lifetime_Object *object = *object_ptr;
|
||||||
lifetime__object_add_key(heap, lifetime_allocator, object, new_key);
|
lifetime__object_add_key(lifetime_allocator, object, new_key);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Initialize
|
// Initialize
|
||||||
new_key->members = heap_array(heap, Lifetime_Object*, count);
|
umem new_memory_size = sizeof(Lifetime_Object*)*count;
|
||||||
memcpy(new_key->members, object_ptr_array, sizeof(*new_key->members)*count);
|
Data new_memory = base_allocate(lifetime_allocator->allocator, new_memory_size);
|
||||||
|
new_key->members = (Lifetime_Object**)new_memory.data;
|
||||||
|
block_copy_dynamic_array(new_key->members, object_ptr_array, count);
|
||||||
new_key->count = count;
|
new_key->count = count;
|
||||||
dynamic_workspace_init(heap, lifetime_allocator,
|
dynamic_workspace_init(lifetime_allocator,
|
||||||
DynamicWorkspace_Intersected, new_key,
|
DynamicWorkspace_Intersected, new_key,
|
||||||
&new_key->dynamic_workspace);
|
&new_key->dynamic_workspace);
|
||||||
|
|
||||||
lifetime__key_table_insert(heap, &lifetime_allocator->key_table, hash, new_key);
|
{
|
||||||
insert_Ptr_table(heap, &lifetime_allocator->key_check_table, new_key);
|
Data key_data = lifetime__key_as_data(new_key);
|
||||||
|
u64 new_key_val = (u64)PtrAsInt(new_key);
|
||||||
|
table_insert(&lifetime_allocator->key_table, key_data, new_key_val);
|
||||||
|
table_insert(&lifetime_allocator->key_check_table, new_key_val, new_key_val);
|
||||||
|
}
|
||||||
|
|
||||||
return(new_key);
|
return(new_key);
|
||||||
}
|
}
|
||||||
|
|
||||||
internal b32
|
internal b32
|
||||||
lifetime_key_check(Lifetime_Allocator *lifetime_allocator, Lifetime_Key *key){
|
lifetime_key_check(Lifetime_Allocator *lifetime_allocator, Lifetime_Key *key){
|
||||||
return(lookup_Ptr_table(&lifetime_allocator->key_check_table, key));
|
Table_Lookup lookup = table_lookup(&lifetime_allocator->key_check_table, (u64)PtrAsInt(key));
|
||||||
|
return(lookup.found_match);
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////
|
////////////////////////////////
|
||||||
|
@ -688,21 +435,16 @@ get_dynamic_object_memory_ptr(Managed_Object_Standard_Header *header){
|
||||||
{
|
{
|
||||||
ptr = ((u8*)header) + managed_header_type_sizes[header->type];
|
ptr = ((u8*)header) + managed_header_type_sizes[header->type];
|
||||||
}break;
|
}break;
|
||||||
case ManagedObjectType_Arena:
|
|
||||||
{
|
|
||||||
ptr = ((u8*)header) + managed_header_type_sizes[header->type];
|
|
||||||
Managed_Arena_Header *arena_header = (Managed_Arena_Header*)header;
|
|
||||||
*(Arena**)ptr = &arena_header->arena;
|
|
||||||
}break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return(ptr);
|
return(ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
internal Managed_Object
|
internal Managed_Object
|
||||||
managed_object_alloc_managed_memory(Heap *heap, Dynamic_Workspace *workspace, i32 item_size, i32 count, void **ptr_out){
|
managed_object_alloc_managed_memory(Dynamic_Workspace *workspace, i32 item_size, i32 count, void **ptr_out){
|
||||||
i32 size = item_size*count;
|
i32 size = item_size*count;
|
||||||
void *ptr = memory_bank_allocate(heap, &workspace->mem_bank, sizeof(Managed_Memory_Header) + size);
|
Data new_memory = base_allocate(&workspace->heap_wrapper, sizeof(Managed_Memory_Header) + size);
|
||||||
|
void *ptr = new_memory.data;
|
||||||
Managed_Memory_Header *header = (Managed_Memory_Header*)ptr;
|
Managed_Memory_Header *header = (Managed_Memory_Header*)ptr;
|
||||||
header->std_header.type = ManagedObjectType_Memory;
|
header->std_header.type = ManagedObjectType_Memory;
|
||||||
header->std_header.item_size = item_size;
|
header->std_header.item_size = item_size;
|
||||||
|
@ -710,14 +452,15 @@ managed_object_alloc_managed_memory(Heap *heap, Dynamic_Workspace *workspace, i3
|
||||||
if (ptr_out != 0){
|
if (ptr_out != 0){
|
||||||
*ptr_out = get_dynamic_object_memory_ptr(&header->std_header);
|
*ptr_out = get_dynamic_object_memory_ptr(&header->std_header);
|
||||||
}
|
}
|
||||||
u32 id = dynamic_workspace_store_pointer(heap, workspace, ptr);
|
u32 id = dynamic_workspace_store_pointer(workspace, ptr);
|
||||||
return(((u64)workspace->scope_id << 32) | (u64)id);
|
return(((u64)workspace->scope_id << 32) | (u64)id);
|
||||||
}
|
}
|
||||||
|
|
||||||
internal Managed_Object
|
internal Managed_Object
|
||||||
managed_object_alloc_buffer_markers(Heap *heap, Dynamic_Workspace *workspace, Buffer_ID buffer_id, i32 count, Marker **markers_out){
|
managed_object_alloc_buffer_markers(Dynamic_Workspace *workspace, Buffer_ID buffer_id, i32 count, Marker **markers_out){
|
||||||
i32 size = count*sizeof(Marker);
|
i32 size = count*sizeof(Marker);
|
||||||
void *ptr = memory_bank_allocate(heap, &workspace->mem_bank, size + sizeof(Managed_Buffer_Markers_Header));
|
Data new_memory = base_allocate(&workspace->heap_wrapper, size + sizeof(Managed_Buffer_Markers_Header));
|
||||||
|
void *ptr = new_memory.data;
|
||||||
Managed_Buffer_Markers_Header *header = (Managed_Buffer_Markers_Header*)ptr;
|
Managed_Buffer_Markers_Header *header = (Managed_Buffer_Markers_Header*)ptr;
|
||||||
header->std_header.type = ManagedObjectType_Markers;
|
header->std_header.type = ManagedObjectType_Markers;
|
||||||
header->std_header.item_size = sizeof(Marker);
|
header->std_header.item_size = sizeof(Marker);
|
||||||
|
@ -726,29 +469,10 @@ managed_object_alloc_buffer_markers(Heap *heap, Dynamic_Workspace *workspace, Bu
|
||||||
workspace->buffer_markers_list.count += 1;
|
workspace->buffer_markers_list.count += 1;
|
||||||
workspace->total_marker_count += count;
|
workspace->total_marker_count += count;
|
||||||
header->buffer_id = buffer_id;
|
header->buffer_id = buffer_id;
|
||||||
header->visual_first = 0;
|
|
||||||
header->visual_last = 0;
|
|
||||||
header->visual_count = 0;
|
|
||||||
if (markers_out != 0){
|
if (markers_out != 0){
|
||||||
*markers_out = (Marker*)get_dynamic_object_memory_ptr(&header->std_header);
|
*markers_out = (Marker*)get_dynamic_object_memory_ptr(&header->std_header);
|
||||||
}
|
}
|
||||||
u32 id = dynamic_workspace_store_pointer(heap, workspace, ptr);
|
u32 id = dynamic_workspace_store_pointer(workspace, ptr);
|
||||||
return(((u64)workspace->scope_id << 32) | (u64)id);
|
|
||||||
}
|
|
||||||
|
|
||||||
internal Managed_Object
|
|
||||||
managed_object_alloc_managed_arena_in_scope(Heap *heap, Dynamic_Workspace *workspace, Application_Links *app, i32 page_size, Arena **arena_out){
|
|
||||||
void *ptr = memory_bank_allocate(heap, &workspace->mem_bank, sizeof(Managed_Arena_Header) + sizeof(Arena*));
|
|
||||||
Managed_Arena_Header *header = (Managed_Arena_Header*)ptr;
|
|
||||||
header->std_header.type = ManagedObjectType_Arena;
|
|
||||||
header->std_header.item_size = sizeof(Arena*);
|
|
||||||
header->std_header.count = 1;
|
|
||||||
zdll_push_back(workspace->arena_list.first, workspace->arena_list.last, header);
|
|
||||||
header->arena = make_arena_app_links(app, page_size);
|
|
||||||
if (arena_out != 0){
|
|
||||||
*arena_out = &header->arena;
|
|
||||||
}
|
|
||||||
u32 id = dynamic_workspace_store_pointer(heap, workspace, ptr);
|
|
||||||
return(((u64)workspace->scope_id << 32) | (u64)id);
|
return(((u64)workspace->scope_id << 32) | (u64)id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -764,22 +488,12 @@ managed_object_free(Dynamic_Workspace *workspace, Managed_Object object){
|
||||||
{
|
{
|
||||||
Managed_Buffer_Markers_Header *header = (Managed_Buffer_Markers_Header*)object_ptr;
|
Managed_Buffer_Markers_Header *header = (Managed_Buffer_Markers_Header*)object_ptr;
|
||||||
workspace->total_marker_count -= header->std_header.count;
|
workspace->total_marker_count -= header->std_header.count;
|
||||||
if (header->visual_count > 0){
|
|
||||||
marker_visual_free_chain(&workspace->visual_allocator, header->visual_first, header->visual_last, header->visual_count);
|
|
||||||
}
|
|
||||||
zdll_remove(workspace->buffer_markers_list.first, workspace->buffer_markers_list.last, header);
|
zdll_remove(workspace->buffer_markers_list.first, workspace->buffer_markers_list.last, header);
|
||||||
workspace->buffer_markers_list.count -= 1;
|
workspace->buffer_markers_list.count -= 1;
|
||||||
}break;
|
}break;
|
||||||
|
|
||||||
case ManagedObjectType_Arena:
|
|
||||||
{
|
|
||||||
Managed_Arena_Header *header = (Managed_Arena_Header*)object_ptr;
|
|
||||||
linalloc_clear(&header->arena);
|
|
||||||
zdll_remove(workspace->arena_list.first, workspace->arena_list.last, header);
|
|
||||||
}break;
|
|
||||||
}
|
}
|
||||||
dynamic_workspace_erase_pointer(workspace, lo_id);
|
dynamic_workspace_erase_pointer(workspace, lo_id);
|
||||||
memory_bank_free(&workspace->mem_bank, object_ptr);
|
base_free(&workspace->heap_wrapper, object_ptr);
|
||||||
result = true;
|
result = true;
|
||||||
}
|
}
|
||||||
return(result);
|
return(result);
|
||||||
|
|
|
@ -30,37 +30,6 @@ struct Managed_Buffer_Markers_Header{
|
||||||
Managed_Buffer_Markers_Header *next;
|
Managed_Buffer_Markers_Header *next;
|
||||||
Managed_Buffer_Markers_Header *prev;
|
Managed_Buffer_Markers_Header *prev;
|
||||||
Buffer_ID buffer_id;
|
Buffer_ID buffer_id;
|
||||||
struct Marker_Visual_Data *visual_first;
|
|
||||||
struct Marker_Visual_Data *visual_last;
|
|
||||||
i32 visual_count;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct Marker_Visual_Data{
|
|
||||||
Marker_Visual_Data *next;
|
|
||||||
Marker_Visual_Data *prev;
|
|
||||||
Managed_Object owner_object;
|
|
||||||
u32 slot_id;
|
|
||||||
u32 gen_id;
|
|
||||||
// "Look"
|
|
||||||
Marker_Visual_Type type;
|
|
||||||
u32 color;
|
|
||||||
u32 text_color;
|
|
||||||
Marker_Visual_Text_Style text_style;
|
|
||||||
// "Take Rule"
|
|
||||||
Marker_Visual_Take_Rule take_rule;
|
|
||||||
i32 one_past_last_take_index;
|
|
||||||
// "Priority"
|
|
||||||
Marker_Visual_Priority_Level priority;
|
|
||||||
// "Key View ID"
|
|
||||||
View_ID key_view_id;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct Marker_Visual_Allocator{
|
|
||||||
Marker_Visual_Data *free_first;
|
|
||||||
Marker_Visual_Data *free_last;
|
|
||||||
i32 free_count;
|
|
||||||
i32 total_visual_count;
|
|
||||||
u32_Ptr_Table id_to_ptr_table;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Managed_Arena_Header{
|
struct Managed_Arena_Header{
|
||||||
|
@ -91,32 +60,24 @@ struct Managed_Arena_Header_List{
|
||||||
|
|
||||||
////////////////////////////////
|
////////////////////////////////
|
||||||
|
|
||||||
struct Dynamic_Variable_Slot{
|
struct Managed_ID_Set{
|
||||||
Dynamic_Variable_Slot *next;
|
Arena arena;
|
||||||
Dynamic_Variable_Slot *prev;
|
Table_Data_u64 name_to_id_table;
|
||||||
String_Const_u8 name;
|
Managed_ID id_counter;
|
||||||
u64 default_value;
|
|
||||||
i32 location;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct Dynamic_Variable_Layout{
|
|
||||||
Dynamic_Variable_Slot sentinel;
|
|
||||||
i32 location_counter;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Dynamic_Variable_Block{
|
struct Dynamic_Variable_Block{
|
||||||
u64 *val_array;
|
Arena arena;
|
||||||
i32 count;
|
Table_u64_Data id_to_data_table;
|
||||||
i32 max;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
////////////////////////////////
|
////////////////////////////////
|
||||||
|
|
||||||
struct Dynamic_Workspace{
|
struct Dynamic_Workspace{
|
||||||
Dynamic_Variable_Block var_block;
|
Dynamic_Variable_Block var_block;
|
||||||
Memory_Bank mem_bank;
|
Heap heap;
|
||||||
Marker_Visual_Allocator visual_allocator;
|
Base_Allocator heap_wrapper;
|
||||||
u32_Ptr_Table object_id_to_object_ptr;
|
Table_u64_u64 object_id_to_object_ptr;
|
||||||
u32 object_id_counter;
|
u32 object_id_counter;
|
||||||
u32 visual_id_counter;
|
u32 visual_id_counter;
|
||||||
u32 scope_id;
|
u32 scope_id;
|
||||||
|
@ -169,14 +130,6 @@ struct Lifetime_Key{
|
||||||
global_const u64 LifetimeKeyHash_Empty = 0&(~bit_63);
|
global_const u64 LifetimeKeyHash_Empty = 0&(~bit_63);
|
||||||
global_const u64 LifetimeKeyHash_Deleted = max_u64&(~bit_63);
|
global_const u64 LifetimeKeyHash_Deleted = max_u64&(~bit_63);
|
||||||
|
|
||||||
struct Lifetime_Key_Table{
|
|
||||||
void *mem_ptr;
|
|
||||||
u64 *hashes;
|
|
||||||
Lifetime_Key **keys;
|
|
||||||
u32 count;
|
|
||||||
u32 max;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct Lifetime_Key_Ref_Node_List{
|
struct Lifetime_Key_Ref_Node_List{
|
||||||
Lifetime_Key_Ref_Node *first;
|
Lifetime_Key_Ref_Node *first;
|
||||||
Lifetime_Key_Ref_Node *last;
|
Lifetime_Key_Ref_Node *last;
|
||||||
|
@ -196,12 +149,13 @@ struct Lifetime_Key_List{
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Lifetime_Allocator{
|
struct Lifetime_Allocator{
|
||||||
|
Base_Allocator *allocator;
|
||||||
Lifetime_Key_Ref_Node_List free_key_references;
|
Lifetime_Key_Ref_Node_List free_key_references;
|
||||||
Lifetime_Object_List free_objects;
|
Lifetime_Object_List free_objects;
|
||||||
Lifetime_Key_List free_keys;
|
Lifetime_Key_List free_keys;
|
||||||
Lifetime_Key_Table key_table;
|
Table_Data_u64 key_table;
|
||||||
Ptr_Table key_check_table;
|
Table_u64_u64 key_check_table;
|
||||||
u32_Ptr_Table scope_id_to_scope_ptr_table;
|
Table_u64_u64 scope_id_to_scope_ptr_table;
|
||||||
u32 scope_id_counter;
|
u32 scope_id_counter;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
31
4ed_edit.cpp
31
4ed_edit.cpp
|
@ -10,7 +10,7 @@
|
||||||
// TOP
|
// TOP
|
||||||
|
|
||||||
internal void
|
internal void
|
||||||
edit_pre_state_change(Models *models, Heap *heap, Editing_File *file){
|
edit_pre_state_change(Models *models, Editing_File *file){
|
||||||
System_Functions *system = models->system;
|
System_Functions *system = models->system;
|
||||||
file_add_dirty_flag(file, DirtyState_UnsavedChanges);
|
file_add_dirty_flag(file, DirtyState_UnsavedChanges);
|
||||||
file_unmark_edit_finished(&models->working_set, file);
|
file_unmark_edit_finished(&models->working_set, file);
|
||||||
|
@ -18,7 +18,8 @@ edit_pre_state_change(Models *models, Heap *heap, Editing_File *file){
|
||||||
|
|
||||||
internal void
|
internal void
|
||||||
edit_fix_markers__write_workspace_markers(Dynamic_Workspace *workspace, Buffer_ID buffer_id,
|
edit_fix_markers__write_workspace_markers(Dynamic_Workspace *workspace, Buffer_ID buffer_id,
|
||||||
Cursor_With_Index *cursors, Cursor_With_Index *r_cursors, i32 *cursor_count, i32 *r_cursor_count){
|
Cursor_With_Index *cursors, Cursor_With_Index *r_cursors,
|
||||||
|
i32 *cursor_count, i32 *r_cursor_count){
|
||||||
for (Managed_Buffer_Markers_Header *node = workspace->buffer_markers_list.first;
|
for (Managed_Buffer_Markers_Header *node = workspace->buffer_markers_list.first;
|
||||||
node != 0;
|
node != 0;
|
||||||
node = node->next){
|
node = node->next){
|
||||||
|
@ -189,19 +190,18 @@ edit_single(Models *models, Editing_File *file, Interval_i64 range, String_Const
|
||||||
Assert(edit.range.first <= edit.range.one_past_last);
|
Assert(edit.range.first <= edit.range.one_past_last);
|
||||||
Assert(edit.range.one_past_last <= buffer_size(buffer));
|
Assert(edit.range.one_past_last <= buffer_size(buffer));
|
||||||
|
|
||||||
Heap *heap = &models->mem.heap;
|
|
||||||
Arena *scratch = &models->mem.arena;
|
Arena *scratch = &models->mem.arena;
|
||||||
|
|
||||||
// NOTE(allen): history update
|
// NOTE(allen): history update
|
||||||
if (!behaviors.do_not_post_to_history){
|
if (!behaviors.do_not_post_to_history){
|
||||||
// TODO(allen): if the edit number counter is not updated, maybe auto-merge edits? Wouldn't that just work?
|
// TODO(allen): if the edit number counter is not updated, maybe auto-merge edits? Wouldn't that just work?
|
||||||
history_dump_records_after_index(&file->state.history, file->state.current_record_index);
|
history_dump_records_after_index(&file->state.history, file->state.current_record_index);
|
||||||
history_record_edit(heap, &models->global_history, &file->state.history, buffer, edit);
|
history_record_edit(&models->global_history, &file->state.history, buffer, edit);
|
||||||
file->state.current_record_index = history_get_record_count(&file->state.history);
|
file->state.current_record_index = history_get_record_count(&file->state.history);
|
||||||
}
|
}
|
||||||
|
|
||||||
// NOTE(allen): fixing stuff beforewards????
|
// NOTE(allen): fixing stuff beforewards????
|
||||||
edit_pre_state_change(models, heap, file);
|
edit_pre_state_change(models, file);
|
||||||
|
|
||||||
// NOTE(allen): edit range hook
|
// NOTE(allen): edit range hook
|
||||||
if (models->hook_file_edit_range != 0){
|
if (models->hook_file_edit_range != 0){
|
||||||
|
@ -221,13 +221,9 @@ edit_single(Models *models, Editing_File *file, Interval_i64 range, String_Const
|
||||||
i64 new_line_count = buffer_count_newlines(scratch, buffer, edit.range.first, edit.range.first + edit.text.size);
|
i64 new_line_count = buffer_count_newlines(scratch, buffer, edit.range.first, edit.range.first + edit.text.size);
|
||||||
i64 line_shift = new_line_count - replaced_line_count;
|
i64 line_shift = new_line_count - replaced_line_count;
|
||||||
|
|
||||||
|
file_clear_layout_cache(file);
|
||||||
buffer_remeasure_starts(scratch, buffer, Ii64(line_start, line_end + 1), line_shift, shift_amount);
|
buffer_remeasure_starts(scratch, buffer, Ii64(line_start, line_end + 1), line_shift, shift_amount);
|
||||||
|
|
||||||
// NOTE(allen): token fixing
|
|
||||||
if (file->settings.tokens_exist){
|
|
||||||
file_relex(models->system, models, file, edit.range.first, edit.range.one_past_last, shift_amount);
|
|
||||||
}
|
|
||||||
|
|
||||||
// NOTE(allen): cursor fixing
|
// NOTE(allen): cursor fixing
|
||||||
edit_fix_markers(models, file, edit);
|
edit_fix_markers(models, file, edit);
|
||||||
|
|
||||||
|
@ -240,10 +236,9 @@ file_end_file(Models *models, Editing_File *file){
|
||||||
if (models->hook_end_file != 0){
|
if (models->hook_end_file != 0){
|
||||||
models->hook_end_file(&models->app_links, file->id);
|
models->hook_end_file(&models->app_links, file->id);
|
||||||
}
|
}
|
||||||
Heap *heap = &models->mem.heap;
|
|
||||||
Lifetime_Allocator *lifetime_allocator = &models->lifetime_allocator;
|
Lifetime_Allocator *lifetime_allocator = &models->lifetime_allocator;
|
||||||
lifetime_free_object(heap, lifetime_allocator, file->lifetime_object);
|
lifetime_free_object(lifetime_allocator, file->lifetime_object);
|
||||||
file->lifetime_object = lifetime_alloc_object(heap, lifetime_allocator, DynamicWorkspace_Buffer, file);
|
file->lifetime_object = lifetime_alloc_object(lifetime_allocator, DynamicWorkspace_Buffer, file);
|
||||||
}
|
}
|
||||||
|
|
||||||
internal void
|
internal void
|
||||||
|
@ -375,7 +370,7 @@ edit_merge_history_range(Models *models, Editing_File *file, History_Record_Inde
|
||||||
}break;
|
}break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
history_merge_records(&models->mem.arena, &models->mem.heap, history, first_index, last_index);
|
history_merge_records(&models->mem.arena, history, first_index, last_index);
|
||||||
if (current_index >= last_index){
|
if (current_index >= last_index){
|
||||||
current_index -= (last_index - first_index);
|
current_index -= (last_index - first_index);
|
||||||
}
|
}
|
||||||
|
@ -490,10 +485,10 @@ create_file(Models *models, String_Const_u8 file_name, Buffer_Create_Flag flags)
|
||||||
file = working_set_allocate_file(working_set, &models->lifetime_allocator);
|
file = working_set_allocate_file(working_set, &models->lifetime_allocator);
|
||||||
if (file != 0){
|
if (file != 0){
|
||||||
if (has_canon_name){
|
if (has_canon_name){
|
||||||
file_bind_file_name(system, heap, working_set, file, string_from_file_name(&canon));
|
file_bind_file_name(system, working_set, file, string_from_file_name(&canon));
|
||||||
}
|
}
|
||||||
String_Const_u8 front = string_front_of_path(file_name);
|
String_Const_u8 front = string_front_of_path(file_name);
|
||||||
buffer_bind_name(models, heap, scratch, working_set, file, front);
|
buffer_bind_name(models, scratch, working_set, file, front);
|
||||||
File_Attributes attributes = {};
|
File_Attributes attributes = {};
|
||||||
file_create_from_string(models, file, SCu8(""), attributes);
|
file_create_from_string(models, file, SCu8(""), attributes);
|
||||||
result = file;
|
result = file;
|
||||||
|
@ -515,9 +510,9 @@ create_file(Models *models, String_Const_u8 file_name, Buffer_Create_Flag flags)
|
||||||
system->load_close(handle);
|
system->load_close(handle);
|
||||||
file = working_set_allocate_file(working_set, &models->lifetime_allocator);
|
file = working_set_allocate_file(working_set, &models->lifetime_allocator);
|
||||||
if (file != 0){
|
if (file != 0){
|
||||||
file_bind_file_name(system, heap, working_set, file, string_from_file_name(&canon));
|
file_bind_file_name(system, working_set, file, string_from_file_name(&canon));
|
||||||
String_Const_u8 front = string_front_of_path(file_name);
|
String_Const_u8 front = string_front_of_path(file_name);
|
||||||
buffer_bind_name(models, heap, scratch, working_set, file, front);
|
buffer_bind_name(models, scratch, working_set, file, front);
|
||||||
file_create_from_string(models, file, SCu8(buffer, (i32)attributes.size), attributes);
|
file_create_from_string(models, file, SCu8(buffer, (i32)attributes.size), attributes);
|
||||||
result = file;
|
result = file;
|
||||||
}
|
}
|
||||||
|
|
43
4ed_file.cpp
43
4ed_file.cpp
|
@ -213,8 +213,6 @@ file_compute_cursor(Editing_File *file, Buffer_Seek seek){
|
||||||
internal void
|
internal void
|
||||||
file_create_from_string(Models *models, Editing_File *file, String_Const_u8 val, File_Attributes attributes){
|
file_create_from_string(Models *models, Editing_File *file, String_Const_u8 val, File_Attributes attributes){
|
||||||
System_Functions *system = models->system;
|
System_Functions *system = models->system;
|
||||||
// TODO(allen): completely eliminate the heap, then clean up the implementation or remove it too!
|
|
||||||
Heap *heap = &models->mem.heap;
|
|
||||||
Arena *scratch = &models->mem.arena;
|
Arena *scratch = &models->mem.arena;
|
||||||
Application_Links *app_links = &models->app_links;
|
Application_Links *app_links = &models->app_links;
|
||||||
Base_Allocator *allocator = models->base_allocator;
|
Base_Allocator *allocator = models->base_allocator;
|
||||||
|
@ -232,27 +230,10 @@ file_create_from_string(Models *models, Editing_File *file, String_Const_u8 val,
|
||||||
|
|
||||||
buffer_measure_starts(scratch, &file->state.buffer);
|
buffer_measure_starts(scratch, &file->state.buffer);
|
||||||
|
|
||||||
file->lifetime_object = lifetime_alloc_object(heap, &models->lifetime_allocator, DynamicWorkspace_Buffer, file);
|
file->lifetime_object = lifetime_alloc_object(&models->lifetime_allocator, DynamicWorkspace_Buffer, file);
|
||||||
history_init(&models->app_links, &file->state.history);
|
history_init(&models->app_links, &file->state.history);
|
||||||
|
|
||||||
// TODO(allen): do(cleanup the create and settings dance)
|
|
||||||
// Right now we have this thing where we call hook_open_file, which may or may not
|
|
||||||
// trigger a lex job or serial lex, or might just flag the buffer to say it wants
|
|
||||||
// tokens. Then we check if we need to lex still and do it here too. Better would
|
|
||||||
// be to make sure it always happens in one way.
|
|
||||||
Open_File_Hook_Function *hook_open_file = models->hook_open_file;
|
|
||||||
if (hook_open_file != 0){
|
|
||||||
hook_open_file(app_links, file->id);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (file->settings.tokens_exist){
|
|
||||||
if (file->state.token_array.tokens == 0){
|
|
||||||
file_first_lex(system, models, file);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
file_mark_edit_finished(&models->working_set, file);
|
file_mark_edit_finished(&models->working_set, file);
|
||||||
}
|
|
||||||
|
|
||||||
file->state.cached_layouts_arena = make_arena(allocator);
|
file->state.cached_layouts_arena = make_arena(allocator);
|
||||||
file->state.line_layout_table = make_table_Data_u64(allocator, 500);
|
file->state.line_layout_table = make_table_Data_u64(allocator, 500);
|
||||||
|
@ -268,15 +249,18 @@ file_create_from_string(Models *models, Editing_File *file, String_Const_u8 val,
|
||||||
attributes.last_write_time, string_expand(name));
|
attributes.last_write_time, string_expand(name));
|
||||||
end_temp(temp);
|
end_temp(temp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
////////////////////////////////
|
||||||
|
|
||||||
|
Buffer_Hook_Function *hook_open_file = models->hook_open_file;
|
||||||
|
if (hook_open_file != 0){
|
||||||
|
hook_open_file(app_links, file->id);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
internal void
|
internal void
|
||||||
file_free(System_Functions *system, Heap *heap, Lifetime_Allocator *lifetime_allocator, Working_Set *working_set, Editing_File *file){
|
file_free(System_Functions *system, Lifetime_Allocator *lifetime_allocator, Working_Set *working_set, Editing_File *file){
|
||||||
if (file->state.token_array.tokens){
|
lifetime_free_object(lifetime_allocator, file->lifetime_object);
|
||||||
heap_free(heap, file->state.token_array.tokens);
|
|
||||||
}
|
|
||||||
|
|
||||||
lifetime_free_object(heap, lifetime_allocator, file->lifetime_object);
|
|
||||||
|
|
||||||
Gap_Buffer *buffer = &file->state.buffer;
|
Gap_Buffer *buffer = &file->state.buffer;
|
||||||
if (buffer->data){
|
if (buffer->data){
|
||||||
|
@ -284,7 +268,7 @@ file_free(System_Functions *system, Heap *heap, Lifetime_Allocator *lifetime_all
|
||||||
base_free(buffer->allocator, buffer->line_starts);
|
base_free(buffer->allocator, buffer->line_starts);
|
||||||
}
|
}
|
||||||
|
|
||||||
history_free(heap, &file->state.history);
|
history_free(&file->state.history);
|
||||||
|
|
||||||
linalloc_clear(&file->state.cached_layouts_arena);
|
linalloc_clear(&file->state.cached_layouts_arena);
|
||||||
table_free(&file->state.line_layout_table);
|
table_free(&file->state.line_layout_table);
|
||||||
|
@ -299,11 +283,6 @@ file_get_current_record_index(Editing_File *file){
|
||||||
return(file->state.current_record_index);
|
return(file->state.current_record_index);
|
||||||
}
|
}
|
||||||
|
|
||||||
internal b32
|
|
||||||
file_tokens_are_ready(Editing_File *file){
|
|
||||||
return(file->state.token_array.tokens != 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
internal Managed_Scope
|
internal Managed_Scope
|
||||||
file_get_managed_scope(Editing_File *file){
|
file_get_managed_scope(Editing_File *file){
|
||||||
Managed_Scope scope = 0;
|
Managed_Scope scope = 0;
|
||||||
|
|
|
@ -35,11 +35,8 @@ struct Text_Effect{
|
||||||
|
|
||||||
struct Editing_File_Settings{
|
struct Editing_File_Settings{
|
||||||
i32 base_map_id;
|
i32 base_map_id;
|
||||||
Parse_Context_ID parse_context_id;
|
|
||||||
b32 dos_write_mode;
|
b32 dos_write_mode;
|
||||||
Face_ID face_id;
|
Face_ID face_id;
|
||||||
b8 tokens_exist;
|
|
||||||
b8 tokens_without_strings;
|
|
||||||
b8 is_initialized;
|
b8 is_initialized;
|
||||||
b8 unimportant;
|
b8 unimportant;
|
||||||
b8 read_only;
|
b8 read_only;
|
||||||
|
@ -59,10 +56,6 @@ struct Editing_File_State{
|
||||||
History history;
|
History history;
|
||||||
i32 current_record_index;
|
i32 current_record_index;
|
||||||
|
|
||||||
// TODO(allen): eliminate this too
|
|
||||||
Cpp_Token_Array token_array;
|
|
||||||
b32 in_edit_handler;
|
|
||||||
|
|
||||||
Text_Effect paste_effect;
|
Text_Effect paste_effect;
|
||||||
|
|
||||||
Dirty_State dirty;
|
Dirty_State dirty;
|
||||||
|
|
212
4ed_file_lex.cpp
212
4ed_file_lex.cpp
|
@ -1,212 +0,0 @@
|
||||||
/*
|
|
||||||
* Mr. 4th Dimention - Allen Webster
|
|
||||||
*
|
|
||||||
* 19.08.2018
|
|
||||||
*
|
|
||||||
* Ways of calling lexer for the text in Editing_File
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
// TOP
|
|
||||||
|
|
||||||
internal void
|
|
||||||
file_kill_tokens(System_Functions *system, Heap *heap, Editing_File *file){
|
|
||||||
file->settings.tokens_exist = false;
|
|
||||||
if (file->state.token_array.tokens != 0){
|
|
||||||
heap_free(heap, file->state.token_array.tokens);
|
|
||||||
}
|
|
||||||
block_zero_struct(&file->state.token_array);
|
|
||||||
}
|
|
||||||
|
|
||||||
internal void
|
|
||||||
file_first_lex_serial(System_Functions *system, Models *models, Editing_File *file){
|
|
||||||
Mem_Options *mem = &models->mem;
|
|
||||||
Arena *scratch = &mem->arena;
|
|
||||||
Heap *heap = &mem->heap;
|
|
||||||
file->settings.tokens_exist = true;
|
|
||||||
|
|
||||||
if (file->is_loading == 0){
|
|
||||||
Assert(file->state.token_array.tokens == 0);
|
|
||||||
|
|
||||||
Temp_Memory temp = begin_temp(scratch);
|
|
||||||
|
|
||||||
Parse_Context parse_context = parse_context_get(scratch, &models->parse_context_memory, file->settings.parse_context_id);
|
|
||||||
Assert(parse_context.valid);
|
|
||||||
|
|
||||||
Gap_Buffer *buffer = &file->state.buffer;
|
|
||||||
i64 text_size = buffer_size(buffer);
|
|
||||||
|
|
||||||
// TODO(allen): REWRITE REWRITE REWRITE
|
|
||||||
Cpp_Token_Array new_tokens = {};
|
|
||||||
new_tokens.max_count = Million(1);
|
|
||||||
new_tokens.count = 0;
|
|
||||||
new_tokens.tokens = push_array(scratch, Cpp_Token, new_tokens.max_count);
|
|
||||||
|
|
||||||
b32 still_lexing = true;
|
|
||||||
|
|
||||||
Cpp_Lex_Data lex = cpp_lex_data_init(file->settings.tokens_without_strings, parse_context.kw_table, parse_context.pp_table);
|
|
||||||
|
|
||||||
List_String_Const_u8 chunks = buffer_get_chunks(scratch, buffer);
|
|
||||||
u8 null_terminator = 0;
|
|
||||||
string_list_push(scratch, &chunks, SCu8(&null_terminator, 1));
|
|
||||||
|
|
||||||
Cpp_Token_Array new_array = {};
|
|
||||||
|
|
||||||
for (Node_String_Const_u8 *node = chunks.first;
|
|
||||||
node != 0;){
|
|
||||||
u8 *chunk = node->string.str;
|
|
||||||
umem chunk_size = node->string.size;
|
|
||||||
|
|
||||||
i32 result = cpp_lex_step(&lex, (char*)chunk, (i32)chunk_size, (i32)text_size, &new_tokens, NO_OUT_LIMIT);
|
|
||||||
|
|
||||||
switch (result){
|
|
||||||
case LexResult_NeedChunk:
|
|
||||||
{
|
|
||||||
node = node->next;
|
|
||||||
}break;
|
|
||||||
|
|
||||||
case LexResult_Finished:
|
|
||||||
case LexResult_NeedTokenMemory:
|
|
||||||
{
|
|
||||||
u32 new_max = round_up_u32(new_array.count + new_tokens.count + 1, KB(1));
|
|
||||||
if (new_array.tokens == 0){
|
|
||||||
new_array.tokens = heap_array(heap, Cpp_Token, new_max);
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
u32 old_count = new_array.count;
|
|
||||||
Cpp_Token *new_token_mem = heap_array(heap, Cpp_Token, new_max);
|
|
||||||
memcpy(new_token_mem, new_array.tokens, sizeof(*new_token_mem)*old_count);
|
|
||||||
heap_free(heap, new_array.tokens);
|
|
||||||
new_array.tokens = new_token_mem;
|
|
||||||
}
|
|
||||||
new_array.max_count = new_max;
|
|
||||||
|
|
||||||
Assert(new_array.count + new_tokens.count <= new_array.max_count);
|
|
||||||
memcpy(new_array.tokens + new_array.count, new_tokens.tokens, new_tokens.count*sizeof(Cpp_Token));
|
|
||||||
new_array.count += new_tokens.count;
|
|
||||||
new_tokens.count = 0;
|
|
||||||
|
|
||||||
if (result == LexResult_Finished){
|
|
||||||
still_lexing = false;
|
|
||||||
}
|
|
||||||
}break;
|
|
||||||
|
|
||||||
case LexResult_HitTokenLimit: InvalidPath;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!still_lexing){
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Cpp_Token_Array *token_array = &file->state.token_array;
|
|
||||||
token_array->count = new_array.count;
|
|
||||||
token_array->max_count = new_array.max_count;
|
|
||||||
if (token_array->tokens != 0){
|
|
||||||
heap_free(heap, token_array->tokens);
|
|
||||||
}
|
|
||||||
token_array->tokens = new_array.tokens;
|
|
||||||
|
|
||||||
new_array.tokens = 0;
|
|
||||||
new_array.count = 0;
|
|
||||||
new_array.max_count = 0;
|
|
||||||
|
|
||||||
end_temp(temp);
|
|
||||||
|
|
||||||
file_mark_edit_finished(&models->working_set, file);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
internal b32
|
|
||||||
file_relex_serial(System_Functions *system, Models *models, Editing_File *file, i64 start_i, i64 end_i, i64 shift_amount){
|
|
||||||
Mem_Options *mem = &models->mem;
|
|
||||||
Arena *scratch = &mem->arena;
|
|
||||||
Heap *heap = &mem->heap;
|
|
||||||
|
|
||||||
if (file->state.token_array.tokens == 0){
|
|
||||||
file_first_lex_serial(system, models, file);
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
Gap_Buffer *buffer = &file->state.buffer;
|
|
||||||
Cpp_Token_Array *array = &file->state.token_array;
|
|
||||||
|
|
||||||
Temp_Memory temp = begin_temp(scratch);
|
|
||||||
Parse_Context parse_context = parse_context_get(scratch, &models->parse_context_memory, file->settings.parse_context_id);
|
|
||||||
Assert(parse_context.valid);
|
|
||||||
|
|
||||||
Cpp_Token_Array relex_array = {};
|
|
||||||
relex_array.count = 0;
|
|
||||||
relex_array.max_count = Million(1);
|
|
||||||
relex_array.tokens = push_array(scratch, Cpp_Token, relex_array.max_count);
|
|
||||||
|
|
||||||
i64 size = buffer_size(buffer);
|
|
||||||
|
|
||||||
Cpp_Relex_Data state = cpp_relex_init(array, (i32)start_i, (i32)end_i, (i32)shift_amount, file->settings.tokens_without_strings, parse_context.kw_table, parse_context.pp_table);
|
|
||||||
|
|
||||||
List_String_Const_u8 chunks = buffer_get_chunks(scratch, buffer);
|
|
||||||
u8 null_terminator = 0;
|
|
||||||
string_list_push(scratch, &chunks, SCu8(&null_terminator, 1));
|
|
||||||
Node_String_Const_u8 *node = chunks.first;
|
|
||||||
|
|
||||||
i32 chunk_index = 0;
|
|
||||||
u8 *chunk = 0;
|
|
||||||
umem chunk_size = 0;
|
|
||||||
if (node != 0){
|
|
||||||
chunk = node->string.str;
|
|
||||||
chunk_size = node->string.size;
|
|
||||||
}
|
|
||||||
for (;!cpp_relex_is_start_chunk(&state, (char*)chunk, (i32)chunk_size);){
|
|
||||||
node = node->next;
|
|
||||||
Assert(node != 0);
|
|
||||||
chunk = node->string.str;
|
|
||||||
chunk_size = node->string.size;
|
|
||||||
}
|
|
||||||
for(;;){
|
|
||||||
Cpp_Lex_Result lex_result = cpp_relex_step(&state, (char*)chunk, (i32)chunk_size, (i32)size, array, &relex_array);
|
|
||||||
|
|
||||||
switch (lex_result){
|
|
||||||
case LexResult_NeedChunk:
|
|
||||||
{
|
|
||||||
node = node->next;
|
|
||||||
Assert(node != 0);
|
|
||||||
chunk = node->string.str;
|
|
||||||
chunk_size = node->string.size;
|
|
||||||
}break;
|
|
||||||
|
|
||||||
case LexResult_NeedTokenMemory: InvalidPath;
|
|
||||||
|
|
||||||
case LexResult_Finished: goto doublebreak;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
doublebreak:;
|
|
||||||
|
|
||||||
i32 new_count = cpp_relex_get_new_count(&state, array->count, &relex_array);
|
|
||||||
if (new_count > array->max_count){
|
|
||||||
i32 new_max = round_up_i32(new_count, KB(1));
|
|
||||||
Cpp_Token *new_tokens = heap_array(heap, Cpp_Token, new_max);
|
|
||||||
memcpy(new_tokens, array->tokens, array->count*sizeof(Cpp_Token));
|
|
||||||
heap_free(heap, array->tokens);
|
|
||||||
array->tokens = new_tokens;
|
|
||||||
array->max_count = new_max;
|
|
||||||
}
|
|
||||||
|
|
||||||
cpp_relex_complete(&state, array, &relex_array);
|
|
||||||
|
|
||||||
end_temp(temp);
|
|
||||||
}
|
|
||||||
|
|
||||||
return(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
internal void
|
|
||||||
file_first_lex(System_Functions *system, Models *models, Editing_File *file){
|
|
||||||
file_first_lex_serial(system, models, file);
|
|
||||||
}
|
|
||||||
|
|
||||||
internal void
|
|
||||||
file_relex(System_Functions *system, Models *models, Editing_File *file, i64 start, i64 end, i64 shift_amount){
|
|
||||||
file_relex_serial(system, models, file, start, end, shift_amount);
|
|
||||||
}
|
|
||||||
|
|
||||||
// BOTTOM
|
|
||||||
|
|
|
@ -25,13 +25,14 @@ history__to_node(Node *sentinel, i32 index){
|
||||||
}
|
}
|
||||||
|
|
||||||
internal void
|
internal void
|
||||||
history__push_back_record_ptr(Heap *heap, Record_Ptr_Lookup_Table *lookup, Record *record){
|
history__push_back_record_ptr(Base_Allocator *allocator, Record_Ptr_Lookup_Table *lookup, Record *record){
|
||||||
if (lookup->records == 0 || lookup->count == lookup->max){
|
if (lookup->records == 0 || lookup->count == lookup->max){
|
||||||
i32 new_max = clamp_bot(1024, lookup->max*2);
|
i32 new_max = clamp_bot(1024, lookup->max*2);
|
||||||
Record **new_records = (Record**)heap_allocate(heap, sizeof(Record*)*new_max);
|
Data new_memory = base_allocate(allocator, sizeof(Record*)*new_max);
|
||||||
|
Record **new_records = (Record**)new_memory.data;
|
||||||
block_copy(new_records, lookup->records, sizeof(*new_records)*lookup->count);
|
block_copy(new_records, lookup->records, sizeof(*new_records)*lookup->count);
|
||||||
if (lookup->records != 0){
|
if (lookup->records != 0){
|
||||||
heap_free(heap, lookup->records);
|
base_free(allocator, lookup->records);
|
||||||
}
|
}
|
||||||
lookup->records = new_records;
|
lookup->records = new_records;
|
||||||
lookup->max = new_max;
|
lookup->max = new_max;
|
||||||
|
@ -77,12 +78,13 @@ history__to_node(History *history, i32 index){
|
||||||
////////////////////////////////
|
////////////////////////////////
|
||||||
|
|
||||||
internal Record*
|
internal Record*
|
||||||
history__allocate_record(Heap *heap, History *history){
|
history__allocate_record(History *history){
|
||||||
Node *sentinel = &history->free_records;
|
Node *sentinel = &history->free_records;
|
||||||
Node *new_node = sentinel->next;
|
Node *new_node = sentinel->next;
|
||||||
if (new_node == sentinel){
|
if (new_node == sentinel){
|
||||||
i32 new_record_count = 1024;
|
i32 new_record_count = 1024;
|
||||||
void *memory = memory_bank_allocate(heap, &history->bank, sizeof(Record)*new_record_count);
|
Data new_memory = base_allocate(&history->heap_wrapper, sizeof(Record)*new_record_count);
|
||||||
|
void *memory = new_memory.data;
|
||||||
|
|
||||||
Record *new_record = (Record*)memory;
|
Record *new_record = (Record*)memory;
|
||||||
sentinel->next = &new_record->node;
|
sentinel->next = &new_record->node;
|
||||||
|
@ -130,7 +132,8 @@ internal void
|
||||||
history_init(Application_Links *app, History *history){
|
history_init(Application_Links *app, History *history){
|
||||||
history->activated = true;
|
history->activated = true;
|
||||||
history->arena = make_arena_app_links(app, KB(32));
|
history->arena = make_arena_app_links(app, KB(32));
|
||||||
memory_bank_init(&history->bank);
|
heap_init(&history->heap, history->arena.base_allocator);
|
||||||
|
history->heap_wrapper = base_allocator_on_heap(&history->heap);
|
||||||
dll_init_sentinel(&history->free_records);
|
dll_init_sentinel(&history->free_records);
|
||||||
dll_init_sentinel(&history->records);
|
dll_init_sentinel(&history->records);
|
||||||
history->record_count = 0;
|
history->record_count = 0;
|
||||||
|
@ -143,10 +146,10 @@ history_is_activated(History *history){
|
||||||
}
|
}
|
||||||
|
|
||||||
internal void
|
internal void
|
||||||
history_free(Heap *heap, History *history){
|
history_free(History *history){
|
||||||
if (history->activated){
|
if (history->activated){
|
||||||
linalloc_clear(&history->arena);
|
linalloc_clear(&history->arena);
|
||||||
memory_bank_free_all(heap, &history->bank);
|
heap_free_all(&history->heap);
|
||||||
block_zero_struct(history);
|
block_zero_struct(history);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -196,11 +199,11 @@ history_get_dummy_record(History *history){
|
||||||
}
|
}
|
||||||
|
|
||||||
internal void
|
internal void
|
||||||
history__stash_record(Heap *heap, History *history, Record *new_record){
|
history__stash_record(History *history, Record *new_record){
|
||||||
Assert(history->record_lookup.count == history->record_count);
|
Assert(history->record_lookup.count == history->record_count);
|
||||||
dll_insert_back(&history->records, &new_record->node);
|
dll_insert_back(&history->records, &new_record->node);
|
||||||
history->record_count += 1;
|
history->record_count += 1;
|
||||||
history__push_back_record_ptr(heap, &history->record_lookup, new_record);
|
history__push_back_record_ptr(&history->heap_wrapper, &history->record_lookup, new_record);
|
||||||
Assert(history->record_lookup.count == history->record_count);
|
Assert(history->record_lookup.count == history->record_count);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -238,12 +241,12 @@ history__free_nodes(History *history, i32 first_index, Node *first_node, Node *l
|
||||||
}
|
}
|
||||||
|
|
||||||
internal void
|
internal void
|
||||||
history_record_edit(Heap *heap, Global_History *global_history, History *history, Gap_Buffer *buffer, Edit edit){
|
history_record_edit(Global_History *global_history, History *history, Gap_Buffer *buffer, Edit edit){
|
||||||
if (history->activated){
|
if (history->activated){
|
||||||
Assert(history->record_lookup.count == history->record_count);
|
Assert(history->record_lookup.count == history->record_count);
|
||||||
|
|
||||||
Record *new_record = history__allocate_record(heap, history);
|
Record *new_record = history__allocate_record(history);
|
||||||
history__stash_record(heap, history, new_record);
|
history__stash_record(history, new_record);
|
||||||
|
|
||||||
new_record->restore_point = begin_temp(&history->arena);
|
new_record->restore_point = begin_temp(&history->arena);
|
||||||
new_record->edit_number = global_history_get_edit_number(global_history);
|
new_record->edit_number = global_history_get_edit_number(global_history);
|
||||||
|
@ -353,7 +356,7 @@ history__optimize_group(Arena *scratch, History *history, Record *record){
|
||||||
}
|
}
|
||||||
|
|
||||||
internal void
|
internal void
|
||||||
history_merge_records(Arena *scratch, Heap *heap, History *history, i32 first_index, i32 last_index){
|
history_merge_records(Arena *scratch, History *history, i32 first_index, i32 last_index){
|
||||||
if (history->activated){
|
if (history->activated){
|
||||||
Assert(history->record_lookup.count == history->record_count);
|
Assert(history->record_lookup.count == history->record_count);
|
||||||
Assert(first_index < last_index);
|
Assert(first_index < last_index);
|
||||||
|
@ -362,7 +365,7 @@ history_merge_records(Arena *scratch, Heap *heap, History *history, i32 first_in
|
||||||
Assert(first_node != &history->records && first_node != 0);
|
Assert(first_node != &history->records && first_node != 0);
|
||||||
Assert(last_node != &history->records && last_node != 0);
|
Assert(last_node != &history->records && last_node != 0);
|
||||||
|
|
||||||
Record *new_record = history__allocate_record(heap, history);
|
Record *new_record = history__allocate_record(history);
|
||||||
|
|
||||||
// NOTE(allen): here we remove (last_index - first_index + 1) nodes, and insert 1 node
|
// NOTE(allen): here we remove (last_index - first_index + 1) nodes, and insert 1 node
|
||||||
// which simplifies to this:
|
// which simplifies to this:
|
||||||
|
|
|
@ -45,7 +45,8 @@ struct Record_Ptr_Lookup_Table{
|
||||||
struct History{
|
struct History{
|
||||||
b32 activated;
|
b32 activated;
|
||||||
Arena arena;
|
Arena arena;
|
||||||
Memory_Bank bank;
|
Heap heap;
|
||||||
|
Base_Allocator heap_wrapper;
|
||||||
Node free_records;
|
Node free_records;
|
||||||
Node records;
|
Node records;
|
||||||
i32 record_count;
|
i32 record_count;
|
||||||
|
|
|
@ -1,54 +0,0 @@
|
||||||
/*
|
|
||||||
* Mr. 4th Dimention - Allen Webster
|
|
||||||
*
|
|
||||||
* 07.02.2019
|
|
||||||
*
|
|
||||||
* Memory bank wrapper for heap
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
// TOP
|
|
||||||
|
|
||||||
internal void
|
|
||||||
memory_bank_init(Memory_Bank *mem_bank){
|
|
||||||
heap_init(&mem_bank->heap);
|
|
||||||
mem_bank->first = 0;
|
|
||||||
mem_bank->last = 0;
|
|
||||||
mem_bank->total_memory_size = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
internal void*
|
|
||||||
memory_bank_allocate(Heap *heap, Memory_Bank *mem_bank, i32 size){
|
|
||||||
void *ptr = heap_allocate(&mem_bank->heap, size);
|
|
||||||
if (ptr == 0){
|
|
||||||
i32 alloc_size = clamp_bot(4096, size*4 + sizeof(Memory_Header));
|
|
||||||
void *new_block = heap_allocate(heap, alloc_size);
|
|
||||||
if (new_block != 0){
|
|
||||||
Memory_Header *header = (Memory_Header*)new_block;
|
|
||||||
sll_queue_push(mem_bank->first, mem_bank->last, header);
|
|
||||||
mem_bank->total_memory_size += alloc_size;
|
|
||||||
heap_extend(&mem_bank->heap, header + 1, alloc_size - sizeof(*header));
|
|
||||||
ptr = heap_allocate(&mem_bank->heap, size);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return(ptr);
|
|
||||||
}
|
|
||||||
|
|
||||||
internal void
|
|
||||||
memory_bank_free(Memory_Bank *mem_bank, void *ptr){
|
|
||||||
heap_free(&mem_bank->heap, ptr);
|
|
||||||
}
|
|
||||||
|
|
||||||
internal void
|
|
||||||
memory_bank_free_all(Heap *heap, Memory_Bank *mem_bank){
|
|
||||||
for (Memory_Header *header = mem_bank->first, *next = 0;
|
|
||||||
header != 0;
|
|
||||||
header = next){
|
|
||||||
next = header->next;
|
|
||||||
heap_free(heap, header);
|
|
||||||
}
|
|
||||||
mem_bank->total_memory_size = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
// BOTTOM
|
|
||||||
|
|
|
@ -1,29 +0,0 @@
|
||||||
/*
|
|
||||||
* Mr. 4th Dimention - Allen Webster
|
|
||||||
*
|
|
||||||
* 07.02.2019
|
|
||||||
*
|
|
||||||
* Memory bank wrapper for heap
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
// TOP
|
|
||||||
|
|
||||||
#if !defined(FRED_MEMORY_BANK_H)
|
|
||||||
#define FRED_MEMORY_BANK_H
|
|
||||||
|
|
||||||
struct Memory_Header{
|
|
||||||
Memory_Header *next;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct Memory_Bank{
|
|
||||||
Heap heap;
|
|
||||||
Memory_Header *first;
|
|
||||||
Memory_Header *last;
|
|
||||||
umem total_memory_size;
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// BOTTOM
|
|
||||||
|
|
|
@ -1,178 +0,0 @@
|
||||||
/*
|
|
||||||
* Mr. 4th Dimention - Allen Webster
|
|
||||||
*
|
|
||||||
* 19.05.2017
|
|
||||||
*
|
|
||||||
* Parse contexts allocation and locking
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
// TOP
|
|
||||||
|
|
||||||
internal void
|
|
||||||
parse_context_init_memory(Parse_Context_Memory *parse_mem, void *mem, umem memsize){
|
|
||||||
parse_mem->free_list = 0;
|
|
||||||
|
|
||||||
parse_mem->parse_context_array = (Stored_Parse_Context_Slot*)mem;
|
|
||||||
parse_mem->parse_context_counter = 0;
|
|
||||||
parse_mem->parse_context_max = (u32)(memsize/sizeof(*parse_mem->parse_context_array));
|
|
||||||
}
|
|
||||||
|
|
||||||
internal Parse_Context_ID
|
|
||||||
parse_context_valid_id(Parse_Context_Memory *parse_mem, Parse_Context_ID id){
|
|
||||||
Parse_Context_ID valid_id = 0;
|
|
||||||
if (id > parse_mem->parse_context_max && id < parse_mem->parse_context_max*2){
|
|
||||||
valid_id = id;
|
|
||||||
}
|
|
||||||
return(valid_id);
|
|
||||||
}
|
|
||||||
|
|
||||||
internal Parse_Context_ID
|
|
||||||
parse_context_add(Parse_Context_Memory *parse_mem, Heap *heap, Parser_String_And_Type *kw_sats, u32 kw_count, Parser_String_And_Type *pp_sats, u32 pp_count){
|
|
||||||
Stored_Parse_Context_Slot *slot = 0;
|
|
||||||
if (parse_mem->free_list != 0){
|
|
||||||
slot = parse_mem->free_list;
|
|
||||||
sll_stack_pop(parse_mem->free_list);
|
|
||||||
}
|
|
||||||
else if (parse_mem->parse_context_counter < parse_mem->parse_context_max){
|
|
||||||
slot = &parse_mem->parse_context_array[parse_mem->parse_context_counter++];
|
|
||||||
}
|
|
||||||
|
|
||||||
u32 result = 0;
|
|
||||||
if (slot != 0){
|
|
||||||
u32 stride = sizeof(*kw_sats);
|
|
||||||
umem kw_memsize = cpp_get_table_memory_size_string_lengths(&kw_sats->length, stride, kw_count);
|
|
||||||
umem pp_memsize = cpp_get_table_memory_size_string_lengths(&pp_sats->length, stride, pp_count);
|
|
||||||
|
|
||||||
umem memsize = kw_memsize + pp_memsize + sizeof(Stored_Parse_Context);
|
|
||||||
void *mem = heap_allocate(heap, (i32)memsize);
|
|
||||||
|
|
||||||
Stored_Parse_Context *parse_context = (Stored_Parse_Context*)mem;
|
|
||||||
u8 *kw_mem = (u8*)(parse_context+1);
|
|
||||||
u8 *pp_mem = kw_mem + kw_memsize;
|
|
||||||
|
|
||||||
Cpp_Keyword_Table kw_table = cpp_make_table(&kw_sats->str, stride, &kw_sats->length, stride, &kw_sats->type, stride, kw_count, kw_mem, kw_memsize);
|
|
||||||
|
|
||||||
Cpp_Keyword_Table pp_table = cpp_make_table(&pp_sats->str, stride, &pp_sats->length, stride, &pp_sats->type, stride, pp_count, pp_mem, pp_memsize);
|
|
||||||
|
|
||||||
parse_context->memsize = memsize;
|
|
||||||
parse_context->kw_keywords = kw_table.keywords;
|
|
||||||
parse_context->pp_keywords = pp_table.keywords;
|
|
||||||
parse_context->kw_max = kw_table.max;
|
|
||||||
parse_context->pp_max = pp_table.max;
|
|
||||||
slot->context = parse_context;
|
|
||||||
slot->freed = false;
|
|
||||||
|
|
||||||
result = (u32)(slot - parse_mem->parse_context_array) + parse_mem->parse_context_max;
|
|
||||||
}
|
|
||||||
|
|
||||||
return(result);
|
|
||||||
}
|
|
||||||
|
|
||||||
internal u32
|
|
||||||
parse_context_add_default(Parse_Context_Memory *parse_mem, Heap *heap){
|
|
||||||
Stored_Parse_Context_Slot *slot = 0;
|
|
||||||
if (parse_mem->free_list != 0){
|
|
||||||
slot = parse_mem->free_list;
|
|
||||||
sll_stack_pop(parse_mem->free_list);
|
|
||||||
}
|
|
||||||
else if (parse_mem->parse_context_counter < parse_mem->parse_context_max){
|
|
||||||
slot = &parse_mem->parse_context_array[parse_mem->parse_context_counter++];
|
|
||||||
}
|
|
||||||
|
|
||||||
u32 result = 0;
|
|
||||||
if (slot != 0){
|
|
||||||
umem kw_memsize = cpp_get_table_memory_size_default(CPP_TABLE_KEYWORDS);
|
|
||||||
umem pp_memsize = cpp_get_table_memory_size_default(CPP_TABLE_PREPROCESSOR_DIRECTIVES);
|
|
||||||
|
|
||||||
umem memsize = kw_memsize + pp_memsize + sizeof(Stored_Parse_Context);
|
|
||||||
void *mem = heap_allocate(heap, (i32)(memsize));
|
|
||||||
|
|
||||||
Stored_Parse_Context *parse_context = (Stored_Parse_Context*)mem;
|
|
||||||
u8 *kw_mem = (u8*)(parse_context+1);
|
|
||||||
u8 *pp_mem = kw_mem + kw_memsize;
|
|
||||||
|
|
||||||
Cpp_Keyword_Table kw_table = cpp_make_table_default(CPP_TABLE_KEYWORDS, kw_mem, kw_memsize);
|
|
||||||
Cpp_Keyword_Table pp_table = cpp_make_table_default(CPP_TABLE_PREPROCESSOR_DIRECTIVES, pp_mem, pp_memsize);
|
|
||||||
|
|
||||||
parse_context->memsize = memsize;
|
|
||||||
parse_context->kw_keywords = kw_table.keywords;
|
|
||||||
parse_context->pp_keywords = pp_table.keywords;
|
|
||||||
parse_context->kw_max = kw_table.max;
|
|
||||||
parse_context->pp_max = pp_table.max;
|
|
||||||
slot->context = parse_context;
|
|
||||||
slot->freed = false;
|
|
||||||
|
|
||||||
result = (u32)(slot - parse_mem->parse_context_array) + parse_mem->parse_context_max;
|
|
||||||
}
|
|
||||||
|
|
||||||
return(result);
|
|
||||||
}
|
|
||||||
|
|
||||||
internal Stored_Parse_Context_Slot*
|
|
||||||
parse_context_get_slot(Parse_Context_Memory *parse_mem, Parse_Context_ID id){
|
|
||||||
Stored_Parse_Context_Slot *slot = 0;
|
|
||||||
if (id == 0){
|
|
||||||
// do nothing
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
id -= parse_mem->parse_context_max;
|
|
||||||
}
|
|
||||||
if (id < parse_mem->parse_context_counter){
|
|
||||||
slot = &parse_mem->parse_context_array[id];
|
|
||||||
if (slot->freed){
|
|
||||||
slot = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return(slot);
|
|
||||||
}
|
|
||||||
|
|
||||||
internal Parse_Context
|
|
||||||
parse_context_get(Parse_Context_Memory *parse_mem, Parse_Context_ID id, void *mem, umem memsize){
|
|
||||||
Stored_Parse_Context_Slot *slot = parse_context_get_slot(parse_mem, id);
|
|
||||||
Parse_Context result = {};
|
|
||||||
if (slot != 0){
|
|
||||||
Stored_Parse_Context *context = slot->context;
|
|
||||||
if (context->memsize < memsize){
|
|
||||||
u8 *base_ptr = (u8*)context;
|
|
||||||
u8 *kw_keywords = (u8*)mem + (((u8*)context->kw_keywords) - base_ptr);
|
|
||||||
u8 *pp_keywords = (u8*)mem + (((u8*)context->pp_keywords) - base_ptr);
|
|
||||||
result.valid = true;
|
|
||||||
result.kw_table.keywords = (u64*)kw_keywords;
|
|
||||||
result.pp_table.keywords = (u64*)pp_keywords;
|
|
||||||
result.kw_table.max = context->kw_max;
|
|
||||||
result.pp_table.max = context->pp_max;
|
|
||||||
result.memory_size = context->memsize;
|
|
||||||
memcpy(mem, context, context->memsize);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return(result);
|
|
||||||
}
|
|
||||||
|
|
||||||
internal Parse_Context
|
|
||||||
parse_context_get(Arena *arena, Parse_Context_Memory *parse_mem, Parse_Context_ID id){
|
|
||||||
Stored_Parse_Context_Slot *slot = parse_context_get_slot(parse_mem, id);
|
|
||||||
Parse_Context result = {};
|
|
||||||
if (slot != 0){
|
|
||||||
Stored_Parse_Context *context = slot->context;
|
|
||||||
umem memsize = context->memsize + 1;
|
|
||||||
u8 *mem = push_array(arena, u8, memsize);
|
|
||||||
result = parse_context_get(parse_mem, id, mem, memsize);
|
|
||||||
}
|
|
||||||
return(result);
|
|
||||||
}
|
|
||||||
|
|
||||||
internal void
|
|
||||||
parse_context_rebase(Parse_Context *parse_mem, void *old_base, void *new_base){
|
|
||||||
u8 *old_base_ptr = (u8*)old_base;
|
|
||||||
u8 *new_base_ptr = (u8*)new_base;
|
|
||||||
|
|
||||||
u8 *ptr = (u8*)parse_mem->kw_table.keywords;
|
|
||||||
parse_mem->kw_table.keywords = (u64*)(ptr + (new_base_ptr - old_base_ptr));
|
|
||||||
|
|
||||||
ptr = (u8*)parse_mem->pp_table.keywords;
|
|
||||||
parse_mem->pp_table.keywords = (u64*)(ptr + (new_base_ptr - old_base_ptr));
|
|
||||||
}
|
|
||||||
|
|
||||||
// BOTTOM
|
|
||||||
|
|
|
@ -1,361 +0,0 @@
|
||||||
/*
|
|
||||||
* Mr. 4th Dimention - Allen Webster
|
|
||||||
*
|
|
||||||
* 26.08.2018
|
|
||||||
*
|
|
||||||
* Pointer check table
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
// TOP
|
|
||||||
|
|
||||||
internal Ptr_Table
|
|
||||||
make_Ptr_table(void *mem, umem size){
|
|
||||||
Ptr_Table table = {};
|
|
||||||
i32 max = (i32)(size/8);
|
|
||||||
if (max > 0){
|
|
||||||
table.mem = mem;
|
|
||||||
u8 *cursor = (u8*)mem;
|
|
||||||
table.hashes = (u64*)cursor;
|
|
||||||
cursor += 8*max;
|
|
||||||
table.count = 0;
|
|
||||||
table.max = max;
|
|
||||||
block_fill_ones(table.hashes, sizeof(*table.hashes)*max);
|
|
||||||
}
|
|
||||||
return(table);
|
|
||||||
}
|
|
||||||
|
|
||||||
internal i32
|
|
||||||
max_to_memsize_Ptr_table(i32 max){
|
|
||||||
return(max*8);
|
|
||||||
}
|
|
||||||
|
|
||||||
internal b32
|
|
||||||
at_max_Ptr_table(Ptr_Table *table){
|
|
||||||
if (table->max > 0 && (table->count + 1)*8 <= table->max*7){
|
|
||||||
return(false);
|
|
||||||
}
|
|
||||||
return(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
internal b32
|
|
||||||
insert_Ptr_table(Ptr_Table *table, void**key){
|
|
||||||
i32 max = table->max;
|
|
||||||
if (max > 0){
|
|
||||||
i32 count = table->count;
|
|
||||||
if ((count + 1)*8 <= max*7){
|
|
||||||
u64 hash = 0;
|
|
||||||
block_copy(&hash, key, 8);
|
|
||||||
if (hash >= 18446744073709551614ULL){ hash += 2; }
|
|
||||||
i32 first_index = hash%max;
|
|
||||||
i32 index = first_index;
|
|
||||||
u64 *hashes = table->hashes;
|
|
||||||
for (;;){
|
|
||||||
if (hashes[index] == 18446744073709551615ULL){
|
|
||||||
table->dirty_slot_count += 1;
|
|
||||||
}
|
|
||||||
if (hashes[index] == 18446744073709551615ULL || hashes[index] == 18446744073709551614ULL){
|
|
||||||
hashes[index] = hash;
|
|
||||||
table->count += 1;
|
|
||||||
return(true);
|
|
||||||
}
|
|
||||||
if (hashes[index] == hash) return(false);
|
|
||||||
index = (index + 1)%max;
|
|
||||||
if (index == first_index) return(false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
internal b32
|
|
||||||
lookup_Ptr_table(Ptr_Table *table, void**key){
|
|
||||||
i32 max = table->max;
|
|
||||||
if (max > 0){
|
|
||||||
u64 hash = 0;
|
|
||||||
block_copy(&hash, key, 8);
|
|
||||||
if (hash >= 18446744073709551614ULL){ hash += 2; }
|
|
||||||
i32 first_index = hash%max;
|
|
||||||
i32 index = first_index;
|
|
||||||
u64 *hashes = table->hashes;
|
|
||||||
for (;;){
|
|
||||||
if (hashes[index] == 18446744073709551615ULL) break;
|
|
||||||
if (hashes[index] == hash){
|
|
||||||
return(true);
|
|
||||||
}
|
|
||||||
index = (index + 1)%max;
|
|
||||||
if (index == first_index) break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
internal b32
|
|
||||||
erase_Ptr_table(Ptr_Table *table, void**key){
|
|
||||||
i32 max = table->max;
|
|
||||||
if (max > 0 && table->count > 0){
|
|
||||||
u64 hash = 0;
|
|
||||||
block_copy(&hash, key, 8);
|
|
||||||
if (hash >= 18446744073709551614ULL){ hash += 2; }
|
|
||||||
i32 first_index = hash%max;
|
|
||||||
i32 index = first_index;
|
|
||||||
u64 *hashes = table->hashes;
|
|
||||||
for (;;){
|
|
||||||
if (hashes[index] == 18446744073709551615ULL) break;
|
|
||||||
if (hashes[index] == hash){
|
|
||||||
hashes[index] = 18446744073709551614ULL;
|
|
||||||
table->count -= 1;
|
|
||||||
return(true);
|
|
||||||
}
|
|
||||||
index = (index + 1)%max;
|
|
||||||
if (index == first_index) break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
internal b32
|
|
||||||
move_Ptr_table(Ptr_Table *dst_table, Ptr_Table *src_table){
|
|
||||||
if ((src_table->count + dst_table->count)*8 <= dst_table->max*7){
|
|
||||||
i32 max = src_table->max;
|
|
||||||
u64 *hashes = src_table->hashes;
|
|
||||||
for (i32 index = 0; index < max; index += 1){
|
|
||||||
if (hashes[index] != 18446744073709551615ULL && hashes[index] != 18446744073709551614ULL){
|
|
||||||
void* key_;
|
|
||||||
void**key = &key_;
|
|
||||||
block_copy(key, &hashes[index], 8);
|
|
||||||
insert_Ptr_table(dst_table, key);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return(true);
|
|
||||||
}
|
|
||||||
return(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
internal b32
|
|
||||||
insert_Ptr_table(Ptr_Table *table, void* key){
|
|
||||||
return(insert_Ptr_table(table, &key));
|
|
||||||
}
|
|
||||||
|
|
||||||
internal b32
|
|
||||||
lookup_Ptr_table(Ptr_Table *table, void* key){
|
|
||||||
return(lookup_Ptr_table(table, &key));
|
|
||||||
}
|
|
||||||
|
|
||||||
internal b32
|
|
||||||
erase_Ptr_table(Ptr_Table *table, void* key){
|
|
||||||
return(erase_Ptr_table(table, &key));
|
|
||||||
}
|
|
||||||
|
|
||||||
////////////////////////////////
|
|
||||||
|
|
||||||
internal void
|
|
||||||
insert_Ptr_table(Heap *heap, Ptr_Table *table, void* key){
|
|
||||||
if (at_max_Ptr_table(table)){
|
|
||||||
i32 new_max = (table->max + 1)*2;
|
|
||||||
i32 new_mem_size = max_to_memsize_Ptr_table(new_max);
|
|
||||||
void *new_mem = heap_allocate(heap, new_mem_size);
|
|
||||||
Ptr_Table new_table = make_Ptr_table(new_mem, new_mem_size);
|
|
||||||
if (table->mem != 0){
|
|
||||||
b32 result = move_Ptr_table(&new_table, table);
|
|
||||||
Assert(result);
|
|
||||||
heap_free(heap, table->mem);
|
|
||||||
}
|
|
||||||
*table = new_table;
|
|
||||||
}
|
|
||||||
b32 result = insert_Ptr_table(table, &key);
|
|
||||||
Assert(result);
|
|
||||||
}
|
|
||||||
|
|
||||||
////////////////////////////////
|
|
||||||
|
|
||||||
internal u32_Ptr_Table
|
|
||||||
make_u32_Ptr_table(void *mem, umem size){
|
|
||||||
u32_Ptr_Table table = {};
|
|
||||||
i32 max = (i32)(size/16);
|
|
||||||
if (max > 0){
|
|
||||||
table.mem = mem;
|
|
||||||
u8 *cursor = (u8*)mem;
|
|
||||||
table.hashes = (u64*)cursor;
|
|
||||||
cursor += 8*max;
|
|
||||||
table.vals = (void**)cursor;
|
|
||||||
table.count = 0;
|
|
||||||
table.max = max;
|
|
||||||
block_fill_ones(table.hashes, sizeof(*table.hashes)*max);
|
|
||||||
}
|
|
||||||
return(table);
|
|
||||||
}
|
|
||||||
|
|
||||||
internal i32
|
|
||||||
max_to_memsize_u32_Ptr_table(i32 max){
|
|
||||||
return(max*16);
|
|
||||||
}
|
|
||||||
|
|
||||||
internal b32
|
|
||||||
at_max_u32_Ptr_table(u32_Ptr_Table *table){
|
|
||||||
if (table->max > 0 && (table->count + 1)*8 <= table->max*7){
|
|
||||||
return(false);
|
|
||||||
}
|
|
||||||
return(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
internal b32
|
|
||||||
insert_u32_Ptr_table(u32_Ptr_Table *table, u32*key, void**val){
|
|
||||||
i32 max = table->max;
|
|
||||||
if (max > 0){
|
|
||||||
i32 count = table->count;
|
|
||||||
if ((count + 1)*8 <= max*7){
|
|
||||||
u64 hash = 0;
|
|
||||||
block_copy(&hash, key, 4);
|
|
||||||
if (hash >= 18446744073709551614ULL){ hash += 2; }
|
|
||||||
i32 first_index = hash%max;
|
|
||||||
i32 index = first_index;
|
|
||||||
u64 *hashes = table->hashes;
|
|
||||||
for (;;){
|
|
||||||
if (hashes[index] == 18446744073709551615ULL){
|
|
||||||
table->dirty_slot_count += 1;
|
|
||||||
}
|
|
||||||
if (hashes[index] == 18446744073709551615ULL || hashes[index] == 18446744073709551614ULL){
|
|
||||||
hashes[index] = hash;
|
|
||||||
table->vals[index] = *val;
|
|
||||||
table->count += 1;
|
|
||||||
return(true);
|
|
||||||
}
|
|
||||||
if (hashes[index] == hash) return(false);
|
|
||||||
index = (index + 1)%max;
|
|
||||||
if (index == first_index) return(false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
internal u32_Ptr_Lookup_Result
|
|
||||||
lookup_u32_Ptr_table(u32_Ptr_Table *table, u32*key){
|
|
||||||
u32_Ptr_Lookup_Result result = {};
|
|
||||||
i32 max = table->max;
|
|
||||||
if (max > 0){
|
|
||||||
u64 hash = 0;
|
|
||||||
block_copy(&hash, key, 4);
|
|
||||||
if (hash >= 18446744073709551614ULL){ hash += 2; }
|
|
||||||
i32 first_index = hash%max;
|
|
||||||
i32 index = first_index;
|
|
||||||
u64 *hashes = table->hashes;
|
|
||||||
for (;;){
|
|
||||||
if (hashes[index] == 18446744073709551615ULL) break;
|
|
||||||
if (hashes[index] == hash){
|
|
||||||
result.success = true;
|
|
||||||
result.val = &table->vals[index];
|
|
||||||
return(result);
|
|
||||||
}
|
|
||||||
index = (index + 1)%max;
|
|
||||||
if (index == first_index) break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return(result);
|
|
||||||
}
|
|
||||||
|
|
||||||
internal b32
|
|
||||||
erase_u32_Ptr_table(u32_Ptr_Table *table, u32*key){
|
|
||||||
i32 max = table->max;
|
|
||||||
if (max > 0 && table->count > 0){
|
|
||||||
u64 hash = 0;
|
|
||||||
block_copy(&hash, key, 4);
|
|
||||||
if (hash >= 18446744073709551614ULL){ hash += 2; }
|
|
||||||
i32 first_index = hash%max;
|
|
||||||
i32 index = first_index;
|
|
||||||
u64 *hashes = table->hashes;
|
|
||||||
for (;;){
|
|
||||||
if (hashes[index] == 18446744073709551615ULL) break;
|
|
||||||
if (hashes[index] == hash){
|
|
||||||
hashes[index] = 18446744073709551614ULL;
|
|
||||||
table->count -= 1;
|
|
||||||
return(true);
|
|
||||||
}
|
|
||||||
index = (index + 1)%max;
|
|
||||||
if (index == first_index) break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
internal b32
|
|
||||||
move_u32_Ptr_table(u32_Ptr_Table *dst_table, u32_Ptr_Table *src_table){
|
|
||||||
if ((src_table->count + dst_table->count)*8 <= dst_table->max*7){
|
|
||||||
i32 max = src_table->max;
|
|
||||||
u64 *hashes = src_table->hashes;
|
|
||||||
for (i32 index = 0; index < max; index += 1){
|
|
||||||
if (hashes[index] != 18446744073709551615ULL && hashes[index] != 18446744073709551614ULL){
|
|
||||||
u32 key_;
|
|
||||||
u32*key = &key_;
|
|
||||||
block_copy(key, &hashes[index], 4);
|
|
||||||
void**val = &src_table->vals[index];
|
|
||||||
insert_u32_Ptr_table(dst_table, key, val);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return(true);
|
|
||||||
}
|
|
||||||
return(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
internal b32
|
|
||||||
lookup_u32_Ptr_table(u32_Ptr_Table *table, u32 *key, void* *val_out){
|
|
||||||
u32_Ptr_Lookup_Result result = lookup_u32_Ptr_table(table, key);
|
|
||||||
if (result.success){
|
|
||||||
*val_out = *result.val;
|
|
||||||
}
|
|
||||||
return(result.success);
|
|
||||||
}
|
|
||||||
|
|
||||||
internal b32
|
|
||||||
insert_u32_Ptr_table(u32_Ptr_Table *table, u32*key, void* val){
|
|
||||||
return(insert_u32_Ptr_table(table, key, &val));
|
|
||||||
}
|
|
||||||
|
|
||||||
internal b32
|
|
||||||
insert_u32_Ptr_table(u32_Ptr_Table *table, u32 key, void**val){
|
|
||||||
return(insert_u32_Ptr_table(table, &key, val));
|
|
||||||
}
|
|
||||||
|
|
||||||
internal b32
|
|
||||||
insert_u32_Ptr_table(u32_Ptr_Table *table, u32 key, void* val){
|
|
||||||
return(insert_u32_Ptr_table(table, &key, &val));
|
|
||||||
}
|
|
||||||
|
|
||||||
internal u32_Ptr_Lookup_Result
|
|
||||||
lookup_u32_Ptr_table(u32_Ptr_Table *table, u32 key){
|
|
||||||
return(lookup_u32_Ptr_table(table, &key));
|
|
||||||
}
|
|
||||||
|
|
||||||
internal b32
|
|
||||||
lookup_u32_Ptr_table(u32_Ptr_Table *table, u32 key, void* *val_out){
|
|
||||||
return(lookup_u32_Ptr_table(table, &key, val_out));
|
|
||||||
}
|
|
||||||
|
|
||||||
internal b32
|
|
||||||
erase_u32_Ptr_table(u32_Ptr_Table *table, u32 key){
|
|
||||||
return(erase_u32_Ptr_table(table, &key));
|
|
||||||
}
|
|
||||||
|
|
||||||
////////////////////////////////
|
|
||||||
|
|
||||||
internal void
|
|
||||||
insert_u32_Ptr_table(Heap *heap, u32_Ptr_Table *table, u32 key, void* val){
|
|
||||||
if (at_max_u32_Ptr_table(table)){
|
|
||||||
i32 new_max = (table->max + 1)*2;
|
|
||||||
i32 new_mem_size = max_to_memsize_u32_Ptr_table(new_max);
|
|
||||||
void *new_mem = heap_allocate(heap, new_mem_size);
|
|
||||||
u32_Ptr_Table new_table = make_u32_Ptr_table(new_mem, new_mem_size);
|
|
||||||
if (table->mem != 0){
|
|
||||||
b32 result = move_u32_Ptr_table(&new_table, table);
|
|
||||||
Assert(result);
|
|
||||||
heap_free(heap, table->mem);
|
|
||||||
}
|
|
||||||
*table = new_table;
|
|
||||||
}
|
|
||||||
b32 result = insert_u32_Ptr_table(table, &key, &val);
|
|
||||||
Assert(result);
|
|
||||||
}
|
|
||||||
|
|
||||||
// BOTTOM
|
|
||||||
|
|
|
@ -1,39 +0,0 @@
|
||||||
/*
|
|
||||||
* Mr. 4th Dimention - Allen Webster
|
|
||||||
*
|
|
||||||
* 26.08.2018
|
|
||||||
*
|
|
||||||
* Pointer check table
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
// TOP
|
|
||||||
|
|
||||||
#if !defined(FRED_POINTER_CHECK_H)
|
|
||||||
#define FRED_POINTER_CHECK_H
|
|
||||||
|
|
||||||
struct Ptr_Table{
|
|
||||||
void *mem;
|
|
||||||
u64 *hashes;
|
|
||||||
i32 count;
|
|
||||||
i32 dirty_slot_count;
|
|
||||||
i32 max;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct u32_Ptr_Lookup_Result{
|
|
||||||
b32 success;
|
|
||||||
void**val;
|
|
||||||
};
|
|
||||||
struct u32_Ptr_Table{
|
|
||||||
void *mem;
|
|
||||||
u64 *hashes;
|
|
||||||
void**vals;
|
|
||||||
i32 count;
|
|
||||||
i32 dirty_slot_count;
|
|
||||||
i32 max;
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// BOTTOM
|
|
||||||
|
|
12
4ed_view.cpp
12
4ed_view.cpp
|
@ -40,7 +40,7 @@ view_get_id(Live_Views *live_set, View *view){
|
||||||
}
|
}
|
||||||
|
|
||||||
internal View*
|
internal View*
|
||||||
live_set_alloc_view(Heap *heap, Lifetime_Allocator *lifetime_allocator, Live_Views *live_set, Panel *panel){
|
live_set_alloc_view(Lifetime_Allocator *lifetime_allocator, Live_Views *live_set, Panel *panel){
|
||||||
Assert(live_set->count < live_set->max);
|
Assert(live_set->count < live_set->max);
|
||||||
++live_set->count;
|
++live_set->count;
|
||||||
|
|
||||||
|
@ -50,7 +50,7 @@ live_set_alloc_view(Heap *heap, Lifetime_Allocator *lifetime_allocator, Live_Vie
|
||||||
|
|
||||||
result->in_use = true;
|
result->in_use = true;
|
||||||
init_query_set(&result->query_set);
|
init_query_set(&result->query_set);
|
||||||
result->lifetime_object = lifetime_alloc_object(heap, lifetime_allocator, DynamicWorkspace_View, result);
|
result->lifetime_object = lifetime_alloc_object(lifetime_allocator, DynamicWorkspace_View, result);
|
||||||
panel->view = result;
|
panel->view = result;
|
||||||
result->panel = panel;
|
result->panel = panel;
|
||||||
|
|
||||||
|
@ -58,7 +58,7 @@ live_set_alloc_view(Heap *heap, Lifetime_Allocator *lifetime_allocator, Live_Vie
|
||||||
}
|
}
|
||||||
|
|
||||||
internal void
|
internal void
|
||||||
live_set_free_view(Heap *heap, Lifetime_Allocator *lifetime_allocator, Live_Views *live_set, View *view){
|
live_set_free_view(Lifetime_Allocator *lifetime_allocator, Live_Views *live_set, View *view){
|
||||||
Assert(live_set->count > 0);
|
Assert(live_set->count > 0);
|
||||||
--live_set->count;
|
--live_set->count;
|
||||||
|
|
||||||
|
@ -68,7 +68,7 @@ live_set_free_view(Heap *heap, Lifetime_Allocator *lifetime_allocator, Live_View
|
||||||
view->next->prev = view;
|
view->next->prev = view;
|
||||||
view->in_use = false;
|
view->in_use = false;
|
||||||
|
|
||||||
lifetime_free_object(heap, lifetime_allocator, view->lifetime_object);
|
lifetime_free_object(lifetime_allocator, view->lifetime_object);
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////
|
////////////////////////////////
|
||||||
|
@ -465,7 +465,7 @@ finalize_color(Color_Table color_table, int_color color){
|
||||||
}
|
}
|
||||||
|
|
||||||
internal u32
|
internal u32
|
||||||
get_token_color(Color_Table color_table, Cpp_Token token){
|
get_token_color(Color_Table color_table, Token token){
|
||||||
u32 result = 0;
|
u32 result = 0;
|
||||||
if ((token.flags & CPP_TFLAG_IS_KEYWORD) != 0){
|
if ((token.flags & CPP_TFLAG_IS_KEYWORD) != 0){
|
||||||
if (cpp_token_category_from_type(token.type) == CPP_TOKEN_CAT_BOOLEAN_CONSTANT){
|
if (cpp_token_category_from_type(token.type) == CPP_TOKEN_CAT_BOOLEAN_CONSTANT){
|
||||||
|
@ -568,7 +568,7 @@ render_loaded_file_in_view__inner(Models *models, Render_Target *target, View *v
|
||||||
// NOTE(allen): Token scanning
|
// NOTE(allen): Token scanning
|
||||||
u32 highlight_this_color = 0;
|
u32 highlight_this_color = 0;
|
||||||
if (tokens_use && ind != prev_ind){
|
if (tokens_use && ind != prev_ind){
|
||||||
Cpp_Token current_token = token_array.tokens[token_i-1];
|
Token current_token = token_array.tokens[token_i-1];
|
||||||
|
|
||||||
if (token_i < token_array.count){
|
if (token_i < token_array.count){
|
||||||
if (ind >= token_array.tokens[token_i].start){
|
if (ind >= token_array.tokens[token_i].start){
|
||||||
|
|
|
@ -183,7 +183,7 @@ working_set_contains_name(Working_Set *working_set, String_Const_u8 name){
|
||||||
}
|
}
|
||||||
|
|
||||||
internal b32
|
internal b32
|
||||||
working_set_add_name(Heap *heap, Working_Set *working_set, Editing_File *file, String_Const_u8 name){
|
working_set_add_name(Working_Set *working_set, Editing_File *file, String_Const_u8 name){
|
||||||
return(working_set_add__generic(&working_set->name_table, file->id, name));
|
return(working_set_add__generic(&working_set->name_table, file->id, name));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -287,7 +287,7 @@ get_canon_name(System_Functions *system, Arena *scratch, String_Const_u8 file_na
|
||||||
}
|
}
|
||||||
|
|
||||||
internal void
|
internal void
|
||||||
file_bind_file_name(System_Functions *system, Heap *heap, Working_Set *working_set, Editing_File *file, String_Const_u8 canon_file_name){
|
file_bind_file_name(System_Functions *system, Working_Set *working_set, Editing_File *file, String_Const_u8 canon_file_name){
|
||||||
Assert(file->unique_name.name_size == 0);
|
Assert(file->unique_name.name_size == 0);
|
||||||
Assert(file->canon.name_size == 0);
|
Assert(file->canon.name_size == 0);
|
||||||
umem size = canon_file_name.size;
|
umem size = canon_file_name.size;
|
||||||
|
@ -349,7 +349,7 @@ buffer_resolve_name_low_level(Arena *scratch, Working_Set *working_set, Editing_
|
||||||
}
|
}
|
||||||
|
|
||||||
internal void
|
internal void
|
||||||
buffer_bind_name_low_level(Arena *scratch, Heap *heap, Working_Set *working_set, Editing_File *file, String_Const_u8 base_name, String_Const_u8 name){
|
buffer_bind_name_low_level(Arena *scratch, Working_Set *working_set, Editing_File *file, String_Const_u8 base_name, String_Const_u8 name){
|
||||||
Assert(file->base_name.name_size == 0);
|
Assert(file->base_name.name_size == 0);
|
||||||
Assert(file->unique_name.name_size == 0);
|
Assert(file->unique_name.name_size == 0);
|
||||||
|
|
||||||
|
@ -369,7 +369,7 @@ buffer_bind_name_low_level(Arena *scratch, Heap *heap, Working_Set *working_set,
|
||||||
file->unique_name.name_size = size;
|
file->unique_name.name_size = size;
|
||||||
}
|
}
|
||||||
|
|
||||||
b32 result = working_set_add_name(heap, working_set, file, string_from_file_name(&file->unique_name));
|
b32 result = working_set_add_name(working_set, file, string_from_file_name(&file->unique_name));
|
||||||
Assert(result);
|
Assert(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -383,7 +383,7 @@ buffer_unbind_name_low_level(Working_Set *working_set, Editing_File *file){
|
||||||
}
|
}
|
||||||
|
|
||||||
internal void
|
internal void
|
||||||
buffer_bind_name(Models *models, Heap *heap, Arena *scratch, Working_Set *working_set, Editing_File *file, String_Const_u8 base_name){
|
buffer_bind_name(Models *models, Arena *scratch, Working_Set *working_set, Editing_File *file, String_Const_u8 base_name){
|
||||||
Temp_Memory temp = begin_temp(scratch);
|
Temp_Memory temp = begin_temp(scratch);
|
||||||
|
|
||||||
// List of conflict files.
|
// List of conflict files.
|
||||||
|
@ -471,7 +471,7 @@ buffer_bind_name(Models *models, Heap *heap, Arena *scratch, Working_Set *workin
|
||||||
Editing_File *file_ptr = node->file_ptr;
|
Editing_File *file_ptr = node->file_ptr;
|
||||||
Buffer_Name_Conflict_Entry *entry = &conflicts[i];
|
Buffer_Name_Conflict_Entry *entry = &conflicts[i];
|
||||||
String_Const_u8 unique_name = SCu8(entry->unique_name_in_out, entry->unique_name_len_in_out);
|
String_Const_u8 unique_name = SCu8(entry->unique_name_in_out, entry->unique_name_len_in_out);
|
||||||
buffer_bind_name_low_level(scratch, heap, working_set, file_ptr, base_name, unique_name);
|
buffer_bind_name_low_level(scratch, working_set, file_ptr, base_name, unique_name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -7,6 +7,25 @@
|
||||||
#if !defined(FCODER_LANGUAGE_CPP_H)
|
#if !defined(FCODER_LANGUAGE_CPP_H)
|
||||||
#define FCODER_LANGUAGE_CPP_H
|
#define FCODER_LANGUAGE_CPP_H
|
||||||
|
|
||||||
|
// TODO(allen): Organize this better!
|
||||||
|
|
||||||
|
internal Token_Array
|
||||||
|
lex_cpp_initial(Base_Allocator *allocator, String_Const_u8 contents){
|
||||||
|
Token_Array result = {};
|
||||||
|
result.tokens = base_array(allocator, Token, 2);
|
||||||
|
result.count = 2;
|
||||||
|
result.max = 2;
|
||||||
|
result.tokens[0].pos = 0;
|
||||||
|
result.tokens[0].size = contents.size;
|
||||||
|
result.tokens[0].kind = TokenBaseKind_COUNT;
|
||||||
|
result.tokens[0].sub_kind = 0;
|
||||||
|
result.tokens[1].pos = contents.size;
|
||||||
|
result.tokens[1].size = 0;
|
||||||
|
result.tokens[1].kind = TokenBaseKind_EOF;
|
||||||
|
return(result);
|
||||||
|
}
|
||||||
|
|
||||||
|
#if 0
|
||||||
static Parse_Context_ID parse_context_language_cpp;
|
static Parse_Context_ID parse_context_language_cpp;
|
||||||
|
|
||||||
#define PSAT(s, t) {s, sizeof(s)-1, t}
|
#define PSAT(s, t) {s, sizeof(s)-1, t}
|
||||||
|
@ -152,6 +171,7 @@ init_language_cpp(Application_Links *app){
|
||||||
parse_context_language_cpp = create_parse_context(app, kw, ArrayCount(kw), pp, ArrayCount(pp));
|
parse_context_language_cpp = create_parse_context(app, kw, ArrayCount(kw), pp, ArrayCount(pp));
|
||||||
}
|
}
|
||||||
#undef PSAT
|
#undef PSAT
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
#if !defined(FCODER_LANGUAGE_CS_H)
|
#if !defined(FCODER_LANGUAGE_CS_H)
|
||||||
#define FCODER_LANGUAGE_CS_H
|
#define FCODER_LANGUAGE_CS_H
|
||||||
|
|
||||||
|
#if 0
|
||||||
static Parse_Context_ID parse_context_language_cs;
|
static Parse_Context_ID parse_context_language_cs;
|
||||||
|
|
||||||
#define PSAT(s, t) {s, sizeof(s)-1, t}
|
#define PSAT(s, t) {s, sizeof(s)-1, t}
|
||||||
|
@ -113,6 +114,7 @@ init_language_cs(Application_Links *app){
|
||||||
parse_context_language_cs = create_parse_context(app, kw, ArrayCount(kw), pp, ArrayCount(pp));
|
parse_context_language_cs = create_parse_context(app, kw, ArrayCount(kw), pp, ArrayCount(pp));
|
||||||
}
|
}
|
||||||
#undef PSAT
|
#undef PSAT
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
#if !defined(FCODER_LANGUAGE_JAVA_H)
|
#if !defined(FCODER_LANGUAGE_JAVA_H)
|
||||||
#define FCODER_LANGUAGE_JAVA_H
|
#define FCODER_LANGUAGE_JAVA_H
|
||||||
|
|
||||||
|
#if 0
|
||||||
static Parse_Context_ID parse_context_language_java;
|
static Parse_Context_ID parse_context_language_java;
|
||||||
|
|
||||||
#define PSAT(s, t) {s, sizeof(s)-1, t}
|
#define PSAT(s, t) {s, sizeof(s)-1, t}
|
||||||
|
@ -73,6 +74,7 @@ init_language_java(Application_Links *app){
|
||||||
parse_context_language_java = create_parse_context(app, kw, ArrayCount(kw), 0, 0);
|
parse_context_language_java = create_parse_context(app, kw, ArrayCount(kw), 0, 0);
|
||||||
}
|
}
|
||||||
#undef PSAT
|
#undef PSAT
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
#if !defined(FCODER_LANGUAGE_RUST_H)
|
#if !defined(FCODER_LANGUAGE_RUST_H)
|
||||||
#define FCODER_LANGUAGE_RUST_H
|
#define FCODER_LANGUAGE_RUST_H
|
||||||
|
|
||||||
|
#if 0
|
||||||
static Parse_Context_ID parse_context_language_rust;
|
static Parse_Context_ID parse_context_language_rust;
|
||||||
|
|
||||||
#define PSAT(s, t) {s, sizeof(s)-1, t}
|
#define PSAT(s, t) {s, sizeof(s)-1, t}
|
||||||
|
@ -73,6 +74,7 @@ init_language_rust(Application_Links *app){
|
||||||
parse_context_language_rust = create_parse_context(app, kw, ArrayCount(kw), 0, 0);
|
parse_context_language_rust = create_parse_context(app, kw, ArrayCount(kw), 0, 0);
|
||||||
}
|
}
|
||||||
#undef PSAT
|
#undef PSAT
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -13,9 +13,9 @@
|
||||||
#define FRED_META_PARSER_CPP
|
#define FRED_META_PARSER_CPP
|
||||||
|
|
||||||
struct Parse_Context{
|
struct Parse_Context{
|
||||||
Cpp_Token *token_s;
|
Token *token_s;
|
||||||
Cpp_Token *token_e;
|
Token *token_e;
|
||||||
Cpp_Token *token;
|
Token *token;
|
||||||
char *data;
|
char *data;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -101,7 +101,7 @@ struct Item_Set{
|
||||||
struct Parse{
|
struct Parse{
|
||||||
String_Const_char code;
|
String_Const_char code;
|
||||||
//String code;
|
//String code;
|
||||||
Cpp_Token_Array tokens;
|
Token_Array tokens;
|
||||||
i32 item_count;
|
i32 item_count;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -131,13 +131,13 @@ SCchar_range(char *data, i32 start, i32 end){
|
||||||
}
|
}
|
||||||
|
|
||||||
internal String_Const_char
|
internal String_Const_char
|
||||||
get_lexeme(Cpp_Token token, char *code){
|
get_lexeme(Token token, char *code){
|
||||||
String_Const_char str = SCchar(code + token.start, token.size);
|
String_Const_char str = SCchar(code + token.start, token.size);
|
||||||
return(str);
|
return(str);
|
||||||
}
|
}
|
||||||
|
|
||||||
internal Parse_Context
|
internal Parse_Context
|
||||||
setup_parse_context(char *data, Cpp_Token_Array array){
|
setup_parse_context(char *data, Token_Array array){
|
||||||
Parse_Context context;
|
Parse_Context context;
|
||||||
context.token_s = array.tokens;
|
context.token_s = array.tokens;
|
||||||
context.token_e = array.tokens + array.count;
|
context.token_e = array.tokens + array.count;
|
||||||
|
@ -156,18 +156,18 @@ setup_parse_context(Parse parse){
|
||||||
return(context);
|
return(context);
|
||||||
}
|
}
|
||||||
|
|
||||||
internal Cpp_Token*
|
internal Token*
|
||||||
get_token(Parse_Context *context){
|
get_token(Parse_Context *context){
|
||||||
Cpp_Token *result = context->token;
|
Token *result = context->token;
|
||||||
if (result >= context->token_e){
|
if (result >= context->token_e){
|
||||||
result = 0;
|
result = 0;
|
||||||
}
|
}
|
||||||
return(result);
|
return(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
internal Cpp_Token*
|
internal Token*
|
||||||
get_next_token(Parse_Context *context){
|
get_next_token(Parse_Context *context){
|
||||||
Cpp_Token *result = context->token+1;
|
Token *result = context->token+1;
|
||||||
context->token = result;
|
context->token = result;
|
||||||
if (result >= context->token_e){
|
if (result >= context->token_e){
|
||||||
result = 0;
|
result = 0;
|
||||||
|
@ -176,9 +176,9 @@ get_next_token(Parse_Context *context){
|
||||||
return(result);
|
return(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
internal Cpp_Token*
|
internal Token*
|
||||||
get_prev_token(Parse_Context *context){
|
get_prev_token(Parse_Context *context){
|
||||||
Cpp_Token *result = context->token-1;
|
Token *result = context->token-1;
|
||||||
if (result < context->token_s){
|
if (result < context->token_s){
|
||||||
result = 0;
|
result = 0;
|
||||||
}
|
}
|
||||||
|
@ -188,18 +188,18 @@ get_prev_token(Parse_Context *context){
|
||||||
return(result);
|
return(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
internal Cpp_Token*
|
internal Token*
|
||||||
can_back_step(Parse_Context *context){
|
can_back_step(Parse_Context *context){
|
||||||
Cpp_Token *result = context->token-1;
|
Token *result = context->token-1;
|
||||||
if (result < context->token_s){
|
if (result < context->token_s){
|
||||||
result = 0;
|
result = 0;
|
||||||
}
|
}
|
||||||
return(result);
|
return(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
internal Cpp_Token*
|
internal Token*
|
||||||
set_token(Parse_Context *context, Cpp_Token *token){
|
set_token(Parse_Context *context, Token *token){
|
||||||
Cpp_Token *result = 0;
|
Token *result = 0;
|
||||||
if (token >= context->token_s && token < context->token_e){
|
if (token >= context->token_s && token < context->token_e){
|
||||||
context->token = token;
|
context->token = token;
|
||||||
result = token;
|
result = token;
|
||||||
|
@ -321,7 +321,7 @@ get_doc_string_from_prev(Parse_Context *context, String_Const_char *doc_string){
|
||||||
i32 result = false;
|
i32 result = false;
|
||||||
|
|
||||||
if (can_back_step(context)){
|
if (can_back_step(context)){
|
||||||
Cpp_Token *prev_token = get_token(context) - 1;
|
Token *prev_token = get_token(context) - 1;
|
||||||
if (prev_token->type == CPP_TOKEN_COMMENT){
|
if (prev_token->type == CPP_TOKEN_COMMENT){
|
||||||
*doc_string = get_lexeme(*prev_token, context->data);
|
*doc_string = get_lexeme(*prev_token, context->data);
|
||||||
if (check_and_fix_docs(doc_string)){
|
if (check_and_fix_docs(doc_string)){
|
||||||
|
@ -546,12 +546,12 @@ internal i32
|
||||||
struct_parse_member(Parse_Context *context, Item_Node *member){
|
struct_parse_member(Parse_Context *context, Item_Node *member){
|
||||||
i32 result = false;
|
i32 result = false;
|
||||||
|
|
||||||
Cpp_Token *token = get_token(context);
|
Token *token = get_token(context);
|
||||||
|
|
||||||
String_Const_char doc_string = {};
|
String_Const_char doc_string = {};
|
||||||
get_doc_string_from_prev(context, &doc_string);
|
get_doc_string_from_prev(context, &doc_string);
|
||||||
|
|
||||||
Cpp_Token *start_token = token;
|
Token *start_token = token;
|
||||||
|
|
||||||
for (; (token = get_token(context)) != 0; get_next_token(context)){
|
for (; (token = get_token(context)) != 0; get_next_token(context)){
|
||||||
if (token->type == CPP_TOKEN_SEMICOLON){
|
if (token->type == CPP_TOKEN_SEMICOLON){
|
||||||
|
@ -561,7 +561,7 @@ struct_parse_member(Parse_Context *context, Item_Node *member){
|
||||||
|
|
||||||
if (token){
|
if (token){
|
||||||
String_Const_char name = {};
|
String_Const_char name = {};
|
||||||
Cpp_Token *token_j = 0;
|
Token *token_j = 0;
|
||||||
i32 nest_level = 0;
|
i32 nest_level = 0;
|
||||||
|
|
||||||
for (; (token_j = get_token(context)) > start_token; get_prev_token(context)){
|
for (; (token_j = get_token(context)) > start_token; get_prev_token(context)){
|
||||||
|
@ -606,7 +606,7 @@ internal Item_Node*
|
||||||
struct_parse_next_member(Arena *arena, Parse_Context *context){
|
struct_parse_next_member(Arena *arena, Parse_Context *context){
|
||||||
Item_Node *result = 0;
|
Item_Node *result = 0;
|
||||||
|
|
||||||
Cpp_Token *token = 0;
|
Token *token = 0;
|
||||||
|
|
||||||
for (; (token = get_token(context)) != 0; get_next_token(context)){
|
for (; (token = get_token(context)) != 0; get_next_token(context)){
|
||||||
if (token->type == CPP_TOKEN_IDENTIFIER ||
|
if (token->type == CPP_TOKEN_IDENTIFIER ||
|
||||||
|
@ -656,8 +656,8 @@ internal i32
|
||||||
struct_parse(Arena *arena, i32 is_struct, Parse_Context *context, Item_Node *top_member){
|
struct_parse(Arena *arena, i32 is_struct, Parse_Context *context, Item_Node *top_member){
|
||||||
i32 result = false;
|
i32 result = false;
|
||||||
|
|
||||||
Cpp_Token *start_token = get_token(context);
|
Token *start_token = get_token(context);
|
||||||
Cpp_Token *token = 0;
|
Token *token = 0;
|
||||||
|
|
||||||
String_Const_char doc_string = {};
|
String_Const_char doc_string = {};
|
||||||
get_doc_string_from_prev(context, &doc_string);
|
get_doc_string_from_prev(context, &doc_string);
|
||||||
|
@ -669,7 +669,7 @@ struct_parse(Arena *arena, i32 is_struct, Parse_Context *context, Item_Node *top
|
||||||
}
|
}
|
||||||
|
|
||||||
if (token){
|
if (token){
|
||||||
Cpp_Token *token_j = token;
|
Token *token_j = token;
|
||||||
|
|
||||||
for (; (token_j = get_token(context)) > start_token; get_prev_token(context)){
|
for (; (token_j = get_token(context)) > start_token; get_prev_token(context)){
|
||||||
if (token_j->type == CPP_TOKEN_IDENTIFIER){
|
if (token_j->type == CPP_TOKEN_IDENTIFIER){
|
||||||
|
@ -737,11 +737,11 @@ internal i32
|
||||||
typedef_parse(Parse_Context *context, Item_Node *item){
|
typedef_parse(Parse_Context *context, Item_Node *item){
|
||||||
i32 result = false;
|
i32 result = false;
|
||||||
|
|
||||||
Cpp_Token *token = get_token(context);
|
Token *token = get_token(context);
|
||||||
String_Const_char doc_string = {};
|
String_Const_char doc_string = {};
|
||||||
get_doc_string_from_prev(context, &doc_string);
|
get_doc_string_from_prev(context, &doc_string);
|
||||||
|
|
||||||
Cpp_Token *start_token = token;
|
Token *start_token = token;
|
||||||
|
|
||||||
for (; (token = get_token(context)) != 0; get_next_token(context)){
|
for (; (token = get_token(context)) != 0; get_next_token(context)){
|
||||||
if (token->type == CPP_TOKEN_SEMICOLON){
|
if (token->type == CPP_TOKEN_SEMICOLON){
|
||||||
|
@ -750,7 +750,7 @@ typedef_parse(Parse_Context *context, Item_Node *item){
|
||||||
}
|
}
|
||||||
|
|
||||||
if (token){
|
if (token){
|
||||||
Cpp_Token *token_j = token;
|
Token *token_j = token;
|
||||||
|
|
||||||
for (; (token_j = get_token(context)) > start_token; get_prev_token(context)){
|
for (; (token_j = get_token(context)) > start_token; get_prev_token(context)){
|
||||||
if (token_j->type == CPP_TOKEN_IDENTIFIER){
|
if (token_j->type == CPP_TOKEN_IDENTIFIER){
|
||||||
|
@ -781,8 +781,8 @@ enum_parse(Arena *arena, Parse_Context *context, Item_Node *item){
|
||||||
String_Const_char parent_doc_string = {};
|
String_Const_char parent_doc_string = {};
|
||||||
get_doc_string_from_prev(context, &parent_doc_string);
|
get_doc_string_from_prev(context, &parent_doc_string);
|
||||||
|
|
||||||
Cpp_Token *parent_start_token = get_token(context);
|
Token *parent_start_token = get_token(context);
|
||||||
Cpp_Token *token = 0;
|
Token *token = 0;
|
||||||
|
|
||||||
for (; (token = get_token(context)) != 0; get_next_token(context)){
|
for (; (token = get_token(context)) != 0; get_next_token(context)){
|
||||||
if (token->type == CPP_TOKEN_BRACE_OPEN){
|
if (token->type == CPP_TOKEN_BRACE_OPEN){
|
||||||
|
@ -792,7 +792,7 @@ enum_parse(Arena *arena, Parse_Context *context, Item_Node *item){
|
||||||
|
|
||||||
if (token){
|
if (token){
|
||||||
String_Const_char parent_name = {};
|
String_Const_char parent_name = {};
|
||||||
Cpp_Token *token_j = 0;
|
Token *token_j = 0;
|
||||||
|
|
||||||
for (; (token_j = get_token(context)) != 0; get_prev_token(context)){
|
for (; (token_j = get_token(context)) != 0; get_prev_token(context)){
|
||||||
if (token_j->type == CPP_TOKEN_IDENTIFIER){
|
if (token_j->type == CPP_TOKEN_IDENTIFIER){
|
||||||
|
@ -829,7 +829,7 @@ enum_parse(Arena *arena, Parse_Context *context, Item_Node *item){
|
||||||
|
|
||||||
if (token){
|
if (token){
|
||||||
if (token->type == CPP_TOKEN_EQ){
|
if (token->type == CPP_TOKEN_EQ){
|
||||||
Cpp_Token *start_token = token;
|
Token *start_token = token;
|
||||||
|
|
||||||
for (; (token = get_token(context)) != 0; get_next_token(context)){
|
for (; (token = get_token(context)) != 0; get_next_token(context)){
|
||||||
if (token->type == CPP_TOKEN_COMMA ||
|
if (token->type == CPP_TOKEN_COMMA ||
|
||||||
|
@ -901,9 +901,9 @@ foo(a, ... , z)
|
||||||
^ ^
|
^ ^
|
||||||
*/
|
*/
|
||||||
internal Argument_Breakdown
|
internal Argument_Breakdown
|
||||||
parameter_parse(Arena *arena, char *data, Cpp_Token *args_start_token, Cpp_Token *args_end_token){
|
parameter_parse(Arena *arena, char *data, Token *args_start_token, Token *args_end_token){
|
||||||
i32 arg_index = 0;
|
i32 arg_index = 0;
|
||||||
Cpp_Token *arg_token = args_start_token + 1;
|
Token *arg_token = args_start_token + 1;
|
||||||
i32 param_string_start = arg_token->start;
|
i32 param_string_start = arg_token->start;
|
||||||
|
|
||||||
i32 arg_count = 1;
|
i32 arg_count = 1;
|
||||||
|
@ -926,7 +926,7 @@ parameter_parse(Arena *arena, char *data, Cpp_Token *args_start_token, Cpp_Token
|
||||||
param_string = string_chop_whitespace(param_string);
|
param_string = string_chop_whitespace(param_string);
|
||||||
breakdown.args[arg_index].param_string = param_string;
|
breakdown.args[arg_index].param_string = param_string;
|
||||||
|
|
||||||
for (Cpp_Token *param_name_token = arg_token - 1;
|
for (Token *param_name_token = arg_token - 1;
|
||||||
param_name_token->start > param_string_start;
|
param_name_token->start > param_string_start;
|
||||||
--param_name_token){
|
--param_name_token){
|
||||||
if (param_name_token->type == CPP_TOKEN_IDENTIFIER){
|
if (param_name_token->type == CPP_TOKEN_IDENTIFIER){
|
||||||
|
@ -957,7 +957,7 @@ internal i32
|
||||||
function_parse_goto_name(Parse_Context *context){
|
function_parse_goto_name(Parse_Context *context){
|
||||||
i32 result = false;
|
i32 result = false;
|
||||||
|
|
||||||
Cpp_Token *token = 0;
|
Token *token = 0;
|
||||||
|
|
||||||
{
|
{
|
||||||
for (; (token = get_token(context)) != 0; get_next_token(context)){
|
for (; (token = get_token(context)) != 0; get_next_token(context)){
|
||||||
|
@ -989,7 +989,7 @@ internal i32
|
||||||
function_get_doc(Parse_Context *context, char *data, String_Const_char *doc_string){
|
function_get_doc(Parse_Context *context, char *data, String_Const_char *doc_string){
|
||||||
i32 result = false;
|
i32 result = false;
|
||||||
|
|
||||||
Cpp_Token *token = get_token(context);
|
Token *token = get_token(context);
|
||||||
String_Const_char lexeme = {};
|
String_Const_char lexeme = {};
|
||||||
|
|
||||||
if (function_parse_goto_name(context)){
|
if (function_parse_goto_name(context)){
|
||||||
|
@ -1017,8 +1017,8 @@ internal i32
|
||||||
cpp_name_parse(Parse_Context *context, String_Const_char *name){
|
cpp_name_parse(Parse_Context *context, String_Const_char *name){
|
||||||
i32 result = false;
|
i32 result = false;
|
||||||
|
|
||||||
Cpp_Token *token = 0;
|
Token *token = 0;
|
||||||
Cpp_Token *token_start = get_token(context);
|
Token *token_start = get_token(context);
|
||||||
|
|
||||||
token = get_next_token(context);
|
token = get_next_token(context);
|
||||||
if (token && token->type == CPP_TOKEN_PARENTHESE_OPEN){
|
if (token && token->type == CPP_TOKEN_PARENTHESE_OPEN){
|
||||||
|
@ -1048,9 +1048,9 @@ internal i32
|
||||||
function_sig_parse(Arena *arena, Parse_Context *context, Item_Node *item, String_Const_char cpp_name){
|
function_sig_parse(Arena *arena, Parse_Context *context, Item_Node *item, String_Const_char cpp_name){
|
||||||
i32 result = false;
|
i32 result = false;
|
||||||
|
|
||||||
Cpp_Token *token = 0;
|
Token *token = 0;
|
||||||
Cpp_Token *args_start_token = 0;
|
Token *args_start_token = 0;
|
||||||
Cpp_Token *ret_token = get_token(context);
|
Token *ret_token = get_token(context);
|
||||||
|
|
||||||
if (function_parse_goto_name(context)){
|
if (function_parse_goto_name(context)){
|
||||||
token = get_token(context);
|
token = get_token(context);
|
||||||
|
@ -1089,7 +1089,7 @@ function_parse(Arena *arena, Parse_Context *context, Item_Node *item, String_Con
|
||||||
i32 result = false;
|
i32 result = false;
|
||||||
|
|
||||||
String_Const_char doc_string = {};
|
String_Const_char doc_string = {};
|
||||||
Cpp_Token *token = get_token(context);
|
Token *token = get_token(context);
|
||||||
|
|
||||||
item->marker = get_lexeme(*token, context->data);
|
item->marker = get_lexeme(*token, context->data);
|
||||||
|
|
||||||
|
@ -1117,7 +1117,7 @@ internal i32
|
||||||
macro_parse_check(Parse_Context *context){
|
macro_parse_check(Parse_Context *context){
|
||||||
i32 result = false;
|
i32 result = false;
|
||||||
|
|
||||||
Cpp_Token *token = 0;
|
Token *token = 0;
|
||||||
|
|
||||||
if ((token = get_next_token(context)) != 0){
|
if ((token = get_next_token(context)) != 0){
|
||||||
if (token->type == CPP_TOKEN_COMMENT){
|
if (token->type == CPP_TOKEN_COMMENT){
|
||||||
|
@ -1141,9 +1141,9 @@ internal i32
|
||||||
macro_parse(Arena *arena, Parse_Context *context, Item_Node *item){
|
macro_parse(Arena *arena, Parse_Context *context, Item_Node *item){
|
||||||
i32 result = false;
|
i32 result = false;
|
||||||
|
|
||||||
Cpp_Token *token = 0;
|
Token *token = 0;
|
||||||
Cpp_Token *doc_token = 0;
|
Token *doc_token = 0;
|
||||||
Cpp_Token *args_start_token = 0;
|
Token *args_start_token = 0;
|
||||||
|
|
||||||
String_Const_char doc_string = {};
|
String_Const_char doc_string = {};
|
||||||
|
|
||||||
|
@ -1180,7 +1180,7 @@ macro_parse(Arena *arena, Parse_Context *context, Item_Node *item){
|
||||||
item->breakdown = parameter_parse(arena, context->data, args_start_token, token);
|
item->breakdown = parameter_parse(arena, context->data, args_start_token, token);
|
||||||
|
|
||||||
if ((token = get_next_token(context)) != 0){
|
if ((token = get_next_token(context)) != 0){
|
||||||
Cpp_Token *body_start = token;
|
Token *body_start = token;
|
||||||
|
|
||||||
if (body_start->flags & CPP_TFLAG_PP_BODY){
|
if (body_start->flags & CPP_TFLAG_PP_BODY){
|
||||||
for (; (token = get_token(context)) != 0; get_next_token(context)){
|
for (; (token = get_token(context)) != 0; get_next_token(context)){
|
||||||
|
@ -1240,7 +1240,7 @@ compile_meta_unit(Arena *arena, char *code_directory, char **files, Meta_Keyword
|
||||||
if (all_files_lexed){
|
if (all_files_lexed){
|
||||||
// TODO(allen): This stage counts nested structs and unions which is not correct. Luckily it only means we over allocate by a few items, but fixing it to be exactly correct would be nice.
|
// TODO(allen): This stage counts nested structs and unions which is not correct. Luckily it only means we over allocate by a few items, but fixing it to be exactly correct would be nice.
|
||||||
for (i32 J = 0; J < unit.count; ++J){
|
for (i32 J = 0; J < unit.count; ++J){
|
||||||
Cpp_Token *token = 0;
|
Token *token = 0;
|
||||||
Parse_Context context_ = setup_parse_context(unit.parse[J]);
|
Parse_Context context_ = setup_parse_context(unit.parse[J]);
|
||||||
Parse_Context *context = &context_;
|
Parse_Context *context = &context_;
|
||||||
|
|
||||||
|
@ -1270,7 +1270,7 @@ compile_meta_unit(Arena *arena, char *code_directory, char **files, Meta_Keyword
|
||||||
i32 index = 0;
|
i32 index = 0;
|
||||||
|
|
||||||
for (i32 J = 0; J < unit.count; ++J){
|
for (i32 J = 0; J < unit.count; ++J){
|
||||||
Cpp_Token *token = 0;
|
Token *token = 0;
|
||||||
Parse_Context context_ = setup_parse_context(unit.parse[J]);
|
Parse_Context context_ = setup_parse_context(unit.parse[J]);
|
||||||
Parse_Context *context = &context_;
|
Parse_Context *context = &context_;
|
||||||
|
|
||||||
|
|
|
@ -20,7 +20,6 @@
|
||||||
#include "4coder_base_types.cpp"
|
#include "4coder_base_types.cpp"
|
||||||
#include "4coder_stringf.cpp"
|
#include "4coder_stringf.cpp"
|
||||||
# define FSTRING_IMPLEMENTATION
|
# define FSTRING_IMPLEMENTATION
|
||||||
# include "4coder_lib/4coder_string.h"
|
|
||||||
#include "4coder_lib/4cpp_lexer.h"
|
#include "4coder_lib/4cpp_lexer.h"
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
|
@ -28,9 +28,6 @@
|
||||||
#include "4coder_lib/4coder_utf8.h"
|
#include "4coder_lib/4coder_utf8.h"
|
||||||
|
|
||||||
#if defined(FRED_SUPER)
|
#if defined(FRED_SUPER)
|
||||||
# include "4coder_lib/4coder_heap.h"
|
|
||||||
# include "4coder_lib/4coder_heap.cpp"
|
|
||||||
|
|
||||||
# include "4coder_base_types.cpp"
|
# include "4coder_base_types.cpp"
|
||||||
# include "4coder_stringf.cpp"
|
# include "4coder_stringf.cpp"
|
||||||
# include "4coder_hash_functions.cpp"
|
# include "4coder_hash_functions.cpp"
|
||||||
|
|
Loading…
Reference in New Issue