summaryrefslogtreecommitdiff
path: root/unix
AgeCommit message (Collapse)Author
2015-12-09unix/modtermios: DJGPP appears to have unicode-capable cc_t type.Paul Sokolovsky
At least it's defined as "unsiged". We don't try to support unicode still, but at least apply workaround for DJGPP build.
2015-12-09unix/modtermios: Provide B57600 and B115200 constants only if defined.Paul Sokolovsky
2015-12-07unix/main: mp_verbose_flag available only if MICROPY_DEBUG_PRINTERS is true.Paul Sokolovsky
Not available for minimal build for example.
2015-12-07py: Add MICROPY_PY_BUILTINS_MIN_MAX, disable for minimal ports.pohmelie
2015-12-05unix/moduselect: register(): Allow to call with duplicate file descriptor.Paul Sokolovsky
Per CPython docs, "Registering a file descriptor that’s already registered is not an error, and has the same effect as registering the descriptor exactly once." https://docs.python.org/3/library/select.html#select.poll.register That's somewhat ambiguous, what's implemented here is that if fd si not yet registered, it is registered. Otherwise, the effect is equivalent to modify() method.
2015-12-04unix/main: Check pending exception at the end of code block execution.Paul Sokolovsky
Usually this checking is done by VM on jump instructions, but for linear sequences of instructions and builtin functions this won't happen. Particular target of this change is long-running builtin functions like time.sleep().
2015-12-03unix/mpconfigport: Typo fix in comment.Paul Sokolovsky
2015-12-02unix/mpconfigport.h: For MICROPY_NO_ALLOCA=1, don't even include alloca.h.Paul Sokolovsky
2015-12-02unix/modtime: sleep(): Return early if KeyboardInterrupt is pendingPaul Sokolovsky
As set by signal handler. This assumes that exception will be raised somewhere else, which so far doesn't happen for single function call. Still, it makes sense to handle that in some common place.
2015-11-30unix/moduselect: Support growing of poll array.Paul Sokolovsky
2015-11-29py: Wrap all obj-ptr conversions in MP_OBJ_TO_PTR/MP_OBJ_FROM_PTR.Damien George
This allows the mp_obj_t type to be configured to something other than a pointer-sized primitive type. This patch also includes additional changes to allow the code to compile when sizeof(mp_uint_t) != sizeof(void*), such as using size_t instead of mp_uint_t, and various casts.
2015-11-29py: Add MP_ROM_* macros and mp_rom_* types and use them.Damien George
2015-11-29unix/modtime: Unbreak Windows build after changes to check select() result.Paul Sokolovsky
2015-11-29unix/modtime: sleep(): Automatically restart after receiving EINTR.Paul Sokolovsky
THis is required to deal well with signals, signals being the closest analogue of hardware interrupts for POSIX. This is also CPython 3.5 compliant behavior (PEP 475). The main problem implementing this is to figure out how much time was spent in waiting so far/how much is remaining. It's well-known fact that Linux updates select()'s timeout value when returning with EINTR to the remaining wait time. Here's what POSIX-based standards say about this: (http://pubs.opengroup.org/onlinepubs/9699919799/functions/pselect.html): "Upon successful completion, the select() function may modify the object pointed to by the timeout argument." I.e. it allows to modify timeout value, but doesn't say how exactly it is modified. And actually, it allows such modification only "upon successful completion", which returning with EINTR error hardly is. POSIX also allows to request automatic EINTR restart for system calls using sigaction call with SA_RESTART flag, but here's what the same document says about it: "If SA_RESTART has been set for the interrupting signal, it is implementation-defined whether the function restarts or returns with [EINTR]." In other words, POSIX doesn't leave room for both portable and efficient handling of this matter, so the code just allows to manually select Linux-compatible behavior with MICROPY_SELECT_REMAINING_TIME option, or otherwise will just raise OSError. When systems with non-Linux behavior are found, they can be handled separately.
2015-11-29unix/moduselect: poll.register(): Reuse freed entries in poll array.Paul Sokolovsky
2015-11-28unix/moduselect: Fix bug in poll.poll() scanning loop.Paul Sokolovsky
2015-11-27unix/unix_mphal: Use size_t instead of mp_uint_t in stdout_tx_strn decls.Damien George
2015-11-26unix/modos: Remove duplicate level of #if MICROPY_PY_OS_STATVFS.Paul Sokolovsky
2015-11-23unix/main: Get rid of perror() which uses stdio.Paul Sokolovsky
2015-11-22unix: Use printf() implementation in terms of mp_printf().Paul Sokolovsky
In other words, unix port now uses overriden printf(), instead of using libc's. This should remove almost all dependency on libc stdio (which is bloated).
2015-11-21unix/modsocket: Use snprintf(), as defined by lib/utils/printf.c.Paul Sokolovsky
2015-11-21py/emitglue: Host definition of mp_verbose_flag.Paul Sokolovsky
This may not seem like the ideal place, but is actually the only place in py/ where it gets referenced, so is just right.
2015-11-21unix/modsocket: Implement sockaddr() function to decode raw socket address.Paul Sokolovsky
Return tuple of (address_family, net_addr, [port, [extra_data]]). net_addr is still raw network address as bytes object, but suitable for passing to inet_ntop() function. At the very least, sockaddr() will separate address family value from binary socket address (and currently, only AF_INET family is decoded).
2015-11-20unix/modsocket: Removed dangling references to sockaddr_in_type.Paul Sokolovsky
2015-11-20unix/modffi: Mark 'O' type specifier as implemented.Paul Sokolovsky
2015-11-20unix/moduselect: Initialise variable so can compile in non-debug mode.Damien George
2015-11-17unix: Add "uselect" module, with poll() function.Paul Sokolovsky
Underlyingly, uses standard POSIX poll() for portability.
2015-11-16unix/input: Switch to POSIX I/O for history reading/writing.Paul Sokolovsky
2015-11-14unix/modos: getenv(): Handle non-existing envvar correctly.Paul Sokolovsky
2015-11-14unix/modos: Add Windows workaround for mkdir().Paul Sokolovsky
2015-11-13unix/modos: Add mkdir().Paul Sokolovsky
Dependency of upip.
2015-11-13unix/modos: Add getenv().Paul Sokolovsky
Dependency of upip.
2015-11-13unix/main: Remove stray mp_printf() from previous commit.Paul Sokolovsky
2015-11-13unix: Use standard mphalport.h header.Paul Sokolovsky
This also unbreaks "make minimal".
2015-11-13main.c: Switch stderr printing from ANSI C to native POSIX.Paul Sokolovsky
2015-11-13unix: Allow to override MICROPY_PY_MATH_SPECIAL_FUNCTIONS from command-line.Paul Sokolovsky
2015-11-13unix/mpconfigport: Move log2() definition to modmath.c.Paul Sokolovsky
It's safer to define it where it's used, defining it for all source files may lead to hard to diagnose conflicts in corner cases.
2015-11-13unix/main: Use builtin unichar_isdigit() in preference if libc's.Paul Sokolovsky
Less dependencies.
2015-11-11unix/modjni: Add missing get_jclass_name() function.Paul Sokolovsky
2015-11-08unix/gccollect: Fallback to setjmp-based register fetching automatically.Paul Sokolovsky
Now, if we build for an architecture which doesn't have dedicated support for getting registers for GC scanning, fallback to setjmp-based method automatically. It's still possible to force setjmp-based implementation on archs with dedicated support (e.g. for testing, or for peculiar calling conventions/optimizations).
2015-11-03unix/unix_mphal: Typo fix in comment.Paul Sokolovsky
2015-10-31all: Add py/mphal.h and use it in all ports.Damien George
py/mphal.h contains declarations for generic mp_hal_XXX functions, such as stdio and delay/ticks, which ports should provide definitions for. A port will also provide mphalport.h with further HAL declarations.
2015-10-27unix, stmhal: Introduce mp_hal_delay_ms(), mp_hal_ticks_ms().Paul Sokolovsky
These MPHAL functions are intended to replace previously used HAL_Delay(), HAL_GetTick() to provide better naming and MPHAL separation (they are fully equivalent otherwise). Also, refactor extmod/modlwip to use them.
2015-10-23unix/modjni: Actually check argument type when doing method resolution.Paul Sokolovsky
This is required to properly select among overloaded methods. It however relies on java.lang.Object-overloaded method to come last, which appears to be the case for OpenJDK.
2015-10-22unix/modjni: Don't pass Java object to a method which doesn't expect it.Paul Sokolovsky
For example, don't pass Integer to double method. This is still not selective enough to choose the right overloaded method maong those taking objects.
2015-10-20unix: Use "Ctrl" as a name of the key, not "CTRL".Paul Sokolovsky
2015-10-19libffi: Skip building docs.Paul Sokolovsky
This requires makeinfo installed and wastes time (especially in CI).
2015-10-19unix/modos: Android Bionic lacks statvfs(), has BSD statfs().Paul Sokolovsky
2015-10-19all: Make netutils.h available to all ports by default.Paul Sokolovsky
Generally, ports should inherit INC from py.mk, append to it, not overwrite it. TODO: Likely should do the same for other vars too.
2015-10-19unix/modtime: Implement ticks_ms(), ticks_us() and ticks_diff().Paul Sokolovsky
All of these functions return positive small int, thus range is 2 bits less than word size (30 bit on 32-bit systems, 62 bit on 64-bit systems).