pocketlang/src/core.h

38 lines
1.0 KiB
C
Raw Normal View History

2021-02-11 01:23:48 +08:00
/*
* Copyright (c) 2021 Thakee Nathees
* Licensed under: MIT License
*/
#ifndef CORE_H
#define CORE_H
#include "var.h"
2021-02-12 01:35:43 +08:00
#include "miniscript.h"
void initializeCore(MSVM* vm);
// Find the builtin function name and returns it's index in the builtins array
// if not found returns -1.
int findBuiltinFunction(const char* name, int length);
Function* getBuiltinFunction(int index);
// Operators //////////////////////////////////////////////////////////////////
2021-02-11 01:23:48 +08:00
Var varAdd(MSVM* vm, Var v1, Var v2);
Var varSubtract(MSVM* vm, Var v1, Var v2);
Var varMultiply(MSVM* vm, Var v1, Var v2);
Var varDivide(MSVM* vm, Var v1, Var v2);
2021-02-15 20:49:19 +08:00
bool varGreater(Var v1, Var v2);
bool varLesser(Var v1, Var v2);
// Functions //////////////////////////////////////////////////////////////////
// Parameter [iterator] should be VAR_NULL before starting the iteration.
// If an element is obtained by iteration it'll return true otherwise returns
// false indicating that the iteration is over.
bool varIterate(MSVM* vm, Var seq, Var* iterator, Var* value);
2021-02-12 01:35:43 +08:00
2021-02-11 01:23:48 +08:00
#endif // CORE_H