Add declare-shared-library for the C back end.
authorGuillermo J. Rozas <edu/mit/csail/zurich/gjr>
Sat, 13 Nov 1993 02:21:39 +0000 (02:21 +0000)
committerGuillermo J. Rozas <edu/mit/csail/zurich/gjr>
Sat, 13 Nov 1993 02:21:39 +0000 (02:21 +0000)
v7/src/runtime/option.scm
v7/src/runtime/runtime.pkg
v8/src/runtime/runtime.pkg

index 445d7b302b1b630261a363cb8737164cb55fac20..7faaf3354ae04c366a3e4df491b2512d1734e7fb 100644 (file)
@@ -1,6 +1,6 @@
 #| -*-Scheme-*-
 
-$Id: option.scm,v 14.25 1993/11/02 20:13:09 adams Exp $
+$Id: option.scm,v 14.26 1993/11/13 02:21:31 gjr Exp $
 
 Copyright (c) 1988-1993 Massachusetts Institute of Technology
 
@@ -36,27 +36,35 @@ MIT in each case. |#
 ;;; package: (runtime options)
 
 (declare (usual-integrations))
-
+\f
 (define (load-option name)
   (let ((entry (assq name options)))
     (if (not entry)
        (error "Unknown option name" name))
     (if (not (memq name loaded-options))
-       (let ((directory (library-directory-pathname "options")))
+       (let ((directory (delay (library-directory-pathname "options"))))
          (for-each
           (lambda (descriptor)
             (let ((environment
                    (package/environment (find-package (car descriptor)))))
-              (for-each (lambda (filename)
-                          (let ((path (merge-pathnames filename directory)))
-                            (with-working-directory-pathname
-                             (directory-pathname path)
-                             (lambda ()
-                               (load path
-                                     environment
-                                     syntax-table/system-internal
-                                     true)))))
-                        (cddr descriptor))
+              (for-each
+               (lambda (filename)
+                 (cond (((ucode-primitive initialize-c-compiled-block 1)
+                         (string-append "runtime_" filename))
+                        => (lambda (obj)
+                             (purify obj)
+                             (scode-eval obj environment)))
+                       (else
+                        (let ((path
+                               (merge-pathnames filename (force directory))))
+                          (with-working-directory-pathname
+                            (directory-pathname path)
+                            (lambda ()
+                              (load path
+                                    environment
+                                    syntax-table/system-internal
+                                    true)))))))
+               (cddr descriptor))
               (eval (cadr descriptor) environment)))
           (cdr entry))
          (set! loaded-options (cons name loaded-options))))
@@ -85,4 +93,17 @@ MIT in each case. |#
     (SUBPROCESS ((RUNTIME SUBPROCESS) (INITIALIZE-PACKAGE!) "process"))))
 
 (define loaded-options
-  '())
\ No newline at end of file
+  '())
+
+(define (declare-shared-library shared-library thunk)
+  (let ((thunk-valid?
+        (lambda (thunk)
+          (not (condition? (ignore-errors thunk))))))
+    (add-event-receiver!
+     event:after-restore
+     (lambda ()
+       (if (not (thunk-valid? thunk))
+          (fluid-let ((load/suppress-loading-message? true))
+            (load (merge-pathnames
+                   (library-directory-pathname "shared")
+                   shared-library))))))))
\ No newline at end of file
index 5b38444545236187a8ccec11573a4ca5b20f8279..542d0b1de8785d496bb2a0d63d153fa1690891b9 100644 (file)
@@ -1,6 +1,6 @@
 #| -*-Scheme-*-
 
-$Id: runtime.pkg,v 14.212 1993/11/03 03:31:17 adams Exp $
+$Id: runtime.pkg,v 14.213 1993/11/13 02:21:39 gjr Exp $
 
 Copyright (c) 1988-1993 Massachusetts Institute of Technology
 
@@ -1437,6 +1437,7 @@ MIT in each case. |#
   (files "option")
   (parent ())
   (export ()
+         declare-shared-library
          load-option))
 
 (define-package (runtime parser)
index 5b38444545236187a8ccec11573a4ca5b20f8279..542d0b1de8785d496bb2a0d63d153fa1690891b9 100644 (file)
@@ -1,6 +1,6 @@
 #| -*-Scheme-*-
 
-$Id: runtime.pkg,v 14.212 1993/11/03 03:31:17 adams Exp $
+$Id: runtime.pkg,v 14.213 1993/11/13 02:21:39 gjr Exp $
 
 Copyright (c) 1988-1993 Massachusetts Institute of Technology
 
@@ -1437,6 +1437,7 @@ MIT in each case. |#
   (files "option")
   (parent ())
   (export ()
+         declare-shared-library
          load-option))
 
 (define-package (runtime parser)