#include long calc_add_long(long a, long b){ return a + b ; } double calc_add_double(double a, double b){ return a + b ; } const char *calc_add_string(const char *sa, const char *sb){ static char res[32] ; if ((sa == NULL)||(sb == NULL)){ return NULL ; } double a = strtod(sa, NULL) ; double b = strtod(sb, NULL) ; sprintf(res, "%lf", a + b) ; return res ; } /* mlp_value *calc_add_double(int nb_args, mlp_value **args){ mlp_context *ctx = mlp_new_context() ; double a = mlp_get_double_value(ctx, args[0]) ; double b = mlp_get_double_value(ctx, args[1]) ; mlp_value *sum = mlp_new_double_value(ctx, a + b) ; mlp_delete_context(ctx) ; return sum ; } mlp_value *calc_add_string(int nb_args, mlp_value **args){ mlp_context *ctx = mlp_new_context() ; const char *a = mlp_get_string_value(ctx, args[0]) ; const char *b = mlp_get_string_value(ctx, args[1]) ; mlp_value *sum = mlp_new_double_value(ctx, strtod(a, NULL) + strtod(b, NULL)) ; mlp_delete_context(ctx) ; return sum ; } */