00001 /* rldefs.h -- an attempt to isolate some of the system-specific defines 00002 for readline. This should be included after any files that define 00003 system-specific constants like _POSIX_VERSION or USG. */ 00004 00005 /* Copyright (C) 1987,1989 Free Software Foundation, Inc. 00006 00007 This file contains the Readline Library (the Library), a set of 00008 routines for providing Emacs style line input to programs that ask 00009 for it. 00010 00011 The Library is free software; you can redistribute it and/or modify 00012 it under the terms of the GNU General Public License as published by 00013 the Free Software Foundation; either version 2, or (at your option) 00014 any later version. 00015 00016 The Library is distributed in the hope that it will be useful, but 00017 WITHOUT ANY WARRANTY; without even the implied warranty of 00018 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00019 General Public License for more details. 00020 00021 The GNU General Public License is often shipped with GNU software, and 00022 is generally kept in a file called COPYING or LICENSE. If you do not 00023 have a copy of the license, write to the Free Software Foundation, 00024 59 Temple Place, Suite 330, Boston, MA 02111 USA. */ 00025 00026 #if !defined (_RLDEFS_H_) 00027 #define _RLDEFS_H_ 00028 00029 #if defined (HAVE_CONFIG_H) 00030 # include "config.h" 00031 #endif 00032 00033 #include "rlstdc.h" 00034 00035 #if defined (_POSIX_VERSION) && !defined (TERMIOS_MISSING) 00036 # define TERMIOS_TTY_DRIVER 00037 #else 00038 # if defined (HAVE_TERMIO_H) 00039 # define TERMIO_TTY_DRIVER 00040 # else 00041 # define NEW_TTY_DRIVER 00042 # endif 00043 #endif 00044 00045 /* Posix macro to check file in statbuf for directory-ness. 00046 This requires that <sys/stat.h> be included before this test. */ 00047 #if defined (S_IFDIR) && !defined (S_ISDIR) 00048 # define S_ISDIR(m) (((m)&S_IFMT) == S_IFDIR) 00049 #endif 00050 00051 /* Decide which flavor of the header file describing the C library 00052 string functions to include and include it. */ 00053 00054 #if defined (HAVE_STRING_H) 00055 # include <string.h> 00056 #else /* !HAVE_STRING_H */ 00057 # include <strings.h> 00058 #endif /* !HAVE_STRING_H */ 00059 00060 #if !defined (strchr) && !defined (__STDC__) 00061 extern char *strchr (), *strrchr (); 00062 #endif /* !strchr && !__STDC__ */ 00063 00064 #if defined (PREFER_STDARG) 00065 # include <stdarg.h> 00066 #else 00067 # if defined (PREFER_VARARGS) 00068 # include <varargs.h> 00069 # endif 00070 #endif 00071 00072 #if defined (HAVE_STRCASECMP) 00073 #define _rl_stricmp strcasecmp 00074 #define _rl_strnicmp strncasecmp 00075 #else 00076 extern int _rl_stricmp PARAMS((char *, char *)); 00077 extern int _rl_strnicmp PARAMS((char *, char *, int)); 00078 #endif 00079 00080 #if defined (HAVE_STRPBRK) && !defined (HAVE_MULTIBYTE) 00081 # define _rl_strpbrk(a,b) strpbrk((a),(b)) 00082 #else 00083 extern char *_rl_strpbrk PARAMS((const char *, const char *)); 00084 #endif 00085 00086 #if !defined (emacs_mode) 00087 # define no_mode -1 00088 # define vi_mode 0 00089 # define emacs_mode 1 00090 #endif 00091 00092 #if !defined (RL_IM_INSERT) 00093 # define RL_IM_INSERT 1 00094 # define RL_IM_OVERWRITE 0 00095 # 00096 # define RL_IM_DEFAULT RL_IM_INSERT 00097 #endif 00098 00099 /* If you cast map[key].function to type (Keymap) on a Cray, 00100 the compiler takes the value of map[key].function and 00101 divides it by 4 to convert between pointer types (pointers 00102 to functions and pointers to structs are different sizes). 00103 This is not what is wanted. */ 00104 #if defined (CRAY) 00105 # define FUNCTION_TO_KEYMAP(map, key) (Keymap)((int)map[key].function) 00106 # define KEYMAP_TO_FUNCTION(data) (rl_command_func_t *)((int)(data)) 00107 #else 00108 # define FUNCTION_TO_KEYMAP(map, key) (Keymap)(map[key].function) 00109 # define KEYMAP_TO_FUNCTION(data) (rl_command_func_t *)(data) 00110 #endif 00111 00112 #ifndef savestring 00113 #define savestring(x) strcpy ((char *)xmalloc (1 + strlen (x)), (x)) 00114 #endif 00115 00116 /* Possible values for _rl_bell_preference. */ 00117 #define NO_BELL 0 00118 #define AUDIBLE_BELL 1 00119 #define VISIBLE_BELL 2 00120 00121 /* Definitions used when searching the line for characters. */ 00122 /* NOTE: it is necessary that opposite directions are inverses */ 00123 #define FTO 1 /* forward to */ 00124 #define BTO -1 /* backward to */ 00125 #define FFIND 2 /* forward find */ 00126 #define BFIND -2 /* backward find */ 00127 00128 /* Possible values for the found_quote flags word used by the completion 00129 functions. It says what kind of (shell-like) quoting we found anywhere 00130 in the line. */ 00131 #define RL_QF_SINGLE_QUOTE 0x01 00132 #define RL_QF_DOUBLE_QUOTE 0x02 00133 #define RL_QF_BACKSLASH 0x04 00134 #define RL_QF_OTHER_QUOTE 0x08 00135 00136 /* Default readline line buffer length. */ 00137 #define DEFAULT_BUFFER_SIZE 256 00138 00139 #if !defined (STREQ) 00140 #define STREQ(a, b) (((a)[0] == (b)[0]) && (strcmp ((a), (b)) == 0)) 00141 #define STREQN(a, b, n) (((n) == 0) ? (1) \ 00142 : ((a)[0] == (b)[0]) && (strncmp ((a), (b), (n)) == 0)) 00143 #endif 00144 00145 #if !defined (FREE) 00146 # define FREE(x) if (x) free (x) 00147 #endif 00148 00149 #if !defined (SWAP) 00150 # define SWAP(s, e) do { int t; t = s; s = e; e = t; } while (0) 00151 #endif 00152 00153 /* CONFIGURATION SECTION */ 00154 #include "rlconf.h" 00155 00156 #endif /* !_RLDEFS_H_ */
1.4.7

