readline.cxx File Reference

#include <sys/types.h>
#include <sys/stat.h>
#include <stdio.h>
#include <dirent.h>
#include <string.h>
#include <pwd.h>
#include <ctype.h>
#include <stdlib.h>
#include <unistd.h>
#include <limits.h>
#include <alloca.h>
#include "histedit.h"
#include "editline.h"
#include "el.h"
#include "compat.h"
#include "TTermManip.h"
#include "enhance.h"
#include <iostream>

Go to the source code of this file.

Defines

#define TAB   '\r'
#define GDB_411_HACK

Functions

static unsigned char _el_rl_complete (EditLine_t *, int)
static char * _get_prompt (EditLine_t *)
static HIST_ENTRY_move_history (int)
static int _history_search_gen (const char *, int, int)
static int rl_complete_internal (int)
static int _rl_qsort_string_compare (const void *, const void *)
bool rl_isinitialized ()
int rl_initialize (void)
void rl_cleanup_after_signal ()
char * readline (const char *prompt, bool newline)
void setColors (const char *colorTab, const char *colorTabComp, const char *colorBracket, const char *colorBadBracket, const char *colorPrompt)
void termResize (void)
void setEcho (bool echo)
void using_history (void)
char ** history_tokenize (const char *str)
void stifle_history (int max)
int unstifle_history (void)
int history_is_stifled (void)
int read_history (const char *filename)
int write_history (const char *filename)
HIST_ENTRYhistory_get (int num)
int add_history (char *line)
void clear_history (void)
int where_history (void)
HIST_ENTRYcurrent_history (void)
int history_total_bytes (void)
int history_set_pos (int pos)
HIST_ENTRYprevious_history (void)
HIST_ENTRYnext_history (void)
int history_search (const char *str, int direction)
int history_search_prefix (const char *str, int direction)
int history_search_pos (const char *str, int, int pos)
char * tilde_expand (char *txt)
char * filename_completion_function (const char *text, int state)
char * username_completion_function (const char *text, int state)
char ** completion_matches (const char *text, CPFunction *genfunc)
void rl_display_match_list (char **matches, int len, int max)
int rl_complete (int ignore, int invoking_key)
int rl_bind_key (int c, int func(int, int))
int rl_read_key (void)
void rl_reset_terminal (void)
int rl_insert (int count, int c)
EditLine_tel_readline_el ()
int rl_eof ()

Variables

const char * rl_library_version = "EditLine_t wrapper"
const char * rl_readline_name = ""
FILE * rl_instream = NULL
FILE * rl_outstream = NULL
int rl_point = 0
int rl_end = 0
char * rl_line_buffer = NULL
int history_base = 1
int history_length = 0
int max_input_history = 0
char history_expansion_char = '!'
char history_subst_char = '^'
const char * history_no_expand_chars = " \t\n=("
Functionhistory_inhibit_expansion_function = NULL
int rl_inhibit_completion = 0
int rl_attempted_completion_over = 0
const char * rl_basic_word_break_characters = " \t\n\"\\'`@$><=;|&{("
char * rl_completer_word_break_characters = NULL
char * rl_completer_quote_characters = NULL
CPFunctionrl_completion_entry_function = NULL
CPPFunctionrl_attempted_completion_function = NULL
int tab_color = 5
El_tab_hook_t rl_tab_hook = NULL
El_in_key_hook_t rl_in_key_hook = NULL
int rl_completion_type = 0
int rl_completion_query_items = 100
char * rl_special_prefixes = (char*) NULL
int rl_completion_append_character = ' '
static int grl_complete_show_all = 0
static HistoryFcns_tgHistory = NULL
static EditLine_tgEditLine = NULL
static int gel_rl_complete_cmdnum = 0
static char * gel_rl_prompt = NULL


Define Documentation

#define GDB_411_HACK

Definition at line 72 of file readline.cxx.

#define TAB   '\r'

Definition at line 69 of file readline.cxx.

Referenced by rl_complete().


