File:  [ELWIX - Embedded LightWeight unIX -] / embedaddon / readline / rldefs.h
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs - revision graph
Wed Jul 30 08:16:45 2014 UTC (9 years, 10 months ago) by misho
Branches: readline, MAIN
CVS tags: v8_2p0, v8_1p0, v6_3p10_cross, v6_3p10, v6_3, p6, HEAD
readline 6.3

    1: /* rldefs.h -- an attempt to isolate some of the system-specific defines
    2:    for readline.  This should be included after any files that define
    3:    system-specific constants like _POSIX_VERSION or USG. */
    4: 
    5: /* Copyright (C) 1987-2011 Free Software Foundation, Inc.
    6: 
    7:    This file is part of the GNU Readline Library (Readline), a library
    8:    for reading lines of text with interactive input and history editing.      
    9: 
   10:    Readline is free software: you can redistribute it and/or modify
   11:    it under the terms of the GNU General Public License as published by
   12:    the Free Software Foundation, either version 3 of the License, or
   13:    (at your option) any later version.
   14: 
   15:    Readline is distributed in the hope that it will be useful,
   16:    but WITHOUT ANY WARRANTY; without even the implied warranty of
   17:    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   18:    GNU General Public License for more details.
   19: 
   20:    You should have received a copy of the GNU General Public License
   21:    along with Readline.  If not, see <http://www.gnu.org/licenses/>.
   22: */
   23: 
   24: #if !defined (_RLDEFS_H_)
   25: #define _RLDEFS_H_
   26: 
   27: #if defined (HAVE_CONFIG_H)
   28: #  include "config.h"
   29: #endif
   30: 
   31: #include "rlstdc.h"
   32: 
   33: #if defined (STRCOLL_BROKEN)
   34: #  undef HAVE_STRCOLL
   35: #endif
   36: 
   37: #if defined (_POSIX_VERSION) && !defined (TERMIOS_MISSING)
   38: #  define TERMIOS_TTY_DRIVER
   39: #else
   40: #  if defined (HAVE_TERMIO_H)
   41: #    define TERMIO_TTY_DRIVER
   42: #  else
   43: #    if !defined (__MINGW32__)
   44: #      define NEW_TTY_DRIVER
   45: #    else
   46: #      define NO_TTY_DRIVER
   47: #    endif
   48: #  endif
   49: #endif
   50: 
   51: /* Posix macro to check file in statbuf for directory-ness.
   52:    This requires that <sys/stat.h> be included before this test. */
   53: #if defined (S_IFDIR) && !defined (S_ISDIR)
   54: #  define S_ISDIR(m) (((m)&S_IFMT) == S_IFDIR)
   55: #endif
   56: 
   57: /* Decide which flavor of the header file describing the C library
   58:    string functions to include and include it. */
   59: 
   60: #if defined (HAVE_STRING_H)
   61: #  include <string.h>
   62: #else /* !HAVE_STRING_H */
   63: #  include <strings.h>
   64: #endif /* !HAVE_STRING_H */
   65: 
   66: #if !defined (strchr) && !defined (__STDC__)
   67: extern char *strchr (), *strrchr ();
   68: #endif /* !strchr && !__STDC__ */
   69: 
   70: #if defined (PREFER_STDARG)
   71: #  include <stdarg.h>
   72: #else
   73: #  if defined (PREFER_VARARGS)
   74: #    include <varargs.h>
   75: #  endif
   76: #endif
   77: 
   78: #if defined (HAVE_STRCASECMP)
   79: #define _rl_stricmp strcasecmp
   80: #define _rl_strnicmp strncasecmp
   81: #else
   82: extern int _rl_stricmp PARAMS((const char *, const char *));
   83: extern int _rl_strnicmp PARAMS((const char *, const char *, int));
   84: #endif
   85: 
   86: #if defined (HAVE_STRPBRK) && !defined (HAVE_MULTIBYTE)
   87: #  define _rl_strpbrk(a,b)	strpbrk((a),(b))
   88: #else
   89: extern char *_rl_strpbrk PARAMS((const char *, const char *));
   90: #endif
   91: 
   92: #if !defined (emacs_mode)
   93: #  define no_mode -1
   94: #  define vi_mode 0
   95: #  define emacs_mode 1
   96: #endif
   97: 
   98: #if !defined (RL_IM_INSERT)
   99: #  define RL_IM_INSERT		1
  100: #  define RL_IM_OVERWRITE	0
  101: #
  102: #  define RL_IM_DEFAULT		RL_IM_INSERT
  103: #endif
  104: 
  105: /* If you cast map[key].function to type (Keymap) on a Cray,
  106:    the compiler takes the value of map[key].function and
  107:    divides it by 4 to convert between pointer types (pointers
  108:    to functions and pointers to structs are different sizes).
  109:    This is not what is wanted. */
  110: #if defined (CRAY)
  111: #  define FUNCTION_TO_KEYMAP(map, key)	(Keymap)((int)map[key].function)
  112: #  define KEYMAP_TO_FUNCTION(data)	(rl_command_func_t *)((int)(data))
  113: #else
  114: #  define FUNCTION_TO_KEYMAP(map, key)	(Keymap)(map[key].function)
  115: #  define KEYMAP_TO_FUNCTION(data)	(rl_command_func_t *)(data)
  116: #endif
  117: 
  118: #ifndef savestring
  119: #define savestring(x) strcpy ((char *)xmalloc (1 + strlen (x)), (x))
  120: #endif
  121: 
  122: /* Possible values for _rl_bell_preference. */
  123: #define NO_BELL 0
  124: #define AUDIBLE_BELL 1
  125: #define VISIBLE_BELL 2
  126: 
  127: /* Definitions used when searching the line for characters. */
  128: /* NOTE: it is necessary that opposite directions are inverses */
  129: #define	FTO	 1		/* forward to */
  130: #define BTO	-1		/* backward to */
  131: #define FFIND	 2		/* forward find */
  132: #define BFIND	-2		/* backward find */
  133: 
  134: /* Possible values for the found_quote flags word used by the completion
  135:    functions.  It says what kind of (shell-like) quoting we found anywhere
  136:    in the line. */
  137: #define RL_QF_SINGLE_QUOTE	0x01
  138: #define RL_QF_DOUBLE_QUOTE	0x02
  139: #define RL_QF_BACKSLASH		0x04
  140: #define RL_QF_OTHER_QUOTE	0x08
  141: 
  142: /* Default readline line buffer length. */
  143: #define DEFAULT_BUFFER_SIZE 256
  144: 
  145: #if !defined (STREQ)
  146: #define STREQ(a, b)	(((a)[0] == (b)[0]) && (strcmp ((a), (b)) == 0))
  147: #define STREQN(a, b, n)	(((n) == 0) ? (1) \
  148: 				    : ((a)[0] == (b)[0]) && (strncmp ((a), (b), (n)) == 0))
  149: #endif
  150: 
  151: #if !defined (RL_STRLEN)
  152: #  define RL_STRLEN(s) (((s) && (s)[0]) ? ((s)[1] ? ((s)[2] ? strlen(s) : 2) : 1) : 0)
  153: #endif
  154: 
  155: #if !defined (FREE)
  156: #  define FREE(x)	if (x) free (x)
  157: #endif
  158: 
  159: #if !defined (SWAP)
  160: #  define SWAP(s, e)  do { int t; t = s; s = e; e = t; } while (0)
  161: #endif
  162: 
  163: /* CONFIGURATION SECTION */
  164: #include "rlconf.h"
  165: 
  166: #endif /* !_RLDEFS_H_ */

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>