NotFound wrote:
> 
> Perhaps a function like the following may have more generic usage:
> 
> PMC *
> Parrot_key_set_from_cstring (PARROT_INTERP, char delim, ARGIN(const
> char * keystr))
> 
> Build a key from a C string and the delimiter specified.
> 
> The usage in this case will be:
> 
> PMC *class_object = Parrot_oo_get_class(interp,
> Parrot_key_set_from_cstring(interp, ';', "Foo;Bar"));
> 
> Is easily implementable by calling existing key functions.
> 
> The name is borrowed from the existing function key_set_to_string

Yes, that's a good addition.

For C code it's preferable to pass in a variable length list of strings, 
which are then converted into the key names, because it doesn't require 
parsing the string. See 'Parrot_ex_throw_from_c_args' (src/exceptions.c) 
and 'Parrot_mmd_multi_dispatch_from_c_args' (src/multidispatch.c) for 
examples of using C varargs. It would be something like:

   PMC*
   Parrot_pmc_build_key_from_c_args (PARROT_INTERP, ...)
   {
       va_list key_names;
       va_start(key_names);

       #...iterate through the key names to build the key PMC

       va_end(key_names);

   }


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

Reply via email to