Debian Codegraph @

texk/web2c/xetexdir/image/numbers.c

raw
1 /* $Header: /home/cvsroot/dvipdfmx/src/numbers.c,v 1.8 2004/03/03 13:19:00 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 #if HAVE_CONFIG_H
26 #include <w2c/config.h>
27 #endif
28
29 #include "mfileio.h"
30 #include "numbers.h"
31
32 unsigned char get_unsigned_byte (FILE *file)
33 {
34 int ch;
35 if ((ch = fgetc (file)) < 0) {
36 fprintf (stderr, "File ended prematurely\n");
37 exit(-1);
38 }
39 return (unsigned char) ch;
40 }
41
42 unsigned short get_unsigned_pair (FILE *file)
43 {
44 unsigned short pair = get_unsigned_byte(file);
45 pair = pair*0x100u + get_unsigned_byte(file);
46 return pair;
47 }