diff --git a/4coder_API.html b/4coder_API.html index 3d247783..e25f2cd5 100644 --- a/4coder_API.html +++ b/4coder_API.html @@ -2,7 +2,7 @@

4coder API

Table of Contents

§1 Introduction

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

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

§2 4coder Systems

Coming Soon
-

§3 Types and Functions

§3.1 Function List

§3.2 Type List

§3.3 Function Descriptions

§3.3.1: exec_command

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

§3 Types and Functions

§3.1 Function List

§3.2 Type List

§3.3 Function Descriptions

§3.3.1: exec_command

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

§3.3.2: exec_system_command

bool32 app->exec_system_command(
Application_Links *app,
View_Summary *view,
Buffer_Identifier buffer,
char *path,
int32_t path_len,
char *command,
int32_t command_len,
Command_Line_Input_Flag flags
)
Parameters
view
If the view parameter is non-null it specifies a view to display the command's output buffer.
buffer
The buffer the command will output to is specified by the buffer parameter. See Buffer_Identifier for information on how this type specifies a buffer.
path
The path parameter specifies the path in which the command shall be executed. The string need not be null terminated.
path_len
The parameter path_len specifies the length of the path string.
command
The command parameter specifies the command that shall be executed. The string need not be null terminated.
command_len
The parameter command_len specifies the length of the command string.
flags
Flags for the behavior of the call are specified in the flags parameter.
Return
This call returns non-zero on success.
Description
A call to exec_system_command executes a command as if called from the command line, and sends the output to a buffer. The buffer identifier can either name a new buffer that does not exist, name a buffer that does @@ -191,104 +191,113 @@ will be replaced into the buffer.
lock_flags
If this is not a null summary, this field contains flags describing the protection status of the buffer.
size
If this is not a null summary, this field specifies the size of the text in the buffer.
line_count
If this is not a null summary, this field specifies the number of lines in the buffer.
file_name
If this is not a null summary, this field specifies the file name associated to this buffer.
file_name_len
This field specifies the length of the file_name string.
buffer_name
If this is not a null summary, this field specifies the name of the buffer.
buffer_name_len
This field specifies the length of the buffer_name string.
is_lexed
If this is not a null summary, this field indicates whether the buffer is set to lex tokens.
map_id
If this is not a null summary, this field specifies the id of the command map for this buffer.
unwrapped_lines
If this is not a null summary, this field indicates whether the buffer 'prefers' wrapped lines.
See Also

§3.4.39: View_Summary

struct View_Summary {
bool32 exists;
int32_t view_id;
int32_t buffer_id;
Access_Flag lock_flags;
Full_Cursor cursor;
Full_Cursor mark;
float preferred_x;
float line_height;
bool32 unwrapped_lines;
bool32 show_whitespace;
i32_Rect file_region;
GUI_Scroll_Vars scroll_vars;
};
Description
View_Summary acts as a handle to a view and describes the state of the view.
Fields
exists
This field indicates whether the View_Summary describes a view that is open in 4coder. When this field is false the summary is referred to as a "null summary".
view_id
If this is not a null summary, this field is the id of the associated view. If this is a null summary then view_id is 0.
buffer_id
If this is not a null summary, then this is the id of the buffer this view currently sees.
lock_flags
If this is not a null summary, this field contains flags describing the protection status of the view.
cursor
If this is not a null summary, this describes the position of the cursor.
mark
If this is not a null summary, this describes the position of the mark.
preferred_x
If this is not a null summary, this is the x position that is maintained in vertical navigation.
line_height
If this is not a null summary, this specifies the height of a line rendered in the view.
unwrapped_lines
If this is not a null summary, this indicates that the view is set to render with unwrapped lines.
show_whitespace
If this is not a null summary, this indicates that the view is set to highlight white space.
file_region
If this is not a null summary, this describes the screen position in which this view's buffer is displayed.
scroll_vars
If this is not a null summary, this describes the scrolling position inside the view.
See Also

§3.4.40: User_Input

struct User_Input {
User_Input_Type_ID type;
bool32 abort;
union {
Key_Event_Data key;
Mouse_State mouse;
};
Generic_Command command;
};
Description
User_Input describes a user input event which can be either a key press or mouse event.
Fields
type
This field specifies whether the event was a key press or mouse event.
abort
This field indicates that an abort event has occurred and the command needs to shut down.
key
This field describes a key press event.
mouse
This field describes a mouse input event.
command
If this event would trigger a command, this field specifies what the command would be.
See Also

§3.4.41: Query_Bar

struct Query_Bar {
String prompt;
String string;
};
Description
Query_Bar is a struct used to store information in the user's control -that will be displayed as a drop down bar durring an interactive command.
Fields
prompt
This specifies the prompt portion of the drop down bar.
string
This specifies the main string portion of the drop down bar.

§3.4.42: Event_Message

struct Event_Message {
int32_t type;
};
Description
This feature is not implemented.
Fields
type
This feature is not implemented.

§3.4.43: Theme_Color

struct Theme_Color {
Style_Tag tag;
int_color color;
};
Description
Theme_Color stores a style tag/color pair, for the purpose of setting and getting colors in the theme .
Fields
tag
color
See Also

-

§4 String Library

§4.1 String Intro

Coming Soon

§4.2 String Function List

§4.3 String Function Descriptions

§4.3.1: char_is_slash

fstr_bool char_is_slash(
char c
)
Description
This call returns non-zero if c is \ or /.

§4.3.2: char_to_upper

char char_to_upper(
char c
)
Description
If c is a lowercase letter this call returns the uppercase equivalent, otherwise it returns c.

§4.3.3: char_to_lower

char char_to_lower(
char c
)
Description
If c is an uppercase letter this call returns the lowercase equivalent, otherwise it returns c.

§4.3.4: char_is_whitespace

fstr_bool char_is_whitespace(
char c
)
Description
This call returns non-zero if c is whitespace.

§4.3.5: char_is_alpha_numeric

fstr_bool char_is_alpha_numeric(
char c
)
Description
This call returns non-zero if c is any alphanumeric character including underscore.

§4.3.6: char_is_alpha_numeric_true

fstr_bool char_is_alpha_numeric_true(
char c
)
Description
This call returns non-zero if c is any alphanumeric character no including underscore.

§4.3.7: char_is_alpha

fstr_bool char_is_alpha(
char c
)
Description
This call returns non-zero if c is any alphabetic character including underscore.

§4.3.8: char_is_alpha_true

fstr_bool char_is_alpha_true(
char c
)
Description
This call returns non-zero if c is any alphabetic character.

§4.3.9: char_is_hex

fstr_bool char_is_hex(
char c
)
Description
This call returns non-zero if c is any valid hexadecimal digit.

§4.3.10: char_is_numeric

fstr_bool char_is_numeric(
char c
)
Description
This call returns non-zero if c is any valid decimal digit.

§4.3.11: string_zero

String string_zero(
void
)
Description
This call returns a String struct of zeroed members.

§4.3.12: make_string_cap

String make_string_cap(
void *str,
int32_t size,
int32_t mem_size
)
Parameters
str
The str parameter provides the of memory with which the string shall operate.
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.
mem_size
The mem_size parameter expresses the full size of the memory provided by str.
Description
This call returns the String created from the parameters.

§4.3.13: make_string

String make_string(
void *str,
int32_t size
)
Parameters
str
The str parameter provides the of memory with which the string shall operate.
size
The size parameter expresses the initial size of the string. +that will be displayed as a drop down bar durring an interactive command.
Fields
prompt
This specifies the prompt portion of the drop down bar.
string
This specifies the main string portion of the drop down bar.

§3.4.42: Event_Message

struct Event_Message {
int32_t type;
};
Description
This feature is not implemented.
Fields
type
This feature is not implemented.

§3.4.43: Theme_Color

struct Theme_Color {
Style_Tag tag;
int_color color;
};
Description
Theme_Color stores a style tag/color pair, for the purpose of setting and getting colors in the theme .
Fields
tag
color
See Also

§3.4.44: Cpp_Token_Type

enum Cpp_Token_Type;
Description
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.
Values
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
This type is not stored in token output from the lexer.
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
CPP_TOKEN_STAR
This is an 'ambiguous' token type because it requires + parsing to determine the full nature of the token.
CPP_TOKEN_AMPERSAND
This is an 'ambiguous' token type because it requires + parsing to determine the full nature of the token.
CPP_TOKEN_TILDE
This is an 'ambiguous' token type because it requires + parsing to determine the full nature of the token.
CPP_TOKEN_PLUS
This is an 'ambiguous' token type because it requires + parsing to determine the full nature of the token.
CPP_TOKEN_MINUS
This is an 'ambiguous' token type because it requires + parsing to determine the full nature of the token.
CPP_TOKEN_INCREMENT
This is an 'ambiguous' token type because it requires + parsing to determine the full nature of the token.
CPP_TOKEN_DECREMENT
This is an 'ambiguous' token type because it requires + parsing to determine the full nature of the token.
CPP_TOKEN_SCOPE
CPP_TOKEN_POSTINC
This type is for parser use, it is not output by the lexer.
CPP_TOKEN_POSTDEC
This type is for parser use, it is not output by the lexer.
CPP_TOKEN_FUNC_STYLE_CAST
This type is for parser use, it is not output by the lexer.
CPP_TOKEN_CPP_STYLE_CAST
CPP_TOKEN_CALL
This type is for parser use, it is not output by the lexer.
CPP_TOKEN_INDEX
This type is for parser use, it is not output by the lexer.
CPP_TOKEN_DOT
CPP_TOKEN_ARROW
CPP_TOKEN_PREINC
This token is for parser use, it is not output by the lexer.
CPP_TOKEN_PREDEC
This token is for parser use, it is not output by the lexer.
CPP_TOKEN_POSITIVE
This token is for parser use, it is not output by the lexer.
CPP_TOKEN_NEGAITVE
This token is for parser use, it is not output by the lexer.
CPP_TOKEN_NOT
CPP_TOKEN_BIT_NOT
This type is for parser use, it is not output by the lexer.
CPP_TOKEN_CAST
This type is for parser use, it is not output by the lexer.
CPP_TOKEN_DEREF
This type is for parser use, it is not output by the lexer.
CPP_TOKEN_TYPE_PTR
This type is for parser use, it is not output by the lexer.
CPP_TOKEN_ADDRESS
This type is for parser use, it is not output by the lexer.
CPP_TOKEN_TYPE_REF
This type is for parser use, it is not output by the lexer.
CPP_TOKEN_SIZEOF
CPP_TOKEN_ALIGNOF
CPP_TOKEN_DECLTYPE
CPP_TOKEN_TYPEID
CPP_TOKEN_NEW
CPP_TOKEN_DELETE
CPP_TOKEN_NEW_ARRAY
This type is for parser use, it is not output by the lexer.
CPP_TOKEN_DELETE_ARRAY
This type is for parser use, it is not output by the lexer.
CPP_TOKEN_PTRDOT
CPP_TOKEN_PTRARROW
CPP_TOKEN_MUL
This type is for parser use, it is not output by the lexer.
CPP_TOKEN_DIV
CPP_TOKEN_MOD
CPP_TOKEN_ADD
This type is for parser use, it is not output by the lexer.
CPP_TOKEN_SUB
This type is for parser use, it is not output by the lexer.
CPP_TOKEN_LSHIFT
CPP_TOKEN_RSHIFT
CPP_TOKEN_LESS
CPP_TOKEN_GRTR
CPP_TOKEN_GRTREQ
CPP_TOKEN_LESSEQ
CPP_TOKEN_EQEQ
CPP_TOKEN_NOTEQ
CPP_TOKEN_BIT_AND
This type is for parser use, it is not output by the lexer.
CPP_TOKEN_BIT_XOR
CPP_TOKEN_BIT_OR
CPP_TOKEN_AND
CPP_TOKEN_OR
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
CPP_TOKEN_COMMA
CPP_TOKEN_DEFINED
CPP_TOKEN_INCLUDE_FILE
CPP_TOKEN_ERROR_MESSAGE
CPP_TOKEN_EOF
This type is for parser use, it is not output by the lexer.
CPP_TOKEN_TYPE_COUNT

§3.4.45: Cpp_Token

struct Cpp_Token {
Cpp_Token_Type type;
int32_t start, size;
uint16_t state_flags;
uint16_t flags;
};
Fields
type
size
state_flags
flags

§3.4.46: Cpp_Token_Flag

enum Cpp_Token_Flag;
Values
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

§3.4.47: Cpp_Preprocessor_State

enum Cpp_Preprocessor_State;
Values
CPP_LEX_PP_DEFAULT
CPP_LEX_PP_IDENTIFIER
CPP_LEX_PP_MACRO_IDENTIFIER
CPP_LEX_PP_INCLUDE
CPP_LEX_PP_BODY
CPP_LEX_PP_BODY_IF
CPP_LEX_PP_NUMBER
CPP_LEX_PP_ERROR
CPP_LEX_PP_JUNK
CPP_LEX_PP_COUNT

§3.4.48: Cpp_Token_Stack

struct Cpp_Token_Stack {
Cpp_Token * tokens;
int32_t count, max_count;
};
Fields
tokens
max_count

§3.4.49: Cpp_Get_Token_Result

struct Cpp_Get_Token_Result {
int32_t token_index;
int32_t in_whitespace;
};
Fields
token_index
in_whitespace

§3.4.50: Cpp_Relex_State

struct Cpp_Relex_State {
char * data;
int32_t size;
Cpp_Token_Stack * stack;
int32_t start, end, amount;
int32_t start_token_i;
int32_t end_token_i;
int32_t relex_start;
int32_t tolerance;
int32_t space_request;
};
Fields
data
size
stack
amount
start_token_i
end_token_i
relex_start
tolerance
space_request

+

§4 String Library

§4.1 String Intro

Coming Soon

§4.2 String Function List

§4.3 String Function Descriptions

§4.3.1: char_is_slash

fstr_bool char_is_slash(
char c
)
Description
This call returns non-zero if c is \ or /.

§4.3.2: char_to_upper

char char_to_upper(
char c
)
Description
If c is a lowercase letter this call returns the uppercase equivalent, otherwise it returns c.

§4.3.3: char_to_lower

char char_to_lower(
char c
)
Description
If c is an uppercase letter this call returns the lowercase equivalent, otherwise it returns c.

§4.3.4: char_is_whitespace

fstr_bool char_is_whitespace(
char c
)
Description
This call returns non-zero if c is whitespace.

§4.3.5: char_is_alpha_numeric

fstr_bool char_is_alpha_numeric(
char c
)
Description
This call returns non-zero if c is any alphanumeric character including underscore.

§4.3.6: char_is_alpha_numeric_true

fstr_bool char_is_alpha_numeric_true(
char c
)
Description
This call returns non-zero if c is any alphanumeric character no including underscore.

§4.3.7: char_is_alpha

fstr_bool char_is_alpha(
char c
)
Description
This call returns non-zero if c is any alphabetic character including underscore.

§4.3.8: char_is_alpha_true

fstr_bool char_is_alpha_true(
char c
)
Description
This call returns non-zero if c is any alphabetic character.

§4.3.9: char_is_hex

