summaryrefslogtreecommitdiffstatshomepage
path: root/py/modio.c
Commit message (Collapse)AuthorAge
* py: Add mp_raise_OSError(errno) helper function.Damien George2016-10-07
| | | | | This is an often used code pattern, and its use reduces code size of the core by about 100 bytes.
* all: Remove 'name' member from mp_obj_module_t struct.Damien George2016-09-22
| | | | One can instead lookup __name__ in the modules dict to get the value.
* all: Rename mp_obj_type_t::stream_p to protocol.Paul Sokolovsky2016-06-18
| | | | | It's now used for more than just stream protocol (e.g. pin protocol), so don't use false names.
* py/stream: Support both "exact size" and "one underlying call" operations.Paul Sokolovsky2016-05-18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* py/modio: Rename module name to "uio" for consistency with other modules.Paul Sokolovsky2016-05-02
|
* py/modio: io.BufferedWriter: Describe flushing policy.Paul Sokolovsky2016-03-25
|
* py/modio: Implement io.BufferedWriter.flush().Paul Sokolovsky2016-03-25
|
* py/modio: Initial implementation of io.BufferedWriter class.Paul Sokolovsky2016-03-25
| | | | Just .write() method implemented currently.
* py: Add MP_ROM_* macros and mp_rom_* types and use them.Damien George2015-11-29
|
* py: Use TextIOWrapper only if PY_IO_FILEIO def'd; cast size_t for print.Damien George2015-02-15
|
* py: Move to guarded includes, everywhere in py/ core.Damien George2015-01-01
| | | | Addresses issue #1022.
* Use MP_DEFINE_CONST_DICT macro to define module dicts.Damien George2014-11-29
| | | | | This is just a clean-up of the code. Generated code is exactly the same.
* py: Include mpconfig.h before all other includes.Paul Sokolovsky2014-06-21
| | | | | | It defines types used by all other headers. Fixes #691.
* Prefix ARRAY_SIZE with micropython prefix MP_Emmanuel Blot2014-06-19
|
* py: Rename builtin "io" to "_io".Paul Sokolovsky2014-06-12
| | | | | | | | Functionality we provide in builtin io module is fairly minimal. Some code, including CPython stdlib, depends on more functionality. So, there's a choice to either implement it in C, or move it _io, and let implement other functionality in Python. 2nd choice is pursued. This setup matches CPython too (_io is builtin, io is Python-level).
* Rename configuration variables controling Python features.Damien George2014-05-24
| | | | Now of the form MICROPY_PY_*. See issue #35.
* py: Implement proper separation between io.FileIO and io.TextIOWrapper.Paul Sokolovsky2014-05-19
| | | | | | | io.FileIO is binary I/O, ans actually optional. Default file type is io.TextIOWrapper, which provides str results. CPython3 explicitly describes io.TextIOWrapper as buffered I/O, but we don't have buffering support yet anyway.
* objstringio: Implement io.BytesIO.Paul Sokolovsky2014-05-15
| | | | | Done in generalized manner, allowing any stream class to be specified as working with bytes.
* Add license header to (almost) all files.Damien George2014-05-03
| | | | | | | Blanket wide to all .c and .h files. Some files originating from ST are difficult to deal with (license wise) so it was left out of those. Also merged modpyb.h, modos.h, modstm.h and modtime.h in stmhal/.
* modio: Implement io.StringIO class.Paul Sokolovsky2014-04-26
|
* Add ARRAY_SIZE macro, and use it where possible.Damien George2014-04-26
|
* py: Change module globals from mp_map_t* to mp_obj_dict_t*.Damien George2014-04-05
| | | | | | Towards addressing issue #424. Had a small increase to ROM usage (order 60 bytes).
* py: Add "io" module.Paul Sokolovsky2014-04-03
So far just includes "open" function, which should be supplied by a port. TODO: Make the module #ifdef'ed.