1 #ifndef LAME_PORTABLEIO_H 2 #define LAME_PORTABLEIO_H 3 /* Copyright (C) 1988-1991 Apple Computer, Inc. 4 * All Rights Reserved. 5 * 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. 13 * 14 * This code may be used and freely distributed as long as it includes 15 * this copyright notice and the warranty information. 16 * 17 * Machine-independent I/O routines for 8-, 16-, 24-, and 32-bit integers. 18 * 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. 23 * 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. 28 * 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 35 * 36 * 37 * Implemented by Malcolm Slaney and Ken Turkowski. 38 * 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. 43 * 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. 48 * 49 * $Id: portableio.h,v 1.2 2000/11/18 04:24:06 markt Exp $ 50 * 51 * $Log: portableio.h,v $ 52 * Revision 1.2 2000/11/18 04:24:06 markt 53 * Removed ieeefloat.* 54 * 55 * Revision 1.1 2000/09/28 16:36:53 takehiro 56 * moved frontend staffs into frontend/ 57 * Need to debug vorbis/mpglib/analyzer/bitrate histgram. 58 * still long way to go... 59 * 60 * HAVEGTK is changed ANALYSIS(library side) and HAVEGTK(frontend side) 61 * 62 * BRHIST is deleted from library. all the bitrate histogram works are 63 * now in frontend(but not works properly, yet). 64 * 65 * timestatus things are also moved to frontend. 66 * 67 * parse.c is now out of library. 68 * 69 * Revision 1.2 2000/09/17 04:19:09 cisc 70 * conformed all this-is-included-defines to match 'project_file_name' style 71 * 72 * Revision 1.1.1.1 1999/11/24 08:43:37 markt 73 * initial checkin of LAME 74 * Starting with LAME 3.57beta with some modifications 75 * 76 * Revision 2.6 91/04/30 17:06:02 malcolm 77 */ 78 79 #include <stdio.h> 80 81 #ifndef __cplusplus 82 # define CLINK 83 #else 84 # define CLINK "C" 85 #endif 86 87 extern CLINK int ReadByte(FILE *fp); 88 extern CLINK int Read16BitsLowHigh(FILE *fp); 89 extern CLINK int Read16BitsHighLow(FILE *fp); 90 extern CLINK void Write8Bits(FILE *fp, int i); 91 extern CLINK void Write16BitsLowHigh(FILE *fp, int i); 92 extern CLINK void Write16BitsHighLow(FILE *fp, int i); 93 extern CLINK int Read24BitsHighLow(FILE *fp); 94 extern CLINK int Read32Bits(FILE *fp); 95 extern CLINK int Read32BitsHighLow(FILE *fp); 96 extern CLINK void Write32Bits(FILE *fp, int i); 97 extern CLINK void Write32BitsLowHigh(FILE *fp, int i); 98 extern CLINK void Write32BitsHighLow(FILE *fp, int i); 99 extern CLINK void ReadBytes(FILE *fp, char *p, int n); 100 extern CLINK void ReadBytesSwapped(FILE *fp, char *p, int n); 101 extern CLINK void WriteBytes(FILE *fp, char *p, int n); 102 extern CLINK void WriteBytesSwapped(FILE *fp, char *p, int n); 103 extern CLINK double ReadIeeeFloatHighLow(FILE *fp); 104 extern CLINK double ReadIeeeFloatLowHigh(FILE *fp); 105 extern CLINK double ReadIeeeDoubleHighLow(FILE *fp); 106 extern CLINK double ReadIeeeDoubleLowHigh(FILE *fp); 107 extern CLINK double ReadIeeeExtendedHighLow(FILE *fp); 108 extern CLINK double ReadIeeeExtendedLowHigh(FILE *fp); 109 extern CLINK void WriteIeeeFloatLowHigh(FILE *fp, double num); 110 extern CLINK void WriteIeeeFloatHighLow(FILE *fp, double num); 111 extern CLINK void WriteIeeeDoubleLowHigh(FILE *fp, double num); 112 extern CLINK void WriteIeeeDoubleHighLow(FILE *fp, double num); 113 extern CLINK void WriteIeeeExtendedLowHigh(FILE *fp, double num); 114 extern CLINK void WriteIeeeExtendedHighLow(FILE *fp, double num); 115 116 #define Read32BitsLowHigh(f) Read32Bits(f) 117 #define WriteString(f,s) fwrite(s,strlen(s),sizeof(char),f) 118 #endif 119