Getline.c File Reference

#include <string.h>
#include <ctype.h>
#include <errno.h>
#include <signal.h>
#include <stdlib.h>
#include <stdio.h>

Go to the source code of this file.

Defines

#define BUF_SIZE   1024
#define HIST_SIZE   500
#define HIST_SAVE   400

Functions

static int gl_tab (char *buf, int offset, int *loc)
char * Getline (const char *prompt)
char * Getlinem (int mode, const char *prompt)
void Gl_config (const char *which, int value)
void Gl_setwidth (int w)
void Gl_windowchanged ()
void Gl_histinit (char *file)
void Gl_histadd (char *buf)
static void gl_init ()
static void gl_cleanup ()
static void gl_char_init ()
static void gl_char_cleanup ()
static void gl_addchar (int c)
static void gl_del (int loc)
static void gl_error (char *buf)
static void gl_fixup (const char *p, int c, int cur)
static int gl_getc ()
static void gl_kill ()
static void gl_newline ()
static void gl_putc (int c)
static void gl_puts (const char *buf)
static void gl_redraw ()
static void gl_transpose ()
static void gl_yank ()
static int is_whitespace (char c)
static void gl_back_1_word ()
static void gl_kill_1_word ()
static void gl_kill_back_1_word ()
static void gl_kill_region (int i, int j)
static void gl_fwd_1_word ()
static void gl_set_mark ()
static void gl_exch ()
static void gl_wipe ()
static void hist_init ()
static char * hist_next ()
static char * hist_prev ()
static char * hist_save (char *p)
static void search_addchar (int c)
static void search_term ()
static void search_back (int s)
static void search_forw (int s)
int Gl_eof ()
static void setCursorPosition (int x)
void Gl_histsize (int size, int save)
static void search_update (int c)

Variables

int(*) Gl_in_hook (char *buf)=0
int(*) Gl_out_hook (char *buf)=0
int(*) Gl_tab_hook (char *buf, int prompt_width, int *loc) = gl_tab
int(*) Gl_beep_hook ()=0
int(*) Gl_in_key (int ch)=0
static int gl_init_done = -1
static int gl_notty = 0
static int gl_eof = 0
static int gl_termw = 80
static int gl_scroll = 27
static int gl_width = 0
static int gl_extent = 0
static int gl_overwrite = 0
static int gl_no_echo = 0
static int gl_passwd = 0
static int gl_erase_line = 0
static int gl_pos
static int gl_cnt = 0
static char gl_buf [BUF_SIZE]
static char gl_killbuf [BUF_SIZE] = ""
static const char * gl_prompt
static char gl_intrc = 0
static char gl_quitc = 0
static char gl_suspc = 0
static char gl_dsuspc = 0
static int gl_search_mode = 0
static int gl_savehist = 0
static char gl_histfile [256]
static int gl_mark = -1
static int hist_pos = 0
static int hist_last = 0
static int num_hist_size = HIST_SIZE
static int num_hist_save = HIST_SAVE
static char ** hist_buf = 0
static char search_prompt [101]
static char search_string [100]
static int search_pos = 0
static int search_forw_flg = 0
static int search_last = 0


Define Documentation

#define BUF_SIZE   1024

Definition at line 261 of file Getline.c.

Referenced by TTabCom::Complete(), Getlinem(), gl_addchar(), gl_fixup(), gl_newline(), and gl_yank().

#define HIST_SAVE   400

Definition at line 1347 of file Getline.c.

#define HIST_SIZE   500

Definition at line 1344 of file Getline.c.


Function Documentation

char* Getline ( const char *  prompt  ) 

char * Getlinem ( int  mode,
const char *  prompt 
)

Definition at line 765 of file Getline.c.

