rev 478 - in trunk: bin docs/tutorial
SVN User <[email protected]> Thu, 13 May 2004 15:19:13 -0400
| Newsgroups | gmane.comp.lang.prothon.cvs |
|---|---|
| Message-ID | <[email protected]> |
Author: mark
Date: 2004-05-13 15:19:09 -0400 (Thu, 13 May 2004)
New Revision: 478
Added:
trunk/docs/tutorial/index.htm
Removed:
trunk/docs/tutorial/tutorial2.htm
Modified:
trunk/bin/rel.pth
trunk/docs/tutorial/tutorial1.htm
Log:
worked on tutorial, added comments to rel.pth
Modified: trunk/bin/rel.pth
===================================================================
--- trunk/bin/rel.pth 2004-05-13 17:06:13 UTC (rev 477)
+++ trunk/bin/rel.pth 2004-05-13 19:19:09 UTC (rev 478)
@@ -1,2 +1,26 @@
-import Re,File
+# rel.pth
+
+# This file and any other files contained in
+# the same directory as prothon.exe that end in .pth,
+# are read by prothon.exe, the prothon interpreter, when
+# the interpreter starts running.
+
+# These .pth files may contain blank lines, comment lines that
+# start with #, lines that are valid directory paths, and prothon
+# import statements.
+
+# Directory paths are added to the list Sys.path. Sys.path is used
+# by prothon when searching for packages and modules to load. It
+# is searched in order through this list.
+
+# Import commands are executed as they are encountered in the .pth
+# file so make sure the needed path directories are specified first.
+
+# this period adds this prothon home directory to Sys.path
+.
+
+# this imports the File module
+# (which should probably be a built-in anyway)
+
+import File
Added: trunk/docs/tutorial/index.htm
===================================================================
--- trunk/docs/tutorial/index.htm 2004-05-13 17:06:13 UTC (rev 477)
+++ trunk/docs/tutorial/index.htm 2004-05-13 19:19:09 UTC (rev 478)
@@ -0,0 +1,289 @@
+<html>
+<head>
+<title>Prothon Tutorial - Outline</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">
+ <p><font size="5" face="Verdana, Arial, Helvetica, sans-serif">Prothon
+ Tutorial</font></p>
+ <p><font face="Times New Roman, Times, serif" size="5">Outline</font></p>
+ </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">Previous Page</td>
+ <td width="183" valign="middle" align="center" height="25">Tutorial Outline</td>
+ <td width="139" valign="middle" align="center" height="25"><a href="tutorial1.htm">Next
+ Page</a></td>
+ </tr>
+ </table>
+ <br>
+ <table width="630" border="0" cellpadding="0" cellspacing="0" bgcolor="#ffffee" height="1707">
+ <tr>
+ <td height="2203" valign="top">
+ <UL CLASS="TofC">
+ <LI>1. <a href="tutorial1.htm#uint">Using the Prothon Interpreter</a>
+ <UL>
+ <LI><A href="tutorial1.htm#intcon">1.1 Interactive Console </a>
+ <UL>
+ <LI><A href="tutorial1.htm#com">Command-Line Options</a>
+ <LI><A href="tutorial1.htm#calculator">Calculator</a>
+ <LI><a href="tutorial1.htm#indent"><u>Indenting</u></a>
+ </ul>
+ <LI><A href="tutorial1.htm#eapf">1.2 Executing A Prothon File</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>
+ </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>
+ </ul>
+
+ </ul>
+ </ul>
+
+ </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">Previous Page</td>
+ <td width="183" valign="middle" align="center" height="25">Tutorial Outline</td>
+ <td width="139" valign="middle" align="center" height="25"><a href="tutorial1.htm">Next
+ Page</a></td>
+ </tr>
+ </table>
+</div>
+
+href="node6.html#SECTION006200000000000000000">4.2 for Statements
+ <LI><A href="node6.html#SECTION006300000000000000000">4.3 The range()
+ Function</a>
+ <LI><A href="node6.html#SECTION006400000000000000000">4.4 break
+ and continue Statements, and else Clauses on Loops</a>
+ <LI><A href="node6.html#SECTION006500000000000000000">4.5 pass Statements</a>
+ <LI><A href="node6.html#SECTION006600000000000000000">4.6 Defining
+ Functions</a>
+ <LI><A href="node6.html#SECTION006700000000000000000">4.7 More on
+ Defining Functions</a>
+ <UL>
+ <LI><A href="node6.html#SECTION006710000000000000000">4.7.1
+ Default Argument Values</a>
+ <LI><A href="node6.html#SECTION006720000000000000000">4.7.2
+ Keyword Arguments</a>
+ <LI><A href="node6.html#SECTION006730000000000000000">4.7.3
+ Arbitrary Argument Lists</a>
+ <LI><A href="node6.html#SECTION006740000000000000000">4.7.4
+ Unpacking Argument Lists</a>
+ <LI><A href="node6.html#SECTION006750000000000000000">4.7.5
+ Lambda Forms</a>
+ <LI><A href="node6.html#SECTION006760000000000000000">4.7.6
+ Documentation Strings</a>
+ </ul>
+
+ <LI><A href="node7.html">5. Data Structures</a>
+ <UL>
+ <LI><A href="node7.html#SECTION007100000000000000000">5.1 More on
+ Lists</a>
+ <UL>
+ <LI><A href="node7.html#SECTION007110000000000000000">5.1.1
+ Using Lists as Stacks</a>
+ <LI><A href="node7.html#SECTION007120000000000000000">5.1.2
+ Using Lists as Queues</a>
+ <LI><A href="node7.html#SECTION007130000000000000000">5.1.3
+ Functional Programming Tools</a>
+ <LI><A href="node7.html#SECTION007140000000000000000">5.1.4
+ List Comprehensions</a>
+ </ul>
+ <LI><A href="node7.html#SECTION007200000000000000000">5.2 The del
+ statement</a>
+ <LI><A href="node7.html#SECTION007300000000000000000">5.3 Tuples
+ and Sequences</a>
+ <LI><A href="node7.html#SECTION007400000000000000000">5.4 Dictionaries</a>
+ <LI><A href="node7.html#SECTION007500000000000000000">5.5 Looping
+ Techniques</a>
+ <LI><A href="node7.html#SECTION007600000000000000000">5.6 More on
+ Conditions</a>
+ <LI><A href="node7.html#SECTION007700000000000000000">5.7 Comparing
+ Sequences and Other Types</a>
+ </ul>
+ <LI><A href="node8.html">6. Modules</a>
+ <UL>
+ <LI><A href="node8.html#SECTION008100000000000000000">6.1 More on
+ Modules</a>
+ <UL>
+ <LI><A href="node8.html#SECTION008110000000000000000">6.1.1
+ The Module Search Path</a>
+ <LI><A href="node8.html#SECTION008120000000000000000">6.1.2
+ ``Compiled'' Python files</a>
+ </ul>
+ <LI><A href="node8.html#SECTION008200000000000000000">6.2 Standard
+ Modules</a>
+ <LI><A href="node8.html#SECTION008300000000000000000">6.3 The dir()
+ Function</a>
+ <LI><A href="node8.html#SECTION008400000000000000000">6.4 Packages</a>
+ <UL>
+ <LI><A href="node8.html#SECTION008410000000000000000">6.4.1
+ Importing * From a Package</a>
+ <LI><A href="node8.html#SECTION008420000000000000000">6.4.2
+ Intra-package References</a>
+ <LI><A href="node8.html#SECTION008430000000000000000">6.4.3
+ Packages in Multiple Directories</a>
+ </ul>
+ </ul>
+ <LI><A href="node9.html">7. Input and Output</a>
+ <UL>
+ <LI><A href="node9.html#SECTION009100000000000000000">7.1 Fancier
+ Output Formatting</a>
+ <LI><A href="node9.html#SECTION009200000000000000000">7.2 Reading
+ and Writing Files</a>
+ <UL>
+ <LI><A href="node9.html#SECTION009210000000000000000">7.2.1
+ Methods of File Objects</a>
+ <LI><A href="node9.html#SECTION009220000000000000000">7.2.2
+ The pickle Module</a>
+ </ul>
+ </ul>
+ <LI><A href="node10.html">8. Errors and Exceptions</a>
+ <UL>
+ <LI><A href="node10.html#SECTION0010100000000000000000">8.1 Syntax
+ Errors</a>
+ <LI><A href="node10.html#SECTION0010200000000000000000">8.2 Exceptions</a>
+ <LI><A href="node10.html#SECTION0010300000000000000000">8.3 Handling
+ Exceptions</a>
+ <LI><A href="node10.html#SECTION0010400000000000000000">8.4 Raising
+ Exceptions</a>
+ <LI><A href="node10.html#SECTION0010500000000000000000">8.5 User-defined
+ Exceptions</a>
+ <LI><A href="node10.html#SECTION0010600000000000000000">8.6 Defining
+ Clean-up Actions</a>
+ </ul>
+ <LI><A href="node11.html">9. Classes</a>
+ <UL>
+ <LI><A href="node11.html#SECTION0011100000000000000000">9.1 A Word
+ About Terminology</a>
+ <LI><A href="node11.html#SECTION0011200000000000000000">9.2 Python
+ Scopes and Name Spaces</a>
+ <LI><A href="node11.html#SECTION0011300000000000000000">9.3 A First
+ Look at Classes</a>
+ <UL>
+ <LI><A href="node11.html#SECTION0011310000000000000000">9.3.1
+ Class Definition Syntax</a>
+ <LI><A href="node11.html#SECTION0011320000000000000000">9.3.2
+ Class Objects</a>
+ <LI><A href="node11.html#SECTION0011330000000000000000">9.3.3
+ Instance Objects</a>
+ <LI><A href="node11.html#SECTION0011340000000000000000">9.3.4
+ Method Objects</a>
+ </ul>
+ <LI><A href="node11.html#SECTION0011400000000000000000">9.4 Random
+ Remarks</a>
+ <LI><A href="node11.html#SECTION0011500000000000000000">9.5 Inheritance</a>
+ <UL>
+ <LI><A href="node11.html#SECTION0011510000000000000000">9.5.1
+ Multiple Inheritance</a>
+ </ul>
+ <LI><A href="node11.html#SECTION0011600000000000000000">9.6 Private
+ Variables</a>
+ <LI><A href="node11.html#SECTION0011700000000000000000">9.7 Odds
+ and Ends</a>
+ <LI><A href="node11.html#SECTION0011800000000000000000">9.8 Exceptions
+ Are Classes Too</a>
+ <LI><A href="node11.html#SECTION0011900000000000000000">9.9 Iterators</a>
+ <LI><A href="node11.html#SECTION00111000000000000000000">9.10 Generators</a>
+ </ul>
+ <LI><A href="node12.html">10. Brief Tour of the Standard Library</a>
+ <UL>
+ <LI><A href="node12.html#SECTION0012100000000000000000">10.1 Operating
+ System Interface</a>
+ <LI><A href="node12.html#SECTION0012200000000000000000">10.2 File
+ Wildcards</a>
+ <LI><A href="node12.html#SECTION0012300000000000000000">10.3 Command
+ Line Arguments</a>
+ <LI><A href="node12.html#SECTION0012400000000000000000">10.4 Error
+ Output Redirection and Program Termination</a>
+ <LI><A href="node12.html#SECTION0012500000000000000000">10.5 String
+ Pattern Matching</a>
+ <LI><A href="node12.html#SECTION0012600000000000000000">10.6 Mathematics</a>
+ <LI><A href="node12.html#SECTION0012700000000000000000">10.7 Internet
+ Access</a>
+ <LI><A href="node12.html#SECTION0012800000000000000000">10.8 Dates
+ and Times</a>
+ <LI><A href="node12.html#SECTION0012900000000000000000">10.9 Data
+ Compression</a>
+ <LI><A href="node12.html#SECTION00121000000000000000000">10.10 Performance
+ Measurement</a>
+ <LI><A href="node12.html#SECTION00121100000000000000000">10.11 Quality
+ Control</a>
+ <LI><A href="node12.html#SECTION00121200000000000000000">10.12 Batteries
+ Included</a>
+ </ul>
+ <LI><A href="node13.html">11. What Now?</a>
+ <LI><A href="node14.html">A. Interactive Input Editing and History Substitution</a>
+ <UL>
+ <LI><A href="node14.html#SECTION0014100000000000000000">A.1 Line
+ Editing</a>
+ <LI><A href="node14.html#SECTION0014200000000000000000">A.2 History
+ Substitution</a>
+ <LI><A href="node14.html#SECTION0014300000000000000000">A.3 Key
+ Bindings</a>
+ <LI><A href="node14.html#SECTION0014400000000000000000">A.4 Commentary</a>
+ </ul>
+ <LI><A href="node15.html">B. Floating Point Arithmetic: Issues and Limitations</a>
+ <UL>
+ <LI><A href="node15.html#SECTION0015100000000000000000">B.1 Representation
+ Error</a>
+ </ul>
+ <LI><A href="node16.html">C. History and License</a>
+ <UL>
+ <LI><A href="node16.html#SECTION0016100000000000000000">C.1 History
+ of the software</a>
+ <LI><A href="node16.html#SECTION0016200000000000000000">C.2 Terms
+ and conditions for accessing or otherwise using Python</a>
+ </ul>
+ <LI><A href="node17.html">D. Glossary</a>
+ <LI><A href="node18.html">Index</a>
+ <LI><A href="node19.html">About this document ...</a>
+
+
+
+
+
+ <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">Previous Page</td>
+ <td width="183" valign="middle" align="center" height="25">Tutorial Outline</td>
+ <td width="139" valign="middle" align="center" height="25"><a href="tutorial1.htm">Next
+ Page</a></td>
+ </tr>
+ </table>
+
+</body>
+
+</html>
Modified: trunk/docs/tutorial/tutorial1.htm
===================================================================
--- trunk/docs/tutorial/tutorial1.htm 2004-05-13 17:06:13 UTC (rev 477)
+++ trunk/docs/tutorial/tutorial1.htm 2004-05-13 19:19:09 UTC (rev 478)
@@ -121,9 +121,32 @@
<pre>for arg in Argv:
print "Argument:", arg
</pre>
- 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.</td>
+ <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
+ 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>
+ <pre>C:\Prothon\pr\tutorial>prothon -i tut2.pr hello world
+Argument: tut2.pr
+Argument: hello
+Argument: world
+
+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
+</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>
</tr>
</table>
<table width="630" border="0" cellpadding="0" cellspacing="0">
Deleted: trunk/docs/tutorial/tutorial2.htm
===================================================================
--- trunk/docs/tutorial/tutorial2.htm 2004-05-13 17:06:13 UTC (rev 477)
+++ trunk/docs/tutorial/tutorial2.htm 2004-05-13 19:19:09 UTC (rev 478)
@@ -1,143 +0,0 @@
-<html>
-<head>
-<title>Prothon Tutorial</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="2203" 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
- Interactive Console</font></p>
- <p><a name="com"></a>When you have Prothon installed properly, you can
- start the interpreter in interactive console mode by simply typing "prothon"
- at the command prompt. Typing "prothon -h" will give you a
- summary of available command-line options.</p>
- <pre>C:\>prothon
-
-Prothon 0.1 Interactive Console, Build 477, May 12 2004 (Ctrl-D to exit)
->>>
-</pre>
- <p>As you can see from the console heading, you exit the interactive console by
- typing Control-D at the beginning of any line that starts with the normal
- >>> prompt. You may have to hit enter a few times to get to
- this prompt.</p>
- <p>In our tutorial we will use output from this console for most of the
- examples. You can follow along by typing the same things into your Prothon
- console. Even when large portions of code are loaded and run, this can
- be done by loading files into the console and we have provided such
- files for you to load and run with this tutorial.</p>
- <p><a name="calculator"></a>Let's try something simple by using the console
- as a calculator:</p>
- <pre>>>> 3**2 + 4**2
-25</pre>
- <p>Two asterisks ( ** ) means "raise to the power of" so the
- formula I typed was "3 squared plus 4 squared" and the console
- echoed 25 (which we know is 5 squared). This shows the feature of the
- console that it echoes the value of whatever result is left on the last
- line typed.</p>
- <p>You can also give commands. One that you will use often is the "print"
- command:</p>
- <pre>>>> print "hello world"
-hello world</pre>
- The print command prints whatever arguments follow it. In this case it
- is a simple string. This is a bit different than the last output of the
- console because we commanded the output instead of just letting the console
- default to showing us what value was left in the line.
- <p><a name="indent"></a>You can also type in statements that require multiple
- lines, such as the for statement:</p>
- <pre>>>> for i in 3:
-... print i
-...
-0
-1
-2</pre>
- <p>Whenever you see the prompt with three dots "..." this means that the
- console is just storing up your input and not running it yet. It knew
- you weren't done yet after typing "for i in 3:" because the
- line ended in a colon ( : ). In Prothon, whenever a line ends in a colon,
- another line is expected to follow that is indented one level deeper
- than the current one. This is the beginning of a "code block".
- All the lines that start at this indent level are run together as one
- block of code.</p>
- <p>Note that the console tabs in one indent level whether you hit the
- tab key or the space key. It also goes back one whole indent level when
- you press backspace. When you are done entering a code block you must
- enter one blank line to let the console know the block is finished.
- Then Prothon runs the whole block of code at once. In this case it ran
- the for loop three times. We will discuss the for loop more later.</p>
- <p><font face="Verdana, Arial, Helvetica, sans-serif" size="+2"><a name="eapf"></a>1.2
- Executing a Prothon File</font></p>
- <p>Prothon source files are normal text files with any type of line endings
- (Unix, Windows, or Mac) that have file names ending in ".pr".
- Prothon is an interpreter so you can run the Prothon source file directly
- without compiling it first. Just type "prothon file.pr" at
- the command prompt. Set your working directory to the prothon/pr/turotorial
- directory and try this:</p>
- <pre>C:\prothon\pr\tutorial>prothon tut1.pr
-hello world
-</pre>
- <p>This complex program should look familiar. The contents of the tut1.pr
- file is: </p>
- <pre>print "hello world"</pre>
- <p>You can see nothing special is needed in the source file. </p>
- <p><a name="args"></a>Prothon programs can also have arguments. Just place
- them after the name of the .pr file as you would any normal program
- file:</p>
- <pre>C:\prothon\pr\tutorial>prothon tut2.pr hello world "test 1 2 3"
-Argument: tut2.pr
-Argument: hello
-Argument: world
-Argument: test 1 2 3</pre>
- <p>The source code for tut2.pr is: </p>
- <pre>for arg in Argv:
- print "Argument:", arg
-</pre>
- 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.</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>