This is nextstd.h in view mode; [Download] [Up]
/* nextstd.h Application Kit, Release 2.0 Copyright (c) 1988, 1989, 1990, NeXT, Inc. All rights reserved. */ /* This file has some standard macros useful in any program. */ #ifndef NEXTSTD_H #define NEXTSTD_H #import <math.h> #import <stdio.h> #import <libc.h> #ifndef MAX #define MAX(A,B) ((A) > (B) ? (A) : (B)) #endif #ifndef MIN #define MIN(A,B) ((A) < (B) ? (A) : (B)) #endif #ifndef ABS #define ABS(A) ((A) < 0 ? (-(A)) : (A)) #endif #define NX_MALLOC( VAR, TYPE, NUM ) \ ((VAR) = (TYPE *) malloc((unsigned)(NUM)*sizeof(TYPE))) #define NX_REALLOC( VAR, TYPE, NUM ) \ ((VAR) = (TYPE *) realloc((VAR), (unsigned)(NUM)*sizeof(TYPE))) #define NX_FREE( PTR ) free((PTR)) #define NX_ZONEMALLOC( Z, VAR, TYPE, NUM ) \ ((VAR) = (TYPE *) NXZoneMalloc((Z), (unsigned)(NUM)*sizeof(TYPE))) #define NX_ZONEREALLOC( Z, VAR, TYPE, NUM ) \ ((VAR) = (TYPE *) NXZoneRealloc ((Z), (char *)(VAR), \ (unsigned)(NUM)*sizeof(TYPE))) #ifndef NBITSCHAR #define NBITSCHAR 8 #endif #ifndef NBITSINT #define NBITSINT (sizeof(int)*NBITSCHAR) #endif #ifndef TRUE #define TRUE 1 #endif #ifndef FALSE #define FALSE 0 #endif /* * compile with -DNX_BLOCKASSERTS to turn off asserts in your code */ #ifndef NX_BLOCKASSERTS extern void NXLogError(const char *format, ...); #define NX_ASSERT(exp,str) {if(!(exp)) NXLogError("Assertion failed: %s\n", str);} #else #define NX_ASSERT(exp,str) {} #endif /* * Used to insert messages in showps output. If you use this macro, you can * compile with -DNX_BLOCKPSDEBUG to turn it off. Note that it only writes * its messages when showps is on. */ #ifndef NX_BLOCKPSDEBUG #define NX_PSDEBUG() {if ((DPSGetCurrentContext())->chainChild && (DPSGetCurrentContext())->chainChild->programEncoding == dps_ascii) DPSPrintf( DPSGetCurrentContext(),"\n%% *** Debug *** Object:%d Class:%s Method:%s\n", ((int)self), ((char *)[self name]), SELNAME(_cmd));} #else #define NX_PSDEBUG() {} #endif #endif
These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.