]> gitweb.factorcode.org Git - factor.git/commitdiff
better plugin docs
authorSlava Pestov <slava@factorcode.org>
Wed, 1 Sep 2004 03:42:30 +0000 (03:42 +0000)
committerSlava Pestov <slava@factorcode.org>
Wed, 1 Sep 2004 03:42:30 +0000 (03:42 +0000)
12 files changed:
doc/jedit/complete.png [new file with mode: 0644]
doc/jedit/describe.png [new file with mode: 0644]
doc/jedit/edit-word.png [new file with mode: 0644]
doc/jedit/error.png [new file with mode: 0644]
doc/jedit/index.html [new file with mode: 0644]
doc/jedit/listener.png [new file with mode: 0644]
doc/jedit/status.png [new file with mode: 0644]
doc/jedit/usages.png [new file with mode: 0644]
doc/jedit/word-list.png [new file with mode: 0644]
doc/jedit/word-use.png [new file with mode: 0644]
doc/plugin.html [deleted file]
doc/tutorial/numbers-game.factor

diff --git a/doc/jedit/complete.png b/doc/jedit/complete.png
new file mode 100644 (file)
index 0000000..9f1742b
Binary files /dev/null and b/doc/jedit/complete.png differ
diff --git a/doc/jedit/describe.png b/doc/jedit/describe.png
new file mode 100644 (file)
index 0000000..1255158
Binary files /dev/null and b/doc/jedit/describe.png differ
diff --git a/doc/jedit/edit-word.png b/doc/jedit/edit-word.png
new file mode 100644 (file)
index 0000000..dd22a3b
Binary files /dev/null and b/doc/jedit/edit-word.png differ
diff --git a/doc/jedit/error.png b/doc/jedit/error.png
new file mode 100644 (file)
index 0000000..4980f1b
Binary files /dev/null and b/doc/jedit/error.png differ
diff --git a/doc/jedit/index.html b/doc/jedit/index.html
new file mode 100644 (file)
index 0000000..d180b5a
--- /dev/null
@@ -0,0 +1,173 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+<head><title>Factor plugin</title>
+
+<style>
+.fancy-heading { background: #c0d0ff; border: 1px solid #2040ff; }
+div.fancy-heading { padding: 1px; margin: 0px 0px 3px 0px; }
+.nice-box {
+       padding: 4px;
+       border-width: 1px;
+       border-style: dashed;
+}
+.syntax0 {
+color: #000000;
+}
+.syntax1 {
+color: #cc0000;
+}
+.syntax2 {
+color: #ff8400;
+}
+.syntax3 {
+color: #6600cc;
+}
+.syntax4 {
+color: #cc6600;
+}
+.syntax5 {
+color: #ff0000;
+}
+.syntax6 {
+color: #9966ff;
+}
+.syntax7 {
+background: #ffffcc;
+color: #ff0066;
+}
+.syntax8 {
+color: #006699;
+font-weight: bold;
+}
+.syntax9 {
+color: #009966;
+font-weight: bold;
+}
+.syntax10 {
+color: #0099ff;
+font-weight: bold;
+}
+.syntax11 {
+color: #66ccff;
+font-weight: bold;
+}
+.syntax12 {
+color: #02b902;
+}
+.syntax13 {
+color: #ff00cc;
+}
+.syntax14 {
+color: #cc00cc;
+}
+.syntax15 {
+color: #9900cc;
+}
+.syntax16 {
+color: #6600cc;
+}
+.syntax17 {
+color: #0000ff;
+}
+.syntax18 {
+color: #000000;
+font-weight: bold;
+}
+.gutter {
+background: #dbdbdb;
+color: #000000;
+}
+.gutterH {
+background: #dbdbdb;
+color: #666699;
+}
+</style>
+
+</head>
+
+<body>
+
+
+<h1 align="center">Factor plugin</h1>
+
+<p><a href="http://factor.sourceforge.net">Factor</a> is a programming language with postfix syntax. The Factor plugin for <a href="http://www.jedit.org">jEdit</a> provides many nifty time-saving features for working with Factor code.<p>
+
+<h2 class="fancy-heading">Introduction</h2>
+
+If Factor is compiled with the jEdit classes in the class path, the resulting <code>Factor.jar</code> can then be placed in <code>$HOME/.jedit/jars/</code> and loaded by jEdit.<p>
+
+Note that while the Factor plugin requires jEdit 4.2pre15, you will need to download and install the Factor edit mode separately from the <a href="http://factor.sf.net">Factor home page</a>. If you are running jEdit 4.2final, this edit mode is already included.
+
+<h2 class="fancy-heading">Embedded interpreter</h2>
+
+<p>The plugin embeds a Factor interpreter inside jEdit that gets lazily loaded when first used. The interpreter communicates with the plugin and vice versa to perform various useful tasks.</p>
+
+<p>The <b>Run current file</b> and <b>Evaluate selection</b> commands can be used to send text from jEdit to the interpreter.<p>
+
+<img class="nice-box" src="listener.png">
+
+<p>If you have CFactor installed, it is possible to embed it in jEdit using the <code>inferior.factor</code> socket protocol. Add the following to your <code>$HOME/.factor-rc</code>:
+
+<PRE class="nice-box"><SPAN CLASS="syntax17">USE:</SPAN><SPAN CLASS="syntax17"> </SPAN><SPAN CLASS="syntax17">telnetd</SPAN>
+<SPAN CLASS="syntax17">:</SPAN><SPAN CLASS="syntax17"> </SPAN><SPAN CLASS="syntax17">inf</SPAN> <SPAN CLASS="syntax5">9999</SPAN> telnetd <SPAN CLASS="syntax17">;</SPAN>
+<SPAN CLASS="syntax17">:</SPAN><SPAN CLASS="syntax17"> </SPAN><SPAN CLASS="syntax17">cfactor</SPAN> <SPAN CLASS="syntax13">&quot;</SPAN><SPAN CLASS="syntax13">localhost</SPAN><SPAN CLASS="syntax13">&quot;</SPAN> <SPAN CLASS="syntax5">9999</SPAN> &lt;client&gt; inferior-client <SPAN CLASS="syntax17">;</SPAN>
+</PRE>
+</div>
+
+<p>Now, start CFactor and type the following phrase:</p>
+
+<pre class="nice-box">inf</pre>
+
+<p>Then open the Factor listener window in jEdit, and type the following phrase:</p>
+
+<pre class="nice-box">cfactor</pre>
+
+<p>You will now be talking to the CFactor interpreter prompt. Styled text output and hyperlinks will be transmitted using the <code>inferior.factor</code> socket protocol.</p>
+
+<h2 class="fancy-heading">Cross-referencing</h2>
+
+<p>The <b>Edit word at caret</b> command opens the source file containing the definition of the word at the caret. <b>See word at caret</b> shows the definition of the word at the caret in the Factor listener window.</p>
+
+<p>The <b>Edit word</b> command opens a dialog box where the name of a word can be typed -- while the word is being typed, the possible completions is instantly updated, and selecting one opens the source file containing the definition of that word:</p>
+
+<img class="nice-box" src="edit-word.png">
+
+<p>To be able to edit definitions of standard library words, add a phrase like the following to your <code>$HOME/.factor-rc</code>:</p>
+
+<pre class="nice-box"><SPAN CLASS="syntax13">&quot;</SPAN><SPAN CLASS="syntax13">/home/slava/Factor/</SPAN><SPAN CLASS="syntax13">&quot;</SPAN> <SPAN CLASS="syntax13">&quot;</SPAN><SPAN CLASS="syntax13">resource-path</SPAN><SPAN CLASS="syntax13">&quot;</SPAN> set
+</PRE>
+
+<p>The <b>Word usages at caret</b> command displays a list of words that refer to the word at the caret in the Factor listener window. Clicking on words in the listener shows a popup menu with various useful actions.</p>
+
+<img class="nice-box" src="usages.png">
+
+<p>Here we see the result of selecting <b>Describe</b>.</p>
+
+<img class="nice-box" src="describe.png">
+
+<h2 class="fancy-heading">Error checking</h2>
+
+<p>Factor files are parsed in a background thread and checked for errors, using the framework provided by the SideKick plugin. Errors are underlined in the text area (and listed in the <b>ErrorList</b> plugin window).</p>
+
+<img class="nice-box" src="error.png">
+
+<p>A common error is a missing <code>USE:</code> declaration. The <b>Plugins</b>&gt;<b>Factor</b>&gt;<b>Use word at caret</b> command searches for the word at the caret in all vocabularies, and adds a <code>USE:</code> declaration for the vocabulary to the start of the source file -- in this case, <code>ifte</code> is found in the <code>combinators</code> vocabulary, and the parse error instantly goes away:</p>
+
+<img class="nice-box" src="word-use.png">
+
+<h2 class="fancy-heading">Completion and browsing</h2>
+
+<p>The stack effect of the word at the caret is shown in the status bar.</p>
+
+<img class="nice-box" src="status.png">
+
+<p>Invoking <b>Plugins</b>&gt;<b>SideKick</b>&gt;<b>Show Completion Popup</b> displays a popup of possible completions for the word at the caret -- bind this to <code>C+SPACE</code> for quick access:</p>
+
+<img class="nice-box" src="complete.png">
+
+<p>The <b>Plugins</b>&gt;<b>SideKick</b>&gt;<b>Structure Browser</b> displays a list of all words defined in the current buffer:</p>
+
+<img class="nice-box" src="word-list.png">
+
+</body>
+</html>
diff --git a/doc/jedit/listener.png b/doc/jedit/listener.png
new file mode 100644 (file)
index 0000000..e0d5228
Binary files /dev/null and b/doc/jedit/listener.png differ
diff --git a/doc/jedit/status.png b/doc/jedit/status.png
new file mode 100644 (file)
index 0000000..56933df
Binary files /dev/null and b/doc/jedit/status.png differ
diff --git a/doc/jedit/usages.png b/doc/jedit/usages.png
new file mode 100644 (file)
index 0000000..3154bed
Binary files /dev/null and b/doc/jedit/usages.png differ
diff --git a/doc/jedit/word-list.png b/doc/jedit/word-list.png
new file mode 100644 (file)
index 0000000..71295a4
Binary files /dev/null and b/doc/jedit/word-list.png differ
diff --git a/doc/jedit/word-use.png b/doc/jedit/word-use.png
new file mode 100644 (file)
index 0000000..e7f31ac
Binary files /dev/null and b/doc/jedit/word-use.png differ
diff --git a/doc/plugin.html b/doc/plugin.html
deleted file mode 100644 (file)
index 189715d..0000000
+++ /dev/null
@@ -1,71 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
-<html>
-<head><title>Factor plugin</title>
-
-<style>
-.fancy-heading { background: #c0d0ff; border: 1px solid #2040ff; }
-div.fancy-heading { padding: 1px; margin: 0px 0px 3px 0px; }
-.screenshot {
-       float: right;
-       margin: 0px 9px 9px 0px;
-       border: 0px;
-}
-</style>
-
-</head>
-
-<body>
-
-
-<h1 align="center">Factor plugin</h1>
-
-Factor is a programming language with postfix syntax. This document describes the Factor plugin only, not the Factor language itself. The language is described in detail in the <a href="devel-guide/index.html">Factor Developer's Guide</a>. Also, be sure to visit the Factor home page located at <a href="http://factor.sourceforge.net">factor.sourceforge.net</a>.<p>
-
-If you're interested in using the Factor plugin as a quick calculator embedded in jEdit, here is a quick start guide:
-
-<pre>2 2 + .
-10 3 ^ .
-HEX: ffce HEX: fefc bitand .
-pi sin .
-pi i * exp .</pre>
-
-<h2 class="fancy-heading">Introduction</h2>
-
-If Factor is compiled with the jEdit classes in the class path, the resulting <code>Factor.jar</code> can then be placed in <code>$HOME/.jedit/jars/</code> and loaded by jEdit.<p>
-
-The plugin embeds a Factor interpreter inside jEdit that gets lazily loaded when first used. The interpreter communicates with the plugin and vice versa to perform various useful tasks.<p>
-
-Note that while the Factor plugin requires jEdit 4.2pre15, you will need to download and install the Factor edit mode separately from the <a href="http://factor.sf.net">Factor home page</a>. If you are running jEdit 4.2final, this edit mode is already included.
-
-<h2 class="fancy-heading">Plugin actions</h2>
-
-The Factor plugin adds a menu to jEdit's <b>Plugins</b> menu with the following commands (which can also be assigned keyboard shortcuts, added to the tool bar etc):
-
-<ul>
-<li><b>Factor Listener</b> opens a dockable window with an interactive interpreter.</li>
-<li><b>Run current file</b> evaluates the <code>run-file</code> word with the current buffer's path name as an argument.</li>
-<li><b>Evaluate selection</b> evaluates the current selection.</li>
-<li><b>Apropos word at caret</b> performs an apropos search on the current selection, or the word at the caret if there is no selection. An "apropos search" lists all words in all vocabularies whose names contain a certain string. For example, you can use this to list all string words by searching for "str", or to find out which vocabulary contains the word "unparse" by searching for "unparse".</li>
-<li><b>See word at caret</b> shows the definition of the word at the caret in the listener dockable window.</li>
-<li><b>Edit word at caret</b> opens the source file containing the definition of the word at the caret.
-For this to work with words defined in the standard library, you must set the "resource-path" variable in your <code>~/.factor-rc</code> to point to the location of the library sources:
-
-<pre>"/home/slava/Factor/" "resource-path" set</pre>
-</li>
-<li><b>Word usages at caret</b> shows all usages of the word at the caret in the listener dockable window.</li>
-</ul>
-
-<h2 class="fancy-heading">SideKick parser</h2>
-
-The Factor plugin uses the SideKick plugin to perform background parsing of Factor source files. This has the following implications:
-
-<ul>
-<li><b>Plugins</b>&gt;<b>SideKick</b>&gt;<b>Structure Browser</b> displays a list of all words defined in the current buffer.</li>
-<li><b>Plugins</b>&gt;<b>SideKick</b>&gt;<b>Show Completion Popup</b> displays a popup listing completions for the partial word at the caret. Completions are searched for in all vocabularies in the current file's search path, as determined by <code>IN:</code> and <code>USE:</code> declarations.</li>
-<li>The navigation commands in the <b>Plugins</b>&gt;<b>SideKick</b> menu will work. SideKick refers to each unit of source structure as an "asset". In Factor, each word definition is an "asset".</li>
-<li>Any parse errors are reported using the ErrorList plugin, which means they will be highlighted in the text area and shown in the ErrorList window.
-</li>
-</ul>
-
-</body>
-</html>
index 0cb72b4894c6181c50dfd645dc7b79bbdcfd617e..4d99271a7a10e900a32ac17250e368aeee434dd4 100644 (file)
@@ -1,6 +1,7 @@
 ! Numbers game example
 
 IN: numbers-game
+USE: combinators
 USE: kernel
 USE: math
 USE: parser
@@ -22,7 +23,7 @@ USE: stack
 
 : judge-guess ( actual guess -- ? )
     2dup = [
-        correct f
+        2drop correct f
     ] [
         inexact-guess t
     ] ifte ;