fstr_bool char_is_hex(
char c
)
Description
This call returns non-zero if c is any valid hexadecimal digit.

§4.3.10: char_is_numeric

fstr_bool char_is_numeric(
char c
)
Description
This call returns non-zero if c is any valid decimal digit.

§4.3.11: make_string_cap

String make_string_cap(
void *str,
int32_t size,
int32_t mem_size
)
Parameters
str
The str parameter provides the of memory with which the string shall operate.
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.
mem_size
The mem_size parameter expresses the full size of the memory provided by str.
Description
This call returns the String created from the parameters.

§4.3.12: make_string

String make_string(
void *str,
int32_t size
)
Parameters
str
The str parameter provides the of memory with which the string shall operate.
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. Since this version does not specify the size of the memory it is also assumed that this size is the maximum size -of the memory.
Description
This call returns the String created from the parameters.

§4.3.14: make_lit_string

#define make_lit_string(s)
Description
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.

§4.3.15: make_fixed_width_string

#define make_fixed_width_string(s)
Description
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.

§4.3.16: expand_str

#define expand_str(s)
Description
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.

§4.3.17: str_size

int32_t str_size(
char *str
)
Description
This call returns the number of bytes before a null terminator starting at str.

§4.3.18: make_string_slowly

String make_string_slowly(
void *str
)
Description
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.

§4.3.19: substr_tail

String substr_tail(
String str,
int32_t start
)
Description
This call creates a substring of str that starts with an offset from str's base. +of the memory.
Description
This call returns the String created from the parameters.

§4.3.13: make_lit_string

#define make_lit_string(s)
Description
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.

§4.3.14: make_fixed_width_string

#define make_fixed_width_string(s)
Description
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.

§4.3.15: expand_str

#define expand_str(s)
Description
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.

§4.3.16: str_size

int32_t str_size(
char *str
)
Description
This call returns the number of bytes before a null terminator starting at str.

§4.3.17: make_string_slowly

String make_string_slowly(
void *str
)
Description
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.

§4.3.18: substr_tail

String substr_tail(
String str,
int32_t start
)
Description
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. -Usually strings created this way should only go through immutable calls.

§4.3.20: substr

String substr(
String str,
int32_t start,
int32_t size
)
Description
This call creates a substring of str that starts with an offset from str's base, +Usually strings created this way should only go through immutable calls.

§4.3.19: substr

String substr(
String str,
int32_t start,
int32_t size
)
Description
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 -will see changes. Usually strings created this way should only go through immutable calls.

§4.3.21: skip_whitespace

String skip_whitespace(
String str
)
Description
This call creates a substring that starts with the first non-whitespace character of str. +will see changes. Usually strings created this way should only go through immutable calls.

§4.3.20: skip_whitespace

String skip_whitespace(
String str
)
Description
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 -considered immutable.
See Also

§4.3.22: chop_whitespace

String chop_whitespace(
String str
)
Description
This call creates a substring that ends with the last non-whitespace character of str. +considered immutable.
See Also

§4.3.21: chop_whitespace

String chop_whitespace(
String str
)
Description
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 -considered immutable.
See Also

§4.3.23: skip_chop_whitespace

String skip_chop_whitespace(
String str
)
Description
This call is equivalent to calling skip_whitespace and chop_whitespace together.
See Also

§4.3.24: tailstr

String tailstr(
String str
)
Description
This call returns an empty String with underlying memory taken from -the portion of str's memory that is not used.

§4.3.25: match_cc

fstr_bool match_cc(
char *a,
char *b
)
Description
This call returns non-zero if a and b are equivalent.

§4.3.26: match_sc

fstr_bool match_sc(
String a,
char *b
)
Description
This call returns non-zero if a and b are equivalent.

§4.3.27: match_cs

fstr_bool match_cs(
char *a,
String b
)
Description
This call returns non-zero if a and b are equivalent.

§4.3.28: match_ss

fstr_bool match_ss(
String a,
String b
)
Description
This call returns non-zero if a and b are equivalent.

§4.3.29: match_part_ccl

fstr_bool match_part_ccl(
char *a,
char *b,
int32_t *len
)
Parameters
len
If this call returns non-zero this parameter is used to output the length of b.
Description
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.

§4.3.30: match_part_scl

fstr_bool match_part_scl(
String a,
char *b,
int32_t *len
)
Parameters
len
If this call returns non-zero this parameter is used to output the length of b.
Description
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.

§4.3.31: match_part_cc

fstr_bool match_part_cc(
char *a,
char *b
)
Parameters
len
If this call returns non-zero this parameter is used to output the length of b.
Description
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.

§4.3.32: match_part_sc

fstr_bool match_part_sc(
String a,
char *b
)
Description
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.

§4.3.33: match_part_cs

fstr_bool match_part_cs(
char *a,
String b
)
Description
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.

§4.3.34: match_part_ss

fstr_bool match_part_ss(
String a,
String b
)
Description
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.

§4.3.35: match_insensitive_cc

fstr_bool match_insensitive_cc(
char *a,
char *b
)
Description
This call returns non-zero if a and b are equivalent under case insensitive comparison.

§4.3.36: match_insensitive_sc

fstr_bool match_insensitive_sc(
String a,
char *b
)
Description
This call returns non-zero if a and b are equivalent under case insensitive comparison.

§4.3.37: match_insensitive_cs

fstr_bool match_insensitive_cs(
char *a,
String b
)
Description
This call returns non-zero if a and b are equivalent under case insensitive comparison.

§4.3.38: match_insensitive_ss

fstr_bool match_insensitive_ss(
String a,
String b
)
Description
This call returns non-zero if a and b are equivalent under case insensitive comparison.

§4.3.39: match_part_insensitive_ccl

fstr_bool match_part_insensitive_ccl(
char *a,
char *b,
int32_t *len
)
Parameters
len
If this call returns non-zero this parameter is used to output the length of b.
Description
This call performs the same partial matching rule as match_part under case insensitive comparison.
See Also

§4.3.40: match_part_insensitive_scl

fstr_bool match_part_insensitive_scl(
String a,
char *b,
int32_t *len
)
Parameters
len
If this call returns non-zero this parameter is used to output the length of b.
Description
This call performs the same partial matching rule as match_part under case insensitive comparison.
See Also

§4.3.41: match_part_insensitive_cc

fstr_bool match_part_insensitive_cc(
char *a,
char *b
)
Description
This call performs the same partial matching rule as match_part under case insensitive comparison.
See Also

§4.3.42: match_part_insensitive_sc

fstr_bool match_part_insensitive_sc(
String a,
char *b
)
Description
This call performs the same partial matching rule as match_part under case insensitive comparison.
See Also

§4.3.43: match_part_insensitive_cs

fstr_bool match_part_insensitive_cs(
char *a,
String b
)
Description
This call performs the same partial matching rule as match_part under case insensitive comparison.
See Also

§4.3.44: match_part_insensitive_ss

fstr_bool match_part_insensitive_ss(
String a,
String b
)
Description
This call performs the same partial matching rule as match_part under case insensitive comparison.
See Also

§4.3.45: compare_cc

int32_t compare_cc(
char *a,
char *b
)
Description
This call returns zero if a and b are equivalent, +considered immutable.
See Also

§4.3.22: skip_chop_whitespace

String skip_chop_whitespace(
String str
)
Description
This call is equivalent to calling skip_whitespace and chop_whitespace together.
See Also

§4.3.23: tailstr

String tailstr(
String str
)
Description
This call returns an empty String with underlying memory taken from +the portion of str's memory that is not used.

§4.3.24: match_cc

fstr_bool match_cc(
char *a,
char *b
)
Description
This call returns non-zero if a and b are equivalent.

§4.3.25: match_sc

fstr_bool match_sc(
String a,
char *b
)
Description
This call returns non-zero if a and b are equivalent.

§4.3.26: match_cs

fstr_bool match_cs(
char *a,
String b
)
Description
This call returns non-zero if a and b are equivalent.

§4.3.27: match_ss

fstr_bool match_ss(
String a,
String b
)
Description
This call returns non-zero if a and b are equivalent.

§4.3.28: match_part_ccl

fstr_bool match_part_ccl(
char *a,
char *b,
int32_t *len
)
Parameters
len
If this call returns non-zero this parameter is used to output the length of b.
Description
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.

§4.3.29: match_part_scl

fstr_bool match_part_scl(
String a,
char *b,
int32_t *len
)
Parameters
len
If this call returns non-zero this parameter is used to output the length of b.
Description
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.

§4.3.30: match_part_cc

fstr_bool match_part_cc(
char *a,
char *b
)
Parameters
len
If this call returns non-zero this parameter is used to output the length of b.
Description
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.

§4.3.31: match_part_sc

fstr_bool match_part_sc(
String a,
char *b
)
Description
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.

§4.3.32: match_part_cs

fstr_bool match_part_cs(
char *a,
String b
)
Description
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.

§4.3.33: match_part_ss

fstr_bool match_part_ss(
String a,
String b
)
Description
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.

§4.3.34: match_insensitive_cc

fstr_bool match_insensitive_cc(
char *a,
char *b
)
Description
This call returns non-zero if a and b are equivalent under case insensitive comparison.

§4.3.35: match_insensitive_sc

fstr_bool match_insensitive_sc(
String a,
char *b
)
Description
This call returns non-zero if a and b are equivalent under case insensitive comparison.

§4.3.36: match_insensitive_cs

fstr_bool match_insensitive_cs(
char *a,
String b
)
Description
This call returns non-zero if a and b are equivalent under case insensitive comparison.

§4.3.37: match_insensitive_ss

fstr_bool match_insensitive_ss(
String a,
String b
)
Description
This call returns non-zero if a and b are equivalent under case insensitive comparison.

§4.3.38: match_part_insensitive_ccl

fstr_bool match_part_insensitive_ccl(
char *a,
char *b,
int32_t *len
)
Parameters
len
If this call returns non-zero this parameter is used to output the length of b.
Description
This call performs the same partial matching rule as match_part under case insensitive comparison.
See Also

§4.3.39: match_part_insensitive_scl

fstr_bool match_part_insensitive_scl(
String a,
char *b,
int32_t *len
)
Parameters
len
If this call returns non-zero this parameter is used to output the length of b.
Description
This call performs the same partial matching rule as match_part under case insensitive comparison.
See Also

§4.3.40: match_part_insensitive_cc

fstr_bool match_part_insensitive_cc(
char *a,
char *b
)
Description
This call performs the same partial matching rule as match_part under case insensitive comparison.
See Also

§4.3.41: match_part_insensitive_sc

fstr_bool match_part_insensitive_sc(
String a,
char *b
)
Description
This call performs the same partial matching rule as match_part under case insensitive comparison.
See Also

§4.3.42: match_part_insensitive_cs

fstr_bool match_part_insensitive_cs(
char *a,
String b
)
Description
This call performs the same partial matching rule as match_part under case insensitive comparison.
See Also

§4.3.43: match_part_insensitive_ss

fstr_bool match_part_insensitive_ss(
String a,
String b
)
Description
This call performs the same partial matching rule as match_part under case insensitive comparison.
See Also

§4.3.44: compare_cc

int32_t compare_cc(
char *a,
char *b
)
Description
This call returns zero if a and b are equivalent, it returns negative if a sorts before b alphabetically, -and positive if a sorts after b alphabetically.

§4.3.46: compare_sc

int32_t compare_sc(
String a,
char *b
)
Description
This call returns zero if a and b are equivalent, +and positive if a sorts after b alphabetically.

§4.3.45: compare_sc

int32_t compare_sc(
String a,
char *b
)
Description
This call returns zero if a and b are equivalent, it returns negative if a sorts before b alphabetically, -and positive if a sorts after b alphabetically.

§4.3.47: compare_cs

int32_t compare_cs(
char *a,
String b
)
Description
This call returns zero if a and b are equivalent, +and positive if a sorts after b alphabetically.

§4.3.46: compare_cs

int32_t compare_cs(
char *a,
String b
)
Description
This call returns zero if a and b are equivalent, it returns negative if a sorts before b alphabetically, -and positive if a sorts after b alphabetically.

§4.3.48: compare_ss

int32_t compare_ss(
String a,
String b
)
Description
This call returns zero if a and b are equivalent, +and positive if a sorts after b alphabetically.

§4.3.47: compare_ss

int32_t compare_ss(
String a,
String b
)
Description
This call returns zero if a and b are equivalent, it returns negative if a sorts before b alphabetically, -and positive if a sorts after b alphabetically.

§4.3.49: find_c_char

int32_t find_c_char(
char *str,
int32_t start,
char character
)
Parameters
str
The str parameter provides a null terminated string to search.
start
The start parameter provides the index of the first character in str to search.
character
The character parameter provides the character for which to search.
Description
This call returns the index of the first occurance of character, or the size of the string -if the character is not found.

§4.3.50: find_s_char

int32_t find_s_char(
String str,
int32_t start,
char character
)
Parameters
str
The str parameter provides a string to search.
start
The start parameter provides the index of the first character in str to search.
character
The character parameter provides the character for which to search.
Description
This call returns the index of the first occurance of character, or the size of the string -if the character is not found.

§4.3.51: rfind_s_char

int32_t rfind_s_char(
String str,
int32_t start,
char character
)
Parameters
str
The str parameter provides a string to search.
start
The start parameter provides the index of the first character in str to search.
character
The character parameter provides the character for which to search.
Description
This call looks for the largest index less than or equal to the start position where -the given character occurs. If the index is found it is returned otherwise -1 is returned.

§4.3.52: find_c_chars

int32_t find_c_chars(
char *str,
int32_t start,
char *characters
)
Parameters
str
The str parameter provides a null terminated string to search.
start
The start parameter provides the index of the first character in str to search.
character
The characters parameter provides a null terminated array of characters for which to search.
Description
This call returns the index of the first occurance of a character in the characters array, -or the size of the string if no such character is not found.

§4.3.53: find_s_chars

int32_t find_s_chars(
String str,
int32_t start,
char *characters
)
Parameters
str
The str parameter provides a string to search.
start
The start parameter provides the index of the first character in str to search.
character
The characters parameter provides a null terminated array of characters for which to search.
Description
This call returns the index of the first occurance of a character in the characters array, -or the size of the string if no such character is not found.

§4.3.54: find_substr_c

int32_t find_substr_c(
char *str,
int32_t start,
String seek
)
Parameters
str
The str parameter provides a null terminated string to search.
start
The start parameter provides the index of the first character in str to search.
seek
The seek parameter provides a string to find in str.
Description
This call returns the index of the first occurance of the seek substring in str or the -size of str if no such substring in str is found.

§4.3.55: find_substr_s

int32_t find_substr_s(
String str,
int32_t start,
String seek
)
Parameters
str
The str parameter provides a string to search.
start
The start parameter provides the index of the first character in str to search.
seek
The seek parameter provides a string to find in str.
Description
This call returns the index of the first occurance of the seek substring in str or the -size of str if no such substring in str is found.

§4.3.56: rfind_substr_s

int32_t rfind_substr_s(
String str,
int32_t start,
String seek
)
Parameters
str
The str parameter provides a string to search.
start
The start parameter provides the index of the first character in str to search.
seek
The seek parameter provides a string to find in str.
Description
This call returns the index of the last occurance of the seek substring in str -or -1 if no such substring in str is found.

§4.3.57: find_substr_insensitive_c

int32_t find_substr_insensitive_c(
char *str,
int32_t start,
String seek
)
Parameters
str
The str parameter provides a null terminated string to search.
start
The start parameter provides the index of the first character in str to search.
seek
The seek parameter provides a string to find in str.
Description
This call acts as find_substr under case insensitive comparison.
See Also

§4.3.58: find_substr_insensitive_s

int32_t find_substr_insensitive_s(
String str,
int32_t start,
String seek
)
Parameters
str
The str parameter provides a string to search.
start
The start parameter provides the index of the first character in str to search.
seek
The seek parameter provides a string to find in str.
Description
This call acts as find_substr under case insensitive comparison.
See Also

§4.3.59: has_substr_c

fstr_bool has_substr_c(
char *s,
String seek
)
Description
This call returns non-zero if the string s contains a substring equivalent to seek.

§4.3.60: has_substr_s

fstr_bool has_substr_s(
String s,
String seek
)
Description
This call returns non-zero if the string s contains a substring equivalent to seek.

§4.3.61: has_substr_insensitive_c

fstr_bool has_substr_insensitive_c(
char *s,
String seek
)
Description
This call returns non-zero if the string s contains a substring equivalent to seek -under case insensitive comparison.

§4.3.62: has_substr_insensitive_s

fstr_bool has_substr_insensitive_s(
String s,
String seek
)
Description
This call returns non-zero if the string s contains a substring equivalent to seek -under case insensitive comparison.

§4.3.63: copy_fast_unsafe_cc

int32_t copy_fast_unsafe_cc(
char *dest,
char *src
)
Description
This call performs a copy from the src buffer to the dest buffer. +and positive if a sorts after b alphabetically.

§4.3.48: find_c_char

int32_t find_c_char(
char *str,
int32_t start,
char character
)
Parameters
str
The str parameter provides a null terminated string to search.
start
The start parameter provides the index of the first character in str to search.
character
The character parameter provides the character for which to search.
Description
This call returns the index of the first occurance of character, or the size of the string +if the character is not found.

§4.3.49: find_s_char

int32_t find_s_char(
String str,
int32_t start,
char character
)
Parameters
str
The str parameter provides a string to search.
start
The start parameter provides the index of the first character in str to search.
character
The character parameter provides the character for which to search.
Description
This call returns the index of the first occurance of character, or the size of the string +if the character is not found.

§4.3.50: rfind_s_char

int32_t rfind_s_char(
String str,
int32_t start,
char character
)
Parameters
str
The str parameter provides a string to search.
start
The start parameter provides the index of the first character in str to search.
character
The character parameter provides the character for which to search.
Description
This call looks for the largest index less than or equal to the start position where +the given character occurs. If the index is found it is returned otherwise -1 is returned.

§4.3.51: find_c_chars

int32_t find_c_chars(
char *str,
int32_t start,
char *characters
)
Parameters
str
The str parameter provides a null terminated string to search.
start
The start parameter provides the index of the first character in str to search.
character
The characters parameter provides a null terminated array of characters for which to search.
Description
This call returns the index of the first occurance of a character in the characters array, +or the size of the string if no such character is not found.

§4.3.52: find_s_chars

int32_t find_s_chars(
String str,
int32_t start,
char *characters
)
Parameters
str
The str parameter provides a string to search.
start
The start parameter provides the index of the first character in str to search.
character
The characters parameter provides a null terminated array of characters for which to search.
Description
This call returns the index of the first occurance of a character in the characters array, +or the size of the string if no such character is not found.

§4.3.53: find_substr_c

int32_t find_substr_c(
char *str,
int32_t start,
String seek
)
Parameters
str
The str parameter provides a null terminated string to search.
start
The start parameter provides the index of the first character in str to search.
seek
The seek parameter provides a string to find in str.
Description
This call returns the index of the first occurance of the seek substring in str or the +size of str if no such substring in str is found.

§4.3.54: find_substr_s

int32_t find_substr_s(
String str,
int32_t start,
String seek
)
Parameters
str
The str parameter provides a string to search.
start
The start parameter provides the index of the first character in str to search.
seek
The seek parameter provides a string to find in str.
Description
This call returns the index of the first occurance of the seek substring in str or the +size of str if no such substring in str is found.

§4.3.55: rfind_substr_s

int32_t rfind_substr_s(
String str,
int32_t start,
String seek
)
Parameters
str
The str parameter provides a string to search.
start
The start parameter provides the index of the first character in str to search.
seek
The seek parameter provides a string to find in str.
Description
This call returns the index of the last occurance of the seek substring in str +or -1 if no such substring in str is found.

§4.3.56: find_substr_insensitive_c

int32_t find_substr_insensitive_c(
char *str,
int32_t start,
String seek
)
Parameters
str
The str parameter provides a null terminated string to search.
start
The start parameter provides the index of the first character in str to search.
seek
The seek parameter provides a string to find in str.
Description
This call acts as find_substr under case insensitive comparison.
See Also

§4.3.57: find_substr_insensitive_s

int32_t find_substr_insensitive_s(
String str,
int32_t start,
String seek
)
Parameters
str
The str parameter provides a string to search.
start
The start parameter provides the index of the first character in str to search.
seek
The seek parameter provides a string to find in str.
Description
This call acts as find_substr under case insensitive comparison.
See Also

§4.3.58: has_substr_c

fstr_bool has_substr_c(
char *s,
String seek
)
Description
This call returns non-zero if the string s contains a substring equivalent to seek.

§4.3.59: has_substr_s

fstr_bool has_substr_s(
String s,
String seek
)
Description
This call returns non-zero if the string s contains a substring equivalent to seek.

§4.3.60: has_substr_insensitive_c

fstr_bool has_substr_insensitive_c(
char *s,
String seek
)
Description
This call returns non-zero if the string s contains a substring equivalent to seek +under case insensitive comparison.

§4.3.61: has_substr_insensitive_s

fstr_bool has_substr_insensitive_s(
String s,
String seek
)
Description
This call returns non-zero if the string s contains a substring equivalent to seek +under case insensitive comparison.

§4.3.62: copy_fast_unsafe_cc

int32_t copy_fast_unsafe_cc(
char *dest,
char *src
)
Description
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 is no safety against overrun so dest must be large enough to contain src. The null terminator is not written to dest. This call returns the number -of bytes coppied to dest.

§4.3.64: copy_fast_unsafe_cs

int32_t copy_fast_unsafe_cs(
char *dest,
String src
)
Description
This call performs a copy from the src string to the dest buffer. +of bytes coppied to dest.

§4.3.63: copy_fast_unsafe_cs

int32_t copy_fast_unsafe_cs(
char *dest,
String src
)
Description
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 is no safety against overrun so dest must be large enough to contain src. The null terminator is not written to dest. This call returns the number -of bytes coppied to dest.

§4.3.65: copy_checked_ss

fstr_bool copy_checked_ss(
String *dest,
String src
)
Description
This call performs a copy from the src string to the dest string. +of bytes coppied to dest.

§4.3.64: copy_checked_ss

fstr_bool copy_checked_ss(
String *dest,
String src
)
Description
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. -This call returns non-zero on a successful copy.

§4.3.66: copy_partial_sc

fstr_bool copy_partial_sc(
String *dest,
char *src
)
Description
This call performs a copy from the src buffer to the dest string. +This call returns non-zero on a successful copy.

§4.3.65: copy_partial_sc

fstr_bool copy_partial_sc(
String *dest,
char *src
)
Description
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, as many bytes as possible are coppied to dest. This call returns non-zero -if the entire string is coppied to dest.

