#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 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().
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] |
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().
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] |
void Gl_histadd | ( | char * | buf | ) |
void Gl_histinit | ( | char * | file | ) |
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] |
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] |
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] |
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().
int(*) Gl_beep_hook()=0 |
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] |
int gl_eof = 0 [static] |
int gl_erase_line = 0 [static] |
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] |
int(*) Gl_in_hook(char *buf)=0 |
int gl_init_done = -1 [static] |
char gl_intrc = 0 [static] |
char gl_killbuf[BUF_SIZE] = "" [static] |
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] |
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 |
int gl_overwrite = 0 [static] |
int gl_passwd = 0 [static] |
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] |
int gl_savehist = 0 [static] |
int gl_scroll = 27 [static] |
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] |
int(*) Gl_tab_hook(char *buf, int prompt_width, int *loc) = gl_tab |
int gl_termw = 80 [static] |
int gl_width = 0 [static] |
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 num_hist_save = HIST_SAVE [static] |
int num_hist_size = HIST_SIZE [static] |
int search_forw_flg = 0 [static] |
int search_last = 0 [static] |
int search_pos = 0 [static] |
char search_prompt[101] [static] |
char search_string[100] [static] |