[WIP] - Support of ulab module for scientific calculations in PythonExtra #15

Draft
Slyvtt wants to merge 33 commits from Slyvtt/PythonExtra:ulab into dev
6 changed files with 23 additions and 7 deletions
Showing only changes of commit 5f385d8bcc - Show all commits

View File

@ -4,7 +4,7 @@ SH_CFLAGS := -DFXCG50
TARGETCASIO := "FXCG50"
SH_LDFLAGS := -T fxcg50.ld -ljustui-cg -lm -lgint-cg -lc -lgint-cg -lgcc
SH_ASSETS := img_modifier_states.png font_9.png font_13.png font_19.png PoliceNW.png
SH_ASSETS := img_modifier_states.png font_9.png font_13.png font_19.png PoliceNW
SH_METADATA := fxconv-metadata.txt
SH_CONVFLAGS := --cg

View File

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1009 B

View File

@ -30,10 +30,10 @@ font_19.png:
grid.border: 0
proportional: true
PoliceNW.png:
PoliceNW:
name: numworks
type: font
charset: print
charset: unicode
grid.size: 10x16
grid.padding: 0
grid.border: 0

View File

@ -126,3 +126,8 @@ typedef long mp_off_t;
#define MICROPY_HW_MCU_NAME "sh-4a"
#define MP_STATE_PORT MP_STATE_VM
/* Activate support of unicode string in MicroPython */
#define MICROPY_PY_BUILTINS_STR_UNICODE (1)

View File

@ -220,7 +220,7 @@ static mp_obj_t Kandinsky_draw_string(size_t n, mp_obj_t const *args) {
}
font_t const *old_font = dfont(&numworks);
int u = 0;
int v = 0;
for (int l = 0; l < (int)text_len; l++) {
@ -228,10 +228,21 @@ static mp_obj_t Kandinsky_draw_string(size_t n, mp_obj_t const *args) {
u = 0;
v += 16;
} else {
drect(x + u - 1, y + v - 1, x + u + 9, y + v + 15, colorback);
dtext_opt(x + u, y + v, colortext, C_NONE, DTEXT_LEFT, DTEXT_TOP,
/* The following test is for support of unicode characters that are encoded on 2 chars */
/* This gives text[l]<0 and we need to pass 2 chars to dtext to take care of unicode encoding */
if(text[l]>=0){
drect(x + u - 1, y + v - 1, x + u + 9, y + v + 15, colorback);
dtext_opt(x + u, y + v, colortext, C_NONE, DTEXT_LEFT, DTEXT_TOP,
&text[l], 1);
u += 10;
u += 10;
} else {
drect(x + u - 1, y + v - 1, x + u + 9, y + v + 15, colorback);
dtext_opt(x + u, y + v, colortext, C_NONE, DTEXT_LEFT, DTEXT_TOP,
&text[l], 2);
u += 10;
l++;
}
}
}