8 for my $opname (@order) {
9 my ($op) = $ops{$opname};
11 if (!$op->{OPTIMIZABLE} || $op->{UNIMPLEMENTED}) {
12 print "case $opname:\n";
13 print " NOT_REACHED ();\n\n";
19 for my $arg (@{$op->{ARGS}}) {
21 my ($name) = $arg->{NAME};
22 my ($type) = $arg->{TYPE};
23 my ($ctype) = c_type ($type);
24 my ($idx) = $arg->{IDX};
25 if (!defined ($idx)) {
26 my ($func) = "get_$type->{ATOM}_arg";
27 push (@decls, "${ctype}arg_$name = $func (node, $arg_idx)");
29 my ($decl) = "size_t arg_$idx = node->arg_cnt";
30 $decl .= " - $arg_idx" if $arg_idx;
33 push (@decls, "${ctype}*arg_$name = "
34 . "get_$type->{ATOM}_args "
35 . " (node, $arg_idx, arg_$idx, e)");
40 my ($sysmis_cond) = make_sysmis_decl ($op, "node->min_valid");
41 push (@decls, $sysmis_cond) if defined $sysmis_cond;
44 for my $arg (@{$op->{ARGS}}) {
45 push (@args, "arg_$arg->{NAME}");
46 if (defined $arg->{IDX}) {
47 my ($idx) = "arg_$arg->{IDX}";
48 $idx .= " / $arg->{TIMES}" if $arg->{TIMES} != 1;
52 for my $aux (@{$op->{AUX}}) {
53 my ($type) = $aux->{TYPE};
54 if ($type->{ROLE} eq 'leaf') {
55 my ($func) = "get_$type->{ATOM}_arg";
56 push (@args, "$func (node, $arg_idx)");
58 } elsif ($type->{ROLE} eq 'fixed') {
59 push (@args, $type->{FIXED_VALUE});
65 my ($result) = "eval_$op->{OPNAME} (" . join (', ', @args) . ")";
66 if (@decls && defined ($sysmis_cond)) {
67 my ($miss_ret) = $op->{RETURNS}{MISSING_VALUE};
68 push (@decls, c_type ($op->{RETURNS}) . "result = "
69 . "force_sysmis ? $miss_ret : $result");
73 print "case $opname:\n";
74 my ($alloc_func) = "expr_allocate_$op->{RETURNS}{NAME}";
77 print " $_;\n" foreach @decls;
78 print " return $alloc_func (e, $result);\n";
81 print " return $alloc_func (e, $result);\n";