Commit Graph

22 Commits

Author SHA1 Message Date
Damien George e191d42188 py: Use % str formatting instead of {} in makeqstrdata.py.
Script is equivalent, but now also runs under ancient Python 2.6.
Goes part way to addressing issue #847.
2014-09-05 13:16:19 +01:00
Chris Angelico de09caaa37 Bring the C and Python compute_hash functions into consistency 2014-06-07 07:06:18 +10:00
stijn 1dc7f0427b More relaxed parsing of preprocessed qstr header
The original parsing would error out on any C declarations that are not typedefs
or extern variables. This limits what can go in mpconfig.h and mpconfigport.h,
as they are included in qstr.h. For instance even a function declaration would be
rejected and including system headers is a complete no-go.
That seems too limiting for a global config header, so makeqstrdata now
ignores everything that does not match a qstr definition.
2014-05-03 10:26:31 +02:00
Damien George 708c073250 py: Add '*' qstr for 'import *'; use blank qstr for comprehension arg. 2014-04-27 19:23:46 +01:00
Damien George 897fe0c0d0 py: Add builtin functions bin and oct, and some tests for them. 2014-04-15 22:03:55 +01:00
Damien George b013aea809 py: Fix builtin hex to print prefix.
I was too hasty.  Still a one-liner though.
2014-04-15 12:50:21 +01:00
Damien George 5805111732 py: Add hex builtin function.
A one-liner, added especially for @pfalcon :)
2014-04-15 12:42:52 +01:00
Damien George 3683789207 py: Clean up and add comments to makeqstrdata. 2014-04-14 23:38:37 +01:00
Damien George 5bb7d99175 py: Modify makeqstrdata to recognise better the output of CPP. 2014-04-13 13:16:51 +01:00
Paul Sokolovsky 73b7027b83 objstr: Add str.encode() and bytes.decode() methods.
These largely duplicate str() & bytes() constructors' functionality,
but can be used to achieve Python2 compatibility.
2014-04-13 06:45:02 +03:00
Paul Sokolovsky a925cb54f1 py: Preprocess qstrdefs.h before feeding to makeqstrdata.py.
This is alternative implementation of supporting conditionals in qstrdefs.h,
hard to say if it's much cleaner than munging #ifdef's in Python code...
2014-04-12 00:39:55 +03:00
Paul Sokolovsky 6ea0e928d8 Revert "makeqstrdata.py: Add support for conditionally defined qstrs."
This reverts commit acb133d1b1.

Conditionals will be suported using C preprocessor.
2014-04-12 00:39:54 +03:00
Paul Sokolovsky acb133d1b1 makeqstrdata.py: Add support for conditionally defined qstrs.
Syntax is usual C #if*/#endif, but each qstr must be wrapped individually.
2014-04-10 03:38:42 +03:00
Damien George 6e628c49ca py: Replace naive and teribble hash function with djb2. 2014-03-25 15:27:15 +00:00
Dave Hylands 0308f964a0 Fix makeqstrdata.py to work in Python 2.7 2014-03-10 00:07:35 -07:00
Damien George fdf0da5436 makeqstrdata: print error to stderr. 2014-03-08 15:03:25 +00:00
Paul Sokolovsky 4aee119f94 stm: Initialize sys.path with ["0:/", "0:/src", "0:/lib"].
This is compatible with what search path was before sys.path refactor,
with addition of module library path ("0:/lib").
2014-02-18 00:06:37 +02: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
Damien George 1976baeeb7 Retain file order of qstr definitions.
Want common qstrs to be first in the list so they have the lowest ids,
so that in the byte code they take up the least room.
2014-01-24 22:22:00 +00:00
Paul Sokolovsky ab5d08280b Allow qstr's with non-ident chars, construct good identifier for them.
Also, add qstr's for string appearing in unix REPL loop, gross effect
being less allocations for each command run.
2014-01-24 02:34:22 +02:00
Dave Hylands 7a996b1f65 Fix malformed generated file when using python 2.7 2014-01-21 15:28:27 -08:00
Damien George 55baff4c9b Revamp qstrs: they now include length and hash.
Can now have null bytes in strings.  Can define ROM qstrs per port using
qstrdefsport.h
2014-01-21 21:40:13 +00:00