Author: mark
Date: 2004-05-13 17:31:05 -0400 (Thu, 13 May 2004)
New Revision: 479
Added:
trunk/docs/tutorial/tutorial2.htm
trunk/pr/tutorial/tut3.pr
Modified:
trunk/docs/tutorial/index.htm
trunk/docs/tutorial/tutorial1.htm
trunk/pr/tutorial/tut2.pr
Log:
more work on tutorial
Modified: trunk/docs/tutorial/index.htm
===================================================================
--- trunk/docs/tutorial/index.htm 2004-05-13 19:19:09 UTC (rev 478)
+++ trunk/docs/tutorial/index.htm 2004-05-13 21:31:05 UTC (rev 479)
@@ -47,19 +47,11 @@
<UL>
<LI><A href="tutorial1.htm#eapf">Line Endings</a>
<LI><a href="tutorial1.htm#args">Arguments</a>
- <LI><A href="node4.html#SECTION004230000000000000000">Source
- Code Encoding</a>
- <LI><A href="node4.html#SECTION004240000000000000000">The
Interactive
- Startup File</a>
</ul>
<LI><A href="tutorial1.htm#confile">1.3 Using Console With
Files</a>
<UL>
- <LI><A href="tutorial1.htm#eapf">Line Endings</a>
- <LI><a href="tutorial1.htm#args">Arguments</a>
- <LI><A href="node4.html#SECTION004230000000000000000">Source
- Code Encoding</a>
- <LI><A href="node4.html#SECTION004240000000000000000">The
Interactive
- Startup File</a>
+ <LI><A href="tutorial1.htm#ioption">The -i Option</a>
+ <LI><a href="tutorial1.htm#toption">The -t Option</a>
</ul>
</ul>
Modified: trunk/docs/tutorial/tutorial1.htm
===================================================================
--- trunk/docs/tutorial/tutorial1.htm 2004-05-13 19:19:09 UTC (rev 478)
+++ trunk/docs/tutorial/tutorial1.htm 2004-05-13 21:31:05 UTC (rev 479)
@@ -1,6 +1,6 @@
<html>
<head>
-<title>Prothon Tutorial</title>
+<title>Prothon Tutorial - 1.0</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
@@ -32,7 +32,7 @@
<br>
<table width="630" border="0" cellpadding="0" cellspacing="0"
bgcolor="#ffffee" height="1707">
<tr>
- <td height="2203" valign="top">
+ <td height="2286" valign="top">
<p align="left"><font face="Verdana, Arial, Helvetica, sans-serif"
size="+2"><a name="uint"></a>1.0
Using the Prothon Interpreter</font></p>
<p align="left"><font face="Verdana, Arial, Helvetica, sans-serif"
size="+2"><a name="intcon"></a>1.1
@@ -119,17 +119,17 @@
Argument: test 1 2 3</pre>
<p>The source code for tut2.pr is: </p>
<pre>for arg in Argv:
- print "Argument:", arg
+ print "Argument:", arg
</pre>
<p>The arguments are placed in a Prothon list called Argv with the
program
name as the first item as is traditional. The for loop and lists
will
be described later.</p>
- <p><font face="Verdana, Arial, Helvetica, sans-serif" size="+2"><a
name="confile"></a>1.1
+ <p><font face="Verdana, Arial, Helvetica, sans-serif" size="+2"><a
name="confile"></a>1.3
Using the Console With Files</font></p>
- <p>If you add the -i option to the prothon command line when starting
- a file, the interpreter will start an interactive console session
when
- the main program finishes. More importantly, the variables will
still
- remain from the main program for you to interrogate:</p>
+ <p><a name="ioption"></a>If you add the -i option to the prothon
command
+ line when starting a file, the interpreter will start an interactive
+ console session when the main program finishes. More importantly,
the
+ variables will still remain from the main program for you to
interrogate:</p>
<pre>C:\Prothon\pr\tutorial>prothon -i tut2.pr hello world
Argument: tut2.pr
Argument: hello
@@ -138,12 +138,19 @@
Prothon 0.1 Interactive Console, Build 477, May 12 2004 (Ctrl-D to exit)
>>> print Argv[0]
tut2.pr</pre>
- <p>There is even a way to run the console at the same time your file
is
- executing. The -t command line option starts a prothon file
executing
- as a background thread. Here is the source code for a simple prothon
- program, tut3.pr, that just adds 1 to a global variable every
second:</p>
- <pre>C:\Prothon\pr\tutorial>prothon -t tut3.pr
+ <p><a name="toption"></a>There is even a way to run the console at the
+ same time your file is executing. Here is the source code for a
simple
+ prothon program, tut3.pr, that adds 1 to a global variable called
timer
+ every second:</p>
+ <pre>for i in 1_000_000:
+ timer = i
+ Sleep(1.0)
</pre>
+ If you run this as a background program then you can examine the timer
+ variable in the console at the same time. The -t command line option
starts
+ a prothon file executing as a background thread:
+ <pre>C:\Prothon\pr\tutorial>prothon -t tut3.pr XXX
+</pre>
<p>You can actually start many files executing with the -t option and
the console all at once, but we won't show that right now.</p>
</td>
Added: trunk/docs/tutorial/tutorial2.htm
===================================================================
--- trunk/docs/tutorial/tutorial2.htm 2004-05-13 19:19:09 UTC (rev 478)
+++ trunk/docs/tutorial/tutorial2.htm 2004-05-13 21:31:05 UTC (rev 479)
@@ -0,0 +1,72 @@
+<html>
+<head>
+<title>Prothon Tutorial - 2.0</title>
+<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+</head>
+
+<body bgcolor="#FFFFFF" text="#000000">
+<div align="center">
+ <table width="630" border="0" cellpadding="0" cellspacing="0"
bgcolor="#FFFFCC">
+ <tr>
+ <td height="121" width="109"><img src="../images/logo_left.jpg"
width="109" height="135"></td>
+ <td valign="center" height="43">
+ <div align="center"><font size="5" face="Verdana, Arial, Helvetica,
sans-serif">Prothon
+ Tutorial</font></div>
+ </td>
+ <td valign="center" height="121" width="106"><img
src="../images/logo_right.jpg" width="109" height="135"></td>
+ </tr>
+ </table>
+ <br>
+ <table width="630" border="0" cellpadding="0" cellspacing="0">
+ <tr>
+ <td width="114" height="25" valign="top"> <a
href="../index.html">Prothon
+ Home</a></td>
+ <td width="194" valign="middle" align="center" height="25"><a
href="index.htm">Previous
+ Page</a></td>
+ <td width="183" valign="middle" align="center" height="25"><a
href="index.htm">Tutorial
+ Outline</a></td>
+ <td width="139" valign="middle" align="center" height="25"><a
href="description-2.htm">Next
+ Page</a></td>
+ </tr>
+ </table>
+ <br>
+ <table width="630" border="0" cellpadding="0" cellspacing="0"
bgcolor="#ffffee" height="1707">
+ <tr>
+ <td height="2286" valign="top">
+ <p align="left"><font face="Verdana, Arial, Helvetica, sans-serif"
size="+2"><a name="intro"></a>2.0
+ Introduction to Prothon</font></p>
+ <p align="left"><font face="Verdana, Arial, Helvetica, sans-serif"
size="+2"><a name="comments"></a>2.1
+ Comments</font></p>
+ <p><a name="hash"></a>Any line starting with the hash symbol, aka
pound-sign
+ ( # ), is a comment line and is ignored by the interpreter. If the
hash
+ symbol appears in the middle of the line then the rest of the line
is
+ ignored. (There are certain exceptions which will be discussed in
the
+ strings section).</p>
+ <pre>>>> # print "Hello"
+>>> print "hello" #, "world"
+hello
+>>></pre>
+ <p><a name="cstyle"></a>You can also use C-style inline comments /*
...
+ */ in the middle of a line of code or to block out large sections of
+ code easily in a file:</p>
+ <pre>>>> print "hello" /* "there" */ , "world"
+hello world
+>>></pre>this
+ </td>
+ </tr>
+ </table>
+ <table width="630" border="0" cellpadding="0" cellspacing="0">
+ <tr>
+ <td width="114" height="25" valign="top"> <a
href="../index.html">Prothon
+ Home</a></td>
+ <td width="194" valign="middle" align="center" height="25"><a
href="index.htm">Previous
+ Page</a></td>
+ <td width="183" valign="middle" align="center" height="25"><a
href="index.htm">Tutorial
+ Outline</a></td>
+ <td width="139" valign="middle" align="center" height="25"><a
href="description-2.htm">Next
+ Page</a></td>
+ </tr>
+ </table>
+</div>
+</body>
+</html>
Modified: trunk/pr/tutorial/tut2.pr
===================================================================
--- trunk/pr/tutorial/tut2.pr 2004-05-13 19:19:09 UTC (rev 478)
+++ trunk/pr/tutorial/tut2.pr 2004-05-13 21:31:05 UTC (rev 479)
@@ -1,3 +1,3 @@
for arg in Argv:
- print "Argument:", arg
+ print "Argument:", arg
Added: trunk/pr/tutorial/tut3.pr
===================================================================
--- trunk/pr/tutorial/tut3.pr 2004-05-13 19:19:09 UTC (rev 478)
+++ trunk/pr/tutorial/tut3.pr 2004-05-13 21:31:05 UTC (rev 479)
@@ -0,0 +1,4 @@
+
+for i in 1_000_000:
+ timer = i
+ Sleep(1.0)
|