[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

bit-struct and arrays of members?

Markus Fischer

5/24/2009 9:59:00 PM

Hi,

I'm using the bit-struct [1] (which is just awesome, btw) and wondering
how I can realize arrays of members.

I'm reading binary data from pre-existing files which are based on C
structs which look similar to this basic example:

struct {
int vector[5];
...
} vector_t;

My current solution is to just write:

class Vector < BitStruct
default_options :endian => :little
signed vector_1, 32
signed vector_2, 32
signed vector_3, 32
....

I would prefer to use an array. I couldn't figure out how to do it,
there's no example with it and I start to think it's not possible ... ?

thanks,
- Markus

[1] http://redshift.sourceforge.net/b...
4 Answers

Shumbawumba

11/23/2008 7:08:00 PM

0

CNN - Helping child brides break free - "When I got married I was
scared," remembers 10-year-old Nujood Ali. "I didn't want to leave my
family and siblings." - At an age when girls in the West still play
with dolls, Nujood found herself married to a man three times her age.
But in her home country of Yemen -- a deeply conservative Middle East
Muslim nation -- this situation isn't uncommon.,,Yemeni lawyer Shada
Nasser had long opposed the practice of early marriage when, in April
2008, she got a chance to do something about it. -
http://edition.cnn.com/2008/WORLD/meast/09/26/heroes.shada.nasser/...

Moslem cartoon character mohammed was a paedophile 6th century warlord and goat fucker who cooked up

12/7/2008 3:54:00 PM

0

HOW TO BECOME A SHITSKIN MOSLEM - this is how: fuck goats, fuck your
mother (nikomak), molest children, wear a beekeepers outfit all the
time, never shower or bath, beat your wives, learn terrorist activities
at a maddrassa, wipe your ass with stones, sell the donkey you fucked to
a nearby village, marry a nine year-old , send your child off to an
indoctrination camp, practice thighing with little kids, ............
Practice all those and you too could become a prophet !!


Elif air ab tizak mohammad !!!!

info@muslimmatch.com or apache@muslimmatch.com or
Achmat.Samsodien@gmail.com
fahmi@telkomsa.net
ipcisa@yebo.co.za
politicsIranian@googlegroups.com
jamiat@islamsa.org.za
dsirc@mweb.co.za
arah1958@gmail.com
jamiatmp@lantic.co.za
sanha-kzn@sanha.org.za
sanha-gp@sanha.org.za
sanha-cpt@sanha.org.za
helpline@sanha.org.za
islamwayoflife@googlegroups.com
furtivo4000@gmail.com

** Posted from http://www.te... ** moslem cartoon character
mohammad and his bumchum allaah were child molesting goat fuckers and
nikomaks


_
/'_/)
,/_ /
/ /
/'_'/' '/'__'7,
/'/ / / /" /_ ('( ' /' ')
\ /
'\' _.7'
\ (
\
Up your ass mohammad - Elif air ab tizak!!!

info@muslimmatch.com or apache@muslimmatch.com or
politicsIranian@googlegroups.com
Achmat.Samsodien@gmail.com
fahmi@telkomsa.net
jamiat@islamsa.org.za
dsirc@mweb.co.za
jamiatmp@lantic.co.za
sanha-kzn@sanha.org.za
sanha-gp@sanha.org.za
sanha-cpt@sanha.org.za
helpline@sanha.org.za
arah1958@gmail.com
islamwayoflife@googlegroups.com
furtivo4000@gmail.com
ipcisa@yebo.co.za

** Posted from http://www.te... **

moslem cartoon character mohammad and his bumchum allaah were child
molesting goat fuckers and nikomaks


_
/'_/)
,/_ /
/ /
/'_'/' '/'__'7,
/'/ / / /" /_ ('( ' /' ')
\ /
'\' _.7'
\ (
\
Up your ass mohammad - Elif air ab tizak!!!

info@muslimmatch.com or apache@muslimmatch.com or
politicsIranian@googlegroups.com
Achmat.Samsodien@gmail.com
fahmi@telkomsa.net
jamiat@islamsa.org.za
dsirc@mweb.co.za
jamiatmp@lantic.co.za
sanha-kzn@sanha.org.za
sanha-gp@sanha.org.za
sanha-cpt@sanha.org.za
helpline@sanha.org.za
arah1958@gmail.com
islamwayoflife@googlegroups.com
furtivo4000@gmail.com
ipcisa@yebo.co.za

** Posted from http://www.te... **


moslem cartoon character mohammad and his bumchum allaah were child
molesting goat fuckers and nikomaks


_
/'_/)
,/_ /
/ /
/'_'/' '/'__'7,
/'/ / / /" /_ ('( ' /' ')
\ /
'\' _.7'
\ (
\
Up your ass mohammad - Elif air ab tizak!!!

info@muslimmatch.com or apache@muslimmatch.com or
politicsIranian@googlegroups.com
Achmat.Samsodien@gmail.com
fahmi@telkomsa.net
jamiat@islamsa.org.za
dsirc@mweb.co.za
jamiatmp@lantic.co.za
sanha-kzn@sanha.org.za
sanha-gp@sanha.org.za
sanha-cpt@sanha.org.za
helpline@sanha.org.za
arah1958@gmail.com
islamwayoflife@googlegroups.com
furtivo4000@gmail.com
ipcisa@yebo.co.za

** Posted from http://www.te... **





moslem cartoon character mohammad and his bumchum allaah were child
molesting goat fuckers and nikomaks


_
/'_/)
,/_ /
/ /
/'_'/' '/'__'7,
/'/ / / /" /_ ('( ' /' ')
\ /
'\' _.7'
\ (
\
Up your ass mohammad - Elif air ab tizak!!!

info@muslimmatch.com or apache@muslimmatch.com or
politicsIranian@googlegroups.com
Achmat.Samsodien@gmail.com
fahmi@telkomsa.net
jamiat@islamsa.org.za
dsirc@mweb.co.za
jamiatmp@lantic.co.za
sanha-kzn@sanha.org.za
sanha-gp@sanha.org.za
sanha-cpt@sanha.org.za
helpline@sanha.org.za
arah1958@gmail.com
islamwayoflife@googlegroups.com
furtivo4000@gmail.com
ipcisa@yebo.co.za

** Posted from http://www.te... **







moslem cartoon character mohammad and his bumchum allaah were child
molesting goat fuckers and nikomaks


_
/'_/)
,/_ /
/ /
/'_'/' '/'__'7,
/'/ / / /" /_ ('( ' /' ')
\ /
'\' _.7'
\ (
\
Up your ass mohammad - Elif air ab tizak!!!

info@muslimmatch.com or apache@muslimmatch.com or
politicsIranian@googlegroups.com
Achmat.Samsodien@gmail.com
fahmi@telkomsa.net
jamiat@islamsa.org.za
dsirc@mweb.co.za
jamiatmp@lantic.co.za
sanha-kzn@sanha.org.za
sanha-gp@sanha.org.za
sanha-cpt@sanha.org.za
helpline@sanha.org.za
arah1958@gmail.com
islamwayoflife@googlegroups.com
furtivo4000@gmail.com
ipcisa@yebo.co.za

** Posted from http://www.te... **









moslem cartoon character mohammad and his bumchum allaah were child
molesting goat fuckers and nikomaks


_
/'_/)
,/_ /
/ /
/'_'/' '/'__'7,
/'/ / / /" /_ ('( ' /' ')
\ /
'\' _.7'
\ (
\
Up your ass mohammad - Elif air ab tizak!!!

info@muslimmatch.com or apache@muslimmatch.com or
politicsIranian@googlegroups.com
Achmat.Samsodien@gmail.com
fahmi@telkomsa.net
jamiat@islamsa.org.za
dsirc@mweb.co.za
jamiatmp@lantic.co.za
sanha-kzn@sanha.org.za
sanha-gp@sanha.org.za
sanha-cpt@sanha.org.za
helpline@sanha.org.za
arah1958@gmail.com
islamwayoflife@googlegroups.com
furtivo4000@gmail.com
ipcisa@yebo.co.za

** Posted from http://www.te... **










moslem cartoon character mohammad and his bumchum allaah were child
molesting goat fuckers and nikomaks


_
/'_/)
,/_ /
/ /
/'_'/' '/'__'7,
/'/ / / /" /_ ('( ' /' ')
\ /
'\' _.7'
\ (
\
Up your ass mohammad - Elif air ab tizak!!!

info@muslimmatch.com or apache@muslimmatch.com or
politicsIranian@googlegroups.com
Achmat.Samsodien@gmail.com
fahmi@telkomsa.net
jamiat@islamsa.org.za
dsirc@mweb.co.za
jamiatmp@lantic.co.za
sanha-kzn@sanha.org.za
sanha-gp@sanha.org.za
sanha-cpt@sanha.org.za
helpline@sanha.org.za
arah1958@gmail.com
islamwayoflife@googlegroups.com
furtivo4000@gmail.com
ipcisa@yebo.co.za

** Posted from http://www.te... **
Vera "Mirelle" Perks
609 Turner St
Silverton, BC
V0G2B0
Phone 250-358-2727

labellemirelle@gmail.com

http://moaningmirelle.blo...

ISP - Telus Communications

arah1958@gmail.com
Achmat.Samsodien@gmail.com
fahmi@telkomsa.net
jamiat@islamsa.org.za
dsirc@mweb.co.za
jamiatmp@lantic.co.za
sanha-kzn@sanha.org.za
sanha-gp@sanha.org.za
sanha-cpt@sanha.org.za
helpline@sanha.org.za
islamwayoflife@googlegroups.com
furtivo4000@gmail.com

** Posted from http://www.te... **

Joel VanderWerf

5/25/2009 7:44:00 PM

0

Markus Fischer wrote:
> Hi,
>
> I'm using the bit-struct [1] (which is just awesome, btw) and wondering
> how I can realize arrays of members.
>
> I'm reading binary data from pre-existing files which are based on C
> structs which look similar to this basic example:
>
> struct {
> int vector[5];
> ...
> } vector_t;
>
> My current solution is to just write:
>
> class Vector < BitStruct
> default_options :endian => :little
> signed vector_1, 32
> signed vector_2, 32
> signed vector_3, 32
> ...
>
> I would prefer to use an array. I couldn't figure out how to do it,
> there's no example with it and I start to think it's not possible ... ?
>
> thanks,
> - Markus
>
> [1] http://redshift.sourceforge.net/b...

Sorry, no support for that (yet). IIRC one of the other libs has
something for this, maybe it was binstruct or binaryparse.

It's not really too different from the #nest construct, so maybe it
could be added along those lines, as long as the array length is static.
Will think about it...

--
vjoel : Joel VanderWerf : path berkeley edu : 510 665 3407

Joel VanderWerf

5/27/2009 12:33:00 AM

0

Markus Fischer wrote:
> I'm using the bit-struct [1] (which is just awesome, btw) and wondering
> how I can realize arrays of members.

Here's a quick implementation and some examples. The main limitation
(that I'm aware of) is that a Vector cannot yet be embedded in another
BitStruct. Will think about that (note hypothetical syntax)...

http://pastebin.co...

--
vjoel : Joel VanderWerf : path berkeley edu : 510 665 3407