§4.3.67: copy_partial_ss

fstr_bool copy_partial_ss(
String *dest,
String src
)
Description
This call performs a copy from the src string to the dest string. +if the entire string is coppied to dest.

§4.3.66: copy_partial_ss

fstr_bool copy_partial_ss(
String *dest,
String src
)
Description
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, as many bytes as possible are coppied to dest. This call returns non-zero -if the entire string is coppied to dest.

§4.3.68: copy_cc

int32_t copy_cc(
char *dest,
char *src
)
Description
This call performs a copy from src to dest equivalent to copy_fast_unsafe.
See Also

§4.3.69: copy_ss

void copy_ss(
String *dest,
String src
)
Description
This call performs a copy from src to dest equivalent to copy_checked.
See Also

§4.3.70: copy_sc

void copy_sc(
String *dest,
char *src
)
Description
This call performs a copy from src to dest equivalent to copy_partial.
See Also

§4.3.71: append_checked_ss

fstr_bool append_checked_ss(
String *dest,
String src
)
Description
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.

§4.3.72: append_partial_sc

fstr_bool append_partial_sc(
String *dest,
char *src
)
Description
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.

§4.3.73: append_partial_ss

fstr_bool append_partial_ss(
String *dest,
String src
)
Description
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.

§4.3.74: append_s_char

fstr_bool append_s_char(
String *dest,
char c
)
Description
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.

§4.3.75: append_ss

fstr_bool append_ss(
String *dest,
String src
)
Description
This call is equivalent to append_partial.
See Also

§4.3.76: append_sc

fstr_bool append_sc(
String *dest,
char *src
)
Description
This call is equivalent to append_partial.
See Also

§4.3.77: terminate_with_null

fstr_bool terminate_with_null(
String *str
)
Description
This call attemps to append a null terminator onto str without effecting the +if the entire string is coppied to dest.

§4.3.67: copy_cc

int32_t copy_cc(
char *dest,
char *src
)
Description
This call performs a copy from src to dest equivalent to copy_fast_unsafe.
See Also

§4.3.68: copy_ss

void copy_ss(
String *dest,
String src
)
Description
This call performs a copy from src to dest equivalent to copy_checked.
See Also

§4.3.69: copy_sc

void copy_sc(
String *dest,
char *src
)
Description
This call performs a copy from src to dest equivalent to copy_partial.
See Also

§4.3.70: append_checked_ss

fstr_bool append_checked_ss(
String *dest,
String src
)
Description
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.

§4.3.71: append_partial_sc

fstr_bool append_partial_sc(
String *dest,
char *src
)
Description
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.

§4.3.72: append_partial_ss

fstr_bool append_partial_ss(
String *dest,
String src
)
Description
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.

§4.3.73: append_s_char

fstr_bool append_s_char(
String *dest,
char c
)
Description
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.

§4.3.74: append_ss

fstr_bool append_ss(
String *dest,
String src
)
Description
This call is equivalent to append_partial.
See Also

§4.3.75: append_sc

fstr_bool append_sc(
String *dest,
char *src
)
Description
This call is equivalent to append_partial.
See Also

§4.3.76: terminate_with_null

fstr_bool terminate_with_null(
String *str
)
Description
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 API that requires a null terminator. This call returns non-zero if there was a spare -byte in the strings underlying memory.

§4.3.78: append_padding

fstr_bool append_padding(
String *dest,
char c,
int32_t target_size
)
Description
This call pads out dest so that it has a size of target_size by appending +byte in the strings underlying memory.

§4.3.77: append_padding

fstr_bool append_padding(
String *dest,
char c,
int32_t target_size
)
Description
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 -non-zero if dest does not run out of space in the underlying memory.

§4.3.79: replace_char

void replace_char(
String *str,
char replace,
char with
)
Parameters
str
The str parameter provides the string in which replacement shall be performed.
replace
The replace character specifies which character should be replaced.
with
The with character specifies what to write into the positions where replacement occurs.
Description
This call replaces all occurances of character in str with another character.

§4.3.80: to_lower_cc

void to_lower_cc(
char *src,
char *dst
)
Parameters
src
The source string to conver to lowercase. This string must be null terminated.
dst
The destination buffer to receive the converted string. This must be large +non-zero if dest does not run out of space in the underlying memory.

§4.3.78: replace_char

void replace_char(
String *str,
char replace,
char with
)
Parameters
str
The str parameter provides the string in which replacement shall be performed.
replace
The replace character specifies which character should be replaced.
with
The with character specifies what to write into the positions where replacement occurs.
Description
This call replaces all occurances of character in str with another character.

§4.3.79: to_lower_cc

void to_lower_cc(
char *src,
char *dst
)
Parameters
src
The source string to conver to lowercase. This string must be null terminated.
dst
The destination buffer to receive the converted string. This must be large enough to contain all of src and a null terminator.
Description
Rewrites the string in src into dst with all letters lowercased. 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.

§4.3.81: to_lower_ss

void to_lower_ss(
String *dst,
String src
)
Parameters
dst
The destination buffer to receive the converted string. +string in place.

§4.3.80: to_lower_ss

void to_lower_ss(
String *dst,
String src
)
Parameters
dst
The destination buffer to receive the converted string. This must have a capacity of at least the size of src.
src
The source string to conver to lowercase.
Description
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.

§4.3.82: to_lower_s

void to_lower_s(
String *str
)
Parameters
str
The string to be converted to all lowercase.
Description
This version of to_lower converts str to lowercase in place.

§4.3.83: to_upper_cc

void to_upper_cc(
char *src,
char *dst
)
Parameters
src
The source string to convert to uppercase. This string must be null terminated.
dst
The destination buffer to receive the converted string. +that src and dst may be exactly equal in order to convert the string in place.

§4.3.81: to_lower_s

void to_lower_s(
String *str
)
Parameters
str
The string to be converted to all lowercase.
Description
This version of to_lower converts str to lowercase in place.

§4.3.82: to_upper_cc

void to_upper_cc(
char *src,
char *dst
)
Parameters
src
The source string to convert to uppercase. This string must be null terminated.
dst
The destination buffer to receive the converted string. This must be large enough to contain all of src and a null terminator.
Description
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.

§4.3.84: to_upper_ss

void to_upper_ss(
String *dst,
String src
)
Parameters
dst
The destination buffer to receive the converted string. +that src and dst may be exactly equal in order to convert the string in place.

§4.3.83: to_upper_ss

void to_upper_ss(
String *dst,
String src
)
Parameters
dst
The destination buffer to receive the converted string. This must have a capacity of at least the size of src.
src
The source string to convert to uppercase.
Description
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.

§4.3.85: to_upper_s

void to_upper_s(
String *str
)
Parameters
str
The string to be converted to all uppercase.
Description
This version of to_upper converts str to uppercase in place.

§4.3.86: to_camel_cc

void to_camel_cc(
char *src,
char *dst
)
Parameters
src
The source string to convert to camel case.
dst
The destination buffer to receive the converted string. +that src and dst may be exactly equal in order to convert the string in place.

§4.3.84: to_upper_s

void to_upper_s(
String *str
)
Parameters
str
The string to be converted to all uppercase.
Description
This version of to_upper converts str to uppercase in place.

§4.3.85: to_camel_cc

void to_camel_cc(
char *src,
char *dst
)
Parameters
src
The source string to convert to camel case.
dst
The destination buffer to receive the converted string. This must be large enough to contain all of src and a null terminator.
Description
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.

§4.3.87: int_to_str_size

int32_t int_to_str_size(
int32_t x
)
Description
This call returns the number of bytes required to represent x as a string.

§4.3.88: int_to_str

