summary refs log tree commit diff
path: root/legacy/bigloo/main.scm
diff options
context:
space:
mode:
authorLudovic Court`es2005-11-02 10:08:38 +0000
committerLudovic Court`es2005-11-02 10:08:38 +0000
commitb76d5e1b252967521f210eac10ddbf089dde8c6a (patch)
tree00fc81c51256991c04799d79a749bbdd5b9fad30 /legacy/bigloo/main.scm
parentba63b8d4780428d9f63f6ace7f49361b77401112 (diff)
parentf553cb65b157b6df9563cefa593902d59301461b (diff)
downloadskribilo-b76d5e1b252967521f210eac10ddbf089dde8c6a.tar.gz
skribilo-b76d5e1b252967521f210eac10ddbf089dde8c6a.tar.lz
skribilo-b76d5e1b252967521f210eac10ddbf089dde8c6a.zip
Cleaned up the source tree and the installation process.
Patches applied:

 * lcourtes@laas.fr--2005-mobile/skribilo--devel--1.2--patch-6
   Cosmetic changes.

 * lcourtes@laas.fr--2005-mobile/skribilo--devel--1.2--patch-7
   Removed useless files, integrated packages.

 * lcourtes@laas.fr--2005-mobile/skribilo--devel--1.2--patch-8
   Removed useless files, integrated packages.

 * lcourtes@laas.fr--2005-mobile/skribilo--devel--1.2--patch-9
   Moved the STkLos and Bigloo code to `legacy'.

 * lcourtes@laas.fr--2005-mobile/skribilo--devel--1.2--patch-10
   Installed Autoconf/Automake machinery.  Fixed a few things.

 * lcourtes@laas.fr--2005-mobile/skribilo--devel--1.2--patch-11
   Changes related to source-highlighting and to the manual.


git-archimport-id: lcourtes@laas.fr--2004-libre/skribilo--devel--1.2--patch-10
Diffstat (limited to 'legacy/bigloo/main.scm')
-rw-r--r--legacy/bigloo/main.scm96
1 files changed, 96 insertions, 0 deletions
diff --git a/legacy/bigloo/main.scm b/legacy/bigloo/main.scm
new file mode 100644
index 0000000..5b9e5e5
--- /dev/null
+++ b/legacy/bigloo/main.scm
@@ -0,0 +1,96 @@
+;*=====================================================================*/
+;*    serrano/prgm/project/skribe/src/bigloo/main.scm                  */
+;*    -------------------------------------------------------------    */
+;*    Author      :  Manuel Serrano                                    */
+;*    Creation    :  Tue Jul 22 16:51:49 2003                          */
+;*    Last change :  Wed May 18 15:45:27 2005 (serrano)                */
+;*    Copyright   :  2003-05 Manuel Serrano                            */
+;*    -------------------------------------------------------------    */
+;*    The Skribe main entry point                                      */
+;*=====================================================================*/
+
+;*---------------------------------------------------------------------*/
+;*    The module                                                       */
+;*---------------------------------------------------------------------*/
+(module skribe_main
+   
+   (include "debug.sch")
+   
+   (import  skribe_types
+	    skribe_parse-args
+	    skribe_param
+	    skribe_lib
+	    skribe_eval
+	    skribe_read
+	    skribe_engine
+	    skribe_evapi)
+   
+   (main    main))
+
+;*---------------------------------------------------------------------*/
+;*    main ...                                                         */
+;*---------------------------------------------------------------------*/
+(define (main args)
+   (with-debug 2 'main
+	       (debug-item "parse env variables...")
+	       (parse-env-variables)
+	       
+	       (debug-item "load rc file...")
+	       (load-rc)
+	       
+	       (debug-item "parse command line...")
+	       (parse-args args)
+	       
+	       (debug-item "load base...")
+	       (skribe-load "base.skr" :engine 'base)
+	       
+	       (debug-item "preload... (" *skribe-engine* ")")
+	       (for-each (lambda (f)
+			    (skribe-load f :engine *skribe-engine*))
+			 *skribe-preload*)
+	       
+	       ;; Load the specified variants
+	       (debug-item "variant... (" *skribe-variants* ")")
+	       (for-each (lambda (x)
+			    (skribe-load (format "~a.skr" x) :engine *skribe-engine*))
+			 (reverse! *skribe-variants*))
+	       
+	       (debug-item "body..." *skribe-engine*)
+	       (if (string? *skribe-dest*)
+		   (cond-expand
+		      (bigloo2.6
+		       (try (with-output-to-file *skribe-dest* doskribe)
+			    (lambda (e a b c)
+			       (delete-file *skribe-dest*)
+			       (let ((s (with-output-to-string
+					   (lambda () (write c)))))
+				  (notify-error a b s))
+			       (exit -1))))
+		      (else
+		       (with-exception-handler
+			  (lambda (e)
+			     (if (&warning? e)
+				 (raise e)
+				 (begin
+				    (delete-file *skribe-dest*)
+				    (if (&error? e)
+					(error-notify e)
+					(raise e))
+				    (exit 1))))
+			  (lambda ()
+			     (with-output-to-file *skribe-dest* doskribe)))))
+		   (doskribe))))
+
+;*---------------------------------------------------------------------*/
+;*    doskribe ...                                                     */
+;*---------------------------------------------------------------------*/
+(define (doskribe)
+   (let ((e (find-engine *skribe-engine*)))
+      (if (and (engine? e) (pair? *skribe-precustom*))
+	  (for-each (lambda (cv)
+		       (engine-custom-set! e (car cv) (cdr cv)))
+		    *skribe-precustom*))
+      (if (pair? *skribe-src*)
+	  (for-each (lambda (f) (skribe-load f :engine *skribe-engine*))
+		    *skribe-src*)
+	  (skribe-eval-port (current-input-port) *skribe-engine*))))