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

« back to all changes in this revision

Viewing changes to Headers/Additions/GNUstepBase/GNUstep.h

  • 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
/* GNUstep.h - macros to make easier to port gnustep apps to macos-x
 
2
   Copyright (C) 2001 Free Software Foundation, Inc.
 
3
 
 
4
   Written by: Nicola Pero <n.pero@mi.flashnet.it>
 
5
   Date: March, October 2001
 
6
   
 
7
   This file is part of GNUstep.
 
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-1307, USA.
 
22
*/ 
 
23
 
 
24
#ifndef __GNUSTEP_GNUSTEP_H_INCLUDED_
 
25
#define __GNUSTEP_GNUSTEP_H_INCLUDED_
 
26
 
 
27
#ifndef GNUSTEP
 
28
 
 
29
#define AUTORELEASE(object)      [object autorelease]
 
30
#define TEST_AUTORELEASE(object) ({ if (object) [object autorelease]; })
 
31
 
 
32
#define RELEASE(object)          [object release]
 
33
#define TEST_RELEASE(object)     ({ if (object) [object release]; })
 
34
 
 
35
#define RETAIN(object)           [object retain]
 
36
#define TEST_RETAIN(object)      ({ if (object) [object retain]; })
 
37
 
 
38
#define ASSIGN(object,value)     ({\
 
39
     id __value = (id)(value); \
 
40
     id __object = (id)(object); \
 
41
     if (__value != __object) \
 
42
       { \
 
43
         if (__value != nil) \
 
44
           { \
 
45
             [__value retain]; \
 
46
           } \
 
47
         object = __value; \
 
48
         if (__object != nil) \
 
49
           { \
 
50
             [__object release]; \
 
51
           } \
 
52
       } \
 
53
   })
 
54
 
 
55
#define ASSIGNCOPY(object,value) ASSIGN(object, [[value copy] autorelease]);
 
56
 
 
57
#define DESTROY(object)          ({ \
 
58
     if (object) \
 
59
       { \
 
60
         id __o = object; \
 
61
         object = nil; \
 
62
         [__o release]; \
 
63
       } \
 
64
   })
 
65
 
 
66
#define CREATE_AUTORELEASE_POOL(X) \
 
67
NSAutoreleasePool *(X) = [NSAutoreleasePool new]
 
68
 
 
69
#define NSLocalizedString(key, comment) \
 
70
  [[NSBundle mainBundle] localizedStringForKey:(key) value:@"" table:nil]
 
71
 
 
72
#define _(X) NSLocalizedString (X, nil)
 
73
#define __(X) X
 
74
 
 
75
#define NSLocalizedStaticString(X, Y) X
 
76
 
 
77
#endif /* GNUSTEP */
 
78
 
 
79
#endif /* __GNUSTEP_GNUSTEP_H_INCLUDED_ */