Merge branch 'master' of git://factorcode.org/git/factor

db4
John Benediktsson 2009-03-25 14:22:54 -07:00
commit eeec4853f3
27 changed files with 139 additions and 70 deletions

View File

@ -98,17 +98,13 @@ netbsd-x86-32:
netbsd-x86-64: netbsd-x86-64:
$(MAKE) $(EXECUTABLE) CONFIG=vm/Config.netbsd.x86.64 $(MAKE) $(EXECUTABLE) CONFIG=vm/Config.netbsd.x86.64
macosx-freetype: macosx-ppc:
ln -sf libfreetype.6.dylib \
Factor.app/Contents/Frameworks/libfreetype.dylib
macosx-ppc: macosx-freetype
$(MAKE) $(EXECUTABLE) macosx.app CONFIG=vm/Config.macosx.ppc $(MAKE) $(EXECUTABLE) macosx.app CONFIG=vm/Config.macosx.ppc
macosx-x86-32: macosx-freetype macosx-x86-32:
$(MAKE) $(EXECUTABLE) macosx.app CONFIG=vm/Config.macosx.x86.32 $(MAKE) $(EXECUTABLE) macosx.app CONFIG=vm/Config.macosx.x86.32
macosx-x86-64: macosx-freetype macosx-x86-64:
$(MAKE) $(EXECUTABLE) macosx.app CONFIG=vm/Config.macosx.x86.64 $(MAKE) $(EXECUTABLE) macosx.app CONFIG=vm/Config.macosx.x86.64
linux-x86-32: linux-x86-32:

View File

@ -1,5 +1,8 @@
IN: compiler.tree.debugger.tests IN: compiler.tree.debugger.tests
USING: compiler.tree.debugger tools.test ; USING: compiler.tree.debugger tools.test sorting sequences io ;
\ optimized. must-infer \ optimized. must-infer
\ optimizer-report. must-infer \ optimizer-report. must-infer
[ [ <=> ] sort ] optimized.
[ <reversed> [ print ] each ] optimizer-report.

View File

@ -160,7 +160,7 @@ SYMBOL: node-count
{ [ dup generic? ] [ generics-called ] } { [ dup generic? ] [ generics-called ] }
{ [ dup method-body? ] [ methods-called ] } { [ dup method-body? ] [ methods-called ] }
[ words-called ] [ words-called ]
} cond inc-at } cond get inc-at
] [ drop ] if ] [ drop ] if
] each-node ] each-node
node-count set node-count set

View File

@ -0,0 +1,12 @@
IN: definitions.icons
USING: help.markup help.syntax ;
ARTICLE: "definitions.icons" "Definition icons"
"The " { $vocab-link "definitions.icons" } " vocabulary associates common definition types with icons."
{ $definition-icons }
"Looking up the icon associated with a definition:"
{ $subsection definition-icon }
"Defining new icons:"
{ $subsection POSTPONE: ICON: } ;
ABOUT: "definitions.icons"

View File

