|
|
1.1 ! root 1: /* ! 2: * Copyright (c) 2000 Apple Computer, Inc. All rights reserved. ! 3: * ! 4: * @APPLE_LICENSE_HEADER_START@ ! 5: * ! 6: * The contents of this file constitute Original Code as defined in and ! 7: * are subject to the Apple Public Source License Version 1.1 (the ! 8: * "License"). You may not use this file except in compliance with the ! 9: * License. Please obtain a copy of the License at ! 10: * http://www.apple.com/publicsource and read it before using this file. ! 11: * ! 12: * This Original Code and all software distributed under the License are ! 13: * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER ! 14: * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, ! 15: * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, ! 16: * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the ! 17: * License for the specific language governing rights and limitations ! 18: * under the License. ! 19: * ! 20: * @APPLE_LICENSE_HEADER_END@ ! 21: */ ! 22: /* ! 23: * Standard C macros ! 24: * ! 25: ********************************************************************** ! 26: * HISTORY ! 27: * 02-Feb-86 Glenn Marcy (gm0w) at Carnegie-Mellon University ! 28: * Added check to allow multiple or recursive inclusion of this ! 29: * file. Added bool enum from machine/types.h for regular users ! 30: * that want a real boolean type. ! 31: * ! 32: * 29-Dec-85 Glenn Marcy (gm0w) at Carnegie-Mellon University ! 33: * Also change spacing of MAX and MIN to coincide with that of ! 34: * sys/param.h. ! 35: * ! 36: * 19-Nov-85 Glenn Marcy (gm0w) at Carnegie-Mellon University ! 37: * Changed the number of tabs between TRUE, FALSE and their ! 38: * respective values to match those in sys/types.h. ! 39: * ! 40: * 17-Dec-84 Glenn Marcy (gm0w) at Carnegie-Mellon University ! 41: * Only define TRUE and FALSE if not defined. Added caseE macro ! 42: * for using enumerated types in switch statements. ! 43: * ! 44: * 23-Apr-81 Mike Accetta (mja) at Carnegie-Mellon University ! 45: * Added "sizeofS" and "sizeofA" macros which expand to the size ! 46: * of a string constant and array respectively. ! 47: * ! 48: ********************************************************************** ! 49: */ ! 50: ! 51: #ifndef _C_INCLUDE_ ! 52: #define _C_INCLUDE_ ! 53: ! 54: #ifndef ABS ! 55: #define ABS(x) ((x)>=0?(x):-(x)) ! 56: #endif /* ABS */ ! 57: #ifndef MIN ! 58: #define MIN(a,b) (((a)<(b))?(a):(b)) ! 59: #endif /* MIN */ ! 60: #ifndef MAX ! 61: #define MAX(a,b) (((a)>(b))?(a):(b)) ! 62: #endif /* MAX */ ! 63: ! 64: #ifndef FALSE ! 65: #define FALSE 0 ! 66: #endif /* FALSE */ ! 67: #ifndef TRUE ! 68: #define TRUE 1 ! 69: #endif /* TRUE */ ! 70: ! 71: #define CERROR (-1) ! 72: ! 73: #ifndef bool ! 74: typedef enum { false = 0, true = 1 } bool; ! 75: #endif /* bool */ ! 76: ! 77: #define sizeofS(string) (sizeof(string) - 1) ! 78: #define sizeofA(array) (sizeof(array)/sizeof(array[0])) ! 79: ! 80: #define caseE(enum_type) case (int)(enum_type) ! 81: ! 82: #endif /* _C_INCLUDE_ */
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.