-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(dataclass): Introduce
mlcd.prototype
(#19)
This PR introduces `mlcd.prototype` that aims to help easier migration between C++ and Python. The method `prototype` prints, for example, when `lang="c++"`, the C++ definition of existing Python dataclasses defined in MLC API. More specifically, the command below: ``` python -c "import mlc.dataclasses as mlcd; print(mlcd.prototype(\"mlc.sym.*\", lang=\"c++\" export_macro=\"MLC_SYM_EXPORTS\"))" ``` prints all C++ definition code for types with prefix `mlc.sym.*`, and the export macro is `MLC_SYM_EXPORTS`.
- Loading branch information
1 parent
b584462
commit a8017ce
Showing
6 changed files
with
63 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,9 @@ | ||
from .c_class import c_class | ||
from .py_class import PyClass, py_class | ||
from .utils import Structure, add_vtable_method, field, prototype_cxx, prototype_py, vtable_method | ||
from .utils import ( | ||
Structure, | ||
add_vtable_method, | ||
field, | ||
prototype, | ||
vtable_method, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters