Someone in the comments even talks about running it on a microcontroller and gives pointers to reducing its memory footprint.
For now, I've only tested this on the unix port, but here's what I did. The idea is that you'll be able to:
Code: Select all
import kilo
kilo.edit("somefile.py")
First, my mangled kilo.c is here: https://github.com/j0hnlittle/kilo/blob ... hon/kilo.c
It includes some basic highlighting for Python keywords (better python support in that fork that could be lifted later: https://github.com/practicalswift/opene ... penemacs.c) and handles resizing the terminal window. Variable sized tabs would be nice but that's also for later.
Following https://micropython-dev-docs.readthedoc ... odule.html, you need to add kilo.c to your Makefile along the other source files:
Code: Select all
# source files
SRC_C = \
kilo.c \
main.c \
Code: Select all
extern const struct _mp_obj_module_t mp_module_kilo;
Code: Select all
#define MICROPY_PORT_BUILTIN_MODULES \
MICROPY_PY_FFI_DEF \
MICROPY_PY_JNI_DEF \
MICROPY_PY_UTIME_DEF \
MICROPY_PY_SOCKET_DEF \
{ MP_ROM_QSTR(MP_QSTR_umachine), MP_ROM_PTR(&mp_module_machine) }, \
MICROPY_PY_UOS_DEF \
MICROPY_PY_USELECT_DEF \
MICROPY_PY_TERMIOS_DEF \
{ MP_OBJ_NEW_QSTR(MP_QSTR_kilo), (mp_obj_t)&mp_module_kilo }, \