Add code to write XML structures.
authorChris Hanson <org/chris-hanson/cph>
Mon, 16 Jul 2001 20:40:28 +0000 (20:40 +0000)
committerChris Hanson <org/chris-hanson/cph>
Mon, 16 Jul 2001 20:40:28 +0000 (20:40 +0000)
v7/src/xml/compile.scm
v7/src/xml/ed-ffi.scm
v7/src/xml/test-parser.scm
v7/src/xml/xml.pkg

index 5a1bfe7717112dfc35f7856ae76e24fb961716ca..220152a95c5624f80a8c9c716bec6029e14c55e8 100644 (file)
@@ -1,6 +1,6 @@
 ;;; -*-Scheme-*-
 ;;;
-;;; $Id: compile.scm,v 1.3 2001/07/14 11:44:13 cph Exp $
+;;; $Id: compile.scm,v 1.4 2001/07/16 20:40:20 cph Exp $
 ;;;
 ;;; Copyright (c) 2001 Massachusetts Institute of Technology
 ;;;
@@ -34,9 +34,8 @@
        (for-each compile-file
                  '("xml-struct"
                    "xml-chars"
-                   "xml-parser"
-                   ;;"xml-output"
-                   ))))
+                   "xml-output"
+                   "xml-parser"))))
     (cref/generate-constructors "xml")
     (sf "xml.con")
     (sf "xml.ldr")))
\ No newline at end of file
index 7f46b8a9c4b778f26f647257816088fdff638fa0..c96248ad9c793cdba2f6af147282869fd45504b6 100644 (file)
@@ -1,6 +1,6 @@
 ;;; -*-Scheme-*-
 ;;;
-;;; $Id: ed-ffi.scm,v 1.2 2001/07/12 03:24:32 cph Exp $
+;;; $Id: ed-ffi.scm,v 1.3 2001/07/16 20:40:23 cph Exp $
 ;;;
 ;;; Copyright (c) 2001 Massachusetts Institute of Technology
 ;;;
@@ -24,4 +24,5 @@
 (standard-scheme-find-file-initialization
  '#(("xml-chars" (runtime xml parser) system-global-syntax-table)
     ("xml-struct" (runtime xml structure) system-global-syntax-table)
+    ("xml-output" (runtime xml output) system-global-syntax-table)
     ("xml-parser" (runtime xml parser) system-global-syntax-table)))
\ No newline at end of file
index 19c96d1c29f11ae005b7464c7e31a048b76ee532..6051b1cbf1f8aed6a7af0c1f32c056fe7b3cc653 100644 (file)
@@ -1,6 +1,6 @@
 ;;; -*-Scheme-*-
 ;;;
-;;; $Id: test-parser.scm,v 1.4 2001/07/12 05:08:16 cph Exp $
+;;; $Id: test-parser.scm,v 1.5 2001/07/16 20:40:25 cph Exp $
 ;;;
 ;;; Copyright (c) 2001 Massachusetts Institute of Technology
 ;;;
                (test-directory (merge-pathnames dir root)))
              '("valid/sa" "valid/ext-sa" "valid/not-sa"
                           "invalid"
-                          "not-wf/sa" "not-wf/ext-sa" "not-wf/not-sa"))))
\ No newline at end of file
+                          "not-wf/sa" "not-wf/ext-sa" "not-wf/not-sa"))))
+
+(define (run-output-tests root output)
+  (let ((root
+        (merge-pathnames "xmlconf/xmltest/"
+                         (pathname-as-directory root)))
+       (output (pathname-as-directory output)))
+    (for-each (lambda (pathname)
+               (write-string ";")
+               (write-string (file-namestring pathname))
+               (write-string ":\t")
+               (let ((v (ignore-errors (lambda () (test-parser pathname)))))
+                 (cond ((not v)
+                        (write-string "No match.")
+                        (newline))
+                       ((condition? v)
+                        (write-condition-report v (current-output-port))
+                        (newline))
+                       (else
+                        (write-string "Parsed: ")
+                        (write v)
+                        (newline)
+                        (call-with-output-file
+                            (merge-pathnames (file-pathname pathname) output)
+                          (lambda (port)
+                            (write-xml v port)))))
+                 v))
+             (directory-read (merge-pathnames "valid/sa/*.xml" root)))))
\ No newline at end of file
index 369d35dfaa94b5caa4a79719c6274ba91fa5d9f3..c25674e21ed32c6e7b22d1d873f806e1b895d5b6 100644 (file)
@@ -1,6 +1,6 @@
 ;;; -*-Scheme-*-
 ;;;
-;;; $Id: xml.pkg,v 1.5 2001/07/16 18:54:48 cph Exp $
+;;; $Id: xml.pkg,v 1.6 2001/07/16 20:40:28 cph Exp $
 ;;;
 ;;; Copyright (c) 2001 Massachusetts Institute of Technology
 ;;;
   (files "xml-chars" "xml-parser")
   (parent ())
   (export ()
-         parse-xml-document))
\ No newline at end of file
+         parse-xml-document))
+
+(define-package (runtime xml output)
+  (files "xml-output")
+  (parent ())
+  (export ()
+         write-xml))
\ No newline at end of file