rev 477 - in trunk: . docs docs/images docs/tutorial include/prothon pr pr/test pr/tutorial
SVN User <[email protected]> Thu, 13 May 2004 13:06:17 -0400
| Newsgroups | gmane.comp.lang.prothon.cvs |
|---|---|
| Message-ID | <[email protected]> |
Author: mark
Date: 2004-05-13 13:06:13 -0400 (Thu, 13 May 2004)
New Revision: 477
Added:
trunk/docs/
trunk/docs/images/
trunk/docs/images/logo_left.jpg
trunk/docs/images/logo_right.jpg
trunk/docs/tutorial/
trunk/docs/tutorial/tutorial1.htm
trunk/docs/tutorial/tutorial2.htm
trunk/pr/test/
trunk/pr/test/bin.pr
trunk/pr/test/bind.pr
trunk/pr/test/chained.pr
trunk/pr/test/closure.pr
trunk/pr/test/dbm.pr
trunk/pr/test/defs.pr
trunk/pr/test/dict.pr
trunk/pr/test/dictadd.pr
trunk/pr/test/file.pr
trunk/pr/test/fixed.pr
trunk/pr/test/func.pr
trunk/pr/test/gen.pr
trunk/pr/test/hex.pr
trunk/pr/test/init.pr
trunk/pr/test/listcomp.pr
trunk/pr/test/meow.pr
trunk/pr/test/modint.pr
trunk/pr/test/new.pr
trunk/pr/test/object.pr
trunk/pr/test/oops.pr
trunk/pr/test/prosist.pr
trunk/pr/test/re.pr
trunk/pr/test/scope.pr
trunk/pr/test/speed.pr
trunk/pr/test/sqlite.pr
trunk/pr/test/stdio.pr
trunk/pr/test/strmod.pr
trunk/pr/test/system.pr
trunk/pr/test/test.pr
trunk/pr/test/threads.pr
trunk/pr/tutorial/
trunk/pr/tutorial/tut1.pr
trunk/pr/tutorial/tut2.pr
Removed:
trunk/pr/bin.pr
trunk/pr/bind.pr
trunk/pr/chained.pr
trunk/pr/closure.pr
trunk/pr/dbm.pr
trunk/pr/defs.pr
trunk/pr/dict.pr
trunk/pr/dictadd.pr
trunk/pr/file.pr
trunk/pr/fixed.pr
trunk/pr/func.pr
trunk/pr/gen.pr
trunk/pr/hex.pr
trunk/pr/init.pr
trunk/pr/listcomp.pr
trunk/pr/meow.pr
trunk/pr/modint.pr
trunk/pr/new.pr
trunk/pr/object.pr
trunk/pr/oops.pr
trunk/pr/prosist.pr
trunk/pr/re.pr
trunk/pr/scope.pr
trunk/pr/speed.pr
trunk/pr/sqlite.pr
trunk/pr/stdio.pr
trunk/pr/strmod.pr
trunk/pr/system.pr
trunk/pr/test.pr
trunk/pr/threads.pr
Modified:
trunk/include/prothon/prothon.h
Log:
turned off debug flags, started tutorial, reorganized
pr folder
Added: trunk/docs/images/logo_left.jpg
===================================================================
(Binary files differ)
Property changes on: trunk/docs/images/logo_left.jpg
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/docs/images/logo_right.jpg
===================================================================
(Binary files differ)
Property changes on: trunk/docs/images/logo_right.jpg
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/docs/tutorial/tutorial1.htm
===================================================================
--- trunk/docs/tutorial/tutorial1.htm 2004-05-13 00:58:47 UTC (rev 476)
+++ trunk/docs/tutorial/tutorial1.htm 2004-05-13 17:06:13 UTC (rev 477)
@@ -0,0 +1,143 @@
+<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>
Added: trunk/docs/tutorial/tutorial2.htm
===================================================================
--- trunk/docs/tutorial/tutorial2.htm 2004-05-13 00:58:47 UTC (rev 476)
+++ trunk/docs/tutorial/tutorial2.htm 2004-05-13 17:06:13 UTC (rev 477)
@@ -0,0 +1,143 @@
+<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>
Modified: trunk/include/prothon/prothon.h
===================================================================
--- trunk/include/prothon/prothon.h 2004-05-13 00:58:47 UTC (rev 476)
+++ trunk/include/prothon/prothon.h 2004-05-13 17:06:13 UTC (rev 477)
@@ -57,9 +57,9 @@
//**************************** DEBUG DEFINITIONS ******************************
-#define TRACE_PARSER
-#define DUMP_MODULE_CODE
-#define TRACE_INTERPRETER
+//#define TRACE_PARSER
+//#define DUMP_MODULE_CODE
+//#define TRACE_INTERPRETER
//#define DUMP_OBJECTS_AT_END
//#define PROSIST_DEBUG
//#define DEBUG_THREADS
Deleted: trunk/pr/bin.pr
===================================================================
--- trunk/pr/bin.pr 2004-05-13 00:58:47 UTC (rev 476)
+++ trunk/pr/bin.pr 2004-05-13 17:06:13 UTC (rev 477)
@@ -1,31 +0,0 @@
-#!/usr/bin/env prothon
-
-# bin.pr
-
-x = Exception
-
-object obj(String, Int):
- Int.init_{obj}(99) # inits using second proto
- print Int.str_{obj}() # prints 99
-
-try:
- with obj: Int.init_{obj}(99) # init Int a second time
-except x,e: print e # throws "object has binary data, expected none"
-
-try:
- obj.init_('abc') # init as String
-except x,e: print e # throws "object has binary data, expected none"
-
-L = Proto(List) # L is uninitialized list
-
-L.init_(1,2,3)
-print L # prints [1, 2, 3]
-
-L.init_(4,5,6)
-print L # prints [4, 5, 6]
-
-d = {1:2, 'a':'b'}
-print d # prints {1:2, 'a':'b'}
-
-d.init_(c = 'd', f = 'g')
-print d # prints {f:'g', c:'d'}
\ No newline at end of file
Deleted: trunk/pr/bind.pr
===================================================================
--- trunk/pr/bind.pr 2004-05-13 00:58:47 UTC (rev 476)
+++ trunk/pr/bind.pr 2004-05-13 17:06:13 UTC (rev 477)
@@ -1,19 +0,0 @@
-#!/usr/bin/env prothon
-
-def func():
- print self
-
-bf33 = func{33}
-bf66 = func{66}
-print bf33 # <func:93b7c0:bound:33>
-print bf66 # <func:93b7e0:bound:66>
-
-bf33() # 33
-bf66() # 66
-bf33{77}() # 77
-bf66{88}() # 88
-
-print bf33 # <func:93b7c0:bound:33>
-print bf33.bindObj_ # 33
-del bf33.bindObj_
-print bf33 # <func:93b7c0>
Deleted: trunk/pr/chained.pr
===================================================================
--- trunk/pr/chained.pr 2004-05-13 00:58:47 UTC (rev 476)
+++ trunk/pr/chained.pr 2004-05-13 17:06:13 UTC (rev 477)
@@ -1,33 +0,0 @@
-#!/usr/bin/env prothon
-
-print "these should all be true\n"
-
-print 1 < 2 < 3 < 5 < 199
-
-print 10 < 20 <= 30 <= 30 >= 30 >= 20 > 10
-
-print 1 < 2 > 1 < 2 > 1
-
-print 1 >= 1 == 1 != 2 == 2 > 1 <= 1 <= 2
-
-print "\n\nthese should all be false\n"
-
-print 1 < 2 < 3 < 2 < 199
-
-print 10 < 20 <= 30 <= 29 >= 30 >= 20 > 10
-
-print 1 < 2 > 2 < 2 > 1
-
-print 1 >= 1 == 2 != 2 == 2 > 1 <= 1 <= 2
-
-def f(i):
- print i,
- return i
-
-print "\n\nThis should print 0 1 2\n"
-f(0) < f(1) < f(2)
-
-print "\n\nThis should print 0 1\n"
-f(0) > f(1) < f(2)
-
-print
Deleted: trunk/pr/closure.pr
===================================================================
--- trunk/pr/closure.pr 2004-05-13 00:58:47 UTC (rev 476)
+++ trunk/pr/closure.pr 2004-05-13 17:06:13 UTC (rev 477)
@@ -1,39 +0,0 @@
-#!/usr/bin/env prothon
-
-print """
-The following should be:
-
-1 2 3 4 5 6 7 8 100
-1 2 3 4 7 6 13 23 200
-"""
-print
-# tested example
-def f1():
- counter = 0
- a=1
- def f2():
- c=3
- def f3():
- e=5
- def f4():
- g=7
- def count():
- print outer.a,outer.b,outer.c,outer.d,outer.e,outer.f,outer.g,outer.h,
- outer.c = outer.a+outer.b
- outer.e = outer.c+outer.d
- outer.g = outer.e+outer.f
- outer.h = outer.c+outer.e+outer.g
- outer.counter += 100
- print outer.counter
- h=8
- return count
- f=6
- return f4()
- d=4
- return f3()
- b=2
- return f2()
-
-c = f1()
-c()
-c()
Deleted: trunk/pr/dbm.pr
===================================================================
--- trunk/pr/dbm.pr 2004-05-13 00:58:47 UTC (rev 476)
+++ trunk/pr/dbm.pr 2004-05-13 17:06:13 UTC (rev 477)
@@ -1,46 +0,0 @@
-#!/usr/bin/env prothon
-
-# dbm.pr
-
-from DBM import DB
-
-db = DB("test.dbm", mode=DBM.RWTRUNCATE)
-
-if db.exists?('a'):
- print 'err1'
- Sys.exit(1)
-
-db.store('a', 'abc' + 0.chr() + 'def')
-db.store('c', 'xyz')
-db.store('b', '')
-
-if not db.exists?('a'):
- print 'err2'
- Sys.exit(1)
-
-if db.fetch('a') != 'abc' + 0.chr() + 'def':
- print 'err3'
- Sys.exit(1)
-
-if db.fetch('b') != '':
- print 'err4'
- Sys.exit(1)
-
-if db.fetch('c') != 'xyz':
- print 'err5'
- Sys.exit(1)
-
-list = []
-k = db.firstKey()
-while k:
- list.append!(k)
- k = db.nextKey(k)
-
-list.sort!()
-
-if list != ['a','b','c']:
- print 'err6'
- Sys.exit(1)
-
-print '\nall tests passed\n'
-
Deleted: trunk/pr/defs.pr
===================================================================
--- trunk/pr/defs.pr 2004-05-13 00:58:47 UTC (rev 476)
+++ trunk/pr/defs.pr 2004-05-13 17:06:13 UTC (rev 477)
@@ -1,18 +0,0 @@
-#!/usr/bin/env prothon
-
-print """
-This should print
-1 2 3 1 2 3
-"""
-
-def outer_func():
- c = 0
- def f():
- outer.c += 1
- return outer.c
- return f
-
-c1 = outer_func()
-c2 = outer_func()
-print c1(),c1(),c1(),c2(),c2(),c2()
-
Deleted: trunk/pr/dict.pr
===================================================================
--- trunk/pr/dict.pr 2004-05-13 00:58:47 UTC (rev 476)
+++ trunk/pr/dict.pr 2004-05-13 17:06:13 UTC (rev 477)
@@ -1,43 +0,0 @@
-#!/usr/bin/env prothon
-
-# dict.pr
-
-d = {1:2}
-if d.keys() != [1] : print 'error in keys'
-if d.values() != [2] : print 'error in values'
-if d.get(1) != 2 : print 'error1 in get'
-if d.get(2) != None : print 'error2 in get'
-if d.get(3,4) != 4 : print 'error3 in get'
-if d.get(3,5) != 5 : print 'error4 in get'
-if d.setDefault!(3,4) != 4 : print 'error5 in setdefault'
-if d.get(3,5) != 4 : print 'error6 in get'
-if 3 not in d: print 'error 7 in notin'
-
-d = {1:2, 3:4}
-e = d.copy()
-
-if d.items() != e.items():
- print 'error1'
-
-if Len(e.items()) != 2:
- print 'error2'
-
-d.clear!()
-
-d = {1:2}
-d.update!({3:4})
-if d.items() != e.items():
- print d.items(), e.items(), 'error3'
-
-if not e.hasKey?(1) or e.hasKey?(2): print 'error4'
-
-print 'all tests passed'
-
-print """
-The following should be:
-1 (1, 2) 3 (3, 4)
-"""
-
-for i in e: print i, d.popItem!(),
-
-print '\n'
Deleted: trunk/pr/dictadd.pr
===================================================================
--- trunk/pr/dictadd.pr 2004-05-13 00:58:47 UTC (rev 476)
+++ trunk/pr/dictadd.pr 2004-05-13 17:06:13 UTC (rev 477)
@@ -1,24 +0,0 @@
-#!/usr/bin/env prothon
-
-d={}
-max = 50
-
-def Key(n):
- return "B%02i" % n
-
-print "Loading dictionary ..."
-
-for n in max:
- d[Key(n)] = True
-
-print "\nChecking dictionary ..."
-lost = False
-for n in max:
- if Key(n) not in d:
- lost = True
- print "Key %s not found" % Key(n)
-
-if lost:
- print d.keys().sort!()
-else:
- print "\ntest passed"
Deleted: trunk/pr/file.pr
===================================================================
--- trunk/pr/file.pr 2004-05-13 00:58:47 UTC (rev 476)
+++ trunk/pr/file.pr 2004-05-13 17:06:13 UTC (rev 477)
@@ -1,42 +0,0 @@
-#!/usr/bin/env prothon
-
-import File
-
-f = File("test.txt", 'w+')
-for i in 5:
- f.write("line "+i+'\n')
-f.writeLines( ['line 5\n','line 6\n','line 7\n','line 8\n','line 9\n',])
-f.close()
-
-ref = ['line 0\n','line 1\n','line 2\n','line 3\n','line 4\n',]
-ref += ['line 5\n','line 6\n','line 7\n','line 8\n','line 9\n',]
-
-f = File("test.txt")
-x = f.read()
-print x
-if (x != ''.join(ref)):
- print "test failed: x != f"
- Sys.exit(1)
-
-f.seek(7)
-x = f.read(7)
-print x
-if (x != 'line 1\n'):
- print "test failed: x != 'line 1'"
- Sys.exit(1)
-
-f.seek(21)
-x = f.read(14)
-print x
-if (x != 'line 3\nline 4\n'):
- print "test failed: x != 'line 3line 4'"
- Sys.exit(1)
-
-x = f.readLines()
-ref = ['line 5\n','line 6\n','line 7\n','line 8\n','line 9\n',]
-print x
-if (''.join(x) != ''.join(ref)):
- print "test failed: x != 'line 5','line 6','line 7','line 8','line 9'"
- Sys.exit(1)
-
-print "\nall tests passed"
Deleted: trunk/pr/fixed.pr
===================================================================
--- trunk/pr/fixed.pr 2004-05-13 00:58:47 UTC (rev 476)
+++ trunk/pr/fixed.pr 2004-05-13 17:06:13 UTC (rev 477)
@@ -1,36 +0,0 @@
-#!/usr/bin/env prothon
-
-object Fixed(Int):
- dp = 2
- divisor = 100
-
- def call_(n=0, decimalplaces=2):
- obj = Proto(self)
- obj.dp = decimalplaces
- obj.divisor = 10
- obj.init_(n) # binary data init here
- return obj
-
-object PrettyPrintFixed(Fixed):
-
- def init_(n):
- Int.init_{self}(n)
- # Set default print format width.
- self.setPrintWidth(self.dp+5)
-
- def setPrintWidth(wid):
- # Create string comprehension "%W.Pf"
- # where W is wid and P is selfdp
- self.pattern = "%%%i.%if" % (wid, self.dp)
- print self.pattern
-
- def str_():
- return self.pattern % (self / self.divisor)
-
-print """
-This should print
-
-%6.1f
-123456.7
-"""
-print PrettyPrintFixed(1234567, 1)
Deleted: trunk/pr/func.pr
===================================================================
--- trunk/pr/func.pr 2004-05-13 00:58:47 UTC (rev 476)
+++ trunk/pr/func.pr 2004-05-13 17:06:13 UTC (rev 477)
@@ -1,29 +0,0 @@
-#!/usr/bin/env prothon
-
-print """
-
-following should print
-
-f1 a
-f2 b
-f2 c
-f1 d
-f2 e
-"""
-def f1(x=''):
- print 'f1 '+x
-
-def f2(y=''):
- print 'f2 '+y
-
-f = Proto(f1)
-f.init_(f2)
-
-f1('a')
-f2('b')
-f('c')
-
-g = Func(f1)
-h = Func(f2)
-g('d')
-h('e')
Deleted: trunk/pr/gen.pr
===================================================================
--- trunk/pr/gen.pr 2004-05-13 00:58:47 UTC (rev 476)
+++ trunk/pr/gen.pr 2004-05-13 17:06:13 UTC (rev 477)
@@ -1,16 +0,0 @@
-#!/usr/bin/env prothon
-
-gen _outer(n):
- x = -1
- def inner():
- return outer.x
- yield inner
- for x in n:
- yield x
-
-iter = _outer(10)
-inner = iter.next()
-
-print inner()
-for x in iter:
- print x, inner()
Deleted: trunk/pr/hex.pr
===================================================================
--- trunk/pr/hex.pr 2004-05-13 00:58:47 UTC (rev 476)
+++ trunk/pr/hex.pr 2004-05-13 17:06:13 UTC (rev 477)
@@ -1,16 +0,0 @@
-#!/usr/bin/env prothon
-
-def hex(n):
- s = ""
- while n:
- d = n & 0xf
- n = n >> 4
- if d < 10: s = ('0'.ord()+d).chr() + s
- else: s = ('a'.ord()+d-10).chr() + s
- return s
-
-print hex(0x100)
-
-n=0x0123456789abcdef
-
-print hex(n & 0x0f0f0f0f0f0f0f0f)
Deleted: trunk/pr/init.pr
===================================================================
--- trunk/pr/init.pr 2004-05-13 00:58:47 UTC (rev 476)
+++ trunk/pr/init.pr 2004-05-13 17:06:13 UTC (rev 477)
@@ -1,21 +0,0 @@
-#!/usr/bin/env prothon
-
-# init.pr
-
-print
-print """This should print:
-0 1234 0 -1
-0 12.34 .333333
- abc 123
-() (1, 2, 3) (4, 5, 6)
-[] [1, 2, 3] [4, 5, 6]
-{1:2, 3:4} {a:1, b:2, c:3}
-
-"""
-
-print Int(), Int(1234), Int(1//3), Int(-01)
-print Float(), Float(12.34), Float(1/3) # Float(-0.1) ERR XXX
-print String(), String("abc"), String(123)
-print Tuple(), Tuple(*(1,2,3)), Tuple(4,5,6)
-print List(), List(*[1,2,3]), List(4,5,6)
-print Dict(**{1:2, 3:4}), Dict(a=1, b=2, c=3)
Deleted: trunk/pr/listcomp.pr
===================================================================
--- trunk/pr/listcomp.pr 2004-05-13 00:58:47 UTC (rev 476)
+++ trunk/pr/listcomp.pr 2004-05-13 17:06:13 UTC (rev 477)
@@ -1,22 +0,0 @@
-#!/usr/bin/env prothon
-
-# listcomp.pr
-
-lst = [x for x in 4]
-if lst != [0, 1, 2, 3]:
- print "err1"
- Sys.exit(1)
-
-lst = [(x,y) for x in 2 for y in 2]
-if lst != [(0, 0), (0, 1), (1, 0), (1, 1)]:
- print "err2"
- Sys.exit(1)
-
-lst = [(x,y) for x in 4 if x%2==0 for y in 4 if y%2==1]
-if lst != [(0, 1), (0, 3), (2, 1), (2, 3)]:
- print "err3"
- Sys.exit(1)
-
-print
-print "all tests passed"
-print
Deleted: trunk/pr/meow.pr
===================================================================
--- trunk/pr/meow.pr 2004-05-13 00:58:47 UTC (rev 476)
+++ trunk/pr/meow.pr 2004-05-13 17:06:13 UTC (rev 477)
@@ -1,31 +0,0 @@
-#!/usr/bin/env prothon
-
-Animal = Object()
-with Animal:
- def describe():
- print "I am an animal."
- self.make_noise()
- def make_noise():
- print "I make animal noise."
-
-Mammal = Animal()
-with Mammal:
- def describe():
- print "I am a mammal."
- Animal.describe{self}()
- self.make_noise()
- def make_noise():
- print "I make mammal noise."
-
-Cat = Mammal()
-with Cat:
- def describe():
- print "I am a cat."
- Mammal.describe{self}()
- self.make_noise()
- def make_noise():
- print "meow"
-
-c = Cat()
-c.describe()
-
Deleted: trunk/pr/modint.pr
===================================================================
--- trunk/pr/modint.pr 2004-05-13 00:58:47 UTC (rev 476)
+++ trunk/pr/modint.pr 2004-05-13 17:06:13 UTC (rev 477)
@@ -1,40 +0,0 @@
-#!/usr/bin/env prothon
-
-object ModInt(Int):
- modulo = 10
- def init_(i=0):
- Int.init_{self}(i % self.modulo)
- def add_(other):
- if self.modulo != other.modulo:
- raise TypeError
- return (self.protoList()[1])(Int.add_{self}(other) % self.modulo)
-
-object Mod16Int(ModInt):
- modulo = 16
-
-object Mod16IntC(Mod16Int):
- cache = {}
- def init_(i):
- i = i % self.modulo
- if i in cache:
- print cache[i] , 'from cache'
- return cache[i]
- obj = Mod16Int(i)
- cache[i] = obj
- print obj, 'new'
- return obj
-
-print """
-
-Should print
-
-11 new
-8 new
-8 from cache
-11 + 8 + 8 = 11
-"""
-
-i = Mod16IntC(27)
-j = Mod16IntC(8)
-k = Mod16IntC(8)
-print "%i + %i + %i = %02i" % (i, j, k, (i + j + k))
Deleted: trunk/pr/new.pr
===================================================================
--- trunk/pr/new.pr 2004-05-13 00:58:47 UTC (rev 476)
+++ trunk/pr/new.pr 2004-05-13 17:06:13 UTC (rev 477)
@@ -1,26 +0,0 @@
-#!/usr/bin/env prothon
-
-def New(proto, *args, **kwargs):
- newObj = Proto(proto)
- newObj.init_(*args, **kwargs)
- return newObj
-
-p = Object()
-with p:
- x = None
- def init_(x):
- self.x = x
- def str_():
- return '*'+self.x+'*'
-
-print
-print 'Should print ...'
-print '*1*'
-print '*a*'
-print
-
-x = New(p, 1)
-print x
-
-y = New(p, 'a')
-print y
Deleted: trunk/pr/object.pr
===================================================================
--- trunk/pr/object.pr 2004-05-13 00:58:47 UTC (rev 476)
+++ trunk/pr/object.pr 2004-05-13 17:06:13 UTC (rev 477)
@@ -1,22 +0,0 @@
-#!/usr/bin/env prothon
-
-# object.pr
-
-object Point(Object):
- x = 0; y = 0
- def init_(x, y):
- self.x=x; self.y=y
- def move(xofs, yofs):
- self.x += xofs; self.y += yofs
- print self
- def str_():
- return '<'+self.x+':'+self.y+'>'
-
-print
-print "Should print..."
-print '<5:50>'
-print '<15:150>'
-print
-p = Point(5, 50)
-print p
-p.move(10, 100)
Deleted: trunk/pr/oops.pr
===================================================================
--- trunk/pr/oops.pr 2004-05-13 00:58:47 UTC (rev 476)
+++ trunk/pr/oops.pr 2004-05-13 17:06:13 UTC (rev 477)
@@ -1,19 +0,0 @@
-#!/usr/bin/env prothon
-
-Emp_proto = Object()
-
-with Emp_proto:
-
- name = "<proto name>"
-
- def init_(name):
- self.name = name
- hello()
-
- def hello():
- print "My name is:", self.name
-
-
-Emp_proto.hello()
-emp = Emp_proto("Jim")
-emp.hello()
Deleted: trunk/pr/prosist.pr
===================================================================
--- trunk/pr/prosist.pr 2004-05-13 00:58:47 UTC (rev 476)
+++ trunk/pr/prosist.pr 2004-05-13 17:06:13 UTC (rev 477)
@@ -1,75 +0,0 @@
-#!/usr/bin/env prothon
-
-# prosist.pr
-
-print
-print ' NOTE: This test is not yet easily readable for success or failure'
-print ' For now consider not locking up a success :) '
-print
-import Prosist
-
-b = 7.3
-
-c = "This is the original data"
-
-d = ('i', 'am', 'a', 'tuple')
-
-e = 1234
-
-f = {"i":"am", "a":"dict"}
-
-g = Object()
-g.a = 1
-g.b = '2'
-g.c = {'3':{4:'5'},'4':None}
-
-a = {1:b, 2:c, 3:[d,e], (4,5): f, 6:g}
-
-db = Prosist('test.pdb', root=a, mode=Prosist.RWTRUNCATE)
-
-a[1] = 999
-a[1] = b
-g.b = [11,22]
-
-a[(4,5)] = {'i':'am', 'a':'different', 'dict':'!'}
-a[2] = "This is the data that is going to be rolled back"
-
-print
-print a, a[6].a , a[6].b , a[6].c
-
-
-db.rollBack()
-
-print
-print a, a[6].a , a[6].b , a[6].c
-
-
-a[1] = 999
-a[1] = b
-g.b = [11,22]
-
-a[(4,5)] = {'i':'am', 'a':'different', 'dict':'!'}
-a[2] = 'The is the data that is going to be committed'
-
-db.commit()
-
-print
-print a, a[6].a , a[6].b , a[6].c
-
-db.close()
-db = Prosist('test.pdb')
-x = db.root
-db.close()
-
-print
-print 'these two should match .. '
-print
-print a, a[6].a , a[6].b , a[6].c
-
-del g.a, g.b, g.c, g, d, c, b, e, f['i'], f['a'], f, a[1], a[2], a[3], a[(4,5)], a[6], a
-a = 1
-
-print
-print x,
-y = x[6]
-print y.a, y.b, y.c
Deleted: trunk/pr/re.pr
===================================================================
--- trunk/pr/re.pr 2004-05-13 00:58:47 UTC (rev 476)
+++ trunk/pr/re.pr 2004-05-13 17:06:13 UTC (rev 477)
@@ -1,39 +0,0 @@
-#!/usr/bin/env prothon
-
-import Re
-
-def findAll(r,s):
- result=[]
- def foundOne(mo):
- outer.result.append!(mo.group())
- return ''
- r.sub(foundOne, s)
- return result
-
-re = Re.compile("m..k")
-
-s = 'this mark likes to muck around in minks'
-
-print findAll(re, s)
-
-print re.findAll(s)
-
-print re.split(s, 2)
-
-mo = re.search(s, 10)
-
-print mo.group(), mo.groups()
-
-re = Re.compile(" (m..k) (l..e)")
-
-mo = re.search(s, 2, 20)
-
-print mo.group(), mo.groups(), mo.expand(r'grp1:<\1> grp2:<\2>')
-
-print "\n-------- above should look like ... -------------\n"
-
-print "['mark', 'muck', 'mink']"
-print "['mark', 'muck', 'mink']"
-print "['this ', ' likes to ', ' around in minks']"
-print "mark ('mark')"
-print " mark like (' mark like', 'mark', 'like') grp1:<mark> grp2:<like>"
Deleted: trunk/pr/scope.pr
===================================================================
--- trunk/pr/scope.pr 2004-05-13 00:58:47 UTC (rev 476)
+++ trunk/pr/scope.pr 2004-05-13 17:06:13 UTC (rev 477)
@@ -1,24 +0,0 @@
-#!/usr/bin/env prothon
-
-print """
-This should print
-1 2 3 4 5 6
-"""
-
-a = 1
-B = 2
-def f1():
- c = 3
- d = 99
- def f2():
- c = 99
- d = 4
- print a, B, outer.c, d, self.x, caller.x
- return f2
-
-object obj:
- x = 5
- f = f1()
-
-x=6
-obj.f()
Deleted: trunk/pr/speed.pr
===================================================================
--- trunk/pr/speed.pr 2004-05-13 00:58:47 UTC (rev 476)
+++ trunk/pr/speed.pr 2004-05-13 17:06:13 UTC (rev 477)
@@ -1,7 +0,0 @@
-#!/usr/bin/env prothon
-
-l=List()
-for i in 10000:
- l.append!("ben")
- if not (i % 100):
- print i
Deleted: trunk/pr/sqlite.pr
===================================================================
--- trunk/pr/sqlite.pr 2004-05-13 00:58:47 UTC (rev 476)
+++ trunk/pr/sqlite.pr 2004-05-13 17:06:13 UTC (rev 477)
@@ -1,72 +0,0 @@
-#!/usr/bin/env prothon
-
-# sqlite.pr
-
-import SQLite
-
-conn = SQLite.connect('test.db')
-curs = conn.cursor()
-
-try: curs.execute!("drop table tbl1")
-except: pass
-try: curs.execute!("drop table tbl2")
-except: pass
-
-curs.execute!("create table tbl1 (a INTEGER PRIMARY KEY, b INTEGER, c INTEGER)")
-curs.execute!("create table tbl2 (d INTEGER PRIMARY KEY, a INTEGER, e INTEGER)")
-
-curs.execute!("insert into tbl1 values (1, 10, 100)")
-
-curs.execute!("insert into tbl2 values (1, 1, 101)")
-curs.execute!("insert into tbl2 values (2, 1, 102)")
-curs.execute!("insert into tbl2 values (3, 1, 103)")
-curs.execute!("insert into tbl2 values (4, 1, 104)")
-curs.execute!("insert into tbl2 values (5, 1, 105)")
-curs.execute!("insert into tbl2 values (6, 1, 106)")
-curs.execute!("insert into tbl2 values (7, 1, 107)")
-curs.execute!("insert into tbl2 values (8, 1, 108)")
-curs.execute!("insert into tbl2 values (9, 1, 109)")
-
-curs.execute!("insert into tbl1 values (2, 20, 200)")
-
-curs.execute!("insert into tbl2 values (10, 2, 201)")
-curs.execute!("insert into tbl2 values (11, 2, 202)")
-curs.execute!("insert into tbl2 values (12, 2, 203)")
-curs.execute!("insert into tbl2 values (13, 2, 204)")
-curs.execute!("insert into tbl2 values (14, 2, 205)")
-curs.execute!("insert into tbl2 values (15, 2, 206)")
-curs.execute!("insert into tbl2 values (16, 2, 207)")
-curs.execute!("insert into tbl2 values (17, 2, 208)")
-curs.execute!("insert into tbl2 values (18, 2, 209)")
-
-curs1 = conn.cursor()
-curs2 = conn.cursor()
-
-curs1.execute!("select * from tbl1")
-
-if curs1.rowCount() != 2:
- print 'curs1.rowCount() error'
- Sys.exit(1)
-
-rows1 = curs1.fetchAll()
-for row in rows1:
- curs2.execute!('select * from tbl2 where a='+row[0])
- if curs2.rowCount() != 9:
- print 'curs2.rowCount() error, rows1:', rows1, 'rowCount:',curs2.rowCount()
- Sys.exit(1)
- for i in 4:
- row2 = curs2.fetchOne()
- if row2[2] != ''+(101+i) and row2[2] != ''+(201+i):
- print 'row2[2] error'
- Sys.exit(1)
- rows2 = curs2.fetchMany(3)
- if Len(rows2) != 3:
- print 'Len(rows2) error1, rows2:', rows2
- Sys.exit(1)
- rows2 = curs2.fetchMany(3)
- if Len(rows2) != 2:
- print 'Len(rows2) error2'
- Sys.exit(1)
-conn.close()
-
-print '\nall tests passed\n'
Deleted: trunk/pr/stdio.pr
===================================================================
--- trunk/pr/stdio.pr 2004-05-13 00:58:47 UTC (rev 476)
+++ trunk/pr/stdio.pr 2004-05-13 17:06:13 UTC (rev 477)
@@ -1,21 +0,0 @@
-#!/usr/bin/env prothon
-
-import File
-
-stdout = File.stdout
-stdin = File.stdin
-stderr = File.stderr
-
-stdout.write("Enter your name: ")
-
-name = stdin.readLine()
-
-stdout.write("Hello " + name)
-
-stderr.write("This is written on stderr\n")
-
-print "Opening test file for stdout"
-
-File.setStdOut(File("stdout.txt", "w+"))
-stdout.write("Should still go to stdout\n")
-File.stdout.write("Should go to stdout.txt file\n")
Deleted: trunk/pr/strmod.pr
===================================================================
--- trunk/pr/strmod.pr 2004-05-13 00:58:47 UTC (rev 476)
+++ trunk/pr/strmod.pr 2004-05-13 17:06:13 UTC (rev 477)
@@ -1,109 +0,0 @@
-#!/usr/bin/env prothon
-
-# strmod.pr
-
-# TODO:
-# *) More comprehensive tests, especially replace() and split().
-# *) Test binary string handling (when parser is fixed).
-
-failures = 0
-
-s = "test %4d..%4.2e..%s" % (-12, 100/3, 'jhgdjhg')
-
-if s != 'test -12..3.33e+01..jhgdjhg':
- print 'error 1'
- print s
- failures = failures+1
-
-if "abCDefG".lower() != "abcdefg":
- print "lower() failed!"
- failures = failures+1
-
-if "abCDefG345%^&".lower() != "abcdefg345%^&":
- print "lower() failed!"
- failures = failures+1
-
-if "abCDefG".upper() != "ABCDEFG":
- print "upper() failed!"
- failures = failures+1
-
-if "+_098abCDefG".upper() != "+_098ABCDEFG":
- print "upper() failed!"
- failures = failures+1
-
-if "abCDefG".replace("CDe","456") != "ab456fG":
- print "replace() failed!"
- failures = failures+1
-
-if "abcdefg".capitalize() != "Abcdefg":
- print "capitalize() failed!"
- failures = failures+1
-
-if "a\tb\tcde".expandTabs() != "a b cde":
- print "expandtabs() failed!"
- failures = failures+1
-
-if " \t \r\n abc".lStrip() != "abc":
- print "lstrip() failed!"
- failures = failures+1
-
-if "abc \t \r\n ".rStrip() != "abc":
- print "rstrip() failed!"
- failures = failures+1
-
-if " \t \r\n abc \t \r\n ".strip() != "abc":
- print "strip() failed!"
- failures = failures+1
-
-if ".a.bc.def.ghij.".split('.') != ['', 'a', 'bc', 'def', 'ghij', '']:
- print "split() failed!"
- failures = failures+1
-
-if "a.bc.def.ghij".split('.') != ['a', 'bc', 'def', 'ghij']:
- print "split() failed!"
- failures = failures+1
-
-if "a.bc.def.ghij.".split('.') != ['a', 'bc', 'def', 'ghij', '']:
- print "split() failed!"
- failures = failures+1
-
-if "..a.bc.def.ghij.".split('.') != ['', '', 'a', 'bc', 'def', 'ghij', '']:
- print "split() failed!"
- failures = failures+1
-
-if "a.bc.def.ghij".split('a') != ['', '.bc.def.ghij']:
- print "split() failed!"
- failures = failures+1
-
-if "a.ab.abc.abcd".split('a') != ['', '.', 'b.', 'bc.', 'bcd']:
- print "split() failed!"
- failures = failures+1
-
-if ".a.ab.abc.abcd".split('a') != ['.', '.', 'b.', 'bc.', 'bcd']:
- print "split() failed!"
- failures = failures+1
-
-if ".a.ab.abc.abcd.".split('a') != ['.', '.', 'b.', 'bc.', 'bcd.']:
- print "split() failed!"
- failures = failures+1
-
-if "aaaaabaacaadaaaaabaacaad".split("aab") != ["aaa","aacaadaaa","aacaad"]:
- print "split() failed!"
- failures = failures+1
-
-if "aaaaabaacaadaaaaabaacaad".find("aab",0) != 3:
- print "split() failed!"
- failures = failures+1
-
-s = "%d" % 3333
-
-if s != '3333':
- print 'error 2'
- print s
- failures = failures+1
-
-if failures==0:
- print '\nall tests passed\n'
-else:
- print "%d failure(s) occurred!\n"%failures
- Sys.exit(1)
Deleted: trunk/pr/system.pr
===================================================================
--- trunk/pr/system.pr 2004-05-13 00:58:47 UTC (rev 476)
+++ trunk/pr/system.pr 2004-05-13 17:06:13 UTC (rev 477)
@@ -1,13 +0,0 @@
-#!/usr/bin/env prothon
-
-import OS
-
-print
-print 'The following lines should be:'
-print 'hello'
-print '0'
-print
-
-ret = OS.system("echo hello")
-print ret
-print
\ No newline at end of file
Copied: trunk/pr/test/bin.pr (from rev 475, trunk/pr/bin.pr)
Copied: trunk/pr/test/bind.pr (from rev 475, trunk/pr/bind.pr)
Copied: trunk/pr/test/chained.pr (from rev 475, trunk/pr/chained.pr)
Copied: trunk/pr/test/closure.pr (from rev 475, trunk/pr/closure.pr)
Copied: trunk/pr/test/dbm.pr (from rev 475, trunk/pr/dbm.pr)
Copied: trunk/pr/test/defs.pr (from rev 475, trunk/pr/defs.pr)
Copied: trunk/pr/test/dict.pr (from rev 475, trunk/pr/dict.pr)
Copied: trunk/pr/test/dictadd.pr (from rev 475, trunk/pr/dictadd.pr)
Copied: trunk/pr/test/file.pr (from rev 475, trunk/pr/file.pr)
Copied: trunk/pr/test/fixed.pr (from rev 475, trunk/pr/fixed.pr)
Copied: trunk/pr/test/func.pr (from rev 475, trunk/pr/func.pr)
Copied: trunk/pr/test/gen.pr (from rev 475, trunk/pr/gen.pr)
Copied: trunk/pr/test/hex.pr (from rev 475, trunk/pr/hex.pr)
Copied: trunk/pr/test/init.pr (from rev 475, trunk/pr/init.pr)
Copied: trunk/pr/test/listcomp.pr (from rev 475, trunk/pr/listcomp.pr)
Copied: trunk/pr/test/meow.pr (from rev 475, trunk/pr/meow.pr)
Copied: trunk/pr/test/modint.pr (from rev 475, trunk/pr/modint.pr)
Copied: trunk/pr/test/new.pr (from rev 476, trunk/pr/new.pr)
Copied: trunk/pr/test/object.pr (from rev 476, trunk/pr/object.pr)
Copied: trunk/pr/test/oops.pr (from rev 476, trunk/pr/oops.pr)
Copied: trunk/pr/test/prosist.pr (from rev 475, trunk/pr/prosist.pr)
Copied: trunk/pr/test/re.pr (from rev 476, trunk/pr/re.pr)
Copied: trunk/pr/test/scope.pr (from rev 475, trunk/pr/scope.pr)
Copied: trunk/pr/test/speed.pr (from rev 475, trunk/pr/speed.pr)
Copied: trunk/pr/test/sqlite.pr (from rev 475, trunk/pr/sqlite.pr)
Copied: trunk/pr/test/stdio.pr (from rev 475, trunk/pr/stdio.pr)
Copied: trunk/pr/test/strmod.pr (from rev 475, trunk/pr/strmod.pr)
Copied: trunk/pr/test/system.pr (from rev 475, trunk/pr/system.pr)
Copied: trunk/pr/test/test.pr (from rev 476, trunk/pr/test.pr)
Copied: trunk/pr/test/threads.pr (from rev 476, trunk/pr/threads.pr)
Deleted: trunk/pr/test.pr
===================================================================
--- trunk/pr/test.pr 2004-05-13 00:58:47 UTC (rev 476)
+++ trunk/pr/test.pr 2004-05-13 17:06:13 UTC (rev 477)
@@ -1,4 +0,0 @@
-#!/usr/bin/env prothon
-
-for i in 10:
- print i
Deleted: trunk/pr/threads.pr
===================================================================
--- trunk/pr/threads.pr 2004-05-13 00:58:47 UTC (rev 476)
+++ trunk/pr/threads.pr 2004-05-13 17:06:13 UTC (rev 477)
@@ -1,30 +0,0 @@
-#!/usr/bin/env prothon
-
-# threads.pr
-
-Finished_thread_count = 0
-
-def func(n, d):
- my_thread = CurrentThread()
- print my_thread, "started"
- for i in n:
- Sleep(d)
- print my_thread, "has been running",(i+1)*d,'seconds'
- outer.Finished_thread_count += 1
-
-a = Thread(func, [10, 1.0000], "A")
-b = Thread(func, [ 5, 2.0000], "B")
-c = Thread(func, [ 3, 3.3333], "C")
-
-/*
-these cause an apr_error ???
-a.join()
-b.join()
-c.join()
-*/
-
-while Finished_thread_count < 3:
- Sleep(0.1)
-print
-print 'All threads finished'
-print
Added: trunk/pr/tutorial/tut1.pr
===================================================================
--- trunk/pr/tutorial/tut1.pr 2004-05-13 00:58:47 UTC (rev 476)
+++ trunk/pr/tutorial/tut1.pr 2004-05-13 17:06:13 UTC (rev 477)
@@ -0,0 +1,2 @@
+
+print "hello world"
\ No newline at end of file
Added: trunk/pr/tutorial/tut2.pr
===================================================================
--- trunk/pr/tutorial/tut2.pr 2004-05-13 00:58:47 UTC (rev 476)
+++ trunk/pr/tutorial/tut2.pr 2004-05-13 17:06:13 UTC (rev 477)
@@ -0,0 +1,3 @@
+
+for arg in Argv:
+ print "Argument:", arg