Function Documentation

static unsigned char _el_rl_complete ( EditLine_t ,
int   
) [static]

Definition at line 1532 of file readline.cxx.

References rl_complete().

Referenced by rl_initialize().

static char * _get_prompt ( EditLine_t  )  [static]

Definition at line 158 of file readline.cxx.

References gel_rl_prompt.

Referenced by rl_initialize().

static int _history_search_gen ( const char *  ,
int  ,
int   
) [static]

Definition at line 1262 of file readline.cxx.

References HistEvent_t::fNum, HistEvent_t::fStr, gHistory, H_CURR, H_NEXT, H_PREV, history(), and if().

Referenced by history_search(), and history_search_prefix().

static HIST_ENTRY * _move_history ( int   )  [static]

Definition at line 167 of file readline.cxx.

References HistEvent_t::fStr, gHistory, history(), and NULL.

Referenced by current_history(), next_history(), and previous_history().

static int _rl_qsort_string_compare ( const void *  ,
const void *   
) [static]

Definition at line 1599 of file readline.cxx.

References s1, s2, and strcasecmp.

Referenced by rl_display_match_list().

int add_history ( char *  line  ) 

Definition at line 1111 of file readline.cxx.

References HistEvent_t::fNum, gEditLine, gHistory, H_ENTER, H_GETSIZE, history(), history_length, NULL, rl_initialize(), and size_t.

void clear_history ( void   ) 

Definition at line 1144 of file readline.cxx.

References gHistory, H_CLEAR, and history().

char** completion_matches ( const char *  text,
CPFunction genfunc 
)

Definition at line 1541 of file readline.cxx.

References gEditLine, gHistory, malloc(), NULL, realloc(), rl_initialize(), and size_t.

Referenced by rl_complete_internal().

HIST_ENTRY* current_history ( void   ) 

Definition at line 1178 of file readline.cxx.

References _move_history(), and H_CURR.

EditLine_t* el_readline_el (  ) 

Added by stephan@s11n.net: returns the editline object associated with the readline compatibility interface, to allow clients to customize that object further.

Definition at line 1939 of file readline.cxx.

References gEditLine, NULL, and rl_initialize().

char* filename_completion_function ( const char *  text,
int  state 
)

Definition at line 1403 of file readline.cxx.

References closedir, dir(), entry, free(), malloc(), NULL, opendir, readdir, realloc(), S_ISDIR, size_t, sprintf(), stat, strcat(), strcpy(), and tilde_expand().

Referenced by rl_complete_internal().

HIST_ENTRY* history_get ( int  num  ) 

Definition at line 1070 of file readline.cxx.

References HistEvent_t::fNum, HistEvent_t::fStr, gEditLine, gHistory, H_CURR, H_FIRST, H_LAST, H_NEXT_EVENT, H_PREV, history(), NULL, and rl_initialize().

int history_is_stifled ( void   ) 

Definition at line 1030 of file readline.cxx.

References max_input_history.

int history_search ( const char *  str,
int  direction 
)

Definition at line 1294 of file readline.cxx.

References _history_search_gen().

int history_search_pos ( const char *  str,
int  ,
int  pos 
)

Definition at line 1314 of file readline.cxx.

References HistEvent_t::fNum, HistEvent_t::fStr, gHistory, H_CURR, H_NEXT, H_PREV, history(), and history_set_pos().

int history_search_prefix ( const char *  str,
int  direction 
)

Definition at line 1303 of file readline.cxx.

References _history_search_gen().

int history_set_pos ( int  pos  ) 

Definition at line 1215 of file readline.cxx.

References HistEvent_t::fNum, gHistory, H_CURR, H_FIRST, H_NEXT, H_NEXT_EVENT, history(), and history_length.

Referenced by history_search_pos().

char** history_tokenize ( const char *  str  ) 

Definition at line 955 of file readline.cxx.

References malloc(), NULL, realloc(), and size_t.

int history_total_bytes ( void   ) 

