summaryrefslogtreecommitdiffstats
path: root/readline-6.2/history.h
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>2011-04-08 16:24:33 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>2011-04-08 16:24:33 +0000
commitb667555541a4d65bb9dae6f0e0f240e6a05b148e (patch)
treeb3ae5c92f04ae68fbf9580d6efcf1a1510851495 /readline-6.2/history.h
parent2011-04-08 Joel Sherrill <joel.sherrill@oarcorp.com> (diff)
downloadrtems-addon-packages-b667555541a4d65bb9dae6f0e0f240e6a05b148e.tar.bz2
2011-04-08 Joel Sherrill <joel.sherrill@oarcorp.com>
* RTEMS_Makefiles/Makefile.readline-6.2, readline-6.2/CHANGELOG, readline-6.2/CHANGES, readline-6.2/COPYING, readline-6.2/INSTALL, readline-6.2/MANIFEST, readline-6.2/Makefile.in, readline-6.2/NEWS, readline-6.2/README, readline-6.2/USAGE, readline-6.2/aclocal.m4, readline-6.2/ansi_stdlib.h, readline-6.2/bind.c, readline-6.2/callback.c, readline-6.2/chardefs.h, readline-6.2/compat.c, readline-6.2/complete.c, readline-6.2/config.h.in, readline-6.2/configure, readline-6.2/configure.in, readline-6.2/display.c, readline-6.2/emacs_keymap.c, readline-6.2/funmap.c, readline-6.2/histexpand.c, readline-6.2/histfile.c, readline-6.2/histlib.h, readline-6.2/history.c, readline-6.2/history.h, readline-6.2/histsearch.c, readline-6.2/input.c, readline-6.2/isearch.c, readline-6.2/keymaps.c, readline-6.2/keymaps.h, readline-6.2/kill.c, readline-6.2/macro.c, readline-6.2/mbutil.c, readline-6.2/misc.c, readline-6.2/nls.c, readline-6.2/parens.c, readline-6.2/patchlevel, readline-6.2/posixdir.h, readline-6.2/posixjmp.h, readline-6.2/posixselect.h, readline-6.2/posixstat.h, readline-6.2/readline.c, readline-6.2/readline.h, readline-6.2/rlconf.h, readline-6.2/rldefs.h, readline-6.2/rlmbutil.h, readline-6.2/rlprivate.h, readline-6.2/rlshell.h, readline-6.2/rlstdc.h, readline-6.2/rltty.c, readline-6.2/rltty.h, readline-6.2/rltypedefs.h, readline-6.2/rlwinsize.h, readline-6.2/savestring.c, readline-6.2/search.c, readline-6.2/shell.c, readline-6.2/signals.c, readline-6.2/tcap.h, readline-6.2/terminal.c, readline-6.2/text.c, readline-6.2/tilde.c, readline-6.2/tilde.h, readline-6.2/undo.c, readline-6.2/util.c, readline-6.2/vi_keymap.c, readline-6.2/vi_mode.c, readline-6.2/xfree.c, readline-6.2/xmalloc.c, readline-6.2/xmalloc.h, readline-6.2/doc/Makefile.in, readline-6.2/doc/fdl.texi, readline-6.2/doc/history.0, readline-6.2/doc/history.3, readline-6.2/doc/history.dvi, readline-6.2/doc/history.html, readline-6.2/doc/history.info, readline-6.2/doc/history.pdf, readline-6.2/doc/history.ps, readline-6.2/doc/history.texi, readline-6.2/doc/history_3.ps, readline-6.2/doc/hstech.texi, readline-6.2/doc/hsuser.texi, readline-6.2/doc/readline.0, readline-6.2/doc/readline.3, readline-6.2/doc/readline.dvi, readline-6.2/doc/readline.html, readline-6.2/doc/readline.info, readline-6.2/doc/readline.pdf, readline-6.2/doc/readline.ps, readline-6.2/doc/readline_3.ps, readline-6.2/doc/rlman.texi, readline-6.2/doc/rltech.texi, readline-6.2/doc/rluser.texi, readline-6.2/doc/rluserman.dvi, readline-6.2/doc/rluserman.html, readline-6.2/doc/rluserman.info, readline-6.2/doc/rluserman.pdf, readline-6.2/doc/rluserman.ps, readline-6.2/doc/rluserman.texi, readline-6.2/doc/texi2dvi, readline-6.2/doc/texi2html, readline-6.2/doc/texinfo.tex, readline-6.2/doc/version.texi, readline-6.2/examples/Inputrc, readline-6.2/examples/Makefile.in, readline-6.2/examples/excallback.c, readline-6.2/examples/fileman.c, readline-6.2/examples/histexamp.c, readline-6.2/examples/manexamp.c, readline-6.2/examples/readlinebuf.h, readline-6.2/examples/rl-fgets.c, readline-6.2/examples/rl.c, readline-6.2/examples/rlcat.c, readline-6.2/examples/rlevent.c, readline-6.2/examples/rlptytest.c, readline-6.2/examples/rltest.c, readline-6.2/examples/rlversion.c, readline-6.2/examples/rlwrap-0.30.tar.gz, readline-6.2/examples/autoconf/BASH_CHECK_LIB_TERMCAP, readline-6.2/examples/autoconf/RL_LIB_READLINE_VERSION, readline-6.2/examples/autoconf/wi_LIB_READLINE, readline-6.2/examples/rlfe/ChangeLog, readline-6.2/examples/rlfe/Makefile.in, readline-6.2/examples/rlfe/README, readline-6.2/examples/rlfe/config.h.in, readline-6.2/examples/rlfe/configure, readline-6.2/examples/rlfe/configure.in, readline-6.2/examples/rlfe/extern.h, readline-6.2/examples/rlfe/os.h, readline-6.2/examples/rlfe/pty.c, readline-6.2/examples/rlfe/rlfe.c, readline-6.2/examples/rlfe/screen.h, readline-6.2/shlib/Makefile.in, readline-6.2/support/config.guess, readline-6.2/support/config.rpath, readline-6.2/support/config.sub, readline-6.2/support/install.sh, readline-6.2/support/mkdirs, readline-6.2/support/mkdist, readline-6.2/support/mkinstalldirs, readline-6.2/support/shlib-install, readline-6.2/support/shobj-conf, readline-6.2/support/wcwidth.c: New files.
Diffstat (limited to 'readline-6.2/history.h')
-rw-r--r--readline-6.2/history.h266
1 files changed, 266 insertions, 0 deletions
diff --git a/readline-6.2/history.h b/readline-6.2/history.h
new file mode 100644
index 0000000..1257e66
--- /dev/null
+++ b/readline-6.2/history.h
@@ -0,0 +1,266 @@
+/* history.h -- the names of functions that you can call in history. */
+
+/* Copyright (C) 1989-2009 Free Software Foundation, Inc.
+
+ This file contains the GNU History Library (History), a set of
+ routines for managing the text of previously typed lines.
+
+ History is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ History is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with History. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef _HISTORY_H_
+#define _HISTORY_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <time.h> /* XXX - for history timestamp code */
+
+#if defined READLINE_LIBRARY
+# include "rlstdc.h"
+# include "rltypedefs.h"
+#else
+# include <readline/rlstdc.h>
+# include <readline/rltypedefs.h>
+#endif
+
+#ifdef __STDC__
+typedef void *histdata_t;
+#else
+typedef char *histdata_t;
+#endif
+
+/* The structure used to store a history entry. */
+typedef struct _hist_entry {
+ char *line;
+ char *timestamp; /* char * rather than time_t for read/write */
+ histdata_t data;
+} HIST_ENTRY;
+
+/* Size of the history-library-managed space in history entry HS. */
+#define HISTENT_BYTES(hs) (strlen ((hs)->line) + strlen ((hs)->timestamp))
+
+/* A structure used to pass the current state of the history stuff around. */
+typedef struct _hist_state {
+ HIST_ENTRY **entries; /* Pointer to the entries themselves. */
+ int offset; /* The location pointer within this array. */
+ int length; /* Number of elements within this array. */
+ int size; /* Number of slots allocated to this array. */
+ int flags;
+} HISTORY_STATE;
+
+/* Flag values for the `flags' member of HISTORY_STATE. */
+#define HS_STIFLED 0x01
+
+/* Initialization and state management. */
+
+/* Begin a session in which the history functions might be used. This
+ just initializes the interactive variables. */
+extern void using_history PARAMS((void));
+
+/* Return the current HISTORY_STATE of the history. */
+extern HISTORY_STATE *history_get_history_state PARAMS((void));
+
+/* Set the state of the current history array to STATE. */
+extern void history_set_history_state PARAMS((HISTORY_STATE *));
+
+/* Manage the history list. */
+
+/* Place STRING at the end of the history list.
+ The associated data field (if any) is set to NULL. */
+extern void add_history PARAMS((const char *));
+
+/* Change the timestamp associated with the most recent history entry to
+ STRING. */
+extern void add_history_time PARAMS((const char *));
+
+/* A reasonably useless function, only here for completeness. WHICH
+ is the magic number that tells us which element to delete. The
+ elements are numbered from 0. */
+extern HIST_ENTRY *remove_history PARAMS((int));
+
+/* Free the history entry H and return any application-specific data
+ associated with it. */
+extern histdata_t free_history_entry PARAMS((HIST_ENTRY *));
+
+/* Make the history entry at WHICH have LINE and DATA. This returns
+ the old entry so you can dispose of the data. In the case of an
+ invalid WHICH, a NULL pointer is returned. */
+extern HIST_ENTRY *replace_history_entry PARAMS((int, const char *, histdata_t));
+
+/* Clear the history list and start over. */
+extern void clear_history PARAMS((void));
+
+/* Stifle the history list, remembering only MAX number of entries. */
+extern void stifle_history PARAMS((int));
+
+/* Stop stifling the history. This returns the previous amount the
+ history was stifled by. The value is positive if the history was
+ stifled, negative if it wasn't. */
+extern int unstifle_history PARAMS((void));
+
+/* Return 1 if the history is stifled, 0 if it is not. */
+extern int history_is_stifled PARAMS((void));
+
+/* Information about the history list. */
+
+/* Return a NULL terminated array of HIST_ENTRY which is the current input
+ history. Element 0 of this list is the beginning of time. If there
+ is no history, return NULL. */
+extern HIST_ENTRY **history_list PARAMS((void));
+
+/* Returns the number which says what history element we are now
+ looking at. */
+extern int where_history PARAMS((void));
+
+/* Return the history entry at the current position, as determined by
+ history_offset. If there is no entry there, return a NULL pointer. */
+extern HIST_ENTRY *current_history PARAMS((void));
+
+/* Return the history entry which is logically at OFFSET in the history
+ array. OFFSET is relative to history_base. */
+extern HIST_ENTRY *history_get PARAMS((int));
+
+/* Return the timestamp associated with the HIST_ENTRY * passed as an
+ argument */
+extern time_t history_get_time PARAMS((HIST_ENTRY *));
+
+/* Return the number of bytes that the primary history entries are using.
+ This just adds up the lengths of the_history->lines. */
+extern int history_total_bytes PARAMS((void));
+
+/* Moving around the history list. */
+
+/* Set the position in the history list to POS. */
+extern int history_set_pos PARAMS((int));
+
+/* Back up history_offset to the previous history entry, and return
+ a pointer to that entry. If there is no previous entry, return
+ a NULL pointer. */
+extern HIST_ENTRY *previous_history PARAMS((void));
+
+/* Move history_offset forward to the next item in the input_history,
+ and return the a pointer to that entry. If there is no next entry,
+ return a NULL pointer. */
+extern HIST_ENTRY *next_history PARAMS((void));
+
+/* Searching the history list. */
+
+/* Search the history for STRING, starting at history_offset.
+ If DIRECTION < 0, then the search is through previous entries,
+ else through subsequent. If the string is found, then
+ current_history () is the history entry, and the value of this function
+ is the offset in the line of that history entry that the string was
+ found in. Otherwise, nothing is changed, and a -1 is returned. */
+extern int history_search PARAMS((const char *, int));
+
+/* Search the history for STRING, starting at history_offset.
+ The search is anchored: matching lines must begin with string.
+ DIRECTION is as in history_search(). */
+extern int history_search_prefix PARAMS((const char *, int));
+
+/* Search for STRING in the history list, starting at POS, an
+ absolute index into the list. DIR, if negative, says to search
+ backwards from POS, else forwards.
+ Returns the absolute index of the history element where STRING
+ was found, or -1 otherwise. */
+extern int history_search_pos PARAMS((const char *, int, int));
+
+/* Managing the history file. */
+
+/* Add the contents of FILENAME to the history list, a line at a time.
+ If FILENAME is NULL, then read from ~/.history. Returns 0 if
+ successful, or errno if not. */
+extern int read_history PARAMS((const char *));
+
+/* Read a range of lines from FILENAME, adding them to the history list.
+ Start reading at the FROM'th line and end at the TO'th. If FROM
+ is zero, start at the beginning. If TO is less than FROM, read
+ until the end of the file. If FILENAME is NULL, then read from
+ ~/.history. Returns 0 if successful, or errno if not. */
+extern int read_history_range PARAMS((const char *, int, int));
+
+/* Write the current history to FILENAME. If FILENAME is NULL,
+ then write the history list to ~/.history. Values returned
+ are as in read_history (). */
+extern int write_history PARAMS((const char *));
+
+/* Append NELEMENT entries to FILENAME. The entries appended are from
+ the end of the list minus NELEMENTs up to the end of the list. */
+extern int append_history PARAMS((int, const char *));
+
+/* Truncate the history file, leaving only the last NLINES lines. */
+extern int history_truncate_file PARAMS((const char *, int));
+
+/* History expansion. */
+
+/* Expand the string STRING, placing the result into OUTPUT, a pointer
+ to a string. Returns:
+
+ 0) If no expansions took place (or, if the only change in
+ the text was the de-slashifying of the history expansion
+ character)
+ 1) If expansions did take place
+ -1) If there was an error in expansion.
+ 2) If the returned line should just be printed.
+
+ If an error ocurred in expansion, then OUTPUT contains a descriptive
+ error message. */
+extern int history_expand PARAMS((char *, char **));
+
+/* Extract a string segment consisting of the FIRST through LAST
+ arguments present in STRING. Arguments are broken up as in
+ the shell. */
+extern char *history_arg_extract PARAMS((int, int, const char *));
+
+/* Return the text of the history event beginning at the current
+ offset into STRING. Pass STRING with *INDEX equal to the
+ history_expansion_char that begins this specification.
+ DELIMITING_QUOTE is a character that is allowed to end the string
+ specification for what to search for in addition to the normal
+ characters `:', ` ', `\t', `\n', and sometimes `?'. */
+extern char *get_history_event PARAMS((const char *, int *, int));
+
+/* Return an array of tokens, much as the shell might. The tokens are
+ parsed out of STRING. */
+extern char **history_tokenize PARAMS((const char *));
+
+/* Exported history variables. */
+extern int history_base;
+extern int history_length;
+extern int history_max_entries;
+extern char history_expansion_char;
+extern char history_subst_char;
+extern char *history_word_delimiters;
+extern char history_comment_char;
+extern char *history_no_expand_chars;
+extern char *history_search_delimiter_chars;
+extern int history_quotes_inhibit_expansion;
+
+extern int history_write_timestamps;
+
+/* Backwards compatibility */
+extern int max_input_history;
+
+/* If set, this function is called to decide whether or not a particular
+ history expansion should be treated as a special case for the calling
+ application and not expanded. */
+extern rl_linebuf_func_t *history_inhibit_expansion_function;
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* !_HISTORY_H_ */