~ubuntu-branches/ubuntu/karmic/gnustep-base/karmic

« back to all changes in this revision

Viewing changes to Headers/gnustep/base/preface.h.in

  • Committer: Bazaar Package Importer
  • Author(s): Eric Heintzmann
  • Date: 2005-04-17 00:14:38 UTC
  • mfrom: (1.2.1 upstream) (2.1.2 hoary)
  • Revision ID: james.westby@ubuntu.com-20050417001438-enf0y07c9tku85z1
Tags: 1.10.3-1
New upstream release.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* General purpose definitions for the GNU Objective-C Library.
2
 
   Copyright (C) 1993, 1994, 1995, 1996 Free Software Foundation, Inc.
3
 
 
4
 
   Written by:  Andrew Kachites McCallum <mccallum@gnu.ai.mit.edu>
5
 
   Created: May 1993
6
 
 
7
 
   This file is part of the GNUstep Base Library.
8
 
 
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.
13
 
   
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.
18
 
 
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.
22
 
*/ 
23
 
 
24
 
#ifndef __preface_h_OBJECTS_INCLUDE
25
 
#define __preface_h_OBJECTS_INCLUDE
26
 
 
27
 
#include <stdlib.h>
28
 
#include <stdarg.h>
29
 
#include <base/objc-gnu2next.h>
30
 
 
31
 
#if     defined(__WIN32__) || defined(_WIN32) || defined(__MS_WIN32__)
32
 
#ifndef __WIN32__
33
 
#define __WIN32__
34
 
#endif
35
 
#endif
36
 
 
37
 
#ifdef __MINGW32__
38
 
#ifndef __MINGW__
39
 
#define __MINGW__
40
 
#endif
41
 
#ifndef __WIN32__
42
 
#define __WIN32__
43
 
#endif
44
 
#endif
45
 
 
46
 
#if defined(__WIN32__)
47
 
#include <windows.h>
48
 
#define GNUSTEP_BASE_SOCKET_MESSAGE (WM_USER + 1)
49
 
#endif
50
 
 
51
 
#if NeXT_RUNTIME
52
 
 #include <objc/objc.h>
53
 
 #include <objc/objc-class.h>
54
 
 #include <objc/objc-runtime.h>
55
 
 #ifndef _C_ATOM
56
 
  #define _C_ATOM '%'
57
 
 #endif
58
 
 #define _F_CONST    0x01
59
 
 #define _F_IN       0x01
60
 
 #define _F_OUT      0x02
61
 
 #define _F_INOUT    0x03
62
 
 #define _F_BYCOPY   0x04
63
 
 #define _F_ONEWAY   0x08
64
 
 #define _C_CONST    'r'
65
 
 #define _C_IN       'n'
66
 
 #define _C_INOUT    'N'
67
 
 #define _C_OUT      'o'
68
 
 #define _C_BYCOPY   'O'
69
 
 #define _C_ONEWAY   'V'
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> */
76
 
#endif
77
 
 
78
 
/*
79
 
 * Hack for older compiler versions that don't have all defines
80
 
 * needed in  objc-api.h
81
 
 */
82
 
#ifndef _C_LNG_LNG
83
 
#define _C_LNG_LNG      'q'
84
 
#endif
85
 
#ifndef _C_ULNG_LNG
86
 
#define _C_ULNG_LNG     'Q'
87
 
#endif
88
 
 
89
 
#ifndef __WIN32__
90
 
#include <sys/param.h> /* Hack to get rid of warning in GNU libc 2.0.3. */
91
 
#endif
92
 
 
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@
99
 
 
100
 
#if 0
101
 
extern const char o_version[];
102
 
extern const char o_gcc_version[];
103
 
#if NeXT_cc
104
 
extern const char o_NeXT_cc_version[];
105
 
#endif
106
 
#endif
107
 
 
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)
119
 
 
120
 
#ifndef MAX
121
 
#define MAX(a,b) \
122
 
       ({typeof(a) _MAX_a = (a); typeof(b) _MAX_b = (b);  \
123
 
         _MAX_a > _MAX_b ? _MAX_a : _MAX_b; })
124
 
#endif
125
 
 
126
 
#ifndef MIN
127
 
#define MIN(a,b) \
128
 
       ({typeof(a) _MIN_a = (a); typeof(b) _MIN_b = (b);  \
129
 
         _MIN_a < _MIN_b ? _MIN_a : _MIN_b; })
130
 
#endif
131
 
 
132
 
#ifndef ABS
133
 
#define ABS(a) \
134
 
       ({typeof(a) _ABS_a = (a); \
135
 
         _ABS_a < 0 ? -_ABS_a : _ABS_a; })
136
 
#endif
137
 
 
138
 
#ifndef STRINGIFY
139
 
#define STRINGIFY(s) XSTRINGIFY(s)
140
 
#define XSTRINGIFY(s) #s
141
 
#endif
142
 
 
143
 
#ifndef OBJC_STRINGIFY
144
 
#define OBJC_STRINGIFY(s) OBJC_XSTRINGIFY(s)
145
 
#define OBJC_XSTRINGIFY(s) @#s
146
 
#endif
147
 
 
148
 
#ifndef PTR2LONG
149
 
#define PTR2LONG(P) (((char*)(P))-(char*)0)
150
 
#endif
151
 
#ifndef LONG2PTR
152
 
#define LONG2PTR(L) (((char*)0)+(L))
153
 
#endif
154
 
 
155
 
#if VSPRINTF_RETURNS_LENGTH 
156
 
#define VSPRINTF_LENGTH(VSPF_CALL) (VSPF_CALL)
157
 
#else
158
 
#define VSPRINTF_LENGTH(VSPF_CALL) strlen((VSPF_CALL))
159
 
#endif /* VSPRINTF_RETURNS_LENGTH */
160
 
 
161
 
#if VASPRINTF_RETURNS_LENGTH 
162
 
#define VASPRINTF_LENGTH(VASPF_CALL) (VASPF_CALL)
163
 
#else
164
 
#define VASPRINTF_LENGTH(VASPF_CALL) strlen((VASPF_CALL))
165
 
#endif /* VSPRINTF_RETURNS_LENGTH */
166
 
 
167
 
 
168
 
#endif /* __preface_h_OBJECTS_INCLUDE */