Back to index

texmacs  1.0.7.15
numbers.h
Go to the documentation of this file.
00001 /*  $Header: /home/cvsroot/dvipdfmx/src/numbers.h,v 1.10 2008/11/30 21:12:27 matthias Exp $
00002 
00003     This is dvipdfmx, an eXtended version of dvipdfm by Mark A. Wicks.
00004 
00005     Copyright (C) 2002 by Jin-Hwan Cho and Shunsaku Hirata,
00006     the dvipdfmx project team <dvipdfmx@project.ktug.or.kr>
00007     
00008     Copyright (C) 1998, 1999 by Mark A. Wicks <mwicks@kettering.edu>
00009 
00010     This program is free software; you can redistribute it and/or modify
00011     it under the terms of the GNU General Public License as published by
00012     the Free Software Foundation; either version 2 of the License, or
00013     (at your option) any later version.
00014     
00015     This program is distributed in the hope that it will be useful,
00016     but WITHOUT ANY WARRANTY; without even the implied warranty of
00017     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00018     GNU General Public License for more details.
00019     
00020     You should have received a copy of the GNU General Public License
00021     along with this program; if not, write to the Free Software
00022     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
00023 */
00024 
00025 #ifndef _NUMBERS_H_
00026 #define _NUMBERS_H_
00027 
00028 #include <stdio.h>
00029 #include <math.h>
00030 
00031 typedef unsigned char Ubyte;
00032 typedef int UNSIGNED_BYTE, SIGNED_BYTE, SIGNED_PAIR;
00033 typedef unsigned UNSIGNED_PAIR;
00034 typedef long UNSIGNED_TRIPLE, SIGNED_TRIPLE, SIGNED_QUAD;
00035 typedef unsigned long UNSIGNED_QUAD;
00036 
00037 extern UNSIGNED_BYTE get_unsigned_byte (FILE *);
00038 #if 0
00039 extern UNSIGNED_BYTE sget_unsigned_byte (char *);
00040 #endif
00041 extern SIGNED_BYTE get_signed_byte (FILE *);
00042 extern UNSIGNED_PAIR get_unsigned_pair (FILE *);
00043 extern UNSIGNED_PAIR sget_unsigned_pair (unsigned char *);
00044 extern SIGNED_PAIR get_signed_pair (FILE *);
00045 extern UNSIGNED_TRIPLE get_unsigned_triple (FILE *);
00046 extern SIGNED_TRIPLE get_signed_triple (FILE *);
00047 extern SIGNED_QUAD get_signed_quad (FILE *);
00048 extern UNSIGNED_QUAD get_unsigned_quad (FILE *);
00049 
00050 typedef signed long fixword;
00051 
00052 extern SIGNED_QUAD sqxfw (SIGNED_QUAD sq, fixword fw);
00053 #if 0
00054 extern SIGNED_QUAD axboverc (SIGNED_QUAD n1, SIGNED_QUAD n2, SIGNED_QUAD divide);
00055 #endif
00056 
00057 #ifndef MAX
00058 #  define MAX(a,b) ((a)>(b)?(a):(b))
00059 #endif
00060 #ifndef MIN
00061 #  define MIN(a,b) ((a)<(b)?(a):(b))
00062 #endif
00063 #define ISODD(n) (((n)/2)*2!=(n))
00064 #define ISEVEN(n) (((n)/2)*2==(n))
00065 
00066 #ifndef M_PI
00067 #  define M_PI (4.0*atan(1.0))
00068 #endif
00069 
00070 #define ROUND(n,acc) (floor(((double)n)/(acc)+0.5)*(acc)) 
00071 
00072 #if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
00073 #  define __C99__
00074 #endif
00075 
00076 #ifndef __C99__
00077 #  ifndef round
00078 #  define round(v) (floor((v) + 0.5))
00079 #  endif
00080 #  ifndef trunc
00081 #  define trunc(v) ((v) > 0.0 ? floor((v)) : ceil((v)))
00082 #  endif
00083 #endif
00084 #define round_at(v,acc) (round(((double)(v))/(acc))*(acc))
00085 
00086 #endif /* _NUMBERS_H_ */