Commit Graph

111 Commits

Author SHA1 Message Date
Damien George 0b2a60acbe windows: Prefix includes with py/; remove need for -I../py. 2015-01-01 21:21:46 +00:00
stijn 8422cac088 msvc: Support py/*.h includes per #1022 2015-01-01 13:10:54 +01:00
Paul Sokolovsky 3b74c91684 Makefiles: Support py/*.h includes per #1022. 2014-12-27 16:32:52 +02:00
stijn f5efefd5a0 windows: Correctly interpret skipped tests, enable uhashlib and ubinascii 2014-12-20 16:52:22 +02:00
Damien George 78d702c300 py: Allow builtins to be overridden.
This patch adds a configuration option (MICROPY_CAN_OVERRIDE_BUILTINS)
which, when enabled, allows to override all names within the builtins
module.  A builtins override dict is created the first time the user
assigns to a name in the builtins model, and then that dict is searched
first on subsequent lookups.  Note that this implementation doesn't
allow deleting of names.

This patch also does some refactoring of builtins code, creating the
modbuiltins.c file.

Addresses issue #959.
2014-12-09 16:19:48 +00:00
Damien George 1f8a2f6623 windows: define __USE_MINGW_ANSI_STDIO for all Windows compilers. 2014-12-06 19:51:30 +00:00
stijn b89eaaa2e2 windows: Update config with latest features
- update mpconfigport.h to reflect latest unix version
- fix compilation error in modure due to msvc not allowing dynamic arrays
2014-11-21 19:38:33 +00:00
Paul Sokolovsky 91386eee26 ports: Define mp_off_t. 2014-11-17 00:16:14 +02:00
stijn 4e54c876a7 Add -Wpointer-arith flag to prevent problems with pointer arithmetic on void* 2014-10-29 10:29:09 +01:00
Paul Sokolovsky e6c5a63fab windows: Enable moduzlib instead of modzlibd. 2014-10-13 14:12:32 +03:00
Paul Sokolovsky 5d328cbeb9 windows: mingw32 gcc doesn't define endianness macros, so just assume little.
Specifically, at least Ubuntu's i586-mingw32msvc-gcc doesn't supply
__LITTLE_ENDIAN__ and friends. And as it's safe enough to assume that
Windows is only little-endian, then it's defined unconditionally,
instead of duplicating detection logic in py/mpconfig.h (or adding
windows-specific defines to it).
2014-10-06 23:18:59 +03:00
stijn a2f9c9445a Enable unicode for Windows port so unicode tests give correct uPy output 2014-10-04 09:16:20 +02:00
stijn 8c41920a90 windows: Enable input(), sys.maxsize(), ujson module, emergency exception buf, os module 2014-09-22 11:10:27 +02:00
stijn 759138caee msvc: Exclude modtermios, include extmod and fix compilation error 2014-09-02 09:00:20 +02:00
Damien George 3c658a4e75 py: Fix bug where GC collected native/viper/asm function data.
Because (for Thumb) a function pointer has the LSB set, pointers to
dynamic functions in RAM (eg native, viper or asm functions) were not
being traced by the GC.  This patch is a comprehensive fix for this.

Addresses issue #820.
2014-08-24 16:28:17 +01:00
stijn 8cce8b7c4c msvc: Use built-in alignof
This also fixes a 'unnamed type definition in parentheses' warning on the
alignof implementation define in binary.c
2014-08-13 10:19:56 +02:00
Damien George 40f3c02682 Rename machine_(u)int_t to mp_(u)int_t.
See discussion in issue #50.
2014-07-03 13:25:24 +01:00
stijn ec6fa8732b windows: Sync mpconfigport.h with the unix' version
- 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
2014-06-29 09:40:20 +02:00
stijn 8abcf666cb windows: Enable GC and implement bss start and end symbols
The pointers to the bss section are acquired in init.c()
by inspecting the PE header. Works for msvc and mingw.
2014-06-22 11:31:16 +02:00
Damien George 26a95ae1e7 windows: Move include of malloc.h outside #ifdef msvc. 2014-06-08 13:50:57 +01:00
Damien George 4480cb3711 Provide definition of alloca() in mpconfigport.h. 2014-06-08 13:25:33 +01:00
Marcus von Appen 0c90eb1658 - FreeBSD provides alloca() via stdlib.h, in contrast to Linux and Windows
- Move the includes for alloca() intp mpconfigport.h
2014-06-07 09:36:04 +02:00
Damien George fb510b3bf9 Rename bultins config variables to MICROPY_PY_BUILTINS_*.
This renames:
MICROPY_PY_FROZENSET -> MICROPY_PY_BUILTINS_FROZENSET
MICROPY_PY_PROPERTY -> MICROPY_PY_BUILTINS_PROPERTY
MICROPY_PY_SLICE -> MICROPY_PY_BUILTINS_SLICE
MICROPY_ENABLE_FLOAT -> MICROPY_PY_BUILTINS_FLOAT

See issue #35 for discussion.
2014-06-01 13:32:54 +01:00
stijn 48d641e41a msvc: Only update generated headers when there are changes
This fixes generating the headers casuing complete rebuilds,
even when the headere's content didn't really change.
2014-05-28 16:03:38 +02:00
stijn 34c24a0fc2 windows: Complete rename of MICROPY_PATH_MAX to MICROPY_ALLOC_PATH_MAX (58ebde4) 2014-05-27 14:35:56 +02:00
Damien George ee3fd46f13 Rename configuration variables controling Python features.
Now of the form MICROPY_PY_*.  See issue #35.
2014-05-24 23:03:12 +01:00
Damien George 58ebde4664 Tidy up some configuration options.
MP_ALLOC_* -> MICROPY_ALLOC_*
MICROPY_PATH_MAX -> MICROPY_ALLOC_PATH_MAX
MICROPY_ENABLE_REPL_HELPERS -> MICROPY_HELPER_REPL
MICROPY_ENABLE_LEXER_UNIX -> MICROPY_HELPER_LEXER_UNIX
MICROPY_EXTRA_* -> MICROPY_PORT_*

See issue #35.
2014-05-21 20:32:59 +01:00
stijn 32acd4b9f1 windows: Fix compilation with mingw-w64 so it uses correct printf implementations
Without this flag, mingw-w64 uses the MS implementations of snpintf and the likes.
This is not really a problem since they work with the the fixes provided for msvc,
but due to the way mingw-w64's stdio.h is structured we cannot get it to use the fixes.
2014-05-20 12:14:28 +02:00
stijn b9d8091d0e windows: Enable frozen set and sys.exit 2014-05-11 19:26:36 +02: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
stijn 01d6be4d51 Windows MSVC port
Extend the windows port so it compiles with the toolchain from Visual Studio 2013
2014-05-08 10:06:43 +02:00
stijn 951335e102 windows: Fix input.c missing in Makefile after changes for #582 2014-05-07 21:15:00 +02:00
stijn 3ce10935f0 windows: Enable math module 2014-05-07 12:39:02 +02: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 3a01840390 windows: Argument to () function should be (void). 2014-05-03 22:43:58 +01:00
stijn 72521a1c17 mingw: Fix number of exponent digits in floating point formatting
By default mingw outputs 3 digits instead of the standard 2 so all float
tests using printf fail. Using setenv at the start of the program fixes this.
To accomodate calling platform specific initialization a
MICROPY_MAIN_INIT_FUNC macro is used which is called in mp_init()
2014-05-03 20:15:15 +02: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
Paul Sokolovsky 5ee1e0f534 windows: alloca.h: Add comment, fix line endings. 2014-05-03 14:42:39 +03:00
Paul Sokolovsky 7a14022604 Merge pull request #552 from stinos/mingw-alloca
py: Use <alloca.h> for alloca()
2014-05-03 14:39:47 +03:00
stijn 5513194273 mingw: Add 'open' as extra builtin and add define MICROPY_MOD_SYS_STDFILES
This one was probable missed when creating mpconfigport.h, but the underlying
code (file.c) gets compiled and works perfectly so no reason to omit it.
2014-05-03 10:46:21 +02:00
stijn 98e2ee0ec1 py: Use <alloca.h> for alloca()
alloca() is declared in alloca.h which als happens to be included by stdlib.h.
On mingw however it resides in malloc.h only.
So if we include alloca.h directly, and add an alloca.h for mingw in it's port
directory we can get rid of the mingw-specific define to include malloc.h
and the other ports are happy as well.
2014-05-03 10:14:53 +02:00
Paul Sokolovsky 6c94abe347 windows/README: Use CROSS_COMPILE instead of CC to cover other tools too.
Suggested by @lurch.
2014-04-23 20:45:53 +03:00
Paul Sokolovsky 521de04ce2 windows: Add README with basic cross-compile instructions. 2014-04-20 22:35:11 +03:00
Paul Sokolovsky 7f7c7aa76a windows: Unbreak mingw32 build (cross-compiling under Linux). 2014-04-20 22:24:44 +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
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
Damien George 094ebef259 windows: Use most of the source files from unix/ port.
To keep it maintainable, windows port now uses as much as possible from
unix port.  Maybe could even use mpconfigport.h.
2014-04-08 13:25:47 +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 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 6c6f9d6782 windows: Make it compile with latest changes to py core. 2014-04-07 13:20:06 +01:00
Damien George 15d18069c5 py: Remove old "run time" functions that were 1 liners. 2014-03-31 16:28:13 +01:00
Damien George d17926db71 Rename rt_* to mp_*.
Mostly just a global search and replace.  Except rt_is_true which
becomes mp_obj_is_true.

Still would like to tidy up some of the names, but this will do for now.
2014-03-30 13:35:08 +01: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 19438fd30a windows: Change MICROPY_FLOAT config to new scheme. 2014-03-13 00:36:34 +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 0c59db1973 Use qstr id to create sys module. 2014-02-04 19:36:00 +02:00
Markus Siemens 7e0dee0cbf windows: Make windows/main.c independent from unix/main.c
Up to know changes unix/main.c were able to break the windows
build because windows/main.c simply included unix/main.c.

Now windows/main.c stands on it's own and won't break if
unix/main.c changes.
2014-01-30 17:13:16 +01:00
Markus Siemens 19ccc6bdc7 Added Windows port (see #233) 2014-01-28 18:21:05 +01:00