dbertoni    00/05/26 12:25:38

  Modified:    c/src/XSLT ElemCopy.cpp ElemTemplateElement.cpp
                        ElemValueOf.cpp StylesheetRoot.cpp
                        XSLTEngineImpl.cpp
  Log:
  General cleanup.
  
  Revision  Changes    Path
  1.5       +1 -1      xml-xalan/c/src/XSLT/ElemCopy.cpp
  
  Index: ElemCopy.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/XSLT/ElemCopy.cpp,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- ElemCopy.cpp      2000/05/24 19:38:47     1.4
  +++ ElemCopy.cpp      2000/05/26 19:25:35     1.5
  @@ -111,7 +111,7 @@
   {
        assert(sourceNode != 0);
   
  -     const int       nodeType = sourceNode->getNodeType();
  +     const XalanNode::NodeType       nodeType = sourceNode->getNodeType();
        
        if(XalanNode::DOCUMENT_NODE != nodeType)
        {
  
  
  
  1.21      +2 -1      xml-xalan/c/src/XSLT/ElemTemplateElement.cpp
  
  Index: ElemTemplateElement.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/XSLT/ElemTemplateElement.cpp,v
  retrieving revision 1.20
  retrieving revision 1.21
  diff -u -r1.20 -r1.21
  --- ElemTemplateElement.cpp   2000/05/24 19:38:48     1.20
  +++ ElemTemplateElement.cpp   2000/05/26 19:25:36     1.21
  @@ -742,7 +742,8 @@
        bool                            doApplyTemplate = true;
        bool                            shouldStrip = false;
   
  -     const int                       nodeType = child->getNodeType();
  +     const const XalanNode::NodeType         nodeType = child->getNodeType();
  +
        const Stylesheet*       stylesheetTree = &stylesheet_tree;
   
        const bool                      isApplyImports = xslToken == 
Constants::ELEMNAME_APPLY_IMPORTS;
  
  
  
  1.8       +2 -2      xml-xalan/c/src/XSLT/ElemValueOf.cpp
  
  Index: ElemValueOf.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/XSLT/ElemValueOf.cpp,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- ElemValueOf.cpp   2000/05/24 19:38:48     1.7
  +++ ElemValueOf.cpp   2000/05/26 19:25:36     1.8
  @@ -210,7 +210,7 @@
   
                if(0 != value)
                {
  -                     const int       type = value->getType();
  +                     const XObject::eObjectType      type = value->getType();
   
                        if (XObject::eTypeNull != type)
                        {
  @@ -219,7 +219,7 @@
                }
        }
   
  -     const unsigned int              len = length(theValue);
  +     const unsigned int      len = length(theValue);
   
        if(len > 0)
        {
  
  
  
  1.17      +142 -145  xml-xalan/c/src/XSLT/StylesheetRoot.cpp
  
  Index: StylesheetRoot.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/XSLT/StylesheetRoot.cpp,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- StylesheetRoot.cpp        2000/05/24 19:38:49     1.16
  +++ StylesheetRoot.cpp        2000/05/26 19:25:36     1.17
  @@ -192,54 +192,54 @@
                        XSLTResultTarget&                               
outputTarget,
                        StylesheetExecutionContext&             
executionContext) const
   {
  -             // Find the root pattern in the XSL.
  -             ElemTemplate* rootRule =
  +     // Find the root pattern in the XSL.
  +     ElemTemplate* rootRule =
                        findTemplate(executionContext, sourceTree, sourceTree);
   
  -             if(0 == rootRule)
  -             {
  -                     rootRule = m_defaultRootRule;
  -                     assert(rootRule);
  -             }
  +     if(0 == rootRule)
  +     {
  +             rootRule = m_defaultRootRule;
  +             assert(rootRule);
  +     }
   
  -             executionContext.setStylesheetRoot(this);
  +     executionContext.setStylesheetRoot(this);
   
  -             FormatterListener* flistener = 0;
  +     FormatterListener* flistener = 0;
   
   #if !defined(XALAN_NO_NAMESPACES)
  -             using std::auto_ptr;
  +     using std::auto_ptr;
   #endif
   
  -             Writer* pw = 0;
  +     Writer* pw = 0;
   
  -             flistener = outputTarget.getFormatterListener();
  +     flistener = outputTarget.getFormatterListener();
   
  -             if(flistener == 0)
  -             {
  -                     // $$$ ToDo: For right now, 
XSLTResultTarget::getDocumentHandler()
  -                     // and XSLTResultTarget::getFormatterListener() both 
return a
  -                     // FormatterListener*.  When we have RTTI on all 
platforms, that
  -                     // may change...
  -                     flistener = outputTarget.getDocumentHandler();
  -             }
  +     if(flistener == 0)
  +     {
  +             // $$$ ToDo: For right now, 
XSLTResultTarget::getDocumentHandler()
  +             // and XSLTResultTarget::getFormatterListener() both return a
  +             // FormatterListener*.  When we have RTTI on all platforms, that
  +             // may change...
  +             flistener = outputTarget.getDocumentHandler();
  +     }
   
  -             if (flistener != 0)
  +     if (flistener != 0)
  +     {
  +             // Do encoding stuff here...
  +     }
  +     /*
  +      * Output target has a character or byte stream or file
  +      */
  +     else if((0 != outputTarget.getCharacterStream()) ||
  +                     (0 != outputTarget.getByteStream()) ||
  +                     (0 != outputTarget.getFileName().length()))
  +     {
  +             if(0 != outputTarget.getCharacterStream())
                {
  -                     // Do encoding stuff here...
  +                     pw = outputTarget.getCharacterStream();
                }
  -             /*
  -              * Output target has a character or byte stream or file
  -              */
  -             else if((0 != outputTarget.getCharacterStream()) ||
  -                                             (0 != 
outputTarget.getByteStream()) ||
  -                                             (0 != 
outputTarget.getFileName().length()))
  +             else
                {
  -                     if(0 != outputTarget.getCharacterStream())
  -                     {
  -                             pw = outputTarget.getCharacterStream();
  -                     }
  -                     else
  -                     {
   /*
                                java:
                                XalanDOMString mimeEncoding;
  @@ -254,148 +254,145 @@
                                }
   */
   
  -                             if(0 != outputTarget.getByteStream())
  -                             {
  -                                     pw = 
executionContext.createPrintWriter(*outputTarget.getByteStream());
  -                             }
  -                             else if(!isEmpty(outputTarget.getFileName()))
  -                             {
  -                                     pw = executionContext.createPrintWriter(
  -                                                             
outputTarget.getFileName(),
  -                                                             
XalanDOMString());
  -                             }
  -                             else
  -                             {
  +                     if(0 != outputTarget.getByteStream())
  +                     {
  +                             pw = 
executionContext.createPrintWriter(*outputTarget.getByteStream());
  +                     }
  +                     else if(!isEmpty(outputTarget.getFileName()))
  +                     {
  +                             pw = executionContext.createPrintWriter(
  +                                                     
outputTarget.getFileName(),
  +                                                     XalanDOMString());
  +                     }
  +                     else
  +                     {
   #if !defined(XALAN_NO_NAMESPACES)
  -                                     using std::cout;
  +                             using std::cout;
   #endif
   
  -                                     pw = 
executionContext.createPrintWriter(cout);
  -                             }
  +                             pw = executionContext.createPrintWriter(cout);
                        }
  +             }
   
  -                     int                     indentAmount = 
executionContext.getIndent();
  -                     const bool      doIndent = (indentAmount > -1) ? true : 
m_indentResult;
  +             int                     indentAmount = 
executionContext.getIndent();
  +             const bool      doIndent = (indentAmount > -1) ? true : 
m_indentResult;
                        
  -                     switch(m_outputMethod)
  +             switch(m_outputMethod)
  +             {
  +             case FormatterListener::OUTPUT_METHOD_HTML:
  +                     if (doIndent == true && indentAmount < 0)
                        {
  -                     case FormatterListener::OUTPUT_METHOD_HTML:
  -                             {
  -                                     if (doIndent == true && indentAmount < 
0)
  -                                     {
  -                                             indentAmount = 
FormatterToHTML::eDefaultIndentAmount;
  -                                     }
  +                             indentAmount = 
FormatterToHTML::eDefaultIndentAmount;
  +                     }
   
  -                                     flistener = 
executionContext.createFormatterToHTML(
  +                     flistener = executionContext.createFormatterToHTML(
                                                *pw, m_encoding, m_mediatype, 
m_doctypeSystem, m_doctypePublic,
                                                doIndent, indentAmount, 
m_version, m_standalone, !m_omitxmlDecl);
  -                             }
  -                             break;
  +                     break;
   
  -                     case FormatterListener::OUTPUT_METHOD_TEXT:
  -                             flistener = 
executionContext.createFormatterToText(*pw);
  -                             break;
  -
  -                     case FormatterListener::OUTPUT_METHOD_NONE:
  -                     case FormatterListener::OUTPUT_METHOD_XML:
  -                     default:
  -                             {
  -                                     // Make sure we don't have a negative 
indent amount if we're
  -                                     // indenting
  -                                     if (doIndent == true && indentAmount < 
0)
  -                                     {
  -                                             indentAmount = 
FormatterToXML::eDefaultIndentAmount;
  -                                     }
  +             case FormatterListener::OUTPUT_METHOD_TEXT:
  +                     flistener = executionContext.createFormatterToText(*pw);
  +                     break;
  +
  +             case FormatterListener::OUTPUT_METHOD_NONE:
  +             case FormatterListener::OUTPUT_METHOD_XML:
  +             default:
  +                     // Make sure we don't have a negative indent amount if 
we're
  +                     // indenting
  +                     if (doIndent == true && indentAmount < 0)
  +                     {
  +                             indentAmount = 
FormatterToXML::eDefaultIndentAmount;
  +                     }
   
  -                                     flistener = 
executionContext.createFormatterToXML(
  +                     flistener = executionContext.createFormatterToXML(
                                                *pw, m_version, doIndent, 
indentAmount, m_encoding, m_mediatype,
                                                m_doctypeSystem, 
m_doctypePublic, !m_omitxmlDecl, m_standalone);
  -                             }
  -                             break;
  -                     }
  -
  -                     executionContext.setFormatterListener(flistener);
  +                     break;
                }
  -             /*
  -              * Output target has a node
  -              */
  -             else if(0 != outputTarget.getNode())
  +
  +             executionContext.setFormatterListener(flistener);
  +     }
  +     /*
  +      * Output target has a node
  +      */
  +     else if(0 != outputTarget.getNode())
  +     {
  +             switch(outputTarget.getNode()->getNodeType())
                {
  -                     switch(outputTarget.getNode()->getNodeType())
  -                     {
  -                     case XalanNode::DOCUMENT_NODE:
  -                             flistener =
  +             case XalanNode::DOCUMENT_NODE:
  +                     flistener =
                                        
executionContext.createFormatterToDOM(static_cast<XalanDocument*>(outputTarget.getNode()));
  -                             break;
  +                     break;
   
  -                     case XalanNode::DOCUMENT_FRAGMENT_NODE:
  -                             flistener =
  +             case XalanNode::DOCUMENT_FRAGMENT_NODE:
  +                     flistener =
                                        
executionContext.createFormatterToDOM(executionContext.createDocument(),
                                                
static_cast<XalanDocumentFragment*>(outputTarget.getNode()));
  -                             break;
  +                     break;
   
  -                     case XalanNode::ELEMENT_NODE:
  -                             flistener =
  +             case XalanNode::ELEMENT_NODE:
  +                     flistener =
                                        
executionContext.createFormatterToDOM(executionContext.createDocument(),
                                                
static_cast<XalanElement*>(outputTarget.getNode()));
  -                             break;
  +                     break;
   
  -                     default:
  -                             executionContext.error("Can only output to an 
Element, DocumentFragment, Document, or PrintWriter.");
  -                     }
  +             default:
  +                     executionContext.error("Can only output to an Element, 
DocumentFragment, Document, or PrintWriter.");
                }
  -             /*
  -              * Create an empty document and set the output target node to 
this
  -              */
  -             else
  -             {
  -                     outputTarget.setNode(executionContext.createDocument());
  -                     flistener =
  +     }
  +     /*
  +      * Create an empty document and set the output target node to this
  +      */
  +     else
  +     {
  +             outputTarget.setNode(executionContext.createDocument());
  +
  +             flistener =
                                
executionContext.createFormatterToDOM(static_cast<XalanDocument*>(outputTarget.getNode()));
  -             }
  -             
  -             executionContext.setFormatterListener(flistener);
  -             executionContext.resetCurrentState(sourceTree, sourceTree);
  +     }
  +
  +     executionContext.setFormatterListener(flistener);
  +     executionContext.resetCurrentState(sourceTree, sourceTree);
   
  -             
executionContext.setRootDocument(static_cast<XalanDocument*>(sourceTree));
  +     
executionContext.setRootDocument(static_cast<XalanDocument*>(sourceTree));
                
  -             if(executionContext.doDiagnosticsOutput())
  -             {
  -                     
executionContext.diag(XALAN_STATIC_UCODE_STRING("============================="));
  -                     
executionContext.diag(XALAN_STATIC_UCODE_STRING("Transforming..."));
  -                     executionContext.pushTime(&sourceTree);
  -             }
  +     if(executionContext.doDiagnosticsOutput())
  +     {
  +             
executionContext.diag(XALAN_STATIC_UCODE_STRING("============================="));
  +             
executionContext.diag(XALAN_STATIC_UCODE_STRING("Transforming..."));
  +             executionContext.pushTime(&sourceTree);
  +     }
                
  -             executionContext.pushContextMarker(0, 0);
  +     executionContext.pushContextMarker(0, 0);
   
  -             try
  -             {
  -                     executionContext.resolveTopLevelParams();
  -             }
  -             // java: catch(Exception e)
  -             catch(...)
  -             {
  -                     throw SAXException("StylesheetRoot.process error");
  -             }
  +     try
  +     {
  +             executionContext.resolveTopLevelParams();
  +     }
  +     // java: catch(Exception e)
  +     catch(...)
  +     {
  +             throw SAXException("StylesheetRoot.process error");
  +     }
   
  -             executionContext.startDocument();
  +     executionContext.startDocument();
   
  -             // Output the action of the found root rule.    All processing
  -             // occurs from here.    buildResultFromTemplate is highly 
recursive.
  -             // java: rootRule->execute(*m_processor, sourceTree, 
sourceTree, 0);
  -             rootRule->execute(executionContext, sourceTree, sourceTree, 
QName());
  +     // Output the action of the found root rule.    All processing
  +     // occurs from here.    buildResultFromTemplate is highly recursive.
  +     // java: rootRule->execute(*m_processor, sourceTree, sourceTree, 0);
  +     rootRule->execute(executionContext, sourceTree, sourceTree, QName());
   
  -             executionContext.endDocument();
  +     executionContext.endDocument();
                
  -             // Reset the top-level params for the next round.
  -             executionContext.clearTopLevelParams();
  +     // Reset the top-level params for the next round.
  +     executionContext.clearTopLevelParams();
   
  -             if(executionContext.doDiagnosticsOutput())
  -             {
  -                     executionContext.diag(XALAN_STATIC_UCODE_STRING(""));
  -                     
executionContext.displayDuration(XALAN_STATIC_UCODE_STRING("transform"), 
&sourceTree);
  -                     executionContext.diag(XALAN_STATIC_UCODE_STRING(""));
  -             }
  +     if(executionContext.doDiagnosticsOutput())
  +     {
  +             executionContext.diag(XALAN_STATIC_UCODE_STRING(""));
  +             
executionContext.displayDuration(XALAN_STATIC_UCODE_STRING("transform"), 
&sourceTree);
  +             executionContext.diag(XALAN_STATIC_UCODE_STRING(""));
  +     }
   }
   
   
  @@ -590,7 +587,7 @@
                                                   
c_wstr(XALAN_STATIC_UCODE_STRING("CDATA")),
                                                   
c_wstr(XALAN_STATIC_UCODE_STRING("*")));
   
  -             m_defaultRule = new ElemTemplate(constructionContext,   // @@ 
JMD: should be null 
  +             m_defaultRule = new ElemTemplate(constructionContext,
                                                                                
 *this,
                                                                                
 xslPrefix + Constants::ELEMNAME_TEMPLATE_STRING, 
                                                                                
 attrs,
  @@ -609,9 +606,9 @@
   
                childrenElement->setDefaultTemplate(true);
                m_defaultRule->appendChildElem(childrenElement);
  -    
  +
                // -----------------------------
  -    
  +
                attrs.clear();
                attrs.addAttribute(c_wstr(Constants::ATTRNAME_MATCH),
                                                   
c_wstr(XALAN_STATIC_UCODE_STRING("CDATA")),
  @@ -638,7 +635,7 @@
                                                        columnNumber);
   
                m_defaultTextRule->appendChildElem(elemValueOf);
  -    
  +
                //--------------------------------
       
                attrs.clear();
  
  
  
  1.41      +6 -5      xml-xalan/c/src/XSLT/XSLTEngineImpl.cpp
  
  Index: XSLTEngineImpl.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/XSLT/XSLTEngineImpl.cpp,v
  retrieving revision 1.40
  retrieving revision 1.41
  diff -u -r1.40 -r1.41
  --- XSLTEngineImpl.cpp        2000/05/25 16:51:36     1.40
  +++ XSLTEngineImpl.cpp        2000/05/26 19:25:36     1.41
  @@ -259,6 +259,7 @@
   {
        m_rootDoc = 0;
   
  +     m_topLevelParams.clear();
        m_durationsTable.clear();
        m_stylesheetLocatorStack.clear();
        clear(m_pendingElementName);
  @@ -548,7 +549,7 @@
        }
        catch(SAXException& se)
        {
  -             message("processStylesheet not successful!");
  +             message("processStylesheet not successfull!");
   
                throw se;
        }
  @@ -2292,9 +2293,9 @@
                        const XalanDOMString&   theNamespace,
                        const XalanElement&     namespaceContext) const
   {
  -     int                             type;
  -     const XalanNode*        parent = &namespaceContext;
  -     XalanDOMString          prefix;
  +     XalanNode::NodeType             type;
  +     const XalanNode*                parent = &namespaceContext;
  +     XalanDOMString                  prefix;
   
        while (0 != parent && 0 == length(prefix)
                   && ((type = parent->getNodeType()) == XalanNode::ELEMENT_NODE
  @@ -3615,7 +3616,7 @@
   XSLTEngineImpl::StackGuard::print(PrintWriter&       pw) const
   {
        // for the moment, these diagnostics are really bad...
  -     const int       theType = m_sourceXML->getNodeType();
  +     const XalanNode::NodeType       theType = m_sourceXML->getNodeType();
   
        if(theType == XalanNode::TEXT_NODE)
        {
  
  
  

Reply via email to