1 |
// Feeping Creaturism |
2 |
// |
3 |
// Douglas Thrift |
4 |
// |
5 |
// $Id$ |
6 |
|
7 |
#include "Jargon.hpp" |
8 |
#include "Matcher.hpp" |
9 |
|
10 |
Jargon::Jargon(const ext::String& path, bool include, const ext::String& relative) |
11 |
{ |
12 |
std::vector<std::string> args(1, FeepingCreaturism::program); |
13 |
|
14 |
args.push_back("-p"); |
15 |
args.push_back("include"); |
16 |
args.push_back(lexical_cast<ext::String>(include) + "()"); |
17 |
|
18 |
if (!relative.IsEmpty()) |
19 |
{ |
20 |
args.push_back("-p"); |
21 |
args.push_back("relative"); |
22 |
args.push_back("\"" + relative + "\""); |
23 |
} |
24 |
|
25 |
args.push_back(path); |
26 |
args.push_back("jargon.xsl"); |
27 |
|
28 |
redi::ipstream pin("/usr/local/bin/Xalan", args); |
29 |
|
30 |
if (include) |
31 |
{ |
32 |
std::string ignore; |
33 |
|
34 |
std::getline(pin, ignore); |
35 |
} |
36 |
|
37 |
do |
38 |
{ |
39 |
std::string line; |
40 |
|
41 |
std::getline(pin, line); |
42 |
|
43 |
buffer << line << '\n'; |
44 |
} |
45 |
while (pin.good()); |
46 |
} |