LCOV - code coverage report
Current view: top level - py - builtin.h (source / functions) Hit Total Coverage
Test: unix_coverage_v1.24.0-7-g548babf8a.info Lines: 2 2 100.0 %
Date: 2024-10-30 09:06:48 Functions: 0 0 -
Branches: 0 0 -

           Branch data     Line data    Source code
       1                 :            : /*
       2                 :            :  * This file is part of the MicroPython project, http://micropython.org/
       3                 :            :  *
       4                 :            :  * The MIT License (MIT)
       5                 :            :  *
       6                 :            :  * Copyright (c) 2013, 2014 Damien P. George
       7                 :            :  *
       8                 :            :  * Permission is hereby granted, free of charge, to any person obtaining a copy
       9                 :            :  * of this software and associated documentation files (the "Software"), to deal
      10                 :            :  * in the Software without restriction, including without limitation the rights
      11                 :            :  * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
      12                 :            :  * copies of the Software, and to permit persons to whom the Software is
      13                 :            :  * furnished to do so, subject to the following conditions:
      14                 :            :  *
      15                 :            :  * The above copyright notice and this permission notice shall be included in
      16                 :            :  * all copies or substantial portions of the Software.
      17                 :            :  *
      18                 :            :  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
      19                 :            :  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
      20                 :            :  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
      21                 :            :  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
      22                 :            :  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
      23                 :            :  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
      24                 :            :  * THE SOFTWARE.
      25                 :            :  */
      26                 :            : #ifndef MICROPY_INCLUDED_PY_BUILTIN_H
      27                 :            : #define MICROPY_INCLUDED_PY_BUILTIN_H
      28                 :            : 
      29                 :            : #include "py/obj.h"
      30                 :            : 
      31                 :            : typedef enum {
      32                 :            :     MP_IMPORT_STAT_NO_EXIST,
      33                 :            :     MP_IMPORT_STAT_DIR,
      34                 :            :     MP_IMPORT_STAT_FILE,
      35                 :            : } mp_import_stat_t;
      36                 :            : 
      37                 :            : #if MICROPY_VFS
      38                 :            : 
      39                 :            : // Delegate to the VFS for import stat and builtin open.
      40                 :            : 
      41                 :            : #define mp_builtin_open_obj mp_vfs_open_obj
      42                 :            : 
      43                 :            : mp_import_stat_t mp_vfs_import_stat(const char *path);
      44                 :            : mp_obj_t mp_vfs_open(size_t n_args, const mp_obj_t *args, mp_map_t *kwargs);
      45                 :            : 
      46                 :            : MP_DECLARE_CONST_FUN_OBJ_KW(mp_vfs_open_obj);
      47                 :            : 
      48                 :      10033 : static inline mp_import_stat_t mp_import_stat(const char *path) {
      49                 :      10033 :     return mp_vfs_import_stat(path);
      50                 :            : }
      51                 :            : 
      52                 :            : static inline mp_obj_t mp_builtin_open(size_t n_args, const mp_obj_t *args, mp_map_t *kwargs) {
      53                 :            :     return mp_vfs_open(n_args, args, kwargs);
      54                 :            : }
      55                 :            : 
      56                 :            : #else
      57                 :            : 
      58                 :            : // A port can provide implementations of these functions.
      59                 :            : mp_import_stat_t mp_import_stat(const char *path);
      60                 :            : mp_obj_t mp_builtin_open(size_t n_args, const mp_obj_t *args, mp_map_t *kwargs);
      61                 :            : 
      62                 :            : // A port can provide this object.
      63                 :            : MP_DECLARE_CONST_FUN_OBJ_KW(mp_builtin_open_obj);
      64                 :            : 
      65                 :            : #endif
      66                 :            : 
      67                 :            : // A port can provide its own import handler by defining mp_builtin___import__.
      68                 :            : #ifndef mp_builtin___import__
      69                 :            : #define mp_builtin___import__ mp_builtin___import___default
      70                 :            : #endif
      71                 :            : mp_obj_t mp_builtin___import__(size_t n_args, const mp_obj_t *args);
      72                 :            : mp_obj_t mp_builtin___import___default(size_t n_args, const mp_obj_t *args);
      73                 :            : 
      74                 :            : mp_obj_t mp_micropython_mem_info(size_t n_args, const mp_obj_t *args);
      75                 :            : 
      76                 :            : MP_DECLARE_CONST_FUN_OBJ_VAR(mp_builtin___build_class___obj);
      77                 :            : MP_DECLARE_CONST_FUN_OBJ_VAR_BETWEEN(mp_builtin___import___obj);
      78                 :            : MP_DECLARE_CONST_FUN_OBJ_1(mp_builtin___repl_print___obj);
      79                 :            : MP_DECLARE_CONST_FUN_OBJ_1(mp_builtin_abs_obj);
      80                 :            : MP_DECLARE_CONST_FUN_OBJ_1(mp_builtin_all_obj);
      81                 :            : MP_DECLARE_CONST_FUN_OBJ_1(mp_builtin_any_obj);
      82                 :            : MP_DECLARE_CONST_FUN_OBJ_1(mp_builtin_bin_obj);
      83                 :            : MP_DECLARE_CONST_FUN_OBJ_1(mp_builtin_callable_obj);
      84                 :            : MP_DECLARE_CONST_FUN_OBJ_VAR_BETWEEN(mp_builtin_compile_obj);
      85                 :            : MP_DECLARE_CONST_FUN_OBJ_1(mp_builtin_chr_obj);
      86                 :            : MP_DECLARE_CONST_FUN_OBJ_2(mp_builtin_delattr_obj);
      87                 :            : MP_DECLARE_CONST_FUN_OBJ_VAR_BETWEEN(mp_builtin_dir_obj);
      88                 :            : MP_DECLARE_CONST_FUN_OBJ_2(mp_builtin_divmod_obj);
      89                 :            : MP_DECLARE_CONST_FUN_OBJ_VAR_BETWEEN(mp_builtin_eval_obj);
      90                 :            : MP_DECLARE_CONST_FUN_OBJ_VAR_BETWEEN(mp_builtin_exec_obj);
      91                 :            : MP_DECLARE_CONST_FUN_OBJ_VAR_BETWEEN(mp_builtin_execfile_obj);
      92                 :            : MP_DECLARE_CONST_FUN_OBJ_VAR_BETWEEN(mp_builtin_getattr_obj);
      93                 :            : MP_DECLARE_CONST_FUN_OBJ_3(mp_builtin_setattr_obj);
      94                 :            : MP_DECLARE_CONST_FUN_OBJ_0(mp_builtin_globals_obj);
      95                 :            : MP_DECLARE_CONST_FUN_OBJ_2(mp_builtin_hasattr_obj);
      96                 :            : MP_DECLARE_CONST_FUN_OBJ_1(mp_builtin_hash_obj);
      97                 :            : MP_DECLARE_CONST_FUN_OBJ_VAR_BETWEEN(mp_builtin_help_obj);
      98                 :            : MP_DECLARE_CONST_FUN_OBJ_1(mp_builtin_hex_obj);
      99                 :            : MP_DECLARE_CONST_FUN_OBJ_1(mp_builtin_id_obj);
     100                 :            : MP_DECLARE_CONST_FUN_OBJ_2(mp_builtin_isinstance_obj);
     101                 :            : MP_DECLARE_CONST_FUN_OBJ_2(mp_builtin_issubclass_obj);
     102                 :            : MP_DECLARE_CONST_FUN_OBJ_1(mp_builtin_iter_obj);
     103                 :            : MP_DECLARE_CONST_FUN_OBJ_1(mp_builtin_len_obj);
     104                 :            : MP_DECLARE_CONST_FUN_OBJ_0(mp_builtin_locals_obj);
     105                 :            : MP_DECLARE_CONST_FUN_OBJ_KW(mp_builtin_max_obj);
     106                 :            : MP_DECLARE_CONST_FUN_OBJ_KW(mp_builtin_min_obj);
     107                 :            : #if MICROPY_PY_BUILTINS_NEXT2
     108                 :            : MP_DECLARE_CONST_FUN_OBJ_VAR_BETWEEN(mp_builtin_next_obj);
     109                 :            : #else
     110                 :            : MP_DECLARE_CONST_FUN_OBJ_1(mp_builtin_next_obj);
     111                 :            : #endif
     112                 :            : MP_DECLARE_CONST_FUN_OBJ_1(mp_builtin_oct_obj);
     113                 :            : MP_DECLARE_CONST_FUN_OBJ_1(mp_builtin_ord_obj);
     114                 :            : MP_DECLARE_CONST_FUN_OBJ_VAR_BETWEEN(mp_builtin_pow_obj);
     115                 :            : MP_DECLARE_CONST_FUN_OBJ_KW(mp_builtin_print_obj);
     116                 :            : MP_DECLARE_CONST_FUN_OBJ_1(mp_builtin_repr_obj);
     117                 :            : MP_DECLARE_CONST_FUN_OBJ_VAR_BETWEEN(mp_builtin_round_obj);
     118                 :            : MP_DECLARE_CONST_FUN_OBJ_KW(mp_builtin_sorted_obj);
     119                 :            : MP_DECLARE_CONST_FUN_OBJ_VAR_BETWEEN(mp_builtin_sum_obj);
     120                 :            : MP_DECLARE_CONST_FUN_OBJ_VAR_BETWEEN(mp_builtin_input_obj);
     121                 :            : 
     122                 :            : MP_DECLARE_CONST_FUN_OBJ_2(mp_namedtuple_obj);
     123                 :            : 
     124                 :            : MP_DECLARE_CONST_FUN_OBJ_2(mp_op_contains_obj);
     125                 :            : MP_DECLARE_CONST_FUN_OBJ_2(mp_op_getitem_obj);
     126                 :            : MP_DECLARE_CONST_FUN_OBJ_3(mp_op_setitem_obj);
     127                 :            : MP_DECLARE_CONST_FUN_OBJ_2(mp_op_delitem_obj);
     128                 :            : 
     129                 :            : MP_DECLARE_CONST_FUN_OBJ_VAR_BETWEEN(mp_sys_exit_obj);
     130                 :            : 
     131                 :            : // Modules needed by the runtime.
     132                 :            : extern const mp_obj_dict_t mp_module_builtins_globals;
     133                 :            : extern const mp_obj_module_t mp_module___main__;
     134                 :            : extern const mp_obj_module_t mp_module_builtins;
     135                 :            : extern const mp_obj_module_t mp_module_sys;
     136                 :            : 
     137                 :            : // Modules needed by the parser when MICROPY_COMP_MODULE_CONST is enabled.
     138                 :            : extern const mp_obj_module_t mp_module_errno;
     139                 :            : extern const mp_obj_module_t mp_module_uctypes;
     140                 :            : extern const mp_obj_module_t mp_module_machine;
     141                 :            : 
     142                 :            : extern const char MICROPY_PY_BUILTINS_HELP_TEXT[];
     143                 :            : 
     144                 :            : #endif // MICROPY_INCLUDED_PY_BUILTIN_H

Generated by: LCOV version 1.15-5-g462f71d