00001 // Copyright 1997-2005 Omni Development, Inc. All rights reserved. 00002 // 00003 // This software may only be used and reproduced according to the 00004 // terms in the file OmniSourceLicense.html, which should be 00005 // distributed with this project and can also be found at 00006 // <http://www.omnigroup.com/developer/sourcecode/sourcelicense/>. 00007 // 00008 // $Header: svn+ssh://source.omnigroup.com/Source/svn/Omni/tags/SourceRelease_2005-11-18/OmniGroup/Frameworks/OmniBase/macros.h 68913 2005-10-03 19:36:19Z kc $ 00009 00010 #import <Foundation/NSAutoreleasePool.h> 00011 #import <OmniBase/SystemType.h> 00012 00013 #if !defined(SWAP) 00014 #define SWAP(A, B) do { __typeof__(A) __temp = (A); (A) = (B); (B) = __temp;} while(0) 00015 #endif 00016 00017 // On Solaris, when _TS_ERRNO is defined <errno.h> defines errno as the thread-safe ___errno() function. 00018 // On NT, errno is defined to be '(*_errno())' and presumably this function is also thread safe. 00019 // On MacOS X, errno is defined to be '(*__error())', which is also presumably thread safe. 00020 00021 #import <errno.h> 00022 #define OMNI_ERRNO() errno 00023 00024 00025 // It might be good to put some exception handling in this. 00026 00027 #define OMNI_POOL_START \ 00028 do { \ 00029 NSAutoreleasePool *__pool; \ 00030 __pool = [[NSAutoreleasePool alloc] init]; \ 00031 { 00032 00033 #define OMNI_POOL_END \ 00034 } \ 00035 [__pool release]; \ 00036 } while(0)