From bc4905b83c032b6b1bd507d198daffc9d3a4950e Mon Sep 17 00:00:00 2001 From: Allen Webster Date: Thu, 15 Sep 2016 11:01:52 -0400 Subject: [PATCH] introduced token streams --- 4coder_API.html | 50 ++++++------- 4coder_custom_api.h | 4 + 4coder_default_include.cpp | 147 +++++++++++++++++++++++++++++-------- 4ed_api_implementation.cpp | 17 +++++ 4 files changed, 164 insertions(+), 54 deletions(-) diff --git a/4coder_API.html b/4coder_API.html index f1ed67c7..5294eaef 100644 --- a/4coder_API.html +++ b/4coder_API.html @@ -2,7 +2,7 @@

4cpp Lexing Library

Table of Contents

§1 Introduction

This is the documentation for alpha 4.0.11 The documentation is still under construction so some of the links are linking to sections that have not been written yet. What is here should be correct and I suspect useful even without some of the other sections.

If you have questions or discover errors please contact editor@4coder.net or to get help from community members you can post on the 4coder forums hosted on handmade.network at 4coder.handmade.network

§2 4coder Systems

Coming Soon
-

§3 Types and Functions

§3.1 Function List

§3.2 Type List

§3.3 Function Descriptions

§3.3.1: exec_command

bool32 app->exec_command(
Application_Links *app,
Command_ID command_id
)
Parameters
command_id
The command_id parameter specifies which internal command to execute.
Return
This call returns non-zero if command_id named a valid internal command.
Description
A call to exec_command executes an internal command. +

§3 Types and Functions

§3.1 Function List

§3.2 Type List

§3.3 Function Descriptions

§3.3.1: exec_command

bool32 app->exec_command(
Application_Links *app,
Command_ID command_id
)
Parameters
command_id
The command_id parameter specifies which internal command to execute.
Return
This call returns non-zero if command_id named a valid internal command.
Description
A call to exec_command executes an internal command. If command_id is invalid a warning is posted to *messages*.

See Also

§3.3.2: exec_system_command

bool32 app->exec_system_command(
Application_Links *app,
View_Summary *view,
Buffer_Identifier buffer,
char *path,
int32_t path_len,
char *command,
int32_t command_len,
Command_Line_Interface_Flag flags
)
Parameters
view
If the view parameter is non-null it specifies a view to display the command's output buffer.
buffer
The buffer the command will output to is specified by the buffer parameter. See Buffer_Identifier for information on how this type specifies a buffer.
path
The path parameter specifies the path in which the command shall be executed. The string need not be null terminated.
path_len
The parameter path_len specifies the length of the path string.
command
The command parameter specifies the command that shall be executed. The string need not be null terminated.
command_len
The parameter command_len specifies the length of the command string.
flags
Flags for the behavior of the call are specified in the flags parameter.
Return
This call returns non-zero on success.
Description
A call to exec_system_command executes a command as if called from the command line, and sends the output to a buffer. The buffer identifier can either name a new buffer that does not exist, name a buffer that does @@ -34,68 +34,68 @@ The seek position must be one of the types supported by Partial_Cursor. Those types are absolute position and line,column position.

See Also

§3.3.14: buffer_batch_edit

bool32 app->buffer_batch_edit(
Application_Links *app,
Buffer_Summary *buffer,
char *str,
int32_t str_len,
Buffer_Edit *edits,
int32_t edit_count,
Buffer_Batch_Edit_Type type
)
Parameters
str
This parameter provides all of the source string for the edits in the batch.
str_len
This parameter specifies the length of the str string.
edits
This parameter provides about the source string and destination range of each edit as an array.
edit_count
This parameter specifies the number of Buffer_Edit structs in edits.
type
This prameter specifies what type of batch edit to execute.
Return
This call returns non-zero if the batch edit succeeds. This call can fail if the provided buffer summary does not refer to an actual buffer in 4coder.
Description
TODO

See Also

§3.3.15: buffer_set_setting

bool32 app->buffer_set_setting(
Application_Links *app,
Buffer_Summary *buffer,
Buffer_Setting_ID setting,
int32_t value
)
Parameters
buffer
The buffer parameter specifies the buffer on which to set a setting.
setting
The setting parameter identifies the setting that shall be changed.
value
The value parameter specifies the value to which the setting shall be changed.
See Also

§3.3.16: buffer_token_count

int32_t app->buffer_token_count(
Application_Links *app,
Buffer_Summary *buffer
)
Parameters
buffer
Specifies the buffer from which to read the token count.
Return
If tokens are available for the buffer, the number of tokens on the buffer is returned. If the buffer does not exist or if it is not a lexed buffer, the return is zero.

§3.3.17: buffer_read_tokens

bool32 app->buffer_read_tokens(
Application_Links *app,
Buffer_Summary *buffer,
int32_t start_token,
int32_t end_token,
Cpp_Token *tokens_out
)
Parameters
buffer
Specifies the buffer from which to read tokens.
first_token
Specifies the index of the first token to read.
end_token
Specifies the token to stop reading at.
tokens_out
The memory that will store the tokens read from the buffer.
Return
Returns non-zero on success. This call can fail if the buffer doesn't -exist or doesn't have tokens ready, or if either the first or last index is out of bounds.
Description
Puts the data for the tokens with the indices [first_token,last_token


§3.3.18: create_buffer

Buffer_Summary app->create_buffer(
Application_Links *app,
char *filename,
int32_t filename_len,
Buffer_Create_Flag flags
)
Parameters
filename
The filename parameter specifies the name of the file to be opened or created; +exist or doesn't have tokens ready, or if either the first or last index is out of bounds.
Description
Puts the data for the tokens with the indices [first_token,last_token


§3.3.18: buffer_get_token_index

bool32 app->buffer_get_token_index(
Application_Links *app,
Buffer_Summary *buffer,
int32_t pos,
Cpp_Get_Token_Result *get_result
)
No documentation generated for this function.

§3.3.19: create_buffer

Buffer_Summary app->create_buffer(
Application_Links *app,
char *filename,
int32_t filename_len,
Buffer_Create_Flag flags
)
Parameters
filename
The filename parameter specifies the name of the file to be opened or created; it need not be null terminated.
filename_len
The filename_len parameter spcifies the length of the filename string.
flags
The flags parameter specifies behaviors for buffer creation.
Return
This call returns the summary of the created buffer.
Description
Tries to create a new buffer and associate it to the given filename. If such a buffer already exists the existing buffer is returned in the Buffer_Summary and no new buffer is created. If the buffer does not exist a new buffer is created and named after the given filename. If the filename corresponds to a file on the disk that file is loaded and put into -buffer, if the filename does not correspond to a file on disk the buffer is created empty.

See Also

§3.3.19: save_buffer

bool32 app->save_buffer(
Application_Links *app,
Buffer_Summary *buffer,
char *filename,
int32_t filename_len,
uint32_t flags
)
Parameters
buffer
The buffer parameter specifies the buffer to save to a file.
filename
The filename parameter specifies the name of the file to associated to the buffer; it need not be null terminated.
filename_len
The filename_len parameter specifies the length of the filename string.
flags
This parameter is not currently used and should be set to 0 for now.
Return
This call returns non-zero on success.

§3.3.20: kill_buffer

bool32 app->kill_buffer(
Application_Links *app,
Buffer_Identifier buffer,
View_ID view_id,
Buffer_Kill_Flag flags
)
Parameters
buffer
The buffer parameter specifies the buffer to try to kill.
view_id
The view_id parameter specifies the view that will contain the "are you sure" dialogue if the buffer is dirty.
flags
The flags parameter specifies behaviors for the buffer kill.
Return
This call returns non-zero if the buffer is killed.
Description
Tries to kill the idenfied buffer. If the buffer is dirty and the "are you sure" +buffer, if the filename does not correspond to a file on disk the buffer is created empty.

See Also

§3.3.20: save_buffer

bool32 app->save_buffer(
Application_Links *app,
Buffer_Summary *buffer,
char *filename,
int32_t filename_len,
uint32_t flags
)
Parameters
buffer
The buffer parameter specifies the buffer to save to a file.
filename
The filename parameter specifies the name of the file to associated to the buffer; it need not be null terminated.
filename_len
The filename_len parameter specifies the length of the filename string.
flags
This parameter is not currently used and should be set to 0 for now.
Return
This call returns non-zero on success.

§3.3.21: kill_buffer

bool32 app->kill_buffer(
Application_Links *app,
Buffer_Identifier buffer,
View_ID view_id,
Buffer_Kill_Flag flags
)
Parameters
buffer
The buffer parameter specifies the buffer to try to kill.
view_id
The view_id parameter specifies the view that will contain the "are you sure" dialogue if the buffer is dirty.
flags
The flags parameter specifies behaviors for the buffer kill.
Return
This call returns non-zero if the buffer is killed.
Description
Tries to kill the idenfied buffer. If the buffer is dirty and the "are you sure" dialogue needs to be displayed the provided view is used to show the dialogue. -If the view is not open the kill fails.

See Also

§3.3.21: get_view_first

View_Summary app->get_view_first(
Application_Links *app,
Access_Flag access
)
Parameters
access
The access parameter determines what levels of protection this call can access.
Return
This call returns the summary of the first view in a view loop.
Description
This call begins a loop across all the open views.

+If the view is not open the kill fails.

See Also

§3.3.22: get_view_first

View_Summary app->get_view_first(
Application_Links *app,
Access_Flag access
)
Parameters
access
The access parameter determines what levels of protection this call can access.
Return
This call returns the summary of the first view in a view loop.
Description
This call begins a loop across all the open views.

If the View_Summary returned is a null summary, the loop is finished. -Views should not be closed or opened durring a view loop.

See Also

§3.3.22: get_view_next

void app->get_view_next(
Application_Links *app,
View_Summary *view,
Access_Flag access
)
Parameters
view
The View_Summary pointed to by view is iterated to the next view or to a null summary if this is the last view.
access
The access parameter determines what levels of protection this call can access. The view outputted will be the next view that is accessible.
Description
This call steps a View_Summary to the next view in the global view order.

+Views should not be closed or opened durring a view loop.

See Also

§3.3.23: get_view_next

void app->get_view_next(
Application_Links *app,
View_Summary *view,
Access_Flag access
)
Parameters
view
The View_Summary pointed to by view is iterated to the next view or to a null summary if this is the last view.
access
The access parameter determines what levels of protection this call can access. The view outputted will be the next view that is accessible.
Description
This call steps a View_Summary to the next view in the global view order.

If the view outputted does not exist, the loop is finished. -Views should not be closed or opened durring a view loop.

See Also

§3.3.23: get_view

View_Summary app->get_view(
Application_Links *app,
View_ID view_id,
Access_Flag access
)
Parameters
view_id
The view_id specifies the view to try to get.
access
The access parameter determines what levels of protection this call can access.
Return
This call returns a summary that describes the indicated view if it is open and accessible.
See Also

§3.3.24: get_active_view

View_Summary app->get_active_view(
Application_Links *app,
Access_Flag access
)
Parameters
access
The access parameter determines what levels of protection this call can access.
Return
This call returns a summary that describes the active view.
See Also

§3.3.25: open_view

View_Summary app->open_view(
Application_Links *app,
View_Summary *view_location,
View_Split_Position position
)
Parameters
view_location
The view_location parameter specifies the view to split to open the new view.
position
The position parameter specifies how to split the view and where to place the new view.
Return
If this call succeeds it returns a View_Summary describing the newly created view, if it fails it +Views should not be closed or opened durring a view loop.

See Also

§3.3.24: get_view

View_Summary app->get_view(
Application_Links *app,
View_ID view_id,
Access_Flag access
)
Parameters
view_id
The view_id specifies the view to try to get.
access
The access parameter determines what levels of protection this call can access.
Return
This call returns a summary that describes the indicated view if it is open and accessible.
See Also

§3.3.25: get_active_view

View_Summary app->get_active_view(
Application_Links *app,
Access_Flag access
)
Parameters
access
The access parameter determines what levels of protection this call can access.
Return
This call returns a summary that describes the active view.
See Also

§3.3.26: open_view

View_Summary app->open_view(
Application_Links *app,
View_Summary *view_location,
View_Split_Position position
)
Parameters
view_location
The view_location parameter specifies the view to split to open the new view.
position
The position parameter specifies how to split the view and where to place the new view.
Return
If this call succeeds it returns a View_Summary describing the newly created view, if it fails it returns a null summary.
Description
4coder is built with a limit of 16 views. If 16 views are already open when this is called the -call will fail.

See Also

§3.3.26: close_view

bool32 app->close_view(
Application_Links *app,
View_Summary *view
)
Parameters
view
The view parameter specifies which view to close.
Return
This call returns non-zero on success.
Description
If the given view is open and is not the last view, it will be closed. +call will fail.

See Also

§3.3.27: close_view

bool32 app->close_view(
Application_Links *app,
View_Summary *view
)
Parameters
view
The view parameter specifies which view to close.
Return
This call returns non-zero on success.
Description
If the given view is open and is not the last view, it will be closed. If the given view is the active view, the next active view in the global order of view will be made active. If the given view is the last open view -in the system, the call will fail.


§3.3.27: set_active_view

bool32 app->set_active_view(
Application_Links *app,
View_Summary *view
)
Parameters
view
The view parameter specifies which view to make active.
Return
This call returns non-zero on success.
Description
If the given view is open, it is set as the +in the system, the call will fail.


§3.3.28: set_active_view

bool32 app->set_active_view(
Application_Links *app,
View_Summary *view
)
Parameters
view
The view parameter specifies which view to make active.
Return
This call returns non-zero on success.
Description
If the given view is open, it is set as the active view, and takes subsequent commands and is returned -from get_active_view.

See Also

§3.3.28: view_set_setting

bool32 app->view_set_setting(
Application_Links *app,
View_Summary *view,
View_Setting_ID setting,
int32_t value
)
Parameters
view
The view parameter specifies the view on which to set a setting.
setting
The setting parameter identifies the setting that shall be changed.
value
The value parameter specifies the value to which the setting shall be changed.
Return
This call returns non-zero on success.
See Also

§3.3.29: view_set_split_proportion

bool32 app->view_set_split_proportion(
Application_Links *app,
View_Summary *view,
float t
)
Parameters
view
The view parameter specifies which view shall have it's size adjusted.
t
The t parameter specifies the proportion of the containing box that the view should occupy. t should be in [0,1].
Return
This call returns non-zero on success.

§3.3.30: view_compute_cursor

bool32 app->view_compute_cursor(
Application_Links *app,
View_Summary *view,
Buffer_Seek seek,
Full_Cursor *cursor_out
)
Parameters
view
The view parameter specifies the view on which to run the cursor computation.
seek
The seek parameter specifies the target position for the seek.
cursor_out
On success this struct is filled with the result of the seek.
Return
This call returns non-zero on success.
Description
Computes a Full_Cursor for the given seek position with no side effects.

See Also

§3.3.31: view_set_cursor

bool32 app->view_set_cursor(
Application_Links *app,
View_Summary *view,
Buffer_Seek seek,
bool32 set_preferred_x
)
Parameters
view
The view parameter specifies the view in which to set the cursor.
seek
The seek parameter specifies the target position for the seek.
set_preferred_x
If this parameter is true the preferred x is updated to match the new cursor x.
Return
This call returns non-zero on success.
Description
This call sets the the view's cursor position. set_preferred_x should usually be true +from get_active_view.

See Also

§3.3.29: view_set_setting

bool32 app->view_set_setting(
Application_Links *app,
View_Summary *view,
View_Setting_ID setting,
int32_t value
)
Parameters
view
The view parameter specifies the view on which to set a setting.
setting
The setting parameter identifies the setting that shall be changed.
value
The value parameter specifies the value to which the setting shall be changed.
Return
This call returns non-zero on success.
See Also

§3.3.30: view_set_split_proportion

bool32 app->view_set_split_proportion(
Application_Links *app,
View_Summary *view,
float t
)
Parameters
view
The view parameter specifies which view shall have it's size adjusted.
t
The t parameter specifies the proportion of the containing box that the view should occupy. t should be in [0,1].
Return
This call returns non-zero on success.

§3.3.31: view_compute_cursor

bool32 app->view_compute_cursor(
Application_Links *app,
View_Summary *view,
Buffer_Seek seek,
Full_Cursor *cursor_out
)
Parameters
view
The view parameter specifies the view on which to run the cursor computation.
seek
The seek parameter specifies the target position for the seek.
cursor_out
On success this struct is filled with the result of the seek.
Return
This call returns non-zero on success.
Description
Computes a Full_Cursor for the given seek position with no side effects.

See Also

§3.3.32: view_set_cursor

bool32 app->view_set_cursor(
Application_Links *app,
View_Summary *view,
Buffer_Seek seek,
bool32 set_preferred_x
)
Parameters
view
The view parameter specifies the view in which to set the cursor.
seek
The seek parameter specifies the target position for the seek.
set_preferred_x
If this parameter is true the preferred x is updated to match the new cursor x.
Return
This call returns non-zero on success.
Description
This call sets the the view's cursor position. set_preferred_x should usually be true unless the change in cursor position is is a vertical motion that tries to keep the -cursor in the same column or x position.

See Also

§3.3.32: view_set_scroll

bool32 app->view_set_scroll(
Application_Links *app,
View_Summary *view,
GUI_Scroll_Vars scroll
)
Description
TODO

See Also

§3.3.33: view_set_mark

bool32 app->view_set_mark(
Application_Links *app,
View_Summary *view,
Buffer_Seek seek
)
Parameters
view
The view parameter specifies the view in which to set the mark.
seek
The seek parameter specifies the target position for the seek.
Return
This call returns non-zero on success.
Description
This call sets the the view's mark position.

See Also

§3.3.34: view_set_highlight

bool32 app->view_set_highlight(
Application_Links *app,
View_Summary *view,
int32_t start,
int32_t end,
bool32 turn_on
)
Parameters
view
The view parameter specifies the view in which to set the highlight.
start
This parameter specifies the absolute position of the first character of the highlight range.
end
This parameter specifies the absolute position of the character one past the end of the highlight range.
turn_on
This parameter indicates whether the highlight is being turned on or off.
Return
This call returns non-zero on success.
Description
The highlight is mutually exclusive to the cursor. When the turn_on parameter +cursor in the same column or x position.

See Also

§3.3.33: view_set_scroll

bool32 app->view_set_scroll(
Application_Links *app,
View_Summary *view,
GUI_Scroll_Vars scroll
)
Description
TODO

See Also

§3.3.34: view_set_mark

bool32 app->view_set_mark(
Application_Links *app,
View_Summary *view,
Buffer_Seek seek
)
Parameters
view
The view parameter specifies the view in which to set the mark.
seek
The seek parameter specifies the target position for the seek.
Return
This call returns non-zero on success.
Description
This call sets the the view's mark position.

See Also

§3.3.35: view_set_highlight

bool32 app->view_set_highlight(
Application_Links *app,
View_Summary *view,
int32_t start,
int32_t end,
bool32 turn_on
)
Parameters
view
The view parameter specifies the view in which to set the highlight.
start
This parameter specifies the absolute position of the first character of the highlight range.
end
This parameter specifies the absolute position of the character one past the end of the highlight range.
turn_on
This parameter indicates whether the highlight is being turned on or off.
Return
This call returns non-zero on success.
Description
The highlight is mutually exclusive to the cursor. When the turn_on parameter is set to true the highlight will be shown and the cursor will be hidden. After that either setting the cursor with view_set_cursor or calling view_set_highlight -and the turn_on set to false, will switch back to showing the cursor.


§3.3.35: view_set_buffer

bool32 app->view_set_buffer(
Application_Links *app,
View_Summary *view,
Buffer_ID buffer_id,
Set_Buffer_Flag flags
)
Parameters
view
The view parameter specifies the view in which to display the buffer.
buffer_id
The buffer_id parameter specifies which buffer to show in the view.
flags
The flags parameter specifies behaviors for setting the buffer.
Return
This call returns non-zero on success.
Description
On success view_set_buffer sets the specified view's current buffer and -cancels and dialogue shown in the view and displays the file.

See Also

§3.3.36: view_post_fade

bool32 app->view_post_fade(
Application_Links *app,
View_Summary *view,
float seconds,
int32_t start,
int32_t end,
int_color color
)
Parameters
view
The view parameter specifies the view onto which the fade effect shall be posted.
seconds
This parameter specifies the number of seconds the fade effect should last.
start
This parameter specifies the absolute position of the first character of the fade range.
end
This parameter specifies the absolute position of the character one past the end of the fdae range.
color
The color parameter specifies the initial color of the text before it fades to it's natural color.
Return
This call returns non-zero on success.
See Also

§3.3.37: get_user_input

User_Input app->get_user_input(
Application_Links *app,
Input_Type_Flag get_type,
Input_Type_Flag abort_type
)
Parameters
get_type
The get_type parameter specifies the set of input types that should be returned.
abort_type
The get_type parameter specifies the set of input types that should trigger an abort signal.
Return
This call returns a User_Input that describes a user input event.
Description
This call preempts the command. The command is resumed if either a get or abort condition +and the turn_on set to false, will switch back to showing the cursor.


§3.3.36: view_set_buffer

bool32 app->view_set_buffer(
Application_Links *app,
View_Summary *view,
Buffer_ID buffer_id,
Set_Buffer_Flag flags
)
Parameters
view
The view parameter specifies the view in which to display the buffer.
buffer_id
The buffer_id parameter specifies which buffer to show in the view.
flags
The flags parameter specifies behaviors for setting the buffer.
Return
This call returns non-zero on success.
Description
On success view_set_buffer sets the specified view's current buffer and +cancels and dialogue shown in the view and displays the file.

See Also

§3.3.37: view_post_fade

bool32 app->view_post_fade(
Application_Links *app,
View_Summary *view,
float seconds,
int32_t start,
int32_t end,
int_color color
)
Parameters
view
The view parameter specifies the view onto which the fade effect shall be posted.
seconds
This parameter specifies the number of seconds the fade effect should last.
start
This parameter specifies the absolute position of the first character of the fade range.
end
This parameter specifies the absolute position of the character one past the end of the fdae range.
color
The color parameter specifies the initial color of the text before it fades to it's natural color.
Return
This call returns non-zero on success.
See Also

§3.3.38: get_user_input

User_Input app->get_user_input(
Application_Links *app,
Input_Type_Flag get_type,
Input_Type_Flag abort_type
)
Parameters
get_type
The get_type parameter specifies the set of input types that should be returned.
abort_type
The get_type parameter specifies the set of input types that should trigger an abort signal.
Return
This call returns a User_Input that describes a user input event.
Description
This call preempts the command. The command is resumed if either a get or abort condition is met, or if another command is executed. If either the abort condition is met or another command is executed an abort signal is returned. If an abort signal is ever returned the command should finish execution without any more calls that preempt the command. -If a get condition is met the user input is returned.

See Also

§3.3.38: get_command_input

User_Input app->get_command_input(
Application_Links *app
)
Return
This call returns the input that triggered the currently executing command.
See Also

§3.3.39: get_mouse_state

Mouse_State app->get_mouse_state(
Application_Links *app
)
Return
This call returns the current mouse state as of the beginning of the frame.
See Also

§3.3.40: start_query_bar

bool32 app->start_query_bar(
Application_Links *app,
Query_Bar *bar,
uint32_t flags
)
Parameters
bar
This parameter provides a Query_Bar that should remain in valid memory +If a get condition is met the user input is returned.

See Also

§3.3.39: get_command_input

User_Input app->get_command_input(
Application_Links *app
)
Return
This call returns the input that triggered the currently executing command.
See Also

§3.3.40: get_mouse_state

Mouse_State app->get_mouse_state(
Application_Links *app
)
Return
This call returns the current mouse state as of the beginning of the frame.
See Also

§3.3.41: start_query_bar

bool32 app->start_query_bar(
Application_Links *app,
Query_Bar *bar,
uint32_t flags
)
Parameters
bar
This parameter provides a Query_Bar that should remain in valid memory until end_query_bar or the end of the command. It is commonly a good idea to make this a pointer to a Query_Bar stored on the stack.
flags
This parameter is not currently used and should be 0 for now.
Return
This call returns non-zero on success.
Description
This call tells the active view to begin displaying a "Query_Bar" which is a small GUI element that can overlap a buffer or other 4coder GUI. The contents of the bar can be changed after the call to start_query_bar and the query bar shown by 4coder will reflect the change. Since the bar stops showing when the command exits the -only use for this call is in an interactive command that makes calls to get_user_input.


§3.3.41: end_query_bar

void app->end_query_bar(
Application_Links *app,
Query_Bar *bar,
uint32_t flags
)
Parameters
bar
This parameter should be a bar pointer of a currently active query bar.
flags
This parameter is not currently used and should be 0 for now.
Description
Stops showing the particular query bar specified by the bar parameter.



§3.3.43: change_theme

void app->change_theme(
Application_Links *app,
char *name,
int32_t len
)
Parameters
name
The name parameter specifies the name of the theme to begin using; it need not be null terminated.
len
The len parameter specifies the length of the name string.
Description
This call changes 4coder's color pallet to one of the built in themes.


§3.3.44: change_font

void app->change_font(
Application_Links *app,
char *name,
int32_t len,
bool32 apply_to_all_files
)
Parameters
name
The name parameter specifies the name of the font to begin using; it need not be null terminated.
len
The len parameter specifies the length of the name string.
apply_to_all_files
If this is set all open files change to this font. Usually this should be true -durring the start hook because several files already exist at that time.
Description
This call changes 4coder's default font to one of the built in fonts.


§3.3.45: buffer_set_font

void app->buffer_set_font(
Application_Links *app,
Buffer_Summary *buffer,
char *name,
int32_t len
)
Parameters
buffer
This parameter the buffer that shall have it's font changed
name
The name parameter specifies the name of the font to begin using; it need not be null terminated.
len
The len parameter specifies the length of the name string.
Description
This call sets the display font of a particular buffer.


§3.3.46: set_theme_colors

void app->set_theme_colors(
Application_Links *app,
Theme_Color *colors,
int32_t count
)
Parameters
colors
The colors pointer provides an array of color structs pairing differet style tags to color codes.
count
The count parameter specifies the number of Theme_Color structs in the colors array.
Description
For each struct in the array, the slot in the main color pallet specified by the +only use for this call is in an interactive command that makes calls to get_user_input.


§3.3.42: end_query_bar

void app->end_query_bar(
Application_Links *app,
Query_Bar *bar,
uint32_t flags
)
Parameters
bar
This parameter should be a bar pointer of a currently active query bar.
flags
This parameter is not currently used and should be 0 for now.
Description
Stops showing the particular query bar specified by the bar parameter.



§3.3.44: change_theme

void app->change_theme(
Application_Links *app,
char *name,
int32_t len
)
Parameters
name
The name parameter specifies the name of the theme to begin using; it need not be null terminated.
len
The len parameter specifies the length of the name string.
Description
This call changes 4coder's color pallet to one of the built in themes.


§3.3.45: change_font

void app->change_font(
Application_Links *app,
char *name,
int32_t len,
bool32 apply_to_all_files
)
Parameters
name
The name parameter specifies the name of the font to begin using; it need not be null terminated.
len
The len parameter specifies the length of the name string.
apply_to_all_files
If this is set all open files change to this font. Usually this should be true +durring the start hook because several files already exist at that time.
Description
This call changes 4coder's default font to one of the built in fonts.


§3.3.46: buffer_set_font

void app->buffer_set_font(
Application_Links *app,
Buffer_Summary *buffer,
char *name,
int32_t len
)
Parameters
buffer
This parameter the buffer that shall have it's font changed
name
The name parameter specifies the name of the font to begin using; it need not be null terminated.
len
The len parameter specifies the length of the name string.
Description
This call sets the display font of a particular buffer.


§3.3.47: set_theme_colors

void app->set_theme_colors(
Application_Links *app,
Theme_Color *colors,
int32_t count
)
Parameters
colors
The colors pointer provides an array of color structs pairing differet style tags to color codes.
count
The count parameter specifies the number of Theme_Color structs in the colors array.
Description
For each struct in the array, the slot in the main color pallet specified by the struct's tag is set to the color code in the struct. If the tag value is invalid -no change is made to the color pallet.


§3.3.47: get_theme_colors

void app->get_theme_colors(
Application_Links *app,
Theme_Color *colors,
int32_t count
)
Parameters
colors
an array of color structs listing style tags to get color values for
count
the number of color structs in the colors array
Description
For each struct in the array, the color field of the struct is filled with the +no change is made to the color pallet.


§3.3.48: get_theme_colors

void app->get_theme_colors(
Application_Links *app,
Theme_Color *colors,
int32_t count
)
Parameters
colors
an array of color structs listing style tags to get color values for
count
the number of color structs in the colors array
Description
For each struct in the array, the color field of the struct is filled with the color from the slot in the main color pallet specified by the tag. If the tag -value is invalid the color is filled with black.


§3.3.48: directory_get_hot

int32_t app->directory_get_hot(
Application_Links *app,
char *out,
int32_t capacity
)
Parameters
out
This parameter provides a character buffer that receives the 4coder 'hot directory'.
capacity
This parameter specifies the maximum size to be output to the out buffer.
Return
This call returns the size of the string written into the buffer.
Description
4coder has a concept of a 'hot directory' which is the directory most recently +value is invalid the color is filled with black.


§3.3.49: directory_get_hot

int32_t app->directory_get_hot(
Application_Links *app,
char *out,
int32_t capacity
)
Parameters
out
This parameter provides a character buffer that receives the 4coder 'hot directory'.
capacity
This parameter specifies the maximum size to be output to the out buffer.
Return
This call returns the size of the string written into the buffer.
Description
4coder has a concept of a 'hot directory' which is the directory most recently accessed in the GUI. Whenever the GUI is opened it shows the hot directory.

In the future this will be deprecated and eliminated in favor of more flexible -directories controlled on the custom side.


§3.3.49: get_file_list

File_List app->get_file_list(
Application_Links *app,
char *dir,
int32_t len
)
Parameters
dir
This parameter specifies the directory whose files will be enumerated in the returned list; it need not be null terminated.
len
This parameter the length of the dir string.
Return
This call returns a File_List struct containing pointers to the names of the files in +directories controlled on the custom side.


§3.3.50: get_file_list

File_List app->get_file_list(
Application_Links *app,
char *dir,
int32_t len
)
Parameters
dir
This parameter specifies the directory whose files will be enumerated in the returned list; it need not be null terminated.
len
This parameter the length of the dir string.
Return
This call returns a File_List struct containing pointers to the names of the files in the specified directory. The File_List returned should be passed to free_file_list -when it is no longer in use.

§3.3.50: free_file_list

void app->free_file_list(
Application_Links *app,
File_List list
)
Parameters
list
This parameter provides the file list to be freed.
Description
After this call the file list passed in should not be read or written to.


§3.3.51: memory_allocate

void* app->memory_allocate(
Application_Links *app,
int32_t size
)
Parameters
size
The size in bytes of the block that should be returned.
Description
This calls to a low level OS allocator which means it is best used +when it is no longer in use.

§3.3.51: free_file_list

void app->free_file_list(
Application_Links *app,
File_List list
)
Parameters
list
This parameter provides the file list to be freed.
Description
After this call the file list passed in should not be read or written to.


§3.3.52: memory_allocate

void* app->memory_allocate(
Application_Links *app,
int32_t size
)
Parameters
size
The size in bytes of the block that should be returned.
Description
This calls to a low level OS allocator which means it is best used for infrequent, large allocations. The size of the block must be remembered -if it will be freed or if it's mem protection status will be changed.

See Also

§3.3.52: memory_set_protection

bool32 app->memory_set_protection(
Application_Links *app,
void *ptr,
int32_t size,
Memory_Protect_Flags flags
)
Parameters
ptr
The base of the block on which to set memory protection flags.
size
The size that was originally used to allocate this block.
flags
The new memory protection flags.
Description
This call sets the memory protection flags of a block of memory that was previously -allocate by memory_allocate.

See Also

§3.3.53: memory_free

void app->memory_free(
Application_Links *app,
void *ptr,
int32_t size
)
Parameters
mem
The base of a block to free.
size
The size that was originally used to allocate this block.
Description
This call frees a block of memory that was previously allocated by -memory_allocate.

See Also

§3.3.54: file_exists

bool32 app->file_exists(
Application_Links *app,
char *filename,
int32_t len
)
Parameters
filename
This parameter specifies the full path to a file; it need not be null terminated.
len
This parameter specifies the length of the filename string.
Return
This call returns non-zero if and only if the file exists.

§3.3.55: directory_cd

bool32 app->directory_cd(
Application_Links *app,
char *dir,
int32_t *len,
int32_t capacity,
char *rel_path,
int32_t rel_len
)
Parameters
dir
This parameter provides a character buffer that stores a directory; it need not be null terminated.
len
This parameter specifies the length of the dir string.
capacity
This parameter specifies the maximum size of the dir string.
rel_path
This parameter specifies the path to change to, may include '.' or '..'; it need not be null terminated.
rel_len
This parameter specifies the length of the rel_path string.
Return
This call returns non-zero if the call succeeds.
Description
This call succeeds if the new directory exists and the it fits inside the +if it will be freed or if it's mem protection status will be changed.

See Also

§3.3.53: memory_set_protection

bool32 app->memory_set_protection(
Application_Links *app,
void *ptr,
int32_t size,
Memory_Protect_Flags flags
)
Parameters
ptr
The base of the block on which to set memory protection flags.
size
The size that was originally used to allocate this block.
flags
The new memory protection flags.
Description
This call sets the memory protection flags of a block of memory that was previously +allocate by memory_allocate.

See Also

§3.3.54: memory_free

void app->memory_free(
Application_Links *app,
void *ptr,
int32_t size
)
Parameters
mem
The base of a block to free.
size
The size that was originally used to allocate this block.
Description
This call frees a block of memory that was previously allocated by +memory_allocate.

See Also

§3.3.55: file_exists

bool32 app->file_exists(
Application_Links *app,
char *filename,
int32_t len
)
Parameters
filename
This parameter specifies the full path to a file; it need not be null terminated.
len
This parameter specifies the length of the filename string.
Return
This call returns non-zero if and only if the file exists.

§3.3.56: directory_cd

bool32 app->directory_cd(
Application_Links *app,
char *dir,
int32_t *len,
int32_t capacity,
char *rel_path,
int32_t rel_len
)
Parameters
dir
This parameter provides a character buffer that stores a directory; it need not be null terminated.
len
This parameter specifies the length of the dir string.
capacity
This parameter specifies the maximum size of the dir string.
rel_path
This parameter specifies the path to change to, may include '.' or '..'; it need not be null terminated.
rel_len
This parameter specifies the length of the rel_path string.
Return
This call returns non-zero if the call succeeds.
Description
This call succeeds if the new directory exists and the it fits inside the dir buffer. If the call succeeds the dir buffer is filled with the new directory and len is overwritten with the length of the new string in the buffer.

For instance if dir contains "C:/Users/MySelf" and rel is "Documents" the buffer will contain "C:/Users/MySelf/Documents" and len will contain the length of that string. This call can also be used with rel set to ".." to traverse to parent -folders.


§3.3.56: get_4ed_path

bool32 app->get_4ed_path(
Application_Links *app,
char *out,
int32_t capacity
)
Parameters
out
This parameter provides a character buffer that receives the path to the 4ed executable file.
capacity
This parameter specifies the maximum capacity of the out buffer.
Return
This call returns non-zero on success.

§3.3.57: show_mouse_cursor

void app->show_mouse_cursor(
Application_Links *app,
Mouse_Cursor_Show_Type show
)
Parameters
show
This parameter specifies the new state of the mouse cursor.
See Also

§3.3.58: toggle_fullscreen

void app->toggle_fullscreen(
Application_Links *app
)
Description
This call tells 4coder to switch into or out of full screen mode. +folders.


§3.3.57: get_4ed_path

bool32 app->get_4ed_path(
Application_Links *app,
char *out,
int32_t capacity
)
Parameters
out
This parameter provides a character buffer that receives the path to the 4ed executable file.
capacity
This parameter specifies the maximum capacity of the out buffer.
Return
This call returns non-zero on success.

§3.3.58: show_mouse_cursor

void app->show_mouse_cursor(
Application_Links *app,
Mouse_Cursor_Show_Type show
)
Parameters
show
This parameter specifies the new state of the mouse cursor.
See Also

§3.3.59: toggle_fullscreen

void app->toggle_fullscreen(
Application_Links *app
)
Description
This call tells 4coder to switch into or out of full screen mode. The changes of full screen mode do not take effect until the end of the current frame. On Windows this call will not work unless 4coder was started in "stream mode". -Stream mode can be enabled with -S or -F flags on the command line to 4ed.


§3.3.59: is_fullscreen

bool32 app->is_fullscreen(
Application_Links *app
)
Description
This call returns true if the 4coder is in full screen mode. This call +Stream mode can be enabled with -S or -F flags on the command line to 4ed.


§3.3.60: is_fullscreen

bool32 app->is_fullscreen(
Application_Links *app
)
Description
This call returns true if the 4coder is in full screen mode. This call takes toggles that have already occured this frame into account. So it may return true even though the frame has not ended and actually put 4coder into full screen. If it returns true though, 4coder will definitely be full screen by the beginning of the next -frame if the state is not changed.


§3.3.60: send_exit_signal

void app->send_exit_signal(
Application_Links *app
)
Description
This call sends a signal to 4coder to attempt to exit. If there are unsaved +frame if the state is not changed.


§3.3.61: send_exit_signal

void app->send_exit_signal(
Application_Links *app
)
Description
This call sends a signal to 4coder to attempt to exit. If there are unsaved files this triggers a dialogue ensuring you're okay with closing.


§3.4 Type Descriptions

§3.4.1: bool32

typedef int32_t bool32;
Description
bool32 is an alias name to signal that an integer parameter or field is for true/false vales.


§3.4.2: int_color

typedef uint32_t int_color;
Description
int_color is an alias name to signal that an integer parameter or field is for a color value, colors are specified as 24 bit integers in 3 channels: 0xRRGGBB.


§3.4.3: Key_Code

typedef unsigned char Key_Code;
Description
Key_Code is the alias for key codes including raw codes and codes translated diff --git a/4coder_custom_api.h b/4coder_custom_api.h index 32b31963..f2b5b583 100644 --- a/4coder_custom_api.h +++ b/4coder_custom_api.h @@ -15,6 +15,7 @@ #define BUFFER_SET_SETTING_SIG(n) bool32 n(Application_Links *app, Buffer_Summary *buffer, Buffer_Setting_ID setting, int32_t value) #define BUFFER_TOKEN_COUNT_SIG(n) int32_t n(Application_Links *app, Buffer_Summary *buffer) #define BUFFER_READ_TOKENS_SIG(n) bool32 n(Application_Links *app, Buffer_Summary *buffer, int32_t start_token, int32_t end_token, Cpp_Token *tokens_out) +#define BUFFER_GET_TOKEN_INDEX_SIG(n) bool32 n(Application_Links *app, Buffer_Summary *buffer, int32_t pos, Cpp_Get_Token_Result *get_result) #define CREATE_BUFFER_SIG(n) Buffer_Summary n(Application_Links *app, char *filename, int32_t filename_len, Buffer_Create_Flag flags) #define SAVE_BUFFER_SIG(n) bool32 n(Application_Links *app, Buffer_Summary *buffer, char *filename, int32_t filename_len, uint32_t flags) #define KILL_BUFFER_SIG(n) bool32 n(Application_Links *app, Buffer_Identifier buffer, View_ID view_id, Buffer_Kill_Flag flags) @@ -75,6 +76,7 @@ typedef BUFFER_BATCH_EDIT_SIG(Buffer_Batch_Edit_Function); typedef BUFFER_SET_SETTING_SIG(Buffer_Set_Setting_Function); typedef BUFFER_TOKEN_COUNT_SIG(Buffer_Token_Count_Function); typedef BUFFER_READ_TOKENS_SIG(Buffer_Read_Tokens_Function); +typedef BUFFER_GET_TOKEN_INDEX_SIG(Buffer_Get_Token_Index_Function); typedef CREATE_BUFFER_SIG(Create_Buffer_Function); typedef SAVE_BUFFER_SIG(Save_Buffer_Function); typedef KILL_BUFFER_SIG(Kill_Buffer_Function); @@ -136,6 +138,7 @@ Buffer_Batch_Edit_Function *buffer_batch_edit; Buffer_Set_Setting_Function *buffer_set_setting; Buffer_Token_Count_Function *buffer_token_count; Buffer_Read_Tokens_Function *buffer_read_tokens; +Buffer_Get_Token_Index_Function *buffer_get_token_index; Create_Buffer_Function *create_buffer; Save_Buffer_Function *save_buffer; Kill_Buffer_Function *kill_buffer; @@ -204,6 +207,7 @@ app_links->buffer_batch_edit = Buffer_Batch_Edit;\ app_links->buffer_set_setting = Buffer_Set_Setting;\ app_links->buffer_token_count = Buffer_Token_Count;\ app_links->buffer_read_tokens = Buffer_Read_Tokens;\ +app_links->buffer_get_token_index = Buffer_Get_Token_Index;\ app_links->create_buffer = Create_Buffer;\ app_links->save_buffer = Save_Buffer;\ app_links->kill_buffer = Kill_Buffer;\ diff --git a/4coder_default_include.cpp b/4coder_default_include.cpp index 10d0f2f6..bbded083 100644 --- a/4coder_default_include.cpp +++ b/4coder_default_include.cpp @@ -131,6 +131,20 @@ init_memory(Application_Links *app){ general_memory_open(&global_general, general_mem, general_size); } +// +// Helpers +// + +static void +refresh_buffer(Application_Links *app, Buffer_Summary *buffer){ + *buffer = app->get_buffer(app, buffer->buffer_id, AccessAll); +} + +static void +refresh_view(Application_Links *app, View_Summary *view){ + *view = app->get_view(app, view->view_id, AccessAll); +} + // // Buffer Streaming // @@ -148,7 +162,7 @@ struct Stream_Chunk{ char *data; }; -int32_t +static int32_t round_down(int32_t x, int32_t b){ int32_t r = 0; if (x >= 0){ @@ -157,7 +171,7 @@ round_down(int32_t x, int32_t b){ return(r); } -int32_t +static int32_t round_up(int32_t x, int32_t b){ int32_t r = 0; if (x >= 0){ @@ -166,21 +180,10 @@ round_up(int32_t x, int32_t b){ return(r); } -void -refresh_buffer(Application_Links *app, Buffer_Summary *buffer){ - *buffer = app->get_buffer(app, buffer->buffer_id, AccessAll); -} - -void -refresh_view(Application_Links *app, View_Summary *view){ - *view = app->get_view(app, view->view_id, AccessAll); -} - -bool32 -init_stream_chunk(Stream_Chunk *chunk, - Application_Links *app, Buffer_Summary *buffer, +static bool32 +init_stream_chunk(Stream_Chunk *chunk, Application_Links *app, Buffer_Summary *buffer, int32_t pos, char *data, int32_t size){ - bool32 result = false; + bool32 result = 0; refresh_buffer(app, buffer); if (pos >= 0 && pos < buffer->size && size > 0){ @@ -205,17 +208,18 @@ init_stream_chunk(Stream_Chunk *chunk, if (chunk->start < chunk->end){ app->buffer_read_range(app, buffer, chunk->start, chunk->end, chunk->base_data); chunk->data = chunk->base_data - chunk->start; - result = true; + result = 1; } } + return(result); } -int32_t +static bool32 forward_stream_chunk(Stream_Chunk *chunk){ Application_Links *app = chunk->app; Buffer_Summary *buffer = chunk->buffer; - int32_t result = false; + bool32 result = 0; refresh_buffer(app, buffer); if (chunk->end < buffer->size){ @@ -232,7 +236,7 @@ forward_stream_chunk(Stream_Chunk *chunk){ if (chunk->start < chunk->end){ app->buffer_read_range(app, buffer, chunk->start, chunk->end, chunk->base_data); chunk->data = chunk->base_data - chunk->start; - result = true; + result = 1; } } @@ -241,17 +245,17 @@ forward_stream_chunk(Stream_Chunk *chunk){ chunk->end = buffer->size + 1; chunk->base_data[0] = 0; chunk->data = chunk->base_data - chunk->start; - result = true; + result = 1; } return(result); } -int32_t +static bool32 backward_stream_chunk(Stream_Chunk *chunk){ Application_Links *app = chunk->app; Buffer_Summary *buffer = chunk->buffer; - int32_t result = false; + bool32 result = 0; refresh_buffer(app, buffer); if (chunk->start > 0){ @@ -268,7 +272,7 @@ backward_stream_chunk(Stream_Chunk *chunk){ if (chunk->start < chunk->end){ app->buffer_read_range(app, buffer, chunk->start, chunk->end, chunk->base_data); chunk->data = chunk->base_data - chunk->start; - result = true; + result = 1; } } @@ -277,6 +281,91 @@ backward_stream_chunk(Stream_Chunk *chunk){ chunk->end = 0; chunk->base_data[0] = 0; chunk->data = chunk->base_data - chunk->start; + result = 1; + } + + return(result); +} + +typedef struct Stream_Tokens{ + Application_Links *app; + Buffer_Summary *buffer; + + Cpp_Token *base_tokens; + Cpp_Token *tokens; + int32_t start, end; + int32_t count, token_count; +} Stream_Tokens; + +static bool32 +init_stream_tokens(Stream_Tokens *stream, Application_Links *app, Buffer_Summary *buffer, + int32_t pos, Cpp_Token *data, int32_t count){ + bool32 result = 0; + + refresh_buffer(app, buffer); + + int32_t token_count = app->buffer_token_count(app, buffer); + if (pos >= 0 && pos < token_count && count > 0){ + stream->app = app; + stream->buffer = buffer; + stream->base_tokens = data; + stream->count = count; + stream->start = round_down(pos, count); + stream->end = round_up(pos, count); + + app->buffer_read_tokens(app, buffer, stream->start, stream->end, stream->base_tokens); + stream->tokens = stream->base_tokens - stream->start; + result = 1; + } + + return(result); +} + +static bool32 +forward_stream_tokens(Stream_Tokens *stream){ + Application_Links *app = stream->app; + Buffer_Summary *buffer = stream->buffer; + bool32 result = 0; + + refresh_buffer(app, buffer); + if (stream->end < stream->token_count){ + stream->start = stream->end; + stream->end += stream->count; + + if (stream->token_count < stream->end){ + stream->end = stream->token_count; + } + + if (stream->start < stream->end){ + app->buffer_read_tokens(app, buffer, stream->start, stream->end, stream->base_tokens); + stream->tokens = stream->base_tokens - stream->start; + result = 1; + } + } + + return(result); +} + +static bool32 +backward_stream_tokens(Stream_Tokens *stream){ + Application_Links *app = stream->app; + Buffer_Summary *buffer = stream->buffer; + bool32 result = 0; + + refresh_buffer(app, buffer); + if (stream->start > 0){ + stream->end = stream->start; + stream->start -= stream->count; + + if (0 > stream->start){ + stream->start = 0; + } + + if (stream->start < stream->end){ + app->buffer_read_tokens(app, buffer, stream->start, stream->end, stream->base_tokens); + stream->tokens = stream->base_tokens - stream->start; + result = 1; + } } return(result); @@ -310,7 +399,7 @@ buffer_seek_delimiter_forward(Application_Links *app, Buffer_Summary *buffer, finished:; } -void +static void buffer_seek_delimiter_backward(Application_Links *app, Buffer_Summary *buffer, int32_t pos, char delim, int32_t *result){ if (buffer->exists){ @@ -344,7 +433,7 @@ buffer_seek_delimiter_backward(Application_Links *app, Buffer_Summary *buffer, // NOTE(allen): This is limitted to a string size of 512. // You can push it up or do something more clever by just // replacing char read_buffer[512]; with more memory. -void +static void buffer_seek_string_forward(Application_Links *app, Buffer_Summary *buffer, int32_t pos, int32_t end, char *str, int32_t size, int32_t *result){ char read_buffer[512]; @@ -399,7 +488,7 @@ buffer_seek_string_forward(Application_Links *app, Buffer_Summary *buffer, // NOTE(allen): This is limitted to a string size of 512. // You can push it up or do something more clever by just // replacing char read_buffer[512]; with more memory. -void +static void buffer_seek_string_backward(Application_Links *app, Buffer_Summary *buffer, int32_t pos, int32_t min, char *str, int32_t size, int32_t *result){ char read_buffer[512]; @@ -448,7 +537,7 @@ buffer_seek_string_backward(Application_Links *app, Buffer_Summary *buffer, // NOTE(allen): This is limitted to a string size of 512. // You can push it up or do something more clever by just // replacing char read_buffer[512]; with more memory. -void +static void buffer_seek_string_insensitive_forward(Application_Links *app, Buffer_Summary *buffer, int32_t pos, int32_t end, char *str, int32_t size, int32_t *result){ char read_buffer[512]; @@ -498,7 +587,7 @@ buffer_seek_string_insensitive_forward(Application_Links *app, Buffer_Summary *b // NOTE(allen): This is limitted to a string size of 512. // You can push it up or do something more clever by just // replacing char read_buffer[512]; with more memory. -void +static void buffer_seek_string_insensitive_backward(Application_Links *app, Buffer_Summary *buffer, int32_t pos, int32_t min, char *str, int32_t size, int32_t *result){ char read_buffer[512]; diff --git a/4ed_api_implementation.cpp b/4ed_api_implementation.cpp index 797e9f59..c0876482 100644 --- a/4ed_api_implementation.cpp +++ b/4ed_api_implementation.cpp @@ -842,6 +842,23 @@ The number of output tokens will be end_token - start_token.) return(result); } +API_EXPORT bool32 +Buffer_Get_Token_Index(Application_Links *app, Buffer_Summary *buffer, int32_t pos, Cpp_Get_Token_Result *get_result){ + Command_Data *cmd = (Command_Data*)app->cmd_context; + Editing_File *file = imp_get_file(cmd, buffer); + Cpp_Token_Array token_array = file->state.token_array; + + bool32 result = 0; + if (file && token_array.tokens && file->state.tokens_complete){ + result = 1; + Cpp_Get_Token_Result get = {0}; + get = cpp_get_token(&token_array, pos); + *get_result = get; + } + + return(result); +} + API_EXPORT Buffer_Summary Create_Buffer(Application_Links *app, char *filename, int32_t filename_len, Buffer_Create_Flag flags)/* DOC_PARAM(filename, The filename parameter specifies the name of the file to be opened or created;