discuss-gnustep
[Top][All Lists]
Advanced

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

Re: problem with gnustep on OpenBSD sparc64


From: Sebastian Reitenbach
Subject: Re: problem with gnustep on OpenBSD sparc64
Date: Wed, 06 Jul 2011 20:35:44 +0200
User-agent: SOGoMail 1.3.7

 
On Wednesday, July 6, 2011 19:47 CEST, David Chisnall <theraven@sucs.org> 
wrote: 
 
> The stuff around skip type qualifiers is irrelevant - there aren't any, this 
> function is a no-op in this case, ignore it.
> 
> 
> On 6 Jul 2011, at 18:38, Sebastian Reitenbach wrote:
> 
> > I added some more fprintf's to the functions that are involved, hope the 
> > output also helps:
> > $ ./a.out      
> > parse_array: element_count: 3, type: [4i]]
> > parse_array: element_count: 4, type: i]]
> 
> 
> Well, this shows that it is finding the correct number of elements for each 
> array.  So, there are two places where it could be going wrong:
> 
> - Calculating the size of int (line 161)
I added two fprintfs before and after that line

> - Combining the size of the elements with the count (line 197)
and another fprintf before that line, after the parse_array:

and another 2 fprintf in parse_array, before and after calling the callback.

$ ./a.out  
parse_array: type: [4i]]
parse_array: type: i]]
^^^ those lines are in parse_array before the callback

sizeof_type: sizeof(typeName): 4
sizeof_type: size: 32
^^^ those lines are around line 161

parse_array: type: ]]
^^^ fprintf after calling callback

element_size: 0, element_count: 4
^^^ this line is before line 197

parse_array: type: ]
^^^ fprintf after calling callback

element_size: 0, element_count: 3
^^^ this line is before line 197

as far as I can see in line 194:

                        int element_size = 0;
                        // FIXME: aligned size
                        int element_count = parse_array(&t, 
(type_parser)sizeof_type, &element_size);

element_size goes into parse_array with a value of 0, and it also gives itself 
as the callback function, then in parse_array I see:

static int parse_array(const char **type, type_parser callback, void *context)
{
        // skip [
        (*type)++;
        int element_count = (int)strtol(*type, (char**)type, 10);
        *type = callback(*type, context);
        // skip ]
        (*type)++;
        return element_count;
}

I don't get it what the code is doing in the #define APPLY_TYPE, where the 
switch statement checks for the case: i ????
That #define is kind of puzzling me. It seems to detect the size of the "i" 
correctly, sizeof(typeName): 4, but it somewhere gets lost in the iterations...

And I'm kind of lost too

Sebastian

> 
> Please see my earlier mail where I explained the code flow.
> 
> David
> 
> -- Sent from my IBM 1620
> 
 
 
 
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]