From bf8fe252711ad462637fcad066e23bdd058e6a65 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Lindqvist?= Date: Fri, 4 Dec 2015 13:29:29 +0100 Subject: [PATCH] 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. --- basis/bootstrap/help/help.factor | 26 +++++++-------- basis/bootstrap/stage2.factor | 2 +- basis/bootstrap/ui/tools/tools.factor | 12 +++---- basis/ui/commands/commands-docs.factor | 29 ----------------- basis/ui/commands/commands.factor | 44 ++++++++++++++++++++++---- 5 files changed, 55 insertions(+), 58 deletions(-) diff --git a/basis/bootstrap/help/help.factor b/basis/bootstrap/help/help.factor index 85e94d5a1e..71e64dc725 100644 --- a/basis/bootstrap/help/help.factor +++ b/basis/bootstrap/help/help.factor @@ -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 diff --git a/basis/bootstrap/stage2.factor b/basis/bootstrap/stage2.factor index 9f59bfb613..320d853f1b 100644 --- a/basis/bootstrap/stage2.factor +++ b/basis/bootstrap/stage2.factor @@ -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 diff --git a/basis/bootstrap/ui/tools/tools.factor b/basis/bootstrap/ui/tools/tools.factor index 2de9be377a..c5fd8f2e15 100644 --- a/basis/bootstrap/ui/tools/tools.factor +++ b/basis/bootstrap/ui/tools/tools.factor @@ -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.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 diff --git a/basis/ui/commands/commands-docs.factor b/basis/ui/commands/commands-docs.factor index 3e5c7f46ae..46562c8c6a 100644 --- a/basis/ui/commands/commands-docs.factor +++ b/basis/ui/commands/commands-docs.factor @@ -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." } ; diff --git a/basis/ui/commands/commands.factor b/basis/ui/commands/commands.factor index 8dc8555424..713a3b1204 100644 --- a/basis/ui/commands/commands.factor +++ b/basis/ui/commands/commands.factor @@ -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