+ everything namespaced
~ fixed clang-tidy errors
This commit is contained in:
parent
5aa0a7862f
commit
c8569eb3b4
@ -5,11 +5,11 @@ bool=false
|
||||
# explicitly set IFS to contain only a line feed
|
||||
IFS='
|
||||
'
|
||||
filelist="$(find . -not \( -path './*build*' -prune \) -type f ! -name "$(printf "*\n*")")"
|
||||
filelist="$(find . -not \( -path './*build*' -prune \) -not \( -path './include' -prune \) -not \( -path './lib' -prune \) -type f ! -name "$(printf "*\n*")")"
|
||||
for file in $filelist; do
|
||||
if echo "$file" | grep -q -E ".*(\.cpp|\.h|\.hpp)$" ; then
|
||||
#Extra check missing dependencies due to clang-tidy doesn't toggle exit code.
|
||||
clang_tidy_lib_check="$(clang-tidy -warnings-as-errors='*' -header-filter='.*,-cpptoml.hpp' -checks='*,-llvm-header-guard,-fuchsia-statically-constructed-objects,-fuchsia-default-arguments,-fuchsia-default-arguments-calls,-cppcoreguidelines-pro-bounds-pointer-arithmetic,-cppcoreguidelines-pro-bounds-constant-array-index,-bugprone-narrowing-conversions,-cppcoreguidelines-narrowing-conversions,-cppcoreguidelines-pro-type-const-cast,-cppcoreguidelines-pro-type-reinterpret-cast,-hicpp-signed-bitwise,-bugprone-exception-escape,-cppcoreguidelines-pro-type-member-init,-cppcoreguidelines-pro-type-cstyle-cast,-hicpp-member-init' "$file" -- -I. -std=c++14 2>&1)"
|
||||
clang_tidy_lib_check="$(clang-tidy -warnings-as-errors='*' -header-filter='.*,-cpptoml.hpp' -checks='*,-llvm-header-guard,-fuchsia-statically-constructed-objects,-fuchsia*,-cppcoreguidelines-pro-bounds-pointer-arithmetic,-cppcoreguidelines-pro-bounds-constant-array-index,-bugprone-narrowing-conversions,-cppcoreguidelines-narrowing-conversions,-cppcoreguidelines-pro-type-const-cast,-cppcoreguidelines-pro-type-reinterpret-cast,-hicpp-signed-bitwise,-bugprone-exception-escape,-cppcoreguidelines-pro-type-member-init,-cppcoreguidelines-pro-type-cstyle-cast,-hicpp-member-init,-google-readability-namespace-comments,-llvm-namespace-comment' "$file" -- -I. -std=c++14 2>&1)"
|
||||
for tidy_line in $clang_tidy_lib_check; do
|
||||
echo "$tidy_line" | grep -q -v -E "^Error while processing*"
|
||||
if [ $? -eq 1 ]; then
|
||||
|
@ -17,7 +17,7 @@ set(CMAKE_CXX_CLANG_TIDY clang-tidy;-header-filter=.;-checks=*;)
|
||||
|
||||
|
||||
file(GLOB_RECURSE SOURCES src/*.cpp)
|
||||
file(GLOB_RECURSE HEADERS src/*.h)
|
||||
file(GLOB_RECURSE HEADERS src/*.hpp)
|
||||
file(GLOB_RECURSE TESTS test/*.cpp)
|
||||
include_directories(src)
|
||||
include_directories(test)
|
||||
|
@ -1,32 +1,33 @@
|
||||
#include "Color.hpp"
|
||||
|
||||
#include "Color.h"
|
||||
namespace vkvm {
|
||||
|
||||
Color::Color(unsigned char red, unsigned char green, unsigned char blue) noexcept
|
||||
: red(red), green(green), blue(blue){
|
||||
Color::Color(unsigned char red, unsigned char green, unsigned char blue) noexcept
|
||||
: red(red), green(green), blue(blue) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
unsigned char Color::getRed() {
|
||||
return red;
|
||||
}
|
||||
auto Color::getRed() -> unsigned char {
|
||||
return red;
|
||||
}
|
||||
|
||||
unsigned char Color::getGreen() {
|
||||
return green;
|
||||
}
|
||||
auto Color::getGreen() -> unsigned char {
|
||||
return green;
|
||||
}
|
||||
|
||||
unsigned char Color::getBlue() {
|
||||
return blue;
|
||||
}
|
||||
auto Color::getBlue() -> unsigned char {
|
||||
return blue;
|
||||
}
|
||||
|
||||
void Color::setRed(unsigned char value) {
|
||||
red = value;
|
||||
}
|
||||
auto Color::setRed(unsigned char value) -> void {
|
||||
red = value;
|
||||
}
|
||||
|
||||
void Color::setGreen(unsigned char value) {
|
||||
green = value;
|
||||
}
|
||||
|
||||
void Color::setBlue(unsigned char value) {
|
||||
blue = value;
|
||||
}
|
||||
auto Color::setGreen(unsigned char value) -> void {
|
||||
green = value;
|
||||
}
|
||||
|
||||
auto Color::setBlue(unsigned char value) -> void {
|
||||
blue = value;
|
||||
}
|
||||
}
|
33
src/Color.h
33
src/Color.h
@ -1,33 +0,0 @@
|
||||
#ifndef LIBRARY_COLOR_H
|
||||
#define LIBRARY_COLOR_H
|
||||
|
||||
|
||||
/**
|
||||
* color values represented as rgb values.
|
||||
* @author Johannes Theiner
|
||||
* @since 0.1.0
|
||||
*/
|
||||
class Color {
|
||||
|
||||
private:
|
||||
unsigned char red;
|
||||
unsigned char green;
|
||||
unsigned char blue;
|
||||
|
||||
public:
|
||||
Color(unsigned char red, unsigned char green, unsigned char blue) noexcept;
|
||||
|
||||
unsigned char getRed();
|
||||
unsigned char getGreen();
|
||||
unsigned char getBlue();
|
||||
|
||||
void setRed(unsigned char value);
|
||||
void setGreen(unsigned char value);
|
||||
void setBlue(unsigned char value);
|
||||
|
||||
};
|
||||
|
||||
const static Color black = Color(0, 0, 0);
|
||||
const static Color white = Color(255, 255, 255);
|
||||
|
||||
#endif
|
40
src/Color.hpp
Normal file
40
src/Color.hpp
Normal file
@ -0,0 +1,40 @@
|
||||
#ifndef LIBRARY_COLOR_HPP
|
||||
#define LIBRARY_COLOR_HPP
|
||||
|
||||
namespace vkvm {
|
||||
|
||||
/**
|
||||
* color values represented as rgb values.
|
||||
* @author Johannes Theiner
|
||||
* @since 0.1.0
|
||||
*/
|
||||
class Color {
|
||||
|
||||
private:
|
||||
unsigned char red;
|
||||
unsigned char green;
|
||||
unsigned char blue;
|
||||
|
||||
public:
|
||||
Color(unsigned char red, unsigned char green, unsigned char blue) noexcept;
|
||||
|
||||
auto getRed() -> unsigned char;
|
||||
|
||||
auto getGreen() -> unsigned char;
|
||||
|
||||
auto getBlue() -> unsigned char;
|
||||
|
||||
auto setRed(unsigned char value) -> void;
|
||||
|
||||
auto setGreen(unsigned char value) -> void;
|
||||
|
||||
auto setBlue(unsigned char value) -> void;
|
||||
|
||||
};
|
||||
|
||||
const static Color black = Color(0, 0, 0);
|
||||
const static Color white = Color(255, 255, 255);
|
||||
|
||||
}
|
||||
|
||||
#endif
|
@ -1,20 +0,0 @@
|
||||
#ifndef LIBRARY_EVENTTYPE_H
|
||||
#define LIBRARY_EVENTTYPE_H
|
||||
|
||||
/**
|
||||
* types of events.
|
||||
* @since 0.1.0
|
||||
* @uthor Johannes Theiner
|
||||
*/
|
||||
enum EventType {
|
||||
Timer = 1,
|
||||
MouseMove = 2,
|
||||
MouseButton = 3,
|
||||
KeyDown = 4,
|
||||
KeyUp = 5,
|
||||
UpdateControlRegisters = 6,
|
||||
Redraw = 7,
|
||||
RenderText = 8
|
||||
};
|
||||
|
||||
#endif
|
24
src/EventType.hpp
Normal file
24
src/EventType.hpp
Normal file
@ -0,0 +1,24 @@
|
||||
#ifndef LIBRARY_EVENTTYPE_HPP
|
||||
#define LIBRARY_EVENTTYPE_HPP
|
||||
|
||||
namespace vkvm {
|
||||
|
||||
/**
|
||||
* types of events.
|
||||
* @since 0.1.0
|
||||
* @uthor Johannes Theiner
|
||||
*/
|
||||
enum EventType {
|
||||
Timer = 1,
|
||||
MouseMove = 2,
|
||||
MouseButton = 3,
|
||||
KeyDown = 4,
|
||||
KeyUp = 5,
|
||||
UpdateControlRegisters = 6,
|
||||
Redraw = 7,
|
||||
RenderText = 8
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
@ -1,25 +1,28 @@
|
||||
#include "FontType.h"
|
||||
#include "FontType.hpp"
|
||||
|
||||
namespace vkvm {
|
||||
|
||||
FontType::FontType(int id, std::string name, int height, int width) noexcept {
|
||||
this->id = id;
|
||||
this->name = std::move(name);
|
||||
this->height = height;
|
||||
this->width = width;
|
||||
}
|
||||
FontType::FontType(int id, std::string name, int height, int width) noexcept {
|
||||
this->id = id;
|
||||
this->name = std::move(name);
|
||||
this->height = height;
|
||||
this->width = width;
|
||||
}
|
||||
|
||||
int FontType::getId() const{
|
||||
return id;
|
||||
}
|
||||
auto FontType::getId() const -> int {
|
||||
return id;
|
||||
}
|
||||
|
||||
std::string FontType::getName() const{
|
||||
return name;
|
||||
}
|
||||
auto FontType::getName() const -> std::string {
|
||||
return name;
|
||||
}
|
||||
|
||||
int FontType::getHeight() const{
|
||||
return height;
|
||||
}
|
||||
auto FontType::getHeight() const -> int {
|
||||
return height;
|
||||
}
|
||||
|
||||
int FontType::getWidth() const{
|
||||
return width;
|
||||
}
|
||||
auto FontType::getWidth() const -> int {
|
||||
return width;
|
||||
}
|
||||
|
||||
}
|
@ -1,27 +0,0 @@
|
||||
#ifndef LIBRARY_FONT_H
|
||||
|
||||
#define LIBRARY_FONT_H
|
||||
|
||||
#include <string>
|
||||
#include <utility>
|
||||
|
||||
class FontType {
|
||||
private:
|
||||
int id;
|
||||
std::string name;
|
||||
int height;
|
||||
int width;
|
||||
|
||||
public:
|
||||
FontType(int id, std::string name, int height, int width) noexcept;
|
||||
int getId() const;
|
||||
std::string getName() const;
|
||||
int getHeight() const;
|
||||
int getWidth() const;
|
||||
|
||||
};
|
||||
|
||||
|
||||
const static FontType font_1 = FontType(1, "DummyFont", 10, 5);
|
||||
|
||||
#endif
|
35
src/FontType.hpp
Normal file
35
src/FontType.hpp
Normal file
@ -0,0 +1,35 @@
|
||||
#ifndef LIBRARY_FONT_H
|
||||
|
||||
#define LIBRARY_FONT_H
|
||||
|
||||
#include <string>
|
||||
#include <utility>
|
||||
|
||||
namespace vkvm {
|
||||
|
||||
class FontType {
|
||||
private:
|
||||
int id;
|
||||
std::string name;
|
||||
int height;
|
||||
int width;
|
||||
|
||||
public:
|
||||
FontType(int id, std::string name, int height, int width) noexcept;
|
||||
|
||||
auto getId() const -> int;
|
||||
|
||||
auto getName() const -> std::string;
|
||||
|
||||
auto getHeight() const -> int;
|
||||
|
||||
auto getWidth() const -> int;
|
||||
|
||||
};
|
||||
|
||||
|
||||
const static FontType font_1 = FontType(1, "DummyFont", 10, 5);
|
||||
|
||||
}
|
||||
|
||||
#endif
|
@ -1,16 +0,0 @@
|
||||
#ifndef LIBRARY_GRAPHICMODE_H
|
||||
#define LIBRARY_GRAPHICMODE_H
|
||||
|
||||
/**
|
||||
* all possible graphics modes.
|
||||
* @author Johannes Theiner
|
||||
* @since 0.1.0
|
||||
*/
|
||||
enum GraphicMode {
|
||||
Text = 1,
|
||||
TwoColors = 2,
|
||||
Gray_256 = 3,
|
||||
TrueColor = 4,
|
||||
};
|
||||
|
||||
#endif
|
19
src/GraphicMode.hpp
Normal file
19
src/GraphicMode.hpp
Normal file
@ -0,0 +1,19 @@
|
||||
#ifndef LIBRARY_GRAPHICMODE_HPP
|
||||
#define LIBRARY_GRAPHICMODE_HPP
|
||||
|
||||
|
||||
namespace vkvm {
|
||||
/**
|
||||
* all possible graphics modes.
|
||||
* @author Johannes Theiner
|
||||
* @since 0.1.0
|
||||
*/
|
||||
enum GraphicMode {
|
||||
Text = 1,
|
||||
TwoColors = 2,
|
||||
Gray_256 = 3,
|
||||
TrueColor = 4,
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
@ -1,9 +1,11 @@
|
||||
#include "KeyCode.hpp"
|
||||
|
||||
#include "KeyCode.h"
|
||||
namespace vkvm {
|
||||
|
||||
KeyCode::KeyCode(int value) noexcept : value(value) {}
|
||||
KeyCode::KeyCode(int value) noexcept : value(value) {}
|
||||
|
||||
auto KeyCode::getValue() -> int {
|
||||
return value;
|
||||
}
|
||||
|
||||
int KeyCode::getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
|
@ -1,17 +0,0 @@
|
||||
#ifndef LIBRARY_KEYCODE_H
|
||||
#define LIBRARY_KEYCODE_H
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
class KeyCode {
|
||||
private:
|
||||
int value;
|
||||
public:
|
||||
explicit KeyCode(int value) noexcept;
|
||||
int getValue();
|
||||
};
|
||||
|
||||
const static KeyCode Backspace = KeyCode(8);
|
||||
const static KeyCode tabulator = KeyCode(9);
|
||||
|
||||
#endif
|
22
src/KeyCode.hpp
Normal file
22
src/KeyCode.hpp
Normal file
@ -0,0 +1,22 @@
|
||||
#ifndef LIBRARY_KEYCODE_HPP
|
||||
#define LIBRARY_KEYCODE_HPP
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
namespace vkvm {
|
||||
|
||||
class KeyCode {
|
||||
private:
|
||||
int value;
|
||||
public:
|
||||
explicit KeyCode(int value) noexcept;
|
||||
|
||||
auto getValue() -> int;
|
||||
};
|
||||
|
||||
const static KeyCode Backspace = KeyCode(8);
|
||||
const static KeyCode tabulator = KeyCode(9);
|
||||
|
||||
}
|
||||
|
||||
#endif
|
@ -1,8 +0,0 @@
|
||||
#ifndef LIBRARY_LAYOUTVERSION_H
|
||||
#define LIBRARY_LAYOUTVERSION_H
|
||||
|
||||
enum LayoutVersion {
|
||||
V1 = 1
|
||||
};
|
||||
|
||||
#endif
|
12
src/LayoutVersion.hpp
Normal file
12
src/LayoutVersion.hpp
Normal file
@ -0,0 +1,12 @@
|
||||
#ifndef LIBRARY_LAYOUTVERSION_HPP
|
||||
#define LIBRARY_LAYOUTVERSION_HPP
|
||||
|
||||
namespace vkvm {
|
||||
|
||||
enum LayoutVersion {
|
||||
V1 = 1
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
@ -1,6 +1,3 @@
|
||||
//
|
||||
// Created by Cigerxwin Chaker on 05.11.19.
|
||||
//
|
||||
#include <cstdio>
|
||||
#include <cstdlib>
|
||||
#include <cstring>
|
||||
@ -12,93 +9,96 @@
|
||||
#include <sys/types.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "SharedMemoryAccess.h" /* header is important for the shmID. name could be different. maybe not needed cause: (shmget(memory_access_key, NULL, 0)) */
|
||||
#include "internal.h"
|
||||
#include "SharedMemoryAccess.hpp" /* header is important for the shmID. name could be different. maybe not needed cause: (shmget(memory_access_key, NULL, 0)) */
|
||||
#include "internal.hpp"
|
||||
|
||||
constexpr int PERM = 0666; /* access rights */
|
||||
constexpr int LOCK = -1;
|
||||
constexpr int UNLOCK = 1;
|
||||
constexpr int SEM_KEY = 123458L;
|
||||
namespace vkvm {
|
||||
constexpr int PERM = 0666; /* access rights */
|
||||
constexpr int LOCK = -1;
|
||||
constexpr int UNLOCK = 1;
|
||||
constexpr int SEM_KEY = 123458L;
|
||||
|
||||
//int memoryAccessKey; /* var type is int. but could be another type. */ //TODO: look after type in sharedmemory group
|
||||
int semId;
|
||||
struct sembuf semaphore;
|
||||
int semId;
|
||||
struct sembuf semaphore;
|
||||
|
||||
std::vector<char> localSharedMemory;
|
||||
std::vector<char> localSharedMemory;
|
||||
|
||||
int initSemaphore() {
|
||||
/* Testen, ob das Semaphor bereits existiert */
|
||||
semId = semget(SEM_KEY, 0, IPC_PRIVATE);
|
||||
if (semId < 0) {
|
||||
/* ... existiert noch nicht, also anlegen */
|
||||
/* Alle Zugriffsrechte der Dateikreierungsmaske */
|
||||
/* erlauben */
|
||||
umask(0);
|
||||
semId = semget(SEM_KEY, 1, IPC_CREAT | IPC_EXCL | PERM);
|
||||
auto initSemaphore() -> int {
|
||||
/* Testen, ob das Semaphor bereits existiert */
|
||||
semId = semget(SEM_KEY, 0, IPC_PRIVATE);
|
||||
if (semId < 0) {
|
||||
/* ... existiert noch nicht, also anlegen */
|
||||
/* Alle Zugriffsrechte der Dateikreierungsmaske */
|
||||
/* erlauben */
|
||||
umask(0);
|
||||
semId = semget(SEM_KEY, 1, IPC_CREAT | IPC_EXCL | PERM);
|
||||
if (semId < 0) {
|
||||
return -1;
|
||||
}
|
||||
/* Semaphor mit 1 initialisieren */
|
||||
if (semctl(semId, 0, SETVAL, 1) == -1){
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
auto semaphoreOperation(int op) -> int {
|
||||
semaphore.sem_op = static_cast<int16_t>(op);
|
||||
semaphore.sem_flg = SEM_UNDO;
|
||||
if (semop(semId, &semaphore, 1) == -1) {
|
||||
perror(" semop ");
|
||||
return -1;
|
||||
}
|
||||
/* Semaphor mit 1 initialisieren */
|
||||
if (semctl(semId, 0, SETVAL, 1) == -1){
|
||||
return -1;
|
||||
return 1;
|
||||
}
|
||||
|
||||
auto writeSharedMemory(char *data, int size, int offset) -> void {
|
||||
lockSharedMemory();
|
||||
memcpy(getSharedMemory() + offset, data, size);
|
||||
unlockSharedMemory();
|
||||
}
|
||||
|
||||
auto getSharedMemory() -> char * {
|
||||
bool useLocal = false;
|
||||
|
||||
if(!useLocal){
|
||||
int shmId = shmget(impl.sharedMemoryKey, NULL, 0);
|
||||
if(shmId < 0) {
|
||||
//no shared memory found
|
||||
useLocal = true;
|
||||
} else {
|
||||
return (char *) shmat(shmId, NULL, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
int semaphoreOperation(int op) {
|
||||
semaphore.sem_op = static_cast<int16_t>(op);
|
||||
semaphore.sem_flg = SEM_UNDO;
|
||||
if (semop(semId, &semaphore, 1) == -1) {
|
||||
perror(" semop ");
|
||||
return -1;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
void writeSharedMemory(char *data, int size, int offset) {
|
||||
lockSharedMemory();
|
||||
memcpy(getSharedMemory() + offset, data, size);
|
||||
unlockSharedMemory();
|
||||
}
|
||||
|
||||
char *getSharedMemory() {
|
||||
bool useLocal = false;
|
||||
|
||||
if(!useLocal){
|
||||
int shmId = shmget(impl.sharedMemoryKey, NULL, 0);
|
||||
if(shmId < 0) {
|
||||
//no shared memory found
|
||||
useLocal = true;
|
||||
} else {
|
||||
return (char *) shmat(shmId, NULL, 0);
|
||||
if(useLocal) {
|
||||
//using a local buffer for shared memory testing
|
||||
if (localSharedMemory.empty()) {
|
||||
initSemaphore();
|
||||
localSharedMemory.resize(impl.sharedMemorySize * 1024);
|
||||
}
|
||||
return &localSharedMemory[0];
|
||||
}
|
||||
}
|
||||
|
||||
if(useLocal) {
|
||||
//using a local buffer for shared memory testing
|
||||
if (localSharedMemory.empty()) {
|
||||
initSemaphore();
|
||||
localSharedMemory.resize(impl.sharedMemorySize * 1024);
|
||||
}
|
||||
return &localSharedMemory[0];
|
||||
auto getSharedMemory(char *address, int size, int offset) -> void {
|
||||
lockSharedMemory();
|
||||
memcpy(address, getSharedMemory() + offset, size);
|
||||
unlockSharedMemory();
|
||||
}
|
||||
}
|
||||
|
||||
void getSharedMemory(char *address, int size, int offset) {
|
||||
lockSharedMemory();
|
||||
memcpy(address, getSharedMemory() + offset, size);
|
||||
unlockSharedMemory();
|
||||
}
|
||||
auto getSharedMemorySize() -> int {
|
||||
return impl.sharedMemorySize;
|
||||
}
|
||||
|
||||
int getSharedMemorySize() {
|
||||
return impl.sharedMemorySize;
|
||||
}
|
||||
auto lockSharedMemory() -> void {
|
||||
semaphoreOperation(LOCK);
|
||||
}
|
||||
|
||||
void lockSharedMemory() {
|
||||
semaphoreOperation(LOCK);
|
||||
}
|
||||
auto unlockSharedMemory() -> void {
|
||||
semaphoreOperation(UNLOCK);
|
||||
}
|
||||
|
||||
void unlockSharedMemory() {
|
||||
semaphoreOperation(UNLOCK);
|
||||
}
|
||||
}
|
@ -1,17 +1,14 @@
|
||||
//
|
||||
// Created by Cigerxwin Chaker on 05.11.19.
|
||||
//
|
||||
|
||||
#ifndef LIBRARY_SHAREDMEMORYACCESSS_H
|
||||
#define LIBRARY_SHAREDMEMORYACCESSS_H
|
||||
|
||||
int initSemaphore();
|
||||
namespace vkvm {
|
||||
auto initSemaphore() -> int;
|
||||
|
||||
/**
|
||||
* use lock and unlock when writing
|
||||
* @return pointer to the shared memory
|
||||
*/
|
||||
char *getSharedMemory();
|
||||
auto getSharedMemory() -> char *;
|
||||
|
||||
/**
|
||||
* use lock and unlock when writing,
|
||||
@ -20,17 +17,17 @@ char *getSharedMemory();
|
||||
* @param size of data
|
||||
* @param offset where the data is written on the shared memory
|
||||
*/
|
||||
void getSharedMemory(char *address, int size, int offset);
|
||||
auto getSharedMemory(char *address, int size, int offset) -> void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @return the size of the shared memory
|
||||
*/
|
||||
int getSharedMemorySize();
|
||||
auto getSharedMemorySize() -> int;
|
||||
|
||||
void lockSharedMemory();
|
||||
auto lockSharedMemory() -> void;
|
||||
|
||||
void unlockSharedMemory();
|
||||
auto unlockSharedMemory() -> void;
|
||||
|
||||
/**
|
||||
*
|
||||
@ -38,6 +35,7 @@ void unlockSharedMemory();
|
||||
* @param size of data
|
||||
* @param offset where the data is written on the shared memory
|
||||
*/
|
||||
void writeSharedMemory(char *data, int size, int offset);
|
||||
auto writeSharedMemory(char *data, int size, int offset) -> void;
|
||||
}
|
||||
|
||||
#endif //LIBRARY_SHAREDMEMORYACCESSS_H
|
||||
#endif
|
139
src/internal.cpp
139
src/internal.cpp
@ -1,78 +1,83 @@
|
||||
#include "internal.h"
|
||||
#include "SharedMemoryAccess.h"
|
||||
#include "vkvm.h"
|
||||
#include "internal.hpp"
|
||||
#include "SharedMemoryAccess.hpp"
|
||||
#include "vkvm.hpp"
|
||||
|
||||
#include <csignal>
|
||||
#include <sys/shm.h>
|
||||
|
||||
Impl impl;
|
||||
|
||||
void sendSignal(pid_t pid, int signalNumber) {
|
||||
kill(pid, signalNumber);
|
||||
}
|
||||
namespace vkvm {
|
||||
|
||||
void onSignal(int signalNumber, void(*callback)(int)) {
|
||||
signal(signalNumber, callback);
|
||||
}
|
||||
Impl impl;
|
||||
|
||||
InterruptEntry *getInterrupTable(){
|
||||
return reinterpret_cast<InterruptEntry*>(getSharedMemory() + sizeof(Registers) + impl.reservedSize);
|
||||
}
|
||||
|
||||
Registers *getRegisters(){
|
||||
return reinterpret_cast<Registers*>(getSharedMemory());
|
||||
}
|
||||
|
||||
char *getTextArea(){
|
||||
return ((getSharedMemory() + sizeof(Registers) + impl.reservedSize) +
|
||||
sizeof(InterruptEntry) * impl.interruptEntyCount);
|
||||
}
|
||||
|
||||
char *getPixelArea(){
|
||||
return (((getSharedMemory() + sizeof(Registers) + impl.reservedSize) +
|
||||
sizeof(InterruptEntry) * impl.interruptEntyCount) +
|
||||
getCharactersPerRow() * getCharactersPerColumn());
|
||||
}
|
||||
|
||||
bool callEvent(EventType type) {
|
||||
auto ivt = getInterrupTable();
|
||||
if(ivt[type].pid != 0){
|
||||
sendSignal(ivt[type].pid, ivt[type].signum);
|
||||
auto sendSignal(pid_t pid, int signalNumber) -> void {
|
||||
kill(pid, signalNumber);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void setLayoutVersion(LayoutVersion newValue) {
|
||||
lockSharedMemory();
|
||||
getRegisters()->layout_version = newValue;
|
||||
unlockSharedMemory();
|
||||
}
|
||||
|
||||
void setCharactersPerColumn(int newValue) {
|
||||
lockSharedMemory();
|
||||
getRegisters()->characters_per_column = newValue;
|
||||
unlockSharedMemory();
|
||||
}
|
||||
|
||||
void setCharactersPerRow(int newValue) {
|
||||
lockSharedMemory();
|
||||
getRegisters()->characters_per_row = newValue;
|
||||
unlockSharedMemory();
|
||||
}
|
||||
|
||||
void setMousePosition(int x, int y) {
|
||||
lockSharedMemory();
|
||||
getRegisters()->mouse_pos_x = x;
|
||||
getRegisters()->mouse_pos_y = y;
|
||||
unlockSharedMemory();
|
||||
}
|
||||
|
||||
void buttonPressed(KeyCode keyCode) {
|
||||
lockSharedMemory();
|
||||
auto reg = getRegisters();
|
||||
if(reg->keyboardBuffer_index_write == sizeof(reg->keyboardBuffer)){
|
||||
reg->keyboardBuffer_index_write = 0;
|
||||
auto onSignal(int signalNumber, void(*callback)(int)) -> void {
|
||||
signal(signalNumber, callback);
|
||||
}
|
||||
reg->keyboardBuffer[reg->keyboardBuffer_index_write++] = keyCode.getValue();
|
||||
unlockSharedMemory();
|
||||
|
||||
auto getInterrupTable() -> InterruptEntry * {
|
||||
return reinterpret_cast<InterruptEntry *>(getSharedMemory() + sizeof(Registers) + impl.reservedSize);
|
||||
}
|
||||
|
||||
auto getRegisters() -> Registers * {
|
||||
return reinterpret_cast<Registers *>(getSharedMemory());
|
||||
}
|
||||
|
||||
auto getTextArea() -> char * {
|
||||
return ((getSharedMemory() + sizeof(Registers) + impl.reservedSize) +
|
||||
sizeof(InterruptEntry) * impl.interruptEntyCount);
|
||||
}
|
||||
|
||||
auto getPixelArea() -> char * {
|
||||
return (((getSharedMemory() + sizeof(Registers) + impl.reservedSize) +
|
||||
sizeof(InterruptEntry) * impl.interruptEntyCount) +
|
||||
getCharactersPerRow() * getCharactersPerColumn());
|
||||
}
|
||||
|
||||
auto callEvent(EventType type) -> bool {
|
||||
auto ivt = getInterrupTable();
|
||||
if (ivt[type].pid != 0) {
|
||||
sendSignal(ivt[type].pid, ivt[type].signum);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
auto setLayoutVersion(LayoutVersion newValue) -> void {
|
||||
lockSharedMemory();
|
||||
getRegisters()->layout_version = newValue;
|
||||
unlockSharedMemory();
|
||||
}
|
||||
|
||||
auto setCharactersPerColumn(int newValue) -> void {
|
||||
lockSharedMemory();
|
||||
getRegisters()->characters_per_column = newValue;
|
||||
unlockSharedMemory();
|
||||
}
|
||||
|
||||
auto setCharactersPerRow(int newValue) -> void {
|
||||
lockSharedMemory();
|
||||
getRegisters()->characters_per_row = newValue;
|
||||
unlockSharedMemory();
|
||||
}
|
||||
|
||||
auto setMousePosition(int x, int y) -> void {
|
||||
lockSharedMemory();
|
||||
getRegisters()->mouse_pos_x = x;
|
||||
getRegisters()->mouse_pos_y = y;
|
||||
unlockSharedMemory();
|
||||
}
|
||||
|
||||
auto buttonPressed(KeyCode keyCode) -> void {
|
||||
lockSharedMemory();
|
||||
auto reg = getRegisters();
|
||||
if (reg->keyboardBuffer_index_write == sizeof(reg->keyboardBuffer)) {
|
||||
reg->keyboardBuffer_index_write = 0;
|
||||
}
|
||||
reg->keyboardBuffer[reg->keyboardBuffer_index_write++] = keyCode.getValue();
|
||||
unlockSharedMemory();
|
||||
}
|
||||
|
||||
}
|
||||
|
126
src/internal.h
126
src/internal.h
@ -1,126 +0,0 @@
|
||||
#ifndef LIBRARY_INTERNAL_H
|
||||
#define LIBRARY_INTERNAL_H
|
||||
|
||||
#include "EventType.h"
|
||||
#include "KeyCode.h"
|
||||
#include "LayoutVersion.h"
|
||||
#include "GraphicMode.h"
|
||||
#include "Color.h"
|
||||
#include <sys/types.h>
|
||||
#include <vector>
|
||||
#include <functional>
|
||||
|
||||
/**
|
||||
* the Control Registers
|
||||
* @author Julian Hinxlage
|
||||
* @since 0.1.0
|
||||
*/
|
||||
struct Registers {
|
||||
int layout_version;
|
||||
int trigger_reset;
|
||||
int width_pixels;
|
||||
int height_pixels;
|
||||
GraphicMode graphicMode;
|
||||
int autoRedrawInterval;
|
||||
int timerInterruptInterval;
|
||||
Color background_color;
|
||||
Color foreground_color;
|
||||
int characters_per_row;
|
||||
int characters_per_column;
|
||||
int textMode_font;
|
||||
int textMode_font_width;
|
||||
int textMode_font_height;
|
||||
int mouse_pos_x;
|
||||
int mouse_pos_y;
|
||||
short keyboardBuffer[16];
|
||||
int keyboardBuffer_index_write;
|
||||
int keyboardBuffer_index_read;
|
||||
};
|
||||
|
||||
struct InterruptEntry {
|
||||
int pid;
|
||||
int signum;
|
||||
};
|
||||
|
||||
/**
|
||||
* internal values for the library.
|
||||
*/
|
||||
struct Impl {
|
||||
int sharedMemoryPid;
|
||||
key_t sharedMemoryKey;
|
||||
int sharedMemorySize;
|
||||
int interruptEntyCount = 64;
|
||||
int reservedSize = 1024;
|
||||
std::vector<std::function<void()>> eventTable;
|
||||
};
|
||||
|
||||
extern Impl impl;
|
||||
|
||||
/**
|
||||
* send a signal to a process
|
||||
* @param pid of the process to which the signal is send
|
||||
* @param signalNumber
|
||||
*/
|
||||
void sendSignal(pid_t pid, int signalNumber);
|
||||
|
||||
/**
|
||||
* calls the callback if a signal is received
|
||||
* @param signalNumber
|
||||
*/
|
||||
void onSignal(int signalNumber, void(*callback)(int));
|
||||
|
||||
|
||||
InterruptEntry *getInterrupTable();
|
||||
Registers *getRegisters();
|
||||
char *getTextArea();
|
||||
char *getPixelArea();
|
||||
|
||||
|
||||
/**
|
||||
* set layout version.
|
||||
* @param newValue new layout version number.
|
||||
*/
|
||||
void setLayoutVersion(LayoutVersion newValue);
|
||||
|
||||
/**
|
||||
* set characters per column for current font.
|
||||
* @param newValue characters per column.
|
||||
*/
|
||||
void setCharactersPerColumn(int newValue);
|
||||
|
||||
/**
|
||||
* set characters per row for current font.
|
||||
* @param newValue
|
||||
*/
|
||||
void setCharactersPerRow(int newValue);
|
||||
|
||||
/**
|
||||
* call a specific event.
|
||||
* @param type
|
||||
* @return true if there is a handler registered.
|
||||
*/
|
||||
bool callEvent(EventType type);
|
||||
|
||||
/**
|
||||
* set mouse position to x,y value.
|
||||
* @param x x coordinate
|
||||
* @param y y coordinate
|
||||
*/
|
||||
void setMousePosition(int x, int y);
|
||||
|
||||
/**
|
||||
* register pressed button.
|
||||
* @param keyCode pressed key.
|
||||
*/
|
||||
void buttonPressed(KeyCode keyCode);
|
||||
|
||||
// Shared Memory Layout
|
||||
// --------------------------------------------------------------------
|
||||
// struct ControlRegisters
|
||||
// char reserved[1024]
|
||||
// Interrupt Vector Table [64]
|
||||
// text area [max_textMode_width * max_textMode_height]
|
||||
// pixel area [max_height_pixels * max_height_pixels * sizeof(uint_32)]
|
||||
|
||||
|
||||
#endif
|
132
src/internal.hpp
Normal file
132
src/internal.hpp
Normal file
@ -0,0 +1,132 @@
|
||||
#ifndef LIBRARY_INTERNAL_HPP
|
||||
#define LIBRARY_INTERNAL_HPP
|
||||
|
||||
#include "EventType.hpp"
|
||||
#include "KeyCode.hpp"
|
||||
#include "LayoutVersion.hpp"
|
||||
#include "GraphicMode.hpp"
|
||||
#include "Color.hpp"
|
||||
#include <sys/types.h>
|
||||
#include <vector>
|
||||
#include <functional>
|
||||
|
||||
namespace vkvm {
|
||||
|
||||
/**
|
||||
* the Control Registers
|
||||
* @author Julian Hinxlage
|
||||
* @since 0.1.0
|
||||
*/
|
||||
struct Registers {
|
||||
int layout_version;
|
||||
int trigger_reset;
|
||||
int width_pixels;
|
||||
int height_pixels;
|
||||
GraphicMode graphicMode;
|
||||
int autoRedrawInterval;
|
||||
int timerInterruptInterval;
|
||||
Color background_color;
|
||||
Color foreground_color;
|
||||
int characters_per_row;
|
||||
int characters_per_column;
|
||||
int textMode_font;
|
||||
int textMode_font_width;
|
||||
int textMode_font_height;
|
||||
int mouse_pos_x;
|
||||
int mouse_pos_y;
|
||||
short keyboardBuffer[16];
|
||||
int keyboardBuffer_index_write;
|
||||
int keyboardBuffer_index_read;
|
||||
};
|
||||
|
||||
struct InterruptEntry {
|
||||
int pid;
|
||||
int signum;
|
||||
};
|
||||
|
||||
/**
|
||||
* internal values for the library.
|
||||
*/
|
||||
struct Impl {
|
||||
int sharedMemoryPid;
|
||||
key_t sharedMemoryKey;
|
||||
int sharedMemorySize;
|
||||
int interruptEntyCount = 64;
|
||||
int reservedSize = 1024;
|
||||
std::vector<std::function<void()>> eventTable;
|
||||
};
|
||||
|
||||
extern Impl impl;
|
||||
|
||||
/**
|
||||
* send a signal to a process
|
||||
* @param pid of the process to which the signal is send
|
||||
* @param signalNumber
|
||||
*/
|
||||
auto sendSignal(pid_t pid, int signalNumber) -> void;
|
||||
|
||||
/**
|
||||
* calls the callback if a signal is received
|
||||
* @param signalNumber
|
||||
*/
|
||||
auto onSignal(int signalNumber, void(*callback)(int)) -> void;
|
||||
|
||||
|
||||
auto getInterrupTable() -> InterruptEntry *;
|
||||
|
||||
auto getRegisters() -> Registers *;
|
||||
|
||||
auto getTextArea() -> char * ;
|
||||
|
||||
auto getPixelArea() -> char *;
|
||||
|
||||
|
||||
/**
|
||||
* set layout version.
|
||||
* @param newValue new layout version number.
|
||||
*/
|
||||
auto setLayoutVersion(LayoutVersion newValue) -> void;
|
||||
|
||||
/**
|
||||
* set characters per column for current font.
|
||||
* @param newValue characters per column.
|
||||
*/
|
||||
auto setCharactersPerColumn(int newValue) -> void;
|
||||
|
||||
/**
|
||||
* set characters per row for current font.
|
||||
* @param newValue
|
||||
*/
|
||||
auto setCharactersPerRow(int newValue) -> void;
|
||||
|
||||
/**
|
||||
* call a specific event.
|
||||
* @param type
|
||||
* @return true if there is a handler registered.
|
||||
*/
|
||||
auto callEvent(EventType type) -> bool;
|
||||
|
||||
/**
|
||||
* set mouse position to x,y value.
|
||||
* @param x x coordinate
|
||||
* @param y y coordinate
|
||||
*/
|
||||
auto setMousePosition(int x, int y) -> void;
|
||||
|
||||
/**
|
||||
* register pressed button.
|
||||
* @param keyCode pressed key.
|
||||
*/
|
||||
auto buttonPressed(KeyCode keyCode) -> void;
|
||||
|
||||
// Shared Memory Layout
|
||||
// --------------------------------------------------------------------
|
||||
// struct ControlRegisters
|
||||
// char reserved[1024]
|
||||
// Interrupt Vector Table [64]
|
||||
// text area [max_textMode_width * max_textMode_height]
|
||||
// pixel area [max_height_pixels * max_height_pixels * sizeof(uint_32)]
|
||||
|
||||
}
|
||||
|
||||
#endif
|
172
src/log.cpp
172
src/log.cpp
@ -4,109 +4,111 @@
|
||||
* @since 0.1.0
|
||||
*/
|
||||
|
||||
#include "log.h"
|
||||
#include "log.hpp"
|
||||
#include <iostream>
|
||||
|
||||
//converts the level to a string of the level
|
||||
auto getLevelName(LogLevel level){
|
||||
switch(level){
|
||||
case LogLevel::DEBUG:
|
||||
return "DEBUG";
|
||||
case LogLevel::INFO:
|
||||
return "INFO";
|
||||
case LogLevel::WARNING:
|
||||
return "WARNING";
|
||||
case LogLevel::ERROR:
|
||||
return "ERROR";
|
||||
case LogLevel::CRITICAL:
|
||||
return "CRITICAL";
|
||||
default:
|
||||
return "NON";
|
||||
namespace vkvm {
|
||||
//converts the level to a string of the level
|
||||
auto getLevelName(LogLevel level) -> std::string {
|
||||
switch(level){
|
||||
case LogLevel::DEBUG:
|
||||
return "DEBUG";
|
||||
case LogLevel::INFO:
|
||||
return "INFO";
|
||||
case LogLevel::WARNING:
|
||||
return "WARNING";
|
||||
case LogLevel::ERROR:
|
||||
return "ERROR";
|
||||
case LogLevel::CRITICAL:
|
||||
return "CRITICAL";
|
||||
default:
|
||||
return "NON";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//converts the level to a ansi color code
|
||||
auto getLevelColor(LogLevel level){
|
||||
switch(level){
|
||||
case LogLevel::DEBUG:
|
||||
return "0;37";
|
||||
case LogLevel::INFO:
|
||||
return "0";
|
||||
case LogLevel::WARNING:
|
||||
return "1;33";
|
||||
case LogLevel::ERROR:
|
||||
return "1;31";
|
||||
case LogLevel::CRITICAL:
|
||||
return "1;35";
|
||||
default:
|
||||
return "0";
|
||||
auto getLevelColor(LogLevel level) -> std::string {
|
||||
switch(level){
|
||||
case LogLevel::DEBUG:
|
||||
return "0;37";
|
||||
case LogLevel::INFO:
|
||||
return "0";
|
||||
case LogLevel::WARNING:
|
||||
return "1;33";
|
||||
case LogLevel::ERROR:
|
||||
return "1;31";
|
||||
case LogLevel::CRITICAL:
|
||||
return "1;35";
|
||||
default:
|
||||
return "0";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
LogLevel logLevel = LogLevel::INFO;
|
||||
LogLevel logLevel = LogLevel::INFO;
|
||||
|
||||
//log the current time
|
||||
void logTime(){
|
||||
time_t rawtime;
|
||||
time(&rawtime);
|
||||
struct tm *timeinfo;
|
||||
timeinfo = localtime(&rawtime);
|
||||
auto logTime() -> void {
|
||||
time_t rawtime;
|
||||
time(&rawtime);
|
||||
struct tm *timeinfo;
|
||||
timeinfo = localtime(&rawtime);
|
||||
|
||||
constexpr int decimalBase = 10;
|
||||
constexpr int decimalBase = 10;
|
||||
|
||||
if (timeinfo->tm_hour < decimalBase) {
|
||||
std::cout << "0";
|
||||
if (timeinfo->tm_hour < decimalBase) {
|
||||
std::cout << "0";
|
||||
}
|
||||
std::cout << timeinfo->tm_hour;
|
||||
std::cout << ":";
|
||||
if (timeinfo->tm_min < decimalBase) {
|
||||
std::cout << "0";
|
||||
}
|
||||
std::cout << timeinfo->tm_min;
|
||||
std::cout << ":";
|
||||
if (timeinfo->tm_sec < decimalBase) {
|
||||
std::cout << "0";
|
||||
}
|
||||
std::cout << timeinfo->tm_sec;
|
||||
}
|
||||
std::cout << timeinfo->tm_hour;
|
||||
std::cout << ":";
|
||||
if (timeinfo->tm_min < decimalBase) {
|
||||
std::cout << "0";
|
||||
}
|
||||
std::cout << timeinfo->tm_min;
|
||||
std::cout << ":";
|
||||
if (timeinfo->tm_sec < decimalBase) {
|
||||
std::cout << "0";
|
||||
}
|
||||
std::cout << timeinfo->tm_sec;
|
||||
}
|
||||
|
||||
//log the message
|
||||
void log(LogLevel level, const std::string &msg) {
|
||||
if(level >= logLevel) {
|
||||
std::string levelName = getLevelName(level);
|
||||
const int maxLevelNameLength = 8;
|
||||
auto log(LogLevel level, const std::string &msg) -> void {
|
||||
if(level >= logLevel) {
|
||||
std::string levelName = getLevelName(level);
|
||||
const int maxLevelNameLength = 8;
|
||||
|
||||
//time
|
||||
std::cout << "[";
|
||||
logTime();
|
||||
std::cout << "] ";
|
||||
//time
|
||||
std::cout << "[";
|
||||
logTime();
|
||||
std::cout << "] ";
|
||||
|
||||
//color and level name;lo
|
||||
std::cout << "[";
|
||||
std::cout << "\033[" << getLevelColor(level) << "m" << levelName << "\033[0m";
|
||||
std::cout << "] ";
|
||||
for (int i = levelName.size(); i < maxLevelNameLength; i++) {
|
||||
std::cout << " ";
|
||||
}
|
||||
|
||||
//message
|
||||
for(char c : msg){
|
||||
if(c == '\n'){
|
||||
//intend newlines so that they align with the start of the message
|
||||
std::cout << "\n";
|
||||
const int paddingSize = 22;
|
||||
for(int i = 0; i < paddingSize;i++){
|
||||
std::cout << " ";
|
||||
}
|
||||
}else{
|
||||
std::cout << c;
|
||||
//color and level name;lo
|
||||
std::cout << "[";
|
||||
std::cout << "\033[" << getLevelColor(level) << "m" << levelName << "\033[0m";
|
||||
std::cout << "] ";
|
||||
for (int i = levelName.size(); i < maxLevelNameLength; i++) {
|
||||
std::cout << " ";
|
||||
}
|
||||
|
||||
//message
|
||||
for(char c : msg){
|
||||
if(c == '\n'){
|
||||
//intend newlines so that they align with the start of the message
|
||||
std::cout << "\n";
|
||||
const int paddingSize = 22;
|
||||
for(int i = 0; i < paddingSize;i++){
|
||||
std::cout << " ";
|
||||
}
|
||||
}else{
|
||||
std::cout << c;
|
||||
}
|
||||
}
|
||||
std::cout << "\n";
|
||||
}
|
||||
std::cout << "\n";
|
||||
}
|
||||
}
|
||||
|
||||
void setLogLevel(LogLevel level) {
|
||||
logLevel = level;
|
||||
}
|
||||
auto setLogLevel(LogLevel level) -> void {
|
||||
logLevel = level;
|
||||
}
|
||||
|
||||
}
|
||||
|
50
src/log.h
50
src/log.h
@ -1,50 +0,0 @@
|
||||
#ifndef LIBRARY_LOG_H
|
||||
#define LIBRARY_LOG_H
|
||||
|
||||
#include <string>
|
||||
#include <sstream>
|
||||
|
||||
enum LogLevel{
|
||||
DEBUG = 1,
|
||||
INFO = 2,
|
||||
WARNING = 3,
|
||||
ERROR = 4,
|
||||
CRITICAL = 5,
|
||||
OFF = 6
|
||||
};
|
||||
|
||||
/**
|
||||
* log the messgae with logLevel and timestamp
|
||||
* @author Julian Hinxlage
|
||||
* @since 0.1.0
|
||||
*/
|
||||
void log(LogLevel level, const std::string &msg);
|
||||
|
||||
|
||||
template<typename T>
|
||||
static void buildString(std::stringstream &stream, T t) {
|
||||
stream << t;
|
||||
}
|
||||
|
||||
template<typename T, typename... Ts>
|
||||
static void buildString(std::stringstream &stream, T t, Ts... ts) {
|
||||
stream << t;
|
||||
buildString(stream, ts...);
|
||||
}
|
||||
|
||||
template<typename... T>
|
||||
static void log(LogLevel level, T... t){
|
||||
std::stringstream stream;
|
||||
buildString(stream, t...);
|
||||
log(level, stream.str());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* set the logLevel, the log function will use this to determine if the message is logged
|
||||
* @author Julian Hinxlage
|
||||
* @since 0.1.0
|
||||
*/
|
||||
void setLogLevel(LogLevel level);
|
||||
|
||||
#endif //LIBRARY_LOG_H
|
52
src/log.hpp
Normal file
52
src/log.hpp
Normal file
@ -0,0 +1,52 @@
|
||||
#ifndef LIBRARY_LOG_HPP
|
||||
#define LIBRARY_LOG_HPP
|
||||
|
||||
#include <string>
|
||||
#include <sstream>
|
||||
|
||||
namespace vkvm {
|
||||
enum LogLevel{
|
||||
DEBUG = 1,
|
||||
INFO = 2,
|
||||
WARNING = 3,
|
||||
ERROR = 4,
|
||||
CRITICAL = 5,
|
||||
OFF = 6
|
||||
};
|
||||
|
||||
/**
|
||||
* log the messgae with logLevel and timestamp
|
||||
* @author Julian Hinxlage
|
||||
* @since 0.1.0
|
||||
*/
|
||||
auto log(LogLevel level, const std::string &msg) -> void;
|
||||
|
||||
|
||||
template<typename T>
|
||||
static auto buildString(std::stringstream &stream, T t) -> void {
|
||||
stream << t;
|
||||
}
|
||||
|
||||
template<typename T, typename... Ts>
|
||||
static auto buildString(std::stringstream &stream, T t, Ts... ts) -> void {
|
||||
stream << t;
|
||||
buildString(stream, ts...);
|
||||
}
|
||||
|
||||
template<typename... T>
|
||||
static auto log(LogLevel level, T... t) -> void {
|
||||
std::stringstream stream;
|
||||
buildString(stream, t...);
|
||||
log(level, stream.str());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* set the logLevel, the log function will use this to determine if the message is logged
|
||||
* @author Julian Hinxlage
|
||||
* @since 0.1.0
|
||||
*/
|
||||
auto setLogLevel(LogLevel level) -> void;
|
||||
}
|
||||
|
||||
#endif
|
321
src/vkvm.cpp
321
src/vkvm.cpp
@ -1,196 +1,199 @@
|
||||
#include "SharedMemoryAccess.h"
|
||||
#include "internal.h"
|
||||
#include "vkvm.h"
|
||||
#include "SharedMemoryAccess.hpp"
|
||||
#include "internal.hpp"
|
||||
#include "vkvm.hpp"
|
||||
|
||||
#include <csignal>
|
||||
#include <unistd.h>
|
||||
|
||||
// NOLINT
|
||||
void initialize(int pid) {
|
||||
impl.sharedMemoryPid = pid;
|
||||
impl.sharedMemoryKey = 12345;// NOLINT
|
||||
impl.sharedMemorySize = 8000;// NOLINT
|
||||
initSemaphore();
|
||||
setDefaultValues();
|
||||
}
|
||||
|
||||
void setDefaultValues(){
|
||||
if(getSharedMemory() != nullptr) {
|
||||
//set default values
|
||||
setCharactersPerRow(60);// NOLINT
|
||||
setCharactersPerColumn(20);// NOLINT
|
||||
setHeight(600);// NOLINT
|
||||
setWidth(800);// NOLINT
|
||||
setMousePosition(42, 42);// NOLINT
|
||||
setBackgroundColor(Color(200, 50, 20));// NOLINT
|
||||
setForegroundColor(Color(20, 200, 50));// NOLINT
|
||||
setMode(GraphicMode::TrueColor);// NOLINT
|
||||
setRedrawInterval(20);// NOLINT
|
||||
setTimerInterruptInterval(10);// NOLINT
|
||||
namespace vkvm {
|
||||
// NOLINT
|
||||
auto initialize(int pid) -> void {
|
||||
impl.sharedMemoryPid = pid;
|
||||
impl.sharedMemoryKey = 12345;// NOLINT
|
||||
impl.sharedMemorySize = 8000;// NOLINT
|
||||
initSemaphore();
|
||||
setDefaultValues();
|
||||
}
|
||||
}
|
||||
|
||||
bool registerEvent(EventType type, const std::function<void()> &handler) {
|
||||
int signum = SIGUSR1 + impl.eventTable.size();
|
||||
auto ivt = getInterrupTable();
|
||||
auto setDefaultValues() -> void {
|
||||
if(getSharedMemory() != nullptr) {
|
||||
//set default values
|
||||
setCharactersPerRow(60);// NOLINT
|
||||
setCharactersPerColumn(20);// NOLINT
|
||||
setHeight(600);// NOLINT
|
||||
setWidth(800);// NOLINT
|
||||
setMousePosition(42, 42);// NOLINT
|
||||
setBackgroundColor(Color(200, 50, 20));// NOLINT
|
||||
setForegroundColor(Color(20, 200, 50));// NOLINT
|
||||
setMode(GraphicMode::TrueColor);// NOLINT
|
||||
setRedrawInterval(20);// NOLINT
|
||||
setTimerInterruptInterval(10);// NOLINT
|
||||
}
|
||||
}
|
||||
|
||||
lockSharedMemory();
|
||||
auto registerEvent(EventType type, const std::function<void()> &handler) -> bool {
|
||||
int signum = SIGUSR1 + impl.eventTable.size();
|
||||
auto ivt = getInterrupTable();
|
||||
|
||||
ivt[type].pid = getpid();
|
||||
ivt[type].signum = signum;
|
||||
impl.eventTable.push_back(handler);
|
||||
lockSharedMemory();
|
||||
|
||||
onSignal(signum, [](int sig){
|
||||
if(sig >= SIGUSR1){
|
||||
if((sig - SIGUSR1) < impl.eventTable.size()){
|
||||
impl.eventTable[sig - SIGUSR1]();
|
||||
ivt[type].pid = getpid();
|
||||
ivt[type].signum = signum;
|
||||
impl.eventTable.push_back(handler);
|
||||
|
||||
onSignal(signum, [](int sig){
|
||||
if(sig >= SIGUSR1){
|
||||
if((sig - SIGUSR1) < impl.eventTable.size()){
|
||||
impl.eventTable[sig - SIGUSR1]();
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
unlockSharedMemory();
|
||||
unlockSharedMemory();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool setPixel(int x, int y, Color color) {
|
||||
char *ptr = getPixelArea() + (y * getWidth() + x) * 3;
|
||||
ptr[0] = color.getRed();
|
||||
ptr[1] = color.getGreen();
|
||||
ptr[2] = color.getBlue();
|
||||
return false;
|
||||
}
|
||||
|
||||
Color getPixel(int x, int y) {
|
||||
//TODO(julian): other than RGB colores
|
||||
//only RGB colores for now
|
||||
unsigned char *ptr = reinterpret_cast<unsigned char *>(getPixelArea()) + (y * getWidth() + x) * 3;
|
||||
return {ptr[0], ptr[1], ptr[2]};
|
||||
}
|
||||
|
||||
bool setText(std::string text) {
|
||||
lockSharedMemory();
|
||||
char *ptr = getTextArea();
|
||||
for(int i = 0; i < static_cast<int>(text.size());i++){
|
||||
if(i >= getCharactersPerColumn() * getCharactersPerRow()){
|
||||
break;
|
||||
}
|
||||
ptr[i] = text[i];
|
||||
return true;
|
||||
}
|
||||
if(text.size() < getCharactersPerColumn() * getCharactersPerRow()){
|
||||
ptr[text.size()] = '\0';
|
||||
|
||||
auto setPixel(int x, int y, Color color) -> bool {
|
||||
char *ptr = getPixelArea() + (y * getWidth() + x) * 3;
|
||||
ptr[0] = color.getRed();
|
||||
ptr[1] = color.getGreen();
|
||||
ptr[2] = color.getBlue();
|
||||
return false;
|
||||
}
|
||||
unlockSharedMemory();
|
||||
return true;
|
||||
}
|
||||
|
||||
std::string getText() {
|
||||
return std::string (getTextArea());
|
||||
}
|
||||
auto getPixel(int x, int y) -> Color {
|
||||
//TODO(julian): other than RGB colores
|
||||
//only RGB colores for now
|
||||
unsigned char *ptr = reinterpret_cast<unsigned char *>(getPixelArea()) + (y * getWidth() + x) * 3;
|
||||
return {ptr[0], ptr[1], ptr[2]};
|
||||
}
|
||||
|
||||
LayoutVersion getLayoutVersion() {
|
||||
return static_cast<LayoutVersion>(getRegisters()->layout_version);
|
||||
}
|
||||
auto setText(std::string text) -> bool {
|
||||
lockSharedMemory();
|
||||
char *ptr = getTextArea();
|
||||
for(int i = 0; i < static_cast<int>(text.size());i++){
|
||||
if(i >= getCharactersPerColumn() * getCharactersPerRow()){
|
||||
break;
|
||||
}
|
||||
ptr[i] = text[i];
|
||||
}
|
||||
if(text.size() < getCharactersPerColumn() * getCharactersPerRow()){
|
||||
ptr[text.size()] = '\0';
|
||||
}
|
||||
unlockSharedMemory();
|
||||
return true;
|
||||
}
|
||||
|
||||
void reset() {
|
||||
//TODO(julian): reset
|
||||
}
|
||||
auto getText() -> std::string {
|
||||
return std::string (getTextArea());
|
||||
}
|
||||
|
||||
int getWidth() {
|
||||
return getRegisters()->width_pixels;
|
||||
}
|
||||
auto getLayoutVersion() -> LayoutVersion {
|
||||
return static_cast<LayoutVersion>(getRegisters()->layout_version);
|
||||
}
|
||||
|
||||
void setWidth(int newValue) {
|
||||
lockSharedMemory();
|
||||
getRegisters()->width_pixels = newValue;
|
||||
unlockSharedMemory();
|
||||
}
|
||||
auto reset() -> void {
|
||||
//TODO(julian): reset
|
||||
}
|
||||
|
||||
int getHeight() {
|
||||
return getRegisters()->height_pixels;
|
||||
}
|
||||
auto getWidth() -> int {
|
||||
return getRegisters()->width_pixels;
|
||||
}
|
||||
|
||||
void setHeight(int newValue) {
|
||||
lockSharedMemory();
|
||||
getRegisters()->height_pixels = newValue;
|
||||
unlockSharedMemory();
|
||||
}
|
||||
auto setWidth(int newValue) -> void {
|
||||
lockSharedMemory();
|
||||
getRegisters()->width_pixels = newValue;
|
||||
unlockSharedMemory();
|
||||
}
|
||||
|
||||
GraphicMode getMode() {
|
||||
return getRegisters()->graphicMode;
|
||||
}
|
||||
auto getHeight() -> int {
|
||||
return getRegisters()->height_pixels;
|
||||
}
|
||||
|
||||
void setMode(GraphicMode newValue) {
|
||||
lockSharedMemory();
|
||||
getRegisters()->graphicMode = newValue;
|
||||
unlockSharedMemory();
|
||||
}
|
||||
auto setHeight(int newValue) -> void {
|
||||
lockSharedMemory();
|
||||
getRegisters()->height_pixels = newValue;
|
||||
unlockSharedMemory();
|
||||
}
|
||||
|
||||
int getRedrawInterval() {
|
||||
return getRegisters()->autoRedrawInterval;
|
||||
}
|
||||
auto getMode() -> GraphicMode {
|
||||
return getRegisters()->graphicMode;
|
||||
}
|
||||
|
||||
void setRedrawInterval(int newValue) {
|
||||
lockSharedMemory();
|
||||
getRegisters()->autoRedrawInterval = newValue;
|
||||
unlockSharedMemory();
|
||||
}
|
||||
auto setMode(GraphicMode newValue) -> void {
|
||||
lockSharedMemory();
|
||||
getRegisters()->graphicMode = newValue;
|
||||
unlockSharedMemory();
|
||||
}
|
||||
|
||||
int getTimerInterruptInterval() {
|
||||
return getRegisters()->timerInterruptInterval;
|
||||
}
|
||||
auto getRedrawInterval() -> int {
|
||||
return getRegisters()->autoRedrawInterval;
|
||||
}
|
||||
|
||||
void setTimerInterruptInterval(int newValue) {
|
||||
lockSharedMemory();
|
||||
getRegisters()->timerInterruptInterval = newValue;
|
||||
unlockSharedMemory();
|
||||
}
|
||||
auto setRedrawInterval(int newValue) -> void {
|
||||
lockSharedMemory();
|
||||
getRegisters()->autoRedrawInterval = newValue;
|
||||
unlockSharedMemory();
|
||||
}
|
||||
|
||||
Color getBackgroundColor() {
|
||||
return getRegisters()->background_color;
|
||||
}
|
||||
auto getTimerInterruptInterval() -> int {
|
||||
return getRegisters()->timerInterruptInterval;
|
||||
}
|
||||
|
||||
void setBackgroundColor(Color newValue) {
|
||||
lockSharedMemory();
|
||||
getRegisters()->background_color = newValue;
|
||||
unlockSharedMemory();
|
||||
}
|
||||
auto setTimerInterruptInterval(int newValue) -> void {
|
||||
lockSharedMemory();
|
||||
getRegisters()->timerInterruptInterval = newValue;
|
||||
unlockSharedMemory();
|
||||
}
|
||||
|
||||
Color getForegroundColor() {
|
||||
return getRegisters()->foreground_color;
|
||||
}
|
||||
auto getBackgroundColor() -> Color {
|
||||
return getRegisters()->background_color;
|
||||
}
|
||||
|
||||
void setForegroundColor(Color newValue) {
|
||||
lockSharedMemory();
|
||||
getRegisters()->foreground_color = newValue;
|
||||
unlockSharedMemory();
|
||||
}
|
||||
auto setBackgroundColor(Color newValue) -> void {
|
||||
lockSharedMemory();
|
||||
getRegisters()->background_color = newValue;
|
||||
unlockSharedMemory();
|
||||
}
|
||||
|
||||
int getCharactersPerRow() {
|
||||
return getRegisters()->characters_per_row;
|
||||
}
|
||||
auto getForegroundColor() -> Color {
|
||||
return getRegisters()->foreground_color;
|
||||
}
|
||||
|
||||
int getCharactersPerColumn() {
|
||||
return getRegisters()->characters_per_column;
|
||||
}
|
||||
auto setForegroundColor(Color newValue) -> void {
|
||||
lockSharedMemory();
|
||||
getRegisters()->foreground_color = newValue;
|
||||
unlockSharedMemory();
|
||||
}
|
||||
|
||||
FontType getFont() {
|
||||
//TODO(julian): get font properly
|
||||
return font_1;
|
||||
}
|
||||
auto getCharactersPerRow() -> int {
|
||||
return getRegisters()->characters_per_row;
|
||||
}
|
||||
|
||||
void setFont(const FontType &newValue) {
|
||||
//TODO(julian): setFont properly
|
||||
lockSharedMemory();
|
||||
getRegisters()->textMode_font = newValue.getId();
|
||||
unlockSharedMemory();
|
||||
}
|
||||
auto getCharactersPerColumn() -> int {
|
||||
return getRegisters()->characters_per_column;
|
||||
}
|
||||
|
||||
std::pair<int, int> getMousePosition() {
|
||||
return {getRegisters()->mouse_pos_x, getRegisters()->mouse_pos_y};
|
||||
}
|
||||
auto getFont() -> FontType {
|
||||
//TODO(julian): get font properly
|
||||
return font_1;
|
||||
}
|
||||
|
||||
KeyCode getLastPressedKey() {
|
||||
//TODO(julian): get key properly
|
||||
return KeyCode(0);
|
||||
}
|
||||
auto setFont(const FontType &newValue) -> void {
|
||||
//TODO(julian): setFont properly
|
||||
lockSharedMemory();
|
||||
getRegisters()->textMode_font = newValue.getId();
|
||||
unlockSharedMemory();
|
||||
}
|
||||
|
||||
auto getMousePosition() -> Coordinates {
|
||||
return {getRegisters()->mouse_pos_x, getRegisters()->mouse_pos_y};
|
||||
}
|
||||
|
||||
auto getLastPressedKey() -> KeyCode {
|
||||
//TODO(julian): get key properly
|
||||
return KeyCode(0);
|
||||
}
|
||||
|
||||
}
|
@ -1,30 +1,34 @@
|
||||
#ifndef LIBRARY_VKVM_H
|
||||
#define LIBRARY_VKVM_H
|
||||
#ifndef LIBRARY_VKVM_HPP
|
||||
#define LIBRARY_VKVM_HPP
|
||||
|
||||
#include "Color.h"
|
||||
#include "EventType.h"
|
||||
#include "GraphicMode.h"
|
||||
#include "FontType.h"
|
||||
#include "KeyCode.h"
|
||||
#include "LayoutVersion.h"
|
||||
#include "log.h"
|
||||
#include "Color.hpp"
|
||||
#include "EventType.hpp"
|
||||
#include "GraphicMode.hpp"
|
||||
#include "FontType.hpp"
|
||||
#include "KeyCode.hpp"
|
||||
#include "LayoutVersion.hpp"
|
||||
#include "log.hpp"
|
||||
#include <functional>
|
||||
#include <string>
|
||||
|
||||
/**
|
||||
namespace vkvm {
|
||||
/**
|
||||
* @since 0.1.0
|
||||
* @author Johannes Theiner
|
||||
*/
|
||||
|
||||
//TODO: better documentation
|
||||
struct Coordinates {
|
||||
int x;
|
||||
int y;
|
||||
};
|
||||
|
||||
/**
|
||||
* initialize the connection with the shared-memory application
|
||||
* @param pid pip of shared-memory application
|
||||
*/
|
||||
void initialize(int pid);
|
||||
auto initialize(int pid) -> void;
|
||||
|
||||
void setDefaultValues();
|
||||
auto setDefaultValues() -> void;
|
||||
|
||||
/**
|
||||
* set pixel at a x,y position to a certain color.
|
||||
@ -33,7 +37,7 @@ void setDefaultValues();
|
||||
* @param color color of pixel
|
||||
* @return true if operation succeeded, false if it failed.
|
||||
*/
|
||||
bool setPixel(int x, int y, Color color);
|
||||
auto setPixel(int x, int y, Color color) -> bool;
|
||||
|
||||
/**
|
||||
* get color of pixel at x,y position
|
||||
@ -41,7 +45,7 @@ bool setPixel(int x, int y, Color color);
|
||||
* @param y y coordinate of pixel
|
||||
* @return color of pixel
|
||||
*/
|
||||
Color getPixel(int x, int y);
|
||||
auto getPixel(int x, int y) -> Color;
|
||||
|
||||
/**
|
||||
* register handler for event.
|
||||
@ -49,19 +53,19 @@ Color getPixel(int x, int y);
|
||||
* @param handler function to call.
|
||||
* @return true if handler could be registered, false if it failed.
|
||||
*/
|
||||
bool registerEvent(EventType type, const std::function<void()> &handler);
|
||||
auto registerEvent(EventType type, const std::function<void()> &handler) -> bool;
|
||||
|
||||
/**
|
||||
* set displayed text in Text mode
|
||||
* @param text text to display
|
||||
* @return if text could be set, false if it could not be set.
|
||||
*/
|
||||
bool setText(std::string text);
|
||||
auto setText(std::string text) -> bool;
|
||||
|
||||
/**
|
||||
* get currently saved/displayed text.
|
||||
*/
|
||||
std::string getText();
|
||||
auto getText() -> std::string;
|
||||
|
||||
//Control registers start here
|
||||
|
||||
@ -71,71 +75,71 @@ std::string getText();
|
||||
* get version of the used layout
|
||||
* @return layout version
|
||||
*/
|
||||
LayoutVersion getLayoutVersion();
|
||||
auto getLayoutVersion() -> LayoutVersion;
|
||||
|
||||
/**
|
||||
* reset all values to default.
|
||||
*/
|
||||
void reset();
|
||||
auto reset() -> void;
|
||||
|
||||
/**
|
||||
* get width of window.
|
||||
* @return width of window.
|
||||
*/
|
||||
int getWidth();
|
||||
auto getWidth() -> int;
|
||||
|
||||
/**
|
||||
* set width of window.
|
||||
* @param newValue new width for window.
|
||||
*/
|
||||
void setWidth(int newValue);
|
||||
auto setWidth(int newValue) -> void;
|
||||
|
||||
/**
|
||||
* get height for window.
|
||||
* @return height of window.
|
||||
*/
|
||||
int getHeight();
|
||||
auto getHeight() -> int;
|
||||
|
||||
/**
|
||||
* set height of window.
|
||||
* @param newValue new height for window.
|
||||
*/
|
||||
void setHeight(int newValue);
|
||||
auto setHeight(int newValue) -> void;
|
||||
|
||||
/**
|
||||
* get graphics display mode.
|
||||
* @return GraphicMode.
|
||||
*/
|
||||
GraphicMode getMode();
|
||||
auto getMode() -> GraphicMode;
|
||||
|
||||
/**
|
||||
* set new graphics display mode.
|
||||
* @param newValue new graphics display mode.
|
||||
*/
|
||||
void setMode(GraphicMode newValue);
|
||||
auto setMode(GraphicMode newValue) -> void;
|
||||
|
||||
/**
|
||||
* get interval between redraws in milliseconds.
|
||||
*/
|
||||
int getRedrawInterval();
|
||||
auto getRedrawInterval() -> int;
|
||||
|
||||
/**
|
||||
* set interval between redraws.
|
||||
* @param newValue new interval in milliseconds.
|
||||
*/
|
||||
void setRedrawInterval(int newValue);
|
||||
auto setRedrawInterval(int newValue) -> void;
|
||||
|
||||
/**
|
||||
* get time between timer interrupts.
|
||||
* @return time between interrupts in milliseconds.
|
||||
*/
|
||||
int getTimerInterruptInterval();
|
||||
auto getTimerInterruptInterval() -> int;
|
||||
|
||||
/**
|
||||
* set time between timer interrupts.
|
||||
* @param newValue new time between interrupts in milliseconds.
|
||||
*/
|
||||
void setTimerInterruptInterval(int newValue);
|
||||
auto setTimerInterruptInterval(int newValue) -> void;
|
||||
|
||||
//black/white mode
|
||||
|
||||
@ -143,25 +147,25 @@ void setTimerInterruptInterval(int newValue);
|
||||
* get background color in two color mode.
|
||||
* @return background color.
|
||||
*/
|
||||
Color getBackgroundColor();
|
||||
auto getBackgroundColor() -> Color;
|
||||
|
||||
/**
|
||||
* set background color in two color mode.
|
||||
* @param newValue new background color.
|
||||
*/
|
||||
void setBackgroundColor(Color newValue);
|
||||
auto setBackgroundColor(Color newValue) -> void;
|
||||
|
||||
/**
|
||||
* get foreground color in two color mode.
|
||||
* @return foreground color.
|
||||
*/
|
||||
Color getForegroundColor();
|
||||
auto getForegroundColor() -> Color;
|
||||
|
||||
/**
|
||||
* set foreground color in two color mode.
|
||||
* @param newValue new foreground color.
|
||||
*/
|
||||
void setForegroundColor(Color newValue);
|
||||
auto setForegroundColor(Color newValue) -> void;
|
||||
|
||||
//text mode
|
||||
|
||||
@ -169,36 +173,37 @@ void setForegroundColor(Color newValue);
|
||||
* get characters per row in text mode.
|
||||
* @return characters per row.
|
||||
*/
|
||||
int getCharactersPerRow();
|
||||
auto getCharactersPerRow() -> int;
|
||||
|
||||
/**
|
||||
* get characters per column in text mode.
|
||||
* @return characters per column.
|
||||
*/
|
||||
int getCharactersPerColumn();
|
||||
auto getCharactersPerColumn() -> int;
|
||||
|
||||
/**
|
||||
* get currently used font in text mode.
|
||||
* @return currently used font.
|
||||
*/
|
||||
FontType getFont();
|
||||
auto getFont() -> FontType;
|
||||
|
||||
/**
|
||||
* set text mode font.
|
||||
* @param newValue new text mode font.
|
||||
*/
|
||||
void setFont(const FontType &newValue);
|
||||
auto setFont(const FontType &newValue) -> void;
|
||||
|
||||
/**
|
||||
* get current mouse position
|
||||
* @return mouse position as x,y pair
|
||||
*/
|
||||
std::pair<int, int> getMousePosition();
|
||||
auto getMousePosition() -> Coordinates;
|
||||
|
||||
/**
|
||||
* get key code of last key press.
|
||||
* @return KeyCode of last key press.
|
||||
*/
|
||||
KeyCode getLastPressedKey();
|
||||
auto getLastPressedKey() -> KeyCode;
|
||||
}
|
||||
|
||||
#endif
|
@ -1,10 +1,10 @@
|
||||
#include "catch2/catch.hpp"
|
||||
#include "../src/vkvm.h"
|
||||
#include "../src/vkvm.hpp"
|
||||
|
||||
TEST_CASE("add works") {
|
||||
initialize(0);
|
||||
setText("Hello World");
|
||||
vkvm::initialize(0);
|
||||
vkvm::setText("Hello World");
|
||||
SECTION("equals") {
|
||||
REQUIRE(getText() == "Hello World");
|
||||
REQUIRE(vkvm::getText() == "Hello World");
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user