References BUF_SIZE, c, gl_addchar(), gl_back_1_word(), gl_buf, gl_cleanup(), gl_cnt, Gl_config(), gl_del(), gl_dsuspc, gl_eof, gl_exch(), gl_extent, gl_fixup(), gl_fwd_1_word(), gl_getc(), Gl_in_hook, Gl_in_key, gl_init(), gl_intrc, gl_kill(), gl_kill_1_word(), gl_kill_back_1_word(), gl_newline(), gl_notty, gl_overwrite, gl_pos, gl_prompt, gl_putc(), gl_quitc, gl_redraw(), gl_search_mode, gl_set_mark(), gl_suspc, Gl_tab_hook, gl_transpose(), gl_wipe(), gl_yank(), hist_next(), hist_prev(), NULL, search_addchar(), search_back(), search_forw(), search_term(), and strcpy().

static void gl_addchar ( int  c  )  [static]

Definition at line 1025 of file Getline.c.

References BUF_SIZE, gl_buf, gl_cnt, gl_error(), gl_extent, gl_fixup(), gl_overwrite, gl_pos, gl_prompt, and i.

Referenced by Getlinem().

static void gl_back_1_word (  )  [static]

Definition at line 1746 of file Getline.c.

References gl_buf, gl_fixup(), gl_pos, gl_prompt, i, and is_whitespace().

Referenced by Getlinem().

static void gl_char_cleanup (  )  [static]

Definition at line 479 of file Getline.c.

References gl_notty, and void.

Referenced by gl_cleanup().

static void gl_char_init (  )  [static]

Definition at line 411 of file Getline.c.

References gl_dsuspc, gl_intrc, gl_notty, gl_quitc, gl_suspc, IEXTEN, and void.

Referenced by gl_init().

static void gl_cleanup (  )  [static]

Definition at line 721 of file Getline.c.

References gl_char_cleanup(), and gl_init_done.

Referenced by Getlinem(), and gl_error().

void Gl_config ( const char *  which,
int  value 
)

static void gl_del ( int  loc  )  [static]

Definition at line 1127 of file Getline.c.

References gl_buf, gl_cnt, gl_fixup(), gl_pos, gl_prompt, gl_putc(), and i.

Referenced by Getlinem().

int Gl_eof (  ) 

Definition at line 1013 of file Getline.c.

References gl_eof.

static void gl_error ( char *  buf  )  [static]

Definition at line 689 of file Getline.c.

References free(), gl_cleanup(), len, malloc(), and write.

Referenced by gl_addchar(), gl_newline(), Gl_setwidth(), gl_yank(), and hist_save().

static void gl_exch (  )  [static]

Definition at line 1899 of file Getline.c.

References gl_fixup(), gl_mark, gl_pos, and gl_prompt.

Referenced by Getlinem().

static void gl_fixup ( const char *  p,
int  c,
int  cur 
) [static]

Definition at line 1188 of file Getline.c.

References BUF_SIZE, extra, gl_buf, gl_cnt, gl_extent, gl_no_echo, gl_passwd, gl_pos, gl_putc(), gl_puts(), gl_scroll, gl_termw, gl_width, i, setCursorPosition(), and strcpy().

Referenced by Getlinem(), gl_addchar(), gl_back_1_word(), gl_del(), gl_exch(), gl_fwd_1_word(), gl_kill(), gl_kill_1_word(), gl_newline(), gl_redraw(), gl_transpose(), gl_wipe(), gl_yank(), search_addchar(), search_back(), search_forw(), and search_term().

static void gl_fwd_1_word (  )  [static]

Definition at line 1843 of file Getline.c.

References gl_buf, gl_cnt, gl_fixup(), gl_pos, gl_prompt, i, and is_whitespace().

Referenced by Getlinem().

static int gl_getc (  )  [static]

Definition at line 555 of file Getline.c.

References c, read, and void.

Referenced by Getlinem().

void Gl_histadd ( char *  buf  ) 

void Gl_histinit ( char *  file  ) 

void Gl_histsize ( int  size,
int  save 
)

Definition at line 1372 of file Getline.c.

static void gl_init (  )  [static]

Definition at line 708 of file Getline.c.

