include/readline/able_history.h File Reference

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  able_history_s
 The ABLE history context. More...
struct  line_hist_s
 ABLE readline history entry. More...

Defines

#define _ABLE_CLIB_ABLE_HISTORY_H   1

Typedefs

typedef void * histdata_t
 ABLE readline history entry application data.
typedef struct able_history_s able_history_t
 ABLE readline history context.
typedef struct line_hist_s line_hist_t
 ABLE readline history entry.

Functions

able_history_table_history_init (int max_entries)
 Create a new ABLE history.
void able_history_free (able_history_t *history)
 Free an ABLE history context.
line_hist_table_history_add (able_history_t *history, const char *line)
 Add a string to a history.
void able_history_limit (able_history_t *history, int age)
 Remove history entries beyond a certain depth.
line_hist_table_history_next (able_history_t *history, line_hist_t *cur)
 Obtain the next history entry.
line_hist_table_history_prev (able_history_t *history, line_hist_t *cur)
 Obtain the previous history entry.


Define Documentation

#define _ABLE_CLIB_ABLE_HISTORY_H   1


Typedef Documentation

ABLE readline history context.

typedef void* histdata_t

ABLE readline history entry application data.

typedef struct line_hist_s line_hist_t

ABLE readline history entry.


Function Documentation

line_hist_t* able_history_add ( able_history_t history,
const char *  line 
)

Add a string to a history.

Add a string to a history ensuring that the number of entries in the history does not exceed a maximum depth.

Parameters:
history The history to add to.
line The string to add to the history.
Returns:
The new history entry.

void able_history_free ( able_history_t history  ) 

Free an ABLE history context.

Free a history context and all associated storage.

Parameters:
history The history to free.

able_history_t* able_history_init ( int  max_entries  ) 

Create a new ABLE history.

Create a new ABLE history with the given maximum number of entries.

Parameters:
max_entries The maximum number of lines in the history. Positive values limit the depth the history should extend to, 0 disables adding new entries to the history (old entries may be accessed) and a negative value indicates no limit should be placed.
Returns:
The new ABLE history.

void able_history_limit ( able_history_t history,
int  age 
)

Remove history entries beyond a certain depth.

Iterate through a shell history list and remove any entries that are too old.

Parameters:
history The history to limit.
age The maximum age, in entries, to limit to.

line_hist_t* able_history_next ( able_history_t history,
line_hist_t cur 
)

Obtain the next history entry.

Get the next oldest history entry after the current one. If the current entry is the oldest return that.

Parameters:
history The history context of the entry.
cur The current history entry or NULL to start at the first entry.
Returns:
The next history entry or NULL if the history is empty or history is invalid.

line_hist_t* able_history_prev ( able_history_t history,
line_hist_t cur 
)

Obtain the previous history entry.

Get the next youngest history entry before the current one. If the current entry is the youngest return NULL.

Parameters:
history The history context of the entry.
cur The current history entry.
Returns:
The previous history entry or NULL if the entry is the youngest, the history is empty or history is invalid.


Generated on Tue Jan 20 14:28:56 2009 for ABLE LIBC by  doxygen 1.5.6