mirror of
https://github.com/justinethier/cyclone.git
synced 2025-07-04 03:36:34 +02:00
Issue #328 - Redefine as library functions
This is the first part of an attempt to migrate file-exists? and delete-file away from being primitives.
This commit is contained in:
parent
4fce12afb0
commit
52367439c4
1 changed files with 15 additions and 2 deletions
|
@ -10,8 +10,8 @@
|
||||||
(export
|
(export
|
||||||
call-with-input-file
|
call-with-input-file
|
||||||
call-with-output-file
|
call-with-output-file
|
||||||
;delete-file
|
delete-file
|
||||||
;file-exists?
|
file-exists?
|
||||||
;open-binary-input-file
|
;open-binary-input-file
|
||||||
;open-binary-output-file
|
;open-binary-output-file
|
||||||
;open-input-file
|
;open-input-file
|
||||||
|
@ -20,7 +20,20 @@
|
||||||
with-output-to-file
|
with-output-to-file
|
||||||
)
|
)
|
||||||
(import (scheme base))
|
(import (scheme base))
|
||||||
|
(inline
|
||||||
|
file-exists?
|
||||||
|
delete-file)
|
||||||
(begin
|
(begin
|
||||||
|
(define-c file-exists?
|
||||||
|
"(void *data, int argc, closure _, object k, object filename)"
|
||||||
|
" return_closcall1(data, k, Cyc_io_file_exists(data, filename));"
|
||||||
|
"(void *data, object ptr, object filename)"
|
||||||
|
" return Cyc_io_file_exists(data, filename);")
|
||||||
|
(define-c delete-file
|
||||||
|
"(void *data, int argc, closure _, object k, object filename)"
|
||||||
|
" return_closcall1(data, k, Cyc_io_delete_file(data, filename));"
|
||||||
|
"(void *data, object ptr, object filename)"
|
||||||
|
" return Cyc_io_delete_file(data, filename);")
|
||||||
(define (call-with-input-file string proc)
|
(define (call-with-input-file string proc)
|
||||||
(call-with-port (open-input-file string) proc))
|
(call-with-port (open-input-file string) proc))
|
||||||
(define (call-with-output-file string proc)
|
(define (call-with-output-file string proc)
|
||||||
|
|
Loading…
Add table
Reference in a new issue