Definition at line 1187 of file readline.cxx.

References HistEvent_t::fNum, HistEvent_t::fStr, gHistory, H_CURR, H_FIRST, H_NEXT, H_PREV_EVENT, and history().

HIST_ENTRY* next_history ( void   ) 

Definition at line 1253 of file readline.cxx.

References _move_history(), and H_NEXT.

HIST_ENTRY* previous_history ( void   ) 

Definition at line 1244 of file readline.cxx.

References _move_history(), and H_PREV.

int read_history ( const char *  filename  ) 

Definition at line 1040 of file readline.cxx.

References gEditLine, gHistory, H_LOAD, history(), NULL, and rl_initialize().

char* readline ( const char *  prompt,
bool  newline 
)

Definition at line 320 of file readline.cxx.

References el_gets(), el_gets_newline(), ElLine_t::fBuffer, ElLine_t::fLastChar, EditLine_t::fLine, HistEvent_t::fNum, free(), gEditLine, gel_rl_prompt, gHistory, H_GETSIZE, history(), history_length, NULL, rl_in_key_hook, rl_initialize(), tty_cookedmode(), and tty_rawmode().

int rl_bind_key ( int  c,
int   func(int, int) 
)

Definition at line 1870 of file readline.cxx.

References ED_INSERT, ElMap_t::fKey, EditLine_t::fMap, func(), gEditLine, gHistory, NULL, rl_initialize(), and rl_insert().

void rl_cleanup_after_signal (  ) 

Definition at line 304 of file readline.cxx.

References el_end(), gEditLine, gHistory, and history_end().

int rl_complete ( int  ignore,
int  invoking_key 
)

Definition at line 1844 of file readline.cxx.

References CC_REFRESH, ElState_t::fLastCmd, EditLine_t::fState, gEditLine, gel_rl_complete_cmdnum, gHistory, grl_complete_show_all, NULL, rl_complete_internal(), rl_inhibit_completion, rl_initialize(), rl_insert(), and TAB.

Referenced by _el_rl_complete().

static int rl_complete_internal ( int   )  [static]

Definition at line 1663 of file readline.cxx.

References alloca(), buf, CC_NORM, CC_REDISPLAY, CC_REFRESH, completion_matches(), el_beep(), el_deletestr(), el_insertstr(), el_line(), ElLine_t::fBufColor, LineInfo_t::fBuffer, ElLine_t::fBuffer, LineInfo_t::fCursor, ElLine_t::fCursor, fflush(), filename_completion_function(), LineInfo_t::fLastChar, ElLine_t::fLastChar, EditLine_t::fLine, EditLine_t::fOutFile, fprintf(), free(), gEditLine, gHistory, int, NULL, re_clear_display(), re_refresh(), rl_attempted_completion_function, rl_basic_word_break_characters, rl_completion_append_character, rl_completion_entry_function, rl_completion_query_items, rl_completion_type, rl_display_match_list(), rl_end, rl_initialize(), rl_point, rl_special_prefixes, rl_tab_hook, size_t, tab_color, term__resetcolor(), and term__setcolor().

Referenced by rl_complete().

void rl_display_match_list ( char **  matches,
int  len,
int  max 
)

Definition at line 1615 of file readline.cxx.

References _rl_qsort_string_compare(), ElCoord_t::fH, EditLine_t::fOutFile, fprintf(), ElTerm_t::fSize, EditLine_t::fTerm, gEditLine, and size_t.

Referenced by rl_complete_internal().

int rl_eof ( void   ) 

Definition at line 1948 of file readline.cxx.

References el_eof(), and gEditLine.

Referenced by Gl_eof().

int rl_initialize ( void   ) 

Definition at line 195 of file readline.cxx.

