[commit] r2289 - trunk/GME/Parser

GMESRC Repository Notifications gme-commit at list.isis.vanderbilt.edu
Thu Aug 15 10:57:20 CDT 2013


Author: ksmyth
Date: Thu Aug 15 10:57:20 2013
New Revision: 2289

Log:
Parser: parse with GUIDs only, no id-...

Added:
   trunk/GME/Parser/mga2.dtd
Modified:
   trunk/GME/Parser/GenParser.cpp
   trunk/GME/Parser/MgaParser.cpp
   trunk/GME/Parser/Parser.rc

Modified: trunk/GME/Parser/GenParser.cpp
==============================================================================
--- trunk/GME/Parser/GenParser.cpp	Thu Aug 15 10:56:57 2013	(r2288)
+++ trunk/GME/Parser/GenParser.cpp	Thu Aug 15 10:57:20 2013	(r2289)
@@ -96,13 +96,14 @@
 		HRSRC res = FindResource(hm, syssid.c_str(), _T("DTD"));
 		if(res) {
 			XMLByte *bytes = (XMLByte *)LockResource(LoadResource(hm, res));
-			if(!bytes) COMTHROW(E_INVALID_DTD); 
+			if (!bytes)
+				COMTHROW(E_INVALID_DTD);
 			return new MemBufInputSource(bytes, SizeofResource(hm, res), syssid.c_str());
 		}
 
 		
-		TCHAR filename[200];
-		int a = GetModuleFileName(hm, filename, 200);
+		TCHAR filename[MAX_PATH];
+		int a = GetModuleFileName(hm, filename, MAX_PATH);
 		a -= 10;
 		if( a <= 0 )
 			break;

