You've already forked Core2forAWS-MicroPython
mirror of
https://github.com/m5stack/Core2forAWS-MicroPython.git
synced 2026-05-20 10:30:31 -07:00
Merge remote-tracking branch 'upstream/master' into list_insert
This commit is contained in:
@@ -0,0 +1,97 @@
|
||||
The font used for the Micro Python logo is "Exo",
|
||||
http://www.google.com/fonts/specimen/Exo.
|
||||
|
||||
Copyright (c) 2013, Natanael Gama (https://plus.google.com/u/0/+NatanaelGama),
|
||||
with Reserved Font Name Exo.
|
||||
|
||||
This Font Software is licensed under the SIL Open Font License, Version 1.1.
|
||||
This license is copied below, and is also available with a FAQ at:
|
||||
http://scripts.sil.org/OFL
|
||||
|
||||
|
||||
-----------------------------------------------------------
|
||||
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
|
||||
-----------------------------------------------------------
|
||||
|
||||
PREAMBLE
|
||||
The goals of the Open Font License (OFL) are to stimulate worldwide
|
||||
development of collaborative font projects, to support the font creation
|
||||
efforts of academic and linguistic communities, and to provide a free and
|
||||
open framework in which fonts may be shared and improved in partnership
|
||||
with others.
|
||||
|
||||
The OFL allows the licensed fonts to be used, studied, modified and
|
||||
redistributed freely as long as they are not sold by themselves. The
|
||||
fonts, including any derivative works, can be bundled, embedded,
|
||||
redistributed and/or sold with any software provided that any reserved
|
||||
names are not used by derivative works. The fonts and derivatives,
|
||||
however, cannot be released under any other type of license. The
|
||||
requirement for fonts to remain under this license does not apply
|
||||
to any document created using the fonts or their derivatives.
|
||||
|
||||
DEFINITIONS
|
||||
"Font Software" refers to the set of files released by the Copyright
|
||||
Holder(s) under this license and clearly marked as such. This may
|
||||
include source files, build scripts and documentation.
|
||||
|
||||
"Reserved Font Name" refers to any names specified as such after the
|
||||
copyright statement(s).
|
||||
|
||||
"Original Version" refers to the collection of Font Software components as
|
||||
distributed by the Copyright Holder(s).
|
||||
|
||||
"Modified Version" refers to any derivative made by adding to, deleting,
|
||||
or substituting -- in part or in whole -- any of the components of the
|
||||
Original Version, by changing formats or by porting the Font Software to a
|
||||
new environment.
|
||||
|
||||
"Author" refers to any designer, engineer, programmer, technical
|
||||
writer or other person who contributed to the Font Software.
|
||||
|
||||
PERMISSION & CONDITIONS
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of the Font Software, to use, study, copy, merge, embed, modify,
|
||||
redistribute, and sell modified and unmodified copies of the Font
|
||||
Software, subject to the following conditions:
|
||||
|
||||
1) Neither the Font Software nor any of its individual components,
|
||||
in Original or Modified Versions, may be sold by itself.
|
||||
|
||||
2) Original or Modified Versions of the Font Software may be bundled,
|
||||
redistributed and/or sold with any software, provided that each copy
|
||||
contains the above copyright notice and this license. These can be
|
||||
included either as stand-alone text files, human-readable headers or
|
||||
in the appropriate machine-readable metadata fields within text or
|
||||
binary files as long as those fields can be easily viewed by the user.
|
||||
|
||||
3) No Modified Version of the Font Software may use the Reserved Font
|
||||
Name(s) unless explicit written permission is granted by the corresponding
|
||||
Copyright Holder. This restriction only applies to the primary font name as
|
||||
presented to the users.
|
||||
|
||||
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
|
||||
Software shall not be used to promote, endorse or advertise any
|
||||
Modified Version, except to acknowledge the contribution(s) of the
|
||||
Copyright Holder(s) and the Author(s) or with their explicit written
|
||||
permission.
|
||||
|
||||
5) The Font Software, modified or unmodified, in part or in whole,
|
||||
must be distributed entirely under this license, and must not be
|
||||
distributed under any other license. The requirement for fonts to
|
||||
remain under this license does not apply to any document created
|
||||
using the Font Software.
|
||||
|
||||
TERMINATION
|
||||
This license becomes null and void if any of the above conditions are
|
||||
not met.
|
||||
|
||||
DISCLAIMER
|
||||
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
|
||||
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
|
||||
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
|
||||
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
|
||||
OTHER DEALINGS IN THE FONT SOFTWARE.
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,137 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
||||
|
||||
<svg
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:cc="http://creativecommons.org/ns#"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
version="1.1"
|
||||
width="765.09967"
|
||||
height="158.82559"
|
||||
id="svg2">
|
||||
<defs
|
||||
id="defs4">
|
||||
<symbol
|
||||
id="*Paper_Space" />
|
||||
<symbol
|
||||
id="*Model_Space" />
|
||||
<pattern
|
||||
height="8"
|
||||
id="Hatch"
|
||||
patternUnits="userSpaceOnUse"
|
||||
width="8"
|
||||
x="0"
|
||||
y="0">
|
||||
<path
|
||||
d="M8 4 l-4,4"
|
||||
linecap="square"
|
||||
stroke="#000000"
|
||||
stroke-width="0.25"
|
||||
id="path3030" />
|
||||
<path
|
||||
d="M6 2 l-4,4"
|
||||
linecap="square"
|
||||
stroke="#000000"
|
||||
stroke-width="0.25"
|
||||
id="path3032" />
|
||||
<path
|
||||
d="M4 0 l-4,4"
|
||||
linecap="square"
|
||||
stroke="#000000"
|
||||
stroke-width="0.25"
|
||||
id="path3034" />
|
||||
</pattern>
|
||||
<marker
|
||||
refX="0"
|
||||
refY="0"
|
||||
orient="auto"
|
||||
id="DistanceX"
|
||||
style="overflow:visible">
|
||||
<path
|
||||
d="M 3,-3 -3,3 M 0,-5 0,5"
|
||||
id="path3027"
|
||||
style="stroke:#000000;stroke-width:0.5" />
|
||||
</marker>
|
||||
</defs>
|
||||
<metadata
|
||||
id="metadata7">
|
||||
<rdf:RDF>
|
||||
<cc:Work
|
||||
rdf:about="">
|
||||
<dc:format>image/svg+xml</dc:format>
|
||||
<dc:type
|
||||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||
<dc:title></dc:title>
|
||||
</cc:Work>
|
||||
</rdf:RDF>
|
||||
</metadata>
|
||||
<g
|
||||
transform="translate(-463.61971,-103.98436)"
|
||||
id="layer1">
|
||||
<g
|
||||
transform="translate(474.11971,-800.05225)"
|
||||
id="g3038" />
|
||||
<path
|
||||
d="m 474.11971,216.99105 8.38645,-95.79752 25.49501,0 15.95818,65.41468 15.86248,-65.41468 25.39886,0 8.91346,95.79752 -18.06677,0 -6.32579,-64.02471 -15.43095,64.02471 -20.41521,0 -16.10201,-64.02471 -5.60688,64.02471 -18.06683,0 0,0 z"
|
||||
id="path3042"
|
||||
style="fill:none;stroke:#bebebe" />
|
||||
<path
|
||||
d="m 585.06082,216.99105 0,-69.48774 18.35416,0 0,69.48774 -18.35416,0 0,0 z"
|
||||
id="path3044"
|
||||
style="fill:none;stroke:#bebebe" />
|
||||
<path
|
||||
d="m 584.4376,137.15201 0,-11.54959 a 3.667629,3.667629 0 0 1 0.77873,-2.55179 3.012482,3.012482 0 0 1 2.33617,-0.85049 l 13.75388,0 a 2.665344,2.665344 0 0 1 2.15675,0.85049 3.874957,3.874957 0 0 1 0.71861,2.55179 l 0,11.54959 a 3.170925,3.170925 0 0 1 -0.71861,2.2641 2.844672,2.844672 0 0 1 -2.15675,0.7548 l -13.75388,0 a 3.183373,3.183373 0 0 1 -2.27606,-0.79069 2.91442,2.91442 0 0 1 -0.83884,-2.22821 l 0,0 z"
|
||||
id="path3046"
|
||||
style="fill:none;stroke:#bebebe" />
|
||||
<path
|
||||
d="m 614.10181,182.15117 a 104.76828,104.76828 0 0 1 0.4073,-9.62042 61.45992,61.45992 0 0 1 1.22222,-7.96728 34.257292,34.257292 0 0 1 2.02456,-6.2896 18.589823,18.589823 0 0 1 2.81556,-4.58861 18.372489,18.372489 0 0 1 7.1404,-5.29557 25.178476,25.178476 0 0 1 9.29684,-1.55745 139.56012,139.56012 0 0 1 17.5877,1.01826 80.33883,80.33883 0 0 1 14.32895,3.05509 l 0,10.97421 a 913.84864,913.84864 0 0 0 -25.74636,0.0659 25.765381,25.765381 0 0 0 -2.98332,0.19783 10.614363,10.614363 0 0 0 -3.33051,1.29399 5.904958,5.904958 0 0 0 -2.63582,3.23482 31.868466,31.868466 0 0 0 -1.36576,6.43958 73.360882,73.360882 0 0 0 -0.45546,8.67975 97.248263,97.248263 0 0 0 0.31162,8.4166 30.406975,30.406975 0 0 0 0.93453,5.64883 13.352632,13.352632 0 0 0 1.53966,3.54027 6.228032,6.228032 0 0 0 2.12638,2.09068 9.932543,9.932543 0 0 0 3.12103,1.0243 26.061579,26.061579 0 0 0 4.52268,0.3415 252.7863,252.7863 0 0 0 21.37366,-0.9105 l 3.49828,-0.2876 0,11.5494 a 31.724353,31.724353 0 0 1 -11.74129,3.6421 158.5758,158.5758 0 0 1 -14.80802,0.8147 l -0.76677,0 a 36.794709,36.794709 0 0 1 -14.74822,-1.7372 18.781067,18.781067 0 0 1 -7.00851,-5.2116 19.357438,19.357438 0 0 1 -2.91432,-4.6785 33.943497,33.943497 0 0 1 -2.0816,-6.31978 60.236572,60.236572 0 0 1 -1.24921,-7.96117 102.18754,102.18754 0 0 1 -0.4162,-9.60257 l 0,0 z"
|
||||
id="path3048"
|
||||
style="fill:none;stroke:#bebebe" />
|
||||
<path
|
||||
d="m 679.80386,216.99105 0,-69.48774 15.43095,0 2.87536,8.76962 a 37.96926,37.96926 0 0 1 9.88418,-7.0806 23.135088,23.135088 0 0 1 10.0038,-2.36009 49.347494,49.347494 0 0 1 4.75639,0.19169 12.434249,12.434249 0 0 1 2.95909,0.57507 l 0,17.68339 a 99.917807,99.917807 0 0 0 -9.91977,-0.38338 37.215466,37.215466 0 0 0 -5.73876,0.4073 21.894431,21.894431 0 0 0 -4.66069,1.22222 14.160958,14.160958 0 0 0 -3.88165,2.33617 19.705025,19.705025 0 0 0 -3.40259,3.74978 l 0,44.37657 -18.30631,0 0,0 z"
|
||||
id="path3050"
|
||||
style="fill:none;stroke:#bebebe" />
|
||||
<path
|
||||
d="m 754.27554,165.28239 a 101.69692,101.69692 0 0 0 -2.0126,9.66857 52.999906,52.999906 0 0 0 -0.67107,7.91912 69.045724,69.045724 0 0 0 0.67107,10.97428 16.561755,16.561755 0 0 0 0.94036,3.45043 8.854315,8.854315 0 0 0 1.47954,2.49198 7.551397,7.551397 0 0 0 3.97766,2.53988 27.363959,27.363959 0 0 0 6.03841,0.5272 45.079768,45.079768 0 0 0 5.70257,-0.2636 9.767782,9.767782 0 0 0 3.66696,-1.3179 5.86791,5.86791 0 0 0 2.53952,-3.2587 27.050263,27.050263 0 0 0 1.25749,-5.53508 55.730735,55.730735 0 0 0 0.42019,-7.21251 158.11284,158.11284 0 0 0 -0.31284,-11.78882 30.217313,30.217313 0 0 0 -1.10107,-6.30187 5.911226,5.911226 0 0 0 -2.51499,-3.57004 10.986507,10.986507 0 0 0 -3.58967,-1.47372 21.310199,21.310199 0 0 0 -4.82232,-0.49134 57.038011,57.038011 0 0 0 -4.65456,0.16194 17.096194,17.096194 0 0 0 -3.08484,0.4852 7.14005,7.14005 0 0 0 -3.92981,2.99498 l 0,0 z"
|
||||
id="path3052"
|
||||
style="fill:none;stroke:#bebebe" />
|
||||
<path
|
||||
d="m 733.28556,183.589 a 92.623124,92.623124 0 0 1 1.03022,-15.09572 34.923348,34.923348 0 0 1 3.25874,-10.35129 16.997543,16.997543 0 0 1 6.15803,-6.70918 27.334986,27.334986 0 0 1 8.92573,-3.45043 58.555226,58.555226 0 0 1 12.30409,-1.15014 64.576878,64.576878 0 0 1 8.27122,0.49134 39.74236,39.74236 0 0 1 6.88921,1.47341 24.998971,24.998971 0 0 1 5.51149,2.4561 17.713605,17.713605 0 0 1 4.12825,3.43847 20.147183,20.147183 0 0 1 3.00878,4.6935 33.054914,33.054914 0 0 1 2.15,6.2209 56.120992,56.120992 0 0 1 1.28816,7.7486 92.689443,92.689443 0 0 1 0.42939,9.27599 93.582889,93.582889 0 0 1 -0.42325,9.252 55.494869,55.494869 0 0 1 -1.2667,7.67662 31.745279,31.745279 0 0 1 -2.11013,6.10108 18.697304,18.697304 0 0 1 -2.95663,4.5258 17.025604,17.025604 0 0 1 -4.09145,3.2707 25.393667,25.393667 0 0 1 -5.51762,2.3362 41.865621,41.865621 0 0 1 -6.94227,1.4018 69.328567,69.328567 0 0 1 -8.36845,0.4672 63.054282,63.054282 0 0 1 -8.23963,-0.5002 39.37126,39.37126 0 0 1 -6.89197,-1.5006 25.293848,25.293848 0 0 1 -5.544,-2.5009 18.401937,18.401937 0 0 1 -4.19634,-3.5014 20.408256,20.408256 0 0 1 -2.97719,-4.5227 30.962036,30.962036 0 0 1 -2.12639,-5.85256 49.71676,49.71676 0 0 1 -1.2762,-7.18239 79.250711,79.250711 0 0 1 -0.42509,-8.5122 l 0,0 z"
|
||||
id="path3054"
|
||||
style="fill:none;stroke:#bebebe" />
|
||||
<path
|
||||
d="m 848.06104,137.39155 -21.46935,0 0,28.03468 21.37427,0 a 9.641122,9.641122 0 0 0 5.07904,-1.19799 6.289092,6.289092 0 0 0 1.92917,-1.80311 10.492988,10.492988 0 0 0 1.37711,-2.82139 28.324879,28.324879 0 0 0 1.10107,-8.69815 26.4065,26.4065 0 0 0 -0.58581,-5.91236 12.140086,12.140086 0 0 0 -1.76048,-4.22332 7.47549,7.47549 0 0 0 -2.93517,-2.5337 9.405207,9.405207 0 0 0 -4.10985,-0.84466 l 0,0 z"
|
||||
id="path3070"
|
||||
style="fill:none;stroke:#ff0000" />
|
||||
<path
|
||||
d="m 957.94734,161.35288 0,-10.20776 11.26221,-3.78566 3.01798,-19.36075 15.28924,0 0,19.36075 15.57453,0 0,13.99342 -15.57453,0 0,27.89084 a 42.025479,42.025479 0 0 0 0.35885,5.97244 12.328486,12.328486 0 0 0 1.07653,3.82783 8.288976,8.288976 0 0 0 4.45643,3.95366 211.85149,211.85149 0 0 0 6.12183,2.0487 14.600045,14.600045 0 0 0 2.64989,0.6828 l 0,11.2619 -15.95782,0 a 16.804947,16.804947 0 0 1 -7.44373,-1.5545 13.606965,13.606965 0 0 1 -5.31827,-4.6635 22.537606,22.537606 0 0 1 -3.18973,-7.7724 49.35507,49.35507 0 0 1 -1.0612,-10.88151 l 0,-30.76626 -11.26221,0 0,0 z"
|
||||
id="path3072"
|
||||
style="fill:none;stroke:#ff0000" />
|
||||
<path
|
||||
d="m 1197.4165,146.30501 a 24.952696,24.952696 0 0 1 9.1,1.52157 16.077531,16.077531 0 0 1 6.4991,4.56469 19.935463,19.935463 0 0 1 3.8982,7.60782 39.066225,39.066225 0 0 1 1.3004,10.65064 l 0,46.34132 -18.3042,0 0,-46.58086 a 15.801149,15.801149 0 0 0 -0.4845,-4.1304 7.859179,7.859179 0 0 0 -1.4446,-2.95019 5.977282,5.977282 0 0 0 -2.4138,-1.77 8.891394,8.891394 0 0 0 -3.3738,-0.5901 25.71484,25.71484 0 0 0 -8.9373,1.36576 29.528311,29.528311 0 0 0 -7.8364,4.67234 l 0,49.98345 -18.3072,0 0,-69.48774 14.6667,0 3.6405,7.42778 a 71.772372,71.772372 0 0 1 8.5663,-5.43911 24.453688,24.453688 0 0 1 6.6248,-2.5159 31.484828,31.484828 0 0 1 6.8058,-0.67107 l 0,0 z"
|
||||
id="path3074"
|
||||
style="fill:none;stroke:#ff0000" />
|
||||
<path
|
||||
d="m 882.47028,147.50331 19.21508,0 12.07804,48.68928 a 6.616536,6.616536 0 0 0 2.23895,3.70202 6.560409,6.560409 0 0 0 4.13438,1.23404 2.645525,2.645525 0 0 0 0.52754,0.1437 l 13.89681,-53.76904 19.11999,0 -24.10395,91.48424 -9.53546,13.3224 -13.13312,0 9.82377,-35.3189 a 22.713351,22.713351 0 0 1 -7.27505,-1.1052 17.518915,17.518915 0 0 1 -5.86726,-3.3157 20.440644,20.440644 0 0 1 -4.4595,-5.5261 32.678904,32.678904 0 0 1 -3.05171,-7.73647 l -13.60851,-51.80427 0,0 z"
|
||||
id="path3076"
|
||||
style="fill:none;stroke:#ff0000" />
|
||||
<path
|
||||
d="m 1011.86,216.99105 0,-102.50669 18.163,0 0,40.44673 a 72.12737,72.12737 0 0 1 8.5172,-5.39126 25.732974,25.732974 0 0 1 6.6739,-2.56375 33.530661,33.530661 0 0 1 6.95,-0.67107 24.944515,24.944515 0 0 1 9.0968,1.52157 16.082612,16.082612 0 0 1 6.5022,4.56469 19.935463,19.935463 0 0 1 3.8982,7.60782 39.066225,39.066225 0 0 1 1.3004,10.65064 l 0,46.34132 -18.3072,0 0,-46.58086 a 15.799795,15.799795 0 0 0 -0.4815,-4.1304 7.862409,7.862409 0 0 0 -1.4477,-2.95019 5.972344,5.972344 0 0 0 -2.4107,-1.77 8.899237,8.899237 0 0 0 -3.3768,-0.5901 25.71484,25.71484 0 0 0 -8.9374,1.36576 29.519786,29.519786 0 0 0 -7.8332,4.67234 l 0,49.98345 -18.3072,0 0,0 z"
|
||||
id="path3078"
|
||||
style="fill:none;stroke:#ff0000" />
|
||||
<path
|
||||
d="m 1082.7855,183.589 a 92.623252,92.623252 0 0 1 1.0305,-15.09572 34.921866,34.921866 0 0 1 3.2572,-10.35129 16.998317,16.998317 0 0 1 6.1587,-6.70918 27.333351,27.333351 0 0 1 8.9251,-3.45043 58.559567,58.559567 0 0 1 12.305,-1.15014 64.58165,64.58165 0 0 1 8.2718,0.49134 39.738976,39.738976 0 0 1 6.8886,1.47341 24.998971,24.998971 0 0 1 5.5115,2.4561 17.713605,17.713605 0 0 1 4.1283,3.43847 20.147183,20.147183 0 0 1 3.0088,4.6935 33.054914,33.054914 0 0 1 2.15,6.2209 56.120992,56.120992 0 0 1 1.2881,7.7486 92.689443,92.689443 0 0 1 0.4294,9.27599 93.581477,93.581477 0 0 1 -0.4202,9.252 55.498435,55.498435 0 0 1 -1.2697,7.67662 31.745279,31.745279 0 0 1 -2.1102,6.10108 18.697304,18.697304 0 0 1 -2.9566,4.5258 17.025604,17.025604 0 0 1 -4.0914,3.2707 25.393667,25.393667 0 0 1 -5.5177,2.3362 41.856735,41.856735 0 0 1 -6.9407,1.4018 69.341232,69.341232 0 0 1 -8.37,0.4672 63.04259,63.04259 0 0 1 -8.2381,-0.5002 39.369587,39.369587 0 0 1 -6.8917,-1.5006 25.298499,25.298499 0 0 1 -5.5452,-2.5009 18.400351,18.400351 0 0 1 -4.1957,-3.5014 20.410163,20.410163 0 0 1 -2.9781,-4.5227 30.960474,30.960474 0 0 1 -2.1255,-5.85256 49.716395,49.716395 0 0 1 -1.2759,-7.18239 79.251281,79.251281 0 0 1 -0.4263,-8.5122 l 0,0 z"
|
||||
id="path3080"
|
||||
style="fill:none;stroke:#ff0000" />
|
||||
<path
|
||||
d="m 1103.7764,165.28239 a 101.69564,101.69564 0 0 0 -2.012,9.66857 53.000252,53.000252 0 0 0 -0.6717,7.91912 69.045959,69.045959 0 0 0 0.6717,10.97428 16.559516,16.559516 0 0 0 0.9385,3.45043 8.857186,8.857186 0 0 0 1.4814,2.49198 7.547675,7.547675 0 0 0 3.9749,2.53988 27.366717,27.366717 0 0 0 6.039,0.5272 45.096704,45.096704 0 0 0 5.7048,-0.2636 9.763441,9.763441 0 0 0 3.6651,-1.3179 5.86791,5.86791 0 0 0 2.5395,-3.2587 27.050263,27.050263 0 0 0 1.2575,-5.53508 55.730735,55.730735 0 0 0 0.4202,-7.21251 158.11284,158.11284 0 0 0 -0.3129,-11.78882 30.217313,30.217313 0 0 0 -1.101,-6.30187 5.911226,5.911226 0 0 0 -2.515,-3.57004 10.983294,10.983294 0 0 0 -3.5885,-1.47372 21.319589,21.319589 0 0 0 -4.8244,-0.49134 57.015487,57.015487 0 0 0 -4.6528,0.16194 17.099511,17.099511 0 0 0 -3.0854,0.4852 7.138992,7.138992 0 0 0 -3.9289,2.99498 l 0,0 z"
|
||||
id="path3082"
|
||||
style="fill:none;stroke:#ff0000" />
|
||||
<path
|
||||
d="m 808.23539,216.99105 0,-95.79752 41.2641,0 a 34.14365,34.14365 0 0 1 12.2774,1.98899 19.541659,19.541659 0 0 1 8.37612,5.96633 23.907413,23.907413 0 0 1 4.41962,8.9975 48.211674,48.211674 0 0 1 1.47525,12.61539 51.335387,51.335387 0 0 1 -1.77276,14.40103 37.898378,37.898378 0 0 1 -1.96598,5.31336 19.829803,19.829803 0 0 1 -2.34936,3.91172 16.201726,16.201726 0 0 1 -6.46841,4.88796 26.614618,26.614618 0 0 1 -11.40636,2.39628 143.35618,143.35618 0 0 1 -14.75865,-1.19799 519.68963,519.68963 0 0 1 -7.78724,-0.95876 24.527385,24.527385 0 0 1 -2.94743,-0.47907 l 0,37.95478 -18.3563,0 0,0 z"
|
||||
id="path3084"
|
||||
style="fill:none;stroke:#ff0000" />
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 13 KiB |
@@ -7,6 +7,9 @@
|
||||
#include "mpconfig.h"
|
||||
#include "asmthumb.h"
|
||||
|
||||
// wrapper around everything in this file
|
||||
#if MICROPY_EMIT_THUMB || MICROPY_EMIT_INLINE_THUMB
|
||||
|
||||
#define UNSIGNED_FIT8(x) (((x) & 0xffffff00) == 0)
|
||||
#define UNSIGNED_FIT16(x) (((x) & 0xffff0000) == 0)
|
||||
#define SIGNED_FIT8(x) (((x) & 0xffffff80) == 0) || (((x) & 0xffffff80) == 0xffffff80)
|
||||
@@ -447,3 +450,5 @@ void asm_thumb_bl_ind(asm_thumb_t *as, void *fun_ptr, uint fun_id, uint reg_temp
|
||||
asm_thumb_write_op16(as, OP_SVC(fun_id));
|
||||
}
|
||||
}
|
||||
|
||||
#endif // MICROPY_EMIT_THUMB || MICROPY_EMIT_INLINE_THUMB
|
||||
|
||||
@@ -6,6 +6,10 @@
|
||||
|
||||
#include "misc.h"
|
||||
#include "asmx64.h"
|
||||
#include "mpconfig.h"
|
||||
|
||||
// wrapper around everything in this file
|
||||
#if MICROPY_EMIT_X64
|
||||
|
||||
#if defined(__OpenBSD__) || defined(__MACH__)
|
||||
#define MAP_ANONYMOUS MAP_ANON
|
||||
@@ -620,3 +624,5 @@ void asm_x64_call_ind(asm_x64_t* as, void *ptr, int temp_r64) {
|
||||
asm_x64_write_word32(as, ptr - (void*)(as->code_base + as->code_offset + 4));
|
||||
*/
|
||||
}
|
||||
|
||||
#endif // MICROPY_EMIT_X64
|
||||
|
||||
@@ -1,12 +1,16 @@
|
||||
// Micro Python byte-codes.
|
||||
// The comment at the end of the line (if it exists) tells the arguments to the byte-code.
|
||||
|
||||
#define MP_BC_LOAD_CONST_FALSE (0x10)
|
||||
#define MP_BC_LOAD_CONST_NONE (0x11)
|
||||
#define MP_BC_LOAD_CONST_TRUE (0x12)
|
||||
#define MP_BC_LOAD_CONST_SMALL_INT (0x13) // 24-bit, in excess
|
||||
#define MP_BC_LOAD_CONST_INT (0x14) // qstr
|
||||
#define MP_BC_LOAD_CONST_DEC (0x15) // qstr
|
||||
#define MP_BC_LOAD_CONST_ID (0x16) // qstr
|
||||
#define MP_BC_LOAD_CONST_BYTES (0x17) // qstr
|
||||
#define MP_BC_LOAD_CONST_STRING (0x18) // qstr
|
||||
#define MP_BC_LOAD_CONST_ELLIPSIS (0x13)
|
||||
#define MP_BC_LOAD_CONST_SMALL_INT (0x14) // 24-bit, in excess
|
||||
#define MP_BC_LOAD_CONST_INT (0x15) // qstr
|
||||
#define MP_BC_LOAD_CONST_DEC (0x16) // qstr
|
||||
#define MP_BC_LOAD_CONST_ID (0x17) // qstr
|
||||
#define MP_BC_LOAD_CONST_BYTES (0x18) // qstr
|
||||
#define MP_BC_LOAD_CONST_STRING (0x19) // qstr
|
||||
|
||||
#define MP_BC_LOAD_FAST_0 (0x20)
|
||||
#define MP_BC_LOAD_FAST_1 (0x21)
|
||||
|
||||
+12
-135
@@ -8,6 +8,7 @@
|
||||
#include "nlr.h"
|
||||
#include "misc.h"
|
||||
#include "mpconfig.h"
|
||||
#include "mpqstr.h"
|
||||
#include "obj.h"
|
||||
#include "runtime0.h"
|
||||
#include "runtime.h"
|
||||
@@ -87,14 +88,6 @@ mp_obj_t mp_builtin_any(mp_obj_t o_in) {
|
||||
return mp_const_false;
|
||||
}
|
||||
|
||||
mp_obj_t mp_builtin_bool(int n_args, const mp_obj_t *args) {
|
||||
switch (n_args) {
|
||||
case 0: return mp_const_false;
|
||||
case 1: if (rt_is_true(args[0])) { return mp_const_true; } else { return mp_const_false; }
|
||||
default: nlr_jump(mp_obj_new_exception_msg_1_arg(rt_q_TypeError, "bool() takes at most 1 argument (%d given)", (void*)(machine_int_t)n_args));
|
||||
}
|
||||
}
|
||||
|
||||
mp_obj_t mp_builtin_callable(mp_obj_t o_in) {
|
||||
if (mp_obj_is_callable(o_in)) {
|
||||
return mp_const_true;
|
||||
@@ -103,42 +96,6 @@ mp_obj_t mp_builtin_callable(mp_obj_t o_in) {
|
||||
}
|
||||
}
|
||||
|
||||
#if MICROPY_ENABLE_FLOAT
|
||||
mp_obj_t mp_builtin_complex(int n_args, const mp_obj_t *args) {
|
||||
assert(0 <= n_args && n_args <= 2);
|
||||
|
||||
if (n_args == 0) {
|
||||
return mp_obj_new_complex(0, 0);
|
||||
} else if (n_args == 1) {
|
||||
// TODO allow string as first arg and parse it
|
||||
if (MP_OBJ_IS_TYPE(args[0], &complex_type)) {
|
||||
return args[0];
|
||||
} else {
|
||||
return mp_obj_new_complex(mp_obj_get_float(args[0]), 0);
|
||||
}
|
||||
} else {
|
||||
mp_float_t real, imag;
|
||||
if (MP_OBJ_IS_TYPE(args[0], &complex_type)) {
|
||||
mp_obj_get_complex(args[0], &real, &imag);
|
||||
} else {
|
||||
real = mp_obj_get_float(args[0]);
|
||||
imag = 0;
|
||||
}
|
||||
if (MP_OBJ_IS_TYPE(args[1], &complex_type)) {
|
||||
mp_float_t real2, imag2;
|
||||
mp_obj_get_complex(args[1], &real2, &imag2);
|
||||
real -= imag2;
|
||||
imag += real2;
|
||||
} else {
|
||||
imag += mp_obj_get_float(args[1]);
|
||||
}
|
||||
return mp_obj_new_complex(real, imag);
|
||||
}
|
||||
}
|
||||
|
||||
MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mp_builtin_complex_obj, 0, 2, mp_builtin_complex);
|
||||
#endif
|
||||
|
||||
mp_obj_t mp_builtin_chr(mp_obj_t o_in) {
|
||||
int ord = mp_obj_get_int(o_in);
|
||||
if (0 <= ord && ord <= 0x10ffff) {
|
||||
@@ -147,15 +104,10 @@ mp_obj_t mp_builtin_chr(mp_obj_t o_in) {
|
||||
str[1] = '\0';
|
||||
return mp_obj_new_str(qstr_from_str_take(str, 2));
|
||||
} else {
|
||||
nlr_jump(mp_obj_new_exception_msg(rt_q_ValueError, "chr() arg not in range(0x110000)"));
|
||||
nlr_jump(mp_obj_new_exception_msg(MP_QSTR_ValueError, "chr() arg not in range(0x110000)"));
|
||||
}
|
||||
}
|
||||
|
||||
mp_obj_t mp_builtin_dict(void) {
|
||||
// TODO create from an iterable!
|
||||
return rt_build_map(0);
|
||||
}
|
||||
|
||||
mp_obj_t mp_builtin_divmod(mp_obj_t o1_in, mp_obj_t o2_in) {
|
||||
if (MP_OBJ_IS_SMALL_INT(o1_in) && MP_OBJ_IS_SMALL_INT(o2_in)) {
|
||||
mp_small_int_t i1 = MP_OBJ_SMALL_INT_VALUE(o1_in);
|
||||
@@ -165,29 +117,10 @@ mp_obj_t mp_builtin_divmod(mp_obj_t o1_in, mp_obj_t o2_in) {
|
||||
revs_args[0] = MP_OBJ_NEW_SMALL_INT(i1 % i2);
|
||||
return rt_build_tuple(2, revs_args);
|
||||
} else {
|
||||
nlr_jump(mp_obj_new_exception_msg_2_args(rt_q_TypeError, "unsupported operand type(s) for divmod(): '%s' and '%s'", mp_obj_get_type_str(o1_in), mp_obj_get_type_str(o2_in)));
|
||||
nlr_jump(mp_obj_new_exception_msg_2_args(MP_QSTR_TypeError, "unsupported operand type(s) for divmod(): '%s' and '%s'", mp_obj_get_type_str(o1_in), mp_obj_get_type_str(o2_in)));
|
||||
}
|
||||
}
|
||||
|
||||
#if MICROPY_ENABLE_FLOAT
|
||||
static mp_obj_t mp_builtin_float(int n_args, const mp_obj_t *args) {
|
||||
assert(0 <= n_args && n_args <= 1);
|
||||
|
||||
if (n_args == 0) {
|
||||
return mp_obj_new_float(0);
|
||||
} else {
|
||||
// TODO allow string as arg and parse it
|
||||
if (MP_OBJ_IS_TYPE(args[0], &float_type)) {
|
||||
return args[0];
|
||||
} else {
|
||||
return mp_obj_new_float(mp_obj_get_float(args[0]));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mp_builtin_float_obj, 0, 1, mp_builtin_float);
|
||||
#endif
|
||||
|
||||
static mp_obj_t mp_builtin_hash(mp_obj_t o_in) {
|
||||
// TODO hash will generally overflow small integer; can we safely truncate it?
|
||||
return mp_obj_new_int(mp_obj_hash(o_in));
|
||||
@@ -195,23 +128,6 @@ static mp_obj_t mp_builtin_hash(mp_obj_t o_in) {
|
||||
|
||||
MP_DEFINE_CONST_FUN_OBJ_1(mp_builtin_hash_obj, mp_builtin_hash);
|
||||
|
||||
static mp_obj_t mp_builtin_int(int n_args, const mp_obj_t *args) {
|
||||
assert(0 <= n_args && n_args <= 2);
|
||||
|
||||
if (n_args == 0) {
|
||||
return MP_OBJ_NEW_SMALL_INT(0);
|
||||
} else if (n_args == 1) {
|
||||
// TODO if arg is a string then parse it
|
||||
return mp_obj_new_int(mp_obj_get_int(args[0]));
|
||||
} else { // n_args == 2
|
||||
// TODO, parse with given base
|
||||
assert(0);
|
||||
return MP_OBJ_NEW_SMALL_INT(0);
|
||||
}
|
||||
}
|
||||
|
||||
MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mp_builtin_int_obj, 0, 2, mp_builtin_int);
|
||||
|
||||
static mp_obj_t mp_builtin_iter(mp_obj_t o_in) {
|
||||
return rt_getiter(o_in);
|
||||
}
|
||||
@@ -235,29 +151,11 @@ mp_obj_t mp_builtin_len(mp_obj_t o_in) {
|
||||
} else if (MP_OBJ_IS_TYPE(o_in, &dict_type)) {
|
||||
len = mp_obj_dict_len(o_in);
|
||||
} else {
|
||||
nlr_jump(mp_obj_new_exception_msg_1_arg(rt_q_TypeError, "object of type '%s' has no len()", mp_obj_get_type_str(o_in)));
|
||||
nlr_jump(mp_obj_new_exception_msg_1_arg(MP_QSTR_TypeError, "object of type '%s' has no len()", mp_obj_get_type_str(o_in)));
|
||||
}
|
||||
return MP_OBJ_NEW_SMALL_INT(len);
|
||||
}
|
||||
|
||||
mp_obj_t mp_builtin_list(int n_args, const mp_obj_t *args) {
|
||||
switch (n_args) {
|
||||
case 0: return rt_build_list(0, NULL);
|
||||
case 1:
|
||||
{
|
||||
// make list from iterable
|
||||
mp_obj_t iterable = rt_getiter(args[0]);
|
||||
mp_obj_t list = rt_build_list(0, NULL);
|
||||
mp_obj_t item;
|
||||
while ((item = rt_iternext(iterable)) != mp_const_stop_iteration) {
|
||||
rt_list_append(list, item);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
default: nlr_jump(mp_obj_new_exception_msg_1_arg(rt_q_TypeError, "list() takes at most 1 argument (%d given)", (void*)(machine_int_t)n_args));
|
||||
}
|
||||
}
|
||||
|
||||
mp_obj_t mp_builtin_max(int n_args, const mp_obj_t *args) {
|
||||
if (n_args == 1) {
|
||||
// given an iterable
|
||||
@@ -270,7 +168,7 @@ mp_obj_t mp_builtin_max(int n_args, const mp_obj_t *args) {
|
||||
}
|
||||
}
|
||||
if (max_obj == NULL) {
|
||||
nlr_jump(mp_obj_new_exception_msg(rt_q_ValueError, "max() arg is an empty sequence"));
|
||||
nlr_jump(mp_obj_new_exception_msg(MP_QSTR_ValueError, "max() arg is an empty sequence"));
|
||||
}
|
||||
return max_obj;
|
||||
} else {
|
||||
@@ -297,7 +195,7 @@ mp_obj_t mp_builtin_min(int n_args, const mp_obj_t *args) {
|
||||
}
|
||||
}
|
||||
if (min_obj == NULL) {
|
||||
nlr_jump(mp_obj_new_exception_msg(rt_q_ValueError, "min() arg is an empty sequence"));
|
||||
nlr_jump(mp_obj_new_exception_msg(MP_QSTR_ValueError, "min() arg is an empty sequence"));
|
||||
}
|
||||
return min_obj;
|
||||
} else {
|
||||
@@ -315,7 +213,7 @@ mp_obj_t mp_builtin_min(int n_args, const mp_obj_t *args) {
|
||||
static mp_obj_t mp_builtin_next(mp_obj_t o) {
|
||||
mp_obj_t ret = rt_iternext(o);
|
||||
if (ret == mp_const_stop_iteration) {
|
||||
nlr_jump(mp_obj_new_exception(qstr_from_str_static("StopIteration")));
|
||||
nlr_jump(mp_obj_new_exception(MP_QSTR_StopIteration));
|
||||
} else {
|
||||
return ret;
|
||||
}
|
||||
@@ -328,7 +226,7 @@ mp_obj_t mp_builtin_ord(mp_obj_t o_in) {
|
||||
if (strlen(str) == 1) {
|
||||
return mp_obj_new_int(str[0]);
|
||||
} else {
|
||||
nlr_jump(mp_obj_new_exception_msg_1_arg(rt_q_TypeError, "ord() expected a character, but string of length %d found", (void*)(machine_int_t)strlen(str)));
|
||||
nlr_jump(mp_obj_new_exception_msg_1_arg(MP_QSTR_TypeError, "ord() expected a character, but string of length %d found", (void*)(machine_int_t)strlen(str)));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -336,7 +234,7 @@ mp_obj_t mp_builtin_pow(int n_args, const mp_obj_t *args) {
|
||||
switch (n_args) {
|
||||
case 2: return rt_binary_op(RT_BINARY_OP_POWER, args[0], args[1]);
|
||||
case 3: return rt_binary_op(RT_BINARY_OP_MODULO, rt_binary_op(RT_BINARY_OP_POWER, args[0], args[1]), args[2]); // TODO optimise...
|
||||
default: nlr_jump(mp_obj_new_exception_msg_1_arg(rt_q_TypeError, "pow expected at most 3 arguments, got %d", (void*)(machine_int_t)n_args));
|
||||
default: nlr_jump(mp_obj_new_exception_msg_1_arg(MP_QSTR_TypeError, "pow expected at most 3 arguments, got %d", (void*)(machine_int_t)n_args));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -362,36 +260,16 @@ mp_obj_t mp_builtin_range(int n_args, const mp_obj_t *args) {
|
||||
case 1: return mp_obj_new_range(0, mp_obj_get_int(args[0]), 1);
|
||||
case 2: return mp_obj_new_range(mp_obj_get_int(args[0]), mp_obj_get_int(args[1]), 1);
|
||||
case 3: return mp_obj_new_range(mp_obj_get_int(args[0]), mp_obj_get_int(args[1]), mp_obj_get_int(args[2]));
|
||||
default: nlr_jump(mp_obj_new_exception_msg_1_arg(rt_q_TypeError, "range expected at most 3 arguments, got %d", (void*)(machine_int_t)n_args));
|
||||
default: nlr_jump(mp_obj_new_exception_msg_1_arg(MP_QSTR_TypeError, "range expected at most 3 arguments, got %d", (void*)(machine_int_t)n_args));
|
||||
}
|
||||
}
|
||||
|
||||
static mp_obj_t mp_builtin_set(int n_args, const mp_obj_t *args) {
|
||||
assert(0 <= n_args && n_args <= 1);
|
||||
|
||||
if (n_args == 0) {
|
||||
// return a new, empty set
|
||||
return mp_obj_new_set(0, NULL);
|
||||
} else {
|
||||
// 1 argument, an iterable from which we make a new set
|
||||
mp_obj_t set = mp_obj_new_set(0, NULL);
|
||||
mp_obj_t iterable = rt_getiter(args[0]);
|
||||
mp_obj_t item;
|
||||
while ((item = rt_iternext(iterable)) != mp_const_stop_iteration) {
|
||||
mp_obj_set_store(set, item);
|
||||
}
|
||||
return set;
|
||||
}
|
||||
}
|
||||
|
||||
MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mp_builtin_set_obj, 0, 1, mp_builtin_set);
|
||||
|
||||
mp_obj_t mp_builtin_sum(int n_args, const mp_obj_t *args) {
|
||||
mp_obj_t value;
|
||||
switch (n_args) {
|
||||
case 1: value = mp_obj_new_int(0); break;
|
||||
case 2: value = args[1]; break;
|
||||
default: nlr_jump(mp_obj_new_exception_msg_1_arg(rt_q_TypeError, "sum expected at most 2 arguments, got %d", (void*)(machine_int_t)n_args));
|
||||
default: nlr_jump(mp_obj_new_exception_msg_1_arg(MP_QSTR_TypeError, "sum expected at most 2 arguments, got %d", (void*)(machine_int_t)n_args));
|
||||
}
|
||||
mp_obj_t iterable = rt_getiter(args[0]);
|
||||
mp_obj_t item;
|
||||
@@ -404,8 +282,7 @@ mp_obj_t mp_builtin_sum(int n_args, const mp_obj_t *args) {
|
||||
static mp_obj_t mp_builtin_type(mp_obj_t o_in) {
|
||||
// TODO implement the 3 argument version of type()
|
||||
if (MP_OBJ_IS_SMALL_INT(o_in)) {
|
||||
// TODO implement int-type
|
||||
return mp_const_none;
|
||||
return (mp_obj_t)&int_type;
|
||||
} else {
|
||||
mp_obj_base_t *o = o_in;
|
||||
return (mp_obj_t)o->type;
|
||||
|
||||
+3
-2
@@ -58,7 +58,9 @@ mp_obj_t mp_builtin___import__(int n, mp_obj_t *args) {
|
||||
return mp_const_none;
|
||||
}
|
||||
|
||||
if (!mp_compile(pn, false)) {
|
||||
mp_obj_t module_fun = mp_compile(pn, false);
|
||||
|
||||
if (module_fun == mp_const_none) {
|
||||
// TODO handle compile error correctly
|
||||
rt_locals_set(old_locals);
|
||||
rt_globals_set(old_globals);
|
||||
@@ -66,7 +68,6 @@ mp_obj_t mp_builtin___import__(int n, mp_obj_t *args) {
|
||||
}
|
||||
|
||||
// complied successfully, execute it
|
||||
mp_obj_t module_fun = rt_make_function_from_id(1); // TODO we should return from mp_compile the unique_code_id for the module
|
||||
nlr_buf_t nlr;
|
||||
if (nlr_push(&nlr) == 0) {
|
||||
rt_call_function_0(module_fun);
|
||||
|
||||
+31
-52
@@ -7,6 +7,7 @@
|
||||
|
||||
#include "misc.h"
|
||||
#include "mpconfig.h"
|
||||
#include "mpqstr.h"
|
||||
#include "lexer.h"
|
||||
#include "parse.h"
|
||||
#include "scope.h"
|
||||
@@ -38,20 +39,6 @@ typedef enum {
|
||||
#define EMIT_OPT_ASM_THUMB (4)
|
||||
|
||||
typedef struct _compiler_t {
|
||||
qstr qstr___class__;
|
||||
qstr qstr___locals__;
|
||||
qstr qstr___name__;
|
||||
qstr qstr___module__;
|
||||
qstr qstr___qualname__;
|
||||
qstr qstr___doc__;
|
||||
qstr qstr_assertion_error;
|
||||
qstr qstr_micropython;
|
||||
qstr qstr_byte_code;
|
||||
qstr qstr_native;
|
||||
qstr qstr_viper;
|
||||
qstr qstr_asm_thumb;
|
||||
qstr qstr_range;
|
||||
|
||||
bool is_repl;
|
||||
pass_kind_t pass;
|
||||
bool had_error; // try to keep compiler clean from nlr
|
||||
@@ -202,7 +189,7 @@ static int comp_next_label(compiler_t *comp) {
|
||||
}
|
||||
|
||||
static scope_t *scope_new_and_link(compiler_t *comp, scope_kind_t kind, mp_parse_node_t pn, uint emit_options) {
|
||||
scope_t *scope = scope_new(kind, pn, rt_get_unique_code_id(kind == SCOPE_MODULE), emit_options);
|
||||
scope_t *scope = scope_new(kind, pn, rt_get_unique_code_id(), emit_options);
|
||||
scope->parent = comp->scope_cur;
|
||||
scope->next = NULL;
|
||||
if (comp->scope_head == NULL) {
|
||||
@@ -903,7 +890,7 @@ qstr compile_classdef_helper(compiler_t *comp, mp_parse_node_struct_t *pns, uint
|
||||
|
||||
// returns true if it was a built-in decorator (even if the built-in had an error)
|
||||
static bool compile_built_in_decorator(compiler_t *comp, int name_len, mp_parse_node_t *name_nodes, uint *emit_options) {
|
||||
if (MP_PARSE_NODE_LEAF_ARG(name_nodes[0]) != comp->qstr_micropython) {
|
||||
if (MP_PARSE_NODE_LEAF_ARG(name_nodes[0]) != MP_QSTR_micropython) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -913,16 +900,16 @@ static bool compile_built_in_decorator(compiler_t *comp, int name_len, mp_parse_
|
||||
}
|
||||
|
||||
qstr attr = MP_PARSE_NODE_LEAF_ARG(name_nodes[1]);
|
||||
if (attr == comp->qstr_byte_code) {
|
||||
if (attr == MP_QSTR_byte_code) {
|
||||
*emit_options = EMIT_OPT_BYTE_CODE;
|
||||
#if MICROPY_EMIT_NATIVE
|
||||
} else if (attr == comp->qstr_native) {
|
||||
} else if (attr == MP_QSTR_native) {
|
||||
*emit_options = EMIT_OPT_NATIVE_PYTHON;
|
||||
} else if (attr == comp->qstr_viper) {
|
||||
} else if (attr == MP_QSTR_viper) {
|
||||
*emit_options = EMIT_OPT_VIPER;
|
||||
#endif
|
||||
#if MICROPY_EMIT_INLINE_THUMB
|
||||
} else if (attr == comp->qstr_asm_thumb) {
|
||||
} else if (attr == MP_QSTR_asm_thumb) {
|
||||
*emit_options = EMIT_OPT_ASM_THUMB;
|
||||
#endif
|
||||
} else {
|
||||
@@ -1329,7 +1316,7 @@ void compile_nonlocal_stmt(compiler_t *comp, mp_parse_node_struct_t *pns) {
|
||||
void compile_assert_stmt(compiler_t *comp, mp_parse_node_struct_t *pns) {
|
||||
int l_end = comp_next_label(comp);
|
||||
c_if_cond(comp, pns->nodes[0], true, l_end);
|
||||
EMIT(load_id, comp->qstr_assertion_error);
|
||||
EMIT(load_id, MP_QSTR_AssertionError);
|
||||
if (!MP_PARSE_NODE_IS_NULL(pns->nodes[1])) {
|
||||
// assertion message
|
||||
compile_node(comp, pns->nodes[1]);
|
||||
@@ -1495,7 +1482,7 @@ void compile_for_stmt(compiler_t *comp, mp_parse_node_struct_t *pns) {
|
||||
// for viper it will be much, much faster
|
||||
if (/*comp->scope_cur->emit_options == EMIT_OPT_VIPER &&*/ MP_PARSE_NODE_IS_ID(pns->nodes[0]) && MP_PARSE_NODE_IS_STRUCT_KIND(pns->nodes[1], PN_power)) {
|
||||
mp_parse_node_struct_t *pns_it = (mp_parse_node_struct_t*)pns->nodes[1];
|
||||
if (MP_PARSE_NODE_IS_ID(pns_it->nodes[0]) && MP_PARSE_NODE_LEAF_ARG(pns_it->nodes[0]) == comp->qstr_range && MP_PARSE_NODE_IS_STRUCT_KIND(pns_it->nodes[1], PN_trailer_paren) && MP_PARSE_NODE_IS_NULL(pns_it->nodes[2])) {
|
||||
if (MP_PARSE_NODE_IS_ID(pns_it->nodes[0]) && MP_PARSE_NODE_LEAF_ARG(pns_it->nodes[0]) == MP_QSTR_range && MP_PARSE_NODE_IS_STRUCT_KIND(pns_it->nodes[1], PN_trailer_paren) && MP_PARSE_NODE_IS_NULL(pns_it->nodes[2])) {
|
||||
mp_parse_node_t pn_range_args = ((mp_parse_node_struct_t*)pns_it->nodes[1])->nodes[0];
|
||||
mp_parse_node_t *args;
|
||||
int n_args = list_get(&pn_range_args, PN_arglist, &args);
|
||||
@@ -1743,7 +1730,7 @@ void compile_expr_stmt(compiler_t *comp, mp_parse_node_struct_t *pns) {
|
||||
if (MP_PARSE_NODE_IS_NULL(pns->nodes[1])) {
|
||||
if (comp->is_repl && comp->scope_cur->kind == SCOPE_MODULE) {
|
||||
// for REPL, evaluate then print the expression
|
||||
EMIT(load_id, qstr_from_str_static("__repl_print__"));
|
||||
EMIT(load_id, MP_QSTR___repl_print__);
|
||||
compile_node(comp, pns->nodes[0]);
|
||||
EMIT(call_function, 1, 0, false, false);
|
||||
EMIT(pop_top);
|
||||
@@ -2683,7 +2670,7 @@ void check_for_doc_string(compiler_t *comp, mp_parse_node_t pn) {
|
||||
if (kind == MP_PARSE_NODE_STRING) {
|
||||
compile_node(comp, pns->nodes[0]); // a doc string
|
||||
// store doc string
|
||||
EMIT(store_id, comp->qstr___doc__);
|
||||
EMIT(store_id, MP_QSTR___doc__);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2796,35 +2783,35 @@ void compile_scope(compiler_t *comp, scope_t *scope, pass_kind_t pass) {
|
||||
|
||||
if (comp->pass == PASS_1) {
|
||||
bool added;
|
||||
id_info_t *id_info = scope_find_or_add_id(scope, comp->qstr___class__, &added);
|
||||
id_info_t *id_info = scope_find_or_add_id(scope, MP_QSTR___class__, &added);
|
||||
assert(added);
|
||||
id_info->kind = ID_INFO_KIND_LOCAL;
|
||||
id_info = scope_find_or_add_id(scope, comp->qstr___locals__, &added);
|
||||
id_info = scope_find_or_add_id(scope, MP_QSTR___locals__, &added);
|
||||
assert(added);
|
||||
id_info->kind = ID_INFO_KIND_LOCAL;
|
||||
id_info->param = true;
|
||||
scope->num_params = 1; // __locals__ is the parameter
|
||||
}
|
||||
|
||||
EMIT(load_id, comp->qstr___locals__);
|
||||
EMIT(load_id, MP_QSTR___locals__);
|
||||
EMIT(store_locals);
|
||||
EMIT(load_id, comp->qstr___name__);
|
||||
EMIT(store_id, comp->qstr___module__);
|
||||
EMIT(load_id, MP_QSTR___name__);
|
||||
EMIT(store_id, MP_QSTR___module__);
|
||||
EMIT(load_const_id, MP_PARSE_NODE_LEAF_ARG(pns->nodes[0])); // 0 is class name
|
||||
EMIT(store_id, comp->qstr___qualname__);
|
||||
EMIT(store_id, MP_QSTR___qualname__);
|
||||
|
||||
check_for_doc_string(comp, pns->nodes[2]);
|
||||
compile_node(comp, pns->nodes[2]); // 2 is class body
|
||||
|
||||
id_info_t *id = scope_find(scope, comp->qstr___class__);
|
||||
id_info_t *id = scope_find(scope, MP_QSTR___class__);
|
||||
assert(id != NULL);
|
||||
if (id->kind == ID_INFO_KIND_LOCAL) {
|
||||
EMIT(load_const_tok, MP_TOKEN_KW_NONE);
|
||||
} else {
|
||||
#if MICROPY_EMIT_CPYTHON
|
||||
EMIT(load_closure, comp->qstr___class__, 0); // XXX check this is the correct local num
|
||||
EMIT(load_closure, MP_QSTR___class__, 0); // XXX check this is the correct local num
|
||||
#else
|
||||
EMIT(load_fast, comp->qstr___class__, 0); // XXX check this is the correct local num
|
||||
EMIT(load_fast, MP_QSTR___class__, 0); // XXX check this is the correct local num
|
||||
#endif
|
||||
}
|
||||
EMIT(return_value);
|
||||
@@ -2917,7 +2904,7 @@ void compile_scope_compute_things(compiler_t *comp, scope_t *scope) {
|
||||
scope->num_locals = 0;
|
||||
for (int i = 0; i < scope->id_info_len; i++) {
|
||||
id_info_t *id = &scope->id_info[i];
|
||||
if (scope->kind == SCOPE_CLASS && id->qstr == comp->qstr___class__) {
|
||||
if (scope->kind == SCOPE_CLASS && id->qstr == MP_QSTR___class__) {
|
||||
// __class__ is not counted as a local; if it's used then it becomes a ID_INFO_KIND_CELL
|
||||
continue;
|
||||
}
|
||||
@@ -3021,20 +3008,6 @@ void compile_scope_compute_things(compiler_t *comp, scope_t *scope) {
|
||||
mp_obj_t mp_compile(mp_parse_node_t pn, bool is_repl) {
|
||||
compiler_t *comp = m_new(compiler_t, 1);
|
||||
|
||||
comp->qstr___class__ = qstr_from_str_static("__class__");
|
||||
comp->qstr___locals__ = qstr_from_str_static("__locals__");
|
||||
comp->qstr___name__ = qstr_from_str_static("__name__");
|
||||
comp->qstr___module__ = qstr_from_str_static("__module__");
|
||||
comp->qstr___qualname__ = qstr_from_str_static("__qualname__");
|
||||
comp->qstr___doc__ = qstr_from_str_static("__doc__");
|
||||
comp->qstr_assertion_error = qstr_from_str_static("AssertionError");
|
||||
comp->qstr_micropython = qstr_from_str_static("micropython");
|
||||
comp->qstr_byte_code = qstr_from_str_static("byte_code");
|
||||
comp->qstr_native = qstr_from_str_static("native");
|
||||
comp->qstr_viper = qstr_from_str_static("viper");
|
||||
comp->qstr_asm_thumb = qstr_from_str_static("asm_thumb");
|
||||
comp->qstr_range = qstr_from_str_static("range");
|
||||
|
||||
comp->is_repl = is_repl;
|
||||
comp->had_error = false;
|
||||
|
||||
@@ -3048,10 +3021,10 @@ mp_obj_t mp_compile(mp_parse_node_t pn, bool is_repl) {
|
||||
pn = fold_constants(pn);
|
||||
|
||||
// set the outer scope
|
||||
scope_new_and_link(comp, SCOPE_MODULE, pn, EMIT_OPT_NONE);
|
||||
scope_t *module_scope = scope_new_and_link(comp, SCOPE_MODULE, pn, EMIT_OPT_NONE);
|
||||
|
||||
// compile pass 1
|
||||
comp->emit = emit_pass1_new(comp->qstr___class__);
|
||||
comp->emit = emit_pass1_new(MP_QSTR___class__);
|
||||
comp->emit_method_table = &emit_pass1_method_table;
|
||||
comp->emit_inline_asm = NULL;
|
||||
comp->emit_inline_asm_method_table = NULL;
|
||||
@@ -3083,11 +3056,13 @@ mp_obj_t mp_compile(mp_parse_node_t pn, bool is_repl) {
|
||||
// compile pass 2 and 3
|
||||
#if !MICROPY_EMIT_CPYTHON
|
||||
emit_t *emit_bc = NULL;
|
||||
#if MICROPY_EMIT_NATIVE
|
||||
emit_t *emit_native = NULL;
|
||||
#endif
|
||||
#if MICROPY_EMIT_INLINE_THUMB
|
||||
emit_inline_asm_t *emit_inline_thumb = NULL;
|
||||
#endif
|
||||
#endif // !MICROPY_EMIT_CPYTHON
|
||||
for (scope_t *s = comp->scope_head; s != NULL && !comp->had_error; s = s->next) {
|
||||
if (false) {
|
||||
// dummy
|
||||
@@ -3115,6 +3090,8 @@ mp_obj_t mp_compile(mp_parse_node_t pn, bool is_repl) {
|
||||
comp->emit_method_table = &emit_cpython_method_table;
|
||||
#else
|
||||
switch (s->emit_options) {
|
||||
|
||||
#if MICROPY_EMIT_NATIVE
|
||||
case EMIT_OPT_NATIVE_PYTHON:
|
||||
case EMIT_OPT_VIPER:
|
||||
#if MICROPY_EMIT_X64
|
||||
@@ -3131,6 +3108,7 @@ mp_obj_t mp_compile(mp_parse_node_t pn, bool is_repl) {
|
||||
comp->emit = emit_native;
|
||||
comp->emit_method_table->set_native_types(comp->emit, s->emit_options == EMIT_OPT_VIPER);
|
||||
break;
|
||||
#endif // MICROPY_EMIT_NATIVE
|
||||
|
||||
default:
|
||||
if (emit_bc == NULL) {
|
||||
@@ -3140,7 +3118,7 @@ mp_obj_t mp_compile(mp_parse_node_t pn, bool is_repl) {
|
||||
comp->emit_method_table = &emit_bc_method_table;
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
#endif // !MICROPY_EMIT_CPYTHON
|
||||
|
||||
// compile pass 2 and pass 3
|
||||
compile_scope(comp, s, PASS_2);
|
||||
@@ -3157,10 +3135,11 @@ mp_obj_t mp_compile(mp_parse_node_t pn, bool is_repl) {
|
||||
} else {
|
||||
#if MICROPY_EMIT_CPYTHON
|
||||
// can't create code, so just return true
|
||||
(void)module_scope; // to suppress warning that module_scope is unused
|
||||
return mp_const_true;
|
||||
#else
|
||||
// return function that executes the outer module
|
||||
return rt_make_function_from_id(1);
|
||||
return rt_make_function_from_id(module_scope->unique_code_id);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@@ -249,6 +249,7 @@ static void emit_bc_load_const_tok(emit_t *emit, mp_token_kind_t tok) {
|
||||
case MP_TOKEN_KW_FALSE: emit_write_byte_1(emit, MP_BC_LOAD_CONST_FALSE); break;
|
||||
case MP_TOKEN_KW_NONE: emit_write_byte_1(emit, MP_BC_LOAD_CONST_NONE); break;
|
||||
case MP_TOKEN_KW_TRUE: emit_write_byte_1(emit, MP_BC_LOAD_CONST_TRUE); break;
|
||||
case MP_TOKEN_ELLIPSIS: emit_write_byte_1(emit, MP_BC_LOAD_CONST_ELLIPSIS); break;
|
||||
default: assert(0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
#include "runtime0.h"
|
||||
#include "emit.h"
|
||||
|
||||
// wrapper around everything in this file
|
||||
#if MICROPY_EMIT_CPYTHON
|
||||
|
||||
struct _emit_t {
|
||||
|
||||
+2
-2
@@ -34,7 +34,7 @@
|
||||
#include "runtime.h"
|
||||
|
||||
// wrapper around everything in this file
|
||||
#if N_X64 || N_THUMB
|
||||
#if (MICROPY_EMIT_X64 && N_X64) || (MICROPY_EMIT_THUMB && N_THUMB)
|
||||
|
||||
#if N_X64
|
||||
|
||||
@@ -1319,4 +1319,4 @@ const emit_method_table_t EXPORT_FUN(method_table) = {
|
||||
emit_native_yield_from,
|
||||
};
|
||||
|
||||
#endif // N_X64 || N_THUMB
|
||||
#endif // (MICROPY_EMIT_X64 && N_X64) || (MICROPY_EMIT_THUMB && N_THUMB)
|
||||
|
||||
+3
-2
@@ -7,6 +7,7 @@
|
||||
|
||||
#include "misc.h"
|
||||
#include "mpconfig.h"
|
||||
#include "mpqstr.h"
|
||||
#include "lexer.h"
|
||||
#include "parse.h"
|
||||
#include "scope.h"
|
||||
@@ -44,9 +45,9 @@ static void emit_pass1_load_id(emit_t *emit, qstr qstr) {
|
||||
bool added;
|
||||
id_info_t *id = scope_find_or_add_id(emit->scope, qstr, &added);
|
||||
if (added) {
|
||||
if (strcmp(qstr_str(qstr), "AssertionError") == 0) {
|
||||
id->kind = ID_INFO_KIND_GLOBAL_EXPLICIT;
|
||||
if (qstr == MP_QSTR_AssertionError) {
|
||||
// TODO how much of a hack is this?
|
||||
id->kind = ID_INFO_KIND_GLOBAL_EXPLICIT;
|
||||
} else if (strcmp(qstr_str(qstr), "super") == 0 && emit->scope->kind == SCOPE_FUNCTION) {
|
||||
// special case, super is a global, and also counts as use of __class__
|
||||
id->kind = ID_INFO_KIND_GLOBAL_EXPLICIT;
|
||||
|
||||
+4
-4
@@ -113,11 +113,11 @@ DEF_RULE(import_stmt, nc, or(2), rule(import_name), rule(import_from))
|
||||
DEF_RULE(import_name, c(import_name), and(2), tok(KW_IMPORT), rule(dotted_as_names))
|
||||
DEF_RULE(import_from, c(import_from), and(4), tok(KW_FROM), rule(import_from_2), tok(KW_IMPORT), rule(import_from_3))
|
||||
DEF_RULE(import_from_2, nc, or(2), rule(dotted_name), rule(import_from_2b))
|
||||
DEF_RULE(import_from_2b, nc, and(2), rule(one_or_more_period_or_ellipses), opt_rule(dotted_name))
|
||||
DEF_RULE(import_from_2b, nc, and(2), rule(one_or_more_period_or_ellipsis), opt_rule(dotted_name))
|
||||
DEF_RULE(import_from_3, nc, or(3), tok(OP_STAR), rule(import_as_names_paren), rule(import_as_names))
|
||||
DEF_RULE(import_as_names_paren, nc, and(3), tok(DEL_PAREN_OPEN), rule(import_as_names), tok(DEL_PAREN_CLOSE))
|
||||
DEF_RULE(one_or_more_period_or_ellipses, nc, one_or_more, rule(period_or_ellipses))
|
||||
DEF_RULE(period_or_ellipses, nc, or(2), tok(DEL_PERIOD), tok(ELLIPSES))
|
||||
DEF_RULE(one_or_more_period_or_ellipsis, nc, one_or_more, rule(period_or_ellipsis))
|
||||
DEF_RULE(period_or_ellipsis, nc, or(2), tok(DEL_PERIOD), tok(ELLIPSIS))
|
||||
DEF_RULE(import_as_name, nc, and(2), tok(NAME), opt_rule(as_name))
|
||||
DEF_RULE(dotted_as_name, nc, and(2), rule(dotted_name), opt_rule(as_name))
|
||||
DEF_RULE(as_name, nc, and(2), tok(KW_AS), tok(NAME))
|
||||
@@ -220,7 +220,7 @@ DEF_RULE(power_dbl_star, c(power_dbl_star), and(2), tok(OP_DBL_STAR), rule(facto
|
||||
// testlist_comp: (test|star_expr) ( comp_for | (',' (test|star_expr))* [','] )
|
||||
// trailer: '(' [arglist] ')' | '[' subscriptlist ']' | '.' NAME
|
||||
|
||||
DEF_RULE(atom, nc, or(10), tok(NAME), tok(NUMBER), rule(atom_string), tok(ELLIPSES), tok(KW_NONE), tok(KW_TRUE), tok(KW_FALSE), rule(atom_paren), rule(atom_bracket), rule(atom_brace))
|
||||
DEF_RULE(atom, nc, or(10), tok(NAME), tok(NUMBER), rule(atom_string), tok(ELLIPSIS), tok(KW_NONE), tok(KW_TRUE), tok(KW_FALSE), rule(atom_paren), rule(atom_bracket), rule(atom_brace))
|
||||
DEF_RULE(atom_string, c(atom_string), one_or_more, rule(string_or_bytes))
|
||||
DEF_RULE(string_or_bytes, nc, or(2), tok(STRING), tok(BYTES))
|
||||
DEF_RULE(atom_paren, c(atom_paren), and(3), tok(DEL_PAREN_OPEN), opt_rule(atom_2b), tok(DEL_PAREN_CLOSE))
|
||||
|
||||
+1
-1
@@ -239,7 +239,7 @@ static const uint8_t tok_enc_kind[] = {
|
||||
MP_TOKEN_OP_CARET, MP_TOKEN_DEL_CARET_EQUAL,
|
||||
MP_TOKEN_DEL_EQUAL, MP_TOKEN_OP_DBL_EQUAL,
|
||||
MP_TOKEN_OP_NOT_EQUAL,
|
||||
MP_TOKEN_DEL_PERIOD, MP_TOKEN_ELLIPSES,
|
||||
MP_TOKEN_DEL_PERIOD, MP_TOKEN_ELLIPSIS,
|
||||
};
|
||||
|
||||
// must have the same order as enum in lexer.h
|
||||
|
||||
+1
-1
@@ -20,7 +20,7 @@ typedef enum _mp_token_kind_t {
|
||||
MP_TOKEN_STRING,
|
||||
MP_TOKEN_BYTES,
|
||||
|
||||
MP_TOKEN_ELLIPSES,
|
||||
MP_TOKEN_ELLIPSIS,
|
||||
|
||||
MP_TOKEN_KW_FALSE, // 12
|
||||
MP_TOKEN_KW_NONE,
|
||||
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
// See mpqstrraw.h for a list of qstr's that are available as constants.
|
||||
// Reference them as MP_QSTR_xxxx.
|
||||
//
|
||||
// Note: it would be possible to define MP_QSTR_xxx as qstr_from_str_static("xxx")
|
||||
// for qstrs that are referenced this way, but you don't want to have them in ROM.
|
||||
|
||||
enum {
|
||||
MP_QSTR_nil = 0,
|
||||
#define Q(id) MP_QSTR_##id,
|
||||
#include "mpqstrraw.h"
|
||||
#undef Q
|
||||
MP_QSTR_number_of,
|
||||
} category_t;
|
||||
@@ -0,0 +1,65 @@
|
||||
// All the qstr definitions in this file are available as constants.
|
||||
// That is, they are in ROM and you can reference them simple as MP_QSTR_xxxx.
|
||||
|
||||
Q(__build_class__)
|
||||
Q(__class__)
|
||||
Q(__doc__)
|
||||
Q(__init__)
|
||||
Q(__locals__)
|
||||
Q(__main__)
|
||||
Q(__module__)
|
||||
Q(__name__)
|
||||
Q(__next__)
|
||||
Q(__qualname__)
|
||||
Q(__repl_print__)
|
||||
|
||||
Q(micropython)
|
||||
Q(byte_code)
|
||||
Q(native)
|
||||
Q(viper)
|
||||
Q(asm_thumb)
|
||||
|
||||
Q(Ellipsis)
|
||||
Q(StopIteration)
|
||||
|
||||
Q(AssertionError)
|
||||
Q(AttributeError)
|
||||
Q(IndexError)
|
||||
Q(KeyError)
|
||||
Q(NameError)
|
||||
Q(SyntaxError)
|
||||
Q(TypeError)
|
||||
Q(ValueError)
|
||||
|
||||
Q(abs)
|
||||
Q(all)
|
||||
Q(any)
|
||||
Q(bool)
|
||||
Q(callable)
|
||||
Q(chr)
|
||||
Q(complex)
|
||||
Q(dict)
|
||||
Q(divmod)
|
||||
Q(float)
|
||||
Q(hash)
|
||||
Q(int)
|
||||
Q(iter)
|
||||
Q(len)
|
||||
Q(list)
|
||||
Q(max)
|
||||
Q(min)
|
||||
Q(next)
|
||||
Q(ord)
|
||||
Q(pow)
|
||||
Q(print)
|
||||
Q(range)
|
||||
Q(set)
|
||||
Q(sum)
|
||||
Q(tuple)
|
||||
Q(type)
|
||||
|
||||
Q(append)
|
||||
Q(pop)
|
||||
Q(sort)
|
||||
Q(join)
|
||||
Q(format)
|
||||
+23
@@ -5,9 +5,14 @@
|
||||
.text
|
||||
|
||||
/* uint nlr_push(rdi=nlr_buf_t *nlr) */
|
||||
#ifndef __apple_build_version__
|
||||
.globl nlr_push
|
||||
.type nlr_push, @function
|
||||
nlr_push:
|
||||
#else
|
||||
.globl _nlr_push
|
||||
_nlr_push:
|
||||
#endif
|
||||
movq (%rsp), %rax # load return %rip
|
||||
movq %rax, 16(%rdi) # store %rip into nlr_buf
|
||||
movq %rbp, 24(%rdi) # store %rbp into nlr_buf
|
||||
@@ -22,22 +27,36 @@ nlr_push:
|
||||
movq %rdi, nlr_top(%rip) # stor new nlr_buf (to make linked list)
|
||||
xorq %rax, %rax # return 0, normal return
|
||||
ret # return
|
||||
#ifndef __apple_build_version__
|
||||
.size nlr_push, .-nlr_push
|
||||
#endif
|
||||
|
||||
/* void nlr_pop() */
|
||||
#ifndef __apple_build_version__
|
||||
.globl nlr_pop
|
||||
.type nlr_pop, @function
|
||||
nlr_pop:
|
||||
#else
|
||||
.globl _nlr_pop
|
||||
_nlr_pop:
|
||||
#endif
|
||||
movq nlr_top(%rip), %rax # get nlr_top into %rax
|
||||
movq (%rax), %rax # load prev nlr_buf
|
||||
movq %rax, nlr_top(%rip) # store prev nlr_buf (to unlink list)
|
||||
ret # return
|
||||
#ifndef __apple_build_version__
|
||||
.size nlr_pop, .-nlr_pop
|
||||
#endif
|
||||
|
||||
/* void nlr_jump(rdi=uint val) */
|
||||
#ifndef __apple_build_version__
|
||||
.globl nlr_jump
|
||||
.type nlr_jump, @function
|
||||
nlr_jump:
|
||||
#else
|
||||
.globl _nlr_jump
|
||||
_nlr_jump:
|
||||
#endif
|
||||
movq %rdi, %rax # put return value in %rax
|
||||
movq nlr_top(%rip), %rdi # get nlr_top into %rdi
|
||||
movq %rax, 8(%rdi) # store return value
|
||||
@@ -55,8 +74,12 @@ nlr_jump:
|
||||
xorq %rax, %rax # clear return register
|
||||
inc %al # increase to make 1, non-local return
|
||||
ret # return
|
||||
#ifndef __apple_build_version__
|
||||
.size nlr_jump, .-nlr_jump
|
||||
#endif
|
||||
|
||||
#ifndef __apple_build_version__
|
||||
.local nlr_top
|
||||
#endif
|
||||
.comm nlr_top,8,8
|
||||
#endif
|
||||
|
||||
@@ -7,15 +7,12 @@
|
||||
#include "nlr.h"
|
||||
#include "misc.h"
|
||||
#include "mpconfig.h"
|
||||
#include "mpqstr.h"
|
||||
#include "obj.h"
|
||||
#include "runtime0.h"
|
||||
#include "runtime.h"
|
||||
#include "map.h"
|
||||
|
||||
mp_obj_t mp_obj_new_int(machine_int_t value) {
|
||||
return MP_OBJ_NEW_SMALL_INT(value);
|
||||
}
|
||||
|
||||
const char *mp_obj_get_type_str(mp_obj_t o_in) {
|
||||
if (MP_OBJ_IS_SMALL_INT(o_in)) {
|
||||
return "int";
|
||||
@@ -127,9 +124,13 @@ machine_int_t mp_obj_get_int(mp_obj_t arg) {
|
||||
return 1;
|
||||
} else if (MP_OBJ_IS_SMALL_INT(arg)) {
|
||||
return MP_OBJ_SMALL_INT_VALUE(arg);
|
||||
#if MICROPY_ENABLE_FLOAT
|
||||
} else if (MP_OBJ_IS_TYPE(arg, &float_type)) {
|
||||
// TODO work out if this should be floor, ceil or trunc
|
||||
return (machine_int_t)mp_obj_float_get(arg);
|
||||
#endif
|
||||
} else {
|
||||
assert(0);
|
||||
return 0;
|
||||
nlr_jump(mp_obj_new_exception_msg_1_arg(MP_QSTR_TypeError, "can't convert %s to int", mp_obj_get_type_str(arg)));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -144,7 +145,7 @@ machine_float_t mp_obj_get_float(mp_obj_t arg) {
|
||||
} else if (MP_OBJ_IS_TYPE(arg, &float_type)) {
|
||||
return mp_obj_float_get(arg);
|
||||
} else {
|
||||
nlr_jump(mp_obj_new_exception_msg_1_arg(rt_q_TypeError, "can't convert %s to float", mp_obj_get_type_str(arg)));
|
||||
nlr_jump(mp_obj_new_exception_msg_1_arg(MP_QSTR_TypeError, "can't convert %s to float", mp_obj_get_type_str(arg)));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -164,7 +165,7 @@ void mp_obj_get_complex(mp_obj_t arg, mp_float_t *real, mp_float_t *imag) {
|
||||
} else if (MP_OBJ_IS_TYPE(arg, &complex_type)) {
|
||||
mp_obj_complex_get(arg, real, imag);
|
||||
} else {
|
||||
nlr_jump(mp_obj_new_exception_msg_1_arg(rt_q_TypeError, "can't convert %s to complex", mp_obj_get_type_str(arg)));
|
||||
nlr_jump(mp_obj_new_exception_msg_1_arg(MP_QSTR_TypeError, "can't convert %s to complex", mp_obj_get_type_str(arg)));
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -188,11 +189,11 @@ mp_obj_t *mp_obj_get_array_fixed_n(mp_obj_t o_in, machine_int_t n) {
|
||||
mp_obj_list_get(o_in, &seq_len, &seq_items);
|
||||
}
|
||||
if (seq_len != n) {
|
||||
nlr_jump(mp_obj_new_exception_msg_2_args(rt_q_IndexError, "requested length %d but object has length %d", (void*)n, (void*)(machine_uint_t)seq_len));
|
||||
nlr_jump(mp_obj_new_exception_msg_2_args(MP_QSTR_IndexError, "requested length %d but object has length %d", (void*)n, (void*)(machine_uint_t)seq_len));
|
||||
}
|
||||
return seq_items;
|
||||
} else {
|
||||
nlr_jump(mp_obj_new_exception_msg_1_arg(rt_q_TypeError, "object '%s' is not a tuple or list", mp_obj_get_type_str(o_in)));
|
||||
nlr_jump(mp_obj_new_exception_msg_1_arg(MP_QSTR_TypeError, "object '%s' is not a tuple or list", mp_obj_get_type_str(o_in)));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -204,10 +205,10 @@ uint mp_get_index(const mp_obj_type_t *type, machine_uint_t len, mp_obj_t index)
|
||||
i += len;
|
||||
}
|
||||
if (i < 0 || i >= len) {
|
||||
nlr_jump(mp_obj_new_exception_msg_1_arg(rt_q_IndexError, "%s index out of range", type->name));
|
||||
nlr_jump(mp_obj_new_exception_msg_1_arg(MP_QSTR_IndexError, "%s index out of range", type->name));
|
||||
}
|
||||
return i;
|
||||
} else {
|
||||
nlr_jump(mp_obj_new_exception_msg_2_args(rt_q_TypeError, "%s indices must be integers, not %s", type->name, mp_obj_get_type_str(index)));
|
||||
nlr_jump(mp_obj_new_exception_msg_2_args(MP_QSTR_TypeError, "%s indices must be integers, not %s", type->name, mp_obj_get_type_str(index)));
|
||||
}
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user