This repository has been archived by the owner on Dec 7, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcore.hpp
83 lines (50 loc) · 1.75 KB
/
core.hpp
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
#ifndef RPN_CORE_H
#define RPN_CORE_H
#include <iostream>
#include <stack>
#include <queue>
#include <cstring>
#include <stdio.h>
#include <stdlib.h>
#include <cmath>
#include <inttypes.h>
extern char* metaName;
extern int line;
extern FILE* program;
extern char* progName;
// will be the error code given when a function return successfully
// this content is set so that if they use it out of context they are still told so
extern const char* lambda_finish;
// this is the class used in our stack
#include "calc_value.hpp"
// user defined variables
#include "user_variables.hpp"
// some useful functions
#include "utils.hpp"
#include "string_stack.hpp"
#include "process_line.hpp"
// don't we all love pretty colors :)))
#include "terminal_colors.hpp"
void runFile(char* programFile, bool& errorReporting);
/* from string_stack.hpp
namespace macro {
typedef enum {
MACRO, LAMBDA, OTHER
} exec_t;
typedef enum {
SUCCESS, RETURN, ERROR, BREAK
} ret_t;
}
*/
macro::ret_t runFile(FILE* prog_file, std::vector<UserVar>& var_nodes, bool& errorReporting,
std::stack<CalcValue>& mainStack, bool& elseStatement
);
void runShell(std::vector<UserVar>& var_nodes, bool& errorReporting,
std::stack<CalcValue>& mainStack, bool& elseStatement, std::vector<void*> freeable
);
char* runMacro(StrStack* macro, std::stack<CalcValue>& mainStack, std::vector<UserVar> var_nodes, std::vector<void*>& freeable, bool showErrors, bool elseStatement);
char* runMacroKeepScope(StrStack* macro, std::stack<CalcValue>& mainStack, std::vector<UserVar> var_nodes, std::vector<void*>& freeable, bool showErrors, bool elseStatement);
// Returns the start of the token/string-constant
// manages escape-sequences within string-constants
char* qtok(char* str, char** next);
#endif