Back to index

tetex-bin  3.0
numbers.h
Go to the documentation of this file.
00001 /*  $Header$
00002 
00003     This is dvipdfm, a DVI to PDF translator.
00004     Copyright (C) 1998, 1999 by Mark A. Wicks
00005 
00006     This program is free software; you can redistribute it and/or modify
00007     it under the terms of the GNU General Public License as published by
00008     the Free Software Foundation; either version 2 of the License, or
00009     (at your option) any later version.
00010 
00011     This program is distributed in the hope that it will be useful,
00012     but WITHOUT ANY WARRANTY; without even the implied warranty of
00013     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014     GNU General Public License for more details.
00015 
00016     You should have received a copy of the GNU General Public License
00017     along with this program; if not, write to the Free Software
00018     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00019     
00020     The author may be contacted via the e-mail address
00021 
00022        mwicks@kettering.edu
00023 */
00024 
00025        
00026 #ifndef NUMBERS_H
00027 #define NUMBERS_H
00028 
00029 #include <stdio.h>
00030 #include <math.h>
00031 
00032 typedef unsigned char Ubyte;
00033 
00034 typedef int UNSIGNED_BYTE, SIGNED_BYTE, SIGNED_PAIR;
00035 typedef unsigned UNSIGNED_PAIR;
00036 typedef long  UNSIGNED_TRIPLE, SIGNED_TRIPLE, SIGNED_QUAD;
00037 typedef unsigned long UNSIGNED_QUAD;
00038 
00039 extern UNSIGNED_BYTE get_unsigned_byte (FILE *);
00040 
00041 extern UNSIGNED_BYTE sget_unsigned_byte (char *);
00042 
00043 extern SIGNED_BYTE get_signed_byte (FILE *);
00044 
00045 extern UNSIGNED_PAIR get_unsigned_pair (FILE *);
00046 
00047 extern UNSIGNED_PAIR sget_unsigned_pair (unsigned char *);
00048 
00049 extern SIGNED_PAIR get_signed_pair (FILE *);
00050 
00051 extern UNSIGNED_TRIPLE get_unsigned_triple (FILE *);
00052 
00053 extern SIGNED_TRIPLE get_signed_triple (FILE *);
00054 
00055 extern SIGNED_QUAD get_signed_quad (FILE *);
00056 
00057 extern UNSIGNED_QUAD get_unsigned_quad (FILE *);
00058 
00059 #define ROUND(n,acc) (floor(((double)n)/(acc)+0.5)*(acc)) 
00060 #ifndef MAX
00061   #define MAX(a,b) ((a)>(b)?(a):(b))
00062 #endif
00063 #ifndef MIN
00064   #define MIN(a,b) ((a)<(b)?(a):(b))
00065 #endif
00066 
00067 #define ISODD(n) (((n)/2)*2!=(n))
00068 #define ISEVEN(n) (((n)/2)*2==(n))
00069 
00070 typedef signed long fixword;
00071 
00072 extern SIGNED_QUAD sqxfw (SIGNED_QUAD sq, fixword fw);
00073 extern SIGNED_QUAD axboverc (SIGNED_QUAD n1, SIGNED_QUAD n2,
00074                           SIGNED_QUAD div);
00075 
00076 int fixnumtoa (char *s, long int i);
00077 int inttoa (char *s, long int i);
00078 int centi_u_to_a (char *s, long int i);
00079 
00080 #define IDIVRND(a,b) ((a)>0? ((a)+(b)/2)/(b): -((-(a)+(b)/2)/(b)))
00081 
00082 #define IDIV(a,b) ((a)>0? (a)/(b): -(-(a))/(b))
00083 
00084 #endif /* NUMBERS_H */
00085