aboutsummaryrefslogtreecommitdiff
path: root/src/guile/skribilo
diff options
context:
space:
mode:
authorLudovic Court`es2005-11-28 16:41:24 +0000
committerLudovic Court`es2005-11-28 16:41:24 +0000
commit4686c3d129e4ebb3edc97e53a20a5f9db682f993 (patch)
tree89d05c18ea5b9106b965b122a809ff2a0997878e /src/guile/skribilo
parent559d3f64f4b051a39c91a3d53d3b41deee8ae42f (diff)
downloadskribilo-4686c3d129e4ebb3edc97e53a20a5f9db682f993.tar.gz
skribilo-4686c3d129e4ebb3edc97e53a20a5f9db682f993.tar.lz
skribilo-4686c3d129e4ebb3edc97e53a20a5f9db682f993.zip
More `%skribilo-module-reader' fixes.
* src/guile/skribilo.scm: Removed the executable bit. * configure.ac: Produce `src/guile/skribilo/utils/Makefile'. * src/guile/skribilo.scm: Call `set-current-reader' after the `use-modules' clause. (process-option-specs): Use `:kw'-style keywords. (*skribilo-output-port*): New. (doskribe): Use the above fluid. (main): Honor the `-o' option. * src/guile/skribilo/debug.scm: Use `(skribilo utils syntax)' and `%skribilo-module-reader'. * src/guile/skribilo/module.scm: Likewise. * src/guile/skribilo/output.scm: Likewise. * src/guile/skribilo/resolve.scm: Likewise. * src/guile/skribilo/verify.scm: Likewise. * src/guile/skribilo/parameters.scm (make-expect): New. (define-number-parameter): New. (define-list-parameter): New. * src/guile/skribilo/utils/Makefile.am (guilemoduledir): Fixed. * src/guile/skribilo/evaluator.scm (%evaluate): Commented out debugging statement. git-archimport-id: lcourtes@laas.fr--2004-libre/skribilo--devel--1.2--patch-14
Diffstat (limited to 'src/guile/skribilo')
-rw-r--r--src/guile/skribilo/debug.scm27
-rw-r--r--src/guile/skribilo/evaluator.scm4
-rw-r--r--src/guile/skribilo/module.scm24
-rw-r--r--src/guile/skribilo/output.scm47
-rw-r--r--src/guile/skribilo/parameters.scm33
-rw-r--r--src/guile/skribilo/resolve.scm49
-rw-r--r--src/guile/skribilo/utils/Makefile.am2
-rw-r--r--src/guile/skribilo/verify.scm59
8 files changed, 139 insertions, 106 deletions
diff --git a/src/guile/skribilo/debug.scm b/src/guile/skribilo/debug.scm
index cc0dfb2..953997e 100644
--- a/src/guile/skribilo/debug.scm
+++ b/src/guile/skribilo/debug.scm
@@ -1,8 +1,8 @@
+;;; debug.scm -- Debug facilities.
;;;
-;;; debug.scm -- Debug Facilities (stolen to Manuel Serrano)
+;;; Copyright 2003-2004 Erick Gallesio - I3S-CNRS/ESSI <eg@unice.fr>
+;;; Copyright 2005 Ludovic Courtès <ludovic.courtes@laas.fr>
;;;
-;;;
-;;; 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
@@ -17,19 +17,20 @@
;;; along with this program; if not, write to the Free Software
;;; Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
;;; USA.
-;;;
-;;; Author: Erick Gallesio [eg@essi.fr]
-;;; Creation date: 10-Aug-2003 20:45 (eg)
-;;; Last file update: 28-Oct-2004 13:16 (eg)
-;;;
(define-module (skribilo debug)
- :export (with-debug %with-debug
- debug-item skribe-debug set-skribe-debug! add-skribe-debug-symbol
- no-debug-color)
- :use-module (srfi srfi-17))
+ :export (with-debug %with-debug
+ debug-item skribe-debug set-skribe-debug! add-skribe-debug-symbol
+ no-debug-color)
+ :use-module (skribilo utils syntax)
+ :use-module (srfi srfi-17))
+(set-current-reader %skribilo-module-reader)
+
+
+;;; FIXME: Use SRFI-39 fluids.
+;;; FIXME: Move this to `parameters.scm'?
(define *skribe-debug* 0)
(define *skribe-debug-symbols* '())
@@ -160,3 +161,5 @@
; (debug-item 'foo4.2))
; (debug-item 'foo3.3))
; (debug-item 'foo2.4))
+
+;;; debug.scm ends here
diff --git a/src/guile/skribilo/evaluator.scm b/src/guile/skribilo/evaluator.scm
index 4c28b24..73f7db0 100644
--- a/src/guile/skribilo/evaluator.scm
+++ b/src/guile/skribilo/evaluator.scm
@@ -59,8 +59,8 @@
(let ((file (source-property expr 'filename))
(line (source-property expr 'line))
(column (source-property expr 'column)))
- (format #t "~%~%*** source props for `~a': ~a~%~%"
- result (source-properties expr))
+; (format #t "~%* source props for `~a': ~a~%"
+; result (source-properties expr))
(slot-set! result 'loc
(make <location>
:file file :line line :pos column))))
diff --git a/src/guile/skribilo/module.scm b/src/guile/skribilo/module.scm
index 76d6717..2418a2c 100644
--- a/src/guile/skribilo/module.scm
+++ b/src/guile/skribilo/module.scm
@@ -23,7 +23,10 @@
:use-module (skribilo debug)
:use-module (system reader confinement) ;; `set-current-reader'
:use-module (srfi srfi-1)
- :use-module (ice-9 optargs))
+ :use-module (ice-9 optargs)
+ :use-module (skribilo utils syntax))
+
+(set-current-reader %skribilo-module-reader)
;;; Author: Ludovic Courtès
;;;
@@ -43,6 +46,7 @@
(srfi srfi-13) ;; strings
(ice-9 optargs) ;; `define*'
+ (skribilo utils syntax) ;; `unless', `when', etc.
(skribilo module)
(skribilo compat) ;; `skribe-load-path', etc.
(skribilo ast) ;; `<document>', `document?', etc.
@@ -73,14 +77,18 @@
'("utils" "api" "bib" "index" "param" "sui"))
+
+;; The very macro to turn a legacy Skribe file (which uses Skribe's syntax)
+;; into a Guile module.
+
(define-macro (define-skribe-module name . options)
`(begin
(define-module ,name
- #:use-module ((skribilo reader) #:select (%default-reader))
- #:use-module (system reader confinement)
- #:use-module (srfi srfi-1)
+ :use-module ((skribilo reader) :select (%default-reader))
+ :use-module (system reader confinement)
+ :use-module (srfi srfi-1)
,@(append-map (lambda (mod)
- (list #:autoload (car mod) (cdr mod)))
+ (list :autoload (car mod) (cdr mod)))
%skribilo-user-autoloads)
,@options)
@@ -99,9 +107,7 @@
;; Change the current reader to a Skribe-compatible reader. If this
;; primitive is not provided by Guile, it should be provided by the
;; `confinement' module (version 0.2 and later).
- (set-current-reader %default-reader)
- (format #t "module: ~a current-reader: ~a~%"
- (current-module) (current-reader))))
+ (set-current-reader %default-reader)))
;; Make it available to the top-level module.
@@ -160,7 +166,7 @@ execution of Skribilo/Skribe code."
(define-public (load-skribilo-file file reader-name)
(load-file-with-read file (make-reader reader-name) (current-module)))
-(define*-public (load-skribe-modules #:optional (debug? #f))
+(define*-public (load-skribe-modules :optional (debug? #f))
"Load the core Skribe modules, both in the @code{(skribilo skribe)}
hierarchy and in @code{(run-time-module)}."
(for-each (lambda (mod)
diff --git a/src/guile/skribilo/output.scm b/src/guile/skribilo/output.scm
index cbd4523..8110418 100644
--- a/src/guile/skribilo/output.scm
+++ b/src/guile/skribilo/output.scm
@@ -1,33 +1,38 @@
-;;;; output.scm -- Skribilo output 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,
-;;;; USA.
+;;; output.scm -- Skribilo output stage.
+;;;
+;;; Copyright 2003-2004 Erick Gallesio - I3S-CNRS/ESSI <eg@unice.fr>
+;;; Copyright 2005 Ludovic Courtès <ludovic.courtes@laas.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,
+;;; USA.
(define-module (skribilo output)
:export (output)
- :use-module (skribilo ast)
- :use-module (skribilo writer)
+ :autoload (skribilo engine) (engine-ident)
+ :autoload (skribilo writer) (writer? writer-ident lookup-markup-writer)
:use-module (skribilo lib)
+ :use-module (skribilo ast)
:use-module (skribilo debug)
+ :use-module (skribilo utils syntax)
:use-module (oop goops))
+(set-current-reader %skribilo-module-reader)
+
(define-generic out)
(define (%out/writer n e w)
diff --git a/src/guile/skribilo/parameters.scm b/src/guile/skribilo/parameters.scm
index d8b259f..baab5ba 100644
--- a/src/guile/skribilo/parameters.scm
+++ b/src/guile/skribilo/parameters.scm
@@ -35,18 +35,39 @@
;;; Switches.
;;;
-(define-public *verbose* (make-parameter #f))
-(define-public *warning* (make-parameter 5))
+(define (make-expect pred pred-name parameter)
+ (let ((msg (string-append parameter ": " pred-name " expected")))
+ (lambda (val)
+ (if (pred val)
+ val
+ (error msg val)))))
+
+(define-macro (define-number-parameter name)
+ `(define-public ,name
+ (make-parameter 0
+ (make-expect number? "number" ,(symbol->string name)))))
+
+(define-number-parameter *verbose*)
+(define-number-parameter *warning*)
+
(define-public *load-rc-file?* (make-parameter #f))
;;;
;;; Paths.
;;;
-(define-public *document-path* (make-parameter (list ".")))
-(define-public *bib-path* (make-parameter (list ".")))
-(define-public *source-path* (make-parameter (list ".")))
-(define-public *image-path* (make-parameter (list ".")))
+
+(define-macro (define-path-parameter name)
+ `(define-public ,name
+ (make-parameter (list ".")
+ (make-expect list? "list" ,(symbol->string name)))))
+
+
+(define-path-parameter *document-path*)
+(define-path-parameter *bib-path*)
+(define-path-parameter *source-path*)
+(define-path-parameter *image-path*)
+
;;;
;;; Files.
diff --git a/src/guile/skribilo/resolve.scm b/src/guile/skribilo/resolve.scm
index 7075f2d..cc1b14f 100644
--- a/src/guile/skribilo/resolve.scm
+++ b/src/guile/skribilo/resolve.scm
@@ -1,40 +1,37 @@
-;;;;
-;;;; 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,
-;;;; USA.
-;;;;
-;;;; Author: Erick Gallesio [eg@essi.fr]
-;;;; Creation date: 13-Aug-2003 18:39 (eg)
-;;;; Last file update: 17-Feb-2004 14:43 (eg)
-;;;;
+;;; resolve.scm -- Skribilo reference resolution.
+;;;
+;;; Copyright 2003-2004 Erick Gallesio - I3S-CNRS/ESSI <eg@unice.fr>
+;;; Copyright 2005 Ludovic Courtès <ludovic.courtes@laas.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,
+;;; USA.
(define-module (skribilo resolve)
:use-module (skribilo debug)
:use-module (skribilo runtime)
:use-module (skribilo ast)
- :use-module (skribilo lib) ;; `unless' and `when'
+ :use-module (skribilo utils syntax)
:use-module (oop goops)
:export (resolve! resolve-search-parent resolve-children resolve-children*
find1 resolve-counter resolve-parent resolve-ident))
+(set-current-reader %skribilo-module-reader)
+
(define *unresolved* #f)
(define-generic do-resolve!)
diff --git a/src/guile/skribilo/utils/Makefile.am b/src/guile/skribilo/utils/Makefile.am
index e87696a..810ee48 100644
--- a/src/guile/skribilo/utils/Makefile.am
+++ b/src/guile/skribilo/utils/Makefile.am
@@ -1,4 +1,4 @@
-guilemoduledir = $(GUILE_SITE)/skribilo
+guilemoduledir = $(GUILE_SITE)/skribilo/utils
dist_guilemodule_DATA = syntax.scm
## arch-tag: 3a18b64b-1da2-417b-8338-2c534bca277f
diff --git a/src/guile/skribilo/verify.scm b/src/guile/skribilo/verify.scm
index aa2dd78..f407c87 100644
--- a/src/guile/skribilo/verify.scm
+++ b/src/guile/skribilo/verify.scm
@@ -1,42 +1,41 @@
-;;;;
-;;;; 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,
-;;;; USA.
-;;;;
-;;;; Author: Erick Gallesio [eg@essi.fr]
-;;;; Creation date: 13-Aug-2003 11:57 (eg)
-;;;; Last file update: 27-Oct-2004 16:35 (eg)
-;;;;
+;;; verify.scm -- Skribe AST verification.
+;;;
+;;; Copyright 2003-2004 Erick Gallesio - I3S-CNRS/ESSI <eg@unice.fr>
+;;; Copyright 2005 Ludovic Courtès <ludovic.courtes@laas.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,
+;;; USA.
(define-module (skribilo verify)
- :export (verify))
+ :autoload (skribilo engine) (engine-ident)
+ :autoload (skribilo writer) (writer? writer-options lookup-markup-writer)
+ :autoload (skribilo lib) (skribe-warning/ast skribe-warning
+ skribe-error)
+ :export (verify))
(use-modules (skribilo debug)
- (skribilo engine)
- (skribilo writer)
(skribilo runtime)
(skribilo ast)
- (skribilo lib) ;; `when', `unless'
+ (skribilo utils syntax)
(oop goops))
+(set-current-reader %skribilo-module-reader)
+
(define-generic verify)
;;;
@@ -158,3 +157,5 @@
(slot-ref e 'customs))
node)
+
+;;; verify.scm ends here \ No newline at end of file