porting (chibi temp-file) and (chibi zlib) to chicken

This commit is contained in:
Alex Shinn 2017-03-25 18:26:35 +09:00
parent e8c9def652
commit be907a31e3
3 changed files with 29 additions and 4 deletions

View file

@ -454,7 +454,9 @@ snowballs:
$(SNOW_CHIBI) package lib/chibi/string.sld
$(SNOW_CHIBI) package lib/chibi/sxml.sld
$(SNOW_CHIBI) package lib/chibi/tar.sld
$(SNOW_CHIBI) package lib/chibi/temp-file.sld
$(SNOW_CHIBI) package lib/chibi/term/ansi.sld
$(SNOW_CHIBI) package lib/chibi/term/edit-line.sld
$(SNOW_CHIBI) package lib/chibi/test.sld
$(SNOW_CHIBI) package lib/chibi/uri.sld
$(SNOW_CHIBI) package lib/chibi/zlib.sld

View file

@ -1,5 +1,12 @@
(define-library (chibi temp-file)
(export call-with-temp-file call-with-temp-dir)
(import (scheme base) (scheme time) (srfi 33)
(chibi filesystem) (chibi pathname) (chibi process))
(import (scheme base) (scheme time)
(chibi filesystem) (chibi pathname))
(cond-expand
((library (srfi 33)) (import (srfi 33)))
(else (import (srfi 60))))
(cond-expand
(chibi (import (only (chibi process) current-process-id)))
(chicken (import (only (posix) current-process-id)))
(else (begin (define (current-process-id) 0))))
(include "temp-file.scm"))

View file

@ -1,6 +1,22 @@
(define-library (chibi zlib)
(export gzip-file gunzip-file gzip gunzip maybe-gunzip)
(import (scheme base) (scheme write)
(chibi io) (chibi process) (chibi temp-file))
(import (scheme base)
(chibi temp-file))
(cond-expand
(chibi (import (chibi process)))
(chicken
(import (rename (chicken) (system %system))
(only (data-structures) intersperse)
(only (posix) process))
(begin
(define (system . args)
(%system (apply string-append (intersperse args " "))))
(define (process->bytevector cmd)
(call-with-values (lambda ()
(if (pair? cmd)
(process (car cmd) (cdr cmd))
(process cmd)))
(lambda (in out pid)
(read-bytevector #f in)))))))
(include "zlib.scm"))