Fix link support

This commit is contained in:
Nikiroy78 2023-07-17 19:52:05 +03:00
parent 5df234b315
commit 2462ecf887
13 changed files with 22 additions and 7 deletions

View File

@ -35,3 +35,15 @@
990 1234 7052883195356824 source.exe b75effd0a1405b8c
4 998 7052883611712854 CMakeFiles/source.dir/main.cpp.obj 27ba6efb8bcbc87e
998 1237 7052883614073394 source.exe b75effd0a1405b8c
151 1771 7113154869974938 CMakeFiles/source.dir/subprog.cpp.obj 1d7edd0e9fce1178
147 1773 7113154869974938 CMakeFiles/source.dir/vm-src.cpp.obj 58985300ff2cd989
148 1773 7113154869984931 CMakeFiles/source.dir/command.cpp.obj d3df98591b675230
149 1774 7113154869984931 CMakeFiles/source.dir/command-exec.cpp.obj 8af330b9b71e9707
145 1804 7113154870285090 CMakeFiles/source.dir/main.cpp.obj 27ba6efb8bcbc87e
9 694 7113158718017742 CMakeFiles/source.dir/stack.cpp.obj 582eb6d8fc3feef9
11 853 7113158719598061 CMakeFiles/source.dir/command-exec.cpp.obj 8af330b9b71e9707
8 877 7113158719838114 CMakeFiles/source.dir/command.cpp.obj d3df98591b675230
4 880 7113158719858131 CMakeFiles/source.dir/subprog.cpp.obj 1d7edd0e9fce1178
6 932 7113158720388258 CMakeFiles/source.dir/vm-src.cpp.obj 58985300ff2cd989
7 1200 7113158723068953 CMakeFiles/source.dir/main.cpp.obj 27ba6efb8bcbc87e
1200 2256 7113158733550796 source.exe b75effd0a1405b8c

View File

@ -1,3 +1,3 @@
Start testing: Jul 04 23:57 RTZ 2 (çèìà)
Start testing: Jul 17 19:44 RTZ 2 (çèìà)
----------------------------------------------------------
End testing: Jul 04 23:57 RTZ 2 (çèìà)
End testing: Jul 17 19:44 RTZ 2 (çèìà)

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE QtCreatorProject>
<!-- Written by QtCreator 9.0.0, 2023-07-04T23:58:12. -->
<!-- Written by QtCreator 9.0.0, 2023-07-17T19:51:48. -->
<qtcreator>
<data>
<variable>EnvironmentId</variable>

View File

@ -1,7 +1,7 @@
#include "stack.h"
#include <iostream>
int bytesToInt (vector<vector<std::byte>> bytes) {
int Stack::bytesToInt (vector<std::byte> bytes) {
// (!) Сделать потом
return 0;
}
@ -19,17 +19,17 @@ vector<byte> Stack::get () {
vector<byte> result = this->stackStorage[this->stackPointer];
if (this->stackLinker[this->stackPointer] != -1) {
if (
this->stackLinker.size() < bytesToInt(this->stackStorage[this->stackPointer])
this->stackLinker.size() < this->bytesToInt(this->stackStorage[this->stackPointer])
) {
// (!) Выдать ошибку: такого элемента не существует
}
else if (
bytesToInt(this->stackStorage[this->stackPointer]) == this->stackPointer
this->bytesToInt(this->stackStorage[this->stackPointer]) == this->stackPointer
) {
// (!) Выдать ошибку: ссылочный элемент не может ссылаться на самого себя
}
else {
this->stackPointer = bytesToInt(this->stackStorage[this->stackPointer]);
this->stackPointer = this->bytesToInt(this->stackStorage[this->stackPointer]);
return this->get();
}
}

View File

@ -19,6 +19,9 @@ public:
vector<byte> get ();
int size ();
private:
int bytesToInt (vector<byte> bytes);
//int bytesToInt (vector<std::byte, allocator<std::byte>> bytes);
int stackPointer = -1;
int stackSize = 0;
vector<vector<byte>> stackStorage = {};