Skip to content

Commit 4791d29

Browse files
committed
extmod: Remove old comments used for auto-doc generation.
They are no longer used, and the text in the docs is more up to date. Signed-off-by: Damien George <damien@micropython.org>
1 parent 9e29217 commit 4791d29

3 files changed

Lines changed: 18 additions & 75 deletions

File tree

extmod/moductypes.c

Lines changed: 10 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -34,38 +34,10 @@
3434

3535
#if MICROPY_PY_UCTYPES
3636

37-
/// \module uctypes - Access data structures in memory
38-
///
39-
/// The module allows to define layout of raw data structure (using terms
40-
/// of C language), and then access memory buffers using this definition.
41-
/// The module also provides convenience functions to access memory buffers
42-
/// contained in Python objects or wrap memory buffers in Python objects.
43-
/// \constant UINT8_1 - uint8_t value type
44-
45-
/// \class struct - C-like structure
46-
///
47-
/// Encapsulalation of in-memory data structure. This class doesn't define
48-
/// any methods, only attribute access (for structure fields) and
49-
/// indexing (for pointer and array fields).
50-
///
51-
/// Usage:
52-
///
53-
/// # Define layout of a structure with 2 fields
54-
/// # 0 and 4 are byte offsets of fields from the beginning of struct
55-
/// # they are logically ORed with field type
56-
/// FOO_STRUCT = {"a": 0 | uctypes.UINT32, "b": 4 | uctypes.UINT8}
57-
///
58-
/// # Example memory buffer to access (contained in bytes object)
59-
/// buf = b"\x64\0\0\0\0x14"
60-
///
61-
/// # Create structure object referring to address of
62-
/// # the data in the buffer above
63-
/// s = uctypes.struct(FOO_STRUCT, uctypes.addressof(buf))
64-
///
65-
/// # Access fields
66-
/// print(s.a, s.b)
67-
/// # Result:
68-
/// # 100, 20
37+
// The uctypes module allows defining the layout of a raw data structure (using
38+
// terms of the C language), and then access memory buffers using this definition.
39+
// The module also provides convenience functions to access memory buffers
40+
// contained in Python objects or wrap memory buffers in Python objects.
6941

7042
#define LAYOUT_LITTLE_ENDIAN (0)
7143
#define LAYOUT_BIG_ENDIAN (1)
@@ -647,29 +619,24 @@ STATIC mp_int_t uctypes_get_buffer(mp_obj_t self_in, mp_buffer_info_t *bufinfo,
647619
return 0;
648620
}
649621

650-
/// \function addressof()
651-
/// Return address of object's data (applies to object providing buffer
652-
/// interface).
622+
// addressof()
623+
// Return address of object's data (applies to objects providing the buffer interface).
653624
STATIC mp_obj_t uctypes_struct_addressof(mp_obj_t buf) {
654625
mp_buffer_info_t bufinfo;
655626
mp_get_buffer_raise(buf, &bufinfo, MP_BUFFER_READ);
656627
return mp_obj_new_int((mp_int_t)(uintptr_t)bufinfo.buf);
657628
}
658629
MP_DEFINE_CONST_FUN_OBJ_1(uctypes_struct_addressof_obj, uctypes_struct_addressof);
659630

660-
/// \function bytearray_at()
661-
/// Capture memory at given address of given size as bytearray. Memory is
662-
/// captured by reference (and thus memory pointed by bytearray may change
663-
/// or become invalid at later time). Use bytes_at() to capture by value.
631+
// bytearray_at()
632+
// Capture memory at given address of given size as bytearray.
664633
STATIC mp_obj_t uctypes_struct_bytearray_at(mp_obj_t ptr, mp_obj_t size) {
665634
return mp_obj_new_bytearray_by_ref(mp_obj_int_get_truncated(size), (void *)(uintptr_t)mp_obj_int_get_truncated(ptr));
666635
}
667636
MP_DEFINE_CONST_FUN_OBJ_2(uctypes_struct_bytearray_at_obj, uctypes_struct_bytearray_at);
668637

669-
/// \function bytes_at()
670-
/// Capture memory at given address of given size as bytes. Memory is
671-
/// captured by value, i.e. copied. Use bytearray_at() to capture by reference
672-
/// ("zero copy").
638+
// bytes_at()
639+
// Capture memory at given address of given size as bytes.
673640
STATIC mp_obj_t uctypes_struct_bytes_at(mp_obj_t ptr, mp_obj_t size) {
674641
return mp_obj_new_bytes((void *)(uintptr_t)mp_obj_int_get_truncated(ptr), mp_obj_int_get_truncated(size));
675642
}
@@ -695,36 +662,19 @@ STATIC const mp_rom_map_elem_t mp_module_uctypes_globals_table[] = {
695662
{ MP_ROM_QSTR(MP_QSTR_bytes_at), MP_ROM_PTR(&uctypes_struct_bytes_at_obj) },
696663
{ MP_ROM_QSTR(MP_QSTR_bytearray_at), MP_ROM_PTR(&uctypes_struct_bytearray_at_obj) },
697664

698-
/// \moduleref uctypes
699-
700-
/// \constant NATIVE - Native structure layout - native endianness,
701-
/// platform-specific field alignment
702665
{ MP_ROM_QSTR(MP_QSTR_NATIVE), MP_ROM_INT(LAYOUT_NATIVE) },
703-
/// \constant LITTLE_ENDIAN - Little-endian structure layout, tightly packed
704-
/// (no alignment constraints)
705666
{ MP_ROM_QSTR(MP_QSTR_LITTLE_ENDIAN), MP_ROM_INT(LAYOUT_LITTLE_ENDIAN) },
706-
/// \constant BIG_ENDIAN - Big-endian structure layout, tightly packed
707-
/// (no alignment constraints)
708667
{ MP_ROM_QSTR(MP_QSTR_BIG_ENDIAN), MP_ROM_INT(LAYOUT_BIG_ENDIAN) },
709668

710-
/// \constant VOID - void value type, may be used only as pointer target type.
711669
{ MP_ROM_QSTR(MP_QSTR_VOID), MP_ROM_INT(TYPE2SMALLINT(UINT8, VAL_TYPE_BITS)) },
712670

713-
/// \constant UINT8 - uint8_t value type
714671
{ MP_ROM_QSTR(MP_QSTR_UINT8), MP_ROM_INT(TYPE2SMALLINT(UINT8, 4)) },
715-
/// \constant INT8 - int8_t value type
716672
{ MP_ROM_QSTR(MP_QSTR_INT8), MP_ROM_INT(TYPE2SMALLINT(INT8, 4)) },
717-
/// \constant UINT16 - uint16_t value type
718673
{ MP_ROM_QSTR(MP_QSTR_UINT16), MP_ROM_INT(TYPE2SMALLINT(UINT16, 4)) },
719-
/// \constant INT16 - int16_t value type
720674
{ MP_ROM_QSTR(MP_QSTR_INT16), MP_ROM_INT(TYPE2SMALLINT(INT16, 4)) },
721-
/// \constant UINT32 - uint32_t value type
722675
{ MP_ROM_QSTR(MP_QSTR_UINT32), MP_ROM_INT(TYPE2SMALLINT(UINT32, 4)) },
723-
/// \constant INT32 - int32_t value type
724676
{ MP_ROM_QSTR(MP_QSTR_INT32), MP_ROM_INT(TYPE2SMALLINT(INT32, 4)) },
725-
/// \constant UINT64 - uint64_t value type
726677
{ MP_ROM_QSTR(MP_QSTR_UINT64), MP_ROM_INT(TYPE2SMALLINT(UINT64, 4)) },
727-
/// \constant INT64 - int64_t value type
728678
{ MP_ROM_QSTR(MP_QSTR_INT64), MP_ROM_INT(TYPE2SMALLINT(INT64, 4)) },
729679

730680
{ MP_ROM_QSTR(MP_QSTR_BFUINT8), MP_ROM_INT(TYPE2SMALLINT(BFUINT8, 4)) },

extmod/moduselect.c

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,6 @@
4040
// Flags for poll()
4141
#define FLAG_ONESHOT (1)
4242

43-
/// \module select - Provides select function to wait for events on a stream
44-
///
45-
/// This module provides the select function.
46-
4743
typedef struct _poll_obj_t {
4844
mp_obj_t obj;
4945
mp_uint_t (*ioctl)(mp_obj_t obj, mp_uint_t request, uintptr_t arg, int *errcode);
@@ -111,7 +107,7 @@ STATIC mp_uint_t poll_map_poll(mp_map_t *poll_map, size_t *rwx_num) {
111107
return n_ready;
112108
}
113109

114-
/// \function select(rlist, wlist, xlist[, timeout])
110+
// select(rlist, wlist, xlist[, timeout])
115111
STATIC mp_obj_t select_select(size_t n_args, const mp_obj_t *args) {
116112
// get array data from tuple/list arguments
117113
size_t rwx_len[3];
@@ -178,8 +174,6 @@ STATIC mp_obj_t select_select(size_t n_args, const mp_obj_t *args) {
178174
}
179175
MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mp_select_select_obj, 3, 4, select_select);
180176

181-
/// \class Poll - poll class
182-
183177
typedef struct _mp_obj_poll_t {
184178
mp_obj_base_t base;
185179
mp_map_t poll_map;
@@ -190,7 +184,7 @@ typedef struct _mp_obj_poll_t {
190184
mp_obj_t ret_tuple;
191185
} mp_obj_poll_t;
192186

193-
/// \method register(obj[, eventmask])
187+
// register(obj[, eventmask])
194188
STATIC mp_obj_t poll_register(size_t n_args, const mp_obj_t *args) {
195189
mp_obj_poll_t *self = MP_OBJ_TO_PTR(args[0]);
196190
mp_uint_t flags;
@@ -204,7 +198,7 @@ STATIC mp_obj_t poll_register(size_t n_args, const mp_obj_t *args) {
204198
}
205199
MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(poll_register_obj, 2, 3, poll_register);
206200

207-
/// \method unregister(obj)
201+
// unregister(obj)
208202
STATIC mp_obj_t poll_unregister(mp_obj_t self_in, mp_obj_t obj_in) {
209203
mp_obj_poll_t *self = MP_OBJ_TO_PTR(self_in);
210204
mp_map_lookup(&self->poll_map, mp_obj_id(obj_in), MP_MAP_LOOKUP_REMOVE_IF_FOUND);
@@ -213,7 +207,7 @@ STATIC mp_obj_t poll_unregister(mp_obj_t self_in, mp_obj_t obj_in) {
213207
}
214208
MP_DEFINE_CONST_FUN_OBJ_2(poll_unregister_obj, poll_unregister);
215209

216-
/// \method modify(obj, eventmask)
210+
// modify(obj, eventmask)
217211
STATIC mp_obj_t poll_modify(mp_obj_t self_in, mp_obj_t obj_in, mp_obj_t eventmask_in) {
218212
mp_obj_poll_t *self = MP_OBJ_TO_PTR(self_in);
219213
mp_map_elem_t *elem = mp_map_lookup(&self->poll_map, mp_obj_id(obj_in), MP_MAP_LOOKUP);
@@ -348,7 +342,7 @@ STATIC const mp_obj_type_t mp_type_poll = {
348342
.locals_dict = (void *)&poll_locals_dict,
349343
};
350344

351-
/// \function poll()
345+
// poll()
352346
STATIC mp_obj_t select_poll(void) {
353347
mp_obj_poll_t *poll = m_new_obj(mp_obj_poll_t);
354348
poll->base.type = &mp_type_poll;

extmod/vfs_fat.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ STATIC mp_obj_t fat_vfs_mkdir(mp_obj_t vfs_in, mp_obj_t path_o) {
256256
}
257257
STATIC MP_DEFINE_CONST_FUN_OBJ_2(fat_vfs_mkdir_obj, fat_vfs_mkdir);
258258

259-
/// Change current directory.
259+
// Change current directory.
260260
STATIC mp_obj_t fat_vfs_chdir(mp_obj_t vfs_in, mp_obj_t path_in) {
261261
mp_obj_fat_vfs_t *self = MP_OBJ_TO_PTR(vfs_in);
262262
const char *path;
@@ -272,7 +272,7 @@ STATIC mp_obj_t fat_vfs_chdir(mp_obj_t vfs_in, mp_obj_t path_in) {
272272
}
273273
STATIC MP_DEFINE_CONST_FUN_OBJ_2(fat_vfs_chdir_obj, fat_vfs_chdir);
274274

275-
/// Get the current directory.
275+
// Get the current directory.
276276
STATIC mp_obj_t fat_vfs_getcwd(mp_obj_t vfs_in) {
277277
mp_obj_fat_vfs_t *self = MP_OBJ_TO_PTR(vfs_in);
278278
char buf[MICROPY_ALLOC_PATH_MAX + 1];
@@ -284,8 +284,7 @@ STATIC mp_obj_t fat_vfs_getcwd(mp_obj_t vfs_in) {
284284
}
285285
STATIC MP_DEFINE_CONST_FUN_OBJ_1(fat_vfs_getcwd_obj, fat_vfs_getcwd);
286286

287-
/// \function stat(path)
288-
/// Get the status of a file or directory.
287+
// Get the status of a file or directory.
289288
STATIC mp_obj_t fat_vfs_stat(mp_obj_t vfs_in, mp_obj_t path_in) {
290289
mp_obj_fat_vfs_t *self = MP_OBJ_TO_PTR(vfs_in);
291290
const char *path = mp_obj_str_get_str(path_in);

0 commit comments

Comments
 (0)