diff options
author | Karl Berry <karl@freefriends.org> | 2006-01-17 21:41:51 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2006-01-17 21:41:51 +0000 |
commit | 487ca4806cc046076293cf6cc5fbba0db282bac7 (patch) | |
tree | 847b412ab5158dd7bdd7ed7e5a4cc3fbca94be32 /Build/source/texk/seetexk/fio.h | |
parent | a3d3111bfe26b8e5f5bc6049dfb2a4ca2edc7881 (diff) |
texk 1
git-svn-id: svn://tug.org/texlive/trunk@1485 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/texk/seetexk/fio.h')
-rw-r--r-- | Build/source/texk/seetexk/fio.h | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/Build/source/texk/seetexk/fio.h b/Build/source/texk/seetexk/fio.h new file mode 100644 index 00000000000..53f2ef8ca81 --- /dev/null +++ b/Build/source/texk/seetexk/fio.h @@ -0,0 +1,53 @@ +/* + * Copyright (c) 1987, 1989 University of Maryland + * Department of Computer Science. All rights reserved. + * Permission to copy for any purpose is hereby granted + * so long as this copyright notice remains intact. + */ + +/* + * File I/O: numbers. + * + * We deal in fixed format numbers and (FILE *)s here. + * For pointer I/O, see pio.h. + * + * N.B.: These do the `wrong thing' at EOF. It is imperative + * that the caller add appropriate `if (feof(fp))' statements. + */ + +/* + * Get one unsigned byte. Note that this is a proper expression. + * The reset have more limited contexts, and are therefore OddLy + * CapItaliseD. + */ +#define fgetbyte(fp) getc(fp) + +/* + * Get a two-byte unsigned integer, a three-byte unsigned integer, + * or a four-byte signed integer. + */ +#define fGetWord(fp, r) ((r) = getc(fp) << 8, (r) |= getc(fp)) +#define fGet3Byte(fp,r) ((r) = getc(fp) << 16, (r) |= getc(fp) << 8, \ + (r) |= getc(fp)) +#define fGetLong(fp, r) ((r) = getc(fp) << 24, (r) |= getc(fp) << 16, \ + (r) |= getc(fp) << 8, (r) |= getc(fp)) + +/* + * Fast I/O write (and regular write) macros. + */ +#define putbyte(fp, r) ((void) putc((r), fp)) + +#define PutWord(fp, r) ((void) putc((r) >> 8, fp), \ + (void) putc((r), fp)) +#define Put3Byte(fp, r) ((void) putc((r) >> 16, fp), \ + (void) putc((r) >> 8, fp), \ + (void) putc((r), fp)) +#define PutLong(fp, r) ((void) putc((r) >> 24, fp), \ + (void) putc((r) >> 16, fp), \ + (void) putc((r) >> 8, fp), \ + (void) putc((r), fp)) + +/* + * Function types + */ +i32 GetByte(), GetWord(), Get3Byte(), GetLong(); |