diff options
-rw-r--r-- | Makefile | 6 | ||||
-rw-r--r-- | debian/changelog | 122 | ||||
-rw-r--r-- | debian/control | 14 | ||||
-rw-r--r-- | debian/copyright | 30 | ||||
-rw-r--r-- | debian/postinst | 17 | ||||
-rw-r--r-- | debian/postrm | 5 | ||||
-rw-r--r-- | debian/prerm | 8 | ||||
-rwxr-xr-x | debian/rules | 92 | ||||
-rw-r--r-- | debian/slibconfig | 7 | ||||
-rw-r--r-- | factor.txi | 73 | ||||
-rw-r--r-- | htmlform.scm | 16 | ||||
-rw-r--r-- | htmlform.txi | 286 | ||||
-rw-r--r-- | lineio.txi | 51 | ||||
-rw-r--r-- | nclients.scm | 4 | ||||
-rw-r--r-- | nclients.txi | 115 | ||||
-rw-r--r-- | obj2str.txi | 17 | ||||
-rw-r--r-- | randinex.txi | 74 | ||||
-rw-r--r-- | random.txi | 69 | ||||
-rw-r--r-- | slib.texi | 10 | ||||
-rw-r--r-- | strsrch.scm | 4 | ||||
-rw-r--r-- | version.txi | 2 |
21 files changed, 1003 insertions, 19 deletions
@@ -33,7 +33,7 @@ html: $(htmldir)slib_toc.html $(htmldir)slib_toc.html: slib slib_toc.html Makefile hitch slib/slib_\*.html slib_\*.html $(htmldir) -prefix = /usr/local +prefix = debian/tmp/usr exec_prefix = $(prefix) bindir = $(exec_prefix)/bin libdir = $(exec_prefix)/lib @@ -118,7 +118,7 @@ slib$(VERSION).info: version.txi slib.texi htmlform.txi objdoc.txi mv slib.info slib$(VERSION).info -mv slibtemp.info slib.info slib.info: slib$(VERSION).info - infobar slib/slib.info slib$(VERSION).info slib.info +# infobar slib/slib.info slib$(VERSION).info slib.info info: installinfo installinfo: $(infodir)/slib.info $(infodir)/slib.info: slib.info @@ -296,6 +296,8 @@ report: clean: -rm -f *~ *.bak *.orig *.rej core a.out *.o \#* -rm -rf *temp + -rm -f slib$(VERSION).info + distclean: realclean realclean: -rm -f *~ *.bak *.orig *.rej TAGS core a.out *.o \#* diff --git a/debian/changelog b/debian/changelog new file mode 100644 index 0000000..1c67c6c --- /dev/null +++ b/debian/changelog @@ -0,0 +1,122 @@ +slib (2c7-1) unstable; urgency=low + + * New upstream. + * Add slibconfig back in. + + -- James LewisMoss <dres@debian.org> Mon, 6 Dec 1999 19:32:57 -0500 + +slib (2c6-2) unstable; urgency=low + + * Remove the slib$(VERSION).info file. Cut the diff back down to + size. + + -- James LewisMoss <dres@debian.org> Sat, 13 Nov 1999 14:10:38 -0500 + +slib (2c6-1) unstable; urgency=low + + * New upstream. + * Move docs to /usr/share. Up standards version. add /usr/doc symlink. + Move info files. Remove undocumented link. + + -- James LewisMoss <dres@debian.org> Sat, 13 Nov 1999 12:56:18 -0500 + +slib (2c5-6) unstable; urgency=low + + * Lowercase two vars in yasyn.scm (Fixes bug #37222) + + -- James LewisMoss <dres@debian.org> Sat, 10 Jul 1999 19:17:04 -0400 + +slib (2c5-5) unstable; urgency=low + + * Fix it so string-index isn't defined (now there is a + strsrch:string-index) (Fixes #38812) + + -- James LewisMoss <dres@debian.org> Fri, 9 Jul 1999 21:30:19 -0400 + +slib (2c5-4) unstable; urgency=low + + * Don't run slibconfig in postinst. (Fixes bug #38253, #37733, #37715, + #37746, #37809, #37917, #38123, #38462) + + -- James LewisMoss <dres@debian.org> Thu, 3 Jun 1999 20:19:53 -0400 + +slib (2c5-3) unstable; urgency=low + + * Run slibconfig in postinst. It was commented out there, but I don't + see any old bug reports on why it was commented out, so let's try + again. :) (Fixes bug #37221) + + -- James LewisMoss <dres@debian.org> Wed, 12 May 1999 22:37:02 -0400 + +slib (2c5-2) unstable; urgency=low + + * Link mklibcat.scm to mklibcat. Fixes a problem with using slib with + guile. + + -- James LewisMoss <dres@debian.org> Sun, 7 Mar 1999 21:51:35 -0500 + +slib (2c5-1) unstable; urgency=low + + * New upstream. + + -- James LewisMoss <dres@debian.org> Sun, 7 Mar 1999 10:10:27 -0500 + +slib (2c3-4) unstable; urgency=low + + * New maintainer. + + -- James LewisMoss <dres@debian.org> Fri, 26 Feb 1999 00:52:26 -0500 + +slib (2c3-3) frozen unstable; urgency=low + + * Fixes #16235. + * Fixes #19943. + * Fixes #20265. + * Fixes #24917. + * Fixes #27389. + + -- David N. Welton <davidw@efn.org> Mon, 9 Nov 1998 21:18:01 -0800 + +slib (2c3-2) frozen unstable; urgency=low + + * Re-uploaded for slink freeze. + + -- David N. Welton <davidw@efn.org> Mon, 2 Nov 1998 21:07:07 -0800 + +slib (2c3-1) unstable; urgency=low + + * New upstream release. + + -- David N. Welton <davidw@efn.org> Mon, 26 Oct 1998 22:14:30 -0800 + +slib (2c0-3) unstable; urgency=low + + * New maintainer. + * slibconfig script to automatically configure guile. + * Fix type in description, closes: Bug#18996 + + -- Jim Pick <jim@jimpick.com> Sun, 8 Mar 1998 23:05:22 -0800 + +slib (2c0-2) unstable; urgency=low + + * Minor fix for debian/rules targets + + -- Rob Browning <rlb@cs.utexas.edu> Fri, 12 Dec 1997 17:35:22 -0600 + +slib (2c0-1) unstable; urgency=low + + * New upstream source + * New maintainer + + -- Rob Browning <rlb@cs.utexas.edu> Fri, 12 Dec 1997 16:49:13 -0600 + +slib (2a6-1) unstable; urgency=low + + * First Debian release. + + -- Karl Sackett <krs@debian.org> Mon, 16 Dec 1996 09:23:46 -0600 + +Local variables: +mode: debian-changelog +add-log-mailing-address: "dres@debian.org" +End: diff --git a/debian/control b/debian/control new file mode 100644 index 0000000..3b3cde5 --- /dev/null +++ b/debian/control @@ -0,0 +1,14 @@ +Source: slib +Section: devel +Priority: optional +Maintainer: James LewisMoss <dres@debian.org> +Standards-Version: 3.0.0 + +Package: slib +Architecture: all +Description: Portable Scheme library. + SLIB is a portable scheme library meant to provide compatibility and + utility functions for all standard scheme implementations. SLIB + includes initialization files for Chez, ELK 2.1, GAMBIT, MacScheme, + MITScheme, scheme->C, Scheme48, T3.1, and VSCM. SCM also supports + SLIB. diff --git a/debian/copyright b/debian/copyright new file mode 100644 index 0000000..65247b2 --- /dev/null +++ b/debian/copyright @@ -0,0 +1,30 @@ +This is the Debian GNU/Linux prepackaged version of slib. + +This package was put together by Rob Browning <rlb@cs.utexas.edu> +from sources obtained from: + + ftp://swiss-ftp.ai.mit.edu/archive/scm/slib2c0.tar.gz + +For more information see: + + http://www-swiss.ai.mit.edu/~jaffer/SLIB.html + +The source files are all subject to the following copyright: + +; Copyright (C) 1991, 1992, 1993, 1994, 1997 Aubrey Jaffer. +; +;Permission to copy this software, to redistribute it, and to use it +;for any purpose is granted, subject to the following restrictions and +;understandings. +; +;1. Any copy made of this software must include this copyright notice +;in full. +; +;2. I have made no warrantee or representation that the operation of +;this software will be error-free, and I am under no obligation to +;provide any services, by way of maintenance, update, or otherwise. +; +;3. In conjunction with products arising from the use of this +;material, there shall be no use of my name in any advertising, +;promotional, or sales literature without prior written consent in +;each case. diff --git a/debian/postinst b/debian/postinst new file mode 100644 index 0000000..2e719ac --- /dev/null +++ b/debian/postinst @@ -0,0 +1,17 @@ +#!/bin/sh +set -e + +install-info --quiet --section "Development" "Development" \ + --description="The SLIB portable Scheme library" \ + /usr/share/info/slib.info.gz + +# OK. This is bad because it really should be in the guile config or in some +# emacs-commond sort of package. +#/usr/sbin/slibconfig + +if [ "$1" = "configure" ]; then + if [ -d /usr/doc -a ! -e /usr/doc/slib -a -d /usr/share/doc/slib ]; then + ln -sf ../share/doc/slib /usr/doc/slib + fi +fi + diff --git a/debian/postrm b/debian/postrm new file mode 100644 index 0000000..abf12d1 --- /dev/null +++ b/debian/postrm @@ -0,0 +1,5 @@ +#!/bin/sh +set -e + +install-info --quiet --remove slib + diff --git a/debian/prerm b/debian/prerm new file mode 100644 index 0000000..853a5c4 --- /dev/null +++ b/debian/prerm @@ -0,0 +1,8 @@ +#!/bin/sh + +set -e + +if [ \( "$1" = "upgrade" -o "$1" = "remove" \) -a -L /usr/doc/slib ]; then + rm -f /usr/doc/slib +fi + diff --git a/debian/rules b/debian/rules new file mode 100755 index 0000000..1a8c9a9 --- /dev/null +++ b/debian/rules @@ -0,0 +1,92 @@ +#! /usr/bin/make -f +# -*-Makefile-*- + +CC =gcc +CFLAGS =-O2 -g -Wall +LDFLAGS = + +SHELL =/bin/sh +srcdir =. + +INSTALL =/usr/bin/install +INSTALL_DIR =$(INSTALL) -d -m 755 -o root -g root +INSTALL_PROGRAM =$(INSTALL) -m 755 -o root -g root +INSTALL_DATA =$(INSTALL) -m 644 -o root -g root +INSTALL_MAN =$(INSTALL) -m 444 -o root -g root + +build: + $(checkdir) + make + texi2html -monolithic slib.texi + touch build + +clean: + $(checkdir) + -rm slib.html + -rm slib.info* + make clean + -rm -f build + -rm -rf debian/tmp* *~ debian/*~ debian/files debian/substvars + +binary-arch: checkroot + $(checkdir) + +binary-indep: checkroot build + $(checkdir) + -rm -rf debian/tmp* + +# debian/tmp + $(INSTALL_DIR) debian/tmp + $(INSTALL_DIR) debian/tmp/DEBIAN + $(INSTALL_PROGRAM) debian/postinst debian/tmp/DEBIAN + $(INSTALL_PROGRAM) debian/prerm debian/tmp/DEBIAN + $(INSTALL_PROGRAM) debian/postrm debian/tmp/DEBIAN + +# library + $(INSTALL_DIR) debian/tmp/usr/share/slib + $(INSTALL_DATA) *.scm debian/tmp/usr/share/slib + # this fixes a load problem with guile + ( cd debian/tmp/usr/share/slib ; ln -s mklibcat.scm mklibcat ) + +# documentation + $(INSTALL_DIR) debian/tmp/usr/share/doc/slib + $(INSTALL_DATA) debian/copyright debian/tmp/usr/share/doc/slib + $(INSTALL_DATA) debian/changelog \ + debian/tmp/usr/share/doc/slib/changelog.Debian + gzip -9v debian/tmp/usr/share/doc/slib/changelog.Debian + + $(INSTALL_DATA) ChangeLog debian/tmp/usr/share/doc/slib/changelog + gzip -9v debian/tmp/usr/share/doc/slib/changelog + $(INSTALL_DATA) README debian/tmp/usr/share/doc/slib + gzip -9v debian/tmp/usr/share/doc/slib/README + $(INSTALL_DATA) FAQ debian/tmp/usr/share/doc/slib + gzip -9v debian/tmp/usr/share/doc/slib/FAQ + $(INSTALL_DATA) slib.html debian/tmp/usr/share/doc/slib + + $(INSTALL_DIR) debian/tmp/usr/share/slib/init + $(INSTALL_DATA) *.init debian/tmp/usr/share/slib/init + +# info pages + $(INSTALL_DIR) debian/tmp/usr/share/info + $(INSTALL_DATA) slib.info* debian/tmp/usr/share/info + gzip -9v debian/tmp/usr/share/info/* + +# slibconfig + + $(INSTALL_DIR) debian/tmp/usr/sbin + $(INSTALL_PROGRAM) debian/slibconfig debian/tmp/usr/sbin + + dpkg-gencontrol + dpkg --build debian/tmp .. + +define checkdir + test -f slib.texi -a -f debian/rules +endef + +binary: binary-indep binary-arch + +checkroot: + $(checkdir) + test root = "`whoami`" + +.PHONY: config build clean binary binary-arch binary-indep diff --git a/debian/slibconfig b/debian/slibconfig new file mode 100644 index 0000000..05eee30 --- /dev/null +++ b/debian/slibconfig @@ -0,0 +1,7 @@ +#! /bin/sh + +if [ -d /usr/share/guile -a -x /usr/bin/guile ]; then + (cd /usr/share/guile + guile -c "(use-modules (ice-9 slib)) (require 'new-catalog)" + ) +fi diff --git a/factor.txi b/factor.txi new file mode 100644 index 0000000..8277c2b --- /dev/null +++ b/factor.txi @@ -0,0 +1,73 @@ + + + +@defvar prime:prngs + + @var{prime:prngs} is the random-state (@pxref{Random Numbers}) used by these + procedures. If you call these procedures from more than one thread + (or from interrupt), @code{random} may complain about reentrant + calls. +@end defvar + + + + + + +@defun jacobi-symbol p q + + Returns the value (+1, @minus{}1, or 0) of the Jacobi-Symbol of + exact non-negative integer @var{p} and exact positive odd integer @var{q}. +@end defun + + +@defvar prime:trials + + @var{prime:trials} the maxinum number of iterations of Solovay-Strassen that will + be done to test a number for primality. +@end defvar + + + + +@defun prime? n + + Returns @code{#f} if @var{n} is composite; @code{#t} if @var{n} is prime. + There is a slight chance @code{(expt 2 (- prime:trials))} that a + composite will return @code{#t}. +@end defun + + + +@defun primes< start count + + Returns a list of the first @var{count} prime numbers less than + @var{start}. If there are fewer than @var{count} prime numbers + less than @var{start}, then the returned list will have fewer than + @var{start} elements. +@end defun + + + +@defun primes> start count + + Returns a list of the first @var{count} prime numbers greater than @var{start}. +@end defun + + + + + + + + + + + + +@defun factor k + + Returns a list of the prime factors of @var{k}. The order of the + factors is unspecified. In order to obtain a sorted list do + @code{(sort! (factor @var{k}) <)}. +@end defun diff --git a/htmlform.scm b/htmlform.scm index c7ce1dc..02dc63a 100644 --- a/htmlform.scm +++ b/htmlform.scm @@ -489,7 +489,7 @@ (define len (string-length str)) (define (sub str) (cond - ((string-index str #\%) + ((strsrch:string-index str #\%) => (lambda (idx) (if (and (< (+ 2 idx) len) (string->number (substring str (+ 1 idx) (+ 2 idx)) 16) @@ -505,7 +505,7 @@ (sub str)) (define (form:split-lines txt) - (let ((idx (string-index txt #\newline)) + (let ((idx (strsrch:string-index txt #\newline)) (carriage-return (integer->char #xd))) (if idx (cons (substring txt 0 @@ -522,11 +522,11 @@ (if (symbol? txt) (set! txt (symbol->string txt))) (set! txt (string-subst txt " " "" "+" " ")) (do ((lst '()) - (edx (string-index txt #\=) - (string-index txt #\=))) + (edx (strsrch:string-index txt #\=) + (strsrch:string-index txt #\=))) ((not edx) lst) (let* ((rxt (substring txt (+ 1 edx) (string-length txt))) - (adx (string-index rxt #\&)) + (adx (strsrch:string-index rxt #\&)) (name (cgi:process-% (substring txt 0 edx)))) (set! lst (append @@ -670,7 +670,7 @@ (set! http:crlf (string (string-ref line 0) #\newline))) (if (eof-object? line) line alist)) (let ((len (string-length line)) - (idx (string-index line #\:))) + (idx (strsrch:string-index line #\:))) (if (char-whitespace? (string-ref line (+ -1 len))) (set! len (+ -1 len))) (and idx (do ((idx2 (+ idx 1) (+ idx2 1))) @@ -691,9 +691,9 @@ (let* ((request-uri (cadr request-line)) (len (string-length request-uri))) (and (> len 3) - (string-index request-uri #\?) + (strsrch:string-index request-uri #\?) (substring request-uri - (+ 1 (string-index request-uri #\?)) + (+ 1 (strsrch:string-index request-uri #\?)) (if (eqv? #\/ (string-ref request-uri (+ -1 len))) (+ -1 len) len))))) diff --git a/htmlform.txi b/htmlform.txi new file mode 100644 index 0000000..c16818f --- /dev/null +++ b/htmlform.txi @@ -0,0 +1,286 @@ + + + +@code{(require 'html-form)} + +@defvar *html:output-port* +Procedure names starting with @samp{html:} send their output +to the port @var{*html:output-port*}. @var{*html:output-port*} is initially the current output port. +@end defvar + + + +@defun make-atval txt +Returns a string with character substitutions appropriate to +send @var{txt} as an @dfn{attribute-value}. +@cindex attribute-value +@end defun + + +@defun make-plain txt +Returns a string with character substitutions appropriate to +send @var{txt} as an @dfn{plain-text}. +@cindex plain-text +@end defun + + +@defun html:start-page title backlink @dots{} +Outputs headers for an HTML page named @var{title}. +@end defun + + +@defun html:end-page +Outputs HTML codes to end a page. +@end defun + + +@defun html:pre line1 line @dots{} +Writes (using @code{html:printf}) the strings @var{line1}, @var{lines} as +@dfn{PRE}formmated plain text (rendered in fixed-width font). +@cindex PRE +Newlines are inserted between @var{line1}, @var{lines}. HTML tags (@samp{<tag>}) +within @var{lines} will be visible verbatim. +@end defun + + +@defun html:comment line1 line @dots{} +Writes (using @code{html:printf}) the strings @var{line1} as HTML +comments. +@end defun + + +@section HTML Tables + +@defun html:start-table caption + +@end defun + + +@defun html:end-table + +@end defun + + +@defun html:heading columns +Outputs a heading row for the currently-started table. +@end defun + + +@defun html:href-heading columns urls +Outputs a heading row with column-names @var{columns} linked to URLs @var{urls}. +@end defun + + +@defun make-row-converter k foreigns + + +The positive integer @var{k} is the primary-key-limit (number of +primary-keys) of the table. @var{foreigns} is a list of the filenames of +foreign-key field pages and #f for non foreign-key fields. + +@code{make-row-converter} returns a procedure taking a row for its single argument. This +returned procedure prints the table row to @var{*html:output-port*}. +@end defun + + +@defun table-name->filename table-name + +Returns the symbol @var{table-name} converted to a filename. +@end defun + + + +@defun table->html caption db table-name match-key1 @dots{} + +Writes HTML for @var{db} table @var{table-name} to @var{*html:output-port*}. + +The optional @var{match-key1} @dots{} arguments restrict actions to a subset of +the table. @xref{Table Operations, match-key}. +@end defun + + +@defun table->page db table-name index-filename + +Writes a complete HTML page to @var{*html:output-port*}. The string +@var{index-filename} names the page which refers to this one. +@end defun + + +@defun catalog->html db caption + +Writes HTML for the catalog table of @var{db} to @var{*html:output-port*}. +@end defun + + +@defun catalog->page db caption + +Writes a complete HTML page for the catalog of @var{db} to +@var{*html:output-port*}. +@end defun + + +@section HTML Forms + + + + + + + + +@defun html:start-form method action +The symbol @var{method} is either @code{get}, @code{head}, @code{post}, +@code{put}, or @code{delete}. @code{html:start-form} prints the header for an HTML +@dfn{form}. +@cindex form +@end defun + + +@defun html:end-form pname submit-label +@code{html:end-form} prints the footer for an HTML @dfn{form}. The string @var{submit-label} +@cindex form +appears on the button which submits the form. +@end defun + + + +@defun command->html rdb command-table command method action +The symbol @var{command-table} names a command table in the @var{rdb} relational +database. + +@code{command->html} writes an HTML-2.0 @dfn{form} for command @var{command} to the +@cindex form +current-output-port. The @samp{SUBMIT} button, which is labeled @var{command}, +invokes the URI @var{action} with method @var{method} with a hidden attribute +@code{*command*} bound to the command symbol submitted. + +An action may invoke a CGI script +(@samp{http://www.my-site.edu/cgi-bin/search.cgi}) or HTTP daemon +(@samp{http://www.my-site.edu:8001}). + +This example demonstrates how to create a HTML-form for the @samp{build} +command. + +@example +(require (in-vicinity (implementation-vicinity) "build.scm")) +(call-with-output-file "buildscm.html" + (lambda (port) + (fluid-let ((*html:output-port* port)) + (html:start-page 'commands) + (command->html + build '*commands* 'build 'post + (or "/cgi-bin/build.cgi" + "http://localhost:8081/buildscm")) + html:end-page))) +@end example +@end defun + + + + + + +@c node HTTP and CGI service, Printing Scheme, HTML Forms, Textual Conversion Packages +@section HTTP and CGI service + +@code{(require 'html-form)} + + +@defun cgi:serve-command rdb command-table +Reads a @samp{"POST"} or @samp{"GET"} query from +@code{(current-input-port)} and executes the encoded command from @var{command-table} +in relational-database @var{rdb}. + +This example puts up a plain-text page in response to a CGI query. + +@example +(display "Content-Type: text/plain") (newline) (newline) +(require 'html-form) +(load (in-vicinity (implementation-vicinity) "build.scm")) +(cgi:serve-command build '*commands*) +@end example +@end defun + + +@defun serve-urlencoded-command rdb command-table urlencoded +Reads attribute-value pairs from @var{urlencoded}, converts them to +parameters and invokes the @var{rdb} command named by the parameter +@code{*command*}. +@end defun + + + + + + + + +@defun http:serve-query input-port output-port serve-proc +reads the @dfn{query-string} from @var{input-port}. If this is a valid +@cindex query-string +@samp{"POST"} or @samp{"GET"} query, then @code{http:serve-query} calls @var{serve-proc} with two +arguments, the query-string and the header-alist. + +Otherwise, @code{http:serve-query} replies (to @var{output-port}) with appropriate HTML describing the +problem. +@end defun + + +This example services HTTP queries from port 8081: + +@example +(define socket (make-stream-socket AF_INET 0)) +(socket:bind socket 8081) +(socket:listen socket 10) +(dynamic-wind + (lambda () #f) + (lambda () + (do ((port (socket:accept socket) + (socket:accept socket))) + (#f) + (dynamic-wind + (lambda () #f) + (lambda () + (fluid-let ((*html:output-port* port)) + (http:serve-query + port port + (lambda (query-string header) + (http:send-header + '(("Content-Type" . "text/plain"))) + (with-output-to-port port + (lambda () + (serve-urlencoded-command + build '*commands* query-string))))))) + (lambda () (close-port port))))) + (lambda () (close-port socket))) +@end example + + +@defun http:read-request-line port +Reads the first non-blank line from @var{port} and, if successful, +returns a list of three itmes from the request-line: + +@enumerate 0 + +@item Method + +Either one of the symbols @code{options}, @code{get}, @code{head}, +@code{post}, @code{put}, @code{delete}, or @code{trace}; Or a string. + +@item Request-URI + +A string. At the minimum, it will be the string @samp{"/"}. + +@item HTTP-Version + +A string. For example, @samp{HTTP/1.0}. +@end enumerate +@end defun + + +@defun cgi:read-query-string +Reads the @dfn{query-string} from @code{(current-input-port)}. +@cindex query-string +@code{cgi:read-query-string} reads a @samp{"POST"} or @samp{"GET"} queries, depending on the +value of @code{(getenv "REQUEST_METHOD")}. +@end defun diff --git a/lineio.txi b/lineio.txi new file mode 100644 index 0000000..c067678 --- /dev/null +++ b/lineio.txi @@ -0,0 +1,51 @@ + + + +@defun read-line read-line + + +@defunx read-line read-line port +Returns a string of the characters up to, but not including a +newline or end of file, updating @var{port} to point to the +character following the newline. If no characters are available, an +end of file object is returned. The @var{port} argument may be +omitted, in which case it defaults to the value returned by +@code{current-input-port}. +@end defun + + +@defun read-line! read-line! string + + +@defunx read-line! read-line! string port +Fills @var{read-line!} with characters up to, but not including a newline or end +of file, updating the @var{port} to point to the last character read +or following the newline if it was read. If no characters are +available, an end of file object is returned. If a newline or end +of file was found, the number of characters read is returned. +Otherwise, @code{#f} is returned. The @var{port} argument may be +omitted, in which case it defaults to the value returned by +@code{current-input-port}. +@end defun + + + +@defun write-line write-line string + + +@defunx write-line write-line string port +Writes @var{write-line} followed by a newline to the given @var{port} and returns +an unspecified value. The @var{Port} argument may be omited, in +which case it defaults to the value returned by +@code{current-input-port}.@refill +@end defun + + +@defun display-file path + + +@defunx display-file path port +Displays the contents of the file named by @var{path} to @var{port}. The +@var{port} argument may be ommited, in which case it defaults to the +value returned by @code{current-output-port}. +@end defun diff --git a/nclients.scm b/nclients.scm index 530683d..96c36c9 100644 --- a/nclients.scm +++ b/nclients.scm @@ -116,7 +116,7 @@ (read-line port) ;past newline (do ((line (read-line port) (read-line port))) ((not (and (string? line) - (string-index line #\=)))) + (strsrch:string-index line #\=)))) (sscanf line "HostName=%s" compname) (sscanf line "DomainName=%s" workgroup))))) (not user) @@ -126,7 +126,7 @@ (read-line port) ;past newline (do ((line (read-line port) (read-line port))) ((not (and (string? line) - (string-index line #\=)))) + (strsrch:string-index line #\=)))) (sscanf line "UserName=%s" user)))))) (if (and compname (not hostname)) (set! hostname diff --git a/nclients.txi b/nclients.txi new file mode 100644 index 0000000..fcb77f8 --- /dev/null +++ b/nclients.txi @@ -0,0 +1,115 @@ + + + +@defun call-with-tmpnam proc + + +@defunx call-with-tmpnam proc k +Calls @var{proc} with @var{k} arguments, strings returned by successive +calls to @code{tmpnam}. If @var{proc} returns, then any files named by the +arguments to @var{proc} are deleted automatically and the value(s) yielded +by the @var{proc} is(are) returned. @var{k} may be ommited, in which case +it defaults to @code{1}. +@end defun + + +@defun user-email-address + +@code{user-email-address} returns a string of the form @samp{username@r{@@}hostname}. If +this e-mail address cannot be obtained, #f is returned. +@end defun + + +@defun current-directory + +@code{current-directory} returns a string containing the absolute file name representing +the current working directory. If this string cannot be obtained, +#f is returned. + +If @code{current-directory} cannot be supported by the platform, the value of @code{current-directory} is +#f. +@end defun + + +@defun make-directory name + +Creates a sub-directory @var{name} of the current-directory. If successful, +@code{make-directory} returns #t; otherwise #f. +@end defun + + +@defun null-directory? file-name + +Returns #t if changing directory to @var{file-name} makes the current working +directory the same as it is before changing directory; otherwise +returns #f. +@end defun + + +@defun absolute-path? file-name + +Returns #t if @var{file-name} is a fully specified pathname (does not depend on +the current working directory); otherwise returns #f. +@end defun + + + +@defun glob-pattern? str +Returns #t if the string @var{str} contains characters used for +specifying glob patterns, namely @samp{*}, @samp{?}, or @samp{[}. +@end defun + + +@defun parse-ftp-address url + +Returns a list of the decoded FTP @var{url}; or #f if indecipherable. FTP +@dfn{Uniform Resource Locator}, @dfn{ange-ftp}, and @dfn{getit} +@cindex Uniform Resource Locator +@cindex ange-ftp +@cindex getit +formats are handled. The returned list has four elements which are +strings or #f: + +@enumerate 0 +@item +username +@item +password +@item +remote-site +@item +remote-directory +@end enumerate +@end defun + + +@defun ftp-upload paths user password remote-site remote-dir + +@var{password} must be a non-empty string or #f. @var{paths} must be a non-empty list +of pathnames or Glob patterns (@pxref{Filenames}) matching files to +transfer. + +@code{ftp-upload} puts the files specified by @var{paths} into the @var{remote-dir} directory of FTP @var{remote-site} +using name @var{user} with (optional) @var{password}. + +If @var{password} is #f and @var{user} is not @samp{ftp} or @samp{anonymous}, then @var{user} is +ignored; FTP takes the username and password from the @file{.netrc} +or equivalent file. +@end defun + + +@defun path->url path + +Returns a URL-string for @var{path} on the local host. +@end defun + + +@defun browse-url-netscape url + +If a @samp{netscape} browser is running, @code{browse-url-netscape} causes the browser to +display the page specified by string @var{url} and returns #t. + +If the browser is not running, @code{browse-url-netscape} runs @samp{netscape} with the +argument @var{url}. If the browser starts, @code{browse-url-netscape} returns #t when the browser +exits; otherwise it returns #f. +@end defun diff --git a/obj2str.txi b/obj2str.txi new file mode 100644 index 0000000..3ab34dc --- /dev/null +++ b/obj2str.txi @@ -0,0 +1,17 @@ + + + +@defun object->string obj +Returns the textual representation of @var{obj} as a string. +@end defun + + + + + + + +@defun object->limited-string obj limit +Returns the textual representation of @var{obj} as a string of length +at most @var{limit}. +@end defun diff --git a/randinex.txi b/randinex.txi new file mode 100644 index 0000000..1d0a639 --- /dev/null +++ b/randinex.txi @@ -0,0 +1,74 @@ + + + + + + +@defun random:uniform + + +@defunx random:uniform state +Returns an uniformly distributed inexact real random number in the +range between 0 and 1. +@end defun + + + +@defun random:exp + + +@defunx random:exp state +Returns an inexact real in an exponential distribution with mean 1. For +an exponential distribution with mean @var{u} use +@w{@code{(* @var{u} (random:exp))}}. +@end defun + + + +@defun random:normal + + +@defunx random:normal state +Returns an inexact real in a normal distribution with mean 0 and +standard deviation 1. For a normal distribution with mean @var{m} and +standard deviation @var{d} use +@w{@code{(+ @var{m} (* @var{d} (random:normal)))}}. +@end defun + + + + +@defun random:normal-vector! vect + + +@defunx random:normal-vector! vect state +Fills @var{vect} with inexact real random numbers which are independent +and standard normally distributed (i.e., with mean 0 and variance 1). +@end defun + + + + +@defun random:hollow-sphere! vect + + +@defunx random:hollow-sphere! vect state +Fills @var{vect} with inexact real random numbers the sum of whose +squares is less than 1.0. Thinking of @var{vect} as coordinates in +space of dimension @var{n} = @code{(vector-length @var{vect})}, the +coordinates are uniformly distributed within the unit @var{n}-shere. +The sum of the squares of the numbers is returned. +@end defun + + + + +@defun random:solid-sphere! vect + + +@defunx random:solid-sphere! vect state +Fills @var{vect} with inexact real random numbers the sum of whose +squares is equal to 1.0. Thinking of @var{vect} as coordinates in space +of dimension n = @code{(vector-length @var{vect})}, the coordinates are +uniformly distributed over the surface of the unit n-shere. +@end defun diff --git a/random.txi b/random.txi new file mode 100644 index 0000000..f144837 --- /dev/null +++ b/random.txi @@ -0,0 +1,69 @@ + + + + + +@defun random n + + +@defunx random n state +Accepts a positive integer or real @var{n} and returns a number of the +same type between zero (inclusive) and @var{n} (exclusive). The values +returned by @code{random} are uniformly distributed from 0 to @var{n}. + +The optional argument @var{state} must be of the type returned by +@code{(seed->random-state)} or @code{(make-random-state)}. It defaults +to the value of the variable @code{*random-state*}. This object is used +to maintain the state of the pseudo-random-number generator and is +altered as a side effect of calls to @code{random}. +@end defun + + + + +@defvar *random-state* +Holds a data structure that encodes the internal state of the +random-number generator that @code{random} uses by default. The nature +of this data structure is implementation-dependent. It may be printed +out and successfully read back in, but may or may not function correctly +as a random-number state object in another implementation. +@end defvar + + +@defun copy-random-state state + +Returns a new copy of argument @var{state}. + + +@defunx copy-random-state +Returns a new copy of @code{*random-state*}. +@end defun + + + +@defun seed->random-state seed + +Returns a new object of type suitable for use as the value of the +variable @code{*random-state*} or as a second argument to @code{random}. +The number or string @var{seed} is used to initialize the state. If +@code{seed->random-state} is called twice with arguments which are +@code{equal?}, then the returned data structures will be @code{equal?}. +Calling @code{seed->random-state} with unequal arguments will nearly +always return unequal states. +@end defun + + + +@defun make-random-state + + +@defunx make-random-state obj +Returns a new object of type suitable for use as the value of the +variable @code{*random-state*} or as a second argument to @code{random}. +If the optional argument @var{obj} is given, it should be a printable +Scheme object; the first 50 characters of its printed representation +will be used as the seed. Otherwise the value of @code{*random-state*} +is used as the seed. +@end defun + + @@ -4795,7 +4795,7 @@ Returns (@var{k2} ^ @var{k3}) mod @var{modulus}. @ftindex factor @ftindex primes -@include factor.txi +@c @include factor.txi @node Random Numbers, Fast Fourier Transform, Prime Numbers, Mathematical Packages @@ -4818,14 +4818,14 @@ from sequential bytes, tests fail. With the seed @samp{http://swissnet.ai.mit.edu/~jaffer/SLIB.html}, all of those tests pass. -@include random.txi +@c @include random.txi If inexact numbers are supported by the Scheme implementation, @file{randinex.scm} will be loaded as well. @file{randinex.scm} contains procedures for generating inexact distributions. -@include randinex.txi +@c @include randinex.txi @node Fast Fourier Transform, Cyclic Checksum, Random Numbers, Mathematical Packages @@ -9588,7 +9588,7 @@ with @var{new2} @dots{}. @code{(require 'line-i/o)} @ftindex line-i -@include lineio.txi +@c @include lineio.txi @node Multi-Processing, , Line I/O, Procedures @@ -10301,7 +10301,7 @@ programs like FTP, mail, and Netscape. @code{(require 'net-clients)} @ftindex net-clients -@include nclients.txi +@c @include nclients.txi @node Extra-SLIB Packages, , Session Support, Other Packages diff --git a/strsrch.scm b/strsrch.scm index 71c69df..a6ab7e1 100644 --- a/strsrch.scm +++ b/strsrch.scm @@ -5,7 +5,7 @@ ; This code is in the public domain. ;;; Return the index of the first occurence of a-char in str, or #f -(define (string-index str a-char) +(define (strsrch:string-index str a-char) (let loop ((pos 0)) (cond ;; whole string has been searched, in vain @@ -40,7 +40,7 @@ (c2 (if (<= pat-len 1) #f (string-ref pattern 1)))) (cond ((not c1) 0) ; empty pattern, matches upfront - ((not c2) (string-index str c1)) ; one-char pattern + ((not c2) (strsrch:string-index str c1)) ; one-char pattern (else ; matching pattern of > two chars (let outer ((pos 0)) (cond diff --git a/version.txi b/version.txi new file mode 100644 index 0000000..7766bb1 --- /dev/null +++ b/version.txi @@ -0,0 +1,2 @@ +@set SLIBVERSION 2c5 +@set SLIBDATE January 1999 |