[Wisp-cvs] wisp/src/builtin modular.wisp,1.61,1.62 stdenv.wisp,1.356,1.357
Status: Alpha
Brought to you by:
digg
|
From: <di...@us...> - 2002-09-04 14:30:59
|
Update of /cvsroot/wisp/wisp/src/builtin
In directory usw-pr-cvs1:/tmp/cvs-serv30082/src/builtin
Modified Files:
modular.wisp stdenv.wisp
Log Message:
Dropped the |gimme| special form and created the builtin module mechanism.
Index: modular.wisp
===================================================================
RCS file: /cvsroot/wisp/wisp/src/builtin/modular.wisp,v
retrieving revision 1.61
retrieving revision 1.62
diff -u -d -r1.61 -r1.62
--- modular.wisp 4 Sep 2002 14:29:47 -0000 1.61
+++ modular.wisp 4 Sep 2002 14:30:56 -0000 1.62
@@ -37,7 +37,32 @@
exports)
(pick-dict-items home-dict exports)))
-(define modules (make-box '()))
+(define modules ; a box containing an alist
+ (make-box
+ (list
+ ; builtin modules
+ (cons 'syscalls
+ (metacode
+ (cons 'list
+ (map (lambda (x) `(cons ',x ,x))
+ '(fdset-ref make-fdset sys:chdir sys:chmod sys:close
+ sys:dup sys:dup2 sys:errno->name sys:execve sys:exit
+ sys:fcntl:cloexec sys:fcntl:dupfd sys:fcntl:flags
+ sys:fcntl:getlk sys:fcntl:setlk sys:fcntl:setlkw
+ sys:for-dir-entries sys:fork sys:fstat sys:ftruncate
+ sys:getcwd sys:getegid sys:geteuid sys:getgid
+ sys:getpgid sys:getpgrp sys:getpid sys:getppid
+ sys:getuid sys:kill sys:link sys:listen sys:lseek
+ sys:lstat sys:mkdir sys:nanosleep sys:open sys:pipe
+ sys:read sys:rename sys:select sys:setpgid sys:setpgrp
+ sys:setsid sys:stat sys:symlink sys:sync sys:tcgetattr
+ sys:tcsetattr sys:truncate sys:unlink sys:waitpid
+ sys:write)))))
+ (cons 'semiraw-files
+ (metacode
+ (cons 'list
+ (map (lambda (x) `(cons ',x ,x))
+ '(init-input-file init-output-file))))))))
(define (%get-module module-name)
(my exportion (and (assq module-name modules[]) => cdr)
Index: stdenv.wisp
===================================================================
RCS file: /cvsroot/wisp/wisp/src/builtin/stdenv.wisp,v
retrieving revision 1.356
retrieving revision 1.357
diff -u -d -r1.356 -r1.357
--- stdenv.wisp 4 Sep 2002 14:29:47 -0000 1.356
+++ stdenv.wisp 4 Sep 2002 14:30:56 -0000 1.357
@@ -6,44 +6,6 @@
;;
;;;; @(#) $Id$
-(define syscalls
- (metacode
- (cons
- 'list
- (map (lambda (x) `(cons ',x ,x))
- '(fdset-ref make-fdset sys:chdir sys:chmod sys:close sys:dup
- sys:dup2 sys:errno->name sys:execve sys:exit
- sys:fcntl:cloexec sys:fcntl:dupfd sys:fcntl:flags
- sys:fcntl:getlk sys:fcntl:setlk sys:fcntl:setlkw
- sys:for-dir-entries sys:fork sys:fstat sys:ftruncate
- sys:getcwd sys:getegid sys:geteuid sys:getgid sys:getpgid
- sys:getpgrp sys:getpid sys:getppid sys:getuid sys:kill
- sys:link sys:listen sys:lseek sys:lstat sys:mkdir
- sys:nanosleep sys:open sys:pipe sys:read sys:rename
- sys:select sys:setpgid sys:setpgrp sys:setsid sys:stat
- sys:symlink sys:sync sys:tcgetattr sys:tcsetattr sys:truncate
- sys:unlink sys:waitpid sys:write)))))
-
-(define (provide-syscalls target)
- (for-each (lambda (p)
- (set! (dict-ref target (car p)) (cdr p)))
- syscalls))
-
-(define (provide-semiraw-files target)
- (set! (dict-ref target 'init-input-file) init-input-file)
- (set! (dict-ref target 'init-output-file) init-output-file))
-
-(defmacro (gimme something)
- (case something
- ((syscalls)
- ; Note that this depends on provide-syscalls being available.
- ; It's supposed to.
- `(provide-syscalls ',*source-dictionary*))
- ((semiraw-files)
- `(provide-semiraw-files ',*source-dictionary*))
- (else
- (raise 'unknown something))))
-
(letrec
((invariably-regular-items
(metacode
@@ -90,8 +52,8 @@
file-stat file-type file? filter find find-tail first
fit-for-symbol? fit-for-variable-name? fixnum? flatten
floor for-all-env-vars for-dir-entries for-each fourth
- fraction? freeze-class frer->structure gimme hache hide*
- incr! init-port input-port? instance? integer->char
+ fraction? freeze-class frer->structure hache hide* incr!
+ init-port input-port? instance? integer->char
integer->string integer? intermingle keyword? lambda-pack
last-cons length let let* letrec list list->semideque
list->vector list-copy list-ref list? load lookup-slot
@@ -106,8 +68,7 @@
parse-character-body parse-lambda-list peek-char
peek-string pick-dict-items port? portio-debugging
positive? prep preprocess print procedure->macro
- procedure? provide-semiraw-files provide-syscalls
- quasiquote quotient raise rassoc rassq rassv
+ procedure? quasiquote quotient raise rassoc rassq rassv
rational->cons rational? read read-all=> read-char
read-char-sequence read-character-body read-directory
read-line read-string read-whole-file real? rec
@@ -140,8 +101,6 @@
; check for the regular environment
((rassq obj invariably-regular-items)
=> (serial car (cut list <> 'regular-env)))
- ((rassq obj syscalls)
- => (serial car (cut list <> 'gimme 'syscalls)))
((eq? obj *origin) (list 'origin 'regular-env))
((eq? obj *regular-env) (list 'regular-env))
; scan module export lists
|