// Core standard library // Copyright (C) 2017 Alexander Koch #include "libdef.h" #include "../vm/vm.h" #include #define SET(x, bit) (x |= (1<= vm->argc || idx < 0) { val = STRING_VAL(""); } else { val = STRING_VAL(vm->argv[idx]); } vm_register(vm, val); } int core_gen_signatures(context_t* context, list_t* toplevel) { signature_new(); require_func(); datatype_t* void_type = context_get(context, "void"); datatype_t* float_type = context_get(context, "float"); datatype_t* int_type = context_get(context, "int"); datatype_t* generic_type = context_get(context, "generic"); datatype_t* string_type = context_get(context, "str"); // print(T) -> void function_new("print", void_type, 1); function_add_param(NULL, generic_type); function_upload(toplevel); // println(T) -> void function_new("println", void_type, 2); function_add_param(NULL, generic_type); function_upload(toplevel); // getline() -> char[] function_new("getline", string_type, 3); function_upload(toplevel); // parseFloat(str:char[]) -> float function_new("parseFloat", float_type, 4); function_add_param(NULL, string_type); function_upload(toplevel); // break() -> void function_new("break", void_type, 5); function_upload(toplevel); // clock() -> void function_new("clock", float_type, 6); function_upload(toplevel); // sysarg(idx:int) -> char[] function_new("sysarg", string_type, 7); function_add_param(NULL, int_type); function_upload(toplevel); return 0; }