diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index 2cfb61baf1eb4..fd2a152eab3a3 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -17,7 +17,7 @@ jobs: env: CP_VERSION: ${{ inputs.cp-version }} MICROPY_CPYTHON3: python3.8 - MICROPY_MICROPYTHON: ../ports/unix/build-coverage/micropython + MICROPY_MICROPYTHON: ../ports/posix/circuitpython TEST_all: TEST_mpy: --via-mpy -d basics float micropython TEST_native: --emit native @@ -44,24 +44,5 @@ jobs: uses: ./.github/actions/mpy_cross with: cp-version: ${{ inputs.cp-version }} - - name: Build unix port - run: make -C ports/unix VARIANT=coverage -j4 - - name: Run tests - run: ./run-tests.py -j4 ${{ env[format('TEST_{0}', matrix.test)] }} - working-directory: tests - - name: Print failure info - run: ./run-tests.py -j4 --print-failures - if: failure() - working-directory: tests - - name: Build native modules - if: matrix.test == 'all' - run: | - make -C examples/natmod/features1 - make -C examples/natmod/features2 - make -C examples/natmod/heapq - make -C examples/natmod/random - make -C examples/natmod/re - - name: Test native modules - if: matrix.test == 'all' - run: ./run-natmodtests.py extmod/{heapq*,re*,zlib*}.py - working-directory: tests + - name: Build & test POSIX port + run: make -C ports/posix -j$(nproc) vtest diff --git a/cmdline.c b/cmdline.c new file mode 100644 index 0000000000000..210100639bc31 --- /dev/null +++ b/cmdline.c @@ -0,0 +1,762 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2013, 2014 Damien P. George + * Copyright (c) 2014-2017 Paul Sokolovsky + * Copyright (c) 2024 Jeff Epler + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "py/compile.h" +#include "py/runtime.h" +#include "py/builtin.h" +#include "py/repl.h" +#include "py/gc.h" +#include "py/objstr.h" +#include "py/stackctrl.h" +#include "py/mphal.h" +#include "py/mpthread.h" +#include "py/mpthread.h" +#include "extmod/misc.h" +#include "extmod/modplatform.h" +#include "extmod/vfs.h" +#include "extmod/vfs_posix.h" +#include "genhdr/mpversion.h" +#include "main.h" +#include "input.h" +#include "shared/runtime/pyexec.h" +#include "shared-module/atexit/__init__.h" + +#if CIRCUITPY_COMMAND_LINE_WORKFLOW +// Command line options, with their defaults +STATIC bool compile_only = false; +STATIC uint emit_opt = MP_EMIT_OPT_NONE; + +STATIC void stderr_print_strn(void *env, const char *str, size_t len) { + (void)env; + ssize_t ret; + MP_HAL_RETRY_SYSCALL(ret, write(STDERR_FILENO, str, len), {}); + #if MICROPY_PY_OS_DUPTERM + mp_os_dupterm_tx_strn(str, len); + #endif +} + +const mp_print_t mp_stderr_print = {NULL, stderr_print_strn}; + +#define FORCED_EXIT (0x100) +// If exc is SystemExit, return value where FORCED_EXIT bit set, +// and lower 8 bits are SystemExit value. For all other exceptions, +// return 1. +STATIC int handle_uncaught_exception(mp_obj_base_t *exc) { + // check for SystemExit + if (mp_obj_is_subclass_fast(MP_OBJ_FROM_PTR(exc->type), MP_OBJ_FROM_PTR(&mp_type_SystemExit))) { + // None is an exit value of 0; an int is its value; anything else is 1 + mp_obj_t exit_val = mp_obj_exception_get_value(MP_OBJ_FROM_PTR(exc)); + mp_int_t val = 0; + if (exit_val != mp_const_none && !mp_obj_get_int_maybe(exit_val, &val)) { + val = 1; + } + return FORCED_EXIT | (val & 255); + } + + // Report all other exceptions + mp_obj_print_exception(&mp_stderr_print, MP_OBJ_FROM_PTR(exc)); + return 1; +} + +#define LEX_SRC_STR (1) +#define LEX_SRC_VSTR (2) +#define LEX_SRC_FILENAME (3) +#define LEX_SRC_STDIN (4) + +// Returns standard error codes: 0 for success, 1 for all other errors, +// except if FORCED_EXIT bit is set then script raised SystemExit and the +// value of the exit is in the lower 8 bits of the return value +STATIC int execute_from_lexer(int source_kind, const void *source, mp_parse_input_kind_t input_kind, bool is_repl) { + mp_hal_set_interrupt_char(CHAR_CTRL_C); + + nlr_buf_t nlr; + if (nlr_push(&nlr) == 0) { + // create lexer based on source kind + mp_lexer_t *lex; + if (source_kind == LEX_SRC_STR) { + const char *line = source; + lex = mp_lexer_new_from_str_len(MP_QSTR__lt_stdin_gt_, line, strlen(line), false); + } else if (source_kind == LEX_SRC_VSTR) { + const vstr_t *vstr = source; + lex = mp_lexer_new_from_str_len(MP_QSTR__lt_stdin_gt_, vstr->buf, vstr->len, false); + } else if (source_kind == LEX_SRC_FILENAME) { + lex = mp_lexer_new_from_file((const char *)source); + } else { // LEX_SRC_STDIN + lex = mp_lexer_new_from_fd(MP_QSTR__lt_stdin_gt_, 0, false); + } + + qstr source_name = lex->source_name; + + #if MICROPY_PY___FILE__ + if (input_kind == MP_PARSE_FILE_INPUT) { + mp_store_global(MP_QSTR___file__, MP_OBJ_NEW_QSTR(source_name)); + } + #endif + + mp_parse_tree_t parse_tree = mp_parse(lex, input_kind); + + #if defined(MICROPY_UNIX_COVERAGE) + // allow to print the parse tree in the coverage build + if (mp_verbose_flag >= 3) { + printf("----------------\n"); + mp_parse_node_print(&mp_plat_print, parse_tree.root, 0); + printf("----------------\n"); + } + #endif + + mp_obj_t module_fun = mp_compile(&parse_tree, source_name, is_repl); + + if (!compile_only) { + // execute it + mp_call_function_0(module_fun); + } + + mp_hal_set_interrupt_char(-1); + mp_handle_pending(true); + nlr_pop(); + return 0; + + } else { + // uncaught exception + mp_hal_set_interrupt_char(-1); + mp_handle_pending(false); + return handle_uncaught_exception(nlr.ret_val); + } +} + +#if MICROPY_USE_READLINE == 1 +#include "shared/readline/readline.h" +#else +STATIC char *strjoin(const char *s1, int sep_char, const char *s2) { + int l1 = strlen(s1); + int l2 = strlen(s2); + char *s = malloc(l1 + l2 + 2); + memcpy(s, s1, l1); + if (sep_char != 0) { + s[l1] = sep_char; + l1 += 1; + } + memcpy(s + l1, s2, l2); + s[l1 + l2] = 0; + return s; +} +#endif + +STATIC int do_repl(void) { + mp_hal_stdout_tx_str(MICROPY_BANNER_NAME_AND_VERSION); + mp_hal_stdout_tx_str("; " MICROPY_BANNER_MACHINE); + mp_hal_stdout_tx_str("\nUse Ctrl-D to exit, Ctrl-E for paste mode\n"); + + #if MICROPY_USE_READLINE == 1 + + // use MicroPython supplied readline + + vstr_t line; + vstr_init(&line, 16); + for (;;) { + mp_hal_stdio_mode_raw(); + + input_restart: + vstr_reset(&line); + int ret = readline(&line, mp_repl_get_ps1()); + mp_parse_input_kind_t parse_input_kind = MP_PARSE_SINGLE_INPUT; + + if (ret == CHAR_CTRL_C) { + // cancel input + mp_hal_stdout_tx_str("\r\n"); + goto input_restart; + } else if (ret == CHAR_CTRL_D) { + // EOF + printf("\n"); + mp_hal_stdio_mode_orig(); + vstr_clear(&line); + return 0; + } else if (ret == CHAR_CTRL_E) { + // paste mode + mp_hal_stdout_tx_str("\npaste mode; Ctrl-C to cancel, Ctrl-D to finish\n=== "); + vstr_reset(&line); + for (;;) { + char c = mp_hal_stdin_rx_chr(); + if (c == CHAR_CTRL_C) { + // cancel everything + mp_hal_stdout_tx_str("\n"); + goto input_restart; + } else if (c == CHAR_CTRL_D) { + // end of input + mp_hal_stdout_tx_str("\n"); + break; + } else { + // add char to buffer and echo + vstr_add_byte(&line, c); + if (c == '\r') { + mp_hal_stdout_tx_str("\n=== "); + } else { + mp_hal_stdout_tx_strn(&c, 1); + } + } + } + parse_input_kind = MP_PARSE_FILE_INPUT; + } else if (line.len == 0) { + if (ret != 0) { + printf("\n"); + } + goto input_restart; + } else { + // got a line with non-zero length, see if it needs continuing + while (mp_repl_continue_with_input(vstr_null_terminated_str(&line))) { + vstr_add_byte(&line, '\n'); + ret = readline(&line, mp_repl_get_ps2()); + if (ret == CHAR_CTRL_C) { + // cancel everything + printf("\n"); + goto input_restart; + } else if (ret == CHAR_CTRL_D) { + // stop entering compound statement + break; + } + } + } + + mp_hal_stdio_mode_orig(); + + ret = execute_from_lexer(LEX_SRC_VSTR, &line, parse_input_kind, true); + if (ret & FORCED_EXIT) { + return ret; + } + } + + #else + + // use simple readline + + for (;;) { + char *line = prompt((char *)mp_repl_get_ps1()); + if (line == NULL) { + // EOF + return 0; + } + while (mp_repl_continue_with_input(line)) { + char *line2 = prompt((char *)mp_repl_get_ps2()); + if (line2 == NULL) { + break; + } + char *line3 = strjoin(line, '\n', line2); + free(line); + free(line2); + line = line3; + } + + int ret = execute_from_lexer(LEX_SRC_STR, line, MP_PARSE_SINGLE_INPUT, true); + if (ret & FORCED_EXIT) { + return ret; + } + free(line); + } + + #endif +} + +STATIC int do_file(const char *file) { + return execute_from_lexer(LEX_SRC_FILENAME, file, MP_PARSE_FILE_INPUT, false); +} + +STATIC int do_str(const char *str) { + return execute_from_lexer(LEX_SRC_STR, str, MP_PARSE_FILE_INPUT, false); +} + +STATIC void print_help(char **argv) { + printf( + "usage: %s [] [-X ] [-c | -m | ]\n" + "Options:\n" + "-h : print this help message\n" + "-i : enable inspection via REPL after running command/module/file\n" + #if MICROPY_DEBUG_PRINTERS + "-v : verbose (trace various operations); can be multiple\n" + #endif + "-O[N] : apply bytecode optimizations of level N\n" + "\n" + "Implementation specific options (-X):\n", argv[0] + ); + int impl_opts_cnt = 0; + printf( + " compile-only -- parse and compile only\n" + #if MICROPY_EMIT_NATIVE + " emit={bytecode,native,viper} -- set the default code emitter\n" + #else + " emit=bytecode -- set the default code emitter\n" + #endif + ); + impl_opts_cnt++; + #if 0 && MICROPY_ENABLE_GC + printf( + " heapsize=[w][K|M] -- set the heap size for the GC (default %ld)\n" + , heap_size); + impl_opts_cnt++; + #endif + #if defined(__APPLE__) + printf(" realtime -- set thread priority to realtime\n"); + impl_opts_cnt++; + #endif + + if (impl_opts_cnt == 0) { + printf(" (none)\n"); + } +} + +STATIC int invalid_args(void) { + fprintf(stderr, "Invalid command line arguments. Use -h option for help.\n"); + return 1; +} + +// Process options which set interpreter init options +STATIC void pre_process_options(int argc, char **argv) { + for (int a = 1; a < argc; a++) { + if (argv[a][0] == '-') { + if (strcmp(argv[a], "-c") == 0 || strcmp(argv[a], "-m") == 0) { + break; // Everything after this is a command/module and arguments for it + } + if (strcmp(argv[a], "-h") == 0) { + print_help(argv); + exit(0); + } + if (strcmp(argv[a], "-X") == 0) { + if (a + 1 >= argc) { + exit(invalid_args()); + } + if (0) { + } else if (strcmp(argv[a + 1], "compile-only") == 0) { + compile_only = true; + } else if (strcmp(argv[a + 1], "emit=bytecode") == 0) { + emit_opt = MP_EMIT_OPT_BYTECODE; + #if MICROPY_EMIT_NATIVE + } else if (strcmp(argv[a + 1], "emit=native") == 0) { + emit_opt = MP_EMIT_OPT_NATIVE_PYTHON; + } else if (strcmp(argv[a + 1], "emit=viper") == 0) { + emit_opt = MP_EMIT_OPT_VIPER; + #endif + #if 0 && MICROPY_ENABLE_GC + } else if (strncmp(argv[a + 1], "heapsize=", sizeof("heapsize=") - 1) == 0) { + char *end; + heap_size = strtol(argv[a + 1] + sizeof("heapsize=") - 1, &end, 0); + // Don't bring unneeded libc dependencies like tolower() + // If there's 'w' immediately after number, adjust it for + // target word size. Note that it should be *before* size + // suffix like K or M, to avoid confusion with kilowords, + // etc. the size is still in bytes, just can be adjusted + // for word size (taking 32bit as baseline). + bool word_adjust = false; + if ((*end | 0x20) == 'w') { + word_adjust = true; + end++; + } + if ((*end | 0x20) == 'k') { + heap_size *= 1024; + } else if ((*end | 0x20) == 'm') { + heap_size *= 1024 * 1024; + } else { + // Compensate for ++ below + --end; + } + if (*++end != 0) { + goto invalid_arg; + } + if (word_adjust) { + heap_size = heap_size * MP_BYTES_PER_OBJ_WORD / 4; + } + // If requested size too small, we'll crash anyway + if (heap_size < 700) { + goto invalid_arg; + } + #endif + #if defined(__APPLE__) + } else if (strcmp(argv[a + 1], "realtime") == 0) { + #if MICROPY_PY_THREAD + mp_thread_is_realtime_enabled = true; + #endif + // main thread was already initialized before the option + // was parsed, so we have to enable realtime here. + mp_thread_set_realtime(); + #endif + } else { + // invalid_arg: + exit(invalid_args()); + } + a++; + } + } else { + break; // Not an option but a file + } + } +} + +STATIC void set_sys_argv(char *argv[], int argc, int start_arg) { + for (int i = start_arg; i < argc; i++) { + mp_obj_list_append(mp_sys_argv, MP_OBJ_NEW_QSTR(qstr_from_str(argv[i]))); + } +} + +#if MICROPY_PY_SYS_EXECUTABLE +extern mp_obj_str_t mp_sys_executable_obj; +STATIC char executable_path[MICROPY_ALLOC_PATH_MAX]; + +STATIC void sys_set_excecutable(char *argv0) { + if (realpath(argv0, executable_path)) { + mp_obj_str_set_data(&mp_sys_executable_obj, (byte *)executable_path, strlen(executable_path)); + } +} +#endif + +#ifdef _WIN32 +#define PATHLIST_SEP_CHAR ';' +#else +#define PATHLIST_SEP_CHAR ':' +#endif + +MP_NOINLINE int main_(int argc, char **argv); + +int *address_of_argc; + +int main(int argc, char **argv) { + address_of_argc = &argc; + #if MICROPY_PY_THREAD + mp_thread_init(); + #endif + // We should capture stack top ASAP after start, and it should be + // captured guaranteedly before any other stack variables are allocated. + // For this, actual main (renamed main_) should not be inlined into + // this function. main_() itself may have other functions inlined (with + // their own stack variables), that's why we need this main/main_ split. + mp_stack_ctrl_init(); + return main_(argc, argv); +} + +MP_NOINLINE int main_(int argc, char **argv) { + #ifdef SIGPIPE + // Do not raise SIGPIPE, instead return EPIPE. Otherwise, e.g. writing + // to peer-closed socket will lead to sudden termination of MicroPython + // process. SIGPIPE is particularly nasty, because unix shell doesn't + // print anything for it, so the above looks like completely sudden and + // silent termination for unknown reason. Ignoring SIGPIPE is also what + // CPython does. Note that this may lead to problems using MicroPython + // scripts as pipe filters, but again, that's what CPython does. So, + // scripts which want to follow unix shell pipe semantics (where SIGPIPE + // means "pipe was requested to terminate, it's not an error"), should + // catch EPIPE themselves. + signal(SIGPIPE, SIG_IGN); + #endif + + circuitpy_init(); + + pre_process_options(argc, argv); + + start_mp(SAFE_MODE_NONE); + + #if MICROPY_EMIT_NATIVE + // Set default emitter options + MP_STATE_VM(default_emit_opt) = emit_opt; + #else + (void)emit_opt; + #endif + + #if MICROPY_VFS_POSIX + { + // Mount the host FS at the root of our internal VFS + mp_obj_t args[2] = { + MP_OBJ_TYPE_GET_SLOT(&mp_type_vfs_posix, make_new)(&mp_type_vfs_posix, 0, 0, NULL), + MP_OBJ_NEW_QSTR(MP_QSTR__slash_), + }; + mp_vfs_mount(2, args, (mp_map_t *)&mp_const_empty_map); + MP_STATE_VM(vfs_cur) = MP_STATE_VM(vfs_mount_table); + } + #endif + + { + // sys.path starts as [""] + mp_sys_path = mp_obj_new_list(0, NULL); + mp_obj_list_append(mp_sys_path, MP_OBJ_NEW_QSTR(MP_QSTR_)); + + // Add colon-separated entries from MICROPYPATH. + char *home = getenv("HOME"); + const char *path = getenv("CIRCUITPYPATH"); + if (path == NULL) { + path = getenv("MICROPYPATH"); + } + if (path == NULL) { + path = MICROPY_PY_SYS_PATH_DEFAULT; + } + if (*path == PATHLIST_SEP_CHAR) { + // First entry is empty. We've already added an empty entry to sys.path, so skip it. + ++path; + } + bool path_remaining = *path; + while (path_remaining) { + const char *path_entry_end = strchr(path, PATHLIST_SEP_CHAR); + if (path_entry_end == NULL) { + path_entry_end = path + strlen(path); + path_remaining = false; + } + if (path[0] == '~' && path[1] == '/' && home != NULL) { + // Expand standalone ~ to $HOME + int home_l = strlen(home); + vstr_t vstr; + vstr_init(&vstr, home_l + (path_entry_end - path - 1) + 1); + vstr_add_strn(&vstr, home, home_l); + vstr_add_strn(&vstr, path + 1, path_entry_end - path - 1); + mp_obj_list_append(mp_sys_path, mp_obj_new_str_from_vstr(&vstr)); + } else { + mp_obj_list_append(mp_sys_path, mp_obj_new_str_via_qstr(path, path_entry_end - path)); + } + path = path_entry_end + 1; + } + } + + mp_obj_list_init(MP_OBJ_TO_PTR(mp_sys_argv), 0); + + #if defined(MICROPY_UNIX_COVERAGE) + { + MP_DECLARE_CONST_FUN_OBJ_0(extra_coverage_obj); + MP_DECLARE_CONST_FUN_OBJ_0(extra_cpp_coverage_obj); + mp_store_global(MP_QSTR_extra_coverage, MP_OBJ_FROM_PTR(&extra_coverage_obj)); + mp_store_global(MP_QSTR_extra_cpp_coverage, MP_OBJ_FROM_PTR(&extra_cpp_coverage_obj)); + // CIRCUITPY-CHANGE: test native base classes work as needed by CircuitPython libraries. + extern const mp_obj_type_t native_base_class_type; + mp_store_global(MP_QSTR_NativeBaseClass, MP_OBJ_FROM_PTR(&native_base_class_type)); + mp_store_global(MP_QSTR_getenv_int, MP_OBJ_FROM_PTR(&mod_os_getenv_int_obj)); + mp_store_global(MP_QSTR_getenv_str, MP_OBJ_FROM_PTR(&mod_os_getenv_str_obj)); + } + #endif + + // Here is some example code to create a class and instance of that class. + // First is the Python, then the C code. + // + // class TestClass: + // pass + // test_obj = TestClass() + // test_obj.attr = 42 + // + // mp_obj_t test_class_type, test_class_instance; + // test_class_type = mp_obj_new_type(qstr_from_str("TestClass"), mp_const_empty_tuple, mp_obj_new_dict(0)); + // mp_store_name(qstr_from_str("test_obj"), test_class_instance = mp_call_function_0(test_class_type)); + // mp_store_attr(test_class_instance, qstr_from_str("attr"), mp_obj_new_int(42)); + + /* + printf("bytes:\n"); + printf(" total %d\n", m_get_total_bytes_allocated()); + printf(" cur %d\n", m_get_current_bytes_allocated()); + printf(" peak %d\n", m_get_peak_bytes_allocated()); + */ + + #if MICROPY_PY_SYS_EXECUTABLE + sys_set_excecutable(argv[0]); + #endif + + const int NOTHING_EXECUTED = -2; + int ret = NOTHING_EXECUTED; + bool inspect = false; + for (int a = 1; a < argc; a++) { + if (argv[a][0] == '-') { + if (strcmp(argv[a], "-i") == 0) { + inspect = true; + } else if (strcmp(argv[a], "-c") == 0) { + if (a + 1 >= argc) { + return invalid_args(); + } + set_sys_argv(argv, a + 1, a); // The -c becomes first item of sys.argv, as in CPython + set_sys_argv(argv, argc, a + 2); // Then what comes after the command + ret = do_str(argv[a + 1]); + break; + } else if (strcmp(argv[a], "-m") == 0) { + if (a + 1 >= argc) { + return invalid_args(); + } + mp_obj_t import_args[4]; + import_args[0] = mp_obj_new_str(argv[a + 1], strlen(argv[a + 1])); + import_args[1] = import_args[2] = mp_const_none; + // Ask __import__ to handle imported module specially - set its __name__ + // to __main__, and also return this leaf module, not top-level package + // containing it. + import_args[3] = mp_const_false; + // TODO: https://docs.python.org/3/using/cmdline.html#cmdoption-m : + // "the first element of sys.argv will be the full path to + // the module file (while the module file is being located, + // the first element will be set to "-m")." + set_sys_argv(argv, argc, a + 1); + + mp_obj_t mod; + nlr_buf_t nlr; + + // Allocating subpkg_tried on the stack can lead to compiler warnings about this + // variable being clobbered when nlr is implemented using setjmp/longjmp. Its + // value must be preserved across calls to setjmp/longjmp. + static bool subpkg_tried; + subpkg_tried = false; + + reimport: + if (nlr_push(&nlr) == 0) { + mod = mp_builtin___import__(MP_ARRAY_SIZE(import_args), import_args); + nlr_pop(); + } else { + // uncaught exception + return handle_uncaught_exception(nlr.ret_val) & 0xff; + } + + // If this module is a package, see if it has a `__main__.py`. + mp_obj_t dest[2]; + mp_load_method_protected(mod, MP_QSTR___path__, dest, true); + if (dest[0] != MP_OBJ_NULL && !subpkg_tried) { + subpkg_tried = true; + vstr_t vstr; + int len = strlen(argv[a + 1]); + vstr_init(&vstr, len + sizeof(".__main__")); + vstr_add_strn(&vstr, argv[a + 1], len); + vstr_add_strn(&vstr, ".__main__", sizeof(".__main__") - 1); + import_args[0] = mp_obj_new_str_from_vstr(&vstr); + goto reimport; + } + + ret = 0; + break; + } else if (strcmp(argv[a], "-X") == 0) { + a += 1; + #if MICROPY_DEBUG_PRINTERS + } else if (strcmp(argv[a], "-v") == 0) { + mp_verbose_flag++; + #endif + } else if (strncmp(argv[a], "-O", 2) == 0) { + if (unichar_isdigit(argv[a][2])) { + MP_STATE_VM(mp_optimise_value) = argv[a][2] & 0xf; + } else { + MP_STATE_VM(mp_optimise_value) = 0; + for (char *p = argv[a] + 1; *p && *p == 'O'; p++, MP_STATE_VM(mp_optimise_value)++) {; + } + } + } else { + return invalid_args(); + } + } else { + char *pathbuf = malloc(PATH_MAX); + char *basedir = realpath(argv[a], pathbuf); + if (basedir == NULL) { + mp_printf(&mp_stderr_print, "%s: can't open file '%s': [Errno %d] %s\n", argv[0], argv[a], errno, strerror(errno)); + free(pathbuf); + // CPython exits with 2 in such case + ret = 2; + break; + } + + // Set base dir of the script as first entry in sys.path. + char *p = strrchr(basedir, '/'); + mp_obj_list_store(mp_sys_path, MP_OBJ_NEW_SMALL_INT(0), mp_obj_new_str_via_qstr(basedir, p - basedir)); + free(pathbuf); + + set_sys_argv(argv, argc, a); + ret = do_file(argv[a]); + break; + } + } + + const char *inspect_env = getenv("MICROPYINSPECT"); + if (inspect_env && inspect_env[0] != '\0') { + inspect = true; + } + if (ret == NOTHING_EXECUTED || inspect) { + if (isatty(0) || inspect) { + prompt_read_history(); + ret = do_repl(); + prompt_write_history(); + } else { + ret = execute_from_lexer(LEX_SRC_STDIN, NULL, MP_PARSE_FILE_INPUT, false); + } + } + + #if MICROPY_PY_SYS_SETTRACE + MP_STATE_THREAD(prof_trace_callback) = MP_OBJ_NULL; + #endif + + #if CIRCUITPY_ATEXIT + pyexec_result_t _exec_result = {0, MP_OBJ_NULL, 0}; + shared_module_atexit_execute(&_exec_result); + #endif + + #if MICROPY_PY_SYS_ATEXIT + // Beware, the sys.settrace callback should be disabled before running sys.atexit. + if (mp_obj_is_callable(MP_STATE_VM(sys_exitfunc))) { + mp_call_function_0(MP_STATE_VM(sys_exitfunc)); + } + #endif + + #if MICROPY_PY_MICROPYTHON_MEM_INFO + if (mp_verbose_flag) { + mp_micropython_mem_info(0, NULL); + } + #endif + + #if MICROPY_PY_BLUETOOTH + void mp_bluetooth_deinit(void); + mp_bluetooth_deinit(); + #endif + + #if MICROPY_PY_THREAD + mp_thread_deinit(); + #endif + + #if defined(MICROPY_UNIX_COVERAGE) + gc_sweep_all(); + #endif + + mp_deinit(); + + #if 0 // MICROPY_ENABLE_GC && !defined(NDEBUG) + // We don't really need to free memory since we are about to exit the + // process, but doing so helps to find memory leaks. + #if !MICROPY_GC_SPLIT_HEAP + free(heap); + #else + for (size_t i = 0; i < MICROPY_GC_SPLIT_HEAP_N_HEAPS; i++) { + free(heaps[i]); + } + #endif + #endif + + // printf("total bytes = %d\n", m_get_total_bytes_allocated()); + return ret & 0xff; +} +#endif diff --git a/extmod/modasyncio.c b/extmod/modasyncio.c index 4667e3de5332b..b7f02e57862b1 100644 --- a/extmod/modasyncio.c +++ b/extmod/modasyncio.c @@ -31,7 +31,7 @@ #if MICROPY_PY_ASYNCIO -#if CIRCUITPY && !(defined(__unix__) || defined(__APPLE__)) +#if CIRCUITPY_RTC #include "shared-bindings/supervisor/__init__.h" #endif @@ -72,7 +72,7 @@ STATIC mp_obj_t task_queue_make_new(const mp_obj_type_t *type, size_t n_args, si #define _TICKS_MAX (_TICKS_PERIOD - 1) #define _TICKS_HALFPERIOD (_TICKS_PERIOD >> 1) -#if !CIRCUITPY || (defined(__unix__) || defined(__APPLE__)) +#if !CIRCUITPY_RTC STATIC mp_obj_t ticks(void) { return MP_OBJ_NEW_SMALL_INT(mp_hal_ticks_ms() & _TICKS_MAX); } diff --git a/main.c b/main.c index 584a076d3d142..799206baff446 100644 --- a/main.c +++ b/main.c @@ -42,9 +42,10 @@ #include "shared/readline/readline.h" #include "shared/runtime/pyexec.h" +#include "shared/runtime/gchelper.h" +#include "main.h" #include "background.h" -#include "mpconfigboard.h" #include "supervisor/background_callback.h" #include "supervisor/board.h" #include "supervisor/cpu.h" @@ -92,6 +93,7 @@ #if CIRCUITPY_DISPLAYIO #include "shared-module/displayio/__init__.h" +#include "shared-bindings/displayio/__init__.h" #endif #if CIRCUITPY_EPAPERDISPLAY @@ -168,7 +170,7 @@ STATIC uint8_t *_allocate_memory(safe_mode_t safe_mode, const char *env_key, siz } #endif -STATIC void start_mp(safe_mode_t safe_mode) { +void start_mp(safe_mode_t safe_mode) { supervisor_workflow_reset(); // Stack limit should be less than real stack size, so we have a chance @@ -989,7 +991,7 @@ STATIC int run_repl(safe_mode_t safe_mode) { return exit_code; } -int __attribute__((used)) main(void) { +void circuitpy_init(void) { // initialise the cpu and peripherals set_safe_mode(port_init()); @@ -1008,7 +1010,9 @@ int __attribute__((used)) main(void) { // Start the debug serial serial_early_init(); + #if !CIRCUITPY_COMMAND_LINE_WORKFLOW mp_hal_stdout_tx_str(line_clear); + #endif // Wait briefly to give a reset window where we'll enter safe mode after the reset. if (get_safe_mode() == SAFE_MODE_NONE) { @@ -1026,6 +1030,7 @@ int __attribute__((used)) main(void) { supervisor_bluetooth_init(); #endif + #if !MICROPY_VFS_POSIX #if !INTERNAL_FLASH_FILESYSTEM // Set up anything that might need to get done before we try to use SPI flash // This is needed for some boards where flash relies on GPIO setup to work @@ -1041,6 +1046,7 @@ int __attribute__((used)) main(void) { if (!filesystem_init(get_safe_mode() == SAFE_MODE_NONE, false)) { set_safe_mode(SAFE_MODE_NO_CIRCUITPY); } + #endif #if CIRCUITPY_ALARM // Record which alarm woke us up, if any. @@ -1059,6 +1065,10 @@ int __attribute__((used)) main(void) { // displays init after filesystem, since they could share the flash SPI board_init(); +} + +void circuitpy_main(void) { + circuitpy_init(); mp_hal_stdout_tx_str(line_clear); @@ -1122,14 +1132,21 @@ int __attribute__((used)) main(void) { #endif } mp_deinit(); +} + +#if !CIRCUITPY_COMMAND_LINE_WORKFLOW +// otherwise, main() lives in cmdline.c */ +int __attribute__((used)) main(void) { + circuitpy_init(); + circuitpy_main(); return 0; } +#endif void gc_collect(void) { gc_collect_start(); - mp_uint_t regs[10]; - mp_uint_t sp = cpu_get_regs_and_sp(regs); + gc_helper_collect_regs_and_stack(); // This collects root pointers from the VFS mount table. Some of them may // have lost their references in the VM even though they are mounted. @@ -1163,9 +1180,6 @@ void gc_collect(void) { common_hal_wifi_gc_collect(); #endif - // This naively collects all object references from an approximate stack - // range. - gc_collect_root((void **)sp, ((mp_uint_t)port_stack_get_top() - sp) / sizeof(mp_uint_t)); gc_collect_end(); } @@ -1192,6 +1206,7 @@ static void NORETURN __fatal_error(const char *msg) { } } +void __assert_func(const char *file, int line, const char *func, const char *expr); void MP_WEAK __assert_func(const char *file, int line, const char *func, const char *expr) { mp_printf(&mp_plat_print, "Assertion '%s' failed, at file %s:%d\n", expr, file, line); __fatal_error("Assertion failed"); diff --git a/main.h b/main.h new file mode 100644 index 0000000000000..602b103923dab --- /dev/null +++ b/main.h @@ -0,0 +1,34 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2024 Jeff Epler + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#pragma once + +#include "supervisor/shared/safe_mode.h" + +extern int *address_of_argc; +void circuitpy_init(void); +void circuitpy_main(void); +void start_mp(safe_mode_t safe_mode); diff --git a/ports/espressif/esp-idf b/ports/espressif/esp-idf index 60ff95f5bf8a8..b6b7a7aad56ed 160000 --- a/ports/espressif/esp-idf +++ b/ports/espressif/esp-idf @@ -1 +1 @@ -Subproject commit 60ff95f5bf8a8bfd676dcfb9204fa82263bf3d60 +Subproject commit b6b7a7aad56ede8f2d4e213c3dd3621dacc34122 diff --git a/ports/espressif/supervisor/serial.c b/ports/espressif/supervisor/serial.c index 7b0166f5b16d8..c1f60769843ea 100644 --- a/ports/espressif/supervisor/serial.c +++ b/ports/espressif/supervisor/serial.c @@ -50,7 +50,7 @@ bool port_serial_connected(void) { #endif } -char port_serial_read(void) { +int port_serial_read(void) { #if CIRCUITPY_ESP_USB_SERIAL_JTAG if (usb_serial_jtag_bytes_available() > 0) { return usb_serial_jtag_read_char(); diff --git a/ports/posix/.gitignore b/ports/posix/.gitignore new file mode 100644 index 0000000000000..a89622da21134 --- /dev/null +++ b/ports/posix/.gitignore @@ -0,0 +1 @@ +/circuitpython diff --git a/ports/posix/Makefile b/ports/posix/Makefile new file mode 100644 index 0000000000000..1226e726ca06c --- /dev/null +++ b/ports/posix/Makefile @@ -0,0 +1,108 @@ +# This file is part of the MicroPython project, http://micropython.org/ +# +# The MIT License (MIT) +# +# SPDX-FileCopyrightText: Copyright (c) 2019 Dan Halbert for Adafruit Industries +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. + +CIRCUITPY_PORT_NO_BOARD = 1 + +include ../../py/circuitpy_mkenv.mk + +CROSS_COMPILE = + +INC += -I. \ + -I../.. \ + -I../lib/mp-readline \ + -I../shared/timeutils \ + -I$(BUILD) + +CFLAGS += -ggdb3 -Og + +CFLAGS += $(INC) -Wall -Werror -std=gnu11 $(BASE_CFLAGS) $(CFLAGS_MOD) $(COPT) -Werror=missing-prototypes + +SRC_COMMON_HAL_EXPANDED = $(addprefix shared-bindings/, $(SRC_COMMON_HAL)) \ + $(addprefix shared-bindings/, $(SRC_BINDINGS_ENUMS)) \ + $(addprefix common-hal/, $(SRC_COMMON_HAL)) + +SRC_SHARED_MODULE_EXPANDED = $(addprefix shared-bindings/, $(SRC_SHARED_MODULE)) \ + $(addprefix shared-module/, $(SRC_SHARED_MODULE)) \ + $(addprefix shared-module/, $(SRC_SHARED_MODULE_INTERNAL)) + +# There may be duplicates between SRC_COMMON_HAL_EXPANDED and SRC_SHARED_MODULE_EXPANDED, +# because a few modules have files both in common-hal/ and shared-module/. +# Doing a $(sort ...) removes duplicates as part of sorting. +SRC_COMMON_HAL_SHARED_MODULE_EXPANDED = $(sort $(SRC_COMMON_HAL_EXPANDED) $(SRC_SHARED_MODULE_EXPANDED)) + +SRC_C += shared/runtime/gchelper_generic.c +SRC_C += input.c + +OBJ = $(PY_O) $(SUPERVISOR_O) $(addprefix $(BUILD)/, $(SRC_C:.c=.o)) +OBJ += $(addprefix $(BUILD)/, $(SRC_COMMON_HAL_SHARED_MODULE_EXPANDED:.c=.o)) +OBJ += $(addprefix $(BUILD)/, $(SRC_CIRCUITPY_COMMON:.c=.o)) +OBJ += $(addprefix $(BUILD)/, $(SRC_MOD:.c=.o)) + +SRC_QSTR += $(SRC_C) $(SRC_SUPERVISOR) $(SRC_COMMON_HAL_EXPANDED) $(SRC_SHARED_MODULE_EXPANDED) $(SRC_CIRCUITPY_COMMON) +# Sources that only hold QSTRs after pre-processing. +SRC_QSTR_PREPROCESSOR += + +all: circuitpython + +circuitpython: $(OBJ) + $(STEPECHO) "LINK $@" + $(Q)echo $(OBJ) > $(BUILD)/firmware.objs + $(Q)$(CC) -o $@ $(LDFLAGS) @$(BUILD)/firmware.objs -Wl,--start-group $(LIBS) -Wl,--end-group -lm + +include $(TOP)/py/mkrules.mk + +TEST_SHOW_FAILURES ?= false +TEST_ARGS ?= +.PHONY: test +test: circuitpython + $(STEPECHO) "TEST $(TEST_ARGS)" + $(eval DIRNAME=ports/$(notdir $(CURDIR))) + $(Q)cd $(TOP)/tests; \ + ./run-tests.py --clean-failures; \ + if ! MICROPY_MICROPYTHON=../$(DIRNAME)/circuitpython ./run-tests.py $(TEST_ARGS); then \ + exitstatus=$?; \ + if $(TEST_SHOW_FAILURES); then \ + ./run-tests.py --print-failures; \ + fi; \ + echo $?; \ + fi + +.PHONY: vtest% vtest +vtest: + $(Q)$(MAKE) TEST_SHOW_FAILURES=true "test" +vtest%: + $(Q)$(MAKE) TEST_SHOW_FAILURES=true "test$*" + +.PHONY: testd-% +testd-%: + $(Q)$(MAKE) TEST_ARGS="-d $*" test + +.PHONY: test-% +test-%: + $(Q)$(MAKE) TEST_ARGS="*/$*.py" test + + +.PHONY: print-failures clean-failures +print-failures clean-failures: + ../../tests/run-tests.py --$@ diff --git a/tests/extmod/ssl_poll.py.exp b/ports/posix/background.h similarity index 100% rename from tests/extmod/ssl_poll.py.exp rename to ports/posix/background.h diff --git a/tests/extmod/uctypes_sizeof_native.py.exp b/ports/posix/common-hal/board/__init__.c similarity index 100% rename from tests/extmod/uctypes_sizeof_native.py.exp rename to ports/posix/common-hal/board/__init__.c diff --git a/ports/posix/common-hal/microcontroller/Pin.h b/ports/posix/common-hal/microcontroller/Pin.h new file mode 100644 index 0000000000000..a5cc75dab781d --- /dev/null +++ b/ports/posix/common-hal/microcontroller/Pin.h @@ -0,0 +1,8 @@ + +#pragma once +#include "py/obj.h" + +typedef struct { + mp_obj_base_t base; + // Stores no state currently. +} mcu_pin_obj_t; diff --git a/ports/posix/common-hal/microcontroller/Processor.h b/ports/posix/common-hal/microcontroller/Processor.h new file mode 100644 index 0000000000000..8c76637015db2 --- /dev/null +++ b/ports/posix/common-hal/microcontroller/Processor.h @@ -0,0 +1,7 @@ +#pragma once +#include "py/obj.h" + +typedef struct { + mp_obj_base_t base; + // Stores no state currently. +} mcu_processor_obj_t; diff --git a/ports/posix/common-hal/os/__init__.c b/ports/posix/common-hal/os/__init__.c new file mode 100644 index 0000000000000..e892790ba95f2 --- /dev/null +++ b/ports/posix/common-hal/os/__init__.c @@ -0,0 +1,38 @@ +#include "shared-bindings/os/__init__.h" +#include "py/objstr.h" +#include "py/objtuple.h" +#include +#include +#include + +static int random_fd = -1; +bool common_hal_os_urandom(uint8_t *buffer, mp_uint_t length) { + if (random_fd == -1) { + random_fd = open("/dev/urandom", O_RDONLY); + } + ssize_t result = read(random_fd, buffer, length); + return result != -1 && result == (ssize_t)length; +} + +STATIC const MP_DEFINE_STR_OBJ(os_uname_info_sysname_obj, "posix"); +STATIC const MP_DEFINE_STR_OBJ(os_uname_info_release_obj, MICROPY_VERSION_STRING); +STATIC const MP_DEFINE_STR_OBJ(os_uname_info_version_obj, MICROPY_GIT_TAG " on " MICROPY_BUILD_DATE); +STATIC const MP_DEFINE_STR_OBJ(os_uname_info_machine_obj, MICROPY_HW_BOARD_NAME " with " MICROPY_HW_MCU_NAME); + +STATIC const qstr os_uname_info_fields[] = { + MP_QSTR_sysname, MP_QSTR_nodename, + MP_QSTR_release, MP_QSTR_version, MP_QSTR_machine +}; + +mp_obj_t common_hal_os_uname(void) { + struct utsname buf; + uname(&buf); + mp_obj_t items[5] = { + (mp_obj_t)&os_uname_info_sysname_obj, + mp_obj_new_str(buf.nodename, strlen(buf.nodename)), + (mp_obj_t)&os_uname_info_release_obj, + (mp_obj_t)&os_uname_info_version_obj, + (mp_obj_t)&os_uname_info_machine_obj + }; + return mp_obj_new_attrtuple(os_uname_info_fields, 5, items); +} diff --git a/ports/posix/common-hal/rtc/RTC.c b/ports/posix/common-hal/rtc/RTC.c new file mode 100644 index 0000000000000..a35c33f896609 --- /dev/null +++ b/ports/posix/common-hal/rtc/RTC.c @@ -0,0 +1,61 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2024 Jeff Epler + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#include "shared-bindings/rtc/RTC.h" +#include "py/runtime.h" +#include +#include +#include + +extern void common_hal_rtc_get_time(timeutils_struct_time_t *tm) { + struct tm tu; + struct timeval ti; + gettimeofday(&ti, NULL); + localtime_r(&ti.tv_sec, &tu); + tm->tm_year = tu.tm_year + 1900; + tm->tm_mon = tu.tm_mon; + tm->tm_mday = tu.tm_mday; + tm->tm_hour = tu.tm_hour; + tm->tm_min = tu.tm_min; + tm->tm_sec = tu.tm_sec; + tm->tm_wday = tu.tm_wday; + tm->tm_yday = tu.tm_yday; +} + +extern void common_hal_rtc_set_time(timeutils_struct_time_t *tm) { + struct timeval tu = { .tv_sec = TIMEUTILS_SECONDS_1970_TO_2000 + timeutils_seconds_since_2000(tm->tm_year, tm->tm_mon, tm->tm_mday, tm->tm_hour, tm->tm_min, tm->tm_sec) }; + int r = settimeofday(&tu, NULL); + if (r < 0) { + mp_raise_OSError(errno); + } +} + +extern int common_hal_rtc_get_calibration(void) { + return 0; +} +extern void common_hal_rtc_set_calibration(int calibration) { + mp_arg_validate_int_range(calibration, 0, 0, MP_QSTR_calibration); +} diff --git a/ports/posix/common-hal/rtc/RTC.h b/ports/posix/common-hal/rtc/RTC.h new file mode 100644 index 0000000000000..e69de29bb2d1d diff --git a/ports/posix/common-hal/rtc/__init__.c b/ports/posix/common-hal/rtc/__init__.c new file mode 100644 index 0000000000000..e69de29bb2d1d diff --git a/ports/posix/common-hal/rtc/__init__.h b/ports/posix/common-hal/rtc/__init__.h new file mode 100644 index 0000000000000..e69de29bb2d1d diff --git a/ports/posix/common-hal/supervisor/Runtime.c b/ports/posix/common-hal/supervisor/Runtime.c new file mode 100644 index 0000000000000..e69de29bb2d1d diff --git a/ports/posix/common-hal/supervisor/Runtime.h b/ports/posix/common-hal/supervisor/Runtime.h new file mode 100644 index 0000000000000..d7f856d85ba41 --- /dev/null +++ b/ports/posix/common-hal/supervisor/Runtime.h @@ -0,0 +1,34 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2018 Michael Schroeder + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#pragma once + +#include "py/obj.h" + +typedef struct { + mp_obj_base_t base; + // Stores no state currently. +} super_runtime_obj_t; diff --git a/ports/posix/common-hal/supervisor/__init__.c b/ports/posix/common-hal/supervisor/__init__.c new file mode 100644 index 0000000000000..e69de29bb2d1d diff --git a/ports/posix/input.c b/ports/posix/input.c new file mode 100644 index 0000000000000..ff1d823aa51c7 --- /dev/null +++ b/ports/posix/input.c @@ -0,0 +1,126 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2013, 2014 Damien P. George + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#include +#include +#include +#include +#include +#include + +#include "py/mpstate.h" +#include "py/mphal.h" +#include "input.h" + +#if MICROPY_USE_READLINE == 1 +#include "shared/readline/readline.h" +#endif + +#if MICROPY_USE_READLINE == 0 +char *prompt(char *p) { + // simple read string + static char buf[256]; + fputs(p, stdout); + char *s = fgets(buf, sizeof(buf), stdin); + if (!s) { + return NULL; + } + int l = strlen(buf); + if (buf[l - 1] == '\n') { + buf[l - 1] = 0; + } else { + l++; + } + char *line = malloc(l); + memcpy(line, buf, l); + return line; +} +#endif + +void prompt_read_history(void) { + #if MICROPY_USE_READLINE_HISTORY + #if MICROPY_USE_READLINE == 1 + readline_init0(); // will clear history pointers + char *home = getenv("HOME"); + if (home != NULL) { + vstr_t vstr; + vstr_init(&vstr, 50); + vstr_printf(&vstr, "%s/.micropython.history", home); + int fd = open(vstr_null_terminated_str(&vstr), O_RDONLY); + if (fd != -1) { + vstr_reset(&vstr); + for (;;) { + char c; + int sz = read(fd, &c, 1); + if (sz < 0) { + if (errno == EINTR) { + continue; + } + break; + } + if (sz == 0 || c == '\n') { + readline_push_history(vstr_null_terminated_str(&vstr)); + if (sz == 0) { + break; + } + vstr_reset(&vstr); + } else { + vstr_add_byte(&vstr, c); + } + } + close(fd); + } + vstr_clear(&vstr); + } + #endif + #endif +} + +void prompt_write_history(void) { + #if MICROPY_USE_READLINE_HISTORY + #if MICROPY_USE_READLINE == 1 + char *home = getenv("HOME"); + if (home != NULL) { + vstr_t vstr; + vstr_init(&vstr, 50); + vstr_printf(&vstr, "%s/.micropython.history", home); + int fd = open(vstr_null_terminated_str(&vstr), O_CREAT | O_TRUNC | O_WRONLY, 0644); + if (fd != -1) { + for (int i = MP_ARRAY_SIZE(MP_STATE_PORT(readline_hist)) - 1; i >= 0; i--) { + const char *line = MP_STATE_PORT(readline_hist)[i]; + if (line != NULL) { + while (write(fd, line, strlen(line)) == -1 && errno == EINTR) { + } + while (write(fd, "\n", 1) == -1 && errno == EINTR) { + } + } + } + close(fd); + } + } + #endif + #endif +} diff --git a/ports/posix/input.h b/ports/posix/input.h new file mode 100644 index 0000000000000..a76b87e644800 --- /dev/null +++ b/ports/posix/input.h @@ -0,0 +1,8 @@ +#ifndef MICROPY_INCLUDED_UNIX_INPUT_H +#define MICROPY_INCLUDED_UNIX_INPUT_H + +char *prompt(char *p); +void prompt_read_history(void); +void prompt_write_history(void); + +#endif // MICROPY_INCLUDED_UNIX_INPUT_H diff --git a/ports/posix/mpconfigport.h b/ports/posix/mpconfigport.h new file mode 100644 index 0000000000000..91606aa66555e --- /dev/null +++ b/ports/posix/mpconfigport.h @@ -0,0 +1,60 @@ +#pragma once + +#define CIRCUITPY_PYSTACK_SIZE 16384 + +#define MICROPY_PY_SYS_PLATFORM "posix" +#define MICROPY_HW_BOARD_NAME "posix" + +#define MICROPY_OBJ_REPR (MICROPY_OBJ_REPR_A) +#define MICROPY_USE_READLINE (1) +#define MICROPY_GCREGS_SETJMP (0) + +#if defined(__i386__) + #define MICROPY_HW_MCU_NAME "x86" +#elif defined(__x86_64__) +#define MICROPY_HW_MCU_NAME "amd64" +#elif defined(__thumb2__) || defined(__thumb__) || defined(__arm__) +#define MICROPY_HW_MCU_NAME "arm32" +#elif defined(__aarch64__) +#define MICROPY_HW_MCU_NAME "aarch64" +#elif defined(__xtensa__) +#define MICROPY_HW_MCU_NAME "xtensa" +#elif defined(__powerpc__) +#define MICROPY_HW_MCU_NAME "powerpc" +#elif defined(__mips__) +#define MICROPY_HW_MCU_NAME "mips" +#else +#define MICROPY_HW_MCU_NAME "idk" +// #warning "No native NLR support for this arch, using setjmp implementation" +#endif + +// Configure which emitter to use for this target. +#if !defined(MICROPY_EMIT_X64) && defined(__x86_64__) + #define MICROPY_EMIT_X64 (1) +#endif +#if !defined(MICROPY_EMIT_X86) && defined(__i386__) + #define MICROPY_EMIT_X86 (1) +#endif +#if !defined(MICROPY_EMIT_THUMB) && defined(__thumb2__) + #define MICROPY_EMIT_THUMB (1) + #define MICROPY_MAKE_POINTER_CALLABLE(p) ((void *)((mp_uint_t)(p) | 1)) +#endif +// Some compilers define __thumb2__ and __arm__ at the same time, let +// autodetected thumb2 emitter have priority. +#if !defined(MICROPY_EMIT_ARM) && defined(__arm__) && !defined(__thumb2__) + #define MICROPY_EMIT_ARM (1) +#endif + +#ifndef MICROPY_PY_SYS_PATH_DEFAULT +#define MICROPY_PY_SYS_PATH_DEFAULT ".frozen:~/.micropython/lib:/usr/lib/micropython" +#endif + +#define MICROPY_COMP_TRIPLE_TUPLE_ASSIGN (1) +#define MICROPY_PY_MICROPYTHON_MEM_INFO (1) +#define MICROPY_MEM_STATS (1) +#define MICROPY_MALLOC_USES_ALLOCATED_SIZE (1) + +// Allow exception details in low-memory conditions. +#define MICROPY_ENABLE_EMERGENCY_EXCEPTION_BUF (1) +#define MICROPY_EMERGENCY_EXCEPTION_BUF_SIZE (256) +#include "py/circuitpy_mpconfig.h" diff --git a/ports/posix/mpconfigport.mk b/ports/posix/mpconfigport.mk new file mode 100644 index 0000000000000..a05d388cc4878 --- /dev/null +++ b/ports/posix/mpconfigport.mk @@ -0,0 +1,45 @@ +CIRCUITPY_SKIP_SAFE_MODE_WAIT = 1 +CIRCUITPY_STACK_CHECK = 0 +CIRCUITPY_ANALOGIO = 0 +CIRCUITPY_BUSDEVICE = 0 +CIRCUITPY_AUDIOBUSIO = 0 +CIRCUITPY_AUDIOIO = 0 +CIRCUITPY_AUDIOCORE = 1 +CIRCUITPY_AUDIOCORE_DEBUG = 1 +CIRCUITPY_BUSIO = 0 +CIRCUITPY_BITBANGIO = 0 +CIRCUITPY_BITMAPTOOLS = 1 +CIRCUITPY_BITMAPFILTER = 1 +CIRCUITPY_DISPLAYIO = 1 +CIRCUITPY_BUSDISPLAY = 0 +CIRCUITPY_FOURWIRE = 0 +CIRCUITPY_FLOAT_IMPL = double +CIRCUITPY_GIFIO = 1 +CIRCUITPY_I2CDISPLAYBUS = 0 +CIRCUITPY_EPAPERDISPLAY = 0 +CIRCUITPY_PARALLELDISPLAYBUS = 0 +CIRCUITPY_BLEIO_HCI = 0 +CIRCUITPY_COMMAND_LINE_WORKFLOW = 1 +CIRCUITPY_TOUCHIO = 0 +CIRCUITPY_KEYPAD = 0 +CIRCUITPY_SDCARDIO = 0 +CIRCUITPY_COUNTIO = 0 +CIRCUITPY_DIGITALIO = 0 +CIRCUITPY_FREQUENCYIO = 0 +CIRCUITPY_FRAMEBUFFERIO = 0 +CIRCUITPY_I2CTARGET = 0 +CIRCUITPY_MICROCONTROLLER = 0 +CIRCUITPY_NEOPIXEL_WRITE = 0 +CIRCUITPY_NVM = 0 +CIRCUITPY_PULSEIO = 0 +CIRCUITPY_PWMIO = 0 +CIRCUITPY_QRIO = 1 +CIRCUITPY_ROTARYIO = 0 +CIRCUITPY_RTC = 1 +CIRCUITPY_SYNTHIO = 1 +CIRCUITPY_STATUS_BAR = 0 +CIRCUITPY_USB = 0 +INTERNAL_FLASH_FILESYSTEM = 1 +LONGINT_IMPL = MPZ +USB_NUM_ENDPOINT_PAIRS = 0 +CIRCUITPY_SYNTHIO_MAX_CHANNELS = 14 diff --git a/ports/posix/mphalport.h b/ports/posix/mphalport.h new file mode 100644 index 0000000000000..ddc989f4d608c --- /dev/null +++ b/ports/posix/mphalport.h @@ -0,0 +1,29 @@ +#pragma once +#include "supervisor/shared/tick.h" +void mp_hal_set_interrupt_char(int c); +#define mp_hal_ticks_ms() ((mp_uint_t)supervisor_ticks_ms32()) + +#ifndef CHAR_CTRL_C +#define CHAR_CTRL_C (3) +#endif + +void mp_hal_stdio_mode_raw(void); +void mp_hal_stdio_mode_orig(void); + +// This macro is used to implement PEP 475 to retry specified syscalls on EINTR +#define MP_HAL_RETRY_SYSCALL(ret, syscall, raise) { \ + for (;;) { \ + MP_THREAD_GIL_EXIT(); \ + ret = syscall; \ + MP_THREAD_GIL_ENTER(); \ + if (ret == -1) { \ + int err = errno; \ + if (err == EINTR) { \ + mp_handle_pending(true); \ + continue; \ + } \ + raise; \ + } \ + break; \ + } \ +} diff --git a/ports/posix/qstrdefsport.h b/ports/posix/qstrdefsport.h new file mode 100644 index 0000000000000..e69de29bb2d1d diff --git a/ports/posix/supervisor/Runtime.h b/ports/posix/supervisor/Runtime.h new file mode 100755 index 0000000000000..f3d76d1b68002 --- /dev/null +++ b/ports/posix/supervisor/Runtime.h @@ -0,0 +1,37 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2018 Michael Schroeder + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#ifndef MICROPY_INCLUDED_ATMEL_SAMD_COMMON_HAL_SUPERVISOR_RUNTIME_H +#define MICROPY_INCLUDED_ATMEL_SAMD_COMMON_HAL_SUPERVISOR_RUNTIME_H + +#include "py/obj.h" + +typedef struct { + mp_obj_base_t base; + // Stores no state currently. +} super_runtime_obj_t; + +#endif // MICROPY_INCLUDED_ATMEL_SAMD_COMMON_HAL_SUPERVISOR_RUNTIME_H diff --git a/ports/posix/supervisor/internal_flash.c b/ports/posix/supervisor/internal_flash.c new file mode 100644 index 0000000000000..e69de29bb2d1d diff --git a/ports/posix/supervisor/internal_flash.h b/ports/posix/supervisor/internal_flash.h new file mode 100644 index 0000000000000..e69de29bb2d1d diff --git a/ports/posix/supervisor/port.c b/ports/posix/supervisor/port.c new file mode 100644 index 0000000000000..5d982d1e2911b --- /dev/null +++ b/ports/posix/supervisor/port.c @@ -0,0 +1,254 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "common-hal/supervisor/Runtime.h" +#include "py/runtime.h" +#include "shared-bindings/microcontroller/__init__.h" +#include "shared-bindings/microcontroller/Processor.h" +#include "shared-bindings/microcontroller/ResetReason.h" +#if CIRCUITPY_RTC +#include "shared-bindings/rtc/__init__.h" +#endif +#include "shared-bindings/supervisor/Runtime.h" +#include "shared/runtime/interrupt_char.h" +#include "supervisor/flash.h" +#include "supervisor/port.h" +#include "supervisor/serial.h" +#include "mphalport.h" +#include "main.h" + +static struct termios orig_termios; + +void mp_hal_stdio_mode_raw(void) { + // save and set terminal settings + tcgetattr(0, &orig_termios); + static struct termios termios; + termios = orig_termios; + termios.c_iflag &= ~(BRKINT | ICRNL | INPCK | ISTRIP | IXON); + termios.c_cflag = (termios.c_cflag & ~(CSIZE | PARENB)) | CS8; + termios.c_lflag = 0; + termios.c_cc[VMIN] = 1; + termios.c_cc[VTIME] = 0; + tcsetattr(0, TCSAFLUSH, &termios); +} + +void mp_hal_stdio_mode_orig(void) { + // restore terminal settings + tcsetattr(0, TCSAFLUSH, &orig_termios); +} + + +uint64_t port_get_raw_ticks(uint8_t *subticks_out) { + struct timespec ts; + clock_gettime(CLOCK_MONOTONIC, &ts); + uint64_t subticks = ((uint64_t)ts.tv_nsec * 140737) >> 32; + int result = ts.tv_sec * 1024 + subticks / 32; + if (subticks_out) { + *subticks_out = subticks % 32; + } + return result; +} + + +void common_hal_mcu_disable_interrupts(void) { +} +void common_hal_mcu_enable_interrupts(void) { +} + +static uint32_t *_stack_top, *_stack_limit; +#if defined(__has_include) && __has_include() +#include +int pthread_getattr_np(pthread_t thread, pthread_attr_t *attr); +safe_mode_t port_init(void) { + pthread_attr_t attr; + pthread_getattr_np(pthread_self(), &attr); + void *stackaddr; + size_t stacksize; + pthread_attr_getstack(&attr, &stackaddr, &stacksize); + // Define a reasonable stack limit to detect stack overflow. + _stack_top = (uint32_t *)((char *)stackaddr + stacksize); + _stack_limit = MAX((uint32_t *)stackaddr, _stack_top - 40000 * sizeof(void *) / sizeof(int)); + pthread_attr_destroy(&attr); + return SAFE_MODE_NONE; +} +#else +safe_mode_t port_init(void) { + intptr_t pagesize = (intptr_t)sysconf(_SC_PAGESIZE); + _stack_top = (uint32_t *)(((intptr_t)address_of_argc + pagesize - 1) & ~(pagesize - 1)); + struct rlimit lim; + getrlimit(RLIMIT_STACK, &lim); + // Define a reasonable stack limit to detect stack overflow. + mp_uint_t stack_limit = MIN(lim.rlim_cur, 40000 * (sizeof(void *) / 4)); + _stack_limit = _stack_top - stack_limit; + return SAFE_MODE_NONE; +} +#endif + +uint32_t *port_stack_get_limit(void) { + return _stack_limit; +} +uint32_t *port_stack_get_top(void) { + return _stack_top; +} + +void reset_port(void) { + #if CIRCUITPY_RTC + rtc_reset(); + #endif +} +void port_idle_until_interrupt(void) { +} +void port_background_task(void) { +} + + +static void *flash_ptr; +void supervisor_flash_init(void) { + int ffd = open("CIRCUITPY.IMG", O_RDWR | O_CREAT, 0666 /* minus bits in umask */); + size_t flash_size = supervisor_flash_get_block_size() * supervisor_flash_get_block_count(); + posix_fallocate(ffd, 0, flash_size); + flash_ptr = mmap(NULL, flash_size, PROT_READ | PROT_WRITE, MAP_SHARED, ffd, 0); +} +uint32_t supervisor_flash_get_block_size(void) { + return 512; +} +uint32_t supervisor_flash_get_block_count(void) { + return 1024; +} +mp_uint_t supervisor_flash_read_blocks(uint8_t *dest, uint32_t block_num, uint32_t num_blocks) { + if (!flash_ptr) { + return 1; /* error */ + } + if (block_num >= supervisor_flash_get_block_count()) { + return 1; /* error */ + } + memcpy(dest, flash_ptr + block_num * supervisor_flash_get_block_size(), supervisor_flash_get_block_size() * num_blocks); + return 0; +} +mp_uint_t supervisor_flash_write_blocks(const uint8_t *src, uint32_t block_num, uint32_t num_blocks) { + if (!flash_ptr) { + return 1; /* error */ + } + if (block_num >= supervisor_flash_get_block_count()) { + return 1; /* error */ + } + memcpy(flash_ptr + block_num * supervisor_flash_get_block_size(), src, supervisor_flash_get_block_size() * num_blocks); + return 0; +} + + +void port_internal_flash_flush(void) { + size_t flash_size = supervisor_flash_get_block_size() * supervisor_flash_get_block_count(); + if (flash_ptr) { + msync(flash_ptr, flash_size, MS_ASYNC | MS_INVALIDATE); + } +} + +void supervisor_flash_release_cache(void) { +} + + +mcu_reset_reason_t common_hal_mcu_processor_get_reset_reason(void) { + return RESET_REASON_UNKNOWN; +} + +uint32_t safe_word; +void port_set_saved_word(uint32_t value) { + safe_word = value; +} + +uint32_t port_get_saved_word(void) { + return safe_word; +} + +void reset_cpu(void) { + exit(0); +} + +void port_start_background_tick(void) { +} +void port_finish_background_tick(void) { +} +void port_interrupt_after_ticks(uint32_t ticks) { +} +void port_enable_tick(void) { +} +void port_disable_tick(void) { +} + +STATIC const mp_rom_map_elem_t board_module_globals_table[] = { + { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_board) }, +}; +MP_DEFINE_CONST_DICT(board_module_globals, board_module_globals_table); + +bool common_hal_supervisor_runtime_get_serial_connected(void) { + return true; +} +bool common_hal_supervisor_runtime_get_serial_bytes_available(void) { + fd_set f; + struct timeval no_timeout = {0, 0}; + FD_ZERO(&f); + FD_SET(0, &f); + int result = select(1, &f, NULL, NULL, &no_timeout); + return result > 0; +} + +const super_runtime_obj_t common_hal_supervisor_runtime_obj = { + .base = { + .type = &supervisor_runtime_type, + }, +}; + +void common_hal_mcu_reset(void) { + exit(0); +} + +static uint32_t mp_heap[1024 * 1024]; + +// Get heap bottom address +uint32_t *port_heap_get_bottom(void) { + return &mp_heap[0]; +} + +// Get heap top address +uint32_t *port_heap_get_top(void) { + return &mp_heap[MP_ARRAY_SIZE(mp_heap)]; +} + +void port_background_tick(void) { +} + +void port_serial_write_substring(const char *text, uint32_t length) { + write(1, text, length); +} + +bool port_serial_bytes_available(void) { + return common_hal_supervisor_runtime_get_serial_bytes_available(); +} + +int port_serial_read(void) { + if (!common_hal_supervisor_runtime_get_serial_bytes_available()) { + return EOF; + } + unsigned char c; + int ret = read(0, &c, 1); + if (ret == 0) { + c = 4; // EOF, ctrl-D + } else if (c == '\x1c' && isatty(0)) { + raise(SIGQUIT); + } else if (c == '\n') { + c = '\r'; + } + + return (int)c; +} +bool port_serial_connected(void) { + return true; +} diff --git a/ports/silabs/supervisor/serial.c b/ports/silabs/supervisor/serial.c index 62dc9899d8443..d2109361ff2db 100644 --- a/ports/silabs/supervisor/serial.c +++ b/ports/silabs/supervisor/serial.c @@ -128,7 +128,7 @@ bool port_serial_connected(void) { } // Get a characters from ring buffer -char port_serial_read(void) { +int port_serial_read(void) { int data; CORE_DECLARE_IRQ_STATE; diff --git a/ports/stm/supervisor/serial.c b/ports/stm/supervisor/serial.c index 10196fbc31185..b1b5b2a5b42c0 100644 --- a/ports/stm/supervisor/serial.c +++ b/ports/stm/supervisor/serial.c @@ -56,7 +56,7 @@ bool port_serial_connected(void) { return true; } -char port_serial_read(void) { +int port_serial_read(void) { #if CPY_STM32F4 uint8_t data; HAL_UART_Receive(&huart2, &data, 1, 500); diff --git a/py/circuitpy_defns.mk b/py/circuitpy_defns.mk index b611d111c0f2f..0b9b46c63b7a3 100644 --- a/py/circuitpy_defns.mk +++ b/py/circuitpy_defns.mk @@ -28,7 +28,6 @@ # Common compile warnings. BASE_CFLAGS = \ - -fsingle-precision-constant \ -fno-strict-aliasing \ -Wdouble-promotion \ -Wimplicit-fallthrough=2 \ @@ -54,6 +53,12 @@ BASE_CFLAGS = \ -DCIRCUITPY_BOARD_ID="\"$(BOARD)\"" \ --param max-inline-insns-single=500 +ifeq ($(CIRCUITPY_FLOAT_IMPL),float) +BASE_CFLAGS += -fsingle-precision-constant -DMICROPY_FLOAT_IMPL=MICROPY_FLOAT_IMPL_FLOAT +else +BASE_CFLAGS += -fno-single-precision-constant -DMICROPY_FLOAT_IMPL=MICROPY_FLOAT_IMPL_DOUBLE +endif + # Use these flags to debug build times and header includes. # -ftime-report # -H @@ -752,7 +757,7 @@ SRC_MOD += $(addprefix lib/mp3/src/, \ subband.c \ trigtabs.c \ ) -$(BUILD)/lib/mp3/src/buffers.o: CFLAGS += -include "py/misc.h" -D'MPDEC_ALLOCATOR(x)=m_malloc(x)' -D'MPDEC_FREE(x)=m_free(x)' +$(BUILD)/lib/mp3/src/buffers.o: CFLAGS += -include "py/gc.h" -D'MPDEC_ALLOCATOR(x)=gc_alloc(x, 0)' -D'MPDEC_FREE(x)=gc_free(x)' endif ifeq ($(CIRCUITPY_GIFIO),1) diff --git a/py/circuitpy_mkenv.mk b/py/circuitpy_mkenv.mk index 7bdf943a14d04..4674fb4d339f8 100644 --- a/py/circuitpy_mkenv.mk +++ b/py/circuitpy_mkenv.mk @@ -24,16 +24,22 @@ # Common Makefile items that can be shared across CircuitPython ports. +CIRCUITPY_PORT_NO_BOARD ?= 0 + +ifeq ($(CIRCUITPY_PORT_NO_BOARD),0) ALL_BOARDS_IN_PORT := $(patsubst boards/%/mpconfigboard.mk,%,$(wildcard boards/*/mpconfigboard.mk)) # An incorrect BOARD might have been specified, so check against the list. # There is deliberately no space after the := VALID_BOARD :=$(filter $(BOARD),$(ALL_BOARDS_IN_PORT)) -# If the flash PORT is not given, use the default /dev/tty.SLAB_USBtoUART. -PORT ?= /dev/tty.SLAB_USBtoUART - # If the build directory is not given, make it reflect the board name. BUILD ?= build-$(BOARD) +else +BUILD ?= build +endif + +# If the flash PORT is not given, use the default /dev/tty.SLAB_USBtoUART. +PORT ?= /dev/tty.SLAB_USBtoUART # First makefile with targets. Defines the default target. include ../../py/mkenv.mk @@ -52,6 +58,12 @@ ifneq ($(VALID_BOARD),) include $(TOP)/py/circuitpy_mpconfig.mk endif +# Also include if the port does not use the board abstraction (POSIX port) +ifeq ($(CIRCUITPY_PORT_NO_BOARD),1) +# CircuitPython-specific +include $(TOP)/py/circuitpy_mpconfig.mk +endif + # qstr definitions (must come before including py.mk) QSTR_DEFS = qstrdefsport.h diff --git a/py/circuitpy_mpconfig.h b/py/circuitpy_mpconfig.h index 8fc707aca49ce..8e45a5648a679 100644 --- a/py/circuitpy_mpconfig.h +++ b/py/circuitpy_mpconfig.h @@ -70,16 +70,28 @@ extern void common_hal_mcu_enable_interrupts(void); // default is 128; consider raising to reduce fragmentation. #define MICROPY_ALLOC_PARSE_CHUNK_INIT (16) // default is 512. Longest path in .py bundle as of June 6th, 2023 is 73 characters. +#if CIRCUITPY_COMMAND_LINE_WORKFLOW +#define MICROPY_ALLOC_PATH_MAX (512) +#else #define MICROPY_ALLOC_PATH_MAX (96) +#endif #define MICROPY_CAN_OVERRIDE_BUILTINS (1) #define MICROPY_COMP_CONST (1) #define MICROPY_COMP_DOUBLE_TUPLE_ASSIGN (1) #define MICROPY_COMP_MODULE_CONST (1) +#if !defined(MICROPY_COMP_TRIPLE_TUPLE_ASSIGN) #define MICROPY_COMP_TRIPLE_TUPLE_ASSIGN (0) -#define MICROPY_DEBUG_PRINTERS (0) +#endif +#define MICROPY_DEBUG_PRINTERS (CIRCUITPY_COMMAND_LINE_WORKFLOW) +#if !defined(MICROPY_EMIT_INLINE_THUMB) #define MICROPY_EMIT_INLINE_THUMB (CIRCUITPY_ENABLE_MPY_NATIVE) +#endif +#if !defined(MICROPY_EMIT_THUMB) #define MICROPY_EMIT_THUMB (CIRCUITPY_ENABLE_MPY_NATIVE) +#endif +#if !defined(MICROPY_EMIT_X64) #define MICROPY_EMIT_X64 (0) +#endif #define MICROPY_ENABLE_DOC_STRING (0) #define MICROPY_ENABLE_FINALISER (1) #define MICROPY_ENABLE_GC (1) @@ -89,17 +101,18 @@ extern void common_hal_mcu_enable_interrupts(void); #define MICROPY_EPOCH_IS_1970 (1) #define MICROPY_ERROR_REPORTING (MICROPY_ERROR_REPORTING_NORMAL) #define MICROPY_FLOAT_HIGH_QUALITY_HASH (0) -#define MICROPY_FLOAT_IMPL (MICROPY_FLOAT_IMPL_FLOAT) #define MICROPY_GC_ALLOC_THRESHOLD (0) #define MICROPY_GC_SPLIT_HEAP (1) #define MICROPY_GC_SPLIT_HEAP_AUTO (1) #define MP_PLAT_ALLOC_HEAP(size) port_malloc(size, false) #define MP_PLAT_FREE_HEAP(ptr) port_free(ptr) #include "supervisor/port_heap.h" -#define MICROPY_HELPER_LEXER_UNIX (0) +#define MICROPY_HELPER_LEXER_UNIX (CIRCUITPY_COMMAND_LINE_WORKFLOW) #define MICROPY_HELPER_REPL (1) #define MICROPY_KBD_EXCEPTION (1) +#if !defined(MICROPY_MEM_STATS) #define MICROPY_MEM_STATS (0) +#endif #define MICROPY_MODULE_BUILTIN_INIT (1) #define MICROPY_MODULE_BUILTIN_SUBPACKAGES (1) #define MICROPY_NONSTANDARD_TYPECODES (0) @@ -147,7 +160,9 @@ extern void common_hal_mcu_enable_interrupts(void); // In extmod #define MICROPY_PY_JSON (CIRCUITPY_JSON) #define MICROPY_PY_MATH (0) +#if !defined(MICROPY_PY_MICROPYTHON_MEM_INFO) #define MICROPY_PY_MICROPYTHON_MEM_INFO (0) +#endif // Supplanted by shared-bindings/random #define MICROPY_PY_RANDOM (0) #define MICROPY_PY_RANDOM_EXTRA_FUNCS (0) @@ -187,8 +202,11 @@ extern void common_hal_mcu_enable_interrupts(void); #define FILESYSTEM_BLOCK_SIZE (512) #define MICROPY_VFS (1) -#define MICROPY_VFS_FAT (MICROPY_VFS) -#define MICROPY_READER_VFS (MICROPY_VFS) +#define MICROPY_READER_VFS (1) +#define MICROPY_VFS_POSIX (CIRCUITPY_COMMAND_LINE_WORKFLOW) +#define MICROPY_VFS_FAT (1) +#define MICROPY_READER_POSIX (MICROPY_VFS_POSIX) +#define MICROPY_USE_READLINE_HISTORY (CIRCUITPY_COMMAND_LINE_WORKFLOW) // type definitions for the specific machine @@ -233,7 +251,9 @@ typedef long mp_off_t; ////////////////////////////////////////////////////////////////////////////////////////////////// // board-specific definitions, which control and may override definitions below. +#if !CIRCUITPY_PORT_NO_BOARD #include "mpconfigboard.h" +#endif // Turning off FULL_BUILD removes some functionality to reduce flash size on tiny SAMD21s #define MICROPY_BUILTIN_METHOD_CHECK_SELF_ARG (CIRCUITPY_FULL_BUILD) @@ -264,7 +284,7 @@ typedef long mp_off_t; #define MICROPY_PY_RE_MATCH_SPAN_START_END (CIRCUITPY_RE) #define MICROPY_PY_RE_SUB (CIRCUITPY_RE) -#define CIRCUITPY_MICROPYTHON_ADVANCED (0) +#define CIRCUITPY_MICROPYTHON_ADVANCED (CIRCUITPY_COMMAND_LINE_WORKFLOW) #ifndef MICROPY_FATFS_EXFAT #define MICROPY_FATFS_EXFAT (CIRCUITPY_FULL_BUILD) diff --git a/py/circuitpy_mpconfig.mk b/py/circuitpy_mpconfig.mk index 06095d47cb3e8..5ffd056338a96 100644 --- a/py/circuitpy_mpconfig.mk +++ b/py/circuitpy_mpconfig.mk @@ -198,6 +198,9 @@ CFLAGS += -DCIRCUITPY_CODEOP=$(CIRCUITPY_CODEOP) CIRCUITPY_COLLECTIONS ?= 1 CFLAGS += -DCIRCUITPY_COLLECTIONS=$(CIRCUITPY_COLLECTIONS) +CIRCUITPY_COMMAND_LINE_WORKFLOW ?= 0 +CFLAGS += -DCIRCUITPY_COMMAND_LINE_WORKFLOW=$(CIRCUITPY_COMMAND_LINE_WORKFLOW) + CIRCUITPY_COMPUTED_GOTO_SAVE_SPACE ?= 0 CFLAGS += -DCIRCUITPY_COMPUTED_GOTO_SAVE_SPACE=$(CIRCUITPY_COMPUTED_GOTO_SAVE_SPACE) @@ -400,6 +403,9 @@ CFLAGS += -DCIRCUITPY_PIXELBUF=$(CIRCUITPY_PIXELBUF) CIRCUITPY_PIXELMAP ?= $(CIRCUITPY_PIXELBUF) CFLAGS += -DCIRCUITPY_PIXELMAP=$(CIRCUITPY_PIXELMAP) +CIRCUITPY_PORT_NO_BOARD ?= $(CIRCUITPY_PIXELBUF) +CFLAGS += -DCIRCUITPY_PORT_NO_BOARD=$(CIRCUITPY_PORT_NO_BOARD) + # Only for SAMD boards for the moment CIRCUITPY_PS2IO ?= 0 CFLAGS += -DCIRCUITPY_PS2IO=$(CIRCUITPY_PS2IO) @@ -594,7 +600,7 @@ CIRCUITPY_USB_VENDOR ?= 0 CFLAGS += -DCIRCUITPY_USB_VENDOR=$(CIRCUITPY_USB_VENDOR) ifndef USB_NUM_ENDPOINT_PAIRS -$(error "USB_NUM_ENDPOINT_PAIRS (number of USB endpoint pairs)must be defined") +$(error "USB_NUM_ENDPOINT_PAIRS (number of USB endpoint pairs) must be defined") endif CFLAGS += -DUSB_NUM_ENDPOINT_PAIRS=$(USB_NUM_ENDPOINT_PAIRS) @@ -675,6 +681,8 @@ else $(error LONGINT_IMPL set to surprising value: "$(LONGINT_IMPL)") endif +CIRCUITPY_FLOAT_IMPL ?= float + PREPROCESS_FROZEN_MODULES = PYTHONPATH=$(TOP)/tools/python-semver $(TOP)/tools/preprocess_frozen_modules.py ifneq ($(FROZEN_MPY_DIRS),) $(BUILD)/frozen_mpy: $(FROZEN_MPY_DIRS) diff --git a/py/compile.c b/py/compile.c index 4752d508c8b76..945ec573292d1 100644 --- a/py/compile.c +++ b/py/compile.c @@ -370,6 +370,7 @@ STATIC void compile_delete_id(compiler_t *comp, qstr qst) { #if NEED_METHOD_TABLE mp_emit_common_id_op(comp->emit, &comp->emit_method_table->delete_id, comp->scope_cur, qst); #else + #error !NEED_METHOD_TABLE mp_emit_common_id_op(comp->emit, &mp_emit_bc_method_table_delete_id_ops, comp->scope_cur, qst); #endif } diff --git a/py/formatfloat.c b/py/formatfloat.c index 7cd471018da98..a2855b8afc3c1 100644 --- a/py/formatfloat.c +++ b/py/formatfloat.c @@ -80,6 +80,7 @@ static inline int fp_isless1(float x) { #elif MICROPY_FLOAT_IMPL == MICROPY_FLOAT_IMPL_DOUBLE +#pragma GCC diagnostic ignored "-Wfloat-equal" #define FPTYPE double #define FPCONST(x) x #define FPROUND_TO_ONE 0.999999999995 diff --git a/shared-bindings/adafruit_pixelbuf/PixelBuf.c b/shared-bindings/adafruit_pixelbuf/PixelBuf.c index 44eebb5c2207f..fc00026dc7846 100644 --- a/shared-bindings/adafruit_pixelbuf/PixelBuf.c +++ b/shared-bindings/adafruit_pixelbuf/PixelBuf.c @@ -38,7 +38,6 @@ #include "shared-bindings/adafruit_pixelbuf/PixelBuf.h" #include "shared-module/adafruit_pixelbuf/PixelBuf.h" -#include "shared-bindings/digitalio/DigitalInOut.h" #if CIRCUITPY_ULAB #include "extmod/ulab/code/ndarray.h" diff --git a/shared-bindings/math/__init__.c b/shared-bindings/math/__init__.c index 93af53769d65d..89084afb80e71 100644 --- a/shared-bindings/math/__init__.c +++ b/shared-bindings/math/__init__.c @@ -49,14 +49,31 @@ STATIC NORETURN void math_error(void) { mp_raise_ValueError(MP_ERROR_TEXT("math domain error")); } +STATIC mp_obj_t math_generic_1(mp_obj_t x_obj, mp_float_t (*f)(mp_float_t)) { + mp_float_t x = mp_obj_get_float(x_obj); + mp_float_t ans = f(x); + if ((isnan(ans) && !isnan(x)) || (isinf(ans) && !isinf(x))) { + math_error(); + } + return mp_obj_new_float(ans); +} + +STATIC mp_obj_t math_generic_2(mp_obj_t x_obj, mp_obj_t y_obj, mp_float_t (*f)(mp_float_t, mp_float_t)) { + mp_float_t x = mp_obj_get_float(x_obj); + mp_float_t y = mp_obj_get_float(y_obj); + mp_float_t ans = f(x, y); + if ((isnan(ans) && !isnan(x) && !isnan(y)) || (isinf(ans) && !isinf(x) && !isinf(y))) { + math_error(); + } + return mp_obj_new_float(ans); +} + #define MATH_FUN_1(py_name, c_name) \ - STATIC mp_obj_t mp_math_##py_name(mp_obj_t x_obj) { return mp_obj_new_float(MICROPY_FLOAT_C_FUN(c_name)(mp_obj_get_float(x_obj))); } \ + STATIC mp_obj_t mp_math_##py_name(mp_obj_t x_obj) { \ + return math_generic_1(x_obj, MICROPY_FLOAT_C_FUN(c_name)); \ + } \ STATIC MP_DEFINE_CONST_FUN_OBJ_1(mp_math_##py_name##_obj, mp_math_##py_name); -#define MATH_FUN_2(py_name, c_name) \ - STATIC mp_obj_t mp_math_##py_name(mp_obj_t x_obj, mp_obj_t y_obj) { return mp_obj_new_float(MICROPY_FLOAT_C_FUN(c_name)(mp_obj_get_float(x_obj), mp_obj_get_float(y_obj))); } \ - STATIC MP_DEFINE_CONST_FUN_OBJ_2(mp_math_##py_name##_obj, mp_math_##py_name); - #define MATH_FUN_1_TO_BOOL(py_name, c_name) \ STATIC mp_obj_t mp_math_##py_name(mp_obj_t x_obj) { return mp_obj_new_bool(c_name(mp_obj_get_float(x_obj))); } \ STATIC MP_DEFINE_CONST_FUN_OBJ_1(mp_math_##py_name##_obj, mp_math_##py_name); @@ -65,15 +82,17 @@ STATIC NORETURN void math_error(void) { STATIC mp_obj_t mp_math_##py_name(mp_obj_t x_obj) { return mp_obj_new_int_from_float(MICROPY_FLOAT_C_FUN(c_name)(mp_obj_get_float(x_obj))); } \ STATIC MP_DEFINE_CONST_FUN_OBJ_1(mp_math_##py_name##_obj, mp_math_##py_name); -#define MATH_FUN_1_ERRCOND(py_name, c_name, error_condition) \ - STATIC mp_obj_t mp_math_##py_name(mp_obj_t x_obj) { \ - mp_float_t x = mp_obj_get_float(x_obj); \ - if (error_condition) { \ - math_error(); \ - } \ - return mp_obj_new_float(MICROPY_FLOAT_C_FUN(c_name)(x)); \ +#define MATH_FUN_2(py_name, c_name) \ + STATIC mp_obj_t mp_math_##py_name(mp_obj_t x_obj, mp_obj_t y_obj) { \ + return math_generic_2(x_obj, y_obj, MICROPY_FLOAT_C_FUN(c_name)); \ } \ - STATIC MP_DEFINE_CONST_FUN_OBJ_1(mp_math_##py_name##_obj, mp_math_##py_name); + STATIC MP_DEFINE_CONST_FUN_OBJ_2(mp_math_##py_name##_obj, mp_math_##py_name); + +#define MATH_FUN_2_FLT_INT(py_name, c_name) \ + STATIC mp_obj_t mp_math_##py_name(mp_obj_t x_obj, mp_obj_t y_obj) { \ + return mp_obj_new_float(MICROPY_FLOAT_C_FUN(c_name)(mp_obj_get_float(x_obj), mp_obj_get_int(y_obj))); \ + } \ + STATIC MP_DEFINE_CONST_FUN_OBJ_2(mp_math_##py_name##_obj, mp_math_##py_name); #ifdef MP_NEED_LOG2 // 1.442695040888963407354163704 is 1/_M_LN2 @@ -154,7 +173,7 @@ STATIC NORETURN void math_error(void) { //| """Return ``True`` if ``x`` is not-a-number""" //| ... //| -//| def ldexp(x: float, exp: float) -> float: +//| def ldexp(x: float, exp: int) -> float: //| """Return ``x * (2**exp)``.""" //| ... //| @@ -190,9 +209,22 @@ STATIC NORETURN void math_error(void) { //| """Return an integer, being ``x`` rounded towards 0.""" //| ... //| -MATH_FUN_1_ERRCOND(sqrt, sqrt, (x < (mp_float_t)0.0)) +MATH_FUN_1(sqrt, sqrt) +// pow(x, y): returns x to the power of y +#if MICROPY_PY_MATH_POW_FIX_NAN +mp_float_t pow_func(mp_float_t x, mp_float_t y) { + // pow(base, 0) returns 1 for any base, even when base is NaN + // pow(+1, exponent) returns 1 for any exponent, even when exponent is NaN + if (x == MICROPY_FLOAT_CONST(1.0) || y == MICROPY_FLOAT_CONST(0.0)) { + return MICROPY_FLOAT_CONST(1.0); + } + return MICROPY_FLOAT_C_FUN(pow)(x, y); +} +MATH_FUN_2(pow, pow_func) +#else MATH_FUN_2(pow, pow) +#endif MATH_FUN_1(exp, exp) #if MICROPY_PY_MATH_SPECIAL_FUNCTIONS @@ -290,17 +322,40 @@ MATH_FUN_1(asin, asin) MATH_FUN_1(atan, atan) +// atan2(y, x) +#if MICROPY_PY_MATH_ATAN2_FIX_INFNAN +mp_float_t atan2_func(mp_float_t x, mp_float_t y) { + if (isinf(x) && isinf(y)) { + return copysign(y < 0 ? MP_3_PI_4 : MP_PI_4, x); + } + return atan2(x, y); +} +MATH_FUN_2(atan2, atan2_func) +#else MATH_FUN_2(atan2, atan2) +#endif MATH_FUN_1_TO_INT(ceil, ceil) -MATH_FUN_2(copysign, copysign) +// copysign(x, y) +STATIC mp_float_t MICROPY_FLOAT_C_FUN(copysign_func)(mp_float_t x, mp_float_t y) { + return MICROPY_FLOAT_C_FUN(copysign)(x, y); +} +MATH_FUN_2(copysign, copysign_func) MATH_FUN_1(fabs, fabs) MATH_FUN_1_TO_INT(floor, floor) // TODO: delegate to x.__floor__() if x is not a float +// fmod(x, y) +#if MICROPY_PY_MATH_FMOD_FIX_INFNAN +mp_float_t fmod_func(mp_float_t x, mp_float_t y) { + return (!isinf(x) && isinf(y)) ? x : fmod(x, y); +} +MATH_FUN_2(fmod, fmod_func) +#else MATH_FUN_2(fmod, fmod) +#endif MATH_FUN_1_TO_BOOL(isfinite, isfinite) @@ -310,7 +365,7 @@ MATH_FUN_1_TO_BOOL(isnan, isnan) MATH_FUN_1_TO_INT(trunc, trunc) -MATH_FUN_2(ldexp, ldexp) +MATH_FUN_2_FLT_INT(ldexp, ldexp) #if MICROPY_PY_MATH_SPECIAL_FUNCTIONS //| def erf(x: float) -> float: @@ -349,7 +404,7 @@ MATH_FUN_1(gamma, tgamma) //| MATH_FUN_1(lgamma, lgamma) #endif -// TODO: factorial, fsum +// TODO: factorial, fsum, isclose // Function that takes a variable number of arguments @@ -371,7 +426,7 @@ STATIC mp_obj_t mp_math_log(size_t n_args, const mp_obj_t *args) { #pragma GCC diagnostic ignored "-Wfloat-equal" } else if (base == (mp_float_t)1.0) { #pragma GCC diagnostic pop - math_error(); + mp_raise_ZeroDivisionError(); } return mp_obj_new_float(l / MICROPY_FLOAT_C_FUN(log)(base)); } diff --git a/shared-bindings/os/__init__.c b/shared-bindings/os/__init__.c index 717d4e92de63a..e2aaef34e4cd7 100644 --- a/shared-bindings/os/__init__.c +++ b/shared-bindings/os/__init__.c @@ -126,6 +126,28 @@ STATIC mp_obj_t os_getenv(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_ } STATIC MP_DEFINE_CONST_FUN_OBJ_KW(os_getenv_obj, 1, os_getenv); +#if CIRCUITPY_COMMAND_LINE_WORKFLOW +#include "shared-module/os/__init__.h" +STATIC mp_obj_t os_getenv_int(mp_obj_t var_in) { + mp_int_t value; + os_getenv_err_t result = common_hal_os_getenv_int(mp_obj_str_get_str(var_in), &value); + if (result == 0) { + return mp_obj_new_int(value); + } + return mp_const_none; +} +STATIC MP_DEFINE_CONST_FUN_OBJ_1(os_getenv_int_obj, os_getenv_int); +STATIC mp_obj_t mod_os_getenv_str(mp_obj_t var_in) { + char buf[4096]; + os_getenv_err_t result = common_hal_os_getenv_str(mp_obj_str_get_str(var_in), buf, sizeof(buf)); + if (result == 0) { + return mp_obj_new_str_copy(&mp_type_str, (byte *)buf, strlen(buf)); + } + return mp_const_none; +} +MP_DEFINE_CONST_FUN_OBJ_1(os_getenv_str_obj, mod_os_getenv_str); +#endif + //| def listdir(dir: str) -> str: //| """With no argument, list the current directory. Otherwise list the given directory.""" //| ... @@ -306,6 +328,10 @@ STATIC const mp_rom_map_elem_t os_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR_urandom), MP_ROM_PTR(&os_urandom_obj) }, + #if CIRCUITPY_COMMAND_LINE_WORKFLOW + { MP_ROM_QSTR(MP_QSTR_getenv_int), MP_ROM_PTR(&os_getenv_int_obj) }, + { MP_ROM_QSTR(MP_QSTR_getenv_str), MP_ROM_PTR(&os_getenv_str_obj) }, + #endif //| sep: str //| """Separator used to delineate path components such as folder and file names.""" { MP_ROM_QSTR(MP_QSTR_sep), MP_ROM_QSTR(MP_QSTR__slash_) }, @@ -318,4 +344,4 @@ const mp_obj_module_t os_module = { .globals = (mp_obj_dict_t *)&os_module_globals, }; -MP_REGISTER_MODULE(MP_QSTR_os, os_module); +MP_REGISTER_EXTENSIBLE_MODULE(MP_QSTR_os, os_module); diff --git a/shared-bindings/random/__init__.c b/shared-bindings/random/__init__.c index 92cd775fb7402..ce478e98a8d24 100644 --- a/shared-bindings/random/__init__.c +++ b/shared-bindings/random/__init__.c @@ -31,6 +31,7 @@ #include "py/obj.h" #include "py/runtime.h" #include "shared-bindings/random/__init__.h" +#include "shared-bindings/os/__init__.h" //| """pseudo-random numbers and choices //| @@ -53,20 +54,27 @@ //| `random` will return deterministic results afterwards.""" //| ... //| -STATIC mp_obj_t random_seed(mp_obj_t seed_in) { - mp_uint_t seed = mp_obj_get_int_truncated(seed_in); +STATIC mp_obj_t random_seed(size_t n_args, const mp_obj_t *args) { + mp_uint_t seed; + if (n_args == 0 || args[0] == mp_const_none) { + if (!common_hal_os_urandom((uint8_t *)&seed, sizeof(seed))) { + mp_raise_NotImplementedError(MP_ERROR_TEXT("No hardware random available")); + } + } else { + seed = mp_obj_get_int_truncated(args[0]); + } shared_modules_random_seed(seed); return mp_const_none; } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(random_seed_obj, random_seed); +STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(random_seed_obj, 0, 1, random_seed); //| def getrandbits(k: int) -> int: //| """Returns an integer with *k* random bits.""" //| ... //| STATIC mp_obj_t random_getrandbits(mp_obj_t num_in) { - int n = mp_obj_get_int(num_in); - if (n > 32 || n == 0) { + mp_int_t n = mp_obj_get_int(num_in); + if (n > 32 || n < 0) { mp_raise_ValueError(NULL); } return mp_obj_new_int_from_uint(shared_modules_random_getrandbits((uint8_t)n)); diff --git a/shared-bindings/time/__init__.c b/shared-bindings/time/__init__.c index 0c78d55d6ed62..406555c5e500e 100644 --- a/shared-bindings/time/__init__.c +++ b/shared-bindings/time/__init__.c @@ -65,7 +65,7 @@ //| STATIC mp_obj_t time_monotonic(void) { uint64_t ticks_ms = common_hal_time_monotonic_ms(); - return mp_obj_new_float(uint64_to_float(ticks_ms) / 1000.0f); + return mp_obj_new_float(uint64_to_float(ticks_ms) / MICROPY_FLOAT_CONST(1000.0)); } MP_DEFINE_CONST_FUN_OBJ_0(time_monotonic_obj, time_monotonic); @@ -78,7 +78,7 @@ MP_DEFINE_CONST_FUN_OBJ_0(time_monotonic_obj, time_monotonic); STATIC mp_obj_t time_sleep(mp_obj_t seconds_o) { #if MICROPY_PY_BUILTINS_FLOAT mp_float_t seconds = mp_obj_get_float(seconds_o); - mp_float_t msecs = 1000.0f * seconds + 0.5f; + mp_float_t msecs = MICROPY_FLOAT_CONST(1000.0) * seconds + MICROPY_FLOAT_CONST(0.5); #else mp_int_t seconds = mp_obj_get_int(seconds_o); mp_int_t msecs = 1000 * seconds; @@ -246,13 +246,9 @@ STATIC mp_obj_t time_localtime(size_t n_args, const mp_obj_t *args) { mp_int_t secs = mp_obj_get_int(arg); - #if MICROPY_EPOCH_IS_1970 - if (secs < 0 || (mp_uint_t)secs < TIMEUTILS_SECONDS_1970_TO_2000) { - #else - if (secs < 0) { - #endif - mp_raise_msg(&mp_type_OverflowError, MP_ERROR_TEXT("timestamp out of range for platform time_t")); - } + // CIRCUITPY-CHANGE + mp_int_t min_secs = MICROPY_EPOCH_IS_1970 ? 0 : TIMEUTILS_SECONDS_1970_TO_2000; + mp_arg_validate_int_min(secs, min_secs, MP_QSTR_secs); timeutils_struct_time_t tm; timeutils_seconds_since_epoch_to_struct_time(secs, &tm); @@ -284,9 +280,7 @@ STATIC mp_obj_t time_mktime(mp_obj_t t) { mp_raise_TypeError_varg(MP_ERROR_TEXT("function takes %d positional arguments but %d were given"), 9, len); } - if (mp_obj_get_int(elem[0]) < 2000) { - mp_raise_msg_varg(&mp_type_OverflowError, MP_ERROR_TEXT("%q out of range"), MP_QSTR_tm_year); - } + mp_arg_validate_int_range(mp_obj_get_int(elem[0]), 1970, 2037, MP_QSTR_tm_year); mp_uint_t secs = timeutils_mktime(mp_obj_get_int(elem[0]), mp_obj_get_int(elem[1]), mp_obj_get_int(elem[2]), mp_obj_get_int(elem[3]), mp_obj_get_int(elem[4]), mp_obj_get_int(elem[5])); @@ -327,4 +321,4 @@ const mp_obj_module_t time_module = { .globals = (mp_obj_dict_t *)&time_module_globals, }; -MP_REGISTER_MODULE(MP_QSTR_time, time_module); +MP_REGISTER_EXTENSIBLE_MODULE(MP_QSTR_time, time_module); diff --git a/shared-module/atexit/__init__.c b/shared-module/atexit/__init__.c index 640bfe0173f7f..088759316005e 100644 --- a/shared-module/atexit/__init__.c +++ b/shared-module/atexit/__init__.c @@ -33,7 +33,7 @@ static atexit_callback_t *callback = NULL; void atexit_reset(void) { callback_len = 0; - m_free(callback); + gc_free(callback); callback = NULL; } @@ -50,7 +50,7 @@ void shared_module_atexit_register(mp_obj_t *func, size_t n_args, const mp_obj_t .n_pos = 0, .n_kw = 0, .func = func, - .args = (n_args + n_kw_args) ? m_malloc((n_args + (n_kw_args * 2)) * sizeof(mp_obj_t)) : NULL + .args = (n_args + n_kw_args) ? gc_alloc((n_args + (n_kw_args * 2)) * sizeof(mp_obj_t), 0) : NULL }; for (; cb.n_pos < n_args; cb.n_pos++) { cb.args[cb.n_pos] = pos_args[cb.n_pos]; @@ -59,7 +59,7 @@ void shared_module_atexit_register(mp_obj_t *func, size_t n_args, const mp_obj_t cb.args[i] = kw_args->table[cb.n_kw].key; cb.args[i += 1] = kw_args->table[cb.n_kw].value; } - callback = (atexit_callback_t *)m_realloc(callback, (callback_len + 1) * sizeof(cb)); + callback = (atexit_callback_t *)gc_realloc(callback, (callback_len + 1) * sizeof(cb), true); callback[callback_len++] = cb; } diff --git a/shared-module/board/__init__.c b/shared-module/board/__init__.c index 08a9761ed5f7e..09112cc224ec0 100644 --- a/shared-module/board/__init__.c +++ b/shared-module/board/__init__.c @@ -27,7 +27,6 @@ #include "shared-bindings/board/__init__.h" #include "shared-bindings/microcontroller/Pin.h" #include "shared-module/board/__init__.h" -#include "mpconfigboard.h" #include "py/runtime.h" #if CIRCUITPY_BUSIO diff --git a/shared-module/displayio/OnDiskBitmap.c b/shared-module/displayio/OnDiskBitmap.c index 1175a576e46b7..de169a78b2efb 100644 --- a/shared-module/displayio/OnDiskBitmap.c +++ b/shared-module/displayio/OnDiskBitmap.c @@ -33,6 +33,7 @@ #include #include "py/mperrno.h" +#include "py/gc.h" #include "py/runtime.h" static uint32_t read_word(uint16_t *bmp_header, uint16_t index) { @@ -100,7 +101,7 @@ void common_hal_displayio_ondiskbitmap_construct(displayio_ondiskbitmap_t *self, uint16_t palette_size = number_of_colors * sizeof(uint32_t); uint16_t palette_offset = 0xe + header_size; - uint32_t *palette_data = m_malloc(palette_size); + uint32_t *palette_data = gc_alloc(palette_size, 0); f_rewind(&self->file->fp); f_lseek(&self->file->fp, palette_offset); @@ -115,7 +116,7 @@ void common_hal_displayio_ondiskbitmap_construct(displayio_ondiskbitmap_t *self, for (uint16_t i = 0; i < number_of_colors; i++) { common_hal_displayio_palette_set_color(palette, i, palette_data[i]); } - m_free(palette_data); + gc_free(palette_data); } else { common_hal_displayio_palette_set_color(palette, 0, 0x0); common_hal_displayio_palette_set_color(palette, 1, 0xffffff); diff --git a/shared-module/displayio/__init__.c b/shared-module/displayio/__init__.c index 0ef7b0b71c99a..d8041b2655e6d 100644 --- a/shared-module/displayio/__init__.c +++ b/shared-module/displayio/__init__.c @@ -27,6 +27,7 @@ #include #include "shared-module/displayio/__init__.h" +#include "shared-bindings/displayio/__init__.h" #include "shared/runtime/interrupt_char.h" #include "py/runtime.h" @@ -38,7 +39,6 @@ #include "supervisor/shared/display.h" #include "supervisor/shared/reload.h" -#include "supervisor/spi_flash_api.h" #include "py/mpconfig.h" #if CIRCUITPY_BUSDISPLAY diff --git a/shared-module/epaperdisplay/EPaperDisplay.h b/shared-module/epaperdisplay/EPaperDisplay.h index 7cd0be915f0a8..e162191526489 100644 --- a/shared-module/epaperdisplay/EPaperDisplay.h +++ b/shared-module/epaperdisplay/EPaperDisplay.h @@ -26,7 +26,6 @@ #pragma once -#include "shared-bindings/digitalio/DigitalInOut.h" #include "shared-bindings/displayio/Group.h" #include "shared-module/displayio/area.h" diff --git a/shared-module/framebufferio/FramebufferDisplay.h b/shared-module/framebufferio/FramebufferDisplay.h index 47f31d794f79b..9f6b04e2f9f76 100644 --- a/shared-module/framebufferio/FramebufferDisplay.h +++ b/shared-module/framebufferio/FramebufferDisplay.h @@ -31,7 +31,6 @@ #include "py/obj.h" #include "py/proto.h" -#include "shared-bindings/digitalio/DigitalInOut.h" #include "shared-bindings/displayio/Group.h" #include "shared-module/displayio/area.h" diff --git a/shared-module/os/getenv.c b/shared-module/os/getenv.c index d3408e8a2c9ac..e08a189463c59 100644 --- a/shared-module/os/getenv.c +++ b/shared-module/os/getenv.c @@ -49,7 +49,10 @@ #include "extmod/vfs_fat.h" typedef FIL file_arg; STATIC bool open_file(const char *name, file_arg *active_file) { - #if defined(UNIX) + #if defined(UNIX) || CIRCUITPY_COMMAND_LINE_WORKFLOW + if (!gc_alloc_possible()) { + return false; + } nlr_buf_t nlr; if (nlr_push(&nlr) == 0) { mp_obj_t file_obj = mp_call_function_2(MP_OBJ_FROM_PTR(&mp_builtin_open_obj), mp_obj_new_str(name, strlen(name)), MP_ROM_QSTR(MP_QSTR_rb)); diff --git a/shared-module/random/__init__.c b/shared-module/random/__init__.c index 438eb24696e5c..8796dc91079e6 100644 --- a/shared-module/random/__init__.c +++ b/shared-module/random/__init__.c @@ -80,6 +80,9 @@ void shared_modules_random_seed(mp_uint_t seed) { } mp_uint_t shared_modules_random_getrandbits(uint8_t n) { + if (n == 0) { + return 0; + } uint32_t mask = ~0; // Beware of C undefined behavior when shifting by >= than bit size mask >>= (32 - n); diff --git a/shared-module/supervisor/StatusBar.c b/shared-module/supervisor/StatusBar.c index 9b6fe9b849c78..b0ce9a790bf73 100644 --- a/shared-module/supervisor/StatusBar.c +++ b/shared-module/supervisor/StatusBar.c @@ -40,6 +40,7 @@ bool shared_module_supervisor_status_bar_get_console(supervisor_status_bar_obj_t } void shared_module_supervisor_status_bar_set_console(supervisor_status_bar_obj_t *self, bool enabled) { + #if CIRCUITPY_STATUS_BAR if (self->console == enabled) { // Do nothing if not changing the state. return; @@ -54,13 +55,14 @@ void shared_module_supervisor_status_bar_set_console(supervisor_status_bar_obj_t // Update may be ignored. supervisor_status_bar_update(); + #endif } bool shared_module_supervisor_status_bar_get_display(supervisor_status_bar_obj_t *self) { return self->display; } -#if CIRCUITPY_TERMINALIO +#if CIRCUITPY_STATUS_BAR && CIRCUITPY_TERMINALIO void shared_module_supervisor_status_bar_set_display(supervisor_status_bar_obj_t *self, bool enabled) { if (self->display == enabled) { // Do nothing if not changing the state. diff --git a/shared/runtime/sys_stdio_mphal.c b/shared/runtime/sys_stdio_mphal.c index 84ce5828ef048..6f76228e047b1 100644 --- a/shared/runtime/sys_stdio_mphal.c +++ b/shared/runtime/sys_stdio_mphal.c @@ -32,6 +32,7 @@ #include "py/mperrno.h" #include "py/mphal.h" +#if !MICROPY_VFS_POSIX // TODO make stdin, stdout and stderr writable objects so they can // be changed by Python code. This requires some changes, as these // objects are in a read-only module (py/modsys.c). @@ -164,3 +165,4 @@ STATIC MP_DEFINE_CONST_OBJ_TYPE( STATIC const sys_stdio_obj_t stdio_buffer_obj = {{&stdio_buffer_obj_type}, .fd = 0}; // fd unused #endif +#endif diff --git a/supervisor/serial.h b/supervisor/serial.h index 2e30998f3bbba..f439c73dad4a4 100644 --- a/supervisor/serial.h +++ b/supervisor/serial.h @@ -58,7 +58,7 @@ bool serial_display_write_disable(bool disabled); void port_serial_early_init(void); void port_serial_init(void); bool port_serial_connected(void); -char port_serial_read(void); +int port_serial_read(void); bool port_serial_bytes_available(void); void port_serial_write_substring(const char *text, uint32_t length); diff --git a/supervisor/shared/serial.c b/supervisor/shared/serial.c index a78ed77f1f0f3..1905a4269df06 100644 --- a/supervisor/shared/serial.c +++ b/supervisor/shared/serial.c @@ -117,7 +117,7 @@ MP_WEAK bool port_serial_connected(void) { return false; } -MP_WEAK char port_serial_read(void) { +MP_WEAK int port_serial_read(void) { return -1; } diff --git a/supervisor/supervisor.mk b/supervisor/supervisor.mk index e8ef434912c0c..01fec10bb70c2 100644 --- a/supervisor/supervisor.mk +++ b/supervisor/supervisor.mk @@ -1,4 +1,5 @@ SRC_SUPERVISOR = \ + cmdline.c \ main.c \ lib/tlsf/tlsf.c \ supervisor/port.c \ @@ -13,7 +14,6 @@ SRC_SUPERVISOR = \ supervisor/shared/reload.c \ supervisor/shared/safe_mode.c \ supervisor/shared/serial.c \ - supervisor/shared/stack.c \ supervisor/shared/status_leds.c \ supervisor/shared/tick.c \ supervisor/shared/traceback.c \ @@ -21,6 +21,11 @@ SRC_SUPERVISOR = \ supervisor/shared/workflow.c \ supervisor/stub/misc.c \ +ifeq ($(CIRCUITPY_STACK_CHECK),0) +SRC_SUPERVISOR += supervisor/stub/stack.c +else +SRC_SUPERVISOR += supervisor/shared/stack.c +endif # For tlsf CFLAGS += -D_DEBUG=0 diff --git a/tests/basics/array_micropython.py b/tests/basics/array_micropython.py index 771a7d709cb45..950f3b1d8e619 100644 --- a/tests/basics/array_micropython.py +++ b/tests/basics/array_micropython.py @@ -1,7 +1,8 @@ # test MicroPython-specific features of array.array try: import array -except ImportError: + array.array('O') +except Exception: print("SKIP") raise SystemExit diff --git a/tests/circuitpython/atexit_test.py b/tests/circuitpython/atexit_test.py index b689f5a5085d8..6586025b12ce5 100644 --- a/tests/circuitpython/atexit_test.py +++ b/tests/circuitpython/atexit_test.py @@ -14,7 +14,7 @@ def skip_at_exit(): @atexit.register def do_at_exit(*args, **kwargs): - print("done at exit:", args, kwargs) + print("done at exit:", args, sorted(kwargs.items())) atexit.unregister(skip_at_exit) diff --git a/tests/circuitpython/getenv.py b/tests/circuitpython/getenv.py index 1bd2ea5b65161..137759cc2d3d8 100644 --- a/tests/circuitpython/getenv.py +++ b/tests/circuitpython/getenv.py @@ -1,6 +1,12 @@ import os -os.umount("/") +try: + from storage import mount, umount, VfsFat +except ImportError: + print("SKIP") + raise SystemExit + +umount("/") class RAMBlockDevice: @@ -32,8 +38,8 @@ def ioctl(self, op, arg): bdev = RAMBlockDevice(64) -os.VfsFat.mkfs(bdev) -os.mount(os.VfsFat(bdev), "/") +VfsFat.mkfs(bdev) +mount(VfsFat(bdev), "/") content_good = b""" # comment @@ -82,7 +88,12 @@ def run_test(key, content): run_test(f"key{i}", content_good) run_test(f"K", b"K = 7\r\n") -print(getenv_int("K")) +print(repr(os.getenv_int("K"))) +print(repr(os.getenv_str("K"))) + +run_test(f"K", b'K = "7"\r\n') +print(repr(os.getenv_int("K"))) +print(repr(os.getenv_str("K"))) # Test value without trailing newline run_test(f"noeol", b"noeol=3") diff --git a/tests/circuitpython/getenv.py.exp b/tests/circuitpython/getenv.py.exp index 925dafb469275..c8bf351ff2a04 100644 --- a/tests/circuitpython/getenv.py.exp +++ b/tests/circuitpython/getenv.py.exp @@ -27,8 +27,16 @@ key11 0 key12 None K 7 7 +An error occurred while retrieving 'K': +Invalid byte '7' +None +K '7' +An error occurred while retrieving 'K': +Invalid byte '"' +None +'7' noeol 3 key Invalid byte '\n' key Invalid byte '"' -key invalid syntax for integer with base 10: '' +key invalid syntax for integer with base 10 key Invalid byte 'EOF' diff --git a/tests/cmdline/cmd_parsetree.py.exp b/tests/cmdline/cmd_parsetree.py.exp index 3049267c0b957..7b796ec38f594 100644 --- a/tests/cmdline/cmd_parsetree.py.exp +++ b/tests/cmdline/cmd_parsetree.py.exp @@ -87,5 +87,5 @@ arg names: 48 RETURN_VALUE mem: total=\\d\+, current=\\d\+, peak=\\d\+ stack: \\d\+ out of \\d\+ -GC: total: \\d\+, used: \\d\+, free: \\d\+ +GC: total: \\d\+, used: \\d\+, free: \\d\+\(, max new split: \\d\+\)? No. of 1-blocks: \\d\+, 2-blocks: \\d\+, max blk sz: \\d\+, max free sz: \\d\+ diff --git a/tests/cmdline/cmd_showbc.py.exp b/tests/cmdline/cmd_showbc.py.exp index db06de9237178..9195195f63db4 100644 --- a/tests/cmdline/cmd_showbc.py.exp +++ b/tests/cmdline/cmd_showbc.py.exp @@ -643,5 +643,5 @@ arg names: * b 04 RETURN_VALUE mem: total=\\d\+, current=\\d\+, peak=\\d\+ stack: \\d\+ out of \\d\+ -GC: total: \\d\+, used: \\d\+, free: \\d\+ +GC: total: \\d\+, used: \\d\+, free: \\d\+\(, max new split: \\d\+\)? No. of 1-blocks: \\d\+, 2-blocks: \\d\+, max blk sz: \\d\+, max free sz: \\d\+ diff --git a/tests/cmdline/cmd_showbc_const.py.exp b/tests/cmdline/cmd_showbc_const.py.exp index 6cdc3e9c96373..edf934b8a4fc9 100644 --- a/tests/cmdline/cmd_showbc_const.py.exp +++ b/tests/cmdline/cmd_showbc_const.py.exp @@ -156,5 +156,5 @@ Kept Kept mem: total=\\d\+, current=\\d\+, peak=\\d\+ stack: \\d\+ out of \\d\+ -GC: total: \\d\+, used: \\d\+, free: \\d\+ +GC: total: \\d\+, used: \\d\+, free: \\d\+\(, max new split: \\d\+\)? No. of 1-blocks: \\d\+, 2-blocks: \\d\+, max blk sz: \\d\+, max free sz: \\d\+ diff --git a/tests/cmdline/cmd_showbc_opt.py.exp b/tests/cmdline/cmd_showbc_opt.py.exp index 9e4e4fae10cfa..36a0e9da0bccd 100644 --- a/tests/cmdline/cmd_showbc_opt.py.exp +++ b/tests/cmdline/cmd_showbc_opt.py.exp @@ -118,5 +118,5 @@ arg names: x 14 RETURN_VALUE mem: total=\\d\+, current=\\d\+, peak=\\d\+ stack: \\d\+ out of \\d\+ -GC: total: \\d\+, used: \\d\+, free: \\d\+ +GC: total: \\d\+, used: \\d\+, free: \\d\+\(, max new split: \\d\+\)? No. of 1-blocks: \\d\+, 2-blocks: \\d\+, max blk sz: \\d\+, max free sz: \\d\+ diff --git a/tests/cmdline/cmd_verbose.py.exp b/tests/cmdline/cmd_verbose.py.exp index ae833dbec8d3e..257c1b8bb5a18 100644 --- a/tests/cmdline/cmd_verbose.py.exp +++ b/tests/cmdline/cmd_verbose.py.exp @@ -15,5 +15,5 @@ arg names: 1 mem: total=\\d\+, current=\\d\+, peak=\\d\+ stack: \\d\+ out of \\d\+ -GC: total: \\d\+, used: \\d\+, free: \\d\+ +GC: total: \\d\+, used: \\d\+, free: \\d\+\(, max new split: \\d\+\)? No. of 1-blocks: \\d\+, 2-blocks: \\d\+, max blk sz: \\d\+, max free sz: \\d\+ diff --git a/tests/cmdline/repl_autocomplete.py.exp b/tests/cmdline/repl_autocomplete.py.exp index 75002985e3c63..d73d38f848601 100644 --- a/tests/cmdline/repl_autocomplete.py.exp +++ b/tests/cmdline/repl_autocomplete.py.exp @@ -1,4 +1,4 @@ -MicroPython \.\+ version +MicroPython \.\+ Use \.\+ >>> # tests for autocompletion >>> import sys diff --git a/tests/cmdline/repl_autoindent.py.exp b/tests/cmdline/repl_autoindent.py.exp index 9127a7d31d903..1a7477756ddb2 100644 --- a/tests/cmdline/repl_autoindent.py.exp +++ b/tests/cmdline/repl_autoindent.py.exp @@ -1,4 +1,4 @@ -MicroPython \.\+ version +MicroPython \.\+ Use \.\+ >>> # tests for autoindent >>> if 1: diff --git a/tests/cmdline/repl_basic.py.exp b/tests/cmdline/repl_basic.py.exp index 2b390ea98bb75..7e8511d18a3f0 100644 --- a/tests/cmdline/repl_basic.py.exp +++ b/tests/cmdline/repl_basic.py.exp @@ -1,4 +1,4 @@ -MicroPython \.\+ version +MicroPython \.\+ Use \.\+ >>> # basic REPL tests >>> print(1) diff --git a/tests/cmdline/repl_cont.py.exp b/tests/cmdline/repl_cont.py.exp index 834c18a4d3699..15bbc0635f6ec 100644 --- a/tests/cmdline/repl_cont.py.exp +++ b/tests/cmdline/repl_cont.py.exp @@ -1,4 +1,4 @@ -MicroPython \.\+ version +MicroPython \.\+ Use \.\+ >>> # check REPL allows to continue input >>> 1 \\\\ diff --git a/tests/cmdline/repl_emacs_keys.py.exp b/tests/cmdline/repl_emacs_keys.py.exp index 6102c19639a8a..ad63231d8f437 100644 --- a/tests/cmdline/repl_emacs_keys.py.exp +++ b/tests/cmdline/repl_emacs_keys.py.exp @@ -1,4 +1,4 @@ -MicroPython \.\+ version +MicroPython \.\+ Use \.\+ >>> # REPL tests of GNU-ish readline navigation >>> # history buffer navigation diff --git a/tests/cmdline/repl_inspect.py.exp b/tests/cmdline/repl_inspect.py.exp index 051acfd153a61..5c57269b54b7e 100644 --- a/tests/cmdline/repl_inspect.py.exp +++ b/tests/cmdline/repl_inspect.py.exp @@ -1,5 +1,5 @@ test -MicroPython \.\+ version +MicroPython \.\+ Use \.\+ >>> # cmdline: -i -c print("test") >>> # -c option combined with -i option results in REPL diff --git a/tests/cmdline/repl_micropyinspect b/tests/cmdline/repl_micropyinspect deleted file mode 100644 index 8dfa8810ea41a..0000000000000 --- a/tests/cmdline/repl_micropyinspect +++ /dev/null @@ -1,3 +0,0 @@ -import os - -os.putenv('MICROPYINSPECT', '1') diff --git a/tests/cmdline/repl_micropyinspect.py b/tests/cmdline/repl_micropyinspect.py deleted file mode 100644 index 220dd43d80d87..0000000000000 --- a/tests/cmdline/repl_micropyinspect.py +++ /dev/null @@ -1,2 +0,0 @@ -# cmdline: cmdline/repl_micropyinspect -# setting MICROPYINSPECT environment variable before program exit triggers REPL diff --git a/tests/cmdline/repl_micropyinspect.py.exp b/tests/cmdline/repl_micropyinspect.py.exp deleted file mode 100644 index 93ff43546eace..0000000000000 --- a/tests/cmdline/repl_micropyinspect.py.exp +++ /dev/null @@ -1,5 +0,0 @@ -MicroPython \.\+ version -Use \.\+ ->>> # cmdline: cmdline/repl_micropyinspect ->>> # setting MICROPYINSPECT environment variable before program exit triggers REPL ->>> diff --git a/tests/cmdline/repl_sys_ps1_ps2.py.exp b/tests/cmdline/repl_sys_ps1_ps2.py.exp index 9e82db5e313e4..121ca127ccaab 100644 --- a/tests/cmdline/repl_sys_ps1_ps2.py.exp +++ b/tests/cmdline/repl_sys_ps1_ps2.py.exp @@ -1,4 +1,4 @@ -MicroPython \.\+ version +MicroPython \.\+ Use \.\+ >>> # test changing ps1/ps2 >>> import sys diff --git a/tests/cmdline/repl_words_move.py.exp b/tests/cmdline/repl_words_move.py.exp index 86f6b7788989e..33585ca1e5735 100644 --- a/tests/cmdline/repl_words_move.py.exp +++ b/tests/cmdline/repl_words_move.py.exp @@ -1,4 +1,4 @@ -MicroPython \.\+ version +MicroPython \.\+ Use \.\+ >>> # word movement >>> # backward-word, start in word diff --git a/tests/extmod/asyncio_basic.py b/tests/extmod/asyncio_basic.py index bdc4f613335cb..4495ea4dc0a35 100644 --- a/tests/extmod/asyncio_basic.py +++ b/tests/extmod/asyncio_basic.py @@ -16,14 +16,8 @@ async def foo(): print("SKIP") raise SystemExit -import time - -if hasattr(time, "ticks_ms"): - ticks = time.ticks_ms - ticks_diff = time.ticks_diff -else: - ticks = lambda: int(time.time() * 1000) - ticks_diff = lambda t1, t0: t1 - t0 +from adafruit_ticks import ticks_diff +from adafruit_ticks import ticks_ms as ticks async def delay_print(t, s): diff --git a/tests/extmod/asyncio_micropython.py b/tests/extmod/asyncio_micropython.py index cc96d34be2ecd..c1eb1b4d797c6 100644 --- a/tests/extmod/asyncio_micropython.py +++ b/tests/extmod/asyncio_micropython.py @@ -3,7 +3,7 @@ # - wait_for_ms try: - import time, asyncio + import adafruit_ticks, asyncio except ImportError: print("SKIP") raise SystemExit @@ -18,13 +18,13 @@ async def task(id, t): async def main(): # Simple sleep_ms - t0 = time.ticks_ms() + t0 = adafruit_ticks.ticks_ms() await asyncio.sleep_ms(1) - print(time.ticks_diff(time.ticks_ms(), t0) < 100) + print(adafruit_ticks.ticks_diff(adafruit_ticks.ticks_ms(), t0) < 100) try: # Sleep 1ms beyond maximum allowed sleep value - await asyncio.sleep_ms(time.ticks_add(0, -1) // 2 + 1) + await asyncio.sleep_ms(adafruit_ticks.ticks_add(0, -1) // 2 + 1) except OverflowError: print("OverflowError") diff --git a/tests/extmod/asyncio_wait_task.py b/tests/extmod/asyncio_wait_task.py index bce426d971046..4bf8376b06f47 100644 --- a/tests/extmod/asyncio_wait_task.py +++ b/tests/extmod/asyncio_wait_task.py @@ -9,12 +9,8 @@ import time -if hasattr(time, "ticks_ms"): - ticks = time.ticks_ms - ticks_diff = time.ticks_diff -else: - ticks = lambda: int(time.time() * 1000) - ticks_diff = lambda t1, t0: t1 - t0 +from adafruit_ticks import ticks_diff +from adafruit_ticks import ticks_ms as ticks async def task(t): diff --git a/tests/extmod/framebuf_ellipse.py b/tests/extmod/framebuf_ellipse.py deleted file mode 100644 index a4c784aff8762..0000000000000 --- a/tests/extmod/framebuf_ellipse.py +++ /dev/null @@ -1,65 +0,0 @@ -try: - import framebuf -except ImportError: - print("SKIP") - raise SystemExit - - -def printbuf(): - print("--8<--") - for y in range(h): - for x in range(w): - print("%02x" % buf[(x + y * w)], end="") - print() - print("-->8--") - - -w = 30 -h = 30 -buf = bytearray(w * h) -fbuf = framebuf.FrameBuffer(buf, w, h, framebuf.GS8) - -# Outline -fbuf.fill(0) -fbuf.ellipse(15, 15, 12, 6, 0xFF, False) -printbuf() - -# Fill -fbuf.fill(0) -fbuf.ellipse(15, 15, 6, 12, 0xAA, True) -printbuf() - -# Outline and fill some different quadrant combos. -for m in (0, 0b0001, 0b0010, 0b0100, 0b1000, 0b1010): - fbuf.fill(0) - fbuf.ellipse(15, 15, 6, 12, 0xAA, False, m) - printbuf() - fbuf.fill(0) - fbuf.ellipse(15, 15, 6, 12, 0xAA, True, m) - printbuf() - -# Draw ellipses that will go out of bounds at each of the edges. -for x, y in ( - ( - 4, - 4, - ), - ( - 26, - 4, - ), - ( - 26, - 26, - ), - ( - 4, - 26, - ), -): - fbuf.fill(0) - fbuf.ellipse(x, y, 6, 12, 0xAA, False) - printbuf() - fbuf.fill(0) - fbuf.ellipse(x, y, 6, 12, 0xAA, True) - printbuf() diff --git a/tests/extmod/framebuf_ellipse.py.exp b/tests/extmod/framebuf_ellipse.py.exp deleted file mode 100644 index ae6ad1ee7e487..0000000000000 --- a/tests/extmod/framebuf_ellipse.py.exp +++ /dev/null @@ -1,704 +0,0 @@ ---8<-- -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -0000000000000000000000ffffffffffffffffff00000000000000000000 -0000000000000000ffffff000000000000000000ffffff00000000000000 -000000000000ffff000000000000000000000000000000ffff0000000000 -0000000000ff00000000000000000000000000000000000000ff00000000 -00000000ff000000000000000000000000000000000000000000ff000000 -000000ff0000000000000000000000000000000000000000000000ff0000 -000000ff0000000000000000000000000000000000000000000000ff0000 -000000ff0000000000000000000000000000000000000000000000ff0000 -00000000ff000000000000000000000000000000000000000000ff000000 -0000000000ff00000000000000000000000000000000000000ff00000000 -000000000000ffff000000000000000000000000000000ffff0000000000 -0000000000000000ffffff000000000000000000ffffff00000000000000 -0000000000000000000000ffffffffffffffffff00000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 --->8-- ---8<-- -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -0000000000000000000000000000aaaaaa00000000000000000000000000 -00000000000000000000000000aaaaaaaaaa000000000000000000000000 -000000000000000000000000aaaaaaaaaaaaaa0000000000000000000000 -0000000000000000000000aaaaaaaaaaaaaaaaaa00000000000000000000 -0000000000000000000000aaaaaaaaaaaaaaaaaa00000000000000000000 -00000000000000000000aaaaaaaaaaaaaaaaaaaaaa000000000000000000 -00000000000000000000aaaaaaaaaaaaaaaaaaaaaa000000000000000000 -00000000000000000000aaaaaaaaaaaaaaaaaaaaaa000000000000000000 -000000000000000000aaaaaaaaaaaaaaaaaaaaaaaaaa0000000000000000 -000000000000000000aaaaaaaaaaaaaaaaaaaaaaaaaa0000000000000000 -000000000000000000aaaaaaaaaaaaaaaaaaaaaaaaaa0000000000000000 -000000000000000000aaaaaaaaaaaaaaaaaaaaaaaaaa0000000000000000 -000000000000000000aaaaaaaaaaaaaaaaaaaaaaaaaa0000000000000000 -000000000000000000aaaaaaaaaaaaaaaaaaaaaaaaaa0000000000000000 -000000000000000000aaaaaaaaaaaaaaaaaaaaaaaaaa0000000000000000 -000000000000000000aaaaaaaaaaaaaaaaaaaaaaaaaa0000000000000000 -000000000000000000aaaaaaaaaaaaaaaaaaaaaaaaaa0000000000000000 -00000000000000000000aaaaaaaaaaaaaaaaaaaaaa000000000000000000 -00000000000000000000aaaaaaaaaaaaaaaaaaaaaa000000000000000000 -00000000000000000000aaaaaaaaaaaaaaaaaaaaaa000000000000000000 -0000000000000000000000aaaaaaaaaaaaaaaaaa00000000000000000000 -0000000000000000000000aaaaaaaaaaaaaaaaaa00000000000000000000 -000000000000000000000000aaaaaaaaaaaaaa0000000000000000000000 -00000000000000000000000000aaaaaaaaaa000000000000000000000000 -0000000000000000000000000000aaaaaa00000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 --->8-- ---8<-- -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 --->8-- ---8<-- -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 --->8-- ---8<-- -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000aaaa00000000000000000000000000 -0000000000000000000000000000000000aa000000000000000000000000 -000000000000000000000000000000000000aa0000000000000000000000 -00000000000000000000000000000000000000aa00000000000000000000 -00000000000000000000000000000000000000aa00000000000000000000 -0000000000000000000000000000000000000000aa000000000000000000 -0000000000000000000000000000000000000000aa000000000000000000 -0000000000000000000000000000000000000000aa000000000000000000 -000000000000000000000000000000000000000000aa0000000000000000 -000000000000000000000000000000000000000000aa0000000000000000 -000000000000000000000000000000000000000000aa0000000000000000 -000000000000000000000000000000000000000000aa0000000000000000 -000000000000000000000000000000000000000000aa0000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 --->8-- ---8<-- -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000aaaa00000000000000000000000000 -000000000000000000000000000000aaaaaa000000000000000000000000 -000000000000000000000000000000aaaaaaaa0000000000000000000000 -000000000000000000000000000000aaaaaaaaaa00000000000000000000 -000000000000000000000000000000aaaaaaaaaa00000000000000000000 -000000000000000000000000000000aaaaaaaaaaaa000000000000000000 -000000000000000000000000000000aaaaaaaaaaaa000000000000000000 -000000000000000000000000000000aaaaaaaaaaaa000000000000000000 -000000000000000000000000000000aaaaaaaaaaaaaa0000000000000000 -000000000000000000000000000000aaaaaaaaaaaaaa0000000000000000 -000000000000000000000000000000aaaaaaaaaaaaaa0000000000000000 -000000000000000000000000000000aaaaaaaaaaaaaa0000000000000000 -000000000000000000000000000000aaaaaaaaaaaaaa0000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 --->8-- ---8<-- -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -0000000000000000000000000000aaaa0000000000000000000000000000 -00000000000000000000000000aa00000000000000000000000000000000 -000000000000000000000000aa0000000000000000000000000000000000 -0000000000000000000000aa000000000000000000000000000000000000 -0000000000000000000000aa000000000000000000000000000000000000 -00000000000000000000aa00000000000000000000000000000000000000 -00000000000000000000aa00000000000000000000000000000000000000 -00000000000000000000aa00000000000000000000000000000000000000 -000000000000000000aa0000000000000000000000000000000000000000 -000000000000000000aa0000000000000000000000000000000000000000 -000000000000000000aa0000000000000000000000000000000000000000 -000000000000000000aa0000000000000000000000000000000000000000 -000000000000000000aa0000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 --->8-- ---8<-- -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -0000000000000000000000000000aaaa0000000000000000000000000000 -00000000000000000000000000aaaaaa0000000000000000000000000000 -000000000000000000000000aaaaaaaa0000000000000000000000000000 -0000000000000000000000aaaaaaaaaa0000000000000000000000000000 -0000000000000000000000aaaaaaaaaa0000000000000000000000000000 -00000000000000000000aaaaaaaaaaaa0000000000000000000000000000 -00000000000000000000aaaaaaaaaaaa0000000000000000000000000000 -00000000000000000000aaaaaaaaaaaa0000000000000000000000000000 -000000000000000000aaaaaaaaaaaaaa0000000000000000000000000000 -000000000000000000aaaaaaaaaaaaaa0000000000000000000000000000 -000000000000000000aaaaaaaaaaaaaa0000000000000000000000000000 -000000000000000000aaaaaaaaaaaaaa0000000000000000000000000000 -000000000000000000aaaaaaaaaaaaaa0000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 --->8-- ---8<-- -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000aa0000000000000000000000000000000000000000 -000000000000000000aa0000000000000000000000000000000000000000 -000000000000000000aa0000000000000000000000000000000000000000 -000000000000000000aa0000000000000000000000000000000000000000 -000000000000000000aa0000000000000000000000000000000000000000 -00000000000000000000aa00000000000000000000000000000000000000 -00000000000000000000aa00000000000000000000000000000000000000 -00000000000000000000aa00000000000000000000000000000000000000 -0000000000000000000000aa000000000000000000000000000000000000 -0000000000000000000000aa000000000000000000000000000000000000 -000000000000000000000000aa0000000000000000000000000000000000 -00000000000000000000000000aa00000000000000000000000000000000 -0000000000000000000000000000aaaa0000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 --->8-- ---8<-- -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000aaaaaaaaaaaaaa0000000000000000000000000000 -000000000000000000aaaaaaaaaaaaaa0000000000000000000000000000 -000000000000000000aaaaaaaaaaaaaa0000000000000000000000000000 -000000000000000000aaaaaaaaaaaaaa0000000000000000000000000000 -000000000000000000aaaaaaaaaaaaaa0000000000000000000000000000 -00000000000000000000aaaaaaaaaaaa0000000000000000000000000000 -00000000000000000000aaaaaaaaaaaa0000000000000000000000000000 -00000000000000000000aaaaaaaaaaaa0000000000000000000000000000 -0000000000000000000000aaaaaaaaaa0000000000000000000000000000 -0000000000000000000000aaaaaaaaaa0000000000000000000000000000 -000000000000000000000000aaaaaaaa0000000000000000000000000000 -00000000000000000000000000aaaaaa0000000000000000000000000000 -0000000000000000000000000000aaaa0000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 --->8-- ---8<-- -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000aa0000000000000000 -000000000000000000000000000000000000000000aa0000000000000000 -000000000000000000000000000000000000000000aa0000000000000000 -000000000000000000000000000000000000000000aa0000000000000000 -000000000000000000000000000000000000000000aa0000000000000000 -0000000000000000000000000000000000000000aa000000000000000000 -0000000000000000000000000000000000000000aa000000000000000000 -0000000000000000000000000000000000000000aa000000000000000000 -00000000000000000000000000000000000000aa00000000000000000000 -00000000000000000000000000000000000000aa00000000000000000000 -000000000000000000000000000000000000aa0000000000000000000000 -0000000000000000000000000000000000aa000000000000000000000000 -000000000000000000000000000000aaaa00000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 --->8-- ---8<-- -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000aaaaaaaaaaaaaa0000000000000000 -000000000000000000000000000000aaaaaaaaaaaaaa0000000000000000 -000000000000000000000000000000aaaaaaaaaaaaaa0000000000000000 -000000000000000000000000000000aaaaaaaaaaaaaa0000000000000000 -000000000000000000000000000000aaaaaaaaaaaaaa0000000000000000 -000000000000000000000000000000aaaaaaaaaaaa000000000000000000 -000000000000000000000000000000aaaaaaaaaaaa000000000000000000 -000000000000000000000000000000aaaaaaaaaaaa000000000000000000 -000000000000000000000000000000aaaaaaaaaa00000000000000000000 -000000000000000000000000000000aaaaaaaaaa00000000000000000000 -000000000000000000000000000000aaaaaaaa0000000000000000000000 -000000000000000000000000000000aaaaaa000000000000000000000000 -000000000000000000000000000000aaaa00000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 --->8-- ---8<-- -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -0000000000000000000000000000aaaa0000000000000000000000000000 -00000000000000000000000000aa00000000000000000000000000000000 -000000000000000000000000aa0000000000000000000000000000000000 -0000000000000000000000aa000000000000000000000000000000000000 -0000000000000000000000aa000000000000000000000000000000000000 -00000000000000000000aa00000000000000000000000000000000000000 -00000000000000000000aa00000000000000000000000000000000000000 -00000000000000000000aa00000000000000000000000000000000000000 -000000000000000000aa0000000000000000000000000000000000000000 -000000000000000000aa0000000000000000000000000000000000000000 -000000000000000000aa0000000000000000000000000000000000000000 -000000000000000000aa0000000000000000000000000000000000000000 -000000000000000000aa0000000000000000000000aa0000000000000000 -000000000000000000000000000000000000000000aa0000000000000000 -000000000000000000000000000000000000000000aa0000000000000000 -000000000000000000000000000000000000000000aa0000000000000000 -000000000000000000000000000000000000000000aa0000000000000000 -0000000000000000000000000000000000000000aa000000000000000000 -0000000000000000000000000000000000000000aa000000000000000000 -0000000000000000000000000000000000000000aa000000000000000000 -00000000000000000000000000000000000000aa00000000000000000000 -00000000000000000000000000000000000000aa00000000000000000000 -000000000000000000000000000000000000aa0000000000000000000000 -0000000000000000000000000000000000aa000000000000000000000000 -000000000000000000000000000000aaaa00000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 --->8-- ---8<-- -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -0000000000000000000000000000aaaa0000000000000000000000000000 -00000000000000000000000000aaaaaa0000000000000000000000000000 -000000000000000000000000aaaaaaaa0000000000000000000000000000 -0000000000000000000000aaaaaaaaaa0000000000000000000000000000 -0000000000000000000000aaaaaaaaaa0000000000000000000000000000 -00000000000000000000aaaaaaaaaaaa0000000000000000000000000000 -00000000000000000000aaaaaaaaaaaa0000000000000000000000000000 -00000000000000000000aaaaaaaaaaaa0000000000000000000000000000 -000000000000000000aaaaaaaaaaaaaa0000000000000000000000000000 -000000000000000000aaaaaaaaaaaaaa0000000000000000000000000000 -000000000000000000aaaaaaaaaaaaaa0000000000000000000000000000 -000000000000000000aaaaaaaaaaaaaa0000000000000000000000000000 -000000000000000000aaaaaaaaaaaaaaaaaaaaaaaaaa0000000000000000 -000000000000000000000000000000aaaaaaaaaaaaaa0000000000000000 -000000000000000000000000000000aaaaaaaaaaaaaa0000000000000000 -000000000000000000000000000000aaaaaaaaaaaaaa0000000000000000 -000000000000000000000000000000aaaaaaaaaaaaaa0000000000000000 -000000000000000000000000000000aaaaaaaaaaaa000000000000000000 -000000000000000000000000000000aaaaaaaaaaaa000000000000000000 -000000000000000000000000000000aaaaaaaaaaaa000000000000000000 -000000000000000000000000000000aaaaaaaaaa00000000000000000000 -000000000000000000000000000000aaaaaaaaaa00000000000000000000 -000000000000000000000000000000aaaaaaaa0000000000000000000000 -000000000000000000000000000000aaaaaa000000000000000000000000 -000000000000000000000000000000aaaa00000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 --->8-- ---8<-- -00000000000000000000aa00000000000000000000000000000000000000 -00000000000000000000aa00000000000000000000000000000000000000 -00000000000000000000aa00000000000000000000000000000000000000 -00000000000000000000aa00000000000000000000000000000000000000 -00000000000000000000aa00000000000000000000000000000000000000 -00000000000000000000aa00000000000000000000000000000000000000 -00000000000000000000aa00000000000000000000000000000000000000 -00000000000000000000aa00000000000000000000000000000000000000 -00000000000000000000aa00000000000000000000000000000000000000 -000000000000000000aa0000000000000000000000000000000000000000 -000000000000000000aa0000000000000000000000000000000000000000 -000000000000000000aa0000000000000000000000000000000000000000 -aa00000000000000aa000000000000000000000000000000000000000000 -aa00000000000000aa000000000000000000000000000000000000000000 -00aa0000000000aa00000000000000000000000000000000000000000000 -0000aa000000aa0000000000000000000000000000000000000000000000 -000000aaaaaa000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 --->8-- ---8<-- -aaaaaaaaaaaaaaaaaaaaaa00000000000000000000000000000000000000 -aaaaaaaaaaaaaaaaaaaaaa00000000000000000000000000000000000000 -aaaaaaaaaaaaaaaaaaaaaa00000000000000000000000000000000000000 -aaaaaaaaaaaaaaaaaaaaaa00000000000000000000000000000000000000 -aaaaaaaaaaaaaaaaaaaaaa00000000000000000000000000000000000000 -aaaaaaaaaaaaaaaaaaaaaa00000000000000000000000000000000000000 -aaaaaaaaaaaaaaaaaaaaaa00000000000000000000000000000000000000 -aaaaaaaaaaaaaaaaaaaaaa00000000000000000000000000000000000000 -aaaaaaaaaaaaaaaaaaaaaa00000000000000000000000000000000000000 -aaaaaaaaaaaaaaaaaaaa0000000000000000000000000000000000000000 -aaaaaaaaaaaaaaaaaaaa0000000000000000000000000000000000000000 -aaaaaaaaaaaaaaaaaaaa0000000000000000000000000000000000000000 -aaaaaaaaaaaaaaaaaa000000000000000000000000000000000000000000 -aaaaaaaaaaaaaaaaaa000000000000000000000000000000000000000000 -00aaaaaaaaaaaaaa00000000000000000000000000000000000000000000 -0000aaaaaaaaaa0000000000000000000000000000000000000000000000 -000000aaaaaa000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 --->8-- ---8<-- -0000000000000000000000000000000000000000aa000000000000000000 -0000000000000000000000000000000000000000aa000000000000000000 -0000000000000000000000000000000000000000aa000000000000000000 -0000000000000000000000000000000000000000aa000000000000000000 -0000000000000000000000000000000000000000aa000000000000000000 -0000000000000000000000000000000000000000aa000000000000000000 -0000000000000000000000000000000000000000aa000000000000000000 -0000000000000000000000000000000000000000aa000000000000000000 -0000000000000000000000000000000000000000aa000000000000000000 -000000000000000000000000000000000000000000aa0000000000000000 -000000000000000000000000000000000000000000aa0000000000000000 -000000000000000000000000000000000000000000aa0000000000000000 -00000000000000000000000000000000000000000000aa00000000000000 -00000000000000000000000000000000000000000000aa00000000000000 -0000000000000000000000000000000000000000000000aa0000000000aa -000000000000000000000000000000000000000000000000aa000000aa00 -00000000000000000000000000000000000000000000000000aaaaaa0000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 --->8-- ---8<-- -0000000000000000000000000000000000000000aaaaaaaaaaaaaaaaaaaa -0000000000000000000000000000000000000000aaaaaaaaaaaaaaaaaaaa -0000000000000000000000000000000000000000aaaaaaaaaaaaaaaaaaaa -0000000000000000000000000000000000000000aaaaaaaaaaaaaaaaaaaa -0000000000000000000000000000000000000000aaaaaaaaaaaaaaaaaaaa -0000000000000000000000000000000000000000aaaaaaaaaaaaaaaaaaaa -0000000000000000000000000000000000000000aaaaaaaaaaaaaaaaaaaa -0000000000000000000000000000000000000000aaaaaaaaaaaaaaaaaaaa -0000000000000000000000000000000000000000aaaaaaaaaaaaaaaaaaaa -000000000000000000000000000000000000000000aaaaaaaaaaaaaaaaaa -000000000000000000000000000000000000000000aaaaaaaaaaaaaaaaaa -000000000000000000000000000000000000000000aaaaaaaaaaaaaaaaaa -00000000000000000000000000000000000000000000aaaaaaaaaaaaaaaa -00000000000000000000000000000000000000000000aaaaaaaaaaaaaaaa -0000000000000000000000000000000000000000000000aaaaaaaaaaaaaa -000000000000000000000000000000000000000000000000aaaaaaaaaa00 -00000000000000000000000000000000000000000000000000aaaaaa0000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 --->8-- ---8<-- -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -00000000000000000000000000000000000000000000000000aaaaaa0000 -000000000000000000000000000000000000000000000000aa000000aa00 -0000000000000000000000000000000000000000000000aa0000000000aa -00000000000000000000000000000000000000000000aa00000000000000 -00000000000000000000000000000000000000000000aa00000000000000 -000000000000000000000000000000000000000000aa0000000000000000 -000000000000000000000000000000000000000000aa0000000000000000 -000000000000000000000000000000000000000000aa0000000000000000 -0000000000000000000000000000000000000000aa000000000000000000 -0000000000000000000000000000000000000000aa000000000000000000 -0000000000000000000000000000000000000000aa000000000000000000 -0000000000000000000000000000000000000000aa000000000000000000 -0000000000000000000000000000000000000000aa000000000000000000 -0000000000000000000000000000000000000000aa000000000000000000 -0000000000000000000000000000000000000000aa000000000000000000 -0000000000000000000000000000000000000000aa000000000000000000 --->8-- ---8<-- -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -00000000000000000000000000000000000000000000000000aaaaaa0000 -000000000000000000000000000000000000000000000000aaaaaaaaaa00 -0000000000000000000000000000000000000000000000aaaaaaaaaaaaaa -00000000000000000000000000000000000000000000aaaaaaaaaaaaaaaa -00000000000000000000000000000000000000000000aaaaaaaaaaaaaaaa -000000000000000000000000000000000000000000aaaaaaaaaaaaaaaaaa -000000000000000000000000000000000000000000aaaaaaaaaaaaaaaaaa -000000000000000000000000000000000000000000aaaaaaaaaaaaaaaaaa -0000000000000000000000000000000000000000aaaaaaaaaaaaaaaaaaaa -0000000000000000000000000000000000000000aaaaaaaaaaaaaaaaaaaa -0000000000000000000000000000000000000000aaaaaaaaaaaaaaaaaaaa -0000000000000000000000000000000000000000aaaaaaaaaaaaaaaaaaaa -0000000000000000000000000000000000000000aaaaaaaaaaaaaaaaaaaa -0000000000000000000000000000000000000000aaaaaaaaaaaaaaaaaaaa -0000000000000000000000000000000000000000aaaaaaaaaaaaaaaaaaaa -0000000000000000000000000000000000000000aaaaaaaaaaaaaaaaaaaa --->8-- ---8<-- -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000aaaaaa000000000000000000000000000000000000000000000000 -0000aa000000aa0000000000000000000000000000000000000000000000 -00aa0000000000aa00000000000000000000000000000000000000000000 -aa00000000000000aa000000000000000000000000000000000000000000 -aa00000000000000aa000000000000000000000000000000000000000000 -000000000000000000aa0000000000000000000000000000000000000000 -000000000000000000aa0000000000000000000000000000000000000000 -000000000000000000aa0000000000000000000000000000000000000000 -00000000000000000000aa00000000000000000000000000000000000000 -00000000000000000000aa00000000000000000000000000000000000000 -00000000000000000000aa00000000000000000000000000000000000000 -00000000000000000000aa00000000000000000000000000000000000000 -00000000000000000000aa00000000000000000000000000000000000000 -00000000000000000000aa00000000000000000000000000000000000000 -00000000000000000000aa00000000000000000000000000000000000000 -00000000000000000000aa00000000000000000000000000000000000000 --->8-- ---8<-- -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000aaaaaa000000000000000000000000000000000000000000000000 -0000aaaaaaaaaa0000000000000000000000000000000000000000000000 -00aaaaaaaaaaaaaa00000000000000000000000000000000000000000000 -aaaaaaaaaaaaaaaaaa000000000000000000000000000000000000000000 -aaaaaaaaaaaaaaaaaa000000000000000000000000000000000000000000 -aaaaaaaaaaaaaaaaaaaa0000000000000000000000000000000000000000 -aaaaaaaaaaaaaaaaaaaa0000000000000000000000000000000000000000 -aaaaaaaaaaaaaaaaaaaa0000000000000000000000000000000000000000 -aaaaaaaaaaaaaaaaaaaaaa00000000000000000000000000000000000000 -aaaaaaaaaaaaaaaaaaaaaa00000000000000000000000000000000000000 -aaaaaaaaaaaaaaaaaaaaaa00000000000000000000000000000000000000 -aaaaaaaaaaaaaaaaaaaaaa00000000000000000000000000000000000000 -aaaaaaaaaaaaaaaaaaaaaa00000000000000000000000000000000000000 -aaaaaaaaaaaaaaaaaaaaaa00000000000000000000000000000000000000 -aaaaaaaaaaaaaaaaaaaaaa00000000000000000000000000000000000000 -aaaaaaaaaaaaaaaaaaaaaa00000000000000000000000000000000000000 --->8-- diff --git a/tests/extmod/framebuf_polygon.py b/tests/extmod/framebuf_polygon.py deleted file mode 100644 index 03130b3bf0fab..0000000000000 --- a/tests/extmod/framebuf_polygon.py +++ /dev/null @@ -1,222 +0,0 @@ -import sys - -try: - import framebuf - from array import array -except ImportError: - print("SKIP") - raise SystemExit - - -# TODO: poly needs functions that aren't in dynruntime.h yet. -if not hasattr(framebuf.FrameBuffer, "poly"): - print("SKIP") - raise SystemExit - - -def print_buffer(buffer, width, height): - for row in range(height): - for col in range(width): - val = buffer[(row * width) + col] - sys.stdout.write(" {:02x}".format(val) if val else " ··") - sys.stdout.write("\n") - - -buf = bytearray(70 * 70) - -w = 30 -h = 25 -fbuf = framebuf.FrameBuffer(buf, w, h, framebuf.GS8) -col = 0xFF -col_fill = 0x99 - -# This describes a arbitrary polygon (this happens to be a concave polygon in -# the shape of an upper-case letter 'M'). -poly = array( - "h", - ( - 0, - 20, - 3, - 20, - 3, - 10, - 6, - 17, - 9, - 10, - 9, - 20, - 12, - 20, - 12, - 3, - 9, - 3, - 6, - 10, - 3, - 3, - 0, - 3, - ), -) -# This describes the same polygon, but the points are in reverse order -# (it shouldn't matter if the polygon has clockwise or anti-clockwise -# winding). Also defined as a bytes instead of array. -poly_reversed = bytes( - ( - 0, - 3, - 3, - 3, - 6, - 10, - 9, - 3, - 12, - 3, - 12, - 20, - 9, - 20, - 9, - 10, - 6, - 17, - 3, - 10, - 3, - 20, - 0, - 20, - ) -) - -# Draw the line polygon (at the origin) and the reversed-order polygon (offset). -fbuf.fill(0) -fbuf.poly(0, 0, poly, col) -fbuf.poly(15, -2, poly_reversed, col) -print_buffer(buf, w, h) -print() - -# Same but filled. -fbuf.fill(0) -fbuf.poly(0, 0, poly, col_fill, True) -fbuf.poly(15, -2, poly_reversed, col_fill, True) -print_buffer(buf, w, h) -print() - -# Draw the fill then the outline to ensure that no fill goes outside the outline. -fbuf.fill(0) -fbuf.poly(0, 0, poly, col_fill, True) -fbuf.poly(0, 0, poly, col) -fbuf.poly(15, -2, poly, col_fill, True) -fbuf.poly(15, -2, poly, col) -print_buffer(buf, w, h) -print() - -# Draw the outline then the fill to ensure the fill completely covers the outline. -fbuf.fill(0) -fbuf.poly(0, 0, poly, col) -fbuf.poly(0, 0, poly, col_fill, True) -fbuf.poly(15, -2, poly, col) -fbuf.poly(15, -2, poly, col_fill, True) -print_buffer(buf, w, h) -print() - -# Draw polygons that will go out of bounds at each of the edges. -for x, y in ( - ( - -8, - -8, - ), - ( - 24, - -6, - ), - ( - 20, - 12, - ), - ( - -2, - 10, - ), -): - fbuf.fill(0) - fbuf.poly(x, y, poly, col) - print_buffer(buf, w, h) - print() - fbuf.fill(0) - fbuf.poly(x, y, poly_reversed, col, True) - print_buffer(buf, w, h) - print() - -# Edge cases: These two lists describe self-intersecting polygons -poly_hourglass = array("h", (0, 0, 9, 0, 0, 19, 9, 19)) -poly_star = array("h", (7, 0, 3, 18, 14, 5, 0, 5, 11, 18)) - -# As before, fill then outline. -fbuf.fill(0) -fbuf.poly(0, 2, poly_hourglass, col_fill, True) -fbuf.poly(0, 2, poly_hourglass, col) -fbuf.poly(12, 2, poly_star, col_fill, True) -fbuf.poly(12, 2, poly_star, col) -print_buffer(buf, w, h) -print() - -# Outline then fill. -fbuf.fill(0) -fbuf.poly(0, 2, poly_hourglass, col) -fbuf.poly(0, 2, poly_hourglass, col_fill, True) -fbuf.poly(12, 2, poly_star, col) -fbuf.poly(12, 2, poly_star, col_fill, True) -print_buffer(buf, w, h) -print() - -# Edge cases: These are "degenerate" polygons. -poly_empty = array("h") # Will draw nothing at all. -poly_one = array("h", (20, 20)) # Will draw a single point. -poly_two = array("h", (10, 10, 5, 5)) # Will draw a single line. -poly_wrong_length = array("h", (2, 2, 4)) # Will round down to one point. - -fbuf.fill(0) -fbuf.poly(0, 0, poly_empty, col) -fbuf.poly(0, 0, poly_one, col) -fbuf.poly(0, 0, poly_two, col) -fbuf.poly(0, 0, poly_wrong_length, col) -print_buffer(buf, w, h) -print() - -# A shape with a horizontal overhang. -poly_overhang = array("h", (0, 0, 0, 5, 5, 5, 5, 10, 10, 10, 10, 0)) - -fbuf.fill(0) -fbuf.poly(0, 0, poly_overhang, col) -fbuf.poly(0, 0, poly_overhang, col_fill, True) -print_buffer(buf, w, h) -print() - -fbuf.fill(0) -fbuf.poly(0, 0, poly_overhang, col_fill, True) -fbuf.poly(0, 0, poly_overhang, col) -print_buffer(buf, w, h) -print() - -# Triangles -w = 70 -h = 70 -fbuf = framebuf.FrameBuffer(buf, w, h, framebuf.GS8) -t1 = array("h", [40, 0, 20, 68, 62, 40]) -t2 = array("h", [40, 0, 0, 16, 20, 68]) - -fbuf.fill(0) -fbuf.poly(0, 0, t1, 0xFF, False) -fbuf.poly(0, 0, t2, 0xFF, False) -print_buffer(buf, w, h) - -fbuf.fill(0) -fbuf.poly(0, 0, t1, 0xFF, True) -fbuf.poly(0, 0, t2, 0xFF, True) -print_buffer(buf, w, h) diff --git a/tests/extmod/framebuf_polygon.py.exp b/tests/extmod/framebuf_polygon.py.exp deleted file mode 100644 index 9b4801c788a5c..0000000000000 --- a/tests/extmod/framebuf_polygon.py.exp +++ /dev/null @@ -1,582 +0,0 @@ - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ff ff ff ff ·· ·· ·· ·· ·· ff ff ff ff ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ff ·· ·· ff ·· ·· ·· ·· ·· ff ·· ·· ff ·· ·· - ff ff ff ff ·· ·· ·· ·· ·· ff ff ff ff ·· ·· ff ·· ·· ·· ff ·· ·· ·· ff ·· ·· ·· ff ·· ·· - ff ·· ·· ff ·· ·· ·· ·· ·· ff ·· ·· ff ·· ·· ff ·· ·· ·· ff ·· ·· ·· ff ·· ·· ·· ff ·· ·· - ff ·· ·· ·· ff ·· ·· ·· ff ·· ·· ·· ff ·· ·· ff ·· ·· ·· ·· ff ·· ff ·· ·· ·· ·· ff ·· ·· - ff ·· ·· ·· ff ·· ·· ·· ff ·· ·· ·· ff ·· ·· ff ·· ·· ·· ·· ff ·· ff ·· ·· ·· ·· ff ·· ·· - ff ·· ·· ·· ·· ff ·· ff ·· ·· ·· ·· ff ·· ·· ff ·· ·· ·· ·· ·· ff ·· ·· ·· ·· ·· ff ·· ·· - ff ·· ·· ·· ·· ff ·· ff ·· ·· ·· ·· ff ·· ·· ff ·· ·· ff ·· ·· ff ·· ·· ff ·· ·· ff ·· ·· - ff ·· ·· ·· ·· ·· ff ·· ·· ·· ·· ·· ff ·· ·· ff ·· ·· ff ·· ·· ·· ·· ·· ff ·· ·· ff ·· ·· - ff ·· ·· ff ·· ·· ff ·· ·· ff ·· ·· ff ·· ·· ff ·· ·· ff ff ·· ·· ·· ff ff ·· ·· ff ·· ·· - ff ·· ·· ff ·· ·· ·· ·· ·· ff ·· ·· ff ·· ·· ff ·· ·· ff ff ·· ·· ·· ff ff ·· ·· ff ·· ·· - ff ·· ·· ff ff ·· ·· ·· ff ff ·· ·· ff ·· ·· ff ·· ·· ff ·· ff ·· ff ·· ff ·· ·· ff ·· ·· - ff ·· ·· ff ff ·· ·· ·· ff ff ·· ·· ff ·· ·· ff ·· ·· ff ·· ff ·· ff ·· ff ·· ·· ff ·· ·· - ff ·· ·· ff ·· ff ·· ff ·· ff ·· ·· ff ·· ·· ff ·· ·· ff ·· ·· ff ·· ·· ff ·· ·· ff ·· ·· - ff ·· ·· ff ·· ff ·· ff ·· ff ·· ·· ff ·· ·· ff ·· ·· ff ·· ·· ff ·· ·· ff ·· ·· ff ·· ·· - ff ·· ·· ff ·· ·· ff ·· ·· ff ·· ·· ff ·· ·· ff ·· ·· ff ·· ·· ·· ·· ·· ff ·· ·· ff ·· ·· - ff ·· ·· ff ·· ·· ff ·· ·· ff ·· ·· ff ·· ·· ff ·· ·· ff ·· ·· ·· ·· ·· ff ·· ·· ff ·· ·· - ff ·· ·· ff ·· ·· ·· ·· ·· ff ·· ·· ff ·· ·· ff ff ff ff ·· ·· ·· ·· ·· ff ff ff ff ·· ·· - ff ·· ·· ff ·· ·· ·· ·· ·· ff ·· ·· ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ff ff ff ff ·· ·· ·· ·· ·· ff ff ff ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· 99 99 99 99 ·· ·· ·· ·· ·· 99 99 99 99 ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· 99 99 99 99 ·· ·· ·· ·· ·· 99 99 99 99 ·· ·· - 99 99 99 99 ·· ·· ·· ·· ·· 99 99 99 99 ·· ·· 99 99 99 99 99 ·· ·· ·· 99 99 99 99 99 ·· ·· - 99 99 99 99 ·· ·· ·· ·· ·· 99 99 99 99 ·· ·· 99 99 99 99 99 ·· ·· ·· 99 99 99 99 99 ·· ·· - 99 99 99 99 99 ·· ·· ·· 99 99 99 99 99 ·· ·· 99 99 99 99 99 99 ·· 99 99 99 99 99 99 ·· ·· - 99 99 99 99 99 ·· ·· ·· 99 99 99 99 99 ·· ·· 99 99 99 99 99 99 ·· 99 99 99 99 99 99 ·· ·· - 99 99 99 99 99 99 ·· 99 99 99 99 99 99 ·· ·· 99 99 99 99 99 99 99 99 99 99 99 99 99 ·· ·· - 99 99 99 99 99 99 ·· 99 99 99 99 99 99 ·· ·· 99 99 99 99 99 99 99 99 99 99 99 99 99 ·· ·· - 99 99 99 99 99 99 99 99 99 99 99 99 99 ·· ·· 99 99 99 99 99 99 99 99 99 99 99 99 99 ·· ·· - 99 99 99 99 99 99 99 99 99 99 99 99 99 ·· ·· 99 99 99 99 99 99 99 99 99 99 99 99 99 ·· ·· - 99 99 99 99 99 99 99 99 99 99 99 99 99 ·· ·· 99 99 99 99 99 99 99 99 99 99 99 99 99 ·· ·· - 99 99 99 99 99 99 99 99 99 99 99 99 99 ·· ·· 99 99 99 99 ·· 99 99 99 ·· 99 99 99 99 ·· ·· - 99 99 99 99 99 99 99 99 99 99 99 99 99 ·· ·· 99 99 99 99 ·· 99 99 99 ·· 99 99 99 99 ·· ·· - 99 99 99 99 ·· 99 99 99 ·· 99 99 99 99 ·· ·· 99 99 99 99 ·· ·· 99 ·· ·· 99 99 99 99 ·· ·· - 99 99 99 99 ·· 99 99 99 ·· 99 99 99 99 ·· ·· 99 99 99 99 ·· ·· 99 ·· ·· 99 99 99 99 ·· ·· - 99 99 99 99 ·· ·· 99 ·· ·· 99 99 99 99 ·· ·· 99 99 99 99 ·· ·· ·· ·· ·· 99 99 99 99 ·· ·· - 99 99 99 99 ·· ·· 99 ·· ·· 99 99 99 99 ·· ·· 99 99 99 99 ·· ·· ·· ·· ·· 99 99 99 99 ·· ·· - 99 99 99 99 ·· ·· ·· ·· ·· 99 99 99 99 ·· ·· 99 99 99 99 ·· ·· ·· ·· ·· 99 99 99 99 ·· ·· - 99 99 99 99 ·· ·· ·· ·· ·· 99 99 99 99 ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - 99 99 99 99 ·· ·· ·· ·· ·· 99 99 99 99 ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ff ff ff ff ·· ·· ·· ·· ·· ff ff ff ff ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ff 99 99 ff ·· ·· ·· ·· ·· ff 99 99 ff ·· ·· - ff ff ff ff ·· ·· ·· ·· ·· ff ff ff ff ·· ·· ff 99 99 99 ff ·· ·· ·· ff 99 99 99 ff ·· ·· - ff 99 99 ff ·· ·· ·· ·· ·· ff 99 99 ff ·· ·· ff 99 99 99 ff ·· ·· ·· ff 99 99 99 ff ·· ·· - ff 99 99 99 ff ·· ·· ·· ff 99 99 99 ff ·· ·· ff 99 99 99 99 ff ·· ff 99 99 99 99 ff ·· ·· - ff 99 99 99 ff ·· ·· ·· ff 99 99 99 ff ·· ·· ff 99 99 99 99 ff ·· ff 99 99 99 99 ff ·· ·· - ff 99 99 99 99 ff ·· ff 99 99 99 99 ff ·· ·· ff 99 99 99 99 99 ff 99 99 99 99 99 ff ·· ·· - ff 99 99 99 99 ff ·· ff 99 99 99 99 ff ·· ·· ff 99 99 ff 99 99 ff 99 99 ff 99 99 ff ·· ·· - ff 99 99 99 99 99 ff 99 99 99 99 99 ff ·· ·· ff 99 99 ff 99 99 99 99 99 ff 99 99 ff ·· ·· - ff 99 99 ff 99 99 ff 99 99 ff 99 99 ff ·· ·· ff 99 99 ff ff 99 99 99 ff ff 99 99 ff ·· ·· - ff 99 99 ff 99 99 99 99 99 ff 99 99 ff ·· ·· ff 99 99 ff ff 99 99 99 ff ff 99 99 ff ·· ·· - ff 99 99 ff ff 99 99 99 ff ff 99 99 ff ·· ·· ff 99 99 ff ·· ff 99 ff ·· ff 99 99 ff ·· ·· - ff 99 99 ff ff 99 99 99 ff ff 99 99 ff ·· ·· ff 99 99 ff ·· ff 99 ff ·· ff 99 99 ff ·· ·· - ff 99 99 ff ·· ff 99 ff ·· ff 99 99 ff ·· ·· ff 99 99 ff ·· ·· ff ·· ·· ff 99 99 ff ·· ·· - ff 99 99 ff ·· ff 99 ff ·· ff 99 99 ff ·· ·· ff 99 99 ff ·· ·· ff ·· ·· ff 99 99 ff ·· ·· - ff 99 99 ff ·· ·· ff ·· ·· ff 99 99 ff ·· ·· ff 99 99 ff ·· ·· ·· ·· ·· ff 99 99 ff ·· ·· - ff 99 99 ff ·· ·· ff ·· ·· ff 99 99 ff ·· ·· ff 99 99 ff ·· ·· ·· ·· ·· ff 99 99 ff ·· ·· - ff 99 99 ff ·· ·· ·· ·· ·· ff 99 99 ff ·· ·· ff ff ff ff ·· ·· ·· ·· ·· ff ff ff ff ·· ·· - ff 99 99 ff ·· ·· ·· ·· ·· ff 99 99 ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ff ff ff ff ·· ·· ·· ·· ·· ff ff ff ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· 99 99 99 99 ·· ·· ·· ·· ·· 99 99 99 99 ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· 99 99 99 99 ·· ·· ·· ·· ·· 99 99 99 99 ·· ·· - 99 99 99 99 ·· ·· ·· ·· ·· 99 99 99 99 ·· ·· 99 99 99 99 99 ·· ·· ·· 99 99 99 99 99 ·· ·· - 99 99 99 99 ·· ·· ·· ·· ·· 99 99 99 99 ·· ·· 99 99 99 99 99 ·· ·· ·· 99 99 99 99 99 ·· ·· - 99 99 99 99 99 ·· ·· ·· 99 99 99 99 99 ·· ·· 99 99 99 99 99 99 ·· 99 99 99 99 99 99 ·· ·· - 99 99 99 99 99 ·· ·· ·· 99 99 99 99 99 ·· ·· 99 99 99 99 99 99 ·· 99 99 99 99 99 99 ·· ·· - 99 99 99 99 99 99 ·· 99 99 99 99 99 99 ·· ·· 99 99 99 99 99 99 99 99 99 99 99 99 99 ·· ·· - 99 99 99 99 99 99 ·· 99 99 99 99 99 99 ·· ·· 99 99 99 99 99 99 99 99 99 99 99 99 99 ·· ·· - 99 99 99 99 99 99 99 99 99 99 99 99 99 ·· ·· 99 99 99 99 99 99 99 99 99 99 99 99 99 ·· ·· - 99 99 99 99 99 99 99 99 99 99 99 99 99 ·· ·· 99 99 99 99 99 99 99 99 99 99 99 99 99 ·· ·· - 99 99 99 99 99 99 99 99 99 99 99 99 99 ·· ·· 99 99 99 99 99 99 99 99 99 99 99 99 99 ·· ·· - 99 99 99 99 99 99 99 99 99 99 99 99 99 ·· ·· 99 99 99 99 ·· 99 99 99 ·· 99 99 99 99 ·· ·· - 99 99 99 99 99 99 99 99 99 99 99 99 99 ·· ·· 99 99 99 99 ·· 99 99 99 ·· 99 99 99 99 ·· ·· - 99 99 99 99 ·· 99 99 99 ·· 99 99 99 99 ·· ·· 99 99 99 99 ·· ·· 99 ·· ·· 99 99 99 99 ·· ·· - 99 99 99 99 ·· 99 99 99 ·· 99 99 99 99 ·· ·· 99 99 99 99 ·· ·· 99 ·· ·· 99 99 99 99 ·· ·· - 99 99 99 99 ·· ·· 99 ·· ·· 99 99 99 99 ·· ·· 99 99 99 99 ·· ·· ·· ·· ·· 99 99 99 99 ·· ·· - 99 99 99 99 ·· ·· 99 ·· ·· 99 99 99 99 ·· ·· 99 99 99 99 ·· ·· ·· ·· ·· 99 99 99 99 ·· ·· - 99 99 99 99 ·· ·· ·· ·· ·· 99 99 99 99 ·· ·· 99 99 99 99 ·· ·· ·· ·· ·· 99 99 99 99 ·· ·· - 99 99 99 99 ·· ·· ·· ·· ·· 99 99 99 99 ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - 99 99 99 99 ·· ·· ·· ·· ·· 99 99 99 99 ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - - ·· ·· ·· ·· ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ff ·· ·· ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ff ·· ·· ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ff ff ·· ·· ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ff ff ·· ·· ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ff ·· ·· ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ff ·· ·· ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ff ·· ·· ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ff ·· ·· ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ff ·· ·· ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ff ·· ·· ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ff ff ff ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - - ff ff ff ff ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ff ff ff ff ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ff ff ff ff ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ff ff ff ff ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ff ff ff ff ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ff ff ff ff ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ff ff ff ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ff ff ff ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ff ff ff ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ff ff ff ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ff ff ff ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ff ff ff ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ff ff ff ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ff ·· ·· ·· ff ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ff ·· ·· ·· ·· ff - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ff ·· ·· ·· ·· ff - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ff ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ff ·· ·· ff ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ff ·· ·· ff ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ff ·· ·· ff ff ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ff ·· ·· ff ff ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ff ·· ·· ff ·· ff - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ff ·· ·· ff ·· ff - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ff ·· ·· ff ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ff ·· ·· ff ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ff ·· ·· ff ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ff ·· ·· ff ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ff ff ff ff ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ff ff ff ff ff ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ff ff ff ff ff ff - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ff ff ff ff ff ff - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ff ff ff ff ff ff - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ff ff ff ff ff ff - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ff ff ff ff ff ff - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ff ff ff ff ff ff - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ff ff ff ff ff ff - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ff ff ff ff ·· ff - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ff ff ff ff ·· ff - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ff ff ff ff ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ff ff ff ff ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ff ff ff ff ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ff ff ff ff ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ff ff ff ff ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ff ff ff ff ·· ·· ·· ·· ·· ff - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ff ·· ·· ff ·· ·· ·· ·· ·· ff - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ff ·· ·· ·· ff ·· ·· ·· ff ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ff ·· ·· ·· ff ·· ·· ·· ff ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ff ·· ·· ·· ·· ff ·· ff ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ff ·· ·· ·· ·· ff ·· ff ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ff ·· ·· ·· ·· ·· ff ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ff ·· ·· ff ·· ·· ff ·· ·· ff - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ff ·· ·· ff ·· ·· ·· ·· ·· ff - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ff ·· ·· ff ff ·· ·· ·· ff ff - - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ff ff ff ff ·· ·· ·· ·· ·· ff - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ff ff ff ff ·· ·· ·· ·· ·· ff - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ff ff ff ff ff ·· ·· ·· ff ff - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ff ff ff ff ff ·· ·· ·· ff ff - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ff ff ff ff ff ff ·· ff ff ff - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ff ff ff ff ff ff ·· ff ff ff - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ff ff ff ff ff ff ff ff ff ff - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ff ff ff ff ff ff ff ff ff ff - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ff ff ff ff ff ff ff ff ff ff - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ff ff ff ff ff ff ff ff ff ff - - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ff ff ·· ·· ·· ·· ·· ff ff ff ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ff ·· ·· ·· ·· ·· ff ·· ·· ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ff ·· ·· ·· ff ·· ·· ·· ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ff ·· ·· ·· ff ·· ·· ·· ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ff ·· ff ·· ·· ·· ·· ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ff ·· ff ·· ·· ·· ·· ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ff ·· ·· ·· ·· ·· ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ff ·· ·· ff ·· ·· ff ·· ·· ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ff ·· ·· ·· ·· ·· ff ·· ·· ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ff ff ·· ·· ·· ff ff ·· ·· ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ff ff ·· ·· ·· ff ff ·· ·· ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ff ·· ff ·· ff ·· ff ·· ·· ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ff ff ·· ·· ·· ·· ·· ff ff ff ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ff ff ·· ·· ·· ·· ·· ff ff ff ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ff ff ff ·· ·· ·· ff ff ff ff ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ff ff ff ·· ·· ·· ff ff ff ff ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ff ff ff ff ·· ff ff ff ff ff ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ff ff ff ff ·· ff ff ff ff ff ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ff ff ff ff ff ff ff ff ff ff ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ff ff ff ff ff ff ff ff ff ff ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ff ff ff ff ff ff ff ff ff ff ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ff ff ff ff ff ff ff ff ff ff ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ff ff ff ff ff ff ff ff ff ff ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ff ff ·· ff ff ff ·· ff ff ff ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ff ff ff ff ff ff ff ff ff ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ff 99 99 99 99 99 99 99 99 ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ff 99 99 99 99 99 99 ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ff 99 99 99 99 99 99 ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ff 99 ff ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ff 99 99 99 99 ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ff 99 ff ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ff 99 99 99 99 ff ·· ·· ·· ·· ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ·· ·· ·· - ·· ·· ·· ff 99 99 ff ·· ·· ·· ·· ·· ·· ff 99 99 99 99 ff ·· ff 99 99 99 99 ff ·· ·· ·· ·· - ·· ·· ·· ff 99 99 ff ·· ·· ·· ·· ·· ·· ·· ff 99 99 ff ·· ·· ·· ff 99 99 ff ·· ·· ·· ·· ·· - ·· ·· ·· ·· ff ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ff 99 ff ·· ·· ·· ff 99 ff ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ff ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ff 99 ff ·· ·· ·· ff 99 ff ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ff ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ff ff ·· ·· ·· ff ff ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ff ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ff ·· ·· ·· ff ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ff 99 99 ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ff 99 ff ·· ff 99 ff ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ff 99 99 ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ff 99 99 ff 99 99 ff ·· ·· ·· ·· ·· ·· ·· - ·· ·· ff 99 99 99 99 ff ·· ·· ·· ·· ·· ·· ·· ·· ff 99 ff ·· ff 99 ff ·· ·· ·· ·· ·· ·· ·· - ·· ·· ff 99 99 99 99 ff ·· ·· ·· ·· ·· ·· ·· ·· ff 99 ff ·· ff 99 ff ·· ·· ·· ·· ·· ·· ·· - ·· ff 99 99 99 99 99 99 ff ·· ·· ·· ·· ·· ·· ff 99 ff ·· ·· ·· ff 99 ff ·· ·· ·· ·· ·· ·· - ·· ff 99 99 99 99 99 99 ff ·· ·· ·· ·· ·· ·· ff ff ·· ·· ·· ·· ·· ff ff ·· ·· ·· ·· ·· ·· - ff 99 99 99 99 99 99 99 99 ff ·· ·· ·· ·· ·· ff ·· ·· ·· ·· ·· ·· ·· ff ·· ·· ·· ·· ·· ·· - ff ff ff ff ff ff ff ff ff ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - 99 99 99 99 99 99 99 99 99 99 ·· ·· ·· ·· ·· ·· ·· ·· ·· 99 ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - 99 99 99 99 99 99 99 99 99 99 ·· ·· ·· ·· ·· ·· ·· ·· ·· 99 ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· 99 99 99 99 99 99 99 99 ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· 99 ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· 99 99 99 99 99 99 99 99 ·· ·· ·· ·· ·· ·· ·· ·· ·· 99 99 99 ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· 99 99 99 99 99 99 ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· 99 99 99 ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· 99 99 99 99 99 99 ·· ·· ·· ·· 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 ·· ·· ·· - ·· ·· ·· 99 99 99 99 ·· ·· ·· ·· ·· ·· 99 99 99 99 99 99 ·· 99 99 99 99 99 99 ·· ·· ·· ·· - ·· ·· ·· 99 99 99 99 ·· ·· ·· ·· ·· ·· ·· 99 99 99 99 ·· ·· ·· 99 99 99 99 ·· ·· ·· ·· ·· - ·· ·· ·· ·· 99 99 ·· ·· ·· ·· ·· ·· ·· ·· ·· 99 99 99 ·· ·· ·· 99 99 99 ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· 99 99 ·· ·· ·· ·· ·· ·· ·· ·· ·· 99 99 99 ·· ·· ·· 99 99 99 ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· 99 99 ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· 99 99 ·· ·· ·· 99 99 ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· 99 99 ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· 99 ·· ·· ·· 99 ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· 99 99 99 99 ·· ·· ·· ·· ·· ·· ·· ·· ·· 99 99 99 ·· 99 99 99 ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· 99 99 99 99 ·· ·· ·· ·· ·· ·· ·· ·· ·· 99 99 99 99 99 99 99 ·· ·· ·· ·· ·· ·· ·· - ·· ·· 99 99 99 99 99 99 ·· ·· ·· ·· ·· ·· ·· ·· 99 99 99 ·· 99 99 99 ·· ·· ·· ·· ·· ·· ·· - ·· ·· 99 99 99 99 99 99 ·· ·· ·· ·· ·· ·· ·· ·· 99 99 99 ·· 99 99 99 ·· ·· ·· ·· ·· ·· ·· - ·· 99 99 99 99 99 99 99 99 ·· ·· ·· ·· ·· ·· 99 99 99 ·· ·· ·· 99 99 99 ·· ·· ·· ·· ·· ·· - ·· 99 99 99 99 99 99 99 99 ·· ·· ·· ·· ·· ·· 99 99 ·· ·· ·· ·· ·· 99 99 ·· ·· ·· ·· ·· ·· - 99 99 99 99 99 99 99 99 99 99 ·· ·· ·· ·· ·· 99 ·· ·· ·· ·· ·· ·· ·· 99 ·· ·· ·· ·· ·· ·· - 99 99 99 99 99 99 99 99 99 99 ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ff ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - - 99 99 99 99 99 99 99 99 99 99 99 ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - 99 99 99 99 99 99 99 99 99 99 99 ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - 99 99 99 99 99 99 99 99 99 99 99 ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - 99 99 99 99 99 99 99 99 99 99 99 ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - 99 99 99 99 99 99 99 99 99 99 99 ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - 99 99 99 99 99 99 99 99 99 99 99 ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· 99 99 99 99 99 99 ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· 99 99 99 99 99 99 ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· 99 99 99 99 99 99 ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· 99 99 99 99 99 99 ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· 99 99 99 99 99 99 ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - - ff ff ff ff ff ff ff ff ff ff ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ff 99 99 99 99 99 99 99 99 99 ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ff 99 99 99 99 99 99 99 99 99 ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ff 99 99 99 99 99 99 99 99 99 ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ff 99 99 99 99 99 99 99 99 99 ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ff ff ff ff ff ff 99 99 99 99 ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ff 99 99 99 99 ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ff 99 99 99 99 ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ff 99 99 99 99 ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ff 99 99 99 99 ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ff ff ff ff ff ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ff ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ff ff ·· ff ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ff ff ff ·· ·· ff ·· ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ff ff ·· ·· ·· ·· ·· ff ·· ·· ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ff ff ff ·· ·· ·· ·· ·· ·· ·· ff ·· ·· ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ff ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ff ·· ·· ·· ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ff ff ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ff ·· ·· ·· ·· ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ff ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ff ·· ·· ·· ·· ·· ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ff ff ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ff ·· ·· ·· ·· ·· ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ff ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ff ·· ·· ·· ·· ·· ·· ·· ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ff ff ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ff ·· ·· ·· ·· ·· ·· ·· ·· ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ff ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ff ·· ·· ·· ·· ·· ·· ·· ·· ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ff ff ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ff ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ff ff ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ff ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ff ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ff ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ff ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ff ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ff ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ff ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ff ff ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ff ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ff ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ff ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ff ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ff ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ff ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ff ·· ·· ·· ·· ·· ·· ·· ·· ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ff ·· ·· ·· ·· ·· ·· ·· ·· ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ff ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ff ·· ·· ·· ·· ·· ·· ·· ·· ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ff ·· ·· ·· ·· ·· ·· ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ff ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ff ·· ·· ·· ·· ·· ·· ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ff ·· ·· ·· ·· ·· ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ff ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ff ·· ·· ·· ·· ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ff ·· ·· ·· ·· ff ·· ·· ·· ·· ·· ·· ·· ff ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ff ·· ·· ·· ff ·· ·· ·· ·· ·· ·· ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ff ·· ·· ff ·· ·· ·· ·· ·· ff ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ff ·· ·· ff ·· ·· ·· ·· ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ff ·· ff ·· ·· ff ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ff ·· ff ·· ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ff ff ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ff ff ff ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ff ff ff ff ff ff ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ff ff ff ff ff ff ff ff ff ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ff ff ff ff ff ff ff ff ff ff ff ff ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ff ff ff ff ff ff ff ff ff ff ff ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ff ff ff ff ff ff ff ff ff ff ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ff ff ff ff ff ff ff ff ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ff ff ff ff ff ff ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ff ff ff ff ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ff ff ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ff ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· - ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· ·· diff --git a/tests/extmod/framebuf_scroll.py b/tests/extmod/framebuf_scroll.py deleted file mode 100644 index db9b6ea1e9649..0000000000000 --- a/tests/extmod/framebuf_scroll.py +++ /dev/null @@ -1,45 +0,0 @@ -try: - import framebuf -except ImportError: - print("SKIP") - raise SystemExit - - -def printbuf(): - print("--8<--") - bytes_per_row = w // 2 - for y in range(h): - for x in range(bytes_per_row): - print("%02x" % buf[(x + y * bytes_per_row)], end="") - print() - print("-->8--") - - -w = 10 -h = 10 -buf = bytearray(w * h // 2) -fbuf = framebuf.FrameBuffer(buf, w, h, framebuf.GS4_HMSB) - - -def prepare_buffer(): - fbuf.fill(0) - fbuf.rect(2, 0, 6, 10, 0x07, True) - fbuf.rect(0, 2, 10, 6, 0x01, True) - - -prepare_buffer() -printbuf() - -fbuf.scroll(5, -1) -printbuf() - -prepare_buffer() -fbuf.scroll(-5, 5) -printbuf() - -prepare_buffer() -# Scrolling by at least the size of buffer, no change to buffer. -fbuf.scroll(15, 7) -fbuf.scroll(10, -1) -fbuf.scroll(1, -10) -printbuf() diff --git a/tests/extmod/framebuf_scroll.py.exp b/tests/extmod/framebuf_scroll.py.exp deleted file mode 100644 index 7e99b275da7c1..0000000000000 --- a/tests/extmod/framebuf_scroll.py.exp +++ /dev/null @@ -1,48 +0,0 @@ ---8<-- -0077777700 -0077777700 -1111111111 -1111111111 -1111111111 -1111111111 -1111111111 -1111111111 -0077777700 -0077777700 --->8-- ---8<-- -0077700777 -0077711111 -1111111111 -1111111111 -1111111111 -1111111111 -1111111111 -1111100777 -0077700777 -0077777700 --->8-- ---8<-- -0077777700 -0077777700 -1111111111 -1111111111 -1111111111 -7770011111 -7770011111 -1111111111 -1111177700 -1111177700 --->8-- ---8<-- -0077777700 -0077777700 -1111111111 -1111111111 -1111111111 -1111111111 -1111111111 -1111111111 -0077777700 -0077777700 --->8-- diff --git a/tests/extmod/msgpack_pack.py b/tests/extmod/msgpack_pack.py index 511ee642dd55a..eccaaa22162e2 100644 --- a/tests/extmod/msgpack_pack.py +++ b/tests/extmod/msgpack_pack.py @@ -6,7 +6,7 @@ raise SystemExit b = BytesIO() -msgpack.pack(False, s) +msgpack.pack(False, b) print(b.getvalue()) b = BytesIO() diff --git a/tests/extmod/msgpack_pack.py.exp b/tests/extmod/msgpack_pack.py.exp new file mode 100644 index 0000000000000..149d436bed92b --- /dev/null +++ b/tests/extmod/msgpack_pack.py.exp @@ -0,0 +1,4 @@ +b'\xc2' +b'\x81\xa1a\x95\xff\x00\x02\x92\x03\xc0\xd1\x00\x80' +Exception +Exception diff --git a/tests/extmod/msgpack_pack.py.ext b/tests/extmod/msgpack_pack.py.ext deleted file mode 100644 index 2f966be069523..0000000000000 --- a/tests/extmod/msgpack_pack.py.ext +++ /dev/null @@ -1,5 +0,0 @@ -b'\xc2' -b'\x82\xa1a\x96\xff\x00\x02\x92\x03\xc0\xd1\x00\x80\xc4\x07abcdefg\xa1b\xd4\x05x' -Exception ExtType -Exception to int -Exception to object diff --git a/tests/extmod/ssl_cadata.py b/tests/extmod/ssl_cadata.py deleted file mode 100644 index e66f6ca825baf..0000000000000 --- a/tests/extmod/ssl_cadata.py +++ /dev/null @@ -1,18 +0,0 @@ -# Test ssl.wrap_socket() with cadata passed in. - -try: - import io - import ssl -except ImportError: - print("SKIP") - raise SystemExit - -# Invalid cadata. -try: - ssl.wrap_socket(io.BytesIO(), cadata=b"!") -except TypeError: - # "cadata" keyword argument is not supported by axtls. - print("SKIP") - raise SystemExit -except ValueError as er: - print(repr(er)) diff --git a/tests/extmod/ssl_cadata.py.exp b/tests/extmod/ssl_cadata.py.exp deleted file mode 100644 index 9f1cf732e33ff..0000000000000 --- a/tests/extmod/ssl_cadata.py.exp +++ /dev/null @@ -1 +0,0 @@ -ValueError('invalid cert',) diff --git a/tests/extmod/ssl_ioctl.py b/tests/extmod/ssl_ioctl.py deleted file mode 100644 index 4db7c2df82aeb..0000000000000 --- a/tests/extmod/ssl_ioctl.py +++ /dev/null @@ -1,31 +0,0 @@ -# Test SSL ioctl method. -# Direct access to this method is only available if MICROPY_UNIX_COVERAGE is enabled. - -try: - import io, ssl - - io.BytesIO -except (ImportError, AttributeError): - print("SKIP") - raise SystemExit - -_MP_STREAM_POLL = 3 -_MP_STREAM_CLOSE = 4 -_MP_STREAM_GET_FILENO = 10 - -s = ssl.wrap_socket(io.BytesIO(), server_side=1, do_handshake=0) - -if not hasattr(s, "ioctl"): - print("SKIP") - raise SystemExit - -# These ioctl's should be unsupported. -for request in (-1, 0, _MP_STREAM_GET_FILENO): - try: - s.ioctl(request, 0) - except OSError: - print(request, "OSError") - -# These ioctl's should be supported. -for request in (_MP_STREAM_CLOSE, _MP_STREAM_POLL, _MP_STREAM_CLOSE): - print(request, s.ioctl(request, 0)) diff --git a/tests/extmod/ssl_ioctl.py.exp b/tests/extmod/ssl_ioctl.py.exp deleted file mode 100644 index 22208b00cc94d..0000000000000 --- a/tests/extmod/ssl_ioctl.py.exp +++ /dev/null @@ -1,6 +0,0 @@ --1 OSError -0 OSError -10 OSError -4 0 -3 32 -4 0 diff --git a/tests/extmod/ssl_poll.py b/tests/extmod/ssl_poll.py deleted file mode 100644 index 347e5f7d37a42..0000000000000 --- a/tests/extmod/ssl_poll.py +++ /dev/null @@ -1,196 +0,0 @@ -try: - import select - import ssl - import io - import binascii -except ImportError: - print("SKIP") - raise SystemExit - -from micropython import const - -_MP_STREAM_POLL_RD = const(0x0001) -_MP_STREAM_POLL_WR = const(0x0004) -_MP_STREAM_POLL_NVAL = const(0x0020) -_MP_STREAM_POLL = const(3) -_MP_STREAM_CLOSE = const(4) - - -# This self-signed key/cert pair is randomly generated and to be used for -# testing/demonstration only. You should always generate your own key/cert. -key = binascii.unhexlify( - b"3082013b020100024100cc20643fd3d9c21a0acba4f48f61aadd675f52175a9dcf07fbef" - b"610a6a6ba14abb891745cd18a1d4c056580d8ff1a639460f867013c8391cdc9f2e573b0f" - b"872d0203010001024100bb17a54aeb3dd7ae4edec05e775ca9632cf02d29c2a089b563b0" - b"d05cdf95aeca507de674553f28b4eadaca82d5549a86058f9996b07768686a5b02cb240d" - b"d9f1022100f4a63f5549e817547dca97b5c658038e8593cb78c5aba3c4642cc4cd031d86" - b"8f022100d598d870ffe4a34df8de57047a50b97b71f4d23e323f527837c9edae88c79483" - b"02210098560c89a70385c36eb07fd7083235c4c1184e525d838aedf7128958bedfdbb102" - b"2051c0dab7057a8176ca966f3feb81123d4974a733df0f958525f547dfd1c271f9022044" - b"6c2cafad455a671a8cf398e642e1be3b18a3d3aec2e67a9478f83c964c4f1f" -) -cert = binascii.unhexlify( - b"308201d53082017f020203e8300d06092a864886f70d01010505003075310b3009060355" - b"0406130258583114301206035504080c0b54686550726f76696e63653110300e06035504" - b"070c075468654369747931133011060355040a0c0a436f6d70616e7958595a3113301106" - b"0355040b0c0a436f6d70616e7958595a3114301206035504030c0b546865486f73744e61" - b"6d65301e170d3139313231383033333935355a170d3239313231353033333935355a3075" - b"310b30090603550406130258583114301206035504080c0b54686550726f76696e636531" - b"10300e06035504070c075468654369747931133011060355040a0c0a436f6d70616e7958" - b"595a31133011060355040b0c0a436f6d70616e7958595a3114301206035504030c0b5468" - b"65486f73744e616d65305c300d06092a864886f70d0101010500034b003048024100cc20" - b"643fd3d9c21a0acba4f48f61aadd675f52175a9dcf07fbef610a6a6ba14abb891745cd18" - b"a1d4c056580d8ff1a639460f867013c8391cdc9f2e573b0f872d0203010001300d06092a" - b"864886f70d0101050500034100b0513fe2829e9ecbe55b6dd14c0ede7502bde5d46153c8" - b"e960ae3ebc247371b525caeb41bbcf34686015a44c50d226e66aef0a97a63874ca5944ef" - b"979b57f0b3" -) - - -class _Pipe(io.IOBase): - def __init__(self): - self._other = None - self.block_reads = False - self.block_writes = False - - self.write_buffers = [] - self.last_poll_arg = None - - def readinto(self, buf): - if self.block_reads or len(self._other.write_buffers) == 0: - return None - - read_buf = self._other.write_buffers[0] - l = min(len(buf), len(read_buf)) - buf[:l] = read_buf[:l] - if l == len(read_buf): - self._other.write_buffers.pop(0) - else: - self._other.write_buffers[0] = read_buf[l:] - return l - - def write(self, buf): - if self.block_writes: - return None - - self.write_buffers.append(memoryview(bytes(buf))) - return len(buf) - - def ioctl(self, request, arg): - if request == _MP_STREAM_POLL: - self.last_poll_arg = arg - ret = 0 - if arg & _MP_STREAM_POLL_RD: - if not self.block_reads and self._other.write_buffers: - ret |= _MP_STREAM_POLL_RD - if arg & _MP_STREAM_POLL_WR: - if not self.block_writes: - ret |= _MP_STREAM_POLL_WR - return ret - - elif request == _MP_STREAM_CLOSE: - return 0 - - raise NotImplementedError() - - @classmethod - def new_pair(cls): - p1 = cls() - p2 = cls() - p1._other = p2 - p2._other = p1 - return p1, p2 - - -def assert_poll(s, i, arg, expected_arg, expected_ret): - ret = s.ioctl(_MP_STREAM_POLL, arg) - assert i.last_poll_arg == expected_arg - i.last_poll_arg = None - assert ret == expected_ret - - -def assert_raises(cb, *args, **kwargs): - try: - cb(*args, **kwargs) - raise AssertionError("should have raised") - except Exception as exc: - pass - - -client_io, server_io = _Pipe.new_pair() - -client_io.block_reads = True -client_io.block_writes = True -client_sock = ssl.wrap_socket(client_io, do_handshake=False) - -server_sock = ssl.wrap_socket(server_io, key=key, cert=cert, server_side=True, do_handshake=False) - -# Do a test read, at this point the TLS handshake wants to write, -# so it returns None: -assert client_sock.read(128) is None - -# Polling for either read or write actually check if the underlying socket can write: -assert_poll(client_sock, client_io, _MP_STREAM_POLL_RD, _MP_STREAM_POLL_WR, 0) -assert_poll(client_sock, client_io, _MP_STREAM_POLL_WR, _MP_STREAM_POLL_WR, 0) - -# Mark the socket as writable, and do another test read: -client_io.block_writes = False -assert client_sock.read(128) is None - -# The client wrote the CLIENT_HELLO message -assert len(client_io.write_buffers) == 1 - -# At this point the TLS handshake wants to read, but we don't know that yet: -assert_poll(client_sock, client_io, _MP_STREAM_POLL_RD, _MP_STREAM_POLL_RD, 0) -assert_poll(client_sock, client_io, _MP_STREAM_POLL_WR, _MP_STREAM_POLL_WR, _MP_STREAM_POLL_WR) - -# Do a test write -client_sock.write(b"foo") - -# Now we know that we want to read: -assert_poll(client_sock, client_io, _MP_STREAM_POLL_RD, _MP_STREAM_POLL_RD, 0) -assert_poll(client_sock, client_io, _MP_STREAM_POLL_WR, _MP_STREAM_POLL_RD, 0) - -# Unblock reads and nudge the two sockets: -client_io.block_reads = False -while server_io.write_buffers or client_io.write_buffers: - if server_io.write_buffers: - assert client_sock.read(128) is None - if client_io.write_buffers: - assert server_sock.read(128) is None - -# At this point, the handshake is done, try writing data: -client_sock.write(b"foo") -assert server_sock.read(3) == b"foo" - -# Test reading partial data: -client_sock.write(b"foobar") -assert server_sock.read(3) == b"foo" -server_io.block_reads = True -assert_poll( - server_sock, server_io, _MP_STREAM_POLL_RD, None, _MP_STREAM_POLL_RD -) # Did not go to the socket, just consumed buffered data -assert server_sock.read(3) == b"bar" - - -# Polling on a closed socket errors out: -client_io, _ = _Pipe.new_pair() -client_sock = ssl.wrap_socket(client_io, do_handshake=False) -client_sock.close() -assert_poll( - client_sock, client_io, _MP_STREAM_POLL_RD, None, _MP_STREAM_POLL_NVAL -) # Did not go to the socket - - -# Errors propagates to poll: -client_io, server_io = _Pipe.new_pair() -client_sock = ssl.wrap_socket(client_io, do_handshake=False) - -# The server returns garbage: -server_io.write(b"fooba") # Needs to be exactly 5 bytes - -assert_poll(client_sock, client_io, _MP_STREAM_POLL_RD, _MP_STREAM_POLL_RD, _MP_STREAM_POLL_RD) -assert_raises(client_sock.read, 128) -assert_poll( - client_sock, client_io, _MP_STREAM_POLL_RD, None, _MP_STREAM_POLL_NVAL -) # Did not go to the socket diff --git a/tests/extmod/ssl_sslcontext.py b/tests/extmod/ssl_sslcontext.py deleted file mode 100644 index 23ff9c29646c0..0000000000000 --- a/tests/extmod/ssl_sslcontext.py +++ /dev/null @@ -1,25 +0,0 @@ -# Very basic test of ssl.SSLContext class. - -try: - import socket, ssl -except ImportError: - print("SKIP") - raise SystemExit - -# Test constructing with arguments. -ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT) -ssl.SSLContext(ssl.PROTOCOL_TLS_SERVER) - -# Test printing object. -ctx = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT) -print("SSLContext" in str(ctx)) - -# Coverage test for destructor, and calling it twice. -if hasattr(ctx, "__del__"): - ctx.__del__() - ctx.__del__() - -# Test calling .wrap_socket() method, multiple times. -ctx = ssl.SSLContext(ssl.PROTOCOL_TLS_SERVER) -ctx.wrap_socket(socket.socket(), do_handshake_on_connect=False) -ctx.wrap_socket(socket.socket(), do_handshake_on_connect=False) diff --git a/tests/extmod/ssl_sslcontext_micropython.py b/tests/extmod/ssl_sslcontext_micropython.py deleted file mode 100644 index 136fb8a054ed7..0000000000000 --- a/tests/extmod/ssl_sslcontext_micropython.py +++ /dev/null @@ -1,29 +0,0 @@ -# Test MicroPython-specific behaviour of ssl.SSLContext. - -try: - import ssl -except ImportError: - print("SKIP") - raise SystemExit - -# Test constructing without any arguments (in CPython it's a DeprecationWarning). -try: - ssl.SSLContext() -except TypeError: - print("TypeError") - -# Test attributes that don't exist (in CPython new attributes can be added). -# This test is needed for coverage because SSLContext implements a custom attr handler. -ctx = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT) -try: - ctx.does_not_exist -except AttributeError: - print("AttributeError on load") -try: - ctx.does_not_exist = None -except AttributeError: - print("AttributeError on store") -try: - del ctx.does_not_exist -except AttributeError: - print("AttributeError on delete") diff --git a/tests/extmod/ssl_sslcontext_micropython.py.exp b/tests/extmod/ssl_sslcontext_micropython.py.exp deleted file mode 100644 index 21e65258ff2a1..0000000000000 --- a/tests/extmod/ssl_sslcontext_micropython.py.exp +++ /dev/null @@ -1,4 +0,0 @@ -TypeError -AttributeError on load -AttributeError on store -AttributeError on delete diff --git a/tests/extmod/ssl_sslcontext_verify_mode.py b/tests/extmod/ssl_sslcontext_verify_mode.py deleted file mode 100644 index daccc2f4a956b..0000000000000 --- a/tests/extmod/ssl_sslcontext_verify_mode.py +++ /dev/null @@ -1,24 +0,0 @@ -# Test ssl.SSLContext.verify_mode attribute. -# It's not available in the axtls implementation, so has an independent test. - -try: - import ssl -except ImportError: - print("SKIP") - raise SystemExit - -if not hasattr(ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT), "verify_mode"): - print("SKIP") - raise SystemExit - -# Test default verify_mode for server (client default is different in MicroPython). -ctx = ssl.SSLContext(ssl.PROTOCOL_TLS_SERVER) -print(ctx.verify_mode == ssl.CERT_NONE) - -# Test setting and getting verify_mode. -ctx.verify_mode = ssl.CERT_NONE -print(ctx.verify_mode == ssl.CERT_NONE) -ctx.verify_mode = ssl.CERT_OPTIONAL -print(ctx.verify_mode == ssl.CERT_OPTIONAL) -ctx.verify_mode = ssl.CERT_REQUIRED -print(ctx.verify_mode == ssl.CERT_REQUIRED) diff --git a/tests/extmod/time_res.py b/tests/extmod/time_res.py index 548bef1f1747c..b2bb698450d58 100644 --- a/tests/extmod/time_res.py +++ b/tests/extmod/time_res.py @@ -2,7 +2,9 @@ try: import time -except ImportError: + + time.ticks_ms +except (ImportError, AttributeError): print("SKIP") raise SystemExit diff --git a/tests/extmod/uctypes_32bit_intbig.py b/tests/extmod/uctypes_32bit_intbig.py deleted file mode 100644 index 27d33817cf618..0000000000000 --- a/tests/extmod/uctypes_32bit_intbig.py +++ /dev/null @@ -1,53 +0,0 @@ -# This test checks previously known problem values for 32-bit ports. -# It's less useful for 64-bit ports. -try: - import uctypes -except ImportError: - print("SKIP") - raise SystemExit - -buf = bytearray(b"12345678abcd") -struct = uctypes.struct( - uctypes.addressof(buf), - {"f32": uctypes.UINT32 | 0, "f64": uctypes.UINT64 | 4}, - uctypes.LITTLE_ENDIAN, -) - -struct.f32 = 0x7FFFFFFF -print(buf) - -struct.f32 = 0x80000000 -print(buf) - -struct.f32 = 0xFF010203 -print(buf) - -struct.f64 = 0x80000000 -print(buf) - -struct.f64 = 0x80000000 * 2 -print(buf) - -print("=") - -buf = bytearray(b"12345678abcd") -struct = uctypes.struct( - uctypes.addressof(buf), - {"f32": uctypes.UINT32 | 0, "f64": uctypes.UINT64 | 4}, - uctypes.BIG_ENDIAN, -) - -struct.f32 = 0x7FFFFFFF -print(buf) - -struct.f32 = 0x80000000 -print(buf) - -struct.f32 = 0xFF010203 -print(buf) - -struct.f64 = 0x80000000 -print(buf) - -struct.f64 = 0x80000000 * 2 -print(buf) diff --git a/tests/extmod/uctypes_32bit_intbig.py.exp b/tests/extmod/uctypes_32bit_intbig.py.exp deleted file mode 100644 index 1b16ddbc3211b..0000000000000 --- a/tests/extmod/uctypes_32bit_intbig.py.exp +++ /dev/null @@ -1,11 +0,0 @@ -bytearray(b'\xff\xff\xff\x7f5678abcd') -bytearray(b'\x00\x00\x00\x805678abcd') -bytearray(b'\x03\x02\x01\xff5678abcd') -bytearray(b'\x03\x02\x01\xff\x00\x00\x00\x80\x00\x00\x00\x00') -bytearray(b'\x03\x02\x01\xff\x00\x00\x00\x00\x01\x00\x00\x00') -= -bytearray(b'\x7f\xff\xff\xff5678abcd') -bytearray(b'\x80\x00\x00\x005678abcd') -bytearray(b'\xff\x01\x02\x035678abcd') -bytearray(b'\xff\x01\x02\x03\x00\x00\x00\x00\x80\x00\x00\x00') -bytearray(b'\xff\x01\x02\x03\x00\x00\x00\x01\x00\x00\x00\x00') diff --git a/tests/extmod/uctypes_array_assign_le.py b/tests/extmod/uctypes_array_assign_le.py deleted file mode 100644 index b7fcdfb49c059..0000000000000 --- a/tests/extmod/uctypes_array_assign_le.py +++ /dev/null @@ -1,55 +0,0 @@ -try: - import uctypes -except ImportError: - print("SKIP") - raise SystemExit - -desc = { - # arr is array at offset 0, of UINT8 elements, array size is 2 - "arr": (uctypes.ARRAY | 0, uctypes.UINT8 | 2), - # arr2 is array at offset 0, size 2, of structures defined recursively - "arr2": (uctypes.ARRAY | 0, 2, {"b": uctypes.UINT8 | 0}), - "arr3": (uctypes.ARRAY | 2, uctypes.UINT16 | 2), - # aligned - "arr5": (uctypes.ARRAY | 0, uctypes.UINT32 | 1), - # unaligned - "arr6": (uctypes.ARRAY | 1, uctypes.UINT32 | 1), - "arr7": (uctypes.ARRAY | 0, 1, {"l": uctypes.UINT32 | 0}), - "arr8": (uctypes.ARRAY | 1, 1, {"l": uctypes.UINT32 | 0}), -} - -data = bytearray(6) - -S = uctypes.struct(uctypes.addressof(data), desc, uctypes.LITTLE_ENDIAN) - -# assign byte -S.arr[0] = 0x11 -print(hex(S.arr[0])) -assert hex(S.arr[0]) == "0x11" - -# assign word -S.arr3[0] = 0x2233 -print(hex(S.arr3[0])) -assert hex(S.arr3[0]) == "0x2233" - -# assign word, with index -S.arr3[1] = 0x4455 -print(hex(S.arr3[1])) -assert hex(S.arr3[1]) == "0x4455" - -# assign long, aligned -S.arr5[0] = 0x66778899 -print(hex(S.arr5[0])) -assert hex(S.arr5[0]) == "0x66778899" - -print(S.arr5[0] == S.arr7[0].l) -assert S.arr5[0] == S.arr7[0].l - - -# assign long, unaligned -S.arr6[0] = 0xAABBCCDD -print(hex(S.arr6[0])) -assert hex(S.arr6[0]) == "0xaabbccdd" - -print(S.arr6[0] == S.arr8[0].l) -assert S.arr6[0] == S.arr8[0].l diff --git a/tests/extmod/uctypes_array_assign_le.py.exp b/tests/extmod/uctypes_array_assign_le.py.exp deleted file mode 100644 index 8d57bc8ab0539..0000000000000 --- a/tests/extmod/uctypes_array_assign_le.py.exp +++ /dev/null @@ -1,7 +0,0 @@ -0x11 -0x2233 -0x4455 -0x66778899 -True -0xaabbccdd -True diff --git a/tests/extmod/uctypes_array_assign_native_le.py b/tests/extmod/uctypes_array_assign_native_le.py deleted file mode 100644 index d4c27fc4b3f5a..0000000000000 --- a/tests/extmod/uctypes_array_assign_native_le.py +++ /dev/null @@ -1,88 +0,0 @@ -import sys - -try: - import uctypes -except ImportError: - print("SKIP") - raise SystemExit - -if sys.byteorder != "little": - print("SKIP") - raise SystemExit - -desc = { - # arr is array at offset 0, of UINT8 elements, array size is 2 - "arr": (uctypes.ARRAY | 0, uctypes.UINT8 | 2), - # arr2 is array at offset 0, size 2, of structures defined recursively - "arr2": (uctypes.ARRAY | 0, 2, {"b": uctypes.UINT8 | 0}), - "arr3": (uctypes.ARRAY | 2, uctypes.UINT16 | 2), - # aligned - "arr5": (uctypes.ARRAY | 0, uctypes.UINT32 | 1), - "arr7": (uctypes.ARRAY | 0, 1, {"l": uctypes.UINT32 | 0}), - "arr8": (uctypes.ARRAY | 0, uctypes.INT8 | 1), - "arr9": (uctypes.ARRAY | 0, uctypes.INT16 | 1), - "arr10": (uctypes.ARRAY | 0, uctypes.INT32 | 1), - "arr11": (uctypes.ARRAY | 0, uctypes.INT64 | 1), - "arr12": (uctypes.ARRAY | 0, uctypes.UINT64 | 1), - "arr13": (uctypes.ARRAY | 1, 1, {"l": {}}), -} - -data = bytearray(8) - -S = uctypes.struct(uctypes.addressof(data), desc) - -# assign byte -S.arr[0] = 0x11 -print(hex(S.arr[0])) -assert hex(S.arr[0]) == "0x11" - -# assign word -S.arr3[0] = 0x2233 -print(hex(S.arr3[0])) -assert hex(S.arr3[0]) == "0x2233" - -# assign word, with index -S.arr3[1] = 0x4455 -print(hex(S.arr3[1])) -assert hex(S.arr3[1]) == "0x4455" - -# assign long, aligned -S.arr5[0] = 0x66778899 -print(hex(S.arr5[0])) -assert hex(S.arr5[0]) == "0x66778899" - -print(S.arr5[0] == S.arr7[0].l) -assert S.arr5[0] == S.arr7[0].l - -# assign int8 -S.arr8[0] = 0x11 -print(hex(S.arr8[0])) -assert hex(S.arr8[0]) == "0x11" - -# assign int16 -S.arr9[0] = 0x1122 -print(hex(S.arr9[0])) -assert hex(S.arr9[0]) == "0x1122" - -# assign int32 -S.arr10[0] = 0x11223344 -print(hex(S.arr10[0])) -assert hex(S.arr10[0]) == "0x11223344" - -# index out of range -try: - print(S.arr8[2]) -except IndexError: - print("IndexError") - -# syntax error in descriptor -try: - S.arr13[0].l = 0x11 -except TypeError: - print("TypeError") - -# operation not supported -try: - S.arr13[0] = 0x11 -except TypeError: - print("TypeError") diff --git a/tests/extmod/uctypes_array_assign_native_le.py.exp b/tests/extmod/uctypes_array_assign_native_le.py.exp deleted file mode 100644 index 9d67b1c777713..0000000000000 --- a/tests/extmod/uctypes_array_assign_native_le.py.exp +++ /dev/null @@ -1,11 +0,0 @@ -0x11 -0x2233 -0x4455 -0x66778899 -True -0x11 -0x1122 -0x11223344 -IndexError -TypeError -TypeError diff --git a/tests/extmod/uctypes_array_assign_native_le_intbig.py b/tests/extmod/uctypes_array_assign_native_le_intbig.py deleted file mode 100644 index f33c63b4ef959..0000000000000 --- a/tests/extmod/uctypes_array_assign_native_le_intbig.py +++ /dev/null @@ -1,42 +0,0 @@ -import sys - -try: - import uctypes -except ImportError: - print("SKIP") - raise SystemExit - -if sys.byteorder != "little": - print("SKIP") - raise SystemExit - -desc = { - # arr is array at offset 0, of UINT8 elements, array size is 2 - "arr": (uctypes.ARRAY | 0, uctypes.UINT8 | 2), - # arr2 is array at offset 0, size 2, of structures defined recursively - "arr2": (uctypes.ARRAY | 0, 2, {"b": uctypes.UINT8 | 0}), - "arr3": (uctypes.ARRAY | 2, uctypes.UINT16 | 2), - # aligned - "arr5": (uctypes.ARRAY | 0, uctypes.UINT32 | 1), - "arr7": (uctypes.ARRAY | 0, 1, {"l": uctypes.UINT32 | 0}), - "arr8": (uctypes.ARRAY | 0, uctypes.INT8 | 1), - "arr9": (uctypes.ARRAY | 0, uctypes.INT16 | 1), - "arr10": (uctypes.ARRAY | 0, uctypes.INT32 | 1), - "arr11": (uctypes.ARRAY | 0, uctypes.INT64 | 1), - "arr12": (uctypes.ARRAY | 0, uctypes.UINT64 | 1), - "arr13": (uctypes.ARRAY | 1, 1, {"l": {}}), -} - -data = bytearray(8) - -S = uctypes.struct(uctypes.addressof(data), desc) - -# assign int64 -S.arr11[0] = 0x11223344 -print(hex(S.arr11[0])) -assert hex(S.arr11[0]) == "0x11223344" - -# assign uint64 -S.arr12[0] = 0x11223344 -print(hex(S.arr12[0])) -assert hex(S.arr12[0]) == "0x11223344" diff --git a/tests/extmod/uctypes_array_assign_native_le_intbig.py.exp b/tests/extmod/uctypes_array_assign_native_le_intbig.py.exp deleted file mode 100644 index 0394e9ae11e2e..0000000000000 --- a/tests/extmod/uctypes_array_assign_native_le_intbig.py.exp +++ /dev/null @@ -1,2 +0,0 @@ -0x11223344 -0x11223344 diff --git a/tests/extmod/uctypes_array_load_store.py b/tests/extmod/uctypes_array_load_store.py deleted file mode 100644 index 0a82d789605c9..0000000000000 --- a/tests/extmod/uctypes_array_load_store.py +++ /dev/null @@ -1,22 +0,0 @@ -# Test uctypes array, load and store, with array size > 1 - -try: - import uctypes -except ImportError: - print("SKIP") - raise SystemExit - -N = 5 - -for endian in ("NATIVE", "LITTLE_ENDIAN", "BIG_ENDIAN"): - for type_ in ("INT8", "UINT8", "INT16", "UINT16", "INT32", "UINT32", "INT64", "UINT64"): - desc = {"arr": (uctypes.ARRAY | 0, getattr(uctypes, type_) | N)} - sz = uctypes.sizeof(desc) - data = bytearray(sz) - s = uctypes.struct(uctypes.addressof(data), desc, getattr(uctypes, endian)) - for i in range(N): - try: - s.arr[i] = i - 2 - except OverflowError: - print("OverflowError") - print(endian, type_, sz, *(s.arr[i] for i in range(N))) diff --git a/tests/extmod/uctypes_array_load_store.py.exp b/tests/extmod/uctypes_array_load_store.py.exp deleted file mode 100644 index 1e914cd015744..0000000000000 --- a/tests/extmod/uctypes_array_load_store.py.exp +++ /dev/null @@ -1,42 +0,0 @@ -NATIVE INT8 5 -2 -1 0 1 2 -OverflowError -OverflowError -NATIVE UINT8 5 0 0 0 1 2 -NATIVE INT16 10 -2 -1 0 1 2 -NATIVE UINT16 10 65534 65535 0 1 2 -NATIVE INT32 20 -2 -1 0 1 2 -NATIVE UINT32 20 4294967294 4294967295 0 1 2 -NATIVE INT64 40 -2 -1 0 1 2 -NATIVE UINT64 40 18446744073709551614 18446744073709551615 0 1 2 -LITTLE_ENDIAN INT8 5 -2 -1 0 1 2 -OverflowError -OverflowError -LITTLE_ENDIAN UINT8 5 0 0 0 1 2 -LITTLE_ENDIAN INT16 10 -2 -1 0 1 2 -OverflowError -OverflowError -LITTLE_ENDIAN UINT16 10 0 0 0 1 2 -LITTLE_ENDIAN INT32 20 -2 -1 0 1 2 -OverflowError -OverflowError -LITTLE_ENDIAN UINT32 20 0 0 0 1 2 -LITTLE_ENDIAN INT64 40 -2 -1 0 1 2 -OverflowError -OverflowError -LITTLE_ENDIAN UINT64 40 0 0 0 1 2 -BIG_ENDIAN INT8 5 -2 -1 0 1 2 -OverflowError -OverflowError -BIG_ENDIAN UINT8 5 0 0 0 1 2 -BIG_ENDIAN INT16 10 -2 -1 0 1 2 -OverflowError -OverflowError -BIG_ENDIAN UINT16 10 0 0 0 1 2 -BIG_ENDIAN INT32 20 -2 -1 0 1 2 -OverflowError -OverflowError -BIG_ENDIAN UINT32 20 0 0 0 1 2 -BIG_ENDIAN INT64 40 -2 -1 0 1 2 -OverflowError -OverflowError -BIG_ENDIAN UINT64 40 0 0 0 1 2 diff --git a/tests/extmod/uctypes_bytearray.py b/tests/extmod/uctypes_bytearray.py deleted file mode 100644 index 77c93c3766c40..0000000000000 --- a/tests/extmod/uctypes_bytearray.py +++ /dev/null @@ -1,22 +0,0 @@ -try: - import uctypes -except ImportError: - print("SKIP") - raise SystemExit - -desc = { - "arr": (uctypes.ARRAY | 0, uctypes.UINT8 | 2), - "arr2": (uctypes.ARRAY | 2, uctypes.INT8 | 2), -} - -data = bytearray(b"01234567") - -S = uctypes.struct(uctypes.addressof(data), desc, uctypes.LITTLE_ENDIAN) - -# Arrays of UINT8 are accessed as bytearrays -print(S.arr) -# But not INT8, because value range is different -print(type(S.arr2)) - -# convert to buffer -print(bytearray(S)) diff --git a/tests/extmod/uctypes_bytearray.py.exp b/tests/extmod/uctypes_bytearray.py.exp deleted file mode 100644 index 7c84edbb6db55..0000000000000 --- a/tests/extmod/uctypes_bytearray.py.exp +++ /dev/null @@ -1,3 +0,0 @@ -bytearray(b'01') - -bytearray(b'0123') diff --git a/tests/extmod/uctypes_byteat.py b/tests/extmod/uctypes_byteat.py deleted file mode 100644 index 0619d31dc9e89..0000000000000 --- a/tests/extmod/uctypes_byteat.py +++ /dev/null @@ -1,10 +0,0 @@ -try: - import uctypes -except ImportError: - print("SKIP") - raise SystemExit - -data = bytearray(b"01234567") - -print(uctypes.bytes_at(uctypes.addressof(data), 4)) -print(uctypes.bytearray_at(uctypes.addressof(data), 4)) diff --git a/tests/extmod/uctypes_byteat.py.exp b/tests/extmod/uctypes_byteat.py.exp deleted file mode 100644 index e1ae4d0534c95..0000000000000 --- a/tests/extmod/uctypes_byteat.py.exp +++ /dev/null @@ -1,2 +0,0 @@ -b'0123' -bytearray(b'0123') diff --git a/tests/extmod/uctypes_error.py b/tests/extmod/uctypes_error.py deleted file mode 100644 index d42956261589f..0000000000000 --- a/tests/extmod/uctypes_error.py +++ /dev/null @@ -1,43 +0,0 @@ -# test general errors with uctypes - -try: - import uctypes -except ImportError: - print("SKIP") - raise SystemExit - -data = bytearray(b"01234567") - -# del subscr not supported -S = uctypes.struct(uctypes.addressof(data), {}) -try: - del S[0] -except TypeError: - print("TypeError") - -# list is an invalid descriptor -S = uctypes.struct(uctypes.addressof(data), []) -try: - S.x -except TypeError: - print("TypeError") - -# can't access attribute with invalid descriptor -S = uctypes.struct(uctypes.addressof(data), {"x": []}) -try: - S.x -except TypeError: - print("TypeError") - -# can't assign to aggregate -S = uctypes.struct(uctypes.addressof(data), {"x": (uctypes.ARRAY | 0, uctypes.INT8 | 2)}) -try: - S.x = 1 -except TypeError: - print("TypeError") - -# unsupported unary op -try: - hash(S) -except TypeError: - print("TypeError") diff --git a/tests/extmod/uctypes_error.py.exp b/tests/extmod/uctypes_error.py.exp deleted file mode 100644 index f2e9c12f7f942..0000000000000 --- a/tests/extmod/uctypes_error.py.exp +++ /dev/null @@ -1,5 +0,0 @@ -TypeError -TypeError -TypeError -TypeError -TypeError diff --git a/tests/extmod/uctypes_le.py b/tests/extmod/uctypes_le.py deleted file mode 100644 index 466191c27a6fe..0000000000000 --- a/tests/extmod/uctypes_le.py +++ /dev/null @@ -1,92 +0,0 @@ -try: - import uctypes -except ImportError: - print("SKIP") - raise SystemExit - -desc = { - "s0": uctypes.UINT16 | 0, - "sub": ( - 0, - { - "b0": uctypes.UINT8 | 0, - "b1": uctypes.UINT8 | 1, - }, - ), - "arr": (uctypes.ARRAY | 0, uctypes.UINT8 | 2), - "arr2": (uctypes.ARRAY | 0, 2, {"b": uctypes.UINT8 | 0}), - "bitf0": uctypes.BFUINT16 | 0 | 0 << uctypes.BF_POS | 8 << uctypes.BF_LEN, - "bitf1": uctypes.BFUINT16 | 0 | 8 << uctypes.BF_POS | 8 << uctypes.BF_LEN, - "bf0": uctypes.BFUINT16 | 0 | 0 << uctypes.BF_POS | 4 << uctypes.BF_LEN, - "bf1": uctypes.BFUINT16 | 0 | 4 << uctypes.BF_POS | 4 << uctypes.BF_LEN, - "bf2": uctypes.BFUINT16 | 0 | 8 << uctypes.BF_POS | 4 << uctypes.BF_LEN, - "bf3": uctypes.BFUINT16 | 0 | 12 << uctypes.BF_POS | 4 << uctypes.BF_LEN, - "ptr": (uctypes.PTR | 0, uctypes.UINT8), - "ptr2": (uctypes.PTR | 0, {"b": uctypes.UINT8 | 0}), -} - -data = bytearray(b"01") - -S = uctypes.struct(uctypes.addressof(data), desc, uctypes.LITTLE_ENDIAN) - -# print(S) -print(hex(S.s0)) -assert hex(S.s0) == "0x3130" -# print(S.sub.b0) -print(S.sub.b0, S.sub.b1) -assert S.sub.b0, S.sub.b1 == (0x30, 0x31) - -try: - S[0] - assert False, "Can't index struct" -except TypeError: - print("TypeError") - -print("arr:", S.arr[0], S.arr[1]) -assert (S.arr[0], S.arr[1]) == (0x30, 0x31) - -print("arr of struct:", S.arr2[0].b, S.arr2[1].b) -assert (S.arr2[0].b, S.arr2[1].b) == (0x30, 0x31) - - -try: - S.arr[2] - assert False, "Out of bounds index" -except IndexError: - print("IndexError") - -print("bf:", S.bitf0, S.bitf1) -assert (S.bitf0, S.bitf1) == (0x30, 0x31) - -print("bf 4bit:", S.bf3, S.bf2, S.bf1, S.bf0) -assert (S.bf3, S.bf2, S.bf1, S.bf0) == (3, 1, 3, 0) - - -# Write access - -S.sub.b0 = ord("2") -print(data) -assert bytes(data) == b"21" - -S.bf3 = 5 -print(data) -assert bytes(data) == b"2Q" - -desc2 = { - "bf8": uctypes.BFUINT8 | 0 | 0 << uctypes.BF_POS | 4 << uctypes.BF_LEN, - "bf32": uctypes.BFUINT32 | 0 | 20 << uctypes.BF_POS | 4 << uctypes.BF_LEN, -} - -data2 = bytearray(b"0123") - -S2 = uctypes.struct(uctypes.addressof(data2), desc2, uctypes.LITTLE_ENDIAN) - -# bitfield using uint8 as base type -S2.bf8 = 5 -print(data2) -assert bytes(data2) == b"5123" - -# bitfield using uint32 as base type -S2.bf32 = 5 -print(data2) -assert bytes(data2) == b"51R3" diff --git a/tests/extmod/uctypes_le.py.exp b/tests/extmod/uctypes_le.py.exp deleted file mode 100644 index 2598b4eabdc87..0000000000000 --- a/tests/extmod/uctypes_le.py.exp +++ /dev/null @@ -1,12 +0,0 @@ -0x3130 -48 49 -TypeError -arr: 48 49 -arr of struct: 48 49 -IndexError -bf: 48 49 -bf 4bit: 3 1 3 0 -bytearray(b'21') -bytearray(b'2Q') -bytearray(b'5123') -bytearray(b'51R3') diff --git a/tests/extmod/uctypes_le_float.py b/tests/extmod/uctypes_le_float.py deleted file mode 100644 index 5255632c912d7..0000000000000 --- a/tests/extmod/uctypes_le_float.py +++ /dev/null @@ -1,40 +0,0 @@ -try: - import uctypes -except ImportError: - print("SKIP") - raise SystemExit - -desc = { - "f32": uctypes.FLOAT32 | 0, - "f64": uctypes.FLOAT64 | 0, - "uf64": uctypes.FLOAT64 | 2, # unaligned -} - -data = bytearray(10) - -S = uctypes.struct(uctypes.addressof(data), desc, uctypes.LITTLE_ENDIAN) - -S.f32 = 12.34 -print("%.4f" % S.f32) - -S.f64 = 12.34 -print("%.4f" % S.f64) - -S.uf64 = 12.34 -print("%.4f" % S.uf64) - -# array of float/double -desc = { - "af32": (uctypes.ARRAY | 0, uctypes.FLOAT32 | 2), - "af64": (uctypes.ARRAY | 0, uctypes.FLOAT64 | 2), -} -data = bytearray(16) -S = uctypes.struct(uctypes.addressof(data), desc, uctypes.LITTLE_ENDIAN) - -S.af32[0] = 1 -S.af32[1] = 2 -print("%.4f %.4f" % (S.af32[0], S.af32[1]), data) - -S.af64[0] = 1 -S.af64[1] = 2 -print("%.4f %.4f" % (S.af64[0], S.af64[1]), data) diff --git a/tests/extmod/uctypes_le_float.py.exp b/tests/extmod/uctypes_le_float.py.exp deleted file mode 100644 index e93fcb0d97beb..0000000000000 --- a/tests/extmod/uctypes_le_float.py.exp +++ /dev/null @@ -1,5 +0,0 @@ -12.3400 -12.3400 -12.3400 -1.0000 2.0000 bytearray(b'\x00\x00\x80?\x00\x00\x00@\x00\x00\x00\x00\x00\x00\x00\x00') -1.0000 2.0000 bytearray(b'\x00\x00\x00\x00\x00\x00\xf0?\x00\x00\x00\x00\x00\x00\x00@') diff --git a/tests/extmod/uctypes_native_float.py b/tests/extmod/uctypes_native_float.py deleted file mode 100644 index 1fdc658499678..0000000000000 --- a/tests/extmod/uctypes_native_float.py +++ /dev/null @@ -1,17 +0,0 @@ -try: - import uctypes -except ImportError: - print("SKIP") - raise SystemExit - -desc = {"f32": uctypes.FLOAT32 | 0, "f64": uctypes.FLOAT64 | 0} - -data = bytearray(8) - -S = uctypes.struct(uctypes.addressof(data), desc, uctypes.NATIVE) - -S.f32 = 12.34 -print("%.4f" % S.f32) - -S.f64 = 12.34 -print("%.4f" % S.f64) diff --git a/tests/extmod/uctypes_native_float.py.exp b/tests/extmod/uctypes_native_float.py.exp deleted file mode 100644 index 6abf0be70e240..0000000000000 --- a/tests/extmod/uctypes_native_float.py.exp +++ /dev/null @@ -1,2 +0,0 @@ -12.3400 -12.3400 diff --git a/tests/extmod/uctypes_native_le.py b/tests/extmod/uctypes_native_le.py deleted file mode 100644 index 10477e669431a..0000000000000 --- a/tests/extmod/uctypes_native_le.py +++ /dev/null @@ -1,101 +0,0 @@ -# This test is exactly like uctypes_le.py, but uses native structure layout. -# Codepaths for packed vs native structures are different. This test only works -# on little-endian machine (no matter if 32 or 64 bit). -import sys - -try: - import uctypes -except ImportError: - print("SKIP") - raise SystemExit - -if sys.byteorder != "little": - print("SKIP") - raise SystemExit - - -desc = { - "s0": uctypes.UINT16 | 0, - "sub": ( - 0, - { - "b0": uctypes.UINT8 | 0, - "b1": uctypes.UINT8 | 1, - }, - ), - "arr": (uctypes.ARRAY | 0, uctypes.UINT8 | 2), - "arr2": (uctypes.ARRAY | 0, 2, {"b": uctypes.UINT8 | 0}), - "bitf0": uctypes.BFUINT16 | 0 | 0 << uctypes.BF_POS | 8 << uctypes.BF_LEN, - "bitf1": uctypes.BFUINT16 | 0 | 8 << uctypes.BF_POS | 8 << uctypes.BF_LEN, - "bf0": uctypes.BFUINT16 | 0 | 0 << uctypes.BF_POS | 4 << uctypes.BF_LEN, - "bf1": uctypes.BFUINT16 | 0 | 4 << uctypes.BF_POS | 4 << uctypes.BF_LEN, - "bf2": uctypes.BFUINT16 | 0 | 8 << uctypes.BF_POS | 4 << uctypes.BF_LEN, - "bf3": uctypes.BFUINT16 | 0 | 12 << uctypes.BF_POS | 4 << uctypes.BF_LEN, - "ptr": (uctypes.PTR | 0, uctypes.UINT8), - "ptr2": (uctypes.PTR | 0, {"b": uctypes.UINT8 | 0}), -} - -data = bytearray(b"01") - -S = uctypes.struct(uctypes.addressof(data), desc, uctypes.NATIVE) - -# print(S) -print(hex(S.s0)) -assert hex(S.s0) == "0x3130" -# print(S.sub.b0) -print(S.sub.b0, S.sub.b1) -assert S.sub.b0, S.sub.b1 == (0x30, 0x31) - -try: - S[0] - assert False, "Can't index struct" -except TypeError: - print("TypeError") - -print("arr:", S.arr[0], S.arr[1]) -assert (S.arr[0], S.arr[1]) == (0x30, 0x31) - -print("arr of struct:", S.arr2[0].b, S.arr2[1].b) -assert (S.arr2[0].b, S.arr2[1].b) == (0x30, 0x31) - - -try: - S.arr[2] - assert False, "Out of bounds index" -except IndexError: - print("IndexError") - -print("bf:", S.bitf0, S.bitf1) -assert (S.bitf0, S.bitf1) == (0x30, 0x31) - -print("bf 4bit:", S.bf3, S.bf2, S.bf1, S.bf0) -assert (S.bf3, S.bf2, S.bf1, S.bf0) == (3, 1, 3, 0) - -# Write access - -S.sub.b0 = ord("2") -print(data) -assert bytes(data) == b"21" - -S.bf3 = 5 -print(data) -assert bytes(data) == b"2Q" - -desc2 = { - "bf8": uctypes.BFUINT8 | 0 | 0 << uctypes.BF_POS | 4 << uctypes.BF_LEN, - "bf32": uctypes.BFUINT32 | 0 | 20 << uctypes.BF_POS | 4 << uctypes.BF_LEN, -} - -data2 = bytearray(b"0123") - -S2 = uctypes.struct(uctypes.addressof(data2), desc2, uctypes.NATIVE) - -# bitfield using uint8 as base type -S2.bf8 = 5 -print(data2) -assert bytes(data2) == b"5123" - -# bitfield using uint32 as base type -S2.bf32 = 5 -print(data2) -assert bytes(data2) == b"51R3" diff --git a/tests/extmod/uctypes_native_le.py.exp b/tests/extmod/uctypes_native_le.py.exp deleted file mode 100644 index 2598b4eabdc87..0000000000000 --- a/tests/extmod/uctypes_native_le.py.exp +++ /dev/null @@ -1,12 +0,0 @@ -0x3130 -48 49 -TypeError -arr: 48 49 -arr of struct: 48 49 -IndexError -bf: 48 49 -bf 4bit: 3 1 3 0 -bytearray(b'21') -bytearray(b'2Q') -bytearray(b'5123') -bytearray(b'51R3') diff --git a/tests/extmod/uctypes_print.py b/tests/extmod/uctypes_print.py deleted file mode 100644 index 6e0018abc7698..0000000000000 --- a/tests/extmod/uctypes_print.py +++ /dev/null @@ -1,25 +0,0 @@ -# test printing of uctypes objects -try: - import uctypes -except ImportError: - print("SKIP") - raise SystemExit - -# we use an address of "0" because we just want to print something deterministic -# and don't actually need to set/get any values in the struct - -desc = {"arr": (uctypes.ARRAY | 0, uctypes.UINT8 | 1)} -S = uctypes.struct(0, desc) -print(S) - -desc2 = [(uctypes.ARRAY | 0, uctypes.UINT8 | 1)] -S2 = uctypes.struct(0, desc2) -print(S2) - -desc3 = (uctypes.ARRAY | 0, uctypes.UINT8 | 1) -S3 = uctypes.struct(0, desc3) -print(S3) - -desc4 = (uctypes.PTR | 0, uctypes.UINT8 | 1) -S4 = uctypes.struct(0, desc4) -print(S4) diff --git a/tests/extmod/uctypes_print.py.exp b/tests/extmod/uctypes_print.py.exp deleted file mode 100644 index b1c730d44f836..0000000000000 --- a/tests/extmod/uctypes_print.py.exp +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/tests/extmod/uctypes_ptr_le.py b/tests/extmod/uctypes_ptr_le.py deleted file mode 100644 index 5d8094ee48a79..0000000000000 --- a/tests/extmod/uctypes_ptr_le.py +++ /dev/null @@ -1,38 +0,0 @@ -import sys - -try: - import uctypes -except ImportError: - print("SKIP") - raise SystemExit - -if sys.byteorder != "little": - print("SKIP") - raise SystemExit - -desc = { - "ptr": (uctypes.PTR | 0, uctypes.UINT8), - "ptr16": (uctypes.PTR | 0, uctypes.UINT16), - "ptr2": (uctypes.PTR | 0, {"b": uctypes.UINT8 | 0}), -} - -bytes = b"01" - -addr = uctypes.addressof(bytes) -buf = addr.to_bytes(uctypes.sizeof(desc), "little") - -S = uctypes.struct(uctypes.addressof(buf), desc, uctypes.LITTLE_ENDIAN) - -print(addr == int(S.ptr)) -print(addr == int(S.ptr2)) - -print(S.ptr[0]) -assert S.ptr[0] == ord("0") -print(S.ptr[1]) -assert S.ptr[1] == ord("1") -print(hex(S.ptr16[0])) -assert hex(S.ptr16[0]) == "0x3130" -print(S.ptr2[0].b, S.ptr2[1].b) -print(S.ptr2[0].b, S.ptr2[1].b) -print(hex(S.ptr16[0])) -assert (S.ptr2[0].b, S.ptr2[1].b) == (48, 49) diff --git a/tests/extmod/uctypes_ptr_le.py.exp b/tests/extmod/uctypes_ptr_le.py.exp deleted file mode 100644 index 92f6caa06943d..0000000000000 --- a/tests/extmod/uctypes_ptr_le.py.exp +++ /dev/null @@ -1,8 +0,0 @@ -True -True -48 -49 -0x3130 -48 49 -48 49 -0x3130 diff --git a/tests/extmod/uctypes_ptr_native_le.py b/tests/extmod/uctypes_ptr_native_le.py deleted file mode 100644 index 8ca4d2c55cf9c..0000000000000 --- a/tests/extmod/uctypes_ptr_native_le.py +++ /dev/null @@ -1,36 +0,0 @@ -import sys - -try: - import uctypes -except ImportError: - print("SKIP") - raise SystemExit - -if sys.byteorder != "little": - print("SKIP") - raise SystemExit - - -desc = { - "ptr": (uctypes.PTR | 0, uctypes.UINT8), - "ptr16": (uctypes.PTR | 0, uctypes.UINT16), - "ptr2": (uctypes.PTR | 0, {"b": uctypes.UINT8 | 0}), -} - -bytes = b"01" - -addr = uctypes.addressof(bytes) -buf = addr.to_bytes(uctypes.sizeof(desc), "little") - -S = uctypes.struct(uctypes.addressof(buf), desc, uctypes.NATIVE) - -print(S.ptr[0]) -assert S.ptr[0] == ord("0") -print(S.ptr[1]) -assert S.ptr[1] == ord("1") -print(hex(S.ptr16[0])) -assert hex(S.ptr16[0]) == "0x3130" -print(S.ptr2[0].b, S.ptr2[1].b) -print(S.ptr2[0].b, S.ptr2[1].b) -print(hex(S.ptr16[0])) -assert (S.ptr2[0].b, S.ptr2[1].b) == (48, 49) diff --git a/tests/extmod/uctypes_ptr_native_le.py.exp b/tests/extmod/uctypes_ptr_native_le.py.exp deleted file mode 100644 index 30d159edd1bfd..0000000000000 --- a/tests/extmod/uctypes_ptr_native_le.py.exp +++ /dev/null @@ -1,6 +0,0 @@ -48 -49 -0x3130 -48 49 -48 49 -0x3130 diff --git a/tests/extmod/uctypes_sizeof.py b/tests/extmod/uctypes_sizeof.py deleted file mode 100644 index 6e52232e39eba..0000000000000 --- a/tests/extmod/uctypes_sizeof.py +++ /dev/null @@ -1,50 +0,0 @@ -try: - import uctypes -except ImportError: - print("SKIP") - raise SystemExit - -desc = { - # arr is array at offset 0, of UINT8 elements, array size is 2 - "arr": (uctypes.ARRAY | 0, uctypes.UINT8 | 2), - # arr2 is array at offset 0, size 2, of structures defined recursively - "arr2": (uctypes.ARRAY | 0, 2, {"b": uctypes.UINT8 | 0}), - "arr3": (uctypes.ARRAY | 2, uctypes.UINT16 | 2), - "arr4": (uctypes.ARRAY | 0, 2, {"b": uctypes.UINT8 | 0, "w": uctypes.UINT16 | 1}), - "sub": ( - 0, - { - "b1": uctypes.BFUINT8 | 0 | 4 << uctypes.BF_POS | 4 << uctypes.BF_LEN, - "b2": uctypes.BFUINT8 | 0 | 0 << uctypes.BF_POS | 4 << uctypes.BF_LEN, - }, - ), -} - -data = bytearray(b"01234567") - -S = uctypes.struct(uctypes.addressof(data), desc, uctypes.LITTLE_ENDIAN) - -print(uctypes.sizeof(S.arr)) -assert uctypes.sizeof(S.arr) == 2 - -print(uctypes.sizeof(S.arr2)) -assert uctypes.sizeof(S.arr2) == 2 - -print(uctypes.sizeof(S.arr3)) - -try: - print(uctypes.sizeof(S.arr3[0])) -except TypeError: - print("TypeError") - -print(uctypes.sizeof(S.arr4)) -assert uctypes.sizeof(S.arr4) == 6 - -print(uctypes.sizeof(S.sub)) -assert uctypes.sizeof(S.sub) == 1 - -# invalid descriptor -try: - print(uctypes.sizeof([])) -except TypeError: - print("TypeError") diff --git a/tests/extmod/uctypes_sizeof.py.exp b/tests/extmod/uctypes_sizeof.py.exp deleted file mode 100644 index b35b11aa0cea9..0000000000000 --- a/tests/extmod/uctypes_sizeof.py.exp +++ /dev/null @@ -1,7 +0,0 @@ -2 -2 -4 -TypeError -6 -1 -TypeError diff --git a/tests/extmod/uctypes_sizeof_float.py b/tests/extmod/uctypes_sizeof_float.py deleted file mode 100644 index f1a4c88e2d81d..0000000000000 --- a/tests/extmod/uctypes_sizeof_float.py +++ /dev/null @@ -1,10 +0,0 @@ -try: - import uctypes -except ImportError: - print("SKIP") - raise SystemExit - -print(uctypes.sizeof({"f": uctypes.FLOAT32})) -print(uctypes.sizeof({"f": uctypes.FLOAT64})) -print(uctypes.sizeof({"f": (uctypes.ARRAY | 0, uctypes.FLOAT32 | 2)})) -print(uctypes.sizeof({"f": (uctypes.ARRAY | 0, uctypes.FLOAT64 | 2)})) diff --git a/tests/extmod/uctypes_sizeof_float.py.exp b/tests/extmod/uctypes_sizeof_float.py.exp deleted file mode 100644 index 82776b54ab5a0..0000000000000 --- a/tests/extmod/uctypes_sizeof_float.py.exp +++ /dev/null @@ -1,4 +0,0 @@ -4 -8 -8 -16 diff --git a/tests/extmod/uctypes_sizeof_layout.py b/tests/extmod/uctypes_sizeof_layout.py deleted file mode 100644 index c710ecde953fb..0000000000000 --- a/tests/extmod/uctypes_sizeof_layout.py +++ /dev/null @@ -1,27 +0,0 @@ -try: - import uctypes -except ImportError: - print("SKIP") - raise SystemExit - -desc = { - "f1": 0 | uctypes.UINT32, - "f2": 4 | uctypes.UINT8, -} - - -# uctypes.NATIVE is default -print(uctypes.sizeof(desc) == uctypes.sizeof(desc, uctypes.NATIVE)) - -# Here we assume that that we run on a platform with conventional ABI -# (which rounds up structure size based on max alignment). For platforms -# where that doesn't hold, this tests should be just disabled in the runner. -print(uctypes.sizeof(desc, uctypes.NATIVE) > uctypes.sizeof(desc, uctypes.LITTLE_ENDIAN)) - -# When taking sizeof of instantiated structure, layout type param -# is prohibited (because structure already has its layout type). -s = uctypes.struct(0, desc, uctypes.LITTLE_ENDIAN) -try: - uctypes.sizeof(s, uctypes.LITTLE_ENDIAN) -except TypeError: - print("TypeError") diff --git a/tests/extmod/uctypes_sizeof_layout.py.exp b/tests/extmod/uctypes_sizeof_layout.py.exp deleted file mode 100644 index 281f20856effc..0000000000000 --- a/tests/extmod/uctypes_sizeof_layout.py.exp +++ /dev/null @@ -1,3 +0,0 @@ -True -True -TypeError diff --git a/tests/extmod/uctypes_sizeof_native.py b/tests/extmod/uctypes_sizeof_native.py deleted file mode 100644 index 991cd25f52999..0000000000000 --- a/tests/extmod/uctypes_sizeof_native.py +++ /dev/null @@ -1,60 +0,0 @@ -try: - import uctypes -except ImportError: - print("SKIP") - raise SystemExit - -S1 = {} -assert uctypes.sizeof(S1) == 0 - -S2 = {"a": uctypes.UINT8 | 0} -assert uctypes.sizeof(S2) == 1 - -S3 = { - "a": uctypes.UINT8 | 0, - "b": uctypes.UINT8 | 1, -} -assert uctypes.sizeof(S3) == 2 - -S4 = { - "a": uctypes.UINT8 | 0, - "b": uctypes.UINT32 | 4, - "c": uctypes.UINT8 | 8, -} -assert uctypes.sizeof(S4) == 12 - -S5 = { - "a": uctypes.UINT8 | 0, - "b": uctypes.UINT32 | 4, - "c": uctypes.UINT8 | 8, - "d": uctypes.UINT32 | 0, - "sub": ( - 4, - { - "b0": uctypes.UINT8 | 0, - "b1": uctypes.UINT8 | 1, - }, - ), -} - -assert uctypes.sizeof(S5) == 12 - -s5 = uctypes.struct(0, S5) -assert uctypes.sizeof(s5) == 12 -assert uctypes.sizeof(s5.sub) == 2 - -S6 = { - "ptr": (uctypes.PTR | 0, uctypes.UINT8), -} -# As if there're no other arch bitnesses -assert uctypes.sizeof(S6) in (4, 8) - -S7 = { - "arr": (uctypes.ARRAY | 0, uctypes.UINT8 | 5), -} -assert uctypes.sizeof(S7) == 5 - -S8 = { - "arr": (uctypes.ARRAY | 0, 3, {"a": uctypes.UINT32 | 0, "b": uctypes.UINT8 | 4}), -} -assert uctypes.sizeof(S8) == 24 diff --git a/tests/extmod/uctypes_sizeof_od.py b/tests/extmod/uctypes_sizeof_od.py deleted file mode 100644 index 375f05f5e2ce0..0000000000000 --- a/tests/extmod/uctypes_sizeof_od.py +++ /dev/null @@ -1,53 +0,0 @@ -try: - from collections import OrderedDict - import uctypes -except ImportError: - print("SKIP") - raise SystemExit - -desc = OrderedDict( - { - # arr is array at offset 0, of UINT8 elements, array size is 2 - "arr": (uctypes.ARRAY | 0, uctypes.UINT8 | 2), - # arr2 is array at offset 0, size 2, of structures defined recursively - "arr2": (uctypes.ARRAY | 0, 2, {"b": uctypes.UINT8 | 0}), - "arr3": (uctypes.ARRAY | 2, uctypes.UINT16 | 2), - "arr4": (uctypes.ARRAY | 0, 2, {"b": uctypes.UINT8 | 0, "w": uctypes.UINT16 | 1}), - "sub": ( - 0, - { - "b1": uctypes.BFUINT8 | 0 | 4 << uctypes.BF_POS | 4 << uctypes.BF_LEN, - "b2": uctypes.BFUINT8 | 0 | 0 << uctypes.BF_POS | 4 << uctypes.BF_LEN, - }, - ), - } -) - -data = bytearray(b"01234567") - -S = uctypes.struct(uctypes.addressof(data), desc, uctypes.LITTLE_ENDIAN) - -print(uctypes.sizeof(S.arr)) -assert uctypes.sizeof(S.arr) == 2 - -print(uctypes.sizeof(S.arr2)) -assert uctypes.sizeof(S.arr2) == 2 - -print(uctypes.sizeof(S.arr3)) - -try: - print(uctypes.sizeof(S.arr3[0])) -except TypeError: - print("TypeError") - -print(uctypes.sizeof(S.arr4)) -assert uctypes.sizeof(S.arr4) == 6 - -print(uctypes.sizeof(S.sub)) -assert uctypes.sizeof(S.sub) == 1 - -# invalid descriptor -try: - print(uctypes.sizeof([])) -except TypeError: - print("TypeError") diff --git a/tests/extmod/uctypes_sizeof_od.py.exp b/tests/extmod/uctypes_sizeof_od.py.exp deleted file mode 100644 index b35b11aa0cea9..0000000000000 --- a/tests/extmod/uctypes_sizeof_od.py.exp +++ /dev/null @@ -1,7 +0,0 @@ -2 -2 -4 -TypeError -6 -1 -TypeError diff --git a/tests/micropython/meminfo.py.exp b/tests/micropython/meminfo.py.exp index fb9eaa890aae7..54567690767a1 100644 --- a/tests/micropython/meminfo.py.exp +++ b/tests/micropython/meminfo.py.exp @@ -1,10 +1,10 @@ mem: total=\\d\+, current=\\d\+, peak=\\d\+ stack: \\d\+ out of \\d\+ -GC: total: \\d\+, used: \\d\+, free: \\d\+ +GC: total: \\d\+, used: \\d\+, free: \\d\+\(, max new split: \\d\+\)? No. of 1-blocks: \\d\+, 2-blocks: \\d\+, max blk sz: \\d\+, max free sz: \\d\+ mem: total=\\d\+, current=\\d\+, peak=\\d\+ stack: \\d\+ out of \\d\+ -GC: total: \\d\+, used: \\d\+, free: \\d\+ +GC: total: \\d\+, used: \\d\+, free: \\d\+\(, max new split: \\d\+\)? No. of 1-blocks: \\d\+, 2-blocks: \\d\+, max blk sz: \\d\+, max free sz: \\d\+ GC memory layout; from 0x\[0-9a-f\]\+: ######## diff --git a/tests/micropython/native_closure.py b/tests/micropython/native_closure.py deleted file mode 100644 index 8182cfea70ec1..0000000000000 --- a/tests/micropython/native_closure.py +++ /dev/null @@ -1,46 +0,0 @@ -# test native emitter can handle closures correctly - - -# basic closure -@micropython.native -def f(): - x = 1 - - @micropython.native - def g(): - nonlocal x - return x - - return g - - -print(f()()) - - -# closing over an argument -@micropython.native -def f(x): - @micropython.native - def g(): - nonlocal x - return x - - return g - - -print(f(2)()) - - -# closing over an argument and a normal local -@micropython.native -def f(x): - y = 2 * x - - @micropython.native - def g(z): - return x + y + z - - return g - - -print(f(2)(3)) diff --git a/tests/micropython/native_closure.py.exp b/tests/micropython/native_closure.py.exp deleted file mode 100644 index 7f4277240ff33..0000000000000 --- a/tests/micropython/native_closure.py.exp +++ /dev/null @@ -1,3 +0,0 @@ -1 -2 -9 diff --git a/tests/micropython/native_const.py b/tests/micropython/native_const.py deleted file mode 100644 index b48499550e91b..0000000000000 --- a/tests/micropython/native_const.py +++ /dev/null @@ -1,21 +0,0 @@ -# test loading constants in native functions - - -@micropython.native -def f(): - return b"bytes" - - -print(f()) - - -@micropython.native -def f(): - @micropython.native - def g(): - return 123 - - return g - - -print(f()()) diff --git a/tests/micropython/native_const.py.exp b/tests/micropython/native_const.py.exp deleted file mode 100644 index 9002a0c2e5dd6..0000000000000 --- a/tests/micropython/native_const.py.exp +++ /dev/null @@ -1,2 +0,0 @@ -b'bytes' -123 diff --git a/tests/micropython/native_const_intbig.py b/tests/micropython/native_const_intbig.py deleted file mode 100644 index 69bc1d2163d1e..0000000000000 --- a/tests/micropython/native_const_intbig.py +++ /dev/null @@ -1,9 +0,0 @@ -# check loading constants - - -@micropython.native -def f(): - return 123456789012345678901234567890 - - -print(f()) diff --git a/tests/micropython/native_const_intbig.py.exp b/tests/micropython/native_const_intbig.py.exp deleted file mode 100644 index 1d52d220f88a0..0000000000000 --- a/tests/micropython/native_const_intbig.py.exp +++ /dev/null @@ -1 +0,0 @@ -123456789012345678901234567890 diff --git a/tests/micropython/native_for.py b/tests/micropython/native_for.py deleted file mode 100644 index c640a8d08b576..0000000000000 --- a/tests/micropython/native_for.py +++ /dev/null @@ -1,19 +0,0 @@ -# test for native for loops - - -@micropython.native -def f1(n): - for i in range(n): - print(i) - - -f1(4) - - -@micropython.native -def f2(r): - for i in r: - print(i) - - -f2(range(4)) diff --git a/tests/micropython/native_for.py.exp b/tests/micropython/native_for.py.exp deleted file mode 100644 index d4dc73eff36bb..0000000000000 --- a/tests/micropython/native_for.py.exp +++ /dev/null @@ -1,8 +0,0 @@ -0 -1 -2 -3 -0 -1 -2 -3 diff --git a/tests/micropython/native_fun_attrs.py b/tests/micropython/native_fun_attrs.py deleted file mode 100644 index e61c869755403..0000000000000 --- a/tests/micropython/native_fun_attrs.py +++ /dev/null @@ -1,25 +0,0 @@ -# test native function attributes - - -def f(): - pass - - -if not hasattr(f, "__name__"): - print("SKIP") - raise SystemExit - - -@micropython.native -def native_f(): - pass - - -print(type(native_f.__name__)) -print(type(native_f.__globals__)) -print(native_f.__globals__ is globals()) - -try: - native_f.__name__ = None -except AttributeError: - print("AttributeError") diff --git a/tests/micropython/native_fun_attrs.py.exp b/tests/micropython/native_fun_attrs.py.exp deleted file mode 100644 index 8be35e2f697e2..0000000000000 --- a/tests/micropython/native_fun_attrs.py.exp +++ /dev/null @@ -1,4 +0,0 @@ - - -True -AttributeError diff --git a/tests/micropython/native_gen.py b/tests/micropython/native_gen.py deleted file mode 100644 index 7e1ee25bcf452..0000000000000 --- a/tests/micropython/native_gen.py +++ /dev/null @@ -1,58 +0,0 @@ -# test for native generators - - -# simple generator with yield and return -@micropython.native -def gen1(x): - yield x - yield x + 1 - return x + 2 - - -g = gen1(3) -print(next(g)) -print(next(g)) -try: - next(g) -except StopIteration as e: - print(e.args[0]) - - -# using yield from -@micropython.native -def gen2(x): - yield from range(x) - - -print(list(gen2(3))) - - -# catching an exception from .throw() -@micropython.native -def gen3(): - try: - yield 1 - yield 2 - except Exception as er: - print("caught", repr(er)) - yield 3 - - -g = gen3() -print(next(g)) -print(g.throw(ValueError(42))) - - -# responding to .close() -@micropython.native -def gen4(): - try: - yield 1 - except: - print("raising GeneratorExit") - raise GeneratorExit - - -g = gen4() -print(next(g)) -print(g.close()) diff --git a/tests/micropython/native_gen.py.exp b/tests/micropython/native_gen.py.exp deleted file mode 100644 index fba4e558ccc8e..0000000000000 --- a/tests/micropython/native_gen.py.exp +++ /dev/null @@ -1,10 +0,0 @@ -3 -4 -5 -[0, 1, 2] -1 -caught ValueError(42,) -3 -1 -raising GeneratorExit -None diff --git a/tests/micropython/native_misc.py b/tests/micropython/native_misc.py deleted file mode 100644 index f40fcb2407086..0000000000000 --- a/tests/micropython/native_misc.py +++ /dev/null @@ -1,54 +0,0 @@ -# tests for natively compiled functions - - -# basic test -@micropython.native -def native_test(x): - print(1, [], x) - - -native_test(2) - -# check that GC doesn't collect the native function -import gc - -gc.collect() -native_test(3) - - -# native with 2 args -@micropython.native -def f(a, b): - print(a + b) - - -f(1, 2) - - -# native with 3 args -@micropython.native -def f(a, b, c): - print(a + b + c) - - -f(1, 2, 3) - - -# check not operator -@micropython.native -def f(a): - print(not a) - - -f(False) -f(True) - - -# stack settling in branch -@micropython.native -def f(a): - print(1, 2, 3, 4 if a else 5) - - -f(False) -f(True) diff --git a/tests/micropython/native_misc.py.exp b/tests/micropython/native_misc.py.exp deleted file mode 100644 index 8eec04228f043..0000000000000 --- a/tests/micropython/native_misc.py.exp +++ /dev/null @@ -1,8 +0,0 @@ -1 [] 2 -1 [] 3 -3 -6 -True -False -1 2 3 5 -1 2 3 4 diff --git a/tests/micropython/native_try.py b/tests/micropython/native_try.py deleted file mode 100644 index 6a2152b28c71e..0000000000000 --- a/tests/micropython/native_try.py +++ /dev/null @@ -1,48 +0,0 @@ -# test native try handling - - -# basic try-finally -@micropython.native -def f(): - try: - fail - finally: - print("finally") - - -try: - f() -except NameError: - print("NameError") - - -# nested try-except with try-finally -@micropython.native -def f(): - try: - try: - fail - finally: - print("finally") - except NameError: - print("NameError") - - -f() - - -# check that locals written to in try blocks keep their values -@micropython.native -def f(): - a = 100 - try: - print(a) - a = 200 - fail - except NameError: - print(a) - a = 300 - print(a) - - -f() diff --git a/tests/micropython/native_try.py.exp b/tests/micropython/native_try.py.exp deleted file mode 100644 index 96596ce5f5a4f..0000000000000 --- a/tests/micropython/native_try.py.exp +++ /dev/null @@ -1,7 +0,0 @@ -finally -NameError -finally -NameError -100 -200 -300 diff --git a/tests/micropython/native_try_deep.py b/tests/micropython/native_try_deep.py deleted file mode 100644 index 26b9243e03d41..0000000000000 --- a/tests/micropython/native_try_deep.py +++ /dev/null @@ -1,37 +0,0 @@ -# test native try handling - - -# deeply nested try (9 deep) -@micropython.native -def f(): - try: - try: - try: - try: - try: - try: - try: - try: - try: - raise ValueError - finally: - print(8) - finally: - print(7) - finally: - print(6) - finally: - print(5) - finally: - print(4) - finally: - print(3) - finally: - print(2) - finally: - print(1) - except ValueError: - print("ValueError") - - -f() diff --git a/tests/micropython/native_try_deep.py.exp b/tests/micropython/native_try_deep.py.exp deleted file mode 100644 index 84c6beae316b5..0000000000000 --- a/tests/micropython/native_try_deep.py.exp +++ /dev/null @@ -1,9 +0,0 @@ -8 -7 -6 -5 -4 -3 -2 -1 -ValueError diff --git a/tests/micropython/native_while.py b/tests/micropython/native_while.py deleted file mode 100644 index ccf0ae0e03515..0000000000000 --- a/tests/micropython/native_while.py +++ /dev/null @@ -1,13 +0,0 @@ -# test native while loop - - -@micropython.native -def f(n): - i = 0 - while i < n: - print(i) - i += 1 - - -f(2) -f(4) diff --git a/tests/micropython/native_while.py.exp b/tests/micropython/native_while.py.exp deleted file mode 100644 index d95e7f145215d..0000000000000 --- a/tests/micropython/native_while.py.exp +++ /dev/null @@ -1,6 +0,0 @@ -0 -1 -0 -1 -2 -3 diff --git a/tests/micropython/native_with.py b/tests/micropython/native_with.py deleted file mode 100644 index 9c0b98af9038e..0000000000000 --- a/tests/micropython/native_with.py +++ /dev/null @@ -1,37 +0,0 @@ -# test with handling within a native function - - -class C: - def __init__(self): - print("__init__") - - def __enter__(self): - print("__enter__") - - def __exit__(self, a, b, c): - print("__exit__", a, b, c) - - -# basic with -@micropython.native -def f(): - with C(): - print(1) - - -f() - - -# nested with and try-except -@micropython.native -def f(): - try: - with C(): - print(1) - fail - print(2) - except NameError: - print("NameError") - - -f() diff --git a/tests/micropython/native_with.py.exp b/tests/micropython/native_with.py.exp deleted file mode 100644 index 6eef7822fbaf8..0000000000000 --- a/tests/micropython/native_with.py.exp +++ /dev/null @@ -1,9 +0,0 @@ -__init__ -__enter__ -1 -__exit__ None None None -__init__ -__enter__ -1 -__exit__ name 'fail' is not defined None -NameError diff --git a/tests/micropython/viper_addr.py b/tests/micropython/viper_addr.py deleted file mode 100644 index 8e79fadb2a84e..0000000000000 --- a/tests/micropython/viper_addr.py +++ /dev/null @@ -1,43 +0,0 @@ -# test passing addresses to viper - - -@micropython.viper -def get_addr(x: ptr) -> ptr: - return x - - -@micropython.viper -def memset(dest: ptr8, c: int, n: int): - for i in range(n): - dest[i] = c - - -@micropython.viper -def memsum(src: ptr8, n: int) -> int: - s = 0 - for i in range(n): - s += src[i] - return s - - -# create array and get its address -ar = bytearray(b"0000") -addr = get_addr(ar) -print(type(ar)) -print(type(addr)) -print(ar) - -# pass array as an object -memset(ar, ord("1"), len(ar)) -print(ar) - -# pass direct pointer to array buffer -memset(addr, ord("2"), len(ar)) -print(ar) - -# pass direct pointer to array buffer, with offset -memset(addr + 2, ord("3"), len(ar) - 2) -print(ar) - -# pass a read-only bytes object in -print(memsum(b"\x01\x02\x03\x04", 4)) diff --git a/tests/micropython/viper_addr.py.exp b/tests/micropython/viper_addr.py.exp deleted file mode 100644 index 8e08db9a54db9..0000000000000 --- a/tests/micropython/viper_addr.py.exp +++ /dev/null @@ -1,7 +0,0 @@ - - -bytearray(b'0000') -bytearray(b'1111') -bytearray(b'2222') -bytearray(b'2233') -10 diff --git a/tests/micropython/viper_args.py b/tests/micropython/viper_args.py deleted file mode 100644 index 27c73fa795816..0000000000000 --- a/tests/micropython/viper_args.py +++ /dev/null @@ -1,68 +0,0 @@ -# test calling viper functions with different number of args - - -@micropython.viper -def f0(): - print(0) - - -f0() - - -@micropython.viper -def f1(x1: int): - print(x1) - - -f1(1) - - -@micropython.viper -def f2(x1: int, x2: int): - print(x1, x2) - - -f2(1, 2) - - -@micropython.viper -def f3(x1: int, x2: int, x3: int): - print(x1, x2, x3) - - -f3(1, 2, 3) - - -@micropython.viper -def f4(x1: int, x2: int, x3: int, x4: int): - print(x1, x2, x3, x4) - - -f4(1, 2, 3, 4) - - -@micropython.viper -def f5(x1: int, x2: int, x3: int, x4: int, x5: int): - print(x1, x2, x3, x4, x5) - - -f5(1, 2, 3, 4, 5) - - -@micropython.viper -def f6(x1: int, x2: int, x3: int, x4: int, x5: int, x6: int): - print(x1, x2, x3, x4, x5, x6) - - -f6(1, 2, 3, 4, 5, 6) - - -# test compiling *x, **x, * args (currently unsupported at runtime) -@micropython.viper -def f(*x, **y): - pass - - -@micropython.viper -def f(*): - pass diff --git a/tests/micropython/viper_args.py.exp b/tests/micropython/viper_args.py.exp deleted file mode 100644 index 6d64c584a5a29..0000000000000 --- a/tests/micropython/viper_args.py.exp +++ /dev/null @@ -1,7 +0,0 @@ -0 -1 -1 2 -1 2 3 -1 2 3 4 -1 2 3 4 5 -1 2 3 4 5 6 diff --git a/tests/micropython/viper_binop_arith.py b/tests/micropython/viper_binop_arith.py deleted file mode 100644 index 2691404b7b8b7..0000000000000 --- a/tests/micropython/viper_binop_arith.py +++ /dev/null @@ -1,93 +0,0 @@ -# test arithmetic operators - - -@micropython.viper -def add(x: int, y: int): - print(x + y) - print(y + x) - - -add(1, 2) -add(42, 3) -add(-1, 2) -add(-42, -3) - - -@micropython.viper -def sub(x: int, y: int): - print(x - y) - print(y - x) - - -sub(1, 2) -sub(42, 3) -sub(-1, 2) -sub(-42, -3) - - -@micropython.viper -def mul(x: int, y: int): - print(x * y) - print(y * x) - - -mul(0, 1) -mul(1, -1) -mul(1, 2) -mul(8, 3) -mul(-3, 4) -mul(-9, -6) - - -@micropython.viper -def shl(x: int, y: int): - print(x << y) - - -shl(1, 0) -shl(1, 3) -shl(1, 30) -shl(42, 10) -shl(-42, 10) - - -@micropython.viper -def shr(x: int, y: int): - print(x >> y) - - -shr(1, 0) -shr(1, 3) -shr(42, 2) -shr(-42, 2) - - -@micropython.viper -def and_(x: int, y: int): - print(x & y, y & x) - - -and_(1, 0) -and_(1, 3) -and_(0xF0, 0x3F) -and_(-42, 6) - - -@micropython.viper -def or_(x: int, y: int): - print(x | y, y | x) - - -or_(1, 0) -or_(1, 2) -or_(-42, 5) - - -@micropython.viper -def xor(x: int, y: int): - print(x ^ y, y ^ x) - - -xor(1, 0) -xor(1, 2) -xor(-42, 5) diff --git a/tests/micropython/viper_binop_arith.py.exp b/tests/micropython/viper_binop_arith.py.exp deleted file mode 100644 index 156e3aff5b77a..0000000000000 --- a/tests/micropython/viper_binop_arith.py.exp +++ /dev/null @@ -1,47 +0,0 @@ -3 -3 -45 -45 -1 -1 --45 --45 --1 -1 -39 --39 --3 -3 --39 -39 -0 -0 --1 --1 -2 -2 -24 -24 --12 --12 -54 -54 -1 -8 -1073741824 -43008 --43008 -1 -0 -10 --11 -0 0 -1 1 -48 48 -6 6 -1 1 -3 3 --41 -41 -1 1 -3 3 --45 -45 diff --git a/tests/micropython/viper_binop_arith_uint.py b/tests/micropython/viper_binop_arith_uint.py deleted file mode 100644 index e4270a10a79a9..0000000000000 --- a/tests/micropython/viper_binop_arith_uint.py +++ /dev/null @@ -1,32 +0,0 @@ -# test arithmetic operators with uint type - - -@micropython.viper -def add(x: uint, y: uint): - return x + y, y + x - - -print("add") -print(*add(1, 2)) -print(*(x & 0xFFFFFFFF for x in add(-1, -2))) - - -@micropython.viper -def sub(x: uint, y: uint): - return x - y, y - x - - -print("sub") -print(*(x & 0xFFFFFFFF for x in sub(1, 2))) -print(*(x & 0xFFFFFFFF for x in sub(-1, -2))) - - -@micropython.viper -def mul(x: uint, y: uint): - return x * y, y * x - - -print("mul") -print(*mul(2, 3)) -print(*(x & 0xFFFFFFFF for x in mul(2, -3))) -print(*mul(-2, -3)) diff --git a/tests/micropython/viper_binop_arith_uint.py.exp b/tests/micropython/viper_binop_arith_uint.py.exp deleted file mode 100644 index 72f84b716a4dd..0000000000000 --- a/tests/micropython/viper_binop_arith_uint.py.exp +++ /dev/null @@ -1,10 +0,0 @@ -add -3 3 -4294967293 4294967293 -sub -4294967295 1 -1 4294967295 -mul -6 6 -4294967290 4294967290 -6 6 diff --git a/tests/micropython/viper_binop_bitwise_uint.py b/tests/micropython/viper_binop_bitwise_uint.py deleted file mode 100644 index 3bc7ba8d1113f..0000000000000 --- a/tests/micropython/viper_binop_bitwise_uint.py +++ /dev/null @@ -1,58 +0,0 @@ -# test bitwise operators on uint type - - -@micropython.viper -def shl(x: uint, y: uint) -> uint: - return x << y - - -print("shl") -print(shl(1, 0)) -print(shl(1, 30)) -print(shl(-1, 10) & 0xFFFFFFFF) - - -@micropython.viper -def shr(x: uint, y: uint) -> uint: - return x >> y - - -print("shr") -print(shr(1, 0)) -print(shr(16, 3)) -print(shr(-1, 1) in (0x7FFFFFFF, 0x7FFFFFFF_FFFFFFFF)) - - -@micropython.viper -def and_(x: uint, y: uint): - return x & y, y & x - - -print("and") -print(*and_(1, 0)) -print(*and_(1, 3)) -print(*and_(-1, 2)) -print(*(x & 0xFFFFFFFF for x in and_(-1, -2))) - - -@micropython.viper -def or_(x: uint, y: uint): - return x | y, y | x - - -print("or") -print(*or_(1, 0)) -print(*or_(1, 2)) -print(*(x & 0xFFFFFFFF for x in or_(-1, 2))) - - -@micropython.viper -def xor(x: uint, y: uint): - return x ^ y, y ^ x - - -print("xor") -print(*xor(1, 0)) -print(*xor(1, 3)) -print(*(x & 0xFFFFFFFF for x in xor(-1, 3))) -print(*xor(-1, -3)) diff --git a/tests/micropython/viper_binop_bitwise_uint.py.exp b/tests/micropython/viper_binop_bitwise_uint.py.exp deleted file mode 100644 index 3ad6469a2fc78..0000000000000 --- a/tests/micropython/viper_binop_bitwise_uint.py.exp +++ /dev/null @@ -1,22 +0,0 @@ -shl -1 -1073741824 -4294966272 -shr -1 -2 -True -and -0 0 -1 1 -2 2 -4294967294 4294967294 -or -1 1 -3 3 -4294967295 4294967295 -xor -1 1 -2 2 -4294967292 4294967292 -2 2 diff --git a/tests/micropython/viper_binop_comp.py b/tests/micropython/viper_binop_comp.py deleted file mode 100644 index a4c0809c85523..0000000000000 --- a/tests/micropython/viper_binop_comp.py +++ /dev/null @@ -1,22 +0,0 @@ -# test comparison operators -@micropython.viper -def f(x: int, y: int): - if x < y: - print(x, "<", y) - if x > y: - print(x, ">", y) - if x == y: - print(x, "==", y) - if x <= y: - print(x, "<=", y) - if x >= y: - print(x, ">=", y) - if x != y: - print(x, "!=", y) - - -f(1, 1) -f(2, 1) -f(1, 2) -f(2, -1) -f(-2, 1) diff --git a/tests/micropython/viper_binop_comp.py.exp b/tests/micropython/viper_binop_comp.py.exp deleted file mode 100644 index 20a8289310729..0000000000000 --- a/tests/micropython/viper_binop_comp.py.exp +++ /dev/null @@ -1,15 +0,0 @@ -1 == 1 -1 <= 1 -1 >= 1 -2 > 1 -2 >= 1 -2 != 1 -1 < 2 -1 <= 2 -1 != 2 -2 > -1 -2 >= -1 -2 != -1 --2 < 1 --2 <= 1 --2 != 1 diff --git a/tests/micropython/viper_binop_comp_imm.py b/tests/micropython/viper_binop_comp_imm.py deleted file mode 100644 index daab8fcfb51e9..0000000000000 --- a/tests/micropython/viper_binop_comp_imm.py +++ /dev/null @@ -1,10 +0,0 @@ -# comparisons with immediate boundary values -@micropython.viper -def f(a: int): - print(a == -1, a == -255, a == -256, a == -257) - - -f(-1) -f(-255) -f(-256) -f(-257) diff --git a/tests/micropython/viper_binop_comp_imm.py.exp b/tests/micropython/viper_binop_comp_imm.py.exp deleted file mode 100644 index 3da9d09fbced9..0000000000000 --- a/tests/micropython/viper_binop_comp_imm.py.exp +++ /dev/null @@ -1,4 +0,0 @@ -True False False False -False True False False -False False True False -False False False True diff --git a/tests/micropython/viper_binop_comp_uint.py b/tests/micropython/viper_binop_comp_uint.py deleted file mode 100644 index 85aa32c78c733..0000000000000 --- a/tests/micropython/viper_binop_comp_uint.py +++ /dev/null @@ -1,31 +0,0 @@ -# test comparison operators with uint type - - -@micropython.viper -def f(x: uint, y: uint): - if x < y: - print(" <", end="") - if x > y: - print(" >", end="") - if x == y: - print(" ==", end="") - if x <= y: - print(" <=", end="") - if x >= y: - print(" >=", end="") - if x != y: - print(" !=", end="") - - -def test(a, b): - print(a, b, end="") - f(a, b) - print() - - -test(1, 1) -test(2, 1) -test(1, 2) -test(2, -1) -test(-2, 1) -test(-2, -1) diff --git a/tests/micropython/viper_binop_comp_uint.py.exp b/tests/micropython/viper_binop_comp_uint.py.exp deleted file mode 100644 index cacce62b6e380..0000000000000 --- a/tests/micropython/viper_binop_comp_uint.py.exp +++ /dev/null @@ -1,6 +0,0 @@ -1 1 == <= >= -2 1 > >= != -1 2 < <= != -2 -1 < <= != --2 1 > >= != --2 -1 < <= != diff --git a/tests/micropython/viper_binop_divmod.py b/tests/micropython/viper_binop_divmod.py deleted file mode 100644 index 4b74b527d3d00..0000000000000 --- a/tests/micropython/viper_binop_divmod.py +++ /dev/null @@ -1,22 +0,0 @@ -# test floor-division and modulo operators - - -@micropython.viper -def div(x: int, y: int) -> int: - return x // y - - -@micropython.viper -def mod(x: int, y: int) -> int: - return x % y - - -def dm(x, y): - print(div(x, y), mod(x, y)) - - -for x in (-6, 6): - for y in range(-7, 8): - if y == 0: - continue - dm(x, y) diff --git a/tests/micropython/viper_binop_divmod.py.exp b/tests/micropython/viper_binop_divmod.py.exp deleted file mode 100644 index 4fc971d461db9..0000000000000 --- a/tests/micropython/viper_binop_divmod.py.exp +++ /dev/null @@ -1,28 +0,0 @@ -0 -6 -1 0 -1 -1 -1 -2 -2 0 -3 0 -6 0 --6 0 --3 0 --2 0 --2 2 --2 4 --1 0 --1 1 --1 -1 --1 0 --2 -4 --2 -2 --2 0 --3 0 --6 0 -6 0 -3 0 -2 0 -1 2 -1 1 -1 0 -0 6 diff --git a/tests/micropython/viper_binop_multi_comp.py b/tests/micropython/viper_binop_multi_comp.py deleted file mode 100644 index 997c397d4c5e0..0000000000000 --- a/tests/micropython/viper_binop_multi_comp.py +++ /dev/null @@ -1,22 +0,0 @@ -# test multi comparison operators -@micropython.viper -def f(x: int, y: int): - if 0 < x < y: - print(x, "<", y) - if 3 > x > y: - print(x, ">", y) - if 1 == x == y: - print(x, "==", y) - if -2 == x <= y: - print(x, "<=", y) - if 2 == x >= y: - print(x, ">=", y) - if 2 == x != y: - print(x, "!=", y) - - -f(1, 1) -f(2, 1) -f(1, 2) -f(2, -1) -f(-2, 1) diff --git a/tests/micropython/viper_binop_multi_comp.py.exp b/tests/micropython/viper_binop_multi_comp.py.exp deleted file mode 100644 index e5e97874edb7a..0000000000000 --- a/tests/micropython/viper_binop_multi_comp.py.exp +++ /dev/null @@ -1,9 +0,0 @@ -1 == 1 -2 > 1 -2 >= 1 -2 != 1 -1 < 2 -2 > -1 -2 >= -1 -2 != -1 --2 <= 1 diff --git a/tests/micropython/viper_cond.py b/tests/micropython/viper_cond.py deleted file mode 100644 index 752261ff5093c..0000000000000 --- a/tests/micropython/viper_cond.py +++ /dev/null @@ -1,44 +0,0 @@ -# using False as a conditional -@micropython.viper -def f(): - x = False - if x: - pass - else: - print("not x", x) - - -f() - - -# using True as a conditional -@micropython.viper -def f(): - x = True - if x: - print("x", x) - - -f() - - -# using an int as a conditional -@micropython.viper -def g(): - y = 1 - if y: - print("y", y) - - -g() - - -# using an int as a conditional that has the lower 16-bits clear -@micropython.viper -def h(): - z = 0x10000 - if z: - print("z", z) - - -h() diff --git a/tests/micropython/viper_cond.py.exp b/tests/micropython/viper_cond.py.exp deleted file mode 100644 index beacd48fe66f2..0000000000000 --- a/tests/micropython/viper_cond.py.exp +++ /dev/null @@ -1,4 +0,0 @@ -not x False -x True -y 1 -z 65536 diff --git a/tests/micropython/viper_const.py b/tests/micropython/viper_const.py deleted file mode 100644 index 230b282f2352e..0000000000000 --- a/tests/micropython/viper_const.py +++ /dev/null @@ -1,21 +0,0 @@ -# test loading constants in viper functions - - -@micropython.viper -def f(): - return b"bytes" - - -print(f()) - - -@micropython.viper -def f(): - @micropython.viper - def g() -> int: - return 123 - - return g - - -print(f()()) diff --git a/tests/micropython/viper_const.py.exp b/tests/micropython/viper_const.py.exp deleted file mode 100644 index 9002a0c2e5dd6..0000000000000 --- a/tests/micropython/viper_const.py.exp +++ /dev/null @@ -1,2 +0,0 @@ -b'bytes' -123 diff --git a/tests/micropython/viper_const_intbig.py b/tests/micropython/viper_const_intbig.py deleted file mode 100644 index 42574820a3c60..0000000000000 --- a/tests/micropython/viper_const_intbig.py +++ /dev/null @@ -1,9 +0,0 @@ -# check loading constants - - -@micropython.viper -def f(): - return 123456789012345678901234567890 - - -print(f()) diff --git a/tests/micropython/viper_const_intbig.py.exp b/tests/micropython/viper_const_intbig.py.exp deleted file mode 100644 index 1d52d220f88a0..0000000000000 --- a/tests/micropython/viper_const_intbig.py.exp +++ /dev/null @@ -1 +0,0 @@ -123456789012345678901234567890 diff --git a/tests/micropython/viper_error.py b/tests/micropython/viper_error.py deleted file mode 100644 index 80617af0c1f29..0000000000000 --- a/tests/micropython/viper_error.py +++ /dev/null @@ -1,89 +0,0 @@ -# test syntax and type errors specific to viper code generation - - -def test(code): - try: - exec(code) - except (SyntaxError, ViperTypeError, NotImplementedError) as e: - print(repr(e)) - - -# viper: annotations must be identifiers -test("@micropython.viper\ndef f(a:1): pass") -test("@micropython.viper\ndef f() -> 1: pass") - -# unknown type -test("@micropython.viper\ndef f(x:unknown_type): pass") - -# local used before type known -test( - """ -@micropython.viper -def f(): - print(x) - x = 1 -""" -) - -# type mismatch storing to local -test( - """ -@micropython.viper -def f(): - x = 1 - y = [] - x = y -""" -) - -# can't implicitly convert type to bool -test( - """ -@micropython.viper -def f(): - x = ptr(0) - if x: - pass -""" -) - -# incorrect return type -test("@micropython.viper\ndef f() -> int: return []") - -# can't do binary op between incompatible types -test("@micropython.viper\ndef f(): 1 + []") -test("@micropython.viper\ndef f(x:int, y:uint): x < y") - -# can't load -test("@micropython.viper\ndef f(): 1[0]") -test("@micropython.viper\ndef f(): 1[x]") - -# can't store -test("@micropython.viper\ndef f(): 1[0] = 1") -test("@micropython.viper\ndef f(): 1[x] = 1") -test("@micropython.viper\ndef f(x:int): x[0] = x") -test("@micropython.viper\ndef f(x:ptr32): x[0] = None") -test("@micropython.viper\ndef f(x:ptr32): x[x] = None") - -# must raise an object -test("@micropython.viper\ndef f(): raise 1") - -# unary ops not implemented -test("@micropython.viper\ndef f(x:int): +x") -test("@micropython.viper\ndef f(x:int): -x") -test("@micropython.viper\ndef f(x:int): ~x") - -# binary op not implemented -test("@micropython.viper\ndef f(x:uint, y:uint): res = x // y") -test("@micropython.viper\ndef f(x:uint, y:uint): res = x % y") -test("@micropython.viper\ndef f(x:int): res = x in x") - -# yield (from) not implemented -test("@micropython.viper\ndef f(): yield") -test("@micropython.viper\ndef f(): yield from f") - -# passing a ptr to a Python function not implemented -test("@micropython.viper\ndef f(): print(ptr(1))") - -# cast of a casting identifier not implemented -test("@micropython.viper\ndef f(): int(int)") diff --git a/tests/micropython/viper_error.py.exp b/tests/micropython/viper_error.py.exp deleted file mode 100644 index 31c85b1d872af..0000000000000 --- a/tests/micropython/viper_error.py.exp +++ /dev/null @@ -1,27 +0,0 @@ -SyntaxError('annotation must be an identifier',) -SyntaxError('annotation must be an identifier',) -ViperTypeError("unknown type 'unknown_type'",) -ViperTypeError("local 'x' used before type known",) -ViperTypeError("local 'x' has type 'int' but source is 'object'",) -ViperTypeError("can't implicitly convert 'ptr' to 'bool'",) -ViperTypeError("return expected 'int' but got 'object'",) -ViperTypeError("can't do binary op between 'int' and 'object'",) -ViperTypeError('comparison of int and uint',) -ViperTypeError("can't load from 'int'",) -ViperTypeError("can't load from 'int'",) -ViperTypeError("can't store to 'int'",) -ViperTypeError("can't store to 'int'",) -ViperTypeError("can't store to 'int'",) -ViperTypeError("can't store 'None'",) -ViperTypeError("can't store 'None'",) -ViperTypeError('must raise an object',) -ViperTypeError('unary op __pos__ not implemented',) -ViperTypeError('unary op __neg__ not implemented',) -ViperTypeError('unary op __invert__ not implemented',) -ViperTypeError('div/mod not implemented for uint',) -ViperTypeError('div/mod not implemented for uint',) -ViperTypeError('binary op not implemented',) -NotImplementedError('native yield',) -NotImplementedError('native yield',) -NotImplementedError('conversion to object',) -NotImplementedError('casting',) diff --git a/tests/micropython/viper_globals.py b/tests/micropython/viper_globals.py deleted file mode 100644 index 9532dfd895b39..0000000000000 --- a/tests/micropython/viper_globals.py +++ /dev/null @@ -1,22 +0,0 @@ -# test that viper functions capture their globals context - -gl = {} - -exec( - """ -@micropython.viper -def f(): - return x -""", - gl, -) - -# x is not yet in the globals, f should not see it -try: - print(gl["f"]()) -except NameError: - print("NameError") - -# x is in globals, f should now see it -gl["x"] = 123 -print(gl["f"]()) diff --git a/tests/micropython/viper_globals.py.exp b/tests/micropython/viper_globals.py.exp deleted file mode 100644 index 5731b89c1bf50..0000000000000 --- a/tests/micropython/viper_globals.py.exp +++ /dev/null @@ -1,2 +0,0 @@ -NameError -123 diff --git a/tests/micropython/viper_import.py b/tests/micropython/viper_import.py deleted file mode 100644 index 3df23e17a77c1..0000000000000 --- a/tests/micropython/viper_import.py +++ /dev/null @@ -1,15 +0,0 @@ -# test import within viper function - - -@micropython.viper -def f(): - import micropython - - print(micropython.const(1)) - - from micropython import const - - print(const(2)) - - -f() diff --git a/tests/micropython/viper_import.py.exp b/tests/micropython/viper_import.py.exp deleted file mode 100644 index 1191247b6d9a2..0000000000000 --- a/tests/micropython/viper_import.py.exp +++ /dev/null @@ -1,2 +0,0 @@ -1 -2 diff --git a/tests/micropython/viper_misc.py b/tests/micropython/viper_misc.py deleted file mode 100644 index 2659032df6679..0000000000000 --- a/tests/micropython/viper_misc.py +++ /dev/null @@ -1,76 +0,0 @@ -# Miscellaneous viper tests. - -import micropython - - -# viper function taking and returning ints -@micropython.viper -def viper_int(x: int, y: int) -> int: - return x + y + 3 - - -print(viper_int(1, 2)) - - -# viper function taking and returning objects -@micropython.viper -def viper_object(x: object, y: object) -> object: - return x + y - - -print(viper_object(1, 2)) - - -# return None as non-object (should return 0) -@micropython.viper -def viper_ret_none() -> int: - return None - - -print(viper_ret_none()) - - -# return Ellipsis as object -@micropython.viper -def viper_ret_ellipsis() -> object: - return ... - - -print(viper_ret_ellipsis()) - - -# 3 args -@micropython.viper -def viper_3args(a: int, b: int, c: int) -> int: - return a + b + c - - -print(viper_3args(1, 2, 3)) - - -# 4 args -@micropython.viper -def viper_4args(a: int, b: int, c: int, d: int) -> int: - return a + b + c + d - - -print(viper_4args(1, 2, 3, 4)) - - -# a local (should have automatic type int) -@micropython.viper -def viper_local(x: int) -> int: - y = 4 - return x + y - - -print(viper_local(3)) - - -# without type annotation, types should default to object -@micropython.viper -def viper_no_annotation(x, y): - return x * y - - -print(viper_no_annotation(4, 5)) diff --git a/tests/micropython/viper_misc.py.exp b/tests/micropython/viper_misc.py.exp deleted file mode 100644 index 922ceb9fef9b4..0000000000000 --- a/tests/micropython/viper_misc.py.exp +++ /dev/null @@ -1,8 +0,0 @@ -6 -3 -0 -Ellipsis -6 -10 -7 -20 diff --git a/tests/micropython/viper_misc2.py b/tests/micropython/viper_misc2.py deleted file mode 100644 index cc77134bd48c0..0000000000000 --- a/tests/micropython/viper_misc2.py +++ /dev/null @@ -1,22 +0,0 @@ -# Miscellaneous viper tests - - -# Test correct use of registers in load and store -@micropython.viper -def expand(dest: ptr8, source: ptr8, length: int): - n = 0 - for x in range(0, length, 2): - c = source[x] - d = source[x + 1] - dest[n] = (c & 0xE0) | ((c & 0x1C) >> 1) - n += 1 - dest[n] = ((c & 3) << 6) | ((d & 0xE0) >> 4) - n += 1 - dest[n] = ((d & 0x1C) << 3) | ((d & 3) << 2) - n += 1 - - -source = b"\xaa\xaa\xff\xff" -dest = bytearray(len(source) // 2 * 3) -expand(dest, source, len(source)) -print(dest) diff --git a/tests/micropython/viper_misc2.py.exp b/tests/micropython/viper_misc2.py.exp deleted file mode 100644 index eff2f5e41d244..0000000000000 --- a/tests/micropython/viper_misc2.py.exp +++ /dev/null @@ -1 +0,0 @@ -bytearray(b'\xa4\x8aH\xee\xce\xec') diff --git a/tests/micropython/viper_misc3.py b/tests/micropython/viper_misc3.py deleted file mode 100644 index 7b211e5dd8c7d..0000000000000 --- a/tests/micropython/viper_misc3.py +++ /dev/null @@ -1,96 +0,0 @@ -# Miscellaneous viper tests. - -import micropython - - -# a for loop -@micropython.viper -def viper_for(a: int, b: int) -> int: - total = 0 - for x in range(a, b): - total += x - return total - - -print(viper_for(10, 10000)) - - -# accessing a global -@micropython.viper -def viper_access_global(): - global gl - gl = 1 - return gl - - -print(viper_access_global(), gl) - - -# calling print with object and int types -@micropython.viper -def viper_print(x, y: int): - print(x, y + 1) - - -viper_print(1, 2) - - -# convert constants to objects in tuple -@micropython.viper -def viper_tuple_consts(x): - return (x, 1, False, True) - - -print(viper_tuple_consts(0)) - - -# making a tuple from an object and an int -@micropython.viper -def viper_tuple(x, y: int): - return (x, y + 1) - - -print(viper_tuple(1, 2)) - - -# making a list from an object and an int -@micropython.viper -def viper_list(x, y: int): - return [x, y + 1] - - -print(viper_list(1, 2)) - - -# making a set from an object and an int -@micropython.viper -def viper_set(x, y: int): - return {x, y + 1} - - -print(sorted(list(viper_set(1, 2)))) - - -# raising an exception -@micropython.viper -def viper_raise(x: int): - raise OSError(x) - - -try: - viper_raise(1) -except OSError as e: - print(repr(e)) - - -# calling GC after defining the function -@micropython.viper -def viper_gc() -> int: - return 1 - - -print(viper_gc()) -import gc - -gc.collect() -print(viper_gc()) diff --git a/tests/micropython/viper_misc3.py.exp b/tests/micropython/viper_misc3.py.exp deleted file mode 100644 index b12807b2f3217..0000000000000 --- a/tests/micropython/viper_misc3.py.exp +++ /dev/null @@ -1,10 +0,0 @@ -49994955 -1 1 -1 3 -(0, 1, False, True) -(1, 3) -[1, 3] -[1, 3] -OSError(1,) -1 -1 diff --git a/tests/micropython/viper_misc_intbig.py b/tests/micropython/viper_misc_intbig.py deleted file mode 100644 index 91673f2c1087a..0000000000000 --- a/tests/micropython/viper_misc_intbig.py +++ /dev/null @@ -1,12 +0,0 @@ -import micropython - - -# unsigned ints -@micropython.viper -def viper_uint() -> uint: - return uint(-1) - - -import sys - -print(viper_uint() == (sys.maxsize << 1 | 1)) diff --git a/tests/micropython/viper_misc_intbig.py.exp b/tests/micropython/viper_misc_intbig.py.exp deleted file mode 100644 index 0ca95142bb715..0000000000000 --- a/tests/micropython/viper_misc_intbig.py.exp +++ /dev/null @@ -1 +0,0 @@ -True diff --git a/tests/micropython/viper_ptr16_load.py b/tests/micropython/viper_ptr16_load.py deleted file mode 100644 index 30c85d0669934..0000000000000 --- a/tests/micropython/viper_ptr16_load.py +++ /dev/null @@ -1,37 +0,0 @@ -# test loading from ptr16 type -# only works on little endian machines - - -@micropython.viper -def get(src: ptr16) -> int: - return src[0] - - -@micropython.viper -def get1(src: ptr16) -> int: - return src[1] - - -@micropython.viper -def memadd(src: ptr16, n: int) -> int: - sum = 0 - for i in range(n): - sum += src[i] - return sum - - -@micropython.viper -def memadd2(src_in) -> int: - src = ptr16(src_in) - n = int(len(src_in)) >> 1 - sum = 0 - for i in range(n): - sum += src[i] - return sum - - -b = bytearray(b"1234") -print(b) -print(get(b), get1(b)) -print(memadd(b, 2)) -print(memadd2(b)) diff --git a/tests/micropython/viper_ptr16_load.py.exp b/tests/micropython/viper_ptr16_load.py.exp deleted file mode 100644 index 2d86b974c4c4e..0000000000000 --- a/tests/micropython/viper_ptr16_load.py.exp +++ /dev/null @@ -1,4 +0,0 @@ -bytearray(b'1234') -12849 13363 -26212 -26212 diff --git a/tests/micropython/viper_ptr16_store.py b/tests/micropython/viper_ptr16_store.py deleted file mode 100644 index 3ca5a027c0593..0000000000000 --- a/tests/micropython/viper_ptr16_store.py +++ /dev/null @@ -1,41 +0,0 @@ -# test ptr16 type - - -@micropython.viper -def set(dest: ptr16, val: int): - dest[0] = val - - -@micropython.viper -def set1(dest: ptr16, val: int): - dest[1] = val - - -@micropython.viper -def memset(dest: ptr16, val: int, n: int): - for i in range(n): - dest[i] = val - - -@micropython.viper -def memset2(dest_in, val: int): - dest = ptr16(dest_in) - n = int(len(dest_in)) >> 1 - for i in range(n): - dest[i] = val - - -b = bytearray(4) -print(b) - -set(b, 0x4242) -print(b) - -set1(b, 0x4343) -print(b) - -memset(b, 0x4444, len(b) // 2) -print(b) - -memset2(b, 0x4545) -print(b) diff --git a/tests/micropython/viper_ptr16_store.py.exp b/tests/micropython/viper_ptr16_store.py.exp deleted file mode 100644 index 31a6dfbe33df5..0000000000000 --- a/tests/micropython/viper_ptr16_store.py.exp +++ /dev/null @@ -1,5 +0,0 @@ -bytearray(b'\x00\x00\x00\x00') -bytearray(b'BB\x00\x00') -bytearray(b'BBCC') -bytearray(b'DDDD') -bytearray(b'EEEE') diff --git a/tests/micropython/viper_ptr32_load.py b/tests/micropython/viper_ptr32_load.py deleted file mode 100644 index b0b90bcaf551e..0000000000000 --- a/tests/micropython/viper_ptr32_load.py +++ /dev/null @@ -1,36 +0,0 @@ -# test loading from ptr32 type - - -@micropython.viper -def get(src: ptr32) -> int: - return src[0] - - -@micropython.viper -def get1(src: ptr32) -> int: - return src[1] - - -@micropython.viper -def memadd(src: ptr32, n: int) -> int: - sum = 0 - for i in range(n): - sum += src[i] - return sum - - -@micropython.viper -def memadd2(src_in) -> int: - src = ptr32(src_in) - n = int(len(src_in)) >> 2 - sum = 0 - for i in range(n): - sum += src[i] - return sum - - -b = bytearray(b"\x12\x12\x12\x12\x34\x34\x34\x34") -print(b) -print(hex(get(b)), hex(get1(b))) -print(hex(memadd(b, 2))) -print(hex(memadd2(b))) diff --git a/tests/micropython/viper_ptr32_load.py.exp b/tests/micropython/viper_ptr32_load.py.exp deleted file mode 100644 index 7ea37f1ca79b5..0000000000000 --- a/tests/micropython/viper_ptr32_load.py.exp +++ /dev/null @@ -1,4 +0,0 @@ -bytearray(b'\x12\x12\x12\x124444') -0x12121212 0x34343434 -0x46464646 -0x46464646 diff --git a/tests/micropython/viper_ptr32_store.py b/tests/micropython/viper_ptr32_store.py deleted file mode 100644 index ff0c371ab8c0d..0000000000000 --- a/tests/micropython/viper_ptr32_store.py +++ /dev/null @@ -1,41 +0,0 @@ -# test store to ptr32 type - - -@micropython.viper -def set(dest: ptr32, val: int): - dest[0] = val - - -@micropython.viper -def set1(dest: ptr32, val: int): - dest[1] = val - - -@micropython.viper -def memset(dest: ptr32, val: int, n: int): - for i in range(n): - dest[i] = val - - -@micropython.viper -def memset2(dest_in, val: int): - dest = ptr32(dest_in) - n = int(len(dest_in)) >> 2 - for i in range(n): - dest[i] = val - - -b = bytearray(8) -print(b) - -set(b, 0x42424242) -print(b) - -set1(b, 0x43434343) -print(b) - -memset(b, 0x44444444, len(b) // 4) -print(b) - -memset2(b, 0x45454545) -print(b) diff --git a/tests/micropython/viper_ptr32_store.py.exp b/tests/micropython/viper_ptr32_store.py.exp deleted file mode 100644 index de8d0ec572cd2..0000000000000 --- a/tests/micropython/viper_ptr32_store.py.exp +++ /dev/null @@ -1,5 +0,0 @@ -bytearray(b'\x00\x00\x00\x00\x00\x00\x00\x00') -bytearray(b'BBBB\x00\x00\x00\x00') -bytearray(b'BBBBCCCC') -bytearray(b'DDDDDDDD') -bytearray(b'EEEEEEEE') diff --git a/tests/micropython/viper_ptr8_load.py b/tests/micropython/viper_ptr8_load.py deleted file mode 100644 index d871bfb689b35..0000000000000 --- a/tests/micropython/viper_ptr8_load.py +++ /dev/null @@ -1,36 +0,0 @@ -# test loading from ptr8 type - - -@micropython.viper -def get(src: ptr8) -> int: - return src[0] - - -@micropython.viper -def get1(src: ptr8) -> int: - return src[1] - - -@micropython.viper -def memadd(src: ptr8, n: int) -> int: - sum = 0 - for i in range(n): - sum += src[i] - return sum - - -@micropython.viper -def memadd2(src_in) -> int: - src = ptr8(src_in) - n = int(len(src_in)) - sum = 0 - for i in range(n): - sum += src[i] - return sum - - -b = bytearray(b"1234") -print(b) -print(get(b), get1(b)) -print(memadd(b, 4)) -print(memadd2(b)) diff --git a/tests/micropython/viper_ptr8_load.py.exp b/tests/micropython/viper_ptr8_load.py.exp deleted file mode 100644 index d899bbee741bf..0000000000000 --- a/tests/micropython/viper_ptr8_load.py.exp +++ /dev/null @@ -1,4 +0,0 @@ -bytearray(b'1234') -49 50 -202 -202 diff --git a/tests/micropython/viper_ptr8_store.py b/tests/micropython/viper_ptr8_store.py deleted file mode 100644 index baa9e2c6d4776..0000000000000 --- a/tests/micropython/viper_ptr8_store.py +++ /dev/null @@ -1,41 +0,0 @@ -# test ptr8 type - - -@micropython.viper -def set(dest: ptr8, val: int): - dest[0] = val - - -@micropython.viper -def set1(dest: ptr8, val: int): - dest[1] = val - - -@micropython.viper -def memset(dest: ptr8, val: int, n: int): - for i in range(n): - dest[i] = val - - -@micropython.viper -def memset2(dest_in, val: int): - dest = ptr8(dest_in) - n = int(len(dest_in)) - for i in range(n): - dest[i] = val - - -b = bytearray(4) -print(b) - -set(b, 41) -print(b) - -set1(b, 42) -print(b) - -memset(b, 43, len(b)) -print(b) - -memset2(b, 44) -print(b) diff --git a/tests/micropython/viper_ptr8_store.py.exp b/tests/micropython/viper_ptr8_store.py.exp deleted file mode 100644 index b2fbe426ce401..0000000000000 --- a/tests/micropython/viper_ptr8_store.py.exp +++ /dev/null @@ -1,5 +0,0 @@ -bytearray(b'\x00\x00\x00\x00') -bytearray(b')\x00\x00\x00') -bytearray(b')*\x00\x00') -bytearray(b'++++') -bytearray(b',,,,') diff --git a/tests/micropython/viper_storeattr.py b/tests/micropython/viper_storeattr.py deleted file mode 100644 index 65f68b6e22eec..0000000000000 --- a/tests/micropython/viper_storeattr.py +++ /dev/null @@ -1,25 +0,0 @@ -# test storing an attribute with a value of different viper types - - -class X: - def __str__(self): - return "X" - - -x = X() - - -@micropython.viper -def a(): - x.i0 = 0 - x.i7 = 7 - x.s = "hello" - x.o = x - - -a() - -print(x.i0) -print(x.i7) -print(x.s) -print(x.o) diff --git a/tests/micropython/viper_storeattr.py.exp b/tests/micropython/viper_storeattr.py.exp deleted file mode 100644 index 8e6a6cfda9533..0000000000000 --- a/tests/micropython/viper_storeattr.py.exp +++ /dev/null @@ -1,4 +0,0 @@ -0 -7 -hello -X diff --git a/tests/micropython/viper_subscr.py b/tests/micropython/viper_subscr.py deleted file mode 100644 index bcaabd3fb409b..0000000000000 --- a/tests/micropython/viper_subscr.py +++ /dev/null @@ -1,23 +0,0 @@ -# test standard Python subscr using viper types - - -@micropython.viper -def get(dest, i: int): - i += 1 - return dest[i] - - -@micropython.viper -def set(dest, i: int, val: int): - i += 1 - dest[i] = val + 1 - - -ar = [i for i in range(3)] - -for i in range(len(ar)): - set(ar, i - 1, i) -print(ar) - -for i in range(len(ar)): - print(get(ar, i - 1)) diff --git a/tests/micropython/viper_subscr.py.exp b/tests/micropython/viper_subscr.py.exp deleted file mode 100644 index e68032ce1e446..0000000000000 --- a/tests/micropython/viper_subscr.py.exp +++ /dev/null @@ -1,4 +0,0 @@ -[1, 2, 3] -1 -2 -3 diff --git a/tests/micropython/viper_subscr_multi.py b/tests/micropython/viper_subscr_multi.py deleted file mode 100644 index a2baba2411681..0000000000000 --- a/tests/micropython/viper_subscr_multi.py +++ /dev/null @@ -1,29 +0,0 @@ -# test viper with multiple subscripts in a single expression - - -@micropython.viper -def f1(b: ptr8): - b[0] += b[1] - - -b = bytearray(b"\x01\x02") -f1(b) -print(b) - - -@micropython.viper -def f2(b: ptr8, i: int): - b[0] += b[i] - - -b = bytearray(b"\x01\x02") -f2(b, 1) -print(b) - - -@micropython.viper -def f3(b: ptr8) -> int: - return b[0] << 24 | b[1] << 16 | b[2] << 8 | b[3] - - -print(hex(f3(b"\x01\x02\x03\x04"))) diff --git a/tests/micropython/viper_subscr_multi.py.exp b/tests/micropython/viper_subscr_multi.py.exp deleted file mode 100644 index ea644c046d85c..0000000000000 --- a/tests/micropython/viper_subscr_multi.py.exp +++ /dev/null @@ -1,3 +0,0 @@ -bytearray(b'\x03\x02') -bytearray(b'\x03\x02') -0x1020304 diff --git a/tests/micropython/viper_try.py b/tests/micropython/viper_try.py deleted file mode 100644 index f5822a66820f4..0000000000000 --- a/tests/micropython/viper_try.py +++ /dev/null @@ -1,48 +0,0 @@ -# test try handling within a viper function - - -# basic try-finally -@micropython.viper -def f(): - try: - fail - finally: - print("finally") - - -try: - f() -except NameError: - print("NameError") - - -# nested try-except with try-finally -@micropython.viper -def f(): - try: - try: - fail - finally: - print("finally") - except NameError: - print("NameError") - - -f() - - -# check that locals written to in try blocks keep their values -@micropython.viper -def f(): - a = 100 - try: - print(a) - a = 200 - fail - except NameError: - print(a) - a = 300 - print(a) - - -f() diff --git a/tests/micropython/viper_try.py.exp b/tests/micropython/viper_try.py.exp deleted file mode 100644 index 96596ce5f5a4f..0000000000000 --- a/tests/micropython/viper_try.py.exp +++ /dev/null @@ -1,7 +0,0 @@ -finally -NameError -finally -NameError -100 -200 -300 diff --git a/tests/micropython/viper_types.py b/tests/micropython/viper_types.py deleted file mode 100644 index 3e0a4f6640469..0000000000000 --- a/tests/micropython/viper_types.py +++ /dev/null @@ -1,35 +0,0 @@ -# test various type conversions - -import micropython - - -# converting incoming arg to bool -@micropython.viper -def f1(x: bool): - print(x) - - -f1(0) -f1(1) -f1([]) -f1([1]) - - -# taking and returning a bool -@micropython.viper -def f2(x: bool) -> bool: - return x - - -print(f2([])) -print(f2([1])) - - -# converting to bool within function -@micropython.viper -def f3(x) -> bool: - return bool(x) - - -print(f3([])) -print(f3(-1)) diff --git a/tests/micropython/viper_types.py.exp b/tests/micropython/viper_types.py.exp deleted file mode 100644 index b7bef156ea494..0000000000000 --- a/tests/micropython/viper_types.py.exp +++ /dev/null @@ -1,8 +0,0 @@ -False -True -False -True -False -True -False -True diff --git a/tests/micropython/viper_with.py b/tests/micropython/viper_with.py deleted file mode 100644 index 40fbf6fb31541..0000000000000 --- a/tests/micropython/viper_with.py +++ /dev/null @@ -1,37 +0,0 @@ -# test with handling within a viper function - - -class C: - def __init__(self): - print("__init__") - - def __enter__(self): - print("__enter__") - - def __exit__(self, a, b, c): - print("__exit__", a, b, c) - - -# basic with -@micropython.viper -def f(): - with C(): - print(1) - - -f() - - -# nested with and try-except -@micropython.viper -def f(): - try: - with C(): - print(1) - fail - print(2) - except NameError: - print("NameError") - - -f() diff --git a/tests/micropython/viper_with.py.exp b/tests/micropython/viper_with.py.exp deleted file mode 100644 index 6eef7822fbaf8..0000000000000 --- a/tests/micropython/viper_with.py.exp +++ /dev/null @@ -1,9 +0,0 @@ -__init__ -__enter__ -1 -__exit__ None None None -__init__ -__enter__ -1 -__exit__ name 'fail' is not defined None -NameError diff --git a/tests/perf_bench/viper_call0.py b/tests/perf_bench/viper_call0.py deleted file mode 100644 index 903e2b5e58e9f..0000000000000 --- a/tests/perf_bench/viper_call0.py +++ /dev/null @@ -1,22 +0,0 @@ -@micropython.viper -def f0(): - pass - - -@micropython.native -def call(r): - f = f0 - for _ in r: - f() - - -bm_params = { - (50, 10): (15000,), - (100, 10): (30000,), - (1000, 10): (300000,), - (5000, 10): (1500000,), -} - - -def bm_setup(params): - return lambda: call(range(params[0])), lambda: (params[0] // 1000, None) diff --git a/tests/perf_bench/viper_call1a.py b/tests/perf_bench/viper_call1a.py deleted file mode 100644 index 76adef60a10db..0000000000000 --- a/tests/perf_bench/viper_call1a.py +++ /dev/null @@ -1,22 +0,0 @@ -@micropython.viper -def f1a(x): - return x - - -@micropython.native -def call(r): - f = f1a - for _ in r: - f(1) - - -bm_params = { - (50, 10): (15000,), - (100, 10): (30000,), - (1000, 10): (300000,), - (5000, 10): (1500000,), -} - - -def bm_setup(params): - return lambda: call(range(params[0])), lambda: (params[0] // 1000, None) diff --git a/tests/perf_bench/viper_call1b.py b/tests/perf_bench/viper_call1b.py deleted file mode 100644 index b52693c15d2c4..0000000000000 --- a/tests/perf_bench/viper_call1b.py +++ /dev/null @@ -1,22 +0,0 @@ -@micropython.viper -def f1b(x) -> int: - return int(x) - - -@micropython.native -def call(r): - f = f1b - for _ in r: - f(1) - - -bm_params = { - (50, 10): (15000,), - (100, 10): (30000,), - (1000, 10): (300000,), - (5000, 10): (1500000,), -} - - -def bm_setup(params): - return lambda: call(range(params[0])), lambda: (params[0] // 1000, None) diff --git a/tests/perf_bench/viper_call1c.py b/tests/perf_bench/viper_call1c.py deleted file mode 100644 index 31578c5baccd3..0000000000000 --- a/tests/perf_bench/viper_call1c.py +++ /dev/null @@ -1,22 +0,0 @@ -@micropython.viper -def f1c(x: int) -> int: - return x - - -@micropython.native -def call(r): - f = f1c - for _ in r: - f(1) - - -bm_params = { - (50, 10): (15000,), - (100, 10): (30000,), - (1000, 10): (300000,), - (5000, 10): (1500000,), -} - - -def bm_setup(params): - return lambda: call(range(params[0])), lambda: (params[0] // 1000, None) diff --git a/tests/perf_bench/viper_call2a.py b/tests/perf_bench/viper_call2a.py deleted file mode 100644 index d0520b46bc8fe..0000000000000 --- a/tests/perf_bench/viper_call2a.py +++ /dev/null @@ -1,22 +0,0 @@ -@micropython.viper -def f2a(x, y): - return x - - -@micropython.native -def call(r): - f = f2a - for _ in r: - f(1, 2) - - -bm_params = { - (50, 10): (15000,), - (100, 10): (30000,), - (1000, 10): (300000,), - (5000, 10): (1500000,), -} - - -def bm_setup(params): - return lambda: call(range(params[0])), lambda: (params[0] // 1000, None) diff --git a/tests/perf_bench/viper_call2b.py b/tests/perf_bench/viper_call2b.py deleted file mode 100644 index 1171b7d576975..0000000000000 --- a/tests/perf_bench/viper_call2b.py +++ /dev/null @@ -1,22 +0,0 @@ -@micropython.viper -def f2b(x: int, y: int) -> int: - return x + y - - -@micropython.native -def call(r): - f = f2b - for _ in r: - f(1, 2) - - -bm_params = { - (50, 10): (15000,), - (100, 10): (30000,), - (1000, 10): (300000,), - (5000, 10): (1500000,), -} - - -def bm_setup(params): - return lambda: call(range(params[0])), lambda: (params[0] // 1000, None) diff --git a/tests/run-tests.py b/tests/run-tests.py index fbf67cd95e10e..0a3865431bd7a 100755 --- a/tests/run-tests.py +++ b/tests/run-tests.py @@ -54,6 +54,9 @@ def base_path(*p): # Set PYTHONIOENCODING so that CPython will use utf-8 on systems which set another encoding in the locale os.environ["PYTHONIOENCODING"] = "utf-8" +# Set time zone to one that allows the time_mktime_localtime test to succeed +os.environ["TZ"] = "GMT" + # Code to allow a target MicroPython to import an .mpy from RAM injected_import_hook_code = """\ import sys, os, io @@ -721,6 +724,7 @@ def run_one_test(test_file): "PYTHONPATH": base_path("testlib"), "PATH": os.environ["PATH"], "LANG": "en_US.UTF-8", + "TZ": "GMT", } # run CPython to work out expected output try: @@ -917,7 +921,7 @@ def main(): for exp in glob(os.path.join(args.result_dir, "*.exp")): testbase = exp[:-4] print() - print("FAILURE {0}".format(testbase)) + print("FAILURE {0}".format(testbase), flush=True) os.system("{0} {1}.exp {1}.out".format(DIFF, testbase)) sys.exit(0) diff --git a/tests/testlib/testpattern_208x208.jpg b/tests/testlib/testpattern_208x208.jpg new file mode 100644 index 0000000000000..94b01de2da807 Binary files /dev/null and b/tests/testlib/testpattern_208x208.jpg differ diff --git a/tests/unix/mod_os.py b/tests/unix/mod_os.py deleted file mode 100644 index f69fa45b2b22a..0000000000000 --- a/tests/unix/mod_os.py +++ /dev/null @@ -1,21 +0,0 @@ -# This module is not entirely compatible with CPython -import os - - -os.putenv("TEST_VARIABLE", "TEST_VALUE") - -print(os.getenv("TEST_VARIABLE")) -print(os.getenv("TEST_VARIABLE", "TEST_DEFAULT_VALUE")) - -os.unsetenv("TEST_VARIABLE") - -print(os.getenv("TEST_VARIABLE")) -print(os.getenv("TEST_VARIABLE", "TEST_DEFAULT_VALUE")) - -print(os.system("exit 0")) - -rand = os.urandom(4) -print(type(rand) is bytes, len(rand)) - -os.errno(2) -print(os.errno()) diff --git a/tests/unix/mod_os.py.exp b/tests/unix/mod_os.py.exp deleted file mode 100644 index 465163085b5d6..0000000000000 --- a/tests/unix/mod_os.py.exp +++ /dev/null @@ -1,7 +0,0 @@ -TEST_VALUE -TEST_VALUE -None -TEST_DEFAULT_VALUE -0 -True 4 -2