@ -2,22 +2,29 @@
! See http://factorcode.org/license.txt for BSD license. ! See http://factorcode.org/license.txt for BSD license.
USING: assocs classes.predicate fry generic io.pathnames kernel USING: assocs classes.predicate fry generic io.pathnames kernel
macros sequences vocabs words words.symbol words.constant macros sequences vocabs words words.symbol words.constant
lexer parser help.topics ; lexer parser help.topics help.markup namespaces sorting ;
IN: definitions.icons IN: definitions.icons
GENERIC: definition-icon ( definition -- path ) GENERIC: definition-icon ( definition -- path )
<PRIVATE
: definition-icon-path ( string -- string' ) : definition-icon-path ( string -- string' )
"resource:basis/definitions/icons/" prepend-path ".tiff" append ; "vocab:definitions/icons/" prepend-path ".tiff" append ;
<< <<
SYNTAX: ICON: SYMBOL: icons
scan-word \ definition-icon create-method
scan '[ drop _ definition-icon-path ] icons [ H{ } clone ] initialize
define ;
: define-icon ( class name -- )
[ swap icons get set-at ]
[
[ \ definition-icon create-method ]
[ '[ drop _ definition-icon-path ] ] bi*
define
] 2bi ;
SYNTAX: ICON: scan-word scan define-icon ;
>> >>
@ -29,12 +36,15 @@ ICON: primitive primitive-word
ICON: symbol symbol-word ICON: symbol symbol-word
ICON: constant constant-word ICON: constant constant-word
ICON: word normal-word ICON: word normal-word
ICON: vocab-link unopen-vocab
ICON: word-link word-help-article ICON: word-link word-help-article
ICON: link help-article ICON: link help-article
ICON: runnable-vocab runnable-vocab
ICON: vocab open-vocab
ICON: vocab-link unopen-vocab
PRIVATE> : $definition-icons ( element -- )
drop
M: vocab definition-icon icons get >alist sort-keys
vocab-main "runnable-vocab" "open-vocab" ? definition-icon-path ; [ [ <$link> ] [ definition-icon-path <$image> ] bi* swap ] assoc-map
{ "" "Definition class" } prefix
$table ;

View File

@ -11,10 +11,7 @@ HELP: article-parent
HELP: help-path HELP: help-path
{ $values { "topic" "an article name or a word" } { "seq" "a new sequence" } } { $values { "topic" "an article name or a word" } { "seq" "a new sequence" } }
{ $description "Outputs a sequence of all help articles which contain " { $snippet "topic" } " as a subsection, traversing all the way up to the root." } { $description "Outputs a sequence of all help articles which contain " { $snippet "topic" } " as a subsection, traversing all the way up to the root." } ;
{ $examples
{ $example "USING: help.crossref prettyprint ;" "\"sequences\" help-path ." "{ \"collections\" \"handbook-language-reference\" \"handbook\" }" }
} ;
HELP: xref-article HELP: xref-article
{ $values { "topic" "an article name or a word" } } { $values { "topic" "an article name or a word" } }

View File

@ -69,12 +69,6 @@ ARTICLE: "element-types" "Element types"
IN: help.markup IN: help.markup
ABOUT: "element-types" ABOUT: "element-types"
ARTICLE: "browsing-help" "Browsing documentation"
"The easiest way to browse the help is from the help browser tool in the UI, however you can also display help topics in the listener. Help topics are identified by article name strings, or words. You can request a specific help topic:"
{ $subsection help }
"You can also display the main help article for a vocabulary:"
{ $subsection about } ;
ARTICLE: "writing-help" "Writing documentation" ARTICLE: "writing-help" "Writing documentation"
"By convention, documentation is written in files whose names end with " { $snippet "-docs.factor" } ". Vocabulary documentation should be placed in the same directory as the vocabulary source code; see " { $link "vocabs.loader" } "." "By convention, documentation is written in files whose names end with " { $snippet "-docs.factor" } ". Vocabulary documentation should be placed in the same directory as the vocabulary source code; see " { $link "vocabs.loader" } "."
$nl $nl
@ -148,11 +142,6 @@ HELP: help
{ $description { $description
"Displays a help topic." "Displays a help topic."
} ; } ;
HELP: about
{ $values { "vocab" "a vocabulary specifier" } }
{ $description
"Displays the main help article for the vocabulary. The main help article is set with the " { $link POSTPONE: ABOUT: } " parsing word."
} ;
HELP: :help HELP: :help
{ $description "Displays documentation for the most recent error." } ; { $description "Displays documentation for the most recent error." } ;

View File

@ -127,15 +127,6 @@ help-hook [ [ print-topic ] ] initialize
: help ( topic -- ) : help ( topic -- )
help-hook get call( topic -- ) ; help-hook get call( topic -- ) ;
: about ( vocab -- )
dup require
dup vocab [ ] [ no-vocab ] ?if
dup vocab-help [ help ] [
"The " write vocab-name write
" vocabulary does not define a main help article." print
"To define one, refer to \\ ABOUT: help" print
] ?if ;
: ($index) ( articles -- ) : ($index) ( articles -- )
sort-articles [ \ $subsection swap 2array ] map print-element ; sort-articles [ \ $subsection swap 2array ] map print-element ;

View File

@ -2,18 +2,22 @@ IN: help.home
USING: help.markup help.syntax ; USING: help.markup help.syntax ;
ARTICLE: "help.home" "Factor documentation" ARTICLE: "help.home" "Factor documentation"
{ $heading "Starting points" } "If this is your first time with Factor, you can start by writing " { $link "first-program" } "."
{ $heading "Reference" }
{ $list { $list
{ $link "ui-listener" }
{ $link "handbook" } { $link "handbook" }
{ $link "vocab-index" } { $link "vocab-index" }
{ $link "ui-tools" }
{ $link "handbook-library-reference" }
} }
{ $heading "Recently visited" } { $heading "Recently visited" }
{ $table { $table
{ "Words" "Articles" "Vocabs" } { "Words" "Articles" "Vocabs" }
{ { $recent recent-words } { $recent recent-articles } { $recent recent-vocabs } } { { $recent recent-words } { $recent recent-articles } { $recent recent-vocabs } }
} print-element }
"The browser, completion popups and other tools use a common set of " { $link "definitions.icons" } "."
{ $heading "Recent searches" } { $heading "Recent searches" }
{ $recent-searches } ; { $recent-searches }
"Use the search field in the top-right of the " { $link "ui-browser" } " window to search for words, vocabularies and help articles." ;
ABOUT: "help.home" ABOUT: "help.home"

View File

@ -24,7 +24,7 @@ M: object add-recent-where f ;
first get [ nl ] [ 1array $pretty-link ] interleave ; first get [ nl ] [ 1array $pretty-link ] interleave ;
: $recent-searches ( element -- ) : $recent-searches ( element -- )
drop recent-searches get [ nl ] [ ($link) ] interleave ; drop recent-searches get [ <$link> ] map $list ;
: redisplay-recent-page ( -- ) : redisplay-recent-page ( -- )
"help.home" >link dup associate "help.home" >link dup associate

View File

@ -140,6 +140,9 @@ ALIAS: $slot $snippet
: $image ( element -- ) : $image ( element -- )
[ [ "" ] dip first image associate format ] ($span) ; [ [ "" ] dip first image associate format ] ($span) ;
: <$image> ( path -- element )
1array \ $image prefix ;
! Some links ! Some links
: write-link ( string object -- ) : write-link ( string object -- )
link-style get [ write-object ] with-style ; link-style get [ write-object ] with-style ;

View File

@ -1,5 +1,6 @@
IN: help.tips IN: help.tips
USING: help.markup help.syntax debugger ; USING: help.markup help.syntax debugger prettyprint see help help.vocabs
help.apropos tools.time stack-checker editors ;
TIP: "To look at the most recent error, run " { $link :error } ". To look at the most recent error's callstack, run " { $link :c } "." ; TIP: "To look at the most recent error, run " { $link :error } ". To look at the most recent error's callstack, run " { $link :c } "." ;
@ -15,6 +16,8 @@ TIP: "You can write documentation for your own code using the " { $link "help" }
TIP: "You can write graphical applications using the " { $link "ui" } "." ; TIP: "You can write graphical applications using the " { $link "ui" } "." ;
TIP: "Power tools: " { $links see edit help about apropos time infer. } ;
ARTICLE: "all-tips-of-the-day" "All tips of the day" ARTICLE: "all-tips-of-the-day" "All tips of the day"
{ $tips-of-the-day } ; { $tips-of-the-day } ;

View File

@ -1,4 +1,4 @@
USING: help.markup help.syntax io strings ; USING: help help.topics help.markup help.syntax io strings ;
IN: help.vocabs IN: help.vocabs
ARTICLE: "vocab-tags" "Vocabulary tags" ARTICLE: "vocab-tags" "Vocabulary tags"
@ -15,3 +15,24 @@ ARTICLE: "vocab-index" "Vocabulary index"
HELP: words. HELP: words.
{ $values { "vocab" "a vocabulary name" } } { $values { "vocab" "a vocabulary name" } }
{ $description "Printings a listing of all the words in a vocabulary, categorized by type." } ; { $description "Printings a listing of all the words in a vocabulary, categorized by type." } ;
HELP: about
{ $values { "vocab" "a vocabulary specifier" } }
{ $description
"Displays the main help article for the vocabulary. The main help article is set with the " { $link POSTPONE: ABOUT: } " parsing word."
} ;
ARTICLE: "browsing-help" "Browsing documentation"
"Help topics are instances of a mixin:"
{ $subsection topic }
"Most commonly, topics are article name strings, or words. You can display a specific help topic:"
{ $subsection help }
"You can also display the help for a vocabulary:"
{ $subsection about }
"To list a vocabulary's words only:"
{ $subsection words. }
{ $examples
{ $code "\"evaluator\" help" }
{ $code "\\ + help" }
{ $code "\"io.files\" about" }
} ;

View File

@ -9,6 +9,9 @@ make namespaces prettyprint sequences sets sorting summary
tools.vocabs vocabs vocabs.loader words words.symbol definitions.icons ; tools.vocabs vocabs vocabs.loader words words.symbol definitions.icons ;
IN: help.vocabs IN: help.vocabs
: about ( vocab -- )
[ require ] [ vocab help ] bi ;
: $pretty-link ( element -- ) : $pretty-link ( element -- )
[ first definition-icon 1array $image " " print-element ] [ first definition-icon 1array $image " " print-element ]
[ $definition-link ] [ $definition-link ]

View File

@ -135,7 +135,9 @@ SYMBOL: ui-notify-flag
: forget-pref-dim ( gadget -- ) f >>pref-dim drop ; : forget-pref-dim ( gadget -- ) f >>pref-dim drop ;
: layout-queue ( -- queue ) \ layout-queue get ; : ui-state ( symbol -- value ) get [ "UI not running" throw ] unless* ;
: layout-queue ( -- queue ) \ layout-queue ui-state ;
: layout-later ( gadget -- ) : layout-later ( gadget -- )
#! When unit testing gadgets without the UI running, the #! When unit testing gadgets without the UI running, the
@ -214,7 +216,7 @@ M: gadget ungraft* drop ;
<PRIVATE <PRIVATE
: graft-queue ( -- dlist ) \ graft-queue get ; : graft-queue ( -- dlist ) \ graft-queue ui-state ;
: unqueue-graft ( gadget -- ) : unqueue-graft ( gadget -- )
[ graft-node>> graft-queue delete-node ] [ graft-node>> graft-queue delete-node ]

View File

@ -78,7 +78,7 @@ M: browser-gadget focusable-child* search-field>> ;
<browser-gadget> "Browser" open-status-window ; <browser-gadget> "Browser" open-status-window ;
: browser-window ( -- ) : browser-window ( -- )
"handbook" (browser-window) ; "help.home" (browser-window) ;
\ browser-window H{ { +nullary+ t } } define-command \ browser-window H{ { +nullary+ t } } define-command
@ -89,7 +89,7 @@ M: browser-gadget focusable-child* search-field>> ;
: show-browser ( -- ) : show-browser ( -- )
[ browser-gadget? ] find-window [ browser-gadget? ] find-window
[ raise-window ] [ browser-window ] if* ; [ [ raise-window ] [ request-focus ] bi ] [ browser-window ] if* ;
\ show-browser H{ { +nullary+ t } } define-command \ show-browser H{ { +nullary+ t } } define-command
@ -97,7 +97,7 @@ M: browser-gadget focusable-child* search-field>> ;
: com-forward ( browser -- ) model>> go-forward ; : com-forward ( browser -- ) model>> go-forward ;
: com-documentation ( browser -- ) "help.home" swap show-help ; : com-home ( browser -- ) "help.home" swap show-help ;
: browser-help ( -- ) "ui-browser" com-browse ; : browser-help ( -- ) "ui-browser" com-browse ;
@ -106,7 +106,7 @@ M: browser-gadget focusable-child* search-field>> ;
browser-gadget "toolbar" f { browser-gadget "toolbar" f {
{ T{ key-down f { A+ } "LEFT" } com-back } { T{ key-down f { A+ } "LEFT" } com-back }
{ T{ key-down f { A+ } "RIGHT" } com-forward } { T{ key-down f { A+ } "RIGHT" } com-forward }
{ f com-documentation } { T{ key-down f { A+ } "H" } com-home }
{ T{ key-down f f "F1" } browser-help } { T{ key-down f f "F1" } browser-help }
} define-command-map } define-command-map

View File

@ -57,8 +57,12 @@ ARTICLE: "ui-tools" "UI developer tools"
"The " { $vocab-link "ui.tools" } " vocabulary hierarchy implements a collection of simple developer tools." "The " { $vocab-link "ui.tools" } " vocabulary hierarchy implements a collection of simple developer tools."
$nl $nl
"To take full advantage of the UI tools, you should be using a supported text editor. See " { $link "editor" } "." "To take full advantage of the UI tools, you should be using a supported text editor. See " { $link "editor" } "."
$nl
"Common functionality:"
{ $subsection "ui-shortcuts" } { $subsection "ui-shortcuts" }
{ $subsection "ui-presentations" } { $subsection "ui-presentations" }
{ $subsection "definitions.icons" }
"Tools:"
{ $subsection "ui-listener" } { $subsection "ui-listener" }
{ $subsection "ui-browser" } { $subsection "ui-browser" }
{ $subsection "ui-inspector" } { $subsection "ui-inspector" }

View File

@ -10,6 +10,5 @@ USING: alien sequences ;
{ "libm" "\\windows\\coredll.dll" "stdcall" } { "libm" "\\windows\\coredll.dll" "stdcall" }
! { "gl" "libGLES_CM.dll" "stdcall" } ! { "gl" "libGLES_CM.dll" "stdcall" }
! { "glu" "libGLES_CM.dll" "stdcall" } ! { "glu" "libGLES_CM.dll" "stdcall" }
! { "freetype" "libfreetype-6.dll" "stdcall" }
{ "ole32" "ole32.dll" "stdcall" } { "ole32" "ole32.dll" "stdcall" }
} [ first3 add-library ] each } [ first3 add-library ] each