References _el_rl_complete(), _get_prompt(), EL_ADDFN, EL_BIND, EL_EDITMODE, EL_EDITOR, el_end(), EL_HIST, el_init(), EL_NUM_FCNS, EL_PROMPT, el_set(), EL_SIGNAL, ElMap_t::fFunc, EditLine_t::fMap, ElMap_t::fNFunc, gEditLine, gel_rl_complete_cmdnum, gel_rl_prompt, gHistory, H_SETSIZE, history(), history_end(), history_init(), history_length, i, max_input_history, NULL, rl_instream, rl_outstream, and rl_readline_name.

Referenced by add_history(), completion_matches(), el_func_readline_reinit(), el_readline_el(), history_get(), read_history(), readline(), rl_bind_key(), rl_complete(), rl_complete_internal(), rl_insert(), rl_read_key(), rl_reset_terminal(), stifle_history(), using_history(), and write_history().

int rl_insert ( int  count,
int  c 
)

Definition at line 1919 of file readline.cxx.

References el_push(), gEditLine, gHistory, NULL, and rl_initialize().

Referenced by rl_bind_key(), and rl_complete().

bool rl_isinitialized (  ) 

Definition at line 183 of file readline.cxx.

References gEditLine, and NULL.

int rl_read_key ( void   ) 

Definition at line 1891 of file readline.cxx.

References el_getc(), gEditLine, gHistory, int, NULL, and rl_initialize().

void rl_reset_terminal ( void   ) 

Definition at line 1907 of file readline.cxx.

References el_reset(), gEditLine, gHistory, NULL, and rl_initialize().

void setColors ( const char *  colorTab,
const char *  colorTabComp,
const char *  colorBracket,
const char *  colorBadBracket,
const char *  colorPrompt 
)

Definition at line 380 of file readline.cxx.

References prompt_setcolor(), setKeywordColors(), tab_color, and term__atocolor().

Referenced by Gl_setColors().

void setEcho ( bool  echo  ) 

Definition at line 399 of file readline.cxx.

References gEditLine, tty_noquotemode(), and tty_quotemode().

void stifle_history ( int  max  ) 

Definition at line 1001 of file readline.cxx.

References gEditLine, gHistory, H_SETSIZE, history(), max_input_history, NULL, and rl_initialize().

void termResize ( void   ) 

Definition at line 393 of file readline.cxx.

References el_resize(), and gEditLine.

char* tilde_expand ( char *  txt  ) 

Definition at line 1358 of file readline.cxx.

References free(), malloc(), NULL, passwd::pw_dir, size_t, and sprintf().

Referenced by filename_completion_function().

int unstifle_history ( void   ) 

Definition at line 1018 of file readline.cxx.

References gHistory, H_SETSIZE, history(), and max_input_history.

char* username_completion_function ( const char *  text,
int  state 
)

Definition at line 1500 of file readline.cxx.

References NULL, and pwd().

void using_history ( void   ) 

Definition at line 417 of file readline.cxx.

References gEditLine, gHistory, NULL, and rl_initialize().

int where_history ( void   ) 

Definition at line 1155 of file readline.cxx.

References HistEvent_t::fNum, gHistory, H_CURR, H_FIRST, H_NEXT, and history().

int write_history ( const char *  filename  ) 

Definition at line 1054 of file readline.cxx.

References gEditLine, gHistory, H_SAVE, history(), NULL, and rl_initialize().


Variable Documentation

EditLine_t* gEditLine = NULL [static]

Definition at line 135 of file readline.cxx.

Referenced by add_history(), completion_matches(), el_readline_el(), history_get(), read_history(), readline(), rl_bind_key(), rl_cleanup_after_signal(), rl_complete(), rl_complete_internal(), rl_display_match_list(), rl_eof(), rl_initialize(), rl_insert(), rl_isinitialized(), rl_read_key(), rl_reset_terminal(), setEcho(), stifle_history(), termResize(), using_history(), and write_history().

int gel_rl_complete_cmdnum = 0 [static]

Definition at line 136 of file readline.cxx.

Referenced by rl_complete(), and rl_initialize().

char* gel_rl_prompt = NULL [static]

Definition at line 154 of file readline.cxx.

Referenced by _get_prompt(), readline(), and rl_initialize().

