summaryrefslogtreecommitdiffstatshomepage
path: root/py/stream.c
Commit message (Collapse)AuthorAge
* py: Small cleanup in stream.c.Damien George2014-08-22
|
* py: Change stream protocol API: fns return uint; is_text for text.Damien George2014-07-27
|
* streams: Treat non-error output size as unsigned.Paul Sokolovsky2014-07-23
|
* stream: Revert to checking for the correct error value.Paul Sokolovsky2014-07-23
|
* Deal with reading a buffer less than what was allocated.Dave Hylands2014-07-21
| | | | With this fix, file_long_read now passes.
* py: Add stream reading of n unicode chars; unicode support by default.Damien George2014-07-19
| | | | | | | | | | | | | With unicode enabled, this patch allows reading a fixed number of characters from text-mode streams; eg file.read(5) will read 5 unicode chars, which can made of more than 5 bytes. For an ASCII stream (ie no chars > 127) it only needs to do 1 read. If there are lots of non-ASCII chars in a stream, then it needs multiple reads of the underlying object. Adds a new test for this case. Enables unicode support by default on unix and stmhal ports.
* stream: Factor out mp_stream_write() method to write a memstring to stream.Paul Sokolovsky2014-07-13
|
* Rename machine_(u)int_t to mp_(u)int_t.Damien George2014-07-03
| | | | See discussion in issue #50.
* windows: Sync mpconfigport.h with the unix' versionstijn2014-06-29
| | | | | | - rearrange/add definitions that were not there so it's easier to compare both - use MICROPY_PY_SYS_PLATFORM in main.c since it's available anyway - define EWOULDBLOCK, it is missing from ingw32
* streams: Reading by char count from unicode text streams is not implemented.Paul Sokolovsky2014-06-27
|
* stream: Use mp_obj_is_true() for EOF testing.Paul Sokolovsky2014-06-13
| | | | | Getting a length of string may be expensive, depending on the underlying implementation.
* py: Slightly improve efficiency of mp_obj_new_str; rename str_new.Damien George2014-05-25
| | | | | | Reorder interning logic in mp_obj_new_str, to be more efficient. str_new is globally accessible, so should be prefixed with mp_obj_.
* objstringio: Implement io.BytesIO.Paul Sokolovsky2014-05-15
| | | | | Done in generalized manner, allowing any stream class to be specified as working with bytes.
* py, unix: Add copyright for modules I worked closely on.Paul Sokolovsky2014-05-13
|
* stream: Make non-blcoking stream support configurable.Paul Sokolovsky2014-05-07
| | | | Enable only on unix. To avoid unpleasant surprises with error codes.
* stream: Use standard name of DEFAULT_BUFFER_SIZE.Paul Sokolovsky2014-05-07
|
* stream: Add compliant handling of non-blocking readall().Paul Sokolovsky2014-05-07
|
* stream: Add compliant handling of non-blocking read()/write().Paul Sokolovsky2014-05-07
| | | | | | | | | | | In case of empty non-blocking read()/write(), both return None. read() cannot return 0, as that means EOF, so returns another value, and then write() just follows. This is still pretty unexpected, and typical "if not len:" check would treat this as EOF. Well, non-blocking files require special handling! This also kind of makes it depending on POSIX, but well, anything else should emulate POSIX anyway ;-).
* 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/.
* py, stream: Implement readlines for a stream.Damien George2014-05-03
|
* py, unix: Make "mpconfig.h" be first included, as other headers depend on it.Paul Sokolovsky2014-05-02
| | | | Specifically, nlr.h does.
* streams: Make .write() support arbitrary objects with buffer interface.Paul Sokolovsky2014-04-26
| | | | This in particular fixes writing str vs bytes.
* py: Add MP_OBJ_STOP_ITERATION and make good use of it.Damien George2014-04-17
| | | | | Also make consistent use of MP_OBJ_NOT_SUPPORTED and MP_OBJ_NULL. This helps a lot in debugging and understanding of function API.
* py: the entire `<unistd.h>` shouldn't be neededIlya Dmitrichenko2014-04-12
|
* py: Replace stream_p with *stream_p in mp_obj_type_t.Damien George2014-04-05
| | | | | | | | This is to reduce ROM usage. stream_p is used in file and socket types only (at the moment), so seems a good idea to make the protocol functions a pointer instead of the actual structure. It saves 308 bytes of ROM in the stmhal/ port, 928 in unix/.
* py: Change nlr_jump to nlr_raise, to aid in debugging.Damien George2014-04-05
| | | | | | This does not affect code size or performance when debugging turned off. To address issue #420.
* py: Replace mp_const_stop_iteration object with MP_OBJ_NULL.Damien George2014-03-26
|
* py: Clean up includes.xbe2014-03-17
| | | | Remove unnecessary includes. Add includes that improve portability.
* Implement proper exception type hierarchy.Damien George2014-02-15
| | | | | | | | | | | | | | Each built-in exception is now a type, with base type BaseException. C exceptions are created by passing a pointer to the exception type to make an instance of. When raising an exception from the VM, an instance is created automatically if an exception type is raised (as opposed to an exception instance). Exception matching (RT_BINARY_OP_EXCEPTION_MATCH) is now proper. Handling of parse error changed to match new exceptions. mp_const_type renamed to mp_type_type for consistency.
* Replace global "static" -> "STATIC", to allow "analysis builds". Part 2.Paul Sokolovsky2014-02-12
|
* Make mp_obj_str_get_data return char* instead of byte*.Damien George2014-02-08
| | | | | Can't decide which is better for string type, char or byte pointer. Changing to char removes a few casts. Really need to do proper unicode.
* file.readline(): Use mp_obj_str_get_data() and fix off-by-one error on EOF.Paul Sokolovsky2014-01-22
|
* Second stage of qstr revamp: uPy str object can be qstr or not.Damien George2014-01-22
|
* Merge branch 'master' of github.com:micropython/micropythonDamien George2014-01-21
|\ | | | | | | | | | | | | | | | | Conflicts: py/objstr.c py/py.mk py/stream.c unix/main.c unix/socket.c
| * stream_read(): Shrink memory block to actual read size.Paul Sokolovsky2014-01-20
| |
| * stream: Add generic unbuffered iternext method.Paul Sokolovsky2014-01-20
| | | | | | | | Uses stream_unbuffered_readline underline.
* | Revamp qstrs: they now include length and hash.Damien George2014-01-21
|/ | | | | Can now have null bytes in strings. Can define ROM qstrs per port using qstrdefsport.h
* Change int to uint for n_args in function with variable arguments.Damien George2014-01-19
|
* Make file.read() and file.read(-1) call out to file.readall().Paul Sokolovsky2014-01-16
| | | | Per Python3 io module semantics.
* Do not assume that vstr buf is the same after it was extended.Paul Sokolovsky2014-01-16
|
* Add unbuffered readline() implementation for Raw I/O files.Paul Sokolovsky2014-01-15
|
* Add generic impl of stream .readall() method. Use one for unix io.FileIO.Paul Sokolovsky2014-01-13
|
* py: add variable argument exception constructor function.Damien George2014-01-08
| | | | Addresses issue #104.
* Add generic implementations of Python read()/write methods for streams.Paul Sokolovsky2014-01-08
These can be used for any object which implements stream protocol (mp_stream_p_t).