<feed xmlns='http://www.w3.org/2005/Atom'>
<title>suspect-devices/circuitpython/py/compile.h, branch 2.x</title>
<subtitle>CircuitPython - a Python implementation for teaching coding with microcontrollers</subtitle>
<id>https://git.suspectdevices.com/suspect-devices/circuitpython/atom?h=2.x</id>
<link rel='self' href='https://git.suspectdevices.com/suspect-devices/circuitpython/atom?h=2.x'/>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/'/>
<updated>2017-07-31T08:35:40+00:00</updated>
<entry>
<title>all: Use the name MicroPython consistently in comments</title>
<updated>2017-07-31T08:35:40+00:00</updated>
<author>
<name>Alexander Steffen</name>
<email>devel.20.webmeister@spamgourmet.com</email>
</author>
<published>2017-06-30T07:22:17+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=55f33240f3d7051d4213629e92437a36f1fac50e'/>
<id>urn:sha1:55f33240f3d7051d4213629e92437a36f1fac50e</id>
<content type='text'>
There were several different spellings of MicroPython present in comments,
when there should be only one.
</content>
</entry>
<entry>
<title>all: Unify header guard usage.</title>
<updated>2017-07-18T01:57:39+00:00</updated>
<author>
<name>Alexander Steffen</name>
<email>devel.20.webmeister@spamgourmet.com</email>
</author>
<published>2017-06-29T21:14:58+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=299bc625864b9e624ed599c94a5f95870516139a'/>
<id>urn:sha1:299bc625864b9e624ed599c94a5f95870516139a</id>
<content type='text'>
The code conventions suggest using header guards, but do not define how
those should look like and instead point to existing files. However, not
all existing files follow the same scheme, sometimes omitting header guards
altogether, sometimes using non-standard names, making it easy to
accidentally pick a "wrong" example.

This commit ensures that all header files of the MicroPython project (that
were not simply copied from somewhere else) follow the same pattern, that
was already present in the majority of files, especially in the py folder.

The rules are as follows.

Naming convention:
* start with the words MICROPY_INCLUDED
* contain the full path to the file
* replace special characters with _

In addition, there are no empty lines before #ifndef, between #ifndef and
one empty line before #endif. #endif is followed by a comment containing
the name of the guard macro.

py/grammar.h cannot use header guards by design, since it has to be
included multiple times in a single C file. Several other files also do not
need header guards as they are only used internally and guaranteed to be
included only once:
* MICROPY_MPHALPORT_H
* mpconfigboard.h
* mpconfigport.h
* mpthreadport.h
* pin_defs_*.h
* qstrdefs*.h
</content>
</entry>
<entry>
<title>py: Allow inline-assembler emitter to be generic.</title>
<updated>2016-12-09T06:06:21+00:00</updated>
<author>
<name>Damien George</name>
<email>damien.p.george@gmail.com</email>
</author>
<published>2016-12-09T02:17:49+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=ad297a1950c74c35c90dd655ae9a69d33ed28dc0'/>
<id>urn:sha1:ad297a1950c74c35c90dd655ae9a69d33ed28dc0</id>
<content type='text'>
This patch refactors some code so that it is easier to integrate new
inline assemblers for different architectures other than ARM Thumb.
</content>
</entry>
<entry>
<title>py/compile: Add mp_compile_to_raw_code() to return raw code object.</title>
<updated>2015-11-20T12:30:37+00:00</updated>
<author>
<name>Damien George</name>
<email>damien.p.george@gmail.com</email>
</author>
<published>2015-11-13T13:38:28+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=d4dba8823655c2715867f4d64e407de390c9d29e'/>
<id>urn:sha1:d4dba8823655c2715867f4d64e407de390c9d29e</id>
<content type='text'>
This can then be passed to mp_raw_code_save_file to save a .mpy file.
</content>
</entry>
<entry>
<title>py: Allocate parse nodes in chunks to reduce fragmentation and RAM use.</title>
<updated>2015-10-01T23:11:11+00:00</updated>
<author>
<name>Damien George</name>
<email>damien.p.george@gmail.com</email>
</author>
<published>2015-09-23T09:50:43+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=58e0f4ac50b3dc732cbfe0d7b04bb41951ac1329'/>
<id>urn:sha1:58e0f4ac50b3dc732cbfe0d7b04bb41951ac1329</id>
<content type='text'>
With this patch parse nodes are allocated sequentially in chunks.  This
reduces fragmentation of the heap and prevents waste at the end of
individually allocated parse nodes.

