#|-------------------- 1.3.1 |# "./html/" 0 #|-------------------- 1.3.1 |# "./html/doctype.html" 5064 Eggs Unlimited - doctype

Description

Provides XML doctypes as strings

Author

Zbigniew

Version

Usage

(require-extension doctype)

Download

doctype.egg

Documentation

Exports strings corresponding to standard XML (XHTML, HTML) doctypes.

string: doctype:xhtml-1.0-strict
string: doctype:html-4.01-strict
string: doctype:xhtml-1.0-transitional
string: doctype:html-4.01-transitional
string: doctype:xhtml-1.0-frameset
string: doctype:html-4.01-frameset
string: doctype:html-3.2
string: doctype:html-2.0

Examples

#;1> (use doctype)
#;2> (print doctype:xhtml-1.0-strict)
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

License

Public domain.

#|-------------------- 1.3.1 |# "./html/args.html" 14500 Eggs Unlimited - args

Description

Command-line argument handling facilities, layered on SRFI 37 (args-fold).

Author

Zbigniew

Version

Requires

Usage

(require-extension args)

Download

args.egg

Documentation

This extension provides a wrapper around SRFI 37 (args-fold). The main goal is to let the user parse command-line arguments without having to write a lot of similar support code every time.

By default, options and operands (non-options) are collected into two lists and returned by the parser, and unrecognized options complain and display help. Therefore, it is very possible not to write any option-procs, operand-procs, or unrecognized-procs as required by SRFI 37. However, the capability to customize is there should you need it.

Additionally, the help text for your options can be generated for you, so your options and usage information don't get out of sync.

Creating options

macro: (args:make-option (OPTION-NAME ...) ARG-DATA [BODY])

Make an args:option record, suitable for passing to args:parse.

OPTION-NAME ... is a sequence of short or long option names. They must be literal symbols; single-character symbols become short options, and longer symbols become long options. So (args:make-option (c cookie) ...) specifies a short option -c and long option --cookie. Under the hood, (c cookie) becomes '(#\c "cookie"), as expected by SRFI 37's OPTION.

ARG-DATA is either a pair (ARG-TYPE ARG-NAME) or a plain keyword ARG-TYPE. ARG-TYPE is a keyword that specifies whether the option takes an argument:

#:required Argument is required
#:optional Argument is optional
#:none No argument (actually, any other value than #:required or #:optional is interpreted as #:none)

ARG-NAME, if provided, is a string specifying the name of the argument. This name is used in the help text produced by args:usage.

