Commit Graph

38 Commits

Author SHA1 Message Date
Damien George cbd2f7482c py: Add module/function/class name to exceptions.
Exceptions know source file, line and block name.

Also tidy up some debug printing functions and provide a global
flag to enable/disable them.
2014-01-19 11:48:48 +00:00
Damien George 8fce5b42a2 Merge pull request #194 from pfalcon/socket
Add lean ("raw") socket module.
2014-01-18 15:34:30 -08:00
Damien George 08335004cf Add source file name and line number to error messages.
Byte code has a map from byte-code offset to source-code line number,
used to give better error messages.
2014-01-18 23:24:36 +00:00
Paul Sokolovsky fc92608237 Add lean ("raw") socket module. 2014-01-19 00:16:39 +02:00
Damien George 4899ff9470 Merge branch 'str-repr' of github.com:pfalcon/micropython into pfalcon-str-repr
Conflicts:
	tests/basics/tests/exception1.py
2014-01-15 22:39:03 +00:00
Damien George 9528cd66d7 Convert parse errors to exceptions.
Parser no longer prints an error, but instead returns an exception ID
and message.
2014-01-15 21:23:31 +00:00
Paul Sokolovsky 76d982ef34 type->print(): Distinguish str() and repr() variety by passing extra param. 2014-01-15 02:15:38 +02:00
Damien George 004cdcebfe py: Implement base class lookup, issubclass, isinstance. 2014-01-09 21:43:51 +00:00
Damien George 062478e66d Improved type/class/instance code; mp_obj_type_t now has load_attr, store_attr.
Creating of classes (types) and instances is much more like CPython now.
You can use "type('name', (), {...})" to create classes.
2014-01-09 20:57:50 +00:00
Paul Sokolovsky e0e79ae6d6 unix: Add basic implementation of io.FileIO object.
Note: only read/write/close methods are defined so far, and class
is not exposed (use open() factory function, as usual).
2014-01-08 17:39:06 +02:00
Damien George 97209d38e1 Merge branch 'cplusplus' of https://github.com/ian-v/micropython into ian-v-cplusplus
Conflicts:
	py/objcomplex.c
2014-01-07 15:58:30 +00:00
Damien George 136f67523b Factor and simplify Makefile's and mpconfig. 2014-01-07 14:54:15 +00:00
ian-v 5fd8fd2c16 Revert MP_BOOL, etc. and use <stdbool.h> instead 2014-01-06 13:51:53 -08:00
ian-v 7a16fadbf8 Co-exist with C++ (issue #85) 2014-01-06 09:52:29 -08:00
Paul Sokolovsky 860ffb0a43 Convert many object types structs to use C99 tagged initializer syntax. 2014-01-05 22:34:09 +02:00
Damien George 71c5181a8d Convert Python types to proper Python type hierarchy.
Now much more inline with how CPython does types.
2014-01-04 20:21:15 +00:00
Paul Sokolovsky d674bd5989 Convert USE_READLINE config option to be consistent with others. 2014-01-04 19:38:19 +02:00
Damien George eb7bfcb286 Split qstr into pools, and put initial pool in ROM.
Qstr's are now split into a linked-list of qstr pools.  This has 2
benefits: the first pool can be in ROM (huge benefit, since we no longer
use RAM for the core qstrs), and subsequent pools use m_new for the next
pool instead of m_renew (thus avoiding a huge single table for all the
qstrs).

Still would be better to use a hash table, but this scheme takes us part
of the way (eventually convert the pools to hash tables).

Also fixed bug with import.

Also improved the way the module code is referenced (not magic number 1
anymore).
2014-01-04 15:57:35 +00:00
Damien George 1fb031744f Change mp_compile so that it returns a function object for the module. 2014-01-03 14:22:03 +00:00
Damien George 66028ab6dc Basic implementation of import.
import works for simple cases.  Still work to do on finding the right
script, and setting globals/locals correctly when running an imported
function.
2014-01-03 14:03:48 +00:00
Edd Barrett 8146aea8ef malloc.h is obsolete. 2014-01-01 23:14:36 +00:00
Paul Sokolovsky fa027672da Make GNU Readline usage optional (USE_READLINE define). Still enabled.
Readline is GPL, so linking with it casts the binary GPL.
2014-01-01 18:28:01 +02:00
Paul Sokolovsky 903b24f041 Add readline history support. 2014-01-01 14:54:39 +02:00
Damien 732407f1bf Change memory allocation API to require size for free and realloc. 2013-12-29 19:33:23 +00:00
Damien b86e3f9293 py: implement some basic exception matching. 2013-12-29 17:17:43 +00:00
Damien d99b05282d Change object representation from 1 big union to individual structs.
A big change.  Micro Python objects are allocated as individual structs
with the first element being a pointer to the type information (which
is itself an object).  This scheme follows CPython.  Much more flexible,
not necessarily slower, uses same heap memory, and can allocate objects
statically.

Also change name prefix, from py_ to mp_ (mp for Micro Python).
2013-12-21 18:17:45 +00:00
Damien 0f08267fa4 unix: include obj.h, and build additional py files. 2013-12-17 18:33:53 +00:00
Damien 087d218d95 Unix: add machine-specific sqrt support. 2013-11-09 20:14:30 +00:00
Damien 014e19fc4d Fix compiler warnings in unix/main.c. 2013-11-03 14:26:21 +00:00
Damien a53f694dc3 Test code for user objects. 2013-11-02 23:58:38 +00:00
Damien 8b3a7c2237 Fix func decls with no arguments: () -> (void). 2013-10-23 20:20:17 +01:00
Damien 92c06561a3 Improve REPL compount statement detection. 2013-10-22 22:32:27 +01:00
Damien fa2162bc77 Integrate new lexer stream with stm framework. 2013-10-20 17:42:00 +01:00
Damien a5185f4bc8 Abstract out back-end stream functionality from lexer. 2013-10-20 14:41:27 +01:00
Damien 5ac1b2efbd Implement REPL. 2013-10-18 19:58:12 +01:00
Damien ce89a21ea4 Implement basic exception framework, and simple for loop. 2013-10-15 22:25:17 +01:00
Damien 3ef4abb446 Change ifdef/if defined to simple if's. 2013-10-12 16:53:13 +01:00
Damien c025ebb2dc Separate out mpy core and unix version. 2013-10-12 14:30:21 +01:00