summaryrefslogtreecommitdiff
path: root/plugins/pychrysalide/struct.c
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2019-12-22 23:24:32 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2019-12-22 23:24:32 (GMT)
commit90b8f66eb8ae62d951dfbd333fb338e38874c9fe (patch)
tree6cc978cc15121bdda4edf65b609d8099329d94cd /plugins/pychrysalide/struct.c
parentdb0404d4e6836ae05eb344a6d7f087f0a299f2a9 (diff)
Updated the documentation for the entry of Python bindings.
Diffstat (limited to 'plugins/pychrysalide/struct.c')
-rw-r--r--plugins/pychrysalide/struct.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/plugins/pychrysalide/struct.c b/plugins/pychrysalide/struct.c
index d4d6a9f..e7dbdcd 100644
--- a/plugins/pychrysalide/struct.c
+++ b/plugins/pychrysalide/struct.c
@@ -30,6 +30,20 @@
+#define STRUCT_OBJ_DOC \
+ "PyStructObject is a sugar glue used to transmit C structures to Python." \
+ "\n" \
+ "For instance, let's consider the following C structure :\n" \
+ "\n" \
+ " struct _my_struct_t { int a; int b } var;\n" \
+ "\n" \
+ "Such a structure will be translated into a Python dictionary.\n" \
+ "\n" \
+ "Each previous field gets then accessible using :\n" \
+ "* a direct access: *var.a*;\n" \
+ "* an access by name thanks to the dictionary: *var['b']*."
+
+
/* Objet à vocation abstraite */
typedef struct _PyStructObject
{
@@ -119,7 +133,7 @@ PyTypeObject *get_python_py_struct_type(void)
.tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
- .tp_doc = "PyChrysalide structure",
+ .tp_doc = STRUCT_OBJ_DOC,
.tp_methods = py_struct_methods,
.tp_getset = py_struct_getseters,