From 84c4bf590cbb808ca3a2f85ea884c0fbf0427a1a Mon Sep 17 00:00:00 2001 From: blueloveTH Date: Thu, 2 May 2024 16:23:08 +0800 Subject: [PATCH] doc fix --- docs/bindings.md | 19 +------------------ docs/cheatsheet.md | 1 - include/pocketpy/cffi.h | 2 -- 3 files changed, 1 insertion(+), 21 deletions(-) diff --git a/docs/bindings.md b/docs/bindings.md index 64acb353..6fe70fb4 100644 --- a/docs/bindings.md +++ b/docs/bindings.md @@ -112,26 +112,13 @@ struct Point{ } ``` -You can write a wrapper class `wrapped__Point`. Add `PY_CLASS` macro into your wrapper class and implement a static function `_register`. - +You can write a wrapper class `wrapped__Point`. Add implement a static function `_register`. Inside the `_register` function, do bind methods and properties. -```cpp -PY_CLASS(T, mod, name) - -// T is the struct type in cpp -// mod is the module name in python -// name is the class name in python -``` - ### Example ```cpp struct wrapped__Point{ - // special macro for wrapper class - PY_CLASS(wrapped__Point, builtins, Point) - // ^T ^module ^name - // wrapped value Point value; @@ -187,8 +174,6 @@ If your custom type stores `PyObject*` in its fields, you need to handle gc for ```cpp struct Container{ - PY_CLASS(Container, builtins, Container) - PyObject* a; std::vector b; // ... @@ -199,8 +184,6 @@ Add a magic method `_gc_mark() const` to your custom type. ```cpp struct Container{ - PY_CLASS(Container, builtins, Container) - PyObject* a; std::vector b; // ... diff --git a/docs/cheatsheet.md b/docs/cheatsheet.md index 273b8e82..f36a4212 100644 --- a/docs/cheatsheet.md +++ b/docs/cheatsheet.md @@ -140,7 +140,6 @@ PyObject* list_t = vm->_t(vm->tp_list); Access extended python types ```cpp -// VoidP was defined by `PY_CLASS` macro Type voidp_t = vm->_tp_user(); ``` diff --git a/include/pocketpy/cffi.h b/include/pocketpy/cffi.h index f39809e0..7ebab26d 100644 --- a/include/pocketpy/cffi.h +++ b/include/pocketpy/cffi.h @@ -63,8 +63,6 @@ POINTER_VAR(const bool*, "bool_p") struct C99Struct{ - PY_CLASS(C99Struct, c, struct) - static constexpr int INLINE_SIZE = 24; char _inlined[INLINE_SIZE];