1 #include <gnumeric-config.h>
2 #include "perl-gnumeric.h"
5 value2perl(const GnmValue
*v
)
9 switch (v
->v_any
.type
) {
11 sv
= newSViv(value_get_as_int (v
));
15 sv
= newSVnv(value_get_as_float (v
));
19 const char *s
= value_peek_string (v
);
20 sv
= newSVpv(s
,strlen(s
));
37 v
= value_new_int (SvIV(sv
));
39 v
= value_new_float ((gnm_float
) SvNV(sv
));
45 v
= value_new_string_nocopy (g_strndup (tmp
, size
));
52 marshal_func (GnmFuncEvalInfo
*ei
, GnmValue
*argv
[])
56 gnm_expr_get_func_def ((GnmExpr
const *)ei
->func_call
);
62 /* Read the perlcall man page for more information. */
67 gnm_func_count_args (func
, &min
, &max
);
69 for (i
= 0; i
< max
&& argv
[i
] != NULL
; i
++) {
70 XPUSHs(sv_2mortal(value2perl(argv
[i
])));
74 r
= perl_call_sv (gnm_func_get_user_data (func
), G_SCALAR
);
77 croak("uh oh, beter get maco");
80 v
= perl2value(result
);