From acdba54a18f67cd097ba04a4246601c337905cd6 Mon Sep 17 00:00:00 2001 From: Chris Hanson Date: Mon, 16 Jul 2001 20:40:28 +0000 Subject: [PATCH] Add code to write XML structures. --- v7/src/xml/compile.scm | 7 +++---- v7/src/xml/ed-ffi.scm | 3 ++- v7/src/xml/test-parser.scm | 31 +++++++++++++++++++++++++++++-- v7/src/xml/xml.pkg | 10 ++++++++-- 4 files changed, 42 insertions(+), 9 deletions(-) diff --git a/v7/src/xml/compile.scm b/v7/src/xml/compile.scm index 5a1bfe771..220152a95 100644 --- a/v7/src/xml/compile.scm +++ b/v7/src/xml/compile.scm @@ -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 diff --git a/v7/src/xml/ed-ffi.scm b/v7/src/xml/ed-ffi.scm index 7f46b8a9c..c96248ad9 100644 --- a/v7/src/xml/ed-ffi.scm +++ b/v7/src/xml/ed-ffi.scm @@ -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 diff --git a/v7/src/xml/test-parser.scm b/v7/src/xml/test-parser.scm index 19c96d1c2..6051b1cbf 100644 --- a/v7/src/xml/test-parser.scm +++ b/v7/src/xml/test-parser.scm @@ -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 ;;; @@ -54,4 +54,31 @@ (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 diff --git a/v7/src/xml/xml.pkg b/v7/src/xml/xml.pkg index 369d35dfa..c25674e21 100644 --- a/v7/src/xml/xml.pkg +++ b/v7/src/xml/xml.pkg @@ -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 ;;; @@ -143,4 +143,10 @@ (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 -- 2.25.1