PageRenderTime 146ms CodeModel.GetById 118ms app.highlight 17ms RepoModel.GetById 2ms app.codeStats 0ms

/contrib/tcsh/ed.term.h

https://bitbucket.org/freebsd/freebsd-head/
C++ Header | 522 lines | 416 code | 42 blank | 64 comment | 68 complexity | 90817e8d3c9f08e4f609f754b41e76ae MD5 | raw file
  1/* $Header: /p/tcsh/cvsroot/tcsh/ed.term.h,v 1.18 2007/07/05 14:13:06 christos Exp $ */
  2/*
  3 * ed.term.h: Local terminal header
  4 */
  5/*-
  6 * Copyright (c) 1980, 1991 The Regents of the University of California.
  7 * All rights reserved.
  8 *
  9 * Redistribution and use in source and binary forms, with or without
 10 * modification, are permitted provided that the following conditions
 11 * are met:
 12 * 1. Redistributions of source code must retain the above copyright
 13 *    notice, this list of conditions and the following disclaimer.
 14 * 2. Redistributions in binary form must reproduce the above copyright
 15 *    notice, this list of conditions and the following disclaimer in the
 16 *    documentation and/or other materials provided with the distribution.
 17 * 3. Neither the name of the University nor the names of its contributors
 18 *    may be used to endorse or promote products derived from this software
 19 *    without specific prior written permission.
 20 *
 21 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
 22 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 23 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 24 * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
 25 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 31 * SUCH DAMAGE.
 32 */
 33#ifndef _h_ed_term
 34#define _h_ed_term
 35
 36#define TO_CONTROL(A)	((A) & 037)
 37
 38#if defined(TERMIO) || defined(POSIX)
 39/*
 40 * Aix compatible names
 41 */
 42# if defined(VWERSE) && !defined(VWERASE)
 43#  define VWERASE VWERSE
 44# endif /* VWERSE && !VWERASE */
 45
 46# if defined(VDISCRD) && !defined(VDISCARD)
 47#  define VDISCARD VDISCRD
 48# endif /* VDISCRD && !VDISCARD */
 49
 50# if defined(VFLUSHO) && !defined(VDISCARD)
 51#  define VDISCARD VFLUSHO
 52# endif  /* VFLUSHO && VDISCARD */
 53
 54# if defined(VSTRT) && !defined(VSTART)
 55#  define VSTART VSTRT
 56# endif /* VSTRT && ! VSTART */
 57
 58# if defined(VSTAT) && !defined(VSTATUS)
 59#  define VSTATUS VSTAT
 60# endif /* VSTAT && ! VSTATUS */
 61
 62# ifndef ONLRET
 63#  define ONLRET 0
 64# endif /* ONLRET */
 65
 66# ifndef TAB3
 67#  ifdef OXTABS
 68#   define TAB3 OXTABS
 69#  else
 70#   define TAB3 0
 71#  endif /* OXTABS */
 72# endif /* !TAB3 */
 73
 74# if defined(OXTABS) && !defined(XTABS)
 75#  define XTABS OXTABS
 76# endif /* OXTABS && !XTABS */
 77
 78# ifndef ONLCR
 79#  define ONLCR 0
 80# endif /* ONLCR */
 81
 82# ifndef IEXTEN
 83#  define IEXTEN 0
 84# endif /* IEXTEN */
 85
 86/*
 87 * emx garbage
 88 */
 89# ifndef IDEFAULT
 90#  define IDEFAULT 0
 91# endif /* IDEFAULT */
 92
 93# ifndef IDELETE
 94#  define IDELETE 0
 95# endif /* IDELETE */
 96
 97# ifndef ECHOCTL
 98#  define ECHOCTL 0
 99# endif /* ECHOCTL */
100
101# ifndef PARENB
102#  define PARENB 0
103# endif /* PARENB */
104
105# ifndef EXTPROC
106#  define EXTPROC 0
107# endif /* EXTPROC */
108
109# ifndef FLUSHO
110#  define FLUSHO  0
111# endif /* FLUSHO */
112
113
114# if defined(VDISABLE) && !defined(_POSIX_VDISABLE)
115#  define _POSIX_VDISABLE VDISABLE
116# endif /* VDISABLE && ! _POSIX_VDISABLE */
117
118/*
119 * Work around ISC's definition of IEXTEN which is
120 * XCASE!
121 */
122# ifdef ISC
123#  if defined(IEXTEN) && defined(XCASE)
124#   if IEXTEN == XCASE
125#    undef IEXTEN
126#    define IEXTEN 0
127#   endif /* IEXTEN == XCASE */
128#  endif /* IEXTEN && XCASE */
129#  if defined(IEXTEN) && !defined(XCASE)
130#   define XCASE IEXTEN
131#   undef IEXTEN
132#   define IEXTEN 0
133#  endif /* IEXTEN && !XCASE */
134# endif /* ISC */
135
136/*
137 * Work around convex weirdness where turning off IEXTEN makes us
138 * lose all postprocessing!
139 */
140#ifdef convex
141# if defined(IEXTEN) && IEXTEN != 0
142#  undef IEXTEN
143#  define IEXTEN 0
144# endif /* IEXTEN != 0 */
145#endif /* convex */
146
147
148# else /* SGTTY */
149
150# ifndef LPASS8
151#  define LPASS8  0
152# endif /* LPASS8 */
153
154#endif /* TERMIO || POSIX */
155
156#ifndef _POSIX_VDISABLE
157# define _POSIX_VDISABLE ((unsigned char) -1)
158#endif /* _POSIX_VDISABLE */
159
160
161#if !defined(CREPRINT) && defined(CRPRNT)
162# define CREPRINT CRPRNT
163#endif /* !CREPRINT && CRPRNT */
164#if !defined(CDISCARD) && defined(CFLUSH)
165# define CDISCARD CFLUSH
166#endif /* !CDISCARD && CFLUSH */
167#if !defined(CDISCARD) && defined(CFLUSHO)
168# define CDISCARD CFLUSHO
169#endif /* !CDISCARD && CFLUSHO */
170
171/*
172 * IRIX4.0 control macro is broken!
173 * Ignore and undef all default tty chars defined and redefine only
174 * the ones that are different in the IRIX file.
175 */
176#if __STDC__ && defined(IRIS4D)
177# undef  CINTR
178# define CINTR		0177	/* ^? */
179# undef  CQUIT
180# undef  CERASE
181# define CERASE		TO_CONTROL('h')
182# undef  CKILL
183# undef  CEOF
184# undef  CEOL
185# undef  CEOL2	
186# undef  CSWTCH	
187# define CSWTCH		TO_CONTROL('z')
188# undef  CDSWTCH 
189# undef  CERASE2
190# undef  CSTART
191# undef  CSTOP
192# undef  CWERASE
193# undef  CSUSP
194# undef  CDSUSP
195# undef  CREPRINT
196# undef  CDISCARD
197# undef  CLNEXT
198# undef  CSTATUS
199# undef  CPAGE
200# undef  CPGOFF
201# undef  CKILL2
202# undef  CBRK
203# undef  CMIN
204# undef  CTIME
205#endif /* __STDC__ && IRIS4D */
206
207
208#ifndef CINTR
209# define CINTR		TO_CONTROL('c')
210#endif /* CINTR */
211#ifndef CQUIT
212# define CQUIT		034	/* ^\ */
213#endif /* CQUIT */
214#ifndef CERASE
215# define CERASE		0177	/* ^? */
216#endif /* CERASE */
217#ifndef CKILL
218# define CKILL		TO_CONTROL('u')
219#endif /* CKILL */
220#ifndef CEOF
221# define CEOF		TO_CONTROL('d')
222#endif /* CEOF */
223#ifndef CEOL
224# define CEOL		_POSIX_VDISABLE
225#endif /* CEOL */
226#ifndef CEOL2
227# define CEOL2		_POSIX_VDISABLE
228#endif /* CEOL2 */
229#ifndef CSWTCH
230# define CSWTCH		_POSIX_VDISABLE
231#endif /* CSWTCH */
232#ifndef CDSWTCH
233# define CDSWTCH	_POSIX_VDISABLE
234#endif /* CDSWTCH */
235#ifndef CERASE2
236# define CERASE2	_POSIX_VDISABLE
237#endif /* CERASE2 */
238#ifndef CSTART
239# define CSTART		TO_CONTROL('q')
240#endif /* CSTART */
241#ifndef CSTOP
242# define CSTOP		TO_CONTROL('s')
243#endif /* CSTOP */
244#ifndef CSUSP
245# define CSUSP		TO_CONTROL('z')
246#endif /* CSUSP */
247#ifndef CDSUSP
248# define CDSUSP		TO_CONTROL('y')
249#endif /* CDSUSP */
250
251#ifdef hpux
252
253# ifndef CREPRINT
254#  define CREPRINT	_POSIX_VDISABLE
255# endif /* CREPRINT */
256# ifndef CDISCARD
257#  define CDISCARD	_POSIX_VDISABLE
258# endif /* CDISCARD */
259# ifndef CLNEXT
260#  define CLNEXT	_POSIX_VDISABLE
261# endif /* CLNEXT */
262# ifndef CWERASE
263#  define CWERASE	_POSIX_VDISABLE
264# endif /* CWERASE */
265
266#else /* !hpux */
267
268# ifndef CREPRINT
269#  define CREPRINT	TO_CONTROL('r')
270# endif /* CREPRINT */
271# ifndef CDISCARD
272#  define CDISCARD	TO_CONTROL('o')
273# endif /* CDISCARD */
274# ifndef CLNEXT
275#  define CLNEXT	TO_CONTROL('v')
276# endif /* CLNEXT */
277# ifndef CWERASE
278#  define CWERASE	TO_CONTROL('w')
279# endif /* CWERASE */
280
281#endif /* hpux */
282
283#ifndef CSTATUS
284# define CSTATUS	TO_CONTROL('t')
285#endif /* CSTATUS */
286#ifndef CPAGE
287# define CPAGE		' '
288#endif /* CPAGE */
289#ifndef CPGOFF
290# define CPGOFF		TO_CONTROL('m')
291#endif /* CPGOFF */
292#ifndef CKILL2
293# define CKILL2		_POSIX_VDISABLE
294#endif /* CKILL2 */
295#ifndef CBRK
296# ifndef masscomp
297#  define CBRK		0377
298# else
299#  define CBRK		'\0'
300# endif /* masscomp */
301#endif /* CBRK */
302#ifndef CMIN
303# define CMIN		CEOF
304#endif /* CMIN */
305#ifndef CTIME
306# define CTIME		CEOL
307#endif /* CTIME */
308
309/*
310 * Fix for sun inconsistency. On termio VSUSP and the rest of the
311 * ttychars > NCC are defined. So we undefine them.
312 */
313#if defined(TERMIO) || defined(POSIX)
314# if defined(POSIX) && defined(NCCS)
315#  define NUMCC		NCCS
316# else
317#  ifdef NCC
318#   define NUMCC	NCC
319#  endif /* NCC */
320# endif /* POSIX && NCCS */
321# ifdef NUMCC
322#  ifdef VINTR
323#   if NUMCC <= VINTR
324#    undef VINTR
325#   endif /* NUMCC <= VINTR */
326#  endif /* VINTR */
327#  ifdef VQUIT
328#   if NUMCC <= VQUIT
329#    undef VQUIT
330#   endif /* NUMCC <= VQUIT */
331#  endif /* VQUIT */
332#  ifdef VERASE
333#   if NUMCC <= VERASE
334#    undef VERASE
335#   endif /* NUMCC <= VERASE */
336#  endif /* VERASE */
337#  ifdef VKILL
338#   if NUMCC <= VKILL
339#    undef VKILL
340#   endif /* NUMCC <= VKILL */
341#  endif /* VKILL */
342#  ifdef VEOF
343#   if NUMCC <= VEOF
344#    undef VEOF
345#   endif /* NUMCC <= VEOF */
346#  endif /* VEOF */
347#  ifdef VEOL
348#   if NUMCC <= VEOL
349#    undef VEOL
350#   endif /* NUMCC <= VEOL */
351#  endif /* VEOL */
352#  ifdef VEOL2
353#   if NUMCC <= VEOL2
354#    undef VEOL2
355#   endif /* NUMCC <= VEOL2 */
356#  endif /* VEOL2 */
357#  ifdef VSWTCH
358#   if NUMCC <= VSWTCH
359#    undef VSWTCH
360#   endif /* NUMCC <= VSWTCH */
361#  endif /* VSWTCH */
362#  ifdef VDSWTCH
363#   if NUMCC <= VDSWTCH
364#    undef VDSWTCH
365#   endif /* NUMCC <= VDSWTCH */
366#  endif /* VDSWTCH */
367#  ifdef VERASE2
368#   if NUMCC <= VERASE2
369#    undef VERASE2
370#   endif /* NUMCC <= VERASE2 */
371#  endif /* VERASE2 */
372#  ifdef VSTART
373#   if NUMCC <= VSTART
374#    undef VSTART
375#   endif /* NUMCC <= VSTART */
376#  endif /* VSTART */
377#  ifdef VSTOP
378#   if NUMCC <= VSTOP
379#    undef VSTOP
380#   endif /* NUMCC <= VSTOP */
381#  endif /* VSTOP */
382#  ifdef VWERASE
383#   if NUMCC <= VWERASE
384#    undef VWERASE
385#   endif /* NUMCC <= VWERASE */
386#  endif /* VWERASE */
387#  ifdef VSUSP
388#   if NUMCC <= VSUSP
389#    undef VSUSP
390#   endif /* NUMCC <= VSUSP */
391#  endif /* VSUSP */
392#  ifdef VDSUSP
393#   if NUMCC <= VDSUSP
394#    undef VDSUSP
395#   endif /* NUMCC <= VDSUSP */
396#  endif /* VDSUSP */
397#  ifdef VREPRINT
398#   if NUMCC <= VREPRINT
399#    undef VREPRINT
400#   endif /* NUMCC <= VREPRINT */
401#  endif /* VREPRINT */
402#  ifdef VDISCARD
403#   if NUMCC <= VDISCARD
404#    undef VDISCARD
405#   endif /* NUMCC <= VDISCARD */
406#  endif /* VDISCARD */
407#  ifdef VLNEXT
408#   if NUMCC <= VLNEXT
409#    undef VLNEXT
410#   endif /* NUMCC <= VLNEXT */
411#  endif /* VLNEXT */
412#  ifdef VSTATUS
413#   if NUMCC <= VSTATUS
414#    undef VSTATUS
415#   endif /* NUMCC <= VSTATUS */
416#  endif /* VSTATUS */
417#  ifdef VPAGE
418#   if NUMCC <= VPAGE
419#    undef VPAGE
420#   endif /* NUMCC <= VPAGE */
421#  endif /* VPAGE */
422#  ifdef VPGOFF
423#   if NUMCC <= VPGOFF
424#    undef VPGOFF
425#   endif /* NUMCC <= VPGOFF */
426#  endif /* VPGOFF */
427#  ifdef VKILL2
428#   if NUMCC <= VKILL2
429#    undef VKILL2
430#   endif /* NUMCC <= VKILL2 */
431#  endif /* VKILL2 */
432#  ifdef VBRK
433#   if NUMCC <= VBRK
434#    undef VBRK
435#   endif /* NUMCC <= VBRK */
436#  endif /* VBRK */
437#  ifdef VMIN
438#   if NUMCC <= VMIN
439#    undef VMIN
440#   endif /* NUMCC <= VMIN */
441#  endif /* VMIN */
442#  ifdef VTIME
443#   if NUMCC <= VTIME
444#    undef VTIME
445#   endif /* NUMCC <= VTIME */
446#  endif /* VTIME */
447# endif /* NUMCC */
448#endif /* !POSIX */
449
450/*
451 * fix for hpux10 inconsistency: it has VWERASE, but TIOCSLTC returns
452 * EINVAL if one tries to change it
453 * Also for RH6.2 on the alpha, defined TIOCGLTC, but does not have
454 * struct ltchars
455 */
456#if (defined(hpux) && defined(VSUSP) && defined(VDSUSP) && defined(VWERASE) && defined(VLNEXT)) || defined(__linux__) || defined(__GNU__) || defined(__GLIBC__) || defined(__QNXNTO__)
457# undef TIOCGLTC       /* not really needed */
458# undef TIOCSLTC
459#endif
460
461#define C_INTR		 0
462#define C_QUIT		 1
463#define C_ERASE		 2
464#define C_KILL		 3
465#define C_EOF		 4
466#define C_EOL		 5
467#define C_EOL2		 6
468#define C_SWTCH		 7
469#define C_DSWTCH	 8
470#define C_ERASE2	 9
471#define C_START		10
472#define C_STOP		11
473#define C_WERASE	12
474#define C_SUSP		13
475#define C_DSUSP		14
476#define C_REPRINT	15
477#define C_DISCARD	16
478#define C_LNEXT		17
479#define C_STATUS	18
480#define C_PAGE		19
481#define C_PGOFF		20
482#define C_KILL2		21
483#define C_BRK		22
484#define C_MIN		23
485#define C_TIME		24
486#define C_NCC		25
487#define C_SH(A)		(1 << (A))
488
489/*
490 * Terminal dependend data structures
491 */
492typedef struct {
493#ifdef WINNT_NATIVE
494    int dummy;
495#else /* !WINNT_NATIVE */
496# if defined(POSIX) || defined(TERMIO)
497#  ifdef POSIX
498    struct termios d_t;
499#  else
500    struct termio d_t;
501#  endif /* POSIX */
502# else /* SGTTY */
503#  ifdef TIOCGETP
504    struct sgttyb d_t;
505#  endif /* TIOCGETP */
506#  ifdef TIOCGETC
507    struct tchars d_tc;
508#  endif /* TIOCGETC */
509#  ifdef TIOCGPAGE
510    struct ttypagestat d_pc;
511#  endif /* TIOCGPAGE */
512#  ifdef TIOCLGET
513    int d_lb;
514#  endif /* TIOCLGET */
515# endif /* POSIX || TERMIO */
516# ifdef TIOCGLTC
517    struct ltchars d_ltc;
518# endif /* TIOCGLTC */
519#endif /* WINNT_NATIVE */
520} ttydata_t;
521
522#endif /* _h_ed_term */