langatator/test.c

52 lines
1.1 KiB
C
Raw Normal View History

2022-04-29 10:30:44 +00:00
#include <stdio.h>
#include "./src/types.h"
#include "./src/list.h"
#include "./src/number_parsing.h"
#include "./src/funcs.h"
#include "./src/repr_utils.h"
int some_computation(int a, int b, int* resPtr)
{
*resPtr = a+b;
return 0;
}
int main () {
// struct List l1;
// list_append_int(&l1, 4);
// list_append_char(&l1, '*');
// list_append_int(&l1, 5);
// list_print(&l1);
// list_delete(&l1, 0);
// list_print(&l1);
// list_delete(&l1, 0);
// list_print(&l1);
// float res = 0;
// void* ptr = &res;
// printf("%d\n", sizeof(ptr));
int found = identify_func_name("ABS");
printf("found: %d \n", found);
unsigned char argsType[1] = { TYPE_FLOAT };
int argsVals[1] = { get_int_rep_from_float(-3.145) };
int resVal = 0;
unsigned char resType = 0;
execute_func(found, 1, argsType, argsVals, &resVal, &resType);
printf("func res type: %d \n", resType);
printf("func res: %f \n", get_float_from_int_rep(resVal));
// int stat = parse_float("1052.254", &res);
// printf("float parsing stat: %d \n", stat);
// printf("final float: %f \n", res);
}