]> gitweb.factorcode.org Git - factor.git/blob - basis/fixups/fixups.factor
Temporary kludge can safely be removed
[factor.git] / basis / fixups / fixups.factor
1 ! Copyright (C) 2021 Doug Coleman.
2 ! See https://factorcode.org/license.txt for BSD license.
3 USING: accessors assocs classes.tuple continuations kernel sequences
4 slots.private vocabs vocabs.parser ;
5 IN: fixups
6
7 CONSTANT: vocab-renames {
8     { "math.intervals" { "intervals" "0.99" } }
9     { "math.ranges" { "ranges" "0.99" } }
10     { "sorting.slots" { "sorting.specification" "0.99" } }
11     { "json.reader" { "json" "0.99" } }
12     { "json.writer" { "json" "0.99" } }
13     { "math.trig" { "math.functions" "0.100" } }
14     { "math.functions.integer-logs" { "math.functions" "0.100" } }
15 }
16
17 CONSTANT: word-renames {
18     { "32bit?" { "layouts:32-bit?" "0.99" } }
19     { "64bit?" { "layouts:64-bit?" "0.99" } }
20     { "lines" { "io:read-lines" "0.99" } }
21     { "words" { "splitting:split-words" "0.99" } }
22     { "contents" { "io:read-contents" "0.99" } }
23     { "exists?" { "io.files:file-exists?" "0.99" } }
24     { "string-lines" { "splitting:split-lines" "0.99" } }
25     { "[-inf,a)" { "math.intervals:[-inf,b)" "0.99" } }
26     { "[-inf,a]" { "math.intervals:[-inf,b]" "0.99" } }
27     { "(a,b)" { "ranges:(a..b)" "0.99" } }
28     { "(a,b]" { "ranges:(a..b]" "0.99" } }
29     { "[a,b)" { "ranges:[a..b)" "0.99" } }
30     { "[a,b]" { "ranges:[a..b]" "0.99" } }
31     { "[0,b)" { "ranges:[0..b)" "0.99" } }
32     { "[0,b]" { "ranges:[0..b]" "0.99" } }
33     { "[1,b)" { "ranges:[1..b)" "0.99" } }
34     { "[1,b]" { "ranges:[1..b]" "0.99" } }
35     { "assoc-combine" { "assocs:assoc-union-all" "0.99" } }
36     { "assoc-refine" { "assocs:assoc-intersect-all" "0.99" } }
37     { "assoc-merge" { "assocs.extras:assoc-collect" "0.99" } }
38     { "assoc-merge!" { "assocs.extras:assoc-collect!" "0.99" } }
39     { "peek-from" { "modern.html:peek1-from" "0.99" } }
40     { "in?" { "interval-sets:interval-in?" "0.99" } }
41     { "substitute" { "regexp.classes:(substitute)" "0.99" } }
42     { "combine" { "sets:union-all" "0.99" } }
43     { "refine" { "sets:intersect-all" "0.99" } }
44     { "read-json-objects" { "json:read-json" "0.99" } }
45     { "init-namespaces" { "namespaces:init-namestack" "0.99" } }
46     { "iota" { "sequences:<iota>" ".98" } }
47     { "git-checkout-existing-branch" { "git-checkout-existing" "0.99" } }
48     { "git-checkout-existing-branch*" { "git-checkout-existing*" "0.99" } }
49     { "tags" { "chloe-tags" "0.99" } }
50     { "(each)" { "sequence-operator" "0.99" } }
51     { "(each-integer)" { "each-integer-from" "0.99" } }
52     { "(find-integer)" { "find-integer-from" "0.99" } }
53     { "(all-integers?)" { "all-integers-from?" "0.99" } }
54     { "short" { "index-or-length" "0.99" } }
55     { "map-integers" { "map-integers-as" "0.99" } }
56     { "deep-subseq?" { "deep-subseq-of?" "0.99" } }
57     { "overtomorrow" { "overmorrow" "0.99" } }
58     { "INITIALIZE:" { "INITIALIZED-SYMBOL:" "0.99" } }
59     { "natural-sort" { "sort" "0.99" } }
60     { "sort-by-with" { "sort-with-spec-by" "0.99" } }
61     { "sort-keys-by" { "sort-keys-with-spec" "0.99" } }
62     { "sort-values-by" { "sort-values-with-spec" "0.99" } }
63     { "compare-slots" { "compare-with-spec" "0.99" } }
64     { "natural-sort!" { "sort!" "0.99" } }
65     { "natural-bubble-sort!" { "bubble-sort!" "0.99" } }
66     { "random-integers" { "randoms" "0.99" } }
67     { "count*" { "percent-of" "0.99" } }
68     { "more?" { "deref?" "0.99" } }
69     { "plox" { "?call" "0.99" } }
70     { "ensure-non-negative" { "assert-non-negative" "0.99" } }
71     { "order" { "dispatch-order" "0.99" } }
72     { "TEST:" { "DEFINE-TEST-WORD:" "0.99" } }
73     { "assoc-all-key?" { "all-keys?" "0.100" } }
74     { "assoc-all-value?" { "all-values?" "0.100" } }
75     { "assoc-any-key?" { "any-key?" "0.100" } }
76     { "assoc-any-value?" { "any-value?" "0.100" } }
77     { "?download-to" { "download-once-into" "0.100" } }
78     { "download-to" { "download-into" "0.100" } }
79 }
80
81 : compute-assoc-fixups ( continuation name assoc -- seq )
82     swap '[ _ = ] filter-keys [
83         drop { }
84     ] [
85         swap '[
86             first2 dupd first2
87             " in Factor " glue " renamed to " glue "Fixup: " prepend
88             swap drop no-op-restart
89             _ <restart>
90         ] map
91     ] if-empty ;
92
93 GENERIC: compute-fixups ( continuation error -- seq )
94
95 M: object compute-fixups
96     "error" over ?offset-of-slot
97     [ slot compute-fixups ] [ 2drop { } ] if* ;
98
99 M: f compute-fixups 2drop { } ;
100
101 M: no-vocab compute-fixups
102     [ name>> vocab-renames compute-assoc-fixups ] [ drop { } ] if* ;
103
104 M: no-word-error compute-fixups
105     [ name>> word-renames compute-assoc-fixups ] [ drop { } ] if* ;