RSSKit  0.6.1
GNUstep.h
00001 /* GNUstep.h - macros to make easier to port gnustep apps to macos-x
00002    Copyright (C) 2001 Free Software Foundation, Inc.
00003 
00004    Written by: Nicola Pero <n.pero@mi.flashnet.it>
00005    Date: March, October 2001
00006    
00007    This file is part of GNUstep.
00008 
00009    This library is free software; you can redistribute it and/or
00010    modify it under the terms of the GNU Library General Public
00011    License as published by the Free Software Foundation; either
00012    version 2 of the License, or (at your option) any later version.
00013    
00014    This library is distributed in the hope that it will be useful,
00015    but WITHOUT ANY WARRANTY; without even the implied warranty of
00016    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00017    Library General Public License for more details.
00018    
00019    You should have received a copy of the GNU Library General Public
00020    License along with this library; if not, write to the Free
00021    Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
00022 */ 
00023 
00024 #ifndef __GNUSTEP_GNUSTEP_H_INCLUDED_
00025 #define __GNUSTEP_GNUSTEP_H_INCLUDED_
00026 
00027 #ifndef GNUSTEP
00028 
00029 #if !defined( MAC_OS_X_VERSION_10_5 )
00030 #define NSUInteger unsigned
00031 #endif
00032 
00033 #define AUTORELEASE(object)      [object autorelease]
00034 #define TEST_AUTORELEASE(object) ({ if (object) [object autorelease]; })
00035 
00036 #define RELEASE(object)          [object release]
00037 #define TEST_RELEASE(object)     ({ if (object) [object release]; })
00038 
00039 #define RETAIN(object)           [object retain]
00040 #define TEST_RETAIN(object)      ({ if (object) [object retain]; })
00041 
00042 #define ASSIGN(object,value)     ({\
00043      id __value = (id)(value); \
00044      id __object = (id)(object); \
00045      if (__value != __object) \
00046        { \
00047          if (__value != nil) \
00048            { \
00049              [__value retain]; \
00050            } \
00051          object = __value; \
00052          if (__object != nil) \
00053            { \
00054              [__object release]; \
00055            } \
00056        } \
00057    })
00058 
00059 #define ASSIGNCOPY(object,value) ASSIGN(object, [[value copy] autorelease]);
00060 
00061 #define DESTROY(object)          ({ \
00062      if (object) \
00063        { \
00064          id __o = object; \
00065          object = nil; \
00066          [__o release]; \
00067        } \
00068    })
00069 
00070 #define CREATE_AUTORELEASE_POOL(X) \
00071 NSAutoreleasePool *(X) = [NSAutoreleasePool new]
00072 
00073 #define NSLocalizedString(key, comment) \
00074   [[NSBundle mainBundle] localizedStringForKey:(key) value:@"" table:nil]
00075 
00076 #define _(X) NSLocalizedString (X, nil)
00077 #define __(X) X
00078 
00079 #define NSLocalizedStaticString(X, Y) X
00080 
00081 #endif /* GNUSTEP */
00082 
00083 #endif /* __GNUSTEP_GNUSTEP_H_INCLUDED_ */