Edinburgh Speech Tools  2.1-release
editline.c File Reference
#include "editline.h"
#include "EST_unix.h"
#include <ctype.h>
Include dependency graph for editline.c:

Go to the source code of this file.

Macros

#define SCREEN_WIDTH   80
 
#define SCREEN_ROWS   24
 
#define NO_ARG   (-1)
 
#define DEL   127
 
#define ESC   0x1b
 
#define CTL(x)   (char)((x) & 0x1F)
 
#define ISCTL(x)   ((x) && (x) < ' ')
 
#define UNCTL(x)   (char)((x) + 64)
 
#define META(x)   (char)((x) | 0x80)
 
#define ISMETA(x)   ((x) & 0x80)
 
#define UNMETA(x)   (char)((x) & 0x7F)
 

Enumerations

enum  CASE { TOupper, TOlower, TOcapitalize }
 

Functions

void TTYflush ()
 
STATIC void TTYput (ECHAR c)
 
STATIC void TTYputs (ECHAR *p)
 
STATIC void TTYshow (ECHAR c)
 
STATIC void TTYstring (ECHAR *p)
 
int TTYget ()
 
STATIC void TTYinfo ()
 
STATIC void print_columns (int ac, char **av)
 
STATIC void reposition (int reset)
 
STATIC void left (STATUS Change)
 
STATIC void right (STATUS Change)
 
STATIC STATUS ring_bell ()
 
STATIC STATUS do_forward (STATUS move)
 
STATIC STATUS do_case (ECHAR type)
 
STATIC STATUS case_down_word ()
 
STATIC STATUS case_up_word ()
 
STATIC void ceol ()
 
STATIC void clear_line ()
 
STATIC STATUS insert_string (ECHAR *p)
 
STATIC ECHARnext_hist ()
 
STATIC ECHARprev_hist ()
 
STATIC STATUS do_insert_hist (ECHAR *p)
 
STATIC STATUS do_hist (ECHAR *(*move)())
 
STATIC STATUS h_next ()
 
STATIC STATUS h_prev ()
 
STATIC STATUS h_first ()
 
STATIC STATUS h_last ()
 
STATIC int substrcmp (char *text, char *pat, int len)
 
STATIC ECHARsearch_hist (ECHAR *search, ECHAR *(*move)())
 
STATIC STATUS h_search ()
 
STATIC STATUS fd_char ()
 
STATIC void save_yank (int begin, int i)
 
STATIC STATUS delete_string (int count)
 
STATIC STATUS bk_char ()
 
STATIC STATUS bk_del_char ()
 
STATIC STATUS redisplay ()
 
STATIC STATUS kill_line ()
 
STATIC char * rsearch_hist (char *patt, int *lpos, int *cpos)
 
STATIC STATUS h_risearch ()
 
STATIC STATUS insert_char (int c)
 
STATIC STATUS meta ()
 
STATIC STATUS emacs (unsigned int c)
 
STATIC STATUS TTYspecial (int c)
 
STATIC ECHAReditinput ()
 
STATIC void hist_add (ECHAR *p)
 
STATIC STATUS beg_line ()
 
STATIC STATUS del_char ()
 
STATIC STATUS end_line ()
 
STATIC ECHARfind_word ()
 
STATIC STATUS c_complete ()
 
STATIC STATUS c_possible ()
 
STATIC STATUS accept_line ()
 
STATIC STATUS transpose ()
 
STATIC STATUS quote ()
 
STATIC STATUS wipe ()
 
STATIC STATUS mk_set ()
 
STATIC STATUS exchange ()
 
STATIC STATUS yank ()
 
STATIC STATUS copy_region ()
 
STATIC STATUS move_to_char ()
 
STATIC STATUS fd_word ()
 
STATIC STATUS fd_kill_word ()
 
STATIC STATUS bk_word ()
 
STATIC STATUS bk_kill_word ()
 
STATIC int argify (ECHAR *line, ECHAR ***avp)
 
STATIC STATUS last_argument ()
 
char * getenv ()
 
char * tgetstr ()
 
int tgetent ()
 
int tgetnum ()
 
STATIC int printlen (CONST char *p)
 
STATIC int screen_pos ()
 
STATIC void TTYback ()
 
STATIC STATUS case_cap_word ()
 
void write_history (const char *history_file)
 
void read_history (const char *history_file)
 
void rl_reset_terminal (char *p)
 
void rl_initialize ()
 
char * readline (CONST char *prompt)
 
void add_history (char *p)
 
void el_redisplay ()
 
char * el_current_sym ()
 
void el_bind_key_in_metamap (char c, Keymap_Function func)
 

Variables

int editline_histsize =256
 
char * editline_history_file
 
EL_USER_COMPLETION_FUNCTION_TYPEel_user_completion_function = NULL
 
int rl_eof
 
int rl_erase
 
int rl_intr
 
int rl_kill
 
ECHAR el_NIL [] = ""
 
CONST ECHARel_Input
 
STATIC ECHARLine = NULL
 
STATIC CONST char * Prompt = NULL
 
STATIC ECHARYanked = NULL
 
STATIC char * Screen = NULL
 
STATIC HISTORY H
 
int rl_quit
 
STATIC int Repeat
 
STATIC int End
 
STATIC int Mark
 
STATIC int OldPoint
 
STATIC int Point
 
int el_PushBack
 
int el_Pushed
 
FORWARD KEYMAP Map [33]
 
FORWARD KEYMAP MetaMap [64]
 
STATIC ESIZE_T Length
 
STATIC ESIZE_T ScreenCount
 
STATIC ESIZE_T ScreenSize
 
STATIC ECHARbackspace = NULL
 
STATIC ECHARupline = NULL
 
STATIC ECHARclrpage = NULL
 
STATIC ECHARdownline = NULL
 
STATIC ECHARmove_right = NULL
 
STATIC ECHARnewline = NULL
 
STATIC ECHARbol = NULL
 
STATIC ECHARnextline = NULL
 
STATIC int TTYwidth
 
STATIC int TTYrows
 
STATIC int RequireNLforWrap = 1
 
STATIC int el_intr_pending = 0
 
int el_no_echo = 0
 
int rl_meta_chars = 0
 

Macro Definition Documentation

#define SCREEN_WIDTH   80

Definition at line 62 of file editline.c.

#define SCREEN_ROWS   24

Definition at line 63 of file editline.c.

#define NO_ARG   (-1)

Definition at line 64 of file editline.c.

#define DEL   127

Definition at line 65 of file editline.c.

#define ESC   0x1b

Definition at line 66 of file editline.c.

#define CTL (   x)    (char)((x) & 0x1F)

Definition at line 67 of file editline.c.

#define ISCTL (   x)    ((x) && (x) < ' ')

Definition at line 68 of file editline.c.

#define UNCTL (   x)    (char)((x) + 64)

Definition at line 69 of file editline.c.

#define META (   x)    (char)((x) | 0x80)

Definition at line 70 of file editline.c.

#define ISMETA (   x)    ((x) & 0x80)

Definition at line 71 of file editline.c.

#define UNMETA (   x)    (char)((x) & 0x7F)

Definition at line 72 of file editline.c.

Enumeration Type Documentation

enum CASE
Enumerator
TOupper 
TOlower 
TOcapitalize 

Definition at line 84 of file editline.c.

Function Documentation

void TTYflush ( )

Definition at line 237 of file editline.c.

STATIC void TTYput ( ECHAR  c)

Definition at line 253 of file editline.c.

STATIC void TTYputs ( ECHAR p)

Definition at line 262 of file editline.c.

STATIC void TTYshow ( ECHAR  c)

Definition at line 268 of file editline.c.

STATIC void TTYstring ( ECHAR p)

Definition at line 287 of file editline.c.

int TTYget ( )

Definition at line 134 of file el_sys_unix.c.

STATIC void TTYinfo ( )

Definition at line 351 of file editline.c.

STATIC void print_columns ( int  ac,
char **  av 
)

Definition at line 435 of file editline.c.

STATIC void reposition ( int  reset)

Definition at line 483 of file editline.c.

STATIC void left ( STATUS  Change)

Definition at line 523 of file editline.c.

STATIC void right ( STATUS  Change)

Definition at line 538 of file editline.c.

STATIC STATUS ring_bell ( )

Definition at line 547 of file editline.c.

STATIC STATUS do_forward ( STATUS  move)

Definition at line 572 of file editline.c.

STATIC STATUS do_case ( ECHAR  type)

Definition at line 594 of file editline.c.

STATIC STATUS case_down_word ( )

Definition at line 626 of file editline.c.

STATIC STATUS case_up_word ( )

Definition at line 631 of file editline.c.

STATIC void ceol ( )

Definition at line 641 of file editline.c.

STATIC void clear_line ( )

Definition at line 682 of file editline.c.

STATIC STATUS insert_string ( ECHAR p)

Definition at line 701 of file editline.c.

STATIC ECHAR * next_hist ( )

Definition at line 749 of file editline.c.

STATIC ECHAR * prev_hist ( )

Definition at line 754 of file editline.c.

STATIC STATUS do_insert_hist ( ECHAR p)

Definition at line 759 of file editline.c.

STATIC STATUS do_hist ( ECHAR *(*)()  move)

Definition at line 773 of file editline.c.

STATIC STATUS h_next ( )

Definition at line 786 of file editline.c.

STATIC STATUS h_prev ( )

