summaryrefslogtreecommitdiffstatshomepage
path: root/py
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2014-12-29 01:02:19 +0000
committerDamien George <damien.p.george@gmail.com>2014-12-29 01:02:19 +0000
commit9ddbe291c4217873b7f50dc03c025aa0c9ffee3d (patch)
treeb5dd73487e5c59dcf5b3016893ee890f2455d1d6 /py
parentf89d659e3b587fb806d20f5f243f5ed79ed19a5d (diff)
downloadmicropython-9ddbe291c4217873b7f50dc03c025aa0c9ffee3d.tar.gz
micropython-9ddbe291c4217873b7f50dc03c025aa0c9ffee3d.zip
py: Add include guards to mpconfig,misc,qstr,obj,runtime,parsehelper.
Diffstat (limited to 'py')
-rw-r--r--py/misc.h7
-rw-r--r--py/mpconfig.h4
-rw-r--r--py/obj.h10
-rw-r--r--py/parsehelper.h7
-rw-r--r--py/qstr.h7
-rw-r--r--py/runtime.h6
6 files changed, 36 insertions, 5 deletions
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 <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__
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__