1 /*** BEGIN INCLUDE FILE: wsthist.h ***/
 2 
 3 /* HISTORY COMMENTS:
 4   1) change(88-07-29,Lee), approve(88-05-16,MCR7897), audit(88-09-19,Flegel):
 5      Created.
 6                                                    END HISTORY COMMENTS */
 7 
 8 /* Function:
 9     This include defines constants and structures for WSTERM's
10     history recall facility.
11 */
12 
13 #ifndef WSTHIST
14 
15 #define HIST_BUFF_SIZE         4096   /* size of history buffer */
16 #define HIST_MAX_LINES           22   /* history lines displayed per screen */
17 #define HIST_START_DIR            0   /* no history buffer traversal flag */
18 #define HIST_PREVIOUS_DIR         1   /* backward history traversal flag */
19 #define HIST_NEXT_DIR             2   /* forward history traversal flag */
20 #define HIST_MAX_SCREEN_SHIFT   980   /* maximum offset for screen shift */
21 #define HIST_DEFAULT_0_ARG        0   /* no history command selected flag */
22 
23 
24 /* This structure maintains a circular buffer which is used as the
25    history buffer. Each command placed in the history buffer has the
26    following format:
27 
28       [2 bytes for item size] + [command bytes] + [2 bytes for item size]
29 
30    Thus, a total of 4 additional bytes are stored with each command.
31    The size bytes at the beginning and end of each item allows for
32    bi-directional traversal of the history buffer.
33 
34    head, tail, and current are indices to a circular buffer and as
35    such, their values are incremented or decremented using modular
36    arithmetic (of history buffer size) to ensure they access only
37    valid history buffer locations.
38 
39 */
40 
41 typedef struct hist_buff_struct {
42     int head;             /* indexes past most recently saved command */
43     int head_item_size;   /* size of most recently saved command+4 */
44     int tail;             /* indexes to the least recently saved command */
45     int tail_item_size;   /* size of least recently saved command+4 */
46     int chars_free;       /* number of bytes unused in kill buffer */
47     int current;          /* index to next item to retrieve */
48     int current_size;     /* size of next command to retrieve+4 */
49     int head_of_histbuff; /* flag indicating current = head */
50     int direction;        /* previous direction of traversal */
51     char kb [HIST_BUFF_SIZE];   /* history buffer space */
52 } HIST_BUFF_INFO;
53 
54 
55 
56 /* this structure contains display control information for displaying
57    the history screen. The 'start' values are initial values and the
58    'cur' values are running values.
59 */
60 
61 typedef struct item_info_struct {
62     int start_item_no;       /* id of history command, most recent=1 */
63     int start_chars_in_buff; /* count of chars not yet displayed */
64     int start_display_count; /* count of commands displayed on screen */
65     int start_item_index;    /* history buffer index to next item to fetch */
66     int start_size;          /* size of next history buffer item to fetch */
67     int cur_item_no;         /* id of current history command fetched */
68     int cur_chars_in_buff;   /* count of chars not yet displayed */
69     int cur_display_count;   /* count of commands currently displayed */
70     int cur_item_index;      /* history buffer index of current item fetched */
71     int cur_size;            /* size of current history buffer item to fetch */
72 } ITEM_INFO;
73 
74 
75 /* global structure which serves as the history buffer */
76 HIST_BUFF_INFO hbi;
77 
78 #define WSTHIST
79 #endif WSTHIST
80 
81 /*** END INCLUDE FILE: wsthist.h */