1 /*===========================================================================* 2 * general.h * 3 * * 4 * very general stuff * 5 * * 6 *===========================================================================*/ 7 8 /* 9 * Copyright (c) 1995 The Regents of the University of California. 10 * All rights reserved. 11 * 12 * Permission to use, copy, modify, and distribute this software and its 13 * documentation for any purpose, without fee, and without written agreement is 14 * hereby granted, provided that the above copyright notice and the following 15 * two paragraphs appear in all copies of this software. 16 * 17 * IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR 18 * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT 19 * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF 20 * CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 21 * 22 * THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, 23 * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY 24 * AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS 25 * ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO 26 * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. 27 */ 28 29 /* 30 * $Header$ 31 * $Log$ 32 * Revision 1.5 2004/04/02 15:12:41 rwcox 33 * Cput 34 * 35 * Revision 1.4 2004/02/05 21:32:23 rwcox 36 * Cput 37 * 38 * Revision 1.3 2003/12/23 13:50:08 rwcox 39 * Cput 40 * 41 * Revision 1.2 2003/12/03 14:46:15 rwcox 42 * Cput 43 * 44 * Revision 1.1 2001/12/17 18:25:44 rwcox 45 * Cadd 46 * 47 * Revision 1.7 1995/08/04 23:34:13 smoot 48 * jpeg5 changed the silly HAVE_BOOLEAN define.... 49 * 50 * Revision 1.6 1995/01/19 23:54:49 eyhung 51 * Changed copyrights 52 * 53 * Revision 1.5 1994/11/12 02:12:48 keving 54 * nothing 55 * 56 * Revision 1.4 1993/07/22 22:24:23 keving 57 * nothing 58 * 59 * Revision 1.3 1993/07/09 00:17:23 keving 60 * nothing 61 * 62 * Revision 1.2 1993/06/03 21:08:53 keving 63 * nothing 64 * 65 * Revision 1.1 1993/02/22 22:39:19 keving 66 * nothing 67 * 68 */ 69 70 71 #ifndef GENERAL_INCLUDED 72 #define GENERAL_INCLUDED 73 74 75 /* prototypes for library procedures 76 * 77 * if your /usr/include headers do not have these, then pass -DMISSING_PROTOS 78 * to your compiler 79 * 80 */ 81 #ifdef MISSING_PROTOS 82 int fprintf(); 83 int fwrite(); 84 int fread(); 85 int fflush(); 86 int fclose(); 87 88 int sscanf(); 89 int bzero(); 90 int bcopy(); 91 int system(); 92 int time(); 93 int perror(); 94 95 int socket(); 96 int bind(); 97 int listen(); 98 int accept(); 99 int connect(); 100 int close(); 101 int read(); 102 int write(); 103 104 int pclose(); 105 106 #endif 107 108 109 /*===========* 110 * CONSTANTS * 111 *===========*/ 112 113 #ifndef NULL 114 #define NULL 0 115 #endif 116 117 #ifndef TRUE 118 #define TRUE 1 119 #define FALSE 0 120 #endif 121 122 #define SPACE ' ' 123 #define TAB '\t' 124 #define SEMICOLON ';' 125 #define NULL_CHAR '\0' 126 #define NEWLINE '\n' 127 128 129 /*==================* 130 * TYPE DEFINITIONS * 131 *==================*/ 132 133 typedef int boolean; 134 /* this is for JPEG stuff */ 135 #define BOOLEAN_DEFINED 136 #define HAVE_BOOLEAN 137 138 typedef unsigned char uint8; 139 typedef char int8; 140 typedef unsigned short uint16; 141 typedef short int16; 142 143 /* LONG_32 should only be defined iff 144 * 1) long's are 32 bits and 145 * 2) int's are not 146 */ 147 #ifdef LONG_32 148 typedef unsigned long uint32; 149 typedef long int32; 150 #else 151 typedef unsigned int uint32; 152 typedef int int32; 153 #endif 154 155 156 /*========* 157 * MACROS * 158 *========*/ 159 160 #undef max 161 #define max(a,b) ((a) > (b) ? (a) : (b)) 162 #undef min 163 #define min(a,b) ((a) < (b) ? (a) : (b)) 164 #undef abs 165 #define abs(a) ((a) >= 0 ? (a) : -(a)) 166 167 168 #endif 169