rev 215 - in trunk: include/prothon modules/String src
SVN User <[email protected]>
| Newsgroups | gmane.comp.lang.prothon.cvs |
|---|---|
| Message-ID | <[email protected]> |
Author: mark
Date: 2004-03-30 14:27:07 -0500 (Tue, 30 Mar 2004)
New Revision: 215
Modified:
trunk/include/prothon/prothon.h
trunk/include/prothon/prothon_dll.h
trunk/modules/String/String.c
trunk/src/object.c
Log:
fixed bug 9, print Object.List -> crash, and some more spelling of immutable
Modified: trunk/include/prothon/prothon.h
===================================================================
--- trunk/include/prothon/prothon.h 2004-03-30 19:01:08 UTC (rev 214)
+++ trunk/include/prothon/prothon.h 2004-03-30 19:27:07 UTC (rev 215)
@@ -896,8 +896,8 @@
// to write_lock the object with immutable set will cause an exception. This bit
// also speeds up processing since the read_lock becomes a no_op when this bit
// is set. This bit is set for many common data types such as Int, String, Etc.
-void set_unmutable(obj_p obj);
-void clr_unmutable(obj_p obj);
+void set_immutable(obj_p obj);
+void clr_immutable(obj_p obj);
//************************** DELETE LOCKING ***********************************
// The garbage collection process in the memory manager will delete any object
Modified: trunk/include/prothon/prothon_dll.h
===================================================================
--- trunk/include/prothon/prothon_dll.h 2004-03-30 19:01:08 UTC (rev 214)
+++ trunk/include/prothon/prothon_dll.h 2004-03-30 19:27:07 UTC (rev 215)
@@ -112,8 +112,8 @@
void (*del_lock)(obj_p obj);
void (*del_unlock)(obj_p obj);
- void (*set_unmutable)(obj_p obj);
- void (*clr_unmutable)(obj_p obj);
+ void (*set_immutable)(obj_p obj);
+ void (*clr_immutable)(obj_p obj);
} pr_services_t;
@@ -207,8 +207,8 @@
#define write_unlock (*services->write_unlock)
#define del_lock (*services->del_lock)
#define del_unlock (*services->del_unlock)
-#define set_unmutable (*services->set_unmutable)
-#define clr_unmutable (*services->clr_unmutable)
+#define set_immutable (*services->set_immutable)
+#define clr_immutable (*services->clr_immutable)
#define get_pr_head_pool (*services->get_pr_head_pool)
#endif // OBJECT_H
Modified: trunk/modules/String/String.c
===================================================================
--- trunk/modules/String/String.c 2004-03-30 19:01:08 UTC (rev 214)
+++ trunk/modules/String/String.c 2004-03-30 19:27:07 UTC (rev 215)
@@ -194,7 +194,7 @@
}
}
dest_ptr[tlen] = 0;
- set_unmutable(obj);
+ set_immutable(obj);
del_unlock(str_list);
return obj;
}
Modified: trunk/src/object.c
===================================================================
--- trunk/src/object.c 2004-03-30 19:01:08 UTC (rev 214)
+++ trunk/src/object.c 2004-03-30 19:27:07 UTC (rev 215)
@@ -268,8 +268,8 @@
dll_services.write_unlock = write_unlock;
dll_services.del_lock = del_lock;
dll_services.del_unlock = del_unlock;
- dll_services.set_unmutable = set_unmutable;
- dll_services.clr_unmutable = clr_unmutable;
+ dll_services.set_immutable = set_immutable;
+ dll_services.clr_immutable = clr_immutable;
dll_services.get_pr_head_pool = get_pr_head_pool;
set_attr(ist, OBJ(OBJECT), sym(ist, "Root_Globals"), OBJ(ROOT_GLOBALS));
@@ -297,6 +297,15 @@
(*dll_initcalls)(&dll_services);
dll_initcalls++;
}
+
+ {
+ list_p lstp = OBJ(LIST_PROTO)->data.ptr =
+ pr_malloc((LIST_OVERHEAD+2) * sizeof(list_t));
+ OBJ(LIST_PROTO)->data_type = OBJ_TYPE_DATAPTR;
+ lstpsize(lstp) = 2;
+ lstplen(lstp) = 0;
+ set_immutable(OBJ(LIST_PROTO));
+ }
}
//********************************* new_object ********************************
@@ -323,15 +332,15 @@
pr_free(obj);
}
-//********************************* set_unmutable *****************************
-void set_unmutable(obj_p obj){
+//********************************* set_immutable *****************************
+void set_immutable(obj_p obj){
get_wrlock(obj, NO_WAIT);
obj->immutable = TRUE;
free_wrlock(obj);
}
-//********************************* clr_unmutable *****************************
-void clr_unmutable(obj_p obj){
+//********************************* clr_immutable *****************************
+void clr_immutable(obj_p obj){
get_wrlock(obj, NO_WAIT);
obj->immutable = FALSE;
free_wrlock(obj);