Wiki
Download
Manual
Eggs
API
Tests
Bugs
show
edit
history
You can edit this page using
wiki syntax
for markup.
Article contents:
== Outdated egg! This is an egg for CHICKEN 4, the unsupported old release. You're almost certainly looking for [[/eggref/5/mbox|the CHICKEN 5 version of this egg]], if it exists. If it does not exist, there may be equivalent functionality provided by another egg; have a look at the [[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:]] == mbox === Description The {{mbox}} library contains procedures for parsing of mbox database files, [[http://tools.ietf.org/html/rfc4155|RFC 4155]]. It is intended to conform closely to the ABNF grammar in the RFC. === Library Procedures ==== Message Predicates and Accessors The parsing procedures in this library return a list of message objects. The following procedures are available for manipulating the message objects: <procedure>(message? X) => BOOL</procedure><br> Returns {{#t}} if the given argument is a message object, {{#f}} otherwise. <procedure>(message-envelope X) => ENVELOPE</procedure><br> Returns the envelope part of a message. The envelope is an s-expression of the following form: ((time-seconds R) [(ctime ...) | (abbrtime ...)] (address ADDRESS)) The {{time-seconds}} field contains the time when the message was received, in seconds since 1900. The {{ctime}} or {{abbrtime}} fields contain the components of the date/time string. The address fields is an s-expression of the form: ((local-part STRING) (domain STRING)) <procedure>(message-headers X) => (LAMBDA () => HEADERS)</procedure><br> Returns the headers part of a message. This is a procedure of no arguments that when invoked, returns the parsed list of headers in an alist where the key is the header name (as a symbol), and the value is the parsed header contents. <procedure>(message-body X) => (LAMBDA ([P]) => BODY)</procedure><br> Returns the body part of a message. This is a procedure of a single argument, that when invoked, uses the given argument procedure to parse the message body, and returns the result. ==== Parsing Procedures: Preliminaries The parsing procedures in {{mbox}} come in two flavors: generic and specialized for operations on strings. The {{<Mbox>}} typeclass defined in module {{mbox}} provides generic parsing procedures. Please see the [[typeclass]] library for information on type classes. The {{<Mbox>}} typeclass is intended to provide abstraction over different kinds of input sequences, e.g. character lists, strings, streams, etc. {{<Mbox>}} inherits from {{<CoreABNF>}}, which provides the core parsing primitives used to build the mbox grammar parser (see the [[abnf]] and [[internet-message]] libraries for more information). The procedures in module {{mbox-string}} operate on strings. They do not require the instantiaton of type classes and are meant to provide "turn key" parsing. ==== Parsing Procedures: {{mbox-string}} <procedure>(mbox-file->messages FILENAME-OR-PORT) => MESSAGE LIST</procedure><br> Given a filename or port, parses the given file as an mbox database, and returns a list of message objects. The contents of the message are represented as a string. ==== Parsing Procedures: {{mbox}} The {{<Mbox>}} typeclass has the following definition: <enscript highlight="scheme"> (define-class <Mbox> (<InetMessage> M) mbox-envelope mbox-message-fields mbox-message mbox-file->messages ) </enscript> The following example illustrates the creation of an instance of {{<Mbox>}} typeclass specialized for byte blobs (see [[byte-blob]]). <enscript highlight="scheme"> (require-extension typeclass input-classes byte-blob) (require-library abnf internet-message mbox) (import (only abnf <CoreABNF> <Token> <CharLex> CharLex->CoreABNF Input->Token Token->CharLex ) (only internet-message <InetMessage> CoreABNF->InetMessage) (only mbox <Mbox> Input+.CoreABNF->Mbox) ) (define byte-blob-<Input> (make-<Input> byte-blob-empty? (compose byte->char byte-blob-car) byte-blob-cdr)) (define byte-blob-<Token> (Input->Token byte-blob-<Input>)) (define byte-blob-<CharLex> (Token->CharLex byte-blob-<Token>)) (define byte-blob-<CoreABNF> (CharLex->CoreABNF byte-blob-<CharLex>)) (define byte-blob-<InetMessage> (CoreABNF->InetMessage byte-blob-<CoreABNF> )) (define byte-blob-<Input+> (make-<Input+> byte-blob-<Input> byte-blob-find (compose blob->byte-blob string->blob) file->byte-blob )) (define byte-blob-<Mbox> (Input+.CoreABNF->Mbox byte-blob-<Input+> byte-blob-<CoreABNF> )) </enscript> === Requires * [[abnf]] * [[internet-message]] * [[internet-timestamp]] === Version History * 3.2 Created mbox-string module * 3.1 Bug fixes in use of byte-blob * 3.0 Compatibility with abnf 5 * 1.2 Improved handling of address without domain part * 1.1 Initial Release === License Copyright 2010-2017 Ivan Raikov. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. A full copy of the GPL license can be found at <http://www.gnu.org/licenses/>.
Description of your changes:
I would like to authenticate
Authentication
Username:
Password:
Spam control
What do you get when you add 9 to 8?