LCOV - code coverage report
Current view: top level - extmod - modplatform.c (source / functions) Hit Total Coverage
Test: unix_coverage_v1.24.0-7-g548babf8a.info Lines: 0 6 0.0 %
Date: 2024-10-30 09:06:48 Functions: 0 3 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-2021 Ibrahim Abdelkader <iabdalkader@openmv.io>
       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                 :            :  */
      27                 :            : 
      28                 :            : #include "py/runtime.h"
      29                 :            : #include "py/objtuple.h"
      30                 :            : #include "py/objstr.h"
      31                 :            : #include "py/mphal.h"
      32                 :            : #include "extmod/modplatform.h"
      33                 :            : #include "genhdr/mpversion.h"
      34                 :            : 
      35                 :            : #if MICROPY_PY_PLATFORM
      36                 :            : 
      37                 :            : // platform - Access to underlying platform's identifying data
      38                 :            : 
      39                 :            : static const MP_DEFINE_STR_OBJ(info_platform_obj, MICROPY_PLATFORM_SYSTEM "-" \
      40                 :            :     MICROPY_VERSION_STRING "-" MICROPY_PLATFORM_ARCH "-" MICROPY_PLATFORM_VERSION "-with-" \
      41                 :            :     MICROPY_PLATFORM_LIBC_LIB "" MICROPY_PLATFORM_LIBC_VER);
      42                 :            : static const MP_DEFINE_STR_OBJ(info_python_compiler_obj, MICROPY_PLATFORM_COMPILER);
      43                 :            : static const MP_DEFINE_STR_OBJ(info_libc_lib_obj, MICROPY_PLATFORM_LIBC_LIB);
      44                 :            : static const MP_DEFINE_STR_OBJ(info_libc_ver_obj, MICROPY_PLATFORM_LIBC_VER);
      45                 :            : static const mp_rom_obj_tuple_t info_libc_tuple_obj = {
      46                 :            :     {&mp_type_tuple}, 2, {MP_ROM_PTR(&info_libc_lib_obj), MP_ROM_PTR(&info_libc_ver_obj)}
      47                 :            : };
      48                 :            : 
      49                 :          0 : static mp_obj_t platform_platform(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
      50                 :          0 :     return MP_OBJ_FROM_PTR(&info_platform_obj);
      51                 :            : }
      52                 :            : static MP_DEFINE_CONST_FUN_OBJ_KW(platform_platform_obj, 0, platform_platform);
      53                 :            : 
      54                 :          0 : static mp_obj_t platform_python_compiler(void) {
      55                 :          0 :     return MP_OBJ_FROM_PTR(&info_python_compiler_obj);
      56                 :            : }
      57                 :            : static MP_DEFINE_CONST_FUN_OBJ_0(platform_python_compiler_obj, platform_python_compiler);
      58                 :            : 
      59                 :          0 : static mp_obj_t platform_libc_ver(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
      60                 :          0 :     return MP_OBJ_FROM_PTR(&info_libc_tuple_obj);
      61                 :            : }
      62                 :            : static MP_DEFINE_CONST_FUN_OBJ_KW(platform_libc_ver_obj, 0, platform_libc_ver);
      63                 :            : 
      64                 :            : static const mp_rom_map_elem_t modplatform_globals_table[] = {
      65                 :            :     { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_platform) },
      66                 :            :     { MP_ROM_QSTR(MP_QSTR_platform), MP_ROM_PTR(&platform_platform_obj) },
      67                 :            :     { MP_ROM_QSTR(MP_QSTR_python_compiler), MP_ROM_PTR(&platform_python_compiler_obj) },
      68                 :            :     { MP_ROM_QSTR(MP_QSTR_libc_ver), MP_ROM_PTR(&platform_libc_ver_obj) },
      69                 :            : };
      70                 :            : 
      71                 :            : static MP_DEFINE_CONST_DICT(modplatform_globals, modplatform_globals_table);
      72                 :            : 
      73                 :            : const mp_obj_module_t mp_module_platform = {
      74                 :            :     .base = { &mp_type_module },
      75                 :            :     .globals = (mp_obj_dict_t *)&modplatform_globals,
      76                 :            : };
      77                 :            : 
      78                 :            : MP_REGISTER_EXTENSIBLE_MODULE(MP_QSTR_platform, mp_module_platform);
      79                 :            : 
      80                 :            : #endif // MICROPY_PY_PLATFORM

Generated by: LCOV version 1.15-5-g462f71d