MRPT  1.9.9
rptypes.h
Go to the documentation of this file.
1 /* +------------------------------------------------------------------------+
2  | Mobile Robot Programming Toolkit (MRPT) |
3  | https://www.mrpt.org/ |
4  | |
5  | Copyright (c) 2005-2019, Individual contributors, see AUTHORS file |
6  | See: https://www.mrpt.org/Authors - All rights reserved. |
7  | Released under BSD License. See: https://www.mrpt.org/License |
8  +------------------------------------------------------------------------+ */
9 /*
10  * Redistribution and use in source and binary forms, with or without
11  * modification, are permitted provided that the following conditions are met:
12  *
13  * 1. Redistributions of source code must retain the above copyright notice,
14  * this list of conditions and the following disclaimer.
15  *
16  * 2. Redistributions in binary form must reproduce the above copyright notice,
17  * this list of conditions and the following disclaimer in the documentation
18  * and/or other materials provided with the distribution.
19  *
20  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22  * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23  * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
24  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
27  * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
28  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
29  * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
30  * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31  *
32  */
33 
34 #pragma once
35 
36 #include <cstddef> // size_t (JLBC for MRPT)
37 
38 #ifdef _WIN32
39 #include <windows.h>
40 
41 // fake stdint.h for VC only
42 
43 typedef signed char int8_t;
44 typedef unsigned char uint8_t;
45 
46 typedef __int16 int16_t;
47 typedef unsigned __int16 uint16_t;
48 
49 typedef __int32 int32_t;
50 typedef unsigned __int32 uint32_t;
51 
52 typedef __int64 int64_t;
53 typedef unsigned __int64 uint64_t;
54 
55 #else
56 
57 #include <cstdint>
58 
59 #endif
60 
61 // based on stdint.h
62 typedef int8_t _s8;
63 typedef uint8_t _u8;
64 
65 typedef int16_t _s16;
66 typedef uint16_t _u16;
67 
68 typedef int32_t _s32;
69 typedef uint32_t _u32;
70 
71 typedef int64_t _s64;
72 typedef uint64_t _u64;
73 
74 #define __small_endian
75 
76 #ifndef __GNUC__
77 #define __attribute__(x)
78 #endif
79 
80 // The _word_size_t uses actual data bus width of the current CPU
81 #ifdef _AVR_
82 typedef _u8 _word_size_t;
83 #define THREAD_PROC
84 #elif defined(WIN64)
85 typedef _u64 _word_size_t;
86 #define THREAD_PROC __stdcall
87 #elif defined(WIN32)
88 typedef _u32 _word_size_t;
89 #define THREAD_PROC __stdcall
90 #elif defined(__GNUC__)
91 typedef unsigned long _word_size_t;
92 #define THREAD_PROC
93 #elif defined(__ICCARM__)
94 typedef _u32 _word_size_t;
95 #define THREAD_PROC
96 #endif
97 
99 
100 #define RESULT_OK 0
101 #define RESULT_FAIL_BIT 0x80000000
102 #define RESULT_ALREADY_DONE 0x20
103 #define RESULT_INVALID_DATA (0x8000 | RESULT_FAIL_BIT)
104 #define RESULT_OPERATION_FAIL (0x8001 | RESULT_FAIL_BIT)
105 #define RESULT_OPERATION_TIMEOUT (0x8002 | RESULT_FAIL_BIT)
106 #define RESULT_OPERATION_STOP (0x8003 | RESULT_FAIL_BIT)
107 #define RESULT_OPERATION_NOT_SUPPORT (0x8004 | RESULT_FAIL_BIT)
108 #define RESULT_FORMAT_NOT_SUPPORT (0x8005 | RESULT_FAIL_BIT)
109 #define RESULT_INSUFFICIENT_MEMORY (0x8006 | RESULT_FAIL_BIT)
110 
111 #define IS_OK(x) (((x)&RESULT_FAIL_BIT) == 0)
112 #define IS_FAIL(x) (((x)&RESULT_FAIL_BIT))
113 
114 typedef _word_size_t(THREAD_PROC* thread_proc_t)(void*);
unsigned __int16 uint16_t
Definition: rptypes.h:47
signed char int8_t
Definition: rptypes.h:43
unsigned char uint8_t
Definition: rptypes.h:44
uint8_t _u8
Definition: rptypes.h:63
__int16 int16_t
Definition: rptypes.h:46
__int64 int64_t
Definition: rptypes.h:52
_word_size_t(THREAD_PROC * thread_proc_t)(void *)
Definition: rptypes.h:114
int32_t _s32
Definition: rptypes.h:68
int64_t _s64
Definition: rptypes.h:71
__int32 int32_t
Definition: rptypes.h:49
unsigned __int64 uint64_t
Definition: rptypes.h:53
uint32_t _u32
Definition: rptypes.h:69
int16_t _s16
Definition: rptypes.h:65
uint64_t _u64
Definition: rptypes.h:72
uint16_t _u16
Definition: rptypes.h:66
unsigned __int32 uint32_t
Definition: rptypes.h:50
int8_t _s8
Definition: rptypes.h:62
uint32_t u_result
Definition: rptypes.h:98



Page generated by Doxygen 1.8.14 for MRPT 1.9.9 Git: 8fe78517f Sun Jul 14 19:43:28 2019 +0200 at lun oct 28 02:10:00 CET 2019