Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Message from discussion Alignment Issues with *ManagedStruct?
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Leopold Toetsch  
View profile  
 More options Feb 6 2004, 10:00 am
Newsgroups: perl.perl6.internals
From: l...@toetsch.at (Leopold Toetsch)
Date: Fri, 6 Feb 2004 15:58:33 +0100
Local: Fri, Feb 6 2004 9:58 am
Subject: Re: Alignment Issues with *ManagedStruct?

Uri Guttman <u...@stemsystems.com> wrote:
> boy, was this easy with this module. all we need to do is mess around
> with the output to get whatever leo needs.

s/leo/Joe R. Parrot Hacker/ - I can craft initializers by hand ;)

1) some script e.g. gen_struct (struct2pasm ...) located in tools/dev or
build_tools.

2) options:

   --gen-pasm, -p    (default, *if* src file =~ /\.pasm$/
   --pmc=Px          (for --gen-pasm only, default P15)
   --gen-pir         (default)
   --named-initializer=0,1   (1)
   --named-accessor=0,1      (0)
   --out-file, -o=file (default: change input in place unless stdin)

3) Operation

3a) Take a C structure, spit out initializer
3b) take a commented C structure, add or change initializer
    3b) is for source-files that may contain multiple C structures
        like in my original posting WRT this util or like below

> with this struct (from leo with some minor changes):

## &gen_struct(--options, --pmc=P20, --gen-pasm)
# struct xt {
#       char x;
#       struct yt {
#               char i,k;
#               int  j;
#       } Y;
#       char z;
#} X;
## &end_gen

## begin autogeneratedd bla bla

4) The output
4a) initializer name / P-register  => $init_pmc

   new P20, .OrderedHash       # .PerlArray if --no-named-initializer

 or
   .local pmc struct_xt_init   # --gen-pir
   struct_xt_init = new OrderedHash

 and

   .include "datatypes.pasm"  # for DATATYPE_ consts below

4b) data type of item

   push $init_pmc, .DATATYPE_$type  # --no-named-init...

 or

   set $init_pmc["$var"], .DATATYPE_$type  # --name-init..

 If item is a nested struct or a pointer to nested struct please
 consult docs/pmc/struct.pod

4c) item count = 0, or N for array of items

   push $init_pmc, $item_count

4d) offset - always 0 for now

   push $init_pmc, 0

4e) nice to have: preserve C comments (put these after '#')

S. also t/pmc/nci.t for examples of initializers and src/nci_test.c for
the referenced C structs.

I hope above outline is somewhat clear else please just ask.

> uri

leo

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.