-
Notifications
You must be signed in to change notification settings - Fork 0
/
specfile.h
59 lines (48 loc) · 1.22 KB
/
specfile.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#ifndef _SPECFILE_H_
#define _SPECFILE_H_
#include <string>
#include "tinyxml.h"
#include "ruleset.h"
#include "labelset.h"
#include "macropatternset.h"
#include "scratchpad.h"
#include "langexporter.h"
class SpecFile
{
typedef struct
{
unsigned int size;
char* text;
unsigned int linenum;
} Line;
public:
SpecFile();
~SpecFile();
void Clear();
bool Load(const char* filepath);
void SaveDot(const char* filepath, bool reduced);
bool Export(const char* filepath);
private:
bool LoadMacroPatterns(TiXmlHandle spec);
bool LoadRules(TiXmlHandle spec);
bool LoadPattern(unsigned int label, const char* buf, unsigned int size);
bool ExpandMacro(PatternSet* patset, const char* macro, unsigned int macrosize);
bool ParseBitstring(const char* buf, unsigned int size, Pattern* pattern);
bool ExportTemplate(const char* filepath, LangExporter* exporter);
private:
std::string mLanguage;
std::string mFuncRoot;
std::string mFuncVarsDef;
std::string mFuncVarsCall;
std::string mFuncUndef;
std::string mFuncStub;
std::string mFuncTable;
std::string mFuncNullstub;
std::string mTemplate;
float mGamma;
MacroPatternSet mMacroPatterns;
LabelSet mLabels;
RuleSet mRules;
Scratchpad mScratchpad;
};
#endif // _SPECFILE_H_