-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexecutor.h
More file actions
64 lines (43 loc) · 1.54 KB
/
Copy pathexecutor.h
File metadata and controls
64 lines (43 loc) · 1.54 KB
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
//
// Created by michal on 09.09.17.
//
#ifndef PROJECT_EXECUTOR_H
#define PROJECT_EXECUTOR_H
#include <vector>
#include <string>
#include <fstream>
#include "instruction.h"
#include "argument.h"
#include "label.h"
class Executor {
public:
explicit Executor(std::vector<char> &buffer, std::vector<std::shared_ptr<VMRegister>> &vm_registers, Memory &memory)
: buffer_ref(buffer),
vm_registers(vm_registers), memory(memory) {}
explicit Executor(std::vector<char> &buffer, std::vector<std::shared_ptr<VMRegister>> &vm_registers, Memory &memory,
std::vector<char> &input_file)
: buffer_ref(buffer),
vm_registers(vm_registers), memory(memory), input_file(input_file) {}
int find_instruction();
void process_instruction();
void execution(int64_t, Label &label, std::vector<std::shared_ptr<Argument>>);
void find_argument();
void find_const_value();
void find_label_address();
std::shared_ptr<Argument> create_register_argument(std::string &raw_parameter);
std::shared_ptr<Argument> create_memory_argument(std::string &raw_parameter);
int get_actual_bit();
void set_actual_bit(int current_bit);
void reset();
private:
int actual_byte = 0;
int actual_bit = 0;
Instruction instruction;
std::vector<std::string> parameters;
std::vector<char> &buffer_ref;
std::vector<std::shared_ptr<VMRegister>> &vm_registers;
Memory &memory;
std::vector<char> input_file;
int read_bit();
};
#endif //PROJECT_EXECUTOR_H