diff options
| author | John R. Lenton <jlenton@gmail.com> | 2014-01-05 01:57:54 +0000 | 
|---|---|---|
| committer | John R. Lenton <jlenton@gmail.com> | 2014-01-05 01:57:54 +0000 | 
| commit | 7e73a8fd09a8070a3bbb90d2ddc4f04af4e2828a (patch) | |
| tree | 606e074a1955f381c68d1689946066e9eb1a5a47 /unix | |
| parent | 5d4a8213395b1e27d303379772c90b3b0adc82d5 (diff) | |
| parent | 45b43c21c4f8e30dcff00c2429eddba20ca002aa (diff) | |
Merge remote-tracking branch 'upstream/master' into list_index
Diffstat (limited to 'unix')
| -rw-r--r-- | unix/Makefile | 8 | ||||
| -rw-r--r-- | unix/main.c | 12 | ||||
| -rw-r--r-- | unix/mpconfigport.h | 9 | 
3 files changed, 20 insertions, 9 deletions
diff --git a/unix/Makefile b/unix/Makefile index fd5b6b43e..984f1c3bf 100644 --- a/unix/Makefile +++ b/unix/Makefile @@ -2,7 +2,7 @@ PYSRC=../py  BUILD=build  CC = gcc -CFLAGS = -I. -I$(PYSRC) -Wall -Werror -ansi -std=gnu99 -Os -DUSE_READLINE #-DNDEBUG +CFLAGS = -I. -I$(PYSRC) -Wall -Werror -ansi -std=gnu99 -Os #-DNDEBUG  LDFLAGS = -lm  SRC_C = \ @@ -45,11 +45,13 @@ PY_O = \  	objfun.o \  	objgenerator.o \  	objinstance.o \ +	objint.o \  	objlist.o \  	objmodule.o \  	objnone.o \  	objrange.o \  	objset.o \ +	objslice.o \  	objstr.o \  	objtuple.o \  	objtype.o \ @@ -82,10 +84,10 @@ $(BUILD)/%.o: $(PYSRC)/%.S  $(BUILD)/%.o: $(PYSRC)/%.c mpconfigport.h  	$(CC) $(CFLAGS) -c -o $@ $< -$(BUILD)/emitnx64.o: $(PYSRC)/emitnative.c $(PYSRC)/emit.h +$(BUILD)/emitnx64.o: $(PYSRC)/emitnative.c $(PYSRC)/emit.h mpconfigport.h  	$(CC) $(CFLAGS) -DN_X64 -c -o $@ $< -$(BUILD)/emitnthumb.o: $(PYSRC)/emitnative.c $(PYSRC)/emit.h +$(BUILD)/emitnthumb.o: $(PYSRC)/emitnative.c $(PYSRC)/emit.h mpconfigport.h  	$(CC) $(CFLAGS) -DN_THUMB -c -o $@ $<  # optimising vm for speed, adds only a small amount to code size but makes a huge difference to speed (20% faster) diff --git a/unix/main.c b/unix/main.c index 1aa333120..16fcf6ef8 100644 --- a/unix/main.c +++ b/unix/main.c @@ -15,7 +15,7 @@  #include "runtime.h"  #include "repl.h" -#ifdef USE_READLINE +#if MICROPY_USE_READLINE  #include <readline/readline.h>  #include <readline/history.h>  #endif @@ -35,7 +35,7 @@ static char *str_join(const char *s1, int sep_char, const char *s2) {  }  static char *prompt(char *p) { -#ifdef USE_READLINE +#if MICROPY_USE_READLINE      char *line = readline(p);      if (line) {          add_history(line); @@ -192,6 +192,7 @@ static const mp_obj_type_t test_type = {      { &mp_const_type },      "Test",      test_print, // print +    NULL, // make_new      NULL, // call_n      NULL, // unary_op      NULL, // binary_op @@ -217,6 +218,13 @@ int main(int argc, char **argv) {      rt_store_name(qstr_from_str_static("test"), test_obj_new(42)); +    /* +    printf("bytes:\n"); +    printf("    total %d\n", m_get_total_bytes_allocated()); +    printf("    cur   %d\n", m_get_current_bytes_allocated()); +    printf("    peak  %d\n", m_get_peak_bytes_allocated()); +    */ +      if (argc == 1) {          do_repl();      } else if (argc == 2) { diff --git a/unix/mpconfigport.h b/unix/mpconfigport.h index 3d0dc8a56..7a4622b8b 100644 --- a/unix/mpconfigport.h +++ b/unix/mpconfigport.h @@ -1,5 +1,10 @@  // options to control how Micro Python is built +// Linking with GNU readline causes binary to be licensed under GPL +#ifndef MICROPY_USE_READLINE +#define MICROPY_USE_READLINE        (1) +#endif +  #define MICROPY_ENABLE_FLOAT        (1)  #define MICROPY_EMIT_CPYTHON        (0)  #define MICROPY_EMIT_X64            (1) @@ -11,15 +16,11 @@  #ifdef __LP64__  typedef long machine_int_t; // must be pointer size  typedef unsigned long machine_uint_t; // must be pointer size -#define UINT_FMT "%lu" -#define INT_FMT "%ld"  #else  // These are definitions for machines where sizeof(int) == sizeof(void*),  // regardless for actual size.  typedef int machine_int_t; // must be pointer size  typedef unsigned int machine_uint_t; // must be pointer size -#define UINT_FMT "%u" -#define INT_FMT "%d"  #endif  #define BYTES_PER_WORD sizeof(machine_int_t)  | 
