]> gitweb.factorcode.org Git - factor.git/commitdiff
Notify definition-observers when words are forgotten
authorSlava Pestov <slava@factorcode.org>
Wed, 9 Jan 2008 21:51:55 +0000 (17:51 -0400)
committerSlava Pestov <slava@factorcode.org>
Wed, 9 Jan 2008 21:51:55 +0000 (17:51 -0400)
13 files changed:
core/bootstrap/primitives.factor
core/bootstrap/stage2.factor
core/classes/mixin/mixin.factor
core/compiler/units/units.factor
core/cpu/x86/bootstrap.factor
core/debugger/debugger.factor
core/definitions/definitions.factor
core/generic/generic.factor
core/source-files/source-files.factor
core/vocabs/vocabs.factor
core/words/words.factor
extra/help/definitions/definitions.factor
extra/sudoku/deploy.factor [new file with mode: 0755]

index d5cedaf7b3dbc61d2fd1c8d1d34fc12447e3686a..c9329a2c9f0b23a803eefbffc8594a7d31b9f301 100755 (executable)
@@ -5,7 +5,7 @@ USING: alien arrays byte-arrays generic hashtables
 hashtables.private io kernel math namespaces parser sequences
 strings vectors words quotations assocs layouts classes tuples
 kernel.private vocabs vocabs.loader source-files definitions
-slots classes.union words.private ;
+slots classes.union words.private compiler.units ;
 
 ! Some very tricky code creating a bootstrap embryo in the
 ! host image.
index 468f9250cc56f1829fd423fe4a21c5fe185f09f4..2bcd4ce82fcf7baffd57d3a35d40c6bdb4bd5691 100755 (executable)
@@ -80,5 +80,5 @@ IN: bootstrap.stage2
         "output-image" get resource-path save-image-and-exit
     ] if
 ] [
-    error-hook get call "listener" vocab-main execute
+    error. :c "listener" vocab-main execute
 ] recover
index 847cce30bfe943b8e221607b53221ad96629e74c..f9b987eb782c8f5d2377cf0a109d6b46155f1bcf 100755 (executable)
@@ -68,7 +68,7 @@ M: mixin-instance definer drop \ INSTANCE: f ;
 
 M: mixin-instance definition drop f ;
 
-M: mixin-instance forget
+M: mixin-instance forget*
     dup mixin-instance-class
     swap mixin-instance-mixin dup mixin-class?
     [ remove-mixin-instance ] [ 2drop ] if ;
index 93994012e347a5cb841411efe9000e1c3d546297..af56f1796bc7f7a73e257dc4efd9f93b8f601aaa 100755 (executable)
@@ -56,16 +56,17 @@ GENERIC: definitions-changed ( assoc obj -- )
     definition-observers get
     [ definitions-changed ] curry* each ;
 
-: changed-vocabs ( -- assoc )
-    changed-words get
+: changed-vocabs ( assoc -- vocabs )
+    [ drop word? ] assoc-subset
     [ drop word-vocabulary dup [ vocab ] when dup ] assoc-map ;
 
 : changed-definitions ( -- assoc )
     H{ } clone
+    dup forgotten-definitions get update
     dup new-definitions get first update
     dup new-definitions get second update
     dup changed-words get update
-    dup changed-vocabs update ;
+    dup dup changed-vocabs update ;
 
 : finish-compilation-unit ( -- )
     changed-words get keys recompile-hook get call
