📄 common_8h-source.htm
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1"><title>MiniGUI V1.6.10 API Reference: common.h Source File</title><link href="doxygen.css" rel="stylesheet" type="text/css"></head><body><!-- Generated by Doxygen 1.4.2 --><div class="qindex"><a class="qindex" href="index.htm">Main Page</a> | <a class="qindex" href="modules.htm">Modules</a> | <a class="qindex" href="classes.htm">Alphabetical List</a> | <a class="qindex" href="annotated.htm">Data Structures</a> | <a class="qindex" href="dirs.htm">Directories</a> | <a class="qindex" href="files.htm">File List</a> | <a class="qindex" href="functions.htm">Data Fields</a> | <a class="qindex" href="globals.htm">Globals</a> | <a class="qindex" href="pages.htm">Related Pages</a></div><div class="nav"><a class="el" href="dir_000003.htm">include</a></div><h1>common.h</h1><a href="common_8h.htm">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment">00001 00022 <span class="comment">/*</span>00023 <span class="comment"> * $Id: common.h 8065 2007-11-13 08:09:54Z weiym $</span>00024 <span class="comment"> *</span>00025 <span class="comment"> * MiniGUI for Linux/uClinux, eCos, uC/OS-II, VxWorks, </span>00026 <span class="comment"> * pSOS, ThreadX, NuCleus, OSE, and Win32.</span>00027 <span class="comment"> *</span>00028 <span class="comment"> * Copyright (C) 2002-2007 Feynman Software.</span>00029 <span class="comment"> * Copyright (C) 1998-2002 Wei Yongming.</span>00030 <span class="comment"> *</span>00031 <span class="comment"> * The definitions of some data types and byte order macros </span>00032 <span class="comment"> * borrowed from LGPL'ed SDL by Sam Lantinga.</span>00033 <span class="comment"> *</span>00034 <span class="comment"> * Fix point math routines come from Allegro (a gift software)</span>00035 <span class="comment"> * by Shawn Hargreaves and others.</span>00036 <span class="comment"> */</span>00037 00038 <span class="preprocessor">#ifndef _MGUI_COMMON_H</span>00039 <span class="preprocessor"></span><span class="preprocessor">#define _MGUI_COMMON_H</span>00040 <span class="preprocessor"></span> 00041 <span class="preprocessor">#ifndef MINIGUI_MAJOR_VERSION</span>00042 <span class="preprocessor"></span><span class="preprocessor"># ifdef __MINIGUI_LIB__</span>00043 <span class="preprocessor"></span><span class="preprocessor">#ifdef _FOR_DATANG</span>00044 <span class="preprocessor"></span><span class="preprocessor">#ifdef WIN32</span>00045 <span class="preprocessor"></span><span class="preprocessor">#include <config-win32/mgconfig.h></span>00046 <span class="preprocessor">#elif defined (__THREADX__)</span>00047 <span class="preprocessor"></span><span class="preprocessor"># include "config-threadx/mgconfig.h"</span>00048 <span class="preprocessor">#elif defined (__NUCLEUS__)</span>00049 <span class="preprocessor"></span><span class="preprocessor"># include "config-nucleus/mgconfig.h"</span>00050 <span class="preprocessor">#endif</span>00051 <span class="preprocessor"></span><span class="preprocessor">#else</span>00052 <span class="preprocessor"></span><span class="preprocessor"># include "../mgconfig.h"</span>00053 <span class="preprocessor">#endif</span>00054 <span class="preprocessor"></span><span class="preprocessor"># else</span>00055 <span class="preprocessor"></span><span class="preprocessor"># include "mgconfig.h"</span>00056 <span class="preprocessor"># endif</span>00057 <span class="preprocessor"></span><span class="preprocessor">#endif</span>00058 <span class="preprocessor"></span><a name="l00079"></a><a class="code" href="group__version__info.htm#ga0">00079</a> <span class="preprocessor">#define _VERSION_CODE(major, minor, micro) (((major)<<16) | ((minor)<<8) | (micro))</span>00080 <span class="preprocessor"></span><a name="l00087"></a><a class="code" href="group__version__info.htm#ga1">00087</a> <span class="preprocessor">#define _MINIGUI_VERSION_CODE \</span>00088 <span class="preprocessor"> ((MINIGUI_MAJOR_VERSION << 16) | (MINIGUI_MINOR_VERSION << 8) | MINIGUI_MICRO_VERSION)</span>00089 <span class="preprocessor"></span><a name="l00101"></a><a class="code" href="group__basic__types.htm#ga0">00101</a> <span class="keyword">typedef</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> <a class="code" href="group__basic__types.htm#ga0">Uint8</a>;<a name="l00106"></a><a class="code" href="group__basic__types.htm#ga1">00106</a> <span class="keyword">typedef</span> <span class="keywordtype">signed</span> <span class="keywordtype">char</span> <a class="code" href="group__basic__types.htm#ga1">Sint8</a>;<a name="l00111"></a><a class="code" href="group__basic__types.htm#ga2">00111</a> <span class="keyword">typedef</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">short</span> <a class="code" href="group__basic__types.htm#ga2">Uint16</a>;<a name="l00116"></a><a class="code" href="group__basic__types.htm#ga3">00116</a> <span class="keyword">typedef</span> <span class="keywordtype">signed</span> <span class="keywordtype">short</span> <a class="code" href="group__basic__types.htm#ga3">Sint16</a>;<a name="l00121"></a><a class="code" href="group__basic__types.htm#ga4">00121</a> <span class="keyword">typedef</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> <a class="code" href="group__basic__types.htm#ga4">Uint32</a>;<a name="l00126"></a><a class="code" href="group__basic__types.htm#ga5">00126</a> <span class="keyword">typedef</span> <span class="keywordtype">signed</span> <span class="keywordtype">int</span> <a class="code" href="group__basic__types.htm#ga5">Sint32</a>;00127 00128 <span class="comment">/* Figure out how to support 64-bit datatypes */</span>00129 <span class="preprocessor">#if !defined(__STRICT_ANSI__)</span>00130 <span class="preprocessor"></span><span class="preprocessor">#if defined(__GNUC__)</span>00131 <span class="preprocessor"></span><span class="preprocessor">#define MGUI_HAS_64BIT_TYPE long long</span>00132 <span class="preprocessor"></span><span class="preprocessor">#endif</span>00133 <span class="preprocessor"></span><span class="preprocessor">#if defined(__CC_ARM)</span>00134 <span class="preprocessor"></span><span class="preprocessor">#define MGUI_HAS_64BIT_TYPE long long</span>00135 <span class="preprocessor"></span><span class="preprocessor">#endif</span>00136 <span class="preprocessor"></span><span class="preprocessor">#if defined(_MSC_VER)</span>00137 <span class="preprocessor"></span><span class="preprocessor">#define MGUI_HAS_64BIT_TYPE __int64</span>00138 <span class="preprocessor"></span><span class="preprocessor">#endif</span>00139 <span class="preprocessor"></span><span class="preprocessor">#endif </span><span class="comment">/* !__STRICT_ANSI__ */</span>00140 00141 <span class="comment">/* The 64-bit datatype isn't supported on all platforms */</span>00142 <span class="preprocessor">#ifdef MGUI_HAS_64BIT_TYPE</span>00143 <span class="preprocessor"></span><a name="l00150"></a><a class="code" href="group__basic__types.htm#ga6">00150</a> <span class="keyword">typedef</span> <span class="keywordtype">unsigned</span> MGUI_HAS_64BIT_TYPE <a class="code" href="group__basic__types.htm#ga6">Uint64</a>;<a name="l00157"></a><a class="code" href="group__basic__types.htm#ga7">00157</a> <span class="keyword">typedef</span> <span class="keywordtype">signed</span> MGUI_HAS_64BIT_TYPE <a class="code" href="group__basic__types.htm#ga7">Sint64</a>;00158 <span class="preprocessor">#else</span>00159 <span class="preprocessor"></span><span class="comment">/* This is really just a hack to prevent the compiler from complaining */</span>00160 <span class="keyword">typedef</span> <span class="keyword">struct </span>{00161 <a class="code" href="group__basic__types.htm#ga4">Uint32</a> hi;00162 <a class="code" href="group__basic__types.htm#ga4">Uint32</a> lo;00163 } <a class="code" href="group__basic__types.htm#ga6">Uint64</a>, <a class="code" href="group__basic__types.htm#ga7">Sint64</a>;00164 <span class="preprocessor">#endif</span>00165 <span class="preprocessor"></span>00166 <span class="comment">/* Make sure the types really have the right sizes */</span>00167 <span class="preprocessor">#define MGUI_COMPILE_TIME_ASSERT(name, x) \</span>00168 <span class="preprocessor"> typedef int MGUI_dummy_ ## name[(x) * 2 - 1]</span>00169 <span class="preprocessor"></span>00170 MGUI_COMPILE_TIME_ASSERT(uint8, <span class="keyword">sizeof</span>(<a class="code" href="group__basic__types.htm#ga0">Uint8</a>) == 1);00171 MGUI_COMPILE_TIME_ASSERT(sint8, <span class="keyword">sizeof</span>(<a class="code" href="group__basic__types.htm#ga1">Sint8</a>) == 1);00172 MGUI_COMPILE_TIME_ASSERT(uint16, <span class="keyword">sizeof</span>(<a class="code" href="group__basic__types.htm#ga2">Uint16</a>) == 2);00173 MGUI_COMPILE_TIME_ASSERT(sint16, <span class="keyword">sizeof</span>(<a class="code" href="group__basic__types.htm#ga3">Sint16</a>) == 2);00174 MGUI_COMPILE_TIME_ASSERT(uint32, <span class="keyword">sizeof</span>(<a class="code" href="group__basic__types.htm#ga4">Uint32</a>) == 4);00175 MGUI_COMPILE_TIME_ASSERT(sint32, <span class="keyword">sizeof</span>(<a class="code" href="group__basic__types.htm#ga5">Sint32</a>) == 4);00176 MGUI_COMPILE_TIME_ASSERT(uint64, <span class="keyword">sizeof</span>(<a class="code" href="group__basic__types.htm#ga6">Uint64</a>) == 8);00177 MGUI_COMPILE_TIME_ASSERT(sint64, <span class="keyword">sizeof</span>(<a class="code" href="group__basic__types.htm#ga7">Sint64</a>) == 8);00178 00179 <span class="preprocessor">#undef MGUI_COMPILE_TIME_ASSERT</span>00180 <span class="preprocessor"></span><a name="l00192"></a><a class="code" href="group__endian__info.htm#ga0">00192</a> <span class="preprocessor">#define MGUI_LIL_ENDIAN 1234</span>00193 <span class="preprocessor"></span><a name="l00197"></a><a class="code" href="group__endian__info.htm#ga1">00197</a> <span class="preprocessor">#define MGUI_BIG_ENDIAN 4321</span>00198 <span class="preprocessor"></span>00199 <span class="comment">/* Pardon the mess, I'm trying to determine the endianness of this host.</span>00200 <span class="comment"> * I'm doing it by preprocessor defines rather than some sort of configure</span>00201 <span class="comment"> * script so that application code can use this too. The "right" way would</span>00202 <span class="comment"> * be to dynamically generate this file on install, but that's a lot of work.</span>00203 <span class="comment"> */</span>00204 00222 <span class="preprocessor">#if defined(__i386__) || defined(__ia64__) || \</span>00223 <span class="preprocessor"> (defined(__alpha__) || defined(__alpha)) || \</span>00224 <span class="preprocessor"> defined(__arm__) || \</span>00225 <span class="preprocessor"> (defined(__CC_ARM) && !defined(__BIG_ENDIAN)) || \</span>00226 <span class="preprocessor"> (defined(__mips__) && defined(__MIPSEL__)) || \</span>00227 <span class="preprocessor"> defined(__LITTLE_ENDIAN__) || \</span>00228 <span class="preprocessor"> defined(WIN32)</span><a name="l00229"></a><a class="code" href="group__endian__info.htm#ga2">00229</a> <span class="preprocessor"></span><span class="preprocessor">#define MGUI_BYTEORDER MGUI_LIL_ENDIAN</span>00230 <span class="preprocessor"></span><span class="preprocessor">#else</span>00231 <span class="preprocessor"></span><span class="preprocessor">#define MGUI_BYTEORDER MGUI_BIG_ENDIAN</span>00232 <span class="preprocessor"></span><span class="preprocessor">#endif</span>00233 <span class="preprocessor"></span>00245 <span class="preprocessor">#ifndef _HAVE_TYPE_BOOL</span>00246 <span class="preprocessor"></span><span class="preprocessor">#ifndef BOOL</span><a name="l00247"></a><a class="code" href="group__simple__types.htm#ga0">00247</a> <span class="preprocessor"></span><span class="keyword">typedef</span> <span class="keywordtype">int</span> <a class="code" href="group__simple__types.htm#ga0">BOOL</a>;00248 <span class="preprocessor">#endif</span>00249 <span class="preprocessor"></span><span class="preprocessor">#endif</span>00250 <span class="preprocessor"></span>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -