/* Libart_LGPL - library of basic graphic primitives * Copyright (C) 1998 Raph Levien * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either * version 2 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 * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this library; if not, write to the * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ /* Simple macros to set up storage allocation and basic types for libart functions. */ #ifndef __ART_MISC_H__ #define __ART_MISC_H__ #include /* for malloc, etc. */ #define art_alloc malloc #define art_free free #define art_realloc realloc /* These aren't, strictly speaking, configuration macros, but they're damn handy to have around, and may be worth playing with for debugging. */ #define art_new(type, n) ((type *)art_alloc ((n) * sizeof(type))) #define art_renew(p, type, n) ((type *)art_realloc (p, (n) * sizeof(type))) /* This one must be used carefully - in particular, p and max should be variables. They can also be pstruct->el lvalues. */ #define art_expand(p, type, max) p = art_renew (p, type, max <<= 1) typedef int art_boolean; #define ART_FALSE 0 #define ART_TRUE 1 /* define pi */ #ifndef M_PI #define M_PI 3.14159265358979323846 #endif /* M_PI */ #ifndef M_SQRT2 #define M_SQRT2 1.41421356237309504880 /* sqrt(2) */ #endif /* M_SQRT2 */ /* These will be true on all platforms I care about. Nonetheless, it should be autoconf'ed. */ typedef unsigned char art_u8; typedef unsigned int art_u32; void art_die (const char *fmt, ...); void art_warn (const char *fmt, ...); #endif /* __ART_MISC_H__ */