rcbench
Servo and ESC test bench: panel, IOmcu and shared C
Loading...
Searching...
No Matches
fm_tree.h
Go to the documentation of this file.
1
34
35#pragma once
36
37#include <stdbool.h>
38#include <stdint.h>
39
40#include "fm_io.h"
41#include "fm_rules.h"
42
43#ifdef __cplusplus
44extern "C" {
45#endif
46
48#define FM_PAGE_MAX 48
49
53typedef struct {
55 uint64_t size;
56 bool is_dir;
57 bool busy;
58 uint8_t kind;
59 uint8_t place;
61
72
77typedef struct {
80 int held;
81 int ahead;
82 int total;
83 unsigned unlisted;
85 unsigned mount;
86} fm_tree_t;
87
94void fm_tree_init(fm_tree_t *tree, const char *dir);
95
111fm_err_t fm_tree_page(fm_tree_t *tree, const fm_io_t *io,
112 const fm_bench_t *bench, fm_go_t go);
113
128fm_err_t fm_tree_enter(fm_tree_t *tree, const fm_io_t *io,
129 const fm_bench_t *bench, int row);
130
139fm_err_t fm_tree_up(fm_tree_t *tree, const fm_io_t *io,
140 const fm_bench_t *bench);
141
148fm_err_t fm_tree_select(fm_tree_t *tree, int row);
149
155const fm_entry_t *fm_tree_selected(const fm_tree_t *tree);
156
162bool fm_tree_has_prev(const fm_tree_t *tree);
163
169bool fm_tree_has_next(const fm_tree_t *tree);
170
178int fm_tree_rank(const void *a, const void *b);
179
180#ifdef __cplusplus
181}
182#endif
The card as the file manager's core sees it: a table of functions the caller supplies,...
fm_err_t
What a call of the core or of the card came to. FM_OK is 0; every other value is a refusal or a failu...
Definition fm_io.h:51
#define FM_NAME_BUF
Room for a listed name and its terminator: FM_LIST_NAME_MAX (63) bytes, as the panel's directory walk...
Definition fm_io.h:44
#define FM_PATH_SIZE
Room for a path and its terminator.
Definition fm_name.h:54
What the file manager may do to a name: the places the bench keeps, the files the logger writes,...
int fm_tree_rank(const void *a, const void *b)
The pane's order of two entries: folders first, then names with case folded, then their bytes....
Definition fm_tree.c:27
fm_err_t fm_tree_up(fm_tree_t *tree, const fm_io_t *io, const fm_bench_t *bench)
Go to the folder above and read its first page, with the folder come from selected when it is on that...
Definition fm_tree.c:293
void fm_tree_init(fm_tree_t *tree, const char *dir)
Start a pane in folder dir, with nothing read yet.
Definition fm_tree.c:201
bool fm_tree_has_prev(const fm_tree_t *tree)
Whether a page stands before the one on show.
Definition fm_tree.c:328
fm_err_t fm_tree_enter(fm_tree_t *tree, const fm_io_t *io, const fm_bench_t *bench, int row)
Enter the folder on row row and read its first page.
Definition fm_tree.c:263
fm_err_t fm_tree_page(fm_tree_t *tree, const fm_io_t *io, const fm_bench_t *bench, fm_go_t go)
Read a page of the pane's folder.
Definition fm_tree.c:214
fm_err_t fm_tree_select(fm_tree_t *tree, int row)
Select row row, or nothing for -1.
Definition fm_tree.c:311
const fm_entry_t * fm_tree_selected(const fm_tree_t *tree)
The selected entry.
Definition fm_tree.c:320
bool fm_tree_has_next(const fm_tree_t *tree)
Whether a page stands after the one on show.
Definition fm_tree.c:333
#define FM_PAGE_MAX
Rows of one page, as LOGS' page (LOG_VIEWER_MAX_FILES).
Definition fm_tree.h:48
fm_go_t
Which page fm_tree_page() reads.
Definition fm_tree.h:65
@ FM_GO_LAST
Definition fm_tree.h:69
@ FM_GO_SAME
Definition fm_tree.h:70
@ FM_GO_PREV
Definition fm_tree.h:68
@ FM_GO_FIRST
Definition fm_tree.h:66
@ FM_GO_NEXT
Definition fm_tree.h:67
The bench as the rules see it, filled by the caller each time it asks. Every pointer may be NULL.
Definition fm_rules.h:101
One entry of a page.
Definition fm_tree.h:53
uint8_t kind
Definition fm_tree.h:58
char name[FM_NAME_BUF]
Definition fm_tree.h:54
uint64_t size
Definition fm_tree.h:55
bool busy
Definition fm_tree.h:57
uint8_t place
Definition fm_tree.h:59
bool is_dir
Definition fm_tree.h:56
The card: every function set, each answering FM_OK or the reason it failed. ctx is passed to each of ...
Definition fm_io.h:117
One pane. The fields are the pane's; read them, change them through the functions.
Definition fm_tree.h:77
int ahead
Definition fm_tree.h:81
unsigned unlisted
Definition fm_tree.h:83
fm_entry_t page[FM_PAGE_MAX]
Definition fm_tree.h:79
int held
Definition fm_tree.h:80
int selected
Definition fm_tree.h:84
char dir[FM_PATH_SIZE]
Definition fm_tree.h:78
int total
Definition fm_tree.h:82
unsigned mount
Definition fm_tree.h:85