References gl_char_init(), gl_init_done, gl_notty, and hist_init().

Referenced by Getlinem().

static void gl_kill (  )  [static]

Definition at line 1145 of file Getline.c.

References gl_buf, gl_cnt, gl_fixup(), gl_killbuf, gl_pos, gl_prompt, gl_putc(), and strcpy().

Referenced by Getlinem().

static void gl_kill_1_word (  )  [static]

Definition at line 1793 of file Getline.c.

References gl_buf, gl_cnt, gl_fixup(), gl_kill_region(), gl_pos, gl_prompt, i, is_whitespace(), and j.

Referenced by Getlinem().

static void gl_kill_back_1_word (  )  [static]

Definition at line 1773 of file Getline.c.

References gl_buf, gl_mark, gl_pos, gl_wipe(), i, and is_whitespace().

Referenced by Getlinem().

static void gl_kill_region ( int  i,
int  j 
) [static]

Definition at line 1827 of file Getline.c.

References gl_buf, gl_cnt, and gl_killbuf.

Referenced by gl_kill_1_word(), and gl_wipe().

static void gl_newline (  )  [static]

Definition at line 1093 of file Getline.c.

References BUF_SIZE, gl_buf, gl_cnt, gl_erase_line, gl_error(), gl_fixup(), gl_mark, Gl_out_hook, gl_prompt, gl_putc(), gl_width, and len.

Referenced by Getlinem().

static void gl_putc ( int  c  )  [static]

Definition at line 641 of file Getline.c.

References Gl_beep_hook, gl_notty, gl_passwd, and write.

Referenced by Getlinem(), gl_del(), gl_fixup(), gl_kill(), gl_newline(), gl_redraw(), gl_transpose(), gl_yank(), hist_next(), hist_prev(), search_back(), search_forw(), and search_update().

static void gl_puts ( const char *  buf  )  [static]

Definition at line 671 of file Getline.c.

References free(), gl_notty, len, malloc(), and write.

Referenced by gl_fixup().

static void gl_redraw (  )  [static]

Definition at line 1157 of file Getline.c.

References gl_fixup(), gl_init_done, gl_pos, gl_prompt, and gl_putc().

Referenced by Getlinem().

static void gl_set_mark (  )  [static]

Definition at line 1872 of file Getline.c.

References gl_mark, and gl_pos.

Referenced by Getlinem().

void Gl_setwidth ( int  w  ) 

static int gl_tab ( char *  buf,
int  offset,
int *  loc 
) [static]

Definition at line 1325 of file Getline.c.

References i, and len.

static void gl_transpose (  )  [static]

Definition at line 1077 of file Getline.c.

References gl_buf, gl_cnt, gl_extent, gl_fixup(), gl_pos, gl_prompt, and gl_putc().

Referenced by Getlinem().

void Gl_windowchanged (  ) 

static void gl_wipe (  )  [static]

Definition at line 1878 of file Getline.c.

References gl_fixup(), gl_kill_region(), gl_mark, gl_pos, and gl_prompt.

Referenced by Getlinem(), and gl_kill_back_1_word().

static void gl_yank (  )  [static]

Definition at line 1045 of file Getline.c.

References BUF_SIZE, gl_buf, gl_cnt, gl_error(), gl_extent, gl_fixup(), gl_killbuf, gl_mark, gl_overwrite, gl_pos, gl_prompt, gl_putc(), i, and len.

Referenced by Getlinem().

static void hist_init (  )  [static]

Definition at line 1355 of file Getline.c.

References i, and malloc().

Referenced by el_init(), Gl_histinit(), and gl_init().

static char * hist_next (  )  [static]

Definition at line 1516 of file Getline.c.

References gl_putc(), hist_last, and p.

Referenced by Getlinem(), and search_forw().

static char * hist_prev (  )  [static]

Definition at line 1494 of file Getline.c.

References gl_putc(), hist_last, and p.

Referenced by Getlinem(), and search_back().

static char * hist_save ( char *  p  )  [static]

