rev 409 - in trunk: pr src

SVN User <[email protected]> Sat, 24 Apr 2004 16:17:34 -0400
Newsgroups gmane.comp.lang.prothon.cvs
Message-ID <[email protected]>
Author: mark
Date: 2004-04-24 16:17:31 -0400 (Sat, 24 Apr 2004)
New Revision: 409

Modified:
   trunk/pr/test.pr
   trunk/src/builtins-string.c
Log:
fixed string.__iter__()

Modified: trunk/pr/test.pr
===================================================================
--- trunk/pr/test.pr	2004-04-24 20:01:41 UTC (rev 408)
+++ trunk/pr/test.pr	2004-04-24 20:17:31 UTC (rev 409)
@@ -1,4 +1,4 @@
 #!/usr/bin/env prothon
 
-try: 1/0
-except Exception, e: print e.__doc__
+for i in "hello":
+	print i

Modified: trunk/src/builtins-string.c
===================================================================
--- trunk/src/builtins-string.c	2004-04-24 20:01:41 UTC (rev 408)
+++ trunk/src/builtins-string.c	2004-04-24 20:17:31 UTC (rev 409)
@@ -394,16 +394,16 @@
         int ch;
         obj_p res = NULL;
         char* res_str;
-        wrlock_rtrn(self) NULL;
-        if ((ch = *pr_strptr(self))) {
-		self->data.ptr = (i64_t *)(((char*)self->data.ptr) + 1);
+        def_write_lock(self);
+        if ((ch = *((char*)self->data.ptr))) {
+				self->data.ptr = (i64_t *)(((char*)self->data.ptr) + 1);
                 res = NEW_OBJ(String_OBJ);
                 res_str = (char*)obj_malloc(res, 2);
                 res_str[0] = ch;
                 res_str[1] = 0;
         } else
                 raise_exception(ist, OBJ(STOP_ITERATION_EXC), NULL);
-        write_unlock(ist, self);
+        def_write_unlock(self);
         return res;
 }