C version of string library, C++ version preserved

master
Allen Webster 2016-08-28 00:31:06 -04:00
parent f7a2affb9f
commit 8e81ae82e0
27 changed files with 1691 additions and 884 deletions

View File

@ -22,7 +22,7 @@ ul { list-style: none; padding: 0; margin: 0; }
<h2 id='section_introduction'>&sect;1 Introduction</h2>
<div>
<p>
This is the documentation for alpha 4.0.10 super! 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. </p>
This is the documentation for alpha 4.0.10 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. </p>
<p>
If you have questions or discover errors please contact <span style='font-family: "Courier New", Courier, monospace; text-align: left;'>editor@4coder.net</span> or to get help from community members you can post on the 4coder forums hosted on handmade.network at <span style='font-family: "Courier New", Courier, monospace; text-align: left;'>4coder.handmade.network</span></p>
</div>
@ -550,7 +550,7 @@ the filename does not correspond to a file on disk the buffer is created empty.<
<div style='font-weight: 600;'>flags</div>
<div style='margin-bottom: 6mm;'><div style='margin-left: 5mm; margin-right: 5mm;'>The flags parameter specifies behaviors for the buffer kill.</div></div>
</div>
<div style='margin-top: 3mm; margin-bottom: 3mm; color: #309030;'><b><i>Return</i></b></div><div style='margin-left: 5mm; margin-right: 5mm;'>This call returns non-zero on success.</div><div style='margin-top: 3mm; margin-bottom: 3mm; color: #309030;'><b><i>Description</i></b></div><div style='margin-left: 5mm; margin-right: 5mm;'>Tries to kill the idenfied buffer. If the buffer is dirty and the "are you sure"
<div style='margin-top: 3mm; margin-bottom: 3mm; color: #309030;'><b><i>Return</i></b></div><div style='margin-left: 5mm; margin-right: 5mm;'>This call returns non-zero if the buffer is killed.</div><div style='margin-top: 3mm; margin-bottom: 3mm; color: #309030;'><b><i>Description</i></b></div><div style='margin-left: 5mm; margin-right: 5mm;'>Tries to kill the idenfied buffer. If the buffer is dirty and the "are you sure"
dialogue needs to be displayed the provided view is used to show the dialogue.
If the view is not open the kill fails.</div><div style='margin-top: 3mm; margin-bottom: 3mm; color: #309030;'><b><i>See Also</i></b></div><div style='margin-left: 5mm; margin-right: 5mm;'><a href='#Buffer_Kill_Flag_doc'>Buffer_Kill_Flag</a></div><div style='margin-left: 5mm; margin-right: 5mm;'><a href='#Buffer_Identifier_doc'>Buffer_Identifier</a></div></div><hr>
<div id='get_view_first_doc' style='margin-bottom: 1cm;'>
@ -2285,35 +2285,70 @@ Coming Soon</i><div>
<li><a href='#char_is_hex_str_doc'>char_is_hex</a></li>
<li><a href='#char_is_numeric_str_doc'>char_is_numeric</a></li>
<li><a href='#string_zero_str_doc'>string_zero</a></li>
<li><a href='#make_string_cap_str_doc'>make_string_cap</a></li>
<li><a href='#make_string_str_doc'>make_string</a></li>
<li><a href='#make_lit_string_str_doc'>make_lit_string</a></li>
<li><a href='#make_fixed_width_string_str_doc'>make_fixed_width_string</a></li>
<li><a href='#expand_str_str_doc'>expand_str</a></li>
<li><a href='#str_size_str_doc'>str_size</a></li>
<li><a href='#make_string_slowly_str_doc'>make_string_slowly</a></li>
<li><a href='#substr_tail_str_doc'>substr_tail</a></li>
<li><a href='#substr_str_doc'>substr</a></li>
<li><a href='#skip_whitespace_str_doc'>skip_whitespace</a></li>
<li><a href='#chop_whitespace_str_doc'>chop_whitespace</a></li>
<li><a href='#skip_chop_whitespace_str_doc'>skip_chop_whitespace</a></li>
<li><a href='#tailstr_str_doc'>tailstr</a></li>
<li><a href='#match_str_doc'>match</a></li>
<li><a href='#match_part_str_doc'>match_part</a></li>
<li><a href='#match_insensitive_str_doc'>match_insensitive</a></li>
<li><a href='#match_part_insensitive_str_doc'>match_part_insensitive</a></li>
<li><a href='#compare_str_doc'>compare</a></li>
<li><a href='#find_str_doc'>find</a></li>
<li><a href='#find_substr_str_doc'>find_substr</a></li>
<li><a href='#rfind_substr_str_doc'>rfind_substr</a></li>
<li><a href='#find_substr_insensitive_str_doc'>find_substr_insensitive</a></li>
<li><a href='#has_substr_str_doc'>has_substr</a></li>
<li><a href='#has_substr_insensitive_str_doc'>has_substr_insensitive</a></li>
<li><a href='#copy_fast_unsafe_str_doc'>copy_fast_unsafe</a></li>
<li><a href='#copy_checked_str_doc'>copy_checked</a></li>
<li><a href='#copy_partial_str_doc'>copy_partial</a></li>
<li><a href='#copy_str_doc'>copy</a></li>
<li><a href='#append_checked_str_doc'>append_checked</a></li>
<li><a href='#append_partial_str_doc'>append_partial</a></li>
<li><a href='#append_str_doc'>append</a></li>
<li><a href='#match_cc_str_doc'>match_cc</a></li>
<li><a href='#match_sc_str_doc'>match_sc</a></li>
<li><a href='#match_cs_str_doc'>match_cs</a></li>
<li><a href='#match_ss_str_doc'>match_ss</a></li>
<li><a href='#match_part_ccl_str_doc'>match_part_ccl</a></li>
<li><a href='#match_part_scl_str_doc'>match_part_scl</a></li>
<li><a href='#match_part_cc_str_doc'>match_part_cc</a></li>
<li><a href='#match_part_sc_str_doc'>match_part_sc</a></li>
<li><a href='#match_part_cs_str_doc'>match_part_cs</a></li>
<li><a href='#match_part_ss_str_doc'>match_part_ss</a></li>
<li><a href='#match_insensitive_cc_str_doc'>match_insensitive_cc</a></li>
<li><a href='#match_insensitive_sc_str_doc'>match_insensitive_sc</a></li>
<li><a href='#match_insensitive_cs_str_doc'>match_insensitive_cs</a></li>
<li><a href='#match_insensitive_ss_str_doc'>match_insensitive_ss</a></li>
<li><a href='#match_part_insensitive_ccl_str_doc'>match_part_insensitive_ccl</a></li>
<li><a href='#match_part_insensitive_scl_str_doc'>match_part_insensitive_scl</a></li>
<li><a href='#match_part_insensitive_cc_str_doc'>match_part_insensitive_cc</a></li>
<li><a href='#match_part_insensitive_sc_str_doc'>match_part_insensitive_sc</a></li>
<li><a href='#match_part_insensitive_cs_str_doc'>match_part_insensitive_cs</a></li>
<li><a href='#match_part_insensitive_ss_str_doc'>match_part_insensitive_ss</a></li>
<li><a href='#compare_cc_str_doc'>compare_cc</a></li>
<li><a href='#compare_sc_str_doc'>compare_sc</a></li>
<li><a href='#compare_cs_str_doc'>compare_cs</a></li>
<li><a href='#compare_ss_str_doc'>compare_ss</a></li>
<li><a href='#find_c_char_str_doc'>find_c_char</a></li>
<li><a href='#find_s_char_str_doc'>find_s_char</a></li>
<li><a href='#find_c_chars_str_doc'>find_c_chars</a></li>
<li><a href='#find_s_chars_str_doc'>find_s_chars</a></li>
<li><a href='#find_substr_c_str_doc'>find_substr_c</a></li>
<li><a href='#find_substr_s_str_doc'>find_substr_s</a></li>
<li><a href='#rfind_substr_s_str_doc'>rfind_substr_s</a></li>
<li><a href='#find_substr_insensitive_c_str_doc'>find_substr_insensitive_c</a></li>
<li><a href='#find_substr_insensitive_s_str_doc'>find_substr_insensitive_s</a></li>
<li><a href='#has_substr_c_str_doc'>has_substr_c</a></li>
<li><a href='#has_substr_s_str_doc'>has_substr_s</a></li>
<li><a href='#has_substr_insensitive_c_str_doc'>has_substr_insensitive_c</a></li>
<li><a href='#has_substr_insensitive_s_str_doc'>has_substr_insensitive_s</a></li>
<li><a href='#copy_fast_unsafe_cc_str_doc'>copy_fast_unsafe_cc</a></li>
<li><a href='#copy_fast_unsafe_cs_str_doc'>copy_fast_unsafe_cs</a></li>
<li><a href='#copy_checked_ss_str_doc'>copy_checked_ss</a></li>
<li><a href='#copy_partial_sc_str_doc'>copy_partial_sc</a></li>
<li><a href='#copy_partial_ss_str_doc'>copy_partial_ss</a></li>
<li><a href='#copy_cc_str_doc'>copy_cc</a></li>
<li><a href='#copy_ss_str_doc'>copy_ss</a></li>
<li><a href='#copy_sc_str_doc'>copy_sc</a></li>
<li><a href='#append_checked_ss_str_doc'>append_checked_ss</a></li>
<li><a href='#append_partial_sc_str_doc'>append_partial_sc</a></li>
<li><a href='#append_partial_ss_str_doc'>append_partial_ss</a></li>
<li><a href='#append_s_char_str_doc'>append_s_char</a></li>
<li><a href='#append_ss_str_doc'>append_ss</a></li>
<li><a href='#append_sc_str_doc'>append_sc</a></li>
<li><a href='#terminate_with_null_str_doc'>terminate_with_null</a></li>
<li><a href='#append_padding_str_doc'>append_padding</a></li>
<li><a href='#replace_char_str_doc'>replace_char</a></li>
@ -2326,17 +2361,21 @@ Coming Soon</i><div>
<li><a href='#float_to_str_size_str_doc'>float_to_str_size</a></li>
<li><a href='#append_float_to_str_str_doc'>append_float_to_str</a></li>
<li><a href='#float_to_str_str_doc'>float_to_str</a></li>
<li><a href='#str_is_int_str_doc'>str_is_int</a></li>
<li><a href='#str_to_int_str_doc'>str_to_int</a></li>
<li><a href='#str_is_int_c_str_doc'>str_is_int_c</a></li>
<li><a href='#str_is_int_s_str_doc'>str_is_int_s</a></li>
<li><a href='#str_to_int_c_str_doc'>str_to_int_c</a></li>
<li><a href='#str_to_int_s_str_doc'>str_to_int_s</a></li>
<li><a href='#hexchar_to_int_str_doc'>hexchar_to_int</a></li>
<li><a href='#int_to_hexchar_str_doc'>int_to_hexchar</a></li>
<li><a href='#hexstr_to_int_str_doc'>hexstr_to_int</a></li>
<li><a href='#color_to_hexstr_str_doc'>color_to_hexstr</a></li>
<li><a href='#hexstr_to_color_str_doc'>hexstr_to_color</a></li>
<li><a href='#reverse_seek_slash_pos_str_doc'>reverse_seek_slash_pos</a></li>
<li><a href='#reverse_seek_slash_str_doc'>reverse_seek_slash</a></li>
<li><a href='#front_of_directory_str_doc'>front_of_directory</a></li>
<li><a href='#path_of_directory_str_doc'>path_of_directory</a></li>
<li><a href='#set_last_folder_str_doc'>set_last_folder</a></li>
<li><a href='#set_last_folder_sc_str_doc'>set_last_folder_sc</a></li>
<li><a href='#set_last_folder_ss_str_doc'>set_last_folder_ss</a></li>
<li><a href='#file_extension_str_doc'>file_extension</a></li>
<li><a href='#remove_last_folder_str_doc'>remove_last_folder</a></li>
<li><a href='#string_set_match_str_doc'>string_set_match</a></li>
@ -2406,12 +2445,12 @@ fstr_bool char_is_numeric(
<div id='string_zero_str_doc'><h4>&sect;4.3.11: string_zero</h4>
<div style='font-family: "Courier New", Courier, monospace; text-align: left; margin-top: 3mm; margin-bottom: 3mm; font-size: .95em; background: #DFDFDF; padding: 0.25em;'>
String string_zero(
<div style='margin-left: 4mm;'><br></div>)
<div style='margin-left: 4mm;'>void<br></div>)
</div>
<div style='margin-top: 3mm; margin-bottom: 3mm; color: #309030;'><b><i>Description</i></b></div><div style='margin-left: 5mm; margin-right: 5mm;'>This call returns a String struct of zeroed members.</div></div><hr>
<div id='make_string_str_doc'><h4>&sect;4.3.12: make_string</h4>
<div id='make_string_cap_str_doc'><h4>&sect;4.3.12: make_string_cap</h4>
<div style='font-family: "Courier New", Courier, monospace; text-align: left; margin-top: 3mm; margin-bottom: 3mm; font-size: .95em; background: #DFDFDF; padding: 0.25em;'>
String make_string(
String make_string_cap(
<div style='margin-left: 4mm;'>void *str,<br>int32_t size,<br>int32_t mem_size<br></div>)
</div>
<div style='margin-top: 3mm; margin-bottom: 3mm; color: #309030;'><b><i>Parameters</i></b></div><div>
@ -2428,7 +2467,7 @@ If the memory does not already contain a useful string this should be zero.</div
<div style='margin-bottom: 6mm;'><div style='margin-left: 5mm; margin-right: 5mm;'>The mem_size parameter expresses the full size of the memory provided by str.</div></div>
</div>
<div style='margin-top: 3mm; margin-bottom: 3mm; color: #309030;'><b><i>Description</i></b></div><div style='margin-left: 5mm; margin-right: 5mm;'>This call returns the String created from the parameters.</div></div><hr>
<div><h4>&sect;4.3.13: make_string</h4>
<div id='make_string_str_doc'><h4>&sect;4.3.13: make_string</h4>
<div style='font-family: "Courier New", Courier, monospace; text-align: left; margin-top: 3mm; margin-bottom: 3mm; font-size: .95em; background: #DFDFDF; padding: 0.25em;'>
String make_string(
<div style='margin-left: 4mm;'>void *str,<br>int32_t size<br></div>)
@ -2473,15 +2512,15 @@ String make_string_slowly(
</div>
<div style='margin-top: 3mm; margin-bottom: 3mm; color: #309030;'><b><i>Description</i></b></div><div style='margin-left: 5mm; margin-right: 5mm;'>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.</div></div><hr>
<div id='substr_str_doc'><h4>&sect;4.3.19: substr</h4>
<div id='substr_tail_str_doc'><h4>&sect;4.3.19: substr_tail</h4>
<div style='font-family: "Courier New", Courier, monospace; text-align: left; margin-top: 3mm; margin-bottom: 3mm; font-size: .95em; background: #DFDFDF; padding: 0.25em;'>
String substr(
String substr_tail(
<div style='margin-left: 4mm;'>String str,<br>int32_t start<br></div>)
</div>
<div style='margin-top: 3mm; margin-bottom: 3mm; color: #309030;'><b><i>Description</i></b></div><div style='margin-left: 5mm; margin-right: 5mm;'>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.</div></div><hr>
<div><h4>&sect;4.3.20: substr</h4>
<div id='substr_str_doc'><h4>&sect;4.3.20: substr</h4>
<div style='font-family: "Courier New", Courier, monospace; text-align: left; margin-top: 3mm; margin-bottom: 3mm; font-size: .95em; background: #DFDFDF; padding: 0.25em;'>
String substr(
<div style='margin-left: 4mm;'>String str,<br>int32_t start,<br>int32_t size<br></div>)
@ -2518,33 +2557,33 @@ String tailstr(
</div>
<div style='margin-top: 3mm; margin-bottom: 3mm; color: #309030;'><b><i>Description</i></b></div><div style='margin-left: 5mm; margin-right: 5mm;'>This call returns an empty String with underlying memory taken from
the portion of str's memory that is not used.</div></div><hr>
<div id='match_str_doc'><h4>&sect;4.3.25: match</h4>
<div id='match_cc_str_doc'><h4>&sect;4.3.25: match_cc</h4>
<div style='font-family: "Courier New", Courier, monospace; text-align: left; margin-top: 3mm; margin-bottom: 3mm; font-size: .95em; background: #DFDFDF; padding: 0.25em;'>
fstr_bool match(
fstr_bool match_cc(
<div style='margin-left: 4mm;'>char *a,<br>char *b<br></div>)
</div>
<div style='margin-top: 3mm; margin-bottom: 3mm; color: #309030;'><b><i>Description</i></b></div><div style='margin-left: 5mm; margin-right: 5mm;'>This call returns non-zero if a and b are equivalent.</div></div><hr>
<div><h4>&sect;4.3.26: match</h4>
<div id='match_sc_str_doc'><h4>&sect;4.3.26: match_sc</h4>
<div style='font-family: "Courier New", Courier, monospace; text-align: left; margin-top: 3mm; margin-bottom: 3mm; font-size: .95em; background: #DFDFDF; padding: 0.25em;'>
fstr_bool match(
fstr_bool match_sc(
<div style='margin-left: 4mm;'>String a,<br>char *b<br></div>)
</div>
<div style='margin-top: 3mm; margin-bottom: 3mm; color: #309030;'><b><i>Description</i></b></div><div style='margin-left: 5mm; margin-right: 5mm;'>This call returns non-zero if a and b are equivalent.</div></div><hr>
<div><h4>&sect;4.3.27: match</h4>
<div id='match_cs_str_doc'><h4>&sect;4.3.27: match_cs</h4>
<div style='font-family: "Courier New", Courier, monospace; text-align: left; margin-top: 3mm; margin-bottom: 3mm; font-size: .95em; background: #DFDFDF; padding: 0.25em;'>
fstr_bool match(
fstr_bool match_cs(
<div style='margin-left: 4mm;'>char *a,<br>String b<br></div>)
</div>
<div style='margin-top: 3mm; margin-bottom: 3mm; color: #309030;'><b><i>Description</i></b></div><div style='margin-left: 5mm; margin-right: 5mm;'>This call returns non-zero if a and b are equivalent.</div></div><hr>
<div><h4>&sect;4.3.28: match</h4>
<div id='match_ss_str_doc'><h4>&sect;4.3.28: match_ss</h4>
<div style='font-family: "Courier New", Courier, monospace; text-align: left; margin-top: 3mm; margin-bottom: 3mm; font-size: .95em; background: #DFDFDF; padding: 0.25em;'>
fstr_bool match(
fstr_bool match_ss(
<div style='margin-left: 4mm;'>String a,<br>String b<br></div>)
</div>
<div style='margin-top: 3mm; margin-bottom: 3mm; color: #309030;'><b><i>Description</i></b></div><div style='margin-left: 5mm; margin-right: 5mm;'>This call returns non-zero if a and b are equivalent.</div></div><hr>
<div id='match_part_str_doc'><h4>&sect;4.3.29: match_part</h4>
<div id='match_part_ccl_str_doc'><h4>&sect;4.3.29: match_part_ccl</h4>
<div style='font-family: "Courier New", Courier, monospace; text-align: left; margin-top: 3mm; margin-bottom: 3mm; font-size: .95em; background: #DFDFDF; padding: 0.25em;'>
fstr_bool match_part(
fstr_bool match_part_ccl(
<div style='margin-left: 4mm;'>char *a,<br>char *b,<br>int32_t *len<br></div>)
</div>
<div style='margin-top: 3mm; margin-bottom: 3mm; color: #309030;'><b><i>Parameters</i></b></div><div>
@ -2553,9 +2592,9 @@ fstr_bool match_part(
</div>
<div style='margin-top: 3mm; margin-bottom: 3mm; color: #309030;'><b><i>Description</i></b></div><div style='margin-left: 5mm; margin-right: 5mm;'>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.</div></div><hr>
<div><h4>&sect;4.3.30: match_part</h4>
<div id='match_part_scl_str_doc'><h4>&sect;4.3.30: match_part_scl</h4>
<div style='font-family: "Courier New", Courier, monospace; text-align: left; margin-top: 3mm; margin-bottom: 3mm; font-size: .95em; background: #DFDFDF; padding: 0.25em;'>
fstr_bool match_part(
fstr_bool match_part_scl(
<div style='margin-left: 4mm;'>String a,<br>char *b,<br>int32_t *len<br></div>)
</div>
<div style='margin-top: 3mm; margin-bottom: 3mm; color: #309030;'><b><i>Parameters</i></b></div><div>
@ -2564,9 +2603,9 @@ fstr_bool match_part(
</div>
<div style='margin-top: 3mm; margin-bottom: 3mm; color: #309030;'><b><i>Description</i></b></div><div style='margin-left: 5mm; margin-right: 5mm;'>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.</div></div><hr>
<div><h4>&sect;4.3.31: match_part</h4>
<div id='match_part_cc_str_doc'><h4>&sect;4.3.31: match_part_cc</h4>
<div style='font-family: "Courier New", Courier, monospace; text-align: left; margin-top: 3mm; margin-bottom: 3mm; font-size: .95em; background: #DFDFDF; padding: 0.25em;'>
fstr_bool match_part(
fstr_bool match_part_cc(
<div style='margin-left: 4mm;'>char *a,<br>char *b<br></div>)
</div>
<div style='margin-top: 3mm; margin-bottom: 3mm; color: #309030;'><b><i>Parameters</i></b></div><div>
@ -2575,54 +2614,54 @@ fstr_bool match_part(
</div>
<div style='margin-top: 3mm; margin-bottom: 3mm; color: #309030;'><b><i>Description</i></b></div><div style='margin-left: 5mm; margin-right: 5mm;'>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.</div></div><hr>
<div><h4>&sect;4.3.32: match_part</h4>
<div id='match_part_sc_str_doc'><h4>&sect;4.3.32: match_part_sc</h4>
<div style='font-family: "Courier New", Courier, monospace; text-align: left; margin-top: 3mm; margin-bottom: 3mm; font-size: .95em; background: #DFDFDF; padding: 0.25em;'>
fstr_bool match_part(
fstr_bool match_part_sc(
<div style='margin-left: 4mm;'>String a,<br>char *b<br></div>)
</div>
<div style='margin-top: 3mm; margin-bottom: 3mm; color: #309030;'><b><i>Description</i></b></div><div style='margin-left: 5mm; margin-right: 5mm;'>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.</div></div><hr>
<div><h4>&sect;4.3.33: match_part</h4>
<div id='match_part_cs_str_doc'><h4>&sect;4.3.33: match_part_cs</h4>
<div style='font-family: "Courier New", Courier, monospace; text-align: left; margin-top: 3mm; margin-bottom: 3mm; font-size: .95em; background: #DFDFDF; padding: 0.25em;'>
fstr_bool match_part(
fstr_bool match_part_cs(
<div style='margin-left: 4mm;'>char *a,<br>String b<br></div>)
</div>
<div style='margin-top: 3mm; margin-bottom: 3mm; color: #309030;'><b><i>Description</i></b></div><div style='margin-left: 5mm; margin-right: 5mm;'>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.</div></div><hr>
<div><h4>&sect;4.3.34: match_part</h4>
<div id='match_part_ss_str_doc'><h4>&sect;4.3.34: match_part_ss</h4>
<div style='font-family: "Courier New", Courier, monospace; text-align: left; margin-top: 3mm; margin-bottom: 3mm; font-size: .95em; background: #DFDFDF; padding: 0.25em;'>
fstr_bool match_part(
fstr_bool match_part_ss(
<div style='margin-left: 4mm;'>String a,<br>String b<br></div>)
</div>
<div style='margin-top: 3mm; margin-bottom: 3mm; color: #309030;'><b><i>Description</i></b></div><div style='margin-left: 5mm; margin-right: 5mm;'>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.</div></div><hr>
<div id='match_insensitive_str_doc'><h4>&sect;4.3.35: match_insensitive</h4>
<div id='match_insensitive_cc_str_doc'><h4>&sect;4.3.35: match_insensitive_cc</h4>
<div style='font-family: "Courier New", Courier, monospace; text-align: left; margin-top: 3mm; margin-bottom: 3mm; font-size: .95em; background: #DFDFDF; padding: 0.25em;'>
fstr_bool match_insensitive(
fstr_bool match_insensitive_cc(
<div style='margin-left: 4mm;'>char *a,<br>char *b<br></div>)
</div>
<div style='margin-top: 3mm; margin-bottom: 3mm; color: #309030;'><b><i>Description</i></b></div><div style='margin-left: 5mm; margin-right: 5mm;'>This call returns non-zero if a and b are equivalent under case insensitive comparison.</div></div><hr>
<div><h4>&sect;4.3.36: match_insensitive</h4>
<div id='match_insensitive_sc_str_doc'><h4>&sect;4.3.36: match_insensitive_sc</h4>
<div style='font-family: "Courier New", Courier, monospace; text-align: left; margin-top: 3mm; margin-bottom: 3mm; font-size: .95em; background: #DFDFDF; padding: 0.25em;'>
fstr_bool match_insensitive(
fstr_bool match_insensitive_sc(
<div style='margin-left: 4mm;'>String a,<br>char *b<br></div>)
</div>
<div style='margin-top: 3mm; margin-bottom: 3mm; color: #309030;'><b><i>Description</i></b></div><div style='margin-left: 5mm; margin-right: 5mm;'>This call returns non-zero if a and b are equivalent under case insensitive comparison.</div></div><hr>
<div><h4>&sect;4.3.37: match_insensitive</h4>
<div id='match_insensitive_cs_str_doc'><h4>&sect;4.3.37: match_insensitive_cs</h4>
<div style='font-family: "Courier New", Courier, monospace; text-align: left; margin-top: 3mm; margin-bottom: 3mm; font-size: .95em; background: #DFDFDF; padding: 0.25em;'>
fstr_bool match_insensitive(
fstr_bool match_insensitive_cs(
<div style='margin-left: 4mm;'>char *a,<br>String b<br></div>)
</div>
<div style='margin-top: 3mm; margin-bottom: 3mm; color: #309030;'><b><i>Description</i></b></div><div style='margin-left: 5mm; margin-right: 5mm;'>This call returns non-zero if a and b are equivalent under case insensitive comparison.</div></div><hr>
<div><h4>&sect;4.3.38: match_insensitive</h4>
<div id='match_insensitive_ss_str_doc'><h4>&sect;4.3.38: match_insensitive_ss</h4>
<div style='font-family: "Courier New", Courier, monospace; text-align: left; margin-top: 3mm; margin-bottom: 3mm; font-size: .95em; background: #DFDFDF; padding: 0.25em;'>
fstr_bool match_insensitive(
fstr_bool match_insensitive_ss(
<div style='margin-left: 4mm;'>String a,<br>String b<br></div>)
</div>
<div style='margin-top: 3mm; margin-bottom: 3mm; color: #309030;'><b><i>Description</i></b></div><div style='margin-left: 5mm; margin-right: 5mm;'>This call returns non-zero if a and b are equivalent under case insensitive comparison.</div></div><hr>
<div id='match_part_insensitive_str_doc'><h4>&sect;4.3.39: match_part_insensitive</h4>
<div id='match_part_insensitive_ccl_str_doc'><h4>&sect;4.3.39: match_part_insensitive_ccl</h4>
<div style='font-family: "Courier New", Courier, monospace; text-align: left; margin-top: 3mm; margin-bottom: 3mm; font-size: .95em; background: #DFDFDF; padding: 0.25em;'>
fstr_bool match_part_insensitive(
fstr_bool match_part_insensitive_ccl(
<div style='margin-left: 4mm;'>char *a,<br>char *b,<br>int32_t *len<br></div>)
</div>
<div style='margin-top: 3mm; margin-bottom: 3mm; color: #309030;'><b><i>Parameters</i></b></div><div>
@ -2630,9 +2669,9 @@ fstr_bool match_part_insensitive(
<div style='margin-bottom: 6mm;'><div style='margin-left: 5mm; margin-right: 5mm;'>If this call returns non-zero this parameter is used to output the length of b.</div></div>
</div>
<div style='margin-top: 3mm; margin-bottom: 3mm; color: #309030;'><b><i>Description</i></b></div><div style='margin-left: 5mm; margin-right: 5mm;'>This call performs the same partial matching rule as match_part under case insensitive comparison.</div><div style='margin-top: 3mm; margin-bottom: 3mm; color: #309030;'><b><i>See Also</i></b></div><div style='margin-left: 5mm; margin-right: 5mm;'><a href='#match_part_doc'>match_part</a></div></div><hr>
<div><h4>&sect;4.3.40: match_part_insensitive</h4>
<div id='match_part_insensitive_scl_str_doc'><h4>&sect;4.3.40: match_part_insensitive_scl</h4>
<div style='font-family: "Courier New", Courier, monospace; text-align: left; margin-top: 3mm; margin-bottom: 3mm; font-size: .95em; background: #DFDFDF; padding: 0.25em;'>
fstr_bool match_part_insensitive(
fstr_bool match_part_insensitive_scl(
<div style='margin-left: 4mm;'>String a,<br>char *b,<br>int32_t *len<br></div>)
</div>
<div style='margin-top: 3mm; margin-bottom: 3mm; color: #309030;'><b><i>Parameters</i></b></div><div>
@ -2640,65 +2679,65 @@ fstr_bool match_part_insensitive(
<div style='margin-bottom: 6mm;'><div style='margin-left: 5mm; margin-right: 5mm;'>If this call returns non-zero this parameter is used to output the length of b.</div></div>
</div>
<div style='margin-top: 3mm; margin-bottom: 3mm; color: #309030;'><b><i>Description</i></b></div><div style='margin-left: 5mm; margin-right: 5mm;'>This call performs the same partial matching rule as match_part under case insensitive comparison.</div><div style='margin-top: 3mm; margin-bottom: 3mm; color: #309030;'><b><i>See Also</i></b></div><div style='margin-left: 5mm; margin-right: 5mm;'><a href='#match_part_doc'>match_part</a></div></div><hr>
<div><h4>&sect;4.3.41: match_part_insensitive</h4>
<div id='match_part_insensitive_cc_str_doc'><h4>&sect;4.3.41: match_part_insensitive_cc</h4>
<div style='font-family: "Courier New", Courier, monospace; text-align: left; margin-top: 3mm; margin-bottom: 3mm; font-size: .95em; background: #DFDFDF; padding: 0.25em;'>
fstr_bool match_part_insensitive(
fstr_bool match_part_insensitive_cc(
<div style='margin-left: 4mm;'>char *a,<br>char *b<br></div>)
</div>
<div style='margin-top: 3mm; margin-bottom: 3mm; color: #309030;'><b><i>Description</i></b></div><div style='margin-left: 5mm; margin-right: 5mm;'>This call performs the same partial matching rule as match_part under case insensitive comparison.</div><div style='margin-top: 3mm; margin-bottom: 3mm; color: #309030;'><b><i>See Also</i></b></div><div style='margin-left: 5mm; margin-right: 5mm;'><a href='#match_part_doc'>match_part</a></div></div><hr>
<div><h4>&sect;4.3.42: match_part_insensitive</h4>
<div id='match_part_insensitive_sc_str_doc'><h4>&sect;4.3.42: match_part_insensitive_sc</h4>
<div style='font-family: "Courier New", Courier, monospace; text-align: left; margin-top: 3mm; margin-bottom: 3mm; font-size: .95em; background: #DFDFDF; padding: 0.25em;'>
fstr_bool match_part_insensitive(
fstr_bool match_part_insensitive_sc(
<div style='margin-left: 4mm;'>String a,<br>char *b<br></div>)
</div>
<div style='margin-top: 3mm; margin-bottom: 3mm; color: #309030;'><b><i>Description</i></b></div><div style='margin-left: 5mm; margin-right: 5mm;'>This call performs the same partial matching rule as match_part under case insensitive comparison.</div><div style='margin-top: 3mm; margin-bottom: 3mm; color: #309030;'><b><i>See Also</i></b></div><div style='margin-left: 5mm; margin-right: 5mm;'><a href='#match_part_doc'>match_part</a></div></div><hr>
<div><h4>&sect;4.3.43: match_part_insensitive</h4>
<div id='match_part_insensitive_cs_str_doc'><h4>&sect;4.3.43: match_part_insensitive_cs</h4>
<div style='font-family: "Courier New", Courier, monospace; text-align: left; margin-top: 3mm; margin-bottom: 3mm; font-size: .95em; background: #DFDFDF; padding: 0.25em;'>
fstr_bool match_part_insensitive(
fstr_bool match_part_insensitive_cs(
<div style='margin-left: 4mm;'>char *a,<br>String b<br></div>)
</div>
<div style='margin-top: 3mm; margin-bottom: 3mm; color: #309030;'><b><i>Description</i></b></div><div style='margin-left: 5mm; margin-right: 5mm;'>This call performs the same partial matching rule as match_part under case insensitive comparison.</div><div style='margin-top: 3mm; margin-bottom: 3mm; color: #309030;'><b><i>See Also</i></b></div><div style='margin-left: 5mm; margin-right: 5mm;'><a href='#match_part_doc'>match_part</a></div></div><hr>
<div><h4>&sect;4.3.44: match_part_insensitive</h4>
<div id='match_part_insensitive_ss_str_doc'><h4>&sect;4.3.44: match_part_insensitive_ss</h4>
<div style='font-family: "Courier New", Courier, monospace; text-align: left; margin-top: 3mm; margin-bottom: 3mm; font-size: .95em; background: #DFDFDF; padding: 0.25em;'>
fstr_bool match_part_insensitive(
fstr_bool match_part_insensitive_ss(
<div style='margin-left: 4mm;'>String a,<br>String b<br></div>)
</div>
<div style='margin-top: 3mm; margin-bottom: 3mm; color: #309030;'><b><i>Description</i></b></div><div style='margin-left: 5mm; margin-right: 5mm;'>This call performs the same partial matching rule as match_part under case insensitive comparison.</div><div style='margin-top: 3mm; margin-bottom: 3mm; color: #309030;'><b><i>See Also</i></b></div><div style='margin-left: 5mm; margin-right: 5mm;'><a href='#match_part_doc'>match_part</a></div></div><hr>
<div id='compare_str_doc'><h4>&sect;4.3.45: compare</h4>
<div id='compare_cc_str_doc'><h4>&sect;4.3.45: compare_cc</h4>
<div style='font-family: "Courier New", Courier, monospace; text-align: left; margin-top: 3mm; margin-bottom: 3mm; font-size: .95em; background: #DFDFDF; padding: 0.25em;'>
int32_t compare(
int32_t compare_cc(
<div style='margin-left: 4mm;'>char *a,<br>char *b<br></div>)
</div>
<div style='margin-top: 3mm; margin-bottom: 3mm; color: #309030;'><b><i>Description</i></b></div><div style='margin-left: 5mm; margin-right: 5mm;'>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.</div></div><hr>
<div><h4>&sect;4.3.46: compare</h4>
<div id='compare_sc_str_doc'><h4>&sect;4.3.46: compare_sc</h4>
<div style='font-family: "Courier New", Courier, monospace; text-align: left; margin-top: 3mm; margin-bottom: 3mm; font-size: .95em; background: #DFDFDF; padding: 0.25em;'>
int32_t compare(
int32_t compare_sc(
<div style='margin-left: 4mm;'>String a,<br>char *b<br></div>)
</div>
<div style='margin-top: 3mm; margin-bottom: 3mm; color: #309030;'><b><i>Description</i></b></div><div style='margin-left: 5mm; margin-right: 5mm;'>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.</div></div><hr>
<div><h4>&sect;4.3.47: compare</h4>
<div id='compare_cs_str_doc'><h4>&sect;4.3.47: compare_cs</h4>
<div style='font-family: "Courier New", Courier, monospace; text-align: left; margin-top: 3mm; margin-bottom: 3mm; font-size: .95em; background: #DFDFDF; padding: 0.25em;'>
int32_t compare(
int32_t compare_cs(
<div style='margin-left: 4mm;'>char *a,<br>String b<br></div>)
</div>
<div style='margin-top: 3mm; margin-bottom: 3mm; color: #309030;'><b><i>Description</i></b></div><div style='margin-left: 5mm; margin-right: 5mm;'>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.</div></div><hr>
<div><h4>&sect;4.3.48: compare</h4>
<div id='compare_ss_str_doc'><h4>&sect;4.3.48: compare_ss</h4>
<div style='font-family: "Courier New", Courier, monospace; text-align: left; margin-top: 3mm; margin-bottom: 3mm; font-size: .95em; background: #DFDFDF; padding: 0.25em;'>
int32_t compare(
int32_t compare_ss(
<div style='margin-left: 4mm;'>String a,<br>String b<br></div>)
</div>
<div style='margin-top: 3mm; margin-bottom: 3mm; color: #309030;'><b><i>Description</i></b></div><div style='margin-left: 5mm; margin-right: 5mm;'>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.</div></div><hr>
<div id='find_str_doc'><h4>&sect;4.3.49: find</h4>
<div id='find_c_char_str_doc'><h4>&sect;4.3.49: find_c_char</h4>
<div style='font-family: "Courier New", Courier, monospace; text-align: left; margin-top: 3mm; margin-bottom: 3mm; font-size: .95em; background: #DFDFDF; padding: 0.25em;'>
int32_t find(
int32_t find_c_char(
<div style='margin-left: 4mm;'>char *str,<br>int32_t start,<br>char character<br></div>)
</div>
<div style='margin-top: 3mm; margin-bottom: 3mm; color: #309030;'><b><i>Parameters</i></b></div><div>
@ -2715,9 +2754,9 @@ int32_t find(
</div>
<div style='margin-top: 3mm; margin-bottom: 3mm; color: #309030;'><b><i>Description</i></b></div><div style='margin-left: 5mm; margin-right: 5mm;'>This call returns the index of the first occurance of character, or the size of the string
if the character is not found.</div></div><hr>
<div><h4>&sect;4.3.50: find</h4>
<div id='find_s_char_str_doc'><h4>&sect;4.3.50: find_s_char</h4>
<div style='font-family: "Courier New", Courier, monospace; text-align: left; margin-top: 3mm; margin-bottom: 3mm; font-size: .95em; background: #DFDFDF; padding: 0.25em;'>
int32_t find(
int32_t find_s_char(
<div style='margin-left: 4mm;'>String str,<br>int32_t start,<br>char character<br></div>)
</div>
<div style='margin-top: 3mm; margin-bottom: 3mm; color: #309030;'><b><i>Parameters</i></b></div><div>
@ -2734,9 +2773,9 @@ int32_t find(
</div>
<div style='margin-top: 3mm; margin-bottom: 3mm; color: #309030;'><b><i>Description</i></b></div><div style='margin-left: 5mm; margin-right: 5mm;'>This call returns the index of the first occurance of character, or the size of the string
if the character is not found.</div></div><hr>
<div><h4>&sect;4.3.51: find</h4>
<div id='find_c_chars_str_doc'><h4>&sect;4.3.51: find_c_chars</h4>
<div style='font-family: "Courier New", Courier, monospace; text-align: left; margin-top: 3mm; margin-bottom: 3mm; font-size: .95em; background: #DFDFDF; padding: 0.25em;'>
int32_t find(
int32_t find_c_chars(
<div style='margin-left: 4mm;'>char *str,<br>int32_t start,<br>char *characters<br></div>)
</div>
<div style='margin-top: 3mm; margin-bottom: 3mm; color: #309030;'><b><i>Parameters</i></b></div><div>
@ -2753,9 +2792,9 @@ int32_t find(
</div>
<div style='margin-top: 3mm; margin-bottom: 3mm; color: #309030;'><b><i>Description</i></b></div><div style='margin-left: 5mm; margin-right: 5mm;'>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.</div></div><hr>
<div><h4>&sect;4.3.52: find</h4>
<div id='find_s_chars_str_doc'><h4>&sect;4.3.52: find_s_chars</h4>
<div style='font-family: "Courier New", Courier, monospace; text-align: left; margin-top: 3mm; margin-bottom: 3mm; font-size: .95em; background: #DFDFDF; padding: 0.25em;'>
int32_t find(
int32_t find_s_chars(
<div style='margin-left: 4mm;'>String str,<br>int32_t start,<br>char *characters<br></div>)
</div>
<div style='margin-top: 3mm; margin-bottom: 3mm; color: #309030;'><b><i>Parameters</i></b></div><div>
@ -2772,9 +2811,9 @@ int32_t find(
</div>
<div style='margin-top: 3mm; margin-bottom: 3mm; color: #309030;'><b><i>Description</i></b></div><div style='margin-left: 5mm; margin-right: 5mm;'>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.</div></div><hr>
<div id='find_substr_str_doc'><h4>&sect;4.3.53: find_substr</h4>
<div id='find_substr_c_str_doc'><h4>&sect;4.3.53: find_substr_c</h4>
<div style='font-family: "Courier New", Courier, monospace; text-align: left; margin-top: 3mm; margin-bottom: 3mm; font-size: .95em; background: #DFDFDF; padding: 0.25em;'>
int32_t find_substr(
int32_t find_substr_c(
<div style='margin-left: 4mm;'>char *str,<br>int32_t start,<br>String seek<br></div>)
</div>
<div style='margin-top: 3mm; margin-bottom: 3mm; color: #309030;'><b><i>Parameters</i></b></div><div>
@ -2791,9 +2830,9 @@ int32_t find_substr(
</div>
<div style='margin-top: 3mm; margin-bottom: 3mm; color: #309030;'><b><i>Description</i></b></div><div style='margin-left: 5mm; margin-right: 5mm;'>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.</div></div><hr>
<div><h4>&sect;4.3.54: find_substr</h4>
<div id='find_substr_s_str_doc'><h4>&sect;4.3.54: find_substr_s</h4>
<div style='font-family: "Courier New", Courier, monospace; text-align: left; margin-top: 3mm; margin-bottom: 3mm; font-size: .95em; background: #DFDFDF; padding: 0.25em;'>
int32_t find_substr(
int32_t find_substr_s(
<div style='margin-left: 4mm;'>String str,<br>int32_t start,<br>String seek<br></div>)
</div>
<div style='margin-top: 3mm; margin-bottom: 3mm; color: #309030;'><b><i>Parameters</i></b></div><div>
@ -2810,9 +2849,9 @@ int32_t find_substr(
</div>
<div style='margin-top: 3mm; margin-bottom: 3mm; color: #309030;'><b><i>Description</i></b></div><div style='margin-left: 5mm; margin-right: 5mm;'>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.</div></div><hr>
<div id='rfind_substr_str_doc'><h4>&sect;4.3.55: rfind_substr</h4>
<div id='rfind_substr_s_str_doc'><h4>&sect;4.3.55: rfind_substr_s</h4>
<div style='font-family: "Courier New", Courier, monospace; text-align: left; margin-top: 3mm; margin-bottom: 3mm; font-size: .95em; background: #DFDFDF; padding: 0.25em;'>
int32_t rfind_substr(
int32_t rfind_substr_s(
<div style='margin-left: 4mm;'>String str,<br>int32_t start,<br>String seek<br></div>)
</div>
<div style='margin-top: 3mm; margin-bottom: 3mm; color: #309030;'><b><i>Parameters</i></b></div><div>
@ -2829,9 +2868,9 @@ int32_t rfind_substr(
</div>
<div style='margin-top: 3mm; margin-bottom: 3mm; color: #309030;'><b><i>Description</i></b></div><div style='margin-left: 5mm; margin-right: 5mm;'>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.</div></div><hr>
<div id='find_substr_insensitive_str_doc'><h4>&sect;4.3.56: find_substr_insensitive</h4>
<div id='find_substr_insensitive_c_str_doc'><h4>&sect;4.3.56: find_substr_insensitive_c</h4>
<div style='font-family: "Courier New", Courier, monospace; text-align: left; margin-top: 3mm; margin-bottom: 3mm; font-size: .95em; background: #DFDFDF; padding: 0.25em;'>
int32_t find_substr_insensitive(
int32_t find_substr_insensitive_c(
<div style='margin-left: 4mm;'>char *str,<br>int32_t start,<br>String seek<br></div>)
</div>
<div style='margin-top: 3mm; margin-bottom: 3mm; color: #309030;'><b><i>Parameters</i></b></div><div>
@ -2847,9 +2886,9 @@ int32_t find_substr_insensitive(
<div style='margin-bottom: 6mm;'><div style='margin-left: 5mm; margin-right: 5mm;'>The seek parameter provides a string to find in str.</div></div>
</div>
<div style='margin-top: 3mm; margin-bottom: 3mm; color: #309030;'><b><i>Description</i></b></div><div style='margin-left: 5mm; margin-right: 5mm;'>This call acts as find_substr under case insensitive comparison.</div><div style='margin-top: 3mm; margin-bottom: 3mm; color: #309030;'><b><i>See Also</i></b></div><div style='margin-left: 5mm; margin-right: 5mm;'><a href='#find_substr_doc'>find_substr</a></div></div><hr>
<div><h4>&sect;4.3.57: find_substr_insensitive</h4>
<div id='find_substr_insensitive_s_str_doc'><h4>&sect;4.3.57: find_substr_insensitive_s</h4>
<div style='font-family: "Courier New", Courier, monospace; text-align: left; margin-top: 3mm; margin-bottom: 3mm; font-size: .95em; background: #DFDFDF; padding: 0.25em;'>
int32_t find_substr_insensitive(
int32_t find_substr_insensitive_s(
<div style='margin-left: 4mm;'>String str,<br>int32_t start,<br>String seek<br></div>)
</div>
<div style='margin-top: 3mm; margin-bottom: 3mm; color: #309030;'><b><i>Parameters</i></b></div><div>
@ -2865,35 +2904,35 @@ int32_t find_substr_insensitive(
<div style='margin-bottom: 6mm;'><div style='margin-left: 5mm; margin-right: 5mm;'>The seek parameter provides a string to find in str.</div></div>
</div>
<div style='margin-top: 3mm; margin-bottom: 3mm; color: #309030;'><b><i>Description</i></b></div><div style='margin-left: 5mm; margin-right: 5mm;'>This call acts as find_substr under case insensitive comparison.</div><div style='margin-top: 3mm; margin-bottom: 3mm; color: #309030;'><b><i>See Also</i></b></div><div style='margin-left: 5mm; margin-right: 5mm;'><a href='#find_substr_doc'>find_substr</a></div></div><hr>
<div id='has_substr_str_doc'><h4>&sect;4.3.58: has_substr</h4>
<div id='has_substr_c_str_doc'><h4>&sect;4.3.58: has_substr_c</h4>
<div style='font-family: "Courier New", Courier, monospace; text-align: left; margin-top: 3mm; margin-bottom: 3mm; font-size: .95em; background: #DFDFDF; padding: 0.25em;'>
fstr_bool has_substr(
fstr_bool has_substr_c(
<div style='margin-left: 4mm;'>char *s,<br>String seek<br></div>)
</div>
<div style='margin-top: 3mm; margin-bottom: 3mm; color: #309030;'><b><i>Description</i></b></div><div style='margin-left: 5mm; margin-right: 5mm;'>This call returns non-zero if the string s contains a substring equivalent to seek.</div></div><hr>
<div><h4>&sect;4.3.59: has_substr</h4>
<div id='has_substr_s_str_doc'><h4>&sect;4.3.59: has_substr_s</h4>
<div style='font-family: "Courier New", Courier, monospace; text-align: left; margin-top: 3mm; margin-bottom: 3mm; font-size: .95em; background: #DFDFDF; padding: 0.25em;'>
fstr_bool has_substr(
fstr_bool has_substr_s(
<div style='margin-left: 4mm;'>String s,<br>String seek<br></div>)
</div>
<div style='margin-top: 3mm; margin-bottom: 3mm; color: #309030;'><b><i>Description</i></b></div><div style='margin-left: 5mm; margin-right: 5mm;'>This call returns non-zero if the string s contains a substring equivalent to seek.</div></div><hr>
<div id='has_substr_insensitive_str_doc'><h4>&sect;4.3.60: has_substr_insensitive</h4>
<div id='has_substr_insensitive_c_str_doc'><h4>&sect;4.3.60: has_substr_insensitive_c</h4>
<div style='font-family: "Courier New", Courier, monospace; text-align: left; margin-top: 3mm; margin-bottom: 3mm; font-size: .95em; background: #DFDFDF; padding: 0.25em;'>
fstr_bool has_substr_insensitive(
fstr_bool has_substr_insensitive_c(
<div style='margin-left: 4mm;'>char *s,<br>String seek<br></div>)
</div>
<div style='margin-top: 3mm; margin-bottom: 3mm; color: #309030;'><b><i>Description</i></b></div><div style='margin-left: 5mm; margin-right: 5mm;'>This call returns non-zero if the string s contains a substring equivalent to seek
under case insensitive comparison.</div></div><hr>
<div><h4>&sect;4.3.61: has_substr_insensitive</h4>
<div id='has_substr_insensitive_s_str_doc'><h4>&sect;4.3.61: has_substr_insensitive_s</h4>
<div style='font-family: "Courier New", Courier, monospace; text-align: left; margin-top: 3mm; margin-bottom: 3mm; font-size: .95em; background: #DFDFDF; padding: 0.25em;'>
fstr_bool has_substr_insensitive(
fstr_bool has_substr_insensitive_s(
<div style='margin-left: 4mm;'>String s,<br>String seek<br></div>)
</div>
<div style='margin-top: 3mm; margin-bottom: 3mm; color: #309030;'><b><i>Description</i></b></div><div style='margin-left: 5mm; margin-right: 5mm;'>This call returns non-zero if the string s contains a substring equivalent to seek
under case insensitive comparison.</div></div><hr>
<div id='copy_fast_unsafe_str_doc'><h4>&sect;4.3.62: copy_fast_unsafe</h4>
<div id='copy_fast_unsafe_cc_str_doc'><h4>&sect;4.3.62: copy_fast_unsafe_cc</h4>
<div style='font-family: "Courier New", Courier, monospace; text-align: left; margin-top: 3mm; margin-bottom: 3mm; font-size: .95em; background: #DFDFDF; padding: 0.25em;'>
int32_t copy_fast_unsafe(
int32_t copy_fast_unsafe_cc(
<div style='margin-left: 4mm;'>char *dest,<br>char *src<br></div>)
</div>
<div style='margin-top: 3mm; margin-bottom: 3mm; color: #309030;'><b><i>Description</i></b></div><div style='margin-left: 5mm; margin-right: 5mm;'>This call performs a copy from the src buffer to the dest buffer.
@ -2901,9 +2940,9 @@ 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.</div></div><hr>
<div><h4>&sect;4.3.63: copy_fast_unsafe</h4>
<div id='copy_fast_unsafe_cs_str_doc'><h4>&sect;4.3.63: copy_fast_unsafe_cs</h4>
<div style='font-family: "Courier New", Courier, monospace; text-align: left; margin-top: 3mm; margin-bottom: 3mm; font-size: .95em; background: #DFDFDF; padding: 0.25em;'>
int32_t copy_fast_unsafe(
int32_t copy_fast_unsafe_cs(
<div style='margin-left: 4mm;'>char *dest,<br>String src<br></div>)
</div>
<div style='margin-top: 3mm; margin-bottom: 3mm; color: #309030;'><b><i>Description</i></b></div><div style='margin-left: 5mm; margin-right: 5mm;'>This call performs a copy from the src string to the dest buffer.
@ -2911,87 +2950,87 @@ 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.</div></div><hr>
<div id='copy_checked_str_doc'><h4>&sect;4.3.64: copy_checked</h4>
<div id='copy_checked_ss_str_doc'><h4>&sect;4.3.64: copy_checked_ss</h4>
<div style='font-family: "Courier New", Courier, monospace; text-align: left; margin-top: 3mm; margin-bottom: 3mm; font-size: .95em; background: #DFDFDF; padding: 0.25em;'>
fstr_bool copy_checked(
fstr_bool copy_checked_ss(
<div style='margin-left: 4mm;'>String *dest,<br>String src<br></div>)
</div>
<div style='margin-top: 3mm; margin-bottom: 3mm; color: #309030;'><b><i>Description</i></b></div><div style='margin-left: 5mm; margin-right: 5mm;'>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.</div></div><hr>
<div id='copy_partial_str_doc'><h4>&sect;4.3.65: copy_partial</h4>
<div id='copy_partial_sc_str_doc'><h4>&sect;4.3.65: copy_partial_sc</h4>
<div style='font-family: "Courier New", Courier, monospace; text-align: left; margin-top: 3mm; margin-bottom: 3mm; font-size: .95em; background: #DFDFDF; padding: 0.25em;'>
fstr_bool copy_partial(
fstr_bool copy_partial_sc(
<div style='margin-left: 4mm;'>String *dest,<br>char *src<br></div>)
</div>
<div style='margin-top: 3mm; margin-bottom: 3mm; color: #309030;'><b><i>Description</i></b></div><div style='margin-left: 5mm; margin-right: 5mm;'>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.</div></div><hr>
<div><h4>&sect;4.3.66: copy_partial</h4>
<div id='copy_partial_ss_str_doc'><h4>&sect;4.3.66: copy_partial_ss</h4>
<div style='font-family: "Courier New", Courier, monospace; text-align: left; margin-top: 3mm; margin-bottom: 3mm; font-size: .95em; background: #DFDFDF; padding: 0.25em;'>
fstr_bool copy_partial(
fstr_bool copy_partial_ss(
<div style='margin-left: 4mm;'>String *dest,<br>String src<br></div>)
</div>
<div style='margin-top: 3mm; margin-bottom: 3mm; color: #309030;'><b><i>Description</i></b></div><div style='margin-left: 5mm; margin-right: 5mm;'>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.</div></div><hr>
<div id='copy_str_doc'><h4>&sect;4.3.67: copy</h4>
<div id='copy_cc_str_doc'><h4>&sect;4.3.67: copy_cc</h4>
<div style='font-family: "Courier New", Courier, monospace; text-align: left; margin-top: 3mm; margin-bottom: 3mm; font-size: .95em; background: #DFDFDF; padding: 0.25em;'>
int32_t copy(
int32_t copy_cc(
<div style='margin-left: 4mm;'>char *dest,<br>char *src<br></div>)
</div>
<div style='margin-top: 3mm; margin-bottom: 3mm; color: #309030;'><b><i>Description</i></b></div><div style='margin-left: 5mm; margin-right: 5mm;'>This call performs a copy from src to dest equivalent to copy_fast_unsafe.</div><div style='margin-top: 3mm; margin-bottom: 3mm; color: #309030;'><b><i>See Also</i></b></div><div style='margin-left: 5mm; margin-right: 5mm;'><a href='#copy_fast_unsafe_doc'>copy_fast_unsafe</a></div></div><hr>
<div><h4>&sect;4.3.68: copy</h4>
<div id='copy_ss_str_doc'><h4>&sect;4.3.68: copy_ss</h4>
<div style='font-family: "Courier New", Courier, monospace; text-align: left; margin-top: 3mm; margin-bottom: 3mm; font-size: .95em; background: #DFDFDF; padding: 0.25em;'>
void copy(
void copy_ss(
<div style='margin-left: 4mm;'>String *dest,<br>String src<br></div>)
</div>
<div style='margin-top: 3mm; margin-bottom: 3mm; color: #309030;'><b><i>Description</i></b></div><div style='margin-left: 5mm; margin-right: 5mm;'>This call performs a copy from src to dest equivalent to copy_checked.</div><div style='margin-top: 3mm; margin-bottom: 3mm; color: #309030;'><b><i>See Also</i></b></div><div style='margin-left: 5mm; margin-right: 5mm;'><a href='#copy_checked_doc'>copy_checked</a></div></div><hr>
<div><h4>&sect;4.3.69: copy</h4>
<div id='copy_sc_str_doc'><h4>&sect;4.3.69: copy_sc</h4>
<div style='font-family: "Courier New", Courier, monospace; text-align: left; margin-top: 3mm; margin-bottom: 3mm; font-size: .95em; background: #DFDFDF; padding: 0.25em;'>
void copy(
void copy_sc(
<div style='margin-left: 4mm;'>String *dest,<br>char *src<br></div>)
</div>
<div style='margin-top: 3mm; margin-bottom: 3mm; color: #309030;'><b><i>Description</i></b></div><div style='margin-left: 5mm; margin-right: 5mm;'>This call performs a copy from src to dest equivalent to copy_partial.</div><div style='margin-top: 3mm; margin-bottom: 3mm; color: #309030;'><b><i>See Also</i></b></div><div style='margin-left: 5mm; margin-right: 5mm;'><a href='#copy_partial_doc'>copy_partial</a></div></div><hr>
<div id='append_checked_str_doc'><h4>&sect;4.3.70: append_checked</h4>
<div id='append_checked_ss_str_doc'><h4>&sect;4.3.70: append_checked_ss</h4>
<div style='font-family: "Courier New", Courier, monospace; text-align: left; margin-top: 3mm; margin-bottom: 3mm; font-size: .95em; background: #DFDFDF; padding: 0.25em;'>
fstr_bool append_checked(
fstr_bool append_checked_ss(
<div style='margin-left: 4mm;'>String *dest,<br>String src<br></div>)
</div>
<div style='margin-top: 3mm; margin-bottom: 3mm; color: #309030;'><b><i>Description</i></b></div><div style='margin-left: 5mm; margin-right: 5mm;'>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.</div></div><hr>
<div id='append_partial_str_doc'><h4>&sect;4.3.71: append_partial</h4>
<div id='append_partial_sc_str_doc'><h4>&sect;4.3.71: append_partial_sc</h4>
<div style='font-family: "Courier New", Courier, monospace; text-align: left; margin-top: 3mm; margin-bottom: 3mm; font-size: .95em; background: #DFDFDF; padding: 0.25em;'>
fstr_bool append_partial(
fstr_bool append_partial_sc(
<div style='margin-left: 4mm;'>String *dest,<br>char *src<br></div>)
</div>
<div style='margin-top: 3mm; margin-bottom: 3mm; color: #309030;'><b><i>Description</i></b></div><div style='margin-left: 5mm; margin-right: 5mm;'>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.</div></div><hr>
<div><h4>&sect;4.3.72: append_partial</h4>
<div id='append_partial_ss_str_doc'><h4>&sect;4.3.72: append_partial_ss</h4>
<div style='font-family: "Courier New", Courier, monospace; text-align: left; margin-top: 3mm; margin-bottom: 3mm; font-size: .95em; background: #DFDFDF; padding: 0.25em;'>
fstr_bool append_partial(
fstr_bool append_partial_ss(
<div style='margin-left: 4mm;'>String *dest,<br>String src<br></div>)
</div>
<div style='margin-top: 3mm; margin-bottom: 3mm; color: #309030;'><b><i>Description</i></b></div><div style='margin-left: 5mm; margin-right: 5mm;'>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.</div></div><hr>
<div id='append_str_doc'><h4>&sect;4.3.73: append</h4>
<div id='append_s_char_str_doc'><h4>&sect;4.3.73: append_s_char</h4>
<div style='font-family: "Courier New", Courier, monospace; text-align: left; margin-top: 3mm; margin-bottom: 3mm; font-size: .95em; background: #DFDFDF; padding: 0.25em;'>
fstr_bool append(
fstr_bool append_s_char(
<div style='margin-left: 4mm;'>String *dest,<br>char c<br></div>)
</div>
<div style='margin-top: 3mm; margin-bottom: 3mm; color: #309030;'><b><i>Description</i></b></div><div style='margin-left: 5mm; margin-right: 5mm;'>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.</div></div><hr>
<div><h4>&sect;4.3.74: append</h4>
<div id='append_ss_str_doc'><h4>&sect;4.3.74: append_ss</h4>
<div style='font-family: "Courier New", Courier, monospace; text-align: left; margin-top: 3mm; margin-bottom: 3mm; font-size: .95em; background: #DFDFDF; padding: 0.25em;'>
fstr_bool append(
fstr_bool append_ss(
<div style='margin-left: 4mm;'>String *dest,<br>String src<br></div>)
</div>
<div style='margin-top: 3mm; margin-bottom: 3mm; color: #309030;'><b><i>Description</i></b></div><div style='margin-left: 5mm; margin-right: 5mm;'>This call is equivalent to append_partial.</div><div style='margin-top: 3mm; margin-bottom: 3mm; color: #309030;'><b><i>See Also</i></b></div><div style='margin-left: 5mm; margin-right: 5mm;'><a href='#append_partial_doc'>append_partial</a></div></div><hr>
<div><h4>&sect;4.3.75: append</h4>
<div id='append_sc_str_doc'><h4>&sect;4.3.75: append_sc</h4>
<div style='font-family: "Courier New", Courier, monospace; text-align: left; margin-top: 3mm; margin-bottom: 3mm; font-size: .95em; background: #DFDFDF; padding: 0.25em;'>
fstr_bool append(
fstr_bool append_sc(
<div style='margin-left: 4mm;'>String *dest,<br>char *src<br></div>)
</div>
<div style='margin-top: 3mm; margin-bottom: 3mm; color: #309030;'><b><i>Description</i></b></div><div style='margin-left: 5mm; margin-right: 5mm;'>This call is equivalent to append_partial.</div><div style='margin-top: 3mm; margin-bottom: 3mm; color: #309030;'><b><i>See Also</i></b></div><div style='margin-left: 5mm; margin-right: 5mm;'><a href='#append_partial_doc'>append_partial</a></div></div><hr>
@ -3090,89 +3129,95 @@ fstr_bool float_to_str(
</div>
<div style='margin-top: 3mm; margin-bottom: 3mm; color: #309030;'><b><i>Description</i></b></div><div style='margin-left: 5mm; margin-right: 5mm;'>This call appends a string representation of x onto dest. If there is enough
space in dest this call returns non-zero.</div></div><hr>
<div id='str_is_int_str_doc'><h4>&sect;4.3.88: str_is_int</h4>
<div id='str_is_int_c_str_doc'><h4>&sect;4.3.88: str_is_int_c</h4>
<div style='font-family: "Courier New", Courier, monospace; text-align: left; margin-top: 3mm; margin-bottom: 3mm; font-size: .95em; background: #DFDFDF; padding: 0.25em;'>
fstr_bool str_is_int(
int32_t str_is_int_c(
<div style='margin-left: 4mm;'>char *str<br></div>)
</div>
<div style='margin-top: 3mm; margin-bottom: 3mm; color: #309030;'><b><i>Description</i></b></div><div style='margin-left: 5mm; margin-right: 5mm;'>If str is a valid string representation of an integer, this call returns non-zero</div></div><hr>
<div id='str_is_int_s_str_doc'><h4>&sect;4.3.89: str_is_int_s</h4>
<div style='font-family: "Courier New", Courier, monospace; text-align: left; margin-top: 3mm; margin-bottom: 3mm; font-size: .95em; background: #DFDFDF; padding: 0.25em;'>
fstr_bool str_is_int_s(
<div style='margin-left: 4mm;'>String str<br></div>)
</div>
<div style='margin-top: 3mm; margin-bottom: 3mm; color: #309030;'><b><i>Description</i></b></div><div style='margin-left: 5mm; margin-right: 5mm;'>If str is a valid string representation of an integer, this call returns non-zero.</div></div><hr>
<div id='str_to_int_str_doc'><h4>&sect;4.3.89: str_to_int</h4>
<div id='str_to_int_c_str_doc'><h4>&sect;4.3.90: str_to_int_c</h4>
<div style='font-family: "Courier New", Courier, monospace; text-align: left; margin-top: 3mm; margin-bottom: 3mm; font-size: .95em; background: #DFDFDF; padding: 0.25em;'>
int32_t str_to_int(
int32_t str_to_int_c(
<div style='margin-left: 4mm;'>char *str<br></div>)
</div>
<div style='margin-top: 3mm; margin-bottom: 3mm; color: #309030;'><b><i>Description</i></b></div><div style='margin-left: 5mm; margin-right: 5mm;'>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.</div></div><hr>
<div><h4>&sect;4.3.90: str_to_int</h4>
<div id='str_to_int_s_str_doc'><h4>&sect;4.3.91: str_to_int_s</h4>
<div style='font-family: "Courier New", Courier, monospace; text-align: left; margin-top: 3mm; margin-bottom: 3mm; font-size: .95em; background: #DFDFDF; padding: 0.25em;'>
int32_t str_to_int(
int32_t str_to_int_s(
<div style='margin-left: 4mm;'>String str<br></div>)
</div>
<div style='margin-top: 3mm; margin-bottom: 3mm; color: #309030;'><b><i>Description</i></b></div><div style='margin-left: 5mm; margin-right: 5mm;'>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.</div></div><hr>
<div id='hexchar_to_int_str_doc'><h4>&sect;4.3.91: hexchar_to_int</h4>
<div id='hexchar_to_int_str_doc'><h4>&sect;4.3.92: hexchar_to_int</h4>
<div style='font-family: "Courier New", Courier, monospace; text-align: left; margin-top: 3mm; margin-bottom: 3mm; font-size: .95em; background: #DFDFDF; padding: 0.25em;'>
int32_t hexchar_to_int(
<div style='margin-left: 4mm;'>char c<br></div>)
</div>
<div style='margin-top: 3mm; margin-bottom: 3mm; color: #309030;'><b><i>Description</i></b></div><div style='margin-left: 5mm; margin-right: 5mm;'>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.</div></div><hr>
<div id='int_to_hexchar_str_doc'><h4>&sect;4.3.92: int_to_hexchar</h4>
<div id='int_to_hexchar_str_doc'><h4>&sect;4.3.93: int_to_hexchar</h4>
<div style='font-family: "Courier New", Courier, monospace; text-align: left; margin-top: 3mm; margin-bottom: 3mm; font-size: .95em; background: #DFDFDF; padding: 0.25em;'>
char int_to_hexchar(
<div style='margin-left: 4mm;'>int32_t x<br></div>)
</div>
<div style='margin-top: 3mm; margin-bottom: 3mm; color: #309030;'><b><i>Description</i></b></div><div style='margin-left: 5mm; margin-right: 5mm;'>If x is in the range [0,15] this call returns the equivalent lowercase hexadecimal digit.
Otherwise the return is some nonsense value.</div></div><hr>
<div id='hexstr_to_int_str_doc'><h4>&sect;4.3.93: hexstr_to_int</h4>
<div id='hexstr_to_int_str_doc'><h4>&sect;4.3.94: hexstr_to_int</h4>
<div style='font-family: "Courier New", Courier, monospace; text-align: left; margin-top: 3mm; margin-bottom: 3mm; font-size: .95em; background: #DFDFDF; padding: 0.25em;'>
uint32_t hexstr_to_int(
<div style='margin-left: 4mm;'>String str<br></div>)
</div>
<div style='margin-top: 3mm; margin-bottom: 3mm; color: #309030;'><b><i>Description</i></b></div><div style='margin-left: 5mm; margin-right: 5mm;'>This call interprets str has a hexadecimal representation of an integer and returns
the represented integer value.</div></div><hr>
<div id='color_to_hexstr_str_doc'><h4>&sect;4.3.94: color_to_hexstr</h4>
<div id='color_to_hexstr_str_doc'><h4>&sect;4.3.95: color_to_hexstr</h4>
<div style='font-family: "Courier New", Courier, monospace; text-align: left; margin-top: 3mm; margin-bottom: 3mm; font-size: .95em; background: #DFDFDF; padding: 0.25em;'>
fstr_bool color_to_hexstr(
<div style='margin-left: 4mm;'>String *s,<br>uint32_t color<br></div>)
</div>
<div style='margin-top: 3mm; margin-bottom: 3mm; color: #309030;'><b><i>Description</i></b></div><div style='margin-left: 5mm; margin-right: 5mm;'>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.</div></div><hr>
<div id='hexstr_to_color_str_doc'><h4>&sect;4.3.95: hexstr_to_color</h4>
<div id='hexstr_to_color_str_doc'><h4>&sect;4.3.96: hexstr_to_color</h4>
<div style='font-family: "Courier New", Courier, monospace; text-align: left; margin-top: 3mm; margin-bottom: 3mm; font-size: .95em; background: #DFDFDF; padding: 0.25em;'>
fstr_bool hexstr_to_color(
<div style='margin-left: 4mm;'>String s,<br>uint32_t *out<br></div>)
</div>
<div style='margin-top: 3mm; margin-bottom: 3mm; color: #309030;'><b><i>Description</i></b></div><div style='margin-left: 5mm; margin-right: 5mm;'>This call interprets s as a color and writes the 32-bit integer representation into out.</div></div><hr>
<div id='reverse_seek_slash_str_doc'><h4>&sect;4.3.96: reverse_seek_slash</h4>
<div id='reverse_seek_slash_pos_str_doc'><h4>&sect;4.3.97: reverse_seek_slash_pos</h4>
<div style='font-family: "Courier New", Courier, monospace; text-align: left; margin-top: 3mm; margin-bottom: 3mm; font-size: .95em; background: #DFDFDF; padding: 0.25em;'>
int32_t reverse_seek_slash(
int32_t reverse_seek_slash_pos(
<div style='margin-left: 4mm;'>String str,<br>int32_t pos<br></div>)
</div>
<div style='margin-top: 3mm; margin-bottom: 3mm; color: #309030;'><b><i>Description</i></b></div><div style='margin-left: 5mm; margin-right: 5mm;'>This call searches for a slash in str by starting pos bytes from the end and going backwards.</div></div><hr>
<div><h4>&sect;4.3.97: reverse_seek_slash</h4>
<div id='reverse_seek_slash_str_doc'><h4>&sect;4.3.98: reverse_seek_slash</h4>
<div style='font-family: "Courier New", Courier, monospace; text-align: left; margin-top: 3mm; margin-bottom: 3mm; font-size: .95em; background: #DFDFDF; padding: 0.25em;'>
int32_t reverse_seek_slash(
<div style='margin-left: 4mm;'>String str<br></div>)
</div>
<div style='margin-top: 3mm; margin-bottom: 3mm; color: #309030;'><b><i>Description</i></b></div><div style='margin-left: 5mm; margin-right: 5mm;'>This call searches for a slash in str by starting at the end and going backwards.</div></div><hr>
<div id='front_of_directory_str_doc'><h4>&sect;4.3.98: front_of_directory</h4>
<div id='front_of_directory_str_doc'><h4>&sect;4.3.99: front_of_directory</h4>
<div style='font-family: "Courier New", Courier, monospace; text-align: left; margin-top: 3mm; margin-bottom: 3mm; font-size: .95em; background: #DFDFDF; padding: 0.25em;'>
String front_of_directory(
<div style='margin-left: 4mm;'>String dir<br></div>)
</div>
<div style='margin-top: 3mm; margin-bottom: 3mm; color: #309030;'><b><i>Description</i></b></div><div style='margin-left: 5mm; margin-right: 5mm;'>This call returns a substring of dir containing only the file name or
folder name furthest to the right in the directory.</div><div style='margin-top: 3mm; margin-bottom: 3mm; color: #309030;'><b><i>See Also</i></b></div><div style='margin-left: 5mm; margin-right: 5mm;'><a href='#substr_doc'>substr</a></div></div><hr>
<div id='path_of_directory_str_doc'><h4>&sect;4.3.99: path_of_directory</h4>
<div id='path_of_directory_str_doc'><h4>&sect;4.3.100: path_of_directory</h4>
<div style='font-family: "Courier New", Courier, monospace; text-align: left; margin-top: 3mm; margin-bottom: 3mm; font-size: .95em; background: #DFDFDF; padding: 0.25em;'>
String path_of_directory(
<div style='margin-left: 4mm;'>String dir<br></div>)
</div>
<div style='margin-top: 3mm; margin-bottom: 3mm; color: #309030;'><b><i>Description</i></b></div><div style='margin-left: 5mm; margin-right: 5mm;'>This call returns a substring of dir containing the whole path except
for the final file or folder name.</div><div style='margin-top: 3mm; margin-bottom: 3mm; color: #309030;'><b><i>See Also</i></b></div><div style='margin-left: 5mm; margin-right: 5mm;'><a href='#substr_doc'>substr</a></div></div><hr>
<div id='set_last_folder_str_doc'><h4>&sect;4.3.100: set_last_folder</h4>
<div id='set_last_folder_sc_str_doc'><h4>&sect;4.3.101: set_last_folder_sc</h4>
<div style='font-family: "Courier New", Courier, monospace; text-align: left; margin-top: 3mm; margin-bottom: 3mm; font-size: .95em; background: #DFDFDF; padding: 0.25em;'>
fstr_bool set_last_folder(
fstr_bool set_last_folder_sc(
<div style='margin-left: 4mm;'>String *dir,<br>char *folder_name,<br>char slash<br></div>)
</div>
<div style='margin-top: 3mm; margin-bottom: 3mm; color: #309030;'><b><i>Parameters</i></b></div><div>
@ -3190,9 +3235,9 @@ at the end of the directory.</div></div>
</div>
<div style='margin-top: 3mm; margin-bottom: 3mm; color: #309030;'><b><i>Description</i></b></div><div style='margin-left: 5mm; margin-right: 5mm;'>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.</div></div><hr>
<div><h4>&sect;4.3.101: set_last_folder</h4>
<div id='set_last_folder_ss_str_doc'><h4>&sect;4.3.102: set_last_folder_ss</h4>
<div style='font-family: "Courier New", Courier, monospace; text-align: left; margin-top: 3mm; margin-bottom: 3mm; font-size: .95em; background: #DFDFDF; padding: 0.25em;'>
fstr_bool set_last_folder(
fstr_bool set_last_folder_ss(
<div style='margin-left: 4mm;'>String *dir,<br>String folder_name,<br>char slash<br></div>)
</div>
<div style='margin-top: 3mm; margin-bottom: 3mm; color: #309030;'><b><i>Parameters</i></b></div><div>
@ -3209,20 +3254,20 @@ fstr_bool set_last_folder(
</div>
<div style='margin-top: 3mm; margin-bottom: 3mm; color: #309030;'><b><i>Description</i></b></div><div style='margin-left: 5mm; margin-right: 5mm;'>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.</div></div><hr>
<div id='file_extension_str_doc'><h4>&sect;4.3.102: file_extension</h4>
<div id='file_extension_str_doc'><h4>&sect;4.3.103: file_extension</h4>
<div style='font-family: "Courier New", Courier, monospace; text-align: left; margin-top: 3mm; margin-bottom: 3mm; font-size: .95em; background: #DFDFDF; padding: 0.25em;'>
String file_extension(
<div style='margin-left: 4mm;'>String str<br></div>)
</div>
<div style='margin-top: 3mm; margin-bottom: 3mm; color: #309030;'><b><i>Description</i></b></div><div style='margin-left: 5mm; margin-right: 5mm;'>This call returns a substring containing only the file extension of the provided filename.</div><div style='margin-top: 3mm; margin-bottom: 3mm; color: #309030;'><b><i>See Also</i></b></div><div style='margin-left: 5mm; margin-right: 5mm;'><a href='#substr_doc'>substr</a></div></div><hr>
<div id='remove_last_folder_str_doc'><h4>&sect;4.3.103: remove_last_folder</h4>
<div id='remove_last_folder_str_doc'><h4>&sect;4.3.104: remove_last_folder</h4>
<div style='font-family: "Courier New", Courier, monospace; text-align: left; margin-top: 3mm; margin-bottom: 3mm; font-size: .95em; background: #DFDFDF; padding: 0.25em;'>
fstr_bool remove_last_folder(
<div style='margin-left: 4mm;'>String *str<br></div>)
</div>
<div style='margin-top: 3mm; margin-bottom: 3mm; color: #309030;'><b><i>Description</i></b></div><div style='margin-left: 5mm; margin-right: 5mm;'>This call attemps to delete a folder or filename off the end of a path string.
This call returns non-zero on success.</div></div><hr>
<div id='string_set_match_str_doc'><h4>&sect;4.3.104: string_set_match</h4>
<div id='string_set_match_str_doc'><h4>&sect;4.3.105: string_set_match</h4>
<div style='font-family: "Courier New", Courier, monospace; text-align: left; margin-top: 3mm; margin-bottom: 3mm; font-size: .95em; background: #DFDFDF; padding: 0.25em;'>
fstr_bool string_set_match(
<div style='margin-left: 4mm;'>String *str_set,<br>int32_t count,<br>String str,<br>int32_t *match_index<br></div>)

BIN
4coder_custom.dll Normal file

Binary file not shown.

BIN
4coder_custom.pdb Normal file

Binary file not shown.

View File

@ -180,10 +180,10 @@ OPEN_FILE_HOOK_SIG(my_file_settings){
if (buffer.file_name && buffer.size < (16 << 20)){
String ext = file_extension(make_string(buffer.file_name, buffer.file_name_len));
if (match(ext, make_lit_string("cpp"))) treat_as_code = 1;
else if (match(ext, make_lit_string("h"))) treat_as_code = 1;
else if (match(ext, make_lit_string("c"))) treat_as_code = 1;
else if (match(ext, make_lit_string("hpp"))) treat_as_code = 1;
if (match_ss(ext, make_lit_string("cpp"))) treat_as_code = 1;
else if (match_ss(ext, make_lit_string("h"))) treat_as_code = 1;
else if (match_ss(ext, make_lit_string("c"))) treat_as_code = 1;
else if (match_ss(ext, make_lit_string("hpp"))) treat_as_code = 1;
}
if (treat_as_code){

View File

@ -267,7 +267,7 @@ buffer_seek_string_forward(Application_Links *app, Buffer_Summary *buffer,
char at_pos = stream.data[pos];
if (at_pos == first_char){
app->buffer_read_range(app, buffer, pos, pos+size, read_buffer);
if (match(needle_str, read_str)){
if (match_ss(needle_str, read_str)){
*result = pos;
goto finished;
}
@ -322,7 +322,7 @@ buffer_seek_string_backward(Application_Links *app, Buffer_Summary *buffer,
char at_pos = stream.data[pos];
if (at_pos == first_char){
app->buffer_read_range(app, buffer, pos, pos+size, read_buffer);
if (match(needle_str, read_str)){
if (match_ss(needle_str, read_str)){
*result = pos;
goto finished;
}
@ -372,7 +372,7 @@ buffer_seek_string_insensitive_forward(Application_Links *app, Buffer_Summary *b
char at_pos = char_to_upper(stream.data[pos]);
if (at_pos == first_char){
app->buffer_read_range(app, buffer, pos, pos+size, read_buffer);
if (match_insensitive(needle_str, read_str)){
if (match_insensitive_ss(needle_str, read_str)){
*result = pos;
goto finished;
}
@ -422,7 +422,7 @@ buffer_seek_string_insensitive_backward(Application_Links *app, Buffer_Summary *
char at_pos = char_to_upper(stream.data[pos]);
if (at_pos == first_char){
app->buffer_read_range(app, buffer, pos, pos+size, read_buffer);
if (match_insensitive(needle_str, read_str)){
if (match_insensitive_ss(needle_str, read_str)){
*result = pos;
goto finished;
}
@ -1556,9 +1556,9 @@ file_name_in_quotes(Application_Links *app, String *file_name){
if (size < sizeof(short_file_name)){
if (app->buffer_read_range(app, &buffer, start, end, short_file_name)){
result = true;
copy(file_name, make_string(buffer.file_name, buffer.file_name_len));
copy_ss(file_name, make_string(buffer.file_name, buffer.file_name_len));
remove_last_folder(file_name);
append(file_name, make_string(short_file_name, size));
append_ss(file_name, make_string(short_file_name, size));
}
}
@ -1631,7 +1631,7 @@ CUSTOM_COMMAND_SIG(goto_line){
bar.string = make_fixed_width_string(string_space);
if (query_user_number(app, &bar)){
int line_number = str_to_int(bar.string);
int line_number = str_to_int_s(bar.string);
active_view_to_line(app, access, line_number);
}
}
@ -1684,7 +1684,7 @@ isearch(Application_Links *app, int start_reversed){
break;
}
else if (in.key.character && key_is_unmodified(&in.key)){
append(&bar.string, in.key.character);
append_s_char(&bar.string, in.key.character);
made_change = 1;
}
else if (in.key.keycode == key_back){
@ -1896,10 +1896,11 @@ CUSTOM_COMMAND_SIG(close_all_code){
app->get_buffer_next(app, &buffer, access)){
extension = file_extension(make_string(buffer.file_name, buffer.file_name_len));
if (match(extension, make_lit_string("cpp")) ||
match(extension, make_lit_string("hpp")) ||
match(extension, make_lit_string("c")) ||
match(extension, make_lit_string("h"))){
if (match_ss(extension, make_lit_string("cpp")) ||
match_ss(extension, make_lit_string("hpp")) ||
match_ss(extension, make_lit_string("c")) ||
match_ss(extension, make_lit_string("h")) ||
match_ss(extension, make_lit_string("cc"))){
buffers_to_close[buffers_to_close_count++] = buffer.buffer_id;
}
@ -1916,7 +1917,7 @@ CUSTOM_COMMAND_SIG(open_all_code){
// and doesn't set up a persistent allocation system within app->memory.
// push_directory isn't a very good option since it's tied to the parameter
// stack, so I am phasing that idea out now.
String dir = make_string(app->memory, 0, app->memory_size);
String dir = make_string_cap(app->memory, 0, app->memory_size);
dir.size = app->directory_get_hot(app, dir.str, dir.memory_size);
int dir_size = dir.size;
@ -1927,19 +1928,19 @@ CUSTOM_COMMAND_SIG(open_all_code){
for (int i = 0; i < list.count; ++i){
File_Info *info = list.infos + i;
if (!info->folder){
String extension = make_string(info->filename, info->filename_len, info->filename_len+1);
String extension = make_string_cap(info->filename, info->filename_len, info->filename_len+1);
extension = file_extension(extension);
if (match(extension, make_lit_string("cpp")) ||
match(extension, make_lit_string("hpp")) ||
match(extension, make_lit_string("c")) ||
match(extension, make_lit_string("h")) ||
match(extension, make_lit_string("cc"))){
if (match_ss(extension, make_lit_string("cpp")) ||
match_ss(extension, make_lit_string("hpp")) ||
match_ss(extension, make_lit_string("c")) ||
match_ss(extension, make_lit_string("h")) ||
match_ss(extension, make_lit_string("cc"))){
// NOTE(allen): There's no way in the 4coder API to use relative
// paths at the moment, so everything should be full paths. Which is
// managable. Here simply set the dir string size back to where it
// was originally, so that new appends overwrite old ones.
dir.size = dir_size;
append(&dir, info->filename);
append_sc(&dir, info->filename);
app->create_buffer(app, dir.str, dir.size, 0);
}
}
@ -2016,12 +2017,12 @@ get_build_directory(Application_Links *app, Buffer_Summary *buffer, String *dir_
int result = BuildDir_None;
if (buffer && buffer->file_name){
if (!match(buffer->file_name, buffer->buffer_name)){
String dir = make_string(buffer->file_name,
buffer->file_name_len,
buffer->file_name_len+1);
if (!match_cc(buffer->file_name, buffer->buffer_name)){
String dir = make_string_cap(buffer->file_name,
buffer->file_name_len,
buffer->file_name_len+1);
remove_last_folder(&dir);
append(dir_out, dir);
append_ss(dir_out, dir);
result = BuildDir_AtFile;
}
}
@ -2051,26 +2052,26 @@ standard_build_search(Application_Links *app,
for(;;){
int old_size = dir->size;
append(dir, filename);
append_ss(dir, filename);
if (app->file_exists(app, dir->str, dir->size)){
dir->size = old_size;
if (use_path_in_command){
append(command, '"');
append(command, *dir);
append(command, commandname);
append(command, '"');
append_s_char(command, '"');
append_ss(command, *dir);
append_ss(command, commandname);
append_s_char(command, '"');
}
else{
append(command, commandname);
append_ss(command, commandname);
}
char space[512];
String message = make_fixed_width_string(space);
append(&message, "Building with: ");
append(&message, *command);
append(&message, '\n');
append_ss(&message, make_lit_string("Building with: "));
append_ss(&message, *command);
append_s_char(&message, '\n');
app->print_message(app, message.str, message.size);
@ -2089,8 +2090,8 @@ standard_build_search(Application_Links *app,
dir->size = app->directory_get_hot(app, dir->str, dir->memory_size);
char backup_space[256];
String backup_command = make_fixed_width_string(backup_space);
append(&backup_command, make_lit_string("echo could not find "));
append(&backup_command, filename);
append_ss(&backup_command, make_lit_string("echo could not find "));
append_ss(&backup_command, filename);
app->exec_system_command(app, view,
buffer_identifier(literal("*compilation*")),
dir->str, dir->size,
@ -2258,7 +2259,7 @@ generic_search_all_buffers(Application_Links *app, General_Memory *general, Part
Search_Iter iter = {0};
search_iter_init(general, &iter, string.string.size);
copy(&iter.word, string.string);
copy_ss(&iter.word, string.string);
int buffer_count = app->get_buffer_count(app);
search_set_init(general, &set, buffer_count);
@ -2346,16 +2347,16 @@ generic_search_all_buffers(Application_Links *app, General_Memory *general, Part
part_size += str_len;
String out_line = make_string(spare, 0, str_len);
append(&out_line, make_string(match.buffer.file_name, file_len));
append(&out_line, ':');
String out_line = make_string_cap(spare, 0, str_len);
append_ss(&out_line, make_string(match.buffer.file_name, file_len));
append_s_char(&out_line, ':');
append_int_to_str(&out_line, word_pos.line);
append(&out_line, ':');
append_s_char(&out_line, ':');
append_int_to_str(&out_line, word_pos.character);
append(&out_line, ':');
append(&out_line, ' ');
append(&out_line, line_str);
append(&out_line, '\n');
append_s_char(&out_line, ':');
append_s_char(&out_line, ' ');
append_ss(&out_line, line_str);
append_s_char(&out_line, '\n');
end_temp_memory(line_temp);
}
@ -2589,19 +2590,19 @@ CUSTOM_COMMAND_SIG(execute_arbitrary_command){
// is still available in bar.string though.
app->end_query_bar(app, &bar, 0);
if (match(bar.string, make_lit_string("open all code"))){
if (match_ss(bar.string, make_lit_string("open all code"))){
exec_command(app, open_all_code);
}
else if(match(bar.string, make_lit_string("close all code"))){
else if(match_ss(bar.string, make_lit_string("close all code"))){
exec_command(app, close_all_code);
}
else if (match(bar.string, make_lit_string("open menu"))){
else if (match_ss(bar.string, make_lit_string("open menu"))){
exec_command(app, cmdid_open_menu);
}
else if (match(bar.string, make_lit_string("dos lines"))){
else if (match_ss(bar.string, make_lit_string("dos lines"))){
exec_command(app, eol_dosify);
}
else if (match(bar.string, make_lit_string("nix lines"))){
else if (match_ss(bar.string, make_lit_string("nix lines"))){
exec_command(app, eol_nixify);
}
else{

View File

@ -388,7 +388,7 @@ query_user_general(Application_Links *app, Query_Bar *bar, int force_number){
}
}
else if (good_character){
append(&bar->string, in.key.character);
append_s_char(&bar->string, in.key.character);
}
}
}

View File

@ -18,40 +18,40 @@ static int
ms_style_verify(String line, int paren_pos){
int result = false;
String line_part = substr(line, paren_pos);
if (match_part(line_part, ") : ")){
result = true;
}
else if (match_part(line_part, "): ")){
result = true;
}
return(result);
}
static int
String line_part = substr_tail(line, paren_pos);
if (match_part_sc(line_part, ") : ")){
result = true;
}
else if (match_part_sc(line_part, "): ")){
result = true;
}
return(result);
}
static int
parse_error(String line, Jump_Location *location,
int skip_sub_errors, int *colon_char){
int result = false;
int result = false;
String original_line = line;
line = skip_chop_whitespace(line);
int colon_pos = find(line, 0, ')');
int colon_pos = find_s_char(line, 0, ')');
if (ms_style_verify(line, colon_pos)){
colon_pos = find(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);
int paren_pos = find(location_str, 0, '(');
int 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);
int close_pos = find(location_str, 0, ')') + 1;
int 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,
@ -61,17 +61,17 @@ parse_error(String line, Jump_Location *location,
if (line_number.size > 0){
location->file = file;
int comma_pos = find(line_number, 0, ',');
int comma_pos = find_s_char(line_number, 0, ',');
if (comma_pos < line_number.size){
int 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(line_number);
location->column = str_to_int(column_number);
location->line = str_to_int_s(line_number);
location->column = str_to_int_s(column_number);
}
else{
location->line = str_to_int(line_number);
location->line = str_to_int_s(line_number);
location->column = 1;
}
@ -85,15 +85,15 @@ parse_error(String line, Jump_Location *location,
}
else{
int colon_pos1 = find(line, 0, ':');
int colon_pos1 = find_s_char(line, 0, ':');
if (line.size > colon_pos1+1){
if (char_is_slash(line.str[colon_pos1+1])){
colon_pos1 = find(line, colon_pos1+1, ':');
colon_pos1 = find_s_char(line, colon_pos1+1, ':');
}
}
int colon_pos2 = find(line, colon_pos1+1, ':');
int colon_pos3 = find(line, colon_pos2+1, ':');
int colon_pos2 = find_s_char(line, colon_pos1+1, ':');
int colon_pos3 = find_s_char(line, colon_pos2+1, ':');
if (colon_pos3 < line.size){
String filename = substr(line, 0, colon_pos1);
@ -104,30 +104,30 @@ parse_error(String line, Jump_Location *location,
line_number.size > 0 &&
column_number.size > 0){
location->file = filename;
location->line = str_to_int(line_number);
location->column = str_to_int(column_number);
location->line = str_to_int_s(line_number);
location->column = str_to_int_s(column_number);
*colon_char = colon_pos3;
result = true;
}
}
else{
colon_pos1 = find(line, 0, ':');
colon_pos1 = find_s_char(line, 0, ':');
if (line.size > colon_pos1+1){
if (char_is_slash(line.str[colon_pos1+1])){
colon_pos1 = find(line, colon_pos1+1, ':');
colon_pos1 = find_s_char(line, colon_pos1+1, ':');
}
}
colon_pos2 = find(line, colon_pos1+1, ':');
colon_pos2 = find_s_char(line, colon_pos1+1, ':');
if (colon_pos2 < line.size){
String filename = substr(line, 0, colon_pos1);
String line_number = substr(line, colon_pos1+1, colon_pos2 - colon_pos1 - 1);
if (str_is_int(line_number)){
if (str_is_int_s(line_number)){
if (filename.size > 0 && line_number.size > 0){
location->file = filename;
location->line = str_to_int(line_number);
location->line = str_to_int_s(line_number);
location->column = 0;
*colon_char = colon_pos2;
result = true;

File diff suppressed because it is too large Load Diff

View File

@ -188,7 +188,7 @@ static int32_t
tbl_string_compare(void *a, void *b, void *arg){
String *stra = (String*)a;
String *strb = (String*)b;
int32_t result = !match(*stra, *strb);
int32_t result = !match_ss(*stra, *strb);
return(result);
}
@ -217,7 +217,7 @@ tbl_offset_string_compare(void *a, void *b, void *arg){
Offset_String *ostrb = (Offset_String*)b;
String stra = make_string((char*)arg + ostra->offset, ostra->size);
String strb = make_string((char*)arg + ostrb->offset, ostrb->size);
int32_t result = !match(stra, strb);
int32_t result = !match_ss(stra, strb);
return(result);
}

View File

@ -398,7 +398,7 @@ sub_match_list(char *data, int size, int pos, String_List list, int sub_size){
str_main = substr(str_main, 0, sub_size);
for (i = 0; i < list.count; ++i){
str_check = list.data[i].str;
if (match(str_main, str_check)){
if (match_sc(str_main, str_check)){
result.index = i;
result.new_pos = pos + sub_size;
break;
@ -408,7 +408,7 @@ sub_match_list(char *data, int size, int pos, String_List list, int sub_size){
else{
for (i = 0; i < list.count; ++i){
str_check = list.data[i].str;
if (match_part(str_main, str_check, &l)){
if (match_part_scl(str_main, str_check, &l)){
result.index = i;
result.new_pos = pos + l;
break;
@ -607,7 +607,7 @@ cpp_read_alpha_numeric(char *data, int size, int pos, bool in_if_body){
String word;
word.size = result.token.size;
word.str = data + result.token.start;
if (match(word, "defined")){
if (match_ss(word, make_lit_string("defined"))){
result.token.type = CPP_TOKEN_DEFINED;
result.token.flags |= CPP_TFLAG_IS_OPERATOR;
result.token.flags |= CPP_TFLAG_IS_KEYWORD;

20
4ed.cpp
View File

@ -141,7 +141,7 @@ consume_input(Available_Input *available, i32 input_type, char *consumer){
record->consumed = 1;
if (consumer){
String str = make_fixed_width_string(record->consumer);
copy(&str, consumer);
copy_sc(&str, consumer);
terminate_with_null(&str);
}
else{
@ -336,7 +336,7 @@ COMMAND_DECL(reopen){
USE_VIEW(view);
REQ_FILE(file, view);
if (match(file->name.source_path, file->name.live_name)) return;
if (match_ss(file->name.source_path, file->name.live_name)) return;
if (file->canon.name.size != 0){
Plat_Handle handle;
@ -1174,7 +1174,7 @@ init_command_line_settings(App_Settings *settings, Plat_Settings *plat_settings,
case CLAct_InitialFilePosition:
{
if (i < clparams.argc){
settings->initial_line = str_to_int(clparams.argv[i]);
settings->initial_line = str_to_int_c(clparams.argv[i]);
}
action = CLAct_Nothing;
}break;
@ -1183,8 +1183,8 @@ init_command_line_settings(App_Settings *settings, Plat_Settings *plat_settings,
{
if (i + 1 < clparams.argc){
plat_settings->set_window_size = true;
plat_settings->window_w = str_to_int(clparams.argv[i]);
plat_settings->window_h = str_to_int(clparams.argv[i+1]);
plat_settings->window_w = str_to_int_c(clparams.argv[i]);
plat_settings->window_h = str_to_int_c(clparams.argv[i+1]);
++i;
}
@ -1202,8 +1202,8 @@ init_command_line_settings(App_Settings *settings, Plat_Settings *plat_settings,
{
if (i + 1 < clparams.argc){
plat_settings->set_window_pos = true;
plat_settings->window_x = str_to_int(clparams.argv[i]);
plat_settings->window_y = str_to_int(clparams.argv[i+1]);
plat_settings->window_x = str_to_int_c(clparams.argv[i]);
plat_settings->window_y = str_to_int_c(clparams.argv[i+1]);
++i;
}
@ -1213,7 +1213,7 @@ init_command_line_settings(App_Settings *settings, Plat_Settings *plat_settings,
case CLAct_FontSize:
{
if (i < clparams.argc){
settings->font_size = str_to_int(clparams.argv[i]);
settings->font_size = str_to_int_c(clparams.argv[i]);
}
action = CLAct_Nothing;
}break;
@ -1601,7 +1601,7 @@ App_Init_Sig(app_init){
// TODO(allen): more robust allocation solution for the clipboard
if (clipboard.str){
String *dest = working_set_next_clipboard_string(&models->mem.general, &models->working_set, clipboard.size);
copy(dest, make_string((char*)clipboard.str, clipboard.size));
copy_ss(dest, make_string((char*)clipboard.str, clipboard.size));
}
// NOTE(allen): style setup
@ -1642,7 +1642,7 @@ update_cli_handle_with_file(System_Functions *system, Models *models,
if (system->cli_end_update(cli)){
char str_space[256];
String str = make_fixed_width_string(str_space);
append(&str, "exited with code ");
append_ss(&str, make_lit_string("exited with code "));
append_int_to_str(&str, cli->exit);
output_file_append(system, models, file, str, cursor_at_end);
result = -1;

View File

@ -221,17 +221,17 @@ DOC_SEE(Command_Line_Input_Flag)
file = get_file_from_identifier(system, working_set, buffer);
if (file){
if (file->settings.read_only == 0){
append(&feedback_str, "ERROR: ");
append(&feedback_str, file->name.live_name);
append(&feedback_str, " is not a read-only buffer\n");
append_ss(&feedback_str, make_lit_string("ERROR: "));
append_ss(&feedback_str, file->name.live_name);
append_ss(&feedback_str, make_lit_string(" is not a read-only buffer\n"));
do_feedback_message(system, models, feedback_str);
result = false;
goto done;
}
if (file->settings.never_kill){
append(&feedback_str, "The buffer ");
append(&feedback_str, file->name.live_name);
append(&feedback_str, " is not killable");
append_ss(&feedback_str, make_lit_string("The buffer "));
append_ss(&feedback_str, file->name.live_name);
append_ss(&feedback_str, make_lit_string(" is not killable"));
do_feedback_message(system, models, feedback_str);
result = false;
goto done;
@ -240,7 +240,8 @@ DOC_SEE(Command_Line_Input_Flag)
else if (buffer.name){
file = working_set_alloc_always(working_set, general);
if (file == 0){
append(&feedback_str, "ERROR: unable to allocate a new buffer\n");
append_ss(&feedback_str,
make_lit_string("ERROR: unable to allocate a new buffer\n"));
do_feedback_message(system, models, feedback_str);
result = false;
goto done;
@ -277,7 +278,8 @@ DOC_SEE(Command_Line_Input_Flag)
}
}
else{
append(&feedback_str, "did not begin command-line command because the target buffer is already in use\n");
append_ss(&feedback_str,
make_lit_string("did not begin command-line command because the target buffer is already in use\n"));
do_feedback_message(system, models, feedback_str);
result = false;
goto done;
@ -326,7 +328,7 @@ DOC_SEE(Command_Line_Input_Flag)
}
}
else{
append(&feedback_str, "ERROR: no available process slot\n");
append_ss(&feedback_str, make_lit_string("ERROR: no available process slot\n"));
do_feedback_message(system, models, feedback_str);
result = false;
goto done;
@ -357,7 +359,7 @@ DOC_SEE(The_4coder_Clipboard)
Working_Set *working = &models->working_set;
String *dest = working_set_next_clipboard_string(general, working, len);
copy(dest, make_string(str, len));
copy_ss(dest, make_string(str, len));
system->post_clipboard(*dest);
}
@ -396,8 +398,8 @@ DOC_SEE(The_4coder_Clipboard)
if (str){
size = str->size;
if (out){
String out_str = make_string(out, 0, len);
copy(&out_str, *str);
String out_str = make_string_cap(out, 0, len);
copy_ss(&out_str, *str);
}
}
@ -1904,7 +1906,7 @@ DOC(This call changes 4coder's color pallet to one of the built in themes.)
Style *s = styles->styles;
for (i = 0; i < count; ++i, ++s){
if (match(s->name, theme_name)){
if (match_ss(s->name, theme_name)){
style_copy(main_style(cmd->models), s);
break;
}

View File

@ -364,7 +364,7 @@ tbl_name_compare(void *a, void *b, void *arg){
File_Name_Entry *fb = (File_Name_Entry*)b;
i32 result = 1;
if (match(*fa, fb->name)){
if (match_ss(*fa, fb->name)){
result = 0;
}
@ -635,7 +635,7 @@ working_set_lookup_file(Working_Set *working_set, String string){
used_nodes = &working_set->used_sentinel;
for (dll_items(node, used_nodes)){
file = (Editing_File*)node;
if (string.size == 0 || match(string, file->name.live_name)){
if (string.size == 0 || match_ss(string, file->name.live_name)){
break;
}
}
@ -647,7 +647,7 @@ working_set_lookup_file(Working_Set *working_set, String string){
used_nodes = &working_set->used_sentinel;
for (dll_items(node, used_nodes)){
file = (Editing_File*)node;
if (string.size == 0 || has_substr(file->name.live_name, string)){
if (string.size == 0 || has_substr_s(file->name.live_name, string)){
break;
}
}
@ -690,7 +690,9 @@ hot_directory_quick_partition(File_Info *infos, i32 start, i32 pivot){
for (i32 i = start; i < pivot; ++i, ++a){
i32 comp = 0;
comp = p->folder - a->folder;
if (comp == 0) comp = compare(a->filename, p->filename);
if (comp == 0){
comp = compare_cc(a->filename, p->filename);
}
if (comp < 0){
Swap(File_Info, *a, infos[start]);
++start;
@ -717,7 +719,7 @@ hot_directory_fixup(Hot_Directory *hot_directory, Working_Set *working_set){
inline void
hot_directory_set(System_Functions *system, Hot_Directory *hot_directory,
String str, Working_Set *working_set){
b32 success = copy_checked(&hot_directory->string, str);
b32 success = copy_checked_ss(&hot_directory->string, str);
terminate_with_null(&hot_directory->string);
if (success){
if (str.size > 0){
@ -741,8 +743,8 @@ hot_directory_init(Hot_Directory *hot_directory, String base, String dir, char s
hot_directory->string = base;
hot_directory->string.str[255] = 0;
hot_directory->string.size = 0;
copy(&hot_directory->string, dir);
append(&hot_directory->string, slash);
copy_ss(&hot_directory->string, dir);
append_s_char(&hot_directory->string, slash);
hot_directory->slash = slash;
}
@ -755,7 +757,7 @@ internal b32
filename_match(String query, Absolutes *absolutes, String filename, b32 case_sensitive){
b32 result;
result = (query.size == 0);
if (!result) result = wildcard_match(absolutes, filename, case_sensitive);
if (!result) result = wildcard_match_s(absolutes, filename, case_sensitive);
return result;
}
@ -858,15 +860,15 @@ internal void
buffer_get_new_name(Working_Set *working_set, Editing_File_Name *name, String filename){
Assert(name->live_name.str != 0);
copy_checked(&name->source_path, filename);
copy(&name->live_name, front_of_directory(filename));
copy_checked_ss(&name->source_path, filename);
copy_ss(&name->live_name, front_of_directory(filename));
if (name->source_path.size == name->live_name.size){
name->extension.size = 0;
}
else{
String ext = file_extension(filename);
copy(&name->extension, ext);
copy_ss(&name->extension, ext);
}
{
@ -880,7 +882,7 @@ buffer_get_new_name(Working_Set *working_set, Editing_File_Name *name, String fi
for (dll_items(node, used_nodes)){
Editing_File *file_ptr = (Editing_File*)node;
if (file_is_ready(file_ptr)){
if (match(name->live_name, file_ptr->name.live_name)){
if (match_ss(name->live_name, file_ptr->name.live_name)){
++file_x;
hit_conflict = 1;
break;
@ -890,9 +892,9 @@ buffer_get_new_name(Working_Set *working_set, Editing_File_Name *name, String fi
if (hit_conflict){
name->live_name.size = original_len;
append(&name->live_name, " <");
append_ss(&name->live_name, make_lit_string(" <"));
append_int_to_str(&name->live_name, file_x);
append(&name->live_name, ">");
append_s_char(&name->live_name, '>');
}
}
}
@ -913,7 +915,7 @@ buffer_bind_file(System_Functions *system, General_Memory *general, Working_Set
Assert(file->canon.name.size == 0);
file->canon.name = make_fixed_width_string(file->canon.name_);
copy(&file->canon.name, canon_filename);
copy_ss(&file->canon.name, canon_filename);
terminate_with_null(&file->canon.name);
system->add_listener(file->canon.name_);
b32 result = working_set_canon_add(general, working_set, file, file->canon.name);
@ -944,9 +946,9 @@ buffer_bind_name(General_Memory *general, Working_Set *working_set,
buffer_get_new_name(working_set, &new_name, filename);
editing_file_name_init(&file->name);
copy(&file->name.live_name, new_name.live_name);
copy(&file->name.source_path, new_name.source_path);
copy(&file->name.extension, new_name.extension);
copy_ss(&file->name.live_name, new_name.live_name);
copy_ss(&file->name.source_path, new_name.source_path);
copy_ss(&file->name.extension, new_name.extension);
b32 result = working_set_name_add(general, working_set, file, file->name.live_name);
Assert(result); AllowLocal(result);

View File

@ -2434,7 +2434,7 @@ working_set_next_clipboard_string(General_Memory *general, Working_Set *working,
new_str = (char*)general_memory_allocate(general, str_size+1);
}
// TODO(allen): What if new_str == 0?
*result = make_string(new_str, 0, str_size);
*result = make_string_cap(new_str, 0, str_size);
return result;
}
@ -3123,8 +3123,8 @@ view_show_file(View *view){
internal String
make_string_terminated(Partition *part, char *str, i32 len){
char *space = (char*)push_array(part, char, len + 1);
String string = make_string(str, len, len+1);
copy_fast_unsafe(space, string);
String string = make_string_cap(str, len, len+1);
copy_fast_unsafe_cs(space, string);
string.str = space;
terminate_with_null(&string);
return(string);
@ -3317,7 +3317,7 @@ interactive_begin_sure_to_kill(System_Functions *system, View *view, Editing_Fil
view_show_interactive(system, view,
IAct_Sure_To_Kill, IInt_Sure_To_Kill,
make_lit_string("Are you sure?"));
copy(&view->dest, file->name.live_name);
copy_ss(&view->dest, file->name.live_name);
}
enum Try_Kill_Result{
@ -3638,9 +3638,9 @@ begin_exhaustive_loop(Exhaustive_File_Loop *loop, Hot_Directory *hdir){
loop->infos = hdir->file_list.infos;
loop->count = hdir->file_list.count;
copy(&loop->front_name, front_of_directory(hdir->string));
copy_ss(&loop->front_name, front_of_directory(hdir->string));
get_absolutes(loop->front_name, &loop->absolutes, 1, 1);
copy(&loop->full_path, path_of_directory(hdir->string));
copy_ss(&loop->full_path, path_of_directory(hdir->string));
loop->r = loop->full_path.size;
}
@ -3655,7 +3655,7 @@ get_exhaustive_info(System_Functions *system, Working_Set *working_set, Exhausti
result.info = loop->infos + i;
loop->full_path.size = loop->r;
append(&loop->full_path, result.info->filename);
append_sc(&loop->full_path, result.info->filename);
terminate_with_null(&loop->full_path);
Editing_File_Canon_Name canon_name;
@ -3664,8 +3664,8 @@ get_exhaustive_info(System_Functions *system, Working_Set *working_set, Exhausti
file = working_set_canon_contains(working_set, canon_name.name);
}
String filename = make_string(result.info->filename,
result.info->filename_len, result.info->filename_len+1);
String filename = make_string_cap(result.info->filename,
result.info->filename_len, result.info->filename_len+1);
result.is_folder = (result.info->folder != 0);
result.name_match = (filename_match(loop->front_name, &loop->absolutes, filename, 0) != 0);
@ -3854,9 +3854,9 @@ internal void
append_label(String *string, i32 indent_level, char *message){
i32 r = 0;
for (r = 0; r < indent_level; ++r){
append(string, '>');
append_s_char(string, '>');
}
append(string, message);
append_sc(string, message);
}
internal void
@ -3866,8 +3866,8 @@ show_gui_line(GUI_Target *target, String *string,
append_label(string, indent_level, message);
if (follow_up){
append_padding(string, '-', h_align);
append(string, ' ');
append(string, follow_up);
append_s_char(string, ' ');
append_sc(string, follow_up);
}
gui_do_text_field(target, *string, string_zero());
}
@ -3878,7 +3878,7 @@ show_gui_int(GUI_Target *target, String *string,
string->size = 0;
append_label(string, indent_level, message);
append_padding(string, '-', h_align);
append(string, ' ');
append_s_char(string, ' ');
append_int_to_str(string, x);
gui_do_text_field(target, *string, string_zero());
}
@ -3889,7 +3889,7 @@ show_gui_u64(GUI_Target *target, String *string,
string->size = 0;
append_label(string, indent_level, message);
append_padding(string, '-', h_align);
append(string, ' ');
append_s_char(string, ' ');
append_u64_to_str(string, x);
gui_do_text_field(target, *string, string_zero());
}
@ -3900,9 +3900,9 @@ show_gui_int_int(GUI_Target *target, String *string,
string->size = 0;
append_label(string, indent_level, message);
append_padding(string, '-', h_align);
append(string, ' ');
append_s_char(string, ' ');
append_int_to_str(string, x);
append(string, '/');
append_s_char(string, '/');
append_int_to_str(string, m);
gui_do_text_field(target, *string, string_zero());
}
@ -3913,10 +3913,10 @@ show_gui_id(GUI_Target *target, String *string,
string->size = 0;
append_label(string, indent_level, message);
append_padding(string, '-', h_align);
append(string, " [0]: ");
append_ss(string, make_lit_string(" [0]: "));
append_u64_to_str(string, id.id[0]);
append_padding(string, ' ', h_align + 26);
append(string, " [1]: ");
append_ss(string, make_lit_string(" [1]: "));
append_u64_to_str(string, id.id[1]);
gui_do_text_field(target, *string, string_zero());
}
@ -3927,7 +3927,7 @@ show_gui_float(GUI_Target *target, String *string,
string->size = 0;
append_label(string, indent_level, message);
append_padding(string, '-', h_align);
append(string, ' ');
append_s_char(string, ' ');
append_float_to_str(string, x);
gui_do_text_field(target, *string, string_zero());
}
@ -3979,11 +3979,11 @@ struct View_Step_Result{
inline void
gui_show_mouse(GUI_Target *target, String *string, i32 mx, i32 my){
string->size = 0;
append(string, "mouse: (");
append_ss(string, make_lit_string("mouse: ("));
append_int_to_str(string, mx);
append(string, ",");
append_s_char(string, ',');
append_int_to_str(string, my);
append(string, ")");
append_s_char(string, ')');
gui_do_text_field(target, *string, string_zero());
}
@ -4190,8 +4190,8 @@ step_file_view(System_Functions *system, View *view, View *active_view, Input_Su
else{
char message_space[256];
message = make_fixed_width_string(message_space);
copy(&message, make_lit_string("currently selected: "));
append(&message, info->name);
copy_ss(&message, make_lit_string("currently selected: "));
append_ss(&message, info->name);
gui_do_font_button(target, id, i, message);
}
}
@ -4384,19 +4384,19 @@ step_file_view(System_Functions *system, View *view, View *active_view, Input_Su
if (file_info.name_match){
id.id[0] = (u64)(file_info.info);
String filename = make_string(file_info.info->filename,
file_info.info->filename_len,
file_info.info->filename_len+1);
String filename = make_string_cap(file_info.info->filename,
file_info.info->filename_len,
file_info.info->filename_len+1);
if (gui_do_file_option(target, id, filename,
file_info.is_folder, file_info.message)){
if (file_info.is_folder){
set_last_folder(&hdir->string, file_info.info->filename, '/');
set_last_folder_sc(&hdir->string, file_info.info->filename, '/');
do_new_directory = 1;
}
else if (use_item_in_list){
complete = 1;
copy(&comp_dest, loop.full_path);
copy_ss(&comp_dest, loop.full_path);
}
}
}
@ -4406,7 +4406,7 @@ step_file_view(System_Functions *system, View *view, View *active_view, Input_Su
if (activate_directly){
complete = 1;
copy(&comp_dest, hdir->string);
copy_ss(&comp_dest, hdir->string);
}
if (do_new_directory){
@ -4502,7 +4502,7 @@ step_file_view(System_Functions *system, View *view, View *active_view, Input_Su
id.id[0] = (u64)(file);
if (gui_do_file_option(target, id, file->name.live_name, 0, message)){
complete = 1;
copy(&comp_dest, file->name.live_name);
copy_ss(&comp_dest, file->name.live_name);
}
}
}
@ -4523,7 +4523,7 @@ step_file_view(System_Functions *system, View *view, View *active_view, Input_Su
id.id[0] = (u64)(file);
if (gui_do_file_option(target, id, file->name.live_name, 0, message)){
complete = 1;
copy(&comp_dest, file->name.live_name);
copy_ss(&comp_dest, file->name.live_name);
}
}
@ -4558,7 +4558,7 @@ step_file_view(System_Functions *system, View *view, View *active_view, Input_Su
if (action != -1){
complete = 1;
copy(&comp_dest, view->dest);
copy_ss(&comp_dest, view->dest);
comp_action = action;
}
}break;
@ -4592,7 +4592,7 @@ step_file_view(System_Functions *system, View *view, View *active_view, Input_Su
if (action != -1){
complete = 1;
copy(&comp_dest, view->dest);
copy_ss(&comp_dest, view->dest);
comp_action = action;
}
}break;
@ -4633,7 +4633,7 @@ step_file_view(System_Functions *system, View *view, View *active_view, Input_Su
string.size = 0;
u64 time = system->now_time();
append(&string, "last redraw: ");
append_ss(&string, make_lit_string("last redraw: "));
append_u64_to_str(&string, time);
gui_do_text_field(target, string, empty_str);
@ -4680,60 +4680,60 @@ step_file_view(System_Functions *system, View *view, View *active_view, Input_Su
string.size = 0;
if (input_event->is_hold){
append(&string, "hold: ");
append_ss(&string, make_lit_string("hold: "));
}
else{
append(&string, "press: ");
append_ss(&string, make_lit_string("press: "));
}
if (input_event->is_ctrl){
append(&string, "ctrl-");
append_ss(&string, make_lit_string("ctrl-"));
}
else{
append(&string, " -");
append_ss(&string, make_lit_string(" -"));
}
if (input_event->is_alt){
append(&string, "alt-");
append_ss(&string, make_lit_string("alt-"));
}
else{
append(&string, " -");
append_ss(&string, make_lit_string(" -"));
}
if (input_event->is_shift){
append(&string, "shift ");
append_ss(&string, make_lit_string("shift "));
}
else{
append(&string, " ");
append_ss(&string, make_lit_string(" "));
}
if (input_event->key > ' ' && input_event->key <= '~'){
append(&string, make_string(&input_event->key, 1));
append_ss(&string, make_string(&input_event->key, 1));
}
else if (input_event->key == ' '){
append(&string, "space");
append_ss(&string, make_lit_string("space"));
}
else if (input_event->key == '\n'){
append(&string, "\\n");
append_ss(&string, make_lit_string("\\n"));
}
else if (input_event->key == '\t'){
append(&string, "\\t");
append_ss(&string, make_lit_string("\\t"));
}
else{
String str;
str.str = global_key_name(input_event->key, &str.size);
if (str.str){
str.memory_size = str.size + 1;
append(&string, str);
append_ss(&string, str);
}
else{
append(&string, "unrecognized!");
append_ss(&string, make_lit_string("unrecognized!"));
}
}
if (input_event->consumer[0] != 0){
append_padding(&string, ' ', 40);
append(&string, input_event->consumer);
append_sc(&string, input_event->consumer);
}
gui_do_text_field(target, string, empty_str);
@ -4750,21 +4750,21 @@ step_file_view(System_Functions *system, View *view, View *active_view, Input_Su
threads, &pending);
string.size = 0;
append(&string, "pending jobs: ");
append_ss(&string, make_lit_string("pending jobs: "));
append_int_to_str(&string, pending);
gui_do_text_field(target, string, empty_str);
for (i32 i = 0; i < 4; ++i){
string.size = 0;
append(&string, "thread ");
append_ss(&string, make_lit_string("thread "));
append_int_to_str(&string, i);
append(&string, ": ");
append_ss(&string, make_lit_string(": "));
if (threads[i]){
append(&string, "running");
append_ss(&string, make_lit_string("running"));
}
else{
append(&string, "waiting");
append_ss(&string, make_lit_string("waiting"));
}
gui_do_text_field(target, string, empty_str);
@ -4775,9 +4775,9 @@ step_file_view(System_Functions *system, View *view, View *active_view, Input_Su
General_Memory *general = &models->mem.general;
string.size = 0;
append(&string, "part memory: ");
append_ss(&string, make_lit_string("part memory: "));
append_int_to_str(&string, part->pos);
append(&string, "/");
append_s_char(&string, '/');
append_int_to_str(&string, part->max);
gui_do_text_field(target, string, empty_str);
@ -4786,10 +4786,10 @@ step_file_view(System_Functions *system, View *view, View *active_view, Input_Su
for (dll_items(bubble, sentinel)){
string.size = 0;
if (bubble->flags & MEM_BUBBLE_USED){
append(&string, " used: ");
append_ss(&string, make_lit_string(" used: "));
}
else{
append(&string, " free: ");
append_ss(&string, make_lit_string(" free: "));
}
append_int_to_str(&string, bubble->size);
@ -4826,28 +4826,28 @@ step_file_view(System_Functions *system, View *view, View *active_view, Input_Su
View *view_ptr = views_to_inspect[i];
string.size = 0;
append(&string, "view: ");
append_ss(&string, make_lit_string("view: "));
append_int_to_str(&string, view_ptr->persistent.id + 1);
gui_do_text_field(target, string, empty_str);
string.size = 0;
Editing_File *file = view_ptr->file_data.file;
append(&string, " > buffer: ");
append_ss(&string, make_lit_string(" > buffer: "));
if (file){
append(&string, file->name.live_name);
append_ss(&string, file->name.live_name);
gui_do_text_field(target, string, empty_str);
string.size = 0;
append(&string, " >> buffer-slot-id: ");
append_ss(&string, make_lit_string(" >> buffer-slot-id: "));
append_int_to_str(&string, file->id.id);
}
else{
append(&string, "*NULL*");
append_ss(&string, make_lit_string("*NULL*"));
gui_do_text_field(target, string, empty_str);
}
if (low_detail){
string.size = 0;
append(&string, "inspect this");
append_ss(&string, make_lit_string("inspect this"));
id.id[0] = (u64)(view_ptr->persistent.id);
if (gui_do_button(target, id, string)){
@ -4858,15 +4858,15 @@ step_file_view(System_Functions *system, View *view, View *active_view, Input_Su
gui_show_mouse(target, &string, input.mouse.x, input.mouse.y);
#define SHOW_GUI_BLANK(n) show_gui_line(target, &string, n, 0, "", 0)
#define SHOW_GUI_LINE(n, str) show_gui_line(target, &string, n, 0, " " str, 0)
#define SHOW_GUI_BLANK(n) show_gui_line(target, &string, n, 0, "", 0)
#define SHOW_GUI_LINE(n, str) show_gui_line(target, &string, n, 0, " " str, 0)
#define SHOW_GUI_STRING(n, h, str, mes) show_gui_line(target, &string, n, h, " " str " ", mes)
#define SHOW_GUI_INT(n, h, str, v) show_gui_int(target, &string, n, h, " " str " ", v)
#define SHOW_GUI_INT(n, h, str, v) show_gui_int(target, &string, n, h, " " str " ", v)
#define SHOW_GUI_INT_INT(n, h, str, v, m) show_gui_int_int(target, &string, n, h, " " str " ", v, m)
#define SHOW_GUI_U64(n, h, str, v) show_gui_u64(target, &string, n, h, " " str " ", v)
#define SHOW_GUI_ID(n, h, str, v) show_gui_id(target, &string, n, h, " " str, v)
#define SHOW_GUI_U64(n, h, str, v) show_gui_u64(target, &string, n, h, " " str " ", v)
#define SHOW_GUI_ID(n, h, str, v) show_gui_id(target, &string, n, h, " " str, v)
#define SHOW_GUI_FLOAT(n, h, str, v) show_gui_float(target, &string, n, h, " " str " ", v)
#define SHOW_GUI_BOOL(n, h, str, v) do { if (v) { show_gui_line(target, &string, n, h, " " str " ", "true"); }\
#define SHOW_GUI_BOOL(n, h, str, v) do { if (v) { show_gui_line(target, &string, n, h, " " str " ", "true"); }\
else { show_gui_line(target, &string, n, h, " " str " ", "false"); } } while(false)
#define SHOW_GUI_SCROLL(n, h, str, v) show_gui_scroll(target, &string, n, h, " " str, v)
@ -5566,9 +5566,9 @@ draw_file_bar(Render_Target *target, View *view, Editing_File *file, i32_Rect re
else{
char line_number_space[30];
String line_number = make_fixed_width_string(line_number_space);
append(&line_number, " L#");
append_ss(&line_number, make_lit_string(" L#"));
append_int_to_str(&line_number, view->edit_pos->cursor.line);
append(&line_number, " C#");
append_ss(&line_number, make_lit_string(" C#"));
append_int_to_str(&line_number, view->edit_pos->cursor.character);
intbar_draw_string(target, &bar, line_number, base_color);
@ -5870,7 +5870,7 @@ do_render_file_view(System_Functions *system, View *view, GUI_Scroll_Vars *scrol
String m = gui_read_string(&ptr);
if (folder){
append(&f, system->slash);
append_s_char(&f, system->slash);
}
draw_fat_option_block(gui_target, target, view, font_id, gui_session.rect, b->id, f, m);

View File

@ -217,7 +217,7 @@ font_set_find_pos(Font_Set *set, String name, u32 *position){
if (i == set->max) i = 0;
entry = set->entries + i;
if (entry->hash == hash){
if (match(name, entry->name)){
if (match_ss(name, entry->name)){
result = 1;
*position = i;
break;

View File

@ -365,6 +365,7 @@ struct Function_Set{
String *args;
String *body;
String *marker;
String *cpp_name;
String *doc_string;
@ -441,7 +442,7 @@ file_dump(char *filename){
String
get_first_line(String source){
String line = {0};
int pos = find(source, 0, '\n');
int pos = find_s_char(source, 0, '\n');
line = substr(source, 0, pos);
@ -459,7 +460,7 @@ get_next_line(String source, String line){
start = pos + 1;
if (start < source.size){
pos = find(source, start, '\n');
pos = find_s_char(source, start, '\n');
next = substr(source, start, pos - start);
}
}
@ -824,7 +825,7 @@ parse_struct_next_member(Partition *part,
(token->flags & CPP_TFLAG_IS_KEYWORD)){
String lexeme = make_string(data + token->start, token->size);
if (match(lexeme, make_lit_string("struct"))){
if (match_ss(lexeme, make_lit_string("struct"))){
Struct_Member *member = push_struct(part, Struct_Member);
if (parse_struct(part, true, data, tokens, count, &token, member)){
result = member;
@ -834,7 +835,7 @@ parse_struct_next_member(Partition *part,
assert(!"unhandled error");
}
}
else if (match(lexeme, make_lit_string("union"))){
else if (match_ss(lexeme, make_lit_string("union"))){
Struct_Member *member = push_struct(part, Struct_Member);
if (parse_struct(part, false, data, tokens, count, &token, member)){
result = member;
@ -960,8 +961,8 @@ print_struct_html(FILE *file, Struct_Member *member){
String type = member->type;
String type_postfix = member->type_postfix;
if (match(type, make_lit_string("struct")) ||
match(type, make_lit_string("union"))){
if (match_ss(type, make_lit_string("struct")) ||
match_ss(type, make_lit_string("union"))){
fprintf(file,
"%.*s %.*s {<br>\n"
"<div style='margin-left: 8mm;'>\n",
@ -1086,8 +1087,8 @@ print_struct_docs(FILE *file, Partition *part, Struct_Member *member){
member_iter != 0;
member_iter = member_iter->next_sibling){
String type = member_iter->type;
if (match(type, make_lit_string("struct")) ||
match(type, make_lit_string("union"))){
if (match_ss(type, make_lit_string("struct")) ||
match_ss(type, make_lit_string("union"))){
print_struct_docs(file, part, member_iter);
}
else{
@ -1248,17 +1249,19 @@ allocate_app_api(int count){
static Function_Set
allocate_function_set(int count){
Function_Set function_set = {0};
int memory_size = (sizeof(String)*6 +
int memory_size = (sizeof(String)*7 +
sizeof(int)*2 +
sizeof(Argument_Breakdown) +
sizeof(Documentation))*count;
function_set.name = (String*)malloc(memory_size);
function_set.ret = function_set.name + count;
function_set.args = function_set.ret + count;
function_set.body = function_set.args + count;
function_set.marker = function_set.body + count;
function_set.doc_string = function_set.marker + count;
String *str_ptr = (String*)malloc(memory_size);
function_set.name = str_ptr; str_ptr += count;
function_set.ret = str_ptr; str_ptr += count;
function_set.args = str_ptr; str_ptr += count;
function_set.body = str_ptr; str_ptr += count;
function_set.marker = str_ptr; str_ptr += count;
function_set.cpp_name = str_ptr; str_ptr += count;
function_set.doc_string = str_ptr; str_ptr += count;
function_set.is_macro = (int*)(function_set.doc_string + count);
function_set.valid = function_set.is_macro + count;
@ -1390,9 +1393,48 @@ do_function_get_doc(int *index, Cpp_Token **token_ptr, int count,
return(result);
}
static String
get_lexeme(Cpp_Token token, char *code){
String str = make_string(code + token.start, token.size);
return(str);
}
static int
do_parse_cpp_name(int *i_ptr, Cpp_Token **token_ptr, int count, char *data, String *name){
int result = false;
int i = *i_ptr;
Cpp_Token *token = *token_ptr;
int i_start = i;
Cpp_Token *token_start = token;
++i, ++token;
if (i < count && token->type == CPP_TOKEN_PARENTHESE_OPEN){
++i, ++token;
if (i < count && token->type == CPP_TOKEN_IDENTIFIER){
++i, ++token;
if (i < count && token->type == CPP_TOKEN_PARENTHESE_CLOSE){
*name = get_lexeme(*(token-1), data);
result = true;
}
}
}
if (!result){
i = i_start;
token = token_start;
}
*i_ptr = i;
*token_ptr = token;
return(result);
}
static int
do_function_parse(int *index, Cpp_Token **token_ptr, int count, Cpp_Token *ret_start_token,
char *data, Function_Set function_set, int sig_count){
char *data, Function_Set function_set, int sig_count, String cpp_name){
int result = false;
int i = *index;
@ -1422,6 +1464,8 @@ do_function_parse(int *index, Cpp_Token **token_ptr, int count, Cpp_Token *ret_s
Argument_Breakdown *breakdown = &function_set.breakdown[sig_count];
*breakdown = do_parameter_parse(data, args_start_token, token);
function_set.cpp_name[sig_count] = cpp_name;
}
*index = i;
@ -1432,7 +1476,7 @@ do_function_parse(int *index, Cpp_Token **token_ptr, int count, Cpp_Token *ret_s
static int
do_full_function_parse(int *index, Cpp_Token **token_ptr, int count, char *data,
Function_Set function_set, int sig_count){
Function_Set function_set, int sig_count, String cpp_name){
int result = false;
int i = *index;
@ -1458,7 +1502,7 @@ do_full_function_parse(int *index, Cpp_Token **token_ptr, int count, char *data,
Cpp_Token *ret_start_token = token;
if (do_function_parse_check(&i, &token, count)){
if (do_function_parse(&i, &token, count, ret_start_token,
data, function_set, sig_count)){
data, function_set, sig_count, cpp_name)){
result = true;
}
}
@ -1580,22 +1624,26 @@ struct String_Function_Marker{
int parse_function;
int is_inline;
int parse_doc;
int cpp_name;
};
static String_Function_Marker
do_string_function_marker_check(String lexeme){
String_Function_Marker result = {0};
if (match(lexeme, "FSTRING_INLINE")){
if (match_ss(lexeme, make_lit_string("FSTRING_INLINE"))){
result.is_inline = true;
result.parse_function = true;
}
else if (match(lexeme, "FSTRING_LINK")){
else if (match_ss(lexeme, make_lit_string("FSTRING_LINK"))){
result.parse_function = true;
}
else if (match(lexeme, "DOC_EXPORT")){
else if (match_ss(lexeme, make_lit_string("DOC_EXPORT"))){
result.parse_doc = true;
}
else if (match_ss(lexeme, make_lit_string("CPP_NAME"))){
result.cpp_name = true;
}
return(result);
}
@ -1792,6 +1840,9 @@ generate_custom_headers(){
Cpp_Token *tokens = token_stack->tokens;
Cpp_Token *token = tokens;
String cpp_name = {0};
int has_cpp_name = 0;
for (int i = 0; i < count; ++i, ++token){
if (token->type == CPP_TOKEN_IDENTIFIER &&
!(token->flags & CPP_TFLAG_PP_BODY)){
@ -1800,9 +1851,15 @@ generate_custom_headers(){
String_Function_Marker marker =
do_string_function_marker_check(lexeme);
if (marker.parse_function){
if (marker.cpp_name){
if (do_parse_cpp_name(&i, &token, count, data, &cpp_name)){
has_cpp_name = 1;
}
}
else if (marker.parse_function){
if (do_full_function_parse(&i, &token, count, data,
string_function_set, string_sig_count)){
string_function_set, string_sig_count,
cpp_name)){
++string_sig_count;
}
}
@ -1813,6 +1870,13 @@ generate_custom_headers(){
++string_sig_count;
}
}
if (has_cpp_name){
has_cpp_name = 0;
}
else{
cpp_name = string_zero();
}
}
}
}
@ -1846,7 +1910,7 @@ generate_custom_headers(){
if (token->type == CPP_TOKEN_IDENTIFIER &&
!(token->flags & CPP_TFLAG_PP_BODY)){
String lexeme = make_string(data + token->start, token->size);
if (match(lexeme, "API_EXPORT")){
if (match_ss(lexeme, make_lit_string("API_EXPORT"))){
if (do_function_parse_check(&i, &token, count)){
++line_count;
}
@ -1874,8 +1938,9 @@ generate_custom_headers(){
if (token->type == CPP_TOKEN_IDENTIFIER &&
!(token->flags & CPP_TFLAG_PP_BODY)){
String lexeme = make_string(data + token->start, token->size);
if (match(lexeme, "API_EXPORT")){
do_full_function_parse(&i, &token, count, data, function_set, sig_count);
if (match_ss(lexeme, make_lit_string("API_EXPORT"))){
do_full_function_parse(&i, &token, count, data, function_set,
sig_count, string_zero());
if (!function_set.valid[sig_count]){
zero_index(function_set, sig_count);
// TODO(allen): get warning file name and line numbers
@ -1896,16 +1961,16 @@ generate_custom_headers(){
macro->memory_size = name_string.size+4;
macro->str = (char*)malloc(macro->memory_size);
copy(macro, name_string);
copy_ss(macro, name_string);
to_upper(macro);
append(macro, make_lit_string("_SIG"));
append_ss(macro, make_lit_string("_SIG"));
public_name->size = 0;
public_name->memory_size = name_string.size;
public_name->str = (char*)malloc(public_name->memory_size);
copy(public_name, name_string);
copy_ss(public_name, name_string);
to_lower(public_name);
}
@ -2197,7 +2262,7 @@ generate_custom_headers(){
if (token->type == CPP_TOKEN_IDENTIFIER &&
!(token->flags & CPP_TFLAG_PP_BODY)){
String lexeme = make_string(code->str + token->start, token->size);
if (match(lexeme, "FSTRING_BEGIN")){
if (match_ss(lexeme, make_lit_string("FSTRING_BEGIN"))){
start = token->start + token->size;
break;
}
@ -2216,13 +2281,17 @@ generate_custom_headers(){
do_whitespace_print = true;
}
String lexeme = make_string(code->str + token->start, token->size);
String lexeme = get_lexeme(*token, code->str);
int do_print = true;
if (match(lexeme, "FSTRING_DECLS")){
fprintf(file, "#ifndef FCODER_STRING_H\n#define FCODER_STRING_H\n\n");
if (match_ss(lexeme, make_lit_string("FSTRING_DECLS"))){
fprintf(file, "#if !defined(FCODER_STRING_H)\n#define FCODER_STRING_H\n\n");
do_print = false;
#define RETURN_PADDING 16
#define SIG_PADDING 30
for (int j = 0; j < string_sig_count; ++j){
char line_space[2048];
String line = make_fixed_width_string(line_space);
@ -2233,12 +2302,12 @@ generate_custom_headers(){
String name = string_function_set.name[j];
String args = string_function_set.args[j];
append(&line, marker);
append_padding(&line, ' ', 16);
append(&line, ret);
append_padding(&line, ' ', 30);
append(&line, name);
append(&line, args);
append_ss(&line, marker);
append_padding(&line, ' ', RETURN_PADDING);
append_ss(&line, ret);
append_padding(&line, ' ', SIG_PADDING);
append_ss(&line, name);
append_ss(&line, args);
terminate_with_null(&line);
fprintf(file, "%s;\n", line.str);
@ -2248,32 +2317,117 @@ generate_custom_headers(){
String args = string_function_set.args[j];
String body = string_function_set.body[j];
append(&line, "#ifndef ");
append_ss(&line, make_lit_string("#ifndef "));
append_padding(&line, ' ', 10);
append(&line, name);
append_ss(&line, name);
terminate_with_null(&line);
fprintf(file, "%s\n", line.str);
line.size = 0;
append(&line, "# define ");
append_ss(&line, make_lit_string("# define "));
append_padding(&line, ' ', 10);
append(&line, name);
append(&line, args);
append(&line, ' ');
append(&line, body);
append_ss(&line, name);
append_ss(&line, args);
append_s_char(&line, ' ');
append_ss(&line, body);
terminate_with_null(&line);
fprintf(file, "%s\n", line.str);
line.size = 0;
append(&line, "#endif");
append_ss(&line, make_lit_string("#endif"));
terminate_with_null(&line);
fprintf(file, "%s\n", line.str);
}
}
{
fprintf(file, "\n#if !defined(FSTRING_C)\n\n"
"// NOTE(allen): This section is here to enable nicer names\n"
"// for C++ users who can have overloaded functions. None of\n"
"// these functions add new features.\n");
for (int j = 0; j < string_sig_count; ++j){
char line_space[2048];
String line = make_fixed_width_string(line_space);
if (!string_function_set.is_macro[j]){
String cpp_name = string_function_set.cpp_name[j];
if (cpp_name.str != 0){
String ret = string_function_set.ret[j];
String args = string_function_set.args[j];
append_ss(&line, make_lit_string("FSTRING_INLINE"));
append_padding(&line, ' ', RETURN_PADDING);
append_ss(&line, ret);
append_padding(&line, ' ', SIG_PADDING);
append_ss(&line, cpp_name);
append_ss(&line, args);
terminate_with_null(&line);
fprintf(file, "%s;\n", line.str);
}
}
}
fprintf(file, "\n#endif\n");
}
fprintf(file, "\n#endif\n");
{
fprintf(file, "\n#if !defined(FSTRING_C) && !defined(FSTRING_GUARD)\n\n");
for (int j = 0; j < string_sig_count; ++j){
char line_space[2048];
String line = make_fixed_width_string(line_space);
if (!string_function_set.is_macro[j]){
String cpp_name = string_function_set.cpp_name[j];
if (cpp_name.str != 0){
String name = string_function_set.name[j];
String ret = string_function_set.ret[j];
String args = string_function_set.args[j];
Argument_Breakdown breakdown = string_function_set.breakdown[j];
append_ss(&line, make_lit_string("FSTRING_INLINE"));
append_s_char(&line, ' ');
append_ss(&line, ret);
append_s_char(&line, '\n');
append_ss(&line, cpp_name);
append_ss(&line, args);
if (match_ss(ret, make_lit_string("void"))){
append_ss(&line, make_lit_string("{ ("));
}
else{
append_ss(&line, make_lit_string("{ return("));
}
append_ss(&line, name);
append_s_char(&line, '(');
if (breakdown.count > 0){
for (int32_t i = 0; i < breakdown.count; ++i){
if (i != 0){
append_s_char(&line, ',');
}
append_ss(&line, breakdown.param_name[i]);
}
}
else{
append_ss(&line, make_lit_string("void"));
}
append_ss(&line, make_lit_string("));}"));
terminate_with_null(&line);
fprintf(file, "%s\n", line.str);
}
}
}
fprintf(file, "\n#endif\n");
}
}
else if (match(lexeme, "DOC_EXPORT")){
else if (match_ss(lexeme, make_lit_string("DOC_EXPORT"))){
++i, ++token;
if (i < count && token->type == CPP_TOKEN_COMMENT){
++i, ++token;
@ -2290,9 +2444,9 @@ generate_custom_headers(){
}
}
}
else if (match(lexeme, "FSTRING_INLINE")){
else if (match_ss(lexeme, make_lit_string("FSTRING_INLINE"))){
if (!(token->flags & CPP_TFLAG_PP_BODY)){
fprintf(file, "#ifndef FSTRING_GUARD\n");
fprintf(file, "#if !defined(FSTRING_GUARD)\n");
print_function_body_code(file, &i, &token, count, code, start);
@ -2300,9 +2454,9 @@ generate_custom_headers(){
do_print = false;
}
}
else if (match(lexeme, "FSTRING_LINK")){
else if (match_ss(lexeme, make_lit_string("FSTRING_LINK"))){
if (!(token->flags & CPP_TFLAG_PP_BODY)){
fprintf(file, "#ifdef FSTRING_IMPLEMENTATION\n");
fprintf(file, "#if defined(FSTRING_IMPLEMENTATION)\n");
print_function_body_code(file, &i, &token, count, code, start);
@ -2310,6 +2464,30 @@ generate_custom_headers(){
do_print = false;
}
}
else if (match_ss(lexeme, make_lit_string("CPP_NAME"))){
Cpp_Token *token_start = token;
int i_start = i;
int has_cpp_name = false;
++i, ++token;
if (token->type == CPP_TOKEN_PARENTHESE_OPEN){
++i, ++token;
if (token->type == CPP_TOKEN_IDENTIFIER){
++i, ++token;
if (token->type == CPP_TOKEN_PARENTHESE_CLOSE){
has_cpp_name = true;
}
}
}
if (!has_cpp_name){
i = i_start;
token = token_start;
}
do_print = false;
}
else if (token->type == CPP_TOKEN_COMMENT){
lexeme = make_string(code->str + token->start, token->size);
if (check_and_fix_docs(&lexeme)){
@ -2909,7 +3087,7 @@ int main(int argc, char **argv){
memset(&global_settings, 0, sizeof(global_settings));
global_settings.generate_docs = true;
global_settings.generate_string = false;
global_settings.generate_string = true;
filename = generate_keycode_enum();
filename = generate_style();

View File

@ -28,8 +28,8 @@ style_copy(Style *dst, Style *src){
internal void
style_set_name(Style *style, String name){
i32 count = ArrayCount(style->name_);
style->name = make_string(style->name_, 0, count - 1);
copy(&style->name, name);
style->name = make_string_cap(style->name_, 0, count - 1);
copy_ss(&style->name, name);
terminate_with_null(&style->name);
}

View File

@ -1,6 +1,23 @@
@echo off
REM "build_exp.bat" /O2
"build_all.bat" /DFRED_SUPER /DFRED_INTERNAL /Zi
REM "build_all.bat" /DFRED_SUPER /DFRED_INTERNAL /Zi
REM "build_all.bat" /DFRED_INTERNAL /Zi
REM "build_all.bat" /DFRED_SUPER /O2 /Zi
call "ctime" -begin 4ed_data.ctm
SET OPTS=/W4 /wd4310 /wd4100 /wd4201 /wd4505 /wd4996 /wd4127 /wd4510 /wd4512 /wd4610 /wd4390 /WX
SET OPTS=/GR- /EHa- /nologo /FC
SET FirstError=0
pushd ..\build
cl %OPTS% ..\code\build.c /Febuild /DDEV_BUILD
if %ERRORLEVEL% neq 0 (set FirstError=1)
popd
..\build\build
if %ERRORLEVEL% neq 0 (set FirstError=1)
call "ctime" -end 4ed_data.ctm %FirstError%

234
build.c Normal file
View File

@ -0,0 +1,234 @@
/*
4coder development build rule.
*/
// TOP
#include <stdio.h>
#include <stdint.h>
#include <assert.h>
//
// reusable
//
#define CL_OPTS \
"/W4 /wd4310 /wd4100 /wd4201 /wd4505 /wd4996 /wd4127 /wd4510 /wd4512 /wd4610 /wd4390 /WX "\
"/GR- /EHa- /nologo /FC"
#if defined(_MSC_VER)
#define IS_CL
#define snprintf _snprintf
#if defined(_WIN32)
# define IS_WINDOWS
# pragma comment(lib, "Kernel32.lib")
#endif
#else
#error This compiler is not supported yet
#endif
static char cmd[1024];
static int error_state = 0;
#define systemf(...) do{\
int32_t n = snprintf(cmd, sizeof(cmd), __VA_ARGS__);\
assert(n < sizeof(cmd));\
if (system(cmd) != 0) error_state = 1;\
}while(0)
#if defined(IS_WINDOWS)
#define DWORD uint32_t
#define LPTSTR char*
DWORD GetCurrentDirectoryA(
_In_ DWORD nBufferLength,
_Out_ LPTSTR lpBuffer
);
static int32_t
get_current_directory(char *buffer, int32_t max){
int32_t result = GetCurrentDirectoryA(max, buffer);
return(result);
}
static void
execute(char *dir, char *str){
if (dir){
systemf("pushd %s & call \"%s\"", dir, str);
}
else{
systemf("call \"%s\"", str);
}
}
#else
#error This OS is not supported yet
#endif
//
// 4coder specific
//
#define CL_INCLUDES \
"/I..\\foreign /I..\\foreign\\freetype2"
#define CL_LIBS \
"user32.lib winmm.lib gdi32.lib opengl32.lib ..\\foreign\\freetype.lib"
#define CL_ICON \
"..\\foreign\\freetype.lib"
static void
swap_ptr(void **A, void **B){
void *a = *A;
void *b = *B;
*A = b;
*B = a;
}
static void
win32_slash_fix(char *path){
for (int32_t i = 0; path[i]; ++i){
if (path[i] == '/') path[i] = '\\';
}
}
enum{
OPTS = 0x1,
INCLUDES = 0x2,
LIBS = 0x4,
ICON = 0x8,
SHARED_CODE = 0x10,
DEBUG_INFO = 0x20
};
static void
build_cl(uint32_t flags,
char *code_path, char *code_file,
char *out_path, char *out_file,
char *exports){
win32_slash_fix(out_path);
char link_options[1024];
if (flags & SHARED_CODE){
assert(exports);
snprintf(link_options, sizeof(link_options), "/OPT:REF %s", exports);
}
else{
snprintf(link_options, sizeof(link_options), "/NODEFAULTLIB:library");
}
char build_optionsA[4096];
char build_optionsB[4096];
char *build_options = build_optionsA;
char *build_options_prev = build_optionsB;
int32_t build_max = sizeof(build_optionsA);
build_optionsA[0] = 0;
build_optionsB[0] = 0;
if (flags & OPTS){
snprintf(build_options, build_max, "%s "CL_OPTS, build_options_prev);
swap_ptr(&build_options, &build_options_prev);
}
if (flags & INCLUDES){
snprintf(build_options, build_max, "%s "CL_INCLUDES, build_options_prev);
swap_ptr(&build_options, &build_options_prev);
}
if (flags & LIBS){
snprintf(build_options, build_max, "%s "CL_LIBS, build_options_prev);
swap_ptr(&build_options, &build_options_prev);
}
if (flags & ICON){
snprintf(build_options, build_max, "%s "CL_ICON, build_options_prev);
swap_ptr(&build_options, &build_options_prev);
}
if (flags & DEBUG_INFO){
snprintf(build_options, build_max, "%s /Zi", build_options_prev);
swap_ptr(&build_options, &build_options_prev);
}
if (flags & SHARED_CODE){
snprintf(build_options, build_max, "%s /LD", build_options_prev);
swap_ptr(&build_options, &build_options_prev);
}
swap_ptr(&build_options, &build_options_prev);
systemf("pushd %s & cl %s %s\\%s /Fe%s /link /DEBUG /INCREMENTAL:NO %s",
out_path, build_options, code_path, code_file, out_file, link_options);
}
static void
build(uint32_t flags,
char *code_path, char *code_file,
char *out_path, char *out_file,
char *exports){
#if defined(IS_CL)
build_cl(flags, code_path, code_file, out_path, out_file, exports);
#else
#error The build rule for this compiler is not ready
#endif
}
static void
buildsuper(char *code_path , char *filename){
#if defined(IS_CL)
win32_slash_fix(filename);
systemf("call \"%s\\buildsuper.bat\" %s",
code_path, filename);
#else
#error The build rule for this compiler is not ready
#endif
}
#if defined(DEV_BUILD)
int main(int argc, char **argv){
char cdir[256];
{
int32_t n = get_current_directory(cdir, sizeof(cdir));
assert(n < sizeof(cdir));
}
build(OPTS | DEBUG_INFO, cdir, "4ed_metagen.cpp",
"../meta", "metagen", 0);
execute(cdir, "../meta/metagen");
//buildsuper(cdir, "../code/4coder_default_bindings.cpp");
buildsuper(cdir, "../code/internal_4coder_tests.cpp");
//buildsuper(cdir, "../code/power/4coder_casey.cpp");
//buildsuper(cdir, "../4vim/4coder_chronal.cpp");
build(OPTS | INCLUDES | SHARED_CODE | DEBUG_INFO, cdir, "4ed_app_target.cpp",
"../build", "4ed_app", "/EXPORT:app_get_functions");
build(OPTS | INCLUDES | LIBS | ICON | DEBUG_INFO, cdir, "win32_4ed.cpp",
"../build", "4ed", 0);
return(error_state);
}
#elif defined(PACKAGE)
#endif
// BOTTOM

View File

@ -32,7 +32,7 @@ REM call "%CODE_DIR%\buildsuper.bat" ..\4vim\4coder_chronal.cpp
if %ERRORLEVEL% neq 0 (set FirstError=1)
set EXPORTS=/EXPORT:app_get_functions
REM cl %OPTS% %INCLUDES% %DEFINES% %CODE_DIR%\4ed_app_target.cpp %* /Fe4ed_app /LD /link /DEBUG /INCREMENTAL:NO /OPT:REF %EXPORTS%
cl %OPTS% %INCLUDES% %DEFINES% %CODE_DIR%\4ed_app_target.cpp %* /Fe4ed_app /LD /link /DEBUG /INCREMENTAL:NO /OPT:REF %EXPORTS%
if %ERRORLEVEL% neq 0 (set FirstError=1)
cl %OPTS% %INCLUDES% %DEFINES% %CODE_DIR%\win32_4ed.cpp %LIBS% %ICON% %* /Fe4ed /link /DEBUG /NODEFAULTLIB:library

View File

@ -3,9 +3,15 @@
#define FSTRING_BEGIN
#define DOC_EXPORT
#define CPP_NAME(n)
FSTRING_BEGIN
// TOP
#if defined(FSTRING_C)
#define FSTRING_INLINE static
#endif
#if defined(FSTRING_IMPLEMENTATION) && defined(FSTRING_GUARD)
#undef FSTRING_IMPLEMENTATION
#endif
@ -22,16 +28,16 @@ FSTRING_BEGIN
#ifndef FSTRING_STRUCT
#define FSTRING_STRUCT
struct String{
typedef struct String{
char *str;
int32_t size;
int32_t memory_size;
};
} String;
struct Offset_String{
typedef struct Offset_String{
int32_t offset;
int32_t size;
};
} Offset_String;
#endif
#ifndef fstr_bool
@ -114,14 +120,15 @@ char_is_numeric(char c)
//
FSTRING_INLINE String
string_zero()
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(void *str, int32_t size, int32_t mem_size)
make_string_cap(void *str, int32_t size, int32_t mem_size)
/*
DOC_PARAM(str, The str parameter provides the of memory with which the string shall operate.)
DOC_PARAM(size, The size parameter expresses the initial size of the string.
@ -154,11 +161,11 @@ DOC(This call returns the String created from the parameters.)
DOC_EXPORT /* DOC(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.) */
#define make_lit_string(s) (make_string((char*)(s), sizeof(s)-1, sizeof(s)))
#define make_lit_string(s) (make_string_cap((char*)(s), sizeof(s)-1, sizeof(s)))
DOC_EXPORT /* DOC(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.) */
#define make_fixed_width_string(s) (make_string((char*)(s), 0, sizeof(s)))
#define make_fixed_width_string(s) (make_string_cap((char*)(s), 0, sizeof(s)))
DOC_EXPORT /* DOC(This macro is a helper for any calls that take a char*,int pair to specify a
string. This macro expands to both of those parameters from one String struct.) */
@ -183,12 +190,9 @@ treating that as the size and memory size of the string.) */{
return result;
}
// TODO(allen): I don't love the substr rule, I chose
// substr(String, start) and substr(String, start, size)
// but I wish I had substr(String, start) and substr(String, start, end)
CPP_NAME(substr)
FSTRING_INLINE String
substr(String str, int32_t start)
substr_tail(String str, int32_t start)
/* DOC(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.) */{
@ -263,8 +267,9 @@ the portion of str's memory that is not used.) */{
// String Comparison
//
CPP_NAME(match)
FSTRING_LINK fstr_bool
match(char *a, char *b)/* DOC(This call returns non-zero if a and b are equivalent.) */{
match_cc(char *a, char *b)/* DOC(This call returns non-zero if a and b are equivalent.) */{
for (int32_t i = 0;; ++i){
if (a[i] != b[i]){
return 0;
@ -275,8 +280,9 @@ match(char *a, char *b)/* DOC(This call returns non-zero if a and b are equivale
}
}
CPP_NAME(match)
FSTRING_LINK fstr_bool
match(String a, char *b)/* DOC(This call returns non-zero if a and b are equivalent.) */{
match_sc(String a, char *b)/* DOC(This call returns non-zero if a and b are equivalent.) */{
int32_t i = 0;
for (; i < a.size; ++i){
if (a.str[i] != b[i]){
@ -289,13 +295,15 @@ match(String a, char *b)/* DOC(This call returns non-zero if a and b are equival
return 1;
}
CPP_NAME(match)
FSTRING_INLINE fstr_bool
match(char *a, String b)/* DOC(This call returns non-zero if a and b are equivalent.) */{
return(match(b,a));
match_cs(char *a, String b)/* DOC(This call returns non-zero if a and b are equivalent.) */{
return(match_sc(b,a));
}
CPP_NAME(match)
FSTRING_LINK fstr_bool
match(String a, String b)/* DOC(This call returns non-zero if a and b are equivalent.) */{
match_ss(String a, String b)/* DOC(This call returns non-zero if a and b are equivalent.) */{
if (a.size != b.size){
return 0;
}
@ -307,8 +315,9 @@ match(String a, String b)/* DOC(This call returns non-zero if a and b are equiva
return 1;
}
CPP_NAME(match_part)
FSTRING_LINK fstr_bool
match_part(char *a, char *b, int32_t *len)/*
match_part_ccl(char *a, char *b, int32_t *len)/*
DOC_PARAM(len, If this call returns non-zero this parameter is used to output the length of b.)
DOC(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.) */{
@ -322,9 +331,9 @@ In other words this call returns non-zero if b is a prefix of a.) */{
return 1;
}
CPP_NAME(match_part)
FSTRING_LINK fstr_bool
match_part(String a, char *b, int32_t *len)/*
match_part_scl(String a, char *b, int32_t *len)/*
DOC_PARAM(len, If this call returns non-zero this parameter is used to output the length of b.)
DOC(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.) */{
@ -338,25 +347,28 @@ In other words this call returns non-zero if b is a prefix of a.) */{
return 1;
}
CPP_NAME(match_part)
FSTRING_INLINE fstr_bool
match_part(char *a, char *b)/*
match_part_cc(char *a, char *b)/*
DOC_PARAM(len, If this call returns non-zero this parameter is used to output the length of b.)
DOC(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.) */{
int32_t x;
return match_part(a,b,&x);
return match_part_ccl(a,b,&x);
}
CPP_NAME(match_part)
FSTRING_INLINE fstr_bool
match_part(String a, char *b)/*
match_part_sc(String a, char *b)/*
DOC(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.) */{
int32_t x;
return match_part(a,b,&x);
return match_part_scl(a,b,&x);
}
CPP_NAME(match_part)
FSTRING_LINK fstr_bool
match_part(char *a, String b)/*
match_part_cs(char *a, String b)/*
DOC(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.) */{
for (int32_t i = 0; i != b.size; ++i){
@ -367,8 +379,9 @@ In other words this call returns non-zero if b is a prefix of a.) */{
return 1;
}
CPP_NAME(match_part)
FSTRING_LINK fstr_bool
match_part(String a, String b)/*
match_part_ss(String a, String b)/*
DOC(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.) */{
if (a.size < b.size){
@ -382,8 +395,9 @@ In other words this call returns non-zero if b is a prefix of a.) */{
return 1;
}
CPP_NAME(match_insensitive)
FSTRING_LINK fstr_bool
match_insensitive(char *a, char *b)/*
match_insensitive_cc(char *a, char *b)/*
DOC(This call returns non-zero if a and b are equivalent under case insensitive comparison.) */{
for (int32_t i = 0;; ++i){
if (char_to_upper(a[i]) !=
@ -396,8 +410,9 @@ DOC(This call returns non-zero if a and b are equivalent under case insensitive
}
}
CPP_NAME(match_insensitive)
FSTRING_LINK fstr_bool
match_insensitive(String a, char *b)/*
match_insensitive_sc(String a, char *b)/*
DOC(This call returns non-zero if a and b are equivalent under case insensitive comparison.) */{
int32_t i = 0;
for (; i < a.size; ++i){
@ -412,14 +427,16 @@ DOC(This call returns non-zero if a and b are equivalent under case insensitive
return 1;
}
CPP_NAME(match_insensitive)
FSTRING_INLINE fstr_bool
match_insensitive(char *a, String b)/*
match_insensitive_cs(char *a, String b)/*
DOC(This call returns non-zero if a and b are equivalent under case insensitive comparison.) */{
return match_insensitive(b,a);
return match_insensitive_sc(b,a);
}
CPP_NAME(match_insensitive)
FSTRING_LINK fstr_bool
match_insensitive(String a, String b)/*
match_insensitive_ss(String a, String b)/*
DOC(This call returns non-zero if a and b are equivalent under case insensitive comparison.) */{
if (a.size != b.size){
return 0;
@ -433,8 +450,9 @@ DOC(This call returns non-zero if a and b are equivalent under case insensitive
return 1;
}
CPP_NAME(match_part_insensitive)
FSTRING_LINK fstr_bool
match_part_insensitive(char *a, char *b, int32_t *len)/*
match_part_insensitive_ccl(char *a, char *b, int32_t *len)/*
DOC_PARAM(len, If this call returns non-zero this parameter is used to output the length of b.)
DOC(This call performs the same partial matching rule as match_part under case insensitive comparison.)
DOC_SEE(match_part) */{
@ -448,8 +466,9 @@ DOC_SEE(match_part) */{
return 1;
}
CPP_NAME(match_part_insensitive)
FSTRING_LINK fstr_bool
match_part_insensitive(String a, char *b, int32_t *len)/*
match_part_insensitive_scl(String a, char *b, int32_t *len)/*
DOC_PARAM(len, If this call returns non-zero this parameter is used to output the length of b.)
DOC(This call performs the same partial matching rule as match_part under case insensitive comparison.)
DOC_SEE(match_part) */{
@ -464,24 +483,27 @@ DOC_SEE(match_part) */{
return 1;
}
CPP_NAME(match_part_insensitive)
FSTRING_INLINE fstr_bool
match_part_insensitive(char *a, char *b)/*
match_part_insensitive_cc(char *a, char *b)/*
DOC(This call performs the same partial matching rule as match_part under case insensitive comparison.)
DOC_SEE(match_part) */{
int32_t x;
return match_part(a,b,&x);
return match_part_insensitive_ccl(a,b,&x);
}
CPP_NAME(match_part_insensitive)
FSTRING_INLINE fstr_bool
match_part_insensitive(String a, char *b)/*
match_part_insensitive_sc(String a, char *b)/*
DOC(This call performs the same partial matching rule as match_part under case insensitive comparison.)
DOC_SEE(match_part) */{
int32_t x;
return match_part(a,b,&x);
return match_part_insensitive_scl(a,b,&x);
}
CPP_NAME(match_part_insensitive)
FSTRING_LINK fstr_bool
match_part_insensitive(char *a, String b)/*
match_part_insensitive_cs(char *a, String b)/*
DOC(This call performs the same partial matching rule as match_part under case insensitive comparison.)
DOC_SEE(match_part) */{
for (int32_t i = 0; i != b.size; ++i){
@ -492,8 +514,9 @@ DOC_SEE(match_part) */{
return 1;
}
CPP_NAME(match_part_insensitive)
FSTRING_LINK fstr_bool
match_part_insensitive(String a, String b)/*
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){
@ -507,8 +530,9 @@ DOC_SEE(match_part) */{
return 1;
}
CPP_NAME(compare)
FSTRING_LINK int32_t
compare(char *a, char *b)/*
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.) */{
@ -519,8 +543,9 @@ and positive if a sorts after b alphabetically.) */{
return (a[i] > b[i]) - (a[i] < b[i]);
}
CPP_NAME(compare)
FSTRING_LINK int32_t
compare(String a, char *b)/*
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.) */{
@ -541,16 +566,18 @@ and positive if a sorts after b alphabetically.) */{
}
}
CPP_NAME(compare)
FSTRING_INLINE int32_t
compare(char *a, String b)/*
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(b,a);
return -compare_sc(b,a);
}
CPP_NAME(compare)
FSTRING_LINK int32_t
compare(String a, String b)/*
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.) */{
@ -570,8 +597,9 @@ and positive if a sorts after b alphabetically.) */{
// Finding Characters and Substrings
//
CPP_NAME(find)
FSTRING_LINK int32_t
find(char *str, int32_t start, char character)/*
find_c_char(char *str, int32_t start, char character)/*
DOC_PARAM(str, The str parameter provides a null terminated 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.)
@ -582,8 +610,9 @@ if the character is not found.) */{
return i;
}
CPP_NAME(find)
FSTRING_LINK int32_t
find(String str, int32_t start, char character)/*
find_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.)
@ -594,8 +623,9 @@ if the character is not found.) */{
return i;
}
CPP_NAME(find)
FSTRING_LINK int32_t
find(char *str, int32_t start, char *characters)/*
find_c_chars(char *str, int32_t start, char *characters)/*
DOC_PARAM(str, The str parameter provides a null terminated string to search.)
DOC_PARAM(start, The start parameter provides the index of the first character in str to search.)
DOC_PARAM(character, The characters parameter provides a null terminated array of characters for which to search.)
@ -613,8 +643,9 @@ or the size of the string if no such character is not found.) */{
return i;
}
CPP_NAME(find)
FSTRING_LINK int32_t
find(String str, int32_t start, char *characters)/*
find_s_chars(String str, int32_t start, char *characters)/*
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 characters parameter provides a null terminated array of characters for which to search.)
@ -632,8 +663,9 @@ or the size of the string if no such character is not found.) */{
return i;
}
CPP_NAME(find_substr)
FSTRING_LINK int32_t
find_substr(char *str, int32_t start, String seek)/*
find_substr_c(char *str, int32_t start, String seek)/*
DOC_PARAM(str, The str parameter provides a null terminated string to search.)
DOC_PARAM(start, The start parameter provides the index of the first character in str to search.)
DOC_PARAM(seek, The seek parameter provides a string to find in str.)
@ -662,8 +694,9 @@ size of str if no such substring in str is found.) */{
return i;
}
CPP_NAME(find_substr)
FSTRING_LINK int32_t
find_substr(String str, int32_t start, String seek)/*
find_substr_s(String str, int32_t start, String seek)/*
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(seek, The seek parameter provides a string to find in str.)
@ -693,8 +726,9 @@ size of str if no such substring in str is found.) */{
return str.size;
}
CPP_NAME(rfind_substr)
FSTRING_LINK int32_t
rfind_substr(String str, int32_t start, String seek)/*
rfind_substr_s(String str, int32_t start, String seek)/*
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(seek, The seek parameter provides a string to find in str.)
@ -726,8 +760,9 @@ or -1 if no such substring in str is found.) */{
return -1;
}
CPP_NAME(find_substr_insensitive)
FSTRING_LINK int32_t
find_substr_insensitive(char *str, int32_t start, String seek)/*
find_substr_insensitive_c(char *str, int32_t start, String seek)/*
DOC_PARAM(str, The str parameter provides a null terminated string to search.)
DOC_PARAM(start, The start parameter provides the index of the first character in str to search.)
DOC_PARAM(seek, The seek parameter provides a string to find in str.)
@ -759,8 +794,9 @@ DOC_SEE(find_substr)*/{
return i;
}
CPP_NAME(find_substr_insensitive)
FSTRING_LINK int32_t
find_substr_insensitive(String str, int32_t start, String seek)/*
find_substr_insensitive_s(String str, int32_t start, String seek)/*
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(seek, The seek parameter provides a string to find in str.)
@ -794,38 +830,43 @@ DOC_SEE(find_substr)*/{
return str.size;
}
CPP_NAME(has_substr)
FSTRING_INLINE fstr_bool
has_substr(char *s, String seek)/*
has_substr_c(char *s, String seek)/*
DOC(This call returns non-zero if the string s contains a substring equivalent to seek.) */{
return (s[find_substr(s, 0, seek)] != 0);
return (s[find_substr_c(s, 0, seek)] != 0);
}
CPP_NAME(has_substr)
FSTRING_INLINE fstr_bool
has_substr(String s, String seek)/*
has_substr_s(String s, String seek)/*
DOC(This call returns non-zero if the string s contains a substring equivalent to seek.) */{
return (find_substr(s, 0, seek) < s.size);
return (find_substr_s(s, 0, seek) < s.size);
}
CPP_NAME(has_substr_insensitive)
FSTRING_INLINE fstr_bool
has_substr_insensitive(char *s, String seek)/*
has_substr_insensitive_c(char *s, String seek)/*
DOC(This call returns non-zero if the string s contains a substring equivalent to seek
under case insensitive comparison.) */{
return (s[find_substr_insensitive(s, 0, seek)] != 0);
return (s[find_substr_insensitive_c(s, 0, seek)] != 0);
}
CPP_NAME(has_substr_insensitive)
FSTRING_INLINE fstr_bool
has_substr_insensitive(String s, String seek)/*
has_substr_insensitive_s(String s, String seek)/*
DOC(This call returns non-zero if the string s contains a substring equivalent to seek
under case insensitive comparison.) */{
return (find_substr_insensitive(s, 0, seek) < s.size);
return (find_substr_insensitive_s(s, 0, seek) < s.size);
}
//
// String Copies and Appends
//
CPP_NAME(copy_fast_unsafe)
FSTRING_LINK int32_t
copy_fast_unsafe(char *dest, char *src)/*
copy_fast_unsafe_cc(char *dest, char *src)/*
DOC(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.
@ -840,8 +881,9 @@ of bytes coppied to dest.) */{
return (int32_t)(dest - start);
}
CPP_NAME(copy_fast_unsafe)
FSTRING_LINK int32_t
copy_fast_unsafe(char *dest, String src)/*
copy_fast_unsafe_cs(char *dest, String src)/*
DOC(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.
@ -855,8 +897,9 @@ of bytes coppied to dest.) */{
return(src.size);
}
CPP_NAME(copy_checked)
FSTRING_LINK fstr_bool
copy_checked(String *dest, String src)/*
copy_checked_ss(String *dest, String src)/*
DOC(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.) */{
@ -873,8 +916,9 @@ This call returns non-zero on a successful copy.) */{
return 1;
}
CPP_NAME(copy_partial)
FSTRING_LINK fstr_bool
copy_partial(String *dest, char *src)/*
copy_partial_sc(String *dest, char *src)/*
DOC(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
@ -893,17 +937,18 @@ if the entire string is coppied to dest.) */{
return 1;
}
CPP_NAME(copy_partial)
FSTRING_LINK fstr_bool
copy_partial(String *dest, String src)/*
copy_partial_ss(String *dest, String src)/*
DOC(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.) */{
char *dest_str = dest->str;
int32_t memory_size = dest->memory_size;
fstr_bool result = false;
fstr_bool result = 0;
if (memory_size >= src.size){
result = true;
result = 1;
memory_size = src.size;
}
for (int32_t i = 0; i < memory_size; ++i){
@ -913,62 +958,69 @@ if the entire string is coppied to dest.) */{
return result;
}
CPP_NAME(copy)
FSTRING_INLINE int32_t
copy(char *dest, char *src)/*
copy_cc(char *dest, char *src)/*
DOC(This call performs a copy from src to dest equivalent to copy_fast_unsafe.)
DOC_SEE(copy_fast_unsafe) */{
return copy_fast_unsafe(dest, src);
return copy_fast_unsafe_cc(dest, src);
}
CPP_NAME(copy)
FSTRING_INLINE void
copy(String *dest, String src)/*
copy_ss(String *dest, String src)/*
DOC(This call performs a copy from src to dest equivalent to copy_checked.)
DOC_SEE(copy_checked) */{
copy_checked(dest, src);
copy_checked_ss(dest, src);
}
CPP_NAME(copy)
FSTRING_INLINE void
copy(String *dest, char *src)/*
copy_sc(String *dest, char *src)/*
DOC(This call performs a copy from src to dest equivalent to copy_partial.)
DOC_SEE(copy_partial) */{
copy_partial(dest, src);
copy_partial_sc(dest, src);
}
CPP_NAME(append_checked)
FSTRING_LINK fstr_bool
append_checked(String *dest, String src)/*
append_checked_ss(String *dest, String src)/*
DOC(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.) */{
String end;
end = tailstr(*dest);
fstr_bool result = copy_checked(&end, src);
fstr_bool result = copy_checked_ss(&end, src);
// NOTE(allen): This depends on end.size still being 0 if
// the check failed and no coppy occurred.
dest->size += end.size;
return result;
}
CPP_NAME(append_partial)
FSTRING_LINK fstr_bool
append_partial(String *dest, char *src)/*
append_partial_sc(String *dest, char *src)/*
DOC(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.) */{
String end = tailstr(*dest);
fstr_bool result = copy_partial(&end, src);
fstr_bool result = copy_partial_sc(&end, src);
dest->size += end.size;
return result;
}
CPP_NAME(append_partial)
FSTRING_LINK fstr_bool
append_partial(String *dest, String src)/*
append_partial_ss(String *dest, String src)/*
DOC(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.) */{
String end = tailstr(*dest);
fstr_bool result = copy_partial(&end, src);
fstr_bool result = copy_partial_ss(&end, src);
dest->size += end.size;
return result;
}
CPP_NAME(append)
FSTRING_LINK fstr_bool
append(String *dest, char c)/*
append_s_char(String *dest, char c)/*
DOC(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.) */{
fstr_bool result = 0;
@ -979,16 +1031,18 @@ memory the character is appended and the call returns non-zero.) */{
return result;
}
CPP_NAME(append)
FSTRING_INLINE fstr_bool
append(String *dest, String src)/*
append_ss(String *dest, String src)/*
DOC(This call is equivalent to append_partial.) DOC_SEE(append_partial) */{
return append_partial(dest, src);
return append_partial_ss(dest, src);
}
CPP_NAME(append)
FSTRING_INLINE fstr_bool
append(String *dest, char *src)/*
append_sc(String *dest, char *src)/*
DOC(This call is equivalent to append_partial.) DOC_SEE(append_partial) */{
return append_partial(dest, src);
return append_partial_sc(dest, src);
}
FSTRING_LINK fstr_bool
@ -1015,7 +1069,7 @@ non-zero if dest does not run out of space in the underlying memory.) */{
int32_t r = 0;
if (offset > 0){
for (r = 0; r < offset; ++r){
if (append(dest, c) == 0){
if (append_s_char(dest, c) == 0){
result = 0;
break;
}
@ -1191,18 +1245,18 @@ space in dest this call returns non-zero.) */{
}
#ifndef FSTRING_GUARD
struct Float_To_Str_Variables{
typedef struct Float_To_Str_Variables{
fstr_bool negative;
int32_t int_part;
int32_t dec_part;
};
} Float_To_Str_Variables;
Float_To_Str_Variables
static Float_To_Str_Variables
get_float_vars(float x){
Float_To_Str_Variables vars = {0};
if (x < 0){
vars.negative = true;
vars.negative = 1;
x = -x;
}
@ -1230,11 +1284,11 @@ space in dest this call returns non-zero.) */{
Float_To_Str_Variables vars = get_float_vars(x);
if (vars.negative){
append(dest, '-');
append_s_char(dest, '-');
}
append_int_to_str(dest, vars.int_part);
append(dest, '.');
append_s_char(dest, '.');
append_int_to_str(dest, vars.dec_part);
return(result);
@ -1250,21 +1304,37 @@ space in dest this call returns non-zero.) */{
return(result);
}
FSTRING_LINK fstr_bool
str_is_int(String str)/*
DOC(If str is a valid string representation of an integer, this call returns non-zero.) */{
fstr_bool result = true;
for (int32_t i = 0; i < str.size; ++i){
if (!char_is_numeric(str.str[i])){
result = false;
CPP_NAME(str_is_int)
FSTRING_LINK int32_t
str_is_int_c(char *str)/*
DOC(If str is a valid string representation of an integer, this call returns non-zero) */{
fstr_bool result = 1;
for (; *str; ++str){
if (!char_is_numeric(*str)){
result = 0;
break;
}
}
return(result);
}
CPP_NAME(str_is_int)
FSTRING_LINK fstr_bool
str_is_int_s(String str)/*
DOC(If str is a valid string representation of an integer, this call returns non-zero.) */{
fstr_bool result = 1;
for (int32_t i = 0; i < str.size; ++i){
if (!char_is_numeric(str.str[i])){
result = 0;
break;
}
}
return(result);
}
CPP_NAME(str_to_int)
FSTRING_LINK int32_t
str_to_int(char *str)/*
str_to_int_c(char *str)/*
DOC(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.) */{
int32_t x = 0;
@ -1281,8 +1351,9 @@ the integer represented by the string. Otherwise this call returns zero.) */{
return(x);
}
CPP_NAME(str_to_int)
FSTRING_LINK int32_t
str_to_int(String str)/*
str_to_int_s(String str)/*
DOC(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.) */{
int32_t x, i;
@ -1394,8 +1465,9 @@ DOC(This call interprets s as a color and writes the 32-bit integer representati
// Directory String Management
//
CPP_NAME(reverse_seek_slash)
FSTRING_LINK int32_t
reverse_seek_slash(String str, int32_t pos)/*
reverse_seek_slash_pos(String str, int32_t pos)/*
DOC(This call searches for a slash in str by starting pos bytes from the end and going backwards.) */{
int32_t i = str.size - 1 - pos;
while (i >= 0 && !char_is_slash(str.str[i])){
@ -1407,14 +1479,14 @@ DOC(This call searches for a slash in str by starting pos bytes from the end and
FSTRING_INLINE int32_t
reverse_seek_slash(String str)/*
DOC(This call searches for a slash in str by starting at the end and going backwards.) */{
return(reverse_seek_slash(str, 0));
return(reverse_seek_slash_pos(str, 0));
}
FSTRING_INLINE String
front_of_directory(String dir)/*
DOC(This call returns a substring of dir containing only the file name or
folder name furthest to the right in the directory.) DOC_SEE(substr) */{
return substr(dir, reverse_seek_slash(dir) + 1);
return substr_tail(dir, reverse_seek_slash(dir) + 1);
}
FSTRING_INLINE String
@ -1424,53 +1496,49 @@ for the final file or folder name.) DOC_SEE(substr) */{
return substr(dir, 0, reverse_seek_slash(dir) + 1);
}
CPP_NAME(set_last_folder)
FSTRING_LINK fstr_bool
set_last_folder(String *dir, char *folder_name, char slash)/*
set_last_folder_sc(String *dir, char *folder_name, char slash)/*
DOC_PARAM(dir, The dir parameter is the directory string in which to set the last folder in the directory.)
DOC_PARAM(folder_name, The folder_name parameter is a null terminated string specifying the name to set
at the end of the directory.)
DOC_PARAM(slash, The slash parameter specifies what slash to use between names in the directory.)
DOC(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.) */{
char str[2];
fstr_bool result = 0;
int32_t size = reverse_seek_slash(*dir) + 1;
dir->size = size;
str[0] = slash;
str[1] = 0;
if (append(dir, folder_name)){
if (append(dir, str)){
if (append_sc(dir, folder_name)){
if (append_s_char(dir, slash)){
result = 1;
}
}
if (!result){
dir->size = size;
}
return result;
return(result);
}
CPP_NAME(set_last_folder)
FSTRING_LINK fstr_bool
set_last_folder(String *dir, String folder_name, char slash)/*
set_last_folder_ss(String *dir, String folder_name, char slash)/*
DOC_PARAM(dir, The dir parameter is the directory string in which to set the last folder in the directory.)
DOC_PARAM(folder_name, The folder_name parameter is a string specifying the name to set at the end of the directory.)
DOC_PARAM(slash, The slash parameter specifies what slash to use between names in the directory.)
DOC(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.) */{
char str[2];
fstr_bool result = 0;
int32_t size = reverse_seek_slash(*dir) + 1;
dir->size = size;
str[0] = slash;
str[1] = 0;
if (append(dir, folder_name)){
if (append(dir, str)){
if (append_ss(dir, folder_name)){
if (append_s_char(dir, slash)){
result = 1;
}
}
if (!result){
dir->size = size;
}
return result;
return(result);
}
FSTRING_LINK String
@ -1482,7 +1550,7 @@ DOC_SEE(substr) */{
if (str.str[i] == '.') break;
}
++i;
return make_string(str.str+i, str.size-i);
return(make_string(str.str+i, str.size-i));
}
FSTRING_LINK fstr_bool
@ -1490,7 +1558,7 @@ remove_last_folder(String *str)/*
DOC(This call attemps to delete a folder or filename off the end of a path string.
This call returns non-zero on success.) */{
fstr_bool result = 0;
int32_t end = reverse_seek_slash(*str, 1);
int32_t end = reverse_seek_slash_pos(*str, 1);
if (end >= 0){
result = 1;
str->size = end + 1;
@ -1508,12 +1576,12 @@ DOC_PARAM(match_index, If this call succeeds match_index is filled with the inde
DOC(This call tries to see if str matches any of the strings in str_set. If there is a match the call
succeeds and returns non-zero. The matching rule is equivalent to the matching rule for match.)
DOC_SEE(match) */{
fstr_bool result = false;
fstr_bool result = 0;
int32_t i = 0;
for (; i < count; ++i, ++str_set){
if (match(*str_set, str)){
if (match_ss(*str_set, str)){
*match_index = i;
result = true;
result = 1;
break;
}
}
@ -1530,10 +1598,10 @@ DOC_SEE(match) */{
# define ArrayCount(a) ((sizeof(a))/sizeof(*a))
#endif
struct Absolutes{
typedef struct Absolutes{
String a[8];
int32_t count;
};
} Absolutes;
static void
get_absolutes(String name, Absolutes *absolutes, fstr_bool implicit_first, fstr_bool implicit_last){
@ -1582,7 +1650,7 @@ get_absolutes(String name, Absolutes *absolutes, fstr_bool implicit_first, fstr_
}
static fstr_bool
wildcard_match(Absolutes *absolutes, char *x, int32_t case_sensitive){
wildcard_match_c(Absolutes *absolutes, char *x, int32_t case_sensitive){
fstr_bool r = 1;
String *a = absolutes->a;
@ -1590,12 +1658,12 @@ wildcard_match(Absolutes *absolutes, char *x, int32_t case_sensitive){
fstr_bool (*match_part_func)(char*, String);
if (case_sensitive){
match_func = match;
match_part_func = match_part;
match_func = match_cs;
match_part_func = match_part_cs;
}
else{
match_func = match_insensitive;
match_part_func = match_part_insensitive;
match_func = match_insensitive_cs;
match_part_func = match_part_insensitive_cs;
}
if (absolutes->count == 1){
@ -1636,22 +1704,22 @@ wildcard_match(Absolutes *absolutes, char *x, int32_t case_sensitive){
}
}
}
return r;
return(r);
}
static fstr_bool
wildcard_match(Absolutes *absolutes, String x, int32_t case_sensitive){
wildcard_match_s(Absolutes *absolutes, String x, int32_t case_sensitive){
terminate_with_null(&x);
return wildcard_match(absolutes, x.str, case_sensitive);
return(wildcard_match_c(absolutes, x.str, case_sensitive));
}
#endif
#ifdef FSTRING_IMPLEMENTATION
#if defined(FSTRING_IMPLEMENTATION)
#undef FSTRING_IMPLEMENTATION
#endif
#ifndef FSTRING_GUARD
#if !defined(FSTRING_GUARD)
#define FSTRING_GUARD
#endif

View File

@ -38,13 +38,13 @@ CUSTOM_COMMAND_SIG(load_lots_of_files){
char space[1024];
String str = make_fixed_width_string(space);
append(&str, LOTS_OF_FILES);
append(&str, '/');
append_ss(&str, make_lit_string(LOTS_OF_FILES));
append_s_char(&str, '/');
int size = str.size;
for (int i = 0; i < list.count; ++i, ++info){
if (!info->folder){
append(&str, make_string(info->filename, info->filename_len));
append_ss(&str, make_string(info->filename, info->filename_len));
Buffer_Summary buffer = app->create_buffer(app, str.str, str.size,
BufferCreate_Background);
assert(buffer.size != 0);

View File

@ -109,7 +109,7 @@ sysshared_to_binary_path(String *out_filename, char *filename){
i32 size = system_get_binary_path(out_filename);
if (size > 0 && size < max-1){
out_filename->size = size;
if (append(out_filename, filename) && terminate_with_null(out_filename)){
if (append_sc(out_filename, filename) && terminate_with_null(out_filename)){
translate_success = 1;
}
}

View File

@ -130,7 +130,7 @@ sub_match_list(char *chunk, int size, int pos, String_List list, int sub_size){
str_main = substr(str_main, 0, sub_size);
for (i = 0; i < list.count; ++i){
str_check = list.data[i].str;
if (match(str_main, str_check)){
if (match_sc(str_main, str_check)){
result.index = i;
result.new_pos = pos + sub_size;
break;
@ -140,7 +140,7 @@ sub_match_list(char *chunk, int size, int pos, String_List list, int sub_size){
else{
for (i = 0; i < list.count; ++i){
str_check = list.data[i].str;
if (match_part(str_main, str_check, &l)){
if (match_part_scl(str_main, str_check, &l)){
result.index = i;
result.new_pos = pos + l;
break;
@ -530,7 +530,7 @@ cpp_lex_nonalloc(Lex_Data *S_ptr,
int word_size = S.pos - S.token_start;
if (S.pp_state == LSPP_body_if){
if (match(make_string(S.tb, word_size), make_lit_string("defined"))){
if (match_ss(make_string(S.tb, word_size), make_lit_string("defined"))){
S.token.type = CPP_TOKEN_DEFINED;
S.token.flags = CPP_TFLAG_IS_OPERATOR | CPP_TFLAG_IS_KEYWORD;
break;

View File

@ -802,7 +802,7 @@ system_file_load_begin(char *filename){
if (fname_str.size < 1024){
char fixed_space[1024];
String fixed_str = make_fixed_width_string(fixed_space);
copy(&fixed_str, fname_str);
copy_ss(&fixed_str, fname_str);
terminate_with_null(&fixed_str);
replace_char(&fixed_str, '/', '\\');
@ -944,10 +944,9 @@ internal
Sys_Set_File_List_Sig(system_set_file_list){
if (directory.size > 0){
char dir_space[MAX_PATH + 32];
String dir = make_string(dir_space, 0, MAX_PATH + 32);
append(&dir, directory);
char trail_str[] = "\\*";
append(&dir, trail_str);
String dir = make_string_cap(dir_space, 0, MAX_PATH + 32);
append_ss(&dir, directory);
append_ss(&dir, make_lit_string("\\*"));
terminate_with_null(&dir);
char *c_str_dir = dir.str;
@ -961,8 +960,8 @@ Sys_Set_File_List_Sig(system_set_file_list){
i32 file_count = 0;
BOOL more_files = 1;
do{
if (!match(find_data.cFileName, ".") &&
!match(find_data.cFileName, "..")){
if (!match_cs(find_data.cFileName, make_lit_string(".")) &&
!match_cs(find_data.cFileName, make_lit_string(".."))){
++file_count;
i32 size = 0;
for(;find_data.cFileName[size];++size);
@ -988,8 +987,8 @@ Sys_Set_File_List_Sig(system_set_file_list){
File_Info *info = file_list->infos;
more_files = 1;
do{
if (!match(find_data.cFileName, ".") &&
!match(find_data.cFileName, "..")){
if (!match_cs(find_data.cFileName, make_lit_string(".")) &&
!match_cs(find_data.cFileName, make_lit_string(".."))){
info->folder = (find_data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) != 0;
info->filename = name;
@ -997,9 +996,9 @@ Sys_Set_File_List_Sig(system_set_file_list){
for(;find_data.cFileName[i];++i) *name++ = find_data.cFileName[i];
info->filename_len = i;
*name++ = 0;
String fname = make_string(info->filename,
info->filename_len,
info->filename_len+1);
String fname = make_string_cap(info->filename,
info->filename_len,
info->filename_len+1);
replace_char(&fname, '\\', '/');
++info;
}
@ -1364,7 +1363,7 @@ Sys_Post_Clipboard_Sig(system_post_clipboard){
memory_handle = GlobalAlloc(GMEM_MOVEABLE, str.size+1);
if (memory_handle){
char *dest = (char*)GlobalLock(memory_handle);
copy_fast_unsafe(dest, str);
copy_fast_unsafe_cs(dest, str);
GlobalUnlock(memory_handle);
SetClipboardData(CF_TEXT, memory_handle);
win32vars.next_clipboard_is_self = 1;
@ -1408,8 +1407,8 @@ Sys_CLI_Call_Sig(system_cli_call){
char command_line[2048];
String s = make_fixed_width_string(command_line);
copy(&s, make_lit_string("/C "));
append_partial(&s, script_name);
copy_ss(&s, make_lit_string("/C "));
append_partial_sc(&s, script_name);
b32 success = terminate_with_null(&s);
if (success){
@ -2298,7 +2297,7 @@ WinMain(HINSTANCE hInstance,
char *current_directory_mem = (char*)system_get_memory(required);
DWORD written = GetCurrentDirectory(required, current_directory_mem);
String current_directory = make_string(current_directory_mem, written, required);
String current_directory = make_string_cap(current_directory_mem, written, required);
terminate_with_null(&current_directory);
replace_char(&current_directory, '\\', '/');

View File

@ -75,7 +75,7 @@ DOC_RETURN(This call returns non-zero if and only if the file exists.)
if (len < sizeof(full_filename_space)){
full_filename = make_fixed_width_string(full_filename_space);
copy(&full_filename, make_string(filename, len));
copy_ss(&full_filename, make_string(filename, len));
terminate_with_null(&full_filename);
file = CreateFile(full_filename.str, GENERIC_READ, 0, 0,
@ -110,13 +110,13 @@ string. This call can also be used with rel set to ".." to traverse to parent
folders.
)
*/{
String directory = make_string(dir, *len, capacity);
String directory = make_string_cap(dir, *len, capacity);
b32 result = 0;
i32 old_size;
char rel_path_space[1024];
String rel_path_string = make_fixed_width_string(rel_path_space);
copy(&rel_path_string, make_string(rel_path, rel_len));
copy_ss(&rel_path_string, make_string(rel_path, rel_len));
terminate_with_null(&rel_path_string);
if (rel_path[0] != 0){
@ -130,8 +130,8 @@ folders.
else{
if (directory.size + rel_len + 1 > directory.memory_size){
old_size = directory.size;
append_partial(&directory, rel_path);
append_partial(&directory, "\\");
append_partial_sc(&directory, rel_path);
append_s_char(&directory, '\\');
if (Win32DirectoryExists(directory.str)){
result = 1;
}
@ -153,7 +153,7 @@ DOC_PARAM(out, This parameter provides a character buffer that receives the path
DOC_PARAM(capacity, This parameter specifies the maximum capacity of the out buffer.)
DOC_RETURN(This call returns non-zero on success.)
*/{
String str = make_string(out, 0, capacity);
String str = make_string_cap(out, 0, capacity);
return(system_get_binary_path(&str));
}

View File

@ -16,7 +16,7 @@ win32_ft_font_load(Partition *part, Render_Font *rf, char *name,
char* filename = push_array(part, char, 256);
if (filename != 0){
String str = make_string(filename, 0, 256);
String str = make_string_cap(filename, 0, 256);
sysshared_to_binary_path(&str, name);
result = font_load_freetype(part, rf, filename, pt_size, tab_width, use_hinting);