--- tinypy.cpp.orig	2011-03-05 19:01:34.305179001 +0100
+++ tinypy.cpp	2011-04-14 08:06:25.799269001 +0200
@@ -120,6 +120,19 @@
 #ifndef tp_inline
 #error "Unsuported compiler"
 #endif
+// MEANX : Redirect printf
+bool pyPrintf(const char *fmt,...);
+#define printf pyPrintf
+// MEANX : Need to use ADM_fopen for WIN32 support
+#define uint8_t unsigned char
+#define int64_t long long int
+extern "C"
+{
+        FILE *ADM_fopen(const char *filename,const char *access);
+        uint8_t ADM_fileExist(const char *file);
+        int64_t ADM_fileSize(const char *file);
+}
+#define fopen ADM_fopen
 
 /*  #define tp_malloc(x) calloc((x),1)
     #define tp_realloc(x,y) realloc(x,y)
@@ -463,7 +476,8 @@
 
 tp_inline static void tp_echo(TP,tp_obj e) {
     e = tp_str(tp,e);
-    fwrite(e.string.val,1,e.string.len,stdout);
+    //fwrite(e.string.val,1,e.string.len,stdout);
+    printf("%s",e.string.val); // MEANX
 }
 
 /* Function: tp_string_n
@@ -1433,9 +1447,10 @@
     tp_obj r;
     char *s;
     char fname[256]; tp_cstr(tp,TP_STR(),fname,256);
-    struct stat stbuf;
-    stat(fname, &stbuf);
-    l = stbuf.st_size;
+    int64_t size=ADM_fileSize(fname);
+    if(size==-1)
+        tp_raise(tp_None,tp_string("(tp_load) cant get filesize"));
+    l = (int)size;
     f = fopen(fname,"rb");
     if (!f) {
         tp_raise(tp_None,tp_string("(tp_load) IOError: ?"));
@@ -1473,11 +1488,14 @@
 
 tp_obj tp_exists(TP) {
     char fname[TP_CSTR_LEN]; tp_cstr(tp,TP_STR(),fname,TP_CSTR_LEN);
-    struct stat stbuf;
-    return tp_number(!stat(fname,&stbuf));
+    uint8_t e=ADM_fileExist(fname);
+    //struct stat stbuf;
+    //return tp_number(!stat(fname,&stbuf));
+    return tp_number(e);
 }
 tp_obj tp_mtime(TP) {
     char fname[TP_CSTR_LEN]; tp_cstr(tp,TP_STR(),fname,TP_CSTR_LEN);
+    #warning fixme
     struct stat stbuf;
     if (!stat(fname,&stbuf)) { return tp_number(stbuf.st_mtime); }
     tp_raise(tp_None,tp_string("(tp_mtime) IOError: ?"));
@@ -2219,6 +2237,9 @@
         exit(-1);
 #else
         tp->ex = e;
+        // MEANX
+         printf("\nException:\n"); tp_echo(tp,e); printf("\n");
+        // /MEANX
         longjmp(tp->nextexpr,1);
 #endif
     }
@@ -2255,6 +2276,9 @@
     tp_print_stack(tp);
     exit(-1);
 #else
+        // MEANX
+    tp_print_stack(tp);
+        // /MEANX
     longjmp(tp->nextexpr,1);
 #endif
 }
