-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathvm.h
57 lines (50 loc) · 1.77 KB
/
vm.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
/*
* j2 - A simple concatenative programming language that can understand
* the structure of and dynamically link with compatible C binaries.
*
* Copyright (C) 2011 Jason Nyberg <[email protected]>
* Copyright (C) 2018 Jason Nyberg <[email protected]> (dual-licensed)
* (C) Copyright 2019 Hewlett Packard Enterprise Development LP.
*
* This file is part of j2.
*
* This file is free software; you can redistribute it and/or modify
* it under the terms of either
*
* * the GNU Lesser General Public License as published by the Free
* Software Foundation; either version 3 of the License, or (at
* your option) any later version
*
* or
*
* * the GNU General Public License as published by the Free
* Software Foundation; either version 3 of the License, or (at
* your option) any later version
*
* or both in parallel, as here.
*
* j2 is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received copies of the GNU General Public License and
* the GNU Lesser General Public License along with this program. If
* not, see <http://www.gnu.org/licenses/>.
*/
#ifndef VM_H
#define VM_H
#include <stdio.h>
#include "listree.h"
#define THROW(expression,ltv) do { if (expression) { vm_throw(ltv); goto done; } } while(0)
FILE *outfile();
FILE *errfile();
extern int vm_bootstrap(char *bootstrap);
extern void vm_throw(LTV *ltv);
extern LTV *vm_stack_enq(LTV *ltv);
extern LTV *vm_stack_deq(int pop);
extern LTV *encaps_ltv(LTV *ltv);
extern LTV *decaps_ltv(LTV *ltv);
extern LTV *vm_resolve(LTV *ref);
extern void vm_eval_ltv(LTV *ltv);
#endif // VM_H