Skip to content
Snippets Groups Projects
Select Git revision
  • db0d459dbff208399866bccc9f4b26f3b6c48ddc
  • master default protected
  • sonopard/display-pixels-drawimage
  • TilCreator/firmware-master
  • rahix/simple_menu
  • genofire/leds_rgb_get_state
  • genofire/rockets-state
  • genofire/ble-follow-py
  • hauke/ble-cleanups
  • plaetzchen/ios-workaround
  • blinkisync-as-preload
  • genofire/haule-ble-fs-deactive
  • schneider/max30001-pycardium
  • schneider/max30001-epicaridum
  • schneider/max30001
  • schneider/stream-locks
  • ios-workarounds
  • schneider/fundamental-test
  • schneider/ble-buffers
  • schneider/maxim-sdk-update
  • ch3/splashscreen
  • v1.8
  • v1.7
  • v1.6
  • v1.5
  • v1.4
  • v1.3
  • v1.2
  • v1.1
  • v1.0
  • release-1
  • bootloader-v1
  • v0.0
33 results

mscmem.c

Blame
  • Forked from card10 / firmware
    Source project has a limited visibility.
    compile.c 126.82 KiB
    #include <stdbool.h>
    #include <stdint.h>
    #include <stdio.h>
    #include <string.h>
    #include <assert.h>
    #include <math.h>
    
    #include "misc.h"
    #include "mpconfig.h"
    #include "qstr.h"
    #include "lexer.h"
    #include "parse.h"
    #include "scope.h"
    #include "runtime0.h"
    #include "emit.h"
    #include "emitglue.h"
    #include "obj.h"
    #include "compile.h"
    #include "runtime.h"
    #include "intdivmod.h"
    
    // TODO need to mangle __attr names
    
    #define MICROPY_EMIT_NATIVE (MICROPY_EMIT_X64 || MICROPY_EMIT_THUMB)
    
    typedef enum {
        PN_none = 0,
    #define DEF_RULE(rule, comp, kind, ...) PN_##rule,
    #include "grammar.h"
    #undef DEF_RULE
        PN_maximum_number_of,
    } pn_kind_t;
    
    #define EMIT(fun) (comp->emit_method_table->fun(comp->emit))
    #define EMIT_ARG(fun, ...) (comp->emit_method_table->fun(comp->emit, __VA_ARGS__))
    #define EMIT_INLINE_ASM(fun) (comp->emit_inline_asm_method_table->fun(comp->emit_inline_asm))
    #define EMIT_INLINE_ASM_ARG(fun, ...) (comp->emit_inline_asm_method_table->fun(comp->emit_inline_asm, __VA_ARGS__))
    
    #define EMIT_OPT_NONE           (0)
    #define EMIT_OPT_BYTE_CODE      (1)
    #define EMIT_OPT_NATIVE_PYTHON  (2)
    #define EMIT_OPT_VIPER          (3)
    #define EMIT_OPT_ASM_THUMB      (4)
    
    typedef struct _compiler_t {
        qstr source_file;
        bool is_repl;
        pass_kind_t pass;
        bool had_error; // try to keep compiler clean from nlr
    
        int next_label;
    
        int break_label;
        int continue_label;
        int break_continue_except_level;
        int cur_except_level; // increased for SETUP_EXCEPT, SETUP_FINALLY; decreased for POP_BLOCK, POP_EXCEPT
    
        int n_arg_keyword;
        bool have_star_arg;
        bool have_dbl_star_arg;
        bool have_bare_star;
        int param_pass;
        int param_pass_num_dict_params;
        int param_pass_num_default_params;
    
        bool func_arg_is_super; // used to compile special case of super() function call
    
        scope_t *scope_head;
        scope_t *scope_cur;