1 |
Douglas Thrift |
196 |
// Feeping Creaturism |
2 |
|
|
// |
3 |
|
|
// Douglas Thrift |
4 |
|
|
// |
5 |
|
|
// $Id$ |
6 |
|
|
|
7 |
|
|
#include "Jargon.hpp" |
8 |
Douglas Thrift |
224 |
#include "Matcher.hpp" |
9 |
Douglas Thrift |
196 |
|
10 |
Douglas Thrift |
230 |
Jargon::Jargon(const ext::String& path, const ext::String& jargon, bool include, |
11 |
Douglas Thrift |
227 |
const ext::String& relative) : include(include), |
12 |
|
|
args(1, FeepingCreaturism::program) |
13 |
Douglas Thrift |
196 |
{ |
14 |
Douglas Thrift |
229 |
args.push_back("-m"); |
15 |
Douglas Thrift |
223 |
args.push_back("-p"); |
16 |
Douglas Thrift |
230 |
args.push_back("jargon"); |
17 |
|
|
args.push_back("\"" + jargon + "\""); |
18 |
|
|
args.push_back("-p"); |
19 |
Douglas Thrift |
223 |
args.push_back("include"); |
20 |
|
|
args.push_back(lexical_cast<ext::String>(include) + "()"); |
21 |
Douglas Thrift |
225 |
|
22 |
|
|
if (!relative.IsEmpty()) |
23 |
|
|
{ |
24 |
|
|
args.push_back("-p"); |
25 |
|
|
args.push_back("relative"); |
26 |
|
|
args.push_back("\"" + relative + "\""); |
27 |
|
|
} |
28 |
|
|
|
29 |
Douglas Thrift |
230 |
args.push_back(path + "/" + jargon); |
30 |
Douglas Thrift |
201 |
args.push_back("jargon.xsl"); |
31 |
Douglas Thrift |
227 |
} |
32 |
Douglas Thrift |
196 |
|
33 |
Douglas Thrift |
227 |
ios::PrintWriter& operator<<(ios::PrintWriter& pout, const Jargon& jargon) |
34 |
|
|
{ |
35 |
|
|
redi::ipstream pin("/usr/local/bin/Xalan", jargon.args); |
36 |
Douglas Thrift |
196 |
|
37 |
Douglas Thrift |
227 |
if (jargon.include) |
38 |
Douglas Thrift |
224 |
{ |
39 |
|
|
std::string ignore; |
40 |
|
|
|
41 |
|
|
std::getline(pin, ignore); |
42 |
|
|
} |
43 |
|
|
|
44 |
Douglas Thrift |
223 |
do |
45 |
Douglas Thrift |
208 |
{ |
46 |
Douglas Thrift |
223 |
std::string line; |
47 |
Douglas Thrift |
208 |
|
48 |
Douglas Thrift |
223 |
std::getline(pin, line); |
49 |
Douglas Thrift |
208 |
|
50 |
Douglas Thrift |
229 |
while (jargon.include && line.find(" xmlns=") != std::string::npos) |
51 |
|
|
{ |
52 |
|
|
std::string::size_type position(line.find(" xmlns=")); |
53 |
|
|
|
54 |
|
|
line.replace(position, 37, ""); |
55 |
|
|
} |
56 |
|
|
|
57 |
Douglas Thrift |
254 |
pout << line << "\n"; |
58 |
Douglas Thrift |
203 |
} |
59 |
Douglas Thrift |
223 |
while (pin.good()); |
60 |
Douglas Thrift |
227 |
|
61 |
|
|
return pout; |
62 |
Douglas Thrift |
196 |
} |