Imported from ../bash-2.0.tar.gz.
[platform/upstream/bash.git] / lib / readline / rldefs.h
index 683f8b5..5a9e62a 100644 (file)
    have a copy of the license, write to the Free Software Foundation,
    675 Mass Ave, Cambridge, MA 02139, USA. */
 
-#if !defined (_RLDEFS_H)
-#define _RLDEFS_H
+#if !defined (_RLDEFS_H_)
+#define _RLDEFS_H_
 
 #if defined (HAVE_CONFIG_H)
 #  include "config.h"
 #endif
 
-#if !defined (PRAGMA_ALLOCA)
-#  include "memalloc.h"
-#endif
-
-#define NEW_TTY_DRIVER
-#define HAVE_BSD_SIGNALS
-/* #define USE_XON_XOFF */
-
-#if defined (__linux__) || defined (HAVE_TERMCAP_H)
-#  include <termcap.h>
-#endif /* __linux__ || HAVE_TERMCAP_H */
-
-/* Some USG machines have BSD signal handling (sigblock, sigsetmask, etc.) */
-#if defined (USG) && !defined (hpux)
-#  undef HAVE_BSD_SIGNALS
-#endif
-
-/* System V machines use termio. */
-#if !defined (_POSIX_VERSION)
-#  if defined (USG) || defined (hpux) || defined (Xenix) || defined (sgi) || \
-      defined (DGUX) || defined (HAVE_TERMIO_H)
-#    undef NEW_TTY_DRIVER
+#if defined (_POSIX_VERSION) && !defined (TERMIOS_MISSING)
+#  define TERMIOS_TTY_DRIVER
+#else
+#  if defined (HAVE_TERMIO_H)
 #    define TERMIO_TTY_DRIVER
-#    include <termio.h>
-#    if !defined (TCOON)
-#      define TCOON 1
-#    endif
-#  endif /* USG || hpux || Xenix || sgi || DUGX || HAVE_TERMIO_H */
-#endif /* !_POSIX_VERSION */
-
-/* Posix systems use termios and the Posix signal functions. */
-#if defined (_POSIX_VERSION)
-#  if !defined (TERMIOS_MISSING)
-#    undef NEW_TTY_DRIVER
-#    define TERMIOS_TTY_DRIVER
-#    include <termios.h>
-#  endif /* !TERMIOS_MISSING */
-#  define HAVE_POSIX_SIGNALS
-#  if !defined (O_NDELAY)
-#    define O_NDELAY O_NONBLOCK        /* Posix-style non-blocking i/o */
-#  endif /* O_NDELAY */
-#endif /* _POSIX_VERSION */
-
-/* System V.3 machines have the old 4.1 BSD `reliable' signal interface. */
-#if !defined (HAVE_BSD_SIGNALS) && !defined (HAVE_POSIX_SIGNALS)
-#  if defined (USGr3) && !defined (XENIX_22)
-#    if !defined (HAVE_USG_SIGHOLD)
-#      define HAVE_USG_SIGHOLD
-#    endif /* !HAVE_USG_SIGHOLD */
-#  endif /* USGr3 && !XENIX_22 */
-#endif /* !HAVE_BSD_SIGNALS && !HAVE_POSIX_SIGNALS */
-
-/* Other (BSD) machines use sgtty. */
-#if defined (NEW_TTY_DRIVER)
-#  include <sgtty.h>
+#  else
+#    define NEW_TTY_DRIVER
+#  endif
 #endif
 
-#if !defined (SHELL) && (defined (_POSIX_VERSION) || defined (USGr3))
-#  if !defined (HAVE_DIRENT_H)
-#    define HAVE_DIRENT_H
-#  endif /* !HAVE_DIRENT_H */
-#endif /* !SHELL && (_POSIX_VERSION || USGr3) */
-
-#if defined (HAVE_DIRENT_H)
-#  include <dirent.h>
-#  define D_NAMLEN(d) strlen ((d)->d_name)
-#else /* !HAVE_DIRENT_H */
-#  define D_NAMLEN(d) ((d)->d_namlen)
-#  if defined (USG)
-#    if defined (Xenix)
-#      include <sys/ndir.h>
-#    else /* !Xenix (but USG...) */
-#      include "ndir.h"
-#    endif /* !Xenix */
-#  else /* !USG */
-#    include <sys/dir.h>
-#  endif /* !USG */
-#  if !defined (dirent)
-#    define dirent direct
-#  endif /* !dirent */
-#endif /* !HAVE_DIRENT_H */
-
-#if defined (USG) && defined (TIOCGWINSZ) && !defined (Linux)
-#  if defined (HAVE_SYS_STREAM_H)
-#    include <sys/stream.h>
-#  endif /* HAVE_SYS_STREAM_H */
-#  if defined (HAVE_SYS_PTEM_H)
-#    include <sys/ptem.h>
-#  endif /* HAVE_SYS_PTEM_H */
-#  if defined (HAVE_SYS_PTE_H)
-#    include <sys/pte.h>
-#  endif /* HAVE_SYS_PTE_H */
-#endif /* USG && TIOCGWINSZ && !Linux */
+#if defined (HAVE_SYS_STREAM_H)
+#  include <sys/stream.h>
+#endif /* HAVE_SYS_STREAM_H */
+#if defined (HAVE_SYS_PTEM_H)
+#  include <sys/ptem.h>
+#  define _IO_PTEM_H           /* work around SVR4.2 1.1.4 bug */
+#endif /* HAVE_SYS_PTEM_H */
+#if defined (HAVE_SYS_PTE_H)
+#  include <sys/pte.h>
+#endif /* HAVE_SYS_PTE_H */
 
 /* Posix macro to check file in statbuf for directory-ness.
    This requires that <sys/stat.h> be included before this test. */
 /* Decide which flavor of the header file describing the C library
    string functions to include and include it. */
 
