home *** CD-ROM | disk | FTP | other *** search
/ The Atari Compendium / The Atari Compendium (Toad Computers) (1994).iso / files / prgtools / mint / shells / tcshsrc.zoo / tcsh / ed.h < prev    next >
Encoding:
C/C++ Source or Header  |  1991-10-25  |  8.2 KB  |  215 lines

  1. /* $Header: /home/hyperion/mu/christos/src/sys/tcsh-6.00/RCS/ed.h,v 3.4 1991/07/29 22:41:12 christos Exp $ */
  2. /*
  3.  * ed.h: Editor declarations and globals
  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. All advertising materials mentioning features or use of this software
  18.  *    must display the following acknowledgement:
  19.  *    This product includes software developed by the University of
  20.  *    California, Berkeley and its contributors.
  21.  * 4. Neither the name of the University nor the names of its contributors
  22.  *    may be used to endorse or promote products derived from this software
  23.  *    without specific prior written permission.
  24.  *
  25.  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
  26.  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  27.  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  28.  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
  29.  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  30.  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  31.  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  32.  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  33.  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  34.  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  35.  * SUCH DAMAGE.
  36.  */
  37. #ifndef _h_ed
  38. #define _h_ed
  39.  
  40. #ifndef EXTERN
  41. # define EXTERN extern
  42. #endif
  43.  
  44. #define TABSIZE        8    /* usually 8 spaces/tab */
  45. #define    INBUFSIZ    BUFSIZ    /* size of input buffer */
  46. #define MAXMACROLEVELS    10    /* max number of nested kbd macros */
  47.  
  48. extern int errno;
  49.  
  50. /****************************************************************************/
  51. /* stuff for the different states returned by the character editor routines */
  52. /****************************************************************************/
  53.  
  54. #define CCRETVAL    char    /* size needed for the different char editor */
  55.  /* return values */
  56.  
  57. #define KEYCMD   unsigned char    /* size needed to index into CcFuncTbl */
  58.  /* Must be unsigned                */
  59.  
  60. typedef CCRETVAL(*PFCmd) __P((int));    /* pointer to function returning CCRETVAL */
  61.  
  62. struct KeyFuncs {        /* for the "bind" shell command */
  63.     char   *name;        /* function name for bind command */
  64.     int     func;        /* function numeric value */
  65.     char   *description;    /* description of function */
  66. };
  67.  
  68. extern PFCmd CcFuncTbl[];    /* table of available commands */
  69. extern KEYCMD CcKeyMap[];    /* keymap table, each index into above tbl */
  70. extern KEYCMD CcAltMap[];    /* Alt keymap table */
  71. extern KEYCMD CcEmacsMap[];    /* keymap table for Emacs default bindings */
  72. extern KEYCMD CcViMap[];    /* keymap table for Vi input mode defaults */
  73. extern KEYCMD CcViCmdMap[];    /* for Vi command mode defaults */
  74. extern struct KeyFuncs FuncNames[];    /* string names vs. CcFuncTbl indices */
  75.  
  76. EXTERN KEYCMD NumFuns;        /* number of KEYCMDs in above table */
  77.  
  78. #define    CC_ERROR        100    /* there should NOT be 100 different... */
  79. #define CC_FATAL        101    /* fatal error: inconsistant, must
  80.                      * reset */
  81. #define    CC_NORM            0
  82. #define    CC_NEWLINE        1
  83. #define    CC_EOF            2
  84. #define    CC_COMPLETE        3
  85. #define    CC_LIST_CHOICES        4
  86. #define    CC_LIST_GLOB        5
  87. #define CC_EXPAND_GLOB        6
  88. #define    CC_HELPME        9
  89. #define CC_CORRECT        10
  90. #define CC_WHICH        11
  91. #define CC_ARGHACK        12
  92. #define CC_CORRECT_L        13
  93. #define CC_REFRESH        14
  94. #define CC_EXPAND_VARS        15
  95.  
  96. /*************************/
  97. /* tty state             */
  98. /*************************/
  99.  
  100.  
  101. #ifndef POSIX
  102. # ifdef TERMIO
  103. EXTERN struct termio nio;
  104. EXTERN struct termio xio;
  105. EXTERN struct termio testio;
  106.  
  107. #  if (defined(OREO) || defined(hpux) || defined(_IBMR2)) && !defined(hp9000s500)
  108. EXTERN struct ltchars nlc;
  109. EXTERN struct ltchars xlc;
  110. EXTERN struct ltchars testlc;
  111. #  endif /* OREO || hpux || _IBMR2 */
  112.  
  113. # else /* GSTTY */
  114. EXTERN struct sgttyb nb;    /* original setup tty bits */
  115. EXTERN struct tchars ntc;
  116. EXTERN struct ltchars nlc;
  117. EXTERN int nlb;
  118.  
  119. EXTERN struct sgttyb xb;    /* running setup tty bits */
  120. EXTERN struct tchars xtc;
  121. EXTERN struct ltchars xlc;
  122. EXTERN int xlb;
  123.  
  124. EXTERN struct sgttyb testsgb;    /* running setup tty bits */
  125. EXTERN int testnlb;        /* test local mode word */
  126. EXTERN struct tchars testtc;
  127. EXTERN struct ltchars testlc;
  128.  
  129. #  ifdef TIOCGPAGE
  130. EXTERN struct ttypagestat npc;
  131. EXTERN struct ttypagestat xpc;
  132. EXTERN struct ttypagestat testpc;
  133.  
  134. #  endif /* TIOCGPAGE */
  135. # endif    /* TERMIO */
  136. #else /* POSIX */
  137. EXTERN struct termios nio;
  138. EXTERN struct termios xio;
  139. EXTERN struct termios testio;
  140.  
  141. # if defined(OREO) || defined(hpux) || defined(_IBMR2)
  142. EXTERN struct ltchars nlc;
  143. EXTERN struct ltchars xlc;
  144. EXTERN struct ltchars testlc;
  145. # endif /* OREO || hpux || _IBMR2 */
  146. #endif /* POSIX */
  147.  
  148. /****************************/
  149. /* Editor state and buffers */
  150. /****************************/
  151.  
  152. EXTERN KEYCMD *CurrentKeyMap;    /* current command key map */
  153. EXTERN int replacemode;        /* true if in overwrite mode */
  154. EXTERN Char GettingInput;    /* true if getting an input line (mostly) */
  155. EXTERN Char NeedsRedraw;    /* for editor and twenex error messages */
  156. EXTERN Char InputBuf[INBUFSIZ];    /* the real input data */
  157. EXTERN Char *LastChar, *Cursor;    /* point to the next open space */
  158. EXTERN Char *InputLim;        /* limit of size of InputBuf */
  159. EXTERN Char MetaNext;        /* flags for ^V and ^[ functions */
  160. EXTERN Char AltKeyMap;        /* Using alternative command map (for vi mode) */
  161. EXTERN Char VImode;        /* true if running in vi mode (PWP 6-27-88) */
  162. EXTERN Char *Mark;        /* the emacs "mark" (dot is Cursor) */
  163. EXTERN Char DoingArg;        /* true if we have an argument */
  164. EXTERN int Argument;        /* "universal" argument value */
  165. EXTERN KEYCMD LastCmd;        /* previous command executed */
  166. EXTERN Char KillBuf[INBUFSIZ];    /* kill buffer */
  167. EXTERN Char *LastKill;        /* points to end of kill buffer */
  168. EXTERN Char HistBuf[INBUFSIZ];    /* history buffer */
  169. EXTERN Char *LastHist;        /* points to end of history buffer */
  170. EXTERN int Hist_num;        /* what point up the history we are at now. */
  171. EXTERN Char WhichBuf[INBUFSIZ];    /* buffer for which command */
  172. EXTERN Char *LastWhich;        /* points to end of which buffer */
  173. EXTERN Char *CursWhich;        /* points to the cursor point in which buf */
  174. EXTERN int HistWhich;        /* Hist_num is saved in this */
  175. EXTERN Char *SearchPrompt;    /* points to string that holds search prompt */
  176. EXTERN Char DoingSearch;    /* true if we are doing a history search */
  177. EXTERN char Expand;        /* true if we are expanding a line */
  178. EXTERN Char HistLit;        /* true if history lines are shown literal */
  179. EXTERN Char CurrentHistLit;    /* Literal status of current show history line */
  180.  
  181. /*
  182.  * These are truly extern
  183.  */
  184. extern Char PromptBuf[];
  185. extern int MacroLvl;
  186.  
  187. EXTERN Char *KeyMacro[MAXMACROLEVELS];
  188.  
  189. EXTERN Char **Display;        /* display buffer seed vector */
  190. EXTERN int CursorV,        /* real cursor vertical (line) */
  191.         CursorH,        /* real cursor horisontal (column) */
  192.         TermV,            /* number of real screen lines
  193.                  * (sizeof(DisplayBuf) / width */
  194.         TermH;            /* screen width */
  195. EXTERN Char **Vdisplay;        /* new buffer */
  196.  
  197. /* Variables that describe terminal ability */
  198. EXTERN int T_Lines, T_Cols;    /* Rows and Cols of the terminal */
  199. EXTERN Char T_CanIns;        /* true if I can insert characters */
  200. EXTERN Char T_CanDel;        /* dito for delete characters */
  201. EXTERN Char T_Tabs;        /* true if tty interface is passing tabs */
  202. EXTERN speed_t T_Speed;        /* Tty input Baud rate */
  203. EXTERN Char T_CanCEOL;        /* true if we can clear to end of line */
  204. EXTERN Char T_CanUP;        /* true if this term can do reverse linefeen */
  205. EXTERN Char T_HasMeta;        /* true if we have a meta key */
  206.  
  207. /* note the extra characters in the Strchr() call in this macro */
  208. #define isword(c)    (Isalpha(c)||Isdigit(c)||Strchr(word_chars,c))
  209. #define min(x,y)    (((x)<(y))?(x):(y))
  210. #define max(x,y)    (((x)>(y))?(x):(y))
  211.  
  212. #include "ed.decls.h"
  213.  
  214. #endif /* _h_ed */
  215.