diff --git a/esp8266/Makefile b/esp8266/Makefile index 7efb0ca50d..5288e97d26 100644 --- a/esp8266/Makefile +++ b/esp8266/Makefile @@ -11,6 +11,7 @@ CROSS_COMPILE = xtensa-lx106-elf- ESP_SDK = $(shell $(CC) -print-sysroot)/usr INC = -I. +INC += -I.. INC += -I$(PY_SRC) INC += -I../stmhal INC += -I$(BUILD) diff --git a/py/misc.h b/py/misc.h index 2f53dcbd3d..c0fd293de5 100644 --- a/py/misc.h +++ b/py/misc.h @@ -23,12 +23,11 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ +#ifndef __MICROPY_INCLUDED_PY_MISC_H__ +#define __MICROPY_INCLUDED_PY_MISC_H__ // a mini library of useful types and functions -#ifndef _INCLUDED_MINILIB_H -#define _INCLUDED_MINILIB_H - /** types *******************************************************/ #include @@ -185,4 +184,4 @@ static inline mp_uint_t count_lead_ones(byte val) { } #endif -#endif // _INCLUDED_MINILIB_H +#endif // __MICROPY_INCLUDED_PY_MISC_H__ diff --git a/py/mpconfig.h b/py/mpconfig.h index 76f31e48e9..b193051c51 100644 --- a/py/mpconfig.h +++ b/py/mpconfig.h @@ -23,6 +23,8 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ +#ifndef __MICROPY_INCLUDED_PY_MPCONFIG_H__ +#define __MICROPY_INCLUDED_PY_MPCONFIG_H__ // This file contains default configuration settings for MicroPython. // You can override any of the options below using mpconfigport.h file @@ -572,3 +574,5 @@ typedef double mp_float_t; #ifndef MP_UNLIKELY #define MP_UNLIKELY(x) __builtin_expect((x), 0) #endif + +#endif // __MICROPY_INCLUDED_PY_MPCONFIG_H__ diff --git a/py/obj.h b/py/obj.h index c37c4d3fa6..bd4cd31aa0 100644 --- a/py/obj.h +++ b/py/obj.h @@ -23,6 +23,12 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ +#ifndef __MICROPY_INCLUDED_PY_OBJ_H__ +#define __MICROPY_INCLUDED_PY_OBJ_H__ + +#include "py/mpconfig.h" +#include "py/misc.h" +#include "py/qstr.h" // A Micro Python object is a machine word having the following form: // - xxxx...xxx1 : a small int, bits 1 and above are the value @@ -81,7 +87,7 @@ typedef struct _mp_obj_base_t mp_obj_base_t; #define MP_OBJ_NEW_SMALL_INT(small_int) ((mp_obj_t)((((mp_int_t)(small_int)) << 1) | 1)) #define MP_OBJ_QSTR_VALUE(o) (((mp_int_t)(o)) >> 2) -#define MP_OBJ_NEW_QSTR(qstr) ((mp_obj_t)((((mp_uint_t)(qstr)) << 2) | 2)) +#define MP_OBJ_NEW_QSTR(qst) ((mp_obj_t)((((mp_uint_t)(qst)) << 2) | 2)) // These macros are used to declare and define constant function objects // You can put "static" in front of the definitions to make them local @@ -620,3 +626,5 @@ mp_obj_t mp_seq_extract_slice(mp_uint_t len, const mp_obj_t *seq, mp_bound_slice /*printf("memmove(%p, %p, %d)\n", dest + beg + len_adj, dest + beg, (dest_len - beg) * sizeof(item_t));*/ \ memmove(dest + beg + len_adj, dest + beg, (dest_len - beg) * sizeof(item_t)); \ memcpy(dest + beg, slice, slice_len * sizeof(item_t)); + +#endif // __MICROPY_INCLUDED_PY_OBJ_H__ diff --git a/py/parsehelper.h b/py/parsehelper.h index 676837f53e..4a95f22fa2 100644 --- a/py/parsehelper.h +++ b/py/parsehelper.h @@ -23,6 +23,13 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ +#ifndef __MICROPY_INCLUDED_PY_PARSEHELPER_H__ +#define __MICROPY_INCLUDED_PY_PARSEHELPER_H__ + +#include "py/lexer.h" +#include "py/parse.h" void mp_parse_show_exception(mp_lexer_t *lex, mp_parse_error_kind_t parse_error_kind); mp_obj_t mp_parse_make_exception(mp_lexer_t *lex, mp_parse_error_kind_t parse_error_kind); + +#endif // __MICROPY_INCLUDED_PY_PARSEHELPER_H__ diff --git a/py/qstr.h b/py/qstr.h index aa4ed41610..a383452b84 100644 --- a/py/qstr.h +++ b/py/qstr.h @@ -23,6 +23,11 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ +#ifndef __MICROPY_INCLUDED_PY_QSTR_H__ +#define __MICROPY_INCLUDED_PY_QSTR_H__ + +#include "py/mpconfig.h" +#include "py/misc.h" // See qstrdefs.h for a list of qstr's that are available as constants. // Reference them as MP_QSTR_xxxx. @@ -60,3 +65,5 @@ mp_uint_t qstr_len(qstr q); const byte* qstr_data(qstr q, mp_uint_t *len); void qstr_pool_info(mp_uint_t *n_pool, mp_uint_t *n_qstr, mp_uint_t *n_str_data_bytes, mp_uint_t *n_total_bytes); + +#endif // __MICROPY_INCLUDED_PY_QSTR_H__ diff --git a/py/runtime.h b/py/runtime.h index 5fbec5937f..54cc60c19c 100644 --- a/py/runtime.h +++ b/py/runtime.h @@ -23,6 +23,10 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ +#ifndef __MICROPY_INCLUDED_PY_RUNTIME_H__ +#define __MICROPY_INCLUDED_PY_RUNTIME_H__ + +#include "py/obj.h" typedef enum { MP_VM_RETURN_NORMAL, @@ -120,3 +124,5 @@ extern struct _mp_obj_list_t mp_sys_path_obj; extern struct _mp_obj_list_t mp_sys_argv_obj; #define mp_sys_path ((mp_obj_t)&mp_sys_path_obj) #define mp_sys_argv ((mp_obj_t)&mp_sys_argv_obj) + +#endif // __MICROPY_INCLUDED_PY_RUNTIME_H__ diff --git a/stmhal/pyexec.c b/stmhal/pyexec.c index cae87591b1..f1e645447c 100644 --- a/stmhal/pyexec.c +++ b/stmhal/pyexec.c @@ -30,11 +30,6 @@ #include "mpconfig.h" #include "nlr.h" -#include "misc.h" -#include "qstr.h" -#include "misc.h" -#include "lexer.h" -#include "parse.h" #include "obj.h" #include "parsehelper.h" #include "compile.h" diff --git a/unix/main.c b/unix/main.c index a0396e5178..d3ab53da6e 100644 --- a/unix/main.c +++ b/unix/main.c @@ -37,11 +37,6 @@ #include "mpconfig.h" #include "nlr.h" -#include "misc.h" -#include "qstr.h" -#include "lexer.h" -#include "lexerunix.h" -#include "parse.h" #include "obj.h" #include "parsehelper.h" #include "compile.h"