Commit Graph

2644 Commits

Author SHA1 Message Date
Damien George 1694bc733d py: Add stream reading of n unicode chars; unicode support by default.
With unicode enabled, this patch allows reading a fixed number of
characters from text-mode streams; eg file.read(5) will read 5 unicode
chars, which can made of more than 5 bytes.

For an ASCII stream (ie no chars > 127) it only needs to do 1 read.  If
there are lots of non-ASCII chars in a stream, then it needs multiple
reads of the underlying object.

Adds a new test for this case.  Enables unicode support by default on
unix and stmhal ports.
2014-07-19 18:34:04 +01:00
Damien George 02bc882c3d stmhal: Add file.flush and os.stat. 2014-07-19 16:39:13 +01:00
blmorris 0f4ee2e44a Merge https://github.com/micropython/micropython 2014-07-18 16:06:22 -04:00
Damien George 5467186b0e py: Remove unnecessary argument in bytearray print. 2014-07-17 21:56:32 +01:00
Paul Sokolovsky e3737b858a formatfloat.c: Typo fix in comment. 2014-07-17 20:45:58 +03:00
Damien George a4022c92f0 py, inline asm: Change "and" op name to "and_" to avoid keyword clash.
Addresses issue #753.
2014-07-17 12:37:56 +01:00
Damien George a50494ab68 Merge pull request #755 from dhylands/teensy-core
Add teensy core files and use same toolchain as stmhal
2014-07-17 12:30:44 +01:00
Damien George db56ad2915 Merge pull request #754 from dhylands/fix-teensy
Fix teensy to build on latest tree.
2014-07-17 12:26:35 +01:00
stijn 73ab8cc21d Add fsync for windows, i.e. _commit. See dce8876 2014-07-16 09:37:09 +02:00
blmorris ef204733d6 Initial commit of Myriad2 board-specific configuration files 2014-07-15 15:10:56 -04:00
blmorris 0429d35f37 Merge https://github.com/micropython/micropython 2014-07-15 12:28:49 -04:00
Dave Hylands 04f5ae1d1c Add core files and use same toolchain as stmhal 2014-07-14 22:48:22 -07:00
Dave Hylands 4d9dd26818 Fix teensy to build on latest tree.
Put #include of mpconfig.h before misc.h
Replace uses of ARRAY_SIZE with MP_ARRAY_SIZE
2014-07-14 22:19:27 -07:00
Paul Sokolovsky dce8876dbe unix: file: No fsync() on Windows. 2014-07-13 23:34:35 +03:00
Paul Sokolovsky ac736f15c9 stream: Factor out mp_stream_write() method to write a memstring to stream. 2014-07-13 23:14:32 +03:00
Paul Sokolovsky 122c9db3db unix: file: Implement .flush() method.
This method apparently should be part of stream interface.
2014-07-13 23:14:24 +03:00
Paul Sokolovsky a1760a56ff test: Add run-tests-exp.sh, script to run testsuite with only sh dependency.
This script uses expected test results as generated by run-tests --write-exp,
and requires only standard unix shell funtionality (no bash). It is useful
to run testsuite on embedded systems, where there's no CPython and Bash.
2014-07-13 18:49:56 +03:00
Paul Sokolovsky b82f34edde unix: Allow to disable MICROPY_EMIT_X64 from commandline.
emitnative in particular requires nlr_* to be real functions, so doesn't
compile with MICROPY_NLR_SETJMP=1.
2014-07-13 13:49:51 +03:00
Paul Sokolovsky 2cf381081a run-tests: Add option to write CPython's test results to .exp files.
Mostly to run testsuite on targets which doesn't have CPython.
2014-07-12 16:34:51 +03:00
Paul Sokolovsky 564e46452d py: Add generic helper to align a pointer. 2014-07-12 15:57:28 +03:00
Paul Sokolovsky 58c9586c34 emitbc: Fix structure field alignment issue.
dummy_data field is accessed as uint value (e.g.
in emit_write_bytecode_byte_ptr), but is not aligned as such, which causes
bus errors or incorrect behavior on any arch requiring strictly aligned
data (ARM pre-v7, MIPS, etc, etc).
2014-07-12 15:57:28 +03:00
blmorris 847a6b30b1 Incorporate stylistic changes suggested by @dhylands 2014-07-11 21:18:09 -04:00
blmorris e687fdbcbc Add keyword argument 'memaddr_use_16b' to i2c.mem_read and mem_write methods
to allow these methods to transmit 16 bit addresses to an i2c device
Add 'memaddr_use_16b' to qstrdefsport.h
2014-07-11 16:14:01 -04:00
Paul Sokolovsky 2097c8b1e1 moductypes: Add symbolic constants to specify bitfield position/length. 2014-07-11 00:06:36 +03:00
Paul Sokolovsky 8215847b4d moductypes: Foreign data interface module, roughly based on ctype ideas.
But much smaller and memory-efficient. Uses Python builtin data structures
(dict, tuple, int) to describe structure layout.
2014-07-09 19:28:24 +03:00
Damien George 42b6419056 Merge branch 'dhylands-fix-sdcard-read' 2014-07-07 07:29:52 +01:00
Damien George 594699bc88 stmhal: Protect SD_WriteBlocks by IRQ disable/enable pair. 2014-07-07 07:29:06 +01:00
Dave Hylands 90ba80dc36 Disable IRQs around sdcard reads.
Once the code switches to using DMA, this can be removed.
2014-07-06 09:51:22 -07:00
Paul Sokolovsky 5fa5ca40e6 binary: Factor out mp_binary_set_int(). 2014-07-05 23:54:03 +03:00
Damien George 539681fffd tests: Rename test scripts, changing - to _ for consistency.
From now on, all new tests must use underscore.

