~ chicken-core (chicken-5) 381f641010b7fbfec53b9932dcd87c8bd5f86c0e
commit 381f641010b7fbfec53b9932dcd87c8bd5f86c0e
Author: Evan Hanson <evhan@foldling.org>
AuthorDate: Wed Feb 14 12:14:29 2018 +1300
Commit: Evan Hanson <evhan@foldling.org>
CommitDate: Wed Feb 14 08:11:43 2018 +1300
Rename C_C_fileno to C_port_fileno and move to chicken.h
diff --git a/chicken.h b/chicken.h
index ff5bd9ee..150736c4 100644
--- a/chicken.h
+++ b/chicken.h
@@ -1033,6 +1033,7 @@ typedef void (C_ccall *C_proc)(C_word, C_word *) C_noret;
#define C_mk_bool(x) ((x) ? C_SCHEME_TRUE : C_SCHEME_FALSE)
#define C_mk_nbool(x) ((x) ? C_SCHEME_FALSE : C_SCHEME_TRUE)
#define C_port_file(p) C_CHECKp(p,C_portp(C_VAL1(p)),(C_FILEPTR)C_block_item(C_VAL1(p), 0))
+#define C_port_fileno(p) C_fix(C_fileno(C_port_file(p)))
#define C_data_pointer(b) C_CHECKp(b,C_blockp((C_word)C_VAL1(b)),(void *)(((C_SCHEME_BLOCK *)(C_VAL1(b)))->data))
#define C_bignum_negativep(b) C_CHECKp(b,C_bignump(C_VAL1(b)),(C_block_item(C_internal_bignum_vector(C_VAL1(b)),0)!=0))
#define C_bignum_digits(b) C_CHECKp(b,C_bignump(C_VAL1(b)),(((C_uword *)C_data_pointer(C_internal_bignum_vector(C_VAL1(b))))+1))
diff --git a/port.scm b/port.scm
index 818df7d0..234562b3 100644
--- a/port.scm
+++ b/port.scm
@@ -78,8 +78,6 @@
# include <termios.h>
#endif
-#define C_C_fileno(p) C_fix(fileno(C_port_file(p)))
-
#if !defined(__ANDROID__) && defined(TIOCGWINSZ)
static int get_tty_size(int fd, int *rows, int *cols)
{
@@ -432,7 +430,7 @@ char *ttyname(int fd) {
(let ((ttyname (foreign-lambda c-string "ttyname" int)))
(lambda (port)
(check-terminal! 'terminal-name port)
- (or (ttyname (##core#inline "C_C_fileno" port))
+ (or (ttyname (##core#inline "C_port_fileno" port))
(posix-error #:error 'terminal-name
"cannot determine terminal name" port)))))
@@ -444,7 +442,7 @@ char *ttyname(int fd) {
(check-terminal! 'terminal-size port)
(let-location ((columns int)
(rows int))
- (if (fx= 0 (ttysize (##core#inline "C_C_fileno" port)
+ (if (fx= 0 (ttysize (##core#inline "C_port_fileno" port)
(location columns)
(location rows)))
(values columns rows)
diff --git a/posix-common.scm b/posix-common.scm
index 1730026c..adab12a9 100644
--- a/posix-common.scm
+++ b/posix-common.scm
@@ -92,7 +92,6 @@ static char C_time_string [TIME_STRING_MAXLENGTH + 1];
#define C_asctime(v, tm) (asctime(C_tm_set((v), (tm))))
#define C_fdopen(a, n, fd, m) C_mpointer(a, fdopen(C_unfix(fd), C_c_string(m)))
-#define C_C_fileno(p) C_fix(fileno(C_port_file(p)))
#define C_dup(x) C_fix(dup(C_unfix(x)))
#define C_dup2(x, y) C_fix(dup2(C_unfix(x), C_unfix(y)))
@@ -436,7 +435,7 @@ EOF
;; Peter agrees with that. I think. Have a nice day.
(##sys#slot (##sys#port-data port) 0) ]
[(not (zero? (##sys#peek-unsigned-integer port 0)))
- (let ([fd (##core#inline "C_C_fileno" port)])
+ (let ([fd (##core#inline "C_port_fileno" port)])
(when (fx< fd 0)
(posix-error #:file-error 'port->fileno "cannot access file-descriptor of port" port) )
fd) ]
diff --git a/posixwin.scm b/posixwin.scm
index 7d97c426..a9e53525 100644
--- a/posixwin.scm
+++ b/posixwin.scm
@@ -921,7 +921,7 @@ static int set_file_mtime(char *filename, C_word atime, C_word mtime)
(lambda (port)
(##sys#check-open-port port 'port->fileno)
(if (not (zero? (##sys#peek-unsigned-integer port 0)))
- (let ([fd (##core#inline "C_C_fileno" port)])
+ (let ([fd (##core#inline "C_port_fileno" port)])
(when (fx< fd 0)
(##sys#update-errno)
(##sys#signal-hook #:file-error 'port->fileno "cannot access file-descriptor of port" port) )
Trap