1use core::ffi::{c_char, c_void};
2use core::mem::{MaybeUninit, offset_of, size_of};
3
4pub type ScsU8 = u8;
5pub type ScsU16 = u16;
6pub type ScsU32 = u32;
7pub type ScsU64 = u64;
8pub type ScsS32 = i32;
9pub type ScsS64 = i64;
10pub type ScsFloat = f32;
11pub type ScsDouble = f64;
12pub type ScsString = *const c_char;
13pub type ScsContext = *mut c_void;
14pub type ScsTimestamp = ScsU64;
15pub type ScsResult = ScsS32;
16pub type ScsLogType = ScsS32;
17pub type ScsValueType = ScsU32;
18pub type ScsEvent = ScsU32;
19pub type ScsPadding = MaybeUninit<ScsU32>;
20
21#[repr(C)]
22#[derive(Clone, Copy, Debug, Default, PartialEq, Eq)]
23pub struct ScsValueBool {
24 pub value: ScsU8,
25}
26
27#[repr(C)]
28#[derive(Clone, Copy, Debug, Default, PartialEq, Eq)]
29pub struct ScsValueS32 {
30 pub value: ScsS32,
31}
32
33#[repr(C)]
34#[derive(Clone, Copy, Debug, Default, PartialEq, Eq)]
35pub struct ScsValueU32 {
36 pub value: ScsU32,
37}
38
39#[repr(C)]
40#[derive(Clone, Copy, Debug, Default, PartialEq, Eq)]
41pub struct ScsValueU64 {
42 pub value: ScsU64,
43}
44
45#[repr(C)]
46#[derive(Clone, Copy, Debug, Default, PartialEq, Eq)]
47pub struct ScsValueS64 {
48 pub value: ScsS64,
49}
50
51#[repr(C)]
52#[derive(Clone, Copy, Debug, Default, PartialEq)]
53pub struct ScsValueFloat {
54 pub value: ScsFloat,
55}
56
57#[repr(C)]
58#[derive(Clone, Copy, Debug, Default, PartialEq)]
59pub struct ScsValueDouble {
60 pub value: ScsDouble,
61}
62
63#[repr(C)]
64#[derive(Clone, Copy, Debug, PartialEq, Eq)]
65pub struct ScsValueString {
66 pub value: ScsString,
67}
68
69#[repr(C)]
70#[derive(Clone, Copy, Debug, Default, PartialEq)]
71pub struct ScsFVector {
72 pub x: ScsFloat,
73 pub y: ScsFloat,
74 pub z: ScsFloat,
75}
76
77#[repr(C)]
78#[derive(Clone, Copy, Debug, Default, PartialEq)]
79pub struct ScsDVector {
80 pub x: ScsDouble,
81 pub y: ScsDouble,
82 pub z: ScsDouble,
83}
84
85#[repr(C)]
86#[derive(Clone, Copy, Debug, Default, PartialEq)]
87pub struct ScsEuler {
88 pub heading: ScsFloat,
89 pub pitch: ScsFloat,
90 pub roll: ScsFloat,
91}
92
93#[repr(C)]
94#[derive(Clone, Copy, Debug, Default, PartialEq)]
95pub struct ScsFPlacement {
96 pub position: ScsFVector,
97 pub orientation: ScsEuler,
98}
99
100#[repr(C)]
101#[derive(Clone, Copy)]
102pub struct ScsDPlacement {
103 pub position: ScsDVector,
104 pub orientation: ScsEuler,
105 pub padding: ScsPadding,
106}
107
108#[repr(C)]
109#[derive(Clone, Copy)]
110pub union ScsValueData {
111 pub value_bool: ScsValueBool,
112 pub value_s32: ScsValueS32,
113 pub value_u32: ScsValueU32,
114 pub value_u64: ScsValueU64,
115 pub value_s64: ScsValueS64,
116 pub value_float: ScsValueFloat,
117 pub value_double: ScsValueDouble,
118 pub value_fvector: ScsFVector,
119 pub value_dvector: ScsDVector,
120 pub value_euler: ScsEuler,
121 pub value_fplacement: ScsFPlacement,
122 pub value_dplacement: ScsDPlacement,
123 pub value_string: ScsValueString,
124}
125
126#[repr(C)]
127#[derive(Clone, Copy)]
128pub struct ScsValue {
129 pub type_: ScsValueType,
130 pub padding: ScsPadding,
131 pub value: ScsValueData,
132}
133
134#[repr(C)]
135pub struct ScsNamedValue {
136 pub name: ScsString,
137 pub index: ScsU32,
138 pub padding: ScsPadding,
139 pub value: ScsValue,
140}
141
142const _: [(); 1] = [(); size_of::<ScsValueBool>()];
143const _: [(); 4] = [(); size_of::<ScsValueS32>()];
144const _: [(); 4] = [(); size_of::<ScsValueU32>()];
145const _: [(); 8] = [(); size_of::<ScsValueU64>()];
146const _: [(); 8] = [(); size_of::<ScsValueS64>()];
147const _: [(); 4] = [(); size_of::<ScsValueFloat>()];
148const _: [(); 8] = [(); size_of::<ScsValueDouble>()];
149const _: [(); 8] = [(); size_of::<ScsValueString>()];
150const _: [(); 12] = [(); size_of::<ScsFVector>()];
151const _: [(); 24] = [(); size_of::<ScsDVector>()];
152const _: [(); 12] = [(); size_of::<ScsEuler>()];
153const _: [(); 24] = [(); size_of::<ScsFPlacement>()];
154const _: [(); 40] = [(); size_of::<ScsDPlacement>()];
155const _: [(); 40] = [(); size_of::<ScsValueData>()];
156const _: [(); 48] = [(); size_of::<ScsValue>()];
157const _: [(); 64] = [(); size_of::<ScsNamedValue>()];
158
159const _: [(); 24] = [(); offset_of!(ScsDPlacement, orientation)];
160const _: [(); 36] = [(); offset_of!(ScsDPlacement, padding)];
161const _: [(); 8] = [(); offset_of!(ScsValue, value)];
162const _: [(); 16] = [(); offset_of!(ScsNamedValue, value)];