fstr_bool int_to_str(
String *dest,
int32_t x
)
Description
This call writes a string representation of x into dest. If there is enough -space in dest this call returns non-zero.

§4.3.89: append_int_to_str

fstr_bool append_int_to_str(
String *dest,
int32_t x
)
Description
This call appends a string representation of x onto dest. If there is enough -space in dest this call returns non-zero.

§4.3.90: u64_to_str_size

int32_t u64_to_str_size(
uint64_t x
)
Description
This call returns the number of bytes required to represent x as a string.

§4.3.91: u64_to_str

fstr_bool u64_to_str(
String *dest,
uint64_t x
)
Description
This call writes a string representation of x into dest. If there is enough -space in dest this call returns non-zero.

§4.3.92: append_u64_to_str

fstr_bool append_u64_to_str(
String *dest,
uint64_t x
)
Description
This call appends a string representation of x onto dest. If there is enough -space in dest this call returns non-zero.

§4.3.93: float_to_str_size

int32_t float_to_str_size(
float x
)
Description
This call returns the number of bytes required to represent x as a string.

§4.3.94: append_float_to_str

fstr_bool append_float_to_str(
String *dest,
float x
)
Description
This call writes a string representation of x into dest. If there is enough -space in dest this call returns non-zero.

§4.3.95: float_to_str

fstr_bool float_to_str(
String *dest,
float x
)
Description
This call appends a string representation of x onto dest. If there is enough -space in dest this call returns non-zero.

§4.3.96: str_is_int_c

int32_t str_is_int_c(
char *str
)
Description
If str is a valid string representation of an integer, this call returns non-zero

§4.3.97: str_is_int_s

fstr_bool str_is_int_s(
String str
)
Description
If str is a valid string representation of an integer, this call returns non-zero.

§4.3.98: str_to_int_c

int32_t str_to_int_c(
char *str
)
Description
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.

§4.3.99: str_to_int_s

int32_t str_to_int_s(
String str
)
Description
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.

§4.3.100: hexchar_to_int

int32_t hexchar_to_int(
char c
)
Description
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.

§4.3.101: int_to_hexchar

char int_to_hexchar(
int32_t x
)
Description
If x is in the range [0,15] this call returns the equivalent lowercase hexadecimal digit. -Otherwise the return is some nonsense value.

§4.3.102: hexstr_to_int

uint32_t hexstr_to_int(
String str
)
Description
This call interprets str has a hexadecimal representation of an integer and returns -the represented integer value.

§4.3.103: color_to_hexstr

fstr_bool color_to_hexstr(
String *s,
uint32_t color
)
Description
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.

§4.3.104: hexstr_to_color

fstr_bool hexstr_to_color(
String s,
uint32_t *out
)
Description
This call interprets s as a color and writes the 32-bit integer representation into out.

§4.3.105: reverse_seek_slash_pos

int32_t reverse_seek_slash_pos(
String str,
int32_t pos
)
Description
This call searches for a slash in str by starting pos bytes from the end and going backwards.

§4.3.106: reverse_seek_slash

int32_t reverse_seek_slash(
String str
)
Description
This call searches for a slash in str by starting at the end and going backwards.

§4.3.107: front_of_directory

String front_of_directory(
String dir
)
Description
This call returns a substring of dir containing only the file name or -folder name furthest to the right in the directory.
See Also

§4.3.108: path_of_directory

String path_of_directory(
String dir
)
Description
This call returns a substring of dir containing the whole path except -for the final file or folder name.
See Also

§4.3.109: set_last_folder_sc

fstr_bool set_last_folder_sc(
String *dir,
char *folder_name,
char slash
)
Parameters
dir
The dir parameter is the directory string in which to set the last folder in the directory.
folder_name
The folder_name parameter is a null terminated string specifying the name to set +convert the string in place.

§4.3.86: int_to_str_size

int32_t int_to_str_size(
int32_t x
)
Description
This call returns the number of bytes required to represent x as a string.

§4.3.87: int_to_str

fstr_bool int_to_str(
String *dest,
int32_t x
)
Description
This call writes a string representation of x into dest. If there is enough +space in dest this call returns non-zero.

§4.3.88: append_int_to_str

fstr_bool append_int_to_str(
String *dest,
int32_t x
)
Description
This call appends a string representation of x onto dest. If there is enough +space in dest this call returns non-zero.

§4.3.89: u64_to_str_size

int32_t u64_to_str_size(
uint64_t x
)
Description
This call returns the number of bytes required to represent x as a string.

§4.3.90: u64_to_str

fstr_bool u64_to_str(
String *dest,
uint64_t x
)
Description
This call writes a string representation of x into dest. If there is enough +space in dest this call returns non-zero.

§4.3.91: append_u64_to_str

fstr_bool append_u64_to_str(
String *dest,
uint64_t x
)
Description
This call appends a string representation of x onto dest. If there is enough +space in dest this call returns non-zero.

§4.3.92: float_to_str_size

int32_t float_to_str_size(
float x
)
Description
This call returns the number of bytes required to represent x as a string.

§4.3.93: append_float_to_str

fstr_bool append_float_to_str(
String *dest,
float x
)
Description
This call writes a string representation of x into dest. If there is enough +space in dest this call returns non-zero.

§4.3.94: float_to_str

fstr_bool float_to_str(
String *dest,
float x
)
Description
This call appends a string representation of x onto dest. If there is enough +space in dest this call returns non-zero.

§4.3.95: str_is_int_c

int32_t str_is_int_c(
char *str
)
Description
If str is a valid string representation of an integer, this call returns non-zero

§4.3.96: str_is_int_s

fstr_bool str_is_int_s(
String str
)
Description
If str is a valid string representation of an integer, this call returns non-zero.

§4.3.97: str_to_int_c

int32_t str_to_int_c(
char *str
)
Description
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.

§4.3.98: str_to_int_s

int32_t str_to_int_s(
String str
)
Description
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.

§4.3.99: hexchar_to_int

int32_t hexchar_to_int(
char c
)
Description
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.

§4.3.100: int_to_hexchar

char int_to_hexchar(
int32_t x
)
Description
If x is in the range [0,15] this call returns the equivalent lowercase hexadecimal digit. +Otherwise the return is some nonsense value.

§4.3.101: hexstr_to_int

uint32_t hexstr_to_int(
String str
)
Description
This call interprets str has a hexadecimal representation of an integer and returns +the represented integer value.

§4.3.102: color_to_hexstr

fstr_bool color_to_hexstr(
String *s,
uint32_t color
)
Description
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.

§4.3.103: hexstr_to_color

fstr_bool hexstr_to_color(
String s,
uint32_t *out
)
Description
This call interprets s as a color and writes the 32-bit integer representation into out.

§4.3.104: reverse_seek_slash_pos

int32_t reverse_seek_slash_pos(
String str,
int32_t pos
)
Description
This call searches for a slash in str by starting pos bytes from the end and going backwards.

§4.3.105: reverse_seek_slash

int32_t reverse_seek_slash(
String str
)
Description
This call searches for a slash in str by starting at the end and going backwards.

§4.3.106: front_of_directory

String front_of_directory(
String dir
)
Description
This call returns a substring of dir containing only the file name or +folder name furthest to the right in the directory.
See Also

§4.3.107: path_of_directory

String path_of_directory(
String dir
)
Description
This call returns a substring of dir containing the whole path except +for the final file or folder name.
See Also

§4.3.108: set_last_folder_sc

fstr_bool set_last_folder_sc(
String *dir,
char *folder_name,
char slash
)
Parameters
dir
The dir parameter is the directory string in which to set the last folder in the directory.
folder_name
The folder_name parameter is a null terminated string specifying the name to set at the end of the directory.
slash
The slash parameter specifies what slash to use between names in the directory.
Description
This call deletes the last file name or folder name in the dir string and appends the new provided one. -If there is enough memory in dir this call returns non-zero.

