rcbench
Servo and ESC test bench: panel, IOmcu and shared C
Loading...
Searching...
No Matches
fm_rules.h
Go to the documentation of this file.
1
40
41#pragma once
42
43#include <stdbool.h>
44#include <stddef.h>
45
46#include "fm_io.h"
47#include "fm_name.h"
48#include "log_take.h"
49
50#ifdef __cplusplus
51extern "C" {
52#endif
53
69
73typedef enum {
74 FM_PLACE_FREE = 0,
75 FM_PLACE_FIXED,
76 FM_PLACE_LOCKED,
77 FM_PLACE_FAULT
79
96
101typedef struct {
102 bool armed;
104 bool link_up;
107 const char *user_logs;
109 const char *auto_logs;
111} fm_bench_t;
112
118bool fm_op_writes(fm_op_t op);
119
125bool fm_logging(const log_marks_t *marks);
126
137fm_err_t fm_gate(fm_op_t op, const fm_bench_t *bench);
138
147fm_place_t fm_place_of(const fm_bench_t *bench, const char *dir,
148 const char *name, bool is_dir);
149
158bool fm_busy(const fm_bench_t *bench, const char *dir, const char *name);
159
174fm_err_t fm_allowed(const fm_bench_t *bench, fm_op_t op, const char *dir,
175 const char *name, bool is_dir);
176
195fm_err_t fm_target_check(const fm_bench_t *bench, const char *dir,
196 const char *name, bool typed);
197
205
213fm_kind_t fm_kind_of(const char *dir, const char *name, bool is_dir);
214
222bool fm_read_at_start(const char *dir, const char *name);
223
230bool fm_same_path(const char *a, const char *b);
231
238bool fm_path_within(const char *outer, const char *inner);
239
240#ifdef __cplusplus
241}
242#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
The file manager's names and paths: which name a person may give a file or a folder,...
fm_path_t
What a path call says. The numbers are stable.
Definition fm_name.h:72
bool fm_logging(const log_marks_t *marks)
Whether a log file is open: any of the logger's three marks.
Definition fm_rules.c:120
bool fm_read_at_start(const char *dir, const char *name)
Whether a file saved as name in dir is read only at the next start of the panel: an ESC profile.
Definition fm_rules.c:416
fm_place_t fm_place_of(const fm_bench_t *bench, const char *dir, const char *name, bool is_dir)
Where name in folder dir stands.
Definition fm_rules.c:209
bool fm_path_within(const char *outer, const char *inner)
Whether path inner is outer or a place below it, case folded.
Definition fm_rules.c:160
fm_err_t fm_gate(fm_op_t op, const fm_bench_t *bench)
The write gate: whether the bench's state lets op run.
Definition fm_rules.c:126
fm_err_t fm_path_err(fm_path_t r)
The answer of a path call (fm_name.h) as the core's.
Definition fm_rules.c:140
fm_err_t fm_target_check(const fm_bench_t *bench, const char *dir, const char *name, bool typed)
Whether a COPY, a SAVE, a RENAME or a NEW may make name in folder dir.
Definition fm_rules.c:336
bool fm_busy(const fm_bench_t *bench, const char *dir, const char *name)
Whether the logger writes name in folder dir now (log_marks_busy()).
Definition fm_rules.c:237
fm_kind_t fm_kind_of(const char *dir, const char *name, bool is_dir)
The kind of name in folder dir.
Definition fm_rules.c:377
bool fm_same_path(const char *a, const char *b)
Whether two paths name one place, case folded.
Definition fm_rules.c:155
bool fm_op_writes(fm_op_t op)
Whether op writes to the card.
Definition fm_rules.c:101
fm_err_t fm_allowed(const fm_bench_t *bench, fm_op_t op, const char *dir, const char *name, bool is_dir)
Whether op may run on name in folder dir: the gate, the file's place and whether the logger writes it...
Definition fm_rules.c:283
fm_kind_t
What an entry is, for its icon and kind word.
Definition fm_rules.h:83
@ FM_KIND_TEXT
Definition fm_rules.h:92
@ FM_KIND_FOLDER
Definition fm_rules.h:84
@ FM_KIND_KST
Definition fm_rules.h:87
@ FM_KIND_REPORT
Definition fm_rules.h:86
@ FM_KIND_JSON
Definition fm_rules.h:91
@ FM_KIND_OTHER
Definition fm_rules.h:93
@ FM_KIND_FAULT
Definition fm_rules.h:89
@ FM_KIND_RUN
Definition fm_rules.h:85
@ FM_KIND_CSV
Definition fm_rules.h:90
@ FM_KIND_PROFILE
Definition fm_rules.h:88
fm_place_t
Where a name stands (the file's comment).
Definition fm_rules.h:73
fm_op_t
What a person asks of a name.
Definition fm_rules.h:57
@ FM_OP_RENAME
Definition fm_rules.h:63
@ FM_OP_OPEN
Definition fm_rules.h:58
@ FM_OP_COPY
Definition fm_rules.h:61
@ FM_OP_INFO
Definition fm_rules.h:59
@ FM_OP_EDIT
Definition fm_rules.h:60
@ FM_OP_MOVE
Definition fm_rules.h:62
@ FM_OP_DELETE
Definition fm_rules.h:64
@ FM_OP_SAVE
Definition fm_rules.h:66
@ FM_OP_NEW
Definition fm_rules.h:65
Taking a run's number in a folder of the card, and which open file keeps a listed name out of reach.
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
bool armed
Definition fm_rules.h:102
bool fault_busy
Definition fm_rules.h:105
const char * auto_logs
Definition fm_rules.h:109
bool link_up
Definition fm_rules.h:104
const log_marks_t * marks
Definition fm_rules.h:103
const char * user_logs
Definition fm_rules.h:107
The files the logger has open, each with the folder it is in: the automatic log's run in run_dir,...
Definition log_take.h:203