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