§4.3.110: set_last_folder_ss

fstr_bool set_last_folder_ss(
String *dir,
String folder_name,
char slash
)
Parameters
dir
The dir parameter is the directory string in which to set the last folder in the directory.
folder_name
The folder_name parameter is a string specifying the name to set at the end of the directory.
slash
The slash parameter specifies what slash to use between names in the directory.
Description
This call deletes the last file name or folder name in the dir string and appends the new provided one. -If there is enough memory in dir this call returns non-zero.

§4.3.111: file_extension

String file_extension(
String str
)
Description
This call returns a substring containing only the file extension of the provided filename.
See Also

§4.3.112: remove_extension

fstr_bool remove_extension(
String *str
)
Description
This call attemps to delete a file extension off the end of a filename. -This call returns non-zero on success.

§4.3.113: remove_last_folder

fstr_bool remove_last_folder(
String *str
)
Description
This call attemps to delete a folder or filename off the end of a path string. -This call returns non-zero on success.

§4.3.114: string_set_match_table

fstr_bool string_set_match_table(
void *str_set,
int32_t item_size,
int32_t count,
String str,
int32_t *match_index
)
Parameters
str_set
The str_set parameter is an array of String structs specifying matchable strings.
count
The count parameter specifies the number of String structs in the str_set array.
str
The str parameter specifies the string to match against the str_set.
match_index
If this call succeeds match_index is filled with the index into str_set where the match occurred.
Description
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.
See Also

§4.3.115: string_set_match

fstr_bool string_set_match(
String *str_set,
int32_t count,
String str,
int32_t *match_index
)
Parameters
str_set
The str_set parameter is an array of String structs specifying matchable strings.
count
The count parameter specifies the number of String structs in the str_set array.
str
The str parameter specifies the string to match against the str_set.
match_index
If this call succeeds match_index is filled with the index into str_set where the match occurred.
Description
This call tries to see if str matches any of the strings in str_set. If there is a match the call +If there is enough memory in dir this call returns non-zero.

§4.3.109: set_last_folder_ss

fstr_bool set_last_folder_ss(
String *dir,
String folder_name,
char slash
)
Parameters
dir
The dir parameter is the directory string in which to set the last folder in the directory.
folder_name
The folder_name parameter is a string specifying the name to set at the end of the directory.
slash
The slash parameter specifies what slash to use between names in the directory.
Description
This call deletes the last file name or folder name in the dir string and appends the new provided one. +If there is enough memory in dir this call returns non-zero.

§4.3.110: file_extension

String file_extension(
String str
)
Description
This call returns a substring containing only the file extension of the provided filename.
See Also

§4.3.111: remove_extension

fstr_bool remove_extension(
String *str
)
Description
This call attemps to delete a file extension off the end of a filename. +This call returns non-zero on success.

§4.3.112: remove_last_folder

fstr_bool remove_last_folder(
String *str
)
Description
This call attemps to delete a folder or filename off the end of a path string. +This call returns non-zero on success.

§4.3.113: string_set_match_table

fstr_bool string_set_match_table(
void *str_set,
int32_t item_size,
int32_t count,
String str,
int32_t *match_index
)
Parameters
str_set
The str_set parameter is an array of String structs specifying matchable strings.
count
The count parameter specifies the number of String structs in the str_set array.
str
The str parameter specifies the string to match against the str_set.
match_index
If this call succeeds match_index is filled with the index into str_set where the match occurred.
Description
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.
See Also

§4.3.114: string_set_match

fstr_bool string_set_match(
String *str_set,
int32_t count,
String str,
int32_t *match_index
)
Parameters
str_set
The str_set parameter is an array of String structs specifying matchable strings.
count
The count parameter specifies the number of String structs in the str_set array.
str
The str parameter specifies the string to match against the str_set.
match_index
If this call succeeds match_index is filled with the index into str_set where the match occurred.
Description
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.
See Also

\ No newline at end of file diff --git a/4coder_default_include.cpp b/4coder_default_include.cpp index dff873d4..78133f09 100644 --- a/4coder_default_include.cpp +++ b/4coder_default_include.cpp @@ -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); diff --git a/4cpp_lexer_types.h b/4coder_lexer_types.h similarity index 58% rename from 4cpp_lexer_types.h rename to 4coder_lexer_types.h index a7954c2c..8d58de15 100644 --- a/4cpp_lexer_types.h +++ b/4coder_lexer_types.h @@ -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; diff --git a/4coder_string.h b/4coder_string.h index fd948ba3..d521319c 100644 --- a/4coder_string.h +++ b/4coder_string.h @@ -57,7 +57,6 @@ 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); #ifndef make_lit_string @@ -246,6 +245,10 @@ FSTRING_INLINE fstr_bool string_set_match(void *str_set, int32_t item_size, in #endif +#if !defined(FSTRING_GUARD) +static String null_string = {0}; +#endif + // // Character Helpers // @@ -335,15 +338,6 @@ 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 diff --git a/4coder_types.h b/4coder_types.h index 3a4cf296..94b6b285 100644 --- a/4coder_types.h +++ b/4coder_types.h @@ -1,6 +1,8 @@ +#ifndef ENUM #define ENUM(type,name) typedef type name; enum name##_ +#endif /* DOC(bool32 is an alias name to signal that an integer parameter or field is for true/false vales.) */ diff --git a/4cpp_lexer.h b/4cpp_lexer.h index ec591a7a..0f29a128 100644 --- a/4cpp_lexer.h +++ b/4cpp_lexer.h @@ -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" diff --git a/4ed_file_view.cpp b/4ed_file_view.cpp index 333df2ad..2ff9ee7f 100644 --- a/4ed_file_view.cpp +++ b/4ed_file_view.cpp @@ -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); diff --git a/4ed_metagen.cpp b/4ed_metagen.cpp index d87a7328..8cb0a5fa 100644 --- a/4ed_metagen.cpp +++ b/4ed_metagen.cpp @@ -614,6 +614,9 @@ get_doc_string_from_prev(Parse_Context *context, String *doc_string){ if (check_and_fix_docs(doc_string)){ result = true; } + else{ + *doc_string = null_string; + } } } @@ -1654,7 +1657,7 @@ compile_meta_unit(Partition *part, char **files, int32_t file_count, has_cpp_name = 0; } else{ - cpp_name = string_zero(); + cpp_name = null_string; } unit.parse[J].item_count = index; @@ -2225,7 +2228,8 @@ generate_custom_headers(){ // NOTE(allen): Parse the customization API types static char *type_files[] = { - "4coder_types.h" + "4coder_types.h", + "4coder_lexer_types.h", }; static Meta_Keywords type_keys[] = { diff --git a/fsm_table_generator.cpp b/fsm_table_generator.cpp index c682d033..c6c6519e 100644 --- a/fsm_table_generator.cpp +++ b/fsm_table_generator.cpp @@ -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" diff --git a/internal_4coder_string.cpp b/internal_4coder_string.cpp index c7415101..12bbff9b 100644 --- a/internal_4coder_string.cpp +++ b/internal_4coder_string.cpp @@ -53,6 +53,10 @@ typedef struct Offset_String{ FSTRING_DECLS +#if !defined(FSTRING_GUARD) +static String null_string = {0}; +#endif + // // Character Helpers // @@ -122,13 +126,6 @@ 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)/* diff --git a/win32_4ed.cpp b/win32_4ed.cpp index 0543a503..018c026e 100644 --- a/win32_4ed.cpp +++ b/win32_4ed.cpp @@ -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){