BODY is an optional sequence of statements executed when this option is encountered. Behind the scenes, BODY is wrapped in code which adds the current option and its argument to the final options alist. So, simply leave BODY blank and options will be collected for you. BODY is an option-processor as defined in SRFI 37, and has access to the variables OPT (the current #<option>), NAME (the option name) and ARG (argument value or #f).

Parsing the command line

procedure: (args:parse ARGS OPTIONS-LIST [OPTIONALS])

Parse ARGS, a list of command-line arguments given as strings, and return two values: an alist of option names (symbols) and their values, and a list of operands (non-option arguments).

Operands are returned in order, but options are returned in reverse order. Duplicate options are retained in the options alist, so this lets ASSQ find the last occurrence of any duplicate option on the command line. A (name . value) pair is added for each alias of every option found, so any alias is a valid lookup key.

OPTIONS-LIST is a list of accepted options, each created by args:make-option.

OPTIONALS is an optional sequence of keywords and values:

#:operand-proc PROC calls PROC for each operand, with arguments OPERAND OPTIONS OPERANDS
#:unrecognized-proc PROC calls PROC for each unrecognized option, with arguments OPTION NAME ARG OPTIONS OPERANDS

The default operand-proc is a no-op, and the default unrecognized-proc issues an error message and calls the help option's processor. See the args-fold documentation for usage information and an explanation of the procedure arguments; OPTIONS and OPERANDS are seed values.

parameter: args:help-options

List of option names (strings or single characters, as in SRFI 37) to be considered 'help' options, in order of preference. args:parse uses this to select a help option from the option list it is passed. This is currently used only for unrecognized options, for which the help option is automatically invoked.

By default, --help, -h and -? are considered help options.

Usage information

Well-behaved programs display help or usage text when invoked with an option such as --help. args:usage will generate a formatted list of options in the GNU style, from a list of args:options. Around this you might place a descriptive header and footer.

procedure: (args:usage OPTION-LIST)

Generate a formatted list of options from OPTION-LIST, and return a string suitable for embedding into help text. The single string consists of multiple lines, with a newline at the end of each line. Thus, a typical use would be (print (args:usage opts)).

parameter: args:width

We don't auto-format the left column (the option keys) based on the length of the longest option, but you can override it manually. Example:

(parameterize ((args:width 40)) (args:usage opts))

Operands and unrecognized options (advanced)

These are suitable for use with #:operand-proc or #:unrecognized-proc in args:parse. Most users will probably not customize these procedures themselves, but a couple useful prefabricated ones are provided.

procedure: args:ignore-unrecognized-options

Silently ignore unrecognized options, and omit from the options alist.

procedure: args:accept-unrecognized-options

Silently add unrecognized options to the options alist.

macro: (args:make-operand-proc [BODY])

Return a procedure suitable for using as an operand procedure in args:parse. Provides the arguments OPERAND, OPTIONS, and OPERANDS to the BODY; where OPERAND is the current operand (as in args-fold) and OPTIONS and OPERANDS are SEEDS (as in args-fold) and should not be modified. Also wraps BODY in code that adds the operand to the final operand list (seed).

Bugs

The name args:make-option is verbose.

Examples

(use args)

(define opts
 (list (args:make-option (c cookie)    #:none     "give me cookie"
         (print "cookie was tasty"))
       (args:make-option (d)           (optional: "LEVEL")  "debug level [default: 1]")
       (args:make-option (e elephant)  #:required "flatten the argument"
         (print "elephant: arg is " arg))
       (args:make-option (f file)      (required: "NAME")   "parse file NAME")
       (args:make-option (v V version) #:none     "Display version"
         (print "args-example $Revision: 1.3 $")
         (exit))
       (args:make-option (abc)         #:none     "Recite the alphabet")
       (args:make-option (h help)      #:none     "Display this text"
         (usage))))

(define (usage)
 (with-output-to-port (current-error-port)
   (lambda ()
     (print "Usage: " (car (argv)) " [options...] [files...]")
     (newline)
     (print (args:usage opts))
     (print "Report bugs to zbigniewsz at gmail.")))
 (exit 1))

(receive (options operands)
    (args:parse (command-line-arguments) opts)
  (print "-e -> " (alist-ref 'elephant options))) ;; 'e or 'elephant both work

;; If command line is --cookie -e test -e hello:
;;  cookie was tasty
;;  elephant: arg is test
;;  elephant: arg is hello
;;  -e -> hello

;; If command line is --cookie -e test --foo:
#|
cookie was tasty
elephant: arg is test
./args-example: unrecognized option: foo
Usage: ./args-example [options...] [files...]

 -c, --cookie             give me cookie
 -d [LEVEL]               debug level [default: 1]
 -e, --elephant=ARG       flatten the argument
 -f, --file=NAME          parse file NAME
 -v, -V, --version        Display version
     --abc                Recite the alphabet
 -h, --help               Display this text

Report bugs to zbigniewsz at gmail.
|#

Additional examples can be found in args-examples.scm.

License

Copyright (c) 2005, 2006 Jim "Zb" Ursetto.  All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:

  Redistributions of source code must retain the above copyright notice,
  this list of conditions and the following disclaimer. Redistributions in
  binary form must reproduce the above copyright notice, this list of
  conditions and the following disclaimer in the documentation and/or
  other materials provided with the distribution. Neither the name of the
  author nor the names of its contributors may be used to endorse or
  promote products derived from this software without specific prior
  written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#|-------------------- 1.3.1 |# "./html/eggdoc.html" 9763 Eggs Unlimited - eggdoc

Description

An egg documentation tool

Author

Zbigniew

Version

Requires

Usage

(require-extension eggdoc)

Download

eggdoc.egg

Documentation

eggdoc is an SXML documentation tool which produces HTML pages for Chicken eggs. It uses the sxml-transforms extension to transform your SXML via a comprehensive XML stylesheet, simplifying the creation of egg documentation. It's also quite customizable.

procedure: (eggdoc->html DOC [STYLESHEET])

Transform the SXML document DOC using the optional SXSLT stylesheet STYLESHEET. If not specified, the built-in stylesheet will be used, which is also accessible with (eggdoc:make-stylesheet).

procedure: (eggdoc:make-stylesheet DOC)

Returns the default SXSLT stylesheet. This is a procedure because the stylesheet is built dynamically using the contents of the SXML document DOC. For example, the value of the (name) tag is retrieved at build time and inserted in the header and the usage information.

You can append to or modify this stylesheet and then pass it to eggdoc->html. This is done in doctype's eggdoc to provide a new tag, (strings), which makes the SXML much cleaner.

parameter: eggdoc:doctype

The DOCTYPE for this document, typically as defined in the doctype extension. This defaults to doctype:xhtml-1.0-strict.

parameter: eggdoc:css

CSS text inserted verbatim between the document's <style> tags. This must be <!-- wrapped in HTML comments -->. The default is quite reasonable.

If you wish to source a CSS file instead of inserting the text directly, you can override the eggdoc-style tag in the default stylesheet to do so.

procedure: (eggdoc:make-defsig TAG SIG . [BODY])

Use this procedure inside a stylesheet to generate a new signature tag, just like procedure or macro. It expands to a (definition (signatures (signature ...))) expression. For example,

(eggdoc->html doc `( ,@(eggdoc:make-stylesheet doc)
                     (constant *macro* . ,eggdoc:make-defsig)
                     (method   *macro* . ,eggdoc:make-defsig) ))

will create new constant and method tags.

Subsections

Document section tags must be nested in the order section -> subsection -> subsubsection -> subsubsubsection. You may not nest section tags of the same level, as in (section "name" (section ...)), and you may not skip a level. eggdoc won't complain if you violate these rules—the HTML driver is pretty lax—but the appearance will be off and eggdoc-texinfo will fail on such a document. eggdoc-texinfo is more sensitive to malformed documents, so it is recommended to generate .info and .pdf output as well to ensure your document is correct.

documentation, examples, and license are section tags in disguise. In particular, (documentation (section ...)) is invalid; use (documentation (subsection ...)).

Examples

Complete examples for the Chicken extensions args, doctype, eggdoc, hostinfo, sxml-tools, sxml-transforms, and vector-lib are provided in the egg under src/. These all validate as XHTML Strict 1.0.

Also, eggdoc has become the standard documentation tool for Chicken eggs, and an eggdoc source file is included in many eggs. Unpack (untar) the egg by hand, or browse the SVN egg repository, to access the source.

License

Copyright (c) 2005, 2006 Jim "Zb" Ursetto.  All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:

  Redistributions of source code must retain the above copyright notice,
  this list of conditions and the following disclaimer. Redistributions in
  binary form must reproduce the above copyright notice, this list of
  conditions and the following disclaimer in the documentation and/or
  other materials provided with the distribution. Neither the name of the
  author nor the names of its contributors may be used to endorse or
  promote products derived from this software without specific prior
  written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#|-------------------- 1.3.1 |# "./html/egg.jpg" 1438 JFIFHHCreated with The GIMPC    $.' ",#(7),01444'9=82<.342C  2!!22222222222222222222222222222222222222222222222222Z"5a!1AQ"q2BRb#3Cr1 ?׽:bt6kE@}\l|쬀'f(z:G?A u T-;yM$%"UQm|T3*jzsq`&uA+T9,|BBy\,dL$n A> mWgCuJ*(̠uT鮂ّA#u@g C'IRlA[8+"9sֿ+S\Vs&pz7.\v5m{s*ZVUjzm^֨ F5ZWn 5U/6qZrO`a> 0a?֜oө/O׃kmgwGOM) i UcF89ZāYeN7*QET Z.bس( k~M35M|7kCI;~w_hlR'q{RFy+W^67Iʮ3ٱ|/bAs^F6)i\Ӹ>77h~{:/&:? Q)3Q*ZCH$8ujḔ291y$e=T#0(s#o B ^J\;?Ks\M=QHX,-E`+UT6 v*E%n%vP,"f=ke$#QY͙{x9̝c]3gG8$jwGi5N TB#KN*2%٩ʂLXʓ* 4!j Lȝ:'8tP2F_̚0dN %Y* d'.@.uF3/ #|-------------------- 1.3.1 |# "./html/sxml-transforms.html" 6884 Eggs Unlimited - sxml-transforms

Description

The SXML transformations (to XML, SXML, and HTML) from the SSAX project

Author

Oleg Kiselyov. Port by Zbigniew

Version

  • 1.1 Improve inline element whitespace handling; add '&' rule.
  • 1.0 Initial release

Documentation

This egg provides the SXML transforms available in the SSAX/SXML Sourceforge project. It incorporates one main extension, and an auxiliary one:

extension: (require-extension sxml-transforms)
From SXML-tree-trans.scm:
SRV:send-reply pre-post-order post-order foldts replace-range
From SXML-to-HTML.scm:
SXML->HTML entag enattr string->goodHTML
From SXML-to-HTML-ext.scm:
universal-conversion-rules universal-protected-rules alist-conv-rules
From util.scm:
make-char-quotator
Chicken-specific modifications:
entag-xhtml entag-html

entag-xhtml closes XHTML tags properly in an HTML compatible way. entag is now an alias for entag-xhtml, so this behaviour is the default. entag-html is an alias for the original entag.

Newlines before open tags in the rendered HTML output are omitted for inline elements, such as tt and strong. This prevents the introduction of extraneous whitespace.

Also, the universal conversion rules have been augmented a bit:

rule: (& ENTITY-NAME ...)

Quotes character references given by strings ENTITY-NAME ....

Example: (& "ndash" "quot") => "&ndash;&quot;"

extension: (require-extension sxml-to-sxml)

Provides pre-post-order-composable, a variant of pre-post-order which always outputs strictly-conformant SXML. This comes from sxml-to-sxml.scm.

Examples

Oleg's site is the main resource. Be sure to read his examples and the ones in the SSAX repository (also included in the egg). The following papers were of great help:

Also, the eggdoc extension makes heavy use of sxml-transforms.

License

The sxml-transforms code is in the public domain.

#|-------------------- 1.3.1 |# "./html/hostinfo.html" 14785 Eggs Unlimited - hostinfo

Description

Look up host, protocol, and service information

Author

Zbigniew

Version

  • 1.0 Initial release

Requires

  • vector-lib

Usage

(require-extension hostinfo)

Download

hostinfo.scm

Documentation

This extension performs host, protocol and service information lookups via underlying calls to gethostbyname(3), getprotobyname(3), and getservbyname(3). Depending on your system, this may consult DNS, NIS, /etc/hosts, /etc/services, /etc/protocols, and so on.

A simple interface is provided for the most commmon queries. Also provided is a more comprehensive interface using records, which contain all data available in a lookup.

IP addresses are represented by 4 (IPv4) or 16 (IPv6) byte u8vectors. The interface requires, and returns, addresses in this format; functions are provided to convert between the string and u8vector representations. However, the "do what I want" procedures (e.g. host-information) will do the conversion for you.

Short and sweet

Quickly perform the most common lookups. Convenient and efficient for one-off use, but perform a new lookup each time. They return #f on failure.

procedure: (hostname->ip HOSTNAME)
Look up string HOSTNAME and return IP address as u8vector.
procedure: (ip->hostname IPADDR)

Look up u8vector IPADDR and return hostname as string.

procedure: (protocol-name->number PROTOCOL-NAME)

Look up string PROTOCOL-NAME and return protocol number.

procedure: (protocol-number->name PROTOCOL-NUMBER)

Look up PROTOCOL-NUMBER and return protocol name as string.

procedure: (service-port->name SERVICE-PORT [PROTO])

Look up SERVICE-PORT number and return service name as string. Optional PROTO argument, which must be a string, constrains lookup to that protocol.

procedure: (service-name->port SERVICE-NAME [PROTO])

Look up string SERVICE-NAME and return the canonical port for that service. Optional PROTO argument as above.

Records

Some lookups return a host, protocol, or service record. These records print nicely on the screen, for convenient interactive use.

procedure: (hostinfo-address h)

Retrieves the address field of the hostinfo record h. Accessors are similar for other records and their fields.

record: hostinfo
name Hostname
addresses A vector of one or more u8vector IP addresses
aliases A vector of any alternate hostnames
address The first IP address (u8vector) in addresses
type 'AF_INET (IPv4) or 'AF_INET6 (IPv6)
length IP address length in bytes
record: protoinfo
name Protocol name
number Protocol number
aliases Vector of alternate names for this protocol
record: servinfo
name Service name
number Service number
aliases Vector of alternate names for this service
protocol Name of protocol this service uses

Record lookup

procedure: (hostname->hostinfo NAME)
procedure: (ip->hostinfo IPADDR)
procedure: (service-name->servinfo NAME)
procedure: (service-port->servinfo NUM)
procedure: (protocol-name->protoinfo NAME)
procedure: (protocol-number->protoinfo NUM)

These lookups correspond to those described in Short and sweet, but return a full record. The entire record is filled in a single system call.

One-stop shops

These decipher your argument, call the appropriate lookup, and return an information record.

procedure: (host-information HOST)

Look up and return a hostinfo record, or #f. HOST is a string hostname, a string numeric IP address, or a u8vector IP address.

procedure: (protocol-information PROTO)

Look up and return a protoinfo record, or #f. PROTO is a protocol number or string name.

procedure: (service-information SERVICE [PROTO])

Look up and return a servinfo record, or #f. SERVICE is a service number or string name. PROTO is an optional protocol number or string name, which will constrain lookups to that particular protocol.

NOTE: if the protocol number is illegal, an error is thrown, since this was probably unintentional.

Utility functions

procedure: (string->ip IP-STRING)

Convert an IPv4 or IPv6 address string in canonical format to a u8vector, which can be considered an "IP address object". Returns #f on failure.

procedure: (ip->string IPADDR)

Convert a 4 (IPv4) or 16 (IPv6) element u8vector to a string in canonical format. Throws an error if the u8vector is not 4 or 16 bytes long. This call should only fail on system error, in which case it will return #f (perhaps not the best behaviour).

Bugs

IPv6 lookup is not yet supported. However, IPv6<->string conversion works fine.

System errors return failure (#f) and so are indistinguishable from failed lookups. They should probably signal an error or an exception.

Examples

(host-information "www.call-with-current-continuation.org")
(host-information '#u8(194 97 107 133))
(host-information "194.97.107.133")
   ; => #,(hostinfo name: "www003.lifemedien.de"
   ;       addresses: #(#u8(194 97 107 133))
   ;       aliases: #("www.call-with-current-continuation.org"))
(ip->hostname '#u8(194 97 107 133))   ; "www003.lifemedien.de"
(string->ip "0708::0901")             ;  #u8(7 8 0 0 0 0 0 0 0 0 0 0 0 0 9 1)
(ip->string '#u8(127 0 0 1))          ;  "127.0.0.1"
(hostinfo-aliases
 (hostname->hostinfo
  (ip->hostname
   (hostname->ip
    (hostinfo-name
     (host-information "www.call-with-current-continuation.org"))))))
   ; => #("www.call-with-current-continuation.org")

(protocol-information 17)
   ; => #,(protoinfo name: "udp" number: 17 aliases: #("UDP"))
(protoinfo-name (protocol-information 2))   ; => "igmp"
(protoinfo-aliases (protocol-name->protoinfo
                    (protocol-number->name
                     (protoinfo-number
                      (protocol-information "ospf")))))  ; => #("OSPFIGP")
(protocol-name->number "OSPFIGP")     ; 89 (you can look up aliases, too)

(servinfo-protocol (service-name->servinfo
                    (service-port->name
                     (servinfo-port (service-information "ssh")))))
   ; => "udp" (yes, really)
(service-information "ssh" "tcp")
   ; => #,(servinfo name: "ssh" port: 22 aliases: #() protocol: "tcp")
(service-information "ssh" "tco") ; => #f
(service-information 512 "tcp")
   ; #,(servinfo name: "exec" port: 512 aliases: #() protocol: "tcp")
(service-information 512 "udp")
   ; #,(servinfo name: "comsat" port: 512 aliases: #("biff") protocol: "udp")
(service-information 512 17)      ; same as previous
(service-information 512 170000)
   ; Error: (service-information) illegal protocol number: 170000

License

Copyright (c) 2005, 2006 Jim "Zb" Ursetto.  All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:

  Redistributions of source code must retain the above copyright notice,
  this list of conditions and the following disclaimer. Redistributions in
  binary form must reproduce the above copyright notice, this list of
  conditions and the following disclaimer in the documentation and/or
  other materials provided with the distribution. Neither the name of the
  author nor the names of its contributors may be used to endorse or
  promote products derived from this software without specific prior
  written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#|-------------------- 1.3.1 |# "./html/sxml-tools.html" 6438 Eggs Unlimited - sxml-tools

Description

The sxml-tools from the SSAX project at Sourceforge.

Version

  • 1.0 Initial release

Requires

  • srfi-13 [string-lib]
  • srfi-1 [list-lib]

Usage

(require-extension sxml-tools)

Documentation

This egg provides most of the sxml-tools available in the SSAX/SXML Sourceforge project. It incorporates several different extensions:

extension: (require-extension sxml-tools)
sxml-tools; sxpath; sxpathlib; sxpath-ext; txpath; and xpath-parser
extension: (require-extension sxml-tools-extra)
xpath-ast; xpath-context; ddo-axes; ddo-txpath; modif; lazy-xpath
extension: (require-extension stx-engine)
extension: (require-extension sxpath-plus)

Much documentation is available at Lisovsky's XML page and the SSAX homepage. For serious use, you will probably want to untar the egg and study the source and the included tests. See the README.txt file in the egg for details.

xlink, xlink-parser, fragments and guides are not provided as extensions, but they are included in the egg as source.

Bugs

Although these files are pretty interdependent, they could be broken down further into separate extensions. sxpath could be pulled out, for example, with the caveat that txpath parsing would result in an error.

Not everything is tested, since tests are not provided for all functionality.

Examples

Examples are available in the sxml-tools documentation (see above). This one is a straightforward example of SXPath. Additionally, the sxml-tools tests are included in the egg. Untar it and read the README.txt file for details.

License

The sxml-tools are in the public domain.

#|-------------------- 1.3.1 |# "./html/vector-lib.html" 7537 Eggs Unlimited - vector-lib

Description

Reference implementation of SRFI-43: Vector library

Author

Taylor Campbell; port by Zbigniew

Version

  • 1.1 Final implementation port by Zbigniew
  • 1.0 Draft implementation port by William S. Annis

Usage

(require-extension vector-lib)

Documentation

See the SRFI-43 document for full documentation on the reference implementation.

The reference implementation on srfi.schemers.org is buggy (as of 24 May 2005). This code is actually derived from Taylor Campbell's updated version.

Also included are the following user-visible fixes:

  • vector-map fix from Will M. Farr
  • list->vector and reverse-list->vector obey the START offset, and disallow negative length

Additionally, list->vector and reverse-list->vector accept optional START and END arguments:

procedure: (list->vector LIST [START END])

Produce a vector containing the elements in LIST, which must be a proper list, between START, whose default is 0, and END, whose default is the length of LIST. It is suggested that if the length of LIST is known in advance, the START and END arguments be passed, so that list->vector need not call length itself.

procedure: (reverse-list->vector LIST [START END])

Produces the same output as list->vector, but in reverse order.

This brings them more in line with vector->list and reverse-vector->list, which also take START and END arguments.

License

Copyright (c) 2005, 2006 Jim "Zb" Ursetto.  All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:

  Redistributions of source code must retain the above copyright notice,
  this list of conditions and the following disclaimer. Redistributions in
  binary form must reproduce the above copyright notice, this list of
  conditions and the following disclaimer in the documentation and/or
  other materials provided with the distribution. Neither the name of the
  author nor the names of its contributors may be used to endorse or
  promote products derived from this software without specific prior
  written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#|-------------------- 1.3.1 |# "./src/" 0 #|-------------------- 1.3.1 |# "./src/eggdoc-doctype.scm" 1817 ;; $Revision: 1.2 $ $Date: 2005/07/17 16:58:29 $ (use eggdoc) (include "eggdoc-zb.scm") (define doc `((eggdoc:begin (name "doctype") (description (p "Provides " (url "http://htmlhelp.com/tools/validator/doctype.html" "XML doctypes") " as strings")) (author (url ,zbigniew-homepage "Zbigniew")) (history (version "1.1" "Fix typo in html-4.01-transitional") (version "1.0" "Initial release")) (usage) (download "doctype.egg") (documentation (p "Exports strings corresponding to standard XML (XHTML, HTML) doctypes.") (group (strings "doctype:xhtml-1.0-strict" "doctype:html-4.01-strict" "doctype:xhtml-1.0-transitional" "doctype:html-4.01-transitional" "doctype:xhtml-1.0-frameset" "doctype:html-4.01-frameset" "doctype:html-3.2" "doctype:html-2.0"))) (examples (pre #< (use doctype) #;2> (print doctype:xhtml-1.0-strict) EOF )) (license (p "Public domain."))))) ;; Here's an example of a custom stylesheet -- we add a new (strings) tag ;; to the eggdoc default. (let ((ss (append (eggdoc:make-stylesheet doc) `( (strings *macro* . ,(lambda (tag . strings) `(definition (signatures ,@(map (lambda (s) `(signature "string" ,s)) strings))))))))) (eggdoc->html doc ss)) #|-------------------- 1.3.1 |# "./src/eggdoc-args.scm" 10110 ;; $Revision: 1.3 $ $Date: 2005/07/13 19:07:50 $ (use eggdoc) (include "eggdoc-zb.scm") (define examples `( (pre #< " (alist-ref 'elephant options))) ;; 'e or 'elephant both work ;; If command line is --cookie -e test -e hello: ;; cookie was tasty ;; elephant: arg is test ;; elephant: arg is hello ;; -e -> hello ;; If command line is --cookie -e test --foo: #| cookie was tasty elephant: arg is test ./args-example: unrecognized option: foo Usage: ./args-example [options...] [files...] -c, --cookie give me cookie -d [LEVEL] debug level [default: 1] -e, --elephant=ARG flatten the argument -f, --file=NAME parse file NAME -v, -V, --version Display version --abc Recite the alphabet -h, --help Display this text Report bugs to zbigniewsz at gmail. |# EOF ) (p "Additional examples can be found in " (a (@ (href "args-examples.scm")) "args-examples.scm") "."))) (define doc `((eggdoc:begin (name "args") (description "Command-line argument handling facilities, layered on SRFI 37 (args-fold).") (author (a (@ (href ,zbigniew-homepage)) "Zbigniew")) (history ; (version "1.1" (b "Fix typo")) (version "1.0" "Initial release")) (requires "srfi-37 [args-fold]" "srfi-13 [string-lib]" "srfi-1 [list-lib]") (usage) (download "args.egg") ;; download may also be a pair, in which case it's inserted verbatim (documentation (p "This extension provides a wrapper around SRFI 37 (args-fold). The main goal is to let the user parse command-line arguments without having to write a lot of similar support code every time.") (p "By default, options and operands (non-options) are collected into two lists and returned by the parser, and unrecognized options complain and display help. Therefore, it is very possible not to write any option-procs, operand-procs, or unrecognized-procs as required by SRFI 37. However, the capability to customize is there should you need it.") (p "Additionally, the help text for your options can be generated for you, so your options and usage information don't get out of sync.") ;;; CREATING OPTIONS (subsection "Creating options" ;; I'd like multiple signatures sometimes -- should they be a plain list, ;; an element followed by a list, one element per signature, attributes (@), or what? (group (macro "(args:make-option (OPTION-NAME ...) ARG-DATA [BODY])" (p "Make an args:option record, suitable for passing to args:parse.") (p "OPTION-NAME ... is a sequence of short or long option names. " "They must be literal symbols; single-character symbols become " "short options, and longer symbols become long options. So " (tt "(args:make-option (c cookie) ...)") " specifies a short " "option -c and long option --cookie. Under the hood, (c cookie) " "becomes '(#\\c \"cookie\"), as expected by SRFI 37's OPTION.") (p "ARG-DATA is either a pair (ARG-TYPE ARG-NAME) or a plain keyword ARG-TYPE. ARG-TYPE is a keyword that specifies whether the option takes an argument:") (symbol-table (describe "#:required" "Argument is required") (describe "#:optional" "Argument is optional") (describe "#:none" "No argument (actually, any other value than #:required or #:optional is interpreted as #:none)")) (p "ARG-NAME, if provided, is a string specifying the name of the argument. This name is used in the help text produced by args:usage.") (p "BODY is an optional sequence of statements executed when this option is encountered. Behind the scenes, BODY is wrapped in code which adds the current option and its argument to the final options alist. So, simply leave BODY blank and options will be collected for you. BODY is an option-processor as defined in SRFI 37, and has access to the variables OPT (the current #