valeri/src/stdlib.hpp

56 lines
965 B
C++
Raw Normal View History

#pragma once
#include <cstdint>
#include "result.hpp"
enum class StdlibFunctionId : uint64_t {
Unknown,
Print,
PrintLn,
Prn,
Slurp,
Spit,
Assert,
Dict,
List,
2024-09-01 15:13:28 +00:00
Array,
Get,
2024-09-18 18:53:12 +00:00
Set,
SrcLoc,
2024-09-10 02:18:00 +00:00
Size,
Map,
Error,
2024-09-24 19:53:26 +00:00
Raise,
Reraise,
Task,
Guard,
Serialize,
Deserialize,
Disassemble,
Max,
};
enum class StdlibTaskId : uint64_t {
Unknown,
Print,
ReadFile,
WriteFile,
Max,
};
class Value;
class Symbol;
class Array;
class StackFrame;
class Continuation;
Result<const char*> get_stdlib_function_name(StdlibFunctionId fun_id);
Result<StdlibFunctionId> get_stdlib_function(const Symbol& name);
Result<StackFrame> call_stdlib_function(StdlibFunctionId fun_id,
const StackFrame& stack);
Result<const char*> get_stdlib_task_name(StdlibTaskId task_id);
Result<StdlibTaskId> get_stdlib_task(const Symbol& name);
Result<Value> call_stdlib_task(StdlibTaskId task_id, const Array& params);