[ADD/WIP] Start making string splitters

I want to go on an encore of XEP-0393, with _rectangles_ as boundaries,
this time.
This commit is contained in:
LDA 2024-07-16 19:33:05 +02:00
commit ed712a9f28
3 changed files with 104 additions and 1 deletions

35
src/include/StringSplit.h Normal file
View file

@ -0,0 +1,35 @@
#ifndef PARSEE_STRINGSPLIT_H
#define PARSEE_STRINGSPLIT_H
#include <stdlib.h>
/* Represents a boundary in a linesplit string */
typedef struct StringRect {
char **source_lines;
/* NOTE: All of these values are inclusive */
/* The start line/character index */
size_t start_line;
size_t start_char;
/* The end line/character index */
size_t end_line;
size_t end_char;
} StringRect;
/** Splits a string into a set of NULL-terminated substrings, which is
* terminated by a NULL pointer.
* ---------
* Returns: A set of lines(excluding them) [LA:HEAP]
* Modifies: NOTHING
* Thrasher: StrFreeLines */
extern char ** StrSplitLines(char *text);
extern void StrFreeLines(char **split);
extern size_t StrLines(char **split);
/* Creates a full zone covering every part of the split */
extern StringRect StrFullRect(char **split);
#endif