Merge branch 'str2int' of github.com:xyb/micropython into xyb-str2int

Conflicts:
	py/objint.c
	unix-cpy/Makefile
	unix/Makefile
diff --git a/py/objint.c b/py/objint.c
index efec600..937bff7 100644
--- a/py/objint.c
+++ b/py/objint.c
@@ -18,11 +18,17 @@
             return MP_OBJ_NEW_SMALL_INT(0);
 
         case 1:
-            // TODO allow string as arg and parse it
-            return mp_obj_new_int(mp_obj_get_int(args[0]));
+            if (MP_OBJ_IS_TYPE(args[0], &str_type)) {
+                // a string, parse it
+                return MP_OBJ_NEW_SMALL_INT(strtonum(qstr_str(mp_obj_get_qstr(args[0])), 0));
+            } else {
+                return MP_OBJ_NEW_SMALL_INT(mp_obj_get_int(args[0]));
+            }
 
-        //case 2:
-            // TODO, parse with given base
+        case 2:
+            // should be a string, parse it
+            // TODO proper error checking of argument types
+            return MP_OBJ_NEW_SMALL_INT(strtonum(qstr_str(mp_obj_get_qstr(args[1])), mp_obj_get_int(args[0])));
 
         default:
             nlr_jump(mp_obj_new_exception_msg_1_arg(MP_QSTR_TypeError, "int takes at most 2 arguments, %d given", (void*)(machine_int_t)n_args));