• Home
  • History
  • Annotate
  • Line#
  • Navigate
  • Raw
  • Download
  • only in /netgear-WNDR4500v2-V1.0.0.60_1.0.38/ap/gpl/timemachine/gettext-0.17/gettext-tools/gnulib-lib/
1/* GLIB - Library of useful routines for C programming
2 * Copyright (C) 1995-1997  Peter Mattis, Spencer Kimball and Josh MacDonald
3 *
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public
6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version.
8 *
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the GNU
12 * Lesser General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public
15 * License along with this library; if not, write to the
16 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17 * Boston, MA 02111-1307, USA.
18 */
19
20/*
21 * Modified by the GLib Team and others 1997-2000.  See the AUTHORS
22 * file for a list of people on the GLib Team.  See the ChangeLog
23 * files for a list of changes.  These files are distributed with
24 * GLib at ftp://ftp.gtk.org/pub/gtk/.
25 */
26
27/*
28 * Modified by Bruno Haible for use as a gnulib module.
29 */
30
31/* ====================== Substitute for glibconfig.h ====================== */
32
33#include <stddef.h>
34#include <sys/types.h>
35#include <stdint.h>
36
37typedef uint16_t guint16;
38typedef uint32_t guint32;
39
40typedef size_t gsize;
41typedef ssize_t gssize;
42
43#define GPOINTER_TO_INT(p)	((gint)   (p))
44#define GPOINTER_TO_UINT(p)	((guint)  (p))
45
46#define GINT_TO_POINTER(i)	((gpointer)  (i))
47#define GUINT_TO_POINTER(u)	((gpointer)  (u))
48
49#define g_memmove memmove
50
51/* ================ Abridged version of for <glib/macros.h> ================ */
52
53#if    __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96)
54#define G_GNUC_PURE                            \
55  __attribute__((__pure__))
56#define G_GNUC_MALLOC    			\
57  __attribute__((__malloc__))
58#else
59#define G_GNUC_PURE
60#define G_GNUC_MALLOC
61#endif
62
63#if     __GNUC__ >= 4
64#define G_GNUC_NULL_TERMINATED __attribute__((__sentinel__))
65#else
66#define G_GNUC_NULL_TERMINATED
67#endif
68
69#if     __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ > 4)
70#define G_GNUC_PRINTF( format_idx, arg_idx )    \
71  __attribute__((__format__ (__printf__, format_idx, arg_idx)))
72#define G_GNUC_SCANF( format_idx, arg_idx )     \
73  __attribute__((__format__ (__scanf__, format_idx, arg_idx)))
74#define G_GNUC_FORMAT( arg_idx )                \
75  __attribute__((__format_arg__ (arg_idx)))
76#define G_GNUC_NORETURN                         \
77  __attribute__((__noreturn__))
78#define G_GNUC_CONST                            \
79  __attribute__((__const__))
80#define G_GNUC_UNUSED                           \
81  __attribute__((__unused__))
82#define G_GNUC_NO_INSTRUMENT			\
83  __attribute__((__no_instrument_function__))
84#else   /* !__GNUC__ */
85#define G_GNUC_PRINTF( format_idx, arg_idx )
86#define G_GNUC_SCANF( format_idx, arg_idx )
87#define G_GNUC_FORMAT( arg_idx )
88#define G_GNUC_NORETURN
89#define G_GNUC_CONST
90#define G_GNUC_UNUSED
91#define G_GNUC_NO_INSTRUMENT
92#endif  /* !__GNUC__ */
93
94#if    __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)
95#define G_GNUC_WARN_UNUSED_RESULT 		\
96  __attribute__((warn_unused_result))
97#else
98#define G_GNUC_WARN_UNUSED_RESULT
99#endif /* __GNUC__ */
100
101#ifdef  __cplusplus
102# define G_BEGIN_DECLS  extern "C" {
103# define G_END_DECLS    }
104#else
105# define G_BEGIN_DECLS
106# define G_END_DECLS
107#endif
108
109#ifndef	FALSE
110#define	FALSE	(0)
111#endif
112
113#ifndef	TRUE
114#define	TRUE	(!FALSE)
115#endif
116
117#undef	MAX
118#define MAX(a, b)  (((a) > (b)) ? (a) : (b))
119
120#undef	MIN
121#define MIN(a, b)  (((a) < (b)) ? (a) : (b))
122
123#define G_STMT_START
124#define G_STMT_END
125
126/* ====================== Substitute for <glib/gmem.h> ====================== */
127
128#include "xalloc.h"
129
130#define g_malloc(n) xmalloc (n)
131#define g_malloc0(n) xzalloc (n)
132#define g_realloc(p,n) xrealloc (p, n)
133#define g_free(p) free (p)
134#define g_try_malloc(n) xmalloc (n)
135#define g_try_malloc0(n) xzalloc (n)
136#define g_try_realloc(p,n) xrealloc (p, n)
137
138#define g_new(t,n) ((t *) xnmalloc (n, sizeof (t)))
139#define g_new0(t,n) ((t *) xcalloc (n, sizeof (t)))
140#define g_try_new(t,n) ((t *) xnmalloc (n, sizeof (t)))
141#define g_try_new0(t,n) ((t *) xcalloc (n, sizeof (t)))
142
143/* =================== Substitute for <glib/gmessages.h> =================== */
144
145#include <stdlib.h>
146
147#define g_assert(expr)                 if (!(expr)) abort ()
148#define g_assert_not_reached()         abort ()
149
150#define g_return_if_fail(expr)         if (!(expr)) return
151#define g_return_val_if_fail(expr,val) if (!(expr)) return (val)
152#define g_return_if_reached()          return
153#define g_return_val_if_reached(val)   return (val)
154
155#define G_LOG_LEVEL_CRITICAL 0
156#define G_LOG_LEVEL_INFO     0
157#define G_LOG_LEVEL_DEBUG    0
158
159extern void g_printerr (const char *format, ...) G_GNUC_PRINTF (1, 2);
160extern void g_warning (const char *format, ...) G_GNUC_PRINTF (1, 2);
161extern void g_log (const char *domain, int level, const char *format, ...) G_GNUC_PRINTF (3, 4);
162
163/* ==================== Substitute for <glib/gprintf.h> ==================== */
164
165#include <stdio.h>
166
167#define g_printf printf
168#define g_fprintf fprintf
169#define g_sprintf sprintf
170#define g_vprintf vprintf
171#define g_vfprintf vfprintf
172#define g_vsprintf vsprintf
173#define g_vasprintf vasprintf
174
175/* ===================== Substitute for <glib/gslice.h> ===================== */
176
177#define g_slice_new(t) XMALLOC (t)
178#define g_slice_new0(t) XZALLOC (t)
179
180#define g_slice_free(t,p) free (p)
181
182/* ======================= Helper for <glib/gtypes.h> ======================= */
183
184/* We don't need to export variables from a shared library.  */
185#define GLIB_VAR extern
186
187/* ==================== Substitute for <glib/gunicode.h> ==================== */
188
189typedef unsigned int gunichar;
190