applied AkhIL's cinelerra-cv surround patch
[cinelerra_cv/ct.git] / toolame-02l / portableio.h
blob4a2b4b394841f7c35e421a668e96f4cd3b379736
1 #ifndef PORTABLEIO_H__
2 #define PORTABLEIO_H__
3 /* Copyright (C) 1988-1991 Apple Computer, Inc.
4 * All Rights Reserved.
6 * Warranty Information
7 * Even though Apple has reviewed this software, Apple makes no warranty
8 * or representation, either express or implied, with respect to this
9 * software, its quality, accuracy, merchantability, or fitness for a
10 * particular purpose. As a result, this software is provided "as is,"
11 * and you, its user, are assuming the entire risk as to its quality
12 * and accuracy.
14 * This code may be used and freely distributed as long as it includes
15 * this copyright notice and the warranty information.
17 * Machine-independent I/O routines for 8-, 16-, 24-, and 32-bit integers.
19 * Motorola processors (Macintosh, Sun, Sparc, MIPS, etc)
20 * pack bytes from high to low (they are big-endian).
21 * Use the HighLow routines to match the native format
22 * of these machines.
24 * Intel-like machines (PCs, Sequent)
25 * pack bytes from low to high (the are little-endian).
26 * Use the LowHigh routines to match the native format
27 * of these machines.
29 * These routines have been tested on the following machines:
30 * Apple Macintosh, MPW 3.1 C compiler
31 * Apple Macintosh, THINK C compiler
32 * Silicon Graphics IRIS, MIPS compiler
33 * Cray X/MP and Y/MP
34 * Digital Equipment VAX
37 * Implemented by Malcolm Slaney and Ken Turkowski.
39 * Malcolm Slaney contributions during 1988-1990 include big- and little-
40 * endian file I/O, conversion to and from Motorola's extended 80-bit
41 * FLOATing-point format, and conversions to and from IEEE single-
42 * precision FLOATing-point format.
44 * In 1991, Ken Turkowski implemented the conversions to and from
45 * IEEE double-precision format, added more precision to the extended
46 * conversions, and accommodated conversions involving +/- infinity,
47 * NaN's, and denormalized numbers.
49 * $Id: portableio.h,v 1.1 2003/10/04 00:11:19 herman Exp $
51 * $Log: portableio.h,v $
52 * Revision 1.1 2003/10/04 00:11:19 herman
53 * New file from 1.1.7 (not in 1.1.6) added from Rich's automakified src tree.
55 * Revision 1.1 2003/07/29 04:17:52 heroine
56 * *** empty log message ***
58 * Revision 2.6 91/04/30 17:06:02 malcolm
61 #include <stdio.h>
62 #include "ieeefloat.h"
64 int ReadByte (FILE * fp);
65 int Read16BitsLowHigh (FILE * fp);
66 int Read16BitsHighLow (FILE * fp);
67 void Write8Bits (FILE * fp, int i);
68 void Write16BitsLowHigh (FILE * fp, int i);
69 void Write16BitsHighLow (FILE * fp, int i);
70 int Read24BitsHighLow (FILE * fp);
71 int Read32Bits (FILE * fp);
72 int Read32BitsHighLow (FILE * fp);
73 void Write32Bits (FILE * fp, int i);
74 void Write32BitsLowHigh (FILE * fp, int i);
75 void Write32BitsHighLow (FILE * fp, int i);
76 void ReadBytes (FILE * fp, char *p, int n);
77 void ReadBytesSwapped (FILE * fp, char *p, int n);
78 void WriteBytes (FILE * fp, char *p, int n);
79 void WriteBytesSwapped (FILE * fp, char *p, int n);
80 double ReadIeeeFloatHighLow (FILE * fp);
81 double ReadIeeeFloatLowHigh (FILE * fp);
82 double ReadIeeeDoubleHighLow (FILE * fp);
83 double ReadIeeeDoubleLowHigh (FILE * fp);
84 double ReadIeeeExtendedHighLow (FILE * fp);
85 double ReadIeeeExtendedLowHigh (FILE * fp);
86 void WriteIeeeFloatLowHigh (FILE * fp, double num);
87 void WriteIeeeFloatHighLow (FILE * fp, double num);
88 void WriteIeeeDoubleLowHigh (FILE * fp, double num);
89 void WriteIeeeDoubleHighLow (FILE * fp, double num);
90 void WriteIeeeExtendedLowHigh (FILE * fp, double num);
91 void WriteIeeeExtendedHighLow (FILE * fp, double num);
93 #define Read32BitsLowHigh(f) Read32Bits(f)
94 #define WriteString(f,s) fwrite(s,strlen(s),sizeof(char),f)
95 #endif