@@ -74,6 +75,7 @@ GENERIC: definitions-changed ( assoc obj -- )
 : with-compilation-unit ( quot -- )
     [
         H{ } clone changed-words set
+        H{ } clone forgotten-definitions set
         <definitions> new-definitions set
         <definitions> old-definitions set
         [ finish-compilation-unit ]
index 7b609ab1c9ec27791689b049163cb82e6851cfd9..fd5a4703a8a8786451d258a0fa2c27c2a18c2ba9 100755 (executable)
@@ -2,7 +2,7 @@
 ! See http://factorcode.org/license.txt for BSD license.
 USING: bootstrap.image.private kernel namespaces system
 cpu.x86.assembler layouts compiler.units math generator.fixup
-compiler.constants ;
+compiler.constants vocabs ;
 IN: bootstrap.x86
 
 big-endian off
index 1d5185deb1ebbe131519b209833b4768251fda2a..77c6da38e960f0197f020c0e2b20b62e742d39db 100755 (executable)
@@ -230,5 +230,5 @@ M: undefined summary
 
 M: no-compilation-unit error.
     "Attempting to define " write
-    no-compilation-unit-word pprint
+    no-compilation-unit-definition pprint
     " outside of a compilation unit" print ;
index 6508d30216bd8d6decc294243fe9b1c52bef9df3..ad261df7d4a2216f5fe63c9227ce7098b66ed84f 100755 (executable)
@@ -3,15 +3,29 @@
 IN: definitions
 USING: kernel sequences namespaces assocs graphs ;
 
+TUPLE: no-compilation-unit definition ;
+
+: no-compilation-unit ( definition -- * )
+    \ no-compilation-unit construct-boa throw ;
+
 GENERIC: where ( defspec -- loc )
 
 M: object where drop f ;
 
 GENERIC: set-where ( loc defspec -- )
 
-GENERIC: forget ( defspec -- )
+GENERIC: forget* ( defspec -- )
+
+M: object forget* drop ;
+
+SYMBOL: forgotten-definitions
+
+: forgotten-definition ( defspec -- )
+    dup forgotten-definitions get
+    [ no-compilation-unit ] unless*
+    set-at ;
 
-M: object forget drop ;
+: forget ( defspec -- ) dup forgotten-definition forget* ;
 
 : forget-all ( definitions -- ) [ forget ] each ;
 
index d57c4500e2ae5b7033eb5a64b6582bd53b8139f8..7c56d43b724a70690e6425e3214c0701abd478ae 100755 (executable)
@@ -85,7 +85,7 @@ M: method-spec definer drop \ M: \ ; ;
 
 M: method-spec definition first2 method method-def ;
 
-M: method-spec forget first2 [ delete-at ] with-methods ;
+M: method-spec forget* first2 [ delete-at ] with-methods ;
 
 : implementors* ( classes -- words )
     all-words [
@@ -99,7 +99,7 @@ M: method-spec forget first2 [ delete-at ] with-methods ;
 : forget-methods ( class -- )
     [ implementors ] keep [ swap 2array ] curry map forget-all ;
 
-M: class forget ( class -- )
+M: class forget* ( class -- )
     dup forget-methods
     dup uncache-class
     forget-word ;
index 6f50502f549d9db94c267739575c9ee1d2d8fa7e..80538e2cf5661af3918b462201d76150bf6ccb40 100755 (executable)
@@ -73,7 +73,7 @@ uses definitions ;
 
 M: pathname where pathname-string 1 2array ;
 
-M: pathname forget
+M: pathname forget*
     pathname-string
     dup source-file
     dup unxref-source
index c47798e414d56f97e0e98da49da9e0c8ddf671c3..daa5658c07559293bccfb74eade0960c8d47fc49 100755 (executable)
@@ -105,4 +105,4 @@ UNION: vocab-spec vocab vocab-link ;
     dup vocab-words values forget-all
     vocab-name dictionary get delete-at ;
 
-M: vocab-spec forget forget-vocab ;
+M: vocab-spec forget* forget-vocab ;
index b36e5cba8107a0fc18e739d4317e978484da14ec..e05fc0009ae8488ca09e37d58a3e855863871cd4 100755 (executable)
@@ -92,11 +92,6 @@ M: word redefined* ( word -- )
 
 SYMBOL: changed-words
 
-TUPLE: no-compilation-unit word ;
-
-: no-compilation-unit ( word -- * )
-    \ no-compilation-unit construct-boa throw ;
-
 : changed-word ( word -- )
     dup changed-words get
     [ no-compilation-unit ] unless*
@@ -194,7 +189,7 @@ M: word (forget-word)
     dup delete-xref
     (forget-word) ;
 
-M: word forget forget-word ;
+M: word forget* forget-word ;
 
 M: word hashcode*
     nip 1 slot { fixnum } declare ;
index 559acf3919e28ec7ff7826275b74c0e7e93e0afc..4d942ae3a989aa434d380b7db9a949dffb21b9c5 100755 (executable)
@@ -12,7 +12,7 @@ M: link where link-name article article-loc ;
 
 M: link set-where link-name article set-article-loc ;
 
-M: link forget link-name remove-article ;
+M: link forget* link-name remove-article ;
 
 M: link definition article-content ;
 
@@ -34,4 +34,4 @@ M: word-link synopsis*
     link-name dup pprint-word
     stack-effect. ;
 
-M: word-link forget link-name remove-word-help ;
+M: word-link forget* link-name remove-word-help ;
diff --git a/extra/sudoku/deploy.factor b/extra/sudoku/deploy.factor
new file mode 100755 (executable)
index 0000000..de60bed
--- /dev/null
@@ -0,0 +1,13 @@
+USING: tools.deploy.config ;
+H{
+    { deploy-reflection 2 }
+    { deploy-word-props? f }
+    { deploy-compiler? t }
+    { deploy-math? f }
+    { deploy-c-types? f }
+    { deploy-io 2 }
+    { deploy-ui? f }
+    { deploy-name "Sudoku" }
+    { "stop-after-last-window?" t }
+    { deploy-word-defs? f }
+}