circuitpython/extmod
Paul Sokolovsky 7f7c84b10a py/stream: Support both "exact size" and "one underlying call" operations.
Both read and write operations support variants where either a) a single
call is made to the undelying stream implementation and returned buffer
length may be less than requested, or b) calls are repeated until requested
amount of data is collected, shorter amount is returned only in case of
EOF or error.

These operations are available from the level of C support functions to be
used by other C modules to implementations of Python methods to be used in
user-facing objects.

The rationale of these changes is to allow to write concise and robust
code to work with *blocking* streams of types prone to short reads, like
serial interfaces and sockets. Particular object types may select "exact"
vs "once" types of methods depending on their needs. E.g., for sockets,
revc() and send() methods continue to be "once", while read() and write()
thus converted to "exactly" versions.

These changes don't affect non-blocking handling, e.g. trying "exact"
method on the non-blocking socket will return as much data as available
without blocking. No data available is continued to be signaled as None
return value to read() and write().

From the point of view of CPython compatibility, this model is a cross
between its io.RawIOBase and io.BufferedIOBase abstract classes. For
blocking streams, it works as io.BufferedIOBase model (guaranteeing
lack of short reads/writes), while for non-blocking - as io.RawIOBase,
returning None in case of lack of data (instead of raising expensive
exception, as required by io.BufferedIOBase). Such a cross-behavior
should be optimal for MicroPython needs.
2016-05-18 02:41:45 +03:00
..
crypto-algorithms extmod/moduhashlib: Add namespace prefix for crypto-algorithms/sha256.h. 2015-12-20 23:14:47 +02:00
lwip-include extmod/lwip: Change void pointers to unions, include new mphal.h file 2015-11-04 23:24:04 +03:00
re1.5 extmod/re1.5: Workaround issue with mingw32-gcc 4.2.1. 2015-11-01 02:39:01 +03:00
uzlib extmod: Update uzlib to 1.2.2. 2016-02-01 23:05:45 +02:00
fsusermount.c extmod/fsusermount: In mount/mkfs, deregister VFS object on error. 2016-04-14 23:36:25 +01:00
fsusermount.h extmod/vfs_fat: Object-oriented encapsulation of FatFs VFS. 2016-02-14 19:15:21 +02:00
machine_i2c.c extmod/machine_i2c: Allow mp_hal_pin_obj_t to be any type, not a ptr. 2016-04-22 09:56:02 +01:00
machine_i2c.h extmod: Add generic machine.I2C class, with bit-bang I2C. 2016-04-12 14:06:54 +01:00
machine_mem.c extmod/modmachine: Truncate integers that are to be stored using mem*. 2016-02-10 17:05:03 +00:00
machine_mem.h unix: machine_mem improvements 2015-12-18 22:01:03 +02:00
misc.h extmod/moduos_dupterm: Make mp_uos_dupterm_tx_strn() function reusable. 2016-01-01 16:43:35 +02:00
modframebuf.c extmod: Add initial framebuf module. 2016-04-12 14:06:53 +01:00
modlwip.c extmod/modlwip: Rework how Python accept callback is called. 2016-05-15 22:42:12 +03:00
modubinascii.c py: Change type signature of builtin funs that take variable or kw args. 2016-01-11 00:49:27 +00:00
modubinascii.h py: Change type signature of builtin funs that take variable or kw args. 2016-01-11 00:49:27 +00:00
moductypes.c extmod/uctypes: Change param type from void* to byte*. 2016-03-19 22:13:17 +00:00
moduhashlib.c extmod/moduhashlib: Use MICROPY_PY_UHASHLIB_SHA1 config define. 2016-01-25 00:49:00 +02:00
moduheapq.c py: Wrap all obj-ptr conversions in MP_OBJ_TO_PTR/MP_OBJ_FROM_PTR. 2015-11-29 14:25:35 +00:00
modujson.c py: Wrap all obj-ptr conversions in MP_OBJ_TO_PTR/MP_OBJ_FROM_PTR. 2015-11-29 14:25:35 +00:00
moduos_dupterm.c extmod/moduos_dupterm: Don't swallow exceptions in dupterm's read()/write(). 2016-04-13 16:34:11 +03:00
modurandom.c extmod/modurandom: Add some extra random functions. 2016-01-26 15:27:00 +00:00
modure.c extmod/modure: re_exec() renamed to ure_exec() due to collison in 4.3BSD. 2016-04-08 20:12:03 +03:00
modussl.c extmod/modussl: SSL_OK from ssl_read() means "no user data so far". 2016-04-28 17:29:11 +03:00
moduzlib.c py: Change type signature of builtin funs that take variable or kw args. 2016-01-11 00:49:27 +00:00
modwebrepl.c py/stream: Support both "exact size" and "one underlying call" operations. 2016-05-18 02:41:45 +03:00
modwebsocket.c py/stream: Support both "exact size" and "one underlying call" operations. 2016-05-18 02:41:45 +03:00
modwebsocket.h extmod/modwebsocket.h: Split websocket-related defines for reuse. 2016-04-10 13:42:51 +03:00
vfs_fat.c extmod/vfs_fat: Add .rename() method. 2016-02-29 01:23:53 +02:00
vfs_fat_diskio.c extmod/vfs_fat_diskio: Actually support sectors != 512 with Python blockdevs. 2016-03-27 14:21:06 +03:00
vfs_fat_ffconf.c extmod/vfs_fat_ffconf: Reusable FatFs module, move from stmhal/ffconf. 2016-02-15 00:19:27 +02:00
vfs_fat_file.c py: When printf'ing an object as a pointer, pass the concrete pointer. 2016-03-14 22:41:14 +00:00
vfs_fat_file.h extmod/vfs_fat: Move listdir() method from stmhal for reuse. 2016-02-28 17:17:24 +02:00
vfs_fat_lexer.c extmod/vfs_fat_lexer: Add func prototype for pedantic warnings. 2016-03-03 14:53:36 +02:00
vfs_fat_misc.c extmod/vfs_fat_misc: Fix cc3200 port build. 2016-02-29 01:15:19 +02:00