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.
-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
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
-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.tools" require
- { "ui.backend.cocoa" } "ui.backend.cocoa.tools" require-when
+{ "ui.backend.cocoa" } "ui.backend.cocoa.tools" require-when
- "ui.tools.walker" require
-] when
+"ui.tools.walker" require
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." } ;
! 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+
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 [
[
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