fixed lexer issue
This commit is contained in:
parent
c134f04dde
commit
2b36821c1e
147
4coder_API.html
147
4coder_API.html
|
@ -1170,6 +1170,12 @@ Coming Soon</i><div>
|
|||
<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>
|
||||
<li><a href='#to_lower_cc_str_doc'>to_lower_cc</a></li>
|
||||
<li><a href='#to_lower_ss_str_doc'>to_lower_ss</a></li>
|
||||
<li><a href='#to_lower_s_str_doc'>to_lower_s</a></li>
|
||||
<li><a href='#to_upper_cc_str_doc'>to_upper_cc</a></li>
|
||||
<li><a href='#to_upper_ss_str_doc'>to_upper_ss</a></li>
|
||||
<li><a href='#to_upper_s_str_doc'>to_upper_s</a></li>
|
||||
<li><a href='#int_to_str_size_str_doc'>int_to_str_size</a></li>
|
||||
<li><a href='#int_to_str_str_doc'>int_to_str</a></li>
|
||||
<li><a href='#append_int_to_str_str_doc'>append_int_to_str</a></li>
|
||||
|
@ -1907,153 +1913,238 @@ void replace_char(
|
|||
<div style='margin-bottom: 6mm;'><div style='margin-left: 5mm; margin-right: 5mm;'>The with character specifies what to write into the positions where replacement occurs.</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 replaces all occurances of character in str with another character.</div></div><hr>
|
||||
<div id='int_to_str_size_str_doc'><h4>§4.3.80: int_to_str_size</h4>
|
||||
<div id='to_lower_cc_str_doc'><h4>§4.3.80: to_lower_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;'>
|
||||
void to_lower_cc(
|
||||
<div style='margin-left: 4mm;'>char *src,<br>char *dst<br></div>)
|
||||
</div>
|
||||
<div style='margin-top: 3mm; margin-bottom: 3mm; color: #309030;'><b><i>Parameters</i></b></div><div>
|
||||
<div style='font-weight: 600;'>src</div>
|
||||
<div style='margin-bottom: 6mm;'><div style='margin-left: 5mm; margin-right: 5mm;'>The source string to conver to lowercase. This string must be null terminated.</div></div>
|
||||
</div>
|
||||
<div>
|
||||
<div style='font-weight: 600;'>dst</div>
|
||||
<div style='margin-bottom: 6mm;'><div style='margin-left: 5mm; margin-right: 5mm;'>The destination buffer to receive the converted string. This must be large
|
||||
enough to contain all of src and a null terminator.</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;'>Rewrites the string in src into dst with all letters lowercased. src and dst should not
|
||||
overlap with the exception that src and dst may be exactly equal in order to convert the
|
||||
string in place.</div></div><hr>
|
||||
<div id='to_lower_ss_str_doc'><h4>§4.3.81: to_lower_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 to_lower_ss(
|
||||
<div style='margin-left: 4mm;'>String *src,<br>String *dst<br></div>)
|
||||
</div>
|
||||
<div style='margin-top: 3mm; margin-bottom: 3mm; color: #309030;'><b><i>Parameters</i></b></div><div>
|
||||
<div style='font-weight: 600;'>src</div>
|
||||
<div style='margin-bottom: 6mm;'><div style='margin-left: 5mm; margin-right: 5mm;'>The source string to conver to lowercase.</div></div>
|
||||
</div>
|
||||
<div>
|
||||
<div style='font-weight: 600;'>dst</div>
|
||||
<div style='margin-bottom: 6mm;'><div style='margin-left: 5mm; margin-right: 5mm;'>The destination buffer to receive the converted string.
|
||||
This must have a capacity of at least the size of src.</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;'>Rewrites the string in src into dst. src and dst should not overlap with the exception
|
||||
that src and dst may be exactly equal in order to convert the string in place.</div></div><hr>
|
||||
<div id='to_lower_s_str_doc'><h4>§4.3.82: to_lower_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;'>
|
||||
void to_lower_s(
|
||||
<div style='margin-left: 4mm;'>String *str<br></div>)
|
||||
</div>
|
||||
<div style='margin-top: 3mm; margin-bottom: 3mm; color: #309030;'><b><i>Parameters</i></b></div><div>
|
||||
<div style='font-weight: 600;'>str</div>
|
||||
<div style='margin-bottom: 6mm;'><div style='margin-left: 5mm; margin-right: 5mm;'>The string to be converted to all lowercase.</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 version of to_lower converts str to lowercase in place.</div></div><hr>
|
||||
<div id='to_upper_cc_str_doc'><h4>§4.3.83: to_upper_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;'>
|
||||
void to_upper_cc(
|
||||
<div style='margin-left: 4mm;'>char *src,<br>char *dst<br></div>)
|
||||
</div>
|
||||
<div style='margin-top: 3mm; margin-bottom: 3mm; color: #309030;'><b><i>Parameters</i></b></div><div>
|
||||
<div style='font-weight: 600;'>src</div>
|
||||
<div style='margin-bottom: 6mm;'><div style='margin-left: 5mm; margin-right: 5mm;'>The source string to convert to uppercase. This string must be null terminated.</div></div>
|
||||
</div>
|
||||
<div>
|
||||
<div style='font-weight: 600;'>dst</div>
|
||||
<div style='margin-bottom: 6mm;'><div style='margin-left: 5mm; margin-right: 5mm;'>The destination buffer to receive the converted string. This must be large
|
||||
enough to contain all of src and a null terminator.</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;'>Rewrites the string in src into dst. src and dst should not overlap with the exception
|
||||
that src and dst may be exactly equal in order to convert the string in place.</div></div><hr>
|
||||
<div id='to_upper_ss_str_doc'><h4>§4.3.84: to_upper_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 to_upper_ss(
|
||||
<div style='margin-left: 4mm;'>String *src,<br>String *dst<br></div>)
|
||||
</div>
|
||||
<div style='margin-top: 3mm; margin-bottom: 3mm; color: #309030;'><b><i>Parameters</i></b></div><div>
|
||||
<div style='font-weight: 600;'>src</div>
|
||||
<div style='margin-bottom: 6mm;'><div style='margin-left: 5mm; margin-right: 5mm;'>The source string to conver to uppercase.</div></div>
|
||||
</div>
|
||||
<div>
|
||||
<div style='font-weight: 600;'>dst</div>
|
||||
<div style='margin-bottom: 6mm;'><div style='margin-left: 5mm; margin-right: 5mm;'>The destination buffer to receive the converted string.
|
||||
This must have a capacity of at least the size of src.</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;'>Rewrites the string in src into dst. src and dst should not overlap with the exception
|
||||
that src and dst may be exactly equal in order to convert the string in place.</div></div><hr>
|
||||
<div id='to_upper_s_str_doc'><h4>§4.3.85: to_upper_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;'>
|
||||
void to_upper_s(
|
||||
<div style='margin-left: 4mm;'>String *str<br></div>)
|
||||
</div>
|
||||
<div style='margin-top: 3mm; margin-bottom: 3mm; color: #309030;'><b><i>Parameters</i></b></div><div>
|
||||
<div style='font-weight: 600;'>str</div>
|
||||
<div style='margin-bottom: 6mm;'><div style='margin-left: 5mm; margin-right: 5mm;'>The string to be converted to all uppercase.</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 version of to_upper converts str to uppercase in place.</div></div><hr>
|
||||
<div id='int_to_str_size_str_doc'><h4>§4.3.86: int_to_str_size</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 int_to_str_size(
|
||||
<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;'>This call returns the number of bytes required to represent x as a string.</div></div><hr>
|
||||
<div id='int_to_str_str_doc'><h4>§4.3.81: int_to_str</h4>
|
||||
<div id='int_to_str_str_doc'><h4>§4.3.87: int_to_str</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 int_to_str(
|
||||
<div style='margin-left: 4mm;'>String *dest,<br>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;'>This call writes a string representation of x into dest. If there is enough
|
||||
space in dest this call returns non-zero.</div></div><hr>
|
||||
<div id='append_int_to_str_str_doc'><h4>§4.3.82: append_int_to_str</h4>
|
||||
<div id='append_int_to_str_str_doc'><h4>§4.3.88: append_int_to_str</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_int_to_str(
|
||||
<div style='margin-left: 4mm;'>String *dest,<br>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;'>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='u64_to_str_size_str_doc'><h4>§4.3.83: u64_to_str_size</h4>
|
||||
<div id='u64_to_str_size_str_doc'><h4>§4.3.89: u64_to_str_size</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 u64_to_str_size(
|
||||
<div style='margin-left: 4mm;'>uint64_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;'>This call returns the number of bytes required to represent x as a string.</div></div><hr>
|
||||
<div id='u64_to_str_str_doc'><h4>§4.3.84: u64_to_str</h4>
|
||||
<div id='u64_to_str_str_doc'><h4>§4.3.90: u64_to_str</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 u64_to_str(
|
||||
<div style='margin-left: 4mm;'>String *dest,<br>uint64_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;'>This call writes a string representation of x into dest. If there is enough
|
||||
space in dest this call returns non-zero.</div></div><hr>
|
||||
<div id='append_u64_to_str_str_doc'><h4>§4.3.85: append_u64_to_str</h4>
|
||||
<div id='append_u64_to_str_str_doc'><h4>§4.3.91: append_u64_to_str</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_u64_to_str(
|
||||
<div style='margin-left: 4mm;'>String *dest,<br>uint64_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;'>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='float_to_str_size_str_doc'><h4>§4.3.86: float_to_str_size</h4>
|
||||
<div id='float_to_str_size_str_doc'><h4>§4.3.92: float_to_str_size</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 float_to_str_size(
|
||||
<div style='margin-left: 4mm;'>float 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;'>This call returns the number of bytes required to represent x as a string.</div></div><hr>
|
||||
<div id='append_float_to_str_str_doc'><h4>§4.3.87: append_float_to_str</h4>
|
||||
<div id='append_float_to_str_str_doc'><h4>§4.3.93: append_float_to_str</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_float_to_str(
|
||||
<div style='margin-left: 4mm;'>String *dest,<br>float 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;'>This call writes a string representation of x into dest. If there is enough
|
||||
space in dest this call returns non-zero.</div></div><hr>
|
||||
<div id='float_to_str_str_doc'><h4>§4.3.88: float_to_str</h4>
|
||||
<div id='float_to_str_str_doc'><h4>§4.3.94: float_to_str</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 float_to_str(
|
||||
<div style='margin-left: 4mm;'>String *dest,<br>float 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;'>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_c_str_doc'><h4>§4.3.89: str_is_int_c</h4>
|
||||
<div id='str_is_int_c_str_doc'><h4>§4.3.95: 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;'>
|
||||
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>§4.3.90: str_is_int_s</h4>
|
||||
<div id='str_is_int_s_str_doc'><h4>§4.3.96: 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_c_str_doc'><h4>§4.3.91: str_to_int_c</h4>
|
||||
<div id='str_to_int_c_str_doc'><h4>§4.3.97: 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_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 id='str_to_int_s_str_doc'><h4>§4.3.92: str_to_int_s</h4>
|
||||
<div id='str_to_int_s_str_doc'><h4>§4.3.98: 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_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>§4.3.93: hexchar_to_int</h4>
|
||||
<div id='hexchar_to_int_str_doc'><h4>§4.3.99: 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>§4.3.94: int_to_hexchar</h4>
|
||||
<div id='int_to_hexchar_str_doc'><h4>§4.3.100: 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>§4.3.95: hexstr_to_int</h4>
|
||||
<div id='hexstr_to_int_str_doc'><h4>§4.3.101: 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>§4.3.96: color_to_hexstr</h4>
|
||||
<div id='color_to_hexstr_str_doc'><h4>§4.3.102: 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>§4.3.97: hexstr_to_color</h4>
|
||||
<div id='hexstr_to_color_str_doc'><h4>§4.3.103: 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_pos_str_doc'><h4>§4.3.98: reverse_seek_slash_pos</h4>
|
||||
<div id='reverse_seek_slash_pos_str_doc'><h4>§4.3.104: 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_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 id='reverse_seek_slash_str_doc'><h4>§4.3.99: reverse_seek_slash</h4>
|
||||
<div id='reverse_seek_slash_str_doc'><h4>§4.3.105: 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>§4.3.100: front_of_directory</h4>
|
||||
<div id='front_of_directory_str_doc'><h4>§4.3.106: 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>§4.3.101: path_of_directory</h4>
|
||||
<div id='path_of_directory_str_doc'><h4>§4.3.107: 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_sc_str_doc'><h4>§4.3.102: set_last_folder_sc</h4>
|
||||
<div id='set_last_folder_sc_str_doc'><h4>§4.3.108: 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_sc(
|
||||
<div style='margin-left: 4mm;'>String *dir,<br>char *folder_name,<br>char slash<br></div>)
|
||||
|
@ -2073,7 +2164,7 @@ 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 id='set_last_folder_ss_str_doc'><h4>§4.3.103: set_last_folder_ss</h4>
|
||||
<div id='set_last_folder_ss_str_doc'><h4>§4.3.109: 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_ss(
|
||||
<div style='margin-left: 4mm;'>String *dir,<br>String folder_name,<br>char slash<br></div>)
|
||||
|
@ -2092,27 +2183,27 @@ fstr_bool set_last_folder_ss(
|
|||
</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>§4.3.104: file_extension</h4>
|
||||
<div id='file_extension_str_doc'><h4>§4.3.110: 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_extension_str_doc'><h4>§4.3.105: remove_extension</h4>
|
||||
<div id='remove_extension_str_doc'><h4>§4.3.111: remove_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;'>
|
||||
fstr_bool remove_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 attemps to delete a file extension off the end of a filename.
|
||||
This call returns non-zero on success.</div></div><hr>
|
||||
<div id='remove_last_folder_str_doc'><h4>§4.3.106: remove_last_folder</h4>
|
||||
<div id='remove_last_folder_str_doc'><h4>§4.3.112: 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>§4.3.107: string_set_match</h4>
|
||||
<div id='string_set_match_str_doc'><h4>§4.3.113: 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>)
|
||||
|
|
106
4coder_string.h
106
4coder_string.h
|
@ -132,6 +132,12 @@ FSTRING_INLINE fstr_bool append_sc(String *dest, char *src);
|
|||
FSTRING_LINK fstr_bool terminate_with_null(String *str);
|
||||
FSTRING_LINK fstr_bool append_padding(String *dest, char c, int32_t target_size);
|
||||
FSTRING_LINK void replace_char(String *str, char replace, char with);
|
||||
FSTRING_LINK void to_lower_cc(char *src, char *dst);
|
||||
FSTRING_LINK void to_lower_ss(String *src, String *dst);
|
||||
FSTRING_LINK void to_lower_s(String *str);
|
||||
FSTRING_LINK void to_upper_cc(char *src, char *dst);
|
||||
FSTRING_LINK void to_upper_ss(String *src, String *dst);
|
||||
FSTRING_LINK void to_upper_s(String *str);
|
||||
FSTRING_LINK int32_t int_to_str_size(int32_t x);
|
||||
FSTRING_LINK fstr_bool int_to_str(String *dest, int32_t x);
|
||||
FSTRING_LINK fstr_bool append_int_to_str(String *dest, int32_t x);
|
||||
|
@ -220,6 +226,12 @@ FSTRING_INLINE fstr_bool append_partial(String *dest, String src);
|
|||
FSTRING_INLINE fstr_bool append(String *dest, char c);
|
||||
FSTRING_INLINE fstr_bool append(String *dest, String src);
|
||||
FSTRING_INLINE fstr_bool append(String *dest, char *src);
|
||||
FSTRING_INLINE void to_lower(char *src, char *dst);
|
||||
FSTRING_INLINE void to_lower(String *src, String *dst);
|
||||
FSTRING_INLINE void to_lower(String *str);
|
||||
FSTRING_INLINE void to_upper(char *src, char *dst);
|
||||
FSTRING_INLINE void to_upper(String *src, String *dst);
|
||||
FSTRING_INLINE void to_upper(String *str);
|
||||
FSTRING_INLINE int32_t str_is_int(char *str);
|
||||
FSTRING_INLINE fstr_bool str_is_int(String str);
|
||||
FSTRING_INLINE int32_t str_to_int(char *str);
|
||||
|
@ -342,6 +354,18 @@ FSTRING_INLINE fstr_bool
|
|||
append(String *dest, String src){return(append_ss(dest,src));}
|
||||
FSTRING_INLINE fstr_bool
|
||||
append(String *dest, char *src){return(append_sc(dest,src));}
|
||||
FSTRING_INLINE void
|
||||
to_lower(char *src, char *dst){(to_lower_cc(src,dst));}
|
||||
FSTRING_INLINE void
|
||||
to_lower(String *src, String *dst){(to_lower_ss(src,dst));}
|
||||
FSTRING_INLINE void
|
||||
to_lower(String *str){(to_lower_s(str));}
|
||||
FSTRING_INLINE void
|
||||
to_upper(char *src, char *dst){(to_upper_cc(src,dst));}
|
||||
FSTRING_INLINE void
|
||||
to_upper(String *src, String *dst){(to_upper_ss(src,dst));}
|
||||
FSTRING_INLINE void
|
||||
to_upper(String *str){(to_upper_s(str));}
|
||||
FSTRING_INLINE int32_t
|
||||
str_is_int(char *str){return(str_is_int_c(str));}
|
||||
FSTRING_INLINE fstr_bool
|
||||
|
@ -1397,6 +1421,88 @@ replace_char(String *str, char replace, char with){
|
|||
}
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(FSTRING_IMPLEMENTATION)
|
||||
FSTRING_LINK void
|
||||
to_lower_cc(char *src, char *dst){
|
||||
for (; *src != 0; ++src){
|
||||
*dst++ = char_to_lower(*src);
|
||||
}
|
||||
*dst++ = 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(FSTRING_IMPLEMENTATION)
|
||||
FSTRING_LINK void
|
||||
to_lower_ss(String *src, String *dst){
|
||||
int32_t i = 0;
|
||||
int32_t size = src->size;
|
||||
char *c = src->str;
|
||||
char *d = dst->str;
|
||||
|
||||
if (dst->memory_size >= size){
|
||||
for (; i < size; ++i){
|
||||
*d++ = char_to_lower(*c++);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(FSTRING_IMPLEMENTATION)
|
||||
FSTRING_LINK void
|
||||
to_lower_s(String *str){
|
||||
int32_t i = 0;
|
||||
int32_t size = str->size;
|
||||
char *c = str->str;
|
||||
for (; i < size; ++c, ++i){
|
||||
*c = char_to_lower(*c);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(FSTRING_IMPLEMENTATION)
|
||||
FSTRING_LINK void
|
||||
to_upper_cc(char *src, char *dst){
|
||||
for (; *src != 0; ++src){
|
||||
*dst++ = char_to_upper(*src);
|
||||
}
|
||||
*dst++ = 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(FSTRING_IMPLEMENTATION)
|
||||
FSTRING_LINK void
|
||||
to_upper_ss(String *src, String *dst){
|
||||
int32_t i = 0;
|
||||
int32_t size = src->size;
|
||||
char *c = src->str;
|
||||
char *d = dst->str;
|
||||
|
||||
if (dst->memory_size >= size){
|
||||
for (; i < size; ++i){
|
||||
*d++ = char_to_upper(*c++);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(FSTRING_IMPLEMENTATION)
|
||||
FSTRING_LINK void
|
||||
to_upper_s(String *str){
|
||||
int32_t i = 0;
|
||||
int32_t size = str->size;
|
||||
char *c = str->str;
|
||||
for (; i < size; ++c, ++i){
|
||||
*c = char_to_upper(*c);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
//
|
||||
// String <-> Number Conversions
|
||||
//
|
||||
|
|
|
@ -706,3 +706,5 @@ struct Theme_Color{
|
|||
int_color color;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -4,7 +4,12 @@
|
|||
#ifndef FCPP_LEXER_TYPES_INC
|
||||
#define FCPP_LEXER_TYPES_INC
|
||||
|
||||
enum Cpp_Token_Type{
|
||||
#if 0
|
||||
|
||||
/* DOC(A Cpp_Token_Type classifies a token to make parsing easier. Some types are not
|
||||
actually output by the lexer, but exist because parsers will also make use of token
|
||||
types in their own output.) */
|
||||
ENUM(int32_t, Cpp_Token_Type){
|
||||
CPP_TOKEN_JUNK,
|
||||
CPP_TOKEN_COMMENT,
|
||||
|
||||
|
@ -29,7 +34,8 @@ enum Cpp_Token_Type{
|
|||
CPP_TOKEN_KEY_TYPE,
|
||||
CPP_TOKEN_KEY_MODIFIER,
|
||||
CPP_TOKEN_KEY_QUALIFIER,
|
||||
CPP_TOKEN_KEY_OPERATOR, // NOTE(allen): This type is not actually stored in tokens
|
||||
/* DOC(This type is not stored in token output from the lexer.) */
|
||||
CPP_TOKEN_KEY_OPERATOR,
|
||||
CPP_TOKEN_KEY_CONTROL_FLOW,
|
||||
CPP_TOKEN_KEY_CAST,
|
||||
CPP_TOKEN_KEY_TYPE_DECLARATION,
|
||||
|
@ -55,62 +61,106 @@ enum Cpp_Token_Type{
|
|||
CPP_TOKEN_SEMICOLON,
|
||||
CPP_TOKEN_ELLIPSIS,
|
||||
|
||||
// NOTE(allen): Ambiguous tokens, lexer only,
|
||||
// parser figures out the real meaning
|
||||
/* DOC(This is an 'ambiguous' token type because it requires
|
||||
parsing to determine the full nature of the token.) */
|
||||
CPP_TOKEN_STAR,
|
||||
|
||||
/* DOC(This is an 'ambiguous' token type because it requires
|
||||
parsing to determine the full nature of the token.) */
|
||||
CPP_TOKEN_AMPERSAND,
|
||||
|
||||
/* DOC(This is an 'ambiguous' token type because it requires
|
||||
parsing to determine the full nature of the token.) */
|
||||
CPP_TOKEN_TILDE,
|
||||
|
||||
/* DOC(This is an 'ambiguous' token type because it requires
|
||||
parsing to determine the full nature of the token.) */
|
||||
CPP_TOKEN_PLUS,
|
||||
|
||||
/* DOC(This is an 'ambiguous' token type because it requires
|
||||
parsing to determine the full nature of the token.) */
|
||||
CPP_TOKEN_MINUS,
|
||||
|
||||
/* DOC(This is an 'ambiguous' token type because it requires
|
||||
parsing to determine the full nature of the token.) */
|
||||
CPP_TOKEN_INCREMENT,
|
||||
|
||||
/* DOC(This is an 'ambiguous' token type because it requires
|
||||
parsing to determine the full nature of the token.) */
|
||||
CPP_TOKEN_DECREMENT,
|
||||
|
||||
// NOTE(allen): Precedence 1, LtoR
|
||||
CPP_TOKEN_SCOPE,
|
||||
|
||||
// NOTE(allen): Precedence 2, LtoR
|
||||
CPP_TOKEN_POSTINC, // from increment, parser only
|
||||
CPP_TOKEN_POSTDEC, // from decrement, parser only
|
||||
CPP_TOKEN_FUNC_STYLE_CAST, // parser only
|
||||
/* DOC(This type is for parser use, it is not output by the lexer.) */
|
||||
CPP_TOKEN_POSTINC,
|
||||
/* DOC(This type is for parser use, it is not output by the lexer.) */
|
||||
CPP_TOKEN_POSTDEC,
|
||||
/* DOC(This type is for parser use, it is not output by the lexer.) */
|
||||
CPP_TOKEN_FUNC_STYLE_CAST,
|
||||
CPP_TOKEN_CPP_STYLE_CAST,
|
||||
CPP_TOKEN_CALL, // from open paren, parser only
|
||||
CPP_TOKEN_INDEX, // from bracket open, parser only
|
||||
/* DOC(This type is for parser use, it is not output by the lexer.) */
|
||||
CPP_TOKEN_CALL,
|
||||
/* DOC(This type is for parser use, it is not output by the lexer.) */
|
||||
CPP_TOKEN_INDEX,
|
||||
CPP_TOKEN_DOT,
|
||||
CPP_TOKEN_ARROW,
|
||||
|
||||
// NOTE(allen): Precedence 3, RtoL
|
||||
CPP_TOKEN_PREINC, // from increment, parser only
|
||||
CPP_TOKEN_PREDEC, // from decrement, parser only
|
||||
CPP_TOKEN_POSITIVE, // from plus, parser only
|
||||
CPP_TOKEN_NEGAITVE, // from minus, parser only
|
||||
|
||||
/* DOC(This token is for parser use, it is not output by the lexer.) */
|
||||
CPP_TOKEN_PREINC,
|
||||
/* DOC(This token is for parser use, it is not output by the lexer.) */
|
||||
CPP_TOKEN_PREDEC,
|
||||
/* DOC(This token is for parser use, it is not output by the lexer.) */
|
||||
CPP_TOKEN_POSITIVE,
|
||||
/* DOC(This token is for parser use, it is not output by the lexer.) */
|
||||
CPP_TOKEN_NEGAITVE,
|
||||
CPP_TOKEN_NOT,
|
||||
CPP_TOKEN_BIT_NOT, // from tilde, direct from 'compl'
|
||||
CPP_TOKEN_CAST, // from open paren, parser only
|
||||
CPP_TOKEN_DEREF, // from star, parser only
|
||||
CPP_TOKEN_TYPE_PTR, // from star, parser only
|
||||
CPP_TOKEN_ADDRESS, // from ampersand, parser only
|
||||
CPP_TOKEN_TYPE_REF, // from ampersand, parser only
|
||||
|
||||
/* DOC(This type is for parser use, it is not output by the lexer.) */
|
||||
CPP_TOKEN_BIT_NOT,
|
||||
|
||||
/* DOC(This type is for parser use, it is not output by the lexer.) */
|
||||
CPP_TOKEN_CAST,
|
||||
/* DOC(This type is for parser use, it is not output by the lexer.) */
|
||||
CPP_TOKEN_DEREF,
|
||||
/* DOC(This type is for parser use, it is not output by the lexer.) */
|
||||
CPP_TOKEN_TYPE_PTR,
|
||||
/* DOC(This type is for parser use, it is not output by the lexer.) */
|
||||
CPP_TOKEN_ADDRESS,
|
||||
/* DOC(This type is for parser use, it is not output by the lexer.) */
|
||||
CPP_TOKEN_TYPE_REF,
|
||||
CPP_TOKEN_SIZEOF,
|
||||
CPP_TOKEN_ALIGNOF,
|
||||
CPP_TOKEN_DECLTYPE,
|
||||
CPP_TOKEN_TYPEID,
|
||||
CPP_TOKEN_NEW,
|
||||
CPP_TOKEN_DELETE,
|
||||
CPP_TOKEN_NEW_ARRAY, // from new and bracket open, parser only
|
||||
CPP_TOKEN_DELETE_ARRAY, // from delete and bracket open, parser only
|
||||
/* DOC(This type is for parser use, it is not output by the lexer.) */
|
||||
CPP_TOKEN_NEW_ARRAY,
|
||||
/* DOC(This type is for parser use, it is not output by the lexer.) */
|
||||
CPP_TOKEN_DELETE_ARRAY,
|
||||
|
||||
// NOTE(allen): Precedence 4, LtoR
|
||||
CPP_TOKEN_PTRDOT,
|
||||
CPP_TOKEN_PTRARROW,
|
||||
|
||||
// NOTE(allen): Precedence 5, LtoR
|
||||
CPP_TOKEN_MUL, // from start, parser only
|
||||
|
||||
/* DOC(This type is for parser use, it is not output by the lexer.) */
|
||||
CPP_TOKEN_MUL,
|
||||
CPP_TOKEN_DIV,
|
||||
CPP_TOKEN_MOD,
|
||||
|
||||
// NOTE(allen): Precedence 6, LtoR
|
||||
CPP_TOKEN_ADD, // from plus, parser only
|
||||
CPP_TOKEN_SUB, // from minus, parser only
|
||||
|
||||
/* DOC(This type is for parser use, it is not output by the lexer.) */
|
||||
CPP_TOKEN_ADD,
|
||||
|
||||
/* DOC(This type is for parser use, it is not output by the lexer.) */
|
||||
CPP_TOKEN_SUB,
|
||||
|
||||
// NOTE(allen): Precedence 7, LtoR
|
||||
CPP_TOKEN_LSHIFT,
|
||||
|
@ -127,7 +177,9 @@ enum Cpp_Token_Type{
|
|||
CPP_TOKEN_NOTEQ,
|
||||
|
||||
// NOTE(allen): Precedence 10, LtoR
|
||||
CPP_TOKEN_BIT_AND, // from ampersand, direct from 'bitand'
|
||||
|
||||
/* DOC(This type is for parser use, it is not output by the lexer.) */
|
||||
CPP_TOKEN_BIT_AND,
|
||||
|
||||
// NOTE(allen): Precedence 11, LtoR
|
||||
CPP_TOKEN_BIT_XOR,
|
||||
|
@ -164,11 +216,182 @@ enum Cpp_Token_Type{
|
|||
CPP_TOKEN_INCLUDE_FILE,
|
||||
CPP_TOKEN_ERROR_MESSAGE,
|
||||
|
||||
/* DOC(This type is for parser use, it is not output by the lexer.) */
|
||||
CPP_TOKEN_EOF,
|
||||
|
||||
CPP_TOKEN_TYPE_COUNT
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
#if 1
|
||||
enum Cpp_Token_Type{
|
||||
CPP_TOKEN_JUNK,
|
||||
CPP_TOKEN_COMMENT,
|
||||
|
||||
CPP_PP_INCLUDE,
|
||||
CPP_PP_DEFINE,
|
||||
CPP_PP_UNDEF,
|
||||
CPP_PP_IF,
|
||||
CPP_PP_IFDEF,
|
||||
CPP_PP_IFNDEF,
|
||||
CPP_PP_ELSE,
|
||||
CPP_PP_ELIF,
|
||||
CPP_PP_ENDIF,
|
||||
CPP_PP_ERROR,
|
||||
CPP_PP_IMPORT,
|
||||
CPP_PP_USING,
|
||||
CPP_PP_LINE,
|
||||
CPP_PP_PRAGMA,
|
||||
CPP_PP_STRINGIFY,
|
||||
CPP_PP_CONCAT,
|
||||
CPP_PP_UNKNOWN,
|
||||
|
||||
CPP_TOKEN_KEY_TYPE,
|
||||
CPP_TOKEN_KEY_MODIFIER,
|
||||
CPP_TOKEN_KEY_QUALIFIER,
|
||||
CPP_TOKEN_KEY_OPERATOR, // NOTE(allen): This type is not actually stored in tokens
|
||||
CPP_TOKEN_KEY_CONTROL_FLOW,
|
||||
CPP_TOKEN_KEY_CAST,
|
||||
CPP_TOKEN_KEY_TYPE_DECLARATION,
|
||||
CPP_TOKEN_KEY_ACCESS,
|
||||
CPP_TOKEN_KEY_LINKAGE,
|
||||
CPP_TOKEN_KEY_OTHER,
|
||||
|
||||
CPP_TOKEN_IDENTIFIER,
|
||||
CPP_TOKEN_INTEGER_CONSTANT,
|
||||
CPP_TOKEN_CHARACTER_CONSTANT,
|
||||
CPP_TOKEN_FLOATING_CONSTANT,
|
||||
CPP_TOKEN_STRING_CONSTANT,
|
||||
CPP_TOKEN_BOOLEAN_CONSTANT,
|
||||
|
||||
CPP_TOKEN_STATIC_ASSERT,
|
||||
|
||||
CPP_TOKEN_BRACKET_OPEN,
|
||||
CPP_TOKEN_BRACKET_CLOSE,
|
||||
CPP_TOKEN_PARENTHESE_OPEN,
|
||||
CPP_TOKEN_PARENTHESE_CLOSE,
|
||||
CPP_TOKEN_BRACE_OPEN,
|
||||
CPP_TOKEN_BRACE_CLOSE,
|
||||
CPP_TOKEN_SEMICOLON,
|
||||
CPP_TOKEN_ELLIPSIS,
|
||||
|
||||
// NOTE(allen): Ambiguous tokens, lexer only,
|
||||
// parser figures out the real meaning
|
||||
CPP_TOKEN_STAR,
|
||||
CPP_TOKEN_AMPERSAND,
|
||||
CPP_TOKEN_TILDE,
|
||||
CPP_TOKEN_PLUS,
|
||||
CPP_TOKEN_MINUS,
|
||||
CPP_TOKEN_INCREMENT,
|
||||
CPP_TOKEN_DECREMENT,
|
||||
|
||||
// NOTE(allen): Precedence 1, LtoR
|
||||
CPP_TOKEN_SCOPE,
|
||||
|
||||
// NOTE(allen): Precedence 2, LtoR
|
||||
CPP_TOKEN_POSTINC, // from increment, parser only
|
||||
CPP_TOKEN_POSTDEC, // from decrement, parser only
|
||||
CPP_TOKEN_FUNC_STYLE_CAST, // parser only
|
||||
CPP_TOKEN_CPP_STYLE_CAST,
|
||||
CPP_TOKEN_CALL, // from open paren, parser only
|
||||
CPP_TOKEN_INDEX, // from bracket open, parser only
|
||||
CPP_TOKEN_DOT,
|
||||
CPP_TOKEN_ARROW,
|
||||
|
||||
// NOTE(allen): Precedence 3, RtoL
|
||||
CPP_TOKEN_PREINC, // from increment, parser only
|
||||
CPP_TOKEN_PREDEC, // from decrement, parser only
|
||||
CPP_TOKEN_POSITIVE, // from plus, parser only
|
||||
CPP_TOKEN_NEGAITVE, // from minus, parser only
|
||||
CPP_TOKEN_NOT,
|
||||
CPP_TOKEN_BIT_NOT, // from tilde, direct from 'compl'
|
||||
CPP_TOKEN_CAST, // from open paren, parser only
|
||||
CPP_TOKEN_DEREF, // from star, parser only
|
||||
CPP_TOKEN_TYPE_PTR, // from star, parser only
|
||||
CPP_TOKEN_ADDRESS, // from ampersand, parser only
|
||||
CPP_TOKEN_TYPE_REF, // from ampersand, parser only
|
||||
CPP_TOKEN_SIZEOF,
|
||||
CPP_TOKEN_ALIGNOF,
|
||||
CPP_TOKEN_DECLTYPE,
|
||||
CPP_TOKEN_TYPEID,
|
||||
CPP_TOKEN_NEW,
|
||||
CPP_TOKEN_DELETE,
|
||||
CPP_TOKEN_NEW_ARRAY, // from new and bracket open, parser only
|
||||
CPP_TOKEN_DELETE_ARRAY, // from delete and bracket open, parser only
|
||||
|
||||
// NOTE(allen): Precedence 4, LtoR
|
||||
CPP_TOKEN_PTRDOT,
|
||||
CPP_TOKEN_PTRARROW,
|
||||
|
||||
// NOTE(allen): Precedence 5, LtoR
|
||||
CPP_TOKEN_MUL, // from start, parser only
|
||||
CPP_TOKEN_DIV,
|
||||
CPP_TOKEN_MOD,
|
||||
|
||||
// NOTE(allen): Precedence 6, LtoR
|
||||
CPP_TOKEN_ADD, // from plus, parser only
|
||||
CPP_TOKEN_SUB, // from minus, parser only
|
||||
|
||||
// NOTE(allen): Precedence 7, LtoR
|
||||
CPP_TOKEN_LSHIFT,
|
||||
CPP_TOKEN_RSHIFT,
|
||||
|
||||
// NOTE(allen): Precedence 8, LtoR
|
||||
CPP_TOKEN_LESS,
|
||||
CPP_TOKEN_GRTR,
|
||||
CPP_TOKEN_GRTREQ,
|
||||
CPP_TOKEN_LESSEQ,
|
||||
|
||||
// NOTE(allen): Precedence 9, LtoR
|
||||
CPP_TOKEN_EQEQ,
|
||||
CPP_TOKEN_NOTEQ,
|
||||
|
||||
// NOTE(allen): Precedence 10, LtoR
|
||||
CPP_TOKEN_BIT_AND, // from ampersand, direct from 'bitand'
|
||||
|
||||
// NOTE(allen): Precedence 11, LtoR
|
||||
CPP_TOKEN_BIT_XOR,
|
||||
|
||||
// NOTE(allen): Precedence 12, LtoR
|
||||
CPP_TOKEN_BIT_OR,
|
||||
|
||||
// NOTE(allen): Precedence 13, LtoR
|
||||
CPP_TOKEN_AND,
|
||||
|
||||
// NOTE(allen): Precedence 14, LtoR
|
||||
CPP_TOKEN_OR,
|
||||
|
||||
// NOTE(allen): Precedence 15, RtoL
|
||||
CPP_TOKEN_TERNARY_QMARK,
|
||||
CPP_TOKEN_COLON,
|
||||
CPP_TOKEN_THROW,
|
||||
CPP_TOKEN_EQ,
|
||||
CPP_TOKEN_ADDEQ,
|
||||
CPP_TOKEN_SUBEQ,
|
||||
CPP_TOKEN_MULEQ,
|
||||
CPP_TOKEN_DIVEQ,
|
||||
CPP_TOKEN_MODEQ,
|
||||
CPP_TOKEN_LSHIFTEQ,
|
||||
CPP_TOKEN_RSHIFTEQ,
|
||||
CPP_TOKEN_ANDEQ,
|
||||
CPP_TOKEN_OREQ,
|
||||
CPP_TOKEN_XOREQ,
|
||||
|
||||
// NOTE(allen): Precedence 16, LtoR
|
||||
CPP_TOKEN_COMMA,
|
||||
|
||||
CPP_TOKEN_DEFINED,
|
||||
CPP_TOKEN_INCLUDE_FILE,
|
||||
CPP_TOKEN_ERROR_MESSAGE,
|
||||
|
||||
// NOTE(allen): used in the parser
|
||||
CPP_TOKEN_EOF,
|
||||
|
||||
CPP_TOKEN_TYPE_COUNT
|
||||
};
|
||||
#endif
|
||||
|
||||
struct Cpp_Token{
|
||||
Cpp_Token_Type type;
|
||||
|
|
|
@ -28,42 +28,6 @@ struct Struct_Field{
|
|||
char *name;
|
||||
};
|
||||
|
||||
void to_lower(char *src, char *dst){
|
||||
char *c, ch;
|
||||
for (c = src; *c != 0; ++c){
|
||||
ch = char_to_lower(*c);
|
||||
*dst++ = ch;
|
||||
}
|
||||
*dst = 0;
|
||||
}
|
||||
|
||||
void to_lower(String *str){
|
||||
char *c;
|
||||
int32_t i = 0;
|
||||
int32_t size = str->size;
|
||||
for (c = str->str; i < size; ++c, ++i){
|
||||
*c = char_to_lower(*c);
|
||||
}
|
||||
}
|
||||
|
||||
void to_upper(char *src, char *dst){
|
||||
char *c, ch;
|
||||
for (c = src; *c != 0; ++c){
|
||||
ch = char_to_upper(*c);
|
||||
*dst++ = ch;
|
||||
}
|
||||
*dst = 0;
|
||||
}
|
||||
|
||||
void to_upper(String *str){
|
||||
char *c;
|
||||
int32_t i = 0;
|
||||
int32_t size = str->size;
|
||||
for (c = str->str; i < size; ++c, ++i){
|
||||
*c = char_to_upper(*c);
|
||||
}
|
||||
}
|
||||
|
||||
void to_camel(char *src, char *dst){
|
||||
char *c, ch;
|
||||
int32_t is_first = 1;
|
||||
|
@ -1950,7 +1914,7 @@ generate_custom_headers(){
|
|||
|
||||
macro->str = (char*)malloc(macro->memory_size);
|
||||
copy_ss(macro, name_string);
|
||||
to_upper(macro);
|
||||
to_upper_s(macro);
|
||||
append_ss(macro, make_lit_string("_SIG"));
|
||||
|
||||
|
||||
|
@ -1959,7 +1923,7 @@ generate_custom_headers(){
|
|||
|
||||
public_name->str = (char*)malloc(public_name->memory_size);
|
||||
copy_ss(public_name, name_string);
|
||||
to_lower(public_name);
|
||||
to_lower_s(public_name);
|
||||
}
|
||||
|
||||
// NOTE(allen): Header
|
||||
|
|
2
TODO.txt
2
TODO.txt
|
@ -89,7 +89,7 @@
|
|||
; [X] exit command
|
||||
; [X] full screen option
|
||||
; [X] add to APIs
|
||||
; [] try to make win32 version better
|
||||
; [X] try to make win32 version better
|
||||
;
|
||||
; [] tokens in the custom API
|
||||
; [] auto indent on the custom side
|
||||
|
|
|
@ -110,81 +110,6 @@ main_fsm(Lex_FSM fsm, unsigned char pp_state, unsigned char c){
|
|||
if (c == '\n') fsm.emit_token = 1;
|
||||
break;
|
||||
|
||||
#if 0
|
||||
case LSPP_include:
|
||||
switch (fsm.state){
|
||||
case LSINC_default:
|
||||
switch (c){
|
||||
case '"': fsm.state = LSINC_quotes; break;
|
||||
case '<': fsm.state = LSINC_pointy; break;
|
||||
case '/': fsm.state = LSINC_def_comment_pre; break;
|
||||
default: fsm.state = LSINC_junk; break;
|
||||
}
|
||||
break;
|
||||
|
||||
case LSINC_quotes:
|
||||
if (c == '"') fsm.emit_token = 1;
|
||||
else if (c == '\n'){
|
||||
fsm.emit_token = 1;
|
||||
fsm.state = LSINC_junk;
|
||||
}
|
||||
break;
|
||||
|
||||
case LSINC_pointy:
|
||||
if (c == '>') fsm.emit_token = 1;
|
||||
else if (c == '\n'){
|
||||
fsm.emit_token = 1;
|
||||
fsm.state = LSINC_junk;
|
||||
}
|
||||
break;
|
||||
|
||||
case LSINC_junk:
|
||||
switch (c){
|
||||
case '/': fsm.state = LSINC_junk_comment_pre; break;
|
||||
case '\n': fsm.emit_token = 1; break;
|
||||
}
|
||||
break;
|
||||
|
||||
case LSINC_def_comment_pre:
|
||||
switch (c){
|
||||
case '/': fsm.state = LSINC_def_comment; break;
|
||||
case '*': fsm.state = LSINC_def_comment_block; break;
|
||||
case '\n': fsm.state = LSINC_junk; fsm.emit_token = 1; break;
|
||||
default: fsm.state = LSINC_junk; break;
|
||||
}
|
||||
break;
|
||||
|
||||
case LSINC_junk_comment_pre:
|
||||
switch (c){
|
||||
case '/': fsm.state = LSINC_junk_comment; break;
|
||||
case '*': fsm.state = LSINC_junk_comment_block; break;
|
||||
case '\n': fsm.state = LSINC_junk; fsm.emit_token = 1; break;
|
||||
default: fsm.state = LSINC_junk; break;
|
||||
}
|
||||
break;
|
||||
|
||||
case LSINC_def_comment:
|
||||
case LSINC_junk_comment:
|
||||
switch (c){
|
||||
|
||||
}
|
||||
break;
|
||||
|
||||
case LSINC_def_comment_slashed:
|
||||
case LSINC_junk_comment_slashed:
|
||||
break;
|
||||
|
||||
case LSINC_def_comment_block:
|
||||
case LSINC_junk_comment_block:
|
||||
break;
|
||||
|
||||
case LSINC_def_comment_block_ending:
|
||||
case LSINC_junk_comment_block_ending:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
|
||||
default:
|
||||
switch (fsm.state){
|
||||
case LS_default:
|
||||
|
@ -322,9 +247,6 @@ main_fsm(Lex_FSM fsm, unsigned char pp_state, unsigned char c){
|
|||
if (pp_state == LSPP_include){
|
||||
fsm.emit_token = 1;
|
||||
}
|
||||
else{
|
||||
fsm.state = LS_string_slashed;
|
||||
}
|
||||
break;
|
||||
case '\\': fsm.state = LS_string_slashed; break;
|
||||
}
|
||||
|
|
|
@ -1123,6 +1123,107 @@ DOC(This call replaces all occurances of character in str with another character
|
|||
}
|
||||
}
|
||||
|
||||
CPP_NAME(to_lower)
|
||||
FSTRING_LINK void
|
||||
to_lower_cc(char *src, char *dst)/*
|
||||
DOC_PARAM(src, The source string to conver to lowercase. This string must be null terminated.)
|
||||
DOC_PARAM(dst, The destination buffer to receive the converted string. This must be large
|
||||
enough to contain all of src and a null terminator.)
|
||||
DOC(Rewrites the string in src into dst with all letters lowercased. src and dst should not
|
||||
overlap with the exception that src and dst may be exactly equal in order to convert the
|
||||
string in place.)
|
||||
*/{
|
||||
for (; *src != 0; ++src){
|
||||
*dst++ = char_to_lower(*src);
|
||||
}
|
||||
*dst++ = 0;
|
||||
}
|
||||
|
||||
CPP_NAME(to_lower)
|
||||
FSTRING_LINK void
|
||||
to_lower_ss(String *src, String *dst)/*
|
||||
DOC_PARAM(src, The source string to conver to lowercase.)
|
||||
DOC_PARAM(dst, The destination buffer to receive the converted string.
|
||||
This must have a capacity of at least the size of src.)
|
||||
DOC(Rewrites the string in src into dst. src and dst should not overlap with the exception
|
||||
that src and dst may be exactly equal in order to convert the string in place.)
|
||||
*/{
|
||||
int32_t i = 0;
|
||||
int32_t size = src->size;
|
||||
char *c = src->str;
|
||||
char *d = dst->str;
|
||||
|
||||
if (dst->memory_size >= size){
|
||||
for (; i < size; ++i){
|
||||
*d++ = char_to_lower(*c++);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
CPP_NAME(to_lower)
|
||||
FSTRING_LINK void
|
||||
to_lower_s(String *str)/*
|
||||
DOC_PARAM(str, The string to be converted to all lowercase.)
|
||||
DOC(This version of to_lower converts str to lowercase in place.)
|
||||
*/{
|
||||
int32_t i = 0;
|
||||
int32_t size = str->size;
|
||||
char *c = str->str;
|
||||
for (; i < size; ++c, ++i){
|
||||
*c = char_to_lower(*c);
|
||||
}
|
||||
}
|
||||
|
||||
CPP_NAME(to_upper)
|
||||
FSTRING_LINK void
|
||||
to_upper_cc(char *src, char *dst)/*
|
||||
DOC_PARAM(src, The source string to convert to uppercase. This string must be null terminated.)
|
||||
DOC_PARAM(dst, The destination buffer to receive the converted string. This must be large
|
||||
enough to contain all of src and a null terminator.)
|
||||
DOC(Rewrites the string in src into dst. src and dst should not overlap with the exception
|
||||
that src and dst may be exactly equal in order to convert the string in place.)
|
||||
*/{
|
||||
for (; *src != 0; ++src){
|
||||
*dst++ = char_to_upper(*src);
|
||||
}
|
||||
*dst++ = 0;
|
||||
}
|
||||
|
||||
CPP_NAME(to_upper)
|
||||
FSTRING_LINK void
|
||||
to_upper_ss(String *src, String *dst)/*
|
||||
DOC_PARAM(src, The source string to conver to uppercase.)
|
||||
DOC_PARAM(dst, The destination buffer to receive the converted string.
|
||||
This must have a capacity of at least the size of src.)
|
||||
DOC(Rewrites the string in src into dst. src and dst should not overlap with the exception
|
||||
that src and dst may be exactly equal in order to convert the string in place.)
|
||||
*/{
|
||||
int32_t i = 0;
|
||||
int32_t size = src->size;
|
||||
char *c = src->str;
|
||||
char *d = dst->str;
|
||||
|
||||
if (dst->memory_size >= size){
|
||||
for (; i < size; ++i){
|
||||
*d++ = char_to_upper(*c++);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
CPP_NAME(to_upper)
|
||||
FSTRING_LINK void
|
||||
to_upper_s(String *str)/*
|
||||
DOC_PARAM(str, The string to be converted to all uppercase.)
|
||||
DOC(This version of to_upper converts str to uppercase in place.)
|
||||
*/{
|
||||
int32_t i = 0;
|
||||
int32_t size = str->size;
|
||||
char *c = str->str;
|
||||
for (; i < size; ++c, ++i){
|
||||
*c = char_to_upper(*c);
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// String <-> Number Conversions
|
||||
//
|
||||
|
|
Loading…
Reference in New Issue