Commit 9115c56e authored by cvs-fast-export's avatar cvs-fast-export
Browse files

Synthetic commit for tag RELEASE_1

parent 7507e5f9
# $Id: Makefile,v 1.2 2004/06/11 13:46:48 scaekenberghe Exp $
default:
@echo Possible targets:
@echo clean-openmcl --- remove all '*.dfsl' recursively
@echo clean-lw --- remove all '*.nfasl' recursively
@echo clean-emacs --- remove all '*~' recursively
@echo clean --- all of the above
clean-openmcl:
find . -name "*.dfsl" | xargs rm
clean-lw:
find . -name "*.nfasl" | xargs rm
clean-emacs:
find . -name "*~" | xargs rm
clean: clean-openmcl clean-lw clean-emacs
#
# This can obviously only be done by a specific person in a very specific context ;-)
#
PRJ=s-xml
ACCOUNT=scaekenberghe
CVSRT=:ext:$(ACCOUNT)@common-lisp.net:/project/$(PRJ)/cvsroot
release:
rm -rf /tmp/$(PRJ) /tmp/public_html /tmp/$(PRJ).tgz /tmp/$(PRJ).tgz.asc
cd /tmp; cvs -d$(CVSRT) export -r HEAD $(PRJ); cvs -d$(CVSRT) export -r HEAD public_html
mv /tmp/public_html /tmp/$(PRJ)/doc
cd /tmp; gnutar cvfz $(PRJ).tgz $(PRJ); gpg -a -b $(PRJ).tgz
scp /tmp/$(PRJ).tgz $(ACCOUNT)@common-lisp.net:/project/$(PRJ)/public_html
scp /tmp/$(PRJ).tgz.asc $(ACCOUNT)@common-lisp.net:/project/$(PRJ)/public_html
;;;; -*- Mode: LISP -*-
;;;;
;;;; $Id: xml.asd,v 1.2 2003/12/13 22:27:02 sven Exp $
;;;;
;;;; The S-XML ASDF system definition
;;;;
;;;; Copyright (C) 2002, 2004 Sven Van Caekenberghe, Beta Nine BVBA.
;;;;
;;;; You are granted the rights to distribute and use this software
;;;; as governed by the terms of the Lisp Lesser General Public License
;;;; (http://opensource.franz.com/preamble.html), also known as the LLGPL.
(in-package :asdf)
(defsystem :s-xml
:name "S-XML"
:author "Sven Van Caekenberghe <svc@mac.com>"
:version "3"
:maintainer "Sven Van Caekenberghe <svc@mac.com>, Brian Mastenbrook <>, Rudi Schlatte <>"
:licence "Lisp Lesser General Public License (LLGPL)"
:description "Simple Common Lisp XML Parser"
:long-description "S-XML is a Common Lisp implementation of a simple XML parser, with a SAX-like and DOM interface"
:components
((:module
:src
:components ((:file "package")
(:file "xml" :depends-on ("package"))
(:file "dom" :depends-on ("package"))
(:file "lxml-dom" :depends-on ("dom"))
(:file "sxml-dom" :depends-on ("dom"))
(:file "xml-struct-dom" :depends-on ("dom"))))))
;;;; eof
;;;; -*- mode: lisp -*-
;;;;
;;;; $Id: dom.lisp,v 1.5 2003/05/23 12:07:44 sven Exp $
;;;;
;;;; This is the generic simple DOM parser and printer interface.
;;;;
;;;; Copyright (C) 2002, 2004 Sven Van Caekenberghe, Beta Nine BVBA.
;;;;
;;;; You are granted the rights to distribute and use this software
;;;; as governed by the terms of the Lisp Lesser General Public License
;;;; (http://opensource.franz.com/preamble.html), also known as the LLGPL.
(in-package :s-xml)
;;; top level DOM parser interface
(defgeneric parse-xml-dom (stream output-type)
(:documentation "Parse a character stream as XML and generate a DOM of output-type"))
(defun parse-xml (stream &key (output-type :lxml))
"Parse a character stream as XML and generate a DOM of output-type, defaulting to :lxml"
(parse-xml-dom stream output-type))
(defun parse-xml-string (string &key (output-type :lxml))
"Parse a string as XML and generate a DOM of output-type, defaulting to :lxml"
(with-input-from-string (stream string)
(parse-xml-dom stream output-type)))
(defun parse-xml-file (filename &key (output-type :lxml))
"Parse a character file as XML and generate a DOM of output-type, defaulting to :lxml"
(with-open-file (in filename :direction :input)
(parse-xml-dom in output-type)))
;;; top level DOM printer interface
(defgeneric print-xml-dom (dom input-type stream pretty level)
(:documentation "Generate XML output on a character stream from a DOM of input-type, optionally pretty printing using level"))
(defun print-xml (dom &key (stream t) (pretty nil) (input-type :lxml) (header))
"Generate XML output on a character stream (t by default) from a DOM of input-type (:lxml by default), optionally pretty printing (off by default), or adding a header (none by default)"
(when header (format stream header))
(when pretty (terpri stream))
(print-xml-dom dom input-type stream pretty 1))
(defun print-xml-string (dom &key (pretty nil) (input-type :lxml))
"Generate XML output to a string from a DOM of input-type (:lxml by default), optionally pretty printing (off by default)"
(with-output-to-string (stream)
(print-xml dom :stream stream :pretty pretty :input-type input-type)))
;;;; eof
;;;; -*- mode: lisp -*-
;;;;
;;;; $Id: lxml-dom.lisp,v 1.4 2003/06/05 12:50:18 sven Exp $
;;;;
;;;; LXML implementation of the generic DOM parser and printer.
;;;;
;;;; Copyright (C) 2002, 2004 Sven Van Caekenberghe, Beta Nine BVBA.
;;;;
;;;; You are granted the rights to distribute and use this software
;;;; as governed by the terms of the Lisp Lesser General Public License
;;;; (http://opensource.franz.com/preamble.html), also known as the LLGPL.
(in-package :s-xml)
;;; the lxml hooks to generate lxml
(defun lxml-new-element-hook (name attributes seed)
(declare (ignore name attributes seed))
'())
(defun lxml-finish-element-hook (name attributes parent-seed seed)
(let ((xml-element
(cond ((and (null seed) (null attributes))
name)
(attributes
`((,name ,@(let (list)
(dolist (attribute attributes list)
(push (cdr attribute) list)
(push (car attribute) list))))
,@(nreverse seed)))
(t
`(,name ,@(nreverse seed))))))
(cons xml-element parent-seed)))
(defun lxml-text-hook (string seed)
(cons string seed))
;;; standard DOM interfaces
(defmethod parse-xml-dom (stream (output-type (eql :lxml)))
(car (start-parse-xml stream
(make-instance 'xml-parser-state
:new-element-hook #'lxml-new-element-hook
:finish-element-hook #'lxml-finish-element-hook
:text-hook #'lxml-text-hook))))
(defmethod print-xml-dom (dom (input-type (eql :lxml)) stream pretty level)
(cond ((symbolp dom) (format stream "<~a/>" dom))
((stringp dom) (print-string-xml dom stream))
((consp dom)
(let (tag attributes)
(cond ((symbolp (car dom)) (setf tag (car dom)))
((consp (car dom)) (setf tag (caar dom) attributes (cdar dom)))
(t (error "Input not recognized as LXML ~s" dom)))
(format stream "<~a" tag)
(labels ((print-attributes (attributes)
(unless (null attributes)
(format stream " ~a=\"" (car attributes))
(print-string-xml (cadr attributes) stream)
(format stream "\"")
(print-attributes (cddr attributes)))))
(when attributes (print-attributes attributes)))
(if (cdr dom)
(let ((children (cdr dom)))
(format stream ">")
(if (and (= (length children) 1) (stringp (first children)))
(print-string-xml (first children) stream)
(progn
(dolist (child children)
(when pretty
(terpri stream)
(dotimes (i (* 2 level)) (write-char #\space stream)))
(if (stringp child)
(print-string-xml child stream)
(print-xml-dom child input-type stream pretty (1+ level))))
(when pretty
(terpri stream)
(dotimes (i (* 2 (1- level))) (write-char #\space stream)))))
(format stream "</~a>" tag))
(format stream "/>" tag))))
(t (error "Input not recognized as LXML ~s" dom))))
;;;; eof
\ No newline at end of file
;;;; -*- mode: lisp -*-
;;;;
;;;; $Id: package.lisp,v 1.1.1.1 2004/06/07 18:49:57 scaekenberghe Exp $
;;;;
;;;; This is a Common Lisp implementation of a very basic XML parser.
;;;; The parser is non-validating and not at all complete (no CDATA).
;;;; The API into the parser is pure functional parser hook model that comes from SSAX,
;;;; see also http://pobox.com/~oleg/ftp/Scheme/xml.html or http://ssax.sourceforge.net
;;;; Different DOM models are provided, an XSML, an LXML and a xml-element struct based one.
;;;;
;;;; Copyright (C) 2002, 2004 Sven Van Caekenberghe, Beta Nine BVBA.
;;;;
;;;; You are granted the rights to distribute and use this software
;;;; as governed by the terms of the Lisp Lesser General Public License
;;;; (http://opensource.franz.com/preamble.html), also known as the LLGPL.
(defpackage s-xml
(:use common-lisp)
(:export
;; main parser interface
#:start-parse-xml
#:print-string-xml
#:echo-xml
#:xml-parser-error #:xml-parser-error-message #:xml-parser-error-args #:xml-parser-error-stream
#:xml-parser-state #:get-entities #:get-seed
#:get-new-element-hook #:get-finish-element-hook #:get-text-hook
;; dom parser and printer
#:parse-xml-dom #:parse-xml #:parse-xml-string #:parse-xml-file
#:print-xml-dom #:print-xml #:print-xml-string
;; xml-element structure
#:make-xml-element #:xml-element-children #:xml-element-name
#:xml-element-attribute #:xml-element-attributes
#:xml-element-p #:new-xml-element #:first-xml-element-child)
(:documentation
"A simple XML parser with an efficient, purely functional, event-based interface as well as a DOM interface"))
;;;; eof
;;;; -*- mode: lisp -*-
;;;;
;;;; $Id: sxml-dom.lisp,v 1.4 2003/06/05 12:50:18 sven Exp $
;;;;
;;;; LXML implementation of the generic DOM parser and printer.
;;;;
;;;; Copyright (C) 2003, 2004 Sven Van Caekenberghe, Beta Nine BVBA.
;;;;
;;;; You are granted the rights to distribute and use this software
;;;; as governed by the terms of the Lisp Lesser General Public License
;;;; (http://opensource.franz.com/preamble.html), also known as the LLGPL.
(in-package :s-xml)
;;; the sxml hooks to generate sxml
(defun sxml-new-element-hook (name attributes seed)
(declare (ignore name attributes seed))
'())
(defun sxml-finish-element-hook (name attributes parent-seed seed)
(let ((xml-element (append (list name)
(when attributes
(list (let (list)
(dolist (attribute attributes (cons :@ list))
(push (list (car attribute) (cdr attribute)) list)))))
(nreverse seed))))
(cons xml-element parent-seed)))
(defun sxml-text-hook (string seed)
(cons string seed))
;;; the standard DOM interfaces
(defmethod parse-xml-dom (stream (output-type (eql :sxml)))
(car (start-parse-xml stream
(make-instance 'xml-parser-state
:new-element-hook #'sxml-new-element-hook
:finish-element-hook #'sxml-finish-element-hook
:text-hook #'sxml-text-hook))))
(defmethod print-xml-dom (dom (input-type (eql :sxml)) stream pretty level)
(cond ((stringp dom) (print-string-xml dom stream))
((consp dom)
(let ((tag (car dom))
attributes
children)
(if (and (consp (cadr dom)) (eq (caadr dom) :@))
(setf attributes (cdadr dom)
children (cddr dom))
(setf children (cdr dom)))
(format stream "<~a" tag)
(dolist (pair attributes)
(format stream " ~a=\"" (car pair))
(print-string-xml (cadr pair) stream)
(format stream "\""))
(if children
(progn
(format stream ">")
(if (and (= (length children) 1) (stringp (first children)))
(print-string-xml (first children) stream)
(progn
(dolist (child children)
(when pretty
(terpri stream)
(dotimes (i (* 2 level)) (write-char #\space stream)))
(if (stringp child)
(print-string-xml child stream)
(print-xml-dom child input-type stream pretty (1+ level))))
(when pretty
(terpri stream)
(dotimes (i (* 2 (1- level))) (write-char #\space stream)))))
(format stream "</~a>" tag))
(format stream "/>" tag))))
(t (error "Input not recognized as SXML ~s" dom))))
;;;; eof
;;;; -*- mode: lisp -*-
;;;;
;;;; $Id: xml-struct-dom.lisp,v 1.5 2003/06/05 12:50:18 sven Exp $
;;;;
;;;; XML-STRUCT implementation of the generic DOM parser and printer.
;;;;
;;;; Copyright (C) 2002, 2004 Sven Van Caekenberghe, Beta Nine BVBA.
;;;;
;;;; You are granted the rights to distribute and use this software
;;;; as governed by the terms of the Lisp Lesser General Public License
;;;; (http://opensource.franz.com/preamble.html), also known as the LLGPL.
(in-package :s-xml)
;;; xml-element struct datastructure and API
(defstruct xml-element
name ; :tag-name
attributes ; a assoc list of (:attribute-name . "attribute-value")
children ; a list of children/content either text strings or xml-elements
)
(setf (documentation 'xml-element-p 'function)
"Return T when the argument is an xml-element struct"
(documentation 'xml-element-attributes 'function)
"Return the alist of attribute names and values dotted pairs from an xml-element struct"
(documentation 'xml-element-children 'function)
"Return the list of children from an xml-element struct"
(documentation 'xml-element-name 'function)
"Return the name from an xml-element struct"
(documentation 'make-xml-element 'function)
"Make and return a new xml-element struct")
(defun xml-element-attribute (xml-element key)
"Return the string value of the attribute with name the keyword :key
of xml-element if any, return null if not found"
(let ((pair (assoc key (xml-element-attributes xml-element) :test #'eq)))
(when pair (cdr pair))))
(defun (setf xml-element-attribute) (value xml-element key)
"Set the string value of the attribute with name the keyword :key of
xml-element, creating a new attribute if necessary or overwriting an
existing one, returning the value"
(let ((attributes (xml-element-attributes xml-element)))
(if (null attributes)
(push (cons key value) (xml-element-attributes xml-element))
(let ((pair (assoc key attributes :test #'eq)))
(if pair
(setf (cdr pair) value)
(push (cons key value) (xml-element-attributes xml-element)))))
value))
(defun new-xml-element (name &rest children)
"Make a new xml-element with name and children"
(make-xml-element :name name :children children))
(defun first-xml-element-child (xml-element)
"Get the first child of an xml-element"
(first (xml-element-children xml-element)))
(defun xml-equal (xml-1 xml-2)
(and (xml-element-p xml-1)
(xml-element-p xml-2)
(eq (xml-element-name xml-1)
(xml-element-name xml-2))
(equal (xml-element-attributes xml-1)
(xml-element-attributes xml-2))
(reduce #'(lambda (&optional (x t) (y t)) (and x y))
(mapcar #'(lambda (x y)
(or (and (stringp x) (stringp y) (string= x y))
(xml-equal x y)))
(xml-element-children xml-1)
(xml-element-children xml-2)))))
;;; printing xml structures
(defmethod print-xml-dom (xml-element (input-type (eql :xml-struct)) stream pretty level)
(format stream "<~a" (xml-element-name xml-element))
(dolist (attribute (xml-element-attributes xml-element))
(format stream " ~a=\"" (car attribute))
(print-string-xml (cdr attribute) stream)
(format stream "\""))
(let ((children (xml-element-children xml-element)))
(if children
(progn
(format stream ">")
(if (and (= (length children) 1) (stringp (first children)))
(print-string-xml (first children) stream)
(progn
(dolist (child children)
(when pretty
(terpri stream)
(dotimes (i (* 2 level)) (write-char #\space stream)))
(if (stringp child)
(print-string-xml child stream)
(print-xml-dom child input-type stream pretty (1+ level))))
(when pretty
(terpri stream)
(dotimes (i (* 2 (1- level))) (write-char #\space stream)))))
(format stream "</~a>" (xml-element-name xml-element)))
(format stream "/>"))))
;;; the standard hooks to generate xml-element structs
(defun standard-new-element-hook (name attributes seed)
(declare (ignore name attributes seed))
'())
(defun standard-finish-element-hook (name attributes parent-seed seed)
(let ((xml-element (make-xml-element :name name
:attributes attributes
:children (nreverse seed))))
(cons xml-element parent-seed)))
(defun standard-text-hook (string seed)
(cons string seed))
;;; top level standard parser interfaces
(defmethod parse-xml-dom (stream (output-type (eql :xml-struct)))
(car (start-parse-xml stream
(make-instance 'xml-parser-state
:new-element-hook #'standard-new-element-hook
:finish-element-hook #'standard-finish-element-hook
:text-hook #'standard-text-hook))))
;;;; eof
This diff is collapsed.
;;;; -*- mode: lisp -*-
;;;;
;;;; $Id: all-tests.lisp,v 1.1 2003/03/25 15:31:18 sven Exp $
;;;;
;;;; Load and execute all unit and functional tests
;;;;
;;;; Copyright (C) 2002, 2004 Sven Van Caekenberghe, Beta Nine BVBA.
;;;;
;;;; You are granted the rights to distribute and use this software
;;;; as governed by the terms of the Lisp Lesser General Public License
;;;; (http://opensource.franz.com/preamble.html), also known as the LLGPL.
(load (merge-pathnames "test-xml" *load-pathname*) :verbose t)
(load (merge-pathnames "test-xml-struct-dom" *load-pathname*) :verbose t)
(load (merge-pathnames "test-lxml-dom" *load-pathname*) :verbose t)
(load (merge-pathnames "test-sxml-dom" *load-pathname*) :verbose t)
;;;; eof
\ No newline at end of file
<!-- $Id: ant-build-file.xml,v 1.1 2003/03/18 08:22:09 sven Exp $ -->
<!-- Ant 1.2 build file -->
<project name="Libretto" default="compile" basedir=".">
<!-- set global properties for this build -->
<property name="src" value="${basedir}/src" />
<property name="rsrc" value="${basedir}/rsrc" />
<property name="build" value="${basedir}/bin" />
<property name="api" value="${basedir}/api" />
<property name="lib" value="${basedir}/lib" />
<property name="junit" value="${basedir}/junit" />
<property name="rsrc" value="${basedir}/rsrc" />
<target name="prepare">
<!-- Create the time stamp -->
<tstamp/>
<!-- Create the build directory structure used by compile -->
<mkdir dir="${build}" />
<mkdir dir="${api}" />
<mkdir dir="${junit}" />
<copy file="${rsrc}/build/build.version" tofile="${build}/build.properties"/>
<replace file="${build}/build.properties" token="@@@BUILD_ID@@@" value="${DSTAMP}-${TSTAMP}"/>
</target>
<target name="compile" depends="copy-rsrc">
<!-- Compile the java code from ${src} into ${build} -->
<javac srcdir="${src}" destdir="${build}" debug="on">
<classpath>
<fileset dir="${lib}">
<include name="log4j-core.jar" />
<include name="jaxp.jar" />
<include name="crimson.jar" />
<include name="jdom.jar" />
<include name="beanshell.jar" />
</fileset>
</classpath>
</javac>
</target>
<target name="compile-junit" depends="copy-rsrc">
<!-- Compile the java code from ${src} into ${build} -->
<javac srcdir="${junit}" destdir="${build}" debug="on">
<classpath>
<fileset dir="${lib}">
<include name="*.jar" />
</fileset>
</classpath>
</javac>
</target>
<target name="copy-rsrc" depends="prepare">
<!-- Copy various resource files into ${build} -->
<copy todir="${build}">
<fileset
dir="${basedir}"
includes="images/*.gif, images/*.jpg" />
</copy>
<copy todir="${build}">
<fileset
dir="${src}"
includes="be/beta9/libretto/data/*.txt" />
</copy>
<copy todir="${build}">
<fileset
dir="${rsrc}/log4j"
includes="log4j.properties" />
</copy>
</target>
<target name="c-header" depends="compile">
<javah destdir="${rsrc}/VC_source" class="be.beta9.libretto.io.ParallelPort">
<classpath>
<pathelement location="${build}" />
</classpath>
</javah>
</target>
<target name="test-parport" depends="compile">
<java
classname="be.beta9.libretto.io.ParallelPortWriter"
fork="yes">
<classpath>
<pathelement location="${build}" />
<fileset dir="${lib}">
<include name="*.jar" />
</fileset>
</classpath>
</java>
</target>
<target name="jar-simple" depends="compile">
<!-- Put everything in ${build} into the a jar file -->
<jar
jarfile="${basedir}/libretto.jar"
basedir="${build}"
manifest="${rsrc}/manifest/libretto.mf"/>
</target>
<target name="jar" depends="compile">
<!-- Put everything in ${build} into the a jar file including all dependecies -->
<unjar src="${lib}/jaxp.jar" dest="${build}" />
<unjar src="${lib}/crimson.jar" dest="${build}" />
<unjar src="${lib}/jdom.jar" dest="${build}" />
<unjar src="${lib}/log4j-core.jar" dest="${build}" />
<jar
jarfile="${basedir}/libretto.jar"
basedir="${build}"
manifest="${rsrc}/manifest/libretto.mf"/>
</target>
<target name="client-jar" depends="background-jar">
<!-- Put everything in ${build} into the a jar file including all dependecies -->
<unjar src="${lib}/log4j-core.jar" dest="${build}" />
<jar jarfile="${basedir}/libretto-client.jar" manifest="${rsrc}/manifest/libretto-client.mf">
<fileset dir="${build}">
<include name="build.properties"/>
<include name="log4j.properties"/>
<include name="be/beta9/libretto/io/*.class"/>
<include name="be/beta9/libretto/application/Build.class"/>
<include name="be/beta9/libretto/net/LibrettoTextClient*.class"/>
<include name="be/beta9/libretto/net/TestClientMessage.class"/>
<include name="be/beta9/libretto/net/ClientStatusMessageResult.class"/>
<include name="be/beta9/libretto/net/Client*.class"/>
<include name="be/beta9/libretto/net/Constants.class"/>
<include name="be/beta9/libretto/net/TextMessage.class"/>
<include name="be/beta9/libretto/net/MessageResult.class"/>
<include name="be/beta9/libretto/net/MessageException.class"/>
<include name="be/beta9/libretto/net/SingleTextMessage.class"/>
<include name="be/beta9/libretto/net/Message.class"/>
<include name="be/beta9/libretto/net/Util.class"/>
<include name="be/beta9/libretto/gui/ShowSingleTextFrame*.class"/>
<include name="be/beta9/libretto/gui/AWTTextView*.class"/>
<include name="be/beta9/libretto/model/AttributedString*.class"/>
<include name="be/beta9/libretto/model/AWTTextStyle.class"/>
<include name="be/beta9/libretto/model/LTextStyle.class"/>
<include name="be/beta9/libretto/model/AWTCharacterAttributes.class"/>
<include name="be/beta9/libretto/model/Java2DTextStyle.class"/>
<include name="be/beta9/libretto/model/LCharacterAttributes.class"/>
<include name="be/beta9/libretto/model/Java2DCharacterAttributes.class"/>
<include name="be/beta9/libretto/util/TextStyleManager.class"/>
<include name="be/beta9/libretto/util/Bean.class"/>
<include name="be/beta9/libretto/util/LibrettoSaxReader.class"/>
<include name="be/beta9/libretto/util/Preferences.class"/>