diff --git a/4coder_default_framework.h b/4coder_default_framework.h index a565b34c..7e1d3d16 100644 --- a/4coder_default_framework.h +++ b/4coder_default_framework.h @@ -634,8 +634,8 @@ config_array_good(Config_Array_Reader *array_reader){ static void lexer_keywords_default_init(Partition *part, Cpp_Keyword_Table *kw_out, Cpp_Keyword_Table *pp_out){ - size_t kw_size = cpp_get_table_memory_size_default(CPP_TABLE_KEYWORDS); - size_t pp_size = cpp_get_table_memory_size_default(CPP_TABLE_PREPROCESSOR_DIRECTIVES); + umem_4tech kw_size = cpp_get_table_memory_size_default(CPP_TABLE_KEYWORDS); + umem_4tech pp_size = cpp_get_table_memory_size_default(CPP_TABLE_PREPROCESSOR_DIRECTIVES); void *kw_mem = push_block(part, (i32_4tech)kw_size); void *pp_mem = push_block(part, (i32_4tech)pp_size); diff --git a/4coder_default_include.cpp b/4coder_default_include.cpp index f29de126..7a92ea82 100644 --- a/4coder_default_include.cpp +++ b/4coder_default_include.cpp @@ -13,6 +13,8 @@ TYPE: 'major-system-include' #include "4coder_helper/4coder_jump_parsing.h" +#define FCODER_JUMP_COMMANDS + #include "4coder_default_framework.h" #include "4coder_base_commands.cpp" #include "4coder_auto_indent.cpp" @@ -25,6 +27,9 @@ TYPE: 'major-system-include' #include "4coder_default_hooks.cpp" #include "4coder_function_list.cpp" +#undef FCODER_JUMP_COMMANDS +#include "4coder_sticky_jump.cpp" + #include "4coder_helper/4coder_bind_helper.h" #include "4coder_helper/4coder_helper.h" #include "4coder_helper/4coder_streaming.h" diff --git a/4coder_lib/4coder_mem.h b/4coder_lib/4coder_mem.h index 53b4e676..77f53803 100644 --- a/4coder_lib/4coder_mem.h +++ b/4coder_lib/4coder_mem.h @@ -26,7 +26,11 @@ typedef uint16_t u16_4tech; typedef uint32_t u32_4tech; typedef uint64_t u64_4tech; +#if defined(FTECH_32_BIT) +typedef u32_4tech umem_4tech; +#else typedef u64_4tech umem_4tech; +#endif typedef float f32_4tech; typedef double f64_4tech; diff --git a/4coder_lib/4coder_string.h b/4coder_lib/4coder_string.h index 7654841b..e45c653b 100644 --- a/4coder_lib/4coder_string.h +++ b/4coder_lib/4coder_string.h @@ -26,7 +26,11 @@ typedef uint16_t u16_4tech; typedef uint32_t u32_4tech; typedef uint64_t u64_4tech; +#if defined(FTECH_32_BIT) +typedef u32_4tech umem_4tech; +#else typedef u64_4tech umem_4tech; +#endif typedef float f32_4tech; typedef double f64_4tech; @@ -293,7 +297,7 @@ FSTRING_LINK b32_4tech string_set_match(void *str_set, i32_4tech ite // #if !defined(FSTRING_GUARD) - FSTRING_INLINE b32_4tech +FSTRING_INLINE b32_4tech char_is_slash(char c) { return (c == '\\' || c == '/'); @@ -301,7 +305,7 @@ char_is_slash(char c) #endif #if !defined(FSTRING_GUARD) - FSTRING_INLINE b32_4tech +FSTRING_INLINE b32_4tech char_is_upper(char c) { return (c >= 'A' && c <= 'Z'); @@ -309,7 +313,7 @@ char_is_upper(char c) #endif #if !defined(FSTRING_GUARD) - FSTRING_INLINE b32_4tech +FSTRING_INLINE b32_4tech char_is_upper_utf8(char c) { return (c >= 'A' && c <= 'Z' || c >= 128); @@ -317,7 +321,7 @@ char_is_upper_utf8(char c) #endif #if !defined(FSTRING_GUARD) - FSTRING_INLINE b32_4tech +FSTRING_INLINE b32_4tech char_is_lower(char c) { return (c >= 'a' && c <= 'z'); @@ -325,7 +329,7 @@ char_is_lower(char c) #endif #if !defined(FSTRING_GUARD) - FSTRING_INLINE b32_4tech +FSTRING_INLINE b32_4tech char_is_lower_utf8(u8_4tech c) { return (c >= 'a' && c <= 'z' || c >= 128); @@ -333,7 +337,7 @@ char_is_lower_utf8(u8_4tech c) #endif #if !defined(FSTRING_GUARD) - FSTRING_INLINE char +FSTRING_INLINE char char_to_upper(char c) { return (c >= 'a' && c <= 'z') ? c + (char)('A' - 'a') : c; @@ -341,7 +345,7 @@ char_to_upper(char c) #endif #if !defined(FSTRING_GUARD) - FSTRING_INLINE char +FSTRING_INLINE char char_to_lower(char c) { return (c >= 'A' && c <= 'Z') ? c - (char)('A' - 'a') : c; @@ -349,7 +353,7 @@ char_to_lower(char c) #endif #if !defined(FSTRING_GUARD) - FSTRING_INLINE b32_4tech +FSTRING_INLINE b32_4tech char_is_whitespace(char c) { return (c == ' ' || c == '\n' || c == '\r' || c == '\t'); @@ -357,7 +361,7 @@ char_is_whitespace(char c) #endif #if !defined(FSTRING_GUARD) - FSTRING_INLINE b32_4tech +FSTRING_INLINE b32_4tech char_is_alpha_numeric(char c) { return (c >= 'a' && c <= 'z' || c >= 'A' && c <= 'Z' || c >= '0' && c <= '9' || c == '_'); @@ -365,7 +369,7 @@ char_is_alpha_numeric(char c) #endif #if !defined(FSTRING_GUARD) - FSTRING_INLINE b32_4tech +FSTRING_INLINE b32_4tech char_is_alpha_numeric_utf8(u8_4tech c) { return (c >= 'a' && c <= 'z' || c >= 'A' && c <= 'Z' || c >= '0' && c <= '9' || c == '_' || c >= 128); @@ -373,7 +377,7 @@ char_is_alpha_numeric_utf8(u8_4tech c) #endif #if !defined(FSTRING_GUARD) - FSTRING_INLINE b32_4tech +FSTRING_INLINE b32_4tech char_is_alpha_numeric_true(char c) { return (c >= 'a' && c <= 'z' || c >= 'A' && c <= 'Z' || c >= '0' && c <= '9'); @@ -381,7 +385,7 @@ char_is_alpha_numeric_true(char c) #endif #if !defined(FSTRING_GUARD) - FSTRING_INLINE b32_4tech +FSTRING_INLINE b32_4tech char_is_alpha_numeric_true_utf8(u8_4tech c) { return (c >= 'a' && c <= 'z' || c >= 'A' && c <= 'Z' || c >= '0' && c <= '9' || c >= 128); @@ -389,7 +393,7 @@ char_is_alpha_numeric_true_utf8(u8_4tech c) #endif #if !defined(FSTRING_GUARD) - FSTRING_INLINE b32_4tech +FSTRING_INLINE b32_4tech char_is_alpha(char c) { return (c >= 'a' && c <= 'z' || c >= 'A' && c <= 'Z' || c == '_'); @@ -397,7 +401,7 @@ char_is_alpha(char c) #endif #if !defined(FSTRING_GUARD) - FSTRING_INLINE b32_4tech +FSTRING_INLINE b32_4tech char_is_alpha_utf8(u8_4tech c) { return (c >= 'a' && c <= 'z' || c >= 'A' && c <= 'Z' || c == '_' || c >= 128); @@ -405,7 +409,7 @@ char_is_alpha_utf8(u8_4tech c) #endif #if !defined(FSTRING_GUARD) - FSTRING_INLINE b32_4tech +FSTRING_INLINE b32_4tech char_is_alpha_true(char c) { return (c >= 'a' && c <= 'z' || c >= 'A' && c <= 'Z'); @@ -413,7 +417,7 @@ char_is_alpha_true(char c) #endif #if !defined(FSTRING_GUARD) - FSTRING_INLINE b32_4tech +FSTRING_INLINE b32_4tech char_is_alpha_true_utf8(u8_4tech c) { return (c >= 'a' && c <= 'z' || c >= 'A' && c <= 'Z' || c >= 128); @@ -421,7 +425,7 @@ char_is_alpha_true_utf8(u8_4tech c) #endif #if !defined(FSTRING_GUARD) - FSTRING_INLINE b32_4tech +FSTRING_INLINE b32_4tech char_is_hex(char c) { return (c >= '0' && c <= '9' || c >= 'A' && c <= 'F' || c >= 'a' && c <= 'f'); @@ -429,7 +433,7 @@ char_is_hex(char c) #endif #if !defined(FSTRING_GUARD) - FSTRING_INLINE b32_4tech +FSTRING_INLINE b32_4tech char_is_hex_utf8(u8_4tech c) { return (c >= '0' && c <= '9' || c >= 'A' && c <= 'F' || c >= 'a' && c <= 'f' || c >= 128); @@ -437,7 +441,7 @@ char_is_hex_utf8(u8_4tech c) #endif #if !defined(FSTRING_GUARD) - FSTRING_INLINE b32_4tech +FSTRING_INLINE b32_4tech char_is_numeric(char c) { return (c >= '0' && c <= '9'); @@ -445,7 +449,7 @@ char_is_numeric(char c) #endif #if !defined(FSTRING_GUARD) - FSTRING_INLINE b32_4tech +FSTRING_INLINE b32_4tech char_is_numeric_utf8(u8_4tech c) { return (c >= '0' && c <= '9' || c >= 128); @@ -459,7 +463,7 @@ char_is_numeric_utf8(u8_4tech c) #if !defined(FSTRING_GUARD) - FSTRING_INLINE String +FSTRING_INLINE String make_string_cap(void *str, i32_4tech size, i32_4tech mem_size){ String result; result.str = (char*)str; @@ -470,7 +474,7 @@ make_string_cap(void *str, i32_4tech size, i32_4tech mem_size){ #endif #if !defined(FSTRING_GUARD) - FSTRING_INLINE String +FSTRING_INLINE String make_string(void *str, i32_4tech size){ String result; result.str = (char*)str; @@ -481,7 +485,7 @@ make_string(void *str, i32_4tech size){ #endif #if defined(FSTRING_IMPLEMENTATION) - FSTRING_LINK i32_4tech +FSTRING_LINK i32_4tech str_size(char *str) { i32_4tech i = 0; @@ -491,7 +495,7 @@ str_size(char *str) #endif #if !defined(FSTRING_GUARD) - FSTRING_INLINE String +FSTRING_INLINE String make_string_slowly(void *str) { String result; @@ -504,7 +508,7 @@ make_string_slowly(void *str) #if !defined(FSTRING_GUARD) - FSTRING_INLINE String +FSTRING_INLINE String substr_tail(String str, i32_4tech start) { String result; @@ -516,7 +520,7 @@ substr_tail(String str, i32_4tech start) #endif #if !defined(FSTRING_GUARD) - FSTRING_INLINE String +FSTRING_INLINE String substr(String str, i32_4tech start, i32_4tech size) { String result; @@ -531,7 +535,7 @@ substr(String str, i32_4tech start, i32_4tech size) #endif #if defined(FSTRING_IMPLEMENTATION) - FSTRING_LINK String +FSTRING_LINK String skip_whitespace(String str) { String result = {0}; @@ -544,7 +548,7 @@ skip_whitespace(String str) #if defined(FSTRING_IMPLEMENTATION) - FSTRING_LINK String +FSTRING_LINK String skip_whitespace_measure(String str, i32_4tech *skip_length) { String result = {0}; @@ -557,7 +561,7 @@ skip_whitespace_measure(String str, i32_4tech *skip_length) #endif #if defined(FSTRING_IMPLEMENTATION) - FSTRING_LINK String +FSTRING_LINK String chop_whitespace(String str) { String result = {0}; @@ -569,7 +573,7 @@ chop_whitespace(String str) #endif #if defined(FSTRING_IMPLEMENTATION) - FSTRING_LINK String +FSTRING_LINK String skip_chop_whitespace(String str) { str = skip_whitespace(str); @@ -580,7 +584,7 @@ skip_chop_whitespace(String str) #if defined(FSTRING_IMPLEMENTATION) - FSTRING_LINK String +FSTRING_LINK String skip_chop_whitespace_measure(String str, i32_4tech *skip_length) { str = skip_whitespace_measure(str, skip_length); @@ -590,7 +594,7 @@ skip_chop_whitespace_measure(String str, i32_4tech *skip_length) #endif #if !defined(FSTRING_GUARD) - FSTRING_INLINE String +FSTRING_INLINE String tailstr(String str) { String result; @@ -608,7 +612,7 @@ tailstr(String str) #if defined(FSTRING_IMPLEMENTATION) - FSTRING_LINK b32_4tech +FSTRING_LINK b32_4tech match_cc(char *a, char *b){ for (i32_4tech i = 0;; ++i){ if (a[i] != b[i]){ @@ -623,7 +627,7 @@ match_cc(char *a, char *b){ #if defined(FSTRING_IMPLEMENTATION) - FSTRING_LINK b32_4tech +FSTRING_LINK b32_4tech match_sc(String a, char *b){ i32_4tech i = 0; for (; i < a.size; ++i){ @@ -640,7 +644,7 @@ match_sc(String a, char *b){ #if !defined(FSTRING_GUARD) - FSTRING_INLINE b32_4tech +FSTRING_INLINE b32_4tech match_cs(char *a, String b){ return(match_sc(b,a)); } @@ -648,7 +652,7 @@ match_cs(char *a, String b){ #if defined(FSTRING_IMPLEMENTATION) - FSTRING_LINK b32_4tech +FSTRING_LINK b32_4tech match_ss(String a, String b){ if (a.size != b.size){ return 0; @@ -664,7 +668,7 @@ match_ss(String a, String b){ #if defined(FSTRING_IMPLEMENTATION) - FSTRING_LINK b32_4tech +FSTRING_LINK b32_4tech match_part_ccl(char *a, char *b, i32_4tech *len){ i32_4tech i; for (i = 0; b[i] != 0; ++i){ @@ -679,7 +683,7 @@ match_part_ccl(char *a, char *b, i32_4tech *len){ #if defined(FSTRING_IMPLEMENTATION) - FSTRING_LINK b32_4tech +FSTRING_LINK b32_4tech match_part_scl(String a, char *b, i32_4tech *len){ i32_4tech i; for (i = 0; b[i] != 0; ++i){ @@ -694,7 +698,7 @@ match_part_scl(String a, char *b, i32_4tech *len){ #if !defined(FSTRING_GUARD) - FSTRING_INLINE b32_4tech +FSTRING_INLINE b32_4tech match_part_cc(char *a, char *b){ i32_4tech x; return match_part_ccl(a,b,&x); @@ -703,7 +707,7 @@ match_part_cc(char *a, char *b){ #if !defined(FSTRING_GUARD) - FSTRING_INLINE b32_4tech +FSTRING_INLINE b32_4tech match_part_sc(String a, char *b){ i32_4tech x; return match_part_scl(a,b,&x); @@ -712,7 +716,7 @@ match_part_sc(String a, char *b){ #if defined(FSTRING_IMPLEMENTATION) - FSTRING_LINK b32_4tech +FSTRING_LINK b32_4tech match_part_cs(char *a, String b){ for (i32_4tech i = 0; i != b.size; ++i){ if (a[i] != b.str[i]){ @@ -725,7 +729,7 @@ match_part_cs(char *a, String b){ #if defined(FSTRING_IMPLEMENTATION) - FSTRING_LINK b32_4tech +FSTRING_LINK b32_4tech match_part_ss(String a, String b){ if (a.size < b.size){ return 0; @@ -741,7 +745,7 @@ match_part_ss(String a, String b){ #if defined(FSTRING_IMPLEMENTATION) - FSTRING_LINK b32_4tech +FSTRING_LINK b32_4tech match_insensitive_cc(char *a, char *b){ for (i32_4tech i = 0;; ++i){ if (char_to_upper(a[i]) != @@ -757,7 +761,7 @@ match_insensitive_cc(char *a, char *b){ #if defined(FSTRING_IMPLEMENTATION) - FSTRING_LINK b32_4tech +FSTRING_LINK b32_4tech match_insensitive_sc(String a, char *b){ i32_4tech i = 0; for (; i < a.size; ++i){ @@ -775,7 +779,7 @@ match_insensitive_sc(String a, char *b){ #if !defined(FSTRING_GUARD) - FSTRING_INLINE b32_4tech +FSTRING_INLINE b32_4tech match_insensitive_cs(char *a, String b){ return match_insensitive_sc(b,a); } @@ -783,7 +787,7 @@ match_insensitive_cs(char *a, String b){ #if defined(FSTRING_IMPLEMENTATION) - FSTRING_LINK b32_4tech +FSTRING_LINK b32_4tech match_insensitive_ss(String a, String b){ if (a.size != b.size){ return 0; @@ -800,7 +804,7 @@ match_insensitive_ss(String a, String b){ #if defined(FSTRING_IMPLEMENTATION) - FSTRING_LINK b32_4tech +FSTRING_LINK b32_4tech match_part_insensitive_ccl(char *a, char *b, i32_4tech *len){ i32_4tech i; for (i = 0; b[i] != 0; ++i){ @@ -815,7 +819,7 @@ match_part_insensitive_ccl(char *a, char *b, i32_4tech *len){ #if defined(FSTRING_IMPLEMENTATION) - FSTRING_LINK b32_4tech +FSTRING_LINK b32_4tech match_part_insensitive_scl(String a, char *b, i32_4tech *len){ i32_4tech i; for (i = 0; b[i] != 0; ++i){ @@ -831,7 +835,7 @@ match_part_insensitive_scl(String a, char *b, i32_4tech *len){ #if !defined(FSTRING_GUARD) - FSTRING_INLINE b32_4tech +FSTRING_INLINE b32_4tech match_part_insensitive_cc(char *a, char *b){ i32_4tech x; return match_part_insensitive_ccl(a,b,&x); @@ -840,7 +844,7 @@ match_part_insensitive_cc(char *a, char *b){ #if !defined(FSTRING_GUARD) - FSTRING_INLINE b32_4tech +FSTRING_INLINE b32_4tech match_part_insensitive_sc(String a, char *b){ i32_4tech x; return match_part_insensitive_scl(a,b,&x); @@ -849,7 +853,7 @@ match_part_insensitive_sc(String a, char *b){ #if defined(FSTRING_IMPLEMENTATION) - FSTRING_LINK b32_4tech +FSTRING_LINK b32_4tech match_part_insensitive_cs(char *a, String b){ for (i32_4tech i = 0; i != b.size; ++i){ if (char_to_upper(a[i]) != char_to_upper(b.str[i])){ @@ -862,7 +866,7 @@ match_part_insensitive_cs(char *a, String b){ #if defined(FSTRING_IMPLEMENTATION) - FSTRING_LINK b32_4tech +FSTRING_LINK b32_4tech match_part_insensitive_ss(String a, String b){ if (a.size < b.size){ return(0); @@ -878,7 +882,7 @@ match_part_insensitive_ss(String a, String b){ #if defined(FSTRING_IMPLEMENTATION) - FSTRING_LINK i32_4tech +FSTRING_LINK i32_4tech compare_cc(char *a, char *b){ i32_4tech i = 0, r = 0; while (a[i] == b[i] && a[i] != 0){ @@ -891,7 +895,7 @@ compare_cc(char *a, char *b){ #if defined(FSTRING_IMPLEMENTATION) - FSTRING_LINK i32_4tech +FSTRING_LINK i32_4tech compare_sc(String a, char *b){ i32_4tech i = 0, r = 0; while (i < a.size && a.str[i] == b[i]){ @@ -914,7 +918,7 @@ compare_sc(String a, char *b){ #if !defined(FSTRING_GUARD) - FSTRING_INLINE i32_4tech +FSTRING_INLINE i32_4tech compare_cs(char *a, String b){ i32_4tech r = -compare_sc(b,a); return(r); @@ -923,7 +927,7 @@ compare_cs(char *a, String b){ #if defined(FSTRING_IMPLEMENTATION) - FSTRING_LINK i32_4tech +FSTRING_LINK i32_4tech compare_ss(String a, String b){ i32_4tech i = 0, r = 0; i32_4tech m = a.size; @@ -951,7 +955,7 @@ compare_ss(String a, String b){ #if defined(FSTRING_IMPLEMENTATION) - FSTRING_LINK i32_4tech +FSTRING_LINK i32_4tech find_c_char(char *str, i32_4tech start, char character){ i32_4tech i = start; while (str[i] != character && str[i] != 0) ++i; @@ -961,7 +965,7 @@ find_c_char(char *str, i32_4tech start, char character){ #if defined(FSTRING_IMPLEMENTATION) - FSTRING_LINK i32_4tech +FSTRING_LINK i32_4tech find_s_char(String str, i32_4tech start, char character){ i32_4tech i = start; while (i < str.size && str.str[i] != character) ++i; @@ -971,7 +975,7 @@ find_s_char(String str, i32_4tech start, char character){ #if defined(FSTRING_IMPLEMENTATION) - FSTRING_LINK i32_4tech +FSTRING_LINK i32_4tech rfind_s_char(String str, i32_4tech start, char character){ i32_4tech i = start; while (i >= 0 && str.str[i] != character) --i; @@ -981,7 +985,7 @@ rfind_s_char(String str, i32_4tech start, char character){ #if defined(FSTRING_IMPLEMENTATION) - FSTRING_LINK i32_4tech +FSTRING_LINK i32_4tech find_c_chars(char *str, i32_4tech start, char *characters){ i32_4tech i = start, j; while (str[i] != 0){ @@ -998,7 +1002,7 @@ find_c_chars(char *str, i32_4tech start, char *characters){ #if defined(FSTRING_IMPLEMENTATION) - FSTRING_LINK i32_4tech +FSTRING_LINK i32_4tech find_s_chars(String str, i32_4tech start, char *characters){ i32_4tech i = start, j; while (i < str.size){ @@ -1015,7 +1019,7 @@ find_s_chars(String str, i32_4tech start, char *characters){ #if defined(FSTRING_IMPLEMENTATION) - FSTRING_LINK i32_4tech +FSTRING_LINK i32_4tech find_substr_c(char *str, i32_4tech start, String seek){ i32_4tech i, j, k; b32_4tech hit; @@ -1044,7 +1048,7 @@ find_substr_c(char *str, i32_4tech start, String seek){ #if defined(FSTRING_IMPLEMENTATION) - FSTRING_LINK i32_4tech +FSTRING_LINK i32_4tech find_substr_s(String str, i32_4tech start, String seek){ i32_4tech stop_at, i, j, k; b32_4tech hit; @@ -1073,7 +1077,7 @@ find_substr_s(String str, i32_4tech start, String seek){ #if defined(FSTRING_IMPLEMENTATION) - FSTRING_LINK i32_4tech +FSTRING_LINK i32_4tech rfind_substr_s(String str, i32_4tech start, String seek){ i32_4tech i, j, k; b32_4tech hit; @@ -1104,7 +1108,7 @@ rfind_substr_s(String str, i32_4tech start, String seek){ #if defined(FSTRING_IMPLEMENTATION) - FSTRING_LINK i32_4tech +FSTRING_LINK i32_4tech find_substr_insensitive_c(char *str, i32_4tech start, String seek){ i32_4tech i, j, k; b32_4tech hit; @@ -1138,7 +1142,7 @@ find_substr_insensitive_c(char *str, i32_4tech start, String seek){ #if defined(FSTRING_IMPLEMENTATION) - FSTRING_LINK i32_4tech +FSTRING_LINK i32_4tech find_substr_insensitive_s(String str, i32_4tech start, String seek){ i32_4tech i, j, k; i32_4tech stop_at; @@ -1174,7 +1178,7 @@ find_substr_insensitive_s(String str, i32_4tech start, String seek){ #if !defined(FSTRING_GUARD) - FSTRING_INLINE b32_4tech +FSTRING_INLINE b32_4tech has_substr_c(char *s, String seek){ return (s[find_substr_c(s, 0, seek)] != 0); } @@ -1182,7 +1186,7 @@ has_substr_c(char *s, String seek){ #if !defined(FSTRING_GUARD) - FSTRING_INLINE b32_4tech +FSTRING_INLINE b32_4tech has_substr_s(String s, String seek){ return (find_substr_s(s, 0, seek) < s.size); } @@ -1190,7 +1194,7 @@ has_substr_s(String s, String seek){ #if !defined(FSTRING_GUARD) - FSTRING_INLINE b32_4tech +FSTRING_INLINE b32_4tech has_substr_insensitive_c(char *s, String seek){ return (s[find_substr_insensitive_c(s, 0, seek)] != 0); } @@ -1198,7 +1202,7 @@ has_substr_insensitive_c(char *s, String seek){ #if !defined(FSTRING_GUARD) - FSTRING_INLINE b32_4tech +FSTRING_INLINE b32_4tech has_substr_insensitive_s(String s, String seek){ return (find_substr_insensitive_s(s, 0, seek) < s.size); } @@ -1210,7 +1214,7 @@ has_substr_insensitive_s(String s, String seek){ #if defined(FSTRING_IMPLEMENTATION) - FSTRING_LINK i32_4tech +FSTRING_LINK i32_4tech copy_fast_unsafe_cc(char *dest, char *src){ char *start = dest; while (*src != 0){ @@ -1224,7 +1228,7 @@ copy_fast_unsafe_cc(char *dest, char *src){ #if defined(FSTRING_IMPLEMENTATION) - FSTRING_LINK i32_4tech +FSTRING_LINK i32_4tech copy_fast_unsafe_cs(char *dest, String src){ i32_4tech i = 0; while (i != src.size){ @@ -1237,7 +1241,7 @@ copy_fast_unsafe_cs(char *dest, String src){ #if defined(FSTRING_IMPLEMENTATION) - FSTRING_LINK b32_4tech +FSTRING_LINK b32_4tech copy_checked_ss(String *dest, String src){ char *dest_str; i32_4tech i; @@ -1255,7 +1259,7 @@ copy_checked_ss(String *dest, String src){ #if defined(FSTRING_IMPLEMENTATION) - FSTRING_LINK b32_4tech +FSTRING_LINK b32_4tech copy_checked_cs(char *dest, i32_4tech dest_cap, String src){ i32_4tech i; if (dest_cap < src.size){ @@ -1270,7 +1274,7 @@ copy_checked_cs(char *dest, i32_4tech dest_cap, String src){ #if defined(FSTRING_IMPLEMENTATION) - FSTRING_LINK b32_4tech +FSTRING_LINK b32_4tech copy_partial_sc(String *dest, char *src){ i32_4tech i = 0; i32_4tech memory_size = dest->memory_size; @@ -1289,7 +1293,7 @@ copy_partial_sc(String *dest, char *src){ #if defined(FSTRING_IMPLEMENTATION) - FSTRING_LINK b32_4tech +FSTRING_LINK b32_4tech copy_partial_ss(String *dest, String src){ char *dest_str = dest->str; i32_4tech memory_size = dest->memory_size; @@ -1308,7 +1312,7 @@ copy_partial_ss(String *dest, String src){ #if defined(FSTRING_IMPLEMENTATION) - FSTRING_LINK b32_4tech +FSTRING_LINK b32_4tech copy_partial_cs(char *dest, i32_4tech dest_cap, String src){ b32_4tech result = 0; i32_4tech copy_size = dest_cap; @@ -1326,7 +1330,7 @@ copy_partial_cs(char *dest, i32_4tech dest_cap, String src){ #if !defined(FSTRING_GUARD) - FSTRING_INLINE i32_4tech +FSTRING_INLINE i32_4tech copy_cc(char *dest, char *src){ return copy_fast_unsafe_cc(dest, src); } @@ -1334,7 +1338,7 @@ copy_cc(char *dest, char *src){ #if !defined(FSTRING_GUARD) - FSTRING_INLINE void +FSTRING_INLINE void copy_ss(String *dest, String src){ copy_checked_ss(dest, src); } @@ -1342,7 +1346,7 @@ copy_ss(String *dest, String src){ #if !defined(FSTRING_GUARD) - FSTRING_INLINE void +FSTRING_INLINE void copy_sc(String *dest, char *src){ copy_partial_sc(dest, src); } @@ -1350,7 +1354,7 @@ copy_sc(String *dest, char *src){ #if defined(FSTRING_IMPLEMENTATION) - FSTRING_LINK b32_4tech +FSTRING_LINK b32_4tech append_checked_ss(String *dest, String src){ String end; end = tailstr(*dest); @@ -1364,7 +1368,7 @@ append_checked_ss(String *dest, String src){ #if defined(FSTRING_IMPLEMENTATION) - FSTRING_LINK b32_4tech +FSTRING_LINK b32_4tech append_partial_sc(String *dest, char *src){ String end = tailstr(*dest); b32_4tech result = copy_partial_sc(&end, src); @@ -1375,7 +1379,7 @@ append_partial_sc(String *dest, char *src){ #if defined(FSTRING_IMPLEMENTATION) - FSTRING_LINK b32_4tech +FSTRING_LINK b32_4tech append_partial_ss(String *dest, String src){ String end = tailstr(*dest); b32_4tech result = copy_partial_ss(&end, src); @@ -1386,7 +1390,7 @@ append_partial_ss(String *dest, String src){ #if defined(FSTRING_IMPLEMENTATION) - FSTRING_LINK b32_4tech +FSTRING_LINK b32_4tech append_s_char(String *dest, char c){ b32_4tech result = 0; if (dest->size < dest->memory_size){ @@ -1399,7 +1403,7 @@ append_s_char(String *dest, char c){ #if !defined(FSTRING_GUARD) - FSTRING_INLINE b32_4tech +FSTRING_INLINE b32_4tech append_ss(String *dest, String src){ return append_partial_ss(dest, src); } @@ -1407,14 +1411,14 @@ append_ss(String *dest, String src){ #if !defined(FSTRING_GUARD) - FSTRING_INLINE b32_4tech +FSTRING_INLINE b32_4tech append_sc(String *dest, char *src){ return append_partial_sc(dest, src); } #endif #if defined(FSTRING_IMPLEMENTATION) - FSTRING_LINK b32_4tech +FSTRING_LINK b32_4tech terminate_with_null(String *str){ b32_4tech result = 0; if (str->size < str->memory_size){ @@ -1426,7 +1430,7 @@ terminate_with_null(String *str){ #endif #if defined(FSTRING_IMPLEMENTATION) - FSTRING_LINK b32_4tech +FSTRING_LINK b32_4tech append_padding(String *dest, char c, i32_4tech target_size){ b32_4tech result = 1; i32_4tech offset = target_size - dest->size; @@ -1449,7 +1453,7 @@ append_padding(String *dest, char c, i32_4tech target_size){ // #if defined(FSTRING_IMPLEMENTATION) - FSTRING_LINK void +FSTRING_LINK void replace_char(String *str, char replace, char with){ char *s = str->str; i32_4tech i = 0; @@ -1461,7 +1465,7 @@ replace_char(String *str, char replace, char with){ #if defined(FSTRING_IMPLEMENTATION) - FSTRING_LINK void +FSTRING_LINK void to_lower_cc(char *src, char *dst){ for (; *src != 0; ++src){ *dst++ = char_to_lower(*src); @@ -1472,7 +1476,7 @@ to_lower_cc(char *src, char *dst){ #if defined(FSTRING_IMPLEMENTATION) - FSTRING_LINK void +FSTRING_LINK void to_lower_ss(String *dst, String src){ i32_4tech i = 0; i32_4tech size = src.size; @@ -1490,7 +1494,7 @@ to_lower_ss(String *dst, String src){ #if defined(FSTRING_IMPLEMENTATION) - FSTRING_LINK void +FSTRING_LINK void to_lower_s(String *str){ i32_4tech i = 0; i32_4tech size = str->size; @@ -1503,7 +1507,7 @@ to_lower_s(String *str){ #if defined(FSTRING_IMPLEMENTATION) - FSTRING_LINK void +FSTRING_LINK void to_upper_cc(char *src, char *dst){ for (; *src != 0; ++src){ *dst++ = char_to_upper(*src); @@ -1514,7 +1518,7 @@ to_upper_cc(char *src, char *dst){ #if defined(FSTRING_IMPLEMENTATION) - FSTRING_LINK void +FSTRING_LINK void to_upper_ss(String *dst, String src){ i32_4tech i = 0; i32_4tech size = src.size; @@ -1532,7 +1536,7 @@ to_upper_ss(String *dst, String src){ #if defined(FSTRING_IMPLEMENTATION) - FSTRING_LINK void +FSTRING_LINK void to_upper_s(String *str){ i32_4tech i = 0; i32_4tech size = str->size; @@ -1545,7 +1549,7 @@ to_upper_s(String *str){ #if defined(FSTRING_IMPLEMENTATION) - FSTRING_LINK void +FSTRING_LINK void to_camel_cc(char *src, char *dst){ char *c, ch; i32_4tech is_first = 1; @@ -1575,7 +1579,7 @@ to_camel_cc(char *src, char *dst){ // #if defined(FSTRING_IMPLEMENTATION) - FSTRING_LINK i32_4tech +FSTRING_LINK i32_4tech int_to_str_size(i32_4tech x){ i32_4tech size = 1; if (x < 0){ @@ -1591,7 +1595,7 @@ int_to_str_size(i32_4tech x){ #endif #if defined(FSTRING_IMPLEMENTATION) - FSTRING_LINK b32_4tech +FSTRING_LINK b32_4tech int_to_str(String *dest, i32_4tech x){ b32_4tech result = 1; char *str = dest->str; @@ -1638,7 +1642,7 @@ int_to_str(String *dest, i32_4tech x){ #endif #if defined(FSTRING_IMPLEMENTATION) - FSTRING_LINK b32_4tech +FSTRING_LINK b32_4tech append_int_to_str(String *dest, i32_4tech x){ String last_part = tailstr(*dest); b32_4tech result = int_to_str(&last_part, x); @@ -1650,7 +1654,7 @@ append_int_to_str(String *dest, i32_4tech x){ #endif #if defined(FSTRING_IMPLEMENTATION) - FSTRING_LINK i32_4tech +FSTRING_LINK i32_4tech u64_to_str_size(uint64_t x){ i32_4tech size; if (x < 0){ @@ -1669,7 +1673,7 @@ u64_to_str_size(uint64_t x){ #endif #if defined(FSTRING_IMPLEMENTATION) - FSTRING_LINK b32_4tech +FSTRING_LINK b32_4tech u64_to_str(String *dest, uint64_t x){ b32_4tech result = 1; char *str = dest->str; @@ -1708,7 +1712,7 @@ u64_to_str(String *dest, uint64_t x){ #endif #if defined(FSTRING_IMPLEMENTATION) - FSTRING_LINK b32_4tech +FSTRING_LINK b32_4tech append_u64_to_str(String *dest, uint64_t x){ String last_part = tailstr(*dest); b32_4tech result = u64_to_str(&last_part, x); @@ -1743,7 +1747,7 @@ get_float_vars(float x){ #endif #if defined(FSTRING_IMPLEMENTATION) - FSTRING_LINK i32_4tech +FSTRING_LINK i32_4tech float_to_str_size(float x){ Float_To_Str_Variables vars = get_float_vars(x); i32_4tech size = vars.negative + int_to_str_size(vars.int_part) + 1 + int_to_str_size(vars.dec_part); @@ -1752,7 +1756,7 @@ float_to_str_size(float x){ #endif #if defined(FSTRING_IMPLEMENTATION) - FSTRING_LINK b32_4tech +FSTRING_LINK b32_4tech append_float_to_str(String *dest, float x){ b32_4tech result = 1; Float_To_Str_Variables vars = get_float_vars(x); @@ -1770,7 +1774,7 @@ append_float_to_str(String *dest, float x){ #endif #if defined(FSTRING_IMPLEMENTATION) - FSTRING_LINK b32_4tech +FSTRING_LINK b32_4tech float_to_str(String *dest, float x){ b32_4tech result = 1; dest->size = 0; @@ -1781,7 +1785,7 @@ float_to_str(String *dest, float x){ #if defined(FSTRING_IMPLEMENTATION) - FSTRING_LINK i32_4tech +FSTRING_LINK i32_4tech str_is_int_c(char *str){ b32_4tech result = 1; for (; *str; ++str){ @@ -1796,7 +1800,7 @@ str_is_int_c(char *str){ #if defined(FSTRING_IMPLEMENTATION) - FSTRING_LINK b32_4tech +FSTRING_LINK b32_4tech str_is_int_s(String str){ b32_4tech result = 1; for (i32_4tech i = 0; i < str.size; ++i){ @@ -1811,7 +1815,7 @@ str_is_int_s(String str){ #if defined(FSTRING_IMPLEMENTATION) - FSTRING_LINK i32_4tech +FSTRING_LINK i32_4tech str_to_int_c(char *str){ i32_4tech x = 0; for (; *str; ++str){ @@ -1830,7 +1834,7 @@ str_to_int_c(char *str){ #if defined(FSTRING_IMPLEMENTATION) - FSTRING_LINK i32_4tech +FSTRING_LINK i32_4tech str_to_int_s(String str){ i32_4tech x, i; if (str.size == 0){ @@ -1848,7 +1852,7 @@ str_to_int_s(String str){ #endif #if defined(FSTRING_IMPLEMENTATION) - FSTRING_LINK i32_4tech +FSTRING_LINK i32_4tech hexchar_to_int(char c){ i32_4tech x = 0; if (c >= '0' && c <= '9'){ @@ -1865,14 +1869,14 @@ hexchar_to_int(char c){ #endif #if defined(FSTRING_IMPLEMENTATION) - FSTRING_LINK char +FSTRING_LINK char int_to_hexchar(i32_4tech x){ return (x<10)?((char)x+'0'):((char)x+'a'-10); } #endif #if defined(FSTRING_IMPLEMENTATION) - FSTRING_LINK u32_4tech +FSTRING_LINK u32_4tech hexstr_to_int(String str){ u32_4tech x; i32_4tech i; @@ -1891,7 +1895,7 @@ hexstr_to_int(String str){ #endif #if defined(FSTRING_IMPLEMENTATION) - FSTRING_LINK b32_4tech +FSTRING_LINK b32_4tech color_to_hexstr(String *s, u32_4tech color){ b32_4tech result = 0; i32_4tech i; @@ -1920,7 +1924,7 @@ color_to_hexstr(String *s, u32_4tech color){ #endif #if defined(FSTRING_IMPLEMENTATION) - FSTRING_LINK b32_4tech +FSTRING_LINK b32_4tech hexstr_to_color(String s, u32_4tech *out){ b32_4tech result = 0; u32_4tech color = 0; @@ -1945,7 +1949,7 @@ hexstr_to_color(String s, u32_4tech *out){ #if defined(FSTRING_IMPLEMENTATION) - FSTRING_LINK i32_4tech +FSTRING_LINK i32_4tech reverse_seek_slash_pos(String str, i32_4tech pos){ i32_4tech i = str.size - 1 - pos; while (i >= 0 && !char_is_slash(str.str[i])){ @@ -1956,21 +1960,21 @@ reverse_seek_slash_pos(String str, i32_4tech pos){ #endif #if !defined(FSTRING_GUARD) - FSTRING_INLINE i32_4tech +FSTRING_INLINE i32_4tech reverse_seek_slash(String str){ return(reverse_seek_slash_pos(str, 0)); } #endif #if !defined(FSTRING_GUARD) - FSTRING_INLINE String +FSTRING_INLINE String front_of_directory(String dir){ return substr_tail(dir, reverse_seek_slash(dir) + 1); } #endif #if !defined(FSTRING_GUARD) - FSTRING_INLINE String +FSTRING_INLINE String path_of_directory(String dir){ return substr(dir, 0, reverse_seek_slash(dir) + 1); } @@ -1978,7 +1982,7 @@ path_of_directory(String dir){ #if defined(FSTRING_IMPLEMENTATION) - FSTRING_LINK b32_4tech +FSTRING_LINK b32_4tech set_last_folder_sc(String *dir, char *folder_name, char slash){ b32_4tech result = 0; i32_4tech size = reverse_seek_slash(*dir) + 1; @@ -1997,7 +2001,7 @@ set_last_folder_sc(String *dir, char *folder_name, char slash){ #if defined(FSTRING_IMPLEMENTATION) - FSTRING_LINK b32_4tech +FSTRING_LINK b32_4tech set_last_folder_ss(String *dir, String folder_name, char slash){ b32_4tech result = 0; i32_4tech size = reverse_seek_slash(*dir) + 1; @@ -2015,7 +2019,7 @@ set_last_folder_ss(String *dir, String folder_name, char slash){ #endif #if defined(FSTRING_IMPLEMENTATION) - FSTRING_LINK String +FSTRING_LINK String file_extension(String str){ i32_4tech i; for (i = str.size - 1; i >= 0; --i){ @@ -2027,7 +2031,7 @@ file_extension(String str){ #endif #if defined(FSTRING_IMPLEMENTATION) - FSTRING_LINK b32_4tech +FSTRING_LINK b32_4tech remove_extension(String *str){ b32_4tech result = 0; i32_4tech i; @@ -2043,7 +2047,7 @@ remove_extension(String *str){ #endif #if defined(FSTRING_IMPLEMENTATION) - FSTRING_LINK b32_4tech +FSTRING_LINK b32_4tech remove_last_folder(String *str){ b32_4tech result = 0; i32_4tech end = reverse_seek_slash_pos(*str, 1); @@ -2058,7 +2062,7 @@ remove_last_folder(String *str){ // TODO(allen): Add hash-table extension to string sets. #if defined(FSTRING_IMPLEMENTATION) - FSTRING_LINK b32_4tech +FSTRING_LINK b32_4tech string_set_match_table(void *str_set, i32_4tech item_size, i32_4tech count, String str, i32_4tech *match_index){ b32_4tech result = 0; i32_4tech i = 0; @@ -2075,7 +2079,7 @@ string_set_match_table(void *str_set, i32_4tech item_size, i32_4tech count, Stri #endif #if defined(FSTRING_IMPLEMENTATION) - FSTRING_LINK b32_4tech +FSTRING_LINK b32_4tech string_set_match(String *str_set, i32_4tech count, String str, i32_4tech *match_index){ b32_4tech result = string_set_match_table(str_set, sizeof(String), count, str, match_index); return(result); @@ -2083,7 +2087,7 @@ string_set_match(String *str_set, i32_4tech count, String str, i32_4tech *match_ #endif #if defined(FSTRING_IMPLEMENTATION) - FSTRING_LINK String +FSTRING_LINK String get_first_double_line(String source){ String line = {0}; i32_4tech pos0 = find_substr_s(source, 0, make_lit_string("\n\n")); @@ -2097,7 +2101,7 @@ get_first_double_line(String source){ #endif #if defined(FSTRING_IMPLEMENTATION) - FSTRING_LINK String +FSTRING_LINK String get_next_double_line(String source, String line){ String next = {0}; i32_4tech pos = (i32_4tech)(line.str - source.str) + line.size; @@ -2122,7 +2126,7 @@ get_next_double_line(String source, String line){ #endif #if defined(FSTRING_IMPLEMENTATION) - FSTRING_LINK String +FSTRING_LINK String get_next_word(String source, String prev_word){ String word = {0}; @@ -2153,7 +2157,7 @@ get_next_word(String source, String prev_word){ #endif #if defined(FSTRING_IMPLEMENTATION) - FSTRING_LINK String +FSTRING_LINK String get_first_word(String source){ String start_str = make_string(source.str, 0); String word = get_next_word(source, start_str); diff --git a/4coder_lib/4coder_table.h b/4coder_lib/4coder_table.h index 17e9bce4..e04df977 100644 --- a/4coder_lib/4coder_table.h +++ b/4coder_lib/4coder_table.h @@ -26,7 +26,11 @@ typedef uint16_t u16_4tech; typedef uint32_t u32_4tech; typedef uint64_t u64_4tech; +#if defined(FTECH_32_BIT) +typedef u32_4tech umem_4tech; +#else typedef u64_4tech umem_4tech; +#endif typedef float f32_4tech; typedef double f64_4tech; diff --git a/4coder_lib/4coder_utf8.h b/4coder_lib/4coder_utf8.h index 0cb1495f..4a18eded 100644 --- a/4coder_lib/4coder_utf8.h +++ b/4coder_lib/4coder_utf8.h @@ -26,7 +26,11 @@ typedef uint16_t u16_4tech; typedef uint32_t u32_4tech; typedef uint64_t u64_4tech; +#if defined(FTECH_32_BIT) +typedef u32_4tech umem_4tech; +#else typedef u64_4tech umem_4tech; +#endif typedef float f32_4tech; typedef double f64_4tech; diff --git a/power/4coder_sticky_jump.cpp b/4coder_sticky_jump.cpp similarity index 100% rename from power/4coder_sticky_jump.cpp rename to 4coder_sticky_jump.cpp diff --git a/4cpp/4cpp_lexer.h b/4cpp/4cpp_lexer.h index 1f373b03..0cbb80b8 100644 --- a/4cpp/4cpp_lexer.h +++ b/4cpp/4cpp_lexer.h @@ -26,7 +26,11 @@ typedef uint16_t u16_4tech; typedef uint32_t u32_4tech; typedef uint64_t u64_4tech; +#if defined(FTECH_32_BIT) +typedef u32_4tech umem_4tech; +#else typedef u64_4tech umem_4tech; +#endif typedef float f32_4tech; typedef double f64_4tech; @@ -1774,8 +1778,8 @@ DOC_SEE(cpp_make_token_array) umem_4tech keywords_memsize = cpp_get_table_memory_size_default(CPP_TABLE_KEYWORDS); umem_4tech preprocessor_words_memsize = cpp_get_table_memory_size_default(CPP_TABLE_PREPROCESSOR_DIRECTIVES); - void *keywords_mem = malloc(keywords_memsize); - void *preprocessor_words_mem = malloc(preprocessor_words_memsize); + void *keywords_mem = malloc((size_t)keywords_memsize); + void *preprocessor_words_mem = malloc((size_t)preprocessor_words_memsize); Cpp_Keyword_Table keywords = cpp_make_table_default(CPP_TABLE_KEYWORDS, keywords_mem, keywords_memsize); Cpp_Keyword_Table preprocessor_words = cpp_make_table_default(CPP_TABLE_PREPROCESSOR_DIRECTIVES, preprocessor_words_mem, preprocessor_words_memsize); diff --git a/4ed_api_implementation.cpp b/4ed_api_implementation.cpp index 116a0c9b..6533c713 100644 --- a/4ed_api_implementation.cpp +++ b/4ed_api_implementation.cpp @@ -476,12 +476,15 @@ internal_get_buffer_first(Working_Set *working_set, Buffer_Summary *buffer){ internal void internal_get_buffer_next(Working_Set *working_set, Buffer_Summary *buffer){ - Editing_File *file; - - file = working_set_get_active_file(working_set, buffer->buffer_id); + Editing_File *file = working_set_get_active_file(working_set, buffer->buffer_id); if (file){ file = (Editing_File*)file->node.next; - fill_buffer_summary(buffer, file, working_set); + if (file != (Editing_File*)&working_set->used_sentinel){ + fill_buffer_summary(buffer, file, working_set); + } + else{ + *buffer = null_buffer_summary; + } } else{ *buffer = null_buffer_summary; diff --git a/4ed_app_target.cpp b/4ed_app_target.cpp index 67eddfd0..b6160a5b 100644 --- a/4ed_app_target.cpp +++ b/4ed_app_target.cpp @@ -22,7 +22,7 @@ #include "4ed_system.h" #include "4ed_profile.h" -//#define USE_DEBUG_MEMORY +#define USE_DEBUG_MEMORY #define FSTRING_IMPLEMENTATION #define FSTRING_C diff --git a/4ed_debug_mem.h b/4ed_debug_mem.h index 5d808a3b..4f5cbd73 100644 --- a/4ed_debug_mem.h +++ b/4ed_debug_mem.h @@ -31,17 +31,17 @@ debug_gm_open(System_Functions *system, Debug_GM *general, void *memory, i32 siz static void* debug_gm_allocate(Debug_GM *general, int32_t size){ System_Functions *system = general->system; - persist u32 round_val = OS_PAGE_SIZE-1; + local_persist u32 round_val = OS_PAGE_SIZE-1; size = (size + round_val) & (~round_val); - void *result = system->memory_allocate(0, size + OS_PAGE_SIZE); - system->memory_set_protection(0, (u8*)result + size, OS_PAGE_SIZE, 0); + void *result = system->memory_allocate(size + OS_PAGE_SIZE); + system->memory_set_protection((u8*)result + size, OS_PAGE_SIZE, 0); return(result); } static void debug_gm_free(Debug_GM *general, void *memory){ System_Functions *system = general->system; - system->memory_free(0, memory, 0); + system->memory_free(memory, 0); } static void* diff --git a/4ed_file_view.cpp b/4ed_file_view.cpp index 15bf77cb..917118a7 100644 --- a/4ed_file_view.cpp +++ b/4ed_file_view.cpp @@ -995,6 +995,7 @@ struct Code_Wrap_State{ Code_Wrap_X plane_wrap_x; i32 *line_starts; + i32 line_count; i32 line_index; i32 next_line_start; @@ -1023,6 +1024,7 @@ wrap_state_init(System_Functions *system, Code_Wrap_State *state, Editing_File * state->end_token = state->token_ptr + state->token_array.count; state->line_starts = file->state.buffer.line_starts; + state->line_count = file->state.buffer.line_count; state->next_line_start = state->line_starts[1]; Gap_Buffer *buffer = &file->state.buffer; @@ -1102,9 +1104,17 @@ wrap_state_consume_token(System_Functions *system, Render_Font *font, Code_Wrap_ } // TODO(allen): exponential search this shit! - while (i >= state->next_line_start){ - ++state->line_index; - state->next_line_start = state->line_starts[state->line_index + 1]; + for (;i >= state->next_line_start;){ + state->next_line_start = state->size; + if (state->line_index < state->line_count){ + ++state->line_index; + if (state->line_index + 1 < state->line_count){ + state->next_line_start = state->line_starts[state->line_index + 1]; + } + } + else{ + break; + } } i32 line_start = state->line_starts[state->line_index]; @@ -1220,6 +1230,9 @@ wrap_state_consume_token(System_Functions *system, Render_Font *font, Code_Wrap_ } ++state->token_ptr; + if (state->token_ptr > state->end_token){ + state->token_ptr = state->end_token; + } } result.position_end = state->i; @@ -2125,7 +2138,7 @@ Job_Callback_Sig(job_full_lex){ Gap_Buffer *buffer = &file->state.buffer; i32 text_size = buffer_size(buffer); - i32 aligned_buffer_size = (text_size + 3)&(~3); + u32 aligned_buffer_size = (text_size + 3)&(~3); for (;memory->size < aligned_buffer_size + parse_context.memory_size;){ void *old_base = memory->data; @@ -2189,8 +2202,7 @@ Job_Callback_Sig(job_full_lex){ data_size -= parse_context.memory_size; tokens.tokens = (Cpp_Token*)(data_ptr); tokens.max_count = (u32)(data_size / sizeof(Cpp_Token)); - } - break; + }break; case LexResult_HitTokenLimit: { diff --git a/4ed_site.ctm b/4ed_site.ctm index 717429fd..201ff961 100644 Binary files a/4ed_site.ctm and b/4ed_site.ctm differ diff --git a/4ed_system.h b/4ed_system.h index 6251ae76..3ca07e23 100644 --- a/4ed_system.h +++ b/4ed_system.h @@ -136,8 +136,8 @@ enum Thread_Group_ID{ struct Thread_Memory{ void *data; - i32 size; - i32 id; + u32 size; + u32 id; }; global Thread_Memory null_thread_memory = {0}; diff --git a/meta/build.cpp b/meta/build.cpp index 09bc324a..df0b8f14 100644 --- a/meta/build.cpp +++ b/meta/build.cpp @@ -485,8 +485,9 @@ static void standard_build(char *cdir, u32 flags){ fsm_generator(cdir); metagen(cdir); + do_buildsuper(cdir, Custom_Default, flags); //do_buildsuper(cdir, Custom_Experiments, flags); - do_buildsuper(cdir, Custom_Casey, flags); + //do_buildsuper(cdir, Custom_Casey, flags); //do_buildsuper(cdir, Custom_ChronalVim, flags); build_main(cdir, flags); } diff --git a/meta/fsm_table_generator.cpp b/meta/fsm_table_generator.cpp index 52132479..6ed167c7 100644 --- a/meta/fsm_table_generator.cpp +++ b/meta/fsm_table_generator.cpp @@ -21,7 +21,11 @@ typedef uint16_t u16_4tech; typedef uint32_t u32_4tech; typedef uint64_t u64_4tech; +#if defined(FTECH_32_BIT) +typedef u32_4tech umem_4tech; +#else typedef u64_4tech umem_4tech; +#endif typedef float f32_4tech; typedef double f64_4tech; diff --git a/power/4coder_experiments.cpp b/power/4coder_experiments.cpp index 8f6cbf31..aedd58fa 100644 --- a/power/4coder_experiments.cpp +++ b/power/4coder_experiments.cpp @@ -9,11 +9,8 @@ TYPE: 'build-target' #if !defined(FCODER_EXPERIMENTS_CPP) #define FCODER_EXPERIMENTS_CPP -#define FCODER_JUMP_COMMANDS #include "4coder_default_include.cpp" #include "4coder_miblo_numbers.cpp" -#undef FCODER_JUMP_COMMANDS -#include "4coder_sticky_jump.cpp" #define NO_BINDING #include "4coder_default_bindings.cpp" diff --git a/string/4tech_standard_preamble.h b/string/4tech_standard_preamble.h index 5be1182f..b6ae1e23 100644 --- a/string/4tech_standard_preamble.h +++ b/string/4tech_standard_preamble.h @@ -12,7 +12,11 @@ typedef uint16_t u16_4tech; typedef uint32_t u32_4tech; typedef uint64_t u64_4tech; +#if defined(FTECH_32_BIT) +typedef u32_4tech umem_4tech; +#else typedef u64_4tech umem_4tech; +#endif typedef float f32_4tech; typedef double f64_4tech;