File: exec_optree.c.inc

package info (click to toggle)
libobject-pad-perl 0.821-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 936 kB
  • sloc: ansic: 3,361; perl: 3,328; pascal: 28; makefile: 3
file content (38 lines) | stat: -rw-r--r-- 550 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
/* vi: set ft=c : */

#define exec_optree_list(o)  S_exec_optree_list(aTHX_ o)
static AV *S_exec_optree_list(pTHX_ OP *o)
{
  dSP;

  ENTER;
  SAVETMPS;

  SAVEVPTR(PL_op);

  PL_op = LINKLIST(o);
  o->op_next = NULL;

  PUSHMARK(SP);

  CALLRUNOPS(aTHX);

  SPAGAIN;
  I32 nargs = SP - PL_stack_base - TOPMARK;

  AV *ret = NULL;

  if(nargs) {
    SV **argsvs = SP - nargs + 1;
    ret = newAV_alloc_x(nargs);

    for(I32 i = 0; i < nargs; i++) {
      av_store_simple(ret, i, newSVsv(argsvs[i]));
    }
  }

  FREETMPS;
  LEAVE;

  return ret;
}