summaryrefslogtreecommitdiff
path: root/lib/common.h
blob: d6baffc4a4022d95f00926fd4d97f6fb97af0e81 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
/* FriBidi
 * common.h - common include for library sources
 *
 * $Id: common.h,v 1.1.1.1 2004-04-25 18:47:57 behdad Exp $
 * $Author: behdad $
 * $Date: 2004-04-25 18:47:57 $
 * $Revision: 1.1.1.1 $
 * $Source: /home/behdad/src/fdo/fribidi/togit/git/../fribidi/fribidi2/lib/common.h,v $
 *
 * Author:
 *   Behdad Esfahbod, 2004
 *
 * Copyright (C) 2004 Sharif FarsiWeb, Inc.
 * 
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 * 
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 * 
 * You should have received a copy of the GNU Lesser General Public License
 * along with this library, in a file named COPYING; if not, write to the
 * Free Software Foundation, Inc., 59 Temple Place, Suite 330,
 * Boston, MA 02111-1307, USA
 *
 * For licensing issues, contact <license@farsiweb.info>.
 */
#ifndef _COMMON_H
#define _COMMON_H

#if HAVE_CONFIG_H
# include <config.h>
#endif

#include <fribidi-common.h>

#if WIN32
# define FRIBIDI_ENTRY __declspec(dllexport)
#endif /* WIN32 */

#ifndef FALSE
# define FALSE (0==1)
#endif /* !FRIBIDI_FALSE */

#ifndef TRUE
# define TRUE (!FALSE)
#endif /* !TRUE */

#ifndef NULL
# define NULL (void *) 0
#endif /* !NULL */

#if FRIBIDI_USE_GLIB
# ifndef SIZEOF_LONG
#  define SIZEOF_LONG GLIB_SIZEOF_LONG
# endif	/* !SIZEOF_LONG */
# ifndef SIZEOF_VOID_P
#  define SIZEOF_VOID_P GLIB_SIZEOF_VOID_P
# endif	/* !SIZEOF_VOID_P */
# if !__C2MAN__
#  include <glib/gmem.h>
# endif	/* !__C2MAN__ */
# ifndef fribidi_malloc
#  define fribidi_malloc g_malloc
#  define fribidi_free g_free
# endif	/* !fribidi_malloc */
#endif /* FRIBIDI_USE_GLIB */

/* fribidi_malloc and fribidi_free should be used instead of malloc and free. 
 * No need to include any headers. */
#ifndef fribidi_malloc
# if HAVE_STDLIB_H
#  if !__C2MAN__
#   include <stdlib.h>
#  endif /* __C2MAN__ */
#  define fribidi_malloc malloc
# else /* !HAVE_STDLIB_H */
#  define fribidi_malloc (void *) malloc
# endif	/* !HAVE_STDLIB_H */
# define fribidi_free free
#endif /* !fribidi_malloc */

/* FRIBIDI_CHUNK_SIZE is the number of bytes in each chunk of memory being
 * allocated for data structure pools. */
#ifndef FRIBIDI_CHUNK_SIZE
# define FRIBIDI_CHUNK_SIZE 4096
#else /* FRIBIDI_CHUNK_SIZE */
# if FRIBIDI_CHUNK_SIZE < 256
#  error FRIBIDI_CHUNK_SIZE now should define the size of a chunk in bytes.
# endif	/* FRIBIDI_CHUNK_SIZE < 256 */
#endif /* FRIBIDI_CHUNK_SIZE */

/* FRIBIDI_BEGIN_STMT should be used at the beginning of your macro
 * definitions that are to behave like simple statements.  Use
 * FRIBIDI_END_STMT at the end of the macro after the semicolon or brace */
#ifndef FRIBIDI_BEGIN_STMT
# define FRIBIDI_BEGIN_STMT do {
# define FRIBIDI_END_STMT } while (0)
#endif /* !FRIBIDI_BEGIN_STMT */

#include "debug.h"

#endif /* !_COMMON_H */
/* Editor directions:
 * vim:textwidth=78:tabstop=8:shiftwidth=2:autoindent:cindent
 */