View File

@ -168,6 +168,7 @@ SYMBOL: interactive-vocabs
"help" "help"
"help.apropos" "help.apropos"
"help.lint" "help.lint"
"help.vocabs"
"inspector" "inspector"
"io" "io"
"io.files" "io.files"

View File

@ -56,6 +56,7 @@ $nl
"Application vocabularies can define a main entry point, giving the user a convenient way to run the application:" "Application vocabularies can define a main entry point, giving the user a convenient way to run the application:"
{ $subsection POSTPONE: MAIN: } { $subsection POSTPONE: MAIN: }
{ $subsection run } { $subsection run }
{ $subsection runnable-vocab }
{ $see-also "vocabularies" "parser-files" "source-files" } ; { $see-also "vocabularies" "parser-files" "source-files" } ;
ABOUT: "vocabs.loader" ABOUT: "vocabs.loader"

View File

@ -96,3 +96,6 @@ $nl
HELP: >vocab-link HELP: >vocab-link
{ $values { "name" string } { "vocab" "a vocabulary specifier" } } { $values { "name" string } { "vocab" "a vocabulary specifier" } }
{ $description "If the vocabulary is loaded, outputs the corresponding " { $link vocab } " instance, otherwise creates a new " { $link vocab-link } "." } ; { $description "If the vocabulary is loaded, outputs the corresponding " { $link vocab } " instance, otherwise creates a new " { $link vocab-link } "." } ;
HELP: runnable-vocab
{ $class-description "The class of vocabularies with a " { $slot "main" } " word." } ;

