Damien George
63436ce22e
unix, Mac support: Generate order.def via Makefile.
2014-05-21 19:56:54 +01:00
Damien George
0fd01683c6
Merge pull request #607 from Anton-2/osx-clang
...
Allow compilation of unix port under clang on OS X
2014-05-21 19:51:05 +01:00
Paul Sokolovsky
9e29666bf9
py: Implement proper separation between io.FileIO and io.TextIOWrapper.
...
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.
2014-05-19 21:56:07 +03:00
Paul Sokolovsky
767e45c290
modos: Clean 64-bit issues.
2014-05-15 18:38:54 +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
Damien George
f6e430f77f
Merge pull request #600 from stinos/unix-exitcode
...
unix: Use standard return codes for main
2014-05-13 22:39:35 +01:00
Paul Sokolovsky
da9f0924ef
py, unix: Add copyright for modules I worked closely on.
2014-05-13 18:41:25 +03:00
Damien George
cc97446ca5
unix: Implement -O option to turn off __debug__ flag.
2014-05-12 23:14:52 +01:00
Damien George
96f137b24a
py: Rename BYTE_CODE to BYTECODE (this was missed in previous rename).
2014-05-12 22:35:37 +01:00
stijn
f42dbb98d1
unix: Fix linker errors when time/ffi modules are disabled
...
When disabling these via mpconfigport.mk or on the commandline,
the correspoding build options are not set and the sources are not
built so the modules should not be added to the
MICROPY_EXTRA_BUILTIN_MODULES list since they are undefined.
2014-05-13 00:03:24 +03:00
Antonin ENFRUN
da1fffaa09
Fix some unused variables, and silence a clang warning about initialization override in vmentrytable.h
2014-05-12 09:06:18 +02:00
Antonin ENFRUN
ceac71f1f5
unix: Add asm statements needed to read registers with clang. Code generated by gcc 4.9.0 is unchanged (same statements, different order).
...
Both are inefficient, saving unmodified registers on the stack.
2014-05-12 09:06:18 +02:00
Antonin ENFRUN
6caae0bcb1
unix: Create __bss_start and _end symbols for Mach-O targets.
...
It's a hack, but can't find a cleaner way to do it.
2014-05-12 00:13:10 +02:00
stijn
9e040b7cd8
unix: Use standard return codes for main
...
As in the CPython manual: "Unix programs generally use 2 for
command line syntax errors and 1 for all other kind of errors"
2014-05-11 19:23:30 +02:00
Damien George
89755ae67f
py: Rename MICROPY_SYS_EXIT to MICROPY_MOD_SYS_EXIT.
...
For consistency with MICROPY_MOD_SYS_STDFILES, etc.
2014-05-11 17:35:43 +01:00
Damien George
bd651d1a67
Merge pull request #597 from stinos/mingw-compilation
...
mingw: Fix compilation issues
2014-05-11 15:06:26 +01:00
Paul Sokolovsky
deaeaac469
modsys: Enable sys.exit() per port after all.
2014-05-10 17:26:47 +03:00
Paul Sokolovsky
d99e9083cb
modsys, unix: Add sys.exit(), should be implemented by a port.
2014-05-10 16:56:21 +03:00
Paul Sokolovsky
d80e2476c7
py: Disable frozenset by default, enable on unix.
...
Takes 416 text bytes on x86.
2014-05-10 16:56:20 +03:00
stijn
f45a83d7fc
mingw: Fix compilation issues
...
- use lowercase windows.h
- fix for mingw32 using preprocessor-unfriendly definition of CLOCKS_PER_SEC
2014-05-10 10:42:40 +02:00
stijn
5ed284a15e
windows: Add modtime implementation
2014-05-09 13:58:15 +02:00
Damien George
7c6c843965
unix: Add missing stdio.h header for readline.
2014-05-07 15:33:15 +01:00
Dave Hylands
117c46d9eb
Add input command for unix
2014-05-07 07:19:51 -07:00
Paul Sokolovsky
0ef015b253
stream: Make non-blcoking stream support configurable.
...
Enable only on unix. To avoid unpleasant surprises with error codes.
2014-05-07 02:25:45 +03:00
Paul Sokolovsky
6c62e7257f
unix modsocket: Add comments re: recv() vs read(), etc. semantics.
2014-05-07 02:17:14 +03:00
Paul Sokolovsky
f9e54e0ea5
modgc: Add new module for GC-related functionality.
2014-05-06 02:28:49 +03:00
Paul Sokolovsky
6b344d7816
py, unix: Add -v option, print bytecode dump if used.
...
This will work if MICROPY_DEBUG_PRINTERS is defined, which is only for
unix/windows ports. This makes it convenient to user uPy normally, but
easily get bytecode dump on the spot if needed, without constant recompiles
back and forth.
TODO: Add more useful debug output, adjust verbosity level on which
specifically bytecode dump happens.
2014-05-05 00:57:00 +03:00
Damien George
c327c0de5d
unix: Remove test class and code.
2014-05-04 12:24:26 +01: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
Damien George
d5f5b2f766
py, stream: Implement readlines for a stream.
2014-05-03 22:01:32 +01:00
Damien George
6ec835dfef
Don't print git hash as well as git tag in banner.
2014-05-03 19:08:02 +01:00
Damien George
1549f17038
Merge branch 'master' of github.com:micropython/micropython
2014-05-03 19:02:47 +01:00
Damien George
977a0ce287
py: Print tag/version/git describe in uPy banner.
2014-05-03 19:02:14 +01:00
Paul Sokolovsky
fb9ca7c3aa
Merge pull request #554 from stinos/mingw-realpath
...
mingw: Add implementation of realpath()
2014-05-03 21:01:34 +03:00
Damien George
e69b7e8288
unix, file.c: adhere to coding conventions.
2014-05-03 17:04:31 +01:00
stijn
4cd21deebc
mingw: Add implementation of realpath()
...
The mingw port used _fullpath() until now, but the behaviour is not exactly
the same as realpath()'s on unix; major difference being that it doesn't
return an error for non-existing files, which would bypass main's error
checking and bail out without any error message.
Also realpath() will return forward slashes only since main() relies on that.
2014-05-03 17:38:08 +02:00
stijn
a89e93e050
CPython compatibility: raise an error for operations on a closed file descriptor
...
In CPython any operations on a file that has been closed already reaises
a ValueError with message "I/O operation on closed file"
2014-05-03 14:05:56 +02:00
Paul Sokolovsky
9b71b16a94
unix,stmhal: Make "mpconfig.h" be first included, as other headers depend on it.
2014-05-02 18:08:16 +03:00
Paul Sokolovsky
f54bcbf099
py, unix: Make "mpconfig.h" be first included, as other headers depend on it.
...
Specifically, nlr.h does.
2014-05-02 17:48:40 +03:00
Paul Sokolovsky
1f85d6255d
py: Add tentative scheme for error messages configuration.
2014-05-01 01:50:35 +03: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
Damien George
6d3c5e4301
Add ARRAY_SIZE macro, and use it where possible.
2014-04-26 10:47:29 +01:00
Paul Sokolovsky
12a9cfed76
modsocket: Make .send() support arbitrary objects with buffer interface.
...
This is CPython-compliant (except that CPython doesn't support buffer
protocol for str).
2014-04-26 05:54:22 +03:00
Paul Sokolovsky
fa6f0506c1
unix: Workaround MP_OBJ_NEW_SMALL_INT() 64-bit issues.
2014-04-22 00:16:46 +03:00
Paul Sokolovsky
5d3a830171
modsocket: Clean up OSError-like exception a bit.
...
Some BSD socket functions don't return error numbers in errno namespace, but
rather in other error namespaces. CPython resolves this by using OSError
subclasses for them. We don't do that so far, so there's ambiguity here.
2014-04-22 00:02:51 +03:00
Paul Sokolovsky
acb13886fc
unix: OSError's args[0] should be errno numeric value.
...
Well, Python3 also defines an attribute for that, but that's bloat.
2014-04-22 00:02:51 +03:00
Paul Sokolovsky
b418b6fb0d
modffi: Don't use OSError for clearly unrelated errors.
2014-04-22 00:02:51 +03:00
Paul Sokolovsky
88972b0d94
modffi: Describe typecodes where they differ from used by struct module.
...
Exact behavior of typecodes may be not yet enforced.
2014-04-22 00:02:51 +03:00
Damien George
c7d2b10b85
Merge pull request #513 from errordeveloper/misc_fix/modffi_pkg_config
...
modffi: Fix how we call `pkg-config`
2014-04-21 01:22:27 +01:00
Paul Sokolovsky
a196d08dfc
unix windows: mingw32 doesn't have realpath(), use _fullpath() instead.
2014-04-20 22:24:44 +03:00
Paul Sokolovsky
1f2ca1c1f9
unix file: mingw32 has STDIN_FILENO and friends in stdio.h .
...
TODO: Never "optimize" includes any more!
2014-04-20 22:24:44 +03:00
Paul Sokolovsky
b76fd842f0
unix mem_info(): Dump GC info only if it's enabled.
2014-04-20 22:24:43 +03:00
Paul Sokolovsky
9fd02e186d
modsocket: Add setblocking() method.
2014-04-20 13:08:33 +03:00
Ilya Dmitrichenko
8e998ed280
modffi: Fix how we call pkg-config
2014-04-20 09:30:46 +01:00
Paul Sokolovsky
9ae0912496
modffi: Update for MP_OBJ_STOP_ITERATION refactor.
2014-04-19 20:05:47 +03:00
Paul Sokolovsky
752d2080b7
modffi: Mark 'p' type spec deprecated, replace with 'P'.
...
'p' in struct module is "pascal string". 'P' is void*.
2014-04-19 03:18:14 +03:00
Damien George
b11b85adaa
py: Allow to pass buffer protocol flags to get_buffer helper funcs.
2014-04-18 22:59:24 +01:00
Damien George
738bdeb73a
unix: Update to use new buffer protocol interface with typecode.
2014-04-18 22:31:24 +01:00
Damien George
5b65f0c7d3
py: Rename USE_COMPUTED_GOTOS to USE_COMPUTED_GOTO and enable on stmhal.
...
On stmhal, computed gotos make the binary about 1k bigger, but makes it
run faster, and we have the room, so why not. All tests pass on
pyboard using computed gotos.
2014-04-17 23:24:13 +01: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
59a2f4828d
unix: Make mem_info() dump GC info too.
...
mem_info() is already pretty hacky, let it be more hacky.
2014-04-17 20:27:01 +03:00
Paul Sokolovsky
eb2fc9787a
unix modtime: Convert to static module structures.
2014-04-17 20:27:01 +03:00
Paul Sokolovsky
de8292202e
unix modtime: Adhere to MICROPY_ENABLE_FLOAT better.
2014-04-17 20:27:00 +03:00
Damien George
d553be5982
build: Simplify build directory layout by putting all headers in genhdr.
...
Any generated headers go in $(BUILD)/genhdr/, and are #included as
'genhdr/xxx.h'.
2014-04-17 18:03:27 +01:00
Damien George
2d1f865d16
Merge branch 'relocatable-build-dir' of github.com:lurch/micropython into lurch-relocatable-build-dir
2014-04-17 17:44:52 +01:00
Damien George
594d0ddbb2
Merge pull request #505 from lurch/patch-5
...
Add 'test' target to unix/Makefile
2014-04-17 17:24:42 +01:00
Damien George
5f82b50324
Merge branch 'master' of github.com:micropython/micropython
2014-04-17 17:11:58 +01:00
Damien George
dbdfee15a1
py: Add cmath module, for complex math. Disabled by default.
...
Not all functions implemented. Not enabled on pyboard.
2014-04-17 17:11:03 +01:00
Paul Sokolovsky
f200c30d53
modffi: Support float types.
2014-04-17 03:38:45 +03:00
Andrew Scheller
e02b77bf6b
Updated the envvar used by ./run-tests
...
As discussed in #504
2014-04-17 01:26:25 +01:00
Andrew Scheller
70a7d7a943
build directory can now be renamed
...
The autogenerated header files have been moved about, and an extra
include dir has been added, which means you can give a custom
BUILD=newbuilddir option to make, and everything "just works"
Also tidied up the way the different Makefiles build their include-
directory flags
2014-04-16 22:16:28 +01:00
Andrew Scheller
d5ce916f26
Add 'test' target to unix/Makefile
...
In conjunction with #504 this allows you to do things like:
```shell
make -C unix clean && make -C unix test CC=gcc-4.7
```
all from the top-level micropython directory :-)
Something similar could probably be done for windows/Makefile too, but I don't have a cygwin setup to test with.
2014-04-16 20:38:16 +01:00
Andrew Scheller
571d5a3363
New config option MICROPY_FORCE_32BIT (defaulted to 0)
...
Makes it easier for 64-bit unix hosts to build 32-bit unix
binaries (for testing)
2014-04-16 01:46:01 +01:00
AZ Huang
9309d9982f
Move entry_table to separated header file.
2014-04-15 17:08:42 +08:00
Damien George
3bb8bd899b
Make USE_COMPUTED_GOTO a config option in mpconfig.h.
...
Disabled by default. Enabled in unix port.
2014-04-14 21:20:30 +01:00
AZ Huang
b1f692e82e
Use computed goto instead of switching op-codes.
2014-04-15 02:40:28 +08:00
Damien George
777b0f32f4
py: Add property object, with basic functionality.
...
Enabled by MICROPY_ENABLE_PROPERTY.
2014-04-13 18:59:45 +01:00
Paul Sokolovsky
4165cd1c0c
stmhal: Update for static mod sys.
2014-04-13 07:02:57 +03:00
Paul Sokolovsky
a3e50eacca
py: Move sys attribute qstrs's to core.
2014-04-13 07:02:57 +03:00
Paul Sokolovsky
5500cdeec7
py, unix: Convert sys module to static representation.
2014-04-13 07:02:56 +03:00
Paul Sokolovsky
9a092831f7
unix: Enable modffi by default.
...
ffi is needed to use micropython-lib, so let's have it enabled by default,
then folks who have troubles with libffi can disable it, instead of everyone
doing manual actions again and again.
2014-04-13 00:01:40 +03:00
xbe
a36a55d2cf
unix: Update comment in gccollect.c
2014-04-11 06:42:17 -07:00
Paul Sokolovsky
263853ef84
modffi: Update for latest binary API refactors.
2014-04-11 05:17:41 +03:00
Damien George
f22626ee4f
unix: Add option to only compile, and not execute code.
2014-04-10 11:30:35 +01:00
Paul Sokolovsky
3aa8ee7c9e
py: Add mp_get_buffer(), mp_get_buffer_raise() convenience functions to API.
2014-04-09 01:07:37 +03:00
Paul Sokolovsky
f898a95cba
unix modffi: Support any object implementing buffer protocol as a native arg.
2014-04-08 19:08:34 +03:00
Damien George
72cfc6ef0a
unix: Oops, remove nlr_jump test in main.
2014-04-08 15:10:21 +01:00
Damien George
26cf55ae05
Add a check for NULL nlr_top in nlr_jump.
...
If no nlr_buf has been pushed, and an nlr_jump is called, then control
is transferred to nlr_jump_fail (which should bail out with a fatal
error).
2014-04-08 14:08:14 +00:00
Damien George
97790455fe
Improve REPL detecting when input needs to continue.
...
Full CPython compatibility with this requires actually parsing the
input so far collected, and if it fails parsing due to lack of tokens,
then continue collecting input. It's not worth doing it this way. Not
having compatibility at this level does not hurt the goals of Micro
Python.
2014-04-08 11:04:29 +00: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
Paul Sokolovsky
b8cf948550
unix, windows: There's no "help" builtin.
2014-04-08 04:07:02 +03:00
Damien George
6827f9fc55
Add uPy welcome message to UNIX and Windows ports; update Teensy port.
...
Partly addresses issue #154 .
2014-04-07 13:27:50 +01:00
Damien George
65cad12d38
py: Add option to compiler to specify default code emitter.
...
Also add command line option to unix port to select emitter.
2014-04-06 11:48:15 +01: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
7efc5b3f34
py: Make globals and locals proper dictionary objects.
...
Finishes addressing issue #424 .
In the end this was a very neat refactor that now makes things a lot
more consistent across the py code base. It allowed some
simplifications in certain places, now that everything is a dict object.
Also converted builtins tables to dictionaries. This will be useful
when we need to turn builtins into a proper module.
2014-04-05 22:36:42 +01:00
Damien George
12bab72d93
Improve GC finalisation code; add option to disable it.
2014-04-05 20:35:48 +01:00
Damien George
ea13f407a3
py: Change nlr_jump to nlr_raise, to aid in debugging.
...
This does not affect code size or performance when debugging turned off.
To address issue #420 .
2014-04-05 18:32:08 +01:00
Paul Sokolovsky
c39368427c
unix: Rename module sources per latest naming conventions (mod*.c).
2014-04-04 20:34:10 +03:00
Paul Sokolovsky
cd31d826bf
unix: Use STATIC modifier to enable code size analysis via map file.
2014-04-04 20:34:02 +03:00