HistoryFcns_t* gHistory = NULL [static]

Definition at line 134 of file readline.cxx.

Referenced by _history_search_gen(), _move_history(), add_history(), clear_history(), completion_matches(), history_get(), history_search_pos(), history_set_pos(), history_total_bytes(), read_history(), readline(), rl_bind_key(), rl_cleanup_after_signal(), rl_complete(), rl_complete_internal(), rl_initialize(), rl_insert(), rl_read_key(), rl_reset_terminal(), stifle_history(), unstifle_history(), using_history(), where_history(), and write_history().

int grl_complete_show_all = 0 [static]

Definition at line 132 of file readline.cxx.

Referenced by rl_complete().

int history_base = 1

Definition at line 84 of file readline.cxx.

char history_expansion_char = '!'

Definition at line 87 of file readline.cxx.

Function* history_inhibit_expansion_function = NULL

Definition at line 90 of file readline.cxx.

int history_length = 0

Definition at line 85 of file readline.cxx.

Referenced by add_history(), history_set_pos(), readline(), and rl_initialize().

const char* history_no_expand_chars = " \t\n=("

Definition at line 89 of file readline.cxx.

char history_subst_char = '^'

Definition at line 88 of file readline.cxx.

int max_input_history = 0

Definition at line 86 of file readline.cxx.

Referenced by history_is_stifled(), rl_initialize(), stifle_history(), and unstifle_history().

CPPFunction* rl_attempted_completion_function = NULL

Definition at line 98 of file readline.cxx.

Referenced by rl_complete_internal().

int rl_attempted_completion_over = 0

Definition at line 93 of file readline.cxx.

const char* rl_basic_word_break_characters = " \t\n\"\\'`@$><=;|&{("

Definition at line 94 of file readline.cxx.

Referenced by rl_complete_internal().

char* rl_completer_quote_characters = NULL

Definition at line 96 of file readline.cxx.

char* rl_completer_word_break_characters = NULL

Definition at line 95 of file readline.cxx.

int rl_completion_append_character = ' '

Definition at line 127 of file readline.cxx.

Referenced by rl_complete_internal().

CPFunction* rl_completion_entry_function = NULL

Definition at line 97 of file readline.cxx.

Referenced by rl_complete_internal().

int rl_completion_query_items = 100

Definition at line 114 of file readline.cxx.

Referenced by rl_complete_internal().

int rl_completion_type = 0

Definition at line 108 of file readline.cxx.

Referenced by rl_complete_internal().

int rl_end = 0

Definition at line 81 of file readline.cxx.

Referenced by rl_complete_internal().

El_in_key_hook_t rl_in_key_hook = NULL

Definition at line 101 of file readline.cxx.

Referenced by readline().

int rl_inhibit_completion = 0

Definition at line 92 of file readline.cxx.

Referenced by rl_complete().

FILE* rl_instream = NULL

Definition at line 78 of file readline.cxx.

Referenced by rl_initialize().

const char* rl_library_version = "EditLine_t wrapper"

Definition at line 76 of file readline.cxx.

char* rl_line_buffer = NULL

Definition at line 82 of file readline.cxx.

FILE* rl_outstream = NULL

Definition at line 79 of file readline.cxx.

Referenced by rl_initialize().

int rl_point = 0

Definition at line 80 of file readline.cxx.

Referenced by rl_complete_internal().

const char* rl_readline_name = ""

Definition at line 77 of file readline.cxx.

Referenced by rl_initialize().

char* rl_special_prefixes = (char*) NULL

Definition at line 121 of file readline.cxx.

Referenced by rl_complete_internal().

El_tab_hook_t rl_tab_hook = NULL

Definition at line 100 of file readline.cxx.

int tab_color = 5

Definition at line 99 of file readline.cxx.

Referenced by rl_complete_internal(), and setColors().


Generated on Tue Jul 5 15:57:25 2011 for ROOT_528-00b_version by  doxygen 1.5.1