On Oct 24, 2005, at 0:07, Jonathan Worthington wrote:

"Leopold Toetsch" <[EMAIL PROTECTED]> wrote:

op result_count(out INT)        # TODO or some such

I'm guessing TODO means "it's not done yet"? But I was wondering, would a more general solution not be to have an op that hands back the results PMC constant that specifies the types as well as number of return values, then you can just call the elements vtable function for that PMC to get the number of arguments, plus other info is available too, and we just have the one new op?

Yep. That's the more general solution:

op result_info(out PMC) {
  PMC *i;
  if (PMC_IS_NULL(i = CONTEXT(interpreter->ctx)->current_results))
$1 = pmc_new(interpreter, enum_class_FixedIntegerArray); /* 0 elems aka void */
  else
    $1 = i;
  goto NEXT();
 }

# untested ;-)

Either way, I should have time to look at putting an op to do something like this in soon, if leo or @other don't beat me to it. ;-)

Drop something like above into experimental.ops and let's see, how it works.

Jonathan

leo

Reply via email to