|
#ifndef _LIGHTSSTRING_H
#define _LIGHTSSTRING_H
// forward reference some classes I need pointers to
class LinkedList;
class LinkedListVar;
class Loop;
class Processor;
#include "GEColorEffectsBulb.h"
#include "Processor.h"
#include "LinkedList.h"
#include "LinkedListVar.h"
#include "ShortStack.h"
// A string of lights
class LightsString
{
private:
byte _stringlen;
void* _bulbs; // a representation of each bulb
Bulb* _allbulbs; // a representation of the broadcast bulb
LinkedList* _executing; // list of instructions currently executing
LinkedList* _loops; // list of current active loops
LinkedListVar* _vars; // list of variables
ShortStack* _returnstack;
#ifdef PC
byte _string;
#endif
#if defined(PC) || defined(RASPBERRY)
Processor* _processor;
short* _program; // our program
short* _subroutinestable; // our subroutines
#else
prog_int16_t* _program; // our program
prog_int16_t* _subroutinestable; // our subroutines
#endif
short _ip; // where we are up to in our program
Instruction* GetNextInstruction(); // get the next instruction
#if defined(PC) || defined(RASPBERRY)
short GetData(short* table, short offset);
#else
short GetData(prog_int16_t* table, short offset);
#endif
public:
#if defined(PC) || defined(RASPBERRY)
LightsString(Processor* p) {_processor = p;};
void Break();
void Construct(const byte string, short* program, byte stringlen, short* subroutines);
#else
void Construct(const byte string, prog_int16_t* program, prog_int8_t* stringlen, prog_int16_t* subroutines);
#endif
void SetAllColour(short colour);
LinkedList* Executing();
Bulb* GetBulb(byte address);
byte BulbCount() { return _stringlen; };
void Execute();
void LoadInstructions();
bool AllDone();
void AddLoop(Loop* loop);
inline bool IsValid() { return (_executing != NULL); };
void SetInvalid();
void AdjustIP(short howmuch);
void LoopDone(short id);
Loop* GetLoop(short id);
short GetVar(short var);
void SetVar(short var, short val);
};
#endif // _LIGHTSSTRING_H
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.