Add some useful macros.
[apps/madmutt.git] / lib-lib / lib-lib.h
index 5f8974d..72ba9aa 100644 (file)
 #ifndef MUTT_LIB_LIB_LIB_LIB_H
 #define MUTT_LIB_LIB_LIB_LIB_H
 
-#include "macros.h"
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#ifndef __GNUC__
+#  define __attribute__(a)
+#endif
+
+/* very common and usual headers we just want to have available {{{ */
+
+#include <assert.h>
+#include <ctype.h>
+#include <dirent.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <limits.h>
+#include <regex.h>
+#include <stdarg.h>
+#include <stddef.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/stat.h>
+#include <sys/types.h>
+#include <sys/wait.h>
+#include <time.h>
+#include <wchar.h>
+#include <wctype.h>
+
+#ifdef HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_STDINT_H
+# include <stdint.h>
+#elif HAVE_INTTYPES_H
+# include <inttypes.h>
+#endif
+#include <stdbool.h>
+
+#ifdef HAVE_SYS_TIME_H
+# include <sys/time.h>
+#endif
+
+#ifdef HAVE_LOCALE_H
+#include <locale.h>
+#endif
+
+#ifndef _POSIX_PATH_MAX
+#include <posix1_lim.h>
+#endif
+
+/* }}} */
+/* useful and common macros {{{ */
+
+#ifdef _
+#  undef _
+#endif
+
+#ifdef HAVE_LIBIDN
+#  include <libintl.h>
+#define _(a)       (gettext(a))
+#  ifdef gettext_noop
+#    define N_(a)  gettext_noop(a)
+#  else
+#    define N_(a)  (a)
+#  endif
+#else
+#  define _(a)     (a)
+#  define N_(a)    (a)
+#endif
+
+#define TRUE 1
+#define FALSE 0
+
+#undef MAX
+#undef MIN
+#define MAX(a,b) ((a) < (b) ? (b) : (a))
+#define MIN(a,b) ((a) < (b) ? (a) : (b))
+
+#define __must_check__  __attribute__((warn_unused_result))
+#define IGNORE(expr)  do { if (expr) (void)0; } while (0)
+
+/* }}} */
+
+typedef union __attribute__((transparent_union)) anytype {
+    void  *ptr;
+    long  li;
+    int   i;
+    short si;
+} anytype;
+
 #include "mem.h"
+#include "str.h"
+#include "utf8.h"
 
-#include "ascii.h"
+#include "array.h"
+#include "bits.h"
 #include "buffer.h"
-#include "date.h"
 #include "file.h"
 #include "hash.h"
 #include "list.h"
+#include "md5.h"
 #include "mapping.h"
 #include "rx.h"
-#include "str.h"
 #include "url.h"
 
 #endif