Modified: trunk/GME/Parser/MgaParser.cpp
==============================================================================
--- trunk/GME/Parser/MgaParser.cpp	Thu Aug 15 10:56:57 2013	(r2288)
+++ trunk/GME/Parser/MgaParser.cpp	Thu Aug 15 10:57:20 2013	(r2289)
@@ -620,7 +620,10 @@
 		if( (*i).first == _T("id") )
 		{
 			RegisterLookup((*i).second, object);
-			//break;
+		}
+		else if( (*i).first == _T("guid") )
+		{
+			RegisterLookup((*i).second, object);
 		}
 		else if( m_maintainGuids && (*i).first == _T("guid"))
 		{
@@ -1084,7 +1087,14 @@
 
 	LookupByID(*s, deriv.from);
 	if( deriv.from == NULL )
-		throw pass_exception(std::wstring(L"Subtype/instance ") + *GetByNameX(attributes, _T("id")) + L" cannot find archetype " + *s);
+	{
+		const std::tstring* name = GetByNameX(attributes, _T("id"));
+		if (name == NULL)
+		{
+			name = GetByNameX(attributes, _T("guid"));
+		}
+		throw pass_exception(std::wstring(L"Subtype/instance ") + *name + L" cannot find archetype " + *s);
+	}
 
 	s = GetByNameX(attributes, _T("isinstance"));
 	deriv.isinstance = ( s != NULL && *s == _T("yes") ) ? VARIANT_TRUE : VARIANT_FALSE;

Modified: trunk/GME/Parser/Parser.rc
==============================================================================
--- trunk/GME/Parser/Parser.rc	Thu Aug 15 10:56:57 2013	(r2288)
+++ trunk/GME/Parser/Parser.rc	Thu Aug 15 10:57:20 2013	(r2289)
@@ -107,6 +107,7 @@
 
 EDF.DTD                 DTD     DISCARDABLE     "edf.dtd"
 MGA.DTD                 DTD     DISCARDABLE     "mga.dtd"
+MGA2.DTD                 DTD     DISCARDABLE     "mga2.dtd"
 
 /////////////////////////////////////////////////////////////////////////////
 //

Added: trunk/GME/Parser/mga2.dtd
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ trunk/GME/Parser/mga2.dtd	Thu Aug 15 10:57:20 2013	(r2289)
@@ -0,0 +1,128 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!ENTITY lt     "&#38;#60;">
+<!ENTITY gt     "&#62;">
+<!ENTITY amp    "&#38;#38;">
+<!ENTITY apos   "&#39;"> 
+<!ENTITY quot   "&#34;">
+
+<!ELEMENT project (name, comment?, author?, folder)>
+<!ATTLIST project
+	version		CDATA		#IMPLIED
+	guid		CDATA		#IMPLIED
+	cdate		CDATA		#IMPLIED
+	mdate		CDATA		#IMPLIED
+	metaversion	CDATA		#IMPLIED
+	metaguid	CDATA		#IMPLIED
+	metaname	CDATA		#REQUIRED
+>
+
+<!ELEMENT name (#PCDATA)>
+<!ELEMENT comment (#PCDATA)>
+<!ELEMENT author (#PCDATA)>
+<!ELEMENT value (#PCDATA)>
+
+<!ELEMENT constraint (name, value)>
+
+<!ELEMENT regnode (value, regnode*)>
+<!ATTLIST regnode
+	name		CDATA		#REQUIRED
+	status		(inherited|meta|undefined) #IMPLIED
+	isopaque	(yes|no)	"no"
+>
+
+<!ELEMENT folder (name, (regnode|constraint|folder|model|atom|reference|set|connection)*)>
+<!ATTLIST folder
+	id			ID			#IMPLIED
+	kind		NMTOKEN		#REQUIRED
+	relid		CDATA		#IMPLIED
+	childrelidcntr	CDATA	#IMPLIED
+	libref		CDATA		#IMPLIED
+	perm 		CDATA		#IMPLIED
+	guid		CDATA		#IMPLIED
+>
+
+<!ELEMENT model (name, (regnode|constraint|attribute|model|atom|reference|set|connection)*)>
+<!ATTLIST model
+	id			ID			#IMPLIED
+	kind		NMTOKEN		#REQUIRED
+	role		NMTOKEN		#IMPLIED
+	derivedfrom	CDATA		#IMPLIED
+	isinstance	(yes|no)	"no"
+	isprimary	(yes|no)	"yes"
+	relid		CDATA		#IMPLIED
+	childrelidcntr	CDATA		#IMPLIED
+	perm 		CDATA		#IMPLIED
+	guid		CDATA		#IMPLIED
+>
+
+<!ELEMENT atom (name, (regnode|constraint|attribute)*)>
+<!ATTLIST atom
+	id			ID			#IMPLIED
+	kind		NMTOKEN		#REQUIRED
+	role		NMTOKEN		#IMPLIED
+	derivedfrom	CDATA		#IMPLIED
+	isinstance	(yes|no)	"no"
+	isprimary	(yes|no)	"yes"
+	relid		CDATA		#IMPLIED
+	perm 		CDATA		#IMPLIED
+	guid		CDATA		#IMPLIED
+>
+
+<!ELEMENT reference (name, (regnode|constraint|attribute)*)>
+<!ATTLIST reference
+	id			ID			#IMPLIED
+	kind		NMTOKEN		#REQUIRED
+	role		NMTOKEN		#IMPLIED
+	derivedfrom	CDATA		#IMPLIED
+	isinstance	(yes|no)	"no"
+	isprimary	(yes|no)	"yes"
+	referred	CDATA		#IMPLIED
+	isbound		(yes|no)	"no"
+	relid		CDATA		#IMPLIED
+	perm 		CDATA		#IMPLIED
+	guid		CDATA		#IMPLIED
+>
+
+<!ELEMENT set (name, (regnode|constraint|attribute)*)>
+<!ATTLIST set
+	id			ID			#IMPLIED
+	kind		NMTOKEN		#REQUIRED
+	role		NMTOKEN		#IMPLIED
+	derivedfrom	CDATA		#IMPLIED
+	isinstance	(yes|no)	"no"
+	isprimary	(yes|no)	"yes"
+	members		CDATA		#IMPLIED
+	isbound		(yes|no)	"no"
+	relid		CDATA		#IMPLIED
+	perm 		CDATA		#IMPLIED
+	guid		CDATA		#IMPLIED
+>
+
+<!ELEMENT connection (name?, (regnode|constraint|connpoint|attribute)*)>
+<!ATTLIST connection
+	id			ID			#IMPLIED
+	kind		NMTOKEN		#REQUIRED
+	role		NMTOKEN		#IMPLIED
+	derivedfrom	CDATA		#IMPLIED
+	isinstance	(yes|no)	"no"
+	isprimary	(yes|no)	"yes"
+	isbound		(yes|no)	"no"
+	relid		CDATA		#IMPLIED
+	perm 		CDATA		#IMPLIED
+	guid		CDATA		#IMPLIED
+>
+
+<!ELEMENT connpoint EMPTY>
+<!ATTLIST connpoint
+	role		NMTOKEN		#REQUIRED
+	target		CDATA		#REQUIRED
+	refs		CDATA		#IMPLIED
+	isbound		(yes|no)	"no"
+>
+
+<!ELEMENT attribute (value, regnode*)>
+<!ATTLIST attribute
+	kind		NMTOKEN		#REQUIRED
+	status		(inherited|meta) #IMPLIED
+>


More information about the gme-commit mailing list