~ubuntu-branches/ubuntu/maverick/gcompris/maverick

« back to all changes in this revision

Viewing changes to src/libart_lgpl/art_misc.h

  • Committer: Bazaar Package Importer
  • Author(s): Marc Gariepy, Marc Gariepy, Stephane Graber
  • Date: 2010-01-04 17:42:49 UTC
  • mfrom: (1.1.14 upstream)
  • Revision ID: james.westby@ubuntu.com-20100104174249-7bupatd9dtxyhvs4
Tags: 9.0-0ubuntu1
[Marc Gariepy]
* New upstream release (9.0).
* Remove cache.c from POTFILES to avoid FTBFS
* Remove unneeded rm in debian/rules (file no longer exists upstream)

[Stephane Graber]
* Bump Debian standards to 3.8.3
* Add patch system (dpatch)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* Libart_LGPL - library of basic graphic primitives
2
 
 * Copyright (C) 1998 Raph Levien
3
 
 *
4
 
 * This library is free software; you can redistribute it and/or
5
 
 * modify it under the terms of the GNU Library General Public
6
 
 * License as published by the Free Software Foundation; either
7
 
 * version 3 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
 
 * Library General Public License for more details.
13
 
 *
14
 
 * You should have received a copy of the GNU Library General Public
15
 
 * License along with this library; if not, see <http://www.gnu.org/licenses/>.
16
 
 * Boston, MA 02111-1307, USA.
17
 
 */
18
 
 
19
 
/* Simple macros to set up storage allocation and basic types for libart
20
 
   functions. */
21
 
 
22
 
#ifndef __ART_MISC_H__
23
 
#define __ART_MISC_H__
24
 
 
25
 
#include <stdlib.h> /* for malloc, etc. */
26
 
 
27
 
/* The art_config.h file is automatically generated by
28
 
   gen_art_config.c and contains definitions of
29
 
   ART_SIZEOF_{CHAR,SHORT,INT,LONG} and art_u{8,16,32}. */
30
 
#ifdef LIBART_COMPILATION
31
 
#include "art_config.h"
32
 
#else
33
 
#include <libart_lgpl/art_config.h>
34
 
#endif
35
 
 
36
 
#ifdef __cplusplus
37
 
extern "C" {
38
 
#endif
39
 
void *art_alloc(size_t size);
40
 
void art_free(void *ptr);
41
 
void *art_realloc(void *ptr, size_t size);
42
 
#ifdef __cplusplus
43
 
}
44
 
#endif /* __cplusplus */
45
 
 
46
 
/* These aren't, strictly speaking, configuration macros, but they're
47
 
   damn handy to have around, and may be worth playing with for
48
 
   debugging. */
49
 
#define art_new(type, n) ((type *)art_alloc ((n) * sizeof(type)))
50
 
 
51
 
#define art_renew(p, type, n) ((type *)art_realloc (p, (n) * sizeof(type)))
52
 
 
53
 
/* This one must be used carefully - in particular, p and max should
54
 
   be variables. They can also be pstruct->el lvalues. */
55
 
#define art_expand(p, type, max) do { if(max) { p = art_renew (p, type, max <<= 1); } else { max = 1; p = art_new(type, 1); } } while (0)
56
 
 
57
 
typedef int art_boolean;
58
 
#define ART_FALSE 0
59
 
#define ART_TRUE 1
60
 
 
61
 
/* define pi */
62
 
#ifndef M_PI
63
 
#define M_PI 3.14159265358979323846
64
 
#endif  /*  M_PI  */
65
 
 
66
 
#ifndef M_SQRT2
67
 
#define M_SQRT2         1.41421356237309504880  /* sqrt(2) */
68
 
#endif  /* M_SQRT2 */
69
 
 
70
 
/* Provide macros to feature the GCC function attribute.
71
 
 */
72
 
#if defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ > 4))
73
 
#define ART_GNUC_PRINTF( format_idx, arg_idx )    \
74
 
  __attribute__((__format__ (__printf__, format_idx, arg_idx)))
75
 
#define ART_GNUC_NORETURN                         \
76
 
  __attribute__((__noreturn__))
77
 
#else   /* !__GNUC__ */
78
 
#define ART_GNUC_PRINTF( format_idx, arg_idx )
79
 
#define ART_GNUC_NORETURN
80
 
#endif  /* !__GNUC__ */
81
 
 
82
 
#ifdef __cplusplus
83
 
extern "C" {
84
 
#endif
85
 
 
86
 
void ART_GNUC_NORETURN
87
 
art_die (const char *fmt, ...) ART_GNUC_PRINTF (1, 2);
88
 
 
89
 
void
90
 
art_warn (const char *fmt, ...) ART_GNUC_PRINTF (1, 2);
91
 
 
92
 
void
93
 
art_dprint (const char *fmt, ...) ART_GNUC_PRINTF (1, 2);
94
 
 
95
 
#ifdef __cplusplus
96
 
}
97
 
#endif
98
 
 
99
 
#define ART_USE_NEW_INTERSECTOR
100
 
 
101
 
#endif /* __ART_MISC_H__ */