Commit Graph

27 Commits

Author SHA1 Message Date
Paul Sokolovsky 8775caf9f1 modffi: Add .addr() method to just get symbol address. 2015-02-06 00:19:43 +02:00
Damien George e37dcaafb4 py: Allow to properly disable builtin "set" object.
This patch makes MICROPY_PY_BUILTINS_SET compile-time option fully
disable the builtin set object (when set to 0).  This includes removing
set constructor/comprehension from the grammar, the compiler and the
emitters.  Now, enabling set costs 8168 bytes on unix x64, and 3576
bytes on stmhal.
2014-12-27 17:33:30 +00:00
Paul Sokolovsky 9c658b6afc unix, windows: Add _os.system() call.
system() is the basic function to support automation of tasks, so have it
available builtin, for example, for bootstrapping rest of micropython
environment.
2014-12-23 12:56:24 +00:00
Paul Sokolovsky 9d944c7fb2 unix: Rename "time" module to "utime" to allow extensibility.
Name choosen per latest conventions and for compatibiity with stmhal port.
2014-12-17 00:13:32 +02:00
Nikita Nazarenko d51107927d unix: add unlink function to os module 2014-12-10 21:49:24 +00:00
Paul Sokolovsky 23b3b04072 unix: Rename "microsocket" module to "usocket".
Per new conventions, we'd like to consistently use "u*" naming conventions
for modules which don't offer complete CPython compatibility, while offer
subset or similar API.
2014-10-09 20:43:10 +03:00
Paul Sokolovsky 4f9ebade60 modtermios: Add "termios" unix module, subset of CPython's.
Also provides setraw() function from "tty" module (which in CPython is
implemented in Python). The idea here is that 95% of "termios" module usage
is to set raw mode to allow access to normal serial devices. Then, instead
of exporting gazillion termios symbols, it's better to implement it in C,
and export minimal number of symbols (mostly baud rates and drain values).
2014-08-23 06:09:46 +03:00
Paul Sokolovsky 122c9db3db unix: file: Implement .flush() method.
This method apparently should be part of stream interface.
2014-07-13 23:14:24 +03:00
Paul Sokolovsky 0c124c3123 unix: Add "_os" module with stat().
stat() is bad function to use using FFI, because its ABI is largely private.
To start with, Glibc .so doesn't even have "stat" symbol. Then, layout of
struct stat is too implementation-dependent. So, introduce _os to deal
with stat() and other similar cases.
2014-05-14 22:08:45 +03:00
Dave Hylands 117c46d9eb Add input command for unix 2014-05-07 07:19:51 -07:00
Damien George 04b9147e15 Add license header to (almost) all files.
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/.
2014-05-03 23:27:38 +01:00
Paul Sokolovsky 27f5bdd6d4 py: "read" & "write" are so common that make them core.
Few other strings move to core, but make depend on "io" module.
2014-04-26 21:15:56 +03:00
Paul Sokolovsky 9fd02e186d modsocket: Add setblocking() method. 2014-04-20 13:08:33 +03:00
Paul Sokolovsky 4abaa1b12b unix modffi: Convert to static module structures. 2014-04-18 00:05:27 +03:00
Paul Sokolovsky e1e4249a67 unix modsocket: Convert to static module structures. 2014-04-17 20:34:04 +03:00
Paul Sokolovsky eb2fc9787a unix modtime: Convert to static module structures. 2014-04-17 20:27:01 +03:00
Paul Sokolovsky a3e50eacca py: Move sys attribute qstrs's to core. 2014-04-13 07:02:57 +03:00
Paul Sokolovsky 72d70cb045 unix, stmhal: Consistently use "FileIO" as class name for file objects.
They correspond to io.FileIO in io module hierarchy (with small caveat
that io.FileIO is raw file and works with bytes, not strings).
2014-04-08 04:08:16 +03:00
Damien George 27e735fd18 py: Replace stream_p with *stream_p in mp_obj_type_t.
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/.
2014-04-05 23:02:23 +01:00
Damien George 918638ec6e unix: Fix ffi.c to compile with latest changes to API. 2014-03-29 13:48:32 +00:00
Damien George c12b2213c1 Change mp_method_t.name from const char * to qstr.
Addresses issue #377.
2014-03-26 20:15:40 +00:00
Damien George c5966128c7 Implement proper exception type hierarchy.
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.
2014-02-15 16:10:44 +00:00
Damien George a71c83a1d1 Change mp_obj_type_t.name from const char * to qstr.
Ultimately all static strings should be qstr.  This entry in the type
structure is only used for printing error messages (to tell the type of
the bad argument), and printing objects that don't supply a .print method.
2014-02-15 11:34:50 +00:00
Paul Sokolovsky 9945f33886 Rename "rawsocket" module to "microsocket".
It's no longer intended to provide just "raw" socket interface, may include
some convenience methods for compatibility with CPython socket - but anyway
just minimal set required to deal with socket client and servers, not wider
network functionality.
2014-02-08 21:20:32 +02:00
Paul Sokolovsky 0c59db1973 Use qstr id to create sys module. 2014-02-04 19:36:00 +02:00
Damien George 12eaccacda Merge branch 'master' of github.com:micropython/micropython
Conflicts:
	py/objstr.c
	py/py.mk
	py/stream.c
	unix/main.c
	unix/socket.c
2014-01-21 21:54:15 +00:00
Damien George 55baff4c9b Revamp qstrs: they now include length and hash.
Can now have null bytes in strings.  Can define ROM qstrs per port using
qstrdefsport.h
2014-01-21 21:40:13 +00:00