]> gitweb.factorcode.org Git - factor.git/commitdiff
run bootstrap and startup hooks inside a with-destructors. use &dispose instead...
authorDoug Coleman <doug.coleman@gmail.com>
Tue, 20 Oct 2009 22:26:10 +0000 (18:26 -0400)
committerDoug Coleman <doug.coleman@gmail.com>
Tue, 20 Oct 2009 22:26:10 +0000 (18:26 -0400)
basis/bootstrap/finish-bootstrap.factor
basis/bootstrap/finish-staging.factor
basis/bootstrap/stage2.factor
basis/io/sockets/unix/unix.factor
basis/random/unix/unix.factor
basis/windows/uniscribe/uniscribe.factor
core/bootstrap/stage1.factor

index 65115fc2df21a05e4d39738714a976c8042dca73..35b40df97a322e967807bbd8d9e4d5547a68f14f 100644 (file)
@@ -1,17 +1,19 @@
 USING: init command-line debugger system continuations
-namespaces eval kernel vocabs.loader io ;
+namespaces eval kernel vocabs.loader io destructors ;
 
 [
     boot
-    do-startup-hooks
     [
-        (command-line) parse-command-line
-        load-vocab-roots
-        run-user-init
-        "e" get [ eval( -- ) ] when*
-        ignore-cli-args? not script get and
-        [ run-script ] [ "run" get run ] if*
-        output-stream get [ stream-flush ] when*
-        0 exit
-    ] [ print-error 1 exit ] recover
+        do-startup-hooks
+        [
+            (command-line) parse-command-line
+            load-vocab-roots
+            run-user-init
+            "e" get [ eval( -- ) ] when*
+            ignore-cli-args? not script get and
+            [ run-script ] [ "run" get run ] if*
+            output-stream get [ stream-flush ] when*
+            0
+        ] [ print-error 1 ] recover
+     ] with-destructors exit
 ] set-boot-quot
index e75f0fa5c5e76893289b5c01185e3d1acac880d8..10d81d6ff6e9ec6f173a6193e82dd5551166aee2 100644 (file)
@@ -3,9 +3,10 @@ io ;
 
 [
     boot
-    do-startup-hooks
-    (command-line) parse-command-line
-    "run" get run
-    output-stream get [ stream-flush ] when*
-    0 exit
+    [
+        do-startup-hooks
+        (command-line) parse-command-line
+        "run" get run
+        output-stream get [ stream-flush ] when*
+    ] with-destructors 0 exit
 ] set-boot-quot
index 3cbe155dd2df7725442462db6ba257258975e49f..b8531abd90c10e7fd6234bf9ff3b73ecaa59dcf3 100644 (file)
@@ -56,6 +56,7 @@ SYMBOL: bootstrap-time
     error-continuation set-global
     error set-global ; inline
 
+
 [
     ! We time bootstrap
     millis
index 583fd8fba9735c7dd375a8de652cc5bb6eccac77..d2df4d9e13947a3bb86d3f93031e6d8ecbaf5c88 100755 (executable)
@@ -113,8 +113,7 @@ SYMBOL: receive-buffer
 
 CONSTANT: packet-size 65536
 
-[ packet-size malloc receive-buffer set-global ] "io.sockets.unix" add-startup-hook
-[ receive-buffer get-global free ] "io.sockets.unix" add-shutdown-hook
+[ packet-size malloc &free receive-buffer set-global ] "io.sockets.unix" add-startup-hook
 
 :: do-receive ( port -- packet sockaddr )
     port addr>> empty-sockaddr/size :> len :> sockaddr
index b15b9ab8b9dc0032b0d7210b0bcb01ada4758e4c..fd93d6492cc73336460f934ad9a9ca2202cf2823 100644 (file)
@@ -16,19 +16,12 @@ M: unix-random random-bytes* ( n tuple -- byte-array )
 
 os openbsd? [
     [
-        "/dev/srandom" <unix-random> secure-random-generator set-global
-        "/dev/arandom" <unix-random> system-random-generator set-global
+        "/dev/srandom" <unix-random> &dispose secure-random-generator set-global
+        "/dev/arandom" <unix-random> &dispose system-random-generator set-global
     ] "random.unix" add-startup-hook
 ] [
     [
-        "/dev/random" <unix-random> secure-random-generator set-global
-        "/dev/urandom" <unix-random> system-random-generator set-global
+        "/dev/random" <unix-random> &dispose secure-random-generator set-global
+        "/dev/urandom" <unix-random> &dispose system-random-generator set-global
     ] "random.unix" add-startup-hook
 ] if
-
-[
-    [
-        secure-random-generator get-global &dispose drop
-        system-random-generator get-global &dispose drop
-    ] with-destructors
-] "random.unix" add-shutdown-hook
index 1651e8b3d894e96b45d41c483cc39067e8b68982..87540dc24f7b050124f7829a32ab5b99342a9bd7 100755 (executable)
@@ -113,8 +113,5 @@ SYMBOL: cached-script-strings
 : cached-script-string ( font string -- script-string )
     cached-script-strings get-global [ <script-string> ] 2cache ;
 
-[ <cache-assoc> cached-script-strings set-global ]
+[ <cache-assoc> &dispose cached-script-strings set-global ]
 "windows.uniscribe" add-startup-hook
-
-[ cached-script-strings get-global dispose ]
-"windows.uniscribe" add-shutdown-hook
index 6dab0f416289568123df9b314a10525aa73b4a6e..1e8ebe2938cfa9c3c7c7329cca3ad1f1eb830e3e 100644 (file)
@@ -3,7 +3,7 @@
 USING: arrays assocs continuations debugger generic hashtables
 init io io.files kernel kernel.private make math memory
 namespaces parser prettyprint sequences splitting system
-vectors vocabs vocabs.loader words ;
+vectors vocabs vocabs.loader words destructors ;
 QUALIFIED: bootstrap.image.private
 IN: bootstrap.stage1
 
@@ -42,7 +42,7 @@ load-help? off
     [
         "resource:basis/bootstrap/stage2.factor"
         dup exists? [
-            run-file
+            [ run-file ] with-destructors
         ] [
             "Cannot find " write write "." print
             "Please move " write image write " to the same directory as the Factor sources," print