In message <[EMAIL PROTECTED]>
        Josef Hook <[EMAIL PROTECTED]> wrote:

> As you can see above the while loop in multiarray below only iterates
> 4 times when it should iterate 6 times ( .MultiArray[2;3;2;1;1;1] ).
> The same happens when i define a 3 dim array .MultiArray[2;2;2]
> it only iterate 1 time. This means that key_next(interpreter,key) 
> always loose 2 keyes. 
> 
> multiarray.pmc:
> 
>  while (key_next(interpreter, key) != NULL) {
>     printf("init_marray key size is %d\n", key_integer(interpreter, key));
>     printf("key_next is %x\n", key_next(interpreter, key));
>     size *= key_integer(interpreter, key);
>     key = key_next(interpreter, key);
> 
> }

This loop stops as soon as key_next() becomes NULL which means that
you never process the last key component. I would guess that you want
to make the first line into this:

  while (key != NULL) {

That explains why you are not seeing the last component. You are also
missing the first one for some reason. The most likely cause would be
that you have already used key_next to discard the first component
before you reached this loop but I can't tell for sure from that code
fragment.

Tom

-- 
Tom Hughes ([EMAIL PROTECTED])
http://www.compton.nu

Reply via email to