]> git.saurik.com Git - apple/objc4.git/blobdiff - runtime/objc-api.h
objc4-532.2.tar.gz
[apple/objc4.git] / runtime / objc-api.h
index 2b139e1e2226561a830ee881d5836a158c153066..94130b92ecc1befc3fe8aa47fd8e4f2f95c2f0a9 100644 (file)
 /*
- * Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
- *
+ * Copyright (c) 1999-2006 Apple Inc.  All Rights Reserved.
+ * 
  * @APPLE_LICENSE_HEADER_START@
  * 
- * Portions Copyright (c) 1999 Apple Computer, Inc.  All Rights
- * Reserved.  This file contains Original Code and/or Modifications of
- * Original Code as defined in and that are subject to the Apple Public
- * Source License Version 1.1 (the "License").  You may not use this file
- * except in compliance with the License.  Please obtain a copy of the
- * License at http://www.apple.com/publicsource and read it before using
- * this file.
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
  * 
  * The Original Code and all software distributed under the License are
- * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
  * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
  * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE OR NON- INFRINGEMENT.  Please see the
- * License for the specific language governing rights and limitations
- * under the License.
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
  * 
  * @APPLE_LICENSE_HEADER_END@
  */
 // Copyright 1988-1996 NeXT Software, Inc.
 
+#ifndef _OBJC_OBJC_API_H_
+#define _OBJC_OBJC_API_H_
+
+#include <Availability.h>
+#include <AvailabilityMacros.h>
+#include <TargetConditionals.h>
+
+#ifndef __has_feature
+#   define __has_feature(x) 0
+#endif
+
+#ifndef __has_extension
+#   define __has_extension __has_feature
+#endif
+
+
+/*
+ * OBJC_API_VERSION 0 or undef: Tiger and earlier API only
+ * OBJC_API_VERSION 2: Leopard and later API available
+ */
+#if !defined(OBJC_API_VERSION)
+#   if defined(__MAC_OS_X_VERSION_MIN_REQUIRED)  &&  __MAC_OS_X_VERSION_MIN_REQUIRED < __MAC_10_5
+#       define OBJC_API_VERSION 0
+#   else
+#       define OBJC_API_VERSION 2
+#   endif
+#endif
+
+
+/* OBJC_OLD_DISPATCH_PROTOTYPES == 0 enforces the rule that the dispatch 
+ * functions must be cast to an appropriate function pointer type. */
+#if !defined(OBJC_OLD_DISPATCH_PROTOTYPES)
+#   define OBJC_OLD_DISPATCH_PROTOTYPES 1
+#endif
+
+
+/* OBJC2_UNAVAILABLE: unavailable in objc 2.0, deprecated in Leopard */
+#if !defined(OBJC2_UNAVAILABLE)
+#   if __OBJC2__
+#       define OBJC2_UNAVAILABLE UNAVAILABLE_ATTRIBUTE
+#   else
+#       define OBJC2_UNAVAILABLE DEPRECATED_IN_MAC_OS_X_VERSION_10_5_AND_LATER
+#   endif
+#endif
+
+/* OBJC_ARC_UNAVAILABLE: unavailable with -fobjc-arc */
+#if !defined(OBJC_ARC_UNAVAILABLE)
+#   if __has_feature(objc_arr)
+#       if __has_extension(attribute_unavailable_with_message)
+#           define OBJC_ARC_UNAVAILABLE __attribute__((unavailable("not available in automatic reference counting mode")))
+#       else
+#           define OBJC_ARC_UNAVAILABLE __attribute__((unavailable))
+#       endif
+#   else
+#       define OBJC_ARC_UNAVAILABLE
+#   endif
+#endif
+
+/* OBJC_GC_UNAVAILABLE: unavailable with -fobjc-gc or -fobjc-gc-only */
+#if !defined(OBJC_GC_UNAVAILABLE)
+#   if __OBJC_GC__
+#       if __has_extension(attribute_unavailable_with_message)
+#           define OBJC_GC_UNAVAILABLE __attribute__((unavailable("not available in garbage collecting mode")))
+#       else
+#           define OBJC_GC_UNAVAILABLE __attribute__((unavailable))
+#       endif
+#   else
+#       define OBJC_GC_UNAVAILABLE
+#   endif
+#endif
+
+#if !defined(OBJC_EXTERN)
+#   if defined(__cplusplus)
+#       define OBJC_EXTERN extern "C" 
+#   else
+#       define OBJC_EXTERN extern
+#   endif
+#endif
+
+#if !defined(OBJC_VISIBLE)
+#   if TARGET_OS_WIN32
+#       if defined(BUILDING_OBJC)
+#           define OBJC_VISIBLE __declspec(dllexport)
+#       else
+#           define OBJC_VISIBLE __declspec(dllimport)
+#       endif
+#   else
+#       define OBJC_VISIBLE  __attribute__((visibility("default")))
+#   endif
+#endif
 
 #if !defined(OBJC_EXPORT)
-    #define OBJC_EXPORT extern
+#   define OBJC_EXPORT  OBJC_EXTERN OBJC_VISIBLE
 #endif
 
 #if !defined(OBJC_IMPORT)
-    #define OBJC_IMPORT extern
+#   define OBJC_IMPORT extern
 #endif
 
+#ifndef __DARWIN_NULL
+#define __DARWIN_NULL NULL
+#endif
 
+#if !defined(OBJC_INLINE)
+#   define OBJC_INLINE __inline
+#endif
+
+#endif