On Wed, 29 Jul 2009, Radovan Baranec wrote:

Hi,

I am very interesting in Parrot embedding system it is part of my diploma project "The assessment of appropriateness of using virtual machines to decode packets". I`d like to ask how to pass arguments from C to Parrot subroutines? What is the best a most comfortable way? I will appreciate some examples.

take a look at docs/embed.pod -- it has documentation on the functions you'd be using, in particular the Parrot_call_sub family of functions. you pass the subroutine name, a type signature for the arguments, and the arguments themselves.

you can find examples in t/src/extend.t and t/src/embed.t, as well as real-world usage in the mod_parrot source in src/parrot_util.c (svn repo at https://svn.perl.org/parrot-modules/mod_parrot/trunk/)

I am also thinking about which data structure should I use to store/represent packet in PIR. If you have had ever meet this problem or solution pls let me know. Thanks.

you can store the raw data in a PMC (very simple if you pass it as an argument from C), and/or your could break it out into an object (also a PMC). you can do this from C or PIR. it all depends on how and where you plan on using the data.

btw: this is my first mailing list ever so pls have a patience with me

welcome!

With best regards,

Radovan

-jeff
_______________________________________________
http://lists.parrot.org/mailman/listinfo/parrot-dev

Reply via email to