diff --git a/codegen/codegen.py b/codegen/codegen.py index 3f7cf6d..159919f 100644 --- a/codegen/codegen.py +++ b/codegen/codegen.py @@ -162,7 +162,7 @@ def test_doubly_linked_list(): ) datatypes: dict[CDataType, list[CInclude]] = {"Str8": [CInclude(header="str8.h", local=True)]} - snippets_dir = Path("snippets") + snippets_dir = Path(__file__).parent / "snippets" for _type, includes in datatypes.items(): type_string = get_datatype_string(_type) @@ -193,7 +193,7 @@ def test_doubly_linked_list(): CArg(name="list", _type=dl_list, pointer=CPointer(CPointerType.SINGLE), qualifier=CQualifier.CONST), CArg(name="index", _type=CType.U64), ], - body=__format_func_body(Path(__file__).parent / snippets_dir / "list_get", type_string), + body=__format_func_body(snippets_dir / "list_get", type_string), pointer=CPointer(CPointerType.SINGLE), ) @@ -204,7 +204,7 @@ def test_doubly_linked_list(): CArg(name="list", _type=dl_list, pointer=CPointer(CPointerType.SINGLE)), CArg(name="node", _type=node, pointer=CPointer(CPointerType.SINGLE)), ], - body=__format_func_body(Path(__file__).parent / snippets_dir / "list_push_front", type_string), + body=__format_func_body(snippets_dir / "list_push_front", type_string), ) push_back_func = CFunc( @@ -214,7 +214,7 @@ def test_doubly_linked_list(): CArg(name="list", _type=dl_list, pointer=CPointer(CPointerType.SINGLE)), CArg(name="node", _type=node, pointer=CPointer(CPointerType.SINGLE)), ], - body=__format_func_body(Path(__file__).parent / snippets_dir / "list_push_back", type_string), + body=__format_func_body(snippets_dir / "list_push_back", type_string), ) insert_func = CFunc( @@ -225,7 +225,7 @@ def test_doubly_linked_list(): CArg(name="node", _type=node, pointer=CPointer(CPointerType.SINGLE)), CArg(name="index", _type=CType.U64), ], - body=__format_func_body(Path(__file__).parent / snippets_dir / "list_insert", type_string), + body=__format_func_body(snippets_dir / "list_insert", type_string), ) pop_front_func = CFunc( @@ -234,7 +234,7 @@ def test_doubly_linked_list(): args=[ CArg(name="list", _type=dl_list, pointer=CPointer(CPointerType.SINGLE)), ], - body=__format_func_body(Path(__file__).parent / snippets_dir / "list_pop_front", type_string), + body=__format_func_body(snippets_dir / "list_pop_front", type_string), pointer=CPointer(CPointerType.SINGLE), ) @@ -244,7 +244,7 @@ def test_doubly_linked_list(): args=[ CArg(name="list", _type=dl_list, pointer=CPointer(CPointerType.SINGLE)), ], - body=__format_func_body(Path(__file__).parent / snippets_dir / "list_pop_back", type_string), + body=__format_func_body(snippets_dir / "list_pop_back", type_string), pointer=CPointer(CPointerType.SINGLE), ) @@ -255,7 +255,7 @@ def test_doubly_linked_list(): CArg(name="list", _type=dl_list, pointer=CPointer(CPointerType.SINGLE)), CArg(name="index", _type=CType.U64), ], - body=__format_func_body(Path(__file__).parent / snippets_dir / "list_remove", type_string), + body=__format_func_body(snippets_dir / "list_remove", type_string), pointer=CPointer(CPointerType.SINGLE), ) @@ -265,7 +265,7 @@ def test_doubly_linked_list(): args=[ CArg(name="list", _type=dl_list, pointer=CPointer(CPointerType.SINGLE)), ], - body=__format_func_body(Path(__file__).parent / snippets_dir / "list_empty", type_string), + body=__format_func_body(snippets_dir / "list_empty", type_string), ) node_to_list_func = CFunc( @@ -274,7 +274,7 @@ def test_doubly_linked_list(): args=[ CArg(name="node", _type=node, pointer=CPointer(CPointerType.SINGLE)), ], - body=__format_func_body(Path(__file__).parent / snippets_dir / "node_to_list", type_string), + body=__format_func_body(snippets_dir / "node_to_list", type_string), qualifiers=[CQualifier.INTERNAL], )