((section 2 "Outdated egg!" (p "This is an egg for CHICKEN 4, the unsupported old release.  You're almost certainly looking for " (int-link "/eggref/5/internet-timestamp" "the CHICKEN 5 version of this egg") ", if it exists.") (p "If it does not exist, there may be equivalent functionality provided by another egg; have a look at the " (link "https://wiki.call-cc.org/chicken-projects/egg-index-5.html" "egg index") ". Otherwise, please consider porting this egg to the current version of CHICKEN.") (tags "eggs") (toc)) (section 2 "internet-timestamp" (section 3 "Description" (p "The " (tt "internet-timestamp") " library contains a procedure for parsing of Internet timestamps " (link "http://tools.ietf.org/html/rfc3339" "RFC 3339") ". It is intended to conform closely to the ABNF grammar in the RFC.") (p "See also " (int-link "rfc3339") ".")) (section 3 "Timestamp record type" (pre " (define-record-type ts \n   (make-ts date time offset) ;; constructor\n   ts?  ;; predicate\n   (date ts-date )  ;; accessors\n   (time ts-time )\n   (offset ts-offset )\n )") (p "The " (tt "internet-timestamp") " library also defines a record printer for the above record type, which prints timestamp entries in the format specified by the RFC.")) (section 3 "Library Procedures" (section 4 "Parsing procedures" (p "The parsing procedures of this library are provided as fields of the " (tt "<InetTimestamp>") " typeclass. Please see the " (int-link "typeclass") " library for information on type classes.") (p "The " (tt "<InetTimestamp>") " typeclass is intended to provide abstraction over different kinds of input sequences, e.g. character lists, strings, streams, etc. " (tt "<InetTimestamp>") " inherits from " (tt "<CoreABNF>") ", which provides the core parsing primitives used to build the timestamp parser (see the " (int-link "abnf") " library for more information).") (p "The following example illustrates the creation of an instance of " (tt "<InetTimestamp>") " specialized for character lists.") (highlight scheme "(require-extension typeclass internet-timestamp)\n\n(require-library abnf)\n(import (only abnf <CoreABNF> \n\t      CharLex->CoreABNF\n\t       <Input> <Token> <CharLex> \n\t      Input->Token Token->CharLex make-<Input>\n\t      ))\n\n\n(define char-list-<Input>\n  (make-<Input> null? car cdr))\n\n(define char-list-<Token>\n  (Input->Token char-list-<Input>))\n\n(define char-list-<CharLex>\n  (Token->CharLex char-list-<Token>))\n\n(define char-list-<CoreABNF>\n  (CharLex->CoreABNF char-list-<CharLex>))\n\n\n(define char-list-<InetTimestamp>\n  (CoreABNF->InetTimestamp char-list-<CoreABNF> ))\n\n\n(define parser (parser char-list-<InetTimestamp>))") (def (sig (procedure "(parser <InetTimestamp) => (LAMBDA TEXT) => TS" (id parser))) (p "Once applied to an instance of the " (tt "InetTimestamp") " typeclass, " (tt "parser") " returns a procedure that parses Internet timestamp text and returns a record of type " (tt "ts") "."))) (section 4 "Formatting procedures" (def (sig (procedure "(ts->list TS) => LIST" (id ts->list))) (p "Returns an alist representation of a timestamp:") (pre " ((date (YEAR MONTH DAY)) (time (HOUR MINUTE SECOND FRAC)) (offset (OFFSET)))")))) (section 3 "Requires" (ul (li (int-link "abnf")) (li (int-link "typeclass")))) (section 3 "Version History" (ul (li "3.1 Compatibility with improved CharLex->CoreABNF constructor") (li "3.0 Compatibility with abnf 5") (li "2.0 Implemented typeclass interface") (li "1.0 Initial Release"))) (section 3 "License" (pre " Copyright 2009-2011 Ivan Raikov.") (pre " This program is free software: you can redistribute it and/or\n modify it under the terms of the GNU General Public License as\n published by the Free Software Foundation, either version 3 of the\n License, or (at your option) any later version.") (pre " This program is distributed in the hope that it will be useful, but\n WITHOUT ANY WARRANTY; without even the implied warranty of\n MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n General Public License for more details.") (pre " A full copy of the GPL license can be found at\n <http://www.gnu.org/licenses/>."))))