blob: c80c2f093757a4812ae9236d27d1d97966492373 (
plain)
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
60
61
62
63
64
65
66
|
#include "resumeparser.h"
#include <string.h>
#include "luaresume.h"
#include "configuration.h"
std::string resume_parser(Macro ¯o, Commit &commit)
{
LUAResume luaresume(commit);
std::string code;
std::vector< Script >::iterator spi = macro.resume_scripts.begin();
while(spi != macro.resume_scripts.end()) {
if(spi->attributes.find("src") != spi->attributes.end()) {
std::string src = spi->attributes["src"];
std::string file =
Conf::xml_basedir + "/include/" + src;
FILE *fp = fopen(file.c_str(), "r");
if(fp) {
char buf[64];
size_t sz;
std::string inc;
while((sz = fread(buf, 1, sizeof(buf), fp)) != 0) {
inc.append(buf, sz);
}
fclose(fp);
code += "\n-- BEGIN INCLUDE: '" + src + "'\n";
code += inc;
code += "\n-- END INCLUDE: '" + src + "'\n";
}
} else {
code += spi->code;
}
spi++;
}
return luaresume.run(code);
}
|