ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/repos/Bender/Bender.cpp
(Generate patch)

Comparing Bender/Bender.cpp (file contents):
Revision 350 by douglas, 2004-12-17T15:02:41-08:00 vs.
Revision 420 by douglas, 2005-03-09T17:47:41-08:00

# Line 6 | Line 6
6  
7   #include "Matcher/Matcher.hpp"
8  
9 + #include <menes-api/console.hpp>
10   #include <menes-api/environment.hpp>
11   #include <menes-api/files.hpp>
12   #include <menes-api/process.hpp>
13   #include <menes-app/simple.hpp>
14   #include <menes-ios/helpers.hpp>
15 + #include <menes-xml/document.hpp>
16 + #include <menes-xml/nodeset.hpp>
17 + #include <menes-xml/parse.hpp>
18  
19   class Bender
20   {
# Line 47 | Line 51 | Bender::Bender()
51  
52                          bend(path, env.get("HTTP_USER_AGENT"));
53                  }
54 <                catch (ext::Exception e)
54 >                catch (ext::Exception)
55                  {
56                          api::Cout << "Status: 404\r\n"
57                                  << "Content-Type: text/html; charset=ISO-8859-1\r\n\r\n"
# Line 80 | Line 84 | void Bender::bend(const ext::String& pat
84  
85   void Bender::bend(const ext::String& path)
86   {
87 <        _L<ext::String> args(1, "-a");
87 >        _H<xml::Document> document(xml::Parse("bender.xml"));
88 >        _H<xml::Node> node(*document/"bender");
89 >        ext::String program(*node/"program");
90 >        _L<ext::String> args;
91 >
92 >        _foreach (const xml::NodeSet, arg, *node/"argument") args.InsertLast(**arg);
93  
94          args.InsertLast(path);
95  
96 < #if defined(__FreeBSD__)
97 <        _S<api::Process> xslt("/usr/local/bin/Xalan", args);
89 < #elif defined(_WIN32)
90 <        _S<api::Process> xslt("Xalan.exe", args);
91 < #else
92 <        _S<api::Process> xslt("Xalan", args);
93 < #endif
94 <        ios::String output;
96 >        _S<api::Process> xslt(program, args);
97 >        _S<ios::String> output;
98  
99          ios::ReadToWrite(*xslt.GetReader(), output);
100  
# Line 105 | Line 108 | void Bender::bend(const ext::String& pat
108                  api::Cout << "Content-Type: " << type << "\r\n\r\n" << output;
109          }
110          else pass(path);
108
109        xslt.Join();
111   }
112  
113   void Bender::pass(const ext::String& path)

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines