1/* $NetBSD: c.h,v 1.6 2009/06/19 23:36:41 dyoung Exp $ */ 2 3/* 4 * Copyright (c) 1991 Carnegie Mellon University 5 * All Rights Reserved. 6 * 7 * Permission to use, copy, modify and distribute this software and its 8 * documentation is hereby granted, provided that both the copyright 9 * notice and this permission notice appear in all copies of the 10 * software, derivative works or modified versions, and any portions 11 * thereof, and that both notices appear in supporting documentation. 12 * 13 * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" 14 * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR 15 * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. 16 * 17 * Carnegie Mellon requests users of this software to return to 18 * 19 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU 20 * School of Computer Science 21 * Carnegie Mellon University 22 * Pittsburgh PA 15213-3890 23 * 24 * any improvements or extensions that they make and grant Carnegie the rights 25 * to redistribute these changes. 26 */ 27/* 28 * Standard C macros 29 * 30 ********************************************************************** 31 * HISTORY 32 * 02-Feb-86 Glenn Marcy (gm0w) at Carnegie-Mellon University 33 * Added check to allow multiple or recursive inclusion of this 34 * file. Added bool enum from machine/types.h for regular users 35 * that want a real boolean type. 36 * 37 * 29-Dec-85 Glenn Marcy (gm0w) at Carnegie-Mellon University 38 * Also change spacing of MAX and MIN to coincide with that of 39 * sys/param.h. 40 * 41 * 19-Nov-85 Glenn Marcy (gm0w) at Carnegie-Mellon University 42 * Changed the number of tabs between TRUE, FALSE and their 43 * respective values to match those in sys/types.h. 44 * 45 * 17-Dec-84 Glenn Marcy (gm0w) at Carnegie-Mellon University 46 * Only define TRUE and FALSE if not defined. Added caseE macro 47 * for using enumerated types in switch statements. 48 * 49 * 23-Apr-81 Mike Accetta (mja) at Carnegie-Mellon University 50 * Added "sizeofS" and "sizeofA" macros which expand to the size 51 * of a string constant and array respectively. 52 * 53 ********************************************************************** 54 */ 55 56#ifndef _C_INCLUDE_ 57#define _C_INCLUDE_ 58 59#include <sys/cdefs.h> 60#include <sys/param.h> 61 62#ifndef FALSE 63#define FALSE 0 64#endif /* FALSE */ 65 66#ifndef TRUE 67#define TRUE 1 68#endif /* TRUE */ 69 70#ifndef MAX 71#define MAX(a,b) ((a)>(b)?(a):(b)) 72#endif 73 74#ifdef __arraycount 75#define sizeofA(array) __arraycount(array) 76#else 77#define sizeofA(array) (sizeof(array)/sizeof(array[0])) 78#endif 79 80#ifndef __unused 81#ifndef __GNUC__ 82#define __unused 83#else 84#define __unused __attribute__((__unused__)) 85#endif 86#endif 87 88#endif /* _C_INCLUDE_ */ 89