summaryrefslogtreecommitdiffstatshomepage
path: root/py/modstruct.c
diff options
context:
space:
mode:
Diffstat (limited to 'py/modstruct.c')
-rw-r--r--py/modstruct.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/py/modstruct.c b/py/modstruct.c
index 39571e3efa..a45181852c 100644
--- a/py/modstruct.c
+++ b/py/modstruct.c
@@ -39,6 +39,22 @@
#if MICROPY_PY_STRUCT
+/*
+ This module implements most of character typecodes from CPython, with
+ some extensions:
+
+ O - (Pointer to) an arbitrary Python object. This is useful for callback
+ data, etc. Note that you must keep reference to passed object in
+ your Python application, otherwise it may be garbage-collected,
+ and then when you get back this value from callback it may be
+ invalid (and lead to crash).
+ S - Pointer to a string (returned as a Python string). Note the
+ difference from "Ns", - the latter says "in this place of structure
+ is character data of up to N bytes length", while "S" means
+ "in this place of a structure is a pointer to zero-terminated
+ character data".
+ */
+
STATIC char get_fmt_type(const char **fmt) {
char t = **fmt;
switch (t) {