history: History Storage

1 
1 2.2 History Storage
1 ===================
1 
1 The history list is an array of history entries.  A history entry is
1 declared as follows:
1 
1      typedef void *histdata_t;
1 
1      typedef struct _hist_entry {
1        char *line;
1        char *timestamp;
1        histdata_t data;
1      } HIST_ENTRY;
1 
1    The history list itself might therefore be declared as
1 
1      HIST_ENTRY **the_history_list;
1 
1    The state of the History library is encapsulated into a single
1 structure:
1 
1      /*
1       * A structure used to pass around the current state of the history.
1       */
1      typedef struct _hist_state {
1        HIST_ENTRY **entries; /* Pointer to the entries themselves. */
1        int offset;           /* The location pointer within this array. */
1        int length;           /* Number of elements within this array. */
1        int size;             /* Number of slots allocated to this array. */
1        int flags;
1      } HISTORY_STATE;
1 
1    If the flags member includes 'HS_STIFLED', the history has been
1 stifled.
1