110 lines
2.8 KiB
C
110 lines
2.8 KiB
C
#include <stdio.h>
|
|
#include "./src/types.h"
|
|
#include "./src/list.h"
|
|
#include "./src/number_parsing.h"
|
|
#include "./src/funcs.h"
|
|
#include "./src/utils.h"
|
|
#include "./src/var_store.h"
|
|
#include "./src/line_processing.h"
|
|
#include "./src/state.h"
|
|
#include <stdlib.h>
|
|
|
|
int main () {
|
|
struct VariableStore* store = var_store_init();
|
|
printf("%d", var_store_hash_name(store, "var"));
|
|
return 0;
|
|
// struct List l1;
|
|
|
|
// short val = 17;
|
|
// list_set(&l1, 0, TYPE_VAR_NAME, &val);
|
|
// list_print(&l1);
|
|
|
|
// return 0;
|
|
|
|
// int yes = 1234;
|
|
// int dst = 0;
|
|
// memcpy(&dst, &yes, 4);
|
|
// printf("yes: %d \n", dst);
|
|
|
|
//struct VariableStore* store = var_store_init();
|
|
|
|
// int hashRes = var_store_hash_name(store, "HelloWorld++");
|
|
// printf("hashRes: %d \n", hashRes);
|
|
// int val = 1234;
|
|
// var_store_set(store, "foo", TYPE_INT, &val);
|
|
// var_store_get_key(store, "while i < 10 then");
|
|
|
|
//printf("Pos of var: %d \n", var_store_get_pos(store, "foo"));
|
|
|
|
//byte type = var_store_get_type(store, "foo");
|
|
//printf("Type of var: %d \n", type);
|
|
|
|
//int key = var_store_get_pos(store, "foo");
|
|
//printf("size of type %d \n", get_size_of_type(store->container[key].type));
|
|
//printf("%d \n", *((int*) store->container[key].dataPtr));
|
|
|
|
// int val2 = 0;
|
|
// var_store_copy(store, "foo", &val2);
|
|
|
|
// printf("Value of var: %d \n", val2);
|
|
|
|
// printf("==== \n");
|
|
// printf("==== \n");
|
|
|
|
// char* lines = "# hello world\n"
|
|
// "set x to 5\n"
|
|
// "set y to 1\n"
|
|
// "if !(x+y = 6) then\n"
|
|
// " print_number(x+y)\n"
|
|
// "end\n"
|
|
// "\n";
|
|
|
|
char* lines1 = "set x to 5\n"
|
|
"set y to 1\n"
|
|
"if !(x+y = 6) then\n"
|
|
" print_number(x+y)\n"
|
|
"end\n"
|
|
"\n";
|
|
|
|
printf("%s", lines1);
|
|
|
|
struct StateContainer* state = state_init();
|
|
process_script(state, lines1);
|
|
|
|
// 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);
|
|
}
|
|
|