Replace deprecated luaL_openlib() by luaL_register()
[apps/madmutt.git] / lib-lib / lib-lib.h
1 /*
2  *  This program is free software; you can redistribute it and/or modify
3  *  it under the terms of the GNU General Public License as published by
4  *  the Free Software Foundation; either version 2 of the License, or (at
5  *  your option) any later version.
6  *
7  *  This program is distributed in the hope that it will be useful, but
8  *  WITHOUT ANY WARRANTY; without even the implied warranty of
9  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
10  *  General Public License for more details.
11  *
12  *  You should have received a copy of the GNU General Public License
13  *  along with this program; if not, write to the Free Software
14  *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
15  *  MA 02110-1301, USA.
16  *
17  *  Copyright © 2006 Pierre Habouzit
18  */
19
20 #ifndef MUTT_LIB_LIB_LIB_LIB_H
21 #define MUTT_LIB_LIB_LIB_LIB_H
22
23 #ifdef HAVE_CONFIG_H
24 # include <config.h>
25 #endif
26
27 #ifndef __GNUC__
28 #  define __attribute__(a)
29 #endif
30
31 /* very common and usual headers we just want to have available {{{ */
32
33 #include <assert.h>
34 #include <ctype.h>
35 #include <dirent.h>
36 #include <errno.h>
37 #include <fcntl.h>
38 #include <limits.h>
39 #include <regex.h>
40 #include <stdarg.h>
41 #include <stddef.h>
42 #include <stdio.h>
43 #include <stdlib.h>
44 #include <string.h>
45 #include <sys/stat.h>
46 #include <sys/types.h>
47 #include <sys/wait.h>
48 #include <time.h>
49 #include <wchar.h>
50 #include <wctype.h>
51
52 #ifdef HAVE_UNISTD_H
53 # include <unistd.h>
54 #endif
55
56 #if HAVE_STDINT_H
57 # include <stdint.h>
58 #elif HAVE_INTTYPES_H
59 # include <inttypes.h>
60 #endif
61 #include <stdbool.h>
62
63 #ifdef HAVE_SYS_TIME_H
64 # include <sys/time.h>
65 #endif
66
67 #ifdef HAVE_LOCALE_H
68 #include <locale.h>
69 #endif
70
71 #ifndef _POSIX_PATH_MAX
72 #include <posix1_lim.h>
73 #endif
74
75 /* }}} */
76 /* useful and common macros {{{ */
77
78 #ifdef _
79 #  undef _
80 #endif
81
82 #ifdef HAVE_LIBIDN
83 #  include <libintl.h>
84 #define _(a)       (gettext(a))
85 #  ifdef gettext_noop
86 #    define N_(a)  gettext_noop(a)
87 #  else
88 #    define N_(a)  (a)
89 #  endif
90 #else
91 #  define _(a)     (a)
92 #  define N_(a)    (a)
93 #endif
94
95 #define TRUE 1
96 #define FALSE 0
97
98 #undef MAX
99 #undef MIN
100 #define MAX(a,b) ((a) < (b) ? (b) : (a))
101 #define MIN(a,b) ((a) < (b) ? (a) : (b))
102
103 #define __must_check__  __attribute__((warn_unused_result))
104 #define IGNORE(expr)  do { if (expr) (void)0; } while (0)
105
106 #define __init  __attribute__((__used__,__constructor__))
107 #define __fini  __attribute__((__used__,__destructor__))
108
109 /* }}} */
110
111 typedef union __attribute__((transparent_union)) anytype {
112     void  *ptr;
113     long  li;
114     int   i;
115     short si;
116 } anytype;
117
118 #include "mem.h"
119 #include "str.h"
120 #include "utf8.h"
121
122 #include "array.h"
123 #include "bits.h"
124 #include "buffer.h"
125 #include "file.h"
126 #include "hash.h"
127 #include "list.h"
128 #include "md5.h"
129 #include "mapping.h"
130 #include "rx.h"
131 #include "url.h"
132
133 #endif