fstr_bool string_set_match(
String *str_set,
int32_t count,
String str,
int32_t *match_index
)
diff --git a/4coder_jump_parsing.cpp b/4coder_jump_parsing.cpp
index ef777140..45bc81fa 100644
--- a/4coder_jump_parsing.cpp
+++ b/4coder_jump_parsing.cpp
@@ -36,55 +36,65 @@ parse_error(String line, Jump_Location *location,
String original_line = line;
line = skip_chop_whitespace(line);
-
- int32_t colon_pos = find_s_char(line, 0, ')');
- if (ms_style_verify(line, colon_pos)){
- colon_pos = find_s_char(line, colon_pos, ':');
- if (colon_pos < line.size){
- String location_str = substr(line, 0, colon_pos);
-
- if (!(skip_sub_errors && original_line.str[0] == ' ')){
- location_str = skip_chop_whitespace(location_str);
+
+ int32_t colon_pos = 0;
+ int32_t is_ms_style = 0;
+
+ int32_t paren_pos = find_s_char(line, 0, ')');
+ while (!is_ms_style && paren_pos < line.size){
+ if (ms_style_verify(line, paren_pos)){
+ is_ms_style = 1;
+ colon_pos = find_s_char(line, paren_pos, ':');
+ if (colon_pos < line.size){
+ String location_str = substr(line, 0, colon_pos);
- int32_t paren_pos = find_s_char(location_str, 0, '(');
- if (paren_pos < location_str.size){
- String file = substr(location_str, 0, paren_pos);
- file = skip_chop_whitespace(file);
+ if (!(skip_sub_errors && original_line.str[0] == ' ')){
+ location_str = skip_chop_whitespace(location_str);
- int32_t close_pos = find_s_char(location_str, 0, ')') + 1;
- if (close_pos == location_str.size && file.size > 0){
- String line_number = substr(location_str,
- paren_pos+1,
- close_pos-paren_pos-2);
- line_number = skip_chop_whitespace(line_number);
+ int32_t close_pos = paren_pos;
+ int32_t open_pos = rfind_s_char(location_str, close_pos, '(');
+
+ if (0 < open_pos && open_pos < location_str.size){
+ String file = substr(location_str, 0, open_pos);
+ file = skip_chop_whitespace(file);
- if (line_number.size > 0){
- location->file = file;
+ if (file.size > 0){
+ String line_number = substr(location_str,
+ open_pos+1,
+ close_pos-open_pos-1);
+ line_number = skip_chop_whitespace(line_number);
- int32_t comma_pos = find_s_char(line_number, 0, ',');
- if (comma_pos < line_number.size){
- int32_t start = comma_pos+1;
- String column_number = substr(line_number, start, line_number.size-start);
- line_number = substr(line_number, 0, comma_pos);
+ if (line_number.size > 0){
+ location->file = file;
- location->line = str_to_int_s(line_number);
- location->column = str_to_int_s(column_number);
+ int32_t comma_pos = find_s_char(line_number, 0, ',');
+ if (comma_pos < line_number.size){
+ int32_t start = comma_pos+1;
+ String column_number = substr(line_number, start, line_number.size-start);
+ line_number = substr(line_number, 0, comma_pos);
+
+ location->line = str_to_int_s(line_number);
+ location->column = str_to_int_s(column_number);
+ }
+ else{
+ location->line = str_to_int_s(line_number);
+ location->column = 1;
+ }
+
+ *colon_char = colon_pos;
+ result = true;
}
- else{
- location->line = str_to_int_s(line_number);
- location->column = 1;
- }
-
- *colon_char = colon_pos;
- result = true;
}
}
}
}
}
+ else{
+ paren_pos = find_s_char(line, paren_pos+1, ')');
+ }
}
- else{
+ if (!is_ms_style){
int32_t colon_pos1 = find_s_char(line, 0, ':');
if (line.size > colon_pos1+1){
if (char_is_slash(line.str[colon_pos1+1])){
diff --git a/4coder_string.h b/4coder_string.h
index fd955d66..451b7f41 100644
--- a/4coder_string.h
+++ b/4coder_string.h
@@ -103,6 +103,7 @@ FSTRING_INLINE int32_t compare_cs(char *a, String b);
FSTRING_LINK int32_t compare_ss(String a, String b);
FSTRING_LINK int32_t find_c_char(char *str, int32_t start, char character);
FSTRING_LINK int32_t find_s_char(String str, int32_t start, char character);
+FSTRING_LINK int32_t rfind_s_char(String str, int32_t start, char character);
FSTRING_LINK int32_t find_c_chars(char *str, int32_t start, char *characters);
FSTRING_LINK int32_t find_s_chars(String str, int32_t start, char *characters);
FSTRING_LINK int32_t find_substr_c(char *str, int32_t start, String seek);
@@ -192,6 +193,7 @@ FSTRING_INLINE int32_t compare(char *a, String b);
FSTRING_INLINE int32_t compare(String a, String b);
FSTRING_INLINE int32_t find(char *str, int32_t start, char character);
FSTRING_INLINE int32_t find(String str, int32_t start, char character);
+FSTRING_INLINE int32_t rfind(String str, int32_t start, char character);
FSTRING_INLINE int32_t find(char *str, int32_t start, char *characters);
FSTRING_INLINE int32_t find(String str, int32_t start, char *characters);
FSTRING_INLINE int32_t find_substr(char *str, int32_t start, String seek);
@@ -288,6 +290,8 @@ find(char *str, int32_t start, char character){return(find_c_char(str,start,char
FSTRING_INLINE int32_t
find(String str, int32_t start, char character){return(find_s_char(str,start,character));}
FSTRING_INLINE int32_t
+rfind(String str, int32_t start, char character){return(rfind_s_char(str,start,character));}
+FSTRING_INLINE int32_t
find(char *str, int32_t start, char *characters){return(find_c_chars(str,start,characters));}
FSTRING_INLINE int32_t
find(String str, int32_t start, char *characters){return(find_s_chars(str,start,characters));}
@@ -825,10 +829,10 @@ FSTRING_LINK fstr_bool
match_part_insensitive_cs(char *a, String b){
for (int32_t i = 0; i != b.size; ++i){
if (char_to_upper(a[i]) != char_to_upper(b.str[i])){
- return 0;
+ return(0);
}
}
- return 1;
+ return(1);
}
#endif
@@ -837,14 +841,14 @@ match_part_insensitive_cs(char *a, String b){
FSTRING_LINK fstr_bool
match_part_insensitive_ss(String a, String b){
if (a.size < b.size){
- return 0;
+ return(0);
}
for (int32_t i = 0; i < b.size; ++i){
if (char_to_upper(a.str[i]) != char_to_upper(b.str[i])){
- return 0;
+ return(0);
}
}
- return 1;
+ return(1);
}
#endif
@@ -852,11 +856,12 @@ match_part_insensitive_ss(String a, String b){
#if defined(FSTRING_IMPLEMENTATION)
FSTRING_LINK int32_t
compare_cc(char *a, char *b){
- int32_t i = 0;
+ int32_t i = 0, r = 0;
while (a[i] == b[i] && a[i] != 0){
++i;
}
- return (a[i] > b[i]) - (a[i] < b[i]);
+ r = (a[i] > b[i]) - (a[i] < b[i]);
+ return(r);
}
#endif
@@ -864,21 +869,22 @@ compare_cc(char *a, char *b){
#if defined(FSTRING_IMPLEMENTATION)
FSTRING_LINK int32_t
compare_sc(String a, char *b){
- int32_t i = 0;
+ int32_t i = 0, r = 0;
while (i < a.size && a.str[i] == b[i]){
++i;
}
if (i < a.size){
- return (a.str[i] > b[i]) - (a.str[i] < b[i]);
+ r = (a.str[i] > b[i]) - (a.str[i] < b[i]);
}
else{
if (b[i] == 0){
- return 0;
+ r = 0;
}
else{
- return -1;
+ r = -1;
}
}
+ return(r);
}
#endif
@@ -886,7 +892,8 @@ compare_sc(String a, char *b){
#if !defined(FSTRING_GUARD)
FSTRING_INLINE int32_t
compare_cs(char *a, String b){
- return -compare_sc(b,a);
+ int32_t r = -compare_sc(b,a);
+ return(r);
}
#endif
@@ -894,16 +901,23 @@ compare_cs(char *a, String b){
#if defined(FSTRING_IMPLEMENTATION)
FSTRING_LINK int32_t
compare_ss(String a, String b){
- int32_t i = 0;
- while (i < a.size && i < b.size && a.str[i] == b.str[i]){
+ int32_t i = 0, r = 0;
+ int32_t m = a.size;
+ if (b.size < m){
+ m = b.size;
+ }
+ while (i < m && a.str[i] == b.str[i]){
++i;
}
- if (i < a.size && i < b.size){
- return (a.str[i] > b.str[i]) - (a.str[i] < b.str[i]);
+
+ if (i < m){
+ r = (a.str[i] > b.str[i]) - (b.str[i] > a.str[i]);
}
else{
- return (a.size > b.size) - (a.size < b.size);
+ r = (a.size > b.size) - (a.size < b.size);
}
+
+ return(r);
}
#endif
@@ -917,7 +931,7 @@ FSTRING_LINK int32_t
find_c_char(char *str, int32_t start, char character){
int32_t i = start;
while (str[i] != character && str[i] != 0) ++i;
- return i;
+ return(i);
}
#endif
@@ -927,7 +941,17 @@ FSTRING_LINK int32_t
find_s_char(String str, int32_t start, char character){
int32_t i = start;
while (i < str.size && str.str[i] != character) ++i;
- return i;
+ return(i);
+}
+#endif
+
+
+#if defined(FSTRING_IMPLEMENTATION)
+FSTRING_LINK int32_t
+rfind_s_char(String str, int32_t start, char character){
+ int32_t i = start;
+ while (i >= 0 && str.str[i] != character) --i;
+ return(i);
}
#endif
@@ -939,12 +963,12 @@ find_c_chars(char *str, int32_t start, char *characters){
while (str[i] != 0){
for (j = 0; characters[j]; ++j){
if (str[i] == characters[j]){
- return i;
+ return(i);
}
}
++i;
}
- return i;
+ return(i);
}
#endif
@@ -956,12 +980,12 @@ find_s_chars(String str, int32_t start, char *characters){
while (i < str.size){
for (j = 0; characters[j]; ++j){
if (str.str[i] == characters[j]){
- return i;
+ return(i);
}
}
++i;
}
- return i;
+ return(i);
}
#endif
@@ -973,7 +997,8 @@ find_substr_c(char *str, int32_t start, String seek){
fstr_bool hit;
if (seek.size == 0){
- return str_size(str);
+ i = str_size(str);
+ return(i);
}
for (i = start; str[i]; ++i){
if (str[i] == seek.str[0]){
@@ -985,11 +1010,11 @@ find_substr_c(char *str, int32_t start, String seek){
}
}
if (hit){
- return i;
+ return(i);
}
}
}
- return i;
+ return(i);
}
#endif
@@ -1018,7 +1043,7 @@ find_substr_s(String str, int32_t start, String seek){
}
}
}
- return str.size;
+ return(str.size);
}
#endif
diff --git a/TODO.txt b/TODO.txt
index 16dee005..1448931e 100644
--- a/TODO.txt
+++ b/TODO.txt
@@ -70,14 +70,14 @@
; [X] key presses that should be consumed in the GUI are now passed to the file!
; [X] paste snaps the cursor back into view!
; [X] clean whitespace doesn't appear to be cleaning trailing whitespace anymore???
+; [X] problem with end of line comments
;
; [] indication on failure to save
; [] history is broken, revist the entire system
;
-; [] 8.0\Include\um\dsound.h
-; [] paths with parens in them
-; [] double check end of line comments
-; [] paste external text from bug report (in email) (not repod, get more info)
+; [] 8.0\Include\um\dsound.h (not reproduced, get more info)
+; [] paths with parens in them
+; [] paste external text from bug report (in email) (not reproduced, get more info)
;
;
diff --git a/internal_4coder_string.cpp b/internal_4coder_string.cpp
index 9a749e9e..ffee550e 100644
--- a/internal_4coder_string.cpp
+++ b/internal_4coder_string.cpp
@@ -511,10 +511,10 @@ DOC(This call performs the same partial matching rule as match_part under case i
DOC_SEE(match_part) */{
for (int32_t i = 0; i != b.size; ++i){
if (char_to_upper(a[i]) != char_to_upper(b.str[i])){
- return 0;
+ return(0);
}
}
- return 1;
+ return(1);
}
CPP_NAME(match_part_insensitive)
@@ -523,14 +523,14 @@ match_part_insensitive_ss(String a, String b)/*
DOC(This call performs the same partial matching rule as match_part under case insensitive comparison.)
DOC_SEE(match_part) */{
if (a.size < b.size){
- return 0;
+ return(0);
}
for (int32_t i = 0; i < b.size; ++i){
if (char_to_upper(a.str[i]) != char_to_upper(b.str[i])){
- return 0;
+ return(0);
}
}
- return 1;
+ return(1);
}
CPP_NAME(compare)
@@ -539,11 +539,12 @@ compare_cc(char *a, char *b)/*
DOC(This call returns zero if a and b are equivalent,
it returns negative if a sorts before b alphabetically,
and positive if a sorts after b alphabetically.) */{
- int32_t i = 0;
+ int32_t i = 0, r = 0;
while (a[i] == b[i] && a[i] != 0){
++i;
}
- return (a[i] > b[i]) - (a[i] < b[i]);
+ r = (a[i] > b[i]) - (a[i] < b[i]);
+ return(r);
}
CPP_NAME(compare)
@@ -552,21 +553,22 @@ compare_sc(String a, char *b)/*
DOC(This call returns zero if a and b are equivalent,
it returns negative if a sorts before b alphabetically,
and positive if a sorts after b alphabetically.) */{
- int32_t i = 0;
+ int32_t i = 0, r = 0;
while (i < a.size && a.str[i] == b[i]){
++i;
}
if (i < a.size){
- return (a.str[i] > b[i]) - (a.str[i] < b[i]);
+ r = (a.str[i] > b[i]) - (a.str[i] < b[i]);
}
else{
if (b[i] == 0){
- return 0;
+ r = 0;
}
else{
- return -1;
+ r = -1;
}
}
+ return(r);
}
CPP_NAME(compare)
@@ -575,7 +577,8 @@ compare_cs(char *a, String b)/*
DOC(This call returns zero if a and b are equivalent,
it returns negative if a sorts before b alphabetically,
and positive if a sorts after b alphabetically.) */{
- return -compare_sc(b,a);
+ int32_t r = -compare_sc(b,a);
+ return(r);
}
CPP_NAME(compare)
@@ -584,16 +587,23 @@ compare_ss(String a, String b)/*
DOC(This call returns zero if a and b are equivalent,
it returns negative if a sorts before b alphabetically,
and positive if a sorts after b alphabetically.) */{
- int32_t i = 0;
- while (i < a.size && i < b.size && a.str[i] == b.str[i]){
+ int32_t i = 0, r = 0;
+ int32_t m = a.size;
+ if (b.size < m){
+ m = b.size;
+ }
+ while (i < m && a.str[i] == b.str[i]){
++i;
}
- if (i < a.size && i < b.size){
- return (a.str[i] > b.str[i]) - (a.str[i] < b.str[i]);
+
+ if (i < m){
+ r = (a.str[i] > b.str[i]) - (b.str[i] > a.str[i]);
}
else{
- return (a.size > b.size) - (a.size < b.size);
+ r = (a.size > b.size) - (a.size < b.size);
}
+
+ return(r);
}
//
@@ -610,7 +620,7 @@ DOC(This call returns the index of the first occurance of character, or the size
if the character is not found.) */{
int32_t i = start;
while (str[i] != character && str[i] != 0) ++i;
- return i;
+ return(i);
}
CPP_NAME(find)
@@ -623,7 +633,20 @@ DOC(This call returns the index of the first occurance of character, or the size
if the character is not found.) */{
int32_t i = start;
while (i < str.size && str.str[i] != character) ++i;
- return i;
+ return(i);
+}
+
+CPP_NAME(rfind)
+FSTRING_LINK int32_t
+rfind_s_char(String str, int32_t start, char character)/*
+DOC_PARAM(str, The str parameter provides a string to search.)
+DOC_PARAM(start, The start parameter provides the index of the first character in str to search.)
+DOC_PARAM(character, The character parameter provides the character for which to search.)
+DOC(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.) */{
+ int32_t i = start;
+ while (i >= 0 && str.str[i] != character) --i;
+ return(i);
}
CPP_NAME(find)
@@ -638,12 +661,12 @@ or the size of the string if no such character is not found.) */{
while (str[i] != 0){
for (j = 0; characters[j]; ++j){
if (str[i] == characters[j]){
- return i;
+ return(i);
}
}
++i;
}
- return i;
+ return(i);
}
CPP_NAME(find)
@@ -658,12 +681,12 @@ or the size of the string if no such character is not found.) */{
while (i < str.size){
for (j = 0; characters[j]; ++j){
if (str.str[i] == characters[j]){
- return i;
+ return(i);
}
}
++i;
}
- return i;
+ return(i);
}
CPP_NAME(find_substr)
@@ -678,7 +701,8 @@ size of str if no such substring in str is found.) */{
fstr_bool hit;
if (seek.size == 0){
- return str_size(str);
+ i = str_size(str);
+ return(i);
}
for (i = start; str[i]; ++i){
if (str[i] == seek.str[0]){
@@ -690,11 +714,11 @@ size of str if no such substring in str is found.) */{
}
}
if (hit){
- return i;
+ return(i);
}
}
}
- return i;
+ return(i);
}
CPP_NAME(find_substr)
@@ -726,7 +750,7 @@ size of str if no such substring in str is found.) */{
}
}
}
- return str.size;
+ return(str.size);
}
CPP_NAME(rfind_substr)