You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xalan.apache.org by db...@locus.apache.org on 2000/07/21 21:16:35 UTC
cvs commit: xml-xalan/c/samples/TraceListen TraceListen.cpp
dbertoni 00/07/21 12:16:34
Modified: c/samples/TraceListen TraceListen.cpp
Log:
Added terminator function calls, and simplified the code that creates the TraceListener.
Revision Changes Path
1.2 +38 -34 xml-xalan/c/samples/TraceListen/TraceListen.cpp
Index: TraceListen.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/samples/TraceListen/TraceListen.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- TraceListen.cpp 2000/06/02 15:34:28 1.1
+++ TraceListen.cpp 2000/07/21 19:16:33 1.2
@@ -34,7 +34,7 @@
const char* argv[])
{
#if !defined(XALAN_NO_NAMESPACES)
- using std::auto_ptr;
+ using std::auto_ptr;
using std::cerr;
using std::endl;
#endif
@@ -50,37 +50,38 @@
cerr << "Usage: TraceListen [+ 1 or more of following] -TT -TG -TS -TTC" << endl;
return -1;
}
- // Set the TraceListener flags...
- for (int i = 1; i < argc; i ++)
- {
- if(!stricmp("-TT", argv[i]))
- {
- traceTemplates = true;
- }
- else if(!stricmp("-TG", argv[i]))
+
+ // Set the TraceListener flags...
+ for (int i = 1; i < argc; i ++)
+ {
+ if(!stricmp("-TT", argv[i]))
+ {
+ traceTemplates = true;
+ }
+ else if(!stricmp("-TG", argv[i]))
{
- traceGenerationEvent = true;
+ traceGenerationEvent = true;
}
else if(!stricmp("-TS", argv[i]))
{
- traceSelectionEvent = true;
- }
- else if(!stricmp("-TTC", argv[i]))
+ traceSelectionEvent = true;
+ }
+ else if(!stricmp("-TTC", argv[i]))
+ {
+ traceTemplateChildren = true;
+ }
+ else
{
- traceTemplateChildren = true;
+ cerr << "Usage: TraceListen [+ 1 or more of following] -TT -TG -TS -TTC" << endl;
+ return -1;
}
- else
- {
- cerr << "Usage: TraceListen [+ 1 or more of following] -TT -TG -TS -TTC" << endl;
- return -1;
- }
- }
+ }
try
{
- // Call the static initializers...
- XMLPlatformUtils::Initialize();
- XSLTEngineImpl::Initialize();
+ // Call the static initializers...
+ XMLPlatformUtils::Initialize();
+ XSLTEngineImpl::Initialize();
// Create the support objects that are necessary for running the processor...
DOMSupportDefault theDOMSupport;
@@ -129,33 +130,36 @@
XercesDOMPrintWriter theResultWriter(theOutputStream);
XSLTResultTarget theResultTarget(&theResultWriter);
- // Set up a diagnostic writer to be used by the TraceListener...
- XercesStdTextOutputStream theStdErr(cerr);
- XercesDOMPrintWriter diagnosticsWriter(theStdErr);
+ // Set up a diagnostic writer to be used by the TraceListener...
+ XercesStdTextOutputStream theStdErr(cerr);
+ XercesDOMPrintWriter diagnosticsWriter(theStdErr);
// Set up the TraceListener...
- auto_ptr<TraceListener> theTraceListener;
- theTraceListener = auto_ptr<TraceListener>(new TraceListenerDefault(
+ auto_ptr<TraceListener> theTraceListener(
+ new TraceListenerDefault(
diagnosticsWriter,
traceTemplates,
traceTemplateChildren,
traceGenerationEvent,
traceSelectionEvent));
- // Add the TraceListener to the XSLT processor...
- theProcessor.setTraceSelects(traceSelectionEvent);
- theProcessor.addTraceListener(theTraceListener.get());
+ // Add the TraceListener to the XSLT processor...
+ theProcessor.setTraceSelects(traceSelectionEvent);
+ theProcessor.addTraceListener(theTraceListener.get());
- // Perform the transformation...
+ // Perform the transformation...
theProcessor.process(
theInputSource,
theStylesheetSource,
theResultTarget,
theConstructionContext,
theExecutionContext);
- }
- catch(...)
+ // Call the static terminators...
+ XMLPlatformUtils::Terminate();
+ XSLTEngineImpl::Terminate();
+ }
+ catch(...)
{
cerr << "Exception caught! Exiting..." << endl;
}