bootstrap.*: fix for #1512, load docs after everything else

By making it so the help component is loaded almost last, all vocabs are loaded without docs and only then are they loaded. It should make it so you don't get cyclic dependency problems in doc files during bootstrapping.
db4
Björn Lindqvist 2015-12-04 13:29:29 +01:00
parent fc9eb0d5ac
commit bf8fe25271
5 changed files with 55 additions and 58 deletions

View File

@ -1,22 +1,20 @@
USING: accessors assocs kernel namespaces sequences vocabs
vocabs.loader vocabs.loader.private ;
USING: accessors assocs namespaces sequences vocabs vocabs.loader
vocabs.loader.private ;
IN: bootstrap.help
: load-help ( -- )
"help" require
"help.topics" require
"help.syntax" require
"help.crossref" require
"help.definitions" require
"help.lint" require
"help.vocabs" require
{
"help"
"help.topics"
"help.syntax"
"help.crossref"
"help.definitions"
"help.lint"
"help.vocabs"
} [ require ] each
t load-help? set-global
[ dup lookup-vocab [ drop ] [ no-vocab ] if ] require-hook [
dictionary get values
[ docs-loaded?>> ] reject
[ load-docs ] each
] with-variable ;
dictionary get values [ docs-loaded?>> ] reject [ load-docs ] each ;
load-help

View File

@ -56,7 +56,7 @@ SYMBOL: bootstrap-time
error set-global ; inline
CONSTANT: default-components
"math compiler threads help io tools ui ui.tools unicode handbook"
"math compiler threads io tools ui ui.tools unicode help handbook"
[
! We time bootstrap

View File

@ -1,10 +1,8 @@
USING: kernel vocabs sequences system vocabs.loader ;
USING: vocabs vocabs.loader ;
IN: bootstrap.ui.tools
{ "ui" "help" "tools" }
[ "bootstrap." prepend lookup-vocab ] all? [
"ui.tools" require
{ "ui.backend.cocoa" } "ui.backend.cocoa.tools" require-when
"ui.tools.walker" require
] when

View File

@ -3,35 +3,6 @@ hashtables quotations words classes sequences namespaces make
arrays assocs ;
IN: ui.commands
: command-map-row ( gesture command -- seq )
[
[ gesture>string , ]
[
[ command-name , ]
[ command-word <$link> , ]
[ command-description , ]
tri
] bi*
] { } make ;
: command-map. ( alist -- )
[ command-map-row ] { } assoc>map
{ "Shortcut" "Command" "Word" "Notes" }
[ \ $strong swap ] { } map>assoc prefix
$table ;
: $command-map ( element -- )
[ second (command-name) " commands" append $heading ]
[
first2 swap get-command-at
[ blurb>> print-element ] [ commands>> command-map. ] bi
] bi ;
: $command ( element -- )
reverse first3 get-command-at
commands>> value-at gesture>string
$snippet ;
HELP: +nullary+
{ $description "A key which may be set in the hashtable passed to " { $link define-command } ". If set to a true value, the command does not take any inputs, and the value passed to " { $link invoke-command } " will be ignored. Otherwise, it takes one input." } ;

View File

@ -1,7 +1,8 @@
! Copyright (C) 2006, 2008 Slava Pestov.
! See http://factorcode.org/license.txt for BSD license.
USING: accessors assocs fry kernel make quotations sequences
splitting tr ui.gestures unicode.case unicode.categories words ;
USING: accessors assocs fry help.markup kernel make quotations
sequences splitting tr ui.gestures unicode.case unicode.categories
words ;
IN: ui.commands
SYMBOL: +nullary+
@ -28,9 +29,43 @@ GENERIC: command-word ( command -- word )
H{ } clone [ "commands" set-word-prop ] keep
] ?if ;
TR: convert-command-name "-" " " ;
: (command-name) ( string -- newstring )
convert-command-name >title ;
: get-command-at ( group class -- command-map )
commands at ;
: command-map-row ( gesture command -- seq )
[
[ gesture>string , ]
[
[ command-name , ]
[ command-word <$link> , ]
[ command-description , ]
tri
] bi*
] { } make ;
: command-map. ( alist -- )
[ command-map-row ] { } assoc>map
{ "Shortcut" "Command" "Word" "Notes" }
[ \ $strong swap ] { } map>assoc prefix
$table ;
: $command-map ( element -- )
[ second (command-name) " commands" append $heading ]
[
first2 swap get-command-at
[ blurb>> print-element ] [ commands>> command-map. ] bi
] bi ;
: $command ( element -- )
reverse first3 get-command-at
commands>> value-at gesture>string
$snippet ;
: command-gestures ( class -- hash )
commands values [
[
@ -48,11 +83,6 @@ GENERIC: command-word ( command -- word )
swap pick commands set-at
update-gestures ;
TR: convert-command-name "-" " " ;
: (command-name) ( string -- newstring )
convert-command-name >title ;
M: word command-name ( word -- str )
name>>
"com-" ?head drop "." ?tail drop