rcbench
Servo and ESC test bench: panel, IOmcu and shared C
Toggle main menu visibility
Loading...
Searching...
No Matches
fm_name.h
Go to the documentation of this file.
1
33
34
#pragma once
35
36
#include <stdbool.h>
37
#include <stddef.h>
38
39
#ifdef __cplusplus
40
extern
"C"
{
41
#endif
42
44
#define FM_LIST_NAME_MAX 63u
46
#define FM_NEW_SUFFIX ".NEW"
48
#define FM_NEW_SUFFIX_LEN 4u
50
#define FM_NAME_MAX (FM_LIST_NAME_MAX - FM_NEW_SUFFIX_LEN)
52
#define FM_PATH_MAX 120u
54
#define FM_PATH_SIZE (FM_PATH_MAX + 1u)
56
#define FM_DEPTH_MAX 16u
57
59
typedef
enum
{
60
FM_NAME_OK
= 0,
61
FM_NAME_EMPTY
= 1,
62
FM_NAME_LONG
= 2,
63
FM_NAME_CHAR
= 3,
65
FM_NAME_EDGE
= 4,
67
FM_NAME_RESERVED
= 5,
69
}
fm_name_t
;
70
72
typedef
enum
{
73
FM_PATH_OK
= 0,
74
FM_PATH_ARG
= 1,
75
FM_PATH_BAD
= 2,
77
FM_PATH_LONG
= 3,
78
FM_PATH_DEEP
= 4,
79
}
fm_path_t
;
80
88
fm_name_t
fm_name_check
(
const
char
*name);
89
99
bool
fm_name_new
(
const
char
*name,
char
*out,
size_t
n);
100
108
fm_path_t
fm_path_check
(
const
char
*path);
109
116
size_t
fm_path_depth
(
const
char
*path);
117
135
fm_path_t
fm_path_join
(
const
char
*dir,
const
char
*name,
bool
is_dir,
136
char
*out,
size_t
n);
137
144
bool
fm_path_up
(
char
*path);
145
152
const
char
*
fm_path_base
(
const
char
*path);
153
154
#ifdef __cplusplus
155
}
156
#endif
fm_path_check
fm_path_t fm_path_check(const char *path)
Whether path is a folder path: "" or names separated by one "/", at most FM_PATH_MAX bytes and FM_DEP...
Definition
fm_name.c:139
fm_path_base
const char * fm_path_base(const char *path)
The last name of path.
Definition
fm_name.c:233
fm_path_join
fm_path_t fm_path_join(const char *dir, const char *name, bool is_dir, char *out, size_t n)
The path of name in folder dir: "name" in the root, "dir/name" elsewhere.
Definition
fm_name.c:180
fm_path_up
bool fm_path_up(char *path)
Take the last name off path, in place: up one folder.
Definition
fm_name.c:219
fm_name_check
fm_name_t fm_name_check(const char *name)
Whether a person may give a file or a folder the name name.
Definition
fm_name.c:80
fm_name_new
bool fm_name_new(const char *name, char *out, size_t n)
The name a save writes first: name and FM_NEW_SUFFIX.
Definition
fm_name.c:108
fm_path_depth
size_t fm_path_depth(const char *path)
Folders in path.
Definition
fm_name.c:167
fm_path_t
fm_path_t
What a path call says. The numbers are stable.
Definition
fm_name.h:72
FM_PATH_DEEP
@ FM_PATH_DEEP
Definition
fm_name.h:78
FM_PATH_BAD
@ FM_PATH_BAD
Definition
fm_name.h:75
FM_PATH_LONG
@ FM_PATH_LONG
Definition
fm_name.h:77
FM_PATH_OK
@ FM_PATH_OK
Definition
fm_name.h:73
FM_PATH_ARG
@ FM_PATH_ARG
Definition
fm_name.h:74
fm_name_t
fm_name_t
What fm_name_check() says of a name. The numbers are stable.
Definition
fm_name.h:59
FM_NAME_CHAR
@ FM_NAME_CHAR
Definition
fm_name.h:63
FM_NAME_EDGE
@ FM_NAME_EDGE
Definition
fm_name.h:65
FM_NAME_RESERVED
@ FM_NAME_RESERVED
Definition
fm_name.h:67
FM_NAME_OK
@ FM_NAME_OK
Definition
fm_name.h:60
FM_NAME_LONG
@ FM_NAME_LONG
Definition
fm_name.h:62
FM_NAME_EMPTY
@ FM_NAME_EMPTY
Definition
fm_name.h:61
shared
files
include
fm_name.h
Generated by
1.18.0