Definition at line 791 of file editline.c.

STATIC STATUS h_first ( )

Definition at line 796 of file editline.c.

STATIC STATUS h_last ( )

Definition at line 801 of file editline.c.

STATIC int substrcmp ( char *  text,
char *  pat,
int  len 
)

Definition at line 809 of file editline.c.

STATIC ECHAR * search_hist ( ECHAR search,
ECHAR *(*)()  move 
)

Definition at line 821 of file editline.c.

STATIC STATUS h_search ( )

Definition at line 859 of file editline.c.

STATIC STATUS fd_char ( )

Definition at line 884 of file editline.c.

STATIC void save_yank ( int  begin,
int  i 
)

Definition at line 897 of file editline.c.

STATIC STATUS delete_string ( int  count)

Definition at line 913 of file editline.c.

STATIC STATUS bk_char ( )

Definition at line 954 of file editline.c.

STATIC STATUS bk_del_char ( )

Definition at line 968 of file editline.c.

STATIC STATUS redisplay ( )

Definition at line 982 of file editline.c.

STATIC STATUS kill_line ( )

Definition at line 992 of file editline.c.

STATIC char * rsearch_hist ( char *  patt,
int lpos,
int cpos 
)

Definition at line 1017 of file editline.c.

STATIC STATUS h_risearch ( )

Definition at line 1037 of file editline.c.

STATIC STATUS insert_char ( int  c)

Definition at line 1115 of file editline.c.

STATIC STATUS meta ( )

Definition at line 1140 of file editline.c.

STATIC STATUS emacs ( unsigned int  c)

Definition at line 1182 of file editline.c.

STATIC STATUS TTYspecial ( int  c)

Definition at line 1203 of file editline.c.

STATIC ECHAR * editinput ( )

Definition at line 1239 of file editline.c.

STATIC void hist_add ( ECHAR p)

Definition at line 1278 of file editline.c.

STATIC STATUS beg_line ( )

Definition at line 1408 of file editline.c.

STATIC STATUS del_char ( )

Definition at line 1420 of file editline.c.

STATIC STATUS end_line ( )

Definition at line 1425 of file editline.c.

STATIC ECHAR * find_word ( )

Definition at line 1442 of file editline.c.

STATIC STATUS c_complete ( )

Definition at line 1560 of file editline.c.

STATIC STATUS c_possible ( )

Definition at line 1656 of file editline.c.

STATIC STATUS accept_line ( )

Definition at line 1681 of file editline.c.

STATIC STATUS transpose ( )

Definition at line 1695 of file editline.c.

STATIC STATUS quote ( )

Definition at line 1712 of file editline.c.

STATIC STATUS wipe ( )

Definition at line 1719 of file editline.c.

STATIC STATUS mk_set ( )

Definition at line 1736 of file editline.c.

STATIC STATUS exchange ( )

Definition at line 1742 of file editline.c.

STATIC STATUS yank ( )

Definition at line 1757 of file editline.c.

STATIC STATUS copy_region ( )

Definition at line 1764 of file editline.c.

STATIC STATUS move_to_char ( )

Definition at line 1777 of file editline.c.

STATIC STATUS fd_word ( )

Definition at line 1793 of file editline.c.

STATIC STATUS fd_kill_word ( )

Definition at line 1798 of file editline.c.

STATIC STATUS bk_word ( )

Definition at line 1814 of file editline.c.

STATIC STATUS bk_kill_word ( )

Definition at line 1834 of file editline.c.

STATIC int argify ( ECHAR line,
ECHAR ***  avp 
)

Definition at line 1842 of file editline.c.

STATIC STATUS last_argument ( )

Definition at line 1885 of file editline.c.

char* getenv ( )
char* tgetstr ( )
int tgetent ( )
int tgetnum ( )
STATIC int printlen ( CONST char *  p)

Definition at line 298 of file editline.c.

STATIC int screen_pos ( )

Definition at line 313 of file editline.c.

STATIC void TTYback ( )

Definition at line 332 of file editline.c.

STATIC STATUS case_cap_word ( )

Definition at line 636 of file editline.c.

void write_history ( const char *  history_file)

Definition at line 1296 of file editline.c.

void read_history ( const char *  history_file)

Definition at line 1313 of file editline.c.

void rl_reset_terminal ( char *  p)

Definition at line 1344 of file editline.c.

void rl_initialize ( )

Definition at line 1350 of file editline.c.

char* readline ( CONST char *  prompt)

Definition at line 1354 of file editline.c.

void add_history ( char *  p)

Definition at line 1395 of file editline.c.

void el_redisplay ( )

Definition at line 1459 of file editline.c.

char* el_current_sym ( )

Definition at line 1464 of file editline.c.

void el_bind_key_in_metamap ( char  c,
Keymap_Function  func 
)