View File

@ -105,4 +105,7 @@ M: vocab-spec forget* forget-vocab ;
SYMBOL: load-vocab-hook ! ( name -- vocab ) SYMBOL: load-vocab-hook ! ( name -- vocab )
: load-vocab ( name -- vocab ) load-vocab-hook get call( name -- vocab ) ; : load-vocab ( name -- vocab ) load-vocab-hook get call( name -- vocab ) ;
PREDICATE: runnable-vocab < vocab
vocab-main >boolean ;

View File

@ -0,0 +1,15 @@
USING: tools.deploy.config ;
H{
{ deploy-word-defs? f }
{ deploy-reflection 1 }
{ deploy-word-props? f }
{ deploy-compiler? t }
{ deploy-threads? t }
{ deploy-unicode? f }
{ "stop-after-last-window?" t }
{ deploy-name "hello-unicode" }
{ deploy-math? t }
{ deploy-ui? t }
{ deploy-io 2 }
{ deploy-c-types? f }
}

View File

@ -15,6 +15,6 @@ IN: hello-unicode
] with-style ] with-style
] make-pane { 10 10 } <border> ; ] make-pane { 10 10 } <border> ;
: hello-unicode ( -- ) <hello-gadget> "გამარჯობა" open-window ; : hello-unicode ( -- ) [ <hello-gadget> "გამარჯობა" open-window ] with-ui ;
MAIN: hello-unicode MAIN: hello-unicode

