home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / octa21fs.zip / octave / readline / rldefs.h < prev    next >
C/C++ Source or Header  |  2000-01-15  |  4KB  |  147 lines

  1. /* Modified by Klaus Gebhardt, 1996 */
  2. /* rldefs.h -- an attempt to isolate some of the system-specific defines
  3.    for readline.  This should be included after any files that define
  4.    system-specific constants like _POSIX_VERSION or USG. */
  5.  
  6. /* Copyright (C) 1987,1989 Free Software Foundation, Inc.
  7.  
  8.    This file contains the Readline Library (the Library), a set of
  9.    routines for providing Emacs style line input to programs that ask
  10.    for it.
  11.  
  12.    The Library is free software; you can redistribute it and/or modify
  13.    it under the terms of the GNU General Public License as published by
  14.    the Free Software Foundation; either version 1, or (at your option)
  15.    any later version.
  16.  
  17.    The Library is distributed in the hope that it will be useful, but
  18.    WITHOUT ANY WARRANTY; without even the implied warranty of
  19.    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  20.    General Public License for more details.
  21.  
  22.    The GNU General Public License is often shipped with GNU software, and
  23.    is generally kept in a file called COPYING or LICENSE.  If you do not
  24.    have a copy of the license, write to the Free Software Foundation,
  25.    675 Mass Ave, Cambridge, MA 02139, USA. */
  26.  
  27. #if !defined (_RLDEFS_H_)
  28. #define _RLDEFS_H_
  29.  
  30. #if defined (HAVE_CONFIG_H)
  31. #  include "config.h"
  32. #endif
  33.  
  34. #if defined (_POSIX_VERSION) && !defined (TERMIOS_MISSING)
  35. #  define TERMIOS_TTY_DRIVER
  36. #else
  37. #  if defined (HAVE_TERMIO_H)
  38. #    define TERMIO_TTY_DRIVER
  39. #  else
  40. #    define NEW_TTY_DRIVER
  41. #  endif
  42. #endif
  43.  
  44. #ifdef __MSDOS__
  45. #undef NEW_TTY_DRIVER
  46. #undef HAVE_BSD_SIGNALS
  47. #endif
  48.  
  49. #ifdef __EMX__
  50. #define HAVE_POSIX_SIGNALS
  51. #undef HAVE_BSD_SIGNALS
  52. #endif /* __EMX__ */
  53.  
  54. /* Posix macro to check file in statbuf for directory-ness.
  55.    This requires that <sys/stat.h> be included before this test. */
  56. #if defined (S_IFDIR) && !defined (S_ISDIR)
  57. #  define S_ISDIR(m) (((m)&S_IFMT) == S_IFDIR)
  58. #endif
  59.  
  60. /* Decide which flavor of the header file describing the C library
  61.    string functions to include and include it. */
  62.  
  63. #if defined (HAVE_STRING_H)
  64. #  include <string.h>
  65. #else /* !HAVE_STRING_H */
  66. #  include <strings.h>
  67. #endif /* !HAVE_STRING_H */
  68.  
  69. #if !defined (strchr) && !defined (__STDC__)
  70. extern char *strchr (), *strrchr ();
  71. #endif /* !strchr && !__STDC__ */
  72.  
  73. #if defined (PREFER_STDARG)
  74. #  include <stdarg.h>
  75. #else
  76. #  if defined (PREFER_VARARGS)
  77. #    include <varargs.h>
  78. #  endif
  79. #endif
  80.  
  81. #if defined (HAVE_STRCASECMP)
  82. #define _rl_stricmp strcasecmp
  83. #define _rl_strnicmp strncasecmp
  84. #else
  85. extern int _rl_stricmp (), _rl_strnicmp ();
  86. #endif
  87.  
  88. #if !defined (emacs_mode)
  89. #  define no_mode -1
  90. #  define vi_mode 0
  91. #  define emacs_mode 1
  92. #endif
  93.  
  94. /* If you cast map[key].function to type (Keymap) on a Cray,
  95.    the compiler takes the value of map[key].function and
  96.    divides it by 4 to convert between pointer types (pointers
  97.    to functions and pointers to structs are different sizes).
  98.    This is not what is wanted. */
  99. #if defined (CRAY)
  100. #  define FUNCTION_TO_KEYMAP(map, key)    (Keymap)((int)map[key].function)
  101. #  define KEYMAP_TO_FUNCTION(data)    (Function *)((int)(data))
  102. #else
  103. #  define FUNCTION_TO_KEYMAP(map, key)    (Keymap)(map[key].function)
  104. #  define KEYMAP_TO_FUNCTION(data)    (Function *)(data)
  105. #endif
  106.  
  107. #ifndef savestring
  108. extern char *xmalloc ();
  109. #define savestring(x) strcpy (xmalloc (1 + strlen (x)), (x))
  110. #endif
  111.  
  112. /* Possible values for _rl_bell_preference. */
  113. #define NO_BELL 0
  114. #define AUDIBLE_BELL 1
  115. #define VISIBLE_BELL 2
  116.  
  117. /* Definitions used when searching the line for characters. */
  118. /* NOTE: it is necessary that opposite directions are inverses */
  119. #define    FTO     1        /* forward to */
  120. #define BTO    -1        /* backward to */
  121. #define FFIND     2        /* forward find */
  122. #define BFIND    -2        /* backward find */
  123.  
  124. /* Possible values for the found_quote flags word used by the completion
  125.    functions.  It says what kind of (shell-like) quoting we found anywhere
  126.    in the line. */
  127. #define RL_QF_SINGLE_QUOTE    0x1
  128. #define RL_QF_DOUBLE_QUOTE    0x2
  129. #define RL_QF_BACKSLASH        0x4
  130.  
  131. /* Default readline line buffer length. */
  132. #define DEFAULT_BUFFER_SIZE 256
  133.  
  134. #if !defined (STREQ)
  135. #define STREQ(a, b)    (((a)[0] == (b)[0]) && (strcmp ((a), (b)) == 0))
  136. #define STREQN(a, b, n)    (((a)[0] == (b)[0]) && (strncmp ((a), (b), (n)) == 0))
  137. #endif
  138.  
  139. #if !defined (FREE)
  140. #  define FREE(x)    if (x) free (x)
  141. #endif
  142.  
  143. /* CONFIGURATION SECTION */
  144. #include "rlconf.h"
  145.  
  146. #endif /* !_RLDEFS_H_ */
  147.