| 1 |
/* $Header: /home/cvsroot/dvipdfmx/src/numbers.h,v 1.9 2005/07/20 10:41:54 hirata Exp $ |
| 2 |
|
| 3 |
This is dvipdfmx, an eXtended version of dvipdfm by Mark A. Wicks. |
| 4 |
|
| 5 |
Copyright (C) 2002-2015 by Jin-Hwan Cho and Shunsaku Hirata, |
| 6 |
the dvipdfmx project team <[email protected]> |
| 7 |
|
| 8 |
Copyright (C) 1998, 1999 by Mark A. Wicks <[email protected]> |
| 9 |
|
| 10 |
This program is free software; you can redistribute it and/or modify |
| 11 |
it under the terms of the GNU General Public License as published by |
| 12 |
the Free Software Foundation; either version 2 of the License, or |
| 13 |
(at your option) any later version. |
| 14 |
|
| 15 |
This program is distributed in the hope that it will be useful, |
| 16 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 17 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 18 |
GNU General Public License for more details. |
| 19 |
|
| 20 |
You should have received a copy of the GNU General Public License |
| 21 |
along with this program; if not, write to the Free Software |
| 22 |
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. |
| 23 |
*/ |
| 24 |
|
| 25 |
#ifndef _NUMBERS_H_ |
| 26 |
#define _NUMBERS_H_ |
| 27 |
|
| 28 |
#include <stdio.h> |
| 29 |
#include <math.h> |
| 30 |
|
| 31 |
extern unsigned char get_unsigned_byte (FILE *); |
| 32 |
extern unsigned short get_unsigned_pair (FILE *); |
| 33 |
|
| 34 |
#ifndef MAX |
| 35 |
# define MAX(a,b) ((a)>(b)?(a):(b)) |
| 36 |
#endif |
| 37 |
#ifndef MIN |
| 38 |
# define MIN(a,b) ((a)<(b)?(a):(b)) |
| 39 |
#endif |
| 40 |
#define ISODD(n) (((n)/2)*2!=(n)) |
| 41 |
#define ISEVEN(n) (((n)/2)*2==(n)) |
| 42 |
|
| 43 |
#define ROUND(n,acc) (floor(((double)n)/(acc)+0.5)*(acc)) |
| 44 |
|
| 45 |
#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L |
| 46 |
# define __C99__ |
| 47 |
#endif |
| 48 |
|
| 49 |
#ifndef __C99__ |
| 50 |
# ifndef round |
| 51 |
# define round(v) (floor((v) + 0.5)) |
| 52 |
# endif |
| 53 |
# ifndef trunc |
| 54 |
# define trunc(v) ((v) > 0.0 ? floor((v)) : ceil((v))) |
| 55 |
# endif |
| 56 |
#endif |
| 57 |
#define round_at(v,acc) (round(((double)(v))/(acc))*(acc)) |
| 58 |
|
| 59 |
#endif /* _NUMBERS_H_ */ |