10 for my $opname (@order) {
11 my ($op) = $ops{$opname};
13 if (!$op->{OPTIMIZABLE} || $op->{UNIMPLEMENTED}) {
14 print "case $opname:\n";
15 print " abort ();\n\n";
21 for my $arg (@{$op->{ARGS}}) {
23 my ($name) = $arg->{NAME};
24 my ($type) = $arg->{TYPE};
25 my ($ctype) = c_type ($type);
26 my ($idx) = $arg->{IDX};
27 if (!defined ($idx)) {
28 my ($func) = "get_$type->{ATOM}_arg";
29 push (@decls, "${ctype}arg_$name = $func (node, $arg_idx)");
31 my ($decl) = "size_t arg_$idx = node->arg_cnt";
32 $decl .= " - $arg_idx" if $arg_idx;
35 push (@decls, "${ctype}*arg_$name = "
36 . "get_$type->{ATOM}_args "
37 . " (node, $arg_idx, arg_$idx, e)");
42 my ($sysmis_cond) = make_sysmis_decl ($op, "node->min_valid");
43 push (@decls, $sysmis_cond) if defined $sysmis_cond;
46 for my $arg (@{$op->{ARGS}}) {
47 push (@args, "arg_$arg->{NAME}");
48 if (defined $arg->{IDX}) {
49 my ($idx) = "arg_$arg->{IDX}";
50 $idx .= " / $arg->{TIMES}" if $arg->{TIMES} != 1;
54 for my $aux (@{$op->{AUX}}) {
55 my ($type) = $aux->{TYPE};
56 if ($type->{ROLE} eq 'leaf') {
57 my ($func) = "get_$type->{ATOM}_arg";
58 push (@args, "$func (node, $arg_idx)");
60 } elsif ($type->{ROLE} eq 'fixed') {
61 push (@args, $type->{FIXED_VALUE});
67 my ($result) = "eval_$op->{OPNAME} (" . join (', ', @args) . ")";
68 if (@decls && defined ($sysmis_cond)) {
69 my ($miss_ret) = $op->{RETURNS}{MISSING_VALUE};
70 push (@decls, c_type ($op->{RETURNS}) . "result = "
71 . "force_sysmis ? $miss_ret : $result");
75 print "case $opname:\n";
76 my ($alloc_func) = "expr_allocate_$op->{RETURNS}{NAME}";
79 print " $_;\n" foreach @decls;
80 print " return $alloc_func (e, $result);\n";
83 print " return $alloc_func (e, $result);\n";