[GME-commit] GMESRC/GME/Parser MgaParser.cpp,1.36,1.37

Log messages of CVS commits gme-commit at list.isis.vanderbilt.edu
Mon Feb 4 15:30:43 CST 2008


Update of /project/gme-repository/GMESRC/GME/Parser
In directory escher:/tmp/cvs-serv21914

Modified Files:
	MgaParser.cpp 
Log Message:
GetXMLInfo implementation got much faster by exiting (by throwing a SAXException intentionally) right after the name analysis of element <project>.


CVS User: Zoltan Molnar, ISIS (zolmol)

Index: MgaParser.cpp
===================================================================
RCS file: /project/gme-repository/GMESRC/GME/Parser/MgaParser.cpp,v
retrieving revision 1.36
retrieving revision 1.37
diff -C2 -d -r1.36 -r1.37
*** MgaParser.cpp	21 Feb 2007 22:37:38 -0000	1.36
--- MgaParser.cpp	4 Feb 2008 21:30:40 -0000	1.37
***************
*** 10,13 ****
--- 10,14 ----
  #include <list>//slist
  
+ const char * magic_exit_str = "Analysis done.Quit parsing.";
  // --------------------------- CMgaParser
  
***************
*** 233,237 ****
  			ranges.clear();
  		}
! 	    catch(const XMLException &e)
  		{
  			XmlStr desc(e.getMessage());
--- 234,238 ----
  			ranges.clear();
  		}
! 		catch(const XMLException &e)
  		{
  			XmlStr desc(e.getMessage());
***************
*** 332,336 ****
  
  		}
! 	    catch(const XMLException &e)
  		{
  			XmlStr desc(e.getMessage());
--- 333,348 ----
  
  		}
! 		catch(const SAXException &e)
! 		{
! 			char * p_msg = XMLString::transcode( e.getMessage());
! 			if( 0 != strcmp( p_msg, magic_exit_str))
! 			{
! 				ThrowXmlError( p_msg);
! 			}
! 			XMLString::release( &p_msg);
! 			// else just ignore it, we threw an exception for a good purpose:
! 			// to quit the costly parsing operation
! 		}
! 		catch(const XMLException &e)
  		{
  			XmlStr desc(e.getMessage());
***************
*** 666,671 ****
  	else if( SUCCEEDED(obj.QueryInterface(folder)) )
  		GetCurrent().name = "folder";
! 	else
! 		HR_THROW(E_INVALID_FILENAME);
  
  	const std::string *parname_hint = GetByNameX(attributes, "paradigmnamehint");
--- 678,685 ----
  	else if( SUCCEEDED(obj.QueryInterface(folder)) )
  		GetCurrent().name = "folder";
! 	// Commented, thus allowing clipboard snippets to be 
! 	// dropped onto atoms/sets/references/connections too
! 	//else
! 	//	HR_THROW(E_INVALID_FILENAME);
  
  	const std::string *parname_hint = GetByNameX(attributes, "paradigmnamehint");
***************
*** 720,726 ****
  void CMgaParser::EndValue()
  {
!     // skip if the object is ignored
!     if( GetPrevious().object == NULL )
!         return;
  
  	if( GetPrevName() == "constraint" )
--- 734,740 ----
  void CMgaParser::EndValue()
  {
! 	// skip if the object is ignored
! 	if( GetPrevious().object == NULL )
! 		return;
  
  	if( GetPrevName() == "constraint" )
***************
*** 1131,1139 ****
  	HRESULT hr = resolver->get_AttrByStr(fco, PutInBstrAttr(attributes, "kind"), PutOut(metaattr));
  
!     if( FAILED(hr) || metaattr == NULL )
!     {
!         GetCurrent().object = NULL;
!         return;
!     }
  
  	COMTHROW( fco->get_Attribute(metaattr, PutOut(attr)) );
--- 1145,1153 ----
  	HRESULT hr = resolver->get_AttrByStr(fco, PutInBstrAttr(attributes, "kind"), PutOut(metaattr));
  
! 	if( FAILED(hr) || metaattr == NULL )
! 	{
! 		GetCurrent().object = NULL;
! 		return;
! 	}
  
  	COMTHROW( fco->get_Attribute(metaattr, PutOut(attr)) );
***************
*** 1604,1607 ****
--- 1618,1623 ----
  		CComBstrObj nn = PutInBstr(GetCurrData());
  		*infoprojname = nn.Detach();
+ 		// analysis done, why waste time by processing further the xme file?
+ 		throw SAXException( magic_exit_str); // trick used & handled only by GetXMLInfo()
  	}
  }
***************
*** 1684,1688 ****
  
  		}
! 	    catch(const XMLException &e)
  		{
  			XmlStr desc(e.getMessage());
--- 1700,1704 ----
  
  		}
! 		catch(const XMLException &e)
  		{
  			XmlStr desc(e.getMessage());



More information about the GME-commit mailing list