Definition at line 1533 of file Getline.c.

References gl_error(), len, malloc(), s, and strcpy().

Referenced by ClassImp(), and Gl_histadd().

static int is_whitespace ( char  c  )  [static]

Definition at line 1862 of file Getline.c.

Referenced by gl_back_1_word(), gl_fwd_1_word(), gl_kill_1_word(), and gl_kill_back_1_word().

static void search_addchar ( int  c  )  [static]

Definition at line 1595 of file Getline.c.

References gl_buf, gl_fixup(), hist_last, search_back(), search_forw(), search_update(), and strcpy().

Referenced by Getlinem().

static void search_back ( int  s  )  [static]

Definition at line 1634 of file Getline.c.

References gl_buf, gl_fixup(), gl_putc(), gl_search_mode, hist_last, hist_prev(), p, search_update(), and strcpy().

Referenced by Getlinem(), and search_addchar().

static void search_forw ( int  s  )  [static]

Definition at line 1667 of file Getline.c.

References gl_buf, gl_fixup(), gl_putc(), gl_search_mode, hist_last, hist_next(), p, search_update(), and strcpy().

Referenced by Getlinem(), and search_addchar().

static void search_term (  )  [static]

Definition at line 1623 of file Getline.c.

References gl_buf, gl_fixup(), Gl_in_hook, gl_pos, gl_prompt, gl_search_mode, and hist_last.

Referenced by Getlinem().

static void search_update ( int  c  )  [static]

Definition at line 1564 of file Getline.c.

References gl_putc(), and hist_last.

Referenced by search_addchar(), search_back(), and search_forw().

static void setCursorPosition ( int  x  )  [static]

Definition at line 1166 of file Getline.c.

References HANDLE, INVALID_HANDLE_VALUE, out, and TRUE.

Referenced by gl_fixup().


Variable Documentation

int(*) Gl_beep_hook()=0

Definition at line 247 of file Getline.c.

char gl_buf[BUF_SIZE] [static]

Definition at line 275 of file Getline.c.

Referenced by Getlinem(), gl_addchar(), gl_back_1_word(), gl_del(), gl_fixup(), gl_fwd_1_word(), gl_kill(), gl_kill_1_word(), gl_kill_back_1_word(), gl_kill_region(), gl_newline(), gl_transpose(), gl_yank(), search_addchar(), search_back(), search_forw(), and search_term().

int gl_cnt = 0 [static]

Definition at line 274 of file Getline.c.

Referenced by Getlinem(), gl_addchar(), gl_del(), gl_fixup(), gl_fwd_1_word(), gl_kill(), gl_kill_1_word(), gl_kill_region(), gl_newline(), gl_transpose(), and gl_yank().

char gl_dsuspc = 0 [static]

Definition at line 281 of file Getline.c.

Referenced by Getlinem(), and gl_char_init().

int gl_eof = 0 [static]

Definition at line 265 of file Getline.c.

Referenced by Getlinem(), and Gl_eof().

int gl_erase_line = 0 [static]

Definition at line 273 of file Getline.c.

Referenced by Gl_config(), and gl_newline().

int gl_extent = 0 [static]

Definition at line 269 of file Getline.c.

Referenced by Getlinem(), gl_addchar(), gl_fixup(), gl_transpose(), and gl_yank().

char gl_histfile[256] [static]

Definition at line 284 of file Getline.c.

Referenced by Gl_histadd(), and Gl_histinit().

int(*) Gl_in_hook(char *buf)=0

Definition at line 244 of file Getline.c.

int(*) Gl_in_key(int ch)=0

Definition at line 248 of file Getline.c.

int gl_init_done = -1 [static]

Definition at line 263 of file Getline.c.

Referenced by gl_cleanup(), gl_init(), and gl_redraw().

char gl_intrc = 0 [static]

Definition at line 278 of file Getline.c.

Referenced by Getlinem(), and gl_char_init().

char gl_killbuf[BUF_SIZE] = "" [static]

