Renamed to iomenu.
[iomenu.git] / iomenu.h
blob131eaa4d324c90f6747fefc7c71661da407276fe
1 #include <stddef.h>
3 #include "config.h"
5 /*
6 * Line coming from stdin, wrapped in a header.
7 */
8 typedef struct Line {
9 char *content; /* sent as output and matched by input */
10 char *comment; /* displayed at the right of the content */
12 int number; /* set here as order will not change */
13 int matches; /* whether it matches buffer's input */
15 struct Line *prev; /* doubly linked list structure */
16 struct Line *next;
17 } Line;
20 * Group of lines from stdin delimited by a header line.
22 * The header lines are identified by a leading 'HEADER' character,
23 * specified on command line. Each header contains a doubly linked list of
24 * lines.
26 typedef struct Header {
27 int count; /* number of candidates in this header */
29 char *title; /* displayed in bold for each header */
31 struct Header *prev; /* doubly linked list structure */
32 struct Header *next;
34 Line *first; /* first line within the header */
35 } Header;
38 * Buffer containing a doubly linked list of headers
40 typedef struct Buffer {
41 int total; /* total number of line in buffer */
42 int matching; /* number lines matching the input */
44 char input[LINE_SIZE]; /* string from user's keyboard */
45 char *prompt; /* specified from the command line */
47 Header *current_h; /* header containing the selected line */
49 Line *empty; /* empty line, for when needed */
50 Line *current; /* selected line, highlighted */
51 Line *first; /* boundaries of the linked list */
52 Line *last;
53 } Buffer;
56 void die(const char *);
57 Buffer * fill_buffer(char *);
58 Line * parse_line(char *, char *);
59 Line * add_line(Buffer *, int, char *, char *, Line *);
60 int line_match_input(Line *, char *);
61 void filter_lines(Buffer *);
62 char * expand_tabs(char *);
63 void print_line(Line *, int, int);
64 void print_header();
65 void print_lines(Buffer *, int, int, int);
66 void update_screen(Buffer *, int, int, int);
67 struct termios terminal_set(int);
68 void get_input(Buffer *, int, int, int);
69 int do_key(char, Buffer *);
70 void do_next_line(Buffer *);
71 void do_prev_line(Buffer *);
72 void print_prompt(Buffer *, int);