1
/* General purpose definitions for the GNU Objective-C Library.
2
Copyright (C) 1993, 1994, 1995, 1996 Free Software Foundation, Inc.
4
Written by: Andrew Kachites McCallum <mccallum@gnu.ai.mit.edu>
7
This file is part of the GNUstep Base Library.
9
This library is free software; you can redistribute it and/or
10
modify it under the terms of the GNU Library General Public
11
License as published by the Free Software Foundation; either
12
version 2 of the License, or (at your option) any later version.
14
This library is distributed in the hope that it will be useful,
15
but WITHOUT ANY WARRANTY; without even the implied warranty of
16
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17
Library General Public License for more details.
19
You should have received a copy of the GNU Library General Public
20
License along with this library; if not, write to the Free
21
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA.
24
#ifndef __preface_h_OBJECTS_INCLUDE
25
#define __preface_h_OBJECTS_INCLUDE
29
#include <base/objc-gnu2next.h>
31
#if defined(__WIN32__) || defined(_WIN32) || defined(__MS_WIN32__)
46
#if defined(__WIN32__)
48
#define GNUSTEP_BASE_SOCKET_MESSAGE (WM_USER + 1)
52
#include <objc/objc.h>
53
#include <objc/objc-class.h>
54
#include <objc/objc-runtime.h>
62
#define _F_BYCOPY 0x04
63
#define _F_ONEWAY 0x08
70
#else /* GNU Objective C Runtime */
71
#include <objc/objc.h>
72
#include <objc/objc-api.h>
73
#include <objc/encoding.h>
74
#include <objc/sarray.h>
75
/* #include <objc/objc-list.h> */
79
* Hack for older compiler versions that don't have all defines
80
* needed in objc-api.h
83
#define _C_LNG_LNG 'q'
86
#define _C_ULNG_LNG 'Q'
90
#include <sys/param.h> /* Hack to get rid of warning in GNU libc 2.0.3. */
93
/* The following group of lines maintained by the gstep-base configure */
94
#define GNUSTEP_BASE_VERSION @VERSION@
95
#define GNUSTEP_BASE_MAJOR_VERSION @MAJOR_VERSION@
96
#define GNUSTEP_BASE_MINOR_VERSION @MINOR_VERSION@
97
#define GNUSTEP_BASE_SUBMINOR_VERSION @SUBMINOR_VERSION@
98
#define GNUSTEP_BASE_GCC_VERSION @GCC_VERSION@
101
extern const char o_version[];
102
extern const char o_gcc_version[];
104
extern const char o_NeXT_cc_version[];
108
#define OBJC_MALLOC(VAR, TYPE, NUM) \
109
((VAR) = (TYPE *) objc_malloc ((unsigned)(NUM)*sizeof(TYPE)))
110
#define OBJC_VALLOC(VAR, TYPE, NUM) \
111
((VAR) = (TYPE *) objc_valloc ((unsigned)(NUM)*sizeof(TYPE)))
112
#define OBJC_ATOMIC_MALLOC(VAR, TYPE, NUM) \
113
((VAR) = (TYPE *) objc_atomic_malloc ((unsigned)(NUM)*sizeof(TYPE)))
114
#define OBJC_REALLOC(VAR, TYPE, NUM) \
115
((VAR) = (TYPE *) objc_realloc ((VAR), (unsigned)(NUM)*sizeof(TYPE)))
116
#define OBJC_CALLOC(VAR, TYPE, NUM) \
117
((VAR) = (TYPE *) objc_calloc ((unsigned)(NUM), sizeof(TYPE)))
118
#define OBJC_FREE(PTR) objc_free (PTR)
122
({typeof(a) _MAX_a = (a); typeof(b) _MAX_b = (b); \
123
_MAX_a > _MAX_b ? _MAX_a : _MAX_b; })
128
({typeof(a) _MIN_a = (a); typeof(b) _MIN_b = (b); \
129
_MIN_a < _MIN_b ? _MIN_a : _MIN_b; })
134
({typeof(a) _ABS_a = (a); \
135
_ABS_a < 0 ? -_ABS_a : _ABS_a; })
139
#define STRINGIFY(s) XSTRINGIFY(s)
140
#define XSTRINGIFY(s) #s
143
#ifndef OBJC_STRINGIFY
144
#define OBJC_STRINGIFY(s) OBJC_XSTRINGIFY(s)
145
#define OBJC_XSTRINGIFY(s) @#s
149
#define PTR2LONG(P) (((char*)(P))-(char*)0)
152
#define LONG2PTR(L) (((char*)0)+(L))
155
#if VSPRINTF_RETURNS_LENGTH
156
#define VSPRINTF_LENGTH(VSPF_CALL) (VSPF_CALL)
158
#define VSPRINTF_LENGTH(VSPF_CALL) strlen((VSPF_CALL))
159
#endif /* VSPRINTF_RETURNS_LENGTH */
161
#if VASPRINTF_RETURNS_LENGTH
162
#define VASPRINTF_LENGTH(VASPF_CALL) (VASPF_CALL)
164
#define VASPRINTF_LENGTH(VASPF_CALL) strlen((VASPF_CALL))
165
#endif /* VSPRINTF_RETURNS_LENGTH */
168
#endif /* __preface_h_OBJECTS_INCLUDE */