|
rcbench
Servo and ESC test bench: panel, IOmcu and shared C
|
One pane of the file manager: its folder, its page and its selection (fm_tree.h). More...
Data Structures | |
| struct | pane_walk_t |
| One walk of the pane's folder on its way into the page. More... | |
Functions | |
| 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. Strict: zero only for one name. | |
| static void | take (const fm_dirent_t *e, void *vctx) |
| Offer one entry of a walk to the page: every name that fits, with what the rules say of it; a longer one is counted. | |
| static void | empty_page (fm_tree_t *tree, int total) |
| Empty the page, for a folder that could not be read. | |
| static fm_err_t | walk_once (fm_tree_t *tree, const fm_io_t *io, const fm_bench_t *bench, fm_page_dir_t side, const fm_entry_t *key) |
| One walk of the folder on the mount in the slot, keeping one page. | |
| static fm_err_t | walk_twice (fm_tree_t *tree, const fm_io_t *io, const fm_bench_t *bench, fm_page_dir_t side, const fm_entry_t *key) |
| One page, walked again once when the walk found the card gone: the second walk is of the card in the slot. | |
| static fm_err_t | read_page (fm_tree_t *tree, const fm_io_t *io, const fm_bench_t *bench, fm_page_dir_t side, const fm_entry_t *key) |
| Read one page, and fall back to the first or the last page when the page asked for holds nothing of a folder that is not empty. Each walk is walked again once when it found the card gone. | |
| static void | reselect (fm_tree_t *tree, const char *name) |
Select the row that holds name, or nothing. | |
| void | fm_tree_init (fm_tree_t *tree, const char *dir) |
Start a pane in folder dir, with nothing read yet. | |
| 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. | |
| 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. | |
| 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 page. | |
| fm_err_t | fm_tree_select (fm_tree_t *tree, int row) |
Select row row, or nothing for -1. | |
| const fm_entry_t * | fm_tree_selected (const fm_tree_t *tree) |
| The selected entry. | |
| bool | fm_tree_has_prev (const fm_tree_t *tree) |
| Whether a page stands before the one on show. | |
| bool | fm_tree_has_next (const fm_tree_t *tree) |
| Whether a page stands after the one on show. | |
One pane of the file manager: its folder, its page and its selection (fm_tree.h).
SPDX-License-Identifier: MIT
|
static |
Empty the page, for a folder that could not be read.
| tree | the pane |
| total | the count to show: 0 for a folder not there, -1 for no card |
| 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.
On a failure the pane stays in its folder and reads its page again.
| tree | the pane |
| io | the card |
| bench | what the rules need; may be NULL |
| row | a row of the page |
| bool fm_tree_has_next | ( | const fm_tree_t * | tree | ) |
Whether a page stands after the one on show.
| tree | the pane |
| bool fm_tree_has_prev | ( | const fm_tree_t * | tree | ) |
Whether a page stands before the one on show.
| tree | the pane |
| void fm_tree_init | ( | fm_tree_t * | tree, |
| const char * | dir ) |
Start a pane in folder dir, with nothing read yet.
| tree | the pane |
| dir | the folder, a path from the root; NULL is the root. A path fm_path_check() refuses is the root. |
| 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.
The selection stays on its name when the name is on the new page, and is cleared otherwise. A page past the folder's end, which a file deleted at the edge leaves, is the last page.
| tree | the pane |
| io | the card |
| bench | what the rules need; may be NULL |
| go | which page |
| 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. Strict: zero only for one name.
| a | an fm_entry_t |
| b | an fm_entry_t |
a stands above b Select row row, or nothing for -1.
| tree | the pane |
| row | a row of the page, or -1 |
| const fm_entry_t * fm_tree_selected | ( | const fm_tree_t * | tree | ) |
The selected entry.
| tree | the pane |
| 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 page.
| tree | the pane |
| io | the card |
| bench | what the rules need; may be NULL |
|
static |
Read one page, and fall back to the first or the last page when the page asked for holds nothing of a folder that is not empty. Each walk is walked again once when it found the card gone.
| tree | the pane |
| io | the card |
| bench | what the rules need; may be NULL |
| side | the side of key the page holds |
| key | the entry at the page's edge, the caller's copy; NULL for none |
|
static |
Select the row that holds name, or nothing.
| tree | the pane |
| name | the name to find; "" for none |
|
static |
Offer one entry of a walk to the page: every name that fits, with what the rules say of it; a longer one is counted.
| e | the entry, borrowed for the call |
| vctx | the walk's pane_walk_t |
|
static |
One walk of the folder on the mount in the slot, keeping one page.
| tree | the pane |
| io | the card |
| bench | what the rules need; may be NULL |
| side | the side of key the page holds |
| key | the entry at the page's edge, the caller's copy; NULL for none |
|
static |
One page, walked again once when the walk found the card gone: the second walk is of the card in the slot.
| tree | the pane |
| io | the card |
| bench | what the rules need; may be NULL |
| side | the side of key the page holds |
| key | the entry at the page's edge, the caller's copy; NULL for none |