rcbench
Servo and ESC test bench: panel, IOmcu and shared C
Loading...
Searching...
No Matches
log_text.h
Go to the documentation of this file.
1
25
26#pragma once
27
28#include <stdbool.h>
29#include <stddef.h>
30#include <stdint.h>
31
32#include "log_csv.h"
33
34#ifdef __cplusplus
35extern "C" {
36#endif
37
39#define LOG_TEXT_MAX ((size_t)32u * 1024u)
40
48#define LOG_TEXT_MARK 16
49
51typedef struct {
52 char *buf;
53 size_t len;
54 bool cut;
55 int cols;
56 int rows;
57 int at_row;
58 size_t at_off;
59 size_t at_end;
60 size_t at_next;
61 bool at_held;
62 uint16_t *marks;
63 size_t walked;
66
80
86
96bool log_text_row(log_text_t *t, int i, char *out, size_t n);
97
104void log_text_set_allocator(void *(*alloc_fn)(size_t),
105 void (*free_fn)(void *));
106
107#ifdef __cplusplus
108}
109#endif
CSV (comma-separated values) and TSV (tab-separated values) import for a board that cannot hold the f...
log_err_t
Result of a CSV import step.
Definition log_csv.h:171
log_err_t log_text_load(log_text_t *t, log_source_t *src, int cols)
Read src from its top into t, and count its rows.
Definition log_text.c:164
void log_text_free(log_text_t *t)
Free what t holds and empty it.
Definition log_text.c:35
bool log_text_row(log_text_t *t, int i, char *out, size_t n)
Row i of the text into out.
Definition log_text.c:219
void log_text_set_allocator(void *(*alloc_fn)(size_t), void(*free_fn)(void *))
Set the allocator the buffer comes from, for a test that refuses it.
Definition log_text.c:28
A byte source that can be read from the top more than once.
Definition log_csv.h:61
One file's text and its rows. The fields are log_text.c's.
Definition log_text.h:51
bool cut
Definition log_text.h:54
bool at_held
Definition log_text.h:61
size_t at_end
Definition log_text.h:59
int at_row
Definition log_text.h:57
size_t at_off
Definition log_text.h:58
int cols
Definition log_text.h:55
size_t walked
Definition log_text.h:63
char * buf
Definition log_text.h:52
size_t len
Definition log_text.h:53
uint16_t * marks
Definition log_text.h:62
int rows
Definition log_text.h:56
size_t at_next
Definition log_text.h:60