Skip to content
Snippets Groups Projects
Select Git revision
  • 97aca12945a48784b0e5fa3fce051b18015820bb
  • main default protected
  • blm_dev_chan
  • release/1.4.0 protected
  • widgets_draw
  • return_of_melodic_demo
  • task_cleanup
  • mixer2
  • dx/fb-save-restore
  • dx/dldldld
  • fpletz/flake
  • dx/jacksense-headset-mic-only
  • release/1.3.0 protected
  • fil3s-limit-filesize
  • allow-reloading-sunmenu
  • wifi-json-error-handling
  • app_text_viewer
  • shoegaze-fps
  • media_has_video_has_audio
  • fil3s-media
  • more-accurate-battery
  • v1.4.0
  • v1.3.0
  • v1.2.0
  • v1.2.0+rc1
  • v1.1.1
  • v1.1.0
  • v1.1.0+rc1
  • v1.0.0
  • v1.0.0+rc6
  • v1.0.0+rc5
  • v1.0.0+rc4
  • v1.0.0+rc3
  • v1.0.0+rc2
  • v1.0.0+rc1
35 results

ui.py

Blame
  • runtime.c 41.35 KiB
    #include <stdio.h>
    #include <string.h>
    #include <assert.h>
    
    #include "nlr.h"
    #include "misc.h"
    #include "mpconfig.h"
    #include "qstr.h"
    #include "obj.h"
    #include "objtuple.h"
    #include "objmodule.h"
    #include "parsenum.h"
    #include "runtime0.h"
    #include "runtime.h"
    #include "emitglue.h"
    #include "builtin.h"
    #include "builtintables.h"
    #include "bc.h"
    #include "smallint.h"
    #include "objgenerator.h"
    
    #if 0 // print debugging info
    #define DEBUG_PRINT (1)
    #define DEBUG_printf DEBUG_printf
    #define DEBUG_OP_printf(...) DEBUG_printf(__VA_ARGS__)
    #else // don't print debugging info
    #define DEBUG_printf(...) (void)0
    #define DEBUG_OP_printf(...) (void)0
    #endif
    
    // locals and globals need to be pointers because they can be the same in outer module scope
    STATIC mp_obj_dict_t *dict_locals;
    STATIC mp_obj_dict_t *dict_globals;
    
    // dictionary for the __main__ module
    STATIC mp_obj_dict_t dict_main;
    
    const mp_obj_module_t mp_module___main__ = {
        .base = { &mp_type_module },
        .name = MP_QSTR___main__,
        .globals = (mp_obj_dict_t*)&dict_main,
    };
    
    void mp_init(void) {
        mp_emit_glue_init();
    
        // init global module stuff
        mp_module_init();
    
        // initialise the __main__ module
        mp_obj_dict_init(&dict_main, 1);
        mp_obj_dict_store(&dict_main, MP_OBJ_NEW_QSTR(MP_QSTR___name__), MP_OBJ_NEW_QSTR(MP_QSTR___main__));
    
        // locals = globals for outer module (see Objects/frameobject.c/PyFrame_New())
        dict_locals = dict_globals = &dict_main;
    
    #if MICROPY_CPYTHON_COMPAT
        // Precreate sys module, so "import sys" didn't throw exceptions.
        mp_obj_t m_sys = mp_obj_new_module(MP_QSTR_sys);
        // Avoid warning of unused var
        (void)m_sys;
    #endif
        // init sys.path
        // for efficiency, left to platform-specific startup code
        //mp_sys_path = mp_obj_new_list(0, NULL);
        //mp_store_attr(m_sys, MP_QSTR_path, mp_sys_path);
    }
    
    void mp_deinit(void) {
        //mp_obj_dict_free(&dict_main);