Changed the way buffer is filled
[iomenu.git] / complete.h
blob707915fa2b7d1242ffc036635834b9557062320d
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 total; /* total number of candidates */
39 int count; /* total number of filtered candidates */
41 char *input; /* string from user's keyboard */
42 char *prompt; /* specified from the command line */
44 Header *current_h; /* header containing the selected line */
45 Line *current; /* selected line, highlighted */
46 Line *first; /* doubly linked list of lines */
47 Line *last;
48 } Buffer;
51 Buffer * fill_buffer(char *);
53 Line * parse_line(char *, char *);
55 Line * add_line(Buffer *, int, char *, char *, Line *);
57 void match_input();
59 Line * * filter_lines();
61 void print_line(Line *);
63 void print_header();
65 void print_lines();
67 void get_input();
69 void print_prompt();
71 void print_input();