Saves roughly 20% of RAM during parse stage.
</content>
</entry>
<entry>
<title>py: Protect mp_parse and mp_compile with nlr push/pop block.</title>
<updated>2015-02-07T18:33:58+00:00</updated>
<author>
<name>Damien George</name>
<email>damien.p.george@gmail.com</email>
</author>
<published>2015-02-07T18:33:58+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=0bfc7638baa4c5a4a2351364ab770a188dcab302'/>
<id>urn:sha1:0bfc7638baa4c5a4a2351364ab770a188dcab302</id>
<content type='text'>
To enable parsing constants more efficiently, mp_parse should be allowed
to raise an exception, and mp_compile can already raise a MemoryError.
So these functions need to be protected by an nlr push/pop block.

This patch adds that feature in all places.  This allows to simplify how
mp_parse and mp_compile are called: they now raise an exception if they
have an error and so explicit checking is not needed anymore.
</content>
</entry>
<entry>
<title>py: Move to guarded includes for compile.h and related headers.</title>
<updated>2014-12-27T14:12:17+00:00</updated>
<author>
<name>Paul Sokolovsky</name>
<email>pfalcon@users.sourceforge.net</email>
</author>
<published>2014-12-25T21:29:19+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=8ab6f9067412d9f73fe88d42d81c0b4c4f1fd20b'/>
<id>urn:sha1:8ab6f9067412d9f73fe88d42d81c0b4c4f1fd20b</id>
<content type='text'>
</content>
</entry>
<entry>
<title>py: Implement proper context save/restore for eval/exec; factor code.</title>
<updated>2014-10-05T19:13:34+00:00</updated>
<author>
<name>Damien George</name>
<email>damien.p.george@gmail.com</email>
</author>
<published>2014-10-05T19:13:34+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=c4d0868df1117ad243ee8f7238985a822b0f775d'/>
<id>urn:sha1:c4d0868df1117ad243ee8f7238985a822b0f775d</id>
<content type='text'>
This has benefits all round: code factoring for parse/compile/execute,
proper context save/restore for exec, allow to sepcify globals/locals
for eval, and reduced ROM usage by &gt;100 bytes on stmhal and unix.

Also, the call to mp_parse_compile_execute is tail call optimised for
the import code, so it doesn't increase stack memory usage.
</content>
</entry>
<entry>
<title>py: Free non-interned strings in the parser when not needed.</title>
<updated>2014-09-23T15:31:56+00:00</updated>
<author>
<name>Damien George</name>
<email>damien.p.george@gmail.com</email>
</author>
<published>2014-09-23T15:31:56+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=52b5d76a6b0c5e4c779211fdf7bca56d87a2f83e'/>
<id>urn:sha1:52b5d76a6b0c5e4c779211fdf7bca56d87a2f83e</id>
<content type='text'>
mp_parse_node_free now frees the memory associated with non-interned
strings.  And the parser calls mp_parse_node_free when discarding a
non-used node (such as a doc string).

Also, the compiler now frees the parse tree explicitly just before it
exits (as opposed to relying on the caller to do this).

Addresses issue #708 as best we can.
</content>
</entry>
<entry>
<title>py: Rename BYTE_CODE to BYTECODE (this was missed in previous rename).</title>
<updated>2014-05-12T21:35:37+00:00</updated>
<author>
<name>Damien George</name>
<email>damien.p.george@gmail.com</email>
</author>
<published>2014-05-12T21:35:37+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=96f137b24a6c0b2e1e3c6f5fb8617b8a7f7896d6'/>
<id>urn:sha1:96f137b24a6c0b2e1e3c6f5fb8617b8a7f7896d6</id>
<content type='text'>
</content>
</entry>
</feed>
