Re: [Prothon-commits] rev 209 - trunk/src

"Mark Hahn" <[email protected]> Tue, 30 Mar 2004 07:38:37 -0800
Newsgroups gmane.comp.lang.prothon.devel
Message-ID <003b01c4166d$119dd820$d701a8c0@MarkVaio>
Ben: Your new module code compiles on windows, but when I run it, function
calls to __objlist__ in mem mgr fail so often my output console is filled
with rolling exceptions and I can't tell if anything is working.  I'll try
turning off the memmgr to see what is wrong.

----- Original Message ----- 
From: "SVN User" <[email protected]>
To: <[email protected]>
Sent: Tuesday, March 30, 2004 7:33 AM
Subject: [Prothon-commits] rev 209 - trunk/src


> Author: bcollins
> Date: 2004-03-30 10:33:18 -0500 (Tue, 30 Mar 2004)
> New Revision: 209
>
> Modified:
>    trunk/src/builtins.c
>    trunk/src/prothon.y
> Log:
> Fix bug #3. Also cleanup str_tuple_list to act more like python.
>
>
> Modified: trunk/src/builtins.c
> ===================================================================
> --- trunk/src/builtins.c 2004-03-30 13:50:37 UTC (rev 208)
> +++ trunk/src/builtins.c 2004-03-30 15:33:18 UTC (rev 209)
> @@ -324,26 +324,41 @@
>  }
>
>
> -static obj_p str_tuple_list(isp ist, obj_p self, char* ldelim, char*
rdelim) {
> +static obj_p str_tuple_list(isp ist, obj_p self, char* ldelim, char*
rdelim)
> +{
>   int i, len=list_len(ist, self);
> - char msg[1024], *res = pr_malloc(2);
> + char msg[64], *res;
> +
> + /* Need enough room for just empty list */
> + res = pr_malloc(strlen(ldelim) + strlen(rdelim) + 1);
> +
>   strcpy(res, ldelim);
> - for (i=0; i < len; i++) {
> +
> + for (i = 0; i < len; i++) {
>   char* item_str;
>   obj_p item = list_item(ist, self,i);
> - if ((uintptr_t)item > 10) item_str = as_str(ist, item);
> - else {
> + int is_str = 0;
> +
> + if ((uintptr_t)item > 10) {
> + item_str = as_str(ist, item);
> + is_str = 1;
> + } else {
>   apr_snprintf(msg, sizeof(msg), "<objptr:%lx>", (unsigned
long)(uintptr_t)item);
>   item_str = msg;
>   }
> - res = pr_realloc(res, strlen(res)+strlen(item_str)+4);
> +
> + res = pr_realloc(res, strlen(res) + strlen(item_str) + strlen(rdelim) +
6);
> + if (is_str)
> + strcat(res, "'");
>   strcat(res, item_str);
> - if (i != len-1) strcat(res, ", ");
> + if (is_str)
> + strcat(res,"'");
> +
> + if (i != len-1)
> + strcat(res, ", ");
>   }
>   strcat(res, rdelim);
> - if (res[0]=='(' && res[1]==')') {
> - res[1]=','; res[2]=')'; res[3]=0;
> - }
> +
>   return new_string_obj(res);
>  }
>
>
> Modified: trunk/src/prothon.y
> ===================================================================
> --- trunk/src/prothon.y 2004-03-30 13:50:37 UTC (rev 208)
> +++ trunk/src/prothon.y 2004-03-30 15:33:18 UTC (rev 209)
> @@ -596,7 +596,8 @@
>   expr ':' expr { $$ = new_list2(yylex_param, $1, $3); }
>   ;
>  tuple_params:
> - expr ',' { $$ = new_list(yylex_param, $1); }
> + { $$ = new_clist(0); }
> + | expr ',' { $$ = new_list(yylex_param, $1); }
>   | tuple_params2
>   | tuple_params2 ','
>   ;
>
>
> _______________________________________________
> Prothon-commits mailing list
> [email protected]
> http://lists.prothon.org/mailman/listinfo/prothon-commits
>
>
>