1997-01-04 22:09:20 +00:00
|
|
|
/* rldefs.h -- an attempt to isolate some of the system-specific defines
|
|
|
|
for readline. This should be included after any files that define
|
|
|
|
system-specific constants like _POSIX_VERSION or USG. */
|
|
|
|
|
|
|
|
/* Copyright (C) 1987,1989 Free Software Foundation, Inc.
|
|
|
|
|
|
|
|
This file contains the Readline Library (the Library), a set of
|
|
|
|
routines for providing Emacs style line input to programs that ask
|
|
|
|
for it.
|
|
|
|
|
|
|
|
The Library is free software; you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
2000-03-19 21:18:09 +00:00
|
|
|
the Free Software Foundation; either version 2, or (at your option)
|
1997-01-04 22:09:20 +00:00
|
|
|
any later version.
|
|
|
|
|
|
|
|
The Library is distributed in the hope that it will be useful, but
|
|
|
|
WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
General Public License for more details.
|
|
|
|
|
|
|
|
The GNU General Public License is often shipped with GNU software, and
|
|
|
|
is generally kept in a file called COPYING or LICENSE. If you do not
|
|
|
|
have a copy of the license, write to the Free Software Foundation,
|
2000-03-19 21:18:09 +00:00
|
|
|
59 Temple Place, Suite 330, Boston, MA 02111 USA. */
|
1997-01-04 22:09:20 +00:00
|
|
|
|
|
|
|
#if !defined (_RLDEFS_H_)
|
|
|
|
#define _RLDEFS_H_
|
|
|
|
|
|
|
|
#if defined (HAVE_CONFIG_H)
|
|
|
|
# include "config.h"
|
|
|
|
#endif
|
|
|
|
|
2001-04-11 02:33:07 +00:00
|
|
|
#include "rlstdc.h"
|
|
|
|
|
1997-01-04 22:09:20 +00:00
|
|
|
#if defined (_POSIX_VERSION) && !defined (TERMIOS_MISSING)
|
|
|
|
# define TERMIOS_TTY_DRIVER
|
|
|
|
#else
|
|
|
|
# if defined (HAVE_TERMIO_H)
|
|
|
|
# define TERMIO_TTY_DRIVER
|
|
|
|
# else
|
|
|
|
# define NEW_TTY_DRIVER
|
|
|
|
# endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/* Posix macro to check file in statbuf for directory-ness.
|
|
|
|
This requires that <sys/stat.h> be included before this test. */
|
|
|
|
#if defined (S_IFDIR) && !defined (S_ISDIR)
|
|
|
|
# define S_ISDIR(m) (((m)&S_IFMT) == S_IFDIR)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/* Decide which flavor of the header file describing the C library
|
|
|
|
string functions to include and include it. */
|
|
|
|
|
|
|
|
#if defined (HAVE_STRING_H)
|
|
|
|
# include <string.h>
|
|
|
|
#else /* !HAVE_STRING_H */
|
|
|
|
# include <strings.h>
|
|
|
|
#endif /* !HAVE_STRING_H */
|
|
|
|
|
|
|
|
#if !defined (strchr) && !defined (__STDC__)
|
|
|
|
extern char *strchr (), *strrchr ();
|
|
|
|
#endif /* !strchr && !__STDC__ */
|
|
|
|
|
|
|
|
#if defined (PREFER_STDARG)
|
|
|
|
# include <stdarg.h>
|
|
|
|
#else
|
|
|
|
# if defined (PREFER_VARARGS)
|
|
|
|
# include <varargs.h>
|
|
|
|
# endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if defined (HAVE_STRCASECMP)
|
|
|
|
#define _rl_stricmp strcasecmp
|
|
|
|
#define _rl_strnicmp strncasecmp
|
|
|
|
#else
|
2001-04-11 02:33:07 +00:00
|
|
|
extern int _rl_stricmp __P((char *, char *);
|
|
|
|
extern int _rl_strnicmp __P((char *, char *));
|
1997-01-04 22:09:20 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#if !defined (emacs_mode)
|
|
|
|
# define no_mode -1
|
|
|
|
# define vi_mode 0
|
|
|
|
# define emacs_mode 1
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/* If you cast map[key].function to type (Keymap) on a Cray,
|
|
|
|
the compiler takes the value of map[key].function and
|
|
|
|
divides it by 4 to convert between pointer types (pointers
|
|
|
|
to functions and pointers to structs are different sizes).
|
|
|
|
This is not what is wanted. */
|
|
|
|
#if defined (CRAY)
|
|
|
|
# define FUNCTION_TO_KEYMAP(map, key) (Keymap)((int)map[key].function)
|
2001-04-11 02:33:07 +00:00
|
|
|
# define KEYMAP_TO_FUNCTION(data) (rl_command_func_t *)((int)(data))
|
1997-01-04 22:09:20 +00:00
|
|
|
#else
|
|
|
|
# define FUNCTION_TO_KEYMAP(map, key) (Keymap)(map[key].function)
|
2001-04-11 02:33:07 +00:00
|
|
|
# define KEYMAP_TO_FUNCTION(data) (rl_command_func_t *)(data)
|
1997-01-04 22:09:20 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef savestring
|
2001-04-11 02:33:07 +00:00
|
|
|
extern char *xmalloc __P((int));
|
1997-01-04 22:09:20 +00:00
|
|
|
#define savestring(x) strcpy (xmalloc (1 + strlen (x)), (x))
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/* Possible values for _rl_bell_preference. */
|
|
|
|
#define NO_BELL 0
|
|
|
|
#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))
|
2000-03-19 21:18:09 +00:00
|
|
|
#define STREQN(a, b, n) (((n) == 0) ? (1) \
|
|
|
|
: ((a)[0] == (b)[0]) && (strncmp ((a), (b), (n)) == 0))
|
1997-01-04 22:09:20 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#if !defined (FREE)
|
|
|
|
# define FREE(x) if (x) free (x)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/* CONFIGURATION SECTION */
|
|
|
|
#include "rlconf.h"
|
|
|
|
|
|
|
|
#endif /* !_RLDEFS_H_ */
|