perl6-internals
[Top] [All Lists]

struct and pointer to pointer in ATTR

To: parrot-porters@perl.org
Subject: struct and pointer to pointer in ATTR
From: NotFound <julian.notfound@gmail.com>
Date: Wed, 27 Aug 2008 09:01:16 +0200
Delivered-to: mailing list perl6-all@perl.org
Delivered-to: perl6-all-poster@perl.org
Delivered-to: mailing list perl6-internals@perl.org
Delivered-to: perl6-internals@perl.org
Delivered-to: perlmail-parrot-porters@onion.perl.org
Delivered-to: parrot-porters@perl.org
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to :subject:mime-version:content-type; bh=MX5MLSa6CkXo38yS5nX/7Z1EMnqJ80bLLlVEq3KHwL8=; b=mmK7FWvAlTjDeZS/XrtNCMcz/e6FHWmFIk04viywoVuhJDhOTgai4wMS73TFXve4aK uVcqXwc5KQiKt/s6s7cH606mBsgFh0vGsWi2hHgHpQyKsS91ctFI/H7f+lERvyXIQsAh 7Z1IqrKfnx88MlAeHI2Xfj71VY8Kw3w/JwH/Y=
Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:mime-version:content-type; b=RwoCjUKI8VQdIoCB9fJuPMTROFvxOjMGbIceL1AXjGw6amejv48ssZLNUqnlEXL6IZ xw1x5wNt7lGumJtDZlZOWgST3e4In6QUEcifleqTZ11C8Cx4D9OtIAZ8jWxWKlDJCzuV p6lr6gvwtISaG0SVlhtEup33+dDWbTzKLo67Y=
List-help: <mailto:perl6-all-help@perl.org>
List-id: <perl6-all.perl.org>
List-id: <perl6-internals.perl.org>
List-post: <mailto:perl6-all@perl.org>
List-subscribe: <mailto:perl6-all-subscribe@perl.org>
List-unsubscribe: <mailto:perl6-all-unsubscribe@perl.org>
Mailing-list: contact perl6-all-help@perl.org; run by ezmlm
Hello.

The current grammar for ATTR in pmc2c allows declarations of the form:
<type> * varname

In the perl6multisub pmc we have the attribute candidates_sorted whose
intended type is candidate_info **, having two problems:

The current grammar allows a single pointer, not a pointer to a
pointer. This can be easily solved.

candidate_info is a struct declared in the pmc file (as typedef struct
candidate_info { ... } candidate_info), then his declaration is not
viewable at the point of inclusion of the generated h file. This can
be solved by declaring the ATTR with type struct candidate_info
instead of candidate_info, but the grammar for ATTR does not allow it.

I think that allowing struct in ATTR is the simpler solution to the
second problem, because the intended usage is for struct used
internally in the pmc, not for his documented interface.

The attached patch changes the ATTR grammar and uses the changes to
clean the workarounds currently used in perl6multsub pmc. It passes
all coretest on my system, both building with C or with C++.

-- 
Salu2

Attachment: attr_struct_pointer.patch
Description: Text Data

<Prev in Thread] Current Thread [Next in Thread>