diff options
author | Ludovic Courtes | 2005-11-26 18:03:04 +0000 |
---|---|---|
committer | Ludovic Courtes | 2005-11-26 18:03:04 +0000 |
commit | 3d3ef9b5ad8687d6e5119cdcd7f86260a79fd697 (patch) | |
tree | 7230ec1c7cba2aed3a3a90bc28af1363dd2bbd48 /src/guile/skribilo.scm | |
parent | f39347c92006298976587cbcf3647395816f200c (diff) | |
parent | 38ef94ef3cd5417a907da6c8540d36734b4cde51 (diff) | |
download | skribilo-3d3ef9b5ad8687d6e5119cdcd7f86260a79fd697.tar.gz skribilo-3d3ef9b5ad8687d6e5119cdcd7f86260a79fd697.tar.lz skribilo-3d3ef9b5ad8687d6e5119cdcd7f86260a79fd697.zip |
Merge from lcourtes@laas.fr--2004-libre
Patches applied:
* lcourtes@laas.fr--2004-libre/skribilo--devel--1.2 (patch 6-11)
- Lots of changes...
- Started relying on the per-module reader; first doc produced ever!
- The first vaguely working version.
- Minor fixes for file/line error reporting.
- Cleaned up the source tree and the installation process.
- Overhaul: emphasized logical separation of the modules.
git-archimport-id: lcourtes@laas.fr--2005-mobile/skribilo--devel--1.2--patch-13
Diffstat (limited to 'src/guile/skribilo.scm')
-rwxr-xr-x | src/guile/skribilo.scm | 121 |
1 files changed, 60 insertions, 61 deletions
diff --git a/src/guile/skribilo.scm b/src/guile/skribilo.scm index 33c2bb4..c4a5eac 100755 --- a/src/guile/skribilo.scm +++ b/src/guile/skribilo.scm @@ -60,23 +60,21 @@ exec ${GUILE-guile} --debug -l $0 -c "(apply $main (cdr (command-line)))" "$@" -(define-module (skribilo)) +(define-module (skribilo) + :autoload (skribilo module) (make-run-time-module) + :autoload (skribilo engine) (*current-engine*)) -(use-modules (skribilo module) - (skribilo runtime) - (skribilo evaluator) - (skribilo types) - (skribilo engine) +(use-modules (skribilo evaluator) (skribilo debug) - (skribilo vars) + (skribilo parameters) (skribilo lib) + (srfi srfi-39) (ice-9 optargs) (ice-9 getopt-long)) -;;; FIXME: With my `#:reader' thing added to `define-module', @@ -351,7 +349,7 @@ Processes a Skribilo/Skribe source file and produces its output. (define (load-rc) (if *load-rc* - (let ((file (make-path *skribe-rc-directory* *skribe-rc-file*))) + (let ((file (make-path (*rc-directory*) (*rc-file*)))) (if (and file (file-exists? file)) (load file))))) @@ -373,8 +371,15 @@ Processes a Skribilo/Skribe source file and produces its output. ; (skribe-eval-port (current-input-port) *skribe-engine*)))) (define (doskribe) - (set-current-module (make-run-time-module)) - (skribe-eval-port (current-input-port) *skribe-engine*)) + (let ((user-module (current-module))) + (dynamic-wind + (lambda () + (set-current-module (make-run-time-module))) + (lambda () + (format #t "engine is ~a~%" (*current-engine*)) + (skribe-eval-port (current-input-port) (*current-engine*))) + (lambda () + (set-current-module user-module))))) ;;;; ====================================================================== @@ -407,8 +412,6 @@ Processes a Skribilo/Skribe source file and produces its output. ;; Parse the most important options. - (set! *skribe-engine* engine) - (set-skribe-debug! (string->number debugging-level)) (if (> (skribe-debug) 4) @@ -416,54 +419,50 @@ Processes a Skribilo/Skribe source file and produces its output. (lambda (file) (format #t "~~ loading `~a'...~%" file)))) - (set! %skribilo-load-path - (cons load-path %skribilo-load-path)) - (set! %skribilo-bib-path - (cons bib-path %skribilo-bib-path)) - - (if (option-ref options 'verbose #f) - (set! *skribe-verbose* #t)) - - ;; Load the user rc file - ;(load-rc) - - ;; Load the base file to bootstrap the system as well as the files - ;; that are in the PRELOAD variable. - (find-engine 'base) - (for-each (lambda (f) - (skribe-load f :engine *skribe-engine*)) - preload) - - ;; Load the specified variants. - (for-each (lambda (x) - (skribe-load (format #f "~a.skr" x) :engine *skribe-engine*)) - (reverse! variants)) - - (let ((files (option-ref options '() '()))) - - (if (> (length files) 2) - (error "you can specify at most one input file and one output file" - files)) - - (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))))) - - (set! *skribe-dest* dest-file) - - (if (and dest-file (file-exists? dest-file)) - (delete-file dest-file)) - - (if source-file - (with-input-from-file source-file - do-it!) - (do-it!)))))) + (parameterize ((*current-engine* engine) + (*document-path* (cons load-path (*document-path*))) + (*bib-path* (cons bib-path (*bib-path*))) + (*verbose* (option-ref options 'verbose #f))) + + ;; Load the user rc file + ;;(load-rc) + + (for-each (lambda (f) + (skribe-load f :engine (*current-engine*))) + preload) + + ;; Load the specified variants. + (for-each (lambda (x) + (skribe-load (format #f "~a.skr" x) + :engine (*current-engine*))) + (reverse! variants)) + + (let ((files (option-ref options '() '()))) + + (if (> (length files) 2) + (error "you can specify at most one input file and one output file" + files)) + + (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))))) + + (parameterize ((*destination-file* dest-file) + (*source-file* source-file)) + + (if (and dest-file (file-exists? dest-file)) + (delete-file dest-file)) + + ;; (start-stack 7 + (if source-file + (with-input-from-file source-file do-it!) + (do-it!)))))))) (define main skribilo) |