types.h

Go to the documentation of this file.
00001 
00004 #ifndef FBXFILESDK_COMPONENTS_KBASELIB_KARCH_TYPES_H
00005 #define FBXFILESDK_COMPONENTS_KBASELIB_KARCH_TYPES_H
00006 
00007 /**************************************************************************************
00008 
00009  Copyright (C) 2001 - 2009 Autodesk, Inc. and/or its licensors.
00010  All Rights Reserved.
00011 
00012  The coded instructions, statements, computer programs, and/or related material 
00013  (collectively the "Data") in these files contain unpublished information 
00014  proprietary to Autodesk, Inc. and/or its licensors, which is protected by 
00015  Canada and United States of America federal copyright law and by international 
00016  treaties. 
00017  
00018  The Data may not be disclosed or distributed to third parties, in whole or in
00019  part, without the prior written consent of Autodesk, Inc. ("Autodesk").
00020 
00021  THE DATA IS PROVIDED "AS IS" AND WITHOUT WARRANTY.
00022  ALL WARRANTIES ARE EXPRESSLY EXCLUDED AND DISCLAIMED. AUTODESK MAKES NO
00023  WARRANTY OF ANY KIND WITH RESPECT TO THE DATA, EXPRESS, IMPLIED OR ARISING
00024  BY CUSTOM OR TRADE USAGE, AND DISCLAIMS ANY IMPLIED WARRANTIES OF TITLE, 
00025  NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE OR USE. 
00026  WITHOUT LIMITING THE FOREGOING, AUTODESK DOES NOT WARRANT THAT THE OPERATION
00027  OF THE DATA WILL BE UNINTERRUPTED OR ERROR FREE. 
00028  
00029  IN NO EVENT SHALL AUTODESK, ITS AFFILIATES, PARENT COMPANIES, LICENSORS
00030  OR SUPPLIERS ("AUTODESK GROUP") BE LIABLE FOR ANY LOSSES, DAMAGES OR EXPENSES
00031  OF ANY KIND (INCLUDING WITHOUT LIMITATION PUNITIVE OR MULTIPLE DAMAGES OR OTHER
00032  SPECIAL, DIRECT, INDIRECT, EXEMPLARY, INCIDENTAL, LOSS OF PROFITS, REVENUE
00033  OR DATA, COST OF COVER OR CONSEQUENTIAL LOSSES OR DAMAGES OF ANY KIND),
00034  HOWEVER CAUSED, AND REGARDLESS OF THE THEORY OF LIABILITY, WHETHER DERIVED
00035  FROM CONTRACT, TORT (INCLUDING, BUT NOT LIMITED TO, NEGLIGENCE), OR OTHERWISE,
00036  ARISING OUT OF OR RELATING TO THE DATA OR ITS USE OR ANY OTHER PERFORMANCE,
00037  WHETHER OR NOT AUTODESK HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH LOSS
00038  OR DAMAGE. 
00039 
00040 **************************************************************************************/
00041 #include <fbxfilesdk/components/kbaselib/karch/arch.h>
00042 
00043 #include <float.h>
00044 #include <stddef.h>
00045 
00046 // Common independant definitions
00047 
00048 typedef void*               kPointer;
00049 typedef signed char         kByte;         /* signed 8-bit integer         */
00050 typedef unsigned char       kUByte;        /* unsigned 8-bit integer       */
00051 typedef signed char         kSChar;
00052 typedef unsigned char       kUChar;
00053 typedef unsigned int        kUInt;
00054 typedef signed short        kShort;
00055 typedef unsigned short      kUShort;
00056 
00057 typedef double              kVector3[3];   /* 3 x 64-bit real              */
00058 typedef double              kVector4[4];   /* 4 x 64-bit real              */
00059 
00060 #define K_SCHAR_MIN         (-128)
00061 #define K_SCHAR_MAX         (127)
00062 #define K_UCHAR_MIN         (0)
00063 #define K_UCHAR_MAX         (255)
00064 
00065 #define K_INT8_MIN          (-128)
00066 #define K_INT8_MAX          (127)
00067 #define K_UINT8_MIN         (0)
00068 #define K_UINT8_MAX         (255)
00069 
00070 #define K_INT16_MIN         (-32768)
00071 #define K_INT16_MAX         (32767)
00072 #define K_UINT16_MIN        (0)
00073 #define K_UINT16_MAX        (65535)
00074 
00075 #define K_INT32_MIN         (0x80000000)
00076 #define K_INT32_MAX         (0x7fffffff)
00077 #define K_UINT32_MIN        (0)
00078 #define K_UINT32_MAX        (0xffffffff)
00079 
00080 #if defined (KARCH_ARCH_POWERPC)
00081     #define KARCH_BIG_ENDIAN
00082 #else
00083     #define KARCH_LITTLE_ENDIAN
00084 #endif
00085 
00086 #define K_CHAR(x)           char(x)
00087 #define K_SCHAR(x)          kSChar(x)
00088 #define K_UCHAR(x)          kUChar(x##L)
00089 
00090 #if defined(KARCH_ENV_WIN64)
00091     typedef unsigned short      kWChar;         /* international character */
00092 #else
00093     typedef wchar_t             kWChar;         /* international character */
00094 #endif
00095 
00096 #define K_WCHAR(x)          kWChar(x)
00097 #define K_WCHAR_MIN         K_WCHAR(0)
00098 #define K_WCHAR_MAX         K_WCHAR(65535)
00099 typedef kWChar *            kWCharPtr;      /* international string */
00100 
00101 typedef char* kTCharPtr;
00102 #ifndef _T
00103     #define __T(x)      x
00104     #define _T(x)       __T(x)
00105 #endif
00106 
00107 #define K_SHORT(x)          kShort(x)
00108 #define K_USHORT(x)         kUShort(x##U)
00109 #define K_SHORT_MIN         K_SHORT(-32768)
00110 #define K_SHORT_MAX         K_SHORT(32767)
00111 #define K_USHORT_MIN        K_USHORT(0)
00112 #define K_USHORT_MAX        K_USHORT(65535)
00113 
00114 #define K_INT(x)            (x)
00115 #define K_UINT(x)           (x##U)
00116 #define K_INT_MIN           K_INT(0x80000000)
00117 #define K_INT_MAX           K_INT(0x7fffffff)
00118 #define K_UINT_MIN          K_UINT(0)
00119 #define K_UINT_MAX          K_UINT(0xffffffff)
00120 
00121 typedef signed long         kLong;
00122 #define K_LONG(x)           (x)
00123 typedef unsigned long       kULong;
00124 #define K_ULONG(x)          (x##U)
00125 #define K_LONG_MIN          K_LONG(0x80000000)
00126 #define K_LONG_MAX          K_LONG(0x7fffffff)
00127 #define K_ULONG_MIN         K_ULONG(0)
00128 #define K_ULONG_MAX         K_ULONG(0xffffffff)
00129 
00130 #if defined(KARCH_DEV_MSC) && !defined(KARCH_DEV_INTEL)
00131     typedef signed __int64      kLongLong;
00132     #define K_LONGLONG(x)       (x##i64)
00133     typedef unsigned __int64    kULongLong;
00134     #define K_ULONGLONG(x)      (x##Ui64)
00135 #else
00136     typedef signed long long    kLongLong;
00137     #define K_LONGLONG(x)       (x##LL)
00138     typedef unsigned long long  kULongLong;
00139     #define K_ULONGLONG(x)      (x##ULL)
00140 #endif
00141 
00142 #define K_LONGLONG_MIN      K_LONGLONG(0x8000000000000000)
00143 #define K_LONGLONG_MAX      K_LONGLONG(0x7fffffffffffffff)
00144 #define K_ULONGLONG_MIN     K_ULONGLONG(0)
00145 #define K_ULONGLONG_MAX     K_ULONGLONG(0xffffffffffffffff)
00146 
00147 #define K_FLOAT(x)          (x##F)
00148 #define K_FLOAT_MIN         FLT_MIN                 // minimum positive value
00149 #define K_FLOAT_MAX         FLT_MAX                 // maximum positive value
00150 
00151 #define K_DOUBLE(x)         (x)
00152 #define K_DOUBLE_MIN        DBL_MIN                 // minimum positive value
00153 #define K_DOUBLE_MAX        DBL_MAX                 // maximum positive value
00154 
00155 typedef kSChar              kInt8;
00156 typedef kUChar              kUInt8;
00157 
00158 typedef kShort              kInt16;
00159 typedef kUShort             kUInt16;
00160 
00161 typedef int                 kInt32;
00162 typedef kUInt               kUInt32;
00163 
00164 typedef kLongLong           kInt64;
00165 typedef kULongLong          kUInt64;
00166 #define K_INT64_MIN         K_LONGLONG_MIN
00167 #define K_INT64_MAX         K_LONGLONG_MAX
00168 #define K_UINT64_MIN        K_ULONGLONG_MIN
00169 #define K_UINT64_MAX        K_ULONGLONG_MAX
00170 
00171 #ifdef KARCH_DEV_MSC
00172     #define K_TEMPLATE_SPEC(t)
00173     #define K_TEMPLATE_SPEC2(t1, t2)
00174     #define K_INLINE            inline
00175     #ifdef _DEBUG
00176         #define K_FORCEINLINE       K_INLINE
00177     #else
00178         #define K_FORCEINLINE       __forceinline
00179     #endif
00180 #else
00181     #define K_TEMPLATE_SPEC(t)  template<>
00182     #define K_TEMPLATE_SPEC2(t1, t2)
00183     #define K_INLINE            inline
00184     #define K_FORCEINLINE       K_INLINE
00185 #endif
00186 
00187 #define K_WIN_API(t)        __declspec(dllimport) t __stdcall
00188 
00189 // Constants not defined on Cygwin
00190 #ifdef KARCH_DEV_GNUC
00191     #define OFN_ENABLEINCLUDENOTIFY     0x00400000     // send include message to callback
00192     #define OFN_ENABLESIZING            0x00800000
00193 #endif
00194 
00195 // Atomic definitions
00196 
00197 #ifdef KARCH_ARCH_64
00198     #ifdef KARCH_DEV_MSC
00199         typedef __int64         kAtomic;
00200     #else
00201         typedef kLongLong       kAtomic;
00202     #endif
00203     #define K_ATOMIC_MIN        K_INT64_MIN
00204     #define K_ATOMIC_MAX        K_INT64_MAX
00205     #define K_SIZEOF_ATOMIC     8
00206     #define K_ATOMIC_BITS       64
00207 
00208     #define kOffset             kUInt64
00209     #define K_REFERENCE_MAX     K_ULONGLONG_MAX
00210 #else
00211     typedef long                kAtomic;
00212     #define K_ATOMIC_MIN        K_INT32_MIN
00213     #define K_ATOMIC_MAX        K_INT32_MAX
00214     #define K_SIZEOF_ATOMIC     4
00215     #define K_ATOMIC_BITS       32
00216 
00217     #define kOffset             kUInt32
00218     #define K_REFERENCE_MAX     K_ULONG_MAX
00219 #endif
00220 
00221 // Common dependent definitions
00222 
00223 typedef kOffset             kSizeT;
00224 typedef kOffset             kReference;
00225 
00226 #endif // FBXFILESDK_COMPONENTS_KBASELIB_KARCH_TYPES_H
00227