mirror of
https://forge.fsky.io/lda/Parsee.git
synced 2026-03-13 22:55:11 +00:00
[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:
parent
a4b8141f4a
commit
ed712a9f28
3 changed files with 104 additions and 1 deletions
|
|
@ -231,6 +231,9 @@ extern bool ParseeIsAdmin(ParseeData *data, char *user);
|
|||
/* Measures Parsee's overall uptime */
|
||||
extern uint64_t ParseeUptime(void);
|
||||
|
||||
/* Turns a date into a nice "X minutes, Y seconds" string */
|
||||
/** Turns a duration into a nice "X minutes, Y seconds" string
|
||||
* ---------
|
||||
* Returns: A human-readable string showing the duration[LA:HEAP]
|
||||
* Modifies: NOTHING */
|
||||
extern char * ParseeStringifyDate(uint64_t millis);
|
||||
#endif
|
||||
|
|
|
|||
35
src/include/StringSplit.h
Normal file
35
src/include/StringSplit.h
Normal 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
|
||||
Loading…
Add table
Add a link
Reference in a new issue