avmplusTypes.h

Go to the documentation of this file.
00001 /* ***** BEGIN LICENSE BLOCK *****
00002  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
00003  *
00004  * The contents of this file are subject to the Mozilla Public License Version
00005  * 1.1 (the "License"); you may not use this file except in compliance with
00006  * the License. You may obtain a copy of the License at
00007  * http://www.mozilla.org/MPL/
00008  *
00009  * Software distributed under the License is distributed on an "AS IS" basis,
00010  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
00011  * for the specific language governing rights and limitations under the
00012  * License.
00013  *
00014  * The Original Code is [Open Source Virtual Machine.].
00015  *
00016  * The Initial Developer of the Original Code is
00017  * Adobe System Incorporated.
00018  * Portions created by the Initial Developer are Copyright (C) 2004-2006
00019  * the Initial Developer. All Rights Reserved.
00020  *
00021  * Contributor(s):
00022  *   Adobe AS3 Team
00023  *
00024  * Alternatively, the contents of this file may be used under the terms of
00025  * either the GNU General Public License Version 2 or later (the "GPL"), or
00026  * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
00027  * in which case the provisions of the GPL or the LGPL are applicable instead
00028  * of those above. If you wish to allow use of your version of this file only
00029  * under the terms of either the GPL or the LGPL, and not to allow others to
00030  * use your version of this file under the terms of the MPL, indicate your
00031  * decision by deleting the provisions above and replace them with the notice
00032  * and other provisions required by the GPL or the LGPL. If you do not delete
00033  * the provisions above, a recipient may use your version of this file under
00034  * the terms of any one of the MPL, the GPL or the LGPL.
00035  *
00036  * ***** END LICENSE BLOCK ***** */
00037 
00038 #ifndef __avmplus_types__
00039 #define __avmplus_types__
00040 
00041 
00042 #ifdef _MSC_VER
00043     // MSVC doesn't support inttypes.h or most C99 types directly
00044     #include <crtdefs.h>    // defines intrptr_t and uintptr_t, but not the rest of C99 int types
00045     typedef __int8              int8_t;
00046     typedef __int16             int16_t;
00047     typedef __int32             int32_t;
00048     typedef __int64             int64_t;
00049     typedef unsigned __int8     uint8_t;
00050     typedef unsigned __int16    uint16_t;
00051     typedef unsigned __int32    uint32_t; 
00052     typedef unsigned __int64    uint64_t;
00053 #else
00054     #include <inttypes.h>
00055 #endif
00056 
00057 namespace avmplus
00058 {
00059     // legacy types
00060     typedef int8_t      sint8;
00061     typedef int8_t      int8;
00062     typedef uint8_t     byte;
00063     typedef uint8_t     uint8;
00064 
00065     typedef int16_t     sint16;
00066     typedef int16_t     int16;
00067     typedef uint16_t    uint16;
00068 
00069     typedef int32_t     sint32;
00070     typedef int32_t     int32;
00071     typedef uint32_t    uint32; 
00072 
00073     typedef int64_t     int64;
00074     typedef int64_t     sint64;
00075     typedef uint64_t    uint64;
00076 
00077     typedef intptr_t    sintptr;
00078     typedef uintptr_t   uintptr;
00079 
00080     /* wchar is our version of wchar_t, since wchar_t is different sizes
00081        on different platforms, but we want to use UTF-16 uniformly. */
00082     typedef uint16_t wchar;
00083     
00084     #ifndef NULL
00085     #define NULL 0
00086     #endif
00087 
00088     // Atom should really be an intptr_t, but doing so can cause problematic compiles
00089     // because some platforms define intptr_t as an int64, and some as a long, which
00090     // create different overload possibilities in a few cases. Ideally, Atom should
00091     // be a unique pointer type (as it is in TT) but for now, avoid the code churn
00092     // by defining it the "old" way
00093     //
00094     // math friendly pointer (64 bits in LP 64 systems)
00095     #if defined (_MSC_VER) && (_MSC_VER >= 1300)
00096         #define AVMPLUS_TYPE_IS_POINTER_SIZED __w64
00097     #else
00098         #define AVMPLUS_TYPE_IS_POINTER_SIZED
00099     #endif  
00100     #ifdef AVMPLUS_64BIT
00101     typedef AVMPLUS_TYPE_IS_POINTER_SIZED int64_t Atom;
00102     #else
00103     typedef AVMPLUS_TYPE_IS_POINTER_SIZED int32_t Atom;
00104     #endif
00105     
00106     // nothing overloads on Binding, so we can use intptr_t
00107     // Ideally, Binding should be a unique pointer type (as it is in TT) but for now, 
00108     // avoid the code churn by defining it the "old" way
00109     typedef intptr_t    Binding;
00110 
00111     // nothing overloads on CodeContextAtom, so we can use intptr_t
00112     // Ideally, CodeContextAtom should be a unique pointer type (as it is in TT) but for now, 
00113     // avoid the code churn by defining it the "old" way
00114     typedef intptr_t    CodeContextAtom;
00115 
00116     inline uint32 urshift(Atom atom, int amount)
00117     {
00118         return ((uint32)atom >> amount);
00119     }
00120 }
00121 
00122 #endif /* __avmplus_types__ */

Generated on Sun Oct 12 18:49:52 2008 for Tamarin by  doxygen 1.4.6