View File

@ -5,15 +5,18 @@ io.directories io.files.temp kernel io.streams.string calendar
debugger combinators.smart sequences ; debugger combinators.smart sequences ;
IN: site-watcher.db IN: site-watcher.db
TUPLE: account account-id account-name email ; TUPLE: account account-id account-name email twitter sms ;
: <account> ( account-name -- account ) : <account> ( account-name email -- account )
account new account new
swap >>email
swap >>account-name ; swap >>account-name ;
account "ACCOUNT" { account "ACCOUNT" {
{ "account-name" "ACCOUNT_NAME" VARCHAR +user-assigned-id+ } { "account-name" "ACCOUNT_NAME" VARCHAR +user-assigned-id+ }
{ "email" "EMAIL" VARCHAR } { "email" "EMAIL" VARCHAR }
{ "twitter" "TWITTER" VARCHAR }
{ "sms" "SMS" VARCHAR }
} define-persistent } define-persistent
TUPLE: site site-id url up? changed? last-up error last-error ; TUPLE: site site-id url up? changed? last-up error last-error ;
@ -72,7 +75,7 @@ TUPLE: reporting-site email url up? changed? last-up? error last-error ;
: insert-site ( url -- site ) : insert-site ( url -- site )
<site> dup select-tuple [ ] [ dup t >>up? insert-tuple ] ?if ; <site> dup select-tuple [ ] [ dup t >>up? insert-tuple ] ?if ;
: insert-account ( account-name -- ) <account> insert-tuple ; : insert-account ( account-name email -- ) <account> insert-tuple ;
: find-sites ( -- seq ) f <site> select-tuples ; : find-sites ( -- seq ) f <site> select-tuples ;

