working on strings.h/c, added stb_sprint.h from the raddbg repo

This commit is contained in:
ed
2025-02-05 22:02:57 -05:00
parent bf1ec52c3a
commit 61f2fad8ef
10 changed files with 2331 additions and 437 deletions
+1
View File
@@ -3,6 +3,7 @@
{ {
"name": "Win32", "name": "Win32",
"includePath": [ "includePath": [
"${workspaceFolder}",
"${workspaceFolder}/code" "${workspaceFolder}/code"
], ],
"defines": [ "defines": [
+4 -1
View File
@@ -31,7 +31,10 @@
"system_error": "cpp", "system_error": "cpp",
"xlocmon": "cpp", "xlocmon": "cpp",
"xlocale": "cpp", "xlocale": "cpp",
"limits": "cpp" "limits": "cpp",
"toolchain.h": "c",
"thread_context.h": "c",
"stb_sprintf.h": "c"
}, },
"workbench.colorCustomizations": { "workbench.colorCustomizations": {
"activityBar.activeBackground": "#713fb8", "activityBar.activeBackground": "#713fb8",
+58 -275
View File
@@ -57,33 +57,7 @@ read_only global U8 base64_reverse[128] = {
//////////////////////////////// ////////////////////////////////
//~ rjf: Character Classification & Conversion Functions //~ rjf: Character Classification & Conversion Functions
internal B32 B32 char_is_digit(U8 c, U32 base) {
char_is_space(U8 c){
return(c == ' ' || c == '\n' || c == '\t' || c == '\r' || c == '\f' || c == '\v');
}
internal B32
char_is_upper(U8 c){
return('A' <= c && c <= 'Z');
}
internal B32
char_is_lower(U8 c){
return('a' <= c && c <= 'z');
}
internal B32
char_is_alpha(U8 c){
return(char_is_upper(c) || char_is_lower(c));
}
internal B32
char_is_slash(U8 c){
return(c == '/' || c == '\\');
}
internal B32
char_is_digit(U8 c, U32 base){
B32 result = 0; B32 result = 0;
if (0 < base && base <= 16) { if (0 < base && base <= 16) {
U8 val = integer_symbol_reverse[c]; U8 val = integer_symbol_reverse[c];
@@ -94,188 +68,21 @@ char_is_digit(U8 c, U32 base){
return(result); return(result);
} }
internal U8
char_to_lower(U8 c){
if (char_is_upper(c)){
c += ('a' - 'A');
}
return(c);
}
internal U8
char_to_upper(U8 c){
if (char_is_lower(c)){
c += ('A' - 'a');
}
return(c);
}
internal U8
char_to_correct_slash(U8 c){
if(char_is_slash(c)){
c = '/';
}
return(c);
}
////////////////////////////////
//~ rjf: C-String Measurement
internal U64
cstring8_length(U8 *c){
U8 *p = c;
for (;*p != 0; p += 1);
return(p - c);
}
internal U64
cstring16_length(U16 *c){
U16 *p = c;
for (;*p != 0; p += 1);
return(p - c);
}
internal U64
cstring32_length(U32 *c){
U32 *p = c;
for (;*p != 0; p += 1);
return(p - c);
}
////////////////////////////////
//~ rjf: String Constructors
internal String8
str8(U8 *str, U64 size){
String8 result = {str, size};
return(result);
}
internal String8
str8_range(U8 *first, U8 *one_past_last){
String8 result = {first, (U64)(one_past_last - first)};
return(result);
}
internal String8
str8_zero(void){
String8 result = {0};
return(result);
}
internal String16
str16(U16 *str, U64 size){
String16 result = {str, size};
return(result);
}
internal String16
str16_range(U16 *first, U16 *one_past_last){
String16 result = {first, (U64)(one_past_last - first)};
return(result);
}
internal String16
str16_zero(void){
String16 result = {0};
return(result);
}
internal String32
str32(U32 *str, U64 size){
String32 result = {str, size};
return(result);
}
internal String32
str32_range(U32 *first, U32 *one_past_last){
String32 result = {first, (U64)(one_past_last - first)};
return(result);
}
internal String32
str32_zero(void){
String32 result = {0};
return(result);
}
internal String8
str8_cstring(char *c){
String8 result = {(U8*)c, cstring8_length((U8*)c)};
return(result);
}
internal String16
str16_cstring(U16 *c){
String16 result = {(U16*)c, cstring16_length((U16*)c)};
return(result);
}
internal String32
str32_cstring(U32 *c){
String32 result = {(U32*)c, cstring32_length((U32*)c)};
return(result);
}
internal String8
str8_cstring_capped(void *cstr, void *cap)
{
char *ptr = (char*)cstr;
char *opl = (char*)cap;
for (;ptr < opl && *ptr != 0; ptr += 1);
U64 size = (U64)(ptr - (char *)cstr);
String8 result = {(U8*)cstr, size};
return(result);
}
////////////////////////////////
//~ rjf: String Stylization
internal String8
upper_from_str8(Arena *arena, String8 string)
{
string = push_str8_copy(arena, string);
for(U64 idx = 0; idx < string.size; idx += 1)
{
string.str[idx] = char_to_upper(string.str[idx]);
}
return string;
}
internal String8
lower_from_str8(Arena *arena, String8 string)
{
string = push_str8_copy(arena, string);
for(U64 idx = 0; idx < string.size; idx += 1)
{
string.str[idx] = char_to_lower(string.str[idx]);
}
return string;
}
internal String8
backslashed_from_str8(Arena *arena, String8 string)
{
string = push_str8_copy(arena, string);
for(U64 idx = 0; idx < string.size; idx += 1)
{
string.str[idx] = char_is_slash(string.str[idx]) ? '\\' : string.str[idx];
}
return string;
}
//////////////////////////////// ////////////////////////////////
//~ rjf: String Matching //~ rjf: String Matching
internal B32 B32
str8_match(String8 a, String8 b, StringMatchFlags flags){ str8_match(String8 a, String8 b, StringMatchFlags flags)
{
B32 result = 0; B32 result = 0;
if (a.size == b.size || (flags & StringMatchFlag_RightSideSloppy)){ if (a.size == b.size || (flags & StringMatchFlag_RightSideSloppy))
{
B32 case_insensitive = (flags & StringMatchFlag_CaseInsensitive); B32 case_insensitive = (flags & StringMatchFlag_CaseInsensitive);
B32 slash_insensitive = (flags & StringMatchFlag_SlashInsensitive); B32 slash_insensitive = (flags & StringMatchFlag_SlashInsensitive);
U64 size = Min(a.size, b.size); U64 size = min(a.size, b.size);
result = 1; result = 1;
for (U64 i = 0; i < size; i += 1){ for (U64 i = 0; i < size; i += 1)
{
U8 at = a.str[i]; U8 at = a.str[i];
U8 bt = b.str[i]; U8 bt = b.str[i];
if (case_insensitive) { if (case_insensitive) {
@@ -295,12 +102,14 @@ str8_match(String8 a, String8 b, StringMatchFlags flags){
return(result); return(result);
} }
internal U64 U64
str8_find_needle(String8 string, U64 start_pos, String8 needle, StringMatchFlags flags){ str8_find_needle(String8 string, U64 start_pos, String8 needle, StringMatchFlags flags)
{
U8* p = string.str + start_pos; U8* p = string.str + start_pos;
U64 stop_offset = Max(string.size + 1, needle.size) - needle.size; U64 stop_offset = max(string.size + 1, needle.size) - needle.size;
U8* stop_p = string.str + stop_offset; U8* stop_p = string.str + stop_offset;
if (needle.size > 0){ if (needle.size > 0)
{
U8* string_opl = string.str + string.size; U8* string_opl = string.str + string.size;
String8 needle_tail = str8_skip(needle, 1); String8 needle_tail = str8_skip(needle, 1);
StringMatchFlags adjusted_flags = flags | StringMatchFlag_RightSideSloppy; StringMatchFlags adjusted_flags = flags | StringMatchFlag_RightSideSloppy;
@@ -308,7 +117,8 @@ str8_find_needle(String8 string, U64 start_pos, String8 needle, StringMatchFlags
if (adjusted_flags & StringMatchFlag_CaseInsensitive) { if (adjusted_flags & StringMatchFlag_CaseInsensitive) {
needle_first_char_adjusted = char_to_upper(needle_first_char_adjusted); needle_first_char_adjusted = char_to_upper(needle_first_char_adjusted);
} }
for (;p < stop_p; p += 1){ for (;p < stop_p; p += 1)
{
U8 haystack_char_adjusted = *p; U8 haystack_char_adjusted = *p;
if(adjusted_flags & StringMatchFlag_CaseInsensitive) { if(adjusted_flags & StringMatchFlag_CaseInsensitive) {
haystack_char_adjusted = char_to_upper(haystack_char_adjusted); haystack_char_adjusted = char_to_upper(haystack_char_adjusted);
@@ -327,69 +137,20 @@ str8_find_needle(String8 string, U64 start_pos, String8 needle, StringMatchFlags
return(result); return(result);
} }
internal B32
str8_ends_with(String8 string, String8 end, StringMatchFlags flags){
String8 postfix = str8_postfix(string, end.size);
B32 is_match = str8_match(end, postfix, flags);
return is_match;
}
//////////////////////////////// ////////////////////////////////
//~ rjf: String Slicing //~ rjf: String Slicing
internal String8 String8
str8_substr(String8 str, Rng1U64 range){ str8_skip_chop_whitespace(String8 string)
range.min = ClampTop(range.min, str.size); {
range.max = ClampTop(range.max, str.size);
str.str += range.min;
str.size = dim_1u64(range);
return(str);
}
internal String8
str8_prefix(String8 str, U64 size){
str.size = ClampTop(size, str.size);
return(str);
}
internal String8
str8_skip(String8 str, U64 amt){
amt = ClampTop(amt, str.size);
str.str += amt;
str.size -= amt;
return(str);
}
internal String8
str8_postfix(String8 str, U64 size){
size = ClampTop(size, str.size);
str.str = (str.str + str.size) - size;
str.size = size;
return(str);
}
internal String8
str8_chop(String8 str, U64 amt){
amt = ClampTop(amt, str.size);
str.size -= amt;
return(str);
}
internal String8
str8_skip_chop_whitespace(String8 string){
U8* first = string.str; U8* first = string.str;
U8* opl = first + string.size; U8* opl = first + string.size;
for (; first < opl; first += 1) { for (; first < opl; first += 1) {
if (!char_is_space(*first)){ if ( ! char_is_space(*first)) { break;}
break;
}
} }
for (; opl > first; ){ for (; opl > first; ){
opl -= 1; opl -= 1;
if (!char_is_space(*opl)){ if ( ! char_is_space(*opl)){ opl += 1; break; }
opl += 1;
break;
}
} }
String8 result = str8_range(first, opl); String8 result = str8_range(first, opl);
return(result); return(result);
@@ -404,8 +165,8 @@ push_str8_cat(Arena* arena, String8 s1, String8 s2)
String8 str; String8 str;
str.size = s1.size + s2.size; str.size = s1.size + s2.size;
str.str = push_array_no_zero(arena, U8, str.size + 1); str.str = push_array_no_zero(arena, U8, str.size + 1);
MemoryCopy(str.str, s1.str, s1.size); memory_copy(str.str, s1.str, s1.size);
MemoryCopy(str.str + s1.size, s2.str, s2.size); memory_copy(str.str + s1.size, s2.str, s2.size);
str.str[str.size] = 0; str.str[str.size] = 0;
return(str); return(str);
} }
@@ -415,7 +176,7 @@ push_str8_copy(Arena *arena, String8 s){
String8 str; String8 str;
str.size = s.size; str.size = s.size;
str.str = push_array_no_zero(arena, U8, str.size + 1); str.str = push_array_no_zero(arena, U8, str.size + 1);
MemoryCopy(str.str, s.str, s.size); memory_copy(str.str, s.str, s.size);
str.str[str.size] = 0; str.str[str.size] = 0;
return(str); return(str);
} }
@@ -442,19 +203,41 @@ push_str8f(Arena *arena, char *fmt, ...){
return(result); return(result);
} }
// String8 String8
// str8__cat(String8 s1, String8 s2, AllocatorInfo ainfo) str8__cat(String8 s1, String8 s2, AllocatorInfo ainfo)
// { {
// String8 str; String8 str;
// str.size = s1.size + s2.size; str.size = s1.size + s2.size;
// str.str = alloc_array(ainfo, U8, str.size + 1); str.str = alloc_array(ainfo, U8, str.size + 1);
memory_copy(str.str, s1.str, s1.size);
memory_copy(str.str + s1.size, s2.str, s2.size);
str.str[str.size] = 0;
return str;
}
// memory_copy(str.str, s1.str, s1.size); String8
// memory_copy(str.str + s1.size, s2.str, s2.size); str8__copy(String8 s, AllocatorInfo ainfo)
// str.str[str.size] = 0; {
String8 str;
str.size = s.size;
str.str = alloc_array(ainfo, U8, str.size + 1);
memory_copy(str.str, s.str, s.size);
str.str[str.size] = 0;
return(str);
}
// return str; internal String8
// } push_str8fv(AllocatorInfo ainfo, char *fmt, va_list args){
va_list args2;
va_copy(args2, args);
U32 needed_bytes = raddbg_vsnprintf(0, 0, fmt, args) + 1;
String8 result = {0};
result.str = alloc_array(ainfo, U8, needed_bytes);
result.size = raddbg_vsnprintf((char*)result.str, needed_bytes, fmt, args2);
result.str[result.size] = 0;
va_end(args2);
return(result);
}
//////////////////////////////// ////////////////////////////////
//~ rjf: String <=> Integer Conversions //~ rjf: String <=> Integer Conversions
+147 -49
View File
@@ -4,15 +4,14 @@
# include "linkage.h" # include "linkage.h"
# include "platform.h" # include "platform.h"
# include "macros.h" # include "macros.h"
# include "generic_macros.h"
# include "base_types.h" # include "base_types.h"
# include "memory.h"
# include "memory_substrate.h"
# include "arena.h"
# include "constants.h" # include "constants.h"
# include "arena.h"
# include "space.h" # include "space.h"
# include "math.h" # include "math.h"
# include "thread_context.h"
# include "toolchain.h" # include "toolchain.h"
# include "time.h"
#endif #endif
// Copyright (c) 2024 Epic Games Tools // Copyright (c) 2024 Epic Games Tools
@@ -21,8 +20,8 @@
//////////////////////////////// ////////////////////////////////
//~ rjf: Third Party Includes //~ rjf: Third Party Includes
// #define STB_SPRINTF_DECORATE(name) raddbg_##name #define STB_SPRINTF_DECORATE(name) raddbg_##name
// #include "third_party/stb/stb_sprintf.h" #include "third_party/stb/stb_sprintf.h"
//////////////////////////////// ////////////////////////////////
//~ rjf: String Types //~ rjf: String Types
@@ -155,22 +154,23 @@ struct FuzzyMatchRangeList
//////////////////////////////// ////////////////////////////////
//~ rjf: Character Classification & Conversion Functions //~ rjf: Character Classification & Conversion Functions
internal B32 char_is_space(U8 c); inline B32 char_is_space (U8 c) { return(c == ' ' || c == '\n' || c == '\t' || c == '\r' || c == '\f' || c == '\v'); }
internal B32 char_is_upper(U8 c); inline B32 char_is_upper (U8 c) { return('A' <= c && c <= 'Z'); }
internal B32 char_is_lower(U8 c); inline B32 char_is_lower (U8 c) { return('a' <= c && c <= 'z'); }
internal B32 char_is_alpha(U8 c); inline B32 char_is_alpha (U8 c) { return(char_is_upper(c) || char_is_lower(c)); }
internal B32 char_is_slash(U8 c); inline B32 char_is_slash (U8 c) { return(c == '/' || c == '\\'); }
internal B32 char_is_digit(U8 c, U32 base); inline U8 char_to_lower (U8 c) { if (char_is_upper(c)) { c += ('a' - 'A'); } return(c); }
internal U8 char_to_lower(U8 c); inline U8 char_to_upper (U8 c) { if (char_is_lower(c)) { c += ('A' - 'a'); } return(c); }
internal U8 char_to_upper(U8 c); inline U8 char_to_correct_slash(U8 c) { if (char_is_slash(c)) { c = '/'; } return(c); }
internal U8 char_to_correct_slash(U8 c);
B32 char_is_digit(U8 c, U32 base);
//////////////////////////////// ////////////////////////////////
//~ rjf: C-String Measurement //~ rjf: C-String Measurement
internal U64 cstring8_length (U8 *c); inline U64 cstring8_length (U8* c) { U8* p = c; for (; *p != 0; p += 1); return(p - c); }
internal U64 cstring16_length(U16 *c); inline U64 cstring16_length(U16* c) { U16* p = c; for (; *p != 0; p += 1); return(p - c); }
internal U64 cstring32_length(U32 *c); inline U64 cstring32_length(U32 *c) { U32* p = c; for (; *p != 0; p += 1); return(p - c); }
//////////////////////////////// ////////////////////////////////
//~ rjf: String Constructors //~ rjf: String Constructors
@@ -183,54 +183,115 @@ internal U64 cstring32_length(U32 *c);
#define str8_array_fixed(S) str8((U8*)(S), sizeof(S)) #define str8_array_fixed(S) str8((U8*)(S), sizeof(S))
#define str8_struct(S) str8((U8*)(S), sizeof(*(S))) #define str8_struct(S) str8((U8*)(S), sizeof(*(S)))
internal String8 str8(U8 *str, U64 size); inline String8 str8 (U8* str, U64 size) { String8 result = {str, size}; return(result); }
internal String8 str8_range(U8 *first, U8 *one_past_last); inline String8 str8_range (U8* first, U8* one_past_last) { String8 result = {first, (U64)(one_past_last - first)}; return(result); }
internal String8 str8_zero(void); inline String8 str8_zero (void) { String8 result = {0}; return(result); }
internal String16 str16(U16 *str, U64 size); inline String16 str16 (U16* str, U64 size) { String16 result = {str, size}; return(result); }
internal String16 str16_range(U16 *first, U16 *one_past_last); inline String16 str16_range (U16* first, U16* one_past_last) { String16 result = {first, (U64)(one_past_last - first)}; return(result); }
internal String16 str16_zero(void); inline String16 str16_zero (void) { String16 result = {0}; return(result); }
internal String32 str32(U32 *str, U64 size); inline String32 str32 (U32* str, U64 size) { String32 result = {str, size}; return(result); }
internal String32 str32_range(U32 *first, U32 *one_past_last); inline String32 str32_range (U32* first, U32* one_past_last) { String32 result = {first, (U64)(one_past_last - first)}; return(result); }
internal String32 str32_zero(void); inline String32 str32_zero (void) { String32 result = {0}; return(result); }
internal String8 str8_cstring(char *c); inline String8 str8_cstring (char* c) { String8 result = {(U8*) c, cstring8_length ((U8*) c)}; return(result); }
internal String16 str16_cstring(U16 *c); inline String16 str16_cstring(U16* c) { String16 result = {(U16*)c, cstring16_length((U16*)c)}; return(result); }
internal String32 str32_cstring(U32 *c); inline String32 str32_cstring(U32* c) { String32 result = {(U32*)c, cstring32_length((U32*)c)}; return(result); }
internal String8 str8_cstring_capped(void *cstr, void *cap);
inline String8
str8_cstring_capped(void *cstr, void *cap) {
char *ptr = (char*)cstr;
char *opl = (char*)cap;
for (;ptr < opl && *ptr != 0; ptr += 1);
U64 size = (U64)(ptr - (char *)cstr);
String8 result = {(U8*)cstr, size};
return(result);
}
//////////////////////////////// ////////////////////////////////
//~ rjf: String Stylization //~ rjf: String Stylization
internal String8 upper_from_str8 (Arena *arena, String8 string); inline String8 upper_from_str8 (Arena* arena, String8 string) { string = push_str8_copy(arena, string); for(U64 idx = 0; idx < string.size; idx += 1) { string.str[idx] = char_to_upper(string.str[idx]); } return string; }
internal String8 lower_from_str8 (Arena *arena, String8 string); inline String8 lower_from_str8 (Arena* arena, String8 string) { string = push_str8_copy(arena, string); for(U64 idx = 0; idx < string.size; idx += 1) { string.str[idx] = char_to_lower(string.str[idx]); } return string; }
internal String8 backslashed_from_str8(Arena *arena, String8 string); inline String8 backslashed_from_str8(Arena *arena, String8 string) { string = push_str8_copy(arena, string); for(U64 idx = 0; idx < string.size; idx += 1) { string.str[idx] = char_is_slash(string.str[idx]) ? '\\' : string.str[idx]; } return string; }
//////////////////////////////// ////////////////////////////////
//~ rjf: String Matching //~ rjf: String Matching
internal B32 str8_match (String8 a, String8 b, StringMatchFlags flags); MD_API B32 str8_match (String8 a, String8 b, StringMatchFlags flags);
internal U64 str8_find_needle(String8 string, U64 start_pos, String8 needle, StringMatchFlags flags); MD_API U64 str8_find_needle(String8 string, U64 start_pos, String8 needle, StringMatchFlags flags);
internal B32 str8_ends_with (String8 string, String8 end, StringMatchFlags flags); B32 str8_ends_with (String8 string, String8 end, StringMatchFlags flags);
inline B32
str8_ends_with(String8 string, String8 end, StringMatchFlags flags) {
String8 postfix = str8_postfix(string, end.size);
B32 is_match = str8_match(end, postfix, flags);
return is_match;
}
//////////////////////////////// ////////////////////////////////
//~ rjf: String Slicing //~ rjf: String Slicing
internal String8 str8_substr (String8 str, Rng1U64 range); MD_API String8 str8_skip_chop_whitespace(String8 string);
internal String8 str8_prefix (String8 str, U64 size);
internal String8 str8_skip (String8 str, U64 amt); String8 str8_substr (String8 str, Rng1U64 range);
internal String8 str8_postfix(String8 str, U64 size); String8 str8_prefix (String8 str, U64 size);
internal String8 str8_chop (String8 str, U64 amt); String8 str8_skip (String8 str, U64 amt);
internal String8 str8_skip_chop_whitespace(String8 string); String8 str8_postfix(String8 str, U64 size);
String8 str8_chop (String8 str, U64 amt);
inline String8
str8_substr(String8 str, Rng1U64 range){
range.min = clamp_top(range.min, str.size);
range.max = clamp_top(range.max, str.size);
str.str += range.min;
str.size = dim_1u64(range);
return(str);
}
inline String8
str8_prefix(String8 str, U64 size){
str.size = clamp_top(size, str.size);
return(str);
}
inline String8
str8_skip(String8 str, U64 amt){
amt = clamp_top(amt, str.size);
str.str += amt;
str.size -= amt;
return(str);
}
inline String8
str8_postfix(String8 str, U64 size){
size = clamp_top(size, str.size);
str.str = (str.str + str.size) - size;
str.size = size;
return(str);
}
inline String8
str8_chop(String8 str, U64 amt){
amt = clamp_top(amt, str.size);
str.size -= amt;
return(str);
}
//////////////////////////////// ////////////////////////////////
//~ rjf: String Formatting & Copying //~ rjf: String Formatting & Copying
internal String8 push_str8_cat (Arena* arena, String8 s1, String8 s2); MD_API String8 push_str8_cat (Arena* arena, String8 s1, String8 s2);
internal String8 push_str8_copy(Arena* arena, String8 s); MD_API String8 push_str8_copy(Arena* arena, String8 s);
internal String8 push_str8fv (Arena* arena, char* fmt, va_list args); MD_API String8 push_str8fv (Arena* arena, char* fmt, va_list args);
internal String8 push_str8f (Arena* arena, char* fmt, ...); MD_API String8 push_str8f (Arena* arena, char* fmt, ...);
// String8 str8__cat(String8 s1, String8 s2, AllocatorInfo a); String8 str8__cat (String8 s1, String8 s2, AllocatorInfo ainfo);
// #define str8_cat(s1, s2, ...) str8__cat(s1, s2, (AllocatorInfo) {__VA_ARGS__}) String8 str8__copy(String8 s, AllocatorInfo ainfo);
String8 str8fv(AllocatorInfo ainfo, char* fmt, va_list args);
String8 str8f (AllocatorInfo afino, char* fmt, ...);
#define str8_cat(s1, s2, ...) str8__cat (s1, s2, (AllocatorInfo) {__VA_ARGS__})
#define str8_copy(s, ...) str8__copy(s, (AllocatorInfo) {__VA_ARGS__})
//////////////////////////////// ////////////////////////////////
//~ rjf: String <=> Integer Conversions //~ rjf: String <=> Integer Conversions
@@ -387,3 +448,40 @@ internal U64 str8_deserial_read_block (String8 string, U64 off
#define str8_deserial_read_array(string, off, ptr, count) str8_deserial_read((string), (off), (ptr), sizeof(*(ptr)) * (count), sizeof( *(ptr))) #define str8_deserial_read_array(string, off, ptr, count) str8_deserial_read((string), (off), (ptr), sizeof(*(ptr)) * (count), sizeof( *(ptr)))
#define str8_deserial_read_struct(string, off, ptr) str8_deserial_read((string), (off), (ptr), sizeof(*(ptr)), sizeof( *(ptr))) #define str8_deserial_read_struct(string, off, ptr) str8_deserial_read((string), (off), (ptr), sizeof(*(ptr)), sizeof( *(ptr)))
////////////////////////////////
//~ rjf: Text 2D Coordinates & Ranges
typedef struct TxtPt TxtPt;
struct TxtPt
{
S64 line;
S64 column;
};
typedef struct TxtRng TxtRng;
struct TxtRng
{
TxtPt min;
TxtPt max;
};
////////////////////////////////
//~ rjf: String Pair Types
typedef struct String8TxtPtPair String8TxtPtPair;
struct String8TxtPtPair
{
String8 string;
TxtPt pt;
};
////////////////////////////////
//~ rjf: Text Path Helpers
internal String8TxtPtPair str8_txt_pt_pair_from_string(String8 string);
////////////////////////////////
//~ rjf: Text Wrapping
internal String8List wrapped_lines_from_string(Arena *arena, String8 string, U64 first_line_max_width, U64 max_width, U64 wrap_indent);
-4
View File
@@ -1,4 +0,0 @@
#ifdef INTELLISENSE_DIRECTIVES
#include "text.h"
#endif
-43
View File
@@ -1,43 +0,0 @@
#ifdef INTELLISENSE_DIRECTIVES
# pragma once
# include "linkage.h"
# include "strings.h"
# include "arena.h"
#endif
////////////////////////////////
//~ rjf: Text 2D Coordinates & Ranges
typedef struct TxtPt TxtPt;
struct TxtPt
{
S64 line;
S64 column;
};
typedef struct TxtRng TxtRng;
struct TxtRng
{
TxtPt min;
TxtPt max;
};
////////////////////////////////
//~ rjf: String Pair Types
typedef struct String8TxtPtPair String8TxtPtPair;
struct String8TxtPtPair
{
String8 string;
TxtPt pt;
};
////////////////////////////////
//~ rjf: Text Path Helpers
internal String8TxtPtPair str8_txt_pt_pair_from_string(String8 string);
////////////////////////////////
//~ rjf: Text Wrapping
internal String8List wrapped_lines_from_string(Arena *arena, String8 string, U64 first_line_max_width, U64 max_width, U64 wrap_indent);
+2 -1
View File
@@ -16,6 +16,7 @@
MD_NS_BEGIN MD_NS_BEGIN
#include "base/base_types.h" #include "base/base_types.h"
#include "base/constants.h"
#include "base/debug.h" #include "base/debug.h"
#include "base/memory.h" #include "base/memory.h"
#include "base/memory_substrate.h" #include "base/memory_substrate.h"
@@ -24,7 +25,7 @@ MD_NS_BEGIN
#include "base/math.h" #include "base/math.h"
#include "base/toolchain.h" #include "base/toolchain.h"
#include "base/strings.h" #include "base/strings.h"
#include "base/text.h"
MD_NS_END MD_NS_END
+2055
View File
File diff suppressed because it is too large Load Diff