From e41a7bb6d626bf7d27cec95205403ba5af30c97f Mon Sep 17 00:00:00 2001 From: Doug Coleman Date: Thu, 19 Mar 2009 16:48:32 -0500 Subject: [PATCH 01/24] site-watcher works again --- extra/site-watcher/db/db.factor | 9 +++++++-- extra/site-watcher/site-watcher-tests.factor | 7 ------- extra/site-watcher/site-watcher.factor | 19 ++++++++++--------- 3 files changed, 17 insertions(+), 18 deletions(-) diff --git a/extra/site-watcher/db/db.factor b/extra/site-watcher/db/db.factor index 0c62c7f791..a1a85f825f 100644 --- a/extra/site-watcher/db/db.factor +++ b/extra/site-watcher/db/db.factor @@ -65,9 +65,9 @@ TUPLE: reporting-site email url up? changed? last-up? error last-error ; update-tuple ; : sites-to-report ( -- seq ) - "select account.email, site.url, site.up, site.changed, site.last_up, site.error, site.last_error from account, site, watching_site where account.account_name = watching_site.account_name and site.site_id = watching_site.site_id and site.changed = '1'" sql-query + "select users.email, site.url, site.up, site.changed, site.last_up, site.error, site.last_error from users, site, watching_site where users.username = watching_site.account_name and site.site_id = watching_site.site_id and site.changed = '1'" sql-query [ [ reporting-site boa ] input dup select-tuple [ ] [ dup t >>up? insert-tuple ] ?if ; @@ -90,3 +90,8 @@ PRIVATE> : watching-sites ( username -- sites ) f select-tuples [ site-id>> site new swap >>site-id select-tuple ] map ; + +: site-watcher-path ( -- path ) "site-watcher.db" temp-file ; inline + +: with-site-watcher-db ( quot -- ) + site-watcher-path swap with-db ; inline diff --git a/extra/site-watcher/site-watcher-tests.factor b/extra/site-watcher/site-watcher-tests.factor index 68a4a440f6..dde5e65e7e 100644 --- a/extra/site-watcher/site-watcher-tests.factor +++ b/extra/site-watcher/site-watcher-tests.factor @@ -5,13 +5,6 @@ site-watcher.private kernel db io.directories io.files.temp continuations db.sqlite site-watcher.db.private ; IN: site-watcher.tests -: site-watcher-path ( -- path ) "site-watcher.db" temp-file ; inline - -[ site-watcher-path delete-file ] ignore-errors - -: with-sqlite-db ( quot -- ) - site-watcher-path swap with-db ; inline - :: fake-sites ( -- seq ) [ account ensure-table diff --git a/extra/site-watcher/site-watcher.factor b/extra/site-watcher/site-watcher.factor index 29a66afb13..4808e7c7eb 100644 --- a/extra/site-watcher/site-watcher.factor +++ b/extra/site-watcher/site-watcher.factor @@ -1,9 +1,10 @@ ! Copyright (C) 2009 Doug Coleman. ! See http://factorcode.org/license.txt for BSD license. USING: accessors alarms arrays calendar combinators -combinators.smart continuations debugger http.client -init io.streams.string kernel locals math math.parser -namespaces sequences site-watcher.db site-watcher.db.private smtp ; +combinators.smart continuations debugger http.client fry +init io.streams.string kernel locals math math.parser db +namespaces sequences site-watcher.db site-watcher.db.private +smtp ; IN: site-watcher SYMBOL: site-watcher-from @@ -44,13 +45,13 @@ SYMBOL: running-site-watcher PRIVATE> -: watch-sites ( -- ) - find-sites check-sites sites-to-report send-reports ; +: watch-sites ( db -- ) + [ find-sites check-sites sites-to-report send-reports ] with-db ; -: run-site-watcher ( -- ) - running-site-watcher get [ - [ watch-sites ] site-watcher-frequency get every - running-site-watcher set-global +: run-site-watcher ( db -- ) + [ running-site-watcher get ] dip '[ + [ _ watch-sites ] site-watcher-frequency get every + running-site-watcher set ] unless ; : stop-site-watcher ( -- ) From ece2eabc39ad424823437fe718bfbb27808aed7d Mon Sep 17 00:00:00 2001 From: Doug Coleman Date: Thu, 19 Mar 2009 16:48:46 -0500 Subject: [PATCH 02/24] call init-db and run-site-watcher from webapps.site-watcher --- extra/webapps/site-watcher/site-watcher.factor | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/extra/webapps/site-watcher/site-watcher.factor b/extra/webapps/site-watcher/site-watcher.factor index af07ccebbb..e220cff1d4 100644 --- a/extra/webapps/site-watcher/site-watcher.factor +++ b/extra/webapps/site-watcher/site-watcher.factor @@ -122,10 +122,12 @@ CONSTANT: site-list-url URL" $site-watcher-app/" site-watcher-db main-responder set-global -: start-site-watcher ( -- ) - start-server ; - : init-db ( -- ) site-watcher-db [ { site account watching-site } [ ensure-table ] each - ] with-db ; \ No newline at end of file + ] with-db ; + +: start-site-watcher ( -- ) + init-db + site-watcher-db run-site-watcher + start-server ; From 54df6bee59a5ef9ba127564ef3cd85b397764cae Mon Sep 17 00:00:00 2001 From: Doug Coleman Date: Thu, 19 Mar 2009 17:05:08 -0500 Subject: [PATCH 03/24] ping every 5 minutes, not every 10 seconds --- extra/site-watcher/site-watcher.factor | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extra/site-watcher/site-watcher.factor b/extra/site-watcher/site-watcher.factor index 4808e7c7eb..114cdf3259 100644 --- a/extra/site-watcher/site-watcher.factor +++ b/extra/site-watcher/site-watcher.factor @@ -11,7 +11,7 @@ SYMBOL: site-watcher-from "factor-site-watcher@gmail.com" site-watcher-from set-global SYMBOL: site-watcher-frequency -10 seconds site-watcher-frequency set-global +5 minutes site-watcher-frequency set-global SYMBOL: running-site-watcher [ f running-site-watcher set-global ] "site-watcher" add-init-hook From 054a2e5b7c02eda05de4c67eeb1b169b06c15b44 Mon Sep 17 00:00:00 2001 From: Doug Coleman Date: Fri, 20 Mar 2009 20:40:39 -0500 Subject: [PATCH 04/24] add word to parse robots.txt visit-time --- basis/calendar/format/format.factor | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/basis/calendar/format/format.factor b/basis/calendar/format/format.factor index 916d3499fe..c2e95f2a9e 100644 --- a/basis/calendar/format/format.factor +++ b/basis/calendar/format/format.factor @@ -46,6 +46,11 @@ IN: calendar.format : read-0000 ( -- n ) 4 read string>number ; +: hhmm>timestamp ( hhmm -- timestamp ) + [ + 0 0 0 read-00 read-00 0 instant + ] with-string-reader ; + GENERIC: day. ( obj -- ) M: integer day. ( n -- ) From c626cab383a9f8db56a8de2caee4e0dfe222a47d Mon Sep 17 00:00:00 2001 From: Doug Coleman Date: Fri, 20 Mar 2009 21:56:48 -0500 Subject: [PATCH 05/24] a robots.txt parser --- extra/robots/authors.txt | 1 + extra/robots/robots-tests.factor | 334 +++++++++++++++++++++++++++++++ extra/robots/robots.factor | 68 +++++++ extra/robots/robots.txt | 279 ++++++++++++++++++++++++++ 4 files changed, 682 insertions(+) create mode 100644 extra/robots/authors.txt create mode 100644 extra/robots/robots-tests.factor create mode 100644 extra/robots/robots.factor create mode 100644 extra/robots/robots.txt diff --git a/extra/robots/authors.txt b/extra/robots/authors.txt new file mode 100644 index 0000000000..b4bd0e7b35 --- /dev/null +++ b/extra/robots/authors.txt @@ -0,0 +1 @@ +Doug Coleman \ No newline at end of file diff --git a/extra/robots/robots-tests.factor b/extra/robots/robots-tests.factor new file mode 100644 index 0000000000..a590d9eee0 --- /dev/null +++ b/extra/robots/robots-tests.factor @@ -0,0 +1,334 @@ +! Copyright (C) 2009 Doug Coleman. +! See http://factorcode.org/license.txt for BSD license. +USING: calendar io.encodings.utf8 io.files robots tools.test ; +IN: robots.tests + +[ +{ "http://www.chiplist.com/sitemap.txt" } +{ + T{ rules + { user-agents V{ "*" } } + { allows V{ } } + { disallows + V{ + "/cgi-bin/" + "/scripts/" + "/ChipList2/scripts/" + "/ChipList2/styles/" + "/ads/" + "/ChipList2/ads/" + "/advertisements/" + "/ChipList2/advertisements/" + "/graphics/" + "/ChipList2/graphics/" + } + } + { visit-time + { + T{ timestamp { hour 2 } } + T{ timestamp { hour 5 } } + } + } + { request-rate 1 } + { crawl-delay 1 } + { unknowns H{ } } + } + T{ rules + { user-agents V{ "UbiCrawler" } } + { allows V{ } } + { disallows V{ "/" } } + { unknowns H{ } } + } + T{ rules + { user-agents V{ "DOC" } } + { allows V{ } } + { disallows V{ "/" } } + { unknowns H{ } } + } + T{ rules + { user-agents V{ "Zao" } } + { allows V{ } } + { disallows V{ "/" } } + { unknowns H{ } } + } + T{ rules + { user-agents V{ "sitecheck.internetseer.com" } } + { allows V{ } } + { disallows V{ "/" } } + { unknowns H{ } } + } + T{ rules + { user-agents V{ "Zealbot" } } + { allows V{ } } + { disallows V{ "/" } } + { unknowns H{ } } + } + T{ rules + { user-agents V{ "MSIECrawler" } } + { allows V{ } } + { disallows V{ "/" } } + { unknowns H{ } } + } + T{ rules + { user-agents V{ "SiteSnagger" } } + { allows V{ } } + { disallows V{ "/" } } + { unknowns H{ } } + } + T{ rules + { user-agents V{ "WebStripper" } } + { allows V{ } } + { disallows V{ "/" } } + { unknowns H{ } } + } + T{ rules + { user-agents V{ "WebCopier" } } + { allows V{ } } + { disallows V{ "/" } } + { unknowns H{ } } + } + T{ rules + { user-agents V{ "Fetch" } } + { allows V{ } } + { disallows V{ "/" } } + { unknowns H{ } } + } + T{ rules + { user-agents V{ "Offline Explorer" } } + { allows V{ } } + { disallows V{ "/" } } + { unknowns H{ } } + } + T{ rules + { user-agents V{ "Teleport" } } + { allows V{ } } + { disallows V{ "/" } } + { unknowns H{ } } + } + T{ rules + { user-agents V{ "TeleportPro" } } + { allows V{ } } + { disallows V{ "/" } } + { unknowns H{ } } + } + T{ rules + { user-agents V{ "WebZIP" } } + { allows V{ } } + { disallows V{ "/" } } + { unknowns H{ } } + } + T{ rules + { user-agents V{ "linko" } } + { allows V{ } } + { disallows V{ "/" } } + { unknowns H{ } } + } + T{ rules + { user-agents V{ "HTTrack" } } + { allows V{ } } + { disallows V{ "/" } } + { unknowns H{ } } + } + T{ rules + { user-agents V{ "Microsoft.URL.Control" } } + { allows V{ } } + { disallows V{ "/" } } + { unknowns H{ } } + } + T{ rules + { user-agents V{ "Xenu" } } + { allows V{ } } + { disallows V{ "/" } } + { unknowns H{ } } + } + T{ rules + { user-agents V{ "larbin" } } + { allows V{ } } + { disallows V{ "/" } } + { unknowns H{ } } + } + T{ rules + { user-agents V{ "libwww" } } + { allows V{ } } + { disallows V{ "/" } } + { unknowns H{ } } + } + T{ rules + { user-agents V{ "ZyBORG" } } + { allows V{ } } + { disallows V{ "/" } } + { unknowns H{ } } + } + T{ rules + { user-agents V{ "Download Ninja" } } + { allows V{ } } + { disallows V{ "/" } } + { unknowns H{ } } + } + T{ rules + { user-agents V{ "wget" } } + { allows V{ } } + { disallows V{ "/" } } + { unknowns H{ } } + } + T{ rules + { user-agents V{ "grub-client" } } + { allows V{ } } + { disallows V{ "/" } } + { unknowns H{ } } + } + T{ rules + { user-agents V{ "k2spider" } } + { allows V{ } } + { disallows V{ "/" } } + { unknowns H{ } } + } + T{ rules + { user-agents V{ "NPBot" } } + { allows V{ } } + { disallows V{ "/" } } + { unknowns H{ } } + } + T{ rules + { user-agents V{ "WebReaper" } } + { allows V{ } } + { disallows V{ "/" } } + { unknowns H{ } } + } + T{ rules + { user-agents + V{ + "abot" + "ALeadSoftbot" + "BeijingCrawler" + "BilgiBot" + "bot" + "botlist" + "BOTW Spider" + "bumblebee" + "Bumblebee" + "BuzzRankingBot" + "Charlotte" + "Clushbot" + "Crawler" + "CydralSpider" + "DataFountains" + "DiamondBot" + "Dulance bot" + "DYNAMIC" + "EARTHCOM.info" + "EDI" + "envolk" + "Exabot" + "Exabot-Images" + "Exabot-Test" + "exactseek-pagereaper" + "Exalead NG" + "FANGCrawl" + "Feed::Find" + "flatlandbot" + "Gigabot" + "GigabotSiteSearch" + "GurujiBot" + "Hatena Antenna" + "Hatena Bookmark" + "Hatena RSS" + "HatenaScreenshot" + "Helix" + "HiddenMarket" + "HyperEstraier" + "iaskspider" + "IIITBOT" + "InfociousBot" + "iVia" + "iVia Page Fetcher" + "Jetbot" + "Kolinka Forum Search" + "KRetrieve" + "LetsCrawl.com" + "Lincoln State Web Browser" + "Links4US-Crawler" + "LOOQ" + "Lsearch/sondeur" + "MapoftheInternet.com" + "NationalDirectory" + "NetCarta_WebMapper" + "NewsGator" + "NextGenSearchBot" + "ng" + "nicebot" + "NP" + "NPBot" + "Nudelsalat" + "Nutch" + "OmniExplorer_Bot" + "OpenIntelligenceData" + "Oracle Enterprise Search" + "Pajaczek" + "panscient.com" + "PeerFactor 404 crawler" + "PeerFactor Crawler" + "PlantyNet" + "PlantyNet_WebRobot" + "plinki" + "PMAFind" + "Pogodak!" + "QuickFinder Crawler" + "Radiation Retriever" + "Reaper" + "RedCarpet" + "ScorpionBot" + "Scrubby" + "Scumbot" + "searchbot" + "Seeker.lookseek.com" + "SeznamBot" + "ShowXML" + "snap.com" + "snap.com beta crawler" + "Snapbot" + "SnapPreviewBot" + "sohu" + "SpankBot" + "Speedy Spider" + "Speedy_Spider" + "SpeedySpider" + "spider" + "SquigglebotBot" + "SurveyBot" + "SynapticSearch" + "T-H-U-N-D-E-R-S-T-O-N-E" + "Talkro Web-Shot" + "Tarantula" + "TerrawizBot" + "TheInformant" + "TMCrawler" + "TridentSpider" + "Tutorial Crawler" + "Twiceler" + "unwrapbot" + "URI::Fetch" + "VengaBot" + "Vonna.com b o t" + "Vortex" + "Votay bot" + "WebAlta Crawler" + "Webbot" + "Webclipping.com" + "WebCorp" + "Webinator" + "WIRE" + "WISEbot" + "Xerka WebBot" + "XSpider" + "YodaoBot" + "Yoono" + "yoono" + } + } + { allows V{ } } + { disallows V{ "/" } } + { unknowns H{ } } + } +} +] [ "vocab:robots/robots.txt" utf8 file-contents parse-robots.txt ] unit-test diff --git a/extra/robots/robots.factor b/extra/robots/robots.factor new file mode 100644 index 0000000000..1b2422f06e --- /dev/null +++ b/extra/robots/robots.factor @@ -0,0 +1,68 @@ +! Copyright (C) 2009 Doug Coleman. +! See http://factorcode.org/license.txt for BSD license. +USING: accessors http.client kernel unicode.categories +sequences urls splitting combinators splitting.monotonic +combinators.short-circuit assocs unicode.case arrays +math.parser calendar.format make ; +IN: robots + +! visit-time is GMT, request-rate is pages/second +! crawl-rate is seconds +TUPLE: rules user-agents allows disallows +visit-time request-rate crawl-delay unknowns ; + +robots.txt-url ( url -- url' ) + >url URL" robots.txt" derive-url ; + +: get-robots.txt ( url -- headers robots.txt ) + >robots.txt-url http-get ; + +: normalize-robots.txt ( string -- sitemaps seq ) + string-lines + [ [ blank? ] trim ] map + [ "#" head? not ] filter harvest + [ ":" split1 [ [ blank? ] trim ] bi@ [ >lower ] dip ] { } map>assoc + [ first "sitemap" = ] partition [ values ] dip + [ + { + [ [ first "user-agent" = ] bi@ and ] + [ nip first "user-agent" = not ] + } 2|| + ] monotonic-split ; + +: ( -- rules ) + rules new + V{ } clone >>user-agents + V{ } clone >>allows + V{ } clone >>disallows + H{ } clone >>unknowns ; + +: add-user-agent ( rules agent -- rules ) over user-agents>> push ; +: add-allow ( rules allow -- rules ) over allows>> push ; +: add-disallow ( rules disallow -- rules ) over disallows>> push ; + +: parse-robots.txt-line ( rules seq -- rules ) + first2 swap { + { "user-agent" [ add-user-agent ] } + { "allow" [ add-allow ] } + { "disallow" [ add-disallow ] } + { "crawl-delay" [ string>number >>crawl-delay ] } + { "request-rate" [ string>number >>request-rate ] } + { + "visit-time" [ "-" split1 [ hhmm>timestamp ] bi@ 2array + >>visit-time + ] } + [ pick unknowns>> push-at ] + } case ; + +PRIVATE> + +: parse-robots.txt ( string -- sitemaps rules-seq ) + normalize-robots.txt [ + [ dup ] dip [ parse-robots.txt-line drop ] with each + ] map ; + +: robots ( url -- sitemaps rules-seq ) + get-robots.txt nip parse-robots.txt ; diff --git a/extra/robots/robots.txt b/extra/robots/robots.txt new file mode 100644 index 0000000000..bbaaee69e1 --- /dev/null +++ b/extra/robots/robots.txt @@ -0,0 +1,279 @@ + + +# robots.txt + +Sitemap: http://www.chiplist.com/sitemap.txt + +User-Agent: * + +Disallow: /cgi-bin/ +Disallow: /scripts/ +Disallow: /ChipList2/scripts/ +#Disallow: /styles/ +Disallow: /ChipList2/styles/ + +Disallow: /ads/ +Disallow: /ChipList2/ads/ +Disallow: /advertisements/ +Disallow: /ChipList2/advertisements/ + +Disallow: /graphics/ +Disallow: /ChipList2/graphics/ + +#Disallow: /ChipList1/ + + +# robots.txt for http://www.wikipedia.org/ and friends +# +# Please note: There are a lot of pages on this site, and there are +# some misbehaved spiders out there that go _way_ too fast. If you're +# irresponsible, your access to the site may be blocked. + +# Inktomi's "Slurp" can read a minimum delay between hits; if your +# bot supports such a thing using the 'Crawl-delay' or another +# instruction, please let us know. + +# *at least* 1 second please. preferably more :D +#User-agent: * +Crawl-delay: 1 +Request-rate: 1/1 +Visit-time: 0200-0500 + +# Crawlers that are kind enough to obey, but which we'd rather not have +# unless they're feeding search engines. +User-agent: UbiCrawler +Disallow: / + +User-agent: DOC +Disallow: / + +User-agent: Zao +Disallow: / + +# Some bots are known to be trouble, particularly those designed to copy +# entire sites. Please obey robots.txt. +User-agent: sitecheck.internetseer.com +Disallow: / + +User-agent: Zealbot +Disallow: / + +User-agent: MSIECrawler +Disallow: / + +User-agent: SiteSnagger +Disallow: / + +User-agent: WebStripper +Disallow: / + +User-agent: WebCopier +Disallow: / + +User-agent: Fetch +Disallow: / + +User-agent: Offline Explorer +Disallow: / + +User-agent: Teleport +Disallow: / + +User-agent: TeleportPro +Disallow: / + +User-agent: WebZIP +Disallow: / + +User-agent: linko +Disallow: / + +User-agent: HTTrack +Disallow: / + +User-agent: Microsoft.URL.Control +Disallow: / + +User-agent: Xenu +Disallow: / + +User-agent: larbin +Disallow: / + +User-agent: libwww +Disallow: / + +User-agent: ZyBORG +Disallow: / + +User-agent: Download Ninja +Disallow: / + +# +# Sorry, wget in its recursive mode is a frequent problem. +# Please read the man page and use it properly; there is a +# --wait option you can use to set the delay between hits, +# for instance. +# +User-agent: wget +Disallow: / + +# +# The 'grub' distributed client has been *very* poorly behaved. +# +User-agent: grub-client +Disallow: / + +# +# Doesn't follow robots.txt anyway, but... +# +User-agent: k2spider +Disallow: / + +# +# Hits many times per second, not acceptable +# http://www.nameprotect.com/botinfo.html +User-agent: NPBot +Disallow: / + +# A capture bot, downloads gazillions of pages with no public benefit +# http://www.webreaper.net/ +User-agent: WebReaper +Disallow: / + + +# Provided courtesy of http://browsers.garykeith.com. +# Created on February 13, 2008 at 7:39:00 PM GMT. +# +# Place this file in the root public folder of your website. +# It will stop the following bots from indexing your website. +# +User-agent: abot +User-agent: ALeadSoftbot +User-agent: BeijingCrawler +User-agent: BilgiBot +User-agent: bot +User-agent: botlist +User-agent: BOTW Spider +User-agent: bumblebee +User-agent: Bumblebee +User-agent: BuzzRankingBot +User-agent: Charlotte +User-agent: Clushbot +User-agent: Crawler +User-agent: CydralSpider +User-agent: DataFountains +User-agent: DiamondBot +User-agent: Dulance bot +User-agent: DYNAMIC +User-agent: EARTHCOM.info +User-agent: EDI +User-agent: envolk +User-agent: Exabot +User-agent: Exabot-Images +User-agent: Exabot-Test +User-agent: exactseek-pagereaper +User-agent: Exalead NG +User-agent: FANGCrawl +User-agent: Feed::Find +User-agent: flatlandbot +User-agent: Gigabot +User-agent: GigabotSiteSearch +User-agent: GurujiBot +User-agent: Hatena Antenna +User-agent: Hatena Bookmark +User-agent: Hatena RSS +User-agent: HatenaScreenshot +User-agent: Helix +User-agent: HiddenMarket +User-agent: HyperEstraier +User-agent: iaskspider +User-agent: IIITBOT +User-agent: InfociousBot +User-agent: iVia +User-agent: iVia Page Fetcher +User-agent: Jetbot +User-agent: Kolinka Forum Search +User-agent: KRetrieve +User-agent: LetsCrawl.com +User-agent: Lincoln State Web Browser +User-agent: Links4US-Crawler +User-agent: LOOQ +User-agent: Lsearch/sondeur +User-agent: MapoftheInternet.com +User-agent: NationalDirectory +User-agent: NetCarta_WebMapper +User-agent: NewsGator +User-agent: NextGenSearchBot +User-agent: ng +User-agent: nicebot +User-agent: NP +User-agent: NPBot +User-agent: Nudelsalat +User-agent: Nutch +User-agent: OmniExplorer_Bot +User-agent: OpenIntelligenceData +User-agent: Oracle Enterprise Search +User-agent: Pajaczek +User-agent: panscient.com +User-agent: PeerFactor 404 crawler +User-agent: PeerFactor Crawler +User-agent: PlantyNet +User-agent: PlantyNet_WebRobot +User-agent: plinki +User-agent: PMAFind +User-agent: Pogodak! +User-agent: QuickFinder Crawler +User-agent: Radiation Retriever +User-agent: Reaper +User-agent: RedCarpet +User-agent: ScorpionBot +User-agent: Scrubby +User-agent: Scumbot +User-agent: searchbot +User-agent: Seeker.lookseek.com +User-agent: SeznamBot +User-agent: ShowXML +User-agent: snap.com +User-agent: snap.com beta crawler +User-agent: Snapbot +User-agent: SnapPreviewBot +User-agent: sohu +User-agent: SpankBot +User-agent: Speedy Spider +User-agent: Speedy_Spider +User-agent: SpeedySpider +User-agent: spider +User-agent: SquigglebotBot +User-agent: SurveyBot +User-agent: SynapticSearch +User-agent: T-H-U-N-D-E-R-S-T-O-N-E +User-agent: Talkro Web-Shot +User-agent: Tarantula +User-agent: TerrawizBot +User-agent: TheInformant +User-agent: TMCrawler +User-agent: TridentSpider +User-agent: Tutorial Crawler +User-agent: Twiceler +User-agent: unwrapbot +User-agent: URI::Fetch +User-agent: VengaBot +User-agent: Vonna.com b o t +User-agent: Vortex +User-agent: Votay bot +User-agent: WebAlta Crawler +User-agent: Webbot +User-agent: Webclipping.com +User-agent: WebCorp +User-agent: Webinator +User-agent: WIRE +User-agent: WISEbot +User-agent: Xerka WebBot +User-agent: XSpider +User-agent: YodaoBot +User-agent: Yoono +User-agent: yoono +Disallow: / + + From 55bb5f0cd4e2183e0a9d60a1e50864d243cd867a Mon Sep 17 00:00:00 2001 From: Doug Coleman Date: Fri, 20 Mar 2009 22:40:46 -0500 Subject: [PATCH 06/24] fix typo in example --- extra/spider/spider-docs.factor | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extra/spider/spider-docs.factor b/extra/spider/spider-docs.factor index 41dd13e918..cdbd5e7e09 100644 --- a/extra/spider/spider-docs.factor +++ b/extra/spider/spider-docs.factor @@ -23,7 +23,7 @@ HELP: slurp-heap-while ARTICLE: "spider-tutorial" "Spider tutorial" "To create a new spider, call the " { $link } " word with a link to the site you wish to spider." -{ $code <" "http://concatentative.org" "> } +{ $code <" "http://concatenative.org" "> } "The max-depth is initialized to 0, which retrieves just the initial page. Let's initialize it to something more fun:" { $code <" 1 >>max-depth "> } "Now the spider will retrieve the first page and all the pages it links to in the same domain." $nl From ccdef3594986d4ea888eb2b61c6e8e6620b14f33 Mon Sep 17 00:00:00 2001 From: Doug Coleman Date: Sun, 22 Mar 2009 19:25:55 -0500 Subject: [PATCH 07/24] inline everything so stuff compiles --- extra/html/parser/analyzer/analyzer.factor | 4 ++-- extra/html/parser/parser.factor | 2 +- extra/html/parser/state/state.factor | 18 +++++++++--------- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/extra/html/parser/analyzer/analyzer.factor b/extra/html/parser/analyzer/analyzer.factor index abe830c3fa..b344ce160f 100755 --- a/extra/html/parser/analyzer/analyzer.factor +++ b/extra/html/parser/analyzer/analyzer.factor @@ -46,7 +46,7 @@ TUPLE: link attributes clickable ; : find-between-all ( vector quot -- seq ) dupd '[ _ [ closing?>> not ] bi and ] find-all - [ first2 find-between* ] with map ; + [ first2 find-between* ] with map ; inline : remove-blank-text ( vector -- vector' ) [ @@ -113,7 +113,7 @@ TUPLE: link attributes clickable ; [ clickable>> [ bl bl text>> print ] each nl ] bi ; : find-by-text ( seq quot -- tag ) - [ dup name>> text = ] prepose find drop ; + [ dup name>> text = ] prepose find drop ; inline : find-opening-tags-by-name ( name seq -- seq ) [ [ name>> = ] [ closing?>> not ] bi and ] with find-all ; diff --git a/extra/html/parser/parser.factor b/extra/html/parser/parser.factor index c445b708c5..60e5ddbf54 100644 --- a/extra/html/parser/parser.factor +++ b/extra/html/parser/parser.factor @@ -137,7 +137,7 @@ SYMBOL: tagstack ] when ; : tag-parse ( quot -- vector ) - V{ } clone tagstack [ string-parse ] with-variable ; + V{ } clone tagstack [ string-parse ] with-variable ; inline : parse-html ( string -- vector ) [ (parse-html) tagstack get ] tag-parse ; diff --git a/extra/html/parser/state/state.factor b/extra/html/parser/state/state.factor index cda601866e..1b3f188a78 100644 --- a/extra/html/parser/state/state.factor +++ b/extra/html/parser/state/state.factor @@ -5,22 +5,22 @@ IN: html.parser.state TUPLE: state string i ; -: get-i ( -- i ) state get i>> ; +: get-i ( -- i ) state get i>> ; inline : get-char ( -- char ) - state get [ i>> ] [ string>> ] bi ?nth ; + state get [ i>> ] [ string>> ] bi ?nth ; inline : get-next ( -- char ) - state get [ i>> 1+ ] [ string>> ] bi ?nth ; + state get [ i>> 1+ ] [ string>> ] bi ?nth ; inline : next ( -- ) - state get [ 1+ ] change-i drop ; + state get [ 1+ ] change-i drop ; inline : string-parse ( string quot -- ) - [ 0 state boa state ] dip with-variable ; + [ 0 state boa state ] dip with-variable ; inline : short* ( n seq -- n' seq ) - over [ nip dup length swap ] unless ; + over [ nip dup length swap ] unless ; inline : skip-until ( quot: ( -- ? ) -- ) get-char [ @@ -30,12 +30,12 @@ TUPLE: state string i ; : take-until ( quot: ( -- ? ) -- ) get-i [ skip-until ] dip get-i - state get string>> subseq ; + state get string>> subseq ; inline : string-matches? ( string circular -- ? ) - get-char over push-growing-circular sequence= ; + get-char over push-growing-circular sequence= ; inline : take-string ( match -- string ) dup length [ 2dup string-matches? ] take-until nip - dup length rot length 1- - head next ; + dup length rot length 1- - head next ; inline From b3080178c6d07718c24f1a03c85c5d8f48d67023 Mon Sep 17 00:00:00 2001 From: Philipp Winkler Date: Mon, 23 Mar 2009 12:39:03 -0700 Subject: [PATCH 08/24] Add a missing step to the tutorial. --- basis/help/tutorial/tutorial.factor | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/basis/help/tutorial/tutorial.factor b/basis/help/tutorial/tutorial.factor index 7ec155881b..26812947c0 100644 --- a/basis/help/tutorial/tutorial.factor +++ b/basis/help/tutorial/tutorial.factor @@ -62,7 +62,9 @@ ARTICLE: "first-program-test" "Testing your first program" "" ": palindrome? ( str -- ? ) dup reverse = ;" } -"We will now test our new word in the listener. First, push a string on the stack:" +"We will now test our new word in the listener. First we have add the palindrome vocabulary to the listener's vocabulary search path:" +{ $code "USE: palindrome"} +"Next, push a string on the stack:" { $code "\"hello\"" } "Note that the stack display in the listener now shows this string. Having supplied the input, we call our word:" { $code "palindrome?" } @@ -132,6 +134,8 @@ $nl $nl "We modify " { $snippet "palindrome?" } " to first apply " { $snippet "normalize" } " to its input:" { $code ": palindrome? ( str -- ? ) normalize dup reverse = ;" } +"Factor compiles the file from the top down. So, be sure to place the definition for " { $snippet "normalize" } " above the definition for " { $snippet "palindrome?" } "." +$nl "Now if you press " { $command tool "common" refresh-all } ", the source file should reload without any errors. You can run unit tests again, and this time, they will all pass:" { $code "\"palindrome\" test" } ; From 8385e9d9f5668c92ac210f0d306919818ce0ad81 Mon Sep 17 00:00:00 2001 From: Slava Pestov Date: Mon, 23 Mar 2009 17:12:41 -0500 Subject: [PATCH 09/24] Fixing compile errors, test failures and help lint failures --- basis/grouping/grouping-docs.factor | 3 +-- basis/help/cookbook/cookbook.factor | 17 +++++++---------- basis/lists/lazy/lazy-docs.factor | 2 +- basis/lists/lazy/lazy.factor | 2 +- basis/math/bitwise/bitwise-docs.factor | 4 ++-- basis/memoize/memoize-docs.factor | 6 +++--- {extra => basis}/promises/authors.txt | 0 {extra => basis}/promises/promises-docs.factor | 0 {extra => basis}/promises/promises-tests.factor | 0 {extra => basis}/promises/promises.factor | 0 {extra => basis}/promises/summary.txt | 0 {extra => basis}/promises/tags.txt | 0 basis/refs/refs-docs.factor | 4 ++-- basis/refs/refs.factor | 4 ++-- basis/see/see-docs.factor | 2 +- basis/stack-checker/stack-checker-docs.factor | 4 ++-- basis/stack-checker/stack-checker-tests.factor | 2 +- basis/ui/commands/commands-docs.factor | 2 +- core/math/math-docs.factor | 2 +- core/memory/memory-tests.factor | 4 ++-- core/strings/strings-docs.factor | 6 +++--- core/strings/strings.factor | 2 +- core/syntax/syntax-docs.factor | 2 +- core/words/words-docs.factor | 6 +++--- extra/24-game/24-game.factor | 2 +- extra/animations/animations-docs.factor | 2 +- extra/animations/animations.factor | 2 +- extra/ctags/ctags-docs.factor | 2 +- extra/ctags/ctags.factor | 2 +- extra/literals/literals-docs.factor | 6 +++--- extra/multi-methods/multi-methods.factor | 13 ++++++------- extra/newfx/newfx.factor | 8 ++++---- extra/sequences/n-based/n-based-docs.factor | 4 ++-- 33 files changed, 55 insertions(+), 60 deletions(-) rename {extra => basis}/promises/authors.txt (100%) rename {extra => basis}/promises/promises-docs.factor (100%) rename {extra => basis}/promises/promises-tests.factor (100%) rename {extra => basis}/promises/promises.factor (100%) rename {extra => basis}/promises/summary.txt (100%) rename {extra => basis}/promises/tags.txt (100%) diff --git a/basis/grouping/grouping-docs.factor b/basis/grouping/grouping-docs.factor index e4ad97abd0..50ffa65474 100644 --- a/basis/grouping/grouping-docs.factor +++ b/basis/grouping/grouping-docs.factor @@ -97,8 +97,7 @@ HELP: { $example "USING: grouping sequences math prettyprint kernel ;" "IN: scratchpad" - ": share-price" - " { 13/50 51/100 13/50 1/10 4/5 17/20 33/50 3/25 19/100 3/100 } ;" + "CONSTANT: share-price { 13/50 51/100 13/50 1/10 4/5 17/20 33/50 3/25 19/100 3/100 }" "" "share-price 4 [ [ sum ] [ length ] bi / ] map ." "{ 113/400 167/400 201/400 241/400 243/400 91/200 1/4 }" diff --git a/basis/help/cookbook/cookbook.factor b/basis/help/cookbook/cookbook.factor index d6693cd94f..2cc19f87dd 100644 --- a/basis/help/cookbook/cookbook.factor +++ b/basis/help/cookbook/cookbook.factor @@ -121,16 +121,16 @@ $nl "sequences" } ; -ARTICLE: "cookbook-variables" "Variables cookbook" -"Before using a variable, you must define a symbol for it:" -{ $code "SYMBOL: name" } +ARTICLE: "cookbook-variables" "Dynamic variables cookbook" "A symbol is a word which pushes itself on the stack when executed. Try it:" { $example "SYMBOL: foo" "foo ." "foo" } +"Before using a variable, you must define a symbol for it:" +{ $code "SYMBOL: name" } "Symbols can be passed to the " { $link get } " and " { $link set } " words to read and write variable values:" -{ $example "\"Slava\" name set" "name get print" "Slava" } +{ $unchecked-example "\"Slava\" name set" "name get print" "Slava" } "If you set variables inside a " { $link with-scope } ", their values will be lost after leaving the scope:" -{ $example - ": print-name name get print ;" +{ $unchecked-example + ": print-name ( -- ) name get print ;" "\"Slava\" name set" "[" " \"Diana\" name set" @@ -139,11 +139,8 @@ ARTICLE: "cookbook-variables" "Variables cookbook" "\"Here, the name is \" write print-name" "There, the name is Diana\nHere, the name is Slava" } -{ $curious - "Variables are dynamically-scoped in Factor." -} { $references - "There is a lot more to be said about variables and namespaces." + "There is a lot more to be said about dynamically-scoped variables and namespaces." "namespaces" } ; diff --git a/basis/lists/lazy/lazy-docs.factor b/basis/lists/lazy/lazy-docs.factor index 08fe3bbcba..c46d3251a9 100644 --- a/basis/lists/lazy/lazy-docs.factor +++ b/basis/lists/lazy/lazy-docs.factor @@ -108,7 +108,7 @@ HELP: lappend { $description "Perform a similar functionality to that of the " { $link append } " word, but in a lazy manner. No evaluation of the list elements occurs initially but a " { $link } " object is returned which conforms to the list protocol. Calling " { $link car } ", " { $link cdr } " or " { $link nil? } " on this will evaluate elements as required. Successive calls to " { $link cdr } " will iterate through list1, followed by list2." } ; HELP: lfrom-by -{ $values { "n" "an integer" } { "quot" { $quotation "( -- int )" } } { "list" "a lazy list of integers" } } +{ $values { "n" "an integer" } { "quot" { $quotation "( -- int )" } } { "lazy-from-by" "a lazy list of integers" } } { $description "Return an infinite lazy list of values starting from n, with each successive value being the result of applying quot to n." } ; HELP: lfrom diff --git a/basis/lists/lazy/lazy.factor b/basis/lists/lazy/lazy.factor index 139f6726e8..64a3f099a0 100644 --- a/basis/lists/lazy/lazy.factor +++ b/basis/lists/lazy/lazy.factor @@ -203,7 +203,7 @@ M: lazy-append nil? ( lazy-append -- bool ) TUPLE: lazy-from-by n quot ; -C: lfrom-by lazy-from-by ( n quot -- list ) +C: lfrom-by lazy-from-by : lfrom ( n -- list ) [ 1+ ] lfrom-by ; diff --git a/basis/math/bitwise/bitwise-docs.factor b/basis/math/bitwise/bitwise-docs.factor index 358c984276..fca06526e0 100644 --- a/basis/math/bitwise/bitwise-docs.factor +++ b/basis/math/bitwise/bitwise-docs.factor @@ -139,8 +139,8 @@ HELP: flags { $examples { $example "USING: math.bitwise kernel prettyprint ;" "IN: scratchpad" - ": MY-CONSTANT HEX: 1 ; inline" - "{ HEX: 20 MY-CONSTANT BIN: 100 } flags .h" + "CONSTANT: x HEX: 1" + "{ HEX: 20 x BIN: 100 } flags .h" "25" } } ; diff --git a/basis/memoize/memoize-docs.factor b/basis/memoize/memoize-docs.factor index a6f78970c8..cfb5cffb37 100644 --- a/basis/memoize/memoize-docs.factor +++ b/basis/memoize/memoize-docs.factor @@ -1,10 +1,10 @@ -! Copyright (C) 2007 Slava Pestov, Daniel Ehrenberg. +! Copyright (C) 2007, 2009 Slava Pestov, Daniel Ehrenberg. ! See http://factorcode.org/license.txt for BSD license. -USING: help.syntax help.markup ; +USING: help.syntax help.markup words quotations effects ; IN: memoize HELP: define-memoized -{ $values { "word" "the word to be defined" } { "quot" "a quotation" } } +{ $values { "word" word } { "quot" quotation } { "effect" effect } } { $description "defines the given word at runtime as one which memoizes its output given a particular input" } { $notes "A maximum of four input and four output arguments can be used" } { $see-also POSTPONE: MEMO: } ; diff --git a/extra/promises/authors.txt b/basis/promises/authors.txt similarity index 100% rename from extra/promises/authors.txt rename to basis/promises/authors.txt diff --git a/extra/promises/promises-docs.factor b/basis/promises/promises-docs.factor similarity index 100% rename from extra/promises/promises-docs.factor rename to basis/promises/promises-docs.factor diff --git a/extra/promises/promises-tests.factor b/basis/promises/promises-tests.factor similarity index 100% rename from extra/promises/promises-tests.factor rename to basis/promises/promises-tests.factor diff --git a/extra/promises/promises.factor b/basis/promises/promises.factor similarity index 100% rename from extra/promises/promises.factor rename to basis/promises/promises.factor diff --git a/extra/promises/summary.txt b/basis/promises/summary.txt similarity index 100% rename from extra/promises/summary.txt rename to basis/promises/summary.txt diff --git a/extra/promises/tags.txt b/basis/promises/tags.txt similarity index 100% rename from extra/promises/tags.txt rename to basis/promises/tags.txt diff --git a/basis/refs/refs-docs.factor b/basis/refs/refs-docs.factor index b6f222cce9..a219f0ba8b 100644 --- a/basis/refs/refs-docs.factor +++ b/basis/refs/refs-docs.factor @@ -37,14 +37,14 @@ HELP: key-ref { $class-description "Instances of this class identify a key in an associative structure. New key references are created by calling " { $link } "." } ; HELP: -{ $values { "key" object } { "assoc" "an assoc" } { "ref" key-ref } } +{ $values { "assoc" "an assoc" } { "key" object } { "key-ref" key-ref } } { $description "Creates a reference to a key stored in an assoc." } ; HELP: value-ref { $class-description "Instances of this class identify a value associated to a key in an associative structure. New value references are created by calling " { $link } "." } ; HELP: -{ $values { "key" object } { "assoc" "an assoc" } { "ref" value-ref } } +{ $values { "assoc" "an assoc" } { "key" object } { "value-ref" value-ref } } { $description "Creates a reference to the value associated with " { $snippet "key" } " in " { $snippet "assoc" } "." } ; { get-ref set-ref delete-ref } related-words diff --git a/basis/refs/refs.factor b/basis/refs/refs.factor index 5f21dad776..0164a1ea57 100644 --- a/basis/refs/refs.factor +++ b/basis/refs/refs.factor @@ -12,11 +12,11 @@ GENERIC: get-ref ( ref -- obj ) GENERIC: set-ref ( obj ref -- ) TUPLE: key-ref < ref ; -C: key-ref ( assoc key -- ref ) +C: key-ref M: key-ref get-ref key>> ; M: key-ref set-ref >ref< rename-at ; TUPLE: value-ref < ref ; -C: value-ref ( assoc key -- ref ) +C: value-ref M: value-ref get-ref >ref< at ; M: value-ref set-ref >ref< set-at ; diff --git a/basis/see/see-docs.factor b/basis/see/see-docs.factor index 755d4ac9bc..cea2592bc2 100644 --- a/basis/see/see-docs.factor +++ b/basis/see/see-docs.factor @@ -25,7 +25,7 @@ HELP: definer { $examples { $example "USING: definitions prettyprint ;" "IN: scratchpad" - ": foo ; \\ foo definer . ." + ": foo ( -- ) ; \\ foo definer . ." ";\nPOSTPONE: :" } { $example "USING: definitions prettyprint ;" diff --git a/basis/stack-checker/stack-checker-docs.factor b/basis/stack-checker/stack-checker-docs.factor index 088fab34d0..28090918bb 100644 --- a/basis/stack-checker/stack-checker-docs.factor +++ b/basis/stack-checker/stack-checker-docs.factor @@ -33,9 +33,9 @@ $nl "A general rule of thumb is that any word which applies " { $link call } " or " { $link curry } " to one of its inputs must be declared " { $link POSTPONE: inline } "." $nl "Here is an example where the stack effect cannot be inferred:" -{ $code ": foo 0 [ + ] ;" "[ foo reduce ] infer." } +{ $code ": foo ( -- n quot ) 0 [ + ] ;" "[ foo reduce ] infer." } "However if " { $snippet "foo" } " was declared " { $link POSTPONE: inline } ", everything would work, since the " { $link reduce } " combinator is also " { $link POSTPONE: inline } ", and the inferencer can see the literal quotation value at the point it is passed to " { $link call } ":" -{ $example ": foo 0 [ + ] ; inline" "[ foo reduce ] infer." "( object -- object )" } +{ $example ": foo ( -- n quot ) 0 [ + ] ; inline" "[ foo reduce ] infer." "( object -- object )" } "Passing a literal quotation on the data stack through an inlined recursive combinator nullifies its literal status. For example, the following will not infer:" { $example "[ [ reverse ] swap [ reverse ] map swap call ] infer." "Got a computed value where a literal quotation was expected\n\nType :help for debugging help." diff --git a/basis/stack-checker/stack-checker-tests.factor b/basis/stack-checker/stack-checker-tests.factor index 3d8c2cdd8c..117b6845b8 100644 --- a/basis/stack-checker/stack-checker-tests.factor +++ b/basis/stack-checker/stack-checker-tests.factor @@ -292,7 +292,7 @@ DEFER: bar [ [ [ m ] m ] infer ] [ inference-error? ] must-fail-with -: m' dup curry call ; inline +: m' ( quot -- ) dup curry call ; inline [ [ [ m' ] m' ] infer ] [ inference-error? ] must-fail-with diff --git a/basis/ui/commands/commands-docs.factor b/basis/ui/commands/commands-docs.factor index 81a4096aab..b576f173b6 100644 --- a/basis/ui/commands/commands-docs.factor +++ b/basis/ui/commands/commands-docs.factor @@ -54,7 +54,7 @@ HELP: command-name { $example "USING: io ui.commands ;" "IN: scratchpad" - ": com-my-command ;" + ": com-my-command ( -- ) ;" "\\ com-my-command command-name write" "My Command" } diff --git a/core/math/math-docs.factor b/core/math/math-docs.factor index 101557d0cf..f79dcb5481 100644 --- a/core/math/math-docs.factor +++ b/core/math/math-docs.factor @@ -307,7 +307,7 @@ HELP: find-last-integer { $notes "This word is used to implement " { $link find-last } "." } ; HELP: byte-array>bignum -{ $values { "byte-array" byte-array } { "n" integer } } +{ $values { "x" byte-array } { "y" bignum } } { $description "Converts a byte-array, interpreted as little-endian, into a bignum integer. User code should call " { $link le> } " or " { $link be> } " instead." } ; ARTICLE: "division-by-zero" "Division by zero" diff --git a/core/memory/memory-tests.factor b/core/memory/memory-tests.factor index 11a6a9d8a9..995c7e6064 100644 --- a/core/memory/memory-tests.factor +++ b/core/memory/memory-tests.factor @@ -15,9 +15,9 @@ IN: memory.tests [ [ ] instances ] must-infer ! Code GC wasn't kicking in when needed -: leak-step 800000 f 1quotation call drop ; +: leak-step ( -- ) 800000 f 1quotation call drop ; -: leak-loop 100 [ leak-step ] times ; +: leak-loop ( -- ) 100 [ leak-step ] times ; [ ] [ leak-loop ] unit-test diff --git a/core/strings/strings-docs.factor b/core/strings/strings-docs.factor index c5ca2b129f..2aa8ef421c 100644 --- a/core/strings/strings-docs.factor +++ b/core/strings/strings-docs.factor @@ -26,17 +26,17 @@ ABOUT: "strings" HELP: string { $description "The class of fixed-length character strings. See " { $link "syntax-strings" } " for syntax and " { $link "strings" } " for general information." } ; -HELP: string-nth ( n string -- ch ) +HELP: string-nth { $values { "n" fixnum } { "string" string } { "ch" "the character at the " { $snippet "n" } "th index" } } { $description "Unsafe string accessor, used to define " { $link nth } " on strings." } { $warning "This word is in the " { $vocab-link "strings.private" } " vocabulary because it does not perform type or bounds checking. User code should call " { $link nth } " instead." } ; -HELP: set-string-nth ( ch n string -- ) +HELP: set-string-nth { $values { "ch" "a character" } { "n" fixnum } { "string" string } } { $description "Unsafe string mutator, used to define " { $link set-nth } " on strings." } { $warning "This word is in the " { $vocab-link "strings.private" } " vocabulary because it does not perform type or bounds checking. User code should call " { $link set-nth } " instead." } ; -HELP: ( n ch -- string ) +HELP: { $values { "n" "a positive integer specifying string length" } { "ch" "an initial character" } { "string" string } } { $description "Creates a new string with the given length and all characters initially set to " { $snippet "ch" } "." } ; diff --git a/core/strings/strings.factor b/core/strings/strings.factor index 7e4c80d4ae..ffcefab78b 100644 --- a/core/strings/strings.factor +++ b/core/strings/strings.factor @@ -17,7 +17,7 @@ IN: strings : rehash-string ( str -- ) 1 over sequence-hashcode swap set-string-hashcode ; inline -: set-string-nth ( ch n str -- ) +: set-string-nth ( ch n string -- ) pick HEX: 7f fixnum<= [ set-string-nth-fast ] [ set-string-nth-slow ] if ; inline diff --git a/core/syntax/syntax-docs.factor b/core/syntax/syntax-docs.factor index 79aeee5b55..6a7e8116cd 100644 --- a/core/syntax/syntax-docs.factor +++ b/core/syntax/syntax-docs.factor @@ -180,7 +180,7 @@ HELP: delimiter HELP: SYNTAX: { $syntax "SYNTAX: foo ... ;" } { $description "Defines a parsing word." } -{ $examples "In the below example, the " { $snippet "world" } " word is never called, however its body references a parsing word which executes immediately:" { $example "USE: io" "IN: scratchpad" "<< SYNTAX: HELLO \"Hello parser!\" print ; >>\n: world HELLO ;" "Hello parser!" } } ; +{ $examples "In the below example, the " { $snippet "world" } " word is never called, however its body references a parsing word which executes immediately:" { $example "USE: io" "IN: scratchpad" "<< SYNTAX: HELLO \"Hello parser!\" print ; >>\n: world ( -- ) HELLO ;" "Hello parser!" } } ; HELP: inline { $syntax ": foo ... ; inline" } diff --git a/core/words/words-docs.factor b/core/words/words-docs.factor index 63b58bf9d5..1ad6928acb 100644 --- a/core/words/words-docs.factor +++ b/core/words/words-docs.factor @@ -165,7 +165,7 @@ HELP: execute ( word -- ) { $values { "word" word } } { $description "Executes a word." } { $examples - { $example "USING: kernel io words ;" "IN: scratchpad" ": twice dup execute execute ;\n: hello \"Hello\" print ;\n\\ hello twice" "Hello\nHello" } + { $example "USING: kernel io words ;" "IN: scratchpad" ": twice ( word -- ) dup execute execute ;\n: hello ( -- ) \"Hello\" print ;\n\\ hello twice" "Hello\nHello" } } ; HELP: deferred @@ -273,8 +273,8 @@ HELP: bootstrap-word { $values { "word" word } { "target" word } } { $description "Looks up a word with the same name and vocabulary as the given word, performing a transformation to handle parsing words in the target dictionary. Used during bootstrap to transfer host words to the target dictionary." } ; -HELP: parsing-word? ( obj -- ? ) -{ $values { "obj" object } { "?" "a boolean" } } +HELP: parsing-word? +{ $values { "object" object } { "?" "a boolean" } } { $description "Tests if an object is a parsing word declared by " { $link POSTPONE: SYNTAX: } "." } { $notes "Outputs " { $link f } " if the object is not a word." } ; diff --git a/extra/24-game/24-game.factor b/extra/24-game/24-game.factor index f22ca001f4..19928b2e0b 100644 --- a/extra/24-game/24-game.factor +++ b/extra/24-game/24-game.factor @@ -57,7 +57,7 @@ DEFER: check-status [ dup quit? [ quit-game ] [ repeat ] if ] if ; : build-quad ( -- array ) 4 [ 10 random ] replicate >array ; -: 24-able? ( vector -- t/f ) [ makes-24? ] with-datastack first ; +: 24-able? ( quad -- t/f ) [ makes-24? ] with-datastack first ; : 24-able ( -- vector ) build-quad dup 24-able? [ drop build-quad ] unless ; : set-commands ( -- ) { + - * / rot swap q } commands set ; : play-game ( -- ) set-commands 24-able repeat ; diff --git a/extra/animations/animations-docs.factor b/extra/animations/animations-docs.factor index 000c0ce4cc..c875feab83 100644 --- a/extra/animations/animations-docs.factor +++ b/extra/animations/animations-docs.factor @@ -29,7 +29,7 @@ HELP: reset-progress ( -- ) "a loop which makes use of " { $link progress } "." } ; -HELP: progress ( -- time ) +HELP: progress { $values { "time" "an integer" } } { $description "Gives the time elapsed since the last time" diff --git a/extra/animations/animations.factor b/extra/animations/animations.factor index 8ac4abe1fa..a5c7dbdde4 100644 --- a/extra/animations/animations.factor +++ b/extra/animations/animations.factor @@ -9,7 +9,7 @@ SYMBOL: sleep-period : reset-progress ( -- ) millis last-loop set ; ! : my-progress ( -- progress ) millis -: progress ( -- progress ) millis last-loop get - reset-progress ; +: progress ( -- time ) millis last-loop get - reset-progress ; : progress-peek ( -- progress ) millis last-loop get - ; : set-end ( duration -- end-time ) duration>milliseconds millis + ; : loop ( quot end -- ) dup millis > [ [ dup call ] dip loop ] [ 2drop ] if ; inline diff --git a/extra/ctags/ctags-docs.factor b/extra/ctags/ctags-docs.factor index b984cdce54..0377808dca 100644 --- a/extra/ctags/ctags-docs.factor +++ b/extra/ctags/ctags-docs.factor @@ -36,7 +36,7 @@ HELP: ctags-write ( seq path -- ) { $notes { $snippet "tags" } " file will contain a single line: if\\t/path/to/factor/extra/unix/unix.factor\\t91" } ; -HELP: ctag-strings ( alist -- seq ) +HELP: ctag-strings { $values { "alist" "an association list" } { "seq" sequence } } { $description "Converts an " { $snippet "alist" } " with ctag format (a word as key and a sequence whose first element is a resource name and a second element is a line number as value) in a " { $snippet "seq" } " of ctag strings." } diff --git a/extra/ctags/ctags.factor b/extra/ctags/ctags.factor index 393c932482..e351fbf793 100644 --- a/extra/ctags/ctags.factor +++ b/extra/ctags/ctags.factor @@ -27,7 +27,7 @@ IN: ctags ctag-lineno number>string % ] "" make ; -: ctag-strings ( seq1 -- seq2 ) +: ctag-strings ( alist -- seq ) [ ctag ] map ; : ctags-write ( seq path -- ) diff --git a/extra/literals/literals-docs.factor b/extra/literals/literals-docs.factor index 6525264f6a..0d61dcb467 100644 --- a/extra/literals/literals-docs.factor +++ b/extra/literals/literals-docs.factor @@ -21,7 +21,7 @@ CONSTANT: five 5 USING: kernel literals prettyprint ; IN: scratchpad -<< : seven-eleven 7 11 ; >> +<< : seven-eleven ( -- a b ) 7 11 ; >> { $ seven-eleven } . "> "{ 7 11 }" } @@ -37,7 +37,7 @@ HELP: $[ USING: kernel literals math prettyprint ; IN: scratchpad -<< : five 5 ; >> +<< CONSTANT: five 5 >> { $[ five dup 1+ dup 2 + ] } . "> "{ 5 6 8 }" } @@ -51,7 +51,7 @@ ARTICLE: "literals" "Interpolating code results into literal values" USING: kernel literals math prettyprint ; IN: scratchpad -<< : five 5 ; >> +<< CONSTANT: five 5 >> { $ five $[ five dup 1+ dup 2 + ] } . "> "{ 5 5 6 8 }" } { $subsection POSTPONE: $ } diff --git a/extra/multi-methods/multi-methods.factor b/extra/multi-methods/multi-methods.factor index ec069a4894..17f0de120e 100755 --- a/extra/multi-methods/multi-methods.factor +++ b/extra/multi-methods/multi-methods.factor @@ -1,11 +1,11 @@ -! Copyright (C) 2008 Slava Pestov. +! Copyright (C) 2008, 2009 Slava Pestov. ! See http://factorcode.org/license.txt for BSD license. USING: kernel math sequences vectors classes classes.algebra combinators arrays words assocs parser namespaces make definitions prettyprint prettyprint.backend prettyprint.custom quotations generalizations debugger io compiler.units kernel.private effects accessors hashtables sorting shuffle -math.order sets see ; +math.order sets see effects.parser ; IN: multi-methods ! PART I: Converting hook specializers @@ -214,17 +214,16 @@ M: no-method error. [ "multi-method-specializer" word-prop ] [ "multi-method-generic" word-prop ] bi prefix ; -: define-generic ( word -- ) - dup "multi-methods" word-prop [ - drop - ] [ +: define-generic ( word effect -- ) + over set-stack-effect + dup "multi-methods" word-prop [ drop ] [ [ H{ } clone "multi-methods" set-word-prop ] [ update-generic ] bi ] if ; ! Syntax -SYNTAX: GENERIC: CREATE define-generic ; +SYNTAX: GENERIC: CREATE-WORD complete-effect define-generic ; : parse-method ( -- quot classes generic ) parse-definition [ 2 tail ] [ second ] [ first ] tri ; diff --git a/extra/newfx/newfx.factor b/extra/newfx/newfx.factor index 4169050e6f..bf7955fa84 100644 --- a/extra/newfx/newfx.factor +++ b/extra/newfx/newfx.factor @@ -140,11 +140,11 @@ METHOD: as-mutate { object object assoc } set-at ; ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -: filter-of ( quot seq -- seq ) swap filter ; +: filter-of ( quot seq -- seq ) swap filter ; inline ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -: map-over ( quot seq -- seq ) swap map ; +: map-over ( quot seq -- seq ) swap map ; inline ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! @@ -242,7 +242,7 @@ METHOD: as-mutate { object object assoc } set-at ; ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -: purge ( seq quot -- seq ) [ not ] compose filter ; +: purge ( seq quot -- seq ) [ not ] compose filter ; inline : purge! ( seq quot -- seq ) - dupd '[ swap @ [ pluck! ] [ drop ] if ] each-index ; + dupd '[ swap @ [ pluck! ] [ drop ] if ] each-index ; inline diff --git a/extra/sequences/n-based/n-based-docs.factor b/extra/sequences/n-based/n-based-docs.factor index 6c56300f6d..852fe59d8b 100644 --- a/extra/sequences/n-based/n-based-docs.factor +++ b/extra/sequences/n-based/n-based-docs.factor @@ -10,7 +10,7 @@ HELP: USING: assocs prettyprint kernel sequences.n-based ; IN: scratchpad -: months +: months ( -- assoc ) { "January" "February" @@ -36,7 +36,7 @@ HELP: n-based-assoc USING: assocs prettyprint kernel sequences.n-based ; IN: scratchpad -: months +: months ( -- assoc ) { "January" "February" From ed26f1921fdeffa537969b71209a2f66739197b3 Mon Sep 17 00:00:00 2001 From: Slava Pestov Date: Mon, 23 Mar 2009 18:25:18 -0500 Subject: [PATCH 10/24] Condomization wraps lambdas in condoms to protect them from macro-transmitted diseases. cond, case and other macros work better now if lambdas appear where quotations are expected --- basis/locals/locals-tests.factor | 61 ++++++++++++++++++++++++++- basis/locals/macros/macros.factor | 7 ++- basis/macros/expander/expander.factor | 22 ++++++++-- 3 files changed, 84 insertions(+), 6 deletions(-) diff --git a/basis/locals/locals-tests.factor b/basis/locals/locals-tests.factor index 8e3b59fe69..8e61e39faf 100644 --- a/basis/locals/locals-tests.factor +++ b/basis/locals/locals-tests.factor @@ -2,7 +2,7 @@ USING: locals math sequences tools.test hashtables words kernel namespaces arrays strings prettyprint io.streams.string parser accessors generic eval combinators combinators.short-circuit combinators.short-circuit.smart math.order math.functions -definitions compiler.units fry lexer words.symbol see ; +definitions compiler.units fry lexer words.symbol see multiline ; IN: locals.tests :: foo ( a b -- a a ) a a ; @@ -392,6 +392,65 @@ ERROR: punned-class x ; [ 9 ] [ 3 big-case-test ] unit-test +! Dan found this problem +: littledan-case-problem-1 ( a -- b ) + { + { t [ 3 ] } + { f [ 4 ] } + [| x | x 12 + { "howdy" } nth ] + } case ; + +\ littledan-case-problem-1 must-infer + +[ "howdy" ] [ -12 \ littledan-case-problem-1 def>> call ] unit-test +[ "howdy" ] [ -12 littledan-case-problem-1 ] unit-test + +:: littledan-case-problem-2 ( a -- b ) + a { + { t [ a not ] } + { f [ 4 ] } + [| x | x a - { "howdy" } nth ] + } case ; + +\ littledan-case-problem-2 must-infer + +[ "howdy" ] [ -12 \ littledan-case-problem-2 def>> call ] unit-test +[ "howdy" ] [ -12 littledan-case-problem-2 ] unit-test + +:: littledan-cond-problem-1 ( a -- b ) + a { + { [ dup 0 < ] [ drop a not ] } + { [| y | y y 0 > ] [ drop 4 ] } + [| x | x a - { "howdy" } nth ] + } cond ; + +\ littledan-cond-problem-1 must-infer + +[ f ] [ -12 \ littledan-cond-problem-1 def>> call ] unit-test +[ 4 ] [ 12 \ littledan-cond-problem-1 def>> call ] unit-test +[ "howdy" ] [ 0 \ littledan-cond-problem-1 def>> call ] unit-test +[ f ] [ -12 littledan-cond-problem-1 ] unit-test +[ 4 ] [ 12 littledan-cond-problem-1 ] unit-test +[ "howdy" ] [ 0 littledan-cond-problem-1 ] unit-test + +/* +:: littledan-case-problem-3 ( a quot -- b ) + a { + { t [ a not ] } + { f [ 4 ] } + quot + } case ; inline + +[ f ] [ t [ ] littledan-case-problem-3 ] unit-test +[ 144 ] [ 12 [ sq ] littledan-case-problem-3 ] unit-test +[| | [| a | a ] littledan-case-problem-3 ] must-infer + +: littledan-case-problem-4 ( a -- b ) + [ 1 + ] littledan-case-problem-3 ; + +\ littledan-case-problem-4 must-infer +*/ + GENERIC: lambda-method-forget-test ( a -- b ) M:: integer lambda-method-forget-test ( a -- b ) ; diff --git a/basis/locals/macros/macros.factor b/basis/locals/macros/macros.factor index 7bde67a792..2b52c53eb5 100644 --- a/basis/locals/macros/macros.factor +++ b/basis/locals/macros/macros.factor @@ -1,6 +1,6 @@ -! Copyright (C) 2007, 2008 Slava Pestov, Eduardo Cavazos. +! Copyright (C) 2007, 2009 Slava Pestov, Eduardo Cavazos. ! See http://factorcode.org/license.txt for BSD license. -USING: accessors assocs kernel locals.types macros.expander ; +USING: accessors assocs kernel locals.types macros.expander fry ; IN: locals.macros M: lambda expand-macros clone [ expand-macros ] change-body ; @@ -14,3 +14,6 @@ M: binding-form expand-macros M: binding-form expand-macros* expand-macros literal ; +M: lambda condomize? drop t ; + +M: lambda condomize '[ @ ] ; \ No newline at end of file diff --git a/basis/macros/expander/expander.factor b/basis/macros/expander/expander.factor index cdd2b49d9c..25f754e92a 100644 --- a/basis/macros/expander/expander.factor +++ b/basis/macros/expander/expander.factor @@ -1,8 +1,8 @@ -! Copyright (C) 2008 Slava Pestov. +! Copyright (C) 2008, 2009 Slava Pestov. ! See http://factorcode.org/license.txt for BSD license. USING: kernel sequences sequences.private namespaces make quotations accessors words continuations vectors effects math -generalizations fry ; +generalizations fry arrays ; IN: macros.expander GENERIC: expand-macros ( quot -- quot' ) @@ -17,7 +17,23 @@ SYMBOL: stack [ delete-all ] bi ; -: literal ( obj -- ) stack get push ; +GENERIC: condomize? ( obj -- ? ) + +M: array condomize? [ condomize? ] any? ; + +M: callable condomize? [ condomize? ] any? ; + +M: object condomize? drop f ; + +GENERIC: condomize ( obj -- obj' ) + +M: array condomize [ condomize ] map ; + +M: callable condomize [ condomize ] map ; + +M: object condomize ; + +: literal ( obj -- ) dup condomize? [ condomize ] when stack get push ; GENERIC: expand-macros* ( obj -- ) From 3d97e4c82e40584b6f7a13e1c4f2accdebcd3931 Mon Sep 17 00:00:00 2001 From: Doug Coleman Date: Mon, 23 Mar 2009 19:00:23 -0500 Subject: [PATCH 11/24] delete factor/ every time after a build is finished. you can easily check it out by knowing the git-id --- extra/mason/build/build.factor | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/extra/mason/build/build.factor b/extra/mason/build/build.factor index 706dc12616..90ca1d31ff 100644 --- a/extra/mason/build/build.factor +++ b/extra/mason/build/build.factor @@ -5,6 +5,8 @@ io.files io.launcher mason.child mason.cleanup mason.common mason.help mason.release mason.report namespaces prettyprint ; IN: mason.build +QUALIFIED: continuations + : create-build-dir ( -- ) now datestamp stamp set build-dir make-directory ; @@ -21,10 +23,11 @@ IN: mason.build create-build-dir enter-build-dir clone-builds-factor - record-id - build-child - upload-help - release - cleanup ; + [ + record-id + build-child + upload-help + release + ] [ cleanup ] [ ] continuations:cleanup ; -MAIN: build \ No newline at end of file +MAIN: build From f8d7fec17f21f5f64aad55003a35bc24cdc6fd3a Mon Sep 17 00:00:00 2001 From: Slava Pestov Date: Mon, 23 Mar 2009 19:23:18 -0500 Subject: [PATCH 12/24] Faster PEG compile times; inline less, use execute( instead --- basis/peg/parsers/parsers.factor | 4 +-- basis/peg/peg.factor | 56 ++++++++++++++++---------------- 2 files changed, 30 insertions(+), 30 deletions(-) diff --git a/basis/peg/parsers/parsers.factor b/basis/peg/parsers/parsers.factor index aadbbaff16..93f407681e 100644 --- a/basis/peg/parsers/parsers.factor +++ b/basis/peg/parsers/parsers.factor @@ -9,14 +9,14 @@ TUPLE: just-parser p1 ; CONSTANT: just-pattern [ - execute dup [ + dup [ dup remaining>> empty? [ drop f ] unless ] when ] M: just-parser (compile) ( parser -- quot ) - p1>> compile-parser just-pattern curry ; + p1>> compile-parser-quot just-pattern compose ; : just ( parser -- parser ) just-parser boa wrap-peg ; diff --git a/basis/peg/peg.factor b/basis/peg/peg.factor index 98c92159ec..ce34beb725 100644 --- a/basis/peg/peg.factor +++ b/basis/peg/peg.factor @@ -116,7 +116,7 @@ TUPLE: peg-head rule-id involved-set eval-set ; #! Evaluate a rule, return an ast resulting from it. #! Return fail if the rule failed. The rule has #! stack effect ( -- parse-result ) - pos get swap execute process-rule-result ; inline + pos get swap execute( -- parse-result ) process-rule-result ; inline : memo ( pos id -- memo-entry ) #! Return the result from the memo cache. @@ -244,14 +244,15 @@ TUPLE: peg-head rule-id involved-set eval-set ; : with-packrat ( input quot -- result ) #! Run the quotation with a packrat cache active. - swap [ - input set + [ + swap input set 0 pos set f lrstack set V{ } clone error-stack set H{ } clone \ heads set H{ } clone \ packrat set - ] H{ } make-assoc swap bind ; inline + call + ] with-scope ; inline GENERIC: (compile) ( peg -- quot ) @@ -264,20 +265,16 @@ GENERIC: (compile) ( peg -- quot ) ] if ; : execute-parser ( word -- result ) - pos get apply-rule process-parser-result ; inline - -: parser-body ( parser -- quot ) - #! Return the body of the word that is the compiled version - #! of the parser. - gensym 2dup swap peg>> (compile) (( -- result )) define-declared - swap dupd id>> "peg-id" set-word-prop - [ execute-parser ] curry ; + pos get apply-rule process-parser-result ; : preset-parser-word ( parser -- parser word ) gensym [ >>compiled ] keep ; : define-parser-word ( parser word -- ) - swap parser-body (( -- result )) define-declared ; + #! Return the body of the word that is the compiled version + #! of the parser. + 2dup swap peg>> (compile) (( -- result )) define-declared + swap id>> "peg-id" set-word-prop ; : compile-parser ( parser -- word ) #! Look to see if the given parser has been compiled. @@ -292,19 +289,22 @@ GENERIC: (compile) ( peg -- quot ) preset-parser-word [ define-parser-word ] keep ] if* ; +: compile-parser-quot ( parser -- quot ) + compile-parser [ execute-parser ] curry ; + SYMBOL: delayed : fixup-delayed ( -- ) #! Work through all delayed parsers and recompile their #! words to have the correct bodies. delayed get [ - call( -- parser ) compile-parser 1quotation (( -- result )) define-declared + call( -- parser ) compile-parser-quot (( -- result )) define-declared ] assoc-each ; : compile ( parser -- word ) [ H{ } clone delayed [ - compile-parser fixup-delayed + compile-parser-quot (( -- result )) define-temp fixup-delayed ] with-variable ] with-compilation-unit ; @@ -411,8 +411,8 @@ M: seq-parser (compile) ( peg -- quot ) [ [ input-slice V{ } clone ] % [ - parsers>> unclip compile-parser 1quotation [ parse-seq-element ] curry , - [ compile-parser 1quotation [ merge-errors ] compose [ parse-seq-element ] curry , ] each + parsers>> unclip compile-parser-quot [ parse-seq-element ] curry , + [ compile-parser-quot [ merge-errors ] compose [ parse-seq-element ] curry , ] each ] { } make , \ 1&& , ] [ ] make ; @@ -421,8 +421,8 @@ TUPLE: choice-parser parsers ; M: choice-parser (compile) ( peg -- quot ) [ [ - parsers>> [ compile-parser ] map - unclip 1quotation , [ 1quotation [ merge-errors ] compose , ] each + parsers>> [ compile-parser-quot ] map + unclip , [ [ merge-errors ] compose , ] each ] { } make , \ 0|| , ] [ ] make ; @@ -438,7 +438,7 @@ TUPLE: repeat0-parser p1 ; ] if* ; inline recursive M: repeat0-parser (compile) ( peg -- quot ) - p1>> compile-parser 1quotation '[ + p1>> compile-parser-quot '[ input-slice V{ } clone _ swap (repeat) ] ; @@ -452,7 +452,7 @@ TUPLE: repeat1-parser p1 ; ] if* ; M: repeat1-parser (compile) ( peg -- quot ) - p1>> compile-parser 1quotation '[ + p1>> compile-parser-quot '[ input-slice V{ } clone _ swap (repeat) repeat1-empty-check ] ; @@ -462,7 +462,7 @@ TUPLE: optional-parser p1 ; [ input-slice f ] unless* ; M: optional-parser (compile) ( peg -- quot ) - p1>> compile-parser 1quotation '[ @ check-optional ] ; + p1>> compile-parser-quot '[ @ check-optional ] ; TUPLE: semantic-parser p1 quot ; @@ -474,7 +474,7 @@ TUPLE: semantic-parser p1 quot ; ] if ; inline M: semantic-parser (compile) ( peg -- quot ) - [ p1>> compile-parser 1quotation ] [ quot>> ] bi + [ p1>> compile-parser-quot ] [ quot>> ] bi '[ @ _ check-semantic ] ; TUPLE: ensure-parser p1 ; @@ -483,7 +483,7 @@ TUPLE: ensure-parser p1 ; [ ignore ] [ drop f ] if ; M: ensure-parser (compile) ( peg -- quot ) - p1>> compile-parser 1quotation '[ input-slice @ check-ensure ] ; + p1>> compile-parser-quot '[ input-slice @ check-ensure ] ; TUPLE: ensure-not-parser p1 ; @@ -491,7 +491,7 @@ TUPLE: ensure-not-parser p1 ; [ drop f ] [ ignore ] if ; M: ensure-not-parser (compile) ( peg -- quot ) - p1>> compile-parser 1quotation '[ input-slice @ check-ensure-not ] ; + p1>> compile-parser-quot '[ input-slice @ check-ensure-not ] ; TUPLE: action-parser p1 quot ; @@ -503,12 +503,12 @@ TUPLE: action-parser p1 quot ; ] if ; inline M: action-parser (compile) ( peg -- quot ) - [ p1>> compile-parser 1quotation ] [ quot>> ] bi '[ @ _ check-action ] ; + [ p1>> compile-parser-quot ] [ quot>> ] bi '[ @ _ check-action ] ; TUPLE: sp-parser p1 ; M: sp-parser (compile) ( peg -- quot ) - p1>> compile-parser 1quotation '[ + p1>> compile-parser-quot '[ input-slice [ blank? ] trim-head-slice input-from pos set @ ] ; @@ -527,7 +527,7 @@ M: box-parser (compile) ( peg -- quot ) #! to produce the parser to be compiled. #! This differs from 'delay' which calls #! it at run time. - quot>> call( -- parser ) compile-parser 1quotation ; + quot>> call( -- parser ) compile-parser-quot ; PRIVATE> From 6f4e5b4bd9fd4f66f040c779fac0537c34bbda46 Mon Sep 17 00:00:00 2001 From: Slava Pestov Date: Mon, 23 Mar 2009 19:25:10 -0500 Subject: [PATCH 13/24] Move synopsis* from definitions to see --- basis/see/see-docs.factor | 5 ++++- basis/see/see.factor | 2 ++ core/definitions/definitions-docs.factor | 4 ++-- core/generic/generic-docs.factor | 2 +- 4 files changed, 9 insertions(+), 4 deletions(-) diff --git a/basis/see/see-docs.factor b/basis/see/see-docs.factor index cea2592bc2..6d51b42a86 100644 --- a/basis/see/see-docs.factor +++ b/basis/see/see-docs.factor @@ -50,6 +50,9 @@ $nl "Printing a definition:" { $subsection see } "Printing the methods defined on a generic word or class (see " { $link "objects" } "):" -{ $subsection see-methods } ; +{ $subsection see-methods } +"Definition specifiers implementing the " { $link "definition-protocol" } " should also implement the " { $emphasis "see protocol" } ":" +{ $subsection see* } +{ $subsection synopsis* } ; ABOUT: "see" \ No newline at end of file diff --git a/basis/see/see.factor b/basis/see/see.factor index 041a72ea0e..32f49499db 100644 --- a/basis/see/see.factor +++ b/basis/see/see.factor @@ -10,6 +10,8 @@ prettyprint.sections sequences sets sorting strings summary words words.symbol ; IN: see +GENERIC: synopsis* ( defspec -- ) + GENERIC: see* ( defspec -- ) : see ( defspec -- ) see* nl ; diff --git a/core/definitions/definitions-docs.factor b/core/definitions/definitions-docs.factor index 80da7daa31..b53ab28cbc 100644 --- a/core/definitions/definitions-docs.factor +++ b/core/definitions/definitions-docs.factor @@ -13,9 +13,9 @@ $nl "Definitions can answer a sequence of definitions they directly depend on:" { $subsection uses } "Definitions must implement a few operations used for printing them in source form:" -{ $subsection synopsis* } { $subsection definer } -{ $subsection definition } ; +{ $subsection definition } +{ $see-also "see" } ; ARTICLE: "definition-crossref" "Definition cross referencing" "A common cross-referencing system is used to track definition usages:" diff --git a/core/generic/generic-docs.factor b/core/generic/generic-docs.factor index b90bcc8fc1..06a8fa87a3 100644 --- a/core/generic/generic-docs.factor +++ b/core/generic/generic-docs.factor @@ -62,7 +62,7 @@ ARTICLE: "method-combination" "Custom method combination" { { $link POSTPONE: HOOK: } { $link hook-combination } } { { $link POSTPONE: MATH: } { $link math-combination } } } -"Developing a custom method combination requires that a parsing word calling " { $link define-generic } " be defined; additionally, it is a good idea to implement the definition protocol words " { $link definer } " and " { $link synopsis* } " on the class of words having this method combination, to properly support developer tools." +"Developing a custom method combination requires that a parsing word calling " { $link define-generic } " be defined; additionally, it is a good idea to implement the " { $link "definition-protocol" } " on the class of words having this method combination, to properly support developer tools." $nl "The combination quotation passed to " { $link define-generic } " has stack effect " { $snippet "( word -- quot )" } ". It's job is to call various introspection words, including at least obtaining the set of methods defined on the generic word, then combining these methods in some way to produce a quotation." { $see-also "generic-introspection" } ; From 919f544d6420bbf3bc7a7485fee94dbcf20ff9fb Mon Sep 17 00:00:00 2001 From: Slava Pestov Date: Mon, 23 Mar 2009 19:25:17 -0500 Subject: [PATCH 14/24] cocoa.messages: cleanup --- basis/cocoa/messages/messages.factor | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/basis/cocoa/messages/messages.factor b/basis/cocoa/messages/messages.factor index f71b9f3f56..65bb2c02ef 100644 --- a/basis/cocoa/messages/messages.factor +++ b/basis/cocoa/messages/messages.factor @@ -22,15 +22,13 @@ SYMBOL: super-message-senders message-senders [ H{ } clone ] initialize super-message-senders [ H{ } clone ] initialize -: cache-stub ( method function hash -- ) - [ - over get [ 2drop ] [ over [ sender-stub ] dip set ] if - ] bind ; +: cache-stub ( method assoc function -- ) + '[ _ sender-stub ] cache drop ; : cache-stubs ( method -- ) - dup - "objc_msgSendSuper" super-message-senders get cache-stub - "objc_msgSend" message-senders get cache-stub ; + [ super-message-senders get "objc_msgSendSuper" cache-stub ] + [ message-senders get "objc_msgSend" cache-stub ] + bi ; : ( receiver -- super ) "objc-super" [ From d42486f078bbaffb2f2f85bfd7f65c69e9091162 Mon Sep 17 00:00:00 2001 From: Doug Coleman Date: Mon, 23 Mar 2009 20:09:01 -0500 Subject: [PATCH 15/24] check pango-1.0 --- build-support/factor.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build-support/factor.sh b/build-support/factor.sh index c5be9f8957..61450dacb4 100755 --- a/build-support/factor.sh +++ b/build-support/factor.sh @@ -142,7 +142,7 @@ check_X11_libraries() { check_library_exists GLU check_library_exists GL check_library_exists X11 - check_library_exists pango + check_library_exists pango-1.0 } check_libraries() { From f061b0531167f949eaeb887332e2662616f9aac0 Mon Sep 17 00:00:00 2001 From: Doug Coleman Date: Mon, 23 Mar 2009 20:32:57 -0500 Subject: [PATCH 16/24] make ecdsa unportable for now --- extra/ecdsa/tags.txt | 1 + 1 file changed, 1 insertion(+) create mode 100644 extra/ecdsa/tags.txt diff --git a/extra/ecdsa/tags.txt b/extra/ecdsa/tags.txt new file mode 100644 index 0000000000..6bf68304bb --- /dev/null +++ b/extra/ecdsa/tags.txt @@ -0,0 +1 @@ +unportable From 688452fa3d78b1ce6406f7aedcfb3403b5a3b815 Mon Sep 17 00:00:00 2001 From: Doug Coleman Date: Mon, 23 Mar 2009 20:36:44 -0500 Subject: [PATCH 17/24] make multimethods tests pass --- extra/multi-methods/tests/definitions.factor | 2 +- extra/multi-methods/tests/syntax.factor | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/extra/multi-methods/tests/definitions.factor b/extra/multi-methods/tests/definitions.factor index 64363af428..240c9f86d7 100644 --- a/extra/multi-methods/tests/definitions.factor +++ b/extra/multi-methods/tests/definitions.factor @@ -26,7 +26,7 @@ DEFER: fake DEFER: testing - [ ] [ \ testing define-generic ] unit-test + [ ] [ \ testing (( -- )) define-generic ] unit-test [ t ] [ \ testing generic? ] unit-test ] with-compilation-unit diff --git a/extra/multi-methods/tests/syntax.factor b/extra/multi-methods/tests/syntax.factor index 9d9c80b214..cc073099d8 100644 --- a/extra/multi-methods/tests/syntax.factor +++ b/extra/multi-methods/tests/syntax.factor @@ -3,7 +3,7 @@ USING: multi-methods tools.test math sequences namespaces system kernel strings definitions prettyprint debugger arrays hashtables continuations classes assocs accessors see ; -GENERIC: first-test +GENERIC: first-test ( -- ) [ t ] [ \ first-test generic? ] unit-test @@ -13,7 +13,7 @@ SINGLETON: paper INSTANCE: paper thing SINGLETON: scissors INSTANCE: scissors thing SINGLETON: rock INSTANCE: rock thing -GENERIC: beats? +GENERIC: beats? ( obj1 obj2 -- ? ) METHOD: beats? { paper scissors } t ; METHOD: beats? { scissors rock } t ; @@ -34,7 +34,7 @@ METHOD: beats? { thing thing } f ; SYMBOL: some-var -GENERIC: hook-test +GENERIC: hook-test ( -- obj ) METHOD: hook-test { array { some-var array } } reverse ; METHOD: hook-test { { some-var array } } class ; @@ -57,7 +57,7 @@ TUPLE: busted-1 ; TUPLE: busted-2 ; INSTANCE: busted-2 busted TUPLE: busted-3 ; -GENERIC: busted-sort +GENERIC: busted-sort ( obj1 obj2 -- obj1 obj2 ) METHOD: busted-sort { busted-1 busted-2 } ; METHOD: busted-sort { busted-2 busted-3 } ; From 7a4a7474e86ca80a5cb1eea60b527f0296e9b28c Mon Sep 17 00:00:00 2001 From: Slava Pestov Date: Mon, 23 Mar 2009 22:33:05 -0500 Subject: [PATCH 18/24] Fix site-watcher tests --- extra/site-watcher/site-watcher-tests.factor | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/extra/site-watcher/site-watcher-tests.factor b/extra/site-watcher/site-watcher-tests.factor index dde5e65e7e..62233587d9 100644 --- a/extra/site-watcher/site-watcher-tests.factor +++ b/extra/site-watcher/site-watcher-tests.factor @@ -2,11 +2,14 @@ ! See http://factorcode.org/license.txt for BSD license. USING: db.tuples locals site-watcher site-watcher.db site-watcher.private kernel db io.directories io.files.temp -continuations db.sqlite site-watcher.db.private ; +continuations site-watcher.db.private db.sqlite +sequences tools.test ; IN: site-watcher.tests +[ "site-watcher.db" temp-file delete-file ] ignore-errors + :: fake-sites ( -- seq ) - [ + "site-watcher.db" temp-file [ account ensure-table site ensure-table watching-site ensure-table @@ -17,5 +20,6 @@ IN: site-watcher.tests "erg@factorcode.org" "http://asdfasdfasdfasdfqwerqqq.com" watch-site f select-tuples - ] with-sqlite-db ; + ] with-db ; +[ f ] [ fake-sites empty? ] unit-test \ No newline at end of file From 862223fa79f68cd883e3d776613c853f79034cc3 Mon Sep 17 00:00:00 2001 From: Slava Pestov Date: Mon, 23 Mar 2009 22:36:51 -0500 Subject: [PATCH 19/24] Fix bunny deployment --- basis/tools/deploy/shaker/shaker.factor | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/basis/tools/deploy/shaker/shaker.factor b/basis/tools/deploy/shaker/shaker.factor index a729e40e2a..55433299ad 100755 --- a/basis/tools/deploy/shaker/shaker.factor +++ b/basis/tools/deploy/shaker/shaker.factor @@ -204,7 +204,8 @@ IN: tools.deploy.shaker ] when ; : strip-vocab-globals ( except names -- words ) - [ child-vocabs [ words ] map concat ] map concat swap diff ; + [ child-vocabs [ words ] map concat ] map concat + swap [ first2 lookup ] map sift diff ; : stripped-globals ( -- seq ) [ @@ -245,7 +246,8 @@ IN: tools.deploy.shaker strip-dictionary? [ "libraries" "alien" lookup , - { } { "cpu" "compiler" } strip-vocab-globals % + { { "yield-hook" "compiler.utilities" } } + { "cpu" "compiler" } strip-vocab-globals % { gensym From 53369cf5ff497cec81b1208e1d639ba648a04678 Mon Sep 17 00:00:00 2001 From: Slava Pestov Date: Mon, 23 Mar 2009 23:15:53 -0500 Subject: [PATCH 20/24] Round mouse co-ordinates --- basis/cocoa/views/views.factor | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/basis/cocoa/views/views.factor b/basis/cocoa/views/views.factor index 0b8346db4b..3c60a6a7c1 100644 --- a/basis/cocoa/views/views.factor +++ b/basis/cocoa/views/views.factor @@ -89,4 +89,4 @@ PRIVATE> -> locationInWindow f -> convertPoint:fromView: [ CGPoint-x ] [ CGPoint-y ] bi ] [ drop -> frame CGRect-h ] 2bi - swap - 2array ; + swap - [ >integer ] bi@ 2array ; From c6837fbe3ed1b7f98d1d4905da88ed91efee82df Mon Sep 17 00:00:00 2001 From: sheeple Date: Tue, 24 Mar 2009 01:07:38 -0500 Subject: [PATCH 21/24] Update cpu-ppc.S for quotation layout change --- vm/cpu-ppc.S | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vm/cpu-ppc.S b/vm/cpu-ppc.S index 30b61b5c0c..8b3141218b 100755 --- a/vm/cpu-ppc.S +++ b/vm/cpu-ppc.S @@ -45,7 +45,7 @@ multiply_overflow: /* Note that the XT is passed to the quotation in r11 */ #define CALL_OR_JUMP_QUOT \ - lwz r11,9(r3) /* load quotation-xt slot */ XX \ + lwz r11,17(r3) /* load quotation-xt slot */ XX \ #define CALL_QUOT \ CALL_OR_JUMP_QUOT XX \ From 5d3c2c874a91c24b96f3d862a41371ebd45cca47 Mon Sep 17 00:00:00 2001 From: "U-SLAVA-DFB8FF805\\Slava" Date: Tue, 24 Mar 2009 03:58:11 -0500 Subject: [PATCH 22/24] Get game-input to load on Windows --- basis/ui/backend/windows/windows.factor | 2 +- basis/windows/dinput/constants/constants.factor | 2 +- basis/windows/dinput/dinput.factor | 6 +++--- extra/game-input/dinput/dinput.factor | 4 ++-- extra/game-input/game-input.factor | 2 +- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/basis/ui/backend/windows/windows.factor b/basis/ui/backend/windows/windows.factor index 54d9ed456a..80dd313e85 100755 --- a/basis/ui/backend/windows/windows.factor +++ b/basis/ui/backend/windows/windows.factor @@ -354,7 +354,7 @@ H{ } clone wm-handlers set-global : add-wm-handler ( quot wm -- ) dup array? - [ [ execute add-wm-handler ] with each ] + [ [ execute( -- wm ) add-wm-handler ] with each ] [ wm-handlers get-global set-at ] if ; [ handle-wm-close 0 ] WM_CLOSE add-wm-handler diff --git a/basis/windows/dinput/constants/constants.factor b/basis/windows/dinput/constants/constants.factor index 314fb167e3..cd1033d418 100755 --- a/basis/windows/dinput/constants/constants.factor +++ b/basis/windows/dinput/constants/constants.factor @@ -832,7 +832,7 @@ SYMBOLS: define-keyboard-format-constant define-hid-keyboard-format-constant ; -: define-constants +: define-constants ( -- ) define-guid-constants define-format-constants ; diff --git a/basis/windows/dinput/dinput.factor b/basis/windows/dinput/dinput.factor index 1cd22beb75..dc544858b6 100755 --- a/basis/windows/dinput/dinput.factor +++ b/basis/windows/dinput/dinput.factor @@ -27,15 +27,15 @@ TYPEDEF: void* LPDIENUMEFFECTSCALLBACKW [ "BOOL" { "LPCDIEFFECTINFOW" "LPVOID" } "stdcall" ] dip alien-callback ; inline TYPEDEF: void* LPDIENUMCREATEDEFFECTOBJECTSCALLBACK -: LPDIENUMCREATEDEFFECTOBJECTSCALLBACK +: LPDIENUMCREATEDEFFECTOBJECTSCALLBACK ( quot -- callback ) [ "BOOL" { "LPDIRECTINPUTEFFECT" "LPVOID" } "stdcall" ] dip alien-callback ; inline TYPEDEF: void* LPDIENUMEFFECTSINFILECALLBACK -: LPDIENUMEFFECTSINFILECALLBACK +: LPDIENUMEFFECTSINFILECALLBACK ( quot -- callback ) [ "BOOL" { "LPCDIFILEEFFECT" "LPVOID" } "stdcall" ] dip alien-callback ; inline TYPEDEF: void* LPDIENUMDEVICEOBJECTSCALLBACKW -: LPDIENUMDEVICEOBJECTSCALLBACKW +: LPDIENUMDEVICEOBJECTSCALLBACKW ( quot -- callback ) [ "BOOL" { "LPCDIDEVICEOBJECTINSTANCEW" "LPVOID" } "stdcall" ] dip alien-callback ; inline diff --git a/extra/game-input/dinput/dinput.factor b/extra/game-input/dinput/dinput.factor index c6004a8221..a2beaf6d9b 100755 --- a/extra/game-input/dinput/dinput.factor +++ b/extra/game-input/dinput/dinput.factor @@ -2,10 +2,10 @@ USING: windows.dinput windows.dinput.constants parser alien.c-types windows.ole32 namespaces assocs kernel arrays vectors windows.kernel32 windows.com windows.dinput shuffle windows.user32 windows.messages sequences combinators locals -math.rectangles ui.windows accessors math windows alien +math.rectangles accessors math windows alien alien.strings io.encodings.utf16 io.encodings.utf16n continuations byte-arrays game-input.dinput.keys-array -game-input ; +game-input ui.backend.windows ; IN: game-input.dinput SINGLETON: dinput-game-input-backend diff --git a/extra/game-input/game-input.factor b/extra/game-input/game-input.factor index 46e3ba9e8d..6efe31861a 100755 --- a/extra/game-input/game-input.factor +++ b/extra/game-input/game-input.factor @@ -35,7 +35,7 @@ PRIVATE> ] when ; : with-game-input ( quot -- ) - open-game-input [ close-game-input ] [ ] cleanup ; + open-game-input [ close-game-input ] [ ] cleanup ; inline TUPLE: controller handle ; TUPLE: controller-state x y z rx ry rz slider pov buttons ; From 637d06a4f85066c70142a0c9d52552601b1bdc65 Mon Sep 17 00:00:00 2001 From: Slava Pestov Date: Tue, 24 Mar 2009 04:11:08 -0500 Subject: [PATCH 23/24] Add silly 'tip of the day' feature, and 'recently visited' list to UI browser home page --- basis/bootstrap/help/help.factor | 2 +- basis/bootstrap/tools/tools.factor | 1 - .../apropos/apropos-docs.factor | 6 ++- basis/help/apropos/apropos-tests.factor | 4 ++ basis/{tools => help}/apropos/apropos.factor | 8 +++- basis/help/handbook/handbook.factor | 14 +++---- basis/help/help-docs.factor | 1 + basis/help/home/authors.txt | 1 + basis/help/home/home-docs.factor | 19 +++++++++ basis/help/home/home.factor | 40 +++++++++++++++++++ basis/help/html/html.factor | 2 +- basis/help/tips/authors.txt | 1 + basis/help/tips/tips-docs.factor | 27 +++++++++++++ basis/help/tips/tips.factor | 38 ++++++++++++++++++ .../browser => help/vocabs}/authors.txt | 0 .../browser => help/vocabs}/summary.txt | 0 .../vocabs/browser => help/vocabs}/tags.txt | 0 .../vocabs/vocabs-docs.factor} | 2 +- basis/help/vocabs/vocabs-tests.factor | 5 +++ .../vocabs/vocabs.factor} | 17 ++++---- basis/tools/apropos/apropos-tests.factor | 4 -- .../tools/vocabs/browser/browser-tests.factor | 5 --- basis/ui/gadgets/editors/editors-docs.factor | 6 ++- basis/ui/tools/browser/browser.factor | 19 ++++----- basis/ui/tools/deploy/deploy-docs.factor | 4 +- .../listener/completion/completion.factor | 2 +- basis/ui/tools/listener/listener-docs.factor | 22 +++++++++- basis/ui/tools/listener/listener.factor | 22 +++++----- .../tools/operations/operations-docs.factor | 8 ++++ basis/ui/tools/operations/operations.factor | 4 +- basis/ui/tools/profiler/profiler-docs.factor | 11 +++++ basis/ui/tools/profiler/profiler.factor | 2 + basis/ui/tools/tools-docs.factor | 5 ++- core/parser/parser.factor | 2 +- core/strings/strings-docs.factor | 2 +- extra/demos/demos.factor | 2 +- extra/fuel/help/help.factor | 2 +- extra/galois-talk/galois-talk.factor | 2 +- .../google-tech-talk/google-tech-talk.factor | 2 +- extra/otug-talk/otug-talk.factor | 2 +- extra/vpri-talk/vpri-talk.factor | 2 +- 41 files changed, 245 insertions(+), 73 deletions(-) rename basis/{tools => help}/apropos/apropos-docs.factor (60%) create mode 100644 basis/help/apropos/apropos-tests.factor rename basis/{tools => help}/apropos/apropos.factor (94%) create mode 100644 basis/help/home/authors.txt create mode 100644 basis/help/home/home-docs.factor create mode 100644 basis/help/home/home.factor create mode 100644 basis/help/tips/authors.txt create mode 100644 basis/help/tips/tips-docs.factor create mode 100644 basis/help/tips/tips.factor rename basis/{tools/vocabs/browser => help/vocabs}/authors.txt (100%) rename basis/{tools/vocabs/browser => help/vocabs}/summary.txt (100%) rename basis/{tools/vocabs/browser => help/vocabs}/tags.txt (100%) rename basis/{tools/vocabs/browser/browser-docs.factor => help/vocabs/vocabs-docs.factor} (94%) create mode 100644 basis/help/vocabs/vocabs-tests.factor rename basis/{tools/vocabs/browser/browser.factor => help/vocabs/vocabs.factor} (96%) delete mode 100644 basis/tools/apropos/apropos-tests.factor delete mode 100644 basis/tools/vocabs/browser/browser-tests.factor create mode 100644 basis/ui/tools/operations/operations-docs.factor create mode 100644 basis/ui/tools/profiler/profiler-docs.factor diff --git a/basis/bootstrap/help/help.factor b/basis/bootstrap/help/help.factor index c3e74f7863..553b91a6ae 100644 --- a/basis/bootstrap/help/help.factor +++ b/basis/bootstrap/help/help.factor @@ -5,7 +5,7 @@ IN: bootstrap.help : load-help ( -- ) "help.lint" require - "tools.vocabs.browser" require + "help.vocabs" require "alien.syntax" require "compiler" require diff --git a/basis/bootstrap/tools/tools.factor b/basis/bootstrap/tools/tools.factor index c6ec7f0b99..b0afe4a1d9 100644 --- a/basis/bootstrap/tools/tools.factor +++ b/basis/bootstrap/tools/tools.factor @@ -14,7 +14,6 @@ IN: bootstrap.tools "tools.time" "tools.threads" "tools.vocabs" - "tools.vocabs.browser" "tools.vocabs.monitor" "editors" } [ require ] each diff --git a/basis/tools/apropos/apropos-docs.factor b/basis/help/apropos/apropos-docs.factor similarity index 60% rename from basis/tools/apropos/apropos-docs.factor rename to basis/help/apropos/apropos-docs.factor index b50b51b84f..4d774a75cb 100644 --- a/basis/tools/apropos/apropos-docs.factor +++ b/basis/help/apropos/apropos-docs.factor @@ -1,6 +1,8 @@ -IN: tools.apropos -USING: help.markup help.syntax strings ; +IN: help.apropos +USING: help.markup help.syntax strings help.tips ; HELP: apropos { $values { "str" string } } { $description "Lists all words, vocabularies and help articles whose name contains a subsequence equal to " { $snippet "str" } ". Results are ranked using a simple distance algorithm." } ; + +TIP: "Use " { $link apropos } " to search for words, vocabularies and help articles." ; \ No newline at end of file diff --git a/basis/help/apropos/apropos-tests.factor b/basis/help/apropos/apropos-tests.factor new file mode 100644 index 0000000000..3dbda475de --- /dev/null +++ b/basis/help/apropos/apropos-tests.factor @@ -0,0 +1,4 @@ +IN: help.apropos.tests +USING: help.apropos tools.test ; + +[ ] [ "swp" apropos ] unit-test diff --git a/basis/tools/apropos/apropos.factor b/basis/help/apropos/apropos.factor similarity index 94% rename from basis/tools/apropos/apropos.factor rename to basis/help/apropos/apropos.factor index c7126c10d0..b241db4c0e 100644 --- a/basis/tools/apropos/apropos.factor +++ b/basis/help/apropos/apropos.factor @@ -2,9 +2,9 @@ ! See http://factorcode.org/license.txt for BSD license. USING: accessors arrays assocs fry help.markup help.topics io kernel make math math.parser namespaces sequences sorting -summary tools.completion tools.vocabs tools.vocabs.browser +summary tools.completion tools.vocabs help.vocabs vocabs words unicode.case help ; -IN: tools.apropos +IN: help.apropos : $completions ( seq -- ) dup [ word? ] all? [ words-table ] [ @@ -67,5 +67,9 @@ M: apropos article-name article-title ; M: apropos article-content search>> 1array \ $apropos prefix ; +M: apropos >link ; + +INSTANCE: apropos topic + : apropos ( str -- ) print-topic ; diff --git a/basis/help/handbook/handbook.factor b/basis/help/handbook/handbook.factor index e048b66b7c..ed2a14a2f2 100644 --- a/basis/help/handbook/handbook.factor +++ b/basis/help/handbook/handbook.factor @@ -4,7 +4,7 @@ prettyprint.backend prettyprint.custom kernel.private io generic math system strings sbufs vectors byte-arrays quotations io.streams.byte-array classes.builtin parser lexer classes.predicate classes.union classes.intersection -classes.singleton classes.tuple tools.vocabs.browser math.parser +classes.singleton classes.tuple help.vocabs math.parser accessors ; IN: help.handbook @@ -278,11 +278,7 @@ ARTICLE: "handbook-library-reference" "Library reference" "This index only includes articles from loaded vocabularies. To explore more vocabularies, see " { $link "vocab-index" } "." { $index [ "handbook" orphan-articles remove ] } ; -ARTICLE: "handbook" "Factor documentation" -"Welcome to Factor." -$nl -"Explore the code base:" -{ $subsection "vocab-index" } +ARTICLE: "handbook" "Factor handbook" "Learn the language:" { $subsection "cookbook" } { $subsection "first-program" } @@ -290,11 +286,13 @@ $nl { $subsection "handbook-environment-reference" } { $subsection "ui" } { $subsection "handbook-library-reference" } -"The below indices only include articles from loaded vocabularies. To explore more vocabularies, see " { $link "vocab-index" } "." +"Explore loaded libraries:" { $subsection "article-index" } { $subsection "primitive-index" } { $subsection "error-index" } { $subsection "type-index" } -{ $subsection "class-index" } ; +{ $subsection "class-index" } +"Explore the code base:" +{ $subsection "vocab-index" } ; ABOUT: "handbook" diff --git a/basis/help/help-docs.factor b/basis/help/help-docs.factor index 733199fc60..547ee871aa 100644 --- a/basis/help/help-docs.factor +++ b/basis/help/help-docs.factor @@ -127,6 +127,7 @@ ARTICLE: "help" "Help system" { $subsection "browsing-help" } { $subsection "writing-help" } { $subsection "help.lint" } +{ $subsection "tips-of-the-day" } { $subsection "help-impl" } ; IN: help diff --git a/basis/help/home/authors.txt b/basis/help/home/authors.txt new file mode 100644 index 0000000000..d4f5d6b3ae --- /dev/null +++ b/basis/help/home/authors.txt @@ -0,0 +1 @@ +Slava Pestov \ No newline at end of file diff --git a/basis/help/home/home-docs.factor b/basis/help/home/home-docs.factor new file mode 100644 index 0000000000..d4d8a6206d --- /dev/null +++ b/basis/help/home/home-docs.factor @@ -0,0 +1,19 @@ +IN: help.home +USING: help.markup help.syntax ; + +ARTICLE: "help.home" "Factor documentation" +{ $heading "Starting points" } +{ $list + { $link "ui-listener" } + { $link "handbook" } + { $link "vocab-index" } +} +{ $heading "Recently visited" } +{ $table + { "Words" "Articles" "Vocabs" } + { { $recent recent-words } { $recent recent-articles } { $recent recent-vocabs } } +} print-element +{ $heading "Recent searches" } +{ $recent-searches } ; + +ABOUT: "help.home" \ No newline at end of file diff --git a/basis/help/home/home.factor b/basis/help/home/home.factor new file mode 100644 index 0000000000..b1b938cb45 --- /dev/null +++ b/basis/help/home/home.factor @@ -0,0 +1,40 @@ +! Copyright (C) 2009 Slava Pestov. +! See http://factorcode.org/license.txt for BSD license. +USING: arrays compiler.units fry hashtables help.topics io +kernel math namespaces sequences sets help.vocabs +help.apropos vocabs help.markup ; +IN: help.home + +SYMBOLS: recent-words recent-articles recent-vocabs recent-searches ; + +CONSTANT: recent-count 10 + +{ recent-words recent-articles recent-vocabs recent-searches } +[ [ V{ } clone ] initialize ] each + +GENERIC: add-recent-where ( obj -- obj symbol ) + +M: link add-recent-where recent-articles ; +M: word-link add-recent-where recent-words ; +M: vocab-spec add-recent-where recent-vocabs ; +M: apropos add-recent-where recent-searches ; +M: object add-recent-where f ; + +: $recent ( element -- ) + first get [ nl ] [ 1array $pretty-link ] interleave ; + +: $recent-searches ( element -- ) + drop recent-searches get [ nl ] [ ($link) ] interleave ; + +: redisplay-recent-page ( -- ) + "help.home" >link dup associate + notify-definition-observers ; + +: expire ( seq -- ) + [ length recent-count - [ 0 > ] keep ] keep + '[ 0 _ _ delete-slice ] when ; + +: add-recent ( obj -- ) + add-recent-where dup + [ get [ adjoin ] [ expire ] bi ] [ 2drop ] if + redisplay-recent-page ; \ No newline at end of file diff --git a/basis/help/html/html.factor b/basis/help/html/html.factor index cbeb8b362e..66d864b2a0 100644 --- a/basis/help/html/html.factor +++ b/basis/help/html/html.factor @@ -3,7 +3,7 @@ USING: io.encodings.utf8 io.encodings.ascii io.encodings.binary io.files io.files.temp io.directories html.streams help kernel assocs sequences make words accessors arrays help.topics vocabs -tools.vocabs tools.vocabs.browser namespaces prettyprint io +tools.vocabs help.vocabs namespaces prettyprint io vocabs.loader serialize fry memoize unicode.case math.order sorting debugger html xml.syntax xml.writer ; IN: help.html diff --git a/basis/help/tips/authors.txt b/basis/help/tips/authors.txt new file mode 100644 index 0000000000..d4f5d6b3ae --- /dev/null +++ b/basis/help/tips/authors.txt @@ -0,0 +1 @@ +Slava Pestov \ No newline at end of file diff --git a/basis/help/tips/tips-docs.factor b/basis/help/tips/tips-docs.factor new file mode 100644 index 0000000000..7148b25a37 --- /dev/null +++ b/basis/help/tips/tips-docs.factor @@ -0,0 +1,27 @@ +IN: help.tips +USING: help.markup help.syntax debugger ; + +TIP: "To look at the most recent error, run " { $link :error } ". To look at the most recent error's callstack, run " { $link :c } "." ; + +TIP: "Learn to use " { $link "dataflow-combinators" } "." ; + +TIP: "Learn to use " { $link "editor" } " to be able to jump to the source code for word definitions from the listener." ; + +TIP: "Check out " { $url "http://concatenative.org/wiki/view/Factor/FAQ" } " to get answers to frequently-asked questions." ; + +TIP: "Drop by the " { $snippet "#concatenative" } " IRC channel on " { $snippet "irc.freenode.net" } " some time." ; + +TIP: "You can write documentation for your own code using the " { $link "help" } "." ; + +TIP: "You can write graphical applications using the " { $link "ui" } "." ; + +ARTICLE: "all-tips-of-the-day" "All tips of the day" +{ $tips-of-the-day } ; + +ARTICLE: "tips-of-the-day" "Tips of the day" +"The " { $vocab-link "help.tips" } " vocabulary provides a facility for displaying tips of the day in the " { $link "ui-listener" } ". Tips are defined with a parsing word:" +{ $subsection POSTPONE: TIP: } +"All tips defined so far:" +{ $subsection "all-tips-of-the-day" } ; + +ABOUT: "tips-of-the-day" \ No newline at end of file diff --git a/basis/help/tips/tips.factor b/basis/help/tips/tips.factor new file mode 100644 index 0000000000..8d173ce533 --- /dev/null +++ b/basis/help/tips/tips.factor @@ -0,0 +1,38 @@ +! Copyright (C) 2009 Slava Pestov. +! See http://factorcode.org/license.txt for BSD license. +USING: parser arrays namespaces sequences random help.markup kernel io +io.styles colors.constants ; +IN: help.tips + +SYMBOL: tips + +tips [ V{ } clone ] initialize + +SYNTAX: TIP: parse-definition >array tips get push ; + +: a-tip ( -- tip ) tips get random ; + +SYMBOL: tip-of-the-day-style + +H{ + { page-color COLOR: lavender } + { border-width 5 } + { wrap-margin 500 } +} tip-of-the-day-style set-global + +: $tip-of-the-day ( element -- ) + drop + [ + tip-of-the-day-style get + [ + last-element off + "Tip of the day" $heading a-tip print-element nl + "— " print-element "all-tips-of-the-day" ($link) + ] + with-nesting + ] ($heading) ; + +: tip-of-the-day. ( -- ) { $tip-of-the-day } print-content nl ; + +: $tips-of-the-day ( element -- ) + drop tips get [ nl nl ] [ print-element ] interleave ; \ No newline at end of file diff --git a/basis/tools/vocabs/browser/authors.txt b/basis/help/vocabs/authors.txt similarity index 100% rename from basis/tools/vocabs/browser/authors.txt rename to basis/help/vocabs/authors.txt diff --git a/basis/tools/vocabs/browser/summary.txt b/basis/help/vocabs/summary.txt similarity index 100% rename from basis/tools/vocabs/browser/summary.txt rename to basis/help/vocabs/summary.txt diff --git a/basis/tools/vocabs/browser/tags.txt b/basis/help/vocabs/tags.txt similarity index 100% rename from basis/tools/vocabs/browser/tags.txt rename to basis/help/vocabs/tags.txt diff --git a/basis/tools/vocabs/browser/browser-docs.factor b/basis/help/vocabs/vocabs-docs.factor similarity index 94% rename from basis/tools/vocabs/browser/browser-docs.factor rename to basis/help/vocabs/vocabs-docs.factor index 723c4ac483..5f1a97205e 100644 --- a/basis/tools/vocabs/browser/browser-docs.factor +++ b/basis/help/vocabs/vocabs-docs.factor @@ -1,5 +1,5 @@ USING: help.markup help.syntax io strings ; -IN: tools.vocabs.browser +IN: help.vocabs ARTICLE: "vocab-tags" "Vocabulary tags" { $all-tags } ; diff --git a/basis/help/vocabs/vocabs-tests.factor b/basis/help/vocabs/vocabs-tests.factor new file mode 100644 index 0000000000..f03e0b3337 --- /dev/null +++ b/basis/help/vocabs/vocabs-tests.factor @@ -0,0 +1,5 @@ +IN: help.vocabs.tests +USING: help.vocabs tools.test help.markup help vocabs ; + +[ ] [ { $vocab "scratchpad" } print-content ] unit-test +[ ] [ "classes" vocab print-topic ] unit-test \ No newline at end of file diff --git a/basis/tools/vocabs/browser/browser.factor b/basis/help/vocabs/vocabs.factor similarity index 96% rename from basis/tools/vocabs/browser/browser.factor rename to basis/help/vocabs/vocabs.factor index c9ade7aae2..13bb0cdf3e 100644 --- a/basis/tools/vocabs/browser/browser.factor +++ b/basis/help/vocabs/vocabs.factor @@ -6,17 +6,16 @@ classes.singleton classes.tuple classes.union combinators definitions effects fry generic help help.markup help.stylesheet help.topics io io.files io.pathnames io.styles kernel macros make namespaces prettyprint sequences sets sorting summary -tools.vocabs vocabs vocabs.loader words words.symbol -combinators.smart definitions.icons ; -IN: tools.vocabs.browser +tools.vocabs vocabs vocabs.loader words words.symbol definitions.icons ; +IN: help.vocabs + +: $pretty-link ( element -- ) + [ first definition-icon 1array $image " " print-element ] + [ $definition-link ] + bi ; : <$pretty-link> ( definition -- element ) - [ - [ definition-icon 1array \ $image prefix ] - [ drop " " ] - [ 1array \ $definition-link prefix ] - tri - ] output>array ; + 1array \ $pretty-link prefix ; : vocab-row ( vocab -- row ) [ <$pretty-link> ] [ vocab-summary ] bi 2array ; diff --git a/basis/tools/apropos/apropos-tests.factor b/basis/tools/apropos/apropos-tests.factor deleted file mode 100644 index 96ce9d3186..0000000000 --- a/basis/tools/apropos/apropos-tests.factor +++ /dev/null @@ -1,4 +0,0 @@ -IN: tools.apropos.tests -USING: tools.apropos tools.test ; - -[ ] [ "swp" apropos ] unit-test diff --git a/basis/tools/vocabs/browser/browser-tests.factor b/basis/tools/vocabs/browser/browser-tests.factor deleted file mode 100644 index 385d1b2d46..0000000000 --- a/basis/tools/vocabs/browser/browser-tests.factor +++ /dev/null @@ -1,5 +0,0 @@ -IN: tools.vocabs.browser.tests -USING: tools.vocabs.browser tools.test help.markup help vocabs ; - -[ ] [ { $vocab "scratchpad" } print-content ] unit-test -[ ] [ "classes" vocab print-topic ] unit-test \ No newline at end of file diff --git a/basis/ui/gadgets/editors/editors-docs.factor b/basis/ui/gadgets/editors/editors-docs.factor index 244e36d640..0ad37cb10f 100644 --- a/basis/ui/gadgets/editors/editors-docs.factor +++ b/basis/ui/gadgets/editors/editors-docs.factor @@ -1,6 +1,6 @@ USING: documents help.markup help.syntax ui.gadgets ui.gadgets.scrollers models strings ui.commands -ui.text colors fonts ; +ui.text colors fonts help.tips ; IN: ui.gadgets.editors HELP: editor @@ -109,4 +109,8 @@ ARTICLE: "ui.gadgets.editors" "Editor gadgets" "Editors edit " { $emphasis "documents" } ":" { $subsection "documents" } ; +TIP: "Editor gadgets support undo and redo; press " { $command editor "editing" com-undo } " and " { $command editor "editing" com-redo } "." ; + +TIP: "Learn the keyboard shortcuts used in " { $link "ui.gadgets.editors" } "." ; + ABOUT: "ui.gadgets.editors" diff --git a/basis/ui/tools/browser/browser.factor b/basis/ui/tools/browser/browser.factor index 078ece6546..e1dcba9910 100644 --- a/basis/ui/tools/browser/browser.factor +++ b/basis/ui/tools/browser/browser.factor @@ -1,10 +1,11 @@ ! Copyright (C) 2006, 2009 Slava Pestov. ! See http://factorcode.org/license.txt for BSD license. -USING: debugger help help.topics help.crossref kernel models compiler.units -assocs words vocabs accessors fry combinators.short-circuit -sequences models models.history tools.apropos combinators -ui.commands ui.gadgets ui.gadgets.panes ui.gadgets.scrollers -ui.gadgets.tracks ui.gestures ui.gadgets.buttons ui.gadgets.packs +USING: debugger help help.topics help.crossref help.home kernel +models compiler.units assocs words vocabs accessors fry +combinators.short-circuit namespaces sequences models +models.history help.apropos combinators ui.commands ui.gadgets +ui.gadgets.panes ui.gadgets.scrollers ui.gadgets.tracks +ui.gestures ui.gadgets.buttons ui.gadgets.packs ui.gadgets.editors ui.gadgets.labels ui.gadgets.status-bar ui.gadgets.glass ui.gadgets.borders ui.tools.common ui.tools.browser.popups ui ; @@ -15,8 +16,8 @@ TUPLE: browser-gadget < tool pane scroller search-field popup ; { 650 400 } browser-gadget set-tool-dim : show-help ( link browser-gadget -- ) - model>> dup add-history - [ >link ] dip set-model ; + [ >link ] [ model>> ] bi* + [ [ add-recent ] [ add-history ] bi* ] [ set-model ] 2bi ; : ( browser-gadget -- gadget ) model>> [ '[ _ print-topic ] try ] ; @@ -96,7 +97,7 @@ M: browser-gadget focusable-child* search-field>> ; : com-forward ( browser -- ) model>> go-forward ; -: com-documentation ( browser -- ) "handbook" swap show-help ; +: com-documentation ( browser -- ) "help.home" swap show-help ; : browser-help ( -- ) "ui-browser" com-browse ; @@ -113,7 +114,7 @@ browser-gadget "toolbar" f { over [ show-help ] [ 2drop ] if ; : navigate ( browser quot -- ) - '[ control-value @ ] keep ?show-help ; + '[ control-value @ ] keep ?show-help ; inline : com-up ( browser -- ) [ article-parent ] navigate ; diff --git a/basis/ui/tools/deploy/deploy-docs.factor b/basis/ui/tools/deploy/deploy-docs.factor index e625d26c60..b0a2fb6cf9 100644 --- a/basis/ui/tools/deploy/deploy-docs.factor +++ b/basis/ui/tools/deploy/deploy-docs.factor @@ -1,4 +1,4 @@ -USING: help.markup help.syntax ; +USING: help.markup help.syntax help.tips ; IN: ui.tools.deploy HELP: deploy-tool @@ -14,4 +14,6 @@ $nl "Alternatively, right-click on a vocabulary presentation in the UI and choose " { $strong "Deploy tool" } " from the resulting popup menu." { $see-also "tools.deploy" } ; +TIP: "Generate stand-alone applications from vocabularies with the " { $link "ui.tools.deploy" } "." ; + ABOUT: "ui.tools.deploy" diff --git a/basis/ui/tools/listener/completion/completion.factor b/basis/ui/tools/listener/completion/completion.factor index 0f357cb0af..022a2daabf 100644 --- a/basis/ui/tools/listener/completion/completion.factor +++ b/basis/ui/tools/listener/completion/completion.factor @@ -3,7 +3,7 @@ USING: accessors arrays assocs calendar colors colors.constants documents documents.elements fry kernel words sets splitting math math.vectors models.delay models.arrow combinators.short-circuit -parser present sequences tools.completion tools.vocabs.browser generic +parser present sequences tools.completion help.vocabs generic generic.standard.engines.tuple fonts definitions.icons ui.images ui.commands ui.operations ui.gadgets ui.gadgets.editors ui.gadgets.glass ui.gadgets.scrollers ui.gadgets.tables diff --git a/basis/ui/tools/listener/listener-docs.factor b/basis/ui/tools/listener/listener-docs.factor index caff45e40e..afe890b9c5 100644 --- a/basis/ui/tools/listener/listener-docs.factor +++ b/basis/ui/tools/listener/listener-docs.factor @@ -1,5 +1,7 @@ USING: help.markup help.syntax ui.commands ui.operations -ui.gadgets.editors ui.gadgets.panes listener io words ; +ui.gadgets.editors ui.gadgets.panes listener io words +ui.tools.listener.completion ui.tools.common help.tips +tools.vocabs vocabs ; IN: ui.tools.listener HELP: interactor @@ -21,11 +23,27 @@ ARTICLE: "ui-listener" "UI listener" { $operations \ word } { $heading "Vocabulary commands" } "These words operate on the vocabulary at the cursor." -{ $operations \ word } +{ $operations T{ vocab-link f "kernel" } } { $command-map interactor "quotation" } { $heading "Editing commands" } "The text editing commands are standard; see " { $link "gadgets-editors-commands" } "." { $heading "Implementation" } "Listeners are instances of " { $link listener-gadget } ". The listener consists of an output area (instance of " { $link pane } ") and an input area (instance of " { $link interactor } "). Clickable presentations can also be printed to the listener; see " { $link "ui-presentations" } "." ; +TIP: "You can read documentation by pressing F1." ; + +TIP: "The listener tool remembers previous lines of input. Press " { $command interactor "completion" recall-previous } " and " { $command interactor "completion" recall-next } " to cycle through them." ; + +TIP: "When you mouse over certain objects, a block border will appear. Left-clicking on such an object will perform the default operation. Right-clicking will show a menu with all operations." ; + +TIP: "The status bar displays stack effects of recognized words as they are being typed in." ; + +TIP: "Press " { $command interactor "completion" code-completion-popup } " to complete word, vocabulary and Unicode character names. The latter two features become available if the cursor is after a " { $link POSTPONE: USE: } ", " { $link POSTPONE: USING: } " or " { $link POSTPONE: CHAR: } "." ; + +TIP: "If a word's vocabulary is loaded, but not in the search path, you can use restarts to add the vocabulary to the search path. Auto-use mode (" { $command listener-gadget "toolbar" com-auto-use } ") invokes restarts automatically if there is only one restart." ; + +TIP: "Scroll the listener from the keyboard by pressing " { $command listener-gadget "scrolling" com-page-up } " and " { $command listener-gadget "scrolling" com-page-down } "." ; + +TIP: "Press " { $command tool "common" refresh-all } " or run " { $link refresh-all } " to reload changed source files from disk. " ; + ABOUT: "ui-listener" \ No newline at end of file diff --git a/basis/ui/tools/listener/listener.factor b/basis/ui/tools/listener/listener.factor index 5efcd01eec..91448dfe10 100644 --- a/basis/ui/tools/listener/listener.factor +++ b/basis/ui/tools/listener/listener.factor @@ -2,12 +2,13 @@ ! See http://factorcode.org/license.txt for BSD license. USING: accessors arrays assocs calendar combinators locals colors.constants combinators.short-circuit compiler.units -concurrency.flags concurrency.mailboxes continuations destructors -documents documents.elements fry hashtables help help.markup io -io.styles kernel lexer listener math models models.delay models.arrow -namespaces parser prettyprint quotations sequences strings threads -tools.vocabs vocabs vocabs.loader vocabs.parser words debugger ui ui.commands -ui.pens.solid ui.gadgets ui.gadgets.glass ui.gadgets.buttons ui.gadgets.editors +help.tips concurrency.flags concurrency.mailboxes continuations +destructors documents documents.elements fry hashtables help +help.markup io io.styles kernel lexer listener math models +models.delay models.arrow namespaces parser prettyprint quotations +sequences strings threads tools.vocabs vocabs vocabs.loader +vocabs.parser words debugger ui ui.commands ui.pens.solid ui.gadgets +ui.gadgets.glass ui.gadgets.buttons ui.gadgets.editors ui.gadgets.labeled ui.gadgets.panes ui.gadgets.scrollers ui.gadgets.status-bar ui.gadgets.tracks ui.gadgets.borders ui.gestures ui.operations ui.tools.browser ui.tools.common ui.tools.debugger @@ -354,16 +355,11 @@ interactor "completion" f { { T{ key-down f { C+ } "r" } history-completion-popup } } define-command-map -: welcome. ( -- ) - "If this is your first time with Factor, please read the " print - "handbook" ($link) ". To see a list of keyboard shortcuts," print - "press F1." print nl ; - : listener-thread ( listener -- ) dup listener-streams [ [ com-browse ] help-hook set '[ [ _ input>> ] 2dip debugger-popup ] error-hook set - welcome. + tip-of-the-day. nl listener ] with-streams* ; @@ -385,7 +381,7 @@ interactor "completion" f { [ wait-for-listener ] } cleave ; -: listener-help ( -- ) "ui-listener" com-browse ; +: listener-help ( -- ) "help.home" com-browse ; \ listener-help H{ { +nullary+ t } } define-command diff --git a/basis/ui/tools/operations/operations-docs.factor b/basis/ui/tools/operations/operations-docs.factor new file mode 100644 index 0000000000..455e4f5ccc --- /dev/null +++ b/basis/ui/tools/operations/operations-docs.factor @@ -0,0 +1,8 @@ +USING: help.tips help.markup help.syntax ui.operations +tools.walker tools.time tools.profiler ui.tools.operations ; + +TIP: "Press " { $operation com-stack-effect } " to print the stack effect of the code in the input field without executing it (" { $link "inference" } ")." ; + +TIP: "Press " { $operation walk } " to single-step through the code in the input field (" { $link "ui-walker" } ")." ; + +TIP: "Press " { $operation time } " to time execution of the code in the input field (" { $link "timing" } ")." ; diff --git a/basis/ui/tools/operations/operations.factor b/basis/ui/tools/operations/operations.factor index 6d6cda1dba..28781e24bb 100644 --- a/basis/ui/tools/operations/operations.factor +++ b/basis/ui/tools/operations/operations.factor @@ -9,7 +9,7 @@ compiler.units accessors vocabs.parser macros.expander ui ui.tools.browser ui.tools.listener ui.tools.listener.completion ui.tools.profiler ui.tools.inspector ui.tools.traceback ui.commands ui.gadgets.editors ui.gestures ui.operations -ui.tools.deploy models ; +ui.tools.deploy models help.tips ; IN: ui.tools.operations ! Objects @@ -157,8 +157,6 @@ M: word com-stack-effect 1quotation com-stack-effect ; { +listener+ t } } define-operation -: com-profile ( quot -- ) profile profiler-window ; - [ quotation? ] \ com-profile H{ { +keyboard+ T{ key-down f { C+ } "o" } } { +listener+ t } diff --git a/basis/ui/tools/profiler/profiler-docs.factor b/basis/ui/tools/profiler/profiler-docs.factor new file mode 100644 index 0000000000..a54a29c6a1 --- /dev/null +++ b/basis/ui/tools/profiler/profiler-docs.factor @@ -0,0 +1,11 @@ +IN: ui.tools.profiler +USING: help.markup help.syntax ui.operations help.tips ; + +ARTICLE: "ui.tools.profiler" "UI profiler tool" +"The " { $vocab-link "ui.tools.profiler" } " vocabulary implements a graphical tool for viewing profiling results (see " { $link "tools.profiler" } ")." +$nl +"To use the profiler, enter a piece of code in the listener's input area and press " { $operation com-profile } "." ; + +TIP: "Press " { $operation com-profile } " to run the code in the input field with profiling enabled (" { $link "ui.tools.profiler" } ")." ; + +ABOUT: "ui.tools.profiler" \ No newline at end of file diff --git a/basis/ui/tools/profiler/profiler.factor b/basis/ui/tools/profiler/profiler.factor index bbd9237c87..6bca4b40c4 100644 --- a/basis/ui/tools/profiler/profiler.factor +++ b/basis/ui/tools/profiler/profiler.factor @@ -208,4 +208,6 @@ profiler-gadget "toolbar" f { : profiler-window ( -- ) "Profiling results" open-status-window ; +: com-profile ( quot -- ) profile profiler-window ; + MAIN: profiler-window \ No newline at end of file diff --git a/basis/ui/tools/tools-docs.factor b/basis/ui/tools/tools-docs.factor index d3078cc178..c591775429 100644 --- a/basis/ui/tools/tools-docs.factor +++ b/basis/ui/tools/tools-docs.factor @@ -1,7 +1,8 @@ USING: editors help.markup help.syntax summary inspector io io.styles listener parser prettyprint tools.profiler tools.walker ui.commands ui.gadgets.panes ui.gadgets.presentations ui.operations -ui.tools.operations ui.tools.profiler ui.tools.common vocabs see ; +ui.tools.operations ui.tools.profiler ui.tools.common vocabs see +help.tips ; IN: ui.tools ARTICLE: "starting-ui-tools" "Starting the UI tools" @@ -67,4 +68,6 @@ $nl "Platform-specific features:" { $subsection "ui-cocoa" } ; +TIP: "All UI developer tools support a common set of " { $link "ui-shortcuts" } ". Each individual tool has its own shortcuts as well; the F1 key is context-sensitive." ; + ABOUT: "ui-tools" diff --git a/core/parser/parser.factor b/core/parser/parser.factor index 871f7c5321..b71f6ed3be 100644 --- a/core/parser/parser.factor +++ b/core/parser/parser.factor @@ -166,6 +166,7 @@ SYMBOL: interactive-vocabs "definitions" "editors" "help" + "help.apropos" "help.lint" "inspector" "io" @@ -186,7 +187,6 @@ SYMBOL: interactive-vocabs "strings" "syntax" "tools.annotations" - "tools.apropos" "tools.crossref" "tools.disassembler" "tools.memory" diff --git a/core/strings/strings-docs.factor b/core/strings/strings-docs.factor index 2aa8ef421c..22e8bfcb62 100644 --- a/core/strings/strings-docs.factor +++ b/core/strings/strings-docs.factor @@ -1,6 +1,6 @@ USING: arrays byte-arrays help.markup help.syntax kernel kernel.private strings.private sequences vectors -sbufs math tools.vocabs.browser ; +sbufs math help.vocabs ; IN: strings ARTICLE: "strings" "Strings" diff --git a/extra/demos/demos.factor b/extra/demos/demos.factor index fd7aafb601..8c55945105 100644 --- a/extra/demos/demos.factor +++ b/extra/demos/demos.factor @@ -1,6 +1,6 @@ USING: kernel fry sequences - vocabs.loader tools.vocabs.browser + vocabs.loader help.vocabs ui ui.gadgets ui.gadgets.buttons ui.gadgets.packs ui.gadgets.scrollers ui.tools.listener accessors ; diff --git a/extra/fuel/help/help.factor b/extra/fuel/help/help.factor index 6368e542a7..30d6845a9b 100644 --- a/extra/fuel/help/help.factor +++ b/extra/fuel/help/help.factor @@ -3,7 +3,7 @@ USING: accessors arrays assocs combinators help help.crossref help.markup help.topics io io.streams.string kernel make namespaces -parser prettyprint sequences summary tools.vocabs tools.vocabs.browser +parser prettyprint sequences summary tools.vocabs help.vocabs vocabs vocabs.loader words see ; IN: fuel.help diff --git a/extra/galois-talk/galois-talk.factor b/extra/galois-talk/galois-talk.factor index ccba90fb6f..be713542ed 100644 --- a/extra/galois-talk/galois-talk.factor +++ b/extra/galois-talk/galois-talk.factor @@ -2,7 +2,7 @@ ! See http://factorcode.org/license.txt for BSD license. USING: slides help.markup math arrays hashtables namespaces sequences kernel sequences parser memoize io.encodings.binary -locals kernel.private tools.vocabs.browser assocs quotations +locals kernel.private help.vocabs assocs quotations urls peg.ebnf tools.vocabs tools.annotations tools.crossref help.topics math.functions compiler.tree.optimizer compiler.cfg.optimizer fry ; diff --git a/extra/google-tech-talk/google-tech-talk.factor b/extra/google-tech-talk/google-tech-talk.factor index 4d4e3b0507..ab8e72fc76 100644 --- a/extra/google-tech-talk/google-tech-talk.factor +++ b/extra/google-tech-talk/google-tech-talk.factor @@ -2,7 +2,7 @@ ! See http://factorcode.org/license.txt for BSD license. USING: slides help.markup math arrays hashtables namespaces sequences kernel sequences parser memoize io.encodings.binary -locals kernel.private tools.vocabs.browser assocs quotations +locals kernel.private help.vocabs assocs quotations urls peg.ebnf tools.vocabs tools.annotations tools.crossref help.topics math.functions compiler.tree.optimizer compiler.cfg.optimizer fry ; diff --git a/extra/otug-talk/otug-talk.factor b/extra/otug-talk/otug-talk.factor index 2ce307ce20..b7256246fe 100644 --- a/extra/otug-talk/otug-talk.factor +++ b/extra/otug-talk/otug-talk.factor @@ -2,7 +2,7 @@ ! See http://factorcode.org/license.txt for BSD license. USING: slides help.markup math arrays hashtables namespaces sequences kernel sequences parser memoize io.encodings.binary locals -kernel.private tools.vocabs.browser assocs quotations tools.vocabs +kernel.private help.vocabs assocs quotations tools.vocabs tools.annotations tools.crossref help.topics math.functions compiler.tree.optimizer compiler.cfg.optimizer fry ui.gadgets.panes tetris tetris.game combinators generalizations multiline diff --git a/extra/vpri-talk/vpri-talk.factor b/extra/vpri-talk/vpri-talk.factor index 5d7620101f..1e5c9602b9 100644 --- a/extra/vpri-talk/vpri-talk.factor +++ b/extra/vpri-talk/vpri-talk.factor @@ -2,7 +2,7 @@ ! See http://factorcode.org/license.txt for BSD license. USING: slides help.markup math arrays hashtables namespaces sequences kernel sequences parser memoize io.encodings.binary -locals kernel.private tools.vocabs.browser assocs quotations +locals kernel.private help.vocabs assocs quotations urls peg.ebnf tools.vocabs tools.annotations tools.crossref help.topics math.functions compiler.tree.optimizer compiler.cfg.optimizer fry ; From 577522fe0f4e71a708dce3d9d71f793f9ad3940e Mon Sep 17 00:00:00 2001 From: Slava Pestov Date: Tue, 24 Mar 2009 08:56:59 -0500 Subject: [PATCH 24/24] Fix ui.tools.profiler help lint --- basis/ui/tools/profiler/profiler-docs.factor | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/basis/ui/tools/profiler/profiler-docs.factor b/basis/ui/tools/profiler/profiler-docs.factor index a54a29c6a1..e2a0ef5f4e 100644 --- a/basis/ui/tools/profiler/profiler-docs.factor +++ b/basis/ui/tools/profiler/profiler-docs.factor @@ -2,7 +2,7 @@ IN: ui.tools.profiler USING: help.markup help.syntax ui.operations help.tips ; ARTICLE: "ui.tools.profiler" "UI profiler tool" -"The " { $vocab-link "ui.tools.profiler" } " vocabulary implements a graphical tool for viewing profiling results (see " { $link "tools.profiler" } ")." +"The " { $vocab-link "ui.tools.profiler" } " vocabulary implements a graphical tool for viewing profiling results (see " { $link "profiling" } ")." $nl "To use the profiler, enter a piece of code in the listener's input area and press " { $operation com-profile } "." ;