py: Move to guarded includes for compile.h and related headers.

This commit is contained in:
Paul Sokolovsky 2014-12-25 23:29:19 +02:00
parent 343266ea51
commit 8ab6f90674
6 changed files with 30 additions and 0 deletions

View File

@ -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_COMPILE_H__
#define __MICROPY_INCLUDED_PY_COMPILE_H__
#include "py/lexer.h"
#include "py/parse.h"
#include "py/emitglue.h"
// These must fit in 8 bits; see scope.h
enum {
@ -38,3 +44,5 @@ mp_obj_t mp_compile(mp_parse_node_t pn, qstr source_file, uint emit_opt, bool is
// this is implemented in runtime.c
mp_obj_t mp_parse_compile_execute(mp_lexer_t *lex, mp_parse_input_kind_t parse_input_kind, mp_obj_dict_t *globals, mp_obj_dict_t *locals);
#endif // __MICROPY_INCLUDED_PY_COMPILE_H__

View File

@ -33,6 +33,10 @@
* This is problematic for some emitters (x64) since they need to know the maximum
* stack size to compile the entry to the function, and this affects code size.
*/
#ifndef __MICROPY_INCLUDED_PY_EMIT_H__
#define __MICROPY_INCLUDED_PY_EMIT_H__
#include "py/runtime0.h"
typedef enum {
MP_PASS_SCOPE = 1, // work out id's and their kind, and number of labels
@ -195,3 +199,5 @@ extern const emit_inline_asm_method_table_t emit_inline_thumb_method_table;
emit_inline_asm_t *emit_inline_thumb_new(mp_uint_t max_num_labels);
void emit_inline_thumb_free(emit_inline_asm_t *emit);
#endif // __MICROPY_INCLUDED_PY_EMIT_H__

View File

@ -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_EMITGLUE_H__
#define __MICROPY_INCLUDED_PY_EMITGLUE_H__
// These variables and functions glue the code emitters to the runtime.
@ -59,3 +61,5 @@ void mp_emit_glue_assign_native(mp_raw_code_t *rc, mp_raw_code_kind_t kind, void
mp_obj_t mp_make_function_from_raw_code(mp_raw_code_t *rc, mp_obj_t def_args, mp_obj_t def_kw_args);
mp_obj_t mp_make_closure_from_raw_code(mp_raw_code_t *rc, mp_uint_t n_closed_over, const mp_obj_t *args);
#endif // __MICROPY_INCLUDED_PY_EMITGLUE_H__

View File

@ -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_LEXER_H__
#define __MICROPY_INCLUDED_PY_LEXER_H__
/* lexer.h -- simple tokeniser for Micro Python
*
@ -186,3 +188,5 @@ mp_import_stat_t mp_import_stat(const char *path);
mp_lexer_t *mp_lexer_new_from_file(const char *filename);
extern mp_uint_t mp_optimise_value;
#endif // __MICROPY_INCLUDED_PY_LEXER_H__

View File

@ -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_PARSE_H__
#define __MICROPY_INCLUDED_PY_PARSE_H__
struct _mp_lexer_t;
@ -93,3 +95,5 @@ typedef enum {
// returns MP_PARSE_NODE_NULL on error, and then parse_error_kind_out is valid
mp_parse_node_t mp_parse(struct _mp_lexer_t *lex, mp_parse_input_kind_t input_kind, mp_parse_error_kind_t *parse_error_kind_out);
#endif // __MICROPY_INCLUDED_PY_PARSE_H__

View File

@ -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_RUNTIME0_H__
#define __MICROPY_INCLUDED_PY_RUNTIME0_H__
// taken from python source, Include/code.h
// These must fit in 8 bits; see scope.h
@ -152,3 +154,5 @@ typedef enum {
} mp_fun_kind_t;
extern void *const mp_fun_table[MP_F_NUMBER_OF];
#endif // __MICROPY_INCLUDED_PY_RUNTIME0_H__