Check-in [9ad4b6efea]
Overview
Comment:Fixed Tcl I/O to be binary
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:9ad4b6efea8c04827d1a6e4ad179a4bb59864598
User & Date: rkeene on 2014-05-22 16:59:26
Other Links: manifest | tags
Context
2014-05-22
16:59
Corrected path seperator on Windows check-in: a6d7a98041 user: rkeene tags: trunk
16:59
Fixed Tcl I/O to be binary check-in: 9ad4b6efea user: rkeene tags: trunk
05:12
tcc4tcl 0.13 check-in: bdab5f40e3 user: rkeene tags: trunk, 0.13
Changes

Modified build/tcc-patches/0.9.26/tcc-0.9.26-tclio.diff from [8fe78dd24b] to [3b7b96df23].

1
2
3
4
5
6
7
8
9
10
..
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
diff -uNr tcc-0.9.26.orig/libtcc.c tcc-0.9.26-1tclio/libtcc.c
--- tcc-0.9.26.orig/libtcc.c	2013-02-15 08:24:00.000000000 -0600
+++ tcc-0.9.26-1tclio/libtcc.c	2014-05-02 01:30:08.967140003 -0500
@@ -669,7 +669,7 @@
     bf->line_num = 1;
     bf->ifndef_macro = 0;
     bf->ifdef_stack_ptr = s1->ifdef_stack_ptr;
-    bf->fd = -1;
+    bf->fd = NULL;
     bf->prev = file;
................................................................................
+
+    if (strcmp(filename, "-") == 0) {
+        fd = Tcl_GetStdChannel(TCL_STDIN);
+        filename = "stdin";
+    } else {
+        path = Tcl_NewStringObj(filename,-1);
+        Tcl_IncrRefCount(path);
+        fd = Tcl_FSOpenFileChannel(NULL,path, "r", 0);
+        Tcl_DecrRefCount(path);
+    }
+
+    if ((s1->verbose == 2 && fd != NULL) || s1->verbose == 3)
+        printf("%s %*s%s\n", fd == NULL ? "nf":"->",
                (int)(s1->include_stack_ptr - s1->include_stack), "", filename);
-    if (fd < 0)


|







 







|







1
2
3
4
5
6
7
8
9
10
..
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
diff -uNr tcc-0.9.26.orig/libtcc.c tcc-0.9.26-1tclio/libtcc.c
--- tcc-0.9.26.orig/libtcc.c	2013-02-15 08:24:00.000000000 -0600
+++ tcc-0.9.26-1tclio/libtcc.c	2014-05-22 11:58:28.746517000 -0500
@@ -669,7 +669,7 @@
     bf->line_num = 1;
     bf->ifndef_macro = 0;
     bf->ifdef_stack_ptr = s1->ifdef_stack_ptr;
-    bf->fd = -1;
+    bf->fd = NULL;
     bf->prev = file;
................................................................................
+
+    if (strcmp(filename, "-") == 0) {
+        fd = Tcl_GetStdChannel(TCL_STDIN);
+        filename = "stdin";
+    } else {
+        path = Tcl_NewStringObj(filename,-1);
+        Tcl_IncrRefCount(path);
+        fd = Tcl_FSOpenFileChannel(NULL,path, "RDONLY BINARY", 0);
+        Tcl_DecrRefCount(path);
+    }
+
+    if ((s1->verbose == 2 && fd != NULL) || s1->verbose == 3)
+        printf("%s %*s%s\n", fd == NULL ? "nf":"->",
                (int)(s1->include_stack_ptr - s1->include_stack), "", filename);
-    if (fd < 0)