Add local argument to serial interface to enable serial interface to create local parameters if needed (for example for serial binary)

This commit is contained in:
Patrick Pelissier committed 2019-05-18 11:17:14 +02:00
1 parent b6d5b5462b
commit 05a68157bc
10 files changed
+147 -106

No files matched your search

+7 -5
View File
@@ -513,20 +513,21 @@
static const char *const field_name[] = \
{ M_REDUCE(VARIANTI_STRINGIFY_NAME, M_ID, __VA_ARGS__) }; \
assert (f != NULL && f->interface != NULL && el != NULL); \
m_serial_local_t local; \
m_serial_return_code_t ret; \
switch (el->type) { \
case M_C(name, _EMPTY): \
return f->interface->write_variant_start(f, field_name, field_max, -1); \
return f->interface->write_variant_start(local, f, field_name, field_max, -1); \
break; \
M_MAP2(VARIANTI_DEFINE_OUT_SERIAL_FUNC , name, __VA_ARGS__) \
default: assert(false); break; \
} \
ret |= f->interface->write_variant_end(f); \
ret |= f->interface->write_variant_end(local, f); \
return ret & M_SERIAL_FAIL; \
}
#define VARIANTI_DEFINE_OUT_SERIAL_FUNC(name, a) \
case M_C4(name, _, VARIANTI_GET_FIELD a, _value): \
ret = f->interface->write_variant_start(f, field_name, field_max, \
ret = f->interface->write_variant_start(local, f, field_name, field_max, \
M_C4(name, _, VARIANTI_GET_FIELD a, _value) -1); \
VARIANTI_CALL_OUT_SERIAL(a, f, el -> value . VARIANTI_GET_FIELD a); \
break;
@@ -540,10 +541,11 @@
static const char *const field_name[] = \
{ M_REDUCE(VARIANTI_STRINGIFY_NAME, M_ID, __VA_ARGS__) }; \
assert (f != NULL && f->interface != NULL && el != NULL); \
m_serial_local_t local; \
m_serial_return_code_t ret; \
int id = -1; \
M_C(name, _clean)(el); \
ret = f->interface->read_variant_start(f, field_name, field_max, &id); \
ret = f->interface->read_variant_start(local, f, field_name, field_max, &id); \
if (ret != M_SERIAL_OK_CONTINUE) return ret; \
assert (id >= 0 && id < field_max); \
el->type = id+1; \
@@ -552,7 +554,7 @@
default: assert(false); break; \
} \
if (ret == M_SERIAL_OK_DONE) \
ret = f->interface->read_variant_end(f); \
ret = f->interface->read_variant_end(local, f); \
return ret; \
}
#define VARIANTI_DEFINE_IN_SERIAL_FUNC(name, a) \