YREA-SLS/SLS_C/include/sls/string.h

32 lines
582 B
C

// Kyler Olsen
// YREA SLS
// Strings Header
// November 2025
#ifndef SLS_STRING_H
#define SLS_STRING_H
#include <stddef.h>
#include <stdarg.h>
#include "bool.h"
typedef struct {
size_t len;
const char *str;
Boolean allocated;
} SlsStr;
#define SLS_STR(s) (SlsStr){ sizeof(s) - 1, (s), FALSE }
int isascii(unsigned char c);
size_t strnlen(const char *s, size_t maxlen);
SlsStr malloc_str(const char *s, size_t maxlen);
SlsStr new_str(size_t length);
SlsStr copy_str(SlsStr s);
void free_str(SlsStr *s);
SlsStr format(const SlsStr s, ...);
#endif // SLS_STRING_H