- Main Page
- Classes
- Files

- Search for |

# systypes.h

    00001 /*****************************
    00002 File:      systypes.h
    00003 Language:   C++ (header)
    00004 Project:    H3DNetworkingUtils
    00005 The contents of this file are subject to the Mozilla Public License
    00006 Version 1.1 (the "License"); you may not use this file except in
    00007 compliance with the License. You may obtain a copy of the License at
    00008 http://www.mozilla.org/MPL/
    00009
    00010 Software distributed under the License is distributed on an "AS IS"
    00011 basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
    00012 License for the specific language governing rights and limitations
    00013 under the License.
    00014
    00015 The Original Code is H3DNetworkingUtils v1.0.
    00016
    00017 The Initial Developer of the Original Code is CSIRO.
    00018 Portions created by the Initial Developer are Copyright (C) 1009 CSIRO. All Rights Reserved.
    00019 Contributor(s):
    00020    Samuel Taylor, (sam.taylor@anu.edu.au)
    00021    Chris Gunn  <Chris.Gunn@csiro.au> <ChrisJGunn@gmail.com>
    00022 ***************************/
    00023
    00024 // The systypes.h file provides some system type definitions
    00025
    00026 #ifndef _systypes_
    00027 #define _systypes_
    00028
    00029 #include "H3DNetworkingUtils/Config.h"
    00030
    00031 /*-- Platform Identification Defines ---------------------------------*/
    00032
    00033 #if defined(_WIN32) || defined(WIN32)
    00034 #   define PLATFORM_WIN32
    00035 #   define PLATFORM WIN32
    00036
    00037 #elif defined(__sgi)
    00038 #   define PLATFORM_SGI_IRIX
    00039 #   define PLATFORM SGI_IRIX
    00040 #   define PLATFORM_UNIX
    00041
    00042 #elif defined (__osf__) && defined(__alpha)
    00043 #   define PLATFORM_DIGITAL_UNIX
    00044 #   define PLATFORM DIGITAL_UNIX
    00045 #   define PLATFORM_UNIX
    00046
    00047 #elif defined(__linux) && defined(__i386)
    00048 #   define PLATFORM_X86_LINUX
    00049 #   define PLATFORM X86_LINUX
    00050 #   define PLATFORM_UNIX
    00051
    00052 #else
    00053 #   define PLATFORM_UNKNOWN
    00054 #   define PLATFORM UNKNOWN
    00055 #   define PLATFORM_UNIX
    00056
    00057 #endif
    00058
    00059 /*-- Platform independent types ----------------------------------------
    00060 /
    00061 /   TYPES
    00062 /  int8, int16, int32, int64 -- signed integers
    00063 /  uint8, uint16, uint32, uint64 -- unsigned integers
    00064 /  float32 -- guaranteed single precision
    00065 /   MACROS
    00066 /  htonXX, ntohXX -- host-to-network and network-to-host
    00067 /   PLATFORMS
    00068 /   1.   Win32 -- 64 bit support is nominal
    00069 /   2.   SGI/MIPS -- 64 bit support guaranteed on 64 bit processors
    00070 /   3.  OSF/ALPHA -- 64 bit support guaranteed
    00071 /   4.  Linux/x86 -- 64 bit support maybe?
    00072 */
    00073
    00074 #if defined(PLATFORM_WIN32)
    00075 #   include <winsock.h>
    00076     typedef __int8       int8;
    00077     typedef __int16      int16;
    00078     typedef __int32      int32;
    00079     typedef __int64      int64;
    00080     typedef unsigned char   uint8;
    00081     typedef unsigned short  uint16;
    00082     typedef unsigned int    uint32;
    00083     typedef unsigned __int64 uint64;
    00084     typedef float     float32;
    00085
    00086
    00087 #elif defined(PLATFORM_SGI_IRIX)
    00088 #   include <sys/types.h>
    00089     typedef int8_t       int8;
    00090     typedef int16_t      int16;
    00091     typedef int32_t      int32;
    00092     typedef int64_t      int64;
    00093     typedef uint8_t      uint8;
    00094     typedef uint16_t     uint16;
    00095     typedef uint32_t     uint32;
    00096     typedef uint64_t     uint64;
    00097     typedef float     float32;
    00098
    00099
    00100 #elif defined(PLATFORM_X86_LINUX)
    00101 #   include <sys/types.h>
    00102     typedef __int8_t     int8;
    00103     typedef __int16_t       int16;
    00104     typedef __int32_t       int32;
    00105     typedef __int64_t       int64;
    00106     typedef __uint8_t       uint8;
    00107     typedef __uint16_t      uint16;
    00108     typedef __uint32_t      uint32;
    00109     typedef __uint64_t      uint64;
    00110     typedef float     float32;
    00111
    00112
    00113 #elif defined (PLATFORM_DIGITAL_UNIX)
    00114 #   include <netinet/in.h>
    00115     typedef char      int8;
    00116     typedef short     int16;
    00117     typedef int          int32;
    00118     typedef long      int64;
    00119     typedef unsigned char   uint8;
    00120     typedef unsigned short  uint16;
    00121     typedef unsigned int    uint32;
    00122     typedef unsigned long   uint64;
    00123
    00124 #endif
    00125
    00126 typedef uint8 byte;
    00127
    00128 #define  hton16 htons
    00129 #define  hton32 htonl
    00130 #define  hton64 <<ERROR>>
    00131 #define  ntoh16 ntohs
    00132 #define  ntoh32 ntohl
    00133 #define  ntoh64 <<ERROR>>
    00134
    00135 #if defined(PLATFORM_WIN32) || defined(PLATFORM_X86_LINUX)
    00136     extern float32 H3D_NETWORKING_UTILS_DLL_SPEC ntohf (float32 f);
    00137     extern float32 H3D_NETWORKING_UTILS_DLL_SPEC htonf (float32 f);
    00138 #elif defined(PLATFORM_SGI_IRIX)
    00139 #   define ntohf(f) (f)
    00140 #   define htonf(f) (f)
    00141 #endif
    00142
    00143 #endif
    00144