Skip to content

Commit fbff3da

Browse files
πŸ› Add primitive type to struct when installing (#50)
* Add primitive type to struct when installing * Make type a pointer --------- Co-authored-by: tolauwae <[email protected]>
1 parent 0c7f92a commit fbff3da

File tree

5 files changed

+5
-1
lines changed

5 files changed

+5
-1
lines changed

β€Žsrc/Primitives/arduino.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,7 @@ int prim_index = 0;
149149
if (prim_index < ALL_PRIMITIVES) { \
150150
PrimitiveEntry *p = &primitives[prim_index++]; \
151151
p->name = #prim_name; \
152+
p->t = &(prim_name##_type); \
152153
p->f = &(prim_name); \
153154
p->f_reverse = nullptr; \
154155
p->f_serialize_state = nullptr; \

β€Žsrc/Primitives/emulated.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ double sensor_emu = 0;
4646
if (prim_index < ALL_PRIMITIVES) { \
4747
PrimitiveEntry *p = &primitives[prim_index++]; \
4848
p->name = #prim_name; \
49+
p->t = &(prim_name##_type); \
4950
p->f = &(prim_name); \
5051
p->f_reverse = nullptr; \
5152
p->f_serialize_state = nullptr; \

β€Žsrc/Primitives/idf.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ double sensor_emu = 0;
4747
if (prim_index < ALL_PRIMITIVES) { \
4848
PrimitiveEntry *p = &primitives[prim_index++]; \
4949
p->name = #prim_name; \
50+
p->t = &(prim_name##_type); \
5051
p->f = &(prim_name); \
5152
p->f_reverse = nullptr; \
5253
p->f_serialize_state = nullptr; \

β€Žsrc/Primitives/zephyr.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ double sensor_emu = 0;
4949
if (prim_index < ALL_PRIMITIVES) { \
5050
PrimitiveEntry *p = &primitives[prim_index++]; \
5151
p->name = #prim_name; \
52+
p->t = &(prim_name##_type); \
5253
p->f = &(prim_name); \
5354
p->f_reverse = nullptr; \
5455
p->f_serialize_state = nullptr; \

β€Žsrc/WARDuino.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ typedef struct PrimitiveEntry {
7474
Primitive f;
7575
void (*f_reverse)(Module *m, std::vector<IOStateElement>);
7676
void (*f_serialize_state)(std::vector<IOStateElement *> &);
77-
Type t;
77+
Type *t;
7878
} PrimitiveEntry;
7979

8080
class WARDuino {

0 commit comments

Comments
Β (0)