[Date Index][Thread Index]
[Date Prev][Date Next][Thread Prev][Thread Next]

Re: Attributes / variables delimiters



On Thu, Oct 04, 2001 at 02:04:45PM +0200, Ghislaine Labouret wrote:
> On Thu, 27 Sep 2001 00:24:39 +0200, Denis Barbier wrote:
> 
> > If mp4h is confused by long and complex constructs, it may be a bug in
> > your pages or in mp4h, and it would be nice to have your example to add
> > it to the mp4h torture suite ;)
> > Could you put some sources online which demonstrate this problem?
> 
> Ok, but since my repeated includes and tag definitions don't make the
> sources easy to analyse, here is, first, a bug which I just managed to
> pin down :
> 
> Input:
> 
> <set-var dir[1]="1" dir[2]="2">
> dir[1]=<get-var dir[1]>
> dir[2]=<get-var dir[2]>
> dir[3]=<get-var dir[3]>
> 
> Output:
> 
> dir[1]=1
> dir[2]=
> dir[3]=2

Hi Ghislaine,

thanks for this bugreport, it is very valuable to have such tiny
examples.
A patch is attached, and has been included into CVS.

> Also, I noticed that error lines given by WML do not correspond to
> "real" lines (vim's line count for exemple) when using \ at the end of
> lines: a lines ending with \ and the following one is counted as a
> single line. This makes debugging more difficult...

You are right :(
But I did not find exactly where does this problem come from, I am not
sure it is caused by escaped newlines.

-- 
Denis Barbier
WML Maintainer
--- wml_backend/p2_mp4h/src/builtin.c	2001/10/02 21:20:52	1.57
+++ wml_backend/p2_mp4h/src/builtin.c	2001/10/05 20:58:47
@@ -3863,21 +3863,22 @@
                     cp = old_value;
                     for (j=0; j<array_index; j++)
                       {
-                        cp = strchr (cp + 1, '\n');
+                        cp = strchr (cp, '\n');
                         if (!cp)
                           {
+                            /*  Add newlines before value at the bottom  */
                             strcat (SYMBOL_TEXT (var), old_value);
                             for (; j<array_index; j++)
                               strcat (SYMBOL_TEXT (var), "\n");
                             strcat (SYMBOL_TEXT (var), value);
                           }
+                        else
+                          cp++;
                       }
                     if (cp)
                       {
                         *cp  = '\0';
-                        cp++;
                         strcat (SYMBOL_TEXT (var), old_value);
-                        strcat (SYMBOL_TEXT (var), "\n");
                         strcat (SYMBOL_TEXT (var), value);
                         cp = strchr (cp + 1, '\n');
                         if (cp)