fstr_bool string_set_match(
String *str_set,
int32_t count,
String str,
int32_t *match_index
)
diff --git a/4coder_string.h b/4coder_string.h
index c6bbdfc9..daf69684 100644
--- a/4coder_string.h
+++ b/4coder_string.h
@@ -132,6 +132,12 @@ 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 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);
@@ -220,6 +226,12 @@ 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 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);
@@ -342,6 +354,18 @@ 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 int32_t
str_is_int(char *str){return(str_is_int_c(str));}
FSTRING_INLINE fstr_bool
@@ -1397,6 +1421,88 @@ replace_char(String *str, char replace, char with){
}
#endif
+
+#if defined(FSTRING_IMPLEMENTATION)
+FSTRING_LINK void
+to_lower_cc(char *src, char *dst){
+ for (; *src != 0; ++src){
+ *dst++ = char_to_lower(*src);
+ }
+ *dst++ = 0;
+}
+#endif
+
+
+#if defined(FSTRING_IMPLEMENTATION)
+FSTRING_LINK void
+to_lower_ss(String *src, String *dst){
+ int32_t i = 0;
+ 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++);
+ }
+ }
+}
+#endif
+
+
+#if defined(FSTRING_IMPLEMENTATION)
+FSTRING_LINK void
+to_lower_s(String *str){
+ int32_t i = 0;
+ int32_t size = str->size;
+ char *c = str->str;
+ for (; i < size; ++c, ++i){
+ *c = char_to_lower(*c);
+ }
+}
+#endif
+
+
+#if defined(FSTRING_IMPLEMENTATION)
+FSTRING_LINK void
+to_upper_cc(char *src, char *dst){
+ for (; *src != 0; ++src){
+ *dst++ = char_to_upper(*src);
+ }
+ *dst++ = 0;
+}
+#endif
+
+
+#if defined(FSTRING_IMPLEMENTATION)
+FSTRING_LINK void
+to_upper_ss(String *src, String *dst){
+ int32_t i = 0;
+ 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++);
+ }
+ }
+}
+#endif
+
+
+#if defined(FSTRING_IMPLEMENTATION)
+FSTRING_LINK void
+to_upper_s(String *str){
+ int32_t i = 0;
+ int32_t size = str->size;
+ char *c = str->str;
+ for (; i < size; ++c, ++i){
+ *c = char_to_upper(*c);
+ }
+}
+#endif
+
//
// String <-> Number Conversions
//
diff --git a/4coder_types.h b/4coder_types.h
index 8d226a84..f04cf17f 100644
--- a/4coder_types.h
+++ b/4coder_types.h
@@ -706,3 +706,5 @@ struct Theme_Color{
int_color color;
};
+
+
diff --git a/4cpp_lexer_types.h b/4cpp_lexer_types.h
index 8adb033a..a7954c2c 100644
--- a/4cpp_lexer_types.h
+++ b/4cpp_lexer_types.h
@@ -4,7 +4,12 @@
#ifndef FCPP_LEXER_TYPES_INC
#define FCPP_LEXER_TYPES_INC
-enum Cpp_Token_Type{
+#if 0
+
+/* 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){
CPP_TOKEN_JUNK,
CPP_TOKEN_COMMENT,
@@ -29,7 +34,8 @@ enum Cpp_Token_Type{
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
+ /* DOC(This type is not stored in token output from the lexer.) */
+ CPP_TOKEN_KEY_OPERATOR,
CPP_TOKEN_KEY_CONTROL_FLOW,
CPP_TOKEN_KEY_CAST,
CPP_TOKEN_KEY_TYPE_DECLARATION,
@@ -55,62 +61,106 @@ enum Cpp_Token_Type{
CPP_TOKEN_SEMICOLON,
CPP_TOKEN_ELLIPSIS,
- // NOTE(allen): Ambiguous tokens, lexer only,
- // parser figures out the real meaning
+ /* DOC(This is an 'ambiguous' token type because it requires
+ parsing to determine the full nature of the token.) */
CPP_TOKEN_STAR,
+
+ /* DOC(This is an 'ambiguous' token type because it requires
+ parsing to determine the full nature of the token.) */
CPP_TOKEN_AMPERSAND,
+
+ /* DOC(This is an 'ambiguous' token type because it requires
+ parsing to determine the full nature of the token.) */
CPP_TOKEN_TILDE,
+
+ /* DOC(This is an 'ambiguous' token type because it requires
+ parsing to determine the full nature of the token.) */
CPP_TOKEN_PLUS,
+
+ /* DOC(This is an 'ambiguous' token type because it requires
+ parsing to determine the full nature of the token.) */
CPP_TOKEN_MINUS,
+
+ /* DOC(This is an 'ambiguous' token type because it requires
+ parsing to determine the full nature of the token.) */
CPP_TOKEN_INCREMENT,
+
+ /* DOC(This is an 'ambiguous' token type because it requires
+ parsing to determine the full nature of the token.) */
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
+ /* DOC(This type is for parser use, it is not output by the lexer.) */
+ CPP_TOKEN_POSTINC,
+ /* DOC(This type is for parser use, it is not output by the lexer.) */
+ CPP_TOKEN_POSTDEC,
+ /* DOC(This type is for parser use, it is not output by the lexer.) */
+ CPP_TOKEN_FUNC_STYLE_CAST,
CPP_TOKEN_CPP_STYLE_CAST,
- CPP_TOKEN_CALL, // from open paren, parser only
- CPP_TOKEN_INDEX, // from bracket open, parser only
+ /* DOC(This type is for parser use, it is not output by the lexer.) */
+ CPP_TOKEN_CALL,
+ /* DOC(This type is for parser use, it is not output by the lexer.) */
+ CPP_TOKEN_INDEX,
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
+
+ /* DOC(This token is for parser use, it is not output by the lexer.) */
+ CPP_TOKEN_PREINC,
+ /* DOC(This token is for parser use, it is not output by the lexer.) */
+ CPP_TOKEN_PREDEC,
+ /* DOC(This token is for parser use, it is not output by the lexer.) */
+ CPP_TOKEN_POSITIVE,
+ /* DOC(This token is for parser use, it is not output by the lexer.) */
+ CPP_TOKEN_NEGAITVE,
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
+
+ /* DOC(This type is for parser use, it is not output by the lexer.) */
+ CPP_TOKEN_BIT_NOT,
+
+ /* DOC(This type is for parser use, it is not output by the lexer.) */
+ CPP_TOKEN_CAST,
+ /* DOC(This type is for parser use, it is not output by the lexer.) */
+ CPP_TOKEN_DEREF,
+ /* DOC(This type is for parser use, it is not output by the lexer.) */
+ CPP_TOKEN_TYPE_PTR,
+ /* DOC(This type is for parser use, it is not output by the lexer.) */
+ CPP_TOKEN_ADDRESS,
+ /* DOC(This type is for parser use, it is not output by the lexer.) */
+ CPP_TOKEN_TYPE_REF,
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
+ /* DOC(This type is for parser use, it is not output by the lexer.) */
+ CPP_TOKEN_NEW_ARRAY,
+ /* DOC(This type is for parser use, it is not output by the lexer.) */
+ CPP_TOKEN_DELETE_ARRAY,
// NOTE(allen): Precedence 4, LtoR
CPP_TOKEN_PTRDOT,
CPP_TOKEN_PTRARROW,
// NOTE(allen): Precedence 5, LtoR
- CPP_TOKEN_MUL, // from start, parser only
+
+ /* DOC(This type is for parser use, it is not output by the lexer.) */
+ CPP_TOKEN_MUL,
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
+
+ /* DOC(This type is for parser use, it is not output by the lexer.) */
+ CPP_TOKEN_ADD,
+
+ /* DOC(This type is for parser use, it is not output by the lexer.) */
+ CPP_TOKEN_SUB,
// NOTE(allen): Precedence 7, LtoR
CPP_TOKEN_LSHIFT,
@@ -127,7 +177,9 @@ enum Cpp_Token_Type{
CPP_TOKEN_NOTEQ,
// NOTE(allen): Precedence 10, LtoR
- CPP_TOKEN_BIT_AND, // from ampersand, direct from 'bitand'
+
+ /* DOC(This type is for parser use, it is not output by the lexer.) */
+ CPP_TOKEN_BIT_AND,
// NOTE(allen): Precedence 11, LtoR
CPP_TOKEN_BIT_XOR,
@@ -164,11 +216,182 @@ enum Cpp_Token_Type{
CPP_TOKEN_INCLUDE_FILE,
CPP_TOKEN_ERROR_MESSAGE,
+ /* DOC(This type is for parser use, it is not output by the lexer.) */
+ CPP_TOKEN_EOF,
+
+ 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;
diff --git a/4ed_metagen.cpp b/4ed_metagen.cpp
index 9ba21eb6..7223b286 100644
--- a/4ed_metagen.cpp
+++ b/4ed_metagen.cpp
@@ -28,42 +28,6 @@ struct Struct_Field{
char *name;
};
-void to_lower(char *src, char *dst){
- char *c, ch;
- for (c = src; *c != 0; ++c){
- ch = char_to_lower(*c);
- *dst++ = ch;
- }
- *dst = 0;
-}
-
-void to_lower(String *str){
- char *c;
- int32_t i = 0;
- int32_t size = str->size;
- for (c = str->str; i < size; ++c, ++i){
- *c = char_to_lower(*c);
- }
-}
-
-void to_upper(char *src, char *dst){
- char *c, ch;
- for (c = src; *c != 0; ++c){
- ch = char_to_upper(*c);
- *dst++ = ch;
- }
- *dst = 0;
-}
-
-void to_upper(String *str){
- char *c;
- int32_t i = 0;
- int32_t size = str->size;
- for (c = str->str; i < size; ++c, ++i){
- *c = char_to_upper(*c);
- }
-}
-
void to_camel(char *src, char *dst){
char *c, ch;
int32_t is_first = 1;
@@ -1950,7 +1914,7 @@ generate_custom_headers(){
macro->str = (char*)malloc(macro->memory_size);
copy_ss(macro, name_string);
- to_upper(macro);
+ to_upper_s(macro);
append_ss(macro, make_lit_string("_SIG"));
@@ -1959,7 +1923,7 @@ generate_custom_headers(){
public_name->str = (char*)malloc(public_name->memory_size);
copy_ss(public_name, name_string);
- to_lower(public_name);
+ to_lower_s(public_name);
}
// NOTE(allen): Header
diff --git a/TODO.txt b/TODO.txt
index aa4940a8..ddf3763e 100644
--- a/TODO.txt
+++ b/TODO.txt
@@ -89,7 +89,7 @@
; [X] exit command
; [X] full screen option
; [X] add to APIs
-; [] try to make win32 version better
+; [X] try to make win32 version better
;
; [] tokens in the custom API
; [] auto indent on the custom side
diff --git a/fsm_table_generator.cpp b/fsm_table_generator.cpp
index 7b29a998..c682d033 100644
--- a/fsm_table_generator.cpp
+++ b/fsm_table_generator.cpp
@@ -110,81 +110,6 @@ main_fsm(Lex_FSM fsm, unsigned char pp_state, unsigned char c){
if (c == '\n') fsm.emit_token = 1;
break;
-#if 0
- case LSPP_include:
- switch (fsm.state){
- case LSINC_default:
- switch (c){
- case '"': fsm.state = LSINC_quotes; break;
- case '<': fsm.state = LSINC_pointy; break;
- case '/': fsm.state = LSINC_def_comment_pre; break;
- default: fsm.state = LSINC_junk; break;
- }
- break;
-
- case LSINC_quotes:
- if (c == '"') fsm.emit_token = 1;
- else if (c == '\n'){
- fsm.emit_token = 1;
- fsm.state = LSINC_junk;
- }
- break;
-
- case LSINC_pointy:
- if (c == '>') fsm.emit_token = 1;
- else if (c == '\n'){
- fsm.emit_token = 1;
- fsm.state = LSINC_junk;
- }
- break;
-
- case LSINC_junk:
- switch (c){
- case '/': fsm.state = LSINC_junk_comment_pre; break;
- case '\n': fsm.emit_token = 1; break;
- }
- break;
-
- case LSINC_def_comment_pre:
- switch (c){
- case '/': fsm.state = LSINC_def_comment; break;
- case '*': fsm.state = LSINC_def_comment_block; break;
- case '\n': fsm.state = LSINC_junk; fsm.emit_token = 1; break;
- default: fsm.state = LSINC_junk; break;
- }
- break;
-
- case LSINC_junk_comment_pre:
- switch (c){
- case '/': fsm.state = LSINC_junk_comment; break;
- case '*': fsm.state = LSINC_junk_comment_block; break;
- case '\n': fsm.state = LSINC_junk; fsm.emit_token = 1; break;
- default: fsm.state = LSINC_junk; break;
- }
- break;
-
- case LSINC_def_comment:
- case LSINC_junk_comment:
- switch (c){
-
- }
- break;
-
- case LSINC_def_comment_slashed:
- case LSINC_junk_comment_slashed:
- break;
-
- case LSINC_def_comment_block:
- case LSINC_junk_comment_block:
- break;
-
- case LSINC_def_comment_block_ending:
- case LSINC_junk_comment_block_ending:
- break;
- }
- break;
-#endif
-
default:
switch (fsm.state){
case LS_default:
@@ -322,9 +247,6 @@ main_fsm(Lex_FSM fsm, unsigned char pp_state, unsigned char c){
if (pp_state == LSPP_include){
fsm.emit_token = 1;
}
- else{
- fsm.state = LS_string_slashed;
- }
break;
case '\\': fsm.state = LS_string_slashed; break;
}
diff --git a/internal_4coder_string.cpp b/internal_4coder_string.cpp
index 54294541..aaf681e2 100644
--- a/internal_4coder_string.cpp
+++ b/internal_4coder_string.cpp
@@ -1123,6 +1123,107 @@ DOC(This call replaces all occurances of character in str with another character
}
}
+CPP_NAME(to_lower)
+FSTRING_LINK void
+to_lower_cc(char *src, char *dst)/*
+DOC_PARAM(src, The source string to conver to lowercase. This string must be null terminated.)
+DOC_PARAM(dst, The destination buffer to receive the converted string. This must be large
+enough to contain all of src and a null terminator.)
+DOC(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.)
+*/{
+ for (; *src != 0; ++src){
+ *dst++ = char_to_lower(*src);
+ }
+ *dst++ = 0;
+}
+
+CPP_NAME(to_lower)
+FSTRING_LINK void
+to_lower_ss(String *src, String *dst)/*
+DOC_PARAM(src, The source string to conver to lowercase.)
+DOC_PARAM(dst, The destination buffer to receive the converted string.
+This must have a capacity of at least the size of src.)
+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;
+ char *d = dst->str;
+
+ if (dst->memory_size >= size){
+ for (; i < size; ++i){
+ *d++ = char_to_lower(*c++);
+ }
+ }
+}
+
+CPP_NAME(to_lower)
+FSTRING_LINK void
+to_lower_s(String *str)/*
+DOC_PARAM(str, The string to be converted to all lowercase.)
+DOC(This version of to_lower converts str to lowercase in place.)
+*/{
+ int32_t i = 0;
+ int32_t size = str->size;
+ char *c = str->str;
+ for (; i < size; ++c, ++i){
+ *c = char_to_lower(*c);
+ }
+}
+
+CPP_NAME(to_upper)
+FSTRING_LINK void
+to_upper_cc(char *src, char *dst)/*
+DOC_PARAM(src, The source string to convert to uppercase. This string must be null terminated.)
+DOC_PARAM(dst, The destination buffer to receive the converted string. This must be large
+enough to contain all of src and a null terminator.)
+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.)
+*/{
+ for (; *src != 0; ++src){
+ *dst++ = char_to_upper(*src);
+ }
+ *dst++ = 0;
+}
+
+CPP_NAME(to_upper)
+FSTRING_LINK void
+to_upper_ss(String *src, String *dst)/*
+DOC_PARAM(src, The source string to conver to uppercase.)
+DOC_PARAM(dst, The destination buffer to receive the converted string.
+This must have a capacity of at least the size of src.)
+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;
+ char *d = dst->str;
+
+ if (dst->memory_size >= size){
+ for (; i < size; ++i){
+ *d++ = char_to_upper(*c++);
+ }
+ }
+}
+
+CPP_NAME(to_upper)
+FSTRING_LINK void
+to_upper_s(String *str)/*
+DOC_PARAM(str, The string to be converted to all uppercase.)
+DOC(This version of to_upper converts str to uppercase in place.)
+*/{
+ int32_t i = 0;
+ int32_t size = str->size;
+ char *c = str->str;
+ for (; i < size; ++c, ++i){
+ *c = char_to_upper(*c);
+ }
+}
+
//
// String <-> Number Conversions
//