summaryrefslogtreecommitdiff
path: root/src/vector.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/vector.h')
-rw-r--r--src/vector.h110
1 files changed, 55 insertions, 55 deletions
diff --git a/src/vector.h b/src/vector.h
index a40b7a42..2b58d946 100644
--- a/src/vector.h
+++ b/src/vector.h
@@ -14,8 +14,8 @@
* limitations under the License.
*/
-#ifndef WASM_VECTOR_H_
-#define WASM_VECTOR_H_
+#ifndef WABT_VECTOR_H_
+#define WABT_VECTOR_H_
#include <stddef.h>
@@ -24,123 +24,123 @@
#include "config.h"
/*
- * WASM_DEFINE_VECTOR(widget, WasmWidget) defines struct and functions like the
+ * WABT_DEFINE_VECTOR(widget, WabtWidget) defines struct and functions like the
* following:
*
- * typedef struct WasmWidgetVector {
- * WasmWidget* data;
+ * typedef struct WabtWidgetVector {
+ * WabtWidget* data;
* size_t size;
* size_t capacity;
- * } WasmWidgetVector;
+ * } WabtWidgetVector;
*
- * void wasm_destroy_widget_vector(WasmAllocator*, WasmWidgetVector* vec);
- * WasmWidget* wasm_append_widget(WasmAllocator*, WasmWidgetVector* vec);
- * void wasm_resize_widget_vector(WasmAllocator*, WasmWidgetVector* vec,
+ * void wabt_destroy_widget_vector(WabtAllocator*, WabtWidgetVector* vec);
+ * WabtWidget* wabt_append_widget(WabtAllocator*, WabtWidgetVector* vec);
+ * void wabt_resize_widget_vector(WabtAllocator*, WabtWidgetVector* vec,
* size_t size);
- * void wasm_reserve_widgets(WasmAllocator*, WasmWidgetVector* vec,
+ * void wabt_reserve_widgets(WabtAllocator*, WabtWidgetVector* vec,
* size_t desired);
- * void wasm_append_widget_value(WasmAllocator*, WasmWidgetVector* vec,
- * const WasmWidget* value);
- * void wasm_extend_widgets(WasmAllocator*, WasmWidgetVector* dst,
- * const WasmWidgetVector* src);
+ * void wabt_append_widget_value(WabtAllocator*, WabtWidgetVector* vec,
+ * const WabtWidget* value);
+ * void wabt_extend_widgets(WabtAllocator*, WabtWidgetVector* dst,
+ * const WabtWidgetVector* src);
*/
-#define WASM_DEFINE_VECTOR(name, type) \
+#define WABT_DEFINE_VECTOR(name, type) \
typedef struct type##Vector { \
type* data; \
size_t size; \
size_t capacity; \
} type##Vector; \
\
- WASM_EXTERN_C_BEGIN \
- static WASM_INLINE void wasm_destroy_##name##_vector( \
- struct WasmAllocator* allocator, type##Vector* vec) WASM_UNUSED; \
- static WASM_INLINE void wasm_resize_##name##_vector( \
- struct WasmAllocator* allocator, type##Vector* vec, size_t desired) \
- WASM_UNUSED; \
- static WASM_INLINE void wasm_reserve_##name##s( \
- struct WasmAllocator* allocator, type##Vector* vec, size_t desired) \
- WASM_UNUSED; \
- static WASM_INLINE type* wasm_append_##name(struct WasmAllocator* allocator, \
- type##Vector* vec) WASM_UNUSED; \
- static WASM_INLINE void wasm_append_##name##_value( \
- struct WasmAllocator* allocator, type##Vector* vec, const type* value) \
- WASM_UNUSED; \
- static WASM_INLINE void wasm_extend_##name##s( \
- struct WasmAllocator* allocator, type##Vector* dst, \
- const type##Vector* src) WASM_UNUSED; \
- WASM_EXTERN_C_END \
+ WABT_EXTERN_C_BEGIN \
+ static WABT_INLINE void wabt_destroy_##name##_vector( \
+ struct WabtAllocator* allocator, type##Vector* vec) WABT_UNUSED; \
+ static WABT_INLINE void wabt_resize_##name##_vector( \
+ struct WabtAllocator* allocator, type##Vector* vec, size_t desired) \
+ WABT_UNUSED; \
+ static WABT_INLINE void wabt_reserve_##name##s( \
+ struct WabtAllocator* allocator, type##Vector* vec, size_t desired) \
+ WABT_UNUSED; \
+ static WABT_INLINE type* wabt_append_##name(struct WabtAllocator* allocator, \
+ type##Vector* vec) WABT_UNUSED; \
+ static WABT_INLINE void wabt_append_##name##_value( \
+ struct WabtAllocator* allocator, type##Vector* vec, const type* value) \
+ WABT_UNUSED; \
+ static WABT_INLINE void wabt_extend_##name##s( \
+ struct WabtAllocator* allocator, type##Vector* dst, \
+ const type##Vector* src) WABT_UNUSED; \
+ WABT_EXTERN_C_END \
\
- void wasm_destroy_##name##_vector(struct WasmAllocator* allocator, \
+ void wabt_destroy_##name##_vector(struct WabtAllocator* allocator, \
type##Vector* vec) { \
- wasm_free(allocator, vec->data); \
+ wabt_free(allocator, vec->data); \
vec->data = NULL; \
vec->size = 0; \
vec->capacity = 0; \
} \
- void wasm_resize_##name##_vector(struct WasmAllocator* allocator, \
+ void wabt_resize_##name##_vector(struct WabtAllocator* allocator, \
type##Vector* vec, size_t size) { \
- wasm_resize_vector(allocator, (void**)&vec->data, &vec->size, \
+ wabt_resize_vector(allocator, (void**)&vec->data, &vec->size, \
&vec->capacity, size, sizeof(type)); \
} \
- void wasm_reserve_##name##s(struct WasmAllocator* allocator, \
+ void wabt_reserve_##name##s(struct WabtAllocator* allocator, \
type##Vector* vec, size_t desired) { \
- wasm_ensure_capacity(allocator, (void**)&vec->data, &vec->capacity, \
+ wabt_ensure_capacity(allocator, (void**)&vec->data, &vec->capacity, \
desired, sizeof(type)); \
} \
- type* wasm_append_##name(struct WasmAllocator* allocator, \
+ type* wabt_append_##name(struct WabtAllocator* allocator, \
type##Vector* vec) { \
- return (type*)wasm_append_element(allocator, (void**)&vec->data, \
+ return (type*)wabt_append_element(allocator, (void**)&vec->data, \
&vec->size, &vec->capacity, \
sizeof(type)); \
} \
- void wasm_append_##name##_value(struct WasmAllocator* allocator, \
+ void wabt_append_##name##_value(struct WabtAllocator* allocator, \
type##Vector* vec, const type* value) { \
- type* slot = wasm_append_##name(allocator, vec); \
+ type* slot = wabt_append_##name(allocator, vec); \
*slot = *value; \
} \
- void wasm_extend_##name##s(struct WasmAllocator* allocator, \
+ void wabt_extend_##name##s(struct WabtAllocator* allocator, \
type##Vector* dst, const type##Vector* src) { \
- wasm_extend_elements(allocator, (void**)&dst->data, &dst->size, \
+ wabt_extend_elements(allocator, (void**)&dst->data, &dst->size, \
&dst->capacity, (const void**)&src->data, src->size, \
sizeof(type)); \
}
-#define WASM_DESTROY_VECTOR_AND_ELEMENTS(allocator, v, name) \
+#define WABT_DESTROY_VECTOR_AND_ELEMENTS(allocator, v, name) \
{ \
size_t i; \
for (i = 0; i < (v).size; ++i) \
- wasm_destroy_##name(allocator, &((v).data[i])); \
- wasm_destroy_##name##_vector(allocator, &(v)); \
+ wabt_destroy_##name(allocator, &((v).data[i])); \
+ wabt_destroy_##name##_vector(allocator, &(v)); \
}
-WASM_EXTERN_C_BEGIN
-void wasm_ensure_capacity(struct WasmAllocator*,
+WABT_EXTERN_C_BEGIN
+void wabt_ensure_capacity(struct WabtAllocator*,
void** data,
size_t* capacity,
size_t desired_size,
size_t elt_byte_size);
-void wasm_resize_vector(struct WasmAllocator*,
+void wabt_resize_vector(struct WabtAllocator*,
void** data,
size_t* size,
size_t* capacity,
size_t desired_size,
size_t elt_byte_size);
-void* wasm_append_element(struct WasmAllocator*,
+void* wabt_append_element(struct WabtAllocator*,
void** data,
size_t* size,
size_t* capacity,
size_t elt_byte_size);
-void wasm_extend_elements(struct WasmAllocator*,
+void wabt_extend_elements(struct WabtAllocator*,
void** dst,
size_t* dst_size,
size_t* dst_capacity,
const void** src,
size_t src_size,
size_t elt_byte_size);
-WASM_EXTERN_C_END
+WABT_EXTERN_C_END
-#endif /* WASM_VECTOR_H_ */
+#endif /* WABT_VECTOR_H_ */