-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathcorewords.h
93 lines (77 loc) · 4.08 KB
/
corewords.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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
/* This file is part of libreDSSP.
Copyright 2019 Alan Beadle
libreDSSP is free software: you can redistribute it and/or modify
it under the terms of 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.
libreDSSP 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 a copy of the GNU General Public License
along with libreDSSP. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef COREWORDS_H
#define COREWORDS_H
#include <stdlib.h>
#include "elem.h"
#include "stack.h"
typedef struct dict dict;
// Arithmetic
void plus(stack * stack, cmdstack * cmdstack, dict * vocab);
void multiply(stack * stack, cmdstack * cmdstack, dict * vocab);
void minus(stack * stack, cmdstack * cmdstack, dict * vocab);
void divide(stack * stack, cmdstack * cmdstack, dict * vocab);
void negate(stack * stack, cmdstack * cmdstack, dict * vocab);
void absval(stack * stack, cmdstack * cmdstack, dict * vocab);
void plus1(stack * stack, cmdstack * cmdstack, dict * vocab);
void plus2(stack * stack, cmdstack * cmdstack, dict * vocab);
void plus3(stack * stack, cmdstack * cmdstack, dict * vocab);
void plus4(stack * stack, cmdstack * cmdstack, dict * vocab);
void minus1(stack * stack, cmdstack * cmdstack, dict * vocab);
void minus2(stack * stack, cmdstack * cmdstack, dict * vocab);
void minus3(stack * stack, cmdstack * cmdstack, dict * vocab);
void minus4(stack * stack, cmdstack * cmdstack, dict * vocab);
// Display and interpreter
void bye(stack * stack, cmdstack * cmdstack, dict * vocab);
void showTop(stack * stack, cmdstack * cmdstack, dict * vocab);
void showStack(stack * stack, cmdstack * cmdstack, dict * vocab);
void base10(stack * stack, cmdstack * cmdstack, dict * vocab);
// Conditionals
void ifplus(stack * stack, cmdstack * cmdstack, dict * vocab);
void ifzero(stack * stack, cmdstack * cmdstack, dict * vocab);
void ifminus(stack * stack, cmdstack * cmdstack, dict * vocab);
void branchminus(stack * stack, cmdstack * cmdstack, dict * vocab);
void branchzero(stack * stack, cmdstack * cmdstack, dict * vocab);
void branchplus(stack * stack, cmdstack * cmdstack, dict * vocab);
void branchsign(stack * stack, cmdstack * cmdstack, dict * vocab);
void branch(stack * stack, cmdstack * cmdstack, dict * vocab);
void equality(stack * stack, cmdstack * cmdstack, dict * vocab);
void greaterthan(stack * stack, cmdstack * cmdstack, dict * vocab);
void lessthan(stack * stack, cmdstack * cmdstack, dict * vocab);
// Looping
void doloop(stack * stack, cmdstack * cmdstack, dict * vocab);
// Stack manipulation
void exch2(stack * stack, cmdstack * cmdstack, dict * vocab);
void exch3(stack * stack, cmdstack * cmdstack, dict * vocab);
void exch4(stack * stack, cmdstack * cmdstack, dict * vocab);
void exchdepth(stack * stack, cmdstack * cmdstack, dict * vocab);
void copy(stack * stack, cmdstack * cmdstack, dict * vocab);
void copy2(stack * stack, cmdstack * cmdstack, dict * vocab);
void copy3(stack * stack, cmdstack * cmdstack, dict * vocab);
void copy4(stack * stack, cmdstack * cmdstack, dict * vocab);
void copydepth(stack * stack, cmdstack * cmdstack, dict * vocab);
void drop(stack * stack, cmdstack * cmdstack, dict * vocab);
void dropStack(stack * stack, cmdstack * cmdstack, dict * vocab);
// Misc
void defVar(stack * stack, cmdstack * cmdstack, dict * vocab);
void printNewline(stack * stack, cmdstack * cmdstack, dict * vocab);
void printSpace(stack * stack, cmdstack * cmdstack, dict * vocab);
void listDicts(stack * stack, cmdstack * cmdstack, dict * vocab);
void growSub(stack * stack, cmdstack * cmdstack, dict * vocab);
void shutSub(stack * stack, cmdstack * cmdstack, dict * vocab);
void openSub(stack * stack, cmdstack * cmdstack, dict * vocab);
void termInNum(stack * stack, cmdstack * cmdstack, dict * vocab);
void termOutNum(stack * stack, cmdstack * cmdstack, dict * vocab);
void stackDepth(stack * stack, cmdstack * cmdstack, dict * vocab);
#endif