Oliver Fabel 1 год назад
Родитель
Сommit
566d24fe64
4 измененных файлов с 1 добавлено и 79 удалено
  1. 0 42
      mp_flipper_compiler.c
  2. 1 3
      mp_flipper_halport.c
  3. 0 2
      mp_flipper_halport.h
  4. 0 32
      mp_flipper_runtime.c

+ 0 - 42
mp_flipper_compiler.c

@@ -12,7 +12,6 @@
 #include "mp_flipper_halport.h"
 #include "mp_flipper_halport.h"
 
 
 void mp_flipper_exec_str(const char* code) {
 void mp_flipper_exec_str(const char* code) {
-#if MP_FLIPPER_IS_COMPILER
     nlr_buf_t nlr;
     nlr_buf_t nlr;
 
 
     if(nlr_push(&nlr) == 0) {
     if(nlr_push(&nlr) == 0) {
@@ -27,11 +26,9 @@ void mp_flipper_exec_str(const char* code) {
         // Uncaught exception: print it out.
         // Uncaught exception: print it out.
         mp_obj_print_exception(&mp_plat_print, (mp_obj_t)nlr.ret_val);
         mp_obj_print_exception(&mp_plat_print, (mp_obj_t)nlr.ret_val);
     }
     }
-#endif
 }
 }
 
 
 void mp_flipper_exec_py_file(const char* file_path) {
 void mp_flipper_exec_py_file(const char* file_path) {
-#if MP_FLIPPER_IS_COMPILER
     nlr_buf_t nlr;
     nlr_buf_t nlr;
 
 
     if(nlr_push(&nlr) == 0) {
     if(nlr_push(&nlr) == 0) {
@@ -56,43 +53,4 @@ void mp_flipper_exec_py_file(const char* file_path) {
         // Uncaught exception: print it out.
         // Uncaught exception: print it out.
         mp_obj_print_exception(&mp_plat_print, (mp_obj_t)nlr.ret_val);
         mp_obj_print_exception(&mp_plat_print, (mp_obj_t)nlr.ret_val);
     }
     }
-#endif
-}
-
-void mp_flipper_compile_and_save_file(const char* py_file_path, const char* mpy_file_path) {
-#if MP_FLIPPER_IS_COMPILER
-    nlr_buf_t nlr;
-
-    if(nlr_push(&nlr) == 0) {
-        mp_lexer_t* lex = mp_lexer_new_from_file(qstr_from_str(py_file_path));
-
-        mp_store_global(MP_QSTR___file__, MP_OBJ_NEW_QSTR(lex->source_name));
-
-        mp_parse_tree_t parse_tree = mp_parse(lex, MP_PARSE_FILE_INPUT);
-        mp_compiled_module_t cm;
-        cm.context = m_new_obj(mp_module_context_t);
-        mp_compile_to_raw_code(&parse_tree, lex->source_name, false, &cm);
-
-        mp_print_t* print = malloc(sizeof(mp_print_t));
-
-        print->data = mp_flipper_print_data_alloc();
-        print->print_strn = mp_flipper_print_strn;
-
-        mp_raw_code_save(&cm, print);
-
-        const char* data = mp_flipper_print_get_data(print->data);
-        size_t size = mp_flipper_print_get_data_length(print->data);
-
-        mp_flipper_save_file(mpy_file_path, data, size);
-
-        mp_flipper_print_data_free(print->data);
-
-        free(print);
-
-        nlr_pop();
-    } else {
-        // Uncaught exception: print it out.
-        mp_obj_print_exception(&mp_plat_print, (mp_obj_t)nlr.ret_val);
-    }
-#endif
 }
 }

+ 1 - 3
mp_flipper_halport.c

@@ -33,8 +33,6 @@ mp_import_stat_t mp_import_stat(const char* path) {
     return MP_IMPORT_STAT_NO_EXIST;
     return MP_IMPORT_STAT_NO_EXIST;
 }
 }
 
 
-#ifdef MP_FLIPPER_SPLIT_HEAP
 size_t gc_get_max_new_split(void) {
 size_t gc_get_max_new_split(void) {
     return mp_flipper_gc_get_max_new_split();
     return mp_flipper_gc_get_max_new_split();
-}
-#endif
+}

+ 0 - 2
mp_flipper_halport.h

@@ -16,6 +16,4 @@ void mp_flipper_stdout_tx_strn_cooked(const char* str, size_t len);
 
 
 mp_flipper_import_stat_t mp_flipper_import_stat(const char* path);
 mp_flipper_import_stat_t mp_flipper_import_stat(const char* path);
 
 
-#ifdef MP_FLIPPER_SPLIT_HEAP
 size_t mp_flipper_gc_get_max_new_split();
 size_t mp_flipper_gc_get_max_new_split();
-#endif

+ 0 - 32
mp_flipper_runtime.c

@@ -29,38 +29,6 @@ void mp_flipper_init(void* heap, size_t heap_size, size_t stack_size, void* stac
     mp_init();
     mp_init();
 }
 }
 
 
-void mp_flipper_exec_mpy_file(const char* file_path) {
-#ifdef MP_FLIPPER_MPY_SUPPORT
-#if MP_FLIPPER_IS_RUNTIME
-    nlr_buf_t nlr;
-
-    if(nlr_push(&nlr) == 0) {
-        do {
-            // check if file exists
-            if(mp_flipper_import_stat(file_path) == MP_FLIPPER_IMPORT_STAT_NO_EXIST) {
-                mp_raise_OSError_with_filename(MP_ENOENT, file_path);
-
-                break;
-            }
-
-            // Execute the given .mpy file
-            mp_module_context_t* context = m_new_obj(mp_module_context_t);
-            context->module.globals = mp_globals_get();
-            mp_compiled_module_t compiled_module;
-            compiled_module.context = context;
-            mp_raw_code_load_file(qstr_from_str(file_path), &compiled_module);
-            mp_obj_t f = mp_make_function_from_proto_fun(compiled_module.rc, context, MP_OBJ_NULL);
-            mp_call_function_0(f);
-        } while(false);
-        nlr_pop();
-    } else {
-        // Uncaught exception: print it out.
-        mp_obj_print_exception(&mp_plat_print, (mp_obj_t)nlr.ret_val);
-    }
-#endif
-#endif
-}
-
 void mp_flipper_deinit() {
 void mp_flipper_deinit() {
     mp_deinit();
     mp_deinit();