Definition at line 1967 of file editline.c.

Variable Documentation

int editline_histsize =256

Definition at line 75 of file editline.c.

char* editline_history_file

Definition at line 76 of file editline.c.

EL_USER_COMPLETION_FUNCTION_TYPE* el_user_completion_function = NULL

Definition at line 79 of file editline.c.

int rl_eof

Definition at line 108 of file editline.c.

int rl_erase

Definition at line 109 of file editline.c.

int rl_intr

Definition at line 110 of file editline.c.

int rl_kill

Definition at line 111 of file editline.c.

ECHAR el_NIL[] = ""

Definition at line 113 of file editline.c.

CONST ECHAR* el_Input

Definition at line 56 of file el_sys_unix.c.

STATIC ECHAR* Line = NULL

Definition at line 115 of file editline.c.

STATIC CONST char* Prompt = NULL

Definition at line 116 of file editline.c.

STATIC ECHAR* Yanked = NULL

Definition at line 117 of file editline.c.

STATIC char* Screen = NULL

Definition at line 118 of file editline.c.

STATIC HISTORY H

Definition at line 120 of file editline.c.

int rl_quit

Definition at line 121 of file editline.c.

STATIC int Repeat

Definition at line 122 of file editline.c.

STATIC int End

Definition at line 123 of file editline.c.

STATIC int Mark

Definition at line 124 of file editline.c.

STATIC int OldPoint

Definition at line 125 of file editline.c.

STATIC int Point

Definition at line 126 of file editline.c.

int el_PushBack

Definition at line 54 of file el_sys_unix.c.

int el_Pushed

Definition at line 55 of file el_sys_unix.c.

STATIC KEYMAP Map

Definition at line 129 of file editline.c.

STATIC KEYMAP MetaMap
Initial value:
= {
{ CTL('H'), bk_kill_word },
{ ' ', mk_set },
{ '.', last_argument },
{ '<', h_first },
{ '>', h_last },
{ '?', c_possible },
{ 'b', bk_word },
{ 'c', case_cap_word },
{ 'd', fd_kill_word },
{ 'f', fd_word },
{ 'l', case_down_word },
{ 'u', case_up_word },
{ 'y', yank },
{ 'w', copy_region },
{ 0, NULL }
}
STATIC STATUS fd_kill_word()
Definition: editline.c:1798
STATIC STATUS yank()
Definition: editline.c:1757
STATIC STATUS fd_word()
Definition: editline.c:1793
#define DEL
Definition: editline.c:65
STATIC STATUS case_down_word()
Definition: editline.c:626
STATIC STATUS last_argument()
Definition: editline.c:1885
STATIC STATUS c_possible()
Definition: editline.c:1656
STATIC STATUS h_last()
Definition: editline.c:801
STATIC STATUS mk_set()
Definition: editline.c:1736
STATIC STATUS bk_kill_word()
Definition: editline.c:1834
STATIC STATUS case_up_word()
Definition: editline.c:631
STATIC STATUS case_cap_word()
Definition: editline.c:636
#define CTL(x)
Definition: editline.c:67
NULL
Definition: EST_WFST.cc:55
STATIC STATUS bk_word()
Definition: editline.c:1814
STATIC STATUS h_first()
Definition: editline.c:796
STATIC STATUS copy_region()
Definition: editline.c:1764

Definition at line 130 of file editline.c.

STATIC ESIZE_T Length

Definition at line 131 of file editline.c.

STATIC ESIZE_T ScreenCount

Definition at line 132 of file editline.c.

STATIC ESIZE_T ScreenSize

Definition at line 133 of file editline.c.

STATIC ECHAR* backspace = NULL

Definition at line 134 of file editline.c.

STATIC ECHAR* upline = NULL

Definition at line 135 of file editline.c.

STATIC ECHAR* clrpage = NULL

Definition at line 136 of file editline.c.

STATIC ECHAR* downline = NULL

Definition at line 137 of file editline.c.

STATIC ECHAR* move_right = NULL

Definition at line 138 of file editline.c.

STATIC ECHAR* newline = NULL

Definition at line 139 of file editline.c.

STATIC ECHAR* bol = NULL

Definition at line 140 of file editline.c.

STATIC ECHAR* nextline = NULL

Definition at line 141 of file editline.c.

STATIC int TTYwidth

Definition at line 142 of file editline.c.

STATIC int TTYrows

Definition at line 143 of file editline.c.

STATIC int RequireNLforWrap = 1

Definition at line 144 of file editline.c.

STATIC int el_intr_pending = 0

Definition at line 145 of file editline.c.

int el_no_echo = 0

Definition at line 146 of file editline.c.

int rl_meta_chars = 0

Definition at line 220 of file editline.c.