| 1 |
/* |
| 2 |
* $Id: general.h 508 2007-05-03 03:20:59Z dhiebert $ |
| 3 |
* |
| 4 |
* Copyright (c) 1998-2003, Darren Hiebert |
| 5 |
* |
| 6 |
* This source code is released for free distribution under the terms of the |
| 7 |
* GNU General Public License. |
| 8 |
* |
| 9 |
* Provides the general (non-ctags-specific) environment assumed by all. |
| 10 |
*/ |
| 11 |
#ifndef _GENERAL_H |
| 12 |
#define _GENERAL_H |
| 13 |
|
| 14 |
/* |
| 15 |
* INCLUDE FILES |
| 16 |
*/ |
| 17 |
#if defined (HAVE_CONFIG_H) |
| 18 |
# include <config.h> |
| 19 |
#elif defined (AMIGA) |
| 20 |
# include "e_amiga.h" |
| 21 |
#elif defined (DJGPP) |
| 22 |
# include "e_djgpp.h" |
| 23 |
#elif defined (macintosh) |
| 24 |
# include "e_mac.h" |
| 25 |
#elif defined (MSDOS) || defined (WIN32) |
| 26 |
# include "e_msoft.h" |
| 27 |
#elif defined (OS2) |
| 28 |
# include "e_os2.h" |
| 29 |
#elif defined (QDOS) |
| 30 |
# include "e_qdos.h" |
| 31 |
#elif defined (RISCOS) |
| 32 |
# include "e_riscos.h" |
| 33 |
#elif defined (__vms) || defined (VMS) |
| 34 |
# include "e_vms.h" |
| 35 |
# ifndef VMS |
| 36 |
# define VMS 1 |
| 37 |
# endif |
| 38 |
#endif |
| 39 |
|
| 40 |
|
| 41 |
/* |
| 42 |
* MACROS |
| 43 |
*/ |
| 44 |
|
| 45 |
/* Define standard error destination |
| 46 |
*/ |
| 47 |
#ifndef errout |
| 48 |
# define errout stderr |
| 49 |
#endif |
| 50 |
|
| 51 |
/* Define regex if supported */ |
| 52 |
#if (defined (HAVE_REGCOMP) && !defined (REGCOMP_BROKEN)) |
| 53 |
# define HAVE_REGEX 1 |
| 54 |
#endif |
| 55 |
|
| 56 |
/* This is a helpful internal feature of later versions (> 2.7) of GCC |
| 57 |
* to prevent warnings about unused variables. |
| 58 |
*/ |
| 59 |
#if (__GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7)) && !defined (__GNUG__) |
| •60 |
# ifndef __unused |
| 61 |
# define __unused __attribute__((unused)) |
| 62 |
# endif |
| 63 |
# define __printf__(s,f) __attribute__((format (printf, s, f))) |
| 64 |
#else |
| •65 |
# define __unused |
| 66 |
# define __printf__(s,f) |
| 67 |
#endif |
| 68 |
|
| 69 |
/* |
| 70 |
* Portability macros |
| 71 |
*/ |
| 72 |
#if !defined(HAVE_STRCASECMP) && !defined(strcasecmp) |
| 73 |
# ifdef HAVE_STRICMP |
| 74 |
# define strcasecmp(s1,s2) stricmp(s1,s2) |
| 75 |
# else |
| 76 |
# define strcasecmp(s1,s2) struppercmp(s1,s2) |
| 77 |
# endif |
| 78 |
#endif |
| 79 |
|
| 80 |
#if !defined(HAVE_STRNCASECMP) && !defined(strncasecmp) |
| 81 |
# ifdef HAVE_STRNICMP |
| 82 |
# define strncasecmp(s1,s2,n) strnicmp(s1,s2,n) |
| 83 |
# else |
| 84 |
# define strncasecmp(s1,s2,n) strnuppercmp(s1,s2,n) |
| 85 |
# endif |
| 86 |
#endif |
| 87 |
|
| 88 |
/* |
| 89 |
* DATA DECLARATIONS |
| 90 |
*/ |
| 91 |
|
| 92 |
#undef FALSE |
| 93 |
#undef TRUE |
| 94 |
#ifdef VAXC |
| 95 |
typedef enum { FALSE, TRUE } booleanType; |
| 96 |
typedef int boolean; |
| 97 |
#else |
| 98 |
# ifdef __cplusplus |
| 99 |
typedef bool boolean; |
| 100 |
#define FALSE false |
| 101 |
#define TRUE true |
| 102 |
# else |
| 103 |
typedef enum { FALSE, TRUE } boolean; |
| 104 |
# endif |
| 105 |
#endif |
| 106 |
|
| 107 |
#if ! defined (HAVE_FGETPOS) && ! defined (fpos_t) |
| 108 |
# define fpos_t long |
| 109 |
#endif |
| 110 |
|
| 111 |
/* |
| 112 |
* FUNCTION PROTOTYPES |
| 113 |
*/ |
| 114 |
|
| 115 |
#if defined (NEED_PROTO_REMOVE) && defined (HAVE_REMOVE) |
| 116 |
extern int remove (const char *); |
| 117 |
#endif |
| 118 |
|
| 119 |
#if defined (NEED_PROTO_UNLINK) && ! defined (HAVE_REMOVE) |
| 120 |
extern void *unlink (const char *); |
| 121 |
#endif |
| 122 |
|
| 123 |
#ifdef NEED_PROTO_GETENV |
| 124 |
extern char *getenv (const char *); |
| 125 |
#endif |
| 126 |
|
| 127 |
#endif /* _GENERAL_H */ |
| 128 |
|
| 129 |
/* vi:set tabstop=4 shiftwidth=4: */ |