[GME-commit] GMESRC/GME/Parser MgaDumper.cpp,1.16,1.17 MgaParser.cpp,1.20,1.21 mga.dtd,1.7,1.8

gme-commit at list.isis.vanderbilt.edu gme-commit at list.isis.vanderbilt.edu
Wed Jul 14 15:30:18 CDT 2004


Update of /var/lib/gme/GMESRC/GME/Parser
In directory braindrain:/tmp/cvs-serv10794/Parser

Modified Files:
	MgaDumper.cpp MgaParser.cpp mga.dtd 
Log Message:
Selective Closure
	-makes possible restoring connections to library elements.

	-library name matching based on short filenames

	-parses libraries correctly (as libraries)

Mga.dtd file modified, more distinctive closure attributes used: "closurelib*"

-----

Mga::FCO::SetCompareToBase modified, checks the number of setmembers
MgaParser::StartSet corrected to erase members originating from the derivation process if the isbound attribute is false



CVS User: zolmol

Index: MgaDumper.cpp
===================================================================
RCS file: /var/lib/gme/GMESRC/GME/Parser/MgaDumper.cpp,v
retrieving revision 1.16
retrieving revision 1.17
diff -C2 -d -r1.16 -r1.17
*** MgaDumper.cpp	6 Jul 2004 16:10:05 -0000	1.16
--- MgaDumper.cpp	14 Jul 2004 19:30:15 -0000	1.17
***************
*** 672,676 ****
  			}
  			// logic added by ZolMol
! 			else if ( !isInLibrary( fco) && isInLibrary( derivedfrom) && m_dumpLibraryStubs) { //derived from a type defined in a library
  				CComBSTR name;
  				COMTHROW( derivedfrom->get_AbsPath( &name));
--- 672,676 ----
  			}
  			// logic added by ZolMol
! 			else if ( m_dumpLibraryStubs && !isInLibrary( fco) && isInLibrary( derivedfrom)) { //derived from a type defined in a library
  				CComBSTR name;
  				COMTHROW( derivedfrom->get_AbsPath( &name));
***************
*** 678,682 ****
  				CopyTo( name, nm);
  				
! 				Attr("libderivedfrom", nm);
  
  				VARIANT_BOOL b;
--- 678,682 ----
  				CopyTo( name, nm);
  				
! 				Attr("closurelibderivedfrom", nm);
  
  				VARIANT_BOOL b;
***************
*** 906,910 ****
  			Attr("referred", fco, IMgaFCO::get_ID);
  		// logic added by ZolMol
! 		else if ( !isInLibrary( reference) && isInLibrary( fco) && m_dumpLibraryStubs) //reference pointing out to a library
  		{
  			CComBSTR name;
--- 906,910 ----
  			Attr("referred", fco, IMgaFCO::get_ID);
  		// logic added by ZolMol
! 		else if ( m_dumpLibraryStubs && !isInLibrary( reference) && isInLibrary( fco)) //reference pointing out to a library
  		{
  			CComBSTR name;
***************
*** 913,917 ****
  			CopyTo( name, nm);
  			
! 			Attr("libreferred", nm);
  		}
  	}
--- 913,917 ----
  			CopyTo( name, nm);
  			
! 			Attr("closurelibreferred", nm);
  		}
  	}
***************
*** 1018,1022 ****
  	}
  
! 	Attr("target", target, IMgaFCO::get_ID);
  
  	CComObjPtrVector<IMgaFCO> refs;
--- 1018,1034 ----
  	}
  
! 	// m_dumpLibraryStubs is true, so the connection to a library element will be dumped with "closurelibtarget" attribute and a dummy! "target" attribute
! 	if ( m_dumpLibraryStubs && !isInLibrary( conn) && isInLibrary( target))
! 	{
! 		CComBSTR name;
! 		COMTHROW( target->get_AbsPath( &name));
! 		string nm;
! 		CopyTo( name, nm);
! 		
! 		Attr("closurelibtarget", nm);
! 		Attr("target", conn, IMgaFCO::get_ID); // this is required, dump a dummy!! value, since the ID is checked and if not found inside the <clipboard/> section the parser will complain about it
! 	}
! 	else
! 		Attr("target", target, IMgaFCO::get_ID);
  
  	CComObjPtrVector<IMgaFCO> refs;
