nsbaci 1.0
Loading...
Searching...
No Matches
nsbaciInterpreter.h
Go to the documentation of this file.
1
12
13#ifndef NSBACI_SERVICES_RUNTIME_NSBACI_INTERPRETER_H
14#define NSBACI_SERVICES_RUNTIME_NSBACI_INTERPRETER_H
15
16#include "interpreter.h"
17
23
31class NsbaciInterpreter final : public Interpreter {
32 public:
33 NsbaciInterpreter() = default;
34 ~NsbaciInterpreter() override = default;
35
44
45 void provideInput(const std::string& input) override;
46 bool isWaitingForInput() const override;
47 void setOutputCallback(OutputCallback callback) override;
48 void setDrawingCallback(DrawingCallback callback) override;
49 void reset() override;
50
51 private:
52 OutputCallback outputCallback;
53 DrawingCallback drawingCallback;
54 bool waitingForInput = false;
55 std::string pendingInput;
56 bool hasInput = false;
57
58 // Drawing state
59 uint8_t currentR = 0, currentG = 0, currentB = 0, currentA = 255;
60 int32_t currentLineWidth = 1;
61};
62
63} // namespace nsbaci::services::runtime
64
65#endif // NSBACI_SERVICES_RUNTIME_NSBACI_INTERPRETER_H
InterpreterResult executeInstruction(Thread &t, Program &program) override
Executes the current instruction for the given thread with the program context.
Definition nsbaciInterpreter.cpp:16
void reset() override
Reset interpreter state for a new run.
Definition nsbaciInterpreter.cpp:764
void setDrawingCallback(DrawingCallback callback) override
Set the drawing callback for drawing operations.
Definition nsbaciInterpreter.cpp:760
void setOutputCallback(OutputCallback callback) override
Set the output callback for print operations.
Definition nsbaciInterpreter.cpp:756
void provideInput(const std::string &input) override
Provide input to a thread waiting for input.
Definition nsbaciInterpreter.cpp:749
bool isWaitingForInput() const override
Check if interpreter is waiting for input.
Definition nsbaciInterpreter.cpp:754
Represents a compiled program ready for execution.
Definition program.h:54
Represents a thread in the runtime service.
Definition thread.h:31
Interpreter class declaration for nsbaci runtime service.
Runtime services namespace for nsbaci.
std::function< void(const std::string &)> OutputCallback
Callback type for output operations.
Definition interpreter.h:62
std::function< void(const nsbaci::types::DrawCommand &)> DrawingCallback
Callback type for drawing operations.
Definition interpreter.h:68
Definition interpreter.h:25