8000 Merge pull request #1 from tannewt/vectorio · adafruit/circuitpython@8a9579c · GitHub
[go: up one dir, main page]

Skip to content

Commit 8a9579c

Browse files
author
Kenny
authored
Merge pull request #1 from tannewt/vectorio
Merge in master
2 parents 90bd931 + d274074 commit 8a9579c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

85 files changed

+2767
-203
lines changed

.github/workflows/build.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,11 +216,13 @@ jobs:
216216
- "pewpew10"
217217
- "pewpew_m4"
218218
- "pirkey_m0"
219+
- "pitaya_go"
219220
- "pyb_nano_v2"
220221
- "pybadge"
221222
- "pybadge_airlift"
222223
- "pyboard_v11"
223224
- "pycubed"
225+
- "pycubed_mram"
224226
- "pygamer"
225227
- "pygamer_advance"
226228
- "pyportal"
@@ -249,6 +251,7 @@ jobs:
249251
- "stm32f746g_discovery"
250252
- "stringcar_m0_express"
251253
- "teensy40"
254+
- "teensy41"
252255
- "teknikio_bluebird"
253256
- "thunderpack"
254257
- "trellis_m4_express"

extmod/modujson.c

Lines changed: 24 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,10 @@ STATIC mp_obj_t mod_ujson_dumps(mp_obj_t obj) {
5353
}
5454
STATIC MP_DEFINE_CONST_FUN_OBJ_1(mod_ujson_dumps_obj, mod_ujson_dumps);
5555

