Commit 9ddbe291 authored by Damien George's avatar Damien George
Browse files

py: Add include guards to mpconfig,misc,qstr,obj,runtime,parsehelper.

parent f89d659e
......@@ -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)
......
......@@ -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 <stdbool.h>
......@@ -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__
......@@ -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__
......@@ -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__
......@@ -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__
......@@ -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__
......@@ -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__
......@@ -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"
......
......@@ -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"
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment