Merge branch 'master' of https://bitbucket.org/4coder/4coder
This commit is contained in:
commit
7b046c477b
3550
4coder_API.html
3550
4coder_API.html
File diff suppressed because one or more lines are too long
|
@ -119,72 +119,72 @@ typedef TOGGLE_FULLSCREEN_SIG(Toggle_Fullscreen_Function);
|
|||
typedef IS_FULLSCREEN_SIG(Is_Fullscreen_Function);
|
||||
typedef SEND_EXIT_SIGNAL_SIG(Send_Exit_Signal_Function);
|
||||
struct Application_Links{
|
||||
void *memory;
|
||||
int32_t memory_size;
|
||||
Exec_Command_Function *exec_command;
|
||||
Exec_System_Command_Function *exec_system_command;
|
||||
Clipboard_Post_Function *clipboard_post;
|
||||
Clipboard_Count_Function *clipboard_count;
|
||||
Clipboard_Index_Function *clipboard_index;
|
||||
Get_Buffer_Count_Function *get_buffer_count;
|
||||
Get_Buffer_First_Function *get_buffer_first;
|
||||
Get_Buffer_Next_Function *get_buffer_next;
|
||||
Get_Buffer_Function *get_buffer;
|
||||
Get_Buffer_By_Name_Function *get_buffer_by_name;
|
||||
Buffer_Boundary_Seek_Function *buffer_boundary_seek;
|
||||
Buffer_Read_Range_Function *buffer_read_range;
|
||||
Buffer_Replace_Range_Function *buffer_replace_range;
|
||||
Buffer_Compute_Cursor_Function *buffer_compute_cursor;
|
||||
Buffer_Batch_Edit_Function *buffer_batch_edit;
|
||||
Buffer_Set_Setting_Function *buffer_set_setting;
|
||||
Buffer_Auto_Indent_Function *buffer_auto_indent;
|
||||
Create_Buffer_Function *create_buffer;
|
||||
Save_Buffer_Function *save_buffer;
|
||||
Kill_Buffer_Function *kill_buffer;
|
||||
Get_View_First_Function *get_view_first;
|
||||
Get_View_Next_Function *get_view_next;
|
||||
Get_View_Function *get_view;
|
||||
Get_Active_View_Function *get_active_view;
|
||||
Open_View_Function *open_view;
|
||||
Close_View_Function *close_view;
|
||||
Set_Active_View_Function *set_active_view;
|
||||
View_Set_Setting_Function *view_set_setting;
|
||||
View_Set_Split_Proportion_Function *view_set_split_proportion;
|
||||
View_Compute_Cursor_Function *view_compute_cursor;
|
||||
View_Set_Cursor_Function *view_set_cursor;
|
||||
View_Set_Scroll_Function *view_set_scroll;
|
||||
View_Set_Mark_Function *view_set_mark;
|
||||
View_Set_Highlight_Function *view_set_highlight;
|
||||
View_Set_Buffer_Function *view_set_buffer;
|
||||
View_Post_Fade_Function *view_post_fade;
|
||||
Get_User_Input_Function *get_user_input;
|
||||
Get_Command_Input_Function *get_command_input;
|
||||
Get_Mouse_State_Function *get_mouse_state;
|
||||
Start_Query_Bar_Function *start_query_bar;
|
||||
End_Query_Bar_Function *end_query_bar;
|
||||
Print_Message_Function *print_message;
|
||||
Change_Theme_Function *change_theme;
|
||||
Change_Font_Function *change_font;
|
||||
Buffer_Set_Font_Function *buffer_set_font;
|
||||
Set_Theme_Colors_Function *set_theme_colors;
|
||||
Get_Theme_Colors_Function *get_theme_colors;
|
||||
Directory_Get_Hot_Function *directory_get_hot;
|
||||
Get_File_List_Function *get_file_list;
|
||||
Free_File_List_Function *free_file_list;
|
||||
Memory_Allocate_Function *memory_allocate;
|
||||
Memory_Set_Protection_Function *memory_set_protection;
|
||||
Memory_Free_Function *memory_free;
|
||||
File_Exists_Function *file_exists;
|
||||
Directory_CD_Function *directory_cd;
|
||||
Get_4ed_Path_Function *get_4ed_path;
|
||||
Show_Mouse_Cursor_Function *show_mouse_cursor;
|
||||
Toggle_Fullscreen_Function *toggle_fullscreen;
|
||||
Is_Fullscreen_Function *is_fullscreen;
|
||||
Send_Exit_Signal_Function *send_exit_signal;
|
||||
void *cmd_context;
|
||||
void *system_links;
|
||||
void *current_coroutine;
|
||||
int32_t type_coroutine;
|
||||
Exec_Command_Function *exec_command;
|
||||
Exec_System_Command_Function *exec_system_command;
|
||||
Clipboard_Post_Function *clipboard_post;
|
||||
Clipboard_Count_Function *clipboard_count;
|
||||
Clipboard_Index_Function *clipboard_index;
|
||||
Get_Buffer_Count_Function *get_buffer_count;
|
||||
Get_Buffer_First_Function *get_buffer_first;
|
||||
Get_Buffer_Next_Function *get_buffer_next;
|
||||
Get_Buffer_Function *get_buffer;
|
||||
Get_Buffer_By_Name_Function *get_buffer_by_name;
|
||||
Buffer_Boundary_Seek_Function *buffer_boundary_seek;
|
||||
Buffer_Read_Range_Function *buffer_read_range;
|
||||
Buffer_Replace_Range_Function *buffer_replace_range;
|
||||
Buffer_Compute_Cursor_Function *buffer_compute_cursor;
|
||||
Buffer_Batch_Edit_Function *buffer_batch_edit;
|
||||
Buffer_Set_Setting_Function *buffer_set_setting;
|
||||
Buffer_Auto_Indent_Function *buffer_auto_indent;
|
||||
Create_Buffer_Function *create_buffer;
|
||||
Save_Buffer_Function *save_buffer;
|
||||
Kill_Buffer_Function *kill_buffer;
|
||||
Get_View_First_Function *get_view_first;
|
||||
Get_View_Next_Function *get_view_next;
|
||||
Get_View_Function *get_view;
|
||||
Get_Active_View_Function *get_active_view;
|
||||
Open_View_Function *open_view;
|
||||
Close_View_Function *close_view;
|
||||
Set_Active_View_Function *set_active_view;
|
||||
View_Set_Setting_Function *view_set_setting;
|
||||
View_Set_Split_Proportion_Function *view_set_split_proportion;
|
||||
View_Compute_Cursor_Function *view_compute_cursor;
|
||||
View_Set_Cursor_Function *view_set_cursor;
|
||||
View_Set_Scroll_Function *view_set_scroll;
|
||||
View_Set_Mark_Function *view_set_mark;
|
||||
View_Set_Highlight_Function *view_set_highlight;
|
||||
View_Set_Buffer_Function *view_set_buffer;
|
||||
View_Post_Fade_Function *view_post_fade;
|
||||
Get_User_Input_Function *get_user_input;
|
||||
Get_Command_Input_Function *get_command_input;
|
||||
Get_Mouse_State_Function *get_mouse_state;
|
||||
Start_Query_Bar_Function *start_query_bar;
|
||||
End_Query_Bar_Function *end_query_bar;
|
||||
Print_Message_Function *print_message;
|
||||
Change_Theme_Function *change_theme;
|
||||
Change_Font_Function *change_font;
|
||||
Buffer_Set_Font_Function *buffer_set_font;
|
||||
Set_Theme_Colors_Function *set_theme_colors;
|
||||
Get_Theme_Colors_Function *get_theme_colors;
|
||||
Directory_Get_Hot_Function *directory_get_hot;
|
||||
Get_File_List_Function *get_file_list;
|
||||
Free_File_List_Function *free_file_list;
|
||||
Memory_Allocate_Function *memory_allocate;
|
||||
Memory_Set_Protection_Function *memory_set_protection;
|
||||
Memory_Free_Function *memory_free;
|
||||
File_Exists_Function *file_exists;
|
||||
Directory_CD_Function *directory_cd;
|
||||
Get_4ed_Path_Function *get_4ed_path;
|
||||
Show_Mouse_Cursor_Function *show_mouse_cursor;
|
||||
Toggle_Fullscreen_Function *toggle_fullscreen;
|
||||
Is_Fullscreen_Function *is_fullscreen;
|
||||
Send_Exit_Signal_Function *send_exit_signal;
|
||||
void *memory;
|
||||
int32_t memory_size;
|
||||
void *cmd_context;
|
||||
void *system_links;
|
||||
void *current_coroutine;
|
||||
int32_t type_coroutine;
|
||||
};
|
||||
#define FillAppLinksAPI(app_links) do{\
|
||||
app_links->exec_command = Exec_Command;\
|
||||
|
@ -246,4 +246,4 @@ app_links->get_4ed_path = Get_4ed_Path;\
|
|||
app_links->show_mouse_cursor = Show_Mouse_Cursor;\
|
||||
app_links->toggle_fullscreen = Toggle_Fullscreen;\
|
||||
app_links->is_fullscreen = Is_Fullscreen;\
|
||||
app_links->send_exit_signal = Send_Exit_Signal; } while(false)
|
||||
app_links->send_exit_signal = Send_Exit_Signal;} while(false)
|
||||
|
|
|
@ -1916,7 +1916,7 @@ CUSTOM_COMMAND_SIG(query_replace){
|
|||
int32_t pos, new_pos;
|
||||
|
||||
bar.prompt = make_lit_string("Replace? (y)es, (n)ext, (esc)\n");
|
||||
bar.string = string_zero();
|
||||
bar.string = null_string;
|
||||
|
||||
app->start_query_bar(app, &bar, 0);
|
||||
|
||||
|
|
|
@ -4,12 +4,14 @@
|
|||
#ifndef FCPP_LEXER_TYPES_INC
|
||||
#define FCPP_LEXER_TYPES_INC
|
||||
|
||||
#if 0
|
||||
#ifndef ENUM
|
||||
#define ENUM(type,name) typedef type name; enum name##_
|
||||
#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.) */
|
||||
ENUM(int32_t, Cpp_Token_Type){
|
||||
ENUM(uint32_t, Cpp_Token_Type){
|
||||
CPP_TOKEN_JUNK,
|
||||
CPP_TOKEN_COMMENT,
|
||||
|
||||
|
@ -222,177 +224,6 @@ ENUM(int32_t, Cpp_Token_Type){
|
|||
CPP_TOKEN_TYPE_COUNT
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
#if 1
|
||||
enum Cpp_Token_Type{
|
||||
CPP_TOKEN_JUNK,
|
||||
CPP_TOKEN_COMMENT,
|
||||
|
||||
CPP_PP_INCLUDE,
|
||||
CPP_PP_DEFINE,
|
||||
CPP_PP_UNDEF,
|
||||
CPP_PP_IF,
|
||||
CPP_PP_IFDEF,
|
||||
CPP_PP_IFNDEF,
|
||||
CPP_PP_ELSE,
|
||||
CPP_PP_ELIF,
|
||||
CPP_PP_ENDIF,
|
||||
CPP_PP_ERROR,
|
||||
CPP_PP_IMPORT,
|
||||
CPP_PP_USING,
|
||||
CPP_PP_LINE,
|
||||
CPP_PP_PRAGMA,
|
||||
CPP_PP_STRINGIFY,
|
||||
CPP_PP_CONCAT,
|
||||
CPP_PP_UNKNOWN,
|
||||
|
||||
CPP_TOKEN_KEY_TYPE,
|
||||
CPP_TOKEN_KEY_MODIFIER,
|
||||
CPP_TOKEN_KEY_QUALIFIER,
|
||||
CPP_TOKEN_KEY_OPERATOR, // NOTE(allen): This type is not actually stored in tokens
|
||||
CPP_TOKEN_KEY_CONTROL_FLOW,
|
||||
CPP_TOKEN_KEY_CAST,
|
||||
CPP_TOKEN_KEY_TYPE_DECLARATION,
|
||||
CPP_TOKEN_KEY_ACCESS,
|
||||
CPP_TOKEN_KEY_LINKAGE,
|
||||
CPP_TOKEN_KEY_OTHER,
|
||||
|
||||
CPP_TOKEN_IDENTIFIER,
|
||||
CPP_TOKEN_INTEGER_CONSTANT,
|
||||
CPP_TOKEN_CHARACTER_CONSTANT,
|
||||
CPP_TOKEN_FLOATING_CONSTANT,
|
||||
CPP_TOKEN_STRING_CONSTANT,
|
||||
CPP_TOKEN_BOOLEAN_CONSTANT,
|
||||
|
||||
CPP_TOKEN_STATIC_ASSERT,
|
||||
|
||||
CPP_TOKEN_BRACKET_OPEN,
|
||||
CPP_TOKEN_BRACKET_CLOSE,
|
||||
CPP_TOKEN_PARENTHESE_OPEN,
|
||||
CPP_TOKEN_PARENTHESE_CLOSE,
|
||||
CPP_TOKEN_BRACE_OPEN,
|
||||
CPP_TOKEN_BRACE_CLOSE,
|
||||
CPP_TOKEN_SEMICOLON,
|
||||
CPP_TOKEN_ELLIPSIS,
|
||||
|
||||
// NOTE(allen): Ambiguous tokens, lexer only,
|
||||
// parser figures out the real meaning
|
||||
CPP_TOKEN_STAR,
|
||||
CPP_TOKEN_AMPERSAND,
|
||||
CPP_TOKEN_TILDE,
|
||||
CPP_TOKEN_PLUS,
|
||||
CPP_TOKEN_MINUS,
|
||||
CPP_TOKEN_INCREMENT,
|
||||
CPP_TOKEN_DECREMENT,
|
||||
|
||||
// NOTE(allen): Precedence 1, LtoR
|
||||
CPP_TOKEN_SCOPE,
|
||||
|
||||
// NOTE(allen): Precedence 2, LtoR
|
||||
CPP_TOKEN_POSTINC, // from increment, parser only
|
||||
CPP_TOKEN_POSTDEC, // from decrement, parser only
|
||||
CPP_TOKEN_FUNC_STYLE_CAST, // parser only
|
||||
CPP_TOKEN_CPP_STYLE_CAST,
|
||||
CPP_TOKEN_CALL, // from open paren, parser only
|
||||
CPP_TOKEN_INDEX, // from bracket open, parser only
|
||||
CPP_TOKEN_DOT,
|
||||
CPP_TOKEN_ARROW,
|
||||
|
||||
// NOTE(allen): Precedence 3, RtoL
|
||||
CPP_TOKEN_PREINC, // from increment, parser only
|
||||
CPP_TOKEN_PREDEC, // from decrement, parser only
|
||||
CPP_TOKEN_POSITIVE, // from plus, parser only
|
||||
CPP_TOKEN_NEGAITVE, // from minus, parser only
|
||||
CPP_TOKEN_NOT,
|
||||
CPP_TOKEN_BIT_NOT, // from tilde, direct from 'compl'
|
||||
CPP_TOKEN_CAST, // from open paren, parser only
|
||||
CPP_TOKEN_DEREF, // from star, parser only
|
||||
CPP_TOKEN_TYPE_PTR, // from star, parser only
|
||||
CPP_TOKEN_ADDRESS, // from ampersand, parser only
|
||||
CPP_TOKEN_TYPE_REF, // from ampersand, parser only
|
||||
CPP_TOKEN_SIZEOF,
|
||||
CPP_TOKEN_ALIGNOF,
|
||||
CPP_TOKEN_DECLTYPE,
|
||||
CPP_TOKEN_TYPEID,
|
||||
CPP_TOKEN_NEW,
|
||||
CPP_TOKEN_DELETE,
|
||||
CPP_TOKEN_NEW_ARRAY, // from new and bracket open, parser only
|
||||
CPP_TOKEN_DELETE_ARRAY, // from delete and bracket open, parser only
|
||||
|
||||
// NOTE(allen): Precedence 4, LtoR
|
||||
CPP_TOKEN_PTRDOT,
|
||||
CPP_TOKEN_PTRARROW,
|
||||
|
||||
// NOTE(allen): Precedence 5, LtoR
|
||||
CPP_TOKEN_MUL, // from start, parser only
|
||||
CPP_TOKEN_DIV,
|
||||
CPP_TOKEN_MOD,
|
||||
|
||||
// NOTE(allen): Precedence 6, LtoR
|
||||
CPP_TOKEN_ADD, // from plus, parser only
|
||||
CPP_TOKEN_SUB, // from minus, parser only
|
||||
|
||||
// NOTE(allen): Precedence 7, LtoR
|
||||
CPP_TOKEN_LSHIFT,
|
||||
CPP_TOKEN_RSHIFT,
|
||||
|
||||
// NOTE(allen): Precedence 8, LtoR
|
||||
CPP_TOKEN_LESS,
|
||||
CPP_TOKEN_GRTR,
|
||||
CPP_TOKEN_GRTREQ,
|
||||
CPP_TOKEN_LESSEQ,
|
||||
|
||||
// NOTE(allen): Precedence 9, LtoR
|
||||
CPP_TOKEN_EQEQ,
|
||||
CPP_TOKEN_NOTEQ,
|
||||
|
||||
// NOTE(allen): Precedence 10, LtoR
|
||||
CPP_TOKEN_BIT_AND, // from ampersand, direct from 'bitand'
|
||||
|
||||
// NOTE(allen): Precedence 11, LtoR
|
||||
CPP_TOKEN_BIT_XOR,
|
||||
|
||||
// NOTE(allen): Precedence 12, LtoR
|
||||
CPP_TOKEN_BIT_OR,
|
||||
|
||||
// NOTE(allen): Precedence 13, LtoR
|
||||
CPP_TOKEN_AND,
|
||||
|
||||
// NOTE(allen): Precedence 14, LtoR
|
||||
CPP_TOKEN_OR,
|
||||
|
||||
// NOTE(allen): Precedence 15, RtoL
|
||||
CPP_TOKEN_TERNARY_QMARK,
|
||||
CPP_TOKEN_COLON,
|
||||
CPP_TOKEN_THROW,
|
||||
CPP_TOKEN_EQ,
|
||||
CPP_TOKEN_ADDEQ,
|
||||
CPP_TOKEN_SUBEQ,
|
||||
CPP_TOKEN_MULEQ,
|
||||
CPP_TOKEN_DIVEQ,
|
||||
CPP_TOKEN_MODEQ,
|
||||
CPP_TOKEN_LSHIFTEQ,
|
||||
CPP_TOKEN_RSHIFTEQ,
|
||||
CPP_TOKEN_ANDEQ,
|
||||
CPP_TOKEN_OREQ,
|
||||
CPP_TOKEN_XOREQ,
|
||||
|
||||
// NOTE(allen): Precedence 16, LtoR
|
||||
CPP_TOKEN_COMMA,
|
||||
|
||||
CPP_TOKEN_DEFINED,
|
||||
CPP_TOKEN_INCLUDE_FILE,
|
||||
CPP_TOKEN_ERROR_MESSAGE,
|
||||
|
||||
// NOTE(allen): used in the parser
|
||||
CPP_TOKEN_EOF,
|
||||
|
||||
CPP_TOKEN_TYPE_COUNT
|
||||
};
|
||||
#endif
|
||||
|
||||
struct Cpp_Token{
|
||||
Cpp_Token_Type type;
|
||||
int32_t start, size;
|
||||
|
@ -400,18 +231,18 @@ struct Cpp_Token{
|
|||
uint16_t flags;
|
||||
};
|
||||
|
||||
enum Cpp_Token_Flag{
|
||||
CPP_TFLAG_IGNORE = 1 << 0,
|
||||
CPP_TFLAG_PP_DIRECTIVE = 1 << 1,
|
||||
CPP_TFLAG_PP_BODY = 1 << 2,
|
||||
CPP_TFLAG_BAD_ENDING = 1 << 3,
|
||||
CPP_TFLAG_MULTILINE = 1 << 4,
|
||||
CPP_TFLAG_PARAMETERIZED = 1 << 5,
|
||||
CPP_TFLAG_IS_OPERATOR = 1 << 6,
|
||||
CPP_TFLAG_IS_KEYWORD = 1 << 7
|
||||
ENUM(uint16_t, Cpp_Token_Flag){
|
||||
CPP_TFLAG_IGNORE = 0x1,
|
||||
CPP_TFLAG_PP_DIRECTIVE = 0x2,
|
||||
CPP_TFLAG_PP_BODY = 0x4,
|
||||
CPP_TFLAG_BAD_ENDING = 0x8,
|
||||
CPP_TFLAG_MULTILINE = 0x10,
|
||||
CPP_TFLAG_PARAMETERIZED = 0x20,
|
||||
CPP_TFLAG_IS_OPERATOR = 0x40,
|
||||
CPP_TFLAG_IS_KEYWORD = 0x80
|
||||
};
|
||||
|
||||
enum Cpp_Preprocessor_State{
|
||||
ENUM(uint16_t, Cpp_Preprocessor_State){
|
||||
CPP_LEX_PP_DEFAULT,
|
||||
CPP_LEX_PP_IDENTIFIER,
|
||||
CPP_LEX_PP_MACRO_IDENTIFIER,
|
||||
|
@ -421,7 +252,6 @@ enum Cpp_Preprocessor_State{
|
|||
CPP_LEX_PP_NUMBER,
|
||||
CPP_LEX_PP_ERROR,
|
||||
CPP_LEX_PP_JUNK,
|
||||
// NEVER ADD BELOW THIS
|
||||
CPP_LEX_PP_COUNT
|
||||
};
|
||||
|
||||
|
@ -429,23 +259,7 @@ struct Cpp_Token_Stack{
|
|||
Cpp_Token *tokens;
|
||||
int32_t count, max_count;
|
||||
};
|
||||
inline Cpp_Token_Stack
|
||||
cpp_token_stack_zero(){
|
||||
Cpp_Token_Stack stack={0};
|
||||
return(stack);
|
||||
}
|
||||
|
||||
#if 0
|
||||
struct Cpp_Token_Merge{
|
||||
Cpp_Token new_token;
|
||||
int32_t did_merge;
|
||||
};
|
||||
#endif
|
||||
|
||||
struct Seek_Result{
|
||||
int32_t pos;
|
||||
int32_t new_line;
|
||||
};
|
||||
static Cpp_Token_Stack null_cpp_token_stack = {0};
|
||||
|
||||
struct Cpp_Get_Token_Result{
|
||||
int32_t token_index;
|
566
4coder_string.h
566
4coder_string.h
|
@ -47,347 +47,208 @@ typedef struct Offset_String{
|
|||
#if !defined(FCODER_STRING_H)
|
||||
#define FCODER_STRING_H
|
||||
|
||||
FSTRING_INLINE fstr_bool char_is_slash(char c);
|
||||
FSTRING_INLINE char char_to_upper(char c);
|
||||
FSTRING_INLINE char char_to_lower(char c);
|
||||
FSTRING_INLINE fstr_bool char_is_whitespace(char c);
|
||||
FSTRING_INLINE fstr_bool char_is_alpha_numeric(char c);
|
||||
FSTRING_INLINE fstr_bool char_is_alpha_numeric_true(char c);
|
||||
FSTRING_INLINE fstr_bool char_is_alpha(char c);
|
||||
FSTRING_INLINE fstr_bool char_is_alpha_true(char c);
|
||||
FSTRING_INLINE fstr_bool char_is_hex(char c);
|
||||
FSTRING_INLINE fstr_bool char_is_numeric(char c);
|
||||
FSTRING_INLINE String string_zero(void);
|
||||
FSTRING_INLINE String make_string_cap(void *str, int32_t size, int32_t mem_size);
|
||||
FSTRING_INLINE String make_string(void *str, int32_t size);
|
||||
FSTRING_INLINE fstr_bool char_is_slash(char c);
|
||||
FSTRING_INLINE char char_to_upper(char c);
|
||||
FSTRING_INLINE char char_to_lower(char c);
|
||||
FSTRING_INLINE fstr_bool char_is_whitespace(char c);
|
||||
FSTRING_INLINE fstr_bool char_is_alpha_numeric(char c);
|
||||
FSTRING_INLINE fstr_bool char_is_alpha_numeric_true(char c);
|
||||
FSTRING_INLINE fstr_bool char_is_alpha(char c);
|
||||
FSTRING_INLINE fstr_bool char_is_alpha_true(char c);
|
||||
FSTRING_INLINE fstr_bool char_is_hex(char c);
|
||||
FSTRING_INLINE fstr_bool char_is_numeric(char c);
|
||||
FSTRING_INLINE String make_string_cap(void *str, int32_t size, int32_t mem_size);
|
||||
FSTRING_INLINE String make_string(void *str, int32_t size);
|
||||
#ifndef make_lit_string
|
||||
# define make_lit_string(s) (make_string_cap((char*)(s), sizeof(s)-1, sizeof(s)))
|
||||
# define make_lit_string(s) (make_string_cap((char*)(s), sizeof(s)-1, sizeof(s)))
|
||||
#endif
|
||||
#ifndef make_fixed_width_string
|
||||
# define make_fixed_width_string(s) (make_string_cap((char*)(s), 0, sizeof(s)))
|
||||
# define make_fixed_width_string(s) (make_string_cap((char*)(s), 0, sizeof(s)))
|
||||
#endif
|
||||
#ifndef expand_str
|
||||
# define expand_str(s) ((s).str), ((s).size)
|
||||
#endif
|
||||
FSTRING_LINK int32_t str_size(char *str);
|
||||
FSTRING_INLINE String make_string_slowly(void *str);
|
||||
FSTRING_INLINE String substr_tail(String str, int32_t start);
|
||||
FSTRING_INLINE String substr(String str, int32_t start, int32_t size);
|
||||
FSTRING_LINK String skip_whitespace(String str);
|
||||
FSTRING_LINK String chop_whitespace(String str);
|
||||
FSTRING_LINK String skip_chop_whitespace(String str);
|
||||
FSTRING_INLINE String tailstr(String str);
|
||||
FSTRING_LINK fstr_bool match_cc(char *a, char *b);
|
||||
FSTRING_LINK fstr_bool match_sc(String a, char *b);
|
||||
FSTRING_INLINE fstr_bool match_cs(char *a, String b);
|
||||
FSTRING_LINK fstr_bool match_ss(String a, String b);
|
||||
FSTRING_LINK fstr_bool match_part_ccl(char *a, char *b, int32_t *len);
|
||||
FSTRING_LINK fstr_bool match_part_scl(String a, char *b, int32_t *len);
|
||||
FSTRING_INLINE fstr_bool match_part_cc(char *a, char *b);
|
||||
FSTRING_INLINE fstr_bool match_part_sc(String a, char *b);
|
||||
FSTRING_LINK fstr_bool match_part_cs(char *a, String b);
|
||||
FSTRING_LINK fstr_bool match_part_ss(String a, String b);
|
||||
FSTRING_LINK fstr_bool match_insensitive_cc(char *a, char *b);
|
||||
FSTRING_LINK fstr_bool match_insensitive_sc(String a, char *b);
|
||||
FSTRING_INLINE fstr_bool match_insensitive_cs(char *a, String b);
|
||||
FSTRING_LINK fstr_bool match_insensitive_ss(String a, String b);
|
||||
FSTRING_LINK fstr_bool match_part_insensitive_ccl(char *a, char *b, int32_t *len);
|
||||
FSTRING_LINK fstr_bool match_part_insensitive_scl(String a, char *b, int32_t *len);
|
||||
FSTRING_INLINE fstr_bool match_part_insensitive_cc(char *a, char *b);
|
||||
FSTRING_INLINE fstr_bool match_part_insensitive_sc(String a, char *b);
|
||||
FSTRING_LINK fstr_bool match_part_insensitive_cs(char *a, String b);
|
||||
FSTRING_LINK fstr_bool match_part_insensitive_ss(String a, String b);
|
||||
FSTRING_LINK int32_t compare_cc(char *a, char *b);
|
||||
FSTRING_LINK int32_t compare_sc(String a, char *b);
|
||||
FSTRING_INLINE int32_t compare_cs(char *a, String b);
|
||||
FSTRING_LINK int32_t compare_ss(String a, String b);
|
||||
FSTRING_LINK int32_t find_c_char(char *str, int32_t start, char character);
|
||||
FSTRING_LINK int32_t find_s_char(String str, int32_t start, char character);
|
||||
FSTRING_LINK int32_t rfind_s_char(String str, int32_t start, char character);
|
||||
FSTRING_LINK int32_t find_c_chars(char *str, int32_t start, char *characters);
|
||||
FSTRING_LINK int32_t find_s_chars(String str, int32_t start, char *characters);
|
||||
FSTRING_LINK int32_t find_substr_c(char *str, int32_t start, String seek);
|
||||
FSTRING_LINK int32_t find_substr_s(String str, int32_t start, String seek);
|
||||
FSTRING_LINK int32_t rfind_substr_s(String str, int32_t start, String seek);
|
||||
FSTRING_LINK int32_t find_substr_insensitive_c(char *str, int32_t start, String seek);
|
||||
FSTRING_LINK int32_t find_substr_insensitive_s(String str, int32_t start, String seek);
|
||||
FSTRING_INLINE fstr_bool has_substr_c(char *s, String seek);
|
||||
FSTRING_INLINE fstr_bool has_substr_s(String s, String seek);
|
||||
FSTRING_INLINE fstr_bool has_substr_insensitive_c(char *s, String seek);
|
||||
FSTRING_INLINE fstr_bool has_substr_insensitive_s(String s, String seek);
|
||||
FSTRING_LINK int32_t copy_fast_unsafe_cc(char *dest, char *src);
|
||||
FSTRING_LINK int32_t copy_fast_unsafe_cs(char *dest, String src);
|
||||
FSTRING_LINK fstr_bool copy_checked_ss(String *dest, String src);
|
||||
FSTRING_LINK fstr_bool copy_partial_sc(String *dest, char *src);
|
||||
FSTRING_LINK fstr_bool copy_partial_ss(String *dest, String src);
|
||||
FSTRING_INLINE int32_t copy_cc(char *dest, char *src);
|
||||
FSTRING_INLINE void copy_ss(String *dest, String src);
|
||||
FSTRING_INLINE void copy_sc(String *dest, char *src);
|
||||
FSTRING_LINK fstr_bool append_checked_ss(String *dest, String src);
|
||||
FSTRING_LINK fstr_bool append_partial_sc(String *dest, char *src);
|
||||
FSTRING_LINK fstr_bool append_partial_ss(String *dest, String src);
|
||||
FSTRING_LINK fstr_bool append_s_char(String *dest, char c);
|
||||
FSTRING_INLINE fstr_bool append_ss(String *dest, String src);
|
||||
FSTRING_INLINE fstr_bool append_sc(String *dest, char *src);
|
||||
FSTRING_LINK fstr_bool terminate_with_null(String *str);
|
||||
FSTRING_LINK fstr_bool append_padding(String *dest, char c, int32_t target_size);
|
||||
FSTRING_LINK void replace_char(String *str, char replace, char with);
|
||||
FSTRING_LINK void to_lower_cc(char *src, char *dst);
|
||||
FSTRING_LINK void to_lower_ss(String *src, String *dst);
|
||||
FSTRING_LINK void to_lower_s(String *str);
|
||||
FSTRING_LINK void to_upper_cc(char *src, char *dst);
|
||||
FSTRING_LINK void to_upper_ss(String *src, String *dst);
|
||||
FSTRING_LINK void to_upper_s(String *str);
|
||||
FSTRING_LINK void to_camel_cc(char *src, char *dst);
|
||||
FSTRING_LINK int32_t int_to_str_size(int32_t x);
|
||||
FSTRING_LINK fstr_bool int_to_str(String *dest, int32_t x);
|
||||
FSTRING_LINK fstr_bool append_int_to_str(String *dest, int32_t x);
|
||||
FSTRING_LINK int32_t u64_to_str_size(uint64_t x);
|
||||
FSTRING_LINK fstr_bool u64_to_str(String *dest, uint64_t x);
|
||||
FSTRING_LINK fstr_bool append_u64_to_str(String *dest, uint64_t x);
|
||||
FSTRING_LINK int32_t float_to_str_size(float x);
|
||||
FSTRING_LINK fstr_bool append_float_to_str(String *dest, float x);
|
||||
FSTRING_LINK fstr_bool float_to_str(String *dest, float x);
|
||||
FSTRING_LINK int32_t str_is_int_c(char *str);
|
||||
FSTRING_LINK fstr_bool str_is_int_s(String str);
|
||||
FSTRING_LINK int32_t str_to_int_c(char *str);
|
||||
FSTRING_LINK int32_t str_to_int_s(String str);
|
||||
FSTRING_LINK int32_t hexchar_to_int(char c);
|
||||
FSTRING_LINK char int_to_hexchar(int32_t x);
|
||||
FSTRING_LINK uint32_t hexstr_to_int(String str);
|
||||
FSTRING_LINK fstr_bool color_to_hexstr(String *s, uint32_t color);
|
||||
FSTRING_LINK fstr_bool hexstr_to_color(String s, uint32_t *out);
|
||||
FSTRING_LINK int32_t reverse_seek_slash_pos(String str, int32_t pos);
|
||||
FSTRING_INLINE int32_t reverse_seek_slash(String str);
|
||||
FSTRING_INLINE String front_of_directory(String dir);
|
||||
FSTRING_INLINE String path_of_directory(String dir);
|
||||
FSTRING_LINK fstr_bool set_last_folder_sc(String *dir, char *folder_name, char slash);
|
||||
FSTRING_LINK fstr_bool set_last_folder_ss(String *dir, String folder_name, char slash);
|
||||
FSTRING_LINK String file_extension(String str);
|
||||
FSTRING_LINK fstr_bool remove_extension(String *str);
|
||||
FSTRING_LINK fstr_bool remove_last_folder(String *str);
|
||||
FSTRING_LINK fstr_bool string_set_match(String *str_set, int32_t count, String str, int32_t *match_index);
|
||||
|
||||
#if !defined(FSTRING_C)
|
||||
|
||||
// NOTE(allen): This section is here to enable nicer names
|
||||
// for C++ users who can have overloaded functions. None of
|
||||
// these functions add new features.
|
||||
FSTRING_INLINE String make_string(void *str, int32_t size, int32_t mem_size);
|
||||
FSTRING_INLINE String substr(String str, int32_t start);
|
||||
FSTRING_INLINE fstr_bool match(char *a, char *b);
|
||||
FSTRING_INLINE fstr_bool match(String a, char *b);
|
||||
FSTRING_INLINE fstr_bool match(char *a, String b);
|
||||
FSTRING_INLINE fstr_bool match(String a, String b);
|
||||
FSTRING_INLINE fstr_bool match_part(char *a, char *b, int32_t *len);
|
||||
FSTRING_INLINE fstr_bool match_part(String a, char *b, int32_t *len);
|
||||
FSTRING_INLINE fstr_bool match_part(char *a, char *b);
|
||||
FSTRING_INLINE fstr_bool match_part(String a, char *b);
|
||||
FSTRING_INLINE fstr_bool match_part(char *a, String b);
|
||||
FSTRING_INLINE fstr_bool match_part(String a, String b);
|
||||
FSTRING_INLINE fstr_bool match_insensitive(char *a, char *b);
|
||||
FSTRING_INLINE fstr_bool match_insensitive(String a, char *b);
|
||||
FSTRING_INLINE fstr_bool match_insensitive(char *a, String b);
|
||||
FSTRING_INLINE fstr_bool match_insensitive(String a, String b);
|
||||
FSTRING_INLINE fstr_bool match_part_insensitive(char *a, char *b, int32_t *len);
|
||||
FSTRING_INLINE fstr_bool match_part_insensitive(String a, char *b, int32_t *len);
|
||||
FSTRING_INLINE fstr_bool match_part_insensitive(char *a, char *b);
|
||||
FSTRING_INLINE fstr_bool match_part_insensitive(String a, char *b);
|
||||
FSTRING_INLINE fstr_bool match_part_insensitive(char *a, String b);
|
||||
FSTRING_INLINE fstr_bool match_part_insensitive(String a, String b);
|
||||
FSTRING_INLINE int32_t compare(char *a, char *b);
|
||||
FSTRING_INLINE int32_t compare(String a, char *b);
|
||||
FSTRING_INLINE int32_t compare(char *a, String b);
|
||||
FSTRING_INLINE int32_t compare(String a, String b);
|
||||
FSTRING_INLINE int32_t find(char *str, int32_t start, char character);
|
||||
FSTRING_INLINE int32_t find(String str, int32_t start, char character);
|
||||
FSTRING_INLINE int32_t rfind(String str, int32_t start, char character);
|
||||
FSTRING_INLINE int32_t find(char *str, int32_t start, char *characters);
|
||||
FSTRING_INLINE int32_t find(String str, int32_t start, char *characters);
|
||||
FSTRING_INLINE int32_t find_substr(char *str, int32_t start, String seek);
|
||||
FSTRING_INLINE int32_t find_substr(String str, int32_t start, String seek);
|
||||
FSTRING_INLINE int32_t rfind_substr(String str, int32_t start, String seek);
|
||||
FSTRING_INLINE int32_t find_substr_insensitive(char *str, int32_t start, String seek);
|
||||
FSTRING_INLINE int32_t find_substr_insensitive(String str, int32_t start, String seek);
|
||||
FSTRING_INLINE fstr_bool has_substr(char *s, String seek);
|
||||
FSTRING_INLINE fstr_bool has_substr(String s, String seek);
|
||||
FSTRING_INLINE fstr_bool has_substr_insensitive(char *s, String seek);
|
||||
FSTRING_INLINE fstr_bool has_substr_insensitive(String s, String seek);
|
||||
FSTRING_INLINE int32_t copy_fast_unsafe(char *dest, char *src);
|
||||
FSTRING_INLINE int32_t copy_fast_unsafe(char *dest, String src);
|
||||
FSTRING_INLINE fstr_bool copy_checked(String *dest, String src);
|
||||
FSTRING_INLINE fstr_bool copy_partial(String *dest, char *src);
|
||||
FSTRING_INLINE fstr_bool copy_partial(String *dest, String src);
|
||||
FSTRING_INLINE int32_t copy(char *dest, char *src);
|
||||
FSTRING_INLINE void copy(String *dest, String src);
|
||||
FSTRING_INLINE void copy(String *dest, char *src);
|
||||
FSTRING_INLINE fstr_bool append_checked(String *dest, String src);
|
||||
FSTRING_INLINE fstr_bool append_partial(String *dest, char *src);
|
||||
FSTRING_INLINE fstr_bool append_partial(String *dest, String src);
|
||||
FSTRING_INLINE fstr_bool append(String *dest, char c);
|
||||
FSTRING_INLINE fstr_bool append(String *dest, String src);
|
||||
FSTRING_INLINE fstr_bool append(String *dest, char *src);
|
||||
FSTRING_INLINE void to_lower(char *src, char *dst);
|
||||
FSTRING_INLINE void to_lower(String *src, String *dst);
|
||||
FSTRING_INLINE void to_lower(String *str);
|
||||
FSTRING_INLINE void to_upper(char *src, char *dst);
|
||||
FSTRING_INLINE void to_upper(String *src, String *dst);
|
||||
FSTRING_INLINE void to_upper(String *str);
|
||||
FSTRING_INLINE void to_camel(char *src, char *dst);
|
||||
FSTRING_INLINE int32_t str_is_int(char *str);
|
||||
FSTRING_INLINE fstr_bool str_is_int(String str);
|
||||
FSTRING_INLINE int32_t str_to_int(char *str);
|
||||
FSTRING_INLINE int32_t str_to_int(String str);
|
||||
FSTRING_INLINE int32_t reverse_seek_slash(String str, int32_t pos);
|
||||
FSTRING_INLINE fstr_bool set_last_folder(String *dir, char *folder_name, char slash);
|
||||
FSTRING_INLINE fstr_bool set_last_folder(String *dir, String folder_name, char slash);
|
||||
|
||||
# define expand_str(s) ((s).str), ((s).size)
|
||||
#endif
|
||||
FSTRING_LINK int32_t str_size(char *str);
|
||||
FSTRING_INLINE String make_string_slowly(void *str);
|
||||
FSTRING_INLINE String substr_tail(String str, int32_t start);
|
||||
FSTRING_INLINE String substr(String str, int32_t start, int32_t size);
|
||||
FSTRING_LINK String skip_whitespace(String str);
|
||||
FSTRING_LINK String chop_whitespace(String str);
|
||||
FSTRING_LINK String skip_chop_whitespace(String str);
|
||||
FSTRING_INLINE String tailstr(String str);
|
||||
FSTRING_LINK fstr_bool match_cc(char *a, char *b);
|
||||
FSTRING_LINK fstr_bool match_sc(String a, char *b);
|
||||
FSTRING_INLINE fstr_bool match_cs(char *a, String b);
|
||||
FSTRING_LINK fstr_bool match_ss(String a, String b);
|
||||
FSTRING_LINK fstr_bool match_part_ccl(char *a, char *b, int32_t *len);
|
||||
FSTRING_LINK fstr_bool match_part_scl(String a, char *b, int32_t *len);
|
||||
FSTRING_INLINE fstr_bool match_part_cc(char *a, char *b);
|
||||
FSTRING_INLINE fstr_bool match_part_sc(String a, char *b);
|
||||
FSTRING_LINK fstr_bool match_part_cs(char *a, String b);
|
||||
FSTRING_LINK fstr_bool match_part_ss(String a, String b);
|
||||
FSTRING_LINK fstr_bool match_insensitive_cc(char *a, char *b);
|
||||
FSTRING_LINK fstr_bool match_insensitive_sc(String a, char *b);
|
||||
FSTRING_INLINE fstr_bool match_insensitive_cs(char *a, String b);
|
||||
FSTRING_LINK fstr_bool match_insensitive_ss(String a, String b);
|
||||
FSTRING_LINK fstr_bool match_part_insensitive_ccl(char *a, char *b, int32_t *len);
|
||||
FSTRING_LINK fstr_bool match_part_insensitive_scl(String a, char *b, int32_t *len);
|
||||
FSTRING_INLINE fstr_bool match_part_insensitive_cc(char *a, char *b);
|
||||
FSTRING_INLINE fstr_bool match_part_insensitive_sc(String a, char *b);
|
||||
FSTRING_LINK fstr_bool match_part_insensitive_cs(char *a, String b);
|
||||
FSTRING_LINK fstr_bool match_part_insensitive_ss(String a, String b);
|
||||
FSTRING_LINK int32_t compare_cc(char *a, char *b);
|
||||
FSTRING_LINK int32_t compare_sc(String a, char *b);
|
||||
FSTRING_INLINE int32_t compare_cs(char *a, String b);
|
||||
FSTRING_LINK int32_t compare_ss(String a, String b);
|
||||
FSTRING_LINK int32_t find_c_char(char *str, int32_t start, char character);
|
||||
FSTRING_LINK int32_t find_s_char(String str, int32_t start, char character);
|
||||
FSTRING_LINK int32_t rfind_s_char(String str, int32_t start, char character);
|
||||
FSTRING_LINK int32_t find_c_chars(char *str, int32_t start, char *characters);
|
||||
FSTRING_LINK int32_t find_s_chars(String str, int32_t start, char *characters);
|
||||
FSTRING_LINK int32_t find_substr_c(char *str, int32_t start, String seek);
|
||||
FSTRING_LINK int32_t find_substr_s(String str, int32_t start, String seek);
|
||||
FSTRING_LINK int32_t rfind_substr_s(String str, int32_t start, String seek);
|
||||
FSTRING_LINK int32_t find_substr_insensitive_c(char *str, int32_t start, String seek);
|
||||
FSTRING_LINK int32_t find_substr_insensitive_s(String str, int32_t start, String seek);
|
||||
FSTRING_INLINE fstr_bool has_substr_c(char *s, String seek);
|
||||
FSTRING_INLINE fstr_bool has_substr_s(String s, String seek);
|
||||
FSTRING_INLINE fstr_bool has_substr_insensitive_c(char *s, String seek);
|
||||
FSTRING_INLINE fstr_bool has_substr_insensitive_s(String s, String seek);
|
||||
FSTRING_LINK int32_t copy_fast_unsafe_cc(char *dest, char *src);
|
||||
FSTRING_LINK int32_t copy_fast_unsafe_cs(char *dest, String src);
|
||||
FSTRING_LINK fstr_bool copy_checked_ss(String *dest, String src);
|
||||
FSTRING_LINK fstr_bool copy_partial_sc(String *dest, char *src);
|
||||
FSTRING_LINK fstr_bool copy_partial_ss(String *dest, String src);
|
||||
FSTRING_INLINE int32_t copy_cc(char *dest, char *src);
|
||||
FSTRING_INLINE void copy_ss(String *dest, String src);
|
||||
FSTRING_INLINE void copy_sc(String *dest, char *src);
|
||||
FSTRING_LINK fstr_bool append_checked_ss(String *dest, String src);
|
||||
FSTRING_LINK fstr_bool append_partial_sc(String *dest, char *src);
|
||||
FSTRING_LINK fstr_bool append_partial_ss(String *dest, String src);
|
||||
FSTRING_LINK fstr_bool append_s_char(String *dest, char c);
|
||||
FSTRING_INLINE fstr_bool append_ss(String *dest, String src);
|
||||
FSTRING_INLINE fstr_bool append_sc(String *dest, char *src);
|
||||
FSTRING_LINK fstr_bool terminate_with_null(String *str);
|
||||
FSTRING_LINK fstr_bool append_padding(String *dest, char c, int32_t target_size);
|
||||
FSTRING_LINK void replace_char(String *str, char replace, char with);
|
||||
FSTRING_LINK void to_lower_cc(char *src, char *dst);
|
||||
FSTRING_LINK void to_lower_ss(String *dst, String src);
|
||||
FSTRING_LINK void to_lower_s(String *str);
|
||||
FSTRING_LINK void to_upper_cc(char *src, char *dst);
|
||||
FSTRING_LINK void to_upper_ss(String *dst, String src);
|
||||
FSTRING_LINK void to_upper_s(String *str);
|
||||
FSTRING_LINK void to_camel_cc(char *src, char *dst);
|
||||
FSTRING_LINK int32_t int_to_str_size(int32_t x);
|
||||
FSTRING_LINK fstr_bool int_to_str(String *dest, int32_t x);
|
||||
FSTRING_LINK fstr_bool append_int_to_str(String *dest, int32_t x);
|
||||
FSTRING_LINK int32_t u64_to_str_size(uint64_t x);
|
||||
FSTRING_LINK fstr_bool u64_to_str(String *dest, uint64_t x);
|
||||
FSTRING_LINK fstr_bool append_u64_to_str(String *dest, uint64_t x);
|
||||
FSTRING_LINK int32_t float_to_str_size(float x);
|
||||
FSTRING_LINK fstr_bool append_float_to_str(String *dest, float x);
|
||||
FSTRING_LINK fstr_bool float_to_str(String *dest, float x);
|
||||
FSTRING_LINK int32_t str_is_int_c(char *str);
|
||||
FSTRING_LINK fstr_bool str_is_int_s(String str);
|
||||
FSTRING_LINK int32_t str_to_int_c(char *str);
|
||||
FSTRING_LINK int32_t str_to_int_s(String str);
|
||||
FSTRING_LINK int32_t hexchar_to_int(char c);
|
||||
FSTRING_LINK char int_to_hexchar(int32_t x);
|
||||
FSTRING_LINK uint32_t hexstr_to_int(String str);
|
||||
FSTRING_LINK fstr_bool color_to_hexstr(String *s, uint32_t color);
|
||||
FSTRING_LINK fstr_bool hexstr_to_color(String s, uint32_t *out);
|
||||
FSTRING_LINK int32_t reverse_seek_slash_pos(String str, int32_t pos);
|
||||
FSTRING_INLINE int32_t reverse_seek_slash(String str);
|
||||
FSTRING_INLINE String front_of_directory(String dir);
|
||||
FSTRING_INLINE String path_of_directory(String dir);
|
||||
FSTRING_LINK fstr_bool set_last_folder_sc(String *dir, char *folder_name, char slash);
|
||||
FSTRING_LINK fstr_bool set_last_folder_ss(String *dir, String folder_name, char slash);
|
||||
FSTRING_LINK String file_extension(String str);
|
||||
FSTRING_LINK fstr_bool remove_extension(String *str);
|
||||
FSTRING_LINK fstr_bool remove_last_folder(String *str);
|
||||
FSTRING_LINK fstr_bool string_set_match_table(void *str_set, int32_t item_size, int32_t count, String str, int32_t *match_index);
|
||||
FSTRING_LINK fstr_bool string_set_match(String *str_set, int32_t count, String str, int32_t *match_index);
|
||||
|
||||
#endif
|
||||
|
||||
#if !defined(FSTRING_C) && !defined(FSTRING_GUARD)
|
||||
|
||||
FSTRING_INLINE String
|
||||
make_string(void *str, int32_t size, int32_t mem_size){return(make_string_cap(str,size,mem_size));}
|
||||
FSTRING_INLINE String
|
||||
substr(String str, int32_t start){return(substr_tail(str,start));}
|
||||
FSTRING_INLINE fstr_bool
|
||||
match(char *a, char *b){return(match_cc(a,b));}
|
||||
FSTRING_INLINE fstr_bool
|
||||
match(String a, char *b){return(match_sc(a,b));}
|
||||
FSTRING_INLINE fstr_bool
|
||||
match(char *a, String b){return(match_cs(a,b));}
|
||||
FSTRING_INLINE fstr_bool
|
||||
match(String a, String b){return(match_ss(a,b));}
|
||||
FSTRING_INLINE fstr_bool
|
||||
match_part(char *a, char *b, int32_t *len){return(match_part_ccl(a,b,len));}
|
||||
FSTRING_INLINE fstr_bool
|
||||
match_part(String a, char *b, int32_t *len){return(match_part_scl(a,b,len));}
|
||||
FSTRING_INLINE fstr_bool
|
||||
match_part(char *a, char *b){return(match_part_cc(a,b));}
|
||||
FSTRING_INLINE fstr_bool
|
||||
match_part(String a, char *b){return(match_part_sc(a,b));}
|
||||
FSTRING_INLINE fstr_bool
|
||||
match_part(char *a, String b){return(match_part_cs(a,b));}
|
||||
FSTRING_INLINE fstr_bool
|
||||
match_part(String a, String b){return(match_part_ss(a,b));}
|
||||
FSTRING_INLINE fstr_bool
|
||||
match_insensitive(char *a, char *b){return(match_insensitive_cc(a,b));}
|
||||
FSTRING_INLINE fstr_bool
|
||||
match_insensitive(String a, char *b){return(match_insensitive_sc(a,b));}
|
||||
FSTRING_INLINE fstr_bool
|
||||
match_insensitive(char *a, String b){return(match_insensitive_cs(a,b));}
|
||||
FSTRING_INLINE fstr_bool
|
||||
match_insensitive(String a, String b){return(match_insensitive_ss(a,b));}
|
||||
FSTRING_INLINE fstr_bool
|
||||
match_part_insensitive(char *a, char *b, int32_t *len){return(match_part_insensitive_ccl(a,b,len));}
|
||||
FSTRING_INLINE fstr_bool
|
||||
match_part_insensitive(String a, char *b, int32_t *len){return(match_part_insensitive_scl(a,b,len));}
|
||||
FSTRING_INLINE fstr_bool
|
||||
match_part_insensitive(char *a, char *b){return(match_part_insensitive_cc(a,b));}
|
||||
FSTRING_INLINE fstr_bool
|
||||
match_part_insensitive(String a, char *b){return(match_part_insensitive_sc(a,b));}
|
||||
FSTRING_INLINE fstr_bool
|
||||
match_part_insensitive(char *a, String b){return(match_part_insensitive_cs(a,b));}
|
||||
FSTRING_INLINE fstr_bool
|
||||
match_part_insensitive(String a, String b){return(match_part_insensitive_ss(a,b));}
|
||||
FSTRING_INLINE int32_t
|
||||
compare(char *a, char *b){return(compare_cc(a,b));}
|
||||
FSTRING_INLINE int32_t
|
||||
compare(String a, char *b){return(compare_sc(a,b));}
|
||||
FSTRING_INLINE int32_t
|
||||
compare(char *a, String b){return(compare_cs(a,b));}
|
||||
FSTRING_INLINE int32_t
|
||||
compare(String a, String b){return(compare_ss(a,b));}
|
||||
FSTRING_INLINE int32_t
|
||||
find(char *str, int32_t start, char character){return(find_c_char(str,start,character));}
|
||||
FSTRING_INLINE int32_t
|
||||
find(String str, int32_t start, char character){return(find_s_char(str,start,character));}
|
||||
FSTRING_INLINE int32_t
|
||||
rfind(String str, int32_t start, char character){return(rfind_s_char(str,start,character));}
|
||||
FSTRING_INLINE int32_t
|
||||
find(char *str, int32_t start, char *characters){return(find_c_chars(str,start,characters));}
|
||||
FSTRING_INLINE int32_t
|
||||
find(String str, int32_t start, char *characters){return(find_s_chars(str,start,characters));}
|
||||
FSTRING_INLINE int32_t
|
||||
find_substr(char *str, int32_t start, String seek){return(find_substr_c(str,start,seek));}
|
||||
FSTRING_INLINE int32_t
|
||||
find_substr(String str, int32_t start, String seek){return(find_substr_s(str,start,seek));}
|
||||
FSTRING_INLINE int32_t
|
||||
rfind_substr(String str, int32_t start, String seek){return(rfind_substr_s(str,start,seek));}
|
||||
FSTRING_INLINE int32_t
|
||||
find_substr_insensitive(char *str, int32_t start, String seek){return(find_substr_insensitive_c(str,start,seek));}
|
||||
FSTRING_INLINE int32_t
|
||||
find_substr_insensitive(String str, int32_t start, String seek){return(find_substr_insensitive_s(str,start,seek));}
|
||||
FSTRING_INLINE fstr_bool
|
||||
has_substr(char *s, String seek){return(has_substr_c(s,seek));}
|
||||
FSTRING_INLINE fstr_bool
|
||||
has_substr(String s, String seek){return(has_substr_s(s,seek));}
|
||||
FSTRING_INLINE fstr_bool
|
||||
has_substr_insensitive(char *s, String seek){return(has_substr_insensitive_c(s,seek));}
|
||||
FSTRING_INLINE fstr_bool
|
||||
has_substr_insensitive(String s, String seek){return(has_substr_insensitive_s(s,seek));}
|
||||
FSTRING_INLINE int32_t
|
||||
copy_fast_unsafe(char *dest, char *src){return(copy_fast_unsafe_cc(dest,src));}
|
||||
FSTRING_INLINE int32_t
|
||||
copy_fast_unsafe(char *dest, String src){return(copy_fast_unsafe_cs(dest,src));}
|
||||
FSTRING_INLINE fstr_bool
|
||||
copy_checked(String *dest, String src){return(copy_checked_ss(dest,src));}
|
||||
FSTRING_INLINE fstr_bool
|
||||
copy_partial(String *dest, char *src){return(copy_partial_sc(dest,src));}
|
||||
FSTRING_INLINE fstr_bool
|
||||
copy_partial(String *dest, String src){return(copy_partial_ss(dest,src));}
|
||||
FSTRING_INLINE int32_t
|
||||
copy(char *dest, char *src){return(copy_cc(dest,src));}
|
||||
FSTRING_INLINE void
|
||||
copy(String *dest, String src){(copy_ss(dest,src));}
|
||||
FSTRING_INLINE void
|
||||
copy(String *dest, char *src){(copy_sc(dest,src));}
|
||||
FSTRING_INLINE fstr_bool
|
||||
append_checked(String *dest, String src){return(append_checked_ss(dest,src));}
|
||||
FSTRING_INLINE fstr_bool
|
||||
append_partial(String *dest, char *src){return(append_partial_sc(dest,src));}
|
||||
FSTRING_INLINE fstr_bool
|
||||
append_partial(String *dest, String src){return(append_partial_ss(dest,src));}
|
||||
FSTRING_INLINE fstr_bool
|
||||
append(String *dest, char c){return(append_s_char(dest,c));}
|
||||
FSTRING_INLINE fstr_bool
|
||||
append(String *dest, String src){return(append_ss(dest,src));}
|
||||
FSTRING_INLINE fstr_bool
|
||||
append(String *dest, char *src){return(append_sc(dest,src));}
|
||||
FSTRING_INLINE void
|
||||
to_lower(char *src, char *dst){(to_lower_cc(src,dst));}
|
||||
FSTRING_INLINE void
|
||||
to_lower(String *src, String *dst){(to_lower_ss(src,dst));}
|
||||
FSTRING_INLINE void
|
||||
to_lower(String *str){(to_lower_s(str));}
|
||||
FSTRING_INLINE void
|
||||
to_upper(char *src, char *dst){(to_upper_cc(src,dst));}
|
||||
FSTRING_INLINE void
|
||||
to_upper(String *src, String *dst){(to_upper_ss(src,dst));}
|
||||
FSTRING_INLINE void
|
||||
to_upper(String *str){(to_upper_s(str));}
|
||||
FSTRING_INLINE void
|
||||
to_camel(char *src, char *dst){(to_camel_cc(src,dst));}
|
||||
FSTRING_INLINE int32_t
|
||||
str_is_int(char *str){return(str_is_int_c(str));}
|
||||
FSTRING_INLINE fstr_bool
|
||||
str_is_int(String str){return(str_is_int_s(str));}
|
||||
FSTRING_INLINE int32_t
|
||||
str_to_int(char *str){return(str_to_int_c(str));}
|
||||
FSTRING_INLINE int32_t
|
||||
str_to_int(String str){return(str_to_int_s(str));}
|
||||
FSTRING_INLINE int32_t
|
||||
reverse_seek_slash(String str, int32_t pos){return(reverse_seek_slash_pos(str,pos));}
|
||||
FSTRING_INLINE fstr_bool
|
||||
set_last_folder(String *dir, char *folder_name, char slash){return(set_last_folder_sc(dir,folder_name,slash));}
|
||||
FSTRING_INLINE fstr_bool
|
||||
set_last_folder(String *dir, String folder_name, char slash){return(set_last_folder_ss(dir,folder_name,slash));}
|
||||
FSTRING_INLINE String make_string(void *str, int32_t size, int32_t mem_size){return(make_string_cap(str,size,mem_size));}
|
||||
FSTRING_INLINE String substr(String str, int32_t start){return(substr_tail(str,start));}
|
||||
FSTRING_INLINE fstr_bool match(char *a, char *b){return(match_cc(a,b));}
|
||||
FSTRING_INLINE fstr_bool match(String a, char *b){return(match_sc(a,b));}
|
||||
FSTRING_INLINE fstr_bool match(char *a, String b){return(match_cs(a,b));}
|
||||
FSTRING_INLINE fstr_bool match(String a, String b){return(match_ss(a,b));}
|
||||
FSTRING_INLINE fstr_bool match_part(char *a, char *b, int32_t *len){return(match_part_ccl(a,b,len));}
|
||||
FSTRING_INLINE fstr_bool match_part(String a, char *b, int32_t *len){return(match_part_scl(a,b,len));}
|
||||
FSTRING_INLINE fstr_bool match_part(char *a, char *b){return(match_part_cc(a,b));}
|
||||
FSTRING_INLINE fstr_bool match_part(String a, char *b){return(match_part_sc(a,b));}
|
||||
FSTRING_INLINE fstr_bool match_part(char *a, String b){return(match_part_cs(a,b));}
|
||||
FSTRING_INLINE fstr_bool match_part(String a, String b){return(match_part_ss(a,b));}
|
||||
FSTRING_INLINE fstr_bool match_insensitive(char *a, char *b){return(match_insensitive_cc(a,b));}
|
||||
FSTRING_INLINE fstr_bool match_insensitive(String a, char *b){return(match_insensitive_sc(a,b));}
|
||||
FSTRING_INLINE fstr_bool match_insensitive(char *a, String b){return(match_insensitive_cs(a,b));}
|
||||
FSTRING_INLINE fstr_bool match_insensitive(String a, String b){return(match_insensitive_ss(a,b));}
|
||||
FSTRING_INLINE fstr_bool match_part_insensitive(char *a, char *b, int32_t *len){return(match_part_insensitive_ccl(a,b,len));}
|
||||
FSTRING_INLINE fstr_bool match_part_insensitive(String a, char *b, int32_t *len){return(match_part_insensitive_scl(a,b,len));}
|
||||
FSTRING_INLINE fstr_bool match_part_insensitive(char *a, char *b){return(match_part_insensitive_cc(a,b));}
|
||||
FSTRING_INLINE fstr_bool match_part_insensitive(String a, char *b){return(match_part_insensitive_sc(a,b));}
|
||||
FSTRING_INLINE fstr_bool match_part_insensitive(char *a, String b){return(match_part_insensitive_cs(a,b));}
|
||||
FSTRING_INLINE fstr_bool match_part_insensitive(String a, String b){return(match_part_insensitive_ss(a,b));}
|
||||
FSTRING_INLINE int32_t compare(char *a, char *b){return(compare_cc(a,b));}
|
||||
FSTRING_INLINE int32_t compare(String a, char *b){return(compare_sc(a,b));}
|
||||
FSTRING_INLINE int32_t compare(char *a, String b){return(compare_cs(a,b));}
|
||||
FSTRING_INLINE int32_t compare(String a, String b){return(compare_ss(a,b));}
|
||||
FSTRING_INLINE int32_t find(char *str, int32_t start, char character){return(find_c_char(str,start,character));}
|
||||
FSTRING_INLINE int32_t find(String str, int32_t start, char character){return(find_s_char(str,start,character));}
|
||||
FSTRING_INLINE int32_t rfind(String str, int32_t start, char character){return(rfind_s_char(str,start,character));}
|
||||
FSTRING_INLINE int32_t find(char *str, int32_t start, char *characters){return(find_c_chars(str,start,characters));}
|
||||
FSTRING_INLINE int32_t find(String str, int32_t start, char *characters){return(find_s_chars(str,start,characters));}
|
||||
FSTRING_INLINE int32_t find_substr(char *str, int32_t start, String seek){return(find_substr_c(str,start,seek));}
|
||||
FSTRING_INLINE int32_t find_substr(String str, int32_t start, String seek){return(find_substr_s(str,start,seek));}
|
||||
FSTRING_INLINE int32_t rfind_substr(String str, int32_t start, String seek){return(rfind_substr_s(str,start,seek));}
|
||||
FSTRING_INLINE int32_t find_substr_insensitive(char *str, int32_t start, String seek){return(find_substr_insensitive_c(str,start,seek));}
|
||||
FSTRING_INLINE int32_t find_substr_insensitive(String str, int32_t start, String seek){return(find_substr_insensitive_s(str,start,seek));}
|
||||
FSTRING_INLINE fstr_bool has_substr(char *s, String seek){return(has_substr_c(s,seek));}
|
||||
FSTRING_INLINE fstr_bool has_substr(String s, String seek){return(has_substr_s(s,seek));}
|
||||
FSTRING_INLINE fstr_bool has_substr_insensitive(char *s, String seek){return(has_substr_insensitive_c(s,seek));}
|
||||
FSTRING_INLINE fstr_bool has_substr_insensitive(String s, String seek){return(has_substr_insensitive_s(s,seek));}
|
||||
FSTRING_INLINE int32_t copy_fast_unsafe(char *dest, char *src){return(copy_fast_unsafe_cc(dest,src));}
|
||||
FSTRING_INLINE int32_t copy_fast_unsafe(char *dest, String src){return(copy_fast_unsafe_cs(dest,src));}
|
||||
FSTRING_INLINE fstr_bool copy_checked(String *dest, String src){return(copy_checked_ss(dest,src));}
|
||||
FSTRING_INLINE fstr_bool copy_partial(String *dest, char *src){return(copy_partial_sc(dest,src));}
|
||||
FSTRING_INLINE fstr_bool copy_partial(String *dest, String src){return(copy_partial_ss(dest,src));}
|
||||
FSTRING_INLINE int32_t copy(char *dest, char *src){return(copy_cc(dest,src));}
|
||||
FSTRING_INLINE void copy(String *dest, String src){(copy_ss(dest,src));}
|
||||
FSTRING_INLINE void copy(String *dest, char *src){(copy_sc(dest,src));}
|
||||
FSTRING_INLINE fstr_bool append_checked(String *dest, String src){return(append_checked_ss(dest,src));}
|
||||
FSTRING_INLINE fstr_bool append_partial(String *dest, char *src){return(append_partial_sc(dest,src));}
|
||||
FSTRING_INLINE fstr_bool append_partial(String *dest, String src){return(append_partial_ss(dest,src));}
|
||||
FSTRING_INLINE fstr_bool append(String *dest, char c){return(append_s_char(dest,c));}
|
||||
FSTRING_INLINE fstr_bool append(String *dest, String src){return(append_ss(dest,src));}
|
||||
FSTRING_INLINE fstr_bool append(String *dest, char *src){return(append_sc(dest,src));}
|
||||
FSTRING_INLINE void to_lower(char *src, char *dst){(to_lower_cc(src,dst));}
|
||||
FSTRING_INLINE void to_lower(String *dst, String src){(to_lower_ss(dst,src));}
|
||||
FSTRING_INLINE void to_lower(String *str){(to_lower_s(str));}
|
||||
FSTRING_INLINE void to_upper(char *src, char *dst){(to_upper_cc(src,dst));}
|
||||
FSTRING_INLINE void to_upper(String *dst, String src){(to_upper_ss(dst,src));}
|
||||
FSTRING_INLINE void to_upper(String *str){(to_upper_s(str));}
|
||||
FSTRING_INLINE void to_camel(char *src, char *dst){(to_camel_cc(src,dst));}
|
||||
FSTRING_INLINE int32_t str_is_int(char *str){return(str_is_int_c(str));}
|
||||
FSTRING_INLINE fstr_bool str_is_int(String str){return(str_is_int_s(str));}
|
||||
FSTRING_INLINE int32_t str_to_int(char *str){return(str_to_int_c(str));}
|
||||
FSTRING_INLINE int32_t str_to_int(String str){return(str_to_int_s(str));}
|
||||
FSTRING_INLINE int32_t reverse_seek_slash(String str, int32_t pos){return(reverse_seek_slash_pos(str,pos));}
|
||||
FSTRING_INLINE fstr_bool set_last_folder(String *dir, char *folder_name, char slash){return(set_last_folder_sc(dir,folder_name,slash));}
|
||||
FSTRING_INLINE fstr_bool set_last_folder(String *dir, String folder_name, char slash){return(set_last_folder_ss(dir,folder_name,slash));}
|
||||
FSTRING_INLINE fstr_bool string_set_match(void *str_set, int32_t item_size, int32_t count, String str, int32_t *match_index){return(string_set_match_table(str_set,item_size,count,str,match_index));}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
#if !defined(FSTRING_GUARD)
|
||||
static String null_string = {0};
|
||||
#endif
|
||||
|
||||
//
|
||||
// Character Helpers
|
||||
//
|
||||
|
@ -460,7 +321,7 @@ char_is_alpha_true(char c)
|
|||
FSTRING_INLINE fstr_bool
|
||||
char_is_hex(char c)
|
||||
{
|
||||
return c >= '0' && c <= '9' || c >= 'A' && c <= 'F' || c >= 'a' && c <= 'f';
|
||||
return (c >= '0' && c <= '9' || c >= 'A' && c <= 'F' || c >= 'a' && c <= 'f');
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -477,25 +338,15 @@ char_is_numeric(char c)
|
|||
// String Making Functions
|
||||
//
|
||||
|
||||
#if !defined(FSTRING_GUARD)
|
||||
FSTRING_INLINE String
|
||||
string_zero(void)
|
||||
{
|
||||
String str={0};
|
||||
return(str);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#if !defined(FSTRING_GUARD)
|
||||
FSTRING_INLINE String
|
||||
make_string_cap(void *str, int32_t size, int32_t mem_size)
|
||||
{
|
||||
make_string_cap(void *str, int32_t size, int32_t mem_size){
|
||||
String result;
|
||||
result.str = (char*)str;
|
||||
result.size = size;
|
||||
result.memory_size = mem_size;
|
||||
return result;
|
||||
return(result);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -506,7 +357,7 @@ make_string(void *str, int32_t size){
|
|||
result.str = (char*)str;
|
||||
result.size = size;
|
||||
result.memory_size = size;
|
||||
return result;
|
||||
return(result);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -516,7 +367,7 @@ str_size(char *str)
|
|||
{
|
||||
int32_t i = 0;
|
||||
while (str[i]) ++i;
|
||||
return i;
|
||||
return(i);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -528,7 +379,7 @@ make_string_slowly(void *str)
|
|||
result.str = (char*)str;
|
||||
result.size = str_size((char*)str);
|
||||
result.memory_size = result.size;
|
||||
return result;
|
||||
return(result);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -1439,16 +1290,17 @@ to_lower_cc(char *src, char *dst){
|
|||
|
||||
#if defined(FSTRING_IMPLEMENTATION)
|
||||
FSTRING_LINK void
|
||||
to_lower_ss(String *src, String *dst){
|
||||
to_lower_ss(String *dst, String src){
|
||||
int32_t i = 0;
|
||||
int32_t size = src->size;
|
||||
char *c = src->str;
|
||||
int32_t size = src.size;
|
||||
char *c = src.str;
|
||||
char *d = dst->str;
|
||||
|
||||
if (dst->memory_size >= size){
|
||||
for (; i < size; ++i){
|
||||
*d++ = char_to_lower(*c++);
|
||||
}
|
||||
dst->size = size;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
@ -1480,16 +1332,17 @@ to_upper_cc(char *src, char *dst){
|
|||
|
||||
#if defined(FSTRING_IMPLEMENTATION)
|
||||
FSTRING_LINK void
|
||||
to_upper_ss(String *src, String *dst){
|
||||
to_upper_ss(String *dst, String src){
|
||||
int32_t i = 0;
|
||||
int32_t size = src->size;
|
||||
char *c = src->str;
|
||||
int32_t size = src.size;
|
||||
char *c = src.str;
|
||||
char *d = dst->str;
|
||||
|
||||
if (dst->memory_size >= size){
|
||||
for (; i < size; ++i){
|
||||
*d++ = char_to_upper(*c++);
|
||||
}
|
||||
dst->size = size;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
@ -2022,13 +1875,15 @@ remove_last_folder(String *str){
|
|||
#endif
|
||||
|
||||
// TODO(allen): Add hash-table extension to string sets.
|
||||
|
||||
#if defined(FSTRING_IMPLEMENTATION)
|
||||
FSTRING_LINK fstr_bool
|
||||
string_set_match(String *str_set, int32_t count, String str, int32_t *match_index){
|
||||
string_set_match_table(void *str_set, int32_t item_size, int32_t count, String str, int32_t *match_index){
|
||||
fstr_bool result = 0;
|
||||
int32_t i = 0;
|
||||
for (; i < count; ++i, ++str_set){
|
||||
if (match_ss(*str_set, str)){
|
||||
uint8_t *ptr = (uint8_t*)str_set;
|
||||
for (; i < count; ++i, ptr += item_size){
|
||||
if (match_ss(*(String*)ptr, str)){
|
||||
*match_index = i;
|
||||
result = 1;
|
||||
break;
|
||||
|
@ -2038,6 +1893,15 @@ string_set_match(String *str_set, int32_t count, String str, int32_t *match_inde
|
|||
}
|
||||
#endif
|
||||
|
||||
#if defined(FSTRING_IMPLEMENTATION)
|
||||
FSTRING_LINK fstr_bool
|
||||
string_set_match(String *str_set, int32_t count, String str, int32_t *match_index){
|
||||
fstr_bool result = string_set_match_table(str_set, sizeof(String), count, str, match_index);
|
||||
return(result);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#ifndef FSTRING_EXPERIMENTAL
|
||||
#define FSTRING_EXPERIMENTAL
|
||||
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
|
||||
|
||||
#ifndef ENUM
|
||||
#define ENUM(type,name) typedef type name; enum name##_
|
||||
#define FLAGENUM(name) typedef uint32_t name; enum name##_
|
||||
#endif
|
||||
|
||||
/* DOC(bool32 is an alias name to signal that an integer parameter or field is for
|
||||
true/false vales.) */
|
||||
|
@ -37,7 +38,7 @@ ENUM(int32_t, Key_Modifier){
|
|||
|
||||
/* DOC(A Key_Modifier_Flag field is used to specify a specific state of modifiers.
|
||||
Flags can be combined with bit or to specify a state with multiple modifiers.) */
|
||||
FLAGENUM(Key_Modifier_Flag){
|
||||
ENUM(uint32_t, Key_Modifier_Flag){
|
||||
/* DOC(MDFR_NONE specifies that no modifiers are pressed.) */
|
||||
MDFR_NONE = 0x0,
|
||||
MDFR_CTRL = 0x1,
|
||||
|
@ -91,7 +92,7 @@ ENUM(uint64_t, Command_ID){
|
|||
};
|
||||
|
||||
/* DOC(TODO) */
|
||||
FLAGENUM(Memory_Protect_Flags){
|
||||
ENUM(uint32_t, Memory_Protect_Flags){
|
||||
/* DOC(TODO) */
|
||||
MemProtect_Read = 0x1,
|
||||
/* DOC(TODO) */
|
||||
|
@ -183,7 +184,7 @@ ENUM(int32_t, View_Setting_ID){
|
|||
};
|
||||
|
||||
/* DOC(A Buffer_Create_Flag field specifies how a buffer should be created.) */
|
||||
FLAGENUM(Buffer_Create_Flag){
|
||||
ENUM(uint32_t, Buffer_Create_Flag){
|
||||
/* DOC(BufferCreate_Background is not currently implemented.) */
|
||||
BufferCreate_Background = 0x1,
|
||||
/* DOC(When BufferCreate_AlwaysNew is set it indicates the buffer should be
|
||||
|
@ -195,7 +196,7 @@ FLAGENUM(Buffer_Create_Flag){
|
|||
};
|
||||
|
||||
/* DOC(A Buffer_Kill_Flag field specifies how a buffer should be killed.) */
|
||||
FLAGENUM(Buffer_Kill_Flag){
|
||||
ENUM(uint32_t, Buffer_Kill_Flag){
|
||||
/* DOC(BufferKill_Background is not currently implemented.) */
|
||||
BufferKill_Background = 0x1,
|
||||
/* DOC(When BufferKill_AlwaysKill is set it indicates the buffer should be killed
|
||||
|
@ -209,7 +210,7 @@ access call. An access call is usually one the returns a summary struct. If a
|
|||
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.) TODO */
|
||||
FLAGENUM(Access_Flag){
|
||||
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.) */
|
||||
AccessOpen = 0x0,
|
||||
|
@ -227,7 +228,7 @@ FLAGENUM(Access_Flag){
|
|||
|
||||
/* 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.) */
|
||||
FLAGENUM(Seek_Boundary_Flag){
|
||||
ENUM(uint32_t, Seek_Boundary_Flag){
|
||||
BoundaryWhitespace = 0x1,
|
||||
BoundaryToken = 0x2,
|
||||
BoundaryAlphanumeric = 0x4,
|
||||
|
@ -235,7 +236,7 @@ FLAGENUM(Seek_Boundary_Flag){
|
|||
};
|
||||
|
||||
/* DOC(A Command_Line_Input_Flag field specifies the behavior of a call to a command line interface.) */
|
||||
FLAGENUM(Command_Line_Input_Flag){
|
||||
ENUM(uint32_t, Command_Line_Input_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
|
||||
|
@ -250,7 +251,7 @@ FLAGENUM(Command_Line_Input_Flag){
|
|||
};
|
||||
|
||||
/* DOC(An Auto_Indent_Flag field specifies the behavior of an auto indentation operation.) */
|
||||
FLAGENUM(Auto_Indent_Flag){
|
||||
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.) */
|
||||
|
@ -262,7 +263,7 @@ FLAGENUM(Auto_Indent_Flag){
|
|||
};
|
||||
|
||||
/* DOC(A Set_Buffer_Flag field specifies the behavior of an operation that sets the buffer of a view.) */
|
||||
FLAGENUM(Set_Buffer_Flag){
|
||||
ENUM(uint32_t, Set_Buffer_Flag){
|
||||
/* DOC(If SetBuffer_KeepOriginalGUI then when the file is set, the view will not switch to it
|
||||
if some other GUI was currently up, otherwise any GUI that is up is closed and the view
|
||||
switches to the file.) */
|
||||
|
@ -270,7 +271,7 @@ FLAGENUM(Set_Buffer_Flag){
|
|||
};
|
||||
|
||||
/* DOC(A Input_Type_Flag field specifies a set of input event types.) */
|
||||
FLAGENUM(Input_Type_Flag){
|
||||
ENUM(uint32_t, Input_Type_Flag){
|
||||
/* DOC(If EventOnAnyKey is set, all keyboard events are included in the set.) */
|
||||
EventOnAnyKey = 0x1,
|
||||
/* DOC(If EventOnEsc is set, any press of the escape key is included in the set.) */
|
||||
|
@ -614,8 +615,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)
|
||||
*/
|
||||
DOC_SEE(Full_Cursor) */
|
||||
struct View_Summary{
|
||||
/* DOC(
|
||||
This field indicates whether the View_Summary describes a view that is open in 4coder.
|
||||
|
@ -627,7 +627,7 @@ struct View_Summary{
|
|||
If this is a null summary then view_id is 0.
|
||||
) */
|
||||
int32_t view_id;
|
||||
/* DOC(If this is not a null summary, and this view looks at a buffer, this is the id of the buffer.) */
|
||||
/* DOC(If this is not a null summary, then this is the id of the buffer this view currently sees.) */
|
||||
int32_t buffer_id;
|
||||
/*
|
||||
DOC(If this is not a null summary, this field contains flags describing the protection status of the view.)
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
# define FCPP_LINK static
|
||||
#endif
|
||||
|
||||
#include "4cpp_lexer_types.h"
|
||||
#include "4coder_lexer_types.h"
|
||||
#include "4cpp_lexer_fsms.h"
|
||||
#include "4cpp_lexer_tables.c"
|
||||
|
||||
|
|
|
@ -1225,7 +1225,7 @@ file_kill_tokens(System_Functions *system,
|
|||
general_memory_free(general, file->state.token_stack.tokens);
|
||||
}
|
||||
file->state.tokens_complete = 0;
|
||||
file->state.token_stack = cpp_token_stack_zero();
|
||||
file->state.token_stack = null_cpp_token_stack;
|
||||
}
|
||||
|
||||
#if BUFFER_EXPERIMENT_SCALPEL <= 0
|
||||
|
@ -3153,7 +3153,7 @@ internal void
|
|||
init_read_only_file(System_Functions *system, Models *models, Editing_File *file){
|
||||
General_Memory *general = &models->mem.general;
|
||||
|
||||
String val = string_zero();
|
||||
String val = null_string;
|
||||
file_create_from_string(system, models, file, val, 1);
|
||||
|
||||
if (file->settings.tokens_exist && file->state.token_stack.tokens == 0){
|
||||
|
@ -3671,7 +3671,7 @@ get_exhaustive_info(System_Functions *system, Working_Set *working_set, Exhausti
|
|||
result.name_match = (filename_match(loop->front_name, &loop->absolutes, filename, 0) != 0);
|
||||
result.is_loaded = (file != 0 && file_is_ready(file));
|
||||
|
||||
result.message = string_zero();
|
||||
result.message = null_string;
|
||||
if (result.is_loaded){
|
||||
switch (file_get_sync(file)){
|
||||
case SYNC_GOOD: result.message = message_loaded; break;
|
||||
|
@ -3869,7 +3869,7 @@ show_gui_line(GUI_Target *target, String *string,
|
|||
append_s_char(string, ' ');
|
||||
append_sc(string, follow_up);
|
||||
}
|
||||
gui_do_text_field(target, *string, string_zero());
|
||||
gui_do_text_field(target, *string, null_string);
|
||||
}
|
||||
|
||||
internal void
|
||||
|
@ -3880,7 +3880,7 @@ show_gui_int(GUI_Target *target, String *string,
|
|||
append_padding(string, '-', h_align);
|
||||
append_s_char(string, ' ');
|
||||
append_int_to_str(string, x);
|
||||
gui_do_text_field(target, *string, string_zero());
|
||||
gui_do_text_field(target, *string, null_string);
|
||||
}
|
||||
|
||||
internal void
|
||||
|
@ -3891,7 +3891,7 @@ show_gui_u64(GUI_Target *target, String *string,
|
|||
append_padding(string, '-', h_align);
|
||||
append_s_char(string, ' ');
|
||||
append_u64_to_str(string, x);
|
||||
gui_do_text_field(target, *string, string_zero());
|
||||
gui_do_text_field(target, *string, null_string);
|
||||
}
|
||||
|
||||
internal void
|
||||
|
@ -3904,7 +3904,7 @@ show_gui_int_int(GUI_Target *target, String *string,
|
|||
append_int_to_str(string, x);
|
||||
append_s_char(string, '/');
|
||||
append_int_to_str(string, m);
|
||||
gui_do_text_field(target, *string, string_zero());
|
||||
gui_do_text_field(target, *string, null_string);
|
||||
}
|
||||
|
||||
internal void
|
||||
|
@ -3918,7 +3918,7 @@ show_gui_id(GUI_Target *target, String *string,
|
|||
append_padding(string, ' ', h_align + 26);
|
||||
append_ss(string, make_lit_string(" [1]: "));
|
||||
append_u64_to_str(string, id.id[1]);
|
||||
gui_do_text_field(target, *string, string_zero());
|
||||
gui_do_text_field(target, *string, null_string);
|
||||
}
|
||||
|
||||
internal void
|
||||
|
@ -3929,7 +3929,7 @@ show_gui_float(GUI_Target *target, String *string,
|
|||
append_padding(string, '-', h_align);
|
||||
append_s_char(string, ' ');
|
||||
append_float_to_str(string, x);
|
||||
gui_do_text_field(target, *string, string_zero());
|
||||
gui_do_text_field(target, *string, null_string);
|
||||
}
|
||||
|
||||
internal void
|
||||
|
@ -3985,7 +3985,7 @@ gui_show_mouse(GUI_Target *target, String *string, i32 mx, i32 my){
|
|||
append_int_to_str(string, my);
|
||||
append_s_char(string, ')');
|
||||
|
||||
gui_do_text_field(target, *string, string_zero());
|
||||
gui_do_text_field(target, *string, null_string);
|
||||
}
|
||||
|
||||
internal View_Step_Result
|
||||
|
@ -4491,7 +4491,7 @@ step_file_view(System_Functions *system, View *view, View *active_view, Input_Su
|
|||
reserved_files[reserved_top++] = file;
|
||||
}
|
||||
else{
|
||||
message = string_zero();
|
||||
message = null_string;
|
||||
if (!file->settings.unimportant){
|
||||
switch (file_get_sync(file)){
|
||||
case SYNC_BEHIND_OS: message = message_unsynced; break;
|
||||
|
@ -4512,7 +4512,7 @@ step_file_view(System_Functions *system, View *view, View *active_view, Input_Su
|
|||
for (i = 0; i < reserved_top; ++i){
|
||||
Editing_File *file = reserved_files[i];
|
||||
|
||||
message = string_zero();
|
||||
message = null_string;
|
||||
if (!file->settings.unimportant){
|
||||
switch (file_get_sync(file)){
|
||||
case SYNC_BEHIND_OS: message = message_unsynced; break;
|
||||
|
@ -4623,7 +4623,7 @@ step_file_view(System_Functions *system, View *view, View *active_view, Input_Su
|
|||
// - Command maps inspection
|
||||
// - Clipboard inspection
|
||||
|
||||
String empty_str = string_zero();
|
||||
String empty_str = null_string;
|
||||
|
||||
char space1[512];
|
||||
String string = make_fixed_width_string(space1);
|
||||
|
|
3084
4ed_metagen.cpp
3084
4ed_metagen.cpp
File diff suppressed because it is too large
Load Diff
1
TODO.txt
1
TODO.txt
|
@ -96,6 +96,7 @@
|
|||
; [] hook on exit
|
||||
; [] read only files
|
||||
; [] occasionally missing the (!) mark on files on windows
|
||||
; [] don't execute frames on events dealing only with ctrl/alt/shift
|
||||
;
|
||||
|
||||
; TODOS
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
#define Assert(n) do{ if (!(n)) { *(int*)0 = 0xA11E; } }while(0)
|
||||
#define ArrayCount(a) (sizeof(a)/sizeof(*a))
|
||||
|
||||
#include "4cpp_lexer_types.h"
|
||||
#include "4coder_lexer_types.h"
|
||||
#include "4cpp_lexer_fsms.h"
|
||||
#include "4ed_mem_ansi.c"
|
||||
|
||||
|
|
|
@ -53,6 +53,10 @@ typedef struct Offset_String{
|
|||
|
||||
FSTRING_DECLS
|
||||
|
||||
#if !defined(FSTRING_GUARD)
|
||||
static String null_string = {0};
|
||||
#endif
|
||||
|
||||
//
|
||||
// Character Helpers
|
||||
//
|
||||
|
@ -108,7 +112,7 @@ char_is_alpha_true(char c)
|
|||
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';
|
||||
return (c >= '0' && c <= '9' || c >= 'A' && c <= 'F' || c >= 'a' && c <= 'f');
|
||||
}
|
||||
|
||||
FSTRING_INLINE fstr_bool
|
||||
|
@ -122,17 +126,9 @@ char_is_numeric(char c)
|
|||
// String Making Functions
|
||||
//
|
||||
|
||||
FSTRING_INLINE String
|
||||
string_zero(void)
|
||||
/* DOC(This call returns a String struct of zeroed members.) */{
|
||||
String str={0};
|
||||
return(str);
|
||||
}
|
||||
|
||||
CPP_NAME(make_string)
|
||||
FSTRING_INLINE String
|
||||
make_string_cap(void *str, int32_t size, int32_t mem_size)
|
||||
/*
|
||||
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.
|
||||
If the memory does not already contain a useful string this should be zero.)
|
||||
|
@ -143,7 +139,7 @@ DOC(This call returns the String created from the parameters.)
|
|||
result.str = (char*)str;
|
||||
result.size = size;
|
||||
result.memory_size = mem_size;
|
||||
return result;
|
||||
return(result);
|
||||
}
|
||||
|
||||
FSTRING_INLINE String
|
||||
|
@ -159,7 +155,7 @@ DOC(This call returns the String created from the parameters.)
|
|||
result.str = (char*)str;
|
||||
result.size = size;
|
||||
result.memory_size = size;
|
||||
return result;
|
||||
return(result);
|
||||
}
|
||||
|
||||
DOC_EXPORT /* DOC(This macro takes a literal string in quotes and uses it to create a String
|
||||
|
@ -179,7 +175,7 @@ str_size(char *str)
|
|||
/* DOC(This call returns the number of bytes before a null terminator starting at str.) */{
|
||||
int32_t i = 0;
|
||||
while (str[i]) ++i;
|
||||
return i;
|
||||
return(i);
|
||||
}
|
||||
|
||||
FSTRING_INLINE String
|
||||
|
@ -190,7 +186,7 @@ treating that as the size and memory size of the string.) */{
|
|||
result.str = (char*)str;
|
||||
result.size = str_size((char*)str);
|
||||
result.memory_size = result.size;
|
||||
return result;
|
||||
return(result);
|
||||
}
|
||||
|
||||
CPP_NAME(substr)
|
||||
|
@ -1141,22 +1137,23 @@ string in place.)
|
|||
|
||||
CPP_NAME(to_lower)
|
||||
FSTRING_LINK void
|
||||
to_lower_ss(String *src, String *dst)/*
|
||||
DOC_PARAM(src, The source string to conver to lowercase.)
|
||||
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.)
|
||||
DOC_PARAM(src, The source string to conver to lowercase.)
|
||||
DOC(Rewrites the string in src into dst. src and dst should not overlap with the exception
|
||||
that src and dst may be exactly equal in order to convert the string in place.)
|
||||
*/{
|
||||
int32_t i = 0;
|
||||
int32_t size = src->size;
|
||||
char *c = src->str;
|
||||
int32_t size = src.size;
|
||||
char *c = src.str;
|
||||
char *d = dst->str;
|
||||
|
||||
if (dst->memory_size >= size){
|
||||
for (; i < size; ++i){
|
||||
*d++ = char_to_lower(*c++);
|
||||
}
|
||||
dst->size = size;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1191,22 +1188,23 @@ that src and dst may be exactly equal in order to convert the string in place.)
|
|||
|
||||
CPP_NAME(to_upper)
|
||||
FSTRING_LINK void
|
||||
to_upper_ss(String *src, String *dst)/*
|
||||
DOC_PARAM(src, The source string to convert to uppercase.)
|
||||
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.)
|
||||
DOC_PARAM(src, The source string to convert to uppercase.)
|
||||
DOC(Rewrites the string in src into dst. src and dst should not overlap with the exception
|
||||
that src and dst may be exactly equal in order to convert the string in place.)
|
||||
*/{
|
||||
int32_t i = 0;
|
||||
int32_t size = src->size;
|
||||
char *c = src->str;
|
||||
int32_t size = src.size;
|
||||
char *c = src.str;
|
||||
char *d = dst->str;
|
||||
|
||||
if (dst->memory_size >= size){
|
||||
for (; i < size; ++i){
|
||||
*d++ = char_to_upper(*c++);
|
||||
}
|
||||
dst->size = size;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1743,8 +1741,9 @@ 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
|
||||
string_set_match(String *str_set, int32_t count, String str, int32_t *match_index)/*
|
||||
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 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.)
|
||||
DOC_PARAM(str, The str parameter specifies the string to match against the str_set.)
|
||||
|
@ -1754,8 +1753,9 @@ succeeds and returns non-zero. The matching rule is equivalent to the matching
|
|||
DOC_SEE(match) */{
|
||||
fstr_bool result = 0;
|
||||
int32_t i = 0;
|
||||
for (; i < count; ++i, ++str_set){
|
||||
if (match_ss(*str_set, str)){
|
||||
uint8_t *ptr = (uint8_t*)str_set;
|
||||
for (; i < count; ++i, ptr += item_size){
|
||||
if (match_ss(*(String*)ptr, str)){
|
||||
*match_index = i;
|
||||
result = 1;
|
||||
break;
|
||||
|
@ -1764,6 +1764,20 @@ DOC_SEE(match) */{
|
|||
return(result);
|
||||
}
|
||||
|
||||
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.)
|
||||
DOC_PARAM(str, The str parameter specifies the string to match against the str_set.)
|
||||
DOC_PARAM(match_index, If this call succeeds match_index is filled with the index into str_set where the match occurred.)
|
||||
DOC(This call tries to see if str matches any of the strings in str_set. If there is a match the call
|
||||
succeeds and returns non-zero. The matching rule is equivalent to the matching rule for match.)
|
||||
DOC_SEE(match) */{
|
||||
fstr_bool result = string_set_match_table(str_set, sizeof(String), count, str, match_index);
|
||||
return(result);
|
||||
}
|
||||
|
||||
|
||||
#ifndef FSTRING_EXPERIMENTAL
|
||||
#define FSTRING_EXPERIMENTAL
|
||||
|
||||
|
|
|
@ -259,7 +259,7 @@ CUSTOM_COMMAND_SIG(mark_matching_brace){
|
|||
|
||||
finished:
|
||||
if (found_result){
|
||||
app->view_set_mark(app, &view, seek_pos(result));
|
||||
app->view_set_mark(app, &view, seek_pos(result+1));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -2382,7 +2382,7 @@ WinMain(HINSTANCE hInstance,
|
|||
|
||||
input_chunk.pers.control_keys[MDFR_CAPS_INDEX] = GetKeyState(VK_CAPITAL) & 0x1;
|
||||
|
||||
win32vars.clipboard_contents = string_zero();
|
||||
win32vars.clipboard_contents = null_string;
|
||||
if (win32vars.clipboard_sequence != 0){
|
||||
DWORD new_number = GetClipboardSequenceNumber();
|
||||
if (new_number != win32vars.clipboard_sequence){
|
||||
|
|
Loading…
Reference in New Issue