Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions src/Primitives/arduino.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -134,10 +134,13 @@ int resolve_isr(int pin) {

int global_index = 0;

#define def_glob(name, type, mut, init_value) \
StackValue name##_sv{.value_type = type, init_value}; \
Global name = { \
.mutability = mut, .import_field = #name, .value = &name##_sv};
#define def_glob(name, type, mut, init_val) \
StackValue name##_sv = {.value_type = type, .value = {init_val}}; \
Global name = {.export_name = nullptr, \
.import_module = nullptr, \
.import_field = #name, \
.mutability = mut, \
.value = &name##_sv};

#define install_global(global_name) \
{ \
Expand Down
11 changes: 7 additions & 4 deletions src/Primitives/emulated.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,13 @@ int global_index = 0;

double sensor_emu = 0;

#define def_glob(name, type, mut, init_value) \
StackValue name##_sv{.value_type = type, init_value}; \
Global name = { \
.mutability = mut, .import_field = #name, .value = &name##_sv};
#define def_glob(name, type, mut, init_val) \
StackValue name##_sv = {.value_type = type, .value = {init_val}}; \
Global name = {.export_name = nullptr, \
.import_module = nullptr, \
.import_field = #name, \
.mutability = mut, \
.value = &name##_sv};

#define install_global(global_name) \
{ \
Expand Down
11 changes: 7 additions & 4 deletions src/Primitives/idf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,13 @@

int global_index = 0;

#define def_glob(name, type, mut, init_value) \
StackValue name##_sv{.value_type = type, init_value}; \
Global name = { \
.mutability = mut, .import_field = #name, .value = &name##_sv};
#define def_glob(name, type, mut, init_val) \
StackValue name##_sv = {.value_type = type, .value = {init_val}}; \
Global name = {.export_name = nullptr, \
.import_module = nullptr, \
.import_field = #name, \
.mutability = mut, \
.value = &name##_sv};

#define install_global(global_name) \
{ \
Expand Down
11 changes: 7 additions & 4 deletions src/Primitives/zephyr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,13 @@

int global_index = 0;

#define def_glob(name, type, mut, init_value) \
StackValue name##_sv{.value_type = type, init_value}; \
Global name = { \
.mutability = mut, .import_field = #name, .value = &name##_sv};
#define def_glob(name, type, mut, init_val) \
StackValue name##_sv = {.value_type = type, .value = {init_val}}; \
Global name = {.export_name = nullptr, \
.import_module = nullptr, \
.import_field = #name, \
.mutability = mut, \
.value = &name##_sv};

#define install_global(global_name) \
{ \
Expand Down
10 changes: 5 additions & 5 deletions src/WARDuino/internals.h
Original file line number Diff line number Diff line change
Expand Up @@ -112,11 +112,11 @@ typedef struct Memory {
} Memory;

typedef struct Global {
char *export_name; // export name of the global
char *import_module; // import module name
char *import_field; // import field name
bool mutability; // 0: immutable, 1: mutable
StackValue *value; // current value
char *export_name; // export name of the global
char *import_module; // import module name
const char *import_field; // import field name
bool mutability; // 0: immutable, 1: mutable
StackValue *value; // current value
} Global;

typedef struct Options {
Expand Down
Loading