Definition at line 276 of file Getline.c.

Referenced by gl_kill(), gl_kill_region(), and gl_yank().

int gl_mark = -1 [static]

Definition at line 313 of file Getline.c.

Referenced by gl_exch(), gl_kill_back_1_word(), gl_newline(), gl_set_mark(), gl_wipe(), and gl_yank().

int gl_no_echo = 0 [static]

Definition at line 271 of file Getline.c.

Referenced by Gl_config(), and gl_fixup().

int gl_notty = 0 [static]

Definition at line 264 of file Getline.c.

Referenced by Getlinem(), gl_char_cleanup(), gl_char_init(), gl_init(), gl_putc(), and gl_puts().

int(*) Gl_out_hook(char *buf)=0

Definition at line 245 of file Getline.c.

int gl_overwrite = 0 [static]

Definition at line 270 of file Getline.c.

Referenced by Getlinem(), gl_addchar(), and gl_yank().

int gl_passwd = 0 [static]

Definition at line 272 of file Getline.c.

Referenced by gl_fixup(), and gl_putc().

int gl_pos [static]

Definition at line 274 of file Getline.c.

Referenced by Getlinem(), gl_addchar(), gl_back_1_word(), gl_del(), gl_exch(), gl_fixup(), gl_fwd_1_word(), gl_kill(), gl_kill_1_word(), gl_kill_back_1_word(), gl_redraw(), gl_set_mark(), gl_transpose(), gl_wipe(), gl_yank(), and search_term().

const char* gl_prompt [static]

Definition at line 277 of file Getline.c.

Referenced by Getlinem(), gl_addchar(), gl_back_1_word(), gl_del(), gl_exch(), gl_fwd_1_word(), gl_kill(), gl_kill_1_word(), gl_newline(), gl_redraw(), gl_transpose(), gl_wipe(), gl_yank(), and search_term().

char gl_quitc = 0 [static]

Definition at line 279 of file Getline.c.

Referenced by Getlinem(), and gl_char_init().

int gl_savehist = 0 [static]

Definition at line 283 of file Getline.c.

Referenced by Gl_histadd(), and Gl_histinit().

int gl_scroll = 27 [static]

Definition at line 267 of file Getline.c.

Referenced by gl_fixup(), and Gl_setwidth().

int gl_search_mode = 0 [static]

Definition at line 282 of file Getline.c.

Referenced by Getlinem(), search_back(), search_forw(), and search_term().

char gl_suspc = 0 [static]

Definition at line 280 of file Getline.c.

Referenced by Getlinem(), and gl_char_init().

int(*) Gl_tab_hook(char *buf, int prompt_width, int *loc) = gl_tab

Definition at line 246 of file Getline.c.

int gl_termw = 80 [static]

Definition at line 266 of file Getline.c.

Referenced by gl_fixup(), and Gl_setwidth().

int gl_width = 0 [static]

Definition at line 268 of file Getline.c.

Referenced by gl_fixup(), and gl_newline().

char** hist_buf = 0 [static]

Definition at line 1352 of file Getline.c.

int hist_last = 0 [static]

Definition at line 1350 of file Getline.c.

Referenced by Gl_histadd(), hist_next(), hist_prev(), search_addchar(), search_back(), search_forw(), search_term(), and search_update().

int hist_pos = 0 [static]

Definition at line 1350 of file Getline.c.

int num_hist_save = HIST_SAVE [static]

Definition at line 1351 of file Getline.c.

int num_hist_size = HIST_SIZE [static]

Definition at line 1351 of file Getline.c.

int search_forw_flg = 0 [static]

Definition at line 1560 of file Getline.c.

int search_last = 0 [static]

Definition at line 1561 of file Getline.c.

int search_pos = 0 [static]

Definition at line 1559 of file Getline.c.

char search_prompt[101] [static]

Definition at line 1557 of file Getline.c.

char search_string[100] [static]

Definition at line 1558 of file Getline.c.


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