"pretty printing" modules.scm; in fact, rearranging definitions

This commit is contained in:
interp 2002-05-13 13:58:19 +00:00
parent 69d33b3afc
commit d188ba7ddb
1 changed files with 421 additions and 345 deletions

View File

@ -1,6 +1,12 @@
;;; Scheme 48 module definitions for TCP/IP protocol suites. ;;; Scheme 48 module definitions for TCP/IP protocol suites.
;;; Copyright (c) 1995 by Olin Shivers. ;;; Copyright (c) 1995 by Olin Shivers.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; Utilities / nice things
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; format-net
(define-interface format-net-interface (define-interface format-net-interface
(export format-internet-host-address (export format-internet-host-address
format-port)) format-port))
@ -10,6 +16,8 @@
scheme scheme
let-opt) ; :optional let-opt) ; :optional
(files format-net)) (files format-net))
;;; sunet utilities
(define-interface sunet-utilities-interface (define-interface sunet-utilities-interface
(export host-name-or-ip (export host-name-or-ip
@ -23,6 +31,67 @@
handle-fatal-error) handle-fatal-error)
(files sunet-utilities)) (files sunet-utilities))
;;; rate limit
(define-interface rate-limit-interface
(export make-rate-limiter
rate-limit-block
rate-limit-open
rate-limit-close
rate-limiter-current-requests))
(define-structure rate-limit rate-limit-interface
(open scheme
define-record-types
locks
signals)
(files rate-limit))
;;; CRLF-IO
(define-interface crlf-io-interface
(export read-crlf-line
read-crlf-line-timeout
write-crlf))
(define-structure crlf-io crlf-io-interface
(open ascii ; ascii->char
scsh ; read-line write-string force-output
receiving ; MV return (RECEIVE and VALUES)
let-opt ; let-optionals
threads ; sleep
scheme)
(files crlf-io))
;;; ecm utilities
;; some utilities for the ecm-stuff (ftp, pop3, smtp, nettime)
;; hope we can vanish this soon
(define-interface ecm-utilities-interface
(export system-fqdn
safe-first
safe-second
write-crlf
dump))
(define-structure ecm-utilities ecm-utilities-interface
(open scsh
string-lib
scheme)
(files ecm-utilities))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; Clients / RFC
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; SMTP
(define-interface smtp-interface (define-interface smtp-interface
(export sendmail %sendmail (export sendmail %sendmail
expn vrfy mail-help expn vrfy mail-help
@ -58,20 +127,7 @@
(files smtp)) (files smtp))
(define-interface crlf-io-interface ;;; RFC 822
(export read-crlf-line
read-crlf-line-timeout
write-crlf))
(define-structure crlf-io crlf-io-interface
(open ascii ; ascii->char
scsh ; read-line write-string force-output
receiving ; MV return (RECEIVE and VALUES)
let-opt ; let-optionals
threads ; sleep
scheme)
(files crlf-io))
(define-interface rfc822-interface (define-interface rfc822-interface
(export read-rfc822-headers (export read-rfc822-headers
@ -97,6 +153,8 @@
(files rfc822)) (files rfc822))
;;; URI
(define-interface uri-interface (define-interface uri-interface
(export parse-uri (export parse-uri
uri-escaped-chars uri-escaped-chars
@ -120,6 +178,7 @@
scheme) scheme)
(files uri)) (files uri))
;;; URL
(define-interface url-interface (define-interface url-interface
(export userhost? ; USERHOST (export userhost? ; USERHOST
@ -167,25 +226,247 @@
(files url)) (files url))
(define-interface httpd-error-interface ;;; ftp client
(export http-error?
http-error
fatal-syntax-error?
fatal-syntax-error))
(define-structure httpd-error httpd-error-interface ;; ftp.scm is a module for transfering files between networked
(open conditions signals handle scheme) ;; machines using the File Transfer Protocol
(files httpd-error))
(define-interface ftp-interface
(export ftp-connect
ftp-login
ftp-type
ftp-rename
ftp-delete
ftp-cd
ftp-cdup
ftp-pwd
ftp-rmdir
ftp-mkdir
ftp-modification-time
ftp-size
ftp-abort
ftp-quit
ftp-ls
ftp-dir
ftp-get
ftp-put
ftp-append
ftp-quot
ftp-error?))
(define-structure ftp ftp-interface
(open netrc
scsh
defrec-package
receiving
handle
conditions
signals
error-package
ecm-utilities
string-lib
let-opt
scheme)
(files ftp))
;; obsolete ftp client
(define-interface ftp-obsolete-interface
(export ftp:connect
ftp:login
ftp:type
ftp:rename
ftp:delete
ftp:cd
ftp:cdup
ftp:pwd
ftp:rmdir
ftp:mkdir
ftp:modification-time
ftp:size
ftp:abort
ftp:quit
ftp:ls
ftp:dir
ftp:get
ftp:put
ftp:append
ftp:quot))
(define-structure ftp-obsolete ftp-obsolete-interface
(open scsh
scheme
ftp)
(files ftp-obsolete))
(define-interface handle-fatal-error-interface ;;; netrc parsing
(export with-fatal-error-handler*
(with-fatal-error-handler :syntax)))
(define-structure handle-fatal-error handle-fatal-error-interface ;; netrc.scm is a module for parsing ~/.netrc files, to obtain login
(open scheme conditions handle) ;; and password information for different network hosts.
(files handle-fatal-error))
(define-interface netrc-interface
(export user-mail-address
netrc:lookup
netrc:lookup-password
netrc:lookup-login
netrc:parse
netrc:try-parse
netrc-refuse?))
(define-structure netrc netrc-interface
(open defrec-package
records
scsh
error-package
ecm-utilities
string-lib
conditions signals handle
let-opt
scheme)
(files netrc))
;;; POP3 client
;; pop3.scm is a module for accessing email on a maildrop server,
;; using the POP3 protocol.
(define-interface pop3-interface
(export pop3-connect
pop3-login
pop3-stat
pop3-get
pop3-headers
pop3-last
pop3-delete
pop3-reset
pop3-quit))
(define-structure pop3 pop3-interface
(open netrc
scsh
defrec-package
handle
conditions
signals
ecm-utilities
string-lib
scheme)
(files pop3))
;; obsolete pop3
(define-interface pop3-obsolete-interface
(export pop3:connect
pop3:login
pop3:stat
pop3:get
pop3:headers
pop3:last
pop3:delete
pop3:reset
pop3:quit))
(define-structure pop3-obsolete pop3-obsolete-interface
(open scsh
scheme
pop3)
(files pop3-obsolete))
;;; nettime
;; nettime.scm is a module for requesting the time on remote machines,
;; using the time or the daytime protocol
(define-interface nettime-interface
(export net-time
net-daytime))
(define-structure nettime nettime-interface
(open scsh
scheme)
(files nettime))
;; obsolete nettime
(define-structure nettime-obsolete nettime-obsolete-interface
(open scsh
scheme
nettime)
(files nettime-obsolete))
(define-interface nettime-obsolete-interface
(export net:time
net:daytime))
;;; ls
;; clone of unix' ls
(define-interface ls-interface
(export ls-crlf?
ls
arguments->ls-flags))
(define-structure ls ls-interface
(open scheme handle
big-scheme bitwise
fluids
crlf-io
scsh)
(files ls))
;;; DNS
;; dns.scm is a module to resolve hostnames and ip-addresses.
;; it implements the rfc1035.
(define-interface dns-interface
(export dns-clear-cache
dns-lookup
dns-lookup-name
dns-inverse-lookup
dns-lookup-ip
dns-lookup-nameserver
dns-lookup-mail-exchanger
concurrent-lookup
show-dns-message
dns-find-nameserver
dns-find-nameserver-list))
(define-structure dns dns-interface
(open scheme
scsh
big-util
tables
ascii
formats
signals
defrec-package
random
queues
threads
locks)
(files dns))
;;; CGI script
;;; For writing CGI scripts in Scheme.
(define-interface cgi-script-interface (export cgi-form-query))
(define-structure cgi-script cgi-script-interface
(open scsh
error-package
parse-html-forms
scheme)
(files cgi-script))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; Servers
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; HTTPD Web-Server
;;; httpd-core
(define-interface httpd-core-interface (define-interface httpd-core-interface
(export server/version (export server/version
@ -249,42 +530,6 @@
begin-http-header begin-http-header
send-http-error-reply)) send-http-error-reply))
(define-interface httpd-make-options-interface
(export with-port
with-root-directory
with-fqdn
with-reported-port
with-path-handler
with-server-admin
with-simultaneous-requests
with-logfile
with-syslog?))
(define-interface httpd-read-options-interface
(export httpd-options-port
httpd-options-root-directory
httpd-options-fqdn
httpd-options-reported-port
httpd-options-path-handler
httpd-options-server-admin
httpd-options-simultaneous-requests
httpd-options-logfile
httpd-options-syslog?))
(define-interface rate-limit-interface
(export make-rate-limiter
rate-limit-block
rate-limit-open
rate-limit-close
rate-limiter-current-requests))
(define-structure rate-limit rate-limit-interface
(open scheme
define-record-types
locks
signals)
(files rate-limit))
(define-structure httpd-core httpd-core-interface (define-structure httpd-core httpd-core-interface
(open threads locks (open threads locks
thread-fluids ; fork-thread thread-fluids ; fork-thread
@ -312,6 +557,32 @@
scheme) scheme)
(files httpd-core)) (files httpd-core))
;;; httpd-make-options
;;; httpd-read-options
(define-interface httpd-make-options-interface
(export with-port
with-root-directory
with-fqdn
with-reported-port
with-path-handler
with-server-admin
with-simultaneous-requests
with-logfile
with-syslog?))
(define-interface httpd-read-options-interface
(export httpd-options-port
httpd-options-root-directory
httpd-options-fqdn
httpd-options-reported-port
httpd-options-path-handler
httpd-options-server-admin
httpd-options-simultaneous-requests
httpd-options-logfile
httpd-options-syslog?))
(define-structures ((httpd-make-options httpd-make-options-interface) (define-structures ((httpd-make-options httpd-make-options-interface)
(httpd-read-options httpd-read-options-interface)) (httpd-read-options httpd-read-options-interface))
(open scheme (open scheme
@ -319,7 +590,50 @@
(files httpd-options)) (files httpd-options))
;;; httpd-access-control
(define-interface httpd-access-control-interface
(export access-denier
access-allower
access-controller
access-controlled-handler))
(define-structure httpd-access-control httpd-access-control-interface
(open big-scheme
httpd-core
httpd-error
string-lib ; STRING-MAP
scsh
scheme)
(files httpd-access-control))
;;; httpd-error
(define-interface httpd-error-interface
(export http-error?
http-error
fatal-syntax-error?
fatal-syntax-error))
(define-structure httpd-error httpd-error-interface
(open conditions signals handle scheme)
(files (httpd httpd-error)))
;;; httpd-fatal-error
(define-interface handle-fatal-error-interface
(export with-fatal-error-handler*
(with-fatal-error-handler :syntax)))
(define-structure handle-fatal-error handle-fatal-error-interface
(open scheme conditions handle)
(files (httpd handle-fatal-error)))
;;; parse-html-forms
;;; For parsing submissions from HTML forms. ;;; For parsing submissions from HTML forms.
(define-interface parse-html-forms-interface (define-interface parse-html-forms-interface
(export parse-html-form-query unescape-uri+)) (export parse-html-form-query unescape-uri+))
@ -334,40 +648,7 @@
(files parse-forms)) (files parse-forms))
;;; For writing CGI scripts in Scheme. ;;; htmlout
(define-interface cgi-script-interface (export cgi-form-query))
(define-structure cgi-script cgi-script-interface
(open scsh
error-package
parse-html-forms
scheme)
(files cgi-script))
;;; Provides the server interface to CGI scripts.
(define-interface cgi-server-interface
(export cgi-default-bin-path
cgi-handler))
(define-structure cgi-server cgi-server-interface
(open string-lib
rfc822
crlf-io ; WRITE-CRLF
uri
url ; HTTP-URL record type
httpd-core ; REQUEST record type, HTTP-ERROR & reply codes
; version stuff
httpd-basic-handlers ; HTTP-HOMEDIR, SERVE-ROOTED-FILE-PATH
httpd-error ; HTTP-ERROR
scsh-utilities ; INDEX
scsh ; syscalls
formats ; format
format-net ; FORMAT-INTERNET-HOST-ADDRESS
sunet-utilities ; host-name-or-empty
let-opt ; let-optionals
scheme)
(files cgi-server))
(define-interface htmlout-interface (define-interface htmlout-interface
(export emit-tag (export emit-tag
@ -388,6 +669,10 @@
(files htmlout)) (files htmlout))
;; path-handlers
;;; httpd-basic-handlers
(define-interface httpd-basic-handlers-interface (define-interface httpd-basic-handlers-interface
(export alist-path-dispatcher (export alist-path-dispatcher
home-dir-handler home-dir-handler
@ -416,9 +701,11 @@
handle-fatal-error ; WITH-FATAL-ERROR-HANDLER handle-fatal-error ; WITH-FATAL-ERROR-HANDLER
string-lib ; STRING-JOIN string-lib ; STRING-JOIN
scheme) scheme)
(files httpd-handlers)) (files (httpd httpd-handlers)))
;;; seval-handler
(define-interface seval-handler-interface (define-interface seval-handler-interface
(export seval-handler)) (export seval-handler))
@ -441,21 +728,8 @@
(files seval)) (files seval))
(define-interface httpd-access-control-interface
(export access-denier
access-allower
access-controller
access-controlled-handler))
(define-structure httpd-access-control httpd-access-control-interface
(open big-scheme
httpd-core
httpd-error
string-lib ; STRING-MAP
scsh
scheme)
(files httpd-access-control))
;;; info-gateway
(define-interface info-gateway-interface (define-interface info-gateway-interface
(export info-handler (export info-handler
@ -477,6 +751,8 @@
(files info-gateway)) (files info-gateway))
;;; rman-gateway
(define-interface rman-gateway-interface (define-interface rman-gateway-interface
(export rman-handler (export rman-handler
man man
@ -503,18 +779,34 @@
(files rman-gateway)) (files rman-gateway))
(define-interface ls-interface ;;; CGI Server
(export ls-crlf?
ls
arguments->ls-flags))
(define-structure ls ls-interface ;;; Provides the server interface to CGI scripts.
(open scheme handle (define-interface cgi-server-interface
big-scheme bitwise (export cgi-default-bin-path
fluids cgi-handler))
crlf-io
scsh) (define-structure cgi-server cgi-server-interface
(files ls)) (open string-lib
rfc822
crlf-io ; WRITE-CRLF
uri
url ; HTTP-URL record type
httpd-core ; REQUEST record type, HTTP-ERROR & reply codes
; version stuff
httpd-basic-handlers ; HTTP-HOMEDIR, SERVE-ROOTED-FILE-PATH
httpd-error ; HTTP-ERROR
scsh-utilities ; INDEX
scsh ; syscalls
formats ; format
format-net ; FORMAT-INTERNET-HOST-ADDRESS
sunet-utilities ; host-name-or-empty
let-opt ; let-optionals
scheme)
(files cgi-server))
;;; FTP server: ftpd
(define-interface ftpd-interface (define-interface ftpd-interface
(export ftpd (export ftpd
@ -541,198 +833,13 @@
(access big-scheme) (access big-scheme)
(files ftpd)) (files ftpd))
;; some utilities for the following stuff ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; hope we can vanish this soon ;;; else: TOOTHLESS
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(define-interface ecm-utilities-interface
(export system-fqdn
safe-first
safe-second
write-crlf
dump))
(define-structure ecm-utilities ecm-utilities-interface
(open scsh
string-lib
scheme)
(files ecm-utilities))
;; netrc.scm is a module for parsing ~/.netrc files, to obtain login
;; and password information for different network hosts.
(define-interface netrc-interface
(export user-mail-address
netrc:lookup
netrc:lookup-password
netrc:lookup-login
netrc:parse
netrc:try-parse
netrc-refuse?))
(define-structure netrc netrc-interface
(open defrec-package
records
scsh
error-package
ecm-utilities
string-lib
conditions signals handle
let-opt
scheme)
(files netrc))
;; ftp.scm is a module for transfering files between networked
;; machines using the File Transfer Protocol
(define-interface ftp-obsolete-interface
(export ftp:connect
ftp:login
ftp:type
ftp:rename
ftp:delete
ftp:cd
ftp:cdup
ftp:pwd
ftp:rmdir
ftp:mkdir
ftp:modification-time
ftp:size
ftp:abort
ftp:quit
ftp:ls
ftp:dir
ftp:get
ftp:put
ftp:append
ftp:quot))
(define-structure ftp-obsolete ftp-obsolete-interface
(open netrc
scsh
defrec-package
receiving
handle
conditions
signals
error-package
ecm-utilities
string-lib
let-opt
ftp
scheme)
(files ftp-obsolete))
(define-interface ftp-interface
(export ftp-connect
ftp-login
ftp-type
ftp-rename
ftp-delete
ftp-cd
ftp-cdup
ftp-pwd
ftp-rmdir
ftp-mkdir
ftp-modification-time
ftp-size
ftp-abort
ftp-quit
ftp-ls
ftp-dir
ftp-get
ftp-put
ftp-append
ftp-quot
ftp-error?))
(define-structure ftp ftp-interface
(open netrc
scsh
defrec-package
receiving
handle
conditions
signals
error-package
ecm-utilities
string-lib
let-opt
scheme)
(files ftp))
;; pop3.scm is a module for accessing email on a maildrop server,
;; using the POP3 protocol.
(define-interface pop3-interface
(export pop3-connect
pop3-login
pop3-stat
pop3-get
pop3-headers
pop3-last
pop3-delete
pop3-reset
pop3-quit))
(define-interface pop3-obsolete-interface
(export pop3:connect
pop3:login
pop3:stat
pop3:get
pop3:headers
pop3:last
pop3:delete
pop3:reset
pop3:quit))
(define-structure pop3 pop3-interface
(open netrc
scsh
defrec-package
handle
conditions
signals
ecm-utilities
string-lib
scheme)
(files pop3))
(define-structure pop3-obsolete pop3-obsolete-interface
(open scsh
scheme
pop3)
(files pop3-obsolete))
;; nettime.scm is a module for requesting the time on remote machines,
;; using the time or the daytime protocol
(define-interface nettime-interface
(export net-time
net-daytime))
(define-interface nettime-obsolete-interface
(export net:time
net:daytime))
(define-structure nettime nettime-interface
(open scsh
scheme)
(files nettime))
(define-structure nettime-obsolete nettime-obsolete-interface
(open scsh
scheme
nettime)
(files nettime-obsolete))
;;; Here is toothless.scm
;;; Shouldn't the definitions be in an extra file? Andreas.
;;; -*- Scheme -*- ;;; -*- Scheme -*-
;;; This file defines a Scheme 48 module that is R4RS without features that ;;; This file defines a Scheme 48 module that is R4RS without features
;;; could examine or effect the file system. You can also use it ;;; that could examine or effect the file system. You can also use it
;;; as a model of how to execute code in other protected environments ;;; as a model of how to execute code in other protected environments
;;; in S48. ;;; in S48.
;;; ;;;
@ -796,34 +903,3 @@
(ignore-errors (lambda () (eval exp (new-safe-package))))))) (ignore-errors (lambda () (eval exp (new-safe-package)))))))
;; dns.scm is a module to resolve hostnames and ip-addresses.
;; it implements the rfc1035.
(define-interface dns-interface
(export dns-clear-cache
dns-lookup
dns-lookup-name
dns-inverse-lookup
dns-lookup-ip
dns-lookup-nameserver
dns-lookup-mail-exchanger
concurrent-lookup
show-dns-message
dns-find-nameserver
dns-find-nameserver-list))
(define-structure dns dns-interface
(open scheme
scsh
big-util
tables
ascii
formats
signals
defrec-package
random
queues
threads
locks)
(files dns))