]> git.donarmstrong.com Git - lilypond.git/blobdiff - scm/generate-documentation.scm
release: 1.5.7
[lilypond.git] / scm / generate-documentation.scm
index 4868dfa3a026e213663c085012ce751607d7a0d8..114d5f2de74a6026a71f7a7602344e3272878894 100644 (file)
 
-;;;; 
-;
-; This file generates documentation for the backend of lilypond.
-;
-;;;;
-
-
-(define (uniqued-alist  alist acc)
-  (if (null? alist) acc
-      (if (assoc (caar alist) acc)
-         (uniqued-alist (cdr alist) acc)
-         (uniqued-alist (cdr alist) (cons (car alist) acc)
-  ))))
-
-;;; TODO
-
-(define (wordwrap string)
-  ""
-  )
-  
-(define (self-evaluating? x)
-  (or (number? x) (string? x) (procedure? x) (boolean? x))
-  )
-
-
-(define (htmlfy x)
-  (let*
-      ((x1 (regexp-substitute/global #f ">" x 'pre ">" 'post))
-       (x2 (regexp-substitute/global #f "<" x1 'pre "&lt;" 'post))
+;;; generate-documentation.scm -- Generate documentation
+;;;
+;;; source file of the GNU LilyPond music typesetter
+;;; 
+;;; (c) 2000--2001 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+;;; Jan Nieuwenhuizen <janneke@gnu.org>
+
+;;; File entry point for generated documentation
+
+;;; Running LilyPond on this file generates the documentation
+
+
+
+;; We use ly-gulp because these files live in
+;;
+;;     PATH=$LILYPONDPREFIX/scm:<datadir>/scm
+;;
+(eval-string
+ (apply string-append
+ (map ly-gulp-file '("documentation-lib.scm"
+                               "engraver-documentation-lib.scm"
+                               "music-documentation-lib.scm"
+                               "backend-documentation-lib.scm"))))
+
+;;(define no-copies #t)  ; from 490 to 410K, but doesn't look nice yet
+;;
+;; Also, copies of interfaces use up lots more space, but that's
+;; functional because the default property values of the interfaces
+;; are described...
+(define no-copies #f)
+
+(let* ((doc (string-append
+            (document-music "LilyPond music properties") 
+            (document-paper "LilyPond interpretation contexts")
+            (document-all-engravers "LilyPond engravers")
+            (document-all-engraver-properties "LilyPond context properties")        
+            (document-all-grobs "LilyPond backend")
+            (document-all-interfaces "LilyPond interfaces")
+            (document-all-backend-properties "LilyPond backend properties")
+            )
        )
-    x2))
-
-(define (scm->string val)
-  (string-append
-   (if (self-evaluating? val) "" "'")
-   (htmlfy 
-    (call-with-output-string (lambda (port) (display val port))))
-  ))
-
-(define (document-property prop desc)
-  (let ((handle (assoc (car prop) desc)))
-    (string-append
-     "\n<li><code>" (symbol->string (car prop)) "</code> (" (type-name (cadr prop)) ") -- "
-     (caddr prop)
-     "<br>default value:  <code>"
-     (if (pair? handle)
-        (scm->string (cdr handle))
-        "not set"
-        )
-     "</code>\n"
-  )
-  ))
-
-(define (document-interface interface elt-description)
-  (let* ((name (car interface))
-        (desc (cadr interface))
-        (props (caddr interface))
-        (docs (map (lambda (x) (document-property x elt-description))
-                   props))
-        )
-
-    (string-append
-     "<hr>"
-     "<h2>Interface: " (symbol->string name) "</h2>\n"
-     desc
-     "<hr>\n<ul>"
-     (apply string-append docs)
-     "</ul>"
-     )
-    ))
-
-;
-; generate HTML, return filename.
-;
-(define (document-element description)
-  (let* ((metah (assoc 'meta description))
-        (meta (if (pair? metah)
-                  (cdr metah)
-                  '((properties . ()) (name . "huh?"))
-                  ))
-        
-        (name (cdr (assoc 'name meta)))
-        (ifaces (cdr (assoc 'interface-descriptions meta)))
-        (ifacedoc (map (lambda (x) (document-interface x description))
-                               (reverse ifaces)))
-        (outname  (string-append name ".html"))
-        (out (open-output-file outname))
-        )
-    (display (string-append "Writing " outname " ... \n") (current-error-port))
-    (display
-     (string-append "<title>LilyPond Element " name " </title>"
-                   "<h1>" name "</h1>"
-                   (apply string-append ifacedoc))
-     out)
-    outname
-    )
-  )
-
-(define (document-elements elts)
-  (let* ((files (map (lambda (x) (document-element (cdr x)))
-                   elts))
-       (outname  (string-append "backend.html"))
-       (out (open-output-file outname))
-       (l (map (lambda (x) (string-append
-                            "<li><a href=" x ">" x "</a>\n"))
-               files))
-       )
-
-       (display
-        (string-append
-         "<title>LilyPond backend documentation</title>"
-         "<h1>LilyPond backend documentation</h1>"
-         "<ul>"
-         (apply string-append l)
-         "</ul>"
-       )
-        out
-        )
-   ))
-
-; (display (document-interface stem-interface '()))
-; (define b (cdr (assoc 'Beam all-element-descriptions)))
-;(display b)
-
-;(document-element  b)
-
-(document-elements all-element-descriptions)
+       (name "lilypond-internals")
+       (outname (string-append name ".texi"))
+       (out (open-output-file outname)))
 
+  (writing-wip outname)
+  (display 
+   (string-append
+    (texi-file-head
+     
+     ;; we can't use (dir) and top if we're included by lilypond.tely
+     "LilyPond internals" name "(lilypond.info)"
+     '(
+       ("LilyPond music properties" . "properties for Music representation")
+       ("LilyPond interpretation contexts" . "Hierarchy and grouping of Engravers")
+       ("LilyPond engravers" . "Engravers create Grobs")
+       ("LilyPond context properties" . "context properties")       
+       ("LilyPond backend" . "Detailed description of all Grobs")
+       ("LilyPond interfaces" . "Grob Interfaces")
+       ("LilyPond backend properties" . "Grob properties")
+       ("Index" . "index")
+       ))
+
+    
+    
+    doc
+
+    "@node Index
+@unnumbered Concept index
+
+@printindex cp
+
+@unnumbered Variable index
+
+@printindex vr
+
+@unnumbered Function index
+
+@printindex fn
+
+"
+
+    
+    "\n@bye")
+   out))
+
+(newline (current-error-port))