Edinburgh Speech Tools 2.4-release
 
Loading...
Searching...
No Matches
editline.h
1/****************************************************************************/
2/* */
3/* Copyright 1992 Simmule Turner and Rich Salz. All rights reserved. */
4/* */
5/* This software is not subject to any license of the American Telephone */
6/* and Telegraph Company or of the Regents of the University of California. */
7/* */
8/* Permission is granted to anyone to use this software for any purpose on */
9/* any computer system, and to alter it and redistribute it freely, subject */
10/* to the following restrictions: */
11/* 1. The authors are not responsible for the consequences of use of this */
12/* software, no matter how awful, even if they arise from flaws in it. */
13/* 2. The origin of this software must not be misrepresented, either by */
14/* explicit claim or by omission. Since few users ever read sources, */
15/* credits must appear in the documentation. */
16/* 3. Altered versions must be plainly marked as such, and must not be */
17/* misrepresented as being the original software. Since few users */
18/* ever read sources, credits must appear in the documentation. */
19/* 4. This notice may not be removed or altered. */
20/* */
21/****************************************************************************/
22/* */
23/* This is a line-editing library, it can be linked into almost any */
24/* program to provide command-line editing and recall. */
25/* */
26/* Posted to comp.sources.misc Sun, 2 Aug 1992 03:05:27 GMT */
27/* by rsalz@osf.org (Rich $alz) */
28/* */
29/****************************************************************************/
30/* */
31/* The version contained here has some modifications by awb@cstr.ed.ac.uk */
32/* (Alan W Black) in order to integrate it with the Edinburgh Speech Tools */
33/* library and Scheme-in-one-defun in particular. All modifications to */
34/* to this work are continued with the same copyright above. That is */
35/* this version of editline does not have the the "no commercial use" */
36/* restriction that some of the rest of the EST library may have */
37/* awb Dec 30 1998 */
38/* */
39/****************************************************************************/
40/* $Revision: 1.2 $
41**
42** Internal header file for editline library.
43**
44*/
45
46/* Explicit configuration for Unix environment which will effectively be */
47/* set up by the Speech Tools configuration by this point -- awb */
48#define ANSI_ARROWS
49#define HAVE_TCGETATTR
50#define HAVE_STDLIB
51#define HIDE
52#define USE_DIRENT
53#define SYS_UNIX
54/* will all work without this except long lines */
55#define USE_TERMCAP
56
57/*
58** Command status codes (moved from editline.h).
59*/
60typedef enum _STATUS {
61 CSdone, CSeof, CSmove, CSdispatch, CSstay
62} STATUS;
63
64typedef STATUS (*Keymap_Function)();
65
66
67#include <stdio.h>
68#if defined(HAVE_STDLIB)
69#include <stdlib.h>
70#include <string.h>
71#endif /* defined(HAVE_STDLIB) */
72#if defined(SYS_UNIX)
73#include "el_unix.h"
74#endif /* defined(SYS_UNIX) */
75#if defined(SYS_OS9)
76#include "os9.h"
77#endif /* defined(SYS_OS9) */
78
79#if !defined(ESIZE_T)
80#define ESIZE_T unsigned int
81#endif /* !defined(ESIZE_T) */
82
83typedef unsigned char ECHAR;
84
85#if defined(HIDE)
86#define STATIC static
87#else
88#define STATIC /* NULL */
89#endif /* !defined(HIDE) */
90
91#if !defined(CONST)
92#if defined(__STDC__)
93#define CONST const
94#else
95#define CONST
96#endif /* defined(__STDC__) */
97#endif /* !defined(CONST) */
98
99
100#define MEM_INC 64
101#define SCREEN_INC 256
102
103#if 0
104#define DISPOSE(p) free((char *)(p))
105#define NEW(T, c) \
106 ((T *)malloc((unsigned int)(sizeof (T) * (c))))
107#define RENEW(p, T, c) \
108 (p = (T *)realloc((char *)(p), (unsigned int)(sizeof (T) * (c))))
109#define STRDUP(X) strdup(X)
110#endif
111#define COPYFROMTO(new, p, len) \
112 (void)memcpy((char *)(new), (char *)(p), (int)(len))
113/* CSTR EST replacements -- awb */
114#include "EST_walloc.h"
115#define DISPOSE(p) wfree(p)
116#define NEW(T,c) walloc(T,c)
117#define RENEW(p,T,c) (p = wrealloc(p,T,c))
118#define STRDUP(X) wstrdup(X)
119
120/*
121** Variables and routines internal to this package.
122*/
123extern int rl_eof;
124extern int rl_erase;
125extern int rl_intr;
126extern int rl_kill;
127extern int rl_quit;
128extern int el_user_intr; /* with SIGINT if non-zero */
129extern int el_no_echo; /* e.g under emacs, don't echo except prompt */
130extern char *rl_complete(char *pathname, int *unique);
131extern int rl_list_possib(char *pathname,char ***avp);
132extern char *editline_history_file;
133void rl_ttyset(int Reset);
134void rl_add_slash(char *path,char *p);
135int el_is_directory(char *path);
136void do_user_intr();
137
138#if !defined(HAVE_STDLIB)
139extern char *getenv();
140extern char *malloc();
141extern char *realloc();
142extern char *memcpy();
143extern char *strcat();
144extern char *strchr();
145extern char *strrchr();
146extern char *strcpy();
147extern char *strdup();
148extern int strcmp();
149extern int strlen();
150extern int strncmp();
151
152#endif /* !defined(HAVE_STDLIB) */
153
154/* Added prototypes for available functions in editline -- awb */
155char * readline(CONST char* prompt);
156void add_history(char *p);
157void read_history(const char *history_file);
158void write_history(const char *history_file);
159typedef char **EL_USER_COMPLETION_FUNCTION_TYPE(char *text,int start, int end);
160extern EL_USER_COMPLETION_FUNCTION_TYPE*el_user_completion_function;
161char *el_current_sym();
162void el_redisplay();
163void el_bind_key_in_metamap(char c, Keymap_Function func);
164