* open-input-file now uses a bytevector representing the filename

during ffi.
This commit is contained in:
Abdulaziz Ghuloum 2007-05-18 21:03:14 -04:00
parent 498084a6e8
commit 1586986dbe
4 changed files with 10 additions and 2 deletions

Binary file not shown.

View File

@ -805,7 +805,14 @@ ikp ikrt_read(ikp fd, ikp buff, ikpcb* pcb){
ikp
ikrt_open_input_file(ikp fname, ikpcb* pcb){
int fd = open(string_data(fname), O_RDONLY);
char* name;
if(tagof(fname) == bytevector_tag){
name = (char*) fname + off_bytevector_data;
} else {
fprintf(stderr, "bug in ikrt_open_input_file\n");
exit(-1);
}
int fd = open(name, O_RDONLY);
if(fd == -1){
return false_object;
} else {

Binary file not shown.

View File

@ -141,7 +141,8 @@
(define $open-input-file
(lambda (filename)
(close-ports)
(let ([fd/error (foreign-call "ikrt_open_input_file" filename)])
(let ([fd/error (foreign-call "ikrt_open_input_file"
(string->utf8-bytevector filename))])
(if (fixnum? fd/error)
(let ([port (make-input-port
(make-input-file-handler fd/error filename)