Leopold Toetsch <[EMAIL PROTECTED]> wrote:
> Jeff Clites <[EMAIL PROTECTED]> wrote:
> > At the same time, I'm not sure why we need this construct in a header:
> 
> >       struct Parrot_Interp;
> 
> >       typedef struct Parrot_Interp *Parrot_Interp;
> 
> We don't need it. There was some discussion a while a go. This typedef
> should just be removed.

The embedding interface needs the typedef, but it doesn't need it to
have the same name as the struct.  The struct is the odd man out
here--the standard used elsewhere in Parrot is:

Struct:  struct parrot_whatever_t {...};
Internal typedef: typedef struct parrot_whatever_t Whatever;
External typedef: typedef struct parrot_whatever_t *Parrot_Whatever;

See the String/Parrot_String/parrot_string_t triplet for another
example of this.

I've written a patch to implement this change: 
<http://www.brentdax.com/tmp/parrot.interp.patch>

Patch is 1979 lines, or ~81kb, and implements the scheme above. 
Amusingly, Parrot is about 172kb smaller with this patch applied--all
those function declarations, I guess.  I've reordered the files in the
patch so that the interesting stuff is near the top, and the
machine-generated stuff is at the bottom.

As you might suspect, most of this patch was done with a
one-liner--the moral equivalent of:
    find . -xtype f | xargs perl -i -pe 's/struct\s+Parrot_Interp/Interp/'
(although I added some extra code to tell me how many changes were
made in each file).

There are a few files that used macros to shorten declarations
involving a "struct Parrot_Interp *"; these are now unnecessary and
occasionally counterproductive, but I haven't attempted to remove
them.

I've tested this out on my Linux box, navi:
    Linux navi 2.4.18-opt #2 SMP Sun May 23 17:39:01 PDT 2004 i686 GNU/Linux
    This is perl, v5.8.2 built for i686-linux-thread-multi
and everything seems to work.  However, I'd appreciate testing from
people on other platforms, particularly ones with their own platform
files.

Testing or no, I'll apply this in a day or two if there are no objections.

-- 
Brent 'Dax' Royal-Gordon <[EMAIL PROTECTED]>
Perl and Parrot hacker

There is no cabal.
[I currently have a couple Gmail invites--contact me if you're interested.]

Reply via email to