Emmanuel Blot
f6932d6506
Prefix ARRAY_SIZE with micropython prefix MP_
11 years ago
Damien George
4480cb3711
Provide definition of alloca() in mpconfigport.h.
11 years ago
Paul Sokolovsky
b9b9354e6c
modsys: Add optional support for sys.platform.
Ports which wants to have it, should define MICROPY_PY_SYS_PLATFORM to a
string value they need.
11 years ago
Marcus von Appen
585a3394df
- Cast the struct stat sb.st_ino field to machine_int_t explicitly to avoid a
cast error in MP_OBJ_NEW_SMALL_INT(). This is necessary for FreeBSD, where
st_ino is of different size
- If MP_CLOCKS_PER_SEC is defined on the target host, simply define CLOCK_DIV
as a fraction, regardless of the value of MP_CLOCKS_PER_SEC.
FreeBSD uses a non-POSIX compliant value of 128 for CLOCKS_PER_SEC
11 years ago
Marcus von Appen
0c90eb1658
- FreeBSD provides alloca() via stdlib.h, in contrast to Linux and Windows
- Move the includes for alloca() intp mpconfigport.h
11 years ago
Marcus von Appen
8ffc02495f
- Let the build environment decide about the toolchain to be used, in case
there are special tweaks and paths to be considered. Just provide some
defaults, in case the values are undefined.
- py-version.sh does not need any bash specific features.
- Use libdl only on Linux for now. FreeBSD provides dl*() calls from libc.
11 years ago
Paul Sokolovsky
755a55f507
modgc: Implement return value for gc.collect(), enable on Unix.
11 years ago
stijn
df3ab07994
unix: Fix path seperator used depending on OS
';' is the standard seperator used for paths in environment variables on Windows
11 years ago
Paul Sokolovsky
76c8a4c91b
unix: Add setjmp-based GC register helper implementation.
As I suspected for a long time, for x86, register helper doesn't really make
any difference - there's simply not enough register to keep anything in
them for any prolonged time. Anything gets pushed on stack anyway. So, on
x86, uPy passed all tests even with empty reg helper. So, this setjmp
implementation goes as "untested".
11 years ago
Paul Sokolovsky
d3439d0c60
py: Instead of having "debug on" var, have "optimization level" var.
This allows to have multiple "optimization" levels (CPython has two
(-OO removes docstrings), we can have more).
11 years ago
Paul Sokolovsky
dd0dee3afc
unix: Properly print script filename in case of error.
11 years ago
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.
11 years ago
Paul Sokolovsky
3dfa76cb85
unix: 64-bit cleanness.
11 years ago
Paul Sokolovsky
914bcf16d8
unix: Add poorman's stack usage info to mem_info() dump.
11 years ago
Paul Sokolovsky
347b3a3d1f
modsocket: Add some comments on intended usage/API design of module.
11 years ago
Paul Sokolovsky
50b08c920a
modsocket: Remove stale ifdef.
11 years ago
Paul Sokolovsky
1d567592b1
unix/gccollect.c: Make Clang workaround apply only to it. Unbreaks gcc builds.
11 years ago
Paul Sokolovsky
168a9ce863
Revert "Fix DEBUG=1 builds"
This reverts commit 6e76f7bc90
.
This patch tries to workaround a previous clang workaround. Instead of going
into workaround of workaround spiral, the original workaround should be tamed.
11 years ago
Dave Hylands
6e76f7bc90
Fix DEBUG=1 builds
Without this fix, I get the following error:
CC gccollect.c
gccollect.c: In function ‘gc_helper_get_regs’:
gccollect.c:63:1: error: bp cannot be used in asm here
11 years ago
Paul Sokolovsky
0405b2210d
modos: stat(): Accept bytes argument.
11 years ago
Damien George
2617eebf2f
Change const byte* to const char* where sensible.
This removes need for some casts (at least, more than it adds need
for new casts!).
11 years ago
Damien George
7a4ddd2428
Add SystemExit exception and use it in unix/ and stmhal/ ports.
Addresses issue #598 .
11 years ago
Damien George
ee3fd46f13
Rename configuration variables controling Python features.
Now of the form MICROPY_PY_*. See issue #35 .
11 years ago
Paul Sokolovsky
d0ceb04b90
modsocket: 64-bit cleanness.
11 years ago
Paul Sokolovsky
561789d718
unix modsocket: Make .makefile() method more compliant.
.makefile() should allow to specify which stream time to create - byte
or text.
11 years ago
Damien George
efaef6eea3
unix: Fix casting issue, int to small int object.
11 years ago
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 .
11 years ago
Damien George
63436ce22e
unix, Mac support: Generate order.def via Makefile.
11 years ago
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.
11 years ago
Paul Sokolovsky
767e45c290
modos: Clean 64-bit issues.
11 years ago
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.
11 years ago
Paul Sokolovsky
da9f0924ef
py, unix: Add copyright for modules I worked closely on.
11 years ago
Damien George
cc97446ca5
unix: Implement -O option to turn off __debug__ flag.
11 years ago
Damien George
96f137b24a
py: Rename BYTE_CODE to BYTECODE (this was missed in previous rename).
11 years ago
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.
11 years ago
Antonin ENFRUN
da1fffaa09
Fix some unused variables, and silence a clang warning about initialization override in vmentrytable.h
11 years ago
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.
11 years ago
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.
11 years ago
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"
11 years ago
Damien George
89755ae67f
py: Rename MICROPY_SYS_EXIT to MICROPY_MOD_SYS_EXIT.
For consistency with MICROPY_MOD_SYS_STDFILES, etc.
11 years ago
Paul Sokolovsky
deaeaac469
modsys: Enable sys.exit() per port after all.
11 years ago
Paul Sokolovsky
d99e9083cb
modsys, unix: Add sys.exit(), should be implemented by a port.
11 years ago
Paul Sokolovsky
d80e2476c7
py: Disable frozenset by default, enable on unix.
Takes 416 text bytes on x86.
11 years ago
stijn
f45a83d7fc
mingw: Fix compilation issues
- use lowercase windows.h
- fix for mingw32 using preprocessor-unfriendly definition of CLOCKS_PER_SEC
11 years ago
stijn
5ed284a15e
windows: Add modtime implementation
11 years ago
Damien George
7c6c843965
unix: Add missing stdio.h header for readline.
11 years ago
Dave Hylands
117c46d9eb
Add input command for unix
11 years ago
Paul Sokolovsky
0ef015b253
stream: Make non-blcoking stream support configurable.
Enable only on unix. To avoid unpleasant surprises with error codes.
11 years ago
Paul Sokolovsky
6c62e7257f
unix modsocket: Add comments re: recv() vs read(), etc. semantics.
11 years ago
Paul Sokolovsky
f9e54e0ea5
modgc: Add new module for GC-related functionality.
11 years ago