View File

@ -14,7 +14,7 @@ IN: site-watcher.tests
site ensure-table site ensure-table
watching-site ensure-table watching-site ensure-table
"erg@factorcode.org" insert-account "erg" "erg@factorcode.org" insert-account
"http://asdfasdfasdfasdfqwerqqq.com" insert-site drop "http://asdfasdfasdfasdfqwerqqq.com" insert-site drop
"http://fark.com" insert-site drop "http://fark.com" insert-site drop
@ -22,4 +22,4 @@ IN: site-watcher.tests
f <site> select-tuples f <site> select-tuples
] with-db ; ] with-db ;
[ f ] [ fake-sites empty? ] unit-test [ f ] [ fake-sites empty? ] unit-test

View File

@ -71,7 +71,7 @@ CONSTANT: site-list-url URL" $site-watcher-app/"
: <update-notify-action> ( -- action ) : <update-notify-action> ( -- action )
<page-action> <page-action>
[ [
username <account> select-tuple from-object username f <account> select-tuple from-object
] >>init ] >>init
{ site-watcher-app "update-notify" } >>template { site-watcher-app "update-notify" } >>template
[ [
@ -82,8 +82,10 @@ CONSTANT: site-list-url URL" $site-watcher-app/"
} validate-params } validate-params
] >>validate ] >>validate
[ [
username <account> select-tuple username f <account> select-tuple
"email" value >>email "email" value >>email
"twitter" value >>twitter
"sms" value >>sms
update-tuple update-tuple
site-list-url <redirect> site-list-url <redirect>
] >>submit ] >>submit
@ -122,6 +124,10 @@ CONSTANT: site-list-url URL" $site-watcher-app/"
site-watcher-db <alloy> site-watcher-db <alloy>
main-responder set-global main-responder set-global
M: site-watcher-app init-user-profile
drop
"username" value "email" value <account> insert-tuple ;
: init-db ( -- ) : init-db ( -- )
site-watcher-db [ site-watcher-db [
{ site account watching-site } [ ensure-table ] each { site account watching-site } [ ensure-table ] each