| 1 |
/* |
| 2 |
* File: texfiles.c |
| 3 |
* Purpose: basic binary TeX reading functions |
| 4 |
* Version: 1.0 (Nov 1993) |
| 5 |
* Author: Piet Tutelaers (derived from xdvi/pl16) |
| 6 |
*/ |
| 7 |
|
| 8 |
#include <stdio.h> |
| 9 |
#include "texfiles.h" |
| 10 |
|
| 11 |
#define one(fp) ((unsigned char) getc(fp)) |
| 12 |
|
| 13 |
unsigned long num(FILE *fp, int size) |
| 14 |
{ unsigned long x = 0; |
| 15 |
|
| 16 |
while (size--) x = (x << 8) | one(fp); |
| 17 |
return x; |
| 18 |
} |
| 19 |
|
| 20 |
integer snum(FILE *fp, int size) |
| 21 |
{ integer x; |
| 22 |
|
| 23 |
x = getc(fp); |
| 24 |
while (--size) x = (x << 8) | one(fp); |
| 25 |
return x; |
| 26 |
} |