rev 728 - trunk/src

SVN User <[email protected]> Mon, 12 Jul 2004 23:49:44 -0400
Newsgroups gmane.comp.lang.prothon.cvs
Message-ID <[email protected]>
Author: mark
Date: 2004-07-12 23:49:41 -0400 (Mon, 12 Jul 2004)
New Revision: 728

Modified:
   trunk/src/builtins-file.c
   trunk/src/interp.c
Log:
Dir.size() is now recursive

Modified: trunk/src/builtins-file.c
===================================================================
--- trunk/src/builtins-file.c	2004-07-13 03:27:24 UTC (rev 727)
+++ trunk/src/builtins-file.c	2004-07-13 03:49:41 UTC (rev 728)
@@ -212,6 +212,14 @@
 				case DLIST_SIZE:
 					apr_stat(&finfo, filepath, APR_FINFO_SIZE, filep->pool);
 					count += finfo.size;
+					if (finfo.filetype == APR_DIR) {
+						obj_p dir_obj, int_obj;
+						dir_obj = new_dir_obj(ist, filepath);  if_exc_return NULL;
+						int_obj = call_func0(ist, dir_obj, sym(ist, "size")); if_exc_return NULL;
+						count += int_obj->data.i64;
+						del_unlock(dir_obj);
+						del_unlock(int_obj);
+					}
 					break;
 				case DLIST_FILENAMES:
 					list_append( ist, res, ( type == APR_REG ?
@@ -386,7 +394,7 @@
 
 DEF(Dir, size, NULL) {
 	BIN_CONTENT_CHK(Dir);
-	return dir_list(ist, self, APR_REG, DLIST_SIZE, NULL, NULL, 0);
+	return dir_list(ist, self, -1, DLIST_SIZE, NULL, NULL, 0);
 }
 
 DEF(Dir, rename, FPARM1(name, OBJ(NODEF))) {
Modified: trunk/src/interp.c
===================================================================
--- trunk/src/interp.c	2004-07-13 03:27:24 UTC (rev 727)
+++ trunk/src/interp.c	2004-07-13 03:49:41 UTC (rev 728)
@@ -2022,7 +2022,7 @@
 		else {
 			obj_p new_globals = NEW_OBJ(NULL);
 			new_locals = NEW_OBJ(NULL);
-			new_frame = create_frame( ist, new_globals, new_locals, new_locals, 
+			new_frame = create_frame( ist, new_globals, NULL, new_locals, 
 				                           new_locals, NULL, code, "execString" );
 		}
 	}