rev 130 - in trunk: include/prothon modules/Int modules/Re src
SVN User <[email protected]>
| Newsgroups | gmane.comp.lang.prothon.cvs |
|---|---|
| Message-ID | <[email protected]> |
Author: mark
Date: 2004-03-25 23:59:03 -0500 (Thu, 25 Mar 2004)
New Revision: 130
Modified:
trunk/include/prothon/prothon.h
trunk/include/prothon/prothon_dll.h
trunk/modules/Int/Int.c
trunk/modules/Re/Re.c
trunk/src/argproc.c
trunk/src/builtins.c
trunk/src/main.c
trunk/src/object.c
Log:
atempted to fix problem with calls to new_string_n_obj
going to new_string_obj
Modified: trunk/include/prothon/prothon.h
===================================================================
--- trunk/include/prothon/prothon.h 2004-03-26 04:27:31 UTC (rev 129)
+++ trunk/include/prothon/prothon.h 2004-03-26 04:59:03 UTC (rev 130)
@@ -482,7 +482,7 @@
// NEW_STRING_OBJ_N: Create a new string object from a C string of N chars long.
// Same as new_string_obj but string length is set by n, not null char at end.
-obj_p new_string_obj_n(char* string, size_t n);
+obj_p new_string_n_obj(char* string, size_t n);
// NEW_LIST_OBJ: Create a new list object with a given initial size
// Only simple ability to create list and append objects are given
Modified: trunk/include/prothon/prothon_dll.h
===================================================================
--- trunk/include/prothon/prothon_dll.h 2004-03-26 04:27:31 UTC (rev 129)
+++ trunk/include/prothon/prothon_dll.h 2004-03-26 04:59:03 UTC (rev 130)
@@ -80,7 +80,7 @@
obj_p (*new_int_obj)(i64_t num);
obj_p (*new_float_obj)(double num);
obj_p (*new_string_obj)(char* string);
- obj_p (*new_string_obj_n)(char* string, size_t n);
+ obj_p (*new_string_n_obj)(char* string, size_t n);
obj_p (*new_tuple_obj)(int fixed_size);
obj_p (*new_list_obj)(int initial_size);
obj_p (*clone_list_obj)(isp ist, obj_p list_obj);
@@ -151,7 +151,7 @@
#define new_int_obj (*services->new_int_obj)
#define new_float_obj (*services->new_float_obj)
#define new_string_obj (*services->new_string_obj)
-#define new_string_obj_n (*services->new_string_obj_n)
+#define new_string_n_obj (*services->new_string_n_obj)
#define new_tuple_obj (*services->new_tuple_obj)
#define new_list_obj (*services->new_list_obj)
#define clone_list_obj (*services->clone_list_obj)
Modified: trunk/modules/Int/Int.c
===================================================================
--- trunk/modules/Int/Int.c 2004-03-26 04:27:31 UTC (rev 129)
+++ trunk/modules/Int/Int.c 2004-03-26 04:59:03 UTC (rev 130)
@@ -288,9 +288,9 @@
}
DEF(INT_PROTO_OBJ, chr, NULL){
- char s[2];
- s[0] = (char) Int_value(self); s[1]=0;
- return new_string_obj(s);
+ char s[1];
+ s[0] = (char) Int_value(self);
+ return new_string_n_obj(s, 1);
}
Modified: trunk/modules/Re/Re.c
===================================================================
--- trunk/modules/Re/Re.c 2004-03-26 04:27:31 UTC (rev 129)
+++ trunk/modules/Re/Re.c 2004-03-26 04:59:03 UTC (rev 130)
@@ -143,18 +143,18 @@
}
if (ngrps == 0) {
sp = m[0].rm_so;
- list_append(ist, res, new_string_obj_n(s+sp, m[0].rm_eo-sp));
+ list_append(ist, res, new_string_n_obj(s+sp, m[0].rm_eo-sp));
} else if (ngrps == 1) {
if ((sp = m[1].rm_so) == -1)
list_append(ist, res, new_string_obj(""));
else
- list_append(ist, res, new_string_obj_n(s+sp, m[1].rm_eo-sp));
+ list_append(ist, res, new_string_n_obj(s+sp, m[1].rm_eo-sp));
} else {
tuple_obj = new_tuple_obj(ngrps);
for (i=1; i <= ngrps; i++) {
sp = m[i].rm_so; ep = m[i].rm_eo;
if (sp == -1) list_append(ist, tuple_obj, new_string_obj(""));
- else list_append(ist, tuple_obj, new_string_obj_n(s+sp,ep-sp));
+ else list_append(ist, tuple_obj, new_string_n_obj(s+sp,ep-sp));
}
list_append(ist, res, tuple_obj);
tuple_obj->unmutable = TRUE;
@@ -262,18 +262,18 @@
return NULL;
}
if (m[0].rm_so == m[0].rm_eo) continue;
- list_append(ist, res, new_string_obj_n(s+last_split, m[0].rm_so-last_split));
+ list_append(ist, res, new_string_n_obj(s+last_split, m[0].rm_so-last_split));
for(i=1; i <= ngrps; i++) {
if ((sp = m[i].rm_so) == -1)
list_append(ist, res, OBJ(NONE));
else
- list_append(ist, res, new_string_obj_n(s+sp, m[i].rm_eo-sp));
+ list_append(ist, res, new_string_n_obj(s+sp, m[i].rm_eo-sp));
}
last_split = m[0].rm_eo;
if (maxsplit && ++split_count == maxsplit) break;
}
if ((sp=last_split) != (ep=strlen(s)))
- list_append(ist, res, new_string_obj_n(s+sp, ep-sp));
+ list_append(ist, res, new_string_n_obj(s+sp, ep-sp));
pr_free(m);
return res;
}
@@ -587,7 +587,7 @@
sp = (int)(list_item(ist, self, j*2 )->data.i64);
ep = (int)(list_item(ist, self, j*2+1)->data.i64);
if (sp == -1) return OBJ(NONE);
- else return new_string_obj_n(orig_s+sp, ep-sp);
+ else return new_string_n_obj(orig_s+sp, ep-sp);
} else {
res = new_tuple_obj(llen);
for (i=0; i < llen; i++) {
@@ -596,7 +596,7 @@
sp = (int)(list_item(ist, self, j*2 )->data.i64);
ep = (int)(list_item(ist, self, j*2+1)->data.i64);
if (sp == -1) list_append(ist, res, OBJ(NONE));
- else list_append(ist, res, new_string_obj_n(orig_s+sp, ep-sp));
+ else list_append(ist, res, new_string_n_obj(orig_s+sp, ep-sp));
}
res->unmutable = TRUE;
return res;
@@ -613,7 +613,7 @@
sp = (int)(list_item(ist, self, i*2 )->data.i64);
ep = (int)(list_item(ist, self, i*2+1)->data.i64);
if (sp == -1) list_append(ist, res, parms[1]);
- else list_append(ist, res, new_string_obj_n(orig_s+sp, ep-sp));
+ else list_append(ist, res, new_string_n_obj(orig_s+sp, ep-sp));
}
res->unmutable = TRUE;
return res;
Modified: trunk/src/argproc.c
===================================================================
--- trunk/src/argproc.c 2004-03-26 04:27:31 UTC (rev 129)
+++ trunk/src/argproc.c 2004-03-26 04:59:03 UTC (rev 130)
@@ -82,10 +82,10 @@
printf ("Unterminated quote in command-line parameter\n");
return NULL;
}
- list_append(ist, argv, new_string_obj_n(p+1, p1-p-1));
+ list_append(ist, argv, new_string_n_obj(p+1, p1-p-1));
} else {
for (p1=p; *p1 && *p1 != ' ' && *p1 != '\t'; p1++);
- list_append(ist, argv, new_string_obj_n(p, p1-p));
+ list_append(ist, argv, new_string_n_obj(p, p1-p));
}
for (p = p1; *p && (*p == ' ' || *p == '\t'); p++);
}
Modified: trunk/src/builtins.c
===================================================================
--- trunk/src/builtins.c 2004-03-26 04:27:31 UTC (rev 129)
+++ trunk/src/builtins.c 2004-03-26 04:59:03 UTC (rev 130)
@@ -306,7 +306,7 @@
}
if (slice_len == 1) {
if (seq_type == SEQ_TYPE_STRING) {
- return new_string_obj_n(self_str+index1, 1);
+ return new_string_n_obj(self_str+index1, 1);
} else
return list_item(ist, self, index1);
}
@@ -364,7 +364,7 @@
char* s = pr_malloc(exp_len+2);
for(i = index1, j=0; i < index2; i += index3, j++)
s[j] = self_str[i];
- res = new_string_obj_n(s, j);
+ res = new_string_n_obj(s, j);
pr_free(s);
} break;
}
@@ -389,7 +389,7 @@
char* s = pr_malloc(exp_len+2);
for(i = index1, j=0; i > index2; i += index3, j++)
s[j] = self_str[i];
- res = new_string_obj_n(s, j);
+ res = new_string_n_obj(s, j);
} break;
}
}
Modified: trunk/src/main.c
===================================================================
--- trunk/src/main.c 2004-03-26 04:27:31 UTC (rev 129)
+++ trunk/src/main.c 2004-03-26 04:59:03 UTC (rev 130)
@@ -223,7 +223,6 @@
else
while(main_threads_running) apr_sleep(PAUSE_MS*1000);
-
#ifdef DEBUG_THREADS
printf("All main threads have terminated, now stopping memory manager ...\n");
#endif
Modified: trunk/src/object.c
===================================================================
--- trunk/src/object.c 2004-03-26 04:27:31 UTC (rev 129)
+++ trunk/src/object.c 2004-03-26 04:59:03 UTC (rev 130)
@@ -230,7 +230,7 @@
dll_services.new_int_obj = new_int_obj;
dll_services.new_float_obj = new_float_obj;
dll_services.new_string_obj = new_string_obj;
- dll_services.new_string_obj_n = new_string_obj_n;
+ dll_services.new_string_n_obj = new_string_n_obj;
dll_services.new_tuple_obj = new_tuple_obj;
dll_services.new_list_obj = new_list_obj;
dll_services.clone_list_obj = clone_list_obj;
@@ -770,7 +770,7 @@
//********************************* new_string_obj ****************************
// this cannot be used with binary data, for C strings only
-// for binary data with embedded nulls use new_string_obj_n()
+// for binary data with embedded nulls use new_string_n_obj()
obj_p new_string_obj(char* str){
obj_p obj;
pr_str_p obj_str;
@@ -791,8 +791,8 @@
return obj;
}
-//********************************* new_string_obj_n ****************************
-obj_p new_string_obj_n(char* str, size_t len){
+//********************************* new_string_n_obj **************************
+obj_p new_string_n_obj(char* str, size_t len){
obj_p obj;
pr_str_p obj_str;
if(!str) return NULL;
_______________________________________________
Prothon-commits mailing list
[email protected]
http://lists.prothon.org/mailman/listinfo/prothon-commits