1 /*
2 **
3 **  Internal header file for editline library.
4 */
5 #include <stdio.h>
6 #include <stdlib.h>
7 #include <string.h>
8 #ifdef MEMDEBUG
9 #include <memdebug.h>
10 #endif
11 
12 #if defined(GC_DEBUG) || defined(MYGC)
13 #undef malloc
14 #undef realloc
15 #undef calloc
16 #undef free
17 #define malloc(s) GC_MALLOC((s))
18 #define realloc(n,s) GC_REALLOC((n),(s))
19 #define free(s) GC_FREE((s))
20 /* #define free(s) ;*/
21 #define calloc(n,s) GC_MALLOC((n)*(s))
22 #include <gc.h>
23 #endif
24 
25 extern  void Erase(const char *PathName);
26 
27 #if defined(GO32)
28 #define DJGPP 1
29 #endif
30 
31 #ifdef DJGPP
32 #define HAVE_DIRENT_H 1
33 #define HAVE_UNISTD_H 1
34 #define HAVE_PERROR 1
35 #define HAVE_STRDUP 1
36 #ifndef __MSDOS__
37 #define __MSDOS__ 1
38 #endif
39 #endif
40 
41 #ifdef _MSC_
42 #define HAVE_PERROR 1
43 #define HAVE_STRDUP 1
44 #endif
45 
46 #ifdef __TURBOC__
47 #ifndef __LINT__
48 #define HAVE_PERROR 1
49 #define HAVE_STRDUP 1
50 #endif
51 #endif
52 
53 #if defined(__EMX__)
54 #define _OS2
55 #define HAVE_DIRENT_H 1
56 #define HAVE_UNISTD_H 1
57 #define HAVE_PERROR 1
58 #define HAVE_STRDUP 1
59 #endif
60 
61 #ifdef _OS2
62 #include <io.h>
63 #include <conio.h>
64 #include "msdos.h"
65 #define SEPST "\\"
66 #define SEPCH '\\'
67 #endif
68 
69 #ifdef MSDOS
70 #ifndef __MSDOS__
71 #define __MSDOS__ 1
72 #endif
73 #endif
74 
75 #if defined(__MSDOS__) || defined(WIN32)
76 #define UNIQUE_HISTORY 1
77 #define ANSI_ARROWS 1
78 #include <io.h>
79 #include "msdos.h"
80 #define SEPST "\\"
81 #define SEPCH '\\'
82 #ifndef WIN32
83 #include <conio.h>
84 #endif
85 #endif
86 
87 #if defined(DESQVP) && defined(__MSDOS__)
88 # define A_DVPAUZ dv_pause();
89 void dv_pause( void ) ;
90 #else
91 #define A_DVPAUZ ;
92 #endif
93 
94 #if	defined(SYS_OS9)
95 #include "os9.h"
96 #endif	/* defined(SYS_OS9) */
97 
98 #if defined(SYS_UNIX)
99 #include "unix.h"
100 #define SEPST "/"
101 #define SEPCH '/'
102 #endif	/* defined(SYS_UNIX) */
103 
104 #ifdef HAVE_UNISTD_H
105 #include <sys/types.h>
106 #include <unistd.h>
107 #else
108 #define STDIN_FILENO 0
109 #define STDOUT_FILENO 1
110 #endif
111 
112 /* the following test is generally relevant to Unix systems only */
113 #if defined(HAVE_TERMIOS_H)
114 #  include <termios.h>
115 #elif defined(HAVE_TERMIO_H)
116 #  include <sys/ioctl.h>
117 #  include <termio.h>
118 #  define termios termio
119 #  define cc_t unsigned char
120 #elif defined(HAVE_SGTTY_H)
121 #  include <sys/ioctl.h>
122 #  include <sgtty.h>
123 #endif
124 
125 #if defined(HAVE_TERMIO_H) && !defined(HAVE_TCGETATTR)
126 #    define tcgetattr(x,z) ioctl(x,TCGETA,z)
127 #    define tcsetattr(x,y,z) ioctl(x,TCSETA,z)
128 #    if !defined(TCSANOW)
129 #      define TCSANOW TCSETA
130 #    endif
131 #endif
132 
133 #if defined(HAVE_TERMCAP_H)
134 #include <termcap.h>
135 #elif defined(SYS_UNIX)
136 #ifdef __cplusplus
137 #define EXTERNC extern "C"
138 #else
139 #define EXTERNC extern
140 #endif
141 extern char PC;
142 extern char *UP;
143 extern char *BC;
144 extern short ospeed;
145 EXTERNC int tgetnum (const char *name);
146 EXTERNC int tgetflag (const char *name);
147 EXTERNC char *tgetstr (const char *name, char **area);
148 EXTERNC int tgetent (char *buffer, const char *termtype);
149 EXTERNC char *tgoto (const char *cstring, int hpos, int vpos);
150 EXTERNC void tputs (const char *string, int nlines, int (*outfun)(int));
151 EXTERNC char *tparam (const char *ctlstring, char *buffer, int size, ...);
152 #endif
153 
154 typedef int UNSI;
155 #define HIDE
156 
157 #if defined(HIDE)
158 #define STATIC	static
159 #else
160 #define STATIC	/* NULL */
161 #endif
162 
163 #define MEM_INC		64
164 #define SCREEN_INC	256
165 
166 #if !defined(HAVE_STRDUP)
167 #define NEED_STRDUP 1
168 #endif
169 
170 #define COPYFROMTO(cnew, p, len) (void)memcpy((char *)(cnew), (char *)(p), (len))
171 
172 /* ms_dos key codes
173 #define KLT 0x4b
174 #define KRT 0x4d
175 #define KUP 0x48
176 #define KDN 0x50
177 #define KHM 0x47
178 #define KPU 0x49
179 #define KPD 0x51
180 #define KEN 0x4f
181 #define KIN 0x52
182 #define KDL 0x53
183 #define KCE 0x4c
184 #define KF1 0x3b
185 #define KF2 0x3c
186 #define KF3 0x3d
187 #define KF4 0x3e
188 */
189 
190 /* ansi */
191 
192 #define ESC 0x1b
193 #define KLT 'D' /* left */
194 #define KRT 'C' /* right */
195 #define KUP 'A' /* up */
196 #define KDN 'B' /* down */
197 #define KCE 'G' /* center */
198 #define KHM 'H' /* home */
199 #define KPU '5' /* page up */
200 #define KPD '6' /* page down */
201 #define KEN 'Y' /* end */
202 #define KIN '2' /* insert */
203 #define KDL '3' /* delete */
204 #define KF1 'P' /* f1 */
205 #define KF2 'Q' /* f2 */
206 #define KF3 'R' /* f3 */
207 #define KF4 'S' /* f4 */
208 #define KF5 'T' /* f5 */
209 #define KF6 'U' /* f6 */
210 #define KF7 'V' /* f7 */
211 #define KF8 'W' /* f8 */
212 #define KF9 'X' /* f9 */
213 #define KF0 'O' /* f10 */
214 
215 
216 /*
217 **  Variables and routines internal to this package.
218 */
219 #if 0
220 extern int	rl_eof;
221 extern int	rl_erase;
222 extern int	rl_intr;
223 extern int	rl_kill;
224 extern int	rl_quit;
225 #endif
226