121308Sache/* rldefs.h -- an attempt to isolate some of the system-specific defines 221308Sache for readline. This should be included after any files that define 321308Sache system-specific constants like _POSIX_VERSION or USG. */ 421308Sache 5157184Sache/* Copyright (C) 1987-2005 Free Software Foundation, Inc. 621308Sache 721308Sache This file contains the Readline Library (the Library), a set of 821308Sache routines for providing Emacs style line input to programs that ask 921308Sache for it. 1021308Sache 1121308Sache The Library is free software; you can redistribute it and/or modify 1221308Sache it under the terms of the GNU General Public License as published by 1358310Sache the Free Software Foundation; either version 2, or (at your option) 1421308Sache any later version. 1521308Sache 1621308Sache The Library is distributed in the hope that it will be useful, but 1721308Sache WITHOUT ANY WARRANTY; without even the implied warranty of 1821308Sache MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 1921308Sache General Public License for more details. 2021308Sache 2121308Sache The GNU General Public License is often shipped with GNU software, and 2221308Sache is generally kept in a file called COPYING or LICENSE. If you do not 2321308Sache have a copy of the license, write to the Free Software Foundation, 2458310Sache 59 Temple Place, Suite 330, Boston, MA 02111 USA. */ 2521308Sache 2621308Sache#if !defined (_RLDEFS_H_) 2721308Sache#define _RLDEFS_H_ 2821308Sache 2921308Sache#if defined (HAVE_CONFIG_H) 3021308Sache# include "config.h" 3121308Sache#endif 3221308Sache 3375406Sache#include "rlstdc.h" 3475406Sache 3521308Sache#if defined (_POSIX_VERSION) && !defined (TERMIOS_MISSING) 3621308Sache# define TERMIOS_TTY_DRIVER 3721308Sache#else 3821308Sache# if defined (HAVE_TERMIO_H) 3921308Sache# define TERMIO_TTY_DRIVER 4021308Sache# else 41157184Sache# if !defined (__MINGW32__) 42157184Sache# define NEW_TTY_DRIVER 43157184Sache# else 44157184Sache# define NO_TTY_DRIVER 45157184Sache# endif 4621308Sache# endif 4721308Sache#endif 4821308Sache 4921308Sache/* Posix macro to check file in statbuf for directory-ness. 5021308Sache This requires that <sys/stat.h> be included before this test. */ 5121308Sache#if defined (S_IFDIR) && !defined (S_ISDIR) 5221308Sache# define S_ISDIR(m) (((m)&S_IFMT) == S_IFDIR) 5321308Sache#endif 5421308Sache 5521308Sache/* Decide which flavor of the header file describing the C library 5621308Sache string functions to include and include it. */ 5721308Sache 5821308Sache#if defined (HAVE_STRING_H) 5921308Sache# include <string.h> 6021308Sache#else /* !HAVE_STRING_H */ 6121308Sache# include <strings.h> 6221308Sache#endif /* !HAVE_STRING_H */ 6321308Sache 6421308Sache#if !defined (strchr) && !defined (__STDC__) 6521308Sacheextern char *strchr (), *strrchr (); 6621308Sache#endif /* !strchr && !__STDC__ */ 6721308Sache 6821308Sache#if defined (PREFER_STDARG) 6921308Sache# include <stdarg.h> 7021308Sache#else 7121308Sache# if defined (PREFER_VARARGS) 7221308Sache# include <varargs.h> 7321308Sache# endif 7421308Sache#endif 7521308Sache 7621308Sache#if defined (HAVE_STRCASECMP) 7721308Sache#define _rl_stricmp strcasecmp 7821308Sache#define _rl_strnicmp strncasecmp 7921308Sache#else 80119610Sacheextern int _rl_stricmp PARAMS((char *, char *)); 81119610Sacheextern int _rl_strnicmp PARAMS((char *, char *, int)); 8221308Sache#endif 8321308Sache 84136644Sache#if defined (HAVE_STRPBRK) && !defined (HAVE_MULTIBYTE) 85119610Sache# define _rl_strpbrk(a,b) strpbrk((a),(b)) 86119610Sache#else 87119610Sacheextern char *_rl_strpbrk PARAMS((const char *, const char *)); 88119610Sache#endif 89119610Sache 9021308Sache#if !defined (emacs_mode) 9121308Sache# define no_mode -1 9221308Sache# define vi_mode 0 9321308Sache# define emacs_mode 1 9421308Sache#endif 9521308Sache 96119610Sache#if !defined (RL_IM_INSERT) 97119610Sache# define RL_IM_INSERT 1 98119610Sache# define RL_IM_OVERWRITE 0 99119610Sache# 100119610Sache# define RL_IM_DEFAULT RL_IM_INSERT 101119610Sache#endif 102119610Sache 10321308Sache/* If you cast map[key].function to type (Keymap) on a Cray, 10421308Sache the compiler takes the value of map[key].function and 10521308Sache divides it by 4 to convert between pointer types (pointers 10621308Sache to functions and pointers to structs are different sizes). 10721308Sache This is not what is wanted. */ 10821308Sache#if defined (CRAY) 10921308Sache# define FUNCTION_TO_KEYMAP(map, key) (Keymap)((int)map[key].function) 11075406Sache# define KEYMAP_TO_FUNCTION(data) (rl_command_func_t *)((int)(data)) 11121308Sache#else 11221308Sache# define FUNCTION_TO_KEYMAP(map, key) (Keymap)(map[key].function) 11375406Sache# define KEYMAP_TO_FUNCTION(data) (rl_command_func_t *)(data) 11421308Sache#endif 11521308Sache 11621308Sache#ifndef savestring 117119610Sache#define savestring(x) strcpy ((char *)xmalloc (1 + strlen (x)), (x)) 11821308Sache#endif 11921308Sache 12021308Sache/* Possible values for _rl_bell_preference. */ 12121308Sache#define NO_BELL 0 12221308Sache#define AUDIBLE_BELL 1 12321308Sache#define VISIBLE_BELL 2 12421308Sache 12521308Sache/* Definitions used when searching the line for characters. */ 12621308Sache/* NOTE: it is necessary that opposite directions are inverses */ 12721308Sache#define FTO 1 /* forward to */ 12821308Sache#define BTO -1 /* backward to */ 12921308Sache#define FFIND 2 /* forward find */ 13021308Sache#define BFIND -2 /* backward find */ 13121308Sache 13221308Sache/* Possible values for the found_quote flags word used by the completion 13321308Sache functions. It says what kind of (shell-like) quoting we found anywhere 13421308Sache in the line. */ 135119610Sache#define RL_QF_SINGLE_QUOTE 0x01 136119610Sache#define RL_QF_DOUBLE_QUOTE 0x02 137119610Sache#define RL_QF_BACKSLASH 0x04 138119610Sache#define RL_QF_OTHER_QUOTE 0x08 13921308Sache 14021308Sache/* Default readline line buffer length. */ 14121308Sache#define DEFAULT_BUFFER_SIZE 256 14221308Sache 14321308Sache#if !defined (STREQ) 14421308Sache#define STREQ(a, b) (((a)[0] == (b)[0]) && (strcmp ((a), (b)) == 0)) 14558310Sache#define STREQN(a, b, n) (((n) == 0) ? (1) \ 14658310Sache : ((a)[0] == (b)[0]) && (strncmp ((a), (b), (n)) == 0)) 14721308Sache#endif 14821308Sache 14921308Sache#if !defined (FREE) 15021308Sache# define FREE(x) if (x) free (x) 15121308Sache#endif 15221308Sache 153119610Sache#if !defined (SWAP) 154119610Sache# define SWAP(s, e) do { int t; t = s; s = e; e = t; } while (0) 155119610Sache#endif 156119610Sache 15721308Sache/* CONFIGURATION SECTION */ 15821308Sache#include "rlconf.h" 15921308Sache 16021308Sache#endif /* !_RLDEFS_H_ */ 161