forked from gfwilliams/tiny-js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscriptMain.h
64 lines (49 loc) · 1.92 KB
/
scriptMain.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
/*
* File: scriptMain.h
* Author: ghernan
*
* Script engine main file. Contains 'evaluate' function, which runs an script
* contained in a string.
*
* Created on December 4, 2016, 10:31 PM
*/
#ifndef SCRIPTMAIN_H
#define SCRIPTMAIN_H
#pragma once
#include "jsVars.h"
#include "asObjects.h"
#include <string>
class MvmRoutine;
struct ExecutionContext;
typedef void (*TraceFN)(int opCode, const ExecutionContext* ec);
ASValue evaluate (const char* script, Ref<JSObject> globals);
ASValue evaluate (const char* script,
Ref<JSObject> globals,
const std::string& scriptPath,
ExecutionContext *ec);
ASValue evaluate (Ref<MvmRoutine> code,
const CodeMap* codeMap,
Ref<JSObject> globals,
const std::string& scriptPath,
ExecutionContext* parentEC);
Ref<JSObject> createDefaultGlobals();
Ref<JSFunction> addNative (const std::string& szFunctionHeader,
JSNativeFn pFn,
VarMap& varMap);
Ref<JSFunction> addNative (const std::string& szFunctionHeader,
JSNativeFn pFn,
Ref<JSObject> obj,
bool isConst=true);
Ref<JSFunction> addNative0 (const std::string& szName,
JSNativeFn pFn,
Ref<JSObject> container);
Ref<JSFunction> addNative1 (const std::string& szName,
const std::string& p1,
JSNativeFn pFn,
Ref<JSObject> container);
Ref<JSFunction> addNative2 (const std::string& szName,
const std::string& p1,
const std::string& p2,
JSNativeFn pFn,
Ref<JSObject> container);
#endif /* SCRIPTMAIN_H */