From 90f248fbe8837befbc794c70968368a644993324 Mon Sep 17 00:00:00 2001 From: Patrick Pelissier Date: Fri, 6 Dec 2019 21:13:37 +0100 Subject: [PATCH] Rename interface field of serial object into m_interface (WINDOWS compatibility as it defines a macro called interface) --- README.md | 8 ++++---- m-array.h | 14 +++++++------- m-bptree.h | 28 ++++++++++++++-------------- m-core.h | 42 +++++++++++++++++++++--------------------- m-deque.h | 14 +++++++------- m-dict.h | 30 +++++++++++++++--------------- m-list.h | 14 +++++++------- m-rbtree.h | 14 +++++++------- m-serial-bin.h | 4 ++-- m-serial-json.h | 4 ++-- m-string.h | 8 ++++---- m-tuple.h | 12 ++++++------ m-variant.h | 14 +++++++------- 13 files changed, 103 insertions(+), 103 deletions(-) diff --git a/README.md b/README.md index 220ff484..2535a295 100644 --- a/README.md +++ b/README.md @@ -5314,7 +5314,7 @@ shall be able to be parsed by the input serialization object. The serialization input object is named as m\_serial\_read\_t, defined in m-core.h as a structure (of array of size 1) with the following fields: -* interface: a pointer to the constant m\_serial\_read\_interface\_s structure that defines all +* m\_interface: a pointer to the constant m\_serial\_read\_interface\_s structure that defines all methods that operate on this object to parse it. The instance has to be customized for the needs of the wanted serialization. * data: a table of M\_SERIAL\_MAX\_DATA\_SIZE of C types (boolean, integer, size or pointer). @@ -5398,7 +5398,7 @@ the following fields with the following definition: The serialization output object is named as m\_serial\_write\_t, defined in m-core.h as a structure (of array of size 1) with the following fields: -* interface: a pointer to the constant m\_serial\_write\_interface\_s structure that defines all +* m\_interface: a pointer to the constant m\_serial\_write\_interface\_s structure that defines all methods that operate on this object to output it. The instance has to be customized for the needs of the wanted serialization. * data: a table of M\_SERIAL\_MAX\_DATA\_SIZE of C types (boolean, integer, size or pointer). @@ -5496,7 +5496,7 @@ The full C definition are: // Object to handle the generic serial read of an object. typedef struct m_serial_read_s { - const struct m_serial_read_interface_s *interface; + const struct m_serial_read_interface_s *m_interface; m_serial_ll_t data[M_SERIAL_MAX_DATA_SIZE]; } m_serial_read_t[1]; @@ -5520,7 +5520,7 @@ The full C definition are: // Object to handle the generic serial write of an object. typedef struct m_serial_write_s { - const struct m_serial_write_interface_s *interface; + const struct m_serial_write_interface_s *m_interface; m_serial_ll_t data[M_SERIAL_MAX_DATA_SIZE]; } m_serial_write_t[1]; diff --git a/m-array.h b/m-array.h index 95f36cb5..a6bf49e8 100644 --- a/m-array.h +++ b/m-array.h @@ -917,17 +917,17 @@ M_C(name, _out_serial)(m_serial_write_t f, const array_t array) \ { \ ARRAYI_CONTRACT(array); \ - assert (f != NULL && f->interface != NULL); \ + assert (f != NULL && f->m_interface != NULL); \ m_serial_return_code_t ret; \ m_serial_local_t local; \ - ret = f->interface->write_array_start(local, f, array->size); \ + ret = f->m_interface->write_array_start(local, f, array->size); \ for (size_t i = 0; i < array->size; i++) { \ type const *item = M_C(name, _cget)(array, i); \ if (i != 0) \ - ret |= f->interface->write_array_next(local, f); \ + ret |= f->m_interface->write_array_next(local, f); \ ret |= M_CALL_OUT_SERIAL(oplist, f, *item); \ } \ - ret |= f->interface->write_array_end(local, f); \ + ret |= f->m_interface->write_array_end(local, f); \ return ret & M_SERIAL_FAIL; \ } \ , /* no OUT_SERIAL */ ) \ @@ -937,12 +937,12 @@ M_C(name, _in_serial)(array_t array, m_serial_read_t f) \ { \ ARRAYI_CONTRACT(array); \ - assert (f != NULL && f->interface != NULL); \ + assert (f != NULL && f->m_interface != NULL); \ m_serial_return_code_t ret; \ m_serial_local_t local; \ size_t estimated_size = 0; \ M_C(name,_clean)(array); \ - ret = f->interface->read_array_start(local, f, &estimated_size); \ + ret = f->m_interface->read_array_start(local, f, &estimated_size); \ if (M_UNLIKELY (ret != M_SERIAL_OK_CONTINUE)) return ret; \ if (estimated_size != 0) M_C(name, _reserve)(array, estimated_size); \ type item; \ @@ -951,7 +951,7 @@ ret = M_CALL_IN_SERIAL(oplist, item, f); \ if (ret != M_SERIAL_OK_DONE) { break; } \ M_C(name, _push_back)(array, item); \ - } while ((ret = f->interface->read_array_next(local, f)) == M_SERIAL_OK_CONTINUE); \ + } while ((ret = f->m_interface->read_array_next(local, f)) == M_SERIAL_OK_CONTINUE); \ M_CALL_CLEAR(oplist, item); \ ARRAYI_CONTRACT(array); \ return ret; \ diff --git a/m-bptree.h b/m-bptree.h index 95ebb617..87eebacc 100644 --- a/m-bptree.h +++ b/m-bptree.h @@ -1218,7 +1218,7 @@ M_C(name, _out_serial)(m_serial_write_t f, tree_t const t1) \ { \ BPTREEI_CONTRACT(N, isMulti, key_oplist, t1); \ - assert (f != NULL && f->interface != NULL); \ + assert (f != NULL && f->m_interface != NULL); \ m_serial_return_code_t ret; \ m_serial_local_t local; \ const M_C(name, _type_t) *item; \ @@ -1227,31 +1227,31 @@ /* Format is different between associative container \ & set container */ \ M_IF(isMap)( \ - ret = f->interface->write_map_start(local, f, t1->size); \ + ret = f->m_interface->write_map_start(local, f, t1->size); \ for (M_C(name, _it)(it, t1) ; \ !M_C(name, _end_p)(it); \ M_C(name, _next)(it)){ \ item = M_C(name, _cref)(it); \ if (first_done) \ - ret |= f->interface->write_map_next(local, f); \ + ret |= f->m_interface->write_map_next(local, f); \ ret |= M_CALL_OUT_SERIAL(key_oplist, f, *item->key_ptr); \ - ret |= f->interface->write_map_value(local, f); \ + ret |= f->m_interface->write_map_value(local, f); \ ret |= M_CALL_OUT_SERIAL(value_oplist, f, *item->value_ptr); \ first_done = true; \ } \ - ret |= f->interface->write_map_end(local, f); \ + ret |= f->m_interface->write_map_end(local, f); \ , \ - ret = f->interface->write_array_start(local, f, t1->size); \ + ret = f->m_interface->write_array_start(local, f, t1->size); \ for (M_C(name, _it)(it, t1) ; \ !M_C(name, _end_p)(it); \ M_C(name, _next)(it)){ \ item = M_C(name, _cref)(it); \ if (first_done) \ - ret |= f->interface->write_array_next(local, f); \ + ret |= f->m_interface->write_array_next(local, f); \ ret |= M_CALL_OUT_SERIAL(key_oplist, f, *item); \ first_done = true; \ } \ - ret |= f->interface->write_array_end(local, f); \ + ret |= f->m_interface->write_array_end(local, f); \ ) \ return ret & M_SERIAL_FAIL; \ } \ @@ -1262,7 +1262,7 @@ M_C(name, _in_serial)(tree_t t1, m_serial_read_t f) \ { \ BPTREEI_CONTRACT(N, isMulti, key_oplist, t1); \ - assert (f != NULL && f->interface != NULL); \ + assert (f != NULL && f->m_interface != NULL); \ m_serial_local_t local; \ m_serial_return_code_t ret; \ size_t estimated_size = 0; \ @@ -1270,30 +1270,30 @@ M_C(name,_clean)(t1); \ M_IF(isMap)( \ value_t value; \ - ret = f->interface->read_map_start(local, f, &estimated_size); \ + ret = f->m_interface->read_map_start(local, f, &estimated_size); \ if (M_UNLIKELY (ret != M_SERIAL_OK_CONTINUE)) return ret; \ M_CALL_INIT(key_oplist, key); \ M_CALL_INIT (value_oplist, value); \ do { \ ret = M_CALL_IN_SERIAL(key_oplist, key, f); \ if (ret != M_SERIAL_OK_DONE) return M_SERIAL_FAIL; \ - ret = f->interface->read_map_value(local, f); \ + ret = f->m_interface->read_map_value(local, f); \ if (ret != M_SERIAL_OK_CONTINUE) return M_SERIAL_FAIL; \ ret = M_CALL_IN_SERIAL(value_oplist, value, f); \ if (ret != M_SERIAL_OK_DONE) return M_SERIAL_FAIL; \ M_C(name, _set_at)(t1, key, value); \ - } while ((ret = f->interface->read_map_next(local, f)) == M_SERIAL_OK_CONTINUE); \ + } while ((ret = f->m_interface->read_map_next(local, f)) == M_SERIAL_OK_CONTINUE); \ M_CALL_CLEAR(key_oplist, key); \ M_CALL_CLEAR(value_oplist, value); \ , \ - ret = f->interface->read_array_start(local, f, &estimated_size); \ + ret = f->m_interface->read_array_start(local, f, &estimated_size); \ if (M_UNLIKELY (ret != M_SERIAL_OK_CONTINUE)) return ret; \ M_CALL_INIT(key_oplist, key); \ do { \ ret = M_CALL_IN_SERIAL(key_oplist, key, f); \ if (ret != M_SERIAL_OK_DONE) { break; } \ M_C(name, _push)(t1, key); \ - } while ((ret = f->interface->read_array_next(local, f)) == M_SERIAL_OK_CONTINUE); \ + } while ((ret = f->m_interface->read_array_next(local, f)) == M_SERIAL_OK_CONTINUE); \ M_CALL_CLEAR(key_oplist, key); \ ) /* End of IF isMap */ \ return ret; \ diff --git a/m-core.h b/m-core.h index fdb63cd0..3d7d31a1 100644 --- a/m-core.h +++ b/m-core.h @@ -2670,7 +2670,7 @@ typedef struct m_serial_local_s { /* Object to handle the generic serial read of an object. */ typedef struct m_serial_read_s { - const struct m_serial_read_interface_s *interface; + const struct m_serial_read_interface_s *m_interface; m_serial_ll_t data[M_SERIAL_MAX_DATA_SIZE]; } m_serial_read_t[1]; @@ -2697,7 +2697,7 @@ typedef struct m_serial_read_interface_s { /* Object to handle the generic serial write of an object. */ typedef struct m_serial_write_s { - const struct m_serial_write_interface_s *interface; + const struct m_serial_write_interface_s *m_interface; m_serial_ll_t data[M_SERIAL_MAX_DATA_SIZE]; } m_serial_write_t[1]; @@ -2726,23 +2726,23 @@ typedef struct m_serial_write_interface_s { */ #define M_OUT_SERIAL_DEFAULT_ARG(serial, x) \ _Generic(((void)0,(x)), \ - bool: (serial)->interface->write_boolean(serial, M_AS_TYPE(bool, (x))), \ - char: (serial)->interface->write_integer(serial, M_AS_TYPE(char,(x)), sizeof (x)), \ - signed char: (serial)->interface->write_integer(serial, M_AS_TYPE(signed char,(x)), sizeof (x)), \ - unsigned char: (serial)->interface->write_integer(serial, M_AS_TYPE(unsigned char,(x)), sizeof (x)), \ - signed short: (serial)->interface->write_integer(serial, M_AS_TYPE(signed short,(x)), sizeof (x)), \ - unsigned short: (serial)->interface->write_integer(serial, M_AS_TYPE(unsigned short,(x)), sizeof (x)), \ - signed int: (serial)->interface->write_integer(serial, M_AS_TYPE(signed int,(x)), sizeof (x)), \ - unsigned int: (serial)->interface->write_integer(serial, M_AS_TYPE(unsigned int,(x)), sizeof (x)), \ - long int: (serial)->interface->write_integer(serial, M_AS_TYPE(long,(x)), sizeof (x)), \ - unsigned long int: (serial)->interface->write_integer(serial, M_AS_TYPE(unsigned long,(x)), sizeof (x)), \ - long long int: (serial)->interface->write_integer(serial, M_AS_TYPE(long long,(x)), sizeof (x)), \ - unsigned long long int: (serial)->interface->write_integer(serial, M_AS_TYPE(unsigned long long,(x)), sizeof (x)), \ - float: (serial)->interface->write_float(serial, M_AS_TYPE(float,(x)), sizeof (x)), \ - double: (serial)->interface->write_float(serial, M_AS_TYPE(double,(x)), sizeof (x)), \ - long double: (serial)->interface->write_float(serial, M_AS_TYPE(long double,(x)), sizeof (x)), \ - const char *: (serial)->interface->write_string(serial, M_AS_TYPE(const char *,(x))), \ - char *: (serial)->interface->write_string(serial, M_AS_TYPE(char *,(x))), \ + bool: (serial)->m_interface->write_boolean(serial, M_AS_TYPE(bool, (x))), \ + char: (serial)->m_interface->write_integer(serial, M_AS_TYPE(char,(x)), sizeof (x)), \ + signed char: (serial)->m_interface->write_integer(serial, M_AS_TYPE(signed char,(x)), sizeof (x)), \ + unsigned char: (serial)->m_interface->write_integer(serial, M_AS_TYPE(unsigned char,(x)), sizeof (x)), \ + signed short: (serial)->m_interface->write_integer(serial, M_AS_TYPE(signed short,(x)), sizeof (x)), \ + unsigned short: (serial)->m_interface->write_integer(serial, M_AS_TYPE(unsigned short,(x)), sizeof (x)), \ + signed int: (serial)->m_interface->write_integer(serial, M_AS_TYPE(signed int,(x)), sizeof (x)), \ + unsigned int: (serial)->m_interface->write_integer(serial, M_AS_TYPE(unsigned int,(x)), sizeof (x)), \ + long int: (serial)->m_interface->write_integer(serial, M_AS_TYPE(long,(x)), sizeof (x)), \ + unsigned long int: (serial)->m_interface->write_integer(serial, M_AS_TYPE(unsigned long,(x)), sizeof (x)), \ + long long int: (serial)->m_interface->write_integer(serial, M_AS_TYPE(long long,(x)), sizeof (x)), \ + unsigned long long int: (serial)->m_interface->write_integer(serial, M_AS_TYPE(unsigned long long,(x)), sizeof (x)), \ + float: (serial)->m_interface->write_float(serial, M_AS_TYPE(float,(x)), sizeof (x)), \ + double: (serial)->m_interface->write_float(serial, M_AS_TYPE(double,(x)), sizeof (x)), \ + long double: (serial)->m_interface->write_float(serial, M_AS_TYPE(long double,(x)), sizeof (x)), \ + const char *: (serial)->m_interface->write_string(serial, M_AS_TYPE(const char *,(x))), \ + char *: (serial)->m_interface->write_string(serial, M_AS_TYPE(char *,(x))), \ const void *: M_SERIAL_FAIL /* unsupported */, \ void *: M_SERIAL_FAIL /* unsupported */) @@ -2751,7 +2751,7 @@ typedef struct m_serial_write_interface_s { */ #define M_IN_SERIAL_DEFAULT_ARG(xptr, serial) \ _Generic(((void)0,*(xptr)), \ - bool: (serial)->interface->read_boolean(serial, M_AS_TYPE(bool *, xptr)), \ + bool: (serial)->m_interface->read_boolean(serial, M_AS_TYPE(bool *, xptr)), \ char: m_core_in_serial_char(serial, M_AS_TYPE(char*,xptr)), \ signed char: m_core_in_serial_schar(serial, M_AS_TYPE(signed char*,xptr)), \ unsigned char: m_core_in_serial_uchar(serial, M_AS_TYPE(unsigned char*,xptr)), \ @@ -2779,7 +2779,7 @@ typedef struct m_serial_write_interface_s { { \ promoted_type i; \ m_serial_return_code_t r; \ - r = serial->interface->func(serial, &i, sizeof (type)); \ + r = serial->m_interface->func(serial, &i, sizeof (type)); \ *ptr = i; \ return r; \ } diff --git a/m-deque.h b/m-deque.h index 4f4f8b05..c62f8b30 100644 --- a/m-deque.h +++ b/m-deque.h @@ -894,22 +894,22 @@ M_C(name, _out_serial)(m_serial_write_t f, const deque_t deque) \ { \ DEQUEI_CONTRACT(deque); \ - assert (f != NULL && f->interface != NULL); \ + assert (f != NULL && f->m_interface != NULL); \ m_serial_local_t local; \ m_serial_return_code_t ret; \ bool first_done = false; \ - ret = f->interface->write_array_start(local, f, deque->count); \ + ret = f->m_interface->write_array_start(local, f, deque->count); \ M_C(name, _it_t) it; \ for (M_C(name, _it)(it, deque) ; \ !M_C(name, _end_p)(it); \ M_C(name, _next)(it)){ \ type const *item = M_C(name, _cref)(it); \ if (first_done) \ - ret |= f->interface->write_array_next(local, f); \ + ret |= f->m_interface->write_array_next(local, f); \ ret |= M_CALL_OUT_SERIAL(oplist, f, *item); \ first_done = true; \ } \ - ret |= f->interface->write_array_end(local, f); \ + ret |= f->m_interface->write_array_end(local, f); \ return ret & M_SERIAL_FAIL; \ } \ , /* no OUT_SERIAL */ ) \ @@ -919,12 +919,12 @@ M_C(name, _in_serial)(deque_t deque, m_serial_read_t f) \ { \ DEQUEI_CONTRACT(deque); \ - assert (f != NULL && f->interface != NULL); \ + assert (f != NULL && f->m_interface != NULL); \ m_serial_local_t local; \ m_serial_return_code_t ret; \ size_t estimated_size = 0; \ M_C(name,_clean)(deque); \ - ret = f->interface->read_array_start(local, f, &estimated_size); \ + ret = f->m_interface->read_array_start(local, f, &estimated_size); \ if (M_UNLIKELY (ret != M_SERIAL_OK_CONTINUE)) return ret; \ type item; \ M_CALL_INIT(oplist, item); \ @@ -932,7 +932,7 @@ ret = M_CALL_IN_SERIAL(oplist, item, f); \ if (ret != M_SERIAL_OK_DONE) { break; } \ M_C(name, _push_back)(deque, item); \ - } while ((ret = f->interface->read_array_next(local, f)) == M_SERIAL_OK_CONTINUE); \ + } while ((ret = f->m_interface->read_array_next(local, f)) == M_SERIAL_OK_CONTINUE); \ M_CALL_CLEAR(oplist, item); \ return ret; \ } \ diff --git a/m-dict.h b/m-dict.h index b971e5a9..b1997db7 100644 --- a/m-dict.h +++ b/m-dict.h @@ -713,7 +713,7 @@ M_CALL_INIT(key_oplist, key); \ M_CALL_INIT(value_oplist, value); \ do { \ - while (isspace(*str)) str++; \ + while (isspace((int) *str)) str++; \ bool b = M_CALL_PARSE_STR(key_oplist, key, str, &str); \ M_IF(isSet)( \ if (b == false) { break; } \ @@ -783,7 +783,7 @@ static inline m_serial_return_code_t \ M_C(name, _out_serial)(m_serial_write_t f, dict_t const t1) \ { \ - assert (f != NULL && f->interface != NULL); \ + assert (f != NULL && f->m_interface != NULL); \ m_serial_local_t local; \ m_serial_return_code_t ret; \ const M_C(name, _type_t) *item; \ @@ -792,31 +792,31 @@ /* Format is different between associative container \ & set container */ \ M_IF(isSet)( \ - ret = f->interface->write_array_start(local, f, M_C(name, _size)(t1)); \ + ret = f->m_interface->write_array_start(local, f, M_C(name, _size)(t1)); \ for (M_C(name, _it)(it, t1) ; \ !M_C(name, _end_p)(it); \ M_C(name, _next)(it)){ \ item = M_C(name, _cref)(it); \ if (first_done) \ - ret |= f->interface->write_array_next(local, f); \ + ret |= f->m_interface->write_array_next(local, f); \ ret |= M_CALL_OUT_SERIAL(key_oplist, f, *item); \ first_done = true; \ } \ - ret |= f->interface->write_array_end(local, f); \ + ret |= f->m_interface->write_array_end(local, f); \ , \ - ret = f->interface->write_map_start(local, f, M_C(name, _size)(t1)); \ + ret = f->m_interface->write_map_start(local, f, M_C(name, _size)(t1)); \ for (M_C(name, _it)(it, t1) ; \ !M_C(name, _end_p)(it); \ M_C(name, _next)(it)){ \ item = M_C(name, _cref)(it); \ if (first_done) \ - ret |= f->interface->write_map_next(local, f); \ + ret |= f->m_interface->write_map_next(local, f); \ ret |= M_CALL_OUT_SERIAL(key_oplist, f, item->key); \ - ret |= f->interface->write_map_value(local, f); \ + ret |= f->m_interface->write_map_value(local, f); \ ret |= M_CALL_OUT_SERIAL(value_oplist, f, item->value); \ first_done = true; \ } \ - ret |= f->interface->write_map_end(local, f); \ + ret |= f->m_interface->write_map_end(local, f); \ ) \ return ret & M_SERIAL_FAIL; \ } \ @@ -826,37 +826,37 @@ static inline m_serial_return_code_t \ M_C(name, _in_serial)(dict_t t1, m_serial_read_t f) \ { \ - assert (f != NULL && f->interface != NULL); \ + assert (f != NULL && f->m_interface != NULL); \ m_serial_local_t local; \ m_serial_return_code_t ret; \ size_t estimated_size = 0; \ key_type key; \ M_C(name,_clean)(t1); \ M_IF(isSet)( \ - ret = f->interface->read_array_start(local, f, &estimated_size); \ + ret = f->m_interface->read_array_start(local, f, &estimated_size); \ if (M_UNLIKELY (ret != M_SERIAL_OK_CONTINUE)) return ret; \ M_CALL_INIT(key_oplist, key); \ do { \ ret = M_CALL_IN_SERIAL(key_oplist, key, f); \ if (ret != M_SERIAL_OK_DONE) { break; } \ M_C(name, _push)(t1, key); \ - } while ((ret = f->interface->read_array_next(local, f)) == M_SERIAL_OK_CONTINUE); \ + } while ((ret = f->m_interface->read_array_next(local, f)) == M_SERIAL_OK_CONTINUE); \ M_CALL_CLEAR(key_oplist, key); \ , \ value_type value; \ - ret = f->interface->read_map_start(local, f, &estimated_size); \ + ret = f->m_interface->read_map_start(local, f, &estimated_size); \ if (M_UNLIKELY (ret != M_SERIAL_OK_CONTINUE)) return ret; \ M_CALL_INIT(key_oplist, key); \ M_CALL_INIT (value_oplist, value); \ do { \ ret = M_CALL_IN_SERIAL(key_oplist, key, f); \ if (ret != M_SERIAL_OK_DONE) return M_SERIAL_FAIL; \ - ret = f->interface->read_map_value(local, f); \ + ret = f->m_interface->read_map_value(local, f); \ if (ret != M_SERIAL_OK_CONTINUE) return M_SERIAL_FAIL; \ ret = M_CALL_IN_SERIAL(value_oplist, value, f); \ if (ret != M_SERIAL_OK_DONE) return M_SERIAL_FAIL; \ M_C(name, _set_at)(t1, key, value); \ - } while ((ret = f->interface->read_map_next(local, f)) == M_SERIAL_OK_CONTINUE); \ + } while ((ret = f->m_interface->read_map_next(local, f)) == M_SERIAL_OK_CONTINUE); \ M_CALL_CLEAR(key_oplist, key); \ M_CALL_CLEAR(value_oplist, value); \ ) /* End of IF isSet */ \ diff --git a/m-list.h b/m-list.h index 205d2606..ab0b55a5 100644 --- a/m-list.h +++ b/m-list.h @@ -720,22 +720,22 @@ M_C(name, _out_serial)(m_serial_write_t f, const list_t list) \ { \ assert (list != NULL); \ - assert (f != NULL && f->interface != NULL); \ + assert (f != NULL && f->m_interface != NULL); \ m_serial_return_code_t ret; \ m_serial_local_t local; \ bool first_done = false; \ - ret = f->interface->write_array_start(local, f, 0); \ + ret = f->m_interface->write_array_start(local, f, 0); \ M_C(name, _it_t) it; \ for (M_C(name, _it)(it, list) ; \ !M_C(name, _end_p)(it); \ M_C(name, _next)(it)){ \ type const *item = M_C(name, _cref)(it); \ if (first_done) \ - ret |= f->interface->write_array_next(local, f); \ + ret |= f->m_interface->write_array_next(local, f); \ ret |= M_CALL_OUT_SERIAL(oplist, f, *item); \ first_done = true; \ } \ - ret |= f->interface->write_array_end(local, f); \ + ret |= f->m_interface->write_array_end(local, f); \ return ret & M_SERIAL_FAIL; \ } \ , /* no OUT_SERIAL */ ) \ @@ -745,12 +745,12 @@ M_C(name, _in_serial)(list_t list, m_serial_read_t f) \ { \ assert (list != NULL); \ - assert (f != NULL && f->interface != NULL); \ + assert (f != NULL && f->m_interface != NULL); \ m_serial_return_code_t ret; \ m_serial_local_t local; \ size_t estimated_size = 0; \ M_C(name,_clean)(list); \ - ret = f->interface->read_array_start(local, f, &estimated_size); \ + ret = f->m_interface->read_array_start(local, f, &estimated_size); \ if (M_UNLIKELY (ret != M_SERIAL_OK_CONTINUE)) return ret; \ type item; \ M_CALL_INIT(oplist, item); \ @@ -758,7 +758,7 @@ ret = M_CALL_IN_SERIAL(oplist, item, f); \ if (ret != M_SERIAL_OK_DONE) { break; } \ M_C(name, _push_back)(list, item); \ - } while ((ret = f->interface->read_array_next(local, f)) == M_SERIAL_OK_CONTINUE); \ + } while ((ret = f->m_interface->read_array_next(local, f)) == M_SERIAL_OK_CONTINUE); \ M_CALL_CLEAR(oplist, item); \ M_C(name, _reverse)(list); \ return ret; \ diff --git a/m-rbtree.h b/m-rbtree.h index aacc20cb..ca07f5e2 100644 --- a/m-rbtree.h +++ b/m-rbtree.h @@ -1025,23 +1025,23 @@ typedef enum { M_C(name, _out_serial)(m_serial_write_t f, tree_t const t1) \ { \ RBTREEI_CONTRACT(t1); \ - assert (f != NULL && f->interface != NULL); \ + assert (f != NULL && f->m_interface != NULL); \ m_serial_local_t local; \ m_serial_return_code_t ret; \ const M_C(name, _type_t) *item; \ bool first_done = false; \ it_t it; \ - ret = f->interface->write_array_start(local, f, t1->size); \ + ret = f->m_interface->write_array_start(local, f, t1->size); \ for (M_C(name, _it)(it, t1) ; \ !M_C(name, _end_p)(it); \ M_C(name, _next)(it)){ \ item = M_C(name, _cref)(it); \ if (first_done) \ - ret |= f->interface->write_array_next(local, f); \ + ret |= f->m_interface->write_array_next(local, f); \ ret |= M_CALL_OUT_SERIAL(oplist, f, *item); \ first_done = true; \ } \ - ret |= f->interface->write_array_end(local, f); \ + ret |= f->m_interface->write_array_end(local, f); \ return ret & M_SERIAL_FAIL; \ } \ , /* no OUT_SERIAL */ ) \ @@ -1051,20 +1051,20 @@ typedef enum { M_C(name, _in_serial)(tree_t t1, m_serial_read_t f) \ { \ RBTREEI_CONTRACT(t1); \ - assert (f != NULL && f->interface != NULL); \ + assert (f != NULL && f->m_interface != NULL); \ m_serial_local_t local; \ m_serial_return_code_t ret; \ size_t estimated_size = 0; \ type key; \ M_C(name,_clean)(t1); \ - ret = f->interface->read_array_start(local, f, &estimated_size); \ + ret = f->m_interface->read_array_start(local, f, &estimated_size); \ if (M_UNLIKELY (ret != M_SERIAL_OK_CONTINUE)) return ret; \ M_CALL_INIT(oplist, key); \ do { \ ret = M_CALL_IN_SERIAL(oplist, key, f); \ if (ret != M_SERIAL_OK_DONE) { break; } \ M_C(name, _push)(t1, key); \ - } while ((ret = f->interface->read_array_next(local, f)) == M_SERIAL_OK_CONTINUE); \ + } while ((ret = f->m_interface->read_array_next(local, f)) == M_SERIAL_OK_CONTINUE); \ M_CALL_CLEAR(oplist, key); \ return ret; \ } \ diff --git a/m-serial-bin.h b/m-serial-bin.h index ac38664b..a94ce380 100644 --- a/m-serial-bin.h +++ b/m-serial-bin.h @@ -258,7 +258,7 @@ static const m_serial_write_interface_t m_serial_write_bin_interface = { static inline void m_serial_bin_write_init(m_serial_write_t serial, FILE *f) { - serial->interface = &m_serial_write_bin_interface; + serial->m_interface = &m_serial_write_bin_interface; serial->data[0].p = M_ASSIGN_CAST(void*, f); } @@ -494,7 +494,7 @@ static const m_serial_read_interface_t m_serial_bin_read_interface = { static inline void m_serial_bin_read_init(m_serial_read_t serial, FILE *f) { - serial->interface = &m_serial_bin_read_interface; + serial->m_interface = &m_serial_bin_read_interface; serial->data[0].p = M_ASSIGN_CAST(void*, f); } diff --git a/m-serial-json.h b/m-serial-json.h index 0d5cb081..8c52fdf9 100644 --- a/m-serial-json.h +++ b/m-serial-json.h @@ -254,7 +254,7 @@ static const m_serial_write_interface_t m_serial_write_json_interface = { static inline void m_serial_json_write_init(m_serial_write_t serial, FILE *f) { - serial->interface = &m_serial_write_json_interface; + serial->m_interface = &m_serial_write_json_interface; serial->data[0].p = M_ASSIGN_CAST(void*, f); } @@ -530,7 +530,7 @@ static const m_serial_read_interface_t m_serial_json_read_interface = { static inline void m_serial_json_read_init(m_serial_read_t serial, FILE *f) { - serial->interface = &m_serial_json_read_interface; + serial->m_interface = &m_serial_json_read_interface; serial->data[0].p = M_ASSIGN_CAST(void*, f); } diff --git a/m-string.h b/m-string.h index 7ef9f9d3..fbdac5de 100644 --- a/m-string.h +++ b/m-string.h @@ -1117,15 +1117,15 @@ string_parse_str(string_t v, const char str[], const char **endptr) static inline m_serial_return_code_t string_out_serial(m_serial_write_t serial, const string_t v) { - assert (serial != NULL && serial->interface != NULL); - return serial->interface->write_string(serial, string_get_cstr(v)); + assert (serial != NULL && serial->m_interface != NULL); + return serial->m_interface->write_string(serial, string_get_cstr(v)); } static inline m_serial_return_code_t string_in_serial(string_t v, m_serial_read_t serial) { - assert (serial != NULL && serial->interface != NULL); - return serial->interface->read_string(serial, v); + assert (serial != NULL && serial->m_interface != NULL); + return serial->m_interface->read_string(serial, v); } /* UTF8 Handling */ diff --git a/m-tuple.h b/m-tuple.h index f2355fc0..9874395c 100644 --- a/m-tuple.h +++ b/m-tuple.h @@ -416,21 +416,21 @@ namespace m_tuple { static inline m_serial_return_code_t \ M_C(name, _out_serial)(m_serial_write_t f, \ M_C(name,_t) const el) { \ - assert (f != NULL && f->interface != NULL && el != NULL); \ + assert (f != NULL && f->m_interface != NULL && el != NULL); \ const int field_max = M_NARGS(__VA_ARGS__); \ static const char *const field_name[] = \ { M_REDUCE(TUPLE_STRINGIFY_NAME, M_ID, __VA_ARGS__) }; \ int index = 0; \ m_serial_local_t local; \ m_serial_return_code_t ret; \ - ret = f->interface->write_tuple_start(local, f); \ + ret = f->m_interface->write_tuple_start(local, f); \ M_MAP(TUPLE_DEFINE_OUT_SERIAL_FUNC , __VA_ARGS__) \ assert( index == field_max); \ - ret |= f->interface->write_tuple_end(local, f); \ + ret |= f->m_interface->write_tuple_end(local, f); \ return ret & M_SERIAL_FAIL; \ } #define TUPLE_DEFINE_OUT_SERIAL_FUNC(a) \ - f->interface->write_tuple_id(local, f, field_name, field_max, index); \ + f->m_interface->write_tuple_id(local, f, field_name, field_max, index); \ TUPLE_CALL_OUT_SERIAL(a, f, el -> TUPLE_GET_FIELD a); \ index++; \ @@ -444,9 +444,9 @@ namespace m_tuple { { M_REDUCE(TUPLE_STRINGIFY_NAME, M_ID, __VA_ARGS__) }; \ m_serial_local_t local; \ m_serial_return_code_t ret; \ - ret = f->interface->read_tuple_start(local, f); \ + ret = f->m_interface->read_tuple_start(local, f); \ while (ret == M_SERIAL_OK_CONTINUE) { \ - ret = f->interface->read_tuple_id(local, f, field_name, field_max, &index); \ + ret = f->m_interface->read_tuple_id(local, f, field_name, field_max, &index); \ if (ret == M_SERIAL_OK_CONTINUE) { \ assert (index >= 0 && index < field_max); \ switch (1+index) { \ diff --git a/m-variant.h b/m-variant.h index 69d2d930..0b919f61 100644 --- a/m-variant.h +++ b/m-variant.h @@ -525,22 +525,22 @@ const int field_max = M_NARGS(__VA_ARGS__); \ static const char *const field_name[] = \ { M_REDUCE(VARIANTI_STRINGIFY_NAME, M_ID, __VA_ARGS__) }; \ - assert (f != NULL && f->interface != NULL && el != NULL); \ + assert (f != NULL && f->m_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(local, f, field_name, field_max, -1); \ + return f->m_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(local, f); \ + ret |= f->m_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(local, f, field_name, field_max, \ + ret = f->m_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; @@ -553,12 +553,12 @@ const int field_max = M_NARGS(__VA_ARGS__); \ static const char *const field_name[] = \ { M_REDUCE(VARIANTI_STRINGIFY_NAME, M_ID, __VA_ARGS__) }; \ - assert (f != NULL && f->interface != NULL && el != NULL); \ + assert (f != NULL && f->m_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(local, f, field_name, field_max, &id); \ + ret = f->m_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 = (enum M_C(name, _enum))(id+1); \ @@ -567,7 +567,7 @@ default: assert(false); break; \ } \ if (ret == M_SERIAL_OK_DONE) \ - ret = f->interface->read_variant_end(local, f); \ + ret = f->m_interface->read_variant_end(local, f); \ return ret; \ } #define VARIANTI_DEFINE_IN_SERIAL_FUNC(name, a) \