42 lines
659 B
C++
42 lines
659 B
C++
// hpglparser.h
|
|
|
|
#ifndef _HPGLPARSER_h
|
|
#define _HPGLPARSER_h
|
|
|
|
#include "point.h"
|
|
#include "plotter.h"
|
|
|
|
#define PA_M 1
|
|
#define PR_M 2
|
|
#define SKIP_M 3
|
|
#define ERROR_M 4
|
|
|
|
class HpglParser
|
|
{
|
|
private:
|
|
Plotter* _plotter;
|
|
char buffer[64];
|
|
int bufferIndex = 0;
|
|
|
|
uint8_t cmdMode = 0;
|
|
uint8_t searchMode = 0;
|
|
|
|
bool xSet = false;
|
|
Point _nextPoint;
|
|
|
|
bool isWhitespace(const char ch);
|
|
bool isSeparator(char ch);
|
|
|
|
void findCommand();
|
|
void findCoordinats();
|
|
|
|
public:
|
|
HpglParser(Plotter* plotter);
|
|
~HpglParser(){}
|
|
|
|
int add(const char ch);
|
|
};
|
|
|
|
#endif
|
|
|