56+
#define JSON_DEBUG(...) (void)0
57+
// #define JSON_DEBUG(...) mp_printf(&mp_plat_print __VA_OPT__(,) __VA_ARGS__)
58+
59+
5660
// The function below implements a simple non-recursive JSON parser.
5761
//
5862
// The JSON specification is at http://www.ietf.org/rfc/rfc4627.txt
@@ -80,6 +84,7 @@ typedef struct _ujson_stream_t {
8084

8185
STATIC byte ujson_stream_next(ujson_stream_t *s) {
8286
mp_uint_t ret = s->read(s->stream_obj, &s->cur, 1, &s->errcode);
87+
JSON_DEBUG(" usjon_stream_next err:%2d cur: %c \n", s->errcode, s->cur);
8388
if (s->errcode != 0) {
8489
mp_raise_OSError(s->errcode);
8590
}
@@ -89,9 +94,10 @@ STATIC byte ujson_stream_next(ujson_stream_t *s) {
8994
return s->cur;
9095
}
9196

92-
STATIC mp_obj_t mod_ujson_load(mp_obj_t stream_obj) {
97+
STATIC mp_obj_t _mod_ujson_load(mp_obj_t stream_obj, bool return_first_json) {
9398
const mp_stream_p_t *stream_p = mp_get_stream_raise(stream_obj, MP_STREAM_OP_READ);
9499
ujson_stream_t s = {stream_obj, stream_p->read, 0, 0};
100+
JSON_DEBUG("got JSON stream\n");
95101
vstr_t vstr;
96102
vstr_init(&vstr, 8);
97103
mp_obj_list_t stack; // we use a list as a simple stack for nested JSON
@@ -262,13 +268,18 @@ STATIC mp_obj_t mod_ujson_load(mp_obj_t stream_obj) {
262268
}
263269
}
264270
success:
265-
// eat trailing whitespace
266-
while (unichar_isspace(S_CUR(s))) {
267-
S_NEXT(s);
268-
}
269-
if (!S_END(s)) {
270-
// unexpected chars
271-
goto fail;
271+
// It is legal for a stream to have contents after JSON.
272+
// E.g., A UART is not closed after receiving an object; in load() we will
273+
// return the first complete JSON object, while in loads() we will retain
274+
// strict adherence to the buffer's complete semantic.
275+
if (!return_first_json) {
276+
while (unichar_isspace(S_CUR(s))) {
277+
S_NEXT(s);
278+
}
279+
if (!S_END(s)) {
280+
// unexpected chars
281+
goto fail;
282+
}
272283
}
273284
if (stack_top == MP_OBJ_NULL || stack.len != 0) {
274285
// not exactly 1 object
@@ -280,14 +291,18 @@ STATIC mp_obj_t mod_ujson_load(mp_obj_t stream_obj) {
280291
fail:
281292
mp_raise_ValueError(translate("syntax error in JSON"));
282293
}
294+
295+
STATIC mp_obj_t mod_ujson_load(mp_obj_t stream_obj) {
296+
return _mod_ujson_load(stream_obj, true);
297+
}
283298
STATIC MP_DEFINE_CONST_FUN_OBJ_1(mod_ujson_load_obj, mod_ujson_load);
284299

285300
STATIC mp_obj_t mod_ujson_loads(mp_obj_t obj) {
286301
size_t len;
287302
const char *buf = mp_obj_str_get_data(obj, &len);
288303
vstr_t vstr = {len, len, (char*)buf, true};
289304
mp_obj_stringio_t sio = {{&mp_type_stringio}, &vstr, 0, MP_OBJ_NULL};
290-
return mod_ujson_load(MP_OBJ_FROM_PTR(&sio));
305+
return _mod_ujson_load(MP_OBJ_FROM_PTR(&sio), false);
291306
}
292307
STATIC MP_DEFINE_CONST_FUN_OBJ_1(mod_ujson_loads_obj, mod_ujson_loads);
293308

locale/ID.po

Lines changed: 36 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ msgid ""
88
msgstr ""
99
"Project-Id-Version: PACKAGE VERSION\n"
1010
"Report-Msgid-Bugs-To: \n"
11-
"POT-Creation-Date: 2020-05-06 17:47+0800\n"
11+
"POT-Creation-Date: 2020-05-12 12:24-0700\n"
1212
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
1313
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
1414
"Language-Team: LANGUAGE <LL@li.org>\n"
@@ -70,13 +70,22 @@ msgstr ""
7070
msgid "%q indices must be integers, not %s"
7171
msgstr ""
7272

73+
#: shared-bindings/vectorio/Polygon.c
74+
msgid "%q list must be a list"
75+
msgstr ""
76+
7377
#: shared-bindings/_bleio/CharacteristicBuffer.c
7478
#: shared-bindings/_bleio/PacketBuffer.c shared-bindings/displayio/Group.c
75-
#: shared-bindings/displayio/Shape.c
79+
#: shared-bindings/displayio/Shape.c shared-bindings/vectorio/Circle.c
80+
#: shared-bindings/vectorio/Rectangle.c
7681
#, fuzzy
7782
msgid "%q must be >= 1"
7883
msgstr "buffers harus mempunyai panjang yang sama"
7984

85+
#: shared-bindings/vectorio/Polygon.c
86+
msgid "%q must be a tuple of length 2"
87+
msgstr ""
88+
8089
#: shared-bindings/fontio/BuiltinFont.c
8190
msgid "%q should be an int"
8291
msgstr ""
@@ -797,7 +806,8 @@ msgstr ""
797806
msgid "Group full"
798807
msgstr ""
799808

800-
#: ports/stm/common-hal/busio/I2C.c ports/stm/common-hal/busio/SPI.c
809+
#: ports/mimxrt10xx/common-hal/busio/SPI.c ports/stm/common-hal/busio/I2C.c
810+
#: ports/stm/common-hal/busio/SPI.c
801811
msgid "Hardware busy, try alternative pins"
802812
msgstr ""
803813

@@ -1050,15 +1060,15 @@ msgstr ""
10501060
msgid "Microphone startup delay must be in range 0.0 to 1.0"
10511061
msgstr ""
10521062

1053-
#: ports/stm/common-hal/busio/SPI.c
1063+
#: ports/mimxrt10xx/common-hal/busio/SPI.c ports/stm/common-hal/busio/SPI.c
10541064
msgid "Missing MISO or MOSI Pin"
10551065
msgstr ""
10561066

10571067
#: shared-bindings/displayio/Group.c
10581068
msgid "Must be a %q subclass."
10591069
msgstr ""
10601070

1061-
#: ports/stm/common-hal/busio/SPI.c
1071+
#: ports/mimxrt10xx/common-hal/busio/SPI.c ports/stm/common-hal/busio/SPI.c
10621072
msgid "Must provide MISO or MOSI pin"
10631073
msgstr ""
10641074

@@ -1089,11 +1099,11 @@ msgstr "Tidak ada DAC (Digital Analog Converter) di dalam chip"
10891099
msgid "No DMA channel found"
10901100
msgstr "tidak ada channel DMA ditemukan"
10911101

1092-
#: ports/stm/common-hal/busio/SPI.c
1102+
#: ports/mimxrt10xx/common-hal/busio/SPI.c ports/stm/common-hal/busio/SPI.c
10931103
msgid "No MISO Pin"
10941104
msgstr ""
10951105

1096-
#: ports/stm/common-hal/busio/SPI.c
1106+
#: ports/mimxrt10xx/common-hal/busio/SPI.c ports/stm/common-hal/busio/SPI.c
10971107
msgid "No MOSI Pin"
10981108
msgstr ""
10991109

@@ -1142,6 +1152,10 @@ msgstr "Tidak ada dukungan hardware untuk pin"
11421152
msgid "No key was specified"
11431153
msgstr ""
11441154

1155+
#: shared-bindings/time/__init__.c
1156+
msgid "No long integer support"
1157+
msgstr ""
1158+
11451159
#: ports/stm/common-hal/pulseio/PWMOut.c
11461160
msgid "No more timers available on this pin."
11471161
msgstr ""
@@ -2012,6 +2026,10 @@ msgstr ""
20122026
msgid "chr() arg not in range(256)"
20132027
msgstr ""
20142028

2029+
#: shared-module/vectorio/Circle.c
2030+
msgid "circle can only be registered in one parent"
2031+
msgstr ""
2032+
20152033
#: shared-bindings/displayio/Palette.c
20162034
msgid "color buffer must be 3 bytes (RGB) or 4 bytes (RGB + pad byte)"
20172035
msgstr ""
@@ -2114,6 +2132,10 @@ msgstr ""
21142132
msgid "empty"
21152133
msgstr ""
21162134

2135+
#: shared-bindings/vectorio/Polygon.c
2136+
msgid "empty %q list"
2137+
msgstr ""
2138+
21172139
#: extmod/moduheapq.c extmod/modutimeq.c
21182140
msgid "empty heap"
21192141
msgstr "heap kosong"
@@ -2804,10 +2826,14 @@ msgstr ""
28042826
msgid "pixel value requires too many bits"
28052827
msgstr ""
28062828

2807-
#: shared-bindings/displayio/TileGrid.c
2829+
#: shared-bindings/displayio/TileGrid.c shared-bindings/vectorio/VectorShape.c
28082830
msgid "pixel_shader must be displayio.Palette or displayio.ColorConverter"
28092831
msgstr ""
28102832

2833+
#: shared-module/vectorio/Polygon.c
2834+
msgid "polygon can only be registered in one parent"
2835+
msgstr ""
2836+
28112837
#: ports/atmel-samd/common-hal/pulseio/PulseIn.c
28122838
#: ports/cxd56/common-hal/pulseio/PulseIn.c
28132839
#: ports/nrf/common-hal/pulseio/PulseIn.c
@@ -3127,7 +3153,8 @@ msgstr ""
31273153
msgid "unreadable attribute"
31283154
msgstr ""
31293155

3130-
#: shared-bindings/displayio/TileGrid.c
3156+
#: shared-bindings/displayio/TileGrid.c shared-bindings/vectorio/Polygon.c
3157+
#: shared-bindings/vectorio/VectorShape.c
31313158
msgid "unsupported %q type"
31323159
msgstr ""
31333160

locale/circuitpython.pot

Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ msgid ""
88
msgstr ""
99
"Project-Id-Version: PACKAGE VERSION\n"
1010
"Report-Msgid-Bugs-To: \n"
11-
"POT-Creation-Date: 2020-05-06 17:47+0800\n"
11+
"POT-Creation-Date: 2020-05-12 12:24-0700\n"
1212
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
1313
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
1414
"Language-Team: LANGUAGE <LL@li.org>\n"
@@ -70,12 +70,21 @@ msgstr ""
7070
msgid "%q indices must be integers, not %s"
7171
msgstr ""
7272

73+
#: shared-bindings/vectorio/Polygon.c
74+
msgid "%q list must be a list"
75+
msgstr ""
76+
7377
#: shared-bindings/_bleio/CharacteristicBuffer.c
7478
#: shared-bindings/_bleio/PacketBuffer.c shared-bindings/displayio/Group.c
75-
#: shared-bindings/displayio/Shape.c
79+
#: shared-bindings/displayio/Shape.c shared-bindings/vectorio/Circle.c
80+
#: shared-bindings/vectorio/Rectangle.c
7681
msgid "%q must be >= 1"
7782
msgstr ""
7883

84+
#: shared-bindings/vectorio/Polygon.c
85+
msgid "%q must be a tuple of length 2"
86+
msgstr ""
87+
7988
#: shared-bindings/fontio/BuiltinFont.c
8089
msgid "%q should be an int"
8190
msgstr ""
@@ -786,7 +795,8 @@ msgstr ""
786795
msgid "Group full"
787796
msgstr ""
788797

789-
#: ports/stm/common-hal/busio/I2C.c ports/stm/common-hal/busio/SPI.c
798+
#: ports/mimxrt10xx/common-hal/busio/SPI.c ports/stm/common-hal/busio/I2C.c
799+
#: ports/stm/common-hal/busio/SPI.c
790800
msgid "Hardware busy, try alternative pins"
791801
msgstr ""
792802

@@ -1039,15 +1049,15 @@ msgstr ""
10391049
msgid "Microphone startup delay must be in range 0.0 to 1.0"
10401050
msgstr ""
10411051

1042-
#: ports/stm/common-hal/busio/SPI.c
1052+
#: ports/mimxrt10xx/common-hal/busio/SPI.c ports/stm/common-hal/busio/SPI.c
10431053
msgid "Missing MISO or MOSI Pin"
10441054
msgstr ""
10451055

10461056
#: shared-bindings/displayio/Group.c
10471057
msgid "Must be a %q subclass."
10481058
msgstr ""
10491059

1050-
#: ports/stm/common-hal/busio/SPI.c
1060+
#: ports/mimxrt10xx/common-hal/busio/SPI.c ports/stm/common-hal/busio/SPI.c
10511061
msgid "Must provide MISO or MOSI pin"
10521062
msgstr ""
10531063

@@ -1078,11 +1088,11 @@ msgstr ""
10781088
msgid "No DMA channel found"
10791089
msgstr ""
10801090

1081-
#: ports/stm/common-hal/busio/SPI.c
1091+
#: ports/mimxrt10xx/common-hal/busio/SPI.c ports/stm/common-hal/busio/SPI.c
10821092
msgid "No MISO Pin"
10831093
msgstr ""
10841094

1085-
#: ports/stm/common-hal/busio/SPI.c
1095+
#: ports/mimxrt10xx/common-hal/busio/SPI.c ports/stm/common-hal/busio/SPI.c
10861096
msgid "No MOSI Pin"
10871097
msgstr ""
10881098

@@ -1131,6 +1141,10 @@ msgstr ""
11311141
msgid "No key was specified"
11321142
msgstr ""
11331143

1144+
#: shared-bindings/time/__init__.c
1145+
msgid "No long integer support"
1146+
msgstr ""
1147+
11341148
#: ports/stm/common-hal/pulseio/PWMOut.c
11351149
msgid "No more timers available on this pin."
11361150
msgstr ""
@@ -1988,6 +2002,10 @@ msgstr ""
19882002
msgid "chr() arg not in range(256)"
19892003
msgstr ""
19902004

2005+
#: shared-module/vectorio/Circle.c
2006+
msgid "circle can only be registered in one parent"
2007+
msgstr ""
2008+
19912009
#: shared-bindings/displayio/Palette.c
19922010
msgid "color buffer must be 3 bytes (RGB) or 4 bytes (RGB + pad byte)"
19932011
msgstr ""
@@ -2090,6 +2108,10 @@ msgstr ""
20902108
msgid "empty"
20912109
msgstr ""
20922110

2111+
#: shared-bindings/vectorio/Polygon.c
2112+
msgid "empty %q list"
2113+
msgstr ""
2114+
20932115
#: extmod/moduheapq.c extmod/modutimeq.c
20942116
msgid "empty heap"
20952117
msgstr ""
@@ -2779,10 +2801,14 @@ msgstr ""
27792801
msgid "pixel value requires too many bits"
27802802
msgstr ""
27812803

2782-
#: shared-bindings/displayio/TileGrid.c
2804+
#: shared-bindings/displayio/TileGrid.c shared-bindings/vectorio/VectorShape.c
27832805
msgid "pixel_shader must be displayio.Palette or displayio.ColorConverter"
27842806
msgstr ""
27852807

2808+
#: shared-module/vectorio/Polygon.c
2809+
msgid "polygon can only be registered in one parent"
2810+
msgstr ""
2811+
27862812
#: ports/atmel-samd/common-hal/pulseio/PulseIn.c
27872813
#: ports/cxd56/common-hal/pulseio/PulseIn.c
27882814
#: ports/nrf/common-hal/pulseio/PulseIn.c
@@ -3101,7 +3127,8 @@ msgstr ""
31013127
msgid "unreadable attribute"
31023128
msgstr ""
31033129

3104-
#: shared-bindings/displayio/TileGrid.c
3130+
#: shared-bindings/displayio/TileGrid.c shared-bindings/vectorio/Polygon.c
3131+
#: shared-bindings/vectorio/VectorShape.c
31053132
msgid "unsupported %q type"
31063133
msgstr ""
31073134

0 commit comments

Comments
 (0)
0