Commit Graph

82 Commits

Author SHA1 Message Date
stijn
3179d23cee windows: Make unistd.h more posix compatible
- add SEEK_XXX definitions, this fixes missing definition in py/stream.c
- move R_OK from realpath.c and add W_OK/F_OK defintions
- move STDXXX_FILENO definitions from mpconfigport for consistency
2015-08-14 12:04:23 +02:00
Paul Sokolovsky
9724a0538b windows/README: Add notes on running under Wine.
After enabling line editing support on Windows console, this is no longer
trivial.
2015-06-04 19:29:51 +03:00
stijn
87ad80edf9 windows: Implement the mp_hal_xxx functions and enable mp-readline 2015-06-04 19:22:13 +03:00
Damien George
4a10214be2 unix: Factor out stdio and ctrl-C code to unix_mphal.c file. 2015-05-27 15:52:35 +01:00
stijn
861670ba2a py: Implement mp_format_float for doubles and use where appropriate
This allows using (almost) the same code for printing floats everywhere,
removes the dependency on sprintf and uses just snprintf and
applies an msvc-specific fix for snprintf in a single place so
nan/inf are now printed correctly.
2015-05-17 21:47:11 +01:00
stijn
a09757f104 windows: Enable some recently added features in mpconfigport.h 2015-05-13 16:26:16 +01:00
stijn
a62c106974 msvc: Allow overriding of build options with custom file
- by default look for a user.props in the msvc directory, which is more convenient
  than the built-in way of looking for such file in the user's home directory
- make git ignore the file
2015-04-30 10:14:59 +02:00
Damien George
95f53461c2 py: Replace py-version.sh with makeversionhdr.py, written in Python.
Also rename py-version.h to mpversion.h for consistency with mpconfig.h.
2015-04-28 23:52:36 +01:00
stijn
c52f1258a8 msvc: Update genhdr script to emit MicroPython version numbers 2015-04-22 12:07:30 +02:00
Damien George
feff00e1a5 Add .gitattributes file to force text line endings to LF.
Some files are excluded, otherwise a whole lot of files need converting.
2015-04-16 22:23:56 +01:00
Damien George
7f9d1d6ab9 py: Overhaul and simplify printf/pfenv mechanism.
Previous to this patch the printing mechanism was a bit of a tangled
mess.  This patch attempts to consolidate printing into one interface.

All (non-debug) printing now uses the mp_print* family of functions,
mainly mp_printf.  All these functions take an mp_print_t structure as
their first argument, and this structure defines the printing backend
through the "print_strn" function of said structure.

Printing from the uPy core can reach the platform-defined print code via
two paths: either through mp_sys_stdout_obj (defined pert port) in
conjunction with mp_stream_write; or through the mp_plat_print structure
which uses the MP_PLAT_PRINT_STRN macro to define how string are printed
on the platform.  The former is only used when MICROPY_PY_IO is defined.

With this new scheme printing is generally more efficient (less layers
to go through, less arguments to pass), and, given an mp_print_t*
structure, one can call mp_print_str for efficiency instead of
mp_printf("%s", ...).  Code size is also reduced by around 200 bytes on
Thumb2 archs.
2015-04-16 14:30:16 +00:00
stijn
28fa84b445 py: Add optional support for descriptors' __get__ and __set__ methods.
Disabled by default.  Enabled on unix and windows ports.
2015-03-26 23:55:14 +00:00
Damien George
42e0c59308 py: Add MICROPY_COMP_{DOUBLE,TRIPLE}_TUPLE_ASSIGN config options.
These allow to fine-tune the compiler to select whether it optimises
tuple assignments of the form a, b = c, d and a, b, c = d, e, f.
Sensible defaults are provided.
2015-03-14 13:11:35 +00:00
Damien George
d891452a73 py: Add MICROPY_MALLOC_USES_ALLOCATED_SIZE to allow simpler malloc API. 2015-03-03 21:23:13 +00:00
Damien George
5b76e3b75e windows: Enable MICROPY_STACK_CHECK. 2015-01-12 15:34:53 +00:00
Damien George
ddd1e18801 py: Add config option MICROPY_COMP_MODULE_CONST for module consts.
Compiler optimises lookup of module.CONST when enabled (an existing
feature).  Disabled by default; enabled for unix, windows, stmhal.
Costs about 100 bytes ROM on stmhal.
2015-01-10 14:07:24 +00:00
Damien George
a9a0862078 windows: Enable MICROPY_PY_MICROPYTHON_MEM_INFO. 2015-01-09 20:30:26 +00:00
stijn
afd6c8e1d2 Remove obsolete bss-related code/build features
GC for unix/windows builds doesn't make use of the bss section anymore,
so we do not need the (sometimes complicated) build features and code related to it
2015-01-08 15:29:44 +01:00
stijn
51af362e31 msvc: Define no-op MP_LIKELY/UNLIKELY since there's no __builtin_expect 2015-01-04 13:29:02 +02:00
stijn
ffc96a901a msvc: Use single build target for dealing with generated files
Remove some duplication in the code for generating
qstrdefs.generated.h and py-version.h
2015-01-02 16:55:02 +01:00
stijn
8dec62a1a4 msvc: Define main build/include directories in a single location
- Use a single file env.props for defining the main directories used when building.
  env.props resolves the base directory and defines overridable output directories,
  and is used by all other build files.
- Fix the build currently failing, basically because the preprocessing command for generating
  qstrdefs uses different include directories than the build itself does.
  (specifically, qstrdefs.h uses #include "py/mpconfig.h" since the fixes for #1022
  in 51dfcb4, so we need to use the base directory as include directory, not the py dir itself).
  So define a single variable containing the include directories instead and use it where needed.
2015-01-02 16:52:07 +01:00
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