diff options
Diffstat (limited to 'unix-cpy')
-rw-r--r-- | unix-cpy/.gitignore | 2 | ||||
-rw-r--r-- | unix-cpy/Makefile | 32 | ||||
-rw-r--r-- | unix-cpy/main.c | 88 | ||||
-rw-r--r-- | unix-cpy/mpconfigport.h | 59 |
4 files changed, 0 insertions, 181 deletions
diff --git a/unix-cpy/.gitignore b/unix-cpy/.gitignore deleted file mode 100644 index e3778ee721..0000000000 --- a/unix-cpy/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -build -cpy diff --git a/unix-cpy/Makefile b/unix-cpy/Makefile deleted file mode 100644 index 9f8ad3b51c..0000000000 --- a/unix-cpy/Makefile +++ /dev/null @@ -1,32 +0,0 @@ -include ../py/mkenv.mk - -# define main target -PROG = cpy - -# include py core make definitions -include ../py/py.mk - -INC = -I. -INC += -I.. -INC += -I$(BUILD) - -# compiler settings -CFLAGS = $(INC) -Wall -Wpointer-arith -Werror -ansi -std=gnu99 -DUNIX -LDFLAGS = -lm - -# Debugging/Optimization -ifdef DEBUG -CFLAGS += -O0 -g -else -CFLAGS += -Os #-DNDEBUG -endif - -# source files -SRC_C = \ - main.c \ - -OBJ = $(PY_O) $(addprefix $(BUILD)/, $(SRC_C:.c=.o)) -LIB = - -include ../py/mkrules.mk - diff --git a/unix-cpy/main.c b/unix-cpy/main.c deleted file mode 100644 index 219e3e6048..0000000000 --- a/unix-cpy/main.c +++ /dev/null @@ -1,88 +0,0 @@ -/* - * This file is part of the Micro Python 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 <stdlib.h> -#include <stdint.h> -#include <stdio.h> -#include <string.h> - -#include "py/nlr.h" -#include "py/compile.h" -#include "py/runtime.h" - -void do_file(const char *file) { - mp_lexer_t *lex = mp_lexer_new_from_file(file); - if (lex == NULL) { - return; - } - - if (0) { - // just tokenise - while (lex->tok_kind != MP_TOKEN_END) { - mp_lexer_show_token(lex); - mp_lexer_to_next(lex); - } - mp_lexer_free(lex); - - } else { - // parse - mp_parse_node_t pn = mp_parse(lex, MP_PARSE_FILE_INPUT); - - if (pn != MP_PARSE_NODE_NULL) { - //printf("----------------\n"); - //mp_parse_node_print(pn, 0); - //printf("----------------\n"); - - // compile - mp_compile(pn, 0, MP_EMIT_OPT_NONE, false); - - //printf("----------------\n"); - } - } -} - -int main(int argc, char **argv) { - mp_init(); - - if (argc == 2) { - do_file(argv[1]); - } else { - printf("usage: py [<file>]\n"); - return 1; - } - mp_deinit(); - - return 0; -} - -mp_import_stat_t mp_import_stat(const char *path) { - return MP_IMPORT_STAT_NO_EXIST; -} - -void nlr_jump_fail(void *val) { - printf("FATAL: uncaught NLR %p\n", val); - exit(1); -} diff --git a/unix-cpy/mpconfigport.h b/unix-cpy/mpconfigport.h deleted file mode 100644 index 9d446b68a1..0000000000 --- a/unix-cpy/mpconfigport.h +++ /dev/null @@ -1,59 +0,0 @@ -/* - * This file is part of the Micro Python 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. - */ - -// options to control how Micro Python is built - -#define MICROPY_EMIT_CPYTHON (1) -#define MICROPY_COMP_TRIPLE_TUPLE_ASSIGN (1) -#define MICROPY_HELPER_LEXER_UNIX (1) -#define MICROPY_FLOAT_IMPL (MICROPY_FLOAT_IMPL_DOUBLE) -#define MICROPY_PY_IO (0) - -// type definitions for the specific machine - -#ifdef __LP64__ -typedef long mp_int_t; // must be pointer size -typedef unsigned long mp_uint_t; // must be pointer size -#else -// These are definitions for machines where sizeof(int) == sizeof(void*), -// regardless for actual size. -typedef int mp_int_t; // must be pointer size -typedef unsigned int mp_uint_t; // must be pointer size -#endif - -#define BYTES_PER_WORD sizeof(mp_int_t) - -typedef void *machine_ptr_t; // must be of pointer size -typedef const void *machine_const_ptr_t; // must be of pointer size -typedef double machine_float_t; -typedef long mp_off_t; - -// We need to provide a declaration/definition of alloca() -#ifdef __FreeBSD__ -#include <stdlib.h> -#else -#include <alloca.h> -#endif |