Addresses issue #727.
2014-07-05 06:14:29 +01:00
Damien George 0182385ab0 py: Automatically ake __new__ a staticmethod.
Addresses issue #622.
2014-07-05 05:55:00 +01:00
Paul Sokolovsky 4e0eeebdc2 py: Implement sys.maxsize, standard way to check platform "bitness".
Implementing it as a static constant is a bit peculiar and require cooperation
from long int implementation.
2014-07-03 18:09:36 +03:00
Damien George 381618269a parser: Convert (u)int to mp_(u)int_t. 2014-07-03 14:13:33 +01:00
Damien George 54eb4e723e lexer: Convert type (u)int to mp_(u)int_t. 2014-07-03 13:47:47 +01: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
Damien George 065aba5875 Merge pull request #739 from errordeveloper/patch-1
qemu: fix typo in readme
2014-07-03 10:16:07 +01:00
Ilya Dmitrichenko e4e55047b3 qemu: fix typo in readme 2014-07-02 18:30:46 +01:00
Damien George 5e6419cb11 Merge branch 'dhylands-add-timer-deinit' 2014-07-02 14:10:18 +01:00
Damien George e70b5dbe58 stmhal: Some reordering of code/functions. 2014-07-02 14:09:44 +01:00
Damien George 92a47b4dae Merge branch 'add-timer-deinit' of github.com:dhylands/micropython into dhylands-add-timer-deinit 2014-07-02 14:06:28 +01:00
Damien George 9cd96cf25d Merge pull request #709 from windelbouwman/master
Added hexfile target
2014-07-02 13:53:28 +01:00
Damien George f83debc716 Merge branch 'dhylands-teensy-new' 2014-07-02 13:45:00 +01:00
Damien George 7a37f647a5 Merge branch 'teensy-new' of github.com:dhylands/micropython into dhylands-teensy-new
Conflicts:
	stmhal/pin_named_pins.c
	stmhal/readline.c

Renamed HAL_H to MICROPY_HAL_H.  Made stmhal/mphal.h which intends to
define the generic Micro Python HAL, which in stmhal sits above the ST
HAL.
2014-07-02 13:42:37 +01:00
Damien George 5fc580475f Merge branch 'dhylands-preserve-except' 2014-07-01 14:28:40 +01:00
Damien George f0b29729aa py, objexcept: Only check for locked gc if gc is enabled. 2014-07-01 14:28:09 +01:00
Damien George f065344d3b Merge branch 'preserve-except' of github.com:dhylands/micropython into dhylands-preserve-except 2014-07-01 14:26:37 +01:00
Damien George aa47f3968b Merge pull request #734 from iabdalkader/copysign
Add copysignf
2014-07-01 14:03:55 +01:00
Dave Hylands 2fe841d2fa Try not to cause a MemoryError when raising an exception during nterrupt handling.
Step 1 fixes #732
2014-06-30 22:49:21 -07:00
Paul Sokolovsky caa7334141 stackctrl: Add "mp_" prefix. 2014-07-01 02:14:08 +03:00
Paul Sokolovsky e95b6b5e07 modffi: Add special 'C' code for passing a callback function pointer. 2014-07-01 02:05:34 +03:00