ftp.nice.ch/Attic/openStep/implementation/gnustep/sources/objcX-0.87.tgz#/objcX-0.87/appkit/stdmacros.h

This is stdmacros.h in view mode; [Download] [Up]

/* Macros and utility functions
 *
 * Copyright (C)  1993  The Board of Trustees of  
 * The Leland Stanford Junior University.  All Rights Reserved.
 *
 * Authors: Scott Francis, Fred Harris, Paul Kunz, Tom Pavel, 
 *	    Imran Qureshi, and Libing Wang
 *
 * This file is part of an Objective-C class library for a window system
 *
 * stdmacros.h,v 1.22 1994/12/14 02:16:07 lakata Exp
 */

 
#ifndef _std_macros_h_
#define _std_macros_h_


#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/param.h>
#ifdef MALLOC_DEBUG
#include <malloc.h>
#endif

#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


/* Some compatibility macros */

#define NX_MALLOC( VAR, TYPE, NUM )		\
	((VAR) = (TYPE *) malloc(((unsigned)NUM)*sizeof(TYPE)))
#define X_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 X_REALLOC( VAR, TYPE, NUM )		\
	((VAR) = (TYPE *) realloc(VAR, ((unsigned)NUM)*sizeof(TYPE)))
	
#define NX_FREE( PTR ) free((PTR))
#define X_FREE( PTR ) free((PTR))

#define NS_ZONEMALLOC( Z, VAR, TYPE, NUM )		\
	((VAR) = (TYPE *) NSZoneMalloc((Z),((unsigned)NUM)*sizeof(TYPE)))

#define NS_ZONEREALLOC( Z, VAR, TYPE, NUM )		\
     ((VAR) = (TYPE *) NSZoneRealloc((Z),(VAR),((unsigned)NUM)*sizeof(TYPE)))

#define NX_ZONEMALLOC( Z, VAR, TYPE, NUM )		\
	((VAR) = (TYPE *) NSZoneMalloc((Z),((unsigned)NUM)*sizeof(TYPE)))

#define NX_ZONEREALLOC( Z, VAR, TYPE, NUM )		\
     ((VAR) = (TYPE *) NSZoneRealloc((Z),(VAR),((unsigned)NUM)*sizeof(TYPE)))
	
#ifndef NBITSCHAR
#define NBITSCHAR 8
#endif NBITSCHAR

#ifndef NBITSINT
#define NBITSINT (sizeof(int)*NBITSCHAR)
#endif NBITSINT

#ifndef TRUE
#define TRUE 1
#endif FALSE
#ifndef FALSE
#define FALSE 0
#endif FALSE

/* I don't know where this should go: */
#ifndef	__NeXT__

#define X_NOBORDER 0

#endif
#endif

These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.