add some very efficient utf8 routines. more to come.
[apps/madmutt.git] / lib-lib / lib-lib.h
index e969bb5..6dd3900 100644 (file)
 #ifndef MUTT_LIB_LIB_LIB_LIB_H
 #define MUTT_LIB_LIB_LIB_LIB_H
 
-#if HAVE_CONFIG_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>
@@ -46,6 +52,7 @@
 #ifdef HAVE_UNISTD_H
 # include <unistd.h>
 #endif
+
 #if HAVE_STDINT_H
 # include <stdint.h>
 #elif HAVE_INTTYPES_H
 #include <locale.h>
 #endif
 
-#include "macros.h"
-#include "mem.h"
+#ifndef _POSIX_PATH_MAX
+#include <posix1_lim.h>
+#endif
+
+/* }}} */
+/* useful and common macros {{{ */
+
+#ifdef _
+#  undef _
+#endif
 
-#include "ascii.h"
+#ifdef ENABLE_NLS
+#  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))
+
+/* }}} */
+
+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 "array.h"
 #include "buffer.h"
 #include "date.h"
 #include "file.h"