Reintroduce C++ support and add usage tests for C++ (#4)
Reviewed-on: #4 Co-authored-by: Abdelrahman <said.abdelrahman89@gmail.com> Co-committed-by: Abdelrahman <said.abdelrahman89@gmail.com>
This commit is contained in:
@@ -153,7 +153,7 @@ def make_array(user_datatypes: Dict[CDataType, ArrayData] = {}):
|
||||
)
|
||||
generic_funcs.append(alloc_capacity_func)
|
||||
|
||||
stack_array_macro = CMacro(
|
||||
stack_array_cmacro = CMacro(
|
||||
name=f"wapp_{type_string_lower}_array(...)",
|
||||
value=__format_func_body(
|
||||
filename=snippets_dir / "stack_array",
|
||||
@@ -163,8 +163,18 @@ def make_array(user_datatypes: Dict[CDataType, ArrayData] = {}):
|
||||
array_typename=array_data.array_typename,
|
||||
),
|
||||
)
|
||||
stack_array_cppmacro = CMacro(
|
||||
name=f"wapp_{type_string_lower}_array(...)",
|
||||
value=__format_func_body(
|
||||
filename=snippets_dir / "stack_array_cpp",
|
||||
type_string=type_string,
|
||||
type_string_upper=type_string_upper,
|
||||
type_string_lower=type_string_lower,
|
||||
array_typename=array_data.array_typename,
|
||||
),
|
||||
)
|
||||
|
||||
stack_capacity_array_macro = CMacro(
|
||||
stack_capacity_array_cmacro = CMacro(
|
||||
name=f"wapp_{type_string_lower}_array_with_capacity(CAPACITY)",
|
||||
value=__format_func_body(
|
||||
filename=snippets_dir / "stack_capacity_array",
|
||||
@@ -174,6 +184,16 @@ def make_array(user_datatypes: Dict[CDataType, ArrayData] = {}):
|
||||
array_typename=array_data.array_typename,
|
||||
),
|
||||
)
|
||||
stack_capacity_array_cppmacro = CMacro(
|
||||
name=f"wapp_{type_string_lower}_array_with_capacity(CAPACITY)",
|
||||
value=__format_func_body(
|
||||
filename=snippets_dir / "stack_capacity_array_cpp",
|
||||
type_string=type_string,
|
||||
type_string_upper=type_string_upper,
|
||||
type_string_lower=type_string_lower,
|
||||
array_typename=array_data.array_typename,
|
||||
),
|
||||
)
|
||||
|
||||
alloc_capacity_array_macro = CMacro(
|
||||
name=f"wapp_{type_string_lower}_array_alloc_capacity(ALLOCATOR_PTR, CAPACITY)",
|
||||
@@ -186,7 +206,7 @@ def make_array(user_datatypes: Dict[CDataType, ArrayData] = {}):
|
||||
),
|
||||
)
|
||||
|
||||
array_pop_macro = CMacro(
|
||||
array_pop_cmacro = CMacro(
|
||||
name=f"wapp_{type_string_lower}_array_pop(ARRAY_PTR)",
|
||||
value=__format_func_body(
|
||||
filename=snippets_dir / "array_pop_macro",
|
||||
@@ -196,6 +216,16 @@ def make_array(user_datatypes: Dict[CDataType, ArrayData] = {}):
|
||||
array_typename=array_data.array_typename,
|
||||
),
|
||||
)
|
||||
array_pop_cppmacro = CMacro(
|
||||
name=f"wapp_{type_string_lower}_array_pop(ARRAY_PTR)",
|
||||
value=__format_func_body(
|
||||
filename=snippets_dir / "array_pop_macro_cpp",
|
||||
type_string=type_string,
|
||||
type_string_upper=type_string_upper,
|
||||
type_string_lower=type_string_lower,
|
||||
array_typename=array_data.array_typename,
|
||||
),
|
||||
)
|
||||
|
||||
get_func = CFunc(
|
||||
name=f"wapp_{type_string_lower}_array_get",
|
||||
@@ -366,10 +396,17 @@ def make_array(user_datatypes: Dict[CDataType, ArrayData] = {}):
|
||||
|
||||
header.decl_types.extend(array_data.hdr_decl_types)
|
||||
header.macros.extend([
|
||||
stack_array_macro,
|
||||
stack_capacity_array_macro,
|
||||
alloc_capacity_array_macro,
|
||||
array_pop_macro,
|
||||
])
|
||||
header.c_macros.extend([
|
||||
stack_array_cmacro,
|
||||
stack_capacity_array_cmacro,
|
||||
array_pop_cmacro,
|
||||
])
|
||||
header.cpp_macros.extend([
|
||||
stack_array_cppmacro,
|
||||
stack_capacity_array_cppmacro,
|
||||
array_pop_cppmacro,
|
||||
])
|
||||
header.types.extend([array])
|
||||
header.funcs.extend([
|
||||
|
Reference in New Issue
Block a user