rcbench
Servo and ESC test bench: panel, IOmcu and shared C
Loading...
Searching...
No Matches
fm_select.h
Go to the documentation of this file.
1
30
31#pragma once
32
33#include <stddef.h>
34
35#ifdef __cplusplus
36extern "C" {
37#endif
38
54
62typedef int (*fm_rank_fn)(const void *a, const void *b);
63
68typedef struct {
69 void *set;
70 size_t size;
74 const void *key;
75 int held;
76 int inside;
77 int outside;
79
95int fm_select_keep(void *set, size_t size, int count, int capacity,
96 const void *cand, fm_rank_fn rank);
97
109void fm_select_begin(fm_select_t *sel, void *set, size_t size, int capacity,
110 fm_rank_fn rank, fm_page_dir_t dir, const void *key);
111
117void fm_select_offer(fm_select_t *sel, const void *cand);
118
128int fm_select_end(fm_select_t *sel, fm_rank_fn show, int *ahead);
129
130#ifdef __cplusplus
131}
132#endif
void fm_select_begin(fm_select_t *sel, void *set, size_t size, int capacity, fm_rank_fn rank, fm_page_dir_t dir, const void *key)
Start choosing one page into set.
Definition fm_select.c:93
int fm_select_end(fm_select_t *sel, fm_rank_fn show, int *ahead)
End the walk: sort the page for display and say where it stands.
Definition fm_select.c:156
int fm_select_keep(void *set, size_t size, int count, int capacity, const void *cand, fm_rank_fn rank)
Offer cand to a set of count entries in rank order, which keeps the capacity entries that rank first.
Definition fm_select.c:87
void fm_select_offer(fm_select_t *sel, const void *cand)
Offer one entry of the folder.
Definition fm_select.c:119
int(*) fm_rank_fn(const void *a, const void *b)
The order of two entries, as qsort() takes it.
Definition fm_select.h:62
fm_page_dir_t
Which side of the key a page holds.
Definition fm_select.h:42
@ FM_PAGE_AFTER
The first entries that rank behind the key: the next page. With no key, the first page.
Definition fm_select.h:48
@ FM_PAGE_BEFORE
The last entries that rank ahead of the key: the page before. With no key, the last entries of all: t...
Definition fm_select.h:52
@ FM_PAGE_FROM
The first entries that rank with the key or behind it. With no key, the first page.
Definition fm_select.h:45
One page being chosen while a folder is read. Filled by fm_select_begin(); the fields are the walk's,...
Definition fm_select.h:68
fm_page_dir_t dir
Definition fm_select.h:73
size_t size
Definition fm_select.h:70
void * set
Definition fm_select.h:69
int outside
Definition fm_select.h:77
int inside
Definition fm_select.h:76
int held
Definition fm_select.h:75
int capacity
Definition fm_select.h:71
fm_rank_fn rank
Definition fm_select.h:72
const void * key
Definition fm_select.h:74