***************
*** 1359,1363 ****
  STDMETHODIMP CMgaDumper::DumpClos( IMgaFCOs *p_sel_fcos, IMgaFolders *p_sel_folds,  BSTR xmlfile, int dump_options)
  {
! 	m_strictDump = true;
  	dumpversion = 2; // no relids dumped
  	m_dumpLibraryStubs = (dump_options & 0x1) == 0x1; // dump library stubs ( absolute path used as libreferred or libderivedfrom attribute)
--- 1371,1375 ----
  STDMETHODIMP CMgaDumper::DumpClos( IMgaFCOs *p_sel_fcos, IMgaFolders *p_sel_folds,  BSTR xmlfile, int dump_options)
  {
! 	m_strictDump = true; // strict dump meaning that all dumped objects must be strictly in the closure
  	dumpversion = 2; // no relids dumped
  	m_dumpLibraryStubs = (dump_options & 0x1) == 0x1; // dump library stubs ( absolute path used as libreferred or libderivedfrom attribute)
***************
*** 1414,1420 ****
  			IMgaFCOs *p_top_fcos, IMgaFolders *p_top_folds, int dump_options)
  {
! 	m_strictDump = true;
  	dumpversion = 2; // no relids dumped
! 	m_dumpLibraryStubs = (dump_options & 0x1) == 0x1; // dump library stubs ( absolute path used as libreferred or libderivedfrom attribute)
  
  	COMTRY
--- 1426,1432 ----
  			IMgaFCOs *p_top_fcos, IMgaFolders *p_top_folds, int dump_options)
  {
! 	m_strictDump = true; // strict dump meaning that all dumped objects must be strictly in the closure
  	dumpversion = 2; // no relids dumped
! 	m_dumpLibraryStubs = (dump_options & 0x1) == 0x1; // dump library stubs ( absolute path used as closurelibreferred, closurelibderivedfrom, closurelibtarget attribute)
  
  	COMTRY

Index: MgaParser.cpp
===================================================================
RCS file: /var/lib/gme/GMESRC/GME/Parser/MgaParser.cpp,v
retrieving revision 1.20
retrieving revision 1.21
diff -C2 -d -r1.20 -r1.21
*** MgaParser.cpp	30 Jun 2004 17:50:47 -0000	1.20
--- MgaParser.cpp	14 Jul 2004 19:30:15 -0000	1.21
***************
*** 102,105 ****
--- 102,112 ----
  		}
  		COMTHROW( project->put_Preferences(project_prefs_orig) );
+ 
+ 		for(librecords::iterator i = libstodo.begin(); i != libstodo.end(); i++) { // copied from ParseProject in order to recognize libraries (zolmol)
+ 			COMTHROW(i->f->put_LibraryName(CComBSTR(i->libname.c_str())));
+ 			COMTHROW(i->f->put_Exempt(VARIANT_FALSE));
+ 		}
+ 		libstodo.clear();
+ 
  		COMTHROW( project->CommitTransaction() );
  		project = NULL;
***************
*** 795,799 ****
  	if( s == NULL )
  	{
! 		s = GetByNameX(attributes, "libderivedfrom");
  		if( s == NULL)
  		{
--- 802,806 ----
  	if( s == NULL )
  	{
! 		s = GetByNameX(attributes, "closurelibderivedfrom");
  		if( s == NULL)
  		{
***************
*** 807,811 ****
  			COMTHROW( obj.QueryInterface( deriv.from));
  
! 		if ( deriv.from == NULL) // do not throw exception in case of libderivedfrom
  		{
  			deriv.from.Release();
--- 814,818 ----
  			COMTHROW( obj.QueryInterface( deriv.from));
  
! 		if ( deriv.from == NULL) // do not throw exception in case of closurelibderivedfrom
  		{
  			deriv.from.Release();
***************
*** 1130,1137 ****
  
  	CComObjPtr<IMgaFCO> target;
- 	LookupByID(GetByName(attributes, "target"), target);
- 	if( target == NULL )
- 		throw pass_exception();
  
  
  	CComObjPtr<IMgaFCOs> coll;
--- 1137,1160 ----
  
  	CComObjPtr<IMgaFCO> target;
  
+ 	//LookupByID(GetByName(attributes, "target"), target);
+ 	const string *libtg = GetByNameX(attributes, "closurelibtarget");
+ 	if ( libtg != NULL)
+ 	{
+ 		CComObjPtr<IMgaObject> obj;
+ 		COMTHROW( project->get_ObjectByPath( PutInBstr( *libtg), PutOut( obj)) );
+ 		if ( obj)
+ 			COMTHROW( obj.QueryInterface( target));
+ 	}
+ 
+ 	const string *tg = GetByNameX(attributes, "target");
+ 	if( tg != NULL && libtg == NULL) // valid info in target iff no closurelibtarget token
+ 	{
+ 		LookupByID( *tg, target);
+ 	}
+ 
+ 	// throw even if closurelibtarget present but not found the needed object
+ 	if ( target == NULL)
+ 		throw pass_exception();
  
  	CComObjPtr<IMgaFCOs> coll;
***************
*** 1209,1213 ****
  	else // by ZolMol
  	{
! 		s = GetByNameX(attributes, "libreferred");
  		if( s != NULL)
  		{
--- 1232,1236 ----
  	else // by ZolMol
  	{
! 		s = GetByNameX(attributes, "closurelibreferred");
  		if( s != NULL)
  		{
***************
*** 1387,1390 ****
--- 1410,1414 ----
  
  	if( !(GetByName(attributes, "isbound") == "yes") ) {
+ 		COMTHROW( mgaset->RemoveAll() ); //by ZolMol: if not bound then the members are different, remove the inherited members
  		slist< CComObjPtr<IMgaFCO> >::iterator i = members.begin();
  		while( i != members.end() )

Index: mga.dtd
===================================================================
RCS file: /var/lib/gme/GMESRC/GME/Parser/mga.dtd,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** mga.dtd	30 Jun 2004 17:50:47 -0000	1.7
--- mga.dtd	14 Jul 2004 19:30:15 -0000	1.8
***************
*** 45,49 ****
  	role		NMTOKEN		#IMPLIED
  	derivedfrom	IDREF		#IMPLIED
! 	libderivedfrom	CDATA		#IMPLIED
  	isinstance	(yes|no)	"no"
  	isprimary	(yes|no)	"yes"
--- 45,49 ----
  	role		NMTOKEN		#IMPLIED
  	derivedfrom	IDREF		#IMPLIED
! 	closurelibderivedfrom	CDATA		#IMPLIED
  	isinstance	(yes|no)	"no"
  	isprimary	(yes|no)	"yes"
***************
*** 58,62 ****
  	role		NMTOKEN		#IMPLIED
  	derivedfrom	IDREF		#IMPLIED
! 	libderivedfrom	CDATA		#IMPLIED
  	isinstance	(yes|no)	"no"
  	isprimary	(yes|no)	"yes"
--- 58,62 ----
  	role		NMTOKEN		#IMPLIED
  	derivedfrom	IDREF		#IMPLIED
! 	closurelibderivedfrom	CDATA		#IMPLIED
  	isinstance	(yes|no)	"no"
  	isprimary	(yes|no)	"yes"
***************
*** 70,78 ****
  	role		NMTOKEN		#IMPLIED
  	derivedfrom	IDREF		#IMPLIED
! 	libderivedfrom	CDATA		#IMPLIED
  	isinstance	(yes|no)	"no"
  	isprimary	(yes|no)	"yes"
  	referred	IDREF		#IMPLIED
! 	libreferred	CDATA		#IMPLIED
  	isbound		(yes|no)	"no"
  	relid		CDATA		#IMPLIED
--- 70,78 ----
  	role		NMTOKEN		#IMPLIED
  	derivedfrom	IDREF		#IMPLIED
! 	closurelibderivedfrom	CDATA		#IMPLIED
  	isinstance	(yes|no)	"no"
  	isprimary	(yes|no)	"yes"
  	referred	IDREF		#IMPLIED
! 	closurelibreferred	CDATA		#IMPLIED
  	isbound		(yes|no)	"no"
  	relid		CDATA		#IMPLIED
***************
*** 85,89 ****
  	role		NMTOKEN		#IMPLIED
  	derivedfrom	IDREF		#IMPLIED
! 	libderivedfrom	CDATA		#IMPLIED
  	isinstance	(yes|no)	"no"
  	isprimary	(yes|no)	"yes"
--- 85,89 ----
  	role		NMTOKEN		#IMPLIED
  	derivedfrom	IDREF		#IMPLIED
! 	closurelibderivedfrom	CDATA		#IMPLIED
  	isinstance	(yes|no)	"no"
  	isprimary	(yes|no)	"yes"
***************
*** 99,103 ****
  	role		NMTOKEN		#IMPLIED
  	derivedfrom	IDREF		#IMPLIED
! 	libderivedfrom	CDATA		#IMPLIED
  	isinstance	(yes|no)	"no"
  	isprimary	(yes|no)	"yes"
--- 99,103 ----
  	role		NMTOKEN		#IMPLIED
  	derivedfrom	IDREF		#IMPLIED
! 	closurelibderivedfrom	CDATA		#IMPLIED
  	isinstance	(yes|no)	"no"
  	isprimary	(yes|no)	"yes"
***************
*** 109,112 ****
--- 109,113 ----
  <!ATTLIST connpoint
  	role		NMTOKEN		#REQUIRED
+ 	closurelibtarget	CDATA		#IMPLIED
  	target		IDREF		#REQUIRED
  	refs		IDREFS		#IMPLIED



More information about the GME-commit mailing list