]> icculus.org git repositories - btb/d2x.git/blob - fileutil.h
da8110ccf8aaff30313bd7fca9d229bf0bb4f65b
[btb/d2x.git] / fileutil.h
1 /*
2 THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX
3 SOFTWARE CORPORATION ("PARALLAX").  PARALLAX, IN DISTRIBUTING THE CODE TO
4 END-USERS, AND SUBJECT TO ALL OF THE TERMS AND CONDITIONS HEREIN, GRANTS A
5 ROYALTY-FREE, PERPETUAL LICENSE TO SUCH END-USERS FOR USE BY SUCH END-USERS
6 IN USING, DISPLAYING,  AND CREATING DERIVATIVE WORKS THEREOF, SO LONG AS
7 SUCH USE, DISPLAY OR CREATION IS FOR NON-COMMERCIAL, ROYALTY OR REVENUE
8 FREE PURPOSES.  IN NO EVENT SHALL THE END-USER USE THE COMPUTER CODE
9 CONTAINED HEREIN FOR REVENUE-BEARING PURPOSES.  THE END-USER UNDERSTANDS
10 AND AGREES TO THE TERMS HEREIN AND ACCEPTS THE SAME BY USE OF THIS FILE.  
11 COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION.  ALL RIGHTS RESERVED.
12 */
13  
14 #ifndef _FILEUTIL_
15 #define _FILEUTIL_
16
17 #include "pstypes.h" 
18 #include "cfile.h"
19 #include "fix.h"
20  
21 extern int filelength(int fd);
22
23 // routines which read basic data types
24 extern byte read_byte(CFILE *fp);
25 extern short read_short(CFILE *fp);
26 extern int read_int(CFILE *fp);
27 extern fix read_fix(CFILE *fp);
28
29 // versions which swap bytes
30 #define read_byte_swap(fp) read_byte(fp)
31 extern short read_short_swap(CFILE *fp);
32
33 // routines which write basic data types
34 extern int write_byte(FILE *fp, byte b);
35 extern int write_short(FILE *fp, short s);
36 extern int write_int(FILE *fp, int i);
37 extern int write_fix(FILE *fp, fix f);
38
39 // routines which write swapped bytes
40 #define write_byte_swap(fp, b) write_byte(fp, b)
41 extern int write_short_swap(FILE *fp, short s);
42 extern int write_int_swap(FILE *fp, int i);
43 extern int write_fix_swap(FILE *fp, fix f);
44
45 #endif