diff options
author | Ludovic Courtes | 2005-07-02 02:04:46 +0000 |
---|---|---|
committer | Ludovic Courtes | 2005-07-02 02:04:46 +0000 |
commit | 2d740bec3cc50480980d8aae3a06e27a5f0649e5 (patch) | |
tree | 8a19b85eed59cd9902c1dc81fc7b6180ff65ef45 | |
parent | efea4dc93f2565555e47de0bfd027614a9c8674d (diff) | |
download | skribilo-2d740bec3cc50480980d8aae3a06e27a5f0649e5.tar.gz skribilo-2d740bec3cc50480980d8aae3a06e27a5f0649e5.tar.lz skribilo-2d740bec3cc50480980d8aae3a06e27a5f0649e5.zip |
Started relying on the per-module reader; first doc produced ever!
First document compiled by Skribilo to HTML!
* src/guile/skribilo/module.scm (define-skribe-module): Use the
`#:reader' option of `define-module' (not yet integrated in Guile 1.7).
Plus lots of other things...
git-archimport-id: lcourtes@laas.fr--2005-mobile/skribilo--devel--1.2--patch-3
-rw-r--r-- | src/guile/README | 4 | ||||
-rwxr-xr-x | src/guile/skribilo.scm | 36 | ||||
-rw-r--r-- | src/guile/skribilo/biblio.scm | 11 | ||||
-rw-r--r-- | src/guile/skribilo/engine/html.scm | 7 | ||||
-rw-r--r-- | src/guile/skribilo/evaluator.scm | 47 | ||||
-rw-r--r-- | src/guile/skribilo/lib.scm | 10 | ||||
-rw-r--r-- | src/guile/skribilo/module.scm | 105 | ||||
-rw-r--r-- | src/guile/skribilo/output.scm | 7 | ||||
-rw-r--r-- | src/guile/skribilo/resolve.scm | 24 | ||||
-rw-r--r-- | src/guile/skribilo/runtime.scm | 102 | ||||
-rw-r--r-- | src/guile/skribilo/skribe/api.scm | 1 | ||||
-rw-r--r-- | src/guile/skribilo/skribe/bib.scm | 1 | ||||
-rw-r--r-- | src/guile/skribilo/skribe/utils.scm | 3 | ||||
-rw-r--r-- | src/guile/skribilo/source.scm | 18 | ||||
-rw-r--r-- | src/guile/skribilo/types.scm | 6 | ||||
-rw-r--r-- | src/guile/skribilo/vars.scm | 8 | ||||
-rw-r--r-- | src/guile/skribilo/verify.scm | 31 | ||||
-rw-r--r-- | src/guile/skribilo/writer.scm | 2 |
18 files changed, 216 insertions, 207 deletions
diff --git a/src/guile/README b/src/guile/README index 1b9a6c4..4bd7eff 100644 --- a/src/guile/README +++ b/src/guile/README @@ -1,4 +1,4 @@ -Skribilo +Skribilo -*- Outline -*- ======== Skribilo is a port of Skribe to GNU Guile. @@ -11,6 +11,8 @@ Here are a few goals. ** Better error handling, automatic back-traces, etc. +** Add an option to continuously watch a file and re-compile it + * Font-ends (readers) ** Implement a new front-end mechanism (see `(skribilo reader)') diff --git a/src/guile/skribilo.scm b/src/guile/skribilo.scm index ae21fab..a43ec66 100755 --- a/src/guile/skribilo.scm +++ b/src/guile/skribilo.scm @@ -59,10 +59,6 @@ exec ${GUILE-guile} --debug -l $0 -c "(apply $main (cdr (command-line)))" "$@" the-arg)))))))) -(set! %load-hook - (lambda (file) - (format #t "~~ loading `~a'...~%" file))) - (define-module (skribilo)) @@ -415,6 +411,11 @@ Processes a Skribilo/Skribe source file and produces its output. (set-skribe-debug! (string->number debugging-level)) + (if (> (skribe-debug) 4) + (set! %load-hook + (lambda (file) + (format #t "~~ loading `~a'...~%" file)))) + (set! %skribilo-load-path (cons load-path %skribilo-load-path)) (set! %skribilo-bib-path @@ -426,9 +427,6 @@ Processes a Skribilo/Skribe source file and produces its output. ;; Load the user rc file ;(load-rc) - ;; load the basic Skribe modules - (load-skribe-modules) - ;; Load the base file to bootstrap the system as well as the files ;; that are in the PRELOAD variable. (find-engine 'base) @@ -442,24 +440,28 @@ Processes a Skribilo/Skribe source file and produces its output. (reverse! variants)) (let ((files (option-ref options '() '()))) - (if (null? files) - (error "you must specify at least the input file" files)) + (if (> (length files) 2) (error "you can specify at most one input file and one output file" files)) - (let* ((source-file (car files)) - (dest-file (if (null? (cdr files)) #f (cadr files))) - (source-port (open-input-file source-file))) + (let* ((source-file (if (null? files) #f (car files))) + (dest-file (if (or (not source-file) + (null? (cdr files))) + #f + (cadr files))) + (do-it! (lambda () + (if (string? dest-file) + (with-output-to-file dest-file doskribe) + (doskribe))))) (if (and dest-file (file-exists? dest-file)) (delete-file dest-file)) - (with-input-from-file source-file - (lambda () - (if (string? dest-file) - (with-output-to-file dest-file doskribe) - (doskribe)))))))) + (if source-file + (with-input-from-file source-file + do-it!) + (do-it!)))))) (define main skribilo) diff --git a/src/guile/skribilo/biblio.scm b/src/guile/skribilo/biblio.scm index d4a644e..f3ddf97 100644 --- a/src/guile/skribilo/biblio.scm +++ b/src/guile/skribilo/biblio.scm @@ -27,10 +27,11 @@ (define-module (skribilo biblio) - :use-module (skribilo runtime) - :export (bib-tables? make-bib-table default-bib-table - bib-load! resolve-bib resolve-the-bib - bib-sort/authors bib-sort/idents bib-sort/dates)) + :use-module (skribilo runtime) + :use-module (skribilo lib) ;; `when', `unless' + :use-module (skribilo vars) + :export (bib-table? make-bib-table default-bib-table + bib-add!)) (define *bib-table* #f) @@ -50,7 +51,7 @@ (make-hash-table)) (define (bib-table? obj) - (hashtable? obj)) + (hash-table? obj)) (define (default-bib-table) (unless *bib-table* diff --git a/src/guile/skribilo/engine/html.scm b/src/guile/skribilo/engine/html.scm index a20ea68..c85f18f 100644 --- a/src/guile/skribilo/engine/html.scm +++ b/src/guile/skribilo/engine/html.scm @@ -16,7 +16,8 @@ ;* @ref ../../doc/user/htmle.skb:ref@ */ ;*=====================================================================*/ -(define-skribe-module (skribilo engine html)) +(define-skribe-module (skribilo engine html) + #:use-module ((srfi srfi-19) :renamer (symbol-prefix-proc 's19:))) ;; Keep a reference to the base engine. @@ -843,7 +844,9 @@ :url (skribilo-url)) "." (linebreak) - "Last update: " (date))))) + "Last update: " + (s19:date->string + (s19:current-date)))))) e)))) :after "</div>\n") diff --git a/src/guile/skribilo/evaluator.scm b/src/guile/skribilo/evaluator.scm index b7e04c1..703186c 100644 --- a/src/guile/skribilo/evaluator.scm +++ b/src/guile/skribilo/evaluator.scm @@ -43,53 +43,6 @@ (oop goops)) - -;;; FIXME: The following page must eventually go to `module.scm'. - -(define *skribilo-user-module* #f) - -(define *skribilo-user-imports* - '((srfi srfi-1) - (srfi srfi-13) - (oop goops) - (skribilo module) - (skribilo config) - (skribilo vars) - (skribilo runtime) - (skribilo biblio) - (skribilo lib) - (skribilo resolve) - (skribilo engine) - (skribilo writer))) - -(define *skribe-core-modules* ;;; FIXME: From `module.scm'. - '("utils" "api" "bib" "index" "param" "sui")) - -;;; -;;; MAKE-RUN-TIME-MODULE -;;; -(define-public (make-run-time-module) - "Return a new module that imports all the necessary bindings required for -execution of Skribilo/Skribe code." - (let ((the-module (make-module))) - (for-each (lambda (iface) - (module-use! the-module (resolve-module iface))) - (append *skribilo-user-imports* - (map (lambda (mod) - `(skribilo skribe - ,(string->symbol mod))) - *skribe-core-modules*))) - (set-module-name! the-module '(skribilo-user)) - the-module)) - -;;; -;;; RUN-TIME-MODULE -;;; -(define-public (run-time-module) - "Return the default instance of a Skribilo/Skribe run-time module." - (if (not *skribilo-user-module*) - (set! *skribilo-user-module* (make-run-time-module))) - *skribilo-user-module*) diff --git a/src/guile/skribilo/lib.scm b/src/guile/skribilo/lib.scm index bb41597..ef8ef8d 100644 --- a/src/guile/skribilo/lib.scm +++ b/src/guile/skribilo/lib.scm @@ -58,6 +58,7 @@ hashtable-get hashtable-put! hashtable-update! hashtable->list + skribe-read find-runtime-type) :export-syntax (new define-markup define-simple-markup @@ -68,6 +69,8 @@ :use-module (skribilo config) :use-module (skribilo types) + :use-module (skribilo reader) + :use-module (skribilo vars) :use-module (srfi srfi-1) :use-module (ice-9 optargs)) @@ -105,7 +108,7 @@ (let ((name (car bindings)) (opts (cdr bindings))) - `(define* ,(cons name (fix-rest-arg opts)) ,@body))) + `(define*-public ,(cons name (fix-rest-arg opts)) ,@body))) ;;; @@ -352,6 +355,11 @@ ;;; Various things. ;;; +(define %skribe-reader (make-reader 'skribe)) + +(define* (skribe-read #:optional (port (current-input-port))) + (%skribe-reader port)) + (define (%procedure-arity proc) (car (procedure-property proc 'arity))) diff --git a/src/guile/skribilo/module.scm b/src/guile/skribilo/module.scm index 50c7b23..854c50d 100644 --- a/src/guile/skribilo/module.scm +++ b/src/guile/skribilo/module.scm @@ -22,6 +22,7 @@ :use-module (skribilo reader) :use-module (skribilo evaluator) :use-module (skribilo debug) + :use-module (srfi srfi-1) :use-module (ice-9 optargs)) ;;; Author: Ludovic Courtès @@ -36,47 +37,47 @@ ;;; ;;; Code: -(define-macro (define-skribe-module name) +(define *skribilo-user-imports* + ;; List of modules that should be imported by any good Skribilo module. + '((srfi srfi-1) ;; lists + (srfi srfi-13) ;; strings + ;(srfi srfi-19) ;; date and time + (oop goops) ;; `make' + (ice-9 optargs) ;; `define*' + + (skribilo module) + (skribilo types) ;; `<document>', `document?', etc. + (skribilo config) + (skribilo vars) + (skribilo runtime) ;; `the-options', `the-body' + (skribilo biblio) + (skribilo lib) ;; `define-markup', `unwind-protect', etc. + (skribilo resolve) + (skribilo engine) + (skribilo writer) + (skribilo output) + (skribilo evaluator))) + +(define *skribe-core-modules* + '("utils" "api" "bib" "index" "param" "sui")) + +(define-macro (define-skribe-module name . options) `(begin - (define-module ,name) + (define-module ,name + #:reader (make-reader 'skribe) + #:use-module (skribilo reader) + ,@options) ;; Pull all the bindings that Skribe code may expect, plus those needed ;; to actually create and read the module. - (use-modules (skribilo module) - (skribilo reader) - (skribilo evaluator) ;; `run-time-module' - (skribilo engine) - (skribilo writer) - (skribilo types) - - (srfi srfi-1) - (ice-9 optargs) - - (skribilo lib) ;; `define-markup', `unwind-protect', etc. - (skribilo runtime) - (skribilo vars) - (skribilo config)) - - - ;; The `define' below results in a module-local definition. So the - ;; definition of `read' in the `(guile-user)' module is left untouched. - ;(define read ,(make-reader 'skribe)) - - ;; Everything is exported. -; (define-macro (define . things) -; (let* ((first (car things)) -; (binding (cond ((symbol? first) first) -; ((list? first) (car first)) -; ((pair? first) (car first)) -; (else -; (error "define/skribe: bad formals" first))))) -; `(begin -; (define-public ,@things) -; ;; Automatically push it to the run-time user module. -; ; (module-define! ,(run-time-module) -; ; (quote ,binding) ,binding) -; ))) - )) + ,(cons 'use-modules + (append *skribilo-user-imports* + (filter-map (lambda (mod) + (let ((m `(skribilo skribe + ,(string->symbol + mod)))) + (and (not (equal? m name)) m))) + *skribe-core-modules*))))) ;; Make it available to the top-level module. @@ -84,9 +85,35 @@ 'define-skribe-module define-skribe-module) -(define-public *skribe-core-modules* - '("utils" "api" "bib" "index" "param" "sui")) + +(define *skribilo-user-module* #f) + +;;; +;;; MAKE-RUN-TIME-MODULE +;;; +(define-public (make-run-time-module) + "Return a new module that imports all the necessary bindings required for +execution of Skribilo/Skribe code." + (let ((the-module (make-module))) + (for-each (lambda (iface) + (module-use! the-module (resolve-module iface))) + (append *skribilo-user-imports* + (map (lambda (mod) + `(skribilo skribe + ,(string->symbol mod))) + *skribe-core-modules*))) + (set-module-name! the-module '(skribilo-user)) + the-module)) + +;;; +;;; RUN-TIME-MODULE +;;; +(define-public (run-time-module) + "Return the default instance of a Skribilo/Skribe run-time module." + (if (not *skribilo-user-module*) + (set! *skribilo-user-module* (make-run-time-module))) + *skribilo-user-module*) ;; FIXME: This will eventually be replaced by the per-module reader thing in diff --git a/src/guile/skribilo/output.scm b/src/guile/skribilo/output.scm index eeff397..8a63a48 100644 --- a/src/guile/skribilo/output.scm +++ b/src/guile/skribilo/output.scm @@ -31,6 +31,7 @@ (skribilo types) ; (skribilo engine) (skribilo writer) + (skribilo lib) ;; `when', `unless' (oop goops)) @@ -60,10 +61,10 @@ (%out/writer node e (car writer))) ((not (car writer)) (skribe-error 'output - (format "Illegal ~A user writer" (engine-ident e)) + (format #f "illegal ~A user writer" (engine-ident e)) (if (markup? node) (markup-markup node) node))) (else - (skribe-error 'output "Illegal user writer" (car writer))))))) + (skribe-error 'output "illegal user writer" (car writer))))))) ;;; @@ -74,7 +75,7 @@ (define-method (out (node <pair>) e) - (let Loop ((n* node)) + (let loop ((n* node)) (cond ((pair? n*) (out (car n*) e) diff --git a/src/guile/skribilo/resolve.scm b/src/guile/skribilo/resolve.scm index e59a2f8..14f36b2 100644 --- a/src/guile/skribilo/resolve.scm +++ b/src/guile/skribilo/resolve.scm @@ -1,24 +1,24 @@ ;;;; ;;;; resolve.stk -- Skribe Resolve Stage -;;;; +;;;; ;;;; Copyright © 2003-2004 Erick Gallesio - I3S-CNRS/ESSI <eg@unice.fr> -;;;; -;;;; +;;;; +;;;; ;;;; This program is free software; you can redistribute it and/or modify ;;;; it under the terms of the GNU General Public License as published by ;;;; the Free Software Foundation; either version 2 of the License, or ;;;; (at your option) any later version. -;;;; +;;;; ;;;; This program is distributed in the hope that it will be useful, ;;;; but WITHOUT ANY WARRANTY; without even the implied warranty of ;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;;;; GNU General Public License for more details. -;;;; +;;;; ;;;; You should have received a copy of the GNU General Public License ;;;; along with this program; if not, write to the Free Software -;;;; Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, +;;;; Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, ;;;; USA. -;;;; +;;;; ;;;; Author: Erick Gallesio [eg@essi.fr] ;;;; Creation date: 13-Aug-2003 18:39 (eg) ;;;; Last file update: 17-Feb-2004 14:43 (eg) @@ -28,6 +28,7 @@ :use-module (skribilo debug) :use-module (skribilo runtime) :use-module (skribilo types) + :use-module (skribilo lib) ;; `unless' and `when' :use-module (oop goops) @@ -62,7 +63,7 @@ ;;;; ====================================================================== ;;;; -;;;; D O - R E S O L V E ! +;;;; D O - R E S O L V E ! ;;;; ;;;; ====================================================================== @@ -195,10 +196,10 @@ (debug-item "parent=" p " " (if (is-a? p 'markup) (slot-ref p 'markup) "???")) (cond - ((pred p) p) + ((pred p) p) ((is-a? p <unresolved>) p) ((not p) #f) - (else (resolve-search-parent p e pred)))))) + (else (resolve-search-parent p e pred)))))) ;;;; ====================================================================== ;;;; @@ -231,7 +232,7 @@ (else (set-car! (cdr c) (+ 1 num)) (+ 1 num))))))) - + ;;;; ====================================================================== ;;;; ;;;; RESOLVE-IDENT @@ -259,4 +260,3 @@ (car mks)) (else (loop (cdr mks))))))))))) - diff --git a/src/guile/skribilo/runtime.scm b/src/guile/skribilo/runtime.scm index 2642f7e..1f411dc 100644 --- a/src/guile/skribilo/runtime.scm +++ b/src/guile/skribilo/runtime.scm @@ -27,6 +27,7 @@ (define-module (skribilo runtime) :export (;; Utilities strip-ref-base ast->file-location string-canonicalize + the-options the-body ;; Markup functions markup-option markup-option-add! markup-output @@ -49,6 +50,8 @@ (skribilo resolve) (skribilo output) (skribilo evaluator) + (skribilo vars) + (srfi srfi-13) (oop goops)) @@ -253,10 +256,10 @@ ;; The general version (lambda (str) (let ((out (open-output-string))) - (dotimes (i (string-length str)) - (let* ((ch (string-ref str i)) - (res (assq ch lst))) - (display (if res (cadr res) ch) out))) + (string-for-each (lambda (ch) + (let ((res (assq ch lst))) + (display (if res (cadr res) ch) out))) + str) (get-output-string out)))) (define string->html @@ -414,48 +417,49 @@ ;;NEW '())))))) ;;NEW -;;NEW ;;;; ====================================================================== -;;NEW ;;;; -;;NEW ;;;; M A R K U P A R G U M E N T P A R S I N G -;;NEW ;;; -;;NEW ;;;; ====================================================================== -;;NEW (define (the-body opt) -;;NEW ;; Filter out the options -;;NEW (let loop ((opt* opt) -;;NEW (res '())) -;;NEW (cond -;;NEW ((null? opt*) -;;NEW (reverse! res)) -;;NEW ((not (pair? opt*)) -;;NEW (skribe-error 'the-body "Illegal body" opt)) -;;NEW ((keyword? (car opt*)) -;;NEW (if (null? (cdr opt*)) -;;NEW (skribe-error 'the-body "Illegal option" (car opt*)) -;;NEW (loop (cddr opt*) res))) -;;NEW (else -;;NEW (loop (cdr opt*) (cons (car opt*) res)))))) -;;NEW -;;NEW -;;NEW -;;NEW (define (the-options opt+ . out) -;;NEW ;; Returns an list made of options.The OUT argument contains -;;NEW ;; keywords that are filtered out. -;;NEW (let loop ((opt* opt+) -;;NEW (res '())) -;;NEW (cond -;;NEW ((null? opt*) -;;NEW (reverse! res)) -;;NEW ((not (pair? opt*)) -;;NEW (skribe-error 'the-options "Illegal options" opt*)) -;;NEW ((keyword? (car opt*)) -;;NEW (cond -;;NEW ((null? (cdr opt*)) -;;NEW (skribe-error 'the-options "Illegal option" (car opt*))) -;;NEW ((memq (car opt*) out) -;;NEW (loop (cdr opt*) res)) -;;NEW (else -;;NEW (loop (cdr opt*) -;;NEW (cons (list (car opt*) (cadr opt*)) res))))) -;;NEW (else -;;NEW (loop (cdr opt*) res))))) -;;NEW + +;;;; ====================================================================== +;;;; +;;;; M A R K U P A R G U M E N T P A R S I N G +;;;; +;;;; ====================================================================== +(define (the-body opt) + ;; Filter out the options + (let loop ((opt* opt) + (res '())) + (cond + ((null? opt*) + (reverse! res)) + ((not (pair? opt*)) + (skribe-error 'the-body "Illegal body" opt)) + ((keyword? (car opt*)) + (if (null? (cdr opt*)) + (skribe-error 'the-body "Illegal option" (car opt*)) + (loop (cddr opt*) res))) + (else + (loop (cdr opt*) (cons (car opt*) res)))))) + + + +(define (the-options opt+ . out) + ;; Returns an list made of options.The OUT argument contains + ;; keywords that are filtered out. + (let loop ((opt* opt+) + (res '())) + (cond + ((null? opt*) + (reverse! res)) + ((not (pair? opt*)) + (skribe-error 'the-options "Illegal options" opt*)) + ((keyword? (car opt*)) + (cond + ((null? (cdr opt*)) + (skribe-error 'the-options "Illegal option" (car opt*))) + ((memq (car opt*) out) + (loop (cdr opt*) res)) + (else + (loop (cdr opt*) + (cons (list (car opt*) (cadr opt*)) res))))) + (else + (loop (cdr opt*) res))))) + diff --git a/src/guile/skribilo/skribe/api.scm b/src/guile/skribilo/skribe/api.scm index 2828908..e7ba4a6 100644 --- a/src/guile/skribilo/skribe/api.scm +++ b/src/guile/skribilo/skribe/api.scm @@ -253,6 +253,7 @@ ;* paragraph ... */ ;*---------------------------------------------------------------------*/ (define-simple-markup paragraph) +(define-public p paragraph) ;*---------------------------------------------------------------------*/ ;* footnote ... */ diff --git a/src/guile/skribilo/skribe/bib.scm b/src/guile/skribilo/skribe/bib.scm index f1a32c1..2ec5c0b 100644 --- a/src/guile/skribilo/skribe/bib.scm +++ b/src/guile/skribilo/skribe/bib.scm @@ -32,7 +32,6 @@ ;;; The contents of the file below are unchanged compared to Skribe 1.2d's ;;; `bib.scm' file found in the `common' directory. - ;*---------------------------------------------------------------------*/ ;* bib-load! ... */ ;*---------------------------------------------------------------------*/ diff --git a/src/guile/skribilo/skribe/utils.scm b/src/guile/skribilo/skribe/utils.scm index f963020..b2a5cfb 100644 --- a/src/guile/skribilo/skribe/utils.scm +++ b/src/guile/skribilo/skribe/utils.scm @@ -19,7 +19,8 @@ ;;; Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, ;;; USA. -(define-skribe-module (skribilo skribe utils)) +(define-skribe-module (skribilo skribe utils) + #:export (ast-document)) ;;; Author: Manuel Serrano ;;; Commentary: diff --git a/src/guile/skribilo/source.scm b/src/guile/skribilo/source.scm index 1e88d45..c682687 100644 --- a/src/guile/skribilo/source.scm +++ b/src/guile/skribilo/source.scm @@ -1,24 +1,24 @@ ;;;; ;;;; source.stk -- Skibe SOURCE implementation stuff -;;;; +;;;; ;;;; Copyright © 2003-2004 Erick Gallesio - I3S-CNRS/ESSI <eg@essi.fr> -;;;; -;;;; +;;;; +;;;; ;;;; This program is free software; you can redistribute it and/or modify ;;;; it under the terms of the GNU General Public License as published by ;;;; the Free Software Foundation; either version 2 of the License, or ;;;; (at your option) any later version. -;;;; +;;;; ;;;; This program is distributed in the hope that it will be useful, ;;;; but WITHOUT ANY WARRANTY; without even the implied warranty of ;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;;;; GNU General Public License for more details. -;;;; +;;;; ;;;; You should have received a copy of the GNU General Public License ;;;; along with this program; if not, write to the Free Software -;;;; Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, +;;;; Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, ;;;; USA. -;;;; +;;;; ;;;; Author: Erick Gallesio [eg@essi.fr] ;;;; Creation date: 3-Sep-2003 12:22 (eg) ;;;; Last file update: 27-Oct-2004 20:09 (eg) @@ -27,7 +27,8 @@ (define-module (skribilo source) - :export (source-read-lines source-read-definition source-fontify)) + :export (source-read-lines source-read-definition source-fontify) + :use-module (skribilo vars)) ;; Temporary solution @@ -187,4 +188,3 @@ (cons* 'eol (substring str j i) r)))) (else (loop (+ i 1) j r)))))) - diff --git a/src/guile/skribilo/types.scm b/src/guile/skribilo/types.scm index 0d51c70..0893587 100644 --- a/src/guile/skribilo/types.scm +++ b/src/guile/skribilo/types.scm @@ -33,10 +33,12 @@ <node> node? node-options node-loc <engine> engine? engine-ident engine-format engine-customs engine-filter engine-symbol-table - <writer> writer? write-object + <writer> writer? write-object writer-options writer-ident + writer-before writer-action writer-after <processor> processor? processor-combinator processor-engine <markup> markup? bind-markup! markup-options is-markup? - markup-body find-markups write-object + markup-markup markup-body markup-ident markup-class + find-markups write-object <container> container? container-options container-ident container-body <document> document? document-ident document-body diff --git a/src/guile/skribilo/vars.scm b/src/guile/skribilo/vars.scm index 51a7ee7..7e75e0f 100644 --- a/src/guile/skribilo/vars.scm +++ b/src/guile/skribilo/vars.scm @@ -21,7 +21,8 @@ ;;; USA. -(define-module (skribilo vars)) +(define-module (skribilo vars) + #:use-module (srfi srfi-17)) ;;; ;;; Switches @@ -30,6 +31,11 @@ (define-public *skribe-warning* 5) (define-public *load-rc* #t) +(define-public skribe-debug + (let ((level 0)) + (getter-with-setter (lambda () level) + (lambda (val) (set! level val))))) + ;;; ;;; PATH variables ;;; diff --git a/src/guile/skribilo/verify.scm b/src/guile/skribilo/verify.scm index 93a1be3..1ff0b5b 100644 --- a/src/guile/skribilo/verify.scm +++ b/src/guile/skribilo/verify.scm @@ -1,24 +1,24 @@ ;;;; ;;;; verify.stk -- Skribe Verification Stage -;;;; +;;;; ;;;; Copyright © 2003-2004 Erick Gallesio - I3S-CNRS/ESSI <eg@unice.fr> -;;;; -;;;; +;;;; +;;;; ;;;; This program is free software; you can redistribute it and/or modify ;;;; it under the terms of the GNU General Public License as published by ;;;; the Free Software Foundation; either version 2 of the License, or ;;;; (at your option) any later version. -;;;; +;;;; ;;;; This program is distributed in the hope that it will be useful, ;;;; but WITHOUT ANY WARRANTY; without even the implied warranty of ;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;;;; GNU General Public License for more details. -;;;; +;;;; ;;;; You should have received a copy of the GNU General Public License ;;;; along with this program; if not, write to the Free Software -;;;; Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, +;;;; Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, ;;;; USA. -;;;; +;;;; ;;;; Author: Erick Gallesio [eg@essi.fr] ;;;; Creation date: 13-Aug-2003 11:57 (eg) ;;;; Last file update: 27-Oct-2004 16:35 (eg) @@ -29,9 +29,10 @@ (use-modules (skribilo debug) ; (skribilo engine) -; (skribilo writer) + (skribilo writer) ; (skribilo runtime) (skribilo types) + (skribilo lib) ;; `when', `unless' (oop goops)) @@ -61,16 +62,16 @@ ;;; CHECK-OPTIONS ;;; (define (check-options lopts markup engine) - + ;; Only keywords are checked, symbols are voluntary left unchecked. */ (with-debug 6 'check-options (debug-item "markup=" (markup-markup markup)) (debug-item "options=" (slot-ref markup 'options)) (debug-item "lopts=" lopts) (for-each - (lambda (o2) + (lambda (o2) (for-each - (lambda (o) + (lambda (o) (if (and (keyword? o) (not (eq? o :&skribe-eval-location)) (not (memq o lopts))) @@ -85,11 +86,11 @@ (markup-option markup o))))) o2)) (slot-ref markup 'options)))) - + ;;; ====================================================================== ;;; -;;; V E R I F Y +;;; V E R I F Y ;;; ;;; ====================================================================== @@ -124,7 +125,7 @@ (with-debug 5 'verify::<markup> (debug-item "node=" (markup-markup node)) (debug-item "options=" (slot-ref node 'options)) - (debug-item "e=" (engine-ident e)) + (debug-item "e=" (engine-ident e)) (next-method) @@ -157,5 +158,3 @@ (slot-ref e 'customs)) node) - - diff --git a/src/guile/skribilo/writer.scm b/src/guile/skribilo/writer.scm index 70ba817..eeefe8b 100644 --- a/src/guile/skribilo/writer.scm +++ b/src/guile/skribilo/writer.scm @@ -64,7 +64,7 @@ (define (lookup-markup-writer node e) (let ((writers (slot-ref e 'writers)) (delegate (slot-ref e 'delegate))) - (let Loop ((w* writers)) + (let loop ((w* writers)) (cond ((pair? w*) (let ((pred (slot-ref (car w*) 'pred))) |