

/**********************************************************//**
 **
 ** @file base/types_c.h
 **
 ** Copyright (C) 2009  Xpace, LLC.  All rights reserved
 **
 ** www.xpace.net
 **
 **************************************************************/

#ifndef XPACE_TYPES_C_H
#define XPACE_TYPES_C_H

/// import/export attribute, used only for Windows DLLs
#if !defined XPACE_EXPORT
# if !defined _WIN32 || defined XPACE_STATICLIB
#   define XPACE_EXPORT
# else
#   define XPACE_EXPORT __declspec(dllimport)
# endif
#endif

/// ABI attribute
#if !defined XPACE_ABI
# if !defined _WIN32
#   define XPACE_ABI
# else
#   define XPACE_ABI _stdcall
# endif
#endif

/// @name unsigned types
//@{
typedef unsigned char byte;
typedef unsigned int uint;
//@}

/// @name explicity-sized types
//@{
typedef char int8;
typedef unsigned char uint8;
typedef short int16;
typedef unsigned short uint16;
typedef int int32;
typedef unsigned int uint32;
typedef long long int64;
typedef unsigned long long uint64;
//@}

typedef uint16 Xpace_Char;
typedef const Xpace_Char* Xpace_String;   

#ifdef XPACE_TYPES_H
Xpace_String XPACE_ABI Xpace_String_Create
  (Xpace::String str);
#endif

#ifdef __cplusplus
extern "C"
{
#endif

/// call this to deallocate Xpace_Strings
XPACE_EXPORT void XPACE_ABI Xpace_String_Destroy
  (Xpace_String);

#ifdef __cplusplus
}

#else
#include <stdlib.h>
typedef int bool;
#endif

/// A low-level data holder 
typedef struct XPACE_EXPORT 
{
  const byte* data;     ///< first byte
  size_t length;        ///< number of bytes
}
Xpace_Bytes;

#endif
