Could split string according to a separator.
[iomenu.git] / complete.h
blob011204c4ee9f1892f7a6c7552614781eb21a5c4e
1 #include <stddef.h>
3 /*
4 * Line coming from stdin, wrapped in a header.
5 */
6 typedef struct Line {
7 char *content; /* sent as output and matched by input */
8 char *comment; /* displayed at the right of the content */
10 int *number; /* set here as there is no line reordering */
12 struct Line *prev; /* doubly linked list structure */
13 struct Line *next;
14 } Line;
17 * Group of lines from stdin delimited by a header line.
19 * The header lines are identified by a leading 'HEADER' character,
20 * specified on command line. Each header contains a doubly linked list of
21 * lines.
23 typedef struct Header {
24 int count; /* number of candidates in this header */
26 char *title; /* displayed in bold for each header */
28 struct Header *prev; /* doubly linked list structure */
29 struct Header *next;
31 Line *first; /* first line within the header */
32 } Header;
35 * Buffer containing a doubly linked list of headers
37 typedef struct Buffer {
38 int count; /* total number of candidates */
40 char *input; /* string from user's keyboard */
41 char *prompt; /* specified from the command line */
43 Header *current_h; /* header containing the selected line */
44 Line *current; /* selected line, highlighted */
45 Line *first; /* doubly linked list of lines */
46 Line *last;
47 } Buffer;
50 Buffer * fill_buffer(char *separator);
52 Line * parse_line(char *s, char *separator);
54 void add_line(Buffer *buffer, Line *line, Line *previous, int number);
56 void match_input();
58 Line * * filter_lines();
60 void print_line(Line *line);
62 void print_header();
64 void print_lines();
66 void get_input();
68 void print_prompt();
70 void print_input();
72 int main(int argc, char *argv[]);