Added menu example
:100644 100644 f3bdd33... 3a442f1... M wml/Makefile
:100644 100644 07db43f... b74b426... M wml/doc/examples.wml
:100644 100644 306daed... f0b22e5... M wml/doc/examples/basic/hello.wml
:000000 100644 0000000... d61dade... A wml/doc/examples/console/menu.wml
diff --git a/wml/Makefile b/wml/Makefile
index f3bdd33..3a442f1 100644
--- a/wml/Makefile
+++ b/wml/Makefile
@@ -6,8 +6,8 @@ DOCINCS=$(wildcard doc/*.inc)
CCDOC=$(CC) $(patsubst %,-i%,$(DOCINCS))
EXINCS=$(wildcard doc/examples/*.inc)
CCEX=$(CCDOC) $(patsubst %,-i%,$(EXINCS))
-SRCS=$(wildcard *.wml) $(wildcard doc/*.wml) $(wildcard doc/examples/basic/*.wml)
-OBJDIRS=$(TOPDIR)/doc $(TOPDIR)/doc/examples/basic
+SRCS=$(wildcard *.wml) $(wildcard doc/*.wml) $(wildcard doc/examples/basic/*.wml) $(wildcard doc/examples/console/*.wml)
+OBJDIRS=$(TOPDIR)/doc $(TOPDIR)/doc/examples/basic $(TOPDIR)/doc/examples/console
OBJS=$(patsubst %,$(TOPDIR)/%,$(SRCS:.wml=.html))
ARCHIVEDIR=$(subst .,_,$(LATEST))
ARCHIVESRCS=$(patsubst %,$(ARCHIVEDIR)/%,install.wml features.wml release-notes.wml)
@@ -23,6 +23,9 @@ $(TOPDIR)/doc:
$(TOPDIR)/doc/examples/basic:
mkdir -p $(TOPDIR)/doc/examples/basic
+$(TOPDIR)/doc/examples/example:
+ mkdir -p $(TOPDIR)/doc/examples/example
+
$(ARCHIVEDIR):
mkdir -p $(ARCHIVEDIR)
diff --git a/wml/doc/examples.wml b/wml/doc/examples.wml
index 07db43f..b74b426 100644
--- a/wml/doc/examples.wml
+++ b/wml/doc/examples.wml
@@ -13,7 +13,7 @@
<h3>Console</h3>
<p>
- A console menu with different choices that let the end user interact with Smalltalk
+ <a href="$(ROOT)/doc/examples/console/menu.html">A console menu with different choices that let the end user interact with Smalltalk</a>
</p>
<h3>Embedding</h3>
diff --git a/wml/doc/examples/basic/hello.wml b/wml/doc/examples/basic/hello.wml
index 306daed..f0b22e5 100644
--- a/wml/doc/examples/basic/hello.wml
+++ b/wml/doc/examples/basic/hello.wml
@@ -25,6 +25,8 @@
On Windows, if you used the installer, you'll find the executable in Start->Programs->Smalltalk YX menu.
You'll see this once Syx has been launched:
<pre>
+ Smalltalk YX $(LATEST) is ready.
+ Type 'help!' to get help.
>
</pre>
</p>
diff --git a/wml/doc/examples/console/menu.wml b/wml/doc/examples/console/menu.wml
new file mode 100644
index 0000000..d61dade
--- /dev/null
+++ b/wml/doc/examples/console/menu.wml
@@ -0,0 +1,49 @@
+{#TITLE#:Console menu:##}
+
+<items>
+ <item "Console menu">
+ <p>
+ This example file is called <b>menu.st</b> <i>(it's available in the examples directory of the source distribution).</i>
+ The code is ugly but it's noticeable that migrating from other scripting languages to Syx is quite direct.
+ </p>
+ <code>|<span style="color: #00007f;"> choice menu </span>|<br />
+ <br />
+ <span style="color: #7f0000;">'Smalltalk YX simple example menu:'</span> displayNl.<br />
+ <span style="color: #00007f;">menu</span> <span style="color: #000066; font-weight:bold;">:=</span> <span style="">[</span><span style="color: #7f0000;">'1 - Reverse a string'</span> displayNl.<br />
+ <span style="color: #7f0000;">'2 - Do a math operation with 2 numbers'</span> displayNl.<br />
+ <span style="color: #7f0000;">'q - Quit'</span> displayNl.<br />
+ <span style="color: #7f0000;">'Choice: '</span> display.<br />
+ <span style="color: #00007f;">stdout</span> flush <span style="">]</span>.<br />
+ <br />
+ <span style="color: #00007f;">choice</span> <span style="color: #000066; font-weight:bold;">:=</span> <span style="color: #7f007f;">nil</span>.<br />
+ <span style="">[</span> <span style="color: #00007f;">menu</span> value. <span style="">(</span><span style="color: #00007f;">choice</span> <span style="color: #000066; font-weight:bold;">:=</span> <span style="color: #00007f;">stdin</span> next asLowercase<span style="">)</span> <span style="color: #000066; font-weight:bold;">=</span> $q <span style="">]</span><br />
+ whileFalse: <span style="">[</span><br />
+ <span style="color: #007f00; font-style: italic;">"Get rid of \n character"</span><br />
+ stdin next.<br />
+ <span style="color: #00007f;">choice</span><br />
+ caseOf: <span style="">{</span><br />
+ <br />
+ <span style="">[</span>$<span style="color: #7f0000;">1</span><span style="">]</span> -> <span style="">[</span><br />
+ |<span style="color: #00007f;"> s </span>|<br />
+ <span style="color: #00007f;">s</span> <span style="color: #000066; font-weight:bold;">:=</span> <span style="">(</span><span style="color: #00007f;">stdin</span> next: <span style="color: #00007f;"><span style="color: #7f0000;">1024</span></span><span style="">)</span> copyWithout: <span style="color: #0000ff;">Character</span> nl.<br />
+ <span style="color: #00007f;">s</span> reverse displayNl <span style="">]</span>.<br />
+ <br />
+ <span style="">[</span>$<span style="color: #7f0000;">2</span><span style="">]</span> -> <span style="">[</span><br />
+ |<span style="color: #00007f;"> n1 n2 op </span>|<br />
+ <span style="color: #7f0000;">'First number: '</span> display.<br />
+ <span style="color: #00007f;">n1</span> <span style="color: #000066; font-weight:bold;">:=</span> <span style="color: #0000ff;">Number</span> readFrom: <span style="color: #00007f;">stdin</span>.<br />
+ <span style="color: #7f0000;">'Operation (+, /, -, *, <, >, =, ...): '</span> display.<br />
+ <span style="color: #00007f;">op</span> <span style="color: #000066; font-weight:bold;">:=</span> <span style="">(</span><span style="">(</span><span style="color: #00007f;">stdin</span> next: <span style="color: #00007f;"><span style="color: #7f0000;">1024</span></span><span style="">)</span> copyWithout: <span style="color: #0000ff;">Character</span> nl<span style="">)</span> asSymbol.<br />
+ <span style="color: #7f0000;">'Second number: '</span> display.<br />
+ <span style="color: #00007f;">n2</span> <span style="color: #000066; font-weight:bold;">:=</span> <span style="color: #0000ff;">Number</span> readFrom: <span style="color: #00007f;">stdin</span>.<br />
+ <span style="">(</span><span style="color: #7f0000;">'Result: '</span>, <span style="">(</span><span style="color: #00007f;">n1</span> perform: <span style="color: #00007f;">op</span> with: <span style="color: #00007f;">n2</span><span style="">)</span> displayString<span style="">)</span> displayNl <span style="">]</span>.<br />
+ <br />
+ <span style="">}</span><br />
+ otherwise: <span style="">[</span> <span style="color: #7f0000;">'Not a valid choice'</span> displayNl <span style="">]</span>.<br />
+ <span style="color: #0000ff;">Transcript</span> cr <span style="">]</span>.<br />
+ <br />
+ <span style="color: #7f0000;">'See you soon. Bye.'</span> displayNl</code>
+ </code>
+ <top>
+ </item>
+</items>