organized metaprogramming some more, still needs work. Setup the 'site' subproject
parent
9de2633f51
commit
de4f320e27
434
4coder_API.html
434
4coder_API.html
File diff suppressed because one or more lines are too long
|
@ -12,15 +12,14 @@
|
|||
#define BUFFER_REPLACE_RANGE_SIG(n) bool32 n(Application_Links *app, Buffer_Summary *buffer, int32_t start, int32_t end, char *str, int32_t len)
|
||||
#define BUFFER_COMPUTE_CURSOR_SIG(n) bool32 n(Application_Links *app, Buffer_Summary *buffer, Buffer_Seek seek, Partial_Cursor *cursor_out)
|
||||
#define BUFFER_BATCH_EDIT_SIG(n) bool32 n(Application_Links *app, Buffer_Summary *buffer, char *str, int32_t str_len, Buffer_Edit *edits, int32_t edit_count, Buffer_Batch_Edit_Type type)
|
||||
#define BUFFER_GET_SETTING_SIG(n) int32_t n(Application_Links *app, Buffer_Summary *buffer, Buffer_Setting_ID setting)
|
||||
#define BUFFER_GET_SETTING_SIG(n) int32_t n(Application_Links *app, Buffer_Summary *buffer, Buffer_Setting_ID setting, int32_t *value_out)
|
||||
#define BUFFER_SET_SETTING_SIG(n) bool32 n(Application_Links *app, Buffer_Summary *buffer, Buffer_Setting_ID setting, int32_t value)
|
||||
#define BUFFER_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 BEGIN_BUFFER_CREATION_SIG(n) void n(Application_Links *app, Buffer_Creation_Data *data, Buffer_Create_Flag flags)
|
||||
#define BUFFER_CREATION_NAME_SIG(n) void n(Application_Links *app, Buffer_Creation_Data *data, char *filename, int32_t filename_len, uint32_t flags)
|
||||
#define BEGIN_BUFFER_CREATION_SIG(n) bool32 n(Application_Links *app, Buffer_Creation_Data *data, Buffer_Create_Flag flags)
|
||||
#define BUFFER_CREATION_NAME_SIG(n) bool32 n(Application_Links *app, Buffer_Creation_Data *data, char *filename, int32_t filename_len, uint32_t flags)
|
||||
#define END_BUFFER_CREATION_SIG(n) Buffer_Summary n(Application_Links *app, Buffer_Creation_Data *data)
|
||||
#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)
|
||||
#define GET_VIEW_FIRST_SIG(n) View_Summary n(Application_Links *app, Access_Flag access)
|
||||
|
@ -30,7 +29,7 @@
|
|||
#define OPEN_VIEW_SIG(n) View_Summary n(Application_Links *app, View_Summary *view_location, View_Split_Position position)
|
||||
#define CLOSE_VIEW_SIG(n) bool32 n(Application_Links *app, View_Summary *view)
|
||||
#define SET_ACTIVE_VIEW_SIG(n) bool32 n(Application_Links *app, View_Summary *view)
|
||||
#define VIEW_GET_SETTING_SIG(n) int32_t n(Application_Links *app, View_Summary *view, View_Setting_ID setting)
|
||||
#define VIEW_GET_SETTING_SIG(n) bool32 n(Application_Links *app, View_Summary *view, View_Setting_ID setting, int32_t *value_out)
|
||||
#define VIEW_SET_SETTING_SIG(n) bool32 n(Application_Links *app, View_Summary *view, View_Setting_ID setting, int32_t value)
|
||||
#define VIEW_SET_SPLIT_PROPORTION_SIG(n) bool32 n(Application_Links *app, View_Summary *view, float t)
|
||||
#define VIEW_COMPUTE_CURSOR_SIG(n) bool32 n(Application_Links *app, View_Summary *view, Buffer_Seek seek, Full_Cursor *cursor_out)
|
||||
|
@ -49,7 +48,7 @@
|
|||
#define CHANGE_THEME_SIG(n) void n(Application_Links *app, char *name, int32_t len)
|
||||
#define CHANGE_FONT_SIG(n) void n(Application_Links *app, char *name, int32_t len, bool32 apply_to_all_files)
|
||||
#define BUFFER_SET_FONT_SIG(n) void n(Application_Links *app, Buffer_Summary *buffer, char *name, int32_t len)
|
||||
#define BUFFER_GET_FONT_SIG(n) int32_t n(Application_Links *app, Buffer_Summary *buffer, char *name_out, int32_t name_max)
|
||||
#define BUFFER_GET_FONT_SIG(n) bool32 n(Application_Links *app, Buffer_Summary *buffer, char *name_out, int32_t name_max)
|
||||
#define SET_THEME_COLORS_SIG(n) void n(Application_Links *app, Theme_Color *colors, int32_t count)
|
||||
#define GET_THEME_COLORS_SIG(n) void n(Application_Links *app, Theme_Color *colors, int32_t count)
|
||||
#define DIRECTORY_GET_HOT_SIG(n) int32_t n(Application_Links *app, char *out, int32_t capacity)
|
||||
|
@ -88,7 +87,6 @@ typedef BUFFER_GET_TOKEN_INDEX_SIG(Buffer_Get_Token_Index_Function);
|
|||
typedef BEGIN_BUFFER_CREATION_SIG(Begin_Buffer_Creation_Function);
|
||||
typedef BUFFER_CREATION_NAME_SIG(Buffer_Creation_Name_Function);
|
||||
typedef END_BUFFER_CREATION_SIG(End_Buffer_Creation_Function);
|
||||
typedef CREATE_BUFFER__SIG(Create_Buffer__Function);
|
||||
typedef SAVE_BUFFER_SIG(Save_Buffer_Function);
|
||||
typedef KILL_BUFFER_SIG(Kill_Buffer_Function);
|
||||
typedef GET_VIEW_FIRST_SIG(Get_View_First_Function);
|
||||
|
@ -158,7 +156,6 @@ Buffer_Get_Token_Index_Function *buffer_get_token_index;
|
|||
Begin_Buffer_Creation_Function *begin_buffer_creation;
|
||||
Buffer_Creation_Name_Function *buffer_creation_name;
|
||||
End_Buffer_Creation_Function *end_buffer_creation;
|
||||
Create_Buffer__Function *create_buffer_;
|
||||
Save_Buffer_Function *save_buffer;
|
||||
Kill_Buffer_Function *kill_buffer;
|
||||
Get_View_First_Function *get_view_first;
|
||||
|
@ -227,7 +224,6 @@ Buffer_Get_Token_Index_Function *buffer_get_token_index_;
|
|||
Begin_Buffer_Creation_Function *begin_buffer_creation_;
|
||||
Buffer_Creation_Name_Function *buffer_creation_name_;
|
||||
End_Buffer_Creation_Function *end_buffer_creation_;
|
||||
Create_Buffer__Function *create_buffer__;
|
||||
Save_Buffer_Function *save_buffer_;
|
||||
Kill_Buffer_Function *kill_buffer_;
|
||||
Get_View_First_Function *get_view_first_;
|
||||
|
@ -304,7 +300,6 @@ app_links->buffer_get_token_index_ = Buffer_Get_Token_Index;\
|
|||
app_links->begin_buffer_creation_ = Begin_Buffer_Creation;\
|
||||
app_links->buffer_creation_name_ = Buffer_Creation_Name;\
|
||||
app_links->end_buffer_creation_ = End_Buffer_Creation;\
|
||||
app_links->create_buffer__ = Create_Buffer_;\
|
||||
app_links->save_buffer_ = Save_Buffer;\
|
||||
app_links->kill_buffer_ = Kill_Buffer;\
|
||||
app_links->get_view_first_ = Get_View_First;\
|
||||
|
@ -365,15 +360,14 @@ static inline bool32 buffer_read_range(Application_Links *app, Buffer_Summary *b
|
|||
static inline bool32 buffer_replace_range(Application_Links *app, Buffer_Summary *buffer, int32_t start, int32_t end, char *str, int32_t len){return(app->buffer_replace_range(app, buffer, start, end, str, len));}
|
||||
static inline bool32 buffer_compute_cursor(Application_Links *app, Buffer_Summary *buffer, Buffer_Seek seek, Partial_Cursor *cursor_out){return(app->buffer_compute_cursor(app, buffer, seek, cursor_out));}
|
||||
static inline bool32 buffer_batch_edit(Application_Links *app, Buffer_Summary *buffer, char *str, int32_t str_len, Buffer_Edit *edits, int32_t edit_count, Buffer_Batch_Edit_Type type){return(app->buffer_batch_edit(app, buffer, str, str_len, edits, edit_count, type));}
|
||||
static inline int32_t buffer_get_setting(Application_Links *app, Buffer_Summary *buffer, Buffer_Setting_ID setting){return(app->buffer_get_setting(app, buffer, setting));}
|
||||
static inline int32_t buffer_get_setting(Application_Links *app, Buffer_Summary *buffer, Buffer_Setting_ID setting, int32_t *value_out){return(app->buffer_get_setting(app, buffer, setting, value_out));}
|
||||
static inline bool32 buffer_set_setting(Application_Links *app, Buffer_Summary *buffer, Buffer_Setting_ID setting, int32_t value){return(app->buffer_set_setting(app, buffer, setting, value));}
|
||||
static inline int32_t buffer_token_count(Application_Links *app, Buffer_Summary *buffer){return(app->buffer_token_count(app, buffer));}
|
||||
static inline bool32 buffer_read_tokens(Application_Links *app, Buffer_Summary *buffer, int32_t start_token, int32_t end_token, Cpp_Token *tokens_out){return(app->buffer_read_tokens(app, buffer, start_token, end_token, tokens_out));}
|
||||
static inline bool32 buffer_get_token_index(Application_Links *app, Buffer_Summary *buffer, int32_t pos, Cpp_Get_Token_Result *get_result){return(app->buffer_get_token_index(app, buffer, pos, get_result));}
|
||||
static inline void begin_buffer_creation(Application_Links *app, Buffer_Creation_Data *data, Buffer_Create_Flag flags){(app->begin_buffer_creation(app, data, flags));}
|
||||
static inline void buffer_creation_name(Application_Links *app, Buffer_Creation_Data *data, char *filename, int32_t filename_len, uint32_t flags){(app->buffer_creation_name(app, data, filename, filename_len, flags));}
|
||||
static inline bool32 begin_buffer_creation(Application_Links *app, Buffer_Creation_Data *data, Buffer_Create_Flag flags){return(app->begin_buffer_creation(app, data, flags));}
|
||||
static inline bool32 buffer_creation_name(Application_Links *app, Buffer_Creation_Data *data, char *filename, int32_t filename_len, uint32_t flags){return(app->buffer_creation_name(app, data, filename, filename_len, flags));}
|
||||
static inline Buffer_Summary end_buffer_creation(Application_Links *app, Buffer_Creation_Data *data){return(app->end_buffer_creation(app, data));}
|
||||
static inline Buffer_Summary create_buffer_(Application_Links *app, char *filename, int32_t filename_len, Buffer_Create_Flag flags){return(app->create_buffer_(app, filename, filename_len, flags));}
|
||||
static inline bool32 save_buffer(Application_Links *app, Buffer_Summary *buffer, char *filename, int32_t filename_len, uint32_t flags){return(app->save_buffer(app, buffer, filename, filename_len, flags));}
|
||||
static inline bool32 kill_buffer(Application_Links *app, Buffer_Identifier buffer, View_ID view_id, Buffer_Kill_Flag flags){return(app->kill_buffer(app, buffer, view_id, flags));}
|
||||
static inline View_Summary get_view_first(Application_Links *app, Access_Flag access){return(app->get_view_first(app, access));}
|
||||
|
@ -383,7 +377,7 @@ static inline View_Summary get_active_view(Application_Links *app, Access_Flag a
|
|||
static inline View_Summary open_view(Application_Links *app, View_Summary *view_location, View_Split_Position position){return(app->open_view(app, view_location, position));}
|
||||
static inline bool32 close_view(Application_Links *app, View_Summary *view){return(app->close_view(app, view));}
|
||||
static inline bool32 set_active_view(Application_Links *app, View_Summary *view){return(app->set_active_view(app, view));}
|
||||
static inline int32_t view_get_setting(Application_Links *app, View_Summary *view, View_Setting_ID setting){return(app->view_get_setting(app, view, setting));}
|
||||
static inline bool32 view_get_setting(Application_Links *app, View_Summary *view, View_Setting_ID setting, int32_t *value_out){return(app->view_get_setting(app, view, setting, value_out));}
|
||||
static inline bool32 view_set_setting(Application_Links *app, View_Summary *view, View_Setting_ID setting, int32_t value){return(app->view_set_setting(app, view, setting, value));}
|
||||
static inline bool32 view_set_split_proportion(Application_Links *app, View_Summary *view, float t){return(app->view_set_split_proportion(app, view, t));}
|
||||
static inline bool32 view_compute_cursor(Application_Links *app, View_Summary *view, Buffer_Seek seek, Full_Cursor *cursor_out){return(app->view_compute_cursor(app, view, seek, cursor_out));}
|
||||
|
@ -402,7 +396,7 @@ static inline void print_message(Application_Links *app, char *str, int32_t len)
|
|||
static inline void change_theme(Application_Links *app, char *name, int32_t len){(app->change_theme(app, name, len));}
|
||||
static inline void change_font(Application_Links *app, char *name, int32_t len, bool32 apply_to_all_files){(app->change_font(app, name, len, apply_to_all_files));}
|
||||
static inline void buffer_set_font(Application_Links *app, Buffer_Summary *buffer, char *name, int32_t len){(app->buffer_set_font(app, buffer, name, len));}
|
||||
static inline int32_t buffer_get_font(Application_Links *app, Buffer_Summary *buffer, char *name_out, int32_t name_max){return(app->buffer_get_font(app, buffer, name_out, name_max));}
|
||||
static inline bool32 buffer_get_font(Application_Links *app, Buffer_Summary *buffer, char *name_out, int32_t name_max){return(app->buffer_get_font(app, buffer, name_out, name_max));}
|
||||
static inline void set_theme_colors(Application_Links *app, Theme_Color *colors, int32_t count){(app->set_theme_colors(app, colors, count));}
|
||||
static inline void get_theme_colors(Application_Links *app, Theme_Color *colors, int32_t count){(app->get_theme_colors(app, colors, count));}
|
||||
static inline int32_t directory_get_hot(Application_Links *app, char *out, int32_t capacity){return(app->directory_get_hot(app, out, capacity));}
|
||||
|
@ -434,15 +428,14 @@ static inline bool32 buffer_read_range(Application_Links *app, Buffer_Summary *b
|
|||
static inline bool32 buffer_replace_range(Application_Links *app, Buffer_Summary *buffer, int32_t start, int32_t end, char *str, int32_t len){return(app->buffer_replace_range_(app, buffer, start, end, str, len));}
|
||||
static inline bool32 buffer_compute_cursor(Application_Links *app, Buffer_Summary *buffer, Buffer_Seek seek, Partial_Cursor *cursor_out){return(app->buffer_compute_cursor_(app, buffer, seek, cursor_out));}
|
||||
static inline bool32 buffer_batch_edit(Application_Links *app, Buffer_Summary *buffer, char *str, int32_t str_len, Buffer_Edit *edits, int32_t edit_count, Buffer_Batch_Edit_Type type){return(app->buffer_batch_edit_(app, buffer, str, str_len, edits, edit_count, type));}
|
||||
static inline int32_t buffer_get_setting(Application_Links *app, Buffer_Summary *buffer, Buffer_Setting_ID setting){return(app->buffer_get_setting_(app, buffer, setting));}
|
||||
static inline int32_t buffer_get_setting(Application_Links *app, Buffer_Summary *buffer, Buffer_Setting_ID setting, int32_t *value_out){return(app->buffer_get_setting_(app, buffer, setting, value_out));}
|
||||
static inline bool32 buffer_set_setting(Application_Links *app, Buffer_Summary *buffer, Buffer_Setting_ID setting, int32_t value){return(app->buffer_set_setting_(app, buffer, setting, value));}
|
||||
static inline int32_t buffer_token_count(Application_Links *app, Buffer_Summary *buffer){return(app->buffer_token_count_(app, buffer));}
|
||||
static inline bool32 buffer_read_tokens(Application_Links *app, Buffer_Summary *buffer, int32_t start_token, int32_t end_token, Cpp_Token *tokens_out){return(app->buffer_read_tokens_(app, buffer, start_token, end_token, tokens_out));}
|
||||
static inline bool32 buffer_get_token_index(Application_Links *app, Buffer_Summary *buffer, int32_t pos, Cpp_Get_Token_Result *get_result){return(app->buffer_get_token_index_(app, buffer, pos, get_result));}
|
||||
static inline void begin_buffer_creation(Application_Links *app, Buffer_Creation_Data *data, Buffer_Create_Flag flags){(app->begin_buffer_creation_(app, data, flags));}
|
||||
static inline void buffer_creation_name(Application_Links *app, Buffer_Creation_Data *data, char *filename, int32_t filename_len, uint32_t flags){(app->buffer_creation_name_(app, data, filename, filename_len, flags));}
|
||||
static inline bool32 begin_buffer_creation(Application_Links *app, Buffer_Creation_Data *data, Buffer_Create_Flag flags){return(app->begin_buffer_creation_(app, data, flags));}
|
||||
static inline bool32 buffer_creation_name(Application_Links *app, Buffer_Creation_Data *data, char *filename, int32_t filename_len, uint32_t flags){return(app->buffer_creation_name_(app, data, filename, filename_len, flags));}
|
||||
static inline Buffer_Summary end_buffer_creation(Application_Links *app, Buffer_Creation_Data *data){return(app->end_buffer_creation_(app, data));}
|
||||
static inline Buffer_Summary create_buffer_(Application_Links *app, char *filename, int32_t filename_len, Buffer_Create_Flag flags){return(app->create_buffer__(app, filename, filename_len, flags));}
|
||||
static inline bool32 save_buffer(Application_Links *app, Buffer_Summary *buffer, char *filename, int32_t filename_len, uint32_t flags){return(app->save_buffer_(app, buffer, filename, filename_len, flags));}
|
||||
static inline bool32 kill_buffer(Application_Links *app, Buffer_Identifier buffer, View_ID view_id, Buffer_Kill_Flag flags){return(app->kill_buffer_(app, buffer, view_id, flags));}
|
||||
static inline View_Summary get_view_first(Application_Links *app, Access_Flag access){return(app->get_view_first_(app, access));}
|
||||
|
@ -452,7 +445,7 @@ static inline View_Summary get_active_view(Application_Links *app, Access_Flag a
|
|||
static inline View_Summary open_view(Application_Links *app, View_Summary *view_location, View_Split_Position position){return(app->open_view_(app, view_location, position));}
|
||||
static inline bool32 close_view(Application_Links *app, View_Summary *view){return(app->close_view_(app, view));}
|
||||
static inline bool32 set_active_view(Application_Links *app, View_Summary *view){return(app->set_active_view_(app, view));}
|
||||
static inline int32_t view_get_setting(Application_Links *app, View_Summary *view, View_Setting_ID setting){return(app->view_get_setting_(app, view, setting));}
|
||||
static inline bool32 view_get_setting(Application_Links *app, View_Summary *view, View_Setting_ID setting, int32_t *value_out){return(app->view_get_setting_(app, view, setting, value_out));}
|
||||
static inline bool32 view_set_setting(Application_Links *app, View_Summary *view, View_Setting_ID setting, int32_t value){return(app->view_set_setting_(app, view, setting, value));}
|
||||
static inline bool32 view_set_split_proportion(Application_Links *app, View_Summary *view, float t){return(app->view_set_split_proportion_(app, view, t));}
|
||||
static inline bool32 view_compute_cursor(Application_Links *app, View_Summary *view, Buffer_Seek seek, Full_Cursor *cursor_out){return(app->view_compute_cursor_(app, view, seek, cursor_out));}
|
||||
|
@ -471,7 +464,7 @@ static inline void print_message(Application_Links *app, char *str, int32_t len)
|
|||
static inline void change_theme(Application_Links *app, char *name, int32_t len){(app->change_theme_(app, name, len));}
|
||||
static inline void change_font(Application_Links *app, char *name, int32_t len, bool32 apply_to_all_files){(app->change_font_(app, name, len, apply_to_all_files));}
|
||||
static inline void buffer_set_font(Application_Links *app, Buffer_Summary *buffer, char *name, int32_t len){(app->buffer_set_font_(app, buffer, name, len));}
|
||||
static inline int32_t buffer_get_font(Application_Links *app, Buffer_Summary *buffer, char *name_out, int32_t name_max){return(app->buffer_get_font_(app, buffer, name_out, name_max));}
|
||||
static inline bool32 buffer_get_font(Application_Links *app, Buffer_Summary *buffer, char *name_out, int32_t name_max){return(app->buffer_get_font_(app, buffer, name_out, name_max));}
|
||||
static inline void set_theme_colors(Application_Links *app, Theme_Color *colors, int32_t count){(app->set_theme_colors_(app, colors, count));}
|
||||
static inline void get_theme_colors(Application_Links *app, Theme_Color *colors, int32_t count){(app->get_theme_colors_(app, colors, count));}
|
||||
static inline int32_t directory_get_hot(Application_Links *app, char *out, int32_t capacity){return(app->directory_get_hot_(app, out, capacity));}
|
||||
|
|
|
@ -158,8 +158,30 @@ HOOK_SIG(my_start){
|
|||
HOOK_SIG(my_exit){
|
||||
// if this returns zero it cancels the exit.
|
||||
return(1);
|
||||
}
|
||||
}
|
||||
|
||||
// TODO(allen): delete this
|
||||
CUSTOM_COMMAND_SIG(weird_buffer_test){
|
||||
for (Buffer_Summary buffer = get_buffer_first(app, AccessAll);
|
||||
buffer.exists;
|
||||
get_buffer_next(app, &buffer, AccessAll)){
|
||||
print_message(app, literal("filename:"));
|
||||
if (buffer.file_name){
|
||||
print_message(app, buffer.file_name, buffer.file_name_len);
|
||||
}
|
||||
else{
|
||||
print_message(app, literal("*NULL*"));
|
||||
}
|
||||
print_message(app, literal("buffername:"));
|
||||
if (buffer.buffer_name){
|
||||
print_message(app, buffer.buffer_name, buffer.buffer_name_len);
|
||||
}
|
||||
else{
|
||||
print_message(app, literal("*NULL*"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// NOTE(allen|a4.0.12): This is for testing it may be removed and replaced with a better test for the buffer_get_font when you eventally read this and wonder what it's about.
|
||||
CUSTOM_COMMAND_SIG(write_name_of_font){
|
||||
View_Summary view = get_active_view(app, AccessOpen);
|
||||
|
@ -314,6 +336,7 @@ default_keys(Bind_Helper *context){
|
|||
bind(context, key_f2, MDFR_NONE, toggle_mouse);
|
||||
bind(context, key_page_up, MDFR_CTRL, toggle_fullscreen);
|
||||
bind(context, 'E', MDFR_ALT, exit_4coder);
|
||||
bind(context, 'K', MDFR_ALT, weird_buffer_test);
|
||||
|
||||
end_map(context);
|
||||
|
||||
|
|
|
@ -2661,7 +2661,8 @@ CUSTOM_COMMAND_SIG(increase_line_wrap){
|
|||
View_Summary view = get_active_view(app, AccessProtected);
|
||||
Buffer_Summary buffer = get_buffer(app, view.buffer_id, AccessProtected);
|
||||
|
||||
int32_t wrap = buffer_get_setting(app, &buffer, BufferSetting_WrapPosition);
|
||||
int32_t wrap = 0;
|
||||
buffer_get_setting(app, &buffer, BufferSetting_WrapPosition, &wrap);
|
||||
buffer_set_setting(app, &buffer, BufferSetting_WrapPosition, wrap + 10);
|
||||
}
|
||||
|
||||
|
@ -2669,7 +2670,8 @@ CUSTOM_COMMAND_SIG(decrease_line_wrap){
|
|||
View_Summary view = get_active_view(app, AccessProtected);
|
||||
Buffer_Summary buffer = get_buffer(app, view.buffer_id, AccessProtected);
|
||||
|
||||
int32_t wrap = buffer_get_setting(app, &buffer, BufferSetting_WrapPosition);
|
||||
int32_t wrap = 0;
|
||||
buffer_get_setting(app, &buffer, BufferSetting_WrapPosition, &wrap);
|
||||
buffer_set_setting(app, &buffer, BufferSetting_WrapPosition, wrap - 10);
|
||||
}
|
||||
|
||||
|
@ -2677,7 +2679,8 @@ CUSTOM_COMMAND_SIG(toggle_virtual_whitespace){
|
|||
View_Summary view = get_active_view(app, AccessProtected);
|
||||
Buffer_Summary buffer = get_buffer(app, view.buffer_id, AccessProtected);
|
||||
|
||||
int32_t vwhite = buffer_get_setting(app, &buffer, BufferSetting_VirtualWhitespace);
|
||||
int32_t vwhite = 0;
|
||||
buffer_get_setting(app, &buffer, BufferSetting_VirtualWhitespace, &vwhite);
|
||||
buffer_set_setting(app, &buffer, BufferSetting_VirtualWhitespace, !vwhite);
|
||||
}
|
||||
|
||||
|
|
590
4coder_string.h
590
4coder_string.h
File diff suppressed because it is too large
Load Diff
201
4coder_types.h
201
4coder_types.h
|
@ -1,28 +1,41 @@
|
|||
|
||||
|
||||
#ifndef ENUM
|
||||
#define ENUM(type,name) typedef type name; enum name##_
|
||||
# define ENUM(type,name) typedef type name; enum name##_
|
||||
#endif
|
||||
|
||||
#ifndef TYPEDEF
|
||||
# define TYPEDEF typedef
|
||||
#endif
|
||||
|
||||
#ifndef STRUCT
|
||||
# define STRUCT struct
|
||||
#endif
|
||||
|
||||
#ifndef UNION
|
||||
# define UNION union
|
||||
#endif
|
||||
|
||||
|
||||
/* DOC(bool32 is an alias name to signal that an integer parameter or field is for
|
||||
true/false vales.) */
|
||||
typedef int32_t bool32;
|
||||
true/false values.) */
|
||||
TYPEDEF int32_t bool32;
|
||||
|
||||
/* DOC(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.) */
|
||||
typedef uint32_t int_color;
|
||||
TYPEDEF uint32_t int_color;
|
||||
|
||||
/* DOC(Key_Code is the alias for key codes including raw codes and codes translated
|
||||
to textual input that takes modifiers into account.) */
|
||||
typedef unsigned char Key_Code;
|
||||
TYPEDEF unsigned char Key_Code;
|
||||
|
||||
/* 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 int32_t Buffer_ID;
|
||||
TYPEDEF int32_t Buffer_ID;
|
||||
|
||||
/* DOC(View_ID is used to name a 4coder view. Each view has a unique id in
|
||||
the interval [1,16].) */
|
||||
typedef int32_t View_ID;
|
||||
TYPEDEF int32_t View_ID;
|
||||
|
||||
/* DOC(A Key_Modifier acts as an index for specifying modifiers in arrays.) */
|
||||
ENUM(int32_t, Key_Modifier){
|
||||
|
@ -216,9 +229,9 @@ ENUM(uint32_t, Buffer_Create_Flag){
|
|||
};
|
||||
|
||||
|
||||
/* DOC(TODO)
|
||||
/* DOC(Buffer_Creation_Data is a struct used as a local handle for the creation of a buffer. )
|
||||
HIDE_MEMBERS() */
|
||||
struct Buffer_Creation_Data{
|
||||
STRUCT Buffer_Creation_Data{
|
||||
Buffer_Create_Flag flags;
|
||||
char fname_space [256];
|
||||
int32_t fname_len;
|
||||
|
@ -233,12 +246,7 @@ ENUM(uint32_t, Buffer_Kill_Flag){
|
|||
BufferKill_AlwaysKill = 0x2,
|
||||
};
|
||||
|
||||
/* 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.) */
|
||||
/* 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(uint32_t, Access_Flag){
|
||||
/* DOC(AccessOpen does not include any bits, it indicates that the access should
|
||||
only return objects that have no protection flags set.) */
|
||||
|
@ -255,25 +263,19 @@ ENUM(uint32_t, Access_Flag){
|
|||
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.) */
|
||||
/* 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(uint32_t, Dirty_State){
|
||||
/* DOC(DirtyState_UpToDate indicates that there are no unsaved changes and
|
||||
the underlying system file still agrees with the buffer's 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,
|
||||
|
||||
/* DOC(DirtyState_UnsavedChanges indicates that there have been changes in the
|
||||
buffer since the last sync point.) */
|
||||
/* DOC(DirtyState_UnsavedChanges indicates that there have been changes in the buffer since the last sync point.) */
|
||||
DirtyState_UnsavedChanges = 1,
|
||||
|
||||
/* DOC(DirtyState_UnsavedChanges indicates that the underlying file has been
|
||||
edited since the last sync point with the buffer.) */
|
||||
/* DOC(DirtyState_UnsavedChanges indicates that the underlying file has been edited since the last sync point with the buffer.) */
|
||||
DirtyState_UnloadedChanges = 2
|
||||
};
|
||||
|
||||
/* DOC(A Seek_Boundary_Flag field specifies a set of "boundary" types used in seeks for the
|
||||
beginning or end of different types of words.) */
|
||||
/* DOC(A Seek_Boundary_Flag field specifies a set of "boundary" types used in seeks for the beginning or end of different types of words.) */
|
||||
ENUM(uint32_t, Seek_Boundary_Flag){
|
||||
BoundaryWhitespace = 0x1,
|
||||
BoundaryToken = 0x2,
|
||||
|
@ -283,34 +285,23 @@ ENUM(uint32_t, Seek_Boundary_Flag){
|
|||
|
||||
/* DOC(A Command_Line_Interface_Flag field specifies the behavior of a call to a command line interface.) */
|
||||
ENUM(uint32_t, 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.) */
|
||||
/* 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,
|
||||
/* 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.) */
|
||||
/* 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,
|
||||
/* 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.) */
|
||||
/* 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,
|
||||
};
|
||||
|
||||
/* DOC(An Auto_Indent_Flag field specifies the behavior of an auto indentation operation.) */
|
||||
ENUM(uint32_t, 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.) */
|
||||
/* 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,
|
||||
/* 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.) */
|
||||
/* 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,
|
||||
/* 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.) */
|
||||
/* 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,
|
||||
/* 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.) */
|
||||
/* 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,
|
||||
};
|
||||
|
||||
|
@ -355,8 +346,7 @@ ENUM(int32_t, Mouse_Cursor_Show_Type){
|
|||
// MouseCursorShow_WhenActive,// TODO(allen): coming soon
|
||||
};
|
||||
|
||||
/* DOC(A View_Split_Position specifies where a new view should be placed as a result of
|
||||
a view split operation.) */
|
||||
/* DOC(A View_Split_Position specifies where a new view should be placed as a result of a view split operation.) */
|
||||
ENUM(int32_t, View_Split_Position){
|
||||
/* DOC(This value indicates that the new view should be above the existing view.) */
|
||||
ViewSplit_Top,
|
||||
|
@ -368,52 +358,35 @@ ENUM(int32_t, View_Split_Position){
|
|||
ViewSplit_Right
|
||||
};
|
||||
|
||||
/* DOC(
|
||||
Generic_Command acts as a name for a command, and can name an
|
||||
internal command or a custom command.
|
||||
)*/
|
||||
union Generic_Command{
|
||||
/*DOC(If this Generic_Command represents an internal command the cmdid field
|
||||
will have a value less than cmdid_count, and this field is the command id for the command.)*/
|
||||
/* DOC(Generic_Command acts as a name for a command, and can name an internal command or a custom command.) */
|
||||
UNION Generic_Command{
|
||||
/*DOC(If this Generic_Command represents an internal command the cmdid field will have a value less than cmdid_count, and this field is the command id for the command.)*/
|
||||
Command_ID cmdid;
|
||||
/*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;
|
||||
};
|
||||
|
||||
/* 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.
|
||||
)*/
|
||||
struct Key_Event_Data{
|
||||
/* 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.) */
|
||||
STRUCT Key_Event_Data{
|
||||
/* DOC(This field is the raw keycode which is always non-zero in valid key events.) */
|
||||
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;
|
||||
|
||||
/* DOC(
|
||||
This field is like the field character, except that the state of caps lock is ignored in the translation.
|
||||
) */
|
||||
/* 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;
|
||||
|
||||
/* 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. A 1 indicates that the corresponding
|
||||
modifier was held, and a 0 indicates that it was not held.
|
||||
)
|
||||
/* 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. A 1 indicates that the corresponding modifier was held, and a 0 indicates that it was not held.)
|
||||
|
||||
DOC_SEE(Key_Modifier)
|
||||
*/
|
||||
char modifiers[MDFR_INDEX_COUNT];
|
||||
};
|
||||
|
||||
/* 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{
|
||||
/* 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{
|
||||
/* DOC(This field indicates that the left button is held.) */
|
||||
char l;
|
||||
/* DOC(This field indicates that the right button is held.) */
|
||||
|
@ -439,21 +412,17 @@ struct Mouse_State{
|
|||
};
|
||||
|
||||
/* DOC(
|
||||
Range describes an integer range typically used for ranges within a buffer.
|
||||
Ranges tend are usually not passed as a Range struct into the API, but this
|
||||
struct is used to return ranges.
|
||||
Range describes an integer range typically used for ranges within a buffer. Ranges tend are usually not passed as a Range struct into the API, but this struct is used to return ranges.
|
||||
|
||||
Throughout the API ranges are thought of in the form [min,max) where max is
|
||||
"one past the end" of the range that is actually read/edited/modified.
|
||||
) */
|
||||
union Range{
|
||||
struct{
|
||||
Throughout the API ranges are thought of in the form [min,max) where max is "one past the end" of the range that is actually read/edited/modified.) */
|
||||
UNION Range{
|
||||
STRUCT{
|
||||
/* DOC(This is the smaller value in the range, it is also the 'start'.) */
|
||||
int32_t min;
|
||||
/* DOC(This is the larger value in the range, it is also the 'end'.) */
|
||||
int32_t max;
|
||||
};
|
||||
struct{
|
||||
STRUCT{
|
||||
/* DOC(This is the start of the range, it is also the 'min'.) */
|
||||
int32_t start;
|
||||
/* DOC(This is the end of the range, it is also the 'max'.) */
|
||||
|
@ -465,7 +434,7 @@ union Range{
|
|||
DOC(File_Info describes the name and type of a file.)
|
||||
DOC_SEE(File_List)
|
||||
*/
|
||||
struct File_Info{
|
||||
STRUCT File_Info{
|
||||
/* DOC(This field is a null terminated string specifying the name of the file.) */
|
||||
char *filename;
|
||||
/* DOC(This field specifies the length of the filename string not counting the null terminator.) */
|
||||
|
@ -475,7 +444,7 @@ struct File_Info{
|
|||
};
|
||||
|
||||
/* DOC(File_List is a list of File_Info structs.) */
|
||||
struct File_List{
|
||||
STRUCT File_List{
|
||||
/* DOC(This field is for inernal use.) */
|
||||
void *block;
|
||||
/* DOC(This field is an array of File_Info structs.) */
|
||||
|
@ -486,26 +455,20 @@ struct File_List{
|
|||
int32_t block_size;
|
||||
};
|
||||
|
||||
/* DOC(
|
||||
Buffer_Identifier acts as a loosely typed description of a buffer that
|
||||
can either be a name or an id. If the
|
||||
) */
|
||||
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.
|
||||
) */
|
||||
/* DOC(Buffer_Identifier acts as a loosely typed description of a buffer that can either be a name or an id.) */
|
||||
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;
|
||||
|
||||
/* DOC(This field specifies the length of the name string.) */
|
||||
int32_t name_len;
|
||||
|
||||
/* DOC(This field is the id of the buffer. If name is specified this should be 0.) */
|
||||
int32_t id;
|
||||
Buffer_ID id;
|
||||
};
|
||||
|
||||
/* DOC(This struct is a part of an incomplete feature.) */
|
||||
struct GUI_Scroll_Vars{
|
||||
STRUCT GUI_Scroll_Vars{
|
||||
/* DOC(TODO) */
|
||||
float scroll_y;
|
||||
/* DOC(TODO) */
|
||||
|
@ -542,32 +505,26 @@ ENUM(int32_t, Buffer_Seek_Type){
|
|||
buffer_seek_line_char
|
||||
};
|
||||
|
||||
/* DOC(Buffer_Seek describes the destination of a seek operation. There are helpers
|
||||
for concisely creating Buffer_Seek structs. They can be found in 4coder_buffer_types.h.)
|
||||
/* DOC(Buffer_Seek describes the destination of a seek operation. There are helpers for concisely creating Buffer_Seek structs. They can be found in 4coder_buffer_types.h.)
|
||||
DOC_SEE(Buffer_Seek_Type)
|
||||
DOC_SEE(4coder_Buffer_Positioning_System)*/
|
||||
struct Buffer_Seek{
|
||||
DOC_SEE(4coder_Buffer_Positioning_System) */
|
||||
STRUCT Buffer_Seek{
|
||||
/* DOC(The type field determines the coordinate system of the seek operation.) */
|
||||
Buffer_Seek_Type type;
|
||||
union{
|
||||
struct {
|
||||
UNION{
|
||||
STRUCT {
|
||||
/* DOC(The pos field specified the pos when the seek is in absolute position.) */
|
||||
int32_t pos;
|
||||
};
|
||||
struct {
|
||||
/* DOC(For xy coordinate seeks, rounding down means that any x in the box of the
|
||||
character lands on that character. For instance when clicking rounding down is the
|
||||
user's expected behavior. Not rounding down means that the right hand portion of
|
||||
the character's box, which is closer to the next character, will land on that next
|
||||
character. The unrounded behavior is the expected behavior when moving vertically
|
||||
and keeping the preferred x.) */
|
||||
STRUCT {
|
||||
/* DOC(For xy coordinate seeks, rounding down means that any x in the box of the character lands on that character. For instance when clicking rounding down is the user's expected behavior. Not rounding down means that the right hand portion of the character's box, which is closer to the next character, will land on that next character. The unrounded behavior is the expected behavior when moving vertically and keeping the preferred x.) */
|
||||
bool32 round_down;
|
||||
/* DOC(The x coordinate for xy type seeks.) */
|
||||
float x;
|
||||
/* DOC(The y coordinate for xy type seeks.) */
|
||||
float y;
|
||||
};
|
||||
struct {
|
||||
STRUCT {
|
||||
/* DOC(The line number of a line-character type seek.) */
|
||||
int32_t line;
|
||||
/* DOC(The character number of a line-character type seek.) */
|
||||
|
@ -576,11 +533,9 @@ struct Buffer_Seek{
|
|||
};
|
||||
};
|
||||
|
||||
/* DOC(Full_Cursor describes the position of a cursor in every buffer
|
||||
coordinate system supported by 4coder. This cursor type requires that
|
||||
the buffer is associated with a view to give the x/y values meaning.)
|
||||
/* DOC(Full_Cursor describes the position of a cursor in every buffer coordinate system supported by 4coder. This cursor type requires that the buffer is associated with a view to give the x/y values meaning.)
|
||||
DOC_SEE(4coder_Buffer_Positioning_System) */
|
||||
struct Full_Cursor{
|
||||
STRUCT Full_Cursor{
|
||||
/* DOC(This field contains the cursor's position in absolute byte index positioning.) */
|
||||
int32_t pos;
|
||||
/* DOC(This field contains the cursor's position in apparent character index positioning.) */
|
||||
|
@ -608,7 +563,7 @@ the coordinate systems that a invariant to the View. In other words
|
|||
the coordinate systems available here can be used on a buffer that is
|
||||
not currently associated with a View.)
|
||||
DOC_SEE(4coder_Buffer_Positioning_System) */
|
||||
struct Partial_Cursor{
|
||||
STRUCT Partial_Cursor{
|
||||
/* DOC(This field contains the cursor's position in absolute byte index positioning.) */
|
||||
int32_t pos;
|
||||
/* DOC(This field contains the number of the character from the beginninf of the line
|
||||
|
@ -621,7 +576,7 @@ struct Partial_Cursor{
|
|||
/* DOC(Buffer_Edit describes a range of a buffer and string to replace that range.
|
||||
A Buffer_Edit has to be paired with a string that contains the actual text that
|
||||
will be replaced into the buffer.) */
|
||||
struct Buffer_Edit{
|
||||
STRUCT Buffer_Edit{
|
||||
/* DOC(The str_start field specifies the first character in the accompanying string that corresponds with this edit.) */
|
||||
int32_t str_start;
|
||||
/* DOC(The len field specifies the length of the string being written into the buffer.) */
|
||||
|
@ -635,7 +590,7 @@ struct Buffer_Edit{
|
|||
/* DOC(Buffer_Summary acts as a handle to a buffer and describes the state of the buffer.)
|
||||
DOC_SEE(Access_Flag)
|
||||
DOC_SEE(Dirty_State) */
|
||||
struct Buffer_Summary{
|
||||
STRUCT Buffer_Summary{
|
||||
/* DOC(This field indicates whether the Buffer_Summary describes a buffer that is open in 4coder.
|
||||
When this field is false the summary is referred to as a "null summary".) */
|
||||
bool32 exists;
|
||||
|
@ -681,7 +636,7 @@ struct Buffer_Summary{
|
|||
/* DOC(View_Summary acts as a handle to a view and describes the state of the view.)
|
||||
DOC_SEE(Access_Flag)
|
||||
DOC_SEE(Full_Cursor) */
|
||||
struct View_Summary{
|
||||
STRUCT View_Summary{
|
||||
/* DOC(
|
||||
This field indicates whether the View_Summary describes a view that is open in 4coder.
|
||||
When this field is false the summary is referred to as a "null summary".
|
||||
|
@ -727,14 +682,14 @@ DOC(User_Input describes a user input event which can be either a key press or m
|
|||
DOC_SEE(User_Input_Type_ID)
|
||||
DOC_SEE(Generic_Command)
|
||||
*/
|
||||
struct User_Input{
|
||||
STRUCT User_Input{
|
||||
/*
|
||||
DOC(This field specifies whether the event was a key press or mouse event.)
|
||||
*/
|
||||
User_Input_Type_ID type;
|
||||
/* DOC(This field indicates that an abort event has occurred and the command needs to shut down.) */
|
||||
bool32 abort;
|
||||
union{
|
||||
UNION{
|
||||
/* DOC(This field describes a key press event.) */
|
||||
Key_Event_Data key;
|
||||
/* DOC(This field describes a mouse input event.) */
|
||||
|
@ -748,7 +703,7 @@ struct User_Input{
|
|||
|
||||
/* 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 prompt;
|
||||
/* DOC(This specifies the main string portion of the drop down bar.) */
|
||||
|
@ -756,7 +711,7 @@ struct Query_Bar{
|
|||
};
|
||||
|
||||
/* DOC(This feature is not implemented.) */
|
||||
struct Event_Message{
|
||||
STRUCT Event_Message{
|
||||
/* DOC(This feature is not implemented.) */
|
||||
int32_t type;
|
||||
};
|
||||
|
@ -766,7 +721,7 @@ DOC(Theme_Color stores a style tag/color pair, for the purpose of setting and ge
|
|||
DOC_SEE(Style_Tag)
|
||||
DOC_SEE(int_color)
|
||||
*/
|
||||
struct Theme_Color{
|
||||
STRUCT Theme_Color{
|
||||
/* DOC(The style slot in the style palette.) */
|
||||
Style_Tag tag;
|
||||
/* DOC(The color in the slot.) */
|
||||
|
@ -787,7 +742,7 @@ DOC(This struct is used to bundle the parameters of the buffer_batch_edit functi
|
|||
for a few functions that return a batch edit to the user.)
|
||||
DOC_SEE(buffer_batch_edit)
|
||||
*/
|
||||
struct Buffer_Batch_Edit{
|
||||
STRUCT Buffer_Batch_Edit{
|
||||
/* DOC(The pointer to the edit string buffer.) */
|
||||
char *str;
|
||||
/* DOC(The length of the edit string buffer.) */
|
||||
|
|
60
4cpp_lexer.h
60
4cpp_lexer.h
|
@ -12,7 +12,9 @@
|
|||
# define FCPP_LINK static
|
||||
#endif
|
||||
|
||||
#define FCPP_INTERNAL FCPP_LINK
|
||||
#ifndef API_EXPORT
|
||||
#define API_EXPORT
|
||||
#endif
|
||||
|
||||
#include <stdint.h>
|
||||
#if !defined(FSTRING_GUARD)
|
||||
|
@ -150,7 +152,7 @@ static String_And_Flag keywords[] = {
|
|||
};
|
||||
|
||||
|
||||
FCPP_LINK Cpp_Get_Token_Result
|
||||
API_EXPORT FCPP_LINK Cpp_Get_Token_Result
|
||||
cpp_get_token(Cpp_Token_Array array, int32_t pos)/*
|
||||
DOC_PARAM(array, The array of tokens from which to get a token.)
|
||||
DOC_PARAM(pos, The position, measured in bytes, to get the token for.)
|
||||
|
@ -226,7 +228,7 @@ DOC_SEE(Cpp_Get_Token_Result)
|
|||
return(result);
|
||||
}
|
||||
|
||||
FCPP_INTERNAL Cpp_Lex_PP_State
|
||||
FCPP_LINK Cpp_Lex_PP_State
|
||||
cpp_pp_directive_to_state(Cpp_Token_Type type){
|
||||
Cpp_Lex_PP_State result = LSPP_default;
|
||||
switch (type){
|
||||
|
@ -280,7 +282,7 @@ cpp_pp_directive_to_state(Cpp_Token_Type type){
|
|||
|
||||
#define DrReturn(n) { token_array_out->count = token_i; *S_ptr = S; S_ptr->__pc__ = -1; return(n); }
|
||||
|
||||
FCPP_INTERNAL Cpp_Lex_Result
|
||||
FCPP_LINK Cpp_Lex_Result
|
||||
cpp_lex_nonalloc_null_end_no_limit(Cpp_Lex_Data *S_ptr, char *chunk, int32_t size,
|
||||
Cpp_Token_Array *token_array_out){
|
||||
Cpp_Lex_Data S = *S_ptr;
|
||||
|
@ -888,7 +890,7 @@ cpp_lex_nonalloc_null_end_no_limit(Cpp_Lex_Data *S_ptr, char *chunk, int32_t siz
|
|||
#undef DrReturn
|
||||
#undef DrCase
|
||||
|
||||
FCPP_INTERNAL Cpp_Lex_Result
|
||||
FCPP_LINK Cpp_Lex_Result
|
||||
cpp_lex_nonalloc_null_end_out_limit(Cpp_Lex_Data *S_ptr, char *chunk, int32_t size,
|
||||
Cpp_Token_Array *token_array_out, int32_t max_tokens_out){
|
||||
Cpp_Token_Array temp_array = *token_array_out;
|
||||
|
@ -908,7 +910,7 @@ cpp_lex_nonalloc_null_end_out_limit(Cpp_Lex_Data *S_ptr, char *chunk, int32_t si
|
|||
return(result);
|
||||
}
|
||||
|
||||
FCPP_INTERNAL Cpp_Lex_Result
|
||||
FCPP_LINK Cpp_Lex_Result
|
||||
cpp_lex_nonalloc_no_null_no_limit(Cpp_Lex_Data *S_ptr, char *chunk, int32_t size, int32_t full_size,
|
||||
Cpp_Token_Array *token_array_out){
|
||||
Cpp_Lex_Result result = 0;
|
||||
|
@ -928,7 +930,7 @@ cpp_lex_nonalloc_no_null_no_limit(Cpp_Lex_Data *S_ptr, char *chunk, int32_t size
|
|||
return(result);
|
||||
}
|
||||
|
||||
FCPP_INTERNAL Cpp_Lex_Result
|
||||
FCPP_LINK Cpp_Lex_Result
|
||||
cpp_lex_nonalloc_no_null_out_limit(Cpp_Lex_Data *S_ptr, char *chunk, int32_t size, int32_t full_size,
|
||||
Cpp_Token_Array *token_array_out, int32_t max_tokens_out){
|
||||
Cpp_Token_Array temp_stack = *token_array_out;
|
||||
|
@ -953,7 +955,7 @@ cpp_lex_nonalloc_no_null_out_limit(Cpp_Lex_Data *S_ptr, char *chunk, int32_t siz
|
|||
#define HAS_NULL_TERM ((int32_t)(-1))
|
||||
#define NO_OUT_LIMIT ((int32_t)(-1))
|
||||
|
||||
FCPP_LINK Cpp_Lex_Result
|
||||
API_EXPORT FCPP_LINK Cpp_Lex_Result
|
||||
cpp_lex_step(Cpp_Lex_Data *S_ptr, char *chunk, int32_t size, int32_t full_size, Cpp_Token_Array *token_array_out, int32_t max_tokens_out)/*
|
||||
DOC_PARAM(S_ptr, The lexer state. Go to the Cpp_Lex_Data section to see how to initialize the state.)
|
||||
DOC_PARAM(chunk, The first or next chunk of the file being lexed.)
|
||||
|
@ -1038,7 +1040,7 @@ DOC_SEE(Cpp_Lex_Result)
|
|||
return(result);
|
||||
}
|
||||
|
||||
FCPP_LINK Cpp_Lex_Data
|
||||
API_EXPORT FCPP_LINK Cpp_Lex_Data
|
||||
cpp_lex_data_init()/*
|
||||
DOC_RETURN(A brand new lex state ready to begin lexing a file from the beginning.)
|
||||
|
||||
|
@ -1051,7 +1053,7 @@ as the file being lexed.)
|
|||
return(data);
|
||||
}
|
||||
|
||||
FCPP_LINK int32_t
|
||||
API_EXPORT FCPP_LINK int32_t
|
||||
cpp_lex_data_temp_size(Cpp_Lex_Data *lex_data)/*
|
||||
DOC_PARAM(lex_data, The lex state from which to get the temporary buffer size.)
|
||||
DOC(This call gets the current size of the temporary buffer in the lexer state so
|
||||
|
@ -1064,7 +1066,7 @@ DOC_SEE(cpp_lex_data_new_temp)
|
|||
return(result);
|
||||
}
|
||||
|
||||
FCPP_LINK void
|
||||
API_EXPORT FCPP_LINK void
|
||||
cpp_lex_data_temp_read(Cpp_Lex_Data *lex_data, char *out_buffer)/*
|
||||
DOC_PARAM(lex_data, The lex state from which to read the temporary buffer.)
|
||||
DOC_PARAM(out_buffer, The buffer into which the contents of the temporary buffer will be written.
|
||||
|
@ -1081,16 +1083,16 @@ DOC_SEE(cpp_lex_data_new_temp)
|
|||
}
|
||||
}
|
||||
|
||||
FCPP_LINK void
|
||||
API_EXPORT FCPP_LINK void
|
||||
cpp_lex_data_new_temp_DEP(Cpp_Lex_Data *lex_data, char *new_buffer)
|
||||
/*DOC(Deprecated in 4cpp Lexer 1.0.1*/{}
|
||||
|
||||
FCPP_INTERNAL char
|
||||
FCPP_LINK char
|
||||
cpp_token_get_pp_state(uint16_t bitfield){
|
||||
return (char)(bitfield);
|
||||
}
|
||||
|
||||
FCPP_INTERNAL void
|
||||
FCPP_LINK void
|
||||
cpp_shift_token_starts(Cpp_Token_Array *array, int32_t from_token_i, int32_t shift_amount){
|
||||
Cpp_Token *token = array->tokens + from_token_i;
|
||||
int32_t count = array->count, i = 0;
|
||||
|
@ -1099,7 +1101,7 @@ cpp_shift_token_starts(Cpp_Token_Array *array, int32_t from_token_i, int32_t shi
|
|||
}
|
||||
}
|
||||
|
||||
FCPP_INTERNAL Cpp_Token
|
||||
FCPP_LINK Cpp_Token
|
||||
cpp_index_array(Cpp_Token_Array *array, int32_t file_size, int32_t index){
|
||||
Cpp_Token result;
|
||||
if (index < array->count){
|
||||
|
@ -1115,7 +1117,7 @@ cpp_index_array(Cpp_Token_Array *array, int32_t file_size, int32_t index){
|
|||
return(result);
|
||||
}
|
||||
|
||||
FCPP_LINK Cpp_Relex_Range
|
||||
API_EXPORT FCPP_LINK Cpp_Relex_Range
|
||||
cpp_get_relex_range(Cpp_Token_Array *array, int32_t start_pos, int32_t end_pos)
|
||||
/*
|
||||
DOC_PARAM(array, A pointer to the token array that will be modified by the relex,
|
||||
|
@ -1148,7 +1150,7 @@ The start and end points are based on the edited region of the file before the e
|
|||
return(range);
|
||||
}
|
||||
|
||||
FCPP_LINK Cpp_Relex_Data
|
||||
API_EXPORT FCPP_LINK Cpp_Relex_Data
|
||||
cpp_relex_init(Cpp_Token_Array *array, int32_t start_pos, int32_t end_pos, int32_t character_shift_amount)
|
||||
/*
|
||||
DOC_PARAM(array, A pointer to the token array that will be modified by the relex,
|
||||
|
@ -1192,7 +1194,7 @@ DOC_SEE(cpp_relex_is_start_chunk)
|
|||
return(state);
|
||||
}
|
||||
|
||||
FCPP_LINK int32_t
|
||||
API_EXPORT FCPP_LINK int32_t
|
||||
cpp_relex_start_position(Cpp_Relex_Data *S_ptr)
|
||||
/*
|
||||
DOC_PARAM(S_ptr, A pointer to a state that is done with the first stage of initialization (cpp_relex_init))
|
||||
|
@ -1211,7 +1213,7 @@ DOC_SEE(cpp_relex_declare_first_chunk_position)
|
|||
return(result);
|
||||
}
|
||||
|
||||
FCPP_LINK void
|
||||
API_EXPORT FCPP_LINK void
|
||||
cpp_relex_declare_first_chunk_position(Cpp_Relex_Data *S_ptr, int32_t position)
|
||||
/*
|
||||
DOC_PARAM(S_ptr, A pointer to a state that is done with the first stage of initialization (cpp_relex_init))
|
||||
|
@ -1230,7 +1232,7 @@ DOC_SEE(cpp_relex_start_position)
|
|||
S_ptr->lex.chunk_pos = position;
|
||||
}
|
||||
|
||||
FCPP_LINK int32_t
|
||||
API_EXPORT FCPP_LINK int32_t
|
||||
cpp_relex_is_start_chunk(Cpp_Relex_Data *S_ptr, char *chunk, int32_t chunk_size)
|
||||
/*
|
||||
DOC_PARAM(S_ptr, A pointer to a state that is done with the first stage of initialization (cpp_relex_init))
|
||||
|
@ -1280,7 +1282,7 @@ DOC_SEE(cpp_relex_init)
|
|||
S_ptr->result_state = n; \
|
||||
*S_ptr = S; S_ptr->__pc__ = -1; return(n); }
|
||||
|
||||
FCPP_LINK Cpp_Lex_Result
|
||||
API_EXPORT FCPP_LINK Cpp_Lex_Result
|
||||
cpp_relex_step(Cpp_Relex_Data *S_ptr, char *chunk, int32_t chunk_size, int32_t full_size,
|
||||
Cpp_Token_Array *array, Cpp_Token_Array *relex_array)
|
||||
/*
|
||||
|
@ -1385,7 +1387,7 @@ DOC_SEE(cpp_relex_abort)
|
|||
#undef DrReturn
|
||||
#undef DrCase
|
||||
|
||||
FCPP_LINK int32_t
|
||||
API_EXPORT FCPP_LINK int32_t
|
||||
cpp_relex_get_new_count(Cpp_Relex_Data *S_ptr, int32_t current_count, Cpp_Token_Array *relex_array)
|
||||
/*
|
||||
DOC_PARAM(S_ptr, A pointer to a state that has gone through cpp_relex_step with a LexResult_Finished return.)
|
||||
|
@ -1411,7 +1413,7 @@ the new array, it's capacity should be increased before passing to cpp_relex_com
|
|||
#include <string.h>
|
||||
#endif
|
||||
|
||||
FCPP_INTERNAL void
|
||||
FCPP_LINK void
|
||||
cpp__block_move(void *dst, void *src, int32_t size){
|
||||
#if !defined(FCPP_FORBID_MEMCPY)
|
||||
memmove(dst, src, size);
|
||||
|
@ -1433,7 +1435,7 @@ cpp__block_move(void *dst, void *src, int32_t size){
|
|||
#endif
|
||||
}
|
||||
|
||||
FCPP_LINK void
|
||||
API_EXPORT FCPP_LINK void
|
||||
cpp_relex_complete(Cpp_Relex_Data *S_ptr, Cpp_Token_Array *array, Cpp_Token_Array *relex_array)
|
||||
/*
|
||||
DOC_PARAM(S_ptr, A pointer to a state that has gone through cpp_relex_step with a LexResult_Finished return.)
|
||||
|
@ -1460,7 +1462,7 @@ does the necessary replacement of tokens in the array to make it match the new f
|
|||
sizeof(Cpp_Token)*relex_array->count);
|
||||
}
|
||||
|
||||
FCPP_LINK void
|
||||
API_EXPORT FCPP_LINK void
|
||||
cpp_relex_abort(Cpp_Relex_Data *S_ptr, Cpp_Token_Array *array)
|
||||
/*
|
||||
DOC_PARAM(S_ptr, A pointer to a state that has gone through at least one cpp_relex_step.)
|
||||
|
@ -1480,7 +1482,7 @@ is dead.)
|
|||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
FCPP_LINK Cpp_Token_Array
|
||||
API_EXPORT FCPP_LINK Cpp_Token_Array
|
||||
cpp_make_token_array(int32_t starting_max)/*
|
||||
DOC_PARAM(starting_max, The number of tokens to initialize the array with.)
|
||||
DOC_RETURN(An empty Cpp_Token_Array with memory malloc'd for storing tokens.)
|
||||
|
@ -1495,7 +1497,7 @@ used in the convenience functions.)
|
|||
return(token_array);
|
||||
}
|
||||
|
||||
FCPP_LINK void
|
||||
API_EXPORT FCPP_LINK void
|
||||
cpp_free_token_array(Cpp_Token_Array token_array)/*
|
||||
DOC_PARAM(token_array, An array previously allocated by cpp_make_token_array)
|
||||
DOC(This call frees a Cpp_Token_Array.)
|
||||
|
@ -1504,7 +1506,7 @@ DOC_SEE(cpp_make_token_array)
|
|||
free(token_array.tokens);
|
||||
}
|
||||
|
||||
FCPP_LINK void
|
||||
API_EXPORT FCPP_LINK void
|
||||
cpp_resize_token_array(Cpp_Token_Array *token_array, int32_t new_max)/*
|
||||
DOC_PARAM(token_array, An array previously allocated by cpp_make_token_array.)
|
||||
DOC_PARAM(new_max, The new maximum size the array should support. If this is not greater
|
||||
|
@ -1525,7 +1527,7 @@ DOC_SEE(cpp_make_token_array)
|
|||
}
|
||||
}
|
||||
|
||||
FCPP_LINK void
|
||||
API_EXPORT FCPP_LINK void
|
||||
cpp_lex_file(char *data, int32_t size, Cpp_Token_Array *token_array_out)/*
|
||||
DOC_PARAM(data, The file data to be lexed in a single contiguous block.)
|
||||
DOC_PARAM(size, The number of bytes in data.)
|
||||
|
|
|
@ -12,8 +12,8 @@
|
|||
#define ENUM_INTERNAL(type,name) typedef type name; enum name##_
|
||||
#endif
|
||||
|
||||
#ifndef struct_internal
|
||||
#define struct_internal struct
|
||||
#ifndef STRUCT
|
||||
#define STRUCT struct
|
||||
#endif
|
||||
|
||||
/* DOC(A Cpp_Token_Type classifies a token to make parsing easier. Some types are not actually output by the lexer, but exist because parsers will also make use of token types in their own output.) */
|
||||
|
@ -233,7 +233,7 @@ ENUM(uint32_t, Cpp_Token_Type){
|
|||
/* DOC(Cpp_Token represents a single lexed token.
|
||||
It is the primary output of the lexing system.)
|
||||
DOC_SEE(Cpp_Token_Flag) */
|
||||
struct Cpp_Token{
|
||||
STRUCT Cpp_Token{
|
||||
/* DOC(The type field indicates the type of the token.
|
||||
All tokens have a type no matter the circumstances.) */
|
||||
Cpp_Token_Type type;
|
||||
|
@ -275,7 +275,7 @@ ENUM(uint16_t, Cpp_Token_Flag){
|
|||
of a growing array of Cpp_Tokens. To initialize it the tokens field should
|
||||
point to a block of memory with a size equal to max_count*sizeof(Cpp_Token)
|
||||
and the count should be initialized to zero.) */
|
||||
struct Cpp_Token_Array{
|
||||
STRUCT Cpp_Token_Array{
|
||||
/* DOC(The tokens field points to the memory used to store the array of tokens.) */
|
||||
Cpp_Token *tokens;
|
||||
|
||||
|
@ -291,7 +291,7 @@ static Cpp_Token_Array null_cpp_token_array = {0};
|
|||
|
||||
/* DOC(Cpp_Get_Token_Result is the return result of the cpp_get_token call.)
|
||||
DOC_SEE(cpp_get_token) */
|
||||
struct Cpp_Get_Token_Result{
|
||||
STRUCT Cpp_Get_Token_Result{
|
||||
/* DOC(The token_index field indicates which token answers the query. To get the token from
|
||||
the source array CODE_EXAMPLE(array.tokens[result.token_index])) */
|
||||
int32_t token_index;
|
||||
|
@ -311,7 +311,7 @@ struct Cpp_Get_Token_Result{
|
|||
|
||||
/* DOC(Cpp_Relex_Range is the return result of the cpp_get_relex_range call.)
|
||||
DOC_SEE(cpp_get_relex_range) */
|
||||
struct Cpp_Relex_Range{
|
||||
STRUCT Cpp_Relex_Range{
|
||||
/* DOC(The index of the first token in the unedited array that needs to be relexed.) */
|
||||
int32_t start_token_index;
|
||||
/* DOC(The index of the first token in the unedited array after the edited range
|
||||
|
@ -320,7 +320,7 @@ struct Cpp_Relex_Range{
|
|||
int32_t end_token_index;
|
||||
};
|
||||
|
||||
struct_internal Cpp_Lex_FSM{
|
||||
struct Cpp_Lex_FSM{
|
||||
uint8_t state;
|
||||
uint8_t int_state;
|
||||
uint8_t emit_token;
|
||||
|
@ -335,7 +335,7 @@ a new lexer state call cpp_lex_data_init.
|
|||
The internals of the lex state should not be treated as a part of the public API.)
|
||||
DOC_SEE(cpp_lex_data_init)
|
||||
HIDE_MEMBERS() */
|
||||
struct Cpp_Lex_Data{
|
||||
STRUCT Cpp_Lex_Data{
|
||||
char tb[32];
|
||||
int32_t tb_pos;
|
||||
int32_t token_start;
|
||||
|
@ -375,7 +375,7 @@ ENUM(int32_t, Cpp_Lex_Result){
|
|||
To create a new relex state call cpp_relex_init.)
|
||||
DOC_SEE(cpp_relex_init)
|
||||
HIDE_MEMBERS()*/
|
||||
struct Cpp_Relex_Data{
|
||||
STRUCT Cpp_Relex_Data{
|
||||
Cpp_Lex_Data lex;
|
||||
|
||||
Cpp_Token end_token;
|
||||
|
|
|
@ -398,12 +398,9 @@ DOC_PARAM(item_index, This parameter specifies which item to read, 0 is the most
|
|||
DOC_PARAM(out, This parameter provides a buffer where the clipboard contents are written. This parameter may be NULL.)
|
||||
DOC_PARAM(len, This parameter specifies the length of the out buffer.)
|
||||
DOC_RETURN(This call returns the size of the item associated with item_index.)
|
||||
DOC
|
||||
(
|
||||
This function always returns the size of the item even if the output buffer is NULL.
|
||||
If the output buffer is too small to contain the whole string, it is filled with the
|
||||
first len character of the clipboard contents. The output string is not null terminated.
|
||||
)
|
||||
|
||||
DOC(This function always returns the size of the item even if the output buffer is NULL. If the output buffer is too small to contain the whole string, it is filled with the first len character of the clipboard contents. The output string is not null terminated. )
|
||||
|
||||
DOC_SEE(The_4coder_Clipboard)
|
||||
*/{
|
||||
Command_Data *cmd = (Command_Data*)app->cmd_context;
|
||||
|
@ -423,7 +420,10 @@ DOC_SEE(The_4coder_Clipboard)
|
|||
}
|
||||
|
||||
API_EXPORT int32_t
|
||||
Get_Buffer_Count(Application_Links *app){
|
||||
Get_Buffer_Count(Application_Links *app)
|
||||
/*
|
||||
DOC(Gives the total number of buffers in the application.)
|
||||
*/{
|
||||
Command_Data *cmd = (Command_Data*)app->cmd_context;
|
||||
Working_Set *working_set = &cmd->models->working_set;
|
||||
int32_t result = working_set->file_count;
|
||||
|
@ -709,21 +709,27 @@ DOC_SEE(Buffer_Batch_Edit_Type)
|
|||
}
|
||||
|
||||
API_EXPORT int32_t
|
||||
Buffer_Get_Setting(Application_Links *app, Buffer_Summary *buffer, Buffer_Setting_ID setting){
|
||||
Buffer_Get_Setting(Application_Links *app, Buffer_Summary *buffer, Buffer_Setting_ID setting, int32_t *value_out)
|
||||
/*
|
||||
DOC_PARAM(buffer, the buffer from which to read a setting)
|
||||
DOC_PARAM(setting, the setting to read from the buffer)
|
||||
DOC_PARAM(value_out, address to write the setting value on success)
|
||||
DOC_RETURN(returns non-zero on success)
|
||||
*/{
|
||||
Command_Data *cmd = (Command_Data*)app->cmd_context;
|
||||
Editing_File *file = imp_get_file(cmd, buffer);
|
||||
int32_t result = -1;
|
||||
int32_t result = 0;
|
||||
|
||||
if (file){
|
||||
switch (setting){
|
||||
case BufferSetting_Lex: result = file->settings.tokens_exist; break;
|
||||
case BufferSetting_WrapLine: result = !file->settings.unwrapped_lines; break;
|
||||
case BufferSetting_WrapPosition: result = file->settings.display_width; break;
|
||||
case BufferSetting_MapID: result = file->settings.base_map_id; break;
|
||||
case BufferSetting_Eol: result = file->settings.dos_write_mode; break;
|
||||
case BufferSetting_Unimportant: result = file->settings.unimportant; break;
|
||||
case BufferSetting_ReadOnly: result = file->settings.read_only; break;
|
||||
case BufferSetting_VirtualWhitespace: result = file->settings.virtual_white; break;
|
||||
case BufferSetting_Lex: result = file->settings.tokens_exist; break;
|
||||
case BufferSetting_WrapLine: result = !file->settings.unwrapped_lines; break;
|
||||
case BufferSetting_WrapPosition: result = file->settings.display_width; break;
|
||||
case BufferSetting_MapID: result = file->settings.base_map_id; break;
|
||||
case BufferSetting_Eol: result = file->settings.dos_write_mode; break;
|
||||
case BufferSetting_Unimportant: result = file->settings.unimportant; break;
|
||||
case BufferSetting_ReadOnly: result = file->settings.read_only; break;
|
||||
case BufferSetting_VirtualWhitespace: result = file->settings.virtual_white; break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -972,20 +978,61 @@ DOC_SEE(cpp_get_token)
|
|||
return(result);
|
||||
}
|
||||
|
||||
API_EXPORT void
|
||||
Begin_Buffer_Creation(Application_Links *app, Buffer_Creation_Data *data, Buffer_Create_Flag flags){
|
||||
// TODO(allen): Buffer_Creation_Flag
|
||||
API_EXPORT bool32
|
||||
Begin_Buffer_Creation(Application_Links *app, Buffer_Creation_Data *data, Buffer_Create_Flag flags)
|
||||
/*
|
||||
DOC_PARAM(data, a local user handle for the buffer creation process)
|
||||
DOC_PARAM(flags, flags defining the buffer creation behavior)
|
||||
|
||||
DOC(Begins a buffer creation by initializing a Buffer_Creation_Data struct. The buffer is not actually created until end_buffer_creation is called.)
|
||||
|
||||
DOC_SEE(buffer_creation_name)
|
||||
DOC_SEE(end_buffer_creation)
|
||||
|
||||
DOC_SEE(Buffer_Creation_Data)
|
||||
DOC_SEE(Buffer_Create_Flag)
|
||||
*/{
|
||||
bool32 result = 0;
|
||||
if (data){
|
||||
data->flags = flags;
|
||||
result = 1;
|
||||
}
|
||||
return(result);
|
||||
}
|
||||
|
||||
API_EXPORT void
|
||||
Buffer_Creation_Name(Application_Links *app, Buffer_Creation_Data *data, char *filename, int32_t filename_len, uint32_t flags){
|
||||
API_EXPORT bool32
|
||||
Buffer_Creation_Name(Application_Links *app, Buffer_Creation_Data *data, char *filename, int32_t filename_len, uint32_t flags)
|
||||
/*
|
||||
DOC_PARAM(data, a local user handle for buffer creation that has already been initialized by begin_buffer_creation)
|
||||
DOC_PARAM(filename, the name to associate to the buffer; This string need not be null terminated.)
|
||||
DOC_PARAM(filename_len, the length of the filename string)
|
||||
DOC_PARAM(flags, not currently used this should be 0)
|
||||
|
||||
DOC(This call sets the name associated to the buffer. If the name is a filename, that filename will be used for loading and saving with the disk, and the buffer name will be extracted from the filename. If the name is not a filename it will be an unassociated buffer and the buffer name will be exactly set to filename.)
|
||||
|
||||
DOC_SEE(begin_buffer_creation)
|
||||
DOC_SEE(end_buffer_creation)
|
||||
*/{
|
||||
bool32 result = 0;
|
||||
if (data){
|
||||
String fname = make_fixed_width_string(data->fname_space);
|
||||
copy_ss(&fname, make_string(filename, filename_len));
|
||||
data->fname_len = filename_len;
|
||||
result = 1;
|
||||
}
|
||||
return(result);
|
||||
}
|
||||
|
||||
|
||||
API_EXPORT Buffer_Summary
|
||||
End_Buffer_Creation(Application_Links *app, Buffer_Creation_Data *data){
|
||||
End_Buffer_Creation(Application_Links *app, Buffer_Creation_Data *data)
|
||||
/*
|
||||
DOC_PARAM(data, a local user handle for buffer creation that has already been initialized by begin_buffer_creation and used in subsequent buffer creation flags)
|
||||
|
||||
DOC_RETURN(returns a summary of the newly created buffer or of the existing buffer that already has the specified name. If there is not enough creation data to make the buffer the returned summary will be null.)
|
||||
|
||||
DOC_SEE(begin_buffer_creation)
|
||||
*/{
|
||||
Command_Data *cmd = (Command_Data*)app->cmd_context;
|
||||
System_Functions *system = cmd->system;
|
||||
Models *models = cmd->models;
|
||||
|
@ -995,7 +1042,7 @@ End_Buffer_Creation(Application_Links *app, Buffer_Creation_Data *data){
|
|||
|
||||
Buffer_Summary result = {0};
|
||||
|
||||
if (data->fname_len > 0){
|
||||
if (data && data->fname_len > 0){
|
||||
String fname = make_string(data->fname_space, data->fname_len);
|
||||
|
||||
Editing_File *file = 0;
|
||||
|
@ -1073,114 +1120,7 @@ End_Buffer_Creation(Application_Links *app, Buffer_Creation_Data *data){
|
|||
}
|
||||
|
||||
end_temp_memory(temp);
|
||||
}
|
||||
|
||||
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;
|
||||
it need not be null terminated.)
|
||||
DOC_PARAM(filename_len, The filename_len parameter spcifies the length of the filename string.)
|
||||
DOC_PARAM(flags, The flags parameter specifies behaviors for buffer creation.)
|
||||
DOC_RETURN(This call returns the summary of the created buffer.)
|
||||
|
||||
DOC(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.)
|
||||
|
||||
DOC_SEE(Buffer_Summary)
|
||||
DOC_SEE(Buffer_Create_Flag)
|
||||
*/{
|
||||
Command_Data *cmd = (Command_Data*)app->cmd_context;
|
||||
System_Functions *system = cmd->system;
|
||||
Models *models = cmd->models;
|
||||
Working_Set *working_set = &models->working_set;
|
||||
General_Memory *general = &models->mem.general;
|
||||
Partition *part = &models->mem.part;
|
||||
|
||||
Buffer_Summary result = {0};
|
||||
|
||||
String fname = make_string(filename, filename_len);
|
||||
|
||||
Temp_Memory temp = begin_temp_memory(part);
|
||||
|
||||
if (filename != 0){
|
||||
Editing_File *file = 0;
|
||||
b32 do_new_file = 0;
|
||||
Plat_Handle handle = {0};
|
||||
|
||||
Editing_File_Canon_Name canon = {0};
|
||||
if (get_canon_name(system, &canon, fname)){
|
||||
file = working_set_canon_contains(working_set, canon.name);
|
||||
}
|
||||
else{
|
||||
do_new_file = 1;
|
||||
}
|
||||
|
||||
if (!file){
|
||||
file = working_set_name_contains(working_set, fname);
|
||||
}
|
||||
|
||||
if (!file){
|
||||
if (!do_new_file){
|
||||
if (flags & BufferCreate_AlwaysNew){
|
||||
do_new_file = 1;
|
||||
}
|
||||
else{
|
||||
if (!system->load_handle(canon.name.str, &handle)){
|
||||
do_new_file = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!do_new_file){
|
||||
Assert(!handle_equal(handle, handle_zero()));
|
||||
|
||||
i32 size = system->load_size(handle);
|
||||
b32 in_general_mem = 0;
|
||||
char *buffer = push_array(part, char, size);
|
||||
|
||||
if (buffer == 0){
|
||||
buffer = (char*)general_memory_allocate(system, general, size);
|
||||
Assert(buffer != 0);
|
||||
in_general_mem = 1;
|
||||
}
|
||||
|
||||
if (system->load_file(handle, buffer, size)){
|
||||
file = working_set_alloc_always(system, working_set, general);
|
||||
if (file){
|
||||
buffer_bind_file(system, general, working_set, file, canon.name);
|
||||
buffer_bind_name(system, general, working_set, file, fname);
|
||||
init_normal_file(system, models, file, buffer, size);
|
||||
fill_buffer_summary(&result, file, cmd);
|
||||
}
|
||||
}
|
||||
|
||||
if (in_general_mem){
|
||||
general_memory_free(system, general, buffer);
|
||||
}
|
||||
|
||||
system->load_close(handle);
|
||||
}
|
||||
else if (!(flags & BufferCreate_NeverNew)){
|
||||
file = working_set_alloc_always(system, working_set, general);
|
||||
if (file){
|
||||
buffer_bind_name(system, general, working_set, file, fname);
|
||||
init_normal_file(system, models, file, 0, 0);
|
||||
fill_buffer_summary(&result, file, cmd);
|
||||
}
|
||||
}
|
||||
}
|
||||
else{
|
||||
fill_buffer_summary(&result, file, cmd);
|
||||
}
|
||||
}
|
||||
end_temp_memory(temp);
|
||||
|
||||
return(result);
|
||||
}
|
||||
|
@ -1588,8 +1528,14 @@ DOC_SEE(get_active_view)
|
|||
return(result);
|
||||
}
|
||||
|
||||
API_EXPORT int32_t
|
||||
View_Get_Setting(Application_Links *app, View_Summary *view, View_Setting_ID setting){
|
||||
API_EXPORT bool32
|
||||
View_Get_Setting(Application_Links *app, View_Summary *view, View_Setting_ID setting, int32_t *value_out)
|
||||
/*
|
||||
DOC_PARAM(view, the view from which to read a setting)
|
||||
DOC_PARAM(setting, the view setting to read)
|
||||
DOC_PARAM(value_out, address to write the setting value on success)
|
||||
DOC_RETURN(returns non-zero on success)
|
||||
*/{
|
||||
Command_Data *cmd = (Command_Data*)app->cmd_context;
|
||||
View *vptr = imp_get_view(cmd, view);
|
||||
int32_t result = -1;
|
||||
|
@ -2104,14 +2050,20 @@ DOC(This call sets the display font of a particular buffer.)
|
|||
}
|
||||
}
|
||||
|
||||
API_EXPORT int32_t
|
||||
API_EXPORT bool32
|
||||
Buffer_Get_Font(Application_Links *app, Buffer_Summary *buffer, char *name_out, int32_t name_max)
|
||||
/*
|
||||
DOC_PARAM(buffer, the buffer from which to get the font name)
|
||||
DOC_PARAM(name_out, a character array in which to write the name of the font)
|
||||
DOC_PARAM(name_max, the capacity of name_out)
|
||||
DOC_RETURN(returns non-zero on success)
|
||||
*/
|
||||
{
|
||||
Command_Data *cmd = (Command_Data*)app->cmd_context;
|
||||
Models *models = cmd->models;
|
||||
Editing_File *file = imp_get_file(cmd, buffer);
|
||||
|
||||
int32_t result = 0;
|
||||
bool32 result = 0;
|
||||
if (file){
|
||||
Font_Set *set = models->font_set;
|
||||
String name = make_string_cap(name_out, 0, name_max);
|
||||
|
@ -2249,6 +2201,11 @@ DOC(After this call the file list passed in should not be read or written to.)
|
|||
|
||||
API_EXPORT void
|
||||
Set_GUI_Up_Down_Keys(Application_Links *app, int16_t up_key, int16_t down_key)
|
||||
/*
|
||||
DOC_PARAM(up_key, the code of the key that should be interpreted as an up key)
|
||||
DOC_PARAM(down_key, the code of the key that should be interpreted as a down key)
|
||||
|
||||
DOC(This is a temporary ad-hoc solution to allow some customization of the behavior of the built in GUI. There is a high chance that it will be removed and not replaced at some point, so it is not recommended that it be heavily used.) */
|
||||
{
|
||||
Command_Data *cmd = (Command_Data*)app->cmd_context;
|
||||
Models *models = cmd->models;
|
||||
|
|
2497
4ed_metagen.cpp
2497
4ed_metagen.cpp
File diff suppressed because it is too large
Load Diff
|
@ -3,7 +3,7 @@
|
|||
call "ctime" -begin 4ed_data.ctm
|
||||
|
||||
SET OPTS=/W4 /wd4310 /wd4100 /wd4201 /wd4505 /wd4996 /wd4127 /wd4510 /wd4512 /wd4610 /wd4390 /WX
|
||||
SET OPTS=/GR- /EHa- /nologo /FC
|
||||
SET OPTS=%OPTS% /GR- /EHa- /nologo /FC
|
||||
|
||||
SET FirstError=0
|
||||
|
||||
|
|
|
@ -1,7 +1,15 @@
|
|||
|
||||
#define FSTRING_DECLS
|
||||
#define FSTRING_BEGIN
|
||||
#define DOC_EXPORT
|
||||
#define API_EXPORT_MACRO
|
||||
|
||||
#ifndef API_EXPORT
|
||||
# define API_EXPORT
|
||||
#endif
|
||||
|
||||
#ifndef API_EXPORT_INLINE
|
||||
# define API_EXPORT_INLINE
|
||||
#endif
|
||||
|
||||
#define CPP_NAME(n)
|
||||
|
||||
|
@ -61,73 +69,73 @@ static String null_string = {0};
|
|||
// Character Helpers
|
||||
//
|
||||
|
||||
FSTRING_INLINE fstr_bool
|
||||
API_EXPORT_INLINE FSTRING_INLINE fstr_bool
|
||||
char_is_slash(char c)
|
||||
/* DOC(This call returns non-zero if c is \ or /.) */{
|
||||
return (c == '\\' || c == '/');
|
||||
}
|
||||
|
||||
FSTRING_INLINE fstr_bool
|
||||
API_EXPORT_INLINE FSTRING_INLINE fstr_bool
|
||||
char_is_upper(char c)
|
||||
/* DOC(If c is an uppercase letter this call returns true.) */{
|
||||
return (c >= 'A' && c <= 'Z');
|
||||
}
|
||||
|
||||
FSTRING_INLINE fstr_bool
|
||||
API_EXPORT_INLINE FSTRING_INLINE fstr_bool
|
||||
char_is_lower(char c)
|
||||
/* DOC(If c is a lower letter this call returns true.) */{
|
||||
return (c >= 'a' && c <= 'z');
|
||||
}
|
||||
|
||||
FSTRING_INLINE char
|
||||
API_EXPORT_INLINE FSTRING_INLINE char
|
||||
char_to_upper(char c)
|
||||
/* DOC(If c is a lowercase letter this call returns the uppercase equivalent, otherwise it returns c.) */{
|
||||
return (c >= 'a' && c <= 'z') ? c + (char)('A' - 'a') : c;
|
||||
}
|
||||
|
||||
FSTRING_INLINE char
|
||||
API_EXPORT_INLINE FSTRING_INLINE char
|
||||
char_to_lower(char c)
|
||||
/* DOC(If c is an uppercase letter this call returns the lowercase equivalent, otherwise it returns c.) */{
|
||||
return (c >= 'A' && c <= 'Z') ? c - (char)('A' - 'a') : c;
|
||||
}
|
||||
|
||||
FSTRING_INLINE fstr_bool
|
||||
API_EXPORT_INLINE FSTRING_INLINE fstr_bool
|
||||
char_is_whitespace(char c)
|
||||
/* DOC(This call returns non-zero if c is whitespace.) */{
|
||||
return (c == ' ' || c == '\n' || c == '\r' || c == '\t');
|
||||
}
|
||||
|
||||
FSTRING_INLINE fstr_bool
|
||||
API_EXPORT_INLINE FSTRING_INLINE fstr_bool
|
||||
char_is_alpha_numeric(char c)
|
||||
/* DOC(This call returns non-zero if c is any alphanumeric character including underscore.) */{
|
||||
return (c >= 'a' && c <= 'z' || c >= 'A' && c <= 'Z' || c >= '0' && c <= '9' || c == '_');
|
||||
}
|
||||
|
||||
FSTRING_INLINE fstr_bool
|
||||
API_EXPORT_INLINE FSTRING_INLINE fstr_bool
|
||||
char_is_alpha_numeric_true(char c)
|
||||
/* DOC(This call returns non-zero if c is any alphanumeric character no including underscore.) */{
|
||||
return (c >= 'a' && c <= 'z' || c >= 'A' && c <= 'Z' || c >= '0' && c <= '9');
|
||||
}
|
||||
|
||||
FSTRING_INLINE fstr_bool
|
||||
API_EXPORT_INLINE FSTRING_INLINE fstr_bool
|
||||
char_is_alpha(char c)
|
||||
/* DOC(This call returns non-zero if c is any alphabetic character including underscore.) */{
|
||||
return (c >= 'a' && c <= 'z' || c >= 'A' && c <= 'Z' || c == '_');
|
||||
}
|
||||
|
||||
FSTRING_INLINE fstr_bool
|
||||
API_EXPORT_INLINE FSTRING_INLINE fstr_bool
|
||||
char_is_alpha_true(char c)
|
||||
/* DOC(This call returns non-zero if c is any alphabetic character.) */{
|
||||
return (c >= 'a' && c <= 'z' || c >= 'A' && c <= 'Z');
|
||||
}
|
||||
|
||||
FSTRING_INLINE fstr_bool
|
||||
API_EXPORT_INLINE FSTRING_INLINE fstr_bool
|
||||
char_is_hex(char c)
|
||||
/* DOC(This call returns non-zero if c is any valid hexadecimal digit.) */{
|
||||
return (c >= '0' && c <= '9' || c >= 'A' && c <= 'F' || c >= 'a' && c <= 'f');
|
||||
}
|
||||
|
||||
FSTRING_INLINE fstr_bool
|
||||
API_EXPORT_INLINE FSTRING_INLINE fstr_bool
|
||||
char_is_numeric(char c)
|
||||
/* DOC(This call returns non-zero if c is any valid decimal digit.) */{
|
||||
return (c >= '0' && c <= '9');
|
||||
|
@ -139,7 +147,7 @@ char_is_numeric(char c)
|
|||
//
|
||||
|
||||
CPP_NAME(make_string)
|
||||
FSTRING_INLINE String
|
||||
API_EXPORT_INLINE FSTRING_INLINE String
|
||||
make_string_cap(void *str, int32_t size, int32_t mem_size)/*
|
||||
DOC_PARAM(str, The str parameter provides the of memory with which the string shall operate.)
|
||||
DOC_PARAM(size, The size parameter expresses the initial size of the string.
|
||||
|
@ -154,7 +162,7 @@ DOC(This call returns the String created from the parameters.)
|
|||
return(result);
|
||||
}
|
||||
|
||||
FSTRING_INLINE String
|
||||
API_EXPORT_INLINE FSTRING_INLINE String
|
||||
make_string(void *str, int32_t size)/*
|
||||
DOC_PARAM(str, The str parameter provides the of memory with which the string shall operate.)
|
||||
DOC_PARAM(size, The size parameter expresses the initial size of the string.
|
||||
|
@ -170,19 +178,19 @@ DOC(This call returns the String created from the parameters.)
|
|||
return(result);
|
||||
}
|
||||
|
||||
DOC_EXPORT /* DOC(This macro takes a literal string in quotes and uses it to create a String
|
||||
with the correct size and memory size. Strings created this way should usually not be mutated.) */
|
||||
API_EXPORT_MACRO
|
||||
/* DOC(This macro takes a literal string in quotes and uses it to create a String with the correct size and memory size. Strings created this way should usually not be mutated.) */
|
||||
#define make_lit_string(s) (make_string_cap((char*)(s), sizeof(s)-1, sizeof(s)))
|
||||
|
||||
DOC_EXPORT /* DOC(This macro takes a local char array with a fixed width and uses it to create
|
||||
an empty String with the correct size and memory size to operate on the array.) */
|
||||
API_EXPORT_MACRO
|
||||
/* DOC(This macro takes a local char array with a fixed width and uses it to create an empty String with the correct size and memory size to operate on the array.) */
|
||||
#define make_fixed_width_string(s) (make_string_cap((char*)(s), 0, sizeof(s)))
|
||||
|
||||
DOC_EXPORT /* DOC(This macro is a helper for any calls that take a char*,integer pair to specify a
|
||||
string. This macro expands to both of those parameters from one String struct.) */
|
||||
API_EXPORT_MACRO
|
||||
/* DOC(This macro is a helper for any calls that take a char*,integer pair to specify a string. This macro expands to both of those parameters from one String struct.) */
|
||||
#define expand_str(s) ((s).str), ((s).size)
|
||||
|
||||
FSTRING_LINK int32_t
|
||||
API_EXPORT FSTRING_LINK int32_t
|
||||
str_size(char *str)
|
||||
/* DOC(This call returns the number of bytes before a null terminator starting at str.) */{
|
||||
int32_t i = 0;
|
||||
|
@ -190,10 +198,9 @@ str_size(char *str)
|
|||
return(i);
|
||||
}
|
||||
|
||||
FSTRING_INLINE String
|
||||
API_EXPORT_INLINE FSTRING_INLINE String
|
||||
make_string_slowly(void *str)
|
||||
/* DOC(This call makes a string by counting the number of bytes before a null terminator and
|
||||
treating that as the size and memory size of the string.) */{
|
||||
/* DOC(This call makes a string by counting the number of bytes before a null terminator and treating that as the size and memory size of the string.) */{
|
||||
String result;
|
||||
result.str = (char*)str;
|
||||
result.size = str_size((char*)str);
|
||||
|
@ -202,7 +209,7 @@ treating that as the size and memory size of the string.) */{
|
|||
}
|
||||
|
||||
CPP_NAME(substr)
|
||||
FSTRING_INLINE String
|
||||
API_EXPORT_INLINE FSTRING_INLINE String
|
||||
substr_tail(String str, int32_t start)
|
||||
/* DOC(This call creates a substring of str that starts with an offset from str's base.
|
||||
The new string uses the same underlying memory so both strings will see changes.
|
||||
|
@ -214,7 +221,7 @@ Usually strings created this way should only go through immutable calls.) */{
|
|||
return(result);
|
||||
}
|
||||
|
||||
FSTRING_INLINE String
|
||||
API_EXPORT_INLINE FSTRING_INLINE String
|
||||
substr(String str, int32_t start, int32_t size)
|
||||
/* DOC(This call creates a substring of str that starts with an offset from str's base,
|
||||
and has a fixed size. The new string uses the same underlying memory so both strings
|
||||
|
@ -229,7 +236,7 @@ will see changes. Usually strings created this way should only go through immuta
|
|||
return(result);
|
||||
}
|
||||
|
||||
FSTRING_LINK String
|
||||
API_EXPORT FSTRING_LINK String
|
||||
skip_whitespace(String str)
|
||||
/* DOC(This call creates a substring that starts with the first non-whitespace character of str.
|
||||
Like other substr calls, the new string uses the underlying memory and so should usually be
|
||||
|
@ -241,7 +248,7 @@ considered immutable.) DOC_SEE(substr) */{
|
|||
return(result);
|
||||
}
|
||||
|
||||
FSTRING_LINK String
|
||||
API_EXPORT FSTRING_LINK String
|
||||
chop_whitespace(String str)
|
||||
/* DOC(This call creates a substring that ends with the last non-whitespace character of str.
|
||||
Like other substr calls, the new string uses the underlying memory and so should usually be
|
||||
|
@ -253,7 +260,7 @@ considered immutable.) DOC_SEE(substr) */{
|
|||
return(result);
|
||||
}
|
||||
|
||||
FSTRING_LINK String
|
||||
API_EXPORT FSTRING_LINK String
|
||||
skip_chop_whitespace(String str)
|
||||
/* DOC(This call is equivalent to calling skip_whitespace and chop_whitespace together.)
|
||||
DOC_SEE(skip_whitespace) DOC_SEE(chop_whitespace)*/{
|
||||
|
@ -262,7 +269,7 @@ DOC_SEE(skip_whitespace) DOC_SEE(chop_whitespace)*/{
|
|||
return(str);
|
||||
}
|
||||
|
||||
FSTRING_INLINE String
|
||||
API_EXPORT_INLINE FSTRING_INLINE String
|
||||
tailstr(String str)
|
||||
/* DOC(This call returns an empty String with underlying memory taken from
|
||||
the portion of str's memory that is not used.) */{
|
||||
|
@ -279,7 +286,7 @@ the portion of str's memory that is not used.) */{
|
|||
//
|
||||
|
||||
CPP_NAME(match)
|
||||
FSTRING_LINK fstr_bool
|
||||
API_EXPORT FSTRING_LINK fstr_bool
|
||||
match_cc(char *a, char *b)/* DOC(This call returns non-zero if a and b are equivalent.) */{
|
||||
for (int32_t i = 0;; ++i){
|
||||
if (a[i] != b[i]){
|
||||
|
@ -292,7 +299,7 @@ match_cc(char *a, char *b)/* DOC(This call returns non-zero if a and b are equiv
|
|||
}
|
||||
|
||||
CPP_NAME(match)
|
||||
FSTRING_LINK fstr_bool
|
||||
API_EXPORT FSTRING_LINK fstr_bool
|
||||
match_sc(String a, char *b)/* DOC(This call returns non-zero if a and b are equivalent.) */{
|
||||
int32_t i = 0;
|
||||
for (; i < a.size; ++i){
|
||||
|
@ -307,13 +314,13 @@ match_sc(String a, char *b)/* DOC(This call returns non-zero if a and b are equi
|
|||
}
|
||||
|
||||
CPP_NAME(match)
|
||||
FSTRING_INLINE fstr_bool
|
||||
API_EXPORT_INLINE FSTRING_INLINE fstr_bool
|
||||
match_cs(char *a, String b)/* DOC(This call returns non-zero if a and b are equivalent.) */{
|
||||
return(match_sc(b,a));
|
||||
}
|
||||
|
||||
CPP_NAME(match)
|
||||
FSTRING_LINK fstr_bool
|
||||
API_EXPORT FSTRING_LINK fstr_bool
|
||||
match_ss(String a, String b)/* DOC(This call returns non-zero if a and b are equivalent.) */{
|
||||
if (a.size != b.size){
|
||||
return 0;
|
||||
|
@ -327,7 +334,7 @@ match_ss(String a, String b)/* DOC(This call returns non-zero if a and b are equ
|
|||
}
|
||||
|
||||
CPP_NAME(match_part)
|
||||
FSTRING_LINK fstr_bool
|
||||
API_EXPORT FSTRING_LINK fstr_bool
|
||||
match_part_ccl(char *a, char *b, int32_t *len)/*
|
||||
DOC_PARAM(len, If this call returns non-zero this parameter is used to output the length of b.)
|
||||
DOC(This call is similar to a match call, except that it is permitted for a to be longer than b.
|
||||
|
@ -343,7 +350,7 @@ In other words this call returns non-zero if b is a prefix of a.) */{
|
|||
}
|
||||
|
||||
CPP_NAME(match_part)
|
||||
FSTRING_LINK fstr_bool
|
||||
API_EXPORT FSTRING_LINK fstr_bool
|
||||
match_part_scl(String a, char *b, int32_t *len)/*
|
||||
DOC_PARAM(len, If this call returns non-zero this parameter is used to output the length of b.)
|
||||
DOC(This call is similar to a match call, except that it is permitted for a to be longer than b.
|
||||
|
@ -359,7 +366,7 @@ In other words this call returns non-zero if b is a prefix of a.) */{
|
|||
}
|
||||
|
||||
CPP_NAME(match_part)
|
||||
FSTRING_INLINE fstr_bool
|
||||
API_EXPORT_INLINE FSTRING_INLINE fstr_bool
|
||||
match_part_cc(char *a, char *b)/*
|
||||
DOC_PARAM(len, If this call returns non-zero this parameter is used to output the length of b.)
|
||||
DOC(This call is similar to a match call, except that it is permitted for a to be longer than b.
|
||||
|
@ -369,7 +376,7 @@ In other words this call returns non-zero if b is a prefix of a.) */{
|
|||
}
|
||||
|
||||
CPP_NAME(match_part)
|
||||
FSTRING_INLINE fstr_bool
|
||||
API_EXPORT_INLINE FSTRING_INLINE fstr_bool
|
||||
match_part_sc(String a, char *b)/*
|
||||
DOC(This call is similar to a match call, except that it is permitted for a to be longer than b.
|
||||
In other words this call returns non-zero if b is a prefix of a.) */{
|
||||
|
@ -378,7 +385,7 @@ In other words this call returns non-zero if b is a prefix of a.) */{
|
|||
}
|
||||
|
||||
CPP_NAME(match_part)
|
||||
FSTRING_LINK fstr_bool
|
||||
API_EXPORT FSTRING_LINK fstr_bool
|
||||
match_part_cs(char *a, String b)/*
|
||||
DOC(This call is similar to a match call, except that it is permitted for a to be longer than b.
|
||||
In other words this call returns non-zero if b is a prefix of a.) */{
|
||||
|
@ -391,7 +398,7 @@ In other words this call returns non-zero if b is a prefix of a.) */{
|
|||
}
|
||||
|
||||
CPP_NAME(match_part)
|
||||
FSTRING_LINK fstr_bool
|
||||
API_EXPORT FSTRING_LINK fstr_bool
|
||||
match_part_ss(String a, String b)/*
|
||||
DOC(This call is similar to a match call, except that it is permitted for a to be longer than b.
|
||||
In other words this call returns non-zero if b is a prefix of a.) */{
|
||||
|
@ -407,7 +414,7 @@ In other words this call returns non-zero if b is a prefix of a.) */{
|
|||
}
|
||||
|
||||
CPP_NAME(match_insensitive)
|
||||
FSTRING_LINK fstr_bool
|
||||
API_EXPORT FSTRING_LINK fstr_bool
|
||||
match_insensitive_cc(char *a, char *b)/*
|
||||
DOC(This call returns non-zero if a and b are equivalent under case insensitive comparison.) */{
|
||||
for (int32_t i = 0;; ++i){
|
||||
|
@ -422,7 +429,7 @@ DOC(This call returns non-zero if a and b are equivalent under case insensitive
|
|||
}
|
||||
|
||||
CPP_NAME(match_insensitive)
|
||||
FSTRING_LINK fstr_bool
|
||||
API_EXPORT FSTRING_LINK fstr_bool
|
||||
match_insensitive_sc(String a, char *b)/*
|
||||
DOC(This call returns non-zero if a and b are equivalent under case insensitive comparison.) */{
|
||||
int32_t i = 0;
|
||||
|
@ -439,14 +446,14 @@ DOC(This call returns non-zero if a and b are equivalent under case insensitive
|
|||
}
|
||||
|
||||
CPP_NAME(match_insensitive)
|
||||
FSTRING_INLINE fstr_bool
|
||||
API_EXPORT_INLINE FSTRING_INLINE fstr_bool
|
||||
match_insensitive_cs(char *a, String b)/*
|
||||
DOC(This call returns non-zero if a and b are equivalent under case insensitive comparison.) */{
|
||||
return match_insensitive_sc(b,a);
|
||||
}
|
||||
|
||||
CPP_NAME(match_insensitive)
|
||||
FSTRING_LINK fstr_bool
|
||||
API_EXPORT FSTRING_LINK fstr_bool
|
||||
match_insensitive_ss(String a, String b)/*
|
||||
DOC(This call returns non-zero if a and b are equivalent under case insensitive comparison.) */{
|
||||
if (a.size != b.size){
|
||||
|
@ -462,7 +469,7 @@ DOC(This call returns non-zero if a and b are equivalent under case insensitive
|
|||
}
|
||||
|
||||
CPP_NAME(match_part_insensitive)
|
||||
FSTRING_LINK fstr_bool
|
||||
API_EXPORT FSTRING_LINK fstr_bool
|
||||
match_part_insensitive_ccl(char *a, char *b, int32_t *len)/*
|
||||
DOC_PARAM(len, If this call returns non-zero this parameter is used to output the length of b.)
|
||||
DOC(This call performs the same partial matching rule as match_part under case insensitive comparison.)
|
||||
|
@ -478,7 +485,7 @@ DOC_SEE(match_part) */{
|
|||
}
|
||||
|
||||
CPP_NAME(match_part_insensitive)
|
||||
FSTRING_LINK fstr_bool
|
||||
API_EXPORT FSTRING_LINK fstr_bool
|
||||
match_part_insensitive_scl(String a, char *b, int32_t *len)/*
|
||||
DOC_PARAM(len, If this call returns non-zero this parameter is used to output the length of b.)
|
||||
DOC(This call performs the same partial matching rule as match_part under case insensitive comparison.)
|
||||
|
@ -495,7 +502,7 @@ DOC_SEE(match_part) */{
|
|||
}
|
||||
|
||||
CPP_NAME(match_part_insensitive)
|
||||
FSTRING_INLINE fstr_bool
|
||||
API_EXPORT_INLINE FSTRING_INLINE fstr_bool
|
||||
match_part_insensitive_cc(char *a, char *b)/*
|
||||
DOC(This call performs the same partial matching rule as match_part under case insensitive comparison.)
|
||||
DOC_SEE(match_part) */{
|
||||
|
@ -504,7 +511,7 @@ DOC_SEE(match_part) */{
|
|||
}
|
||||
|
||||
CPP_NAME(match_part_insensitive)
|
||||
FSTRING_INLINE fstr_bool
|
||||
API_EXPORT_INLINE FSTRING_INLINE fstr_bool
|
||||
match_part_insensitive_sc(String a, char *b)/*
|
||||
DOC(This call performs the same partial matching rule as match_part under case insensitive comparison.)
|
||||
DOC_SEE(match_part) */{
|
||||
|
@ -513,7 +520,7 @@ DOC_SEE(match_part) */{
|
|||
}
|
||||
|
||||
CPP_NAME(match_part_insensitive)
|
||||
FSTRING_LINK fstr_bool
|
||||
API_EXPORT FSTRING_LINK fstr_bool
|
||||
match_part_insensitive_cs(char *a, String b)/*
|
||||
DOC(This call performs the same partial matching rule as match_part under case insensitive comparison.)
|
||||
DOC_SEE(match_part) */{
|
||||
|
@ -526,7 +533,7 @@ DOC_SEE(match_part) */{
|
|||
}
|
||||
|
||||
CPP_NAME(match_part_insensitive)
|
||||
FSTRING_LINK fstr_bool
|
||||
API_EXPORT FSTRING_LINK fstr_bool
|
||||
match_part_insensitive_ss(String a, String b)/*
|
||||
DOC(This call performs the same partial matching rule as match_part under case insensitive comparison.)
|
||||
DOC_SEE(match_part) */{
|
||||
|
@ -542,7 +549,7 @@ DOC_SEE(match_part) */{
|
|||
}
|
||||
|
||||
CPP_NAME(compare)
|
||||
FSTRING_LINK int32_t
|
||||
API_EXPORT FSTRING_LINK int32_t
|
||||
compare_cc(char *a, char *b)/*
|
||||
DOC(This call returns zero if a and b are equivalent,
|
||||
it returns negative if a sorts before b alphabetically,
|
||||
|
@ -556,7 +563,7 @@ and positive if a sorts after b alphabetically.) */{
|
|||
}
|
||||
|
||||
CPP_NAME(compare)
|
||||
FSTRING_LINK int32_t
|
||||
API_EXPORT FSTRING_LINK int32_t
|
||||
compare_sc(String a, char *b)/*
|
||||
DOC(This call returns zero if a and b are equivalent,
|
||||
it returns negative if a sorts before b alphabetically,
|
||||
|
@ -580,7 +587,7 @@ and positive if a sorts after b alphabetically.) */{
|
|||
}
|
||||
|
||||
CPP_NAME(compare)
|
||||
FSTRING_INLINE int32_t
|
||||
API_EXPORT_INLINE FSTRING_INLINE int32_t
|
||||
compare_cs(char *a, String b)/*
|
||||
DOC(This call returns zero if a and b are equivalent,
|
||||
it returns negative if a sorts before b alphabetically,
|
||||
|
@ -590,7 +597,7 @@ and positive if a sorts after b alphabetically.) */{
|
|||
}
|
||||
|
||||
CPP_NAME(compare)
|
||||
FSTRING_LINK int32_t
|
||||
API_EXPORT FSTRING_LINK int32_t
|
||||
compare_ss(String a, String b)/*
|
||||
DOC(This call returns zero if a and b are equivalent,
|
||||
it returns negative if a sorts before b alphabetically,
|
||||
|
@ -619,7 +626,7 @@ and positive if a sorts after b alphabetically.) */{
|
|||
//
|
||||
|
||||
CPP_NAME(find)
|
||||
FSTRING_LINK int32_t
|
||||
API_EXPORT FSTRING_LINK int32_t
|
||||
find_c_char(char *str, int32_t start, char character)/*
|
||||
DOC_PARAM(str, The str parameter provides a null terminated string to search.)
|
||||
DOC_PARAM(start, The start parameter provides the index of the first character in str to search.)
|
||||
|
@ -632,7 +639,7 @@ if the character is not found.) */{
|
|||
}
|
||||
|
||||
CPP_NAME(find)
|
||||
FSTRING_LINK int32_t
|
||||
API_EXPORT FSTRING_LINK int32_t
|
||||
find_s_char(String str, int32_t start, char character)/*
|
||||
DOC_PARAM(str, The str parameter provides a string to search.)
|
||||
DOC_PARAM(start, The start parameter provides the index of the first character in str to search.)
|
||||
|
@ -645,7 +652,7 @@ if the character is not found.) */{
|
|||
}
|
||||
|
||||
CPP_NAME(rfind)
|
||||
FSTRING_LINK int32_t
|
||||
API_EXPORT FSTRING_LINK int32_t
|
||||
rfind_s_char(String str, int32_t start, char character)/*
|
||||
DOC_PARAM(str, The str parameter provides a string to search.)
|
||||
DOC_PARAM(start, The start parameter provides the index of the first character in str to search.)
|
||||
|
@ -658,7 +665,7 @@ the given character occurs. If the index is found it is returned otherwise -1 i
|
|||
}
|
||||
|
||||
CPP_NAME(find)
|
||||
FSTRING_LINK int32_t
|
||||
API_EXPORT FSTRING_LINK int32_t
|
||||
find_c_chars(char *str, int32_t start, char *characters)/*
|
||||
DOC_PARAM(str, The str parameter provides a null terminated string to search.)
|
||||
DOC_PARAM(start, The start parameter provides the index of the first character in str to search.)
|
||||
|
@ -678,7 +685,7 @@ or the size of the string if no such character is not found.) */{
|
|||
}
|
||||
|
||||
CPP_NAME(find)
|
||||
FSTRING_LINK int32_t
|
||||
API_EXPORT FSTRING_LINK int32_t
|
||||
find_s_chars(String str, int32_t start, char *characters)/*
|
||||
DOC_PARAM(str, The str parameter provides a string to search.)
|
||||
DOC_PARAM(start, The start parameter provides the index of the first character in str to search.)
|
||||
|
@ -698,7 +705,7 @@ or the size of the string if no such character is not found.) */{
|
|||
}
|
||||
|
||||
CPP_NAME(find_substr)
|
||||
FSTRING_LINK int32_t
|
||||
API_EXPORT FSTRING_LINK int32_t
|
||||
find_substr_c(char *str, int32_t start, String seek)/*
|
||||
DOC_PARAM(str, The str parameter provides a null terminated string to search.)
|
||||
DOC_PARAM(start, The start parameter provides the index of the first character in str to search.)
|
||||
|
@ -730,7 +737,7 @@ size of str if no such substring in str is found.) */{
|
|||
}
|
||||
|
||||
CPP_NAME(find_substr)
|
||||
FSTRING_LINK int32_t
|
||||
API_EXPORT FSTRING_LINK int32_t
|
||||
find_substr_s(String str, int32_t start, String seek)/*
|
||||
DOC_PARAM(str, The str parameter provides a string to search.)
|
||||
DOC_PARAM(start, The start parameter provides the index of the first character in str to search.)
|
||||
|
@ -762,7 +769,7 @@ size of str if no such substring in str is found.) */{
|
|||
}
|
||||
|
||||
CPP_NAME(rfind_substr)
|
||||
FSTRING_LINK int32_t
|
||||
API_EXPORT FSTRING_LINK int32_t
|
||||
rfind_substr_s(String str, int32_t start, String seek)/*
|
||||
DOC_PARAM(str, The str parameter provides a string to search.)
|
||||
DOC_PARAM(start, The start parameter provides the index of the first character in str to search.)
|
||||
|
@ -796,7 +803,7 @@ or -1 if no such substring in str is found.) */{
|
|||
}
|
||||
|
||||
CPP_NAME(find_substr_insensitive)
|
||||
FSTRING_LINK int32_t
|
||||
API_EXPORT FSTRING_LINK int32_t
|
||||
find_substr_insensitive_c(char *str, int32_t start, String seek)/*
|
||||
DOC_PARAM(str, The str parameter provides a null terminated string to search.)
|
||||
DOC_PARAM(start, The start parameter provides the index of the first character in str to search.)
|
||||
|
@ -830,7 +837,7 @@ DOC_SEE(find_substr)*/{
|
|||
}
|
||||
|
||||
CPP_NAME(find_substr_insensitive)
|
||||
FSTRING_LINK int32_t
|
||||
API_EXPORT FSTRING_LINK int32_t
|
||||
find_substr_insensitive_s(String str, int32_t start, String seek)/*
|
||||
DOC_PARAM(str, The str parameter provides a string to search.)
|
||||
DOC_PARAM(start, The start parameter provides the index of the first character in str to search.)
|
||||
|
@ -866,21 +873,21 @@ DOC_SEE(find_substr)*/{
|
|||
}
|
||||
|
||||
CPP_NAME(has_substr)
|
||||
FSTRING_INLINE fstr_bool
|
||||
API_EXPORT_INLINE FSTRING_INLINE fstr_bool
|
||||
has_substr_c(char *s, String seek)/*
|
||||
DOC(This call returns non-zero if the string s contains a substring equivalent to seek.) */{
|
||||
return (s[find_substr_c(s, 0, seek)] != 0);
|
||||
}
|
||||
|
||||
CPP_NAME(has_substr)
|
||||
FSTRING_INLINE fstr_bool
|
||||
API_EXPORT_INLINE FSTRING_INLINE fstr_bool
|
||||
has_substr_s(String s, String seek)/*
|
||||
DOC(This call returns non-zero if the string s contains a substring equivalent to seek.) */{
|
||||
return (find_substr_s(s, 0, seek) < s.size);
|
||||
}
|
||||
|
||||
CPP_NAME(has_substr_insensitive)
|
||||
FSTRING_INLINE fstr_bool
|
||||
API_EXPORT_INLINE FSTRING_INLINE fstr_bool
|
||||
has_substr_insensitive_c(char *s, String seek)/*
|
||||
DOC(This call returns non-zero if the string s contains a substring equivalent to seek
|
||||
under case insensitive comparison.) */{
|
||||
|
@ -888,7 +895,7 @@ under case insensitive comparison.) */{
|
|||
}
|
||||
|
||||
CPP_NAME(has_substr_insensitive)
|
||||
FSTRING_INLINE fstr_bool
|
||||
API_EXPORT_INLINE FSTRING_INLINE fstr_bool
|
||||
has_substr_insensitive_s(String s, String seek)/*
|
||||
DOC(This call returns non-zero if the string s contains a substring equivalent to seek
|
||||
under case insensitive comparison.) */{
|
||||
|
@ -900,7 +907,7 @@ under case insensitive comparison.) */{
|
|||
//
|
||||
|
||||
CPP_NAME(copy_fast_unsafe)
|
||||
FSTRING_LINK int32_t
|
||||
API_EXPORT FSTRING_LINK int32_t
|
||||
copy_fast_unsafe_cc(char *dest, char *src)/*
|
||||
DOC(This call performs a copy from the src buffer to the dest buffer.
|
||||
The copy does not stop until a null terminator is found in src. There
|
||||
|
@ -917,7 +924,7 @@ of bytes coppied to dest.) */{
|
|||
}
|
||||
|
||||
CPP_NAME(copy_fast_unsafe)
|
||||
FSTRING_LINK int32_t
|
||||
API_EXPORT FSTRING_LINK int32_t
|
||||
copy_fast_unsafe_cs(char *dest, String src)/*
|
||||
DOC(This call performs a copy from the src string to the dest buffer.
|
||||
The copy does not stop until src.size characters are coppied. There
|
||||
|
@ -933,7 +940,7 @@ of bytes coppied to dest.) */{
|
|||
}
|
||||
|
||||
CPP_NAME(copy_checked)
|
||||
FSTRING_LINK fstr_bool
|
||||
API_EXPORT FSTRING_LINK fstr_bool
|
||||
copy_checked_ss(String *dest, String src)/*
|
||||
DOC(This call performs a copy from the src string to the dest string.
|
||||
The memory_size of dest is checked before any coppying is done.
|
||||
|
@ -952,7 +959,7 @@ This call returns non-zero on a successful copy.) */{
|
|||
}
|
||||
|
||||
CPP_NAME(copy_partial)
|
||||
FSTRING_LINK fstr_bool
|
||||
API_EXPORT FSTRING_LINK fstr_bool
|
||||
copy_partial_sc(String *dest, char *src)/*
|
||||
DOC(This call performs a copy from the src buffer to the dest string.
|
||||
The memory_size of dest is checked if the entire copy cannot be performed,
|
||||
|
@ -973,7 +980,7 @@ if the entire string is coppied to dest.) */{
|
|||
}
|
||||
|
||||
CPP_NAME(copy_partial)
|
||||
FSTRING_LINK fstr_bool
|
||||
API_EXPORT FSTRING_LINK fstr_bool
|
||||
copy_partial_ss(String *dest, String src)/*
|
||||
DOC(This call performs a copy from the src string to the dest string.
|
||||
The memory_size of dest is checked if the entire copy cannot be performed,
|
||||
|
@ -994,7 +1001,7 @@ if the entire string is coppied to dest.) */{
|
|||
}
|
||||
|
||||
CPP_NAME(copy)
|
||||
FSTRING_INLINE int32_t
|
||||
API_EXPORT_INLINE FSTRING_INLINE int32_t
|
||||
copy_cc(char *dest, char *src)/*
|
||||
DOC(This call performs a copy from src to dest equivalent to copy_fast_unsafe.)
|
||||
DOC_SEE(copy_fast_unsafe) */{
|
||||
|
@ -1002,7 +1009,7 @@ DOC_SEE(copy_fast_unsafe) */{
|
|||
}
|
||||
|
||||
CPP_NAME(copy)
|
||||
FSTRING_INLINE void
|
||||
API_EXPORT_INLINE FSTRING_INLINE void
|
||||
copy_ss(String *dest, String src)/*
|
||||
DOC(This call performs a copy from src to dest equivalent to copy_checked.)
|
||||
DOC_SEE(copy_checked) */{
|
||||
|
@ -1010,7 +1017,7 @@ DOC_SEE(copy_checked) */{
|
|||
}
|
||||
|
||||
CPP_NAME(copy)
|
||||
FSTRING_INLINE void
|
||||
API_EXPORT_INLINE FSTRING_INLINE void
|
||||
copy_sc(String *dest, char *src)/*
|
||||
DOC(This call performs a copy from src to dest equivalent to copy_partial.)
|
||||
DOC_SEE(copy_partial) */{
|
||||
|
@ -1018,7 +1025,7 @@ DOC_SEE(copy_partial) */{
|
|||
}
|
||||
|
||||
CPP_NAME(append_checked)
|
||||
FSTRING_LINK fstr_bool
|
||||
API_EXPORT FSTRING_LINK fstr_bool
|
||||
append_checked_ss(String *dest, String src)/*
|
||||
DOC(This call checks if there is enough space in dest's underlying memory
|
||||
to append src onto dest. If there is src is appended and the call returns non-zero.) */{
|
||||
|
@ -1032,7 +1039,7 @@ to append src onto dest. If there is src is appended and the call returns non-ze
|
|||
}
|
||||
|
||||
CPP_NAME(append_partial)
|
||||
FSTRING_LINK fstr_bool
|
||||
API_EXPORT FSTRING_LINK fstr_bool
|
||||
append_partial_sc(String *dest, char *src)/*
|
||||
DOC(This call attemps to append as much of src into the space in dest's underlying memory
|
||||
as possible. If the entire string is appended the call returns non-zero.) */{
|
||||
|
@ -1043,7 +1050,7 @@ as possible. If the entire string is appended the call returns non-zero.) */{
|
|||
}
|
||||
|
||||
CPP_NAME(append_partial)
|
||||
FSTRING_LINK fstr_bool
|
||||
API_EXPORT FSTRING_LINK fstr_bool
|
||||
append_partial_ss(String *dest, String src)/*
|
||||
DOC(This call attemps to append as much of src into the space in dest's underlying memory
|
||||
as possible. If the entire string is appended the call returns non-zero.) */{
|
||||
|
@ -1054,7 +1061,7 @@ as possible. If the entire string is appended the call returns non-zero.) */{
|
|||
}
|
||||
|
||||
CPP_NAME(append)
|
||||
FSTRING_LINK fstr_bool
|
||||
API_EXPORT FSTRING_LINK fstr_bool
|
||||
append_s_char(String *dest, char c)/*
|
||||
DOC(This call attemps to append c onto dest. If there is space left in dest's underlying
|
||||
memory the character is appended and the call returns non-zero.) */{
|
||||
|
@ -1067,20 +1074,20 @@ memory the character is appended and the call returns non-zero.) */{
|
|||
}
|
||||
|
||||
CPP_NAME(append)
|
||||
FSTRING_INLINE fstr_bool
|
||||
API_EXPORT_INLINE FSTRING_INLINE fstr_bool
|
||||
append_ss(String *dest, String src)/*
|
||||
DOC(This call is equivalent to append_partial.) DOC_SEE(append_partial) */{
|
||||
return append_partial_ss(dest, src);
|
||||
}
|
||||
|
||||
CPP_NAME(append)
|
||||
FSTRING_INLINE fstr_bool
|
||||
API_EXPORT_INLINE FSTRING_INLINE fstr_bool
|
||||
append_sc(String *dest, char *src)/*
|
||||
DOC(This call is equivalent to append_partial.) DOC_SEE(append_partial) */{
|
||||
return append_partial_sc(dest, src);
|
||||
}
|
||||
|
||||
FSTRING_LINK fstr_bool
|
||||
API_EXPORT FSTRING_LINK fstr_bool
|
||||
terminate_with_null(String *str)/*
|
||||
DOC(This call attemps to append a null terminator onto str without effecting the
|
||||
size of str. This is usually called when the time comes to pass the the string to an
|
||||
|
@ -1094,7 +1101,7 @@ byte in the strings underlying memory.) */{
|
|||
return(result);
|
||||
}
|
||||
|
||||
FSTRING_LINK fstr_bool
|
||||
API_EXPORT FSTRING_LINK fstr_bool
|
||||
append_padding(String *dest, char c, int32_t target_size)/*
|
||||
DOC(This call pads out dest so that it has a size of target_size by appending
|
||||
the padding character c until the target size is achieved. This call returns
|
||||
|
@ -1118,7 +1125,7 @@ non-zero if dest does not run out of space in the underlying memory.) */{
|
|||
// Other Edits
|
||||
//
|
||||
|
||||
FSTRING_LINK void
|
||||
API_EXPORT FSTRING_LINK void
|
||||
replace_char(String *str, char replace, char with)/*
|
||||
DOC_PARAM(str, The str parameter provides the string in which replacement shall be performed.)
|
||||
DOC_PARAM(replace, The replace character specifies which character should be replaced.)
|
||||
|
@ -1132,7 +1139,7 @@ DOC(This call replaces all occurances of character in str with another character
|
|||
}
|
||||
|
||||
CPP_NAME(to_lower)
|
||||
FSTRING_LINK void
|
||||
API_EXPORT FSTRING_LINK void
|
||||
to_lower_cc(char *src, char *dst)/*
|
||||
DOC_PARAM(src, The source string to conver to lowercase. This string must be null terminated.)
|
||||
DOC_PARAM(dst, The destination buffer to receive the converted string. This must be large
|
||||
|
@ -1148,7 +1155,7 @@ string in place.)
|
|||
}
|
||||
|
||||
CPP_NAME(to_lower)
|
||||
FSTRING_LINK void
|
||||
API_EXPORT FSTRING_LINK void
|
||||
to_lower_ss(String *dst, String src)/*
|
||||
DOC_PARAM(dst, The destination buffer to receive the converted string.
|
||||
This must have a capacity of at least the size of src.)
|
||||
|
@ -1170,7 +1177,7 @@ that src and dst may be exactly equal in order to convert the string in place.)
|
|||
}
|
||||
|
||||
CPP_NAME(to_lower)
|
||||
FSTRING_LINK void
|
||||
API_EXPORT FSTRING_LINK void
|
||||
to_lower_s(String *str)/*
|
||||
DOC_PARAM(str, The string to be converted to all lowercase.)
|
||||
DOC(This version of to_lower converts str to lowercase in place.)
|
||||
|
@ -1184,7 +1191,7 @@ DOC(This version of to_lower converts str to lowercase in place.)
|
|||
}
|
||||
|
||||
CPP_NAME(to_upper)
|
||||
FSTRING_LINK void
|
||||
API_EXPORT FSTRING_LINK void
|
||||
to_upper_cc(char *src, char *dst)/*
|
||||
DOC_PARAM(src, The source string to convert to uppercase. This string must be null terminated.)
|
||||
DOC_PARAM(dst, The destination buffer to receive the converted string.
|
||||
|
@ -1199,7 +1206,7 @@ that src and dst may be exactly equal in order to convert the string in place.)
|
|||
}
|
||||
|
||||
CPP_NAME(to_upper)
|
||||
FSTRING_LINK void
|
||||
API_EXPORT FSTRING_LINK void
|
||||
to_upper_ss(String *dst, String src)/*
|
||||
DOC_PARAM(dst, The destination buffer to receive the converted string.
|
||||
This must have a capacity of at least the size of src.)
|
||||
|
@ -1221,7 +1228,7 @@ that src and dst may be exactly equal in order to convert the string in place.)
|
|||
}
|
||||
|
||||
CPP_NAME(to_upper)
|
||||
FSTRING_LINK void
|
||||
API_EXPORT FSTRING_LINK void
|
||||
to_upper_s(String *str)/*
|
||||
DOC_PARAM(str, The string to be converted to all uppercase.)
|
||||
DOC(This version of to_upper converts str to uppercase in place.)
|
||||
|
@ -1235,7 +1242,7 @@ DOC(This version of to_upper converts str to uppercase in place.)
|
|||
}
|
||||
|
||||
CPP_NAME(to_camel)
|
||||
FSTRING_LINK void
|
||||
API_EXPORT FSTRING_LINK void
|
||||
to_camel_cc(char *src, char *dst)/*
|
||||
DOC_PARAM(src, The source string to convert to camel case.)
|
||||
DOC_PARAM(dst, The destination buffer to receive the converted string.
|
||||
|
@ -1270,7 +1277,7 @@ convert the string in place.)
|
|||
// String <-> Number Conversions
|
||||
//
|
||||
|
||||
FSTRING_LINK int32_t
|
||||
API_EXPORT FSTRING_LINK int32_t
|
||||
int_to_str_size(int32_t x)/*
|
||||
DOC(This call returns the number of bytes required to represent x as a string.) */{
|
||||
int32_t size = 1;
|
||||
|
@ -1285,7 +1292,7 @@ DOC(This call returns the number of bytes required to represent x as a string.)
|
|||
return(size);
|
||||
}
|
||||
|
||||
FSTRING_LINK fstr_bool
|
||||
API_EXPORT FSTRING_LINK fstr_bool
|
||||
int_to_str(String *dest, int32_t x)/*
|
||||
DOC(This call writes a string representation of x into dest. If there is enough
|
||||
space in dest this call returns non-zero.) */{
|
||||
|
@ -1333,7 +1340,7 @@ space in dest this call returns non-zero.) */{
|
|||
return(result);
|
||||
}
|
||||
|
||||
FSTRING_LINK fstr_bool
|
||||
API_EXPORT FSTRING_LINK fstr_bool
|
||||
append_int_to_str(String *dest, int32_t x)/*
|
||||
DOC(This call appends a string representation of x onto dest. If there is enough
|
||||
space in dest this call returns non-zero.) */{
|
||||
|
@ -1345,7 +1352,7 @@ space in dest this call returns non-zero.) */{
|
|||
return(result);
|
||||
}
|
||||
|
||||
FSTRING_LINK int32_t
|
||||
API_EXPORT FSTRING_LINK int32_t
|
||||
u64_to_str_size(uint64_t x)/*
|
||||
DOC(This call returns the number of bytes required to represent x as a string.) */{
|
||||
int32_t size;
|
||||
|
@ -1363,7 +1370,7 @@ DOC(This call returns the number of bytes required to represent x as a string.)
|
|||
return(size);
|
||||
}
|
||||
|
||||
FSTRING_LINK fstr_bool
|
||||
API_EXPORT FSTRING_LINK fstr_bool
|
||||
u64_to_str(String *dest, uint64_t x)/*
|
||||
DOC(This call writes a string representation of x into dest. If there is enough
|
||||
space in dest this call returns non-zero.) */{
|
||||
|
@ -1402,7 +1409,7 @@ space in dest this call returns non-zero.) */{
|
|||
return(result);
|
||||
}
|
||||
|
||||
FSTRING_LINK fstr_bool
|
||||
API_EXPORT FSTRING_LINK fstr_bool
|
||||
append_u64_to_str(String *dest, uint64_t x)/*
|
||||
DOC(This call appends a string representation of x onto dest. If there is enough
|
||||
space in dest this call returns non-zero.) */{
|
||||
|
@ -1437,7 +1444,7 @@ get_float_vars(float x){
|
|||
}
|
||||
#endif
|
||||
|
||||
FSTRING_LINK int32_t
|
||||
API_EXPORT FSTRING_LINK int32_t
|
||||
float_to_str_size(float x)/*
|
||||
DOC(This call returns the number of bytes required to represent x as a string.) */{
|
||||
Float_To_Str_Variables vars = get_float_vars(x);
|
||||
|
@ -1446,7 +1453,7 @@ DOC(This call returns the number of bytes required to represent x as a string.)
|
|||
return(size);
|
||||
}
|
||||
|
||||
FSTRING_LINK fstr_bool
|
||||
API_EXPORT FSTRING_LINK fstr_bool
|
||||
append_float_to_str(String *dest, float x)/*
|
||||
DOC(This call writes a string representation of x into dest. If there is enough
|
||||
space in dest this call returns non-zero.) */{
|
||||
|
@ -1464,7 +1471,7 @@ space in dest this call returns non-zero.) */{
|
|||
return(result);
|
||||
}
|
||||
|
||||
FSTRING_LINK fstr_bool
|
||||
API_EXPORT FSTRING_LINK fstr_bool
|
||||
float_to_str(String *dest, float x)/*
|
||||
DOC(This call appends a string representation of x onto dest. If there is enough
|
||||
space in dest this call returns non-zero.) */{
|
||||
|
@ -1475,7 +1482,7 @@ space in dest this call returns non-zero.) */{
|
|||
}
|
||||
|
||||
CPP_NAME(str_is_int)
|
||||
FSTRING_LINK int32_t
|
||||
API_EXPORT FSTRING_LINK int32_t
|
||||
str_is_int_c(char *str)/*
|
||||
DOC(If str is a valid string representation of an integer, this call returns non-zero) */{
|
||||
fstr_bool result = 1;
|
||||
|
@ -1489,7 +1496,7 @@ DOC(If str is a valid string representation of an integer, this call returns non
|
|||
}
|
||||
|
||||
CPP_NAME(str_is_int)
|
||||
FSTRING_LINK fstr_bool
|
||||
API_EXPORT FSTRING_LINK fstr_bool
|
||||
str_is_int_s(String str)/*
|
||||
DOC(If str is a valid string representation of an integer, this call returns non-zero.) */{
|
||||
fstr_bool result = 1;
|
||||
|
@ -1503,7 +1510,7 @@ DOC(If str is a valid string representation of an integer, this call returns non
|
|||
}
|
||||
|
||||
CPP_NAME(str_to_int)
|
||||
FSTRING_LINK int32_t
|
||||
API_EXPORT FSTRING_LINK int32_t
|
||||
str_to_int_c(char *str)/*
|
||||
DOC(If str is a valid string representation of an integer, this call will return
|
||||
the integer represented by the string. Otherwise this call returns zero.) */{
|
||||
|
@ -1522,7 +1529,7 @@ the integer represented by the string. Otherwise this call returns zero.) */{
|
|||
}
|
||||
|
||||
CPP_NAME(str_to_int)
|
||||
FSTRING_LINK int32_t
|
||||
API_EXPORT FSTRING_LINK int32_t
|
||||
str_to_int_s(String str)/*
|
||||
DOC(If str represents a valid string representation of an integer, this call will return
|
||||
the integer represented by the string. Otherwise this call returns zero.) */{
|
||||
|
@ -1540,7 +1547,7 @@ the integer represented by the string. Otherwise this call returns zero.) */{
|
|||
return(x);
|
||||
}
|
||||
|
||||
FSTRING_LINK int32_t
|
||||
API_EXPORT FSTRING_LINK int32_t
|
||||
hexchar_to_int(char c)/*
|
||||
DOC(If c is a valid hexadecimal digit [0-9a-fA-F] this call returns the value of
|
||||
the integer value of the digit. Otherwise the return is some nonsense value.) */{
|
||||
|
@ -1557,14 +1564,14 @@ the integer value of the digit. Otherwise the return is some nonsense value.) */
|
|||
return(x);
|
||||
}
|
||||
|
||||
FSTRING_LINK char
|
||||
API_EXPORT FSTRING_LINK char
|
||||
int_to_hexchar(int32_t x)/*
|
||||
DOC(If x is in the range [0,15] this call returns the equivalent lowercase hexadecimal digit.
|
||||
Otherwise the return is some nonsense value.) */{
|
||||
return (x<10)?((char)x+'0'):((char)x+'a'-10);
|
||||
}
|
||||
|
||||
FSTRING_LINK uint32_t
|
||||
API_EXPORT FSTRING_LINK uint32_t
|
||||
hexstr_to_int(String str)/*
|
||||
DOC(This call interprets str has a hexadecimal representation of an integer and returns
|
||||
the represented integer value.) */{
|
||||
|
@ -1583,7 +1590,7 @@ the represented integer value.) */{
|
|||
return(x);
|
||||
}
|
||||
|
||||
FSTRING_LINK fstr_bool
|
||||
API_EXPORT FSTRING_LINK fstr_bool
|
||||
color_to_hexstr(String *s, uint32_t color)/*
|
||||
DOC(This call fills s with the hexadecimal representation of the color.
|
||||
If there is enough memory in s to represent the color this call returns non-zero.) */{
|
||||
|
@ -1612,7 +1619,7 @@ If there is enough memory in s to represent the color this call returns non-zero
|
|||
return(result);
|
||||
}
|
||||
|
||||
FSTRING_LINK fstr_bool
|
||||
API_EXPORT FSTRING_LINK fstr_bool
|
||||
hexstr_to_color(String s, uint32_t *out)/*
|
||||
DOC(This call interprets s as a color and writes the 32-bit integer representation into out.) */{
|
||||
fstr_bool result = 0;
|
||||
|
@ -1636,7 +1643,7 @@ DOC(This call interprets s as a color and writes the 32-bit integer representati
|
|||
//
|
||||
|
||||
CPP_NAME(reverse_seek_slash)
|
||||
FSTRING_LINK int32_t
|
||||
API_EXPORT FSTRING_LINK int32_t
|
||||
reverse_seek_slash_pos(String str, int32_t pos)/*
|
||||
DOC(This call searches for a slash in str by starting pos bytes from the end and going backwards.) */{
|
||||
int32_t i = str.size - 1 - pos;
|
||||
|
@ -1646,20 +1653,20 @@ DOC(This call searches for a slash in str by starting pos bytes from the end and
|
|||
return i;
|
||||
}
|
||||
|
||||
FSTRING_INLINE int32_t
|
||||
API_EXPORT_INLINE FSTRING_INLINE int32_t
|
||||
reverse_seek_slash(String str)/*
|
||||
DOC(This call searches for a slash in str by starting at the end and going backwards.) */{
|
||||
return(reverse_seek_slash_pos(str, 0));
|
||||
}
|
||||
|
||||
FSTRING_INLINE String
|
||||
API_EXPORT_INLINE FSTRING_INLINE String
|
||||
front_of_directory(String dir)/*
|
||||
DOC(This call returns a substring of dir containing only the file name or
|
||||
folder name furthest to the right in the directory.) DOC_SEE(substr) */{
|
||||
return substr_tail(dir, reverse_seek_slash(dir) + 1);
|
||||
}
|
||||
|
||||
FSTRING_INLINE String
|
||||
API_EXPORT_INLINE FSTRING_INLINE String
|
||||
path_of_directory(String dir)/*
|
||||
DOC(This call returns a substring of dir containing the whole path except
|
||||
for the final file or folder name.) DOC_SEE(substr) */{
|
||||
|
@ -1667,7 +1674,7 @@ for the final file or folder name.) DOC_SEE(substr) */{
|
|||
}
|
||||
|
||||
CPP_NAME(set_last_folder)
|
||||
FSTRING_LINK fstr_bool
|
||||
API_EXPORT FSTRING_LINK fstr_bool
|
||||
set_last_folder_sc(String *dir, char *folder_name, char slash)/*
|
||||
DOC_PARAM(dir, The dir parameter is the directory string in which to set the last folder in the directory.)
|
||||
DOC_PARAM(folder_name, The folder_name parameter is a null terminated string specifying the name to set
|
||||
|
@ -1690,7 +1697,7 @@ If there is enough memory in dir this call returns non-zero.) */{
|
|||
}
|
||||
|
||||
CPP_NAME(set_last_folder)
|
||||
FSTRING_LINK fstr_bool
|
||||
API_EXPORT FSTRING_LINK fstr_bool
|
||||
set_last_folder_ss(String *dir, String folder_name, char slash)/*
|
||||
DOC_PARAM(dir, The dir parameter is the directory string in which to set the last folder in the directory.)
|
||||
DOC_PARAM(folder_name, The folder_name parameter is a string specifying the name to set at the end of the directory.)
|
||||
|
@ -1711,7 +1718,7 @@ If there is enough memory in dir this call returns non-zero.) */{
|
|||
return(result);
|
||||
}
|
||||
|
||||
FSTRING_LINK String
|
||||
API_EXPORT FSTRING_LINK String
|
||||
file_extension(String str)/*
|
||||
DOC(This call returns a substring containing only the file extension of the provided filename.)
|
||||
DOC_SEE(substr) */{
|
||||
|
@ -1723,7 +1730,7 @@ DOC_SEE(substr) */{
|
|||
return(make_string(str.str+i, str.size-i));
|
||||
}
|
||||
|
||||
FSTRING_LINK fstr_bool
|
||||
API_EXPORT FSTRING_LINK fstr_bool
|
||||
remove_extension(String *str)/*
|
||||
DOC(This call attemps to delete a file extension off the end of a filename.
|
||||
This call returns non-zero on success.) */{
|
||||
|
@ -1739,7 +1746,7 @@ This call returns non-zero on success.) */{
|
|||
return(result);
|
||||
}
|
||||
|
||||
FSTRING_LINK fstr_bool
|
||||
API_EXPORT FSTRING_LINK fstr_bool
|
||||
remove_last_folder(String *str)/*
|
||||
DOC(This call attemps to delete a folder or filename off the end of a path string.
|
||||
This call returns non-zero on success.) */{
|
||||
|
@ -1754,7 +1761,7 @@ This call returns non-zero on success.) */{
|
|||
|
||||
// TODO(allen): Add hash-table extension to string sets.
|
||||
CPP_NAME(string_set_match)
|
||||
FSTRING_LINK fstr_bool
|
||||
API_EXPORT FSTRING_LINK fstr_bool
|
||||
string_set_match_table(void *str_set, int32_t item_size, int32_t count, String str, int32_t *match_index)/*
|
||||
DOC_PARAM(str_set, The str_set parameter may be an array of any type.
|
||||
It should point at the String in the first element of the array.)
|
||||
|
@ -1779,7 +1786,7 @@ DOC_SEE(match) */{
|
|||
return(result);
|
||||
}
|
||||
|
||||
FSTRING_LINK fstr_bool
|
||||
API_EXPORT FSTRING_LINK fstr_bool
|
||||
string_set_match(String *str_set, int32_t count, String str, int32_t *match_index)/*
|
||||
DOC_PARAM(str_set, The str_set parameter is an array of String structs specifying matchable strings.)
|
||||
DOC_PARAM(count, The count parameter specifies the number of String structs in the str_set array.)
|
||||
|
|
File diff suppressed because it is too large
Load Diff
Binary file not shown.
|
@ -0,0 +1,22 @@
|
|||
@echo off
|
||||
|
||||
call "ctime" -begin 4ed_site.ctm
|
||||
|
||||
SET OPTS=/W4 /wd4310 /wd4100 /wd4201 /wd4505 /wd4996 /wd4127 /wd4510 /wd4512 /wd4610 /wd4390 /WX
|
||||
SET OPTS=%OPTS% /GR- /EHa- /nologo /FC
|
||||
SET OPTS=%OPTS% /I..\\..\\code
|
||||
|
||||
|
||||
SET FirstError=0
|
||||
|
||||
pushd ..\..\build\site
|
||||
cl %OPTS% ..\..\code\site\sitegen.cpp /Zi /Fesitegen
|
||||
if %ERRORLEVEL% neq 0 (set FirstError=1)
|
||||
popd
|
||||
|
||||
if %FirstError% neq 1 (
|
||||
..\..\build\site\sitegen.exe .. source_material ..\..\site
|
||||
)
|
||||
if %ERRORLEVEL% neq 0 (set FirstError=1)
|
||||
|
||||
call "ctime" -end 4ed_site.ctm %FirstError%
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue