Use unit type in print function.
This commit is contained in:
parent
969e457fba
commit
3fcdd55395
|
@ -78,10 +78,12 @@ libab_result register_functions(libab* ab) {
|
||||||
libab_ref trig_type;
|
libab_ref trig_type;
|
||||||
libab_ref atan2_type;
|
libab_ref atan2_type;
|
||||||
libab_ref difficult_type;
|
libab_ref difficult_type;
|
||||||
|
libab_ref print_num_type;
|
||||||
|
|
||||||
result = libab_create_type(ab, &trig_type, "(num)->num");
|
result = libab_create_type(ab, &trig_type, "(num)->num");
|
||||||
TRY(libab_create_type(ab, &atan2_type, "(num, num)->num"));
|
TRY(libab_create_type(ab, &atan2_type, "(num, num)->num"));
|
||||||
TRY(libab_create_type(ab, &difficult_type, "((num)->num)->num"));
|
TRY(libab_create_type(ab, &difficult_type, "((num)->num)->num"));
|
||||||
|
TRY(libab_create_type(ab, &print_num_type, "(num)->unit"));
|
||||||
|
|
||||||
TRY(libab_register_function(ab, "atan", &trig_type, function_atan));
|
TRY(libab_register_function(ab, "atan", &trig_type, function_atan));
|
||||||
TRY(libab_register_function(ab, "atan2", &atan2_type, function_atan2));
|
TRY(libab_register_function(ab, "atan2", &atan2_type, function_atan2));
|
||||||
|
@ -89,7 +91,7 @@ libab_result register_functions(libab* ab) {
|
||||||
TRY(libab_register_function(ab, "minus", &atan2_type, function_minus));
|
TRY(libab_register_function(ab, "minus", &atan2_type, function_minus));
|
||||||
TRY(libab_register_function(ab, "times", &atan2_type, function_times));
|
TRY(libab_register_function(ab, "times", &atan2_type, function_times));
|
||||||
TRY(libab_register_function(ab, "divide", &atan2_type, function_divide));
|
TRY(libab_register_function(ab, "divide", &atan2_type, function_divide));
|
||||||
TRY(libab_register_function(ab, "print", &trig_type, function_print_num));
|
TRY(libab_register_function(ab, "print", &print_num_type, function_print_num));
|
||||||
TRY(libab_register_operator_infix(ab, "+", 0, -1, "plus"));
|
TRY(libab_register_operator_infix(ab, "+", 0, -1, "plus"));
|
||||||
TRY(libab_register_operator_infix(ab, "-", 0, -1, "minus"));
|
TRY(libab_register_operator_infix(ab, "-", 0, -1, "minus"));
|
||||||
TRY(libab_register_operator_infix(ab, "*", 1, -1, "times"));
|
TRY(libab_register_operator_infix(ab, "*", 1, -1, "times"));
|
||||||
|
@ -98,6 +100,7 @@ libab_result register_functions(libab* ab) {
|
||||||
libab_ref_free(&trig_type);
|
libab_ref_free(&trig_type);
|
||||||
libab_ref_free(&atan2_type);
|
libab_ref_free(&atan2_type);
|
||||||
libab_ref_free(&difficult_type);
|
libab_ref_free(&difficult_type);
|
||||||
|
libab_ref_free(&print_num_type);
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user