Commits

Pjotr Kourzanov  committed 810b935

extend common with stuff from sequel.
include common diagram in all HTML output

  • Participants
  • Parent commits ecb182b

Comments (0)

Files changed (3)

File src/sequel/afterall.tex

 
 \section{Indices}
 
-\Figure{Refinement hierarchy}{XXX-hier}
+\Figure{Refinement hierarchy for XXX module}{XXX-hier}
+\Figure{Refinement hierarchy for common module}{common-hier}
 	
 \begin{multicols}{2}[\subsection{Chunks}]
 \nowebchunks

File src/sequel/common.nw

 (define %caddr (compose caddr %))
 (define %cadddr (compose cadddr %))
 (define %cddddr (compose cddddr %))
+(define %caddddr (compose cddddr car %))
 (define $caar (compose caar $))
 (define $caadr (compose caadr $))
 
 @ \subsection{SXPath trickery}\label{ssec:sxpath}
 
+@ Miscellaneous functions for \mac{SXML} transformations and namespace support.
+
 @ We hake use of the following \mac{XML} namespaces inside \mac{GXF} files. We
   represent that as a list of pairs, just in a format that's needed for [[ssax:xml->sxml]] 
   and [[srl:parameterizable]]
        `([xlink . ,xlink]
 	 [xi    . ,xi])))
 
+@ Abbreviations of common namespaces and their elements.
+
+<<Miscellaneous>>=
+(define XLink:type 'http://www.w3.org/1999/xlink:type)
+(define XLink:label 'http://www.w3.org/1999/xlink:label)
+(define XLink:href 'http://www.w3.org/1999/xlink:href)
+(define XLink:from 'http://www.w3.org/1999/xlink:from)
+(define XLink:to 'http://www.w3.org/1999/xlink:to)
+
 @ Turn a list of pairs into a list of lists (needed for literal \mac{GXF} generation)
 
 <<Miscellaneous>>=
 <<Miscellaneous>>=
 (define-syntax X@
    (syntax-rules (default)
-      ([_ t (default r ...) x ...] (let ([r((sxpath '(x ...)) t)])
+      ([_ t (default r ...) x ...] (let ([r ((sxpath '(x ...)) t)])
 				       (cond
 					     ([pair? r] (car r))
 					     (else r ...))))
 (define is-cons (lambda (p) (pair? ((sxpath '(const)) p))))
 (define is-prod (lambda (p) (null? ((sxpath '(const)) p))))
 
+@ \subsection{GXF preprocessing}\label{ssec:preproc}
+
+@ Dump the \mac{GXF} to the filesystem...
+
+<<Miscellaneous>>=
+(define (gxf:convert in out)
+   (with-output-to-file out (lambda ()
+	(print "<?xml version='1.0' encoding='utf-8'?>")
+	(print (string-append "<!DOCTYPE gxf PUBLIC "
+	               "'-//LIME/DTD gxf 1.0 Transitional//EN' "
+		       "'/home/pjotr/LIME/doc/gxf.dtd'>"))
+	(srl:parameterizable
+	 (gxf:stream-splice
+	  (xlink:find-doc in (xlink:documents in))) (current-output-port)
+	  ;'(indent . "")
+	  '(omit-xml-declaration . #t)
+	  '(standalone . yes)
+	  '(cdata-section-elements . (code))
+	  ))))
+
+@ A transformation to splice the contents of the [[<stream>]] node into the context. This is needed to support outport-inport traversals (along edges); for some reason XLinks do not work if they are not enclosed directly by the root context.
+
+<<Miscellaneous>>=
+(define (gxf:stream-splice sxml) (pre-post-order sxml 
+	`((*TOP* *macro* 	. ,(lambda top (car ((sxpath "*") top))))
+	  (@ *preorder*  	. ,Id)
+	  (gxf 			. ,(lambda gxf `(gxf
+              (@ ,@(map-union Identity ((sxpath "attribute::*") gxf)))
+     	         ,@(map-union Identity ((sxpath "node") gxf))
+     	         ,@(map-union Identity ((sxpath "stream/*") gxf))
+     	         ,@(map-union (lambda (x)
+     		   (let ([n (cadadr x)]
+			 [p (cadadr (cdr x))])
+     		   (list <<stream-splice nodes>>
+     		     )))
+     		    ((sxpath "stream/edge/from-node") gxf)))))
+	  (*text*  		. ,Unmeta)
+	  (*default*  		. ,Id))))
+
+
+@ Also, add these handy link nodes for outport-edge, edge-outport traversals.
+
+<<stream-splice nodes>>=
+     		    `(el (@ (,XLink:type "locator")
+     		            (,XLink:label ,(string-append n "_" p "_fanout"))
+     		            (,XLink:href ,(string-append
+     			      "#xpointer(gxf//edge[contains(from-node/id,'" n "') "
+     			      "and contains(from-node/port-id,'" p "')])"))))
+     		    `(nl (@ (,XLink:type "locator")
+     		            (,XLink:label ,(string-append n ":" p))
+     		            (,XLink:href ,(string-append "#" n ":" p))))
+     		    `(ea (@ (,XLink:type "arc")
+     		            (,XLink:from ,(string-append n "_" p "_fanout"))
+     		            (,XLink:to ,(string-append n ":" p))))
+     		    `(pa (@ (,XLink:type "arc")
+     		            (,XLink:from ,(string-append n ":" p))
+     		            (,XLink:to ,(string-append n "_" p "_fanout"))))
+
+
+@ \subsection{Debugging}\label{ssec:debugging}
+
 @ Possibly force a promise...
 
 <<Miscellaneous>>=

File src/sequel/middle.tex

 \tableofcontents
 
 \Figure{Refinement hierarchy}{XXX-hier}
-