nsbaci 1.0
Loading...
Searching...
No Matches
nsbaci::types Namespace Reference

Type definitions namespace for nsbaci (runtime-specific). More...

Classes

struct  SymbolInfo
 Information about a variable/symbol. More...
struct  Color
 RGB color representation with values from 0-255. More...
struct  Point
 2D point/position representation. More...
struct  Size
 2D size representation. More...
struct  Circle
 Circle shape with center and radius. More...
struct  Rectangle
 Rectangle shape with position and size. More...
struct  Triangle
 Triangle shape defined by three vertices. More...
struct  Line
 Line segment from start to end point. More...
struct  Ellipse
 Ellipse shape with center and radii. More...
struct  Pixel
 Single pixel at a position. More...
struct  DrawText
struct  Drawable
 Complete drawable object with shape, color, and visibility. More...
struct  DrawCommand
 Represents a single drawing command to be executed. More...
struct  CanvasConfig
 Configuration for the drawing canvas. More...
struct  ErrorBase
 Base structure containing common error properties. More...
struct  CompileError
 Error payload for compilation errors. More...
struct  SaveError
 Error payload for file save errors. More...
struct  LoadError
 Error payload for file load errors. More...
struct  RuntimeError
 Error payload for runtime errors. More...

Typedefs

using StackValue = int32_t
 Stack value type (can hold int or address).
using Stack = std::vector<StackValue>
 Runtime stack.
using Memory = std::vector<int32_t>
 Memory block for runtime data.
using SemaphoreTable
 Maps memory addresses to semaphores.
using ThreadQueue = std::queue<nsbaci::services::runtime::Thread>
 Queue of threads for scheduler operations.
using VarName = std::string
 Type alias for variable names.
using MemoryAddr = uint32_t
 Type alias for memory addresses.
using SymbolTable = std::unordered_map<VarName, SymbolInfo>
 Lookup table mapping variable names to their symbol info.
using Shape = std::variant<Circle, Rectangle, Triangle, Line, Ellipse, Pixel, DrawText>
 Variant type for all drawable shapes.
using ErrMessage = std::string
using ErrorPayload
 Variant type for all possible error payloads.
using Text = std::string
 Alias for text content (file contents, source code, etc.).
using File = fs::path
 Alias for file system paths.
using ThreadID = unsigned long long int
using Priority = unsigned long int

Enumerations

enum class  DrawCommandType {
  Clear , SetColor , SetPosition , DrawShape ,
  Fill , SetLineWidth , Refresh
}
 Types of drawing commands that can be executed.
enum class  StandardPosition {
  TopLeft , TopCenter , TopRight , CenterLeft ,
  Center , CenterRight , BottomLeft , BottomCenter ,
  BottomRight
}
enum class  ErrSeverity { Warning , Error , Fatal }
 Severity levels for errors.
enum class  ErrType {
  emptyPath , invalidPath , invalidExtension , directoryNotFound ,
  fileNotFound , notARegularFile , permissionDenied , openFailed ,
  readFailed , writeFailed , compilationError , unknown
}
 Types of errors that can occur in the application.
enum class  ThreadState {
  Ready , Running , Blocked , Waiting ,
  IO , Terminated
}

Functions

Point resolvePosition (StandardPosition pos, Size canvasSize)
 Resolve a standard position to actual coordinates.

Detailed Description

Type definitions namespace for nsbaci (runtime-specific).

Type definitions namespace for nsbaci.

Typedef Documentation

◆ ErrorPayload

Initial value:
std::variant<SaveError, LoadError, CompileError, RuntimeError>

Variant type for all possible error payloads.

Can be used to create a more specific error message in the controller, for example when an error is of type compileError, the controller can specify the line, col, what might have happened...

◆ SemaphoreTable

Initial value:
std::unordered_map<MemoryAddr, nsbaci::services::runtime::Semaphore>

Maps memory addresses to semaphores.

  • Compile time: Compiler emits StoreSemaphore instructions with addresses
  • Runtime: Executing StoreSemaphore adds entry to this table
  • Wait/Signal: Look up semaphore by address

Enumeration Type Documentation

◆ ThreadState

enum class nsbaci::types::ThreadState
strong
Enumerator
Ready 

Thread is ready to run.

Running 

Thread is currently executing.

Blocked 

Thread is blocked (e.g., waiting on semaphore).

Waiting 

Thread is waiting for I/O.

IO 

Thread is performing I/O.

Terminated 

Thread has finished execution.

Function Documentation

◆ resolvePosition()

Point nsbaci::types::resolvePosition ( StandardPosition pos,
Size canvasSize )
inline

Resolve a standard position to actual coordinates.

Parameters
posThe standard position enum value.
canvasSizeThe size of the canvas.
Returns
The resolved Point coordinates.