1 /* catdvi - get text from DVI files 2 Copyright (C) 1999 Antti-Juhani Kaijanaho <gaia@iki.fi> 3 4 This program is free software; you can redistribute it and/or modify 5 it under the terms of the GNU General Public License as published by 6 the Free Software Foundation; either version 2 of the License, or 7 (at your option) any later version. 8 9 This program 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 12 GNU General Public License for more details. 13 14 You should have received a copy of the GNU General Public License 15 along with this program; if not, write to the Free Software 16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 17 */ 18 19 #ifndef FIXWORD_H 20 #define FIXWORD_H 21 22 #include "bytesex.h" 23 24 /* fix_word is used in TFM files; read the TFM file spec for more 25 info. */ 26 27 #define FW_FIX_WORD_BIT 32 28 #define FW_WHOLEPART_BIT 12 29 #define FW_FRACTION_BIT (FW_FIX_WORD_BIT - FW_WHOLEPART_BIT) 30 31 typedef sint32 fix_word_t; 32 33 /* fix_word_t read_fw(FILE *); */ 34 #define read_fw(fp) (s_readbigendiannumber(4,(fp))) 35 36 double fw2double(fix_word_t); 37 38 /* fix_word_t double2fw(double); */ 39 #define double2fw(dbl) ((fix_word_t) ((dbl) * (1 << FW_FRACTION_BIT))) 40 41 #define fw2int(fw) ((fw) / (1 << FW_FRACTION_BIT)) 42 43 /* fix_word_t fw_negate(fix_word_t); */ 44 #define fw_negate(fw) (-(fw)) 45 46 /* fix_word_t fw_sum(fix_word_t, fix_word_t); */ 47 #define fw_sum(fw1,fw2) ((fw1) + (fw2)) 48 49 /* Calculates x * y. */ 50 fix_word_t fw_prod(fix_word_t x, fix_word_t y); 51 52 53 54 #endif /* FIXWORD_H */ 55