-#if defined (USG) || defined (NeXT)
-#  if !defined (HAVE_STRING_H)
-#    define HAVE_STRING_H
-#  endif /* !HAVE_STRING_H */
-#endif /* USG || NeXT */
-
 #if defined (HAVE_STRING_H)
 #  include <string.h>
 #else /* !HAVE_STRING_H */
 extern char *strchr (), *strrchr ();
 #endif /* !strchr && !__STDC__ */
 
-#if defined (HAVE_VARARGS_H)
-#  include <varargs.h>
-#endif /* HAVE_VARARGS_H */
-
-/* This is needed to include support for TIOCGWINSZ and window resizing. */
-#if defined (OSF1) || defined (BSD386) || defined (NetBSD) || \
-    defined (__BSD_4_4__) || defined (FreeBSD) || defined (_386BSD) || \
-    defined (AIX)
-#  define GWINSZ_IN_SYS_IOCTL
+#if defined (PREFER_STDARG)
+#  include <stdarg.h>
+#else
+#  if defined (PREFER_VARARGS)
+#    include <varargs.h>
+#  endif
 #endif
 
-/* Define _POSIX_VDISABLE if we are not using the `new' tty driver and
-   it is not already defined.  It is used both to determine if a
-   special character is disabled and to disable certain special
-   characters.  Posix systems should set to 0, USG systems to -1. */
-#if !defined (NEW_TTY_DRIVER) && !defined (_POSIX_VDISABLE)
-#  if defined (_SVR4_VDISABLE)
-#    define _POSIX_VDISABLE _SVR4_VDISABLE
-#  else
-#    if defined (_POSIX_VERSION)
-#      define _POSIX_VDISABLE 0
-#    else /* !_POSIX_VERSION */
-#      define _POSIX_VDISABLE -1
-#    endif /* !_POSIX_VERSION */
-#  endif /* !_SVR4_VDISABLE */
-#endif /* !NEW_TTY_DRIVER && !_POSIX_VDISABLE */
-
+#if defined (HAVE_STRCASECMP)
+#define _rl_stricmp strcasecmp
+#define _rl_strnicmp strncasecmp
+#else
+extern int _rl_stricmp (), _rl_strnicmp ();
+#endif
 
 #if !defined (emacs_mode)
 #  define no_mode -1
@@ -206,7 +114,33 @@ extern char *xmalloc ();
 #define AUDIBLE_BELL 1
 #define VISIBLE_BELL 2
 
+/* Definitions used when searching the line for characters. */
+/* NOTE: it is necessary that opposite directions are inverses */
+#define        FTO      1              /* forward to */
+#define BTO    -1              /* backward to */
+#define FFIND   2              /* forward find */
+#define BFIND  -2              /* backward find */
+
+/* Possible values for the found_quote flags word used by the completion
+   functions.  It says what kind of (shell-like) quoting we found anywhere
+   in the line. */
+#define RL_QF_SINGLE_QUOTE     0x1
+#define RL_QF_DOUBLE_QUOTE     0x2
+#define RL_QF_BACKSLASH                0x4
+
+/* Default readline line buffer length. */
+#define DEFAULT_BUFFER_SIZE 256
+
+#if !defined (STREQ)
+#define STREQ(a, b)    (((a)[0] == (b)[0]) && (strcmp ((a), (b)) == 0))
+#define STREQN(a, b, n)        (((a)[0] == (b)[0]) && (strncmp ((a), (b), (n)) == 0))
+#endif
+
+#if !defined (FREE)
+#  define FREE(x)      if (x) free (x)
+#endif
+
 /* CONFIGURATION SECTION */
 #include "rlconf.h"
 
-#endif /* !_RLDEFS_H */
+#endif /* !_RLDEFS_H_ */