Xpace
types_c.h
Go to the documentation of this file.
1 
2 
3 /**************************************************************
4  **
5  ** @file base/types_c.h
6  **
7  ** Copyright (C) 2012 Xpace, LLC. All rights reserved
8  **
9  ** www.xpace.net
10  **
11  **************************************************************/
12 
13 #ifndef XPACE_TYPES_C_H
14 #define XPACE_TYPES_C_H
15 
16 #ifdef __cplusplus
17 # define EXTERNC extern "C"
18 #else
19 # define EXTERNC
20 #endif
21 
22 #if defined _WIN32
23 # define STDCALL __stdcall
24 #else
25 # define STDCALL
26 #endif
27 
28 /// import/export attribute, used only for Windows DLLs
29 #if !defined _WIN32 || defined XPACE_STATICLIB
30 # define XPACE_C_EXPORT(ret) EXTERNC ret
31 #elif !defined XPACE_EXPORT
32 # define XPACE_C_EXPORT(ret) EXTERNC __declspec(dllimport) ret __stdcall
33 #else
34 # define XPACE_C_EXPORT(ret) EXTERNC __declspec(dllexport) ret __stdcall
35 #endif
36 
37 #define XPACE_C_CALLBACK(ret, name) EXTERNC typedef ret (STDCALL *name)
38 
39 /// @name unsigned types
40 //@{
41 typedef unsigned char byte;
42 typedef unsigned int uint;
43 //@}
44 
45 /// @name explicity-sized types
46 //@{
47 typedef char int8;
48 typedef unsigned char uint8;
49 typedef short int16;
50 typedef unsigned short uint16;
51 typedef int int32;
52 typedef unsigned int uint32;
53 typedef long long int64;
54 typedef unsigned long long uint64;
55 //@}
56 
59 
60 ///@name free a string
61 XPACE_C_EXPORT(void) Xpace_String_destroy
62  (Xpace_Char16* str);
63 
64 #ifndef __cplusplus
65 #include <stdlib.h>
66 typedef int bool;
67 #endif
68 
70 {
79 };
80 
81 /// A low-level data holder
82 typedef struct XPACE_EXPORT
83 {
84  const byte* data; ///< first byte
85  size_t length; ///< number of bytes
86 }
88 
89 /// A float with a explicit mantissa and exponent
90 typedef struct XPACE_EXPORT
91 {
92  int64 mantissa; ///< mantissa
93  int decimals; ///< decimals
94 }
96 
97 /// A date and a time
98 typedef struct XPACE_EXPORT
99 {
100  int year;
107 }
109 
110 /// convert a DecimalFloat to a double
111 XPACE_C_EXPORT(double) Xpace_DecimalFloat_to_Double
112  (const Xpace_DecimalFloat*);
113 
114 #endif
int bool
Definition: types_c.h:66
uint hour
Definition: types_c.h:103
unsigned char byte
Definition: types_c.h:41
A low-level data holder.
Definition: types_c.h:82
unsigned int uint32
Definition: types_c.h:52
int64 mantissa
mantissa
Definition: types_c.h:92
Xpace_Data_Type
Definition: types_c.h:69
int decimals
decimals
Definition: types_c.h:93
#define XPACE_C_EXPORT(ret)
import/export attribute, used only for Windows DLLs
Definition: types_c.h:30
int int32
Definition: types_c.h:51
uint day
Definition: types_c.h:102
unsigned int uint
Definition: types_c.h:42
uint minute
Definition: types_c.h:104
unsigned char uint8
Definition: types_c.h:48
uint month
Definition: types_c.h:101
uint millisecond
Definition: types_c.h:106
struct XPACE_EXPORT Xpace_DecimalFloat
A float with a explicit mantissa and exponent.
unsigned long long uint64
Definition: types_c.h:54
struct XPACE_EXPORT Xpace_Bytes
A low-level data holder.
char int8
Definition: types_c.h:47
const byte * data
first byte
Definition: types_c.h:84
uint16 Xpace_Char16
Definition: types_c.h:58
struct XPACE_EXPORT Xpace_DateTime
A date and a time.
short int16
Definition: types_c.h:49
long long int64
Definition: types_c.h:53
uint8 Xpace_Char8
Definition: types_c.h:57
unsigned short uint16
Definition: types_c.h:50
size_t length
number of bytes
Definition: types_c.h:85
uint second
Definition: types_c.h:105

current as of Wed Jun 10 2026 12:00:05