[GME-commit] GMESRC/Paradigms/MetaGME/MetaInterpreter2008 CompIcon.ico, NONE, 1.1 Component.rc, NONE, 1.1 ComponentConfig.h, NONE, 1.1 Console.cpp, NONE, 1.1 Console.h, NONE, 1.1 Engine.cpp, NONE, 1.1 Globals.h, NONE, 1.1 LogStream.cpp, NONE, 1.1 LogStream.h, NONE, 1.1 MetaGME8.vcproj, NONE, 1.1 RawComponent.cpp, NONE, 1.1 RawComponent.h, NONE, 1.1 Regexp.cpp, NONE, 1.1 Regexp.h, NONE, 1.1 Resource.h, NONE, 1.1 StdAfx.cpp, NONE, 1.1 StdAfx.h, NONE, 1.1 component.def, NONE, 1.1 entity.h, NONE, 1.1 iconDN.ico, NONE, 1.1 iconUP.ico, NONE, 1.1 logger.cpp, NONE, 1.1 logger.h, NONE, 1.1 myutil.cpp, NONE, 1.1 myutil.h, NONE, 1.1 relation.cpp, NONE, 1.1 relation.h, NONE, 1.1 token.cpp, NONE, 1.1 token.h, NONE, 1.1
Log messages of CVS commits
gme-commit at list.isis.vanderbilt.edu
Wed Mar 12 12:48:44 CDT 2008
- Previous message: [GME-commit] GMESRC/Paradigms/MetaGME MetaGME.sln,1.5,1.6
- Next message: [GME-commit] GMESRC/Paradigms/MetaGME/MetaInterpreter2008/asp AspectPage.cpp, NONE, 1.1 AspectPage.h, NONE, 1.1 AspectSpecDlg.cpp, NONE, 1.1 AspectSpecDlg.h, NONE, 1.1 AspectSpecTbl.cpp, NONE, 1.1 AspectSpecTbl.h, NONE, 1.1 EventsDial.cpp, NONE, 1.1 EventsDial.h, NONE, 1.1 GlobalAspOrder.cpp, NONE, 1.1 GlobalAspOrder.h, NONE, 1.1 InPlaceEdit.cpp, NONE, 1.1 InPlaceEdit.h, NONE, 1.1 InPlaceList.cpp, NONE, 1.1 InPlaceList.h, NONE, 1.1 NameSpecDlg.cpp, NONE, 1.1 NameSpecDlg.h, NONE, 1.1 NameSpecTbl.cpp, NONE, 1.1 NameSpecTbl.h, NONE, 1.1 Options.cpp, NONE, 1.1 options.h, NONE, 1.1
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /project/gme-repository/GMESRC/Paradigms/MetaGME/MetaInterpreter2008
In directory escher:/tmp/cvs-serv813/MetaInterpreter2008
Added Files:
CompIcon.ico Component.rc ComponentConfig.h Console.cpp
Console.h Engine.cpp Globals.h LogStream.cpp LogStream.h
MetaGME8.vcproj RawComponent.cpp RawComponent.h Regexp.cpp
Regexp.h Resource.h StdAfx.cpp StdAfx.h component.def entity.h
iconDN.ico iconUP.ico logger.cpp logger.h myutil.cpp myutil.h
relation.cpp relation.h token.cpp token.h
Log Message:
MetaInterpreter2008 is a RawComponent, a faster alternative to MetaInterprter2004.
CVS User: Zoltan Molnar, ISIS (zolmol)
--- NEW FILE: Regexp.cpp ---
// Win32 porting notes.
#if defined( _MBCS )
#pragma message( __FILEINFO__ "This code is broken under _MBCS, " \
"see the comments at the top of this file." )
#endif //_MBCS
//
//
// In case this isn't obvious from the later comments this is an ALTERED
// version of the software. If you like my changes then cool, but nearly
// all of the functionality here is derived from Henry Spencer's original
// work.
//
// This code should work correctly under both _SBCS and _UNICODE, I did
// start working on making it work with _MBCS but gave up after a while
// since I don't need this particular port and it's not going to be as
// straight forward as the other two.
//
// The problem stems from the compiled program being stored as TCHARS,
[...1702 lines suppressed...]
}
szReplace.ReleaseBuffer( replacelen );
return szReplace;
}
CString Regexp::GetErrorString() const
{
// make sure that if status == 0 that we have an error string
ASSERT( ( ! CompiledOK() ) ? ( rc ? rc->GetErrorString() : m_szError).GetLength() != 0 : 1 );
return rc ? rc->GetErrorString() : m_szError ;
}
void Regexp::ClearErrorString() const
{
if ( rc )
rc->ClearErrorString();
m_szError.Empty();
}
--- NEW FILE: myutil.cpp ---
#pragma once
#include "stdafx.h"
#include <string>
#include "ComponentLib.h"
#include "GMECOM.h"
#include "Console.h"
//interface IMgaFCO;
//interface IMgaFolder;
//interface IMgaProject;
namespace Util
{
CComBSTR Copy( const std::string& str )
{
return ( str.empty() ) ? CComBSTR() : CComBSTR( str.c_str() );
}
std::string Copy( const CComBSTR& bstr )
{
CString str( bstr );
std::string strResult( str.GetBuffer( str.GetLength() ) );
str.ReleaseBuffer();
return strResult;
}
std::string CopyV( const CComVariant& v)
{
if (v.vt != (VT_UI1 | VT_ARRAY) ||
v.parray == NULL ||
v.parray->cbElements != 1 ||
v.parray->cDims != 1 ||
v.parray->rgsabound[0].cElements != sizeof(GUID))
{
ASSERT( 0);
return "";
}
GUID guid;
unsigned char *start = (unsigned char*)&guid;
unsigned char *end = (unsigned char*)(&guid+1);
const unsigned char *q = NULL;
COMTHROW( SafeArrayAccessData(v.parray, (void**)&q) );
if (q == NULL ) {
ASSERT( 0);
return "";
}
memcpy( start, q, (end - start) * sizeof(unsigned char) );
COMTHROW( SafeArrayUnaccessData(v.parray) );
wchar_t *guidstr = NULL;
COMTHROW(StringFromCLSID(guid,&guidstr));
std::string result = Util::Copy( guidstr );
CoTaskMemFree(guidstr);
return result;
}
std::string gvbp( IMgaRegNode* p_rn, const std::string& p_path)
{
ASSERT( p_path.substr( 0, 1) != "/");
try
{
CComBSTR rv;
CComPtr<IMgaRegNode> subn;
COMTHROW( p_rn->get_SubNodeByName( Util::Copy( p_path), &subn));
COMTHROW( subn->get_Value( &rv));
return Util::Copy( rv);
}
catch(...)
{
ASSERT( 0);
Console::ssendMsg( "Failed with gvbp() with path " + p_path, MSG_ERROR);
throw;
}
}
void svbp( IMgaRegNode* p_rn, const std::string& p_path, const std::string& p_value)
{
ASSERT( p_path.substr( 0, 1) != "/");
try
{
CComPtr<IMgaRegNode> subn;
COMTHROW( p_rn->get_SubNodeByName( Util::Copy( p_path), &subn));
COMTHROW( subn->put_Value( Util::Copy( p_value)));
}
catch(...)
{
ASSERT( 0);
Console::ssendMsg( "Failed with svbp() with path " + p_path, MSG_ERROR);
throw;
}
}
std::string getReg( IMgaFolder* ptr, const std::string& p_path)
{
ASSERT( p_path.substr( 0, 1) != "/");
try {
CComBSTR val;
COMTHROW( ptr->get_RegistryValue( Copy( p_path), &val));
return Copy( val);
}
catch(...)
{
ASSERT( 0);
Console::ssendMsg( "Failed with getReg() with path " + p_path, MSG_ERROR);
throw;
}
}
std::string getReg( IMgaFCO* ptr, const std::string& p_path)
{
ASSERT( p_path.substr( 0, 1) != "/");
try {
CComBSTR val;
COMTHROW( ptr->get_RegistryValue( Copy( p_path), &val));
return Copy( val);
}
catch(...)
{
ASSERT( 0);
Console::ssendMsg( "Failed with getReg() with path " + p_path, MSG_ERROR);
throw;
}
}
void setReg( IMgaFCO* ptr, const std::string& p_path, const std::string& p_value)
{
ASSERT( p_path.substr( 0, 1) != "/");
try {
COMTHROW( ptr->put_RegistryValue( Copy( p_path), Copy( p_value)));
}
catch(...)
{
ASSERT( 0);
Console::ssendMsg( "Failed with getReg() with path " + p_path, MSG_ERROR);
throw;
}
}
bool islibobj( IMgaObject* p_ptr)
{
try
{
VARIANT_BOOL vb = VARIANT_FALSE;
if( p_ptr) COMTHROW( p_ptr->get_IsLibObject( &vb));
return vb == VARIANT_TRUE; // element's parent is in a library?
}
catch(...)
{
ASSERT( 0);
Console::ssendMsg( "Failed with isliboj()", MSG_ERROR);
throw;
}
}
bool isproxy( IMgaFCO* p_ptr)
{
try
{
CComPtr<IMgaMetaFCO> meta;
if( p_ptr) COMTHROW( p_ptr->get_Meta( &meta));
CComBSTR b_kind;
if( meta) COMTHROW( meta->get_Name( &b_kind));
std::string kind = Util::Copy( b_kind);
return kind.find( "Proxy") != std::string::npos;
}
catch(...)
{
ASSERT( 0);
Console::ssendMsg( "Failed with isproxy()", MSG_ERROR);
throw;
}
}
std::string name( IMgaObject* ptr)
{
try
{
CComBSTR nm;
if( ptr) COMTHROW( ptr->get_Name( &nm));
return Util::Copy( nm);
}
catch(...)
{
ASSERT( 0);
Console::ssendMsg( "Failed with name()", MSG_ERROR);
throw;
}
}
std::string name( IMgaFCO* ptr)
{
try
{
CComBSTR nm;
if( ptr) COMTHROW( ptr->get_Name( &nm));
return Util::Copy( nm);
}
catch(...)
{
ASSERT( 0);
Console::ssendMsg( "Failed with name()", MSG_ERROR);
throw;
}
}
std::string kind( IMgaObject* p_ptr)
{
try
{
CComPtr<IMgaMetaBase> meta;
if( p_ptr) COMTHROW( p_ptr->get_MetaBase( &meta));
CComBSTR b_kind;
if( meta) COMTHROW( meta->get_Name( &b_kind));
return Util::Copy( b_kind);
}
catch(...)
{
ASSERT( 0);
Console::ssendMsg( "Failed with kind()", MSG_ERROR);
throw;
}
}
std::string getStrAttr( IMgaFCO* p_ptr, const std::string& p_attrName)
{
try
{
CComBSTR val;
COMTHROW( p_ptr->get_StrAttrByName( Copy( p_attrName), &val));
return Util::Copy( val);
}
catch(...)
{
ASSERT( 0);
Console::ssendMsg( "Failed with getStrAttr with attr " + p_attrName + " on " + Util::name( p_ptr), MSG_ERROR);
throw;
}
}
bool getBoolAttr( IMgaFCO* p_ptr, const std::string& p_attrName)
{
try
{
VARIANT_BOOL vb;
COMTHROW( p_ptr->get_BoolAttrByName( Copy( p_attrName), &vb));
return vb == VARIANT_TRUE;
}
catch(...)
{
ASSERT( 0);
Console::ssendMsg( "Failed with getBoolAttr with attr " + p_attrName + " on " + Util::name( p_ptr), MSG_ERROR);
throw;
}
}
long getLongAttr( IMgaFCO* p_ptr, const std::string& p_attrName)
{
try
{
long val;
COMTHROW( p_ptr->get_IntAttrByName( Copy( p_attrName), &val));
return val;
}
catch(...)
{
ASSERT( 0);
Console::ssendMsg( "Failed with getLongAttr with attr " + p_attrName + " on " + Util::name( p_ptr), MSG_ERROR);
throw;
}
}
IMgaAttribute* getAttrib( IMgaFCO* p_fco, const std::string& p_attrName)
{
CComBSTR attr_name = Util::Copy( p_attrName);
CComPtr<IMgaAttribute> found_attr = 0;
CComPtr<IMgaMetaAttribute> found_meta_attr = 0;
// property Status of definition: 0: here, -1: in meta, >=1: inherited, -2: undefined")]
CComPtr<IMgaAttributes> attrs;
COMTHROW( p_fco->get_Attributes( &attrs));
long c = 0;
if( attrs) COMTHROW( attrs->get_Count( &c));
for( long i = 1; i <= c; ++i)
{
CComPtr<IMgaAttribute> item;
COMTHROW( attrs->get_Item( i, &item));
CComPtr<IMgaMetaAttribute> meta_attr;
if( item) COMTHROW( item->get_Meta( &meta_attr));
CComBSTR nm;
if( meta_attr) COMTHROW( meta_attr->get_Name( &nm));
if( attr_name == nm)
{
found_attr = item;
found_meta_attr = meta_attr;
break;
}
}
return found_attr;
}
bool isAttrStatHere( IMgaFCO* p_fco, const std::string& p_attrName)
{
try
{
CComBSTR attr_name = Util::Copy( p_attrName);
CComPtr<IMgaAttribute> found_attr = 0;
CComPtr<IMgaMetaAttribute> found_meta_attr = 0;
// property Status of definition: 0: here, -1: in meta, >=1: inherited, -2: undefined")]
CComPtr<IMgaAttributes> attrs;
COMTHROW( p_fco->get_Attributes( &attrs));
long c = 0;
if( attrs) COMTHROW( attrs->get_Count( &c));
for( long i = 1; i <= c; ++i)
{
CComPtr<IMgaAttribute> item;
COMTHROW( attrs->get_Item( i, &item));
CComPtr<IMgaMetaAttribute> meta_attr;
if( item) COMTHROW( item->get_Meta( &meta_attr));
CComBSTR nm;
if( meta_attr) COMTHROW( meta_attr->get_Name( &nm));
if( attr_name == nm)
{
found_attr = item;
found_meta_attr = meta_attr;
break;
}
}
ASSERT( found_attr);
if( !found_attr)
return false;
long stat = -2;
COMTHROW( found_attr->get_Status( &stat));
return stat >= 0;
}
catch(...)
{
ASSERT( 0);
Console::ssendMsg( "Failed in isAttrStatHere with attribute " + p_attrName + " on " + Util::name( p_fco), MSG_ERROR);
throw;
}
}
std::string composePath( IMgaObject * ptr, bool p_upUntilFolders) // should produce an output like: SF/OutputSignal
{
CComPtr<IMgaObject> cur = ptr;
try
{
std::string path;
while( cur)
{
if( !path.empty())
path.insert( 0, '/');
std::string nm = Util::name( cur);
path.insert( 0, nm.c_str());
CComPtr<IMgaObject> parent;
objtype_enum ot;
COMTHROW( cur->GetParent( &parent, &ot));
cur = parent;
if( p_upUntilFolders && ot == OBJTYPE_FOLDER)
cur = 0;
}
return path;
}
catch(...)
{
ASSERT( 0);
Console::ssendMsg( "Failed with composePath()", MSG_ERROR);
throw;
}
}
}
--- NEW FILE: CompIcon.ico ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: Engine.cpp ---
#include "stdafx.h"
#include "RawComponent.h"
#include "logger.h"
#include <string>
#include "Dumper.h"
#include "NameSpecDlg.h"
#include "globals.h"
extern Globals global_vars;
extern NameSpecDlg * dlg;
void RawComponent::entityBuilder( IMgaModel* model, IMgaFolder* parent)
{
CComPtr<IMgaFCOs> children;
COMTHROW( model->get_ChildFCOs( &children));
long c = 0;
if( children) COMTHROW( children->get_Count( &c));
[...1613 lines suppressed...]
{
if (rel_it1->getOperation() == Relation::HAS_ATTRIBUTE_OP &&
rel_it2->getOperation() == Relation::HAS_ATTRIBUTE_OP )
{
//CHECK if the same attribute is contained twice by the FCO
if ( rel_it1->getOp1() == rel_it2->getOp1()
&& rel_it1->getOp2() == rel_it2->getOp2()
&& rel_it1 != rel_it2)
{
ObjPointer o1 = rel_it1->getOp1();
ObjPointer o2 = rel_it1->getOp2();
global_vars.err << "Internal error: Same attribute " << Util::name( o2) <<
" contained twice by " << Util::name( o1) << "\n";
}
}
}
}
#endif
}
--- NEW FILE: iconUP.ico ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: MetaGME8.vcproj ---
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="7.10"
Name="MetaGME2008"
ProjectGUID="{98080516-B915-4681-8D08-102D4B4AA59E}"
SccProjectName=""
SccLocalPath=""
Keyword="AtlProj">
<Platforms>
<Platform
Name="Win32"/>
</Platforms>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory=".\Debug"
IntermediateDirectory=".\Debug"
ConfigurationType="2"
UseOfMFC="2"
ATLMinimizesCRunTimeLibraryUsage="FALSE"
CharacterSet="2">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="Asp,Rep,./,../../../sdk/BON/"
PreprocessorDefinitions="_DEBUG;WIN32;_WINDOWS;_USRDLL"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
RuntimeTypeInfo="TRUE"
UsePrecompiledHeader="3"
PrecompiledHeaderThrough="stdafx.h"
PrecompiledHeaderFile=".\Debug/MetaGME8Component.pch"
AssemblerListingLocation=".\Debug/"
ObjectFile=".\Debug/"
ProgramDataBaseFileName=".\Debug/"
BrowseInformation="1"
WarningLevel="3"
SuppressStartupBanner="TRUE"
DebugInformationFormat="4"/>
<Tool
Name="VCCustomBuildTool"
Description="Performing registration"
CommandLine="regsvr32 /s /c "$(TargetPath)"
echo regsvr32 exec. time > "$(OutDir)\regsvr32.trg"
"
Outputs="$(OutDir)\regsvr32.trg"/>
<Tool
Name="VCLinkerTool"
OutputFile=".\Debug/MetaInterpreter2008.dll"
LinkIncremental="1"
SuppressStartupBanner="TRUE"
ModuleDefinitionFile=".\Component.def"
GenerateDebugInformation="TRUE"
ProgramDatabaseFile=".\Debug/MetaInterpreter2008.pdb"
SubSystem="2"
ImportLibrary=".\Debug/MetaInterpreter2008.lib"
TargetMachine="1"/>
<Tool
Name="VCMIDLTool"
TypeLibraryName=".\Debug/MetaGME8Component.tlb"
HeaderFileName=""/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="_DEBUG"
Culture="1033"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory=".\Release"
IntermediateDirectory=".\Release"
ConfigurationType="2"
UseOfMFC="2"
UseOfATL="1"
ATLMinimizesCRunTimeLibraryUsage="FALSE"
CharacterSet="2">
<Tool
Name="VCCLCompilerTool"
Optimization="1"
InlineFunctionExpansion="1"
AdditionalIncludeDirectories="Asp,Rep,./,../../../sdk/BON/"
PreprocessorDefinitions="NDEBUG;WIN32;_WINDOWS;_USRDLL"
StringPooling="TRUE"
RuntimeLibrary="2"
EnableFunctionLevelLinking="TRUE"
RuntimeTypeInfo="TRUE"
UsePrecompiledHeader="3"
PrecompiledHeaderThrough="stdafx.h"
PrecompiledHeaderFile=".\Release/MetaGME8Component.pch"
AssemblerListingLocation=".\Release/"
ObjectFile=".\Release/"
ProgramDataBaseFileName=".\Release/"
WarningLevel="3"
SuppressStartupBanner="TRUE"/>
<Tool
Name="VCCustomBuildTool"
Description="Performing registration"
CommandLine="regsvr32 /s /c "$(TargetPath)"
echo regsvr32 exec. time > "$(OutDir)\regsvr32.trg"
"
Outputs="$(OutDir)\regsvr32.trg"/>
<Tool
Name="VCLinkerTool"
OutputFile=".\Release/MetaInterpreter2008.dll"
LinkIncremental="1"
SuppressStartupBanner="TRUE"
ModuleDefinitionFile=".\Component.def"
ProgramDatabaseFile=".\Release/MetaInterpreter2008.pdb"
SubSystem="2"
ImportLibrary=".\Release\MetaInterpreter2008.lib"
TargetMachine="1"/>
<Tool
Name="VCMIDLTool"
TypeLibraryName=".\Release/MetaGME8Component.tlb"
HeaderFileName=""/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="NDEBUG"
Culture="1033"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Source Files"
Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat">
<File
RelativePath="..\..\..\SDK\bon\ComHelp.cpp">
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
BasicRuntimeChecks="3"
UsePrecompiledHeader="3"
BrowseInformation="1"/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="1"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
BasicRuntimeChecks="0"
UsePrecompiledHeader="3"
BrowseInformation="0"/>
</FileConfiguration>
</File>
<File
RelativePath="Component.def">
</File>
<File
RelativePath="Component.rc">
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions=""
AdditionalIncludeDirectories="$(OUTDIR)"/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions=""
AdditionalIncludeDirectories="$(OUTDIR)"/>
</FileConfiguration>
</File>
<File
RelativePath="..\..\..\SDK\bon\ComponentDll.cpp">
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
BasicRuntimeChecks="3"
UsePrecompiledHeader="3"
BrowseInformation="1"/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="1"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
BasicRuntimeChecks="0"
UsePrecompiledHeader="3"
BrowseInformation="0"/>
</FileConfiguration>
</File>
<File
RelativePath="..\..\..\SDK\bon\ComponentLib.idl">
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCMIDLTool"
AdditionalIncludeDirectories="$(ProjectDir)"
TypeLibraryName="$(OutDir)/ComponentLib.tlb"/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCMIDLTool"
AdditionalIncludeDirectories="$(ProjectDir)"
TypeLibraryName="$(OutDir)/ComponentLib.tlb"/>
</FileConfiguration>
</File>
<File
RelativePath="..\..\..\SDK\bon\ComponentObj.cpp">
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
BasicRuntimeChecks="3"
UsePrecompiledHeader="3"
BrowseInformation="1"/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="1"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
BasicRuntimeChecks="0"
UsePrecompiledHeader="3"
BrowseInformation="0"/>
</FileConfiguration>
</File>
<File
RelativePath=".\Console.cpp">
</File>
<File
RelativePath=".\Engine.cpp">
</File>
<File
RelativePath=".\logger.cpp">
</File>
<File
RelativePath=".\LogStream.cpp">
</File>
<File
RelativePath=".\myutil.cpp">
</File>
<File
RelativePath="RawComponent.cpp">
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
PreprocessorDefinitions=""
BasicRuntimeChecks="3"
BrowseInformation="1"/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="1"
PreprocessorDefinitions=""/>
</FileConfiguration>
</File>
<File
RelativePath=".\Regexp.cpp">
</File>
<File
RelativePath=".\relation.cpp">
</File>
<File
RelativePath="StdAfx.cpp">
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
PreprocessorDefinitions=""
BasicRuntimeChecks="3"
UsePrecompiledHeader="1"
BrowseInformation="1"/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="1"
PreprocessorDefinitions=""
UsePrecompiledHeader="1"/>
</FileConfiguration>
</File>
<File
RelativePath=".\token.cpp">
</File>
</Filter>
<Filter
Name="Header Files"
Filter="h;hpp;hxx;hm;inl">
<File
RelativePath="..\..\..\SDK\bon\ComHelp.h">
</File>
<File
RelativePath="ComponentConfig.h">
</File>
<File
RelativePath="..\..\..\SDK\bon\ComponentDll.h">
</File>
<File
RelativePath="..\..\..\SDK\bon\ComponentObj.h">
</File>
<File
RelativePath=".\Console.h">
</File>
<File
RelativePath=".\entity.h">
</File>
<File
RelativePath=".\Globals.h">
</File>
<File
RelativePath="..\..\..\SDK\bon\GMECOM.h">
</File>
<File
RelativePath=".\logger.h">
</File>
<File
RelativePath=".\LogStream.h">
</File>
<File
RelativePath=".\myutil.h">
</File>
<File
RelativePath="RawComponent.h">
</File>
<File
RelativePath=".\Regexp.h">
</File>
<File
RelativePath=".\relation.h">
</File>
<File
RelativePath="Resource.h">
</File>
<File
RelativePath="StdAfx.h">
</File>
<File
RelativePath=".\token.h">
</File>
</Filter>
<Filter
Name="Resource Files"
Filter="ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe">
</Filter>
<Filter
Name="Rep"
Filter="">
<File
RelativePath=".\Rep\Any.cpp">
</File>
<File
RelativePath=".\Rep\Any.h">
</File>
<File
RelativePath=".\Rep\AspectRep.cpp">
</File>
<File
RelativePath=".\Rep\AspectRep.h">
</File>
<File
RelativePath=".\Rep\AtomRep.cpp">
</File>
<File
RelativePath=".\Rep\AtomRep.h">
</File>
<File
RelativePath=".\Rep\AttributeRep.cpp">
</File>
<File
RelativePath=".\Rep\AttributeRep.h">
</File>
<File
RelativePath=".\Rep\Broker.cpp">
</File>
<File
RelativePath=".\Rep\Broker.h">
</File>
<File
RelativePath=".\Rep\ConnectionRep.cpp">
</File>
<File
RelativePath=".\Rep\ConnectionRep.h">
</File>
<File
RelativePath=".\Rep\ConnJoint.cpp">
</File>
<File
RelativePath=".\Rep\ConnJoint.h">
</File>
<File
RelativePath=".\Rep\ConstraintFuncRep.cpp">
</File>
<File
RelativePath=".\Rep\ConstraintFuncRep.h">
</File>
<File
RelativePath=".\Rep\ConstraintRep.cpp">
</File>
<File
RelativePath=".\Rep\ConstraintRep.h">
</File>
<File
RelativePath=".\Rep\Dumper.cpp">
</File>
<File
RelativePath=".\Rep\Dumper.h">
</File>
<File
RelativePath=".\Rep\FCO.cpp">
</File>
<File
RelativePath=".\Rep\FCO.h">
</File>
<File
RelativePath=".\Rep\FcoRep.h">
</File>
<File
RelativePath=".\Rep\FolderRep.cpp">
</File>
<File
RelativePath=".\Rep\FolderRep.h">
</File>
<File
RelativePath=".\Rep\ModelRep.cpp">
</File>
<File
RelativePath=".\Rep\ModelRep.h">
</File>
<File
RelativePath=".\Rep\PartRep.h">
</File>
<File
RelativePath=".\Rep\PointerItem.cpp">
</File>
<File
RelativePath=".\Rep\PointerItem.h">
</File>
<File
RelativePath=".\Rep\ReferenceRep.cpp">
</File>
<File
RelativePath=".\Rep\ReferenceRep.h">
</File>
<File
RelativePath=".\Rep\RoleRep.cpp">
</File>
<File
RelativePath=".\Rep\RoleRep.h">
</File>
<File
RelativePath=".\Rep\RootFolder.cpp">
</File>
<File
RelativePath=".\Rep\RootFolder.h">
</File>
<File
RelativePath=".\Rep\SetRep.cpp">
</File>
<File
RelativePath=".\Rep\SetRep.h">
</File>
<File
RelativePath=".\Rep\Sheet.cpp">
</File>
<File
RelativePath=".\Rep\Sheet.h">
</File>
</Filter>
<Filter
Name="Asp"
Filter="">
<File
RelativePath=".\Asp\AspectPage.cpp">
</File>
<File
RelativePath=".\Asp\AspectPage.h">
</File>
<File
RelativePath=".\Asp\AspectSpecDlg.cpp">
</File>
<File
RelativePath=".\Asp\AspectSpecDlg.h">
</File>
<File
RelativePath=".\Asp\AspectSpecTbl.cpp">
</File>
<File
RelativePath=".\Asp\AspectSpecTbl.h">
</File>
<File
RelativePath=".\Asp\EventsDial.cpp">
</File>
<File
RelativePath=".\Asp\EventsDial.h">
</File>
<File
RelativePath=".\Asp\GlobalAspOrder.cpp">
</File>
<File
RelativePath=".\Asp\GlobalAspOrder.h">
</File>
<File
RelativePath=".\Asp\InPlaceEdit.cpp">
</File>
<File
RelativePath=".\Asp\InPlaceEdit.h">
</File>
<File
RelativePath=".\Asp\InPlaceList.cpp">
</File>
<File
RelativePath=".\Asp\InPlaceList.h">
</File>
<File
RelativePath=".\Asp\NameSpecDlg.cpp">
</File>
<File
RelativePath=".\Asp\NameSpecDlg.h">
</File>
<File
RelativePath=".\Asp\NameSpecTbl.cpp">
</File>
<File
RelativePath=".\Asp\NameSpecTbl.h">
</File>
<File
RelativePath=".\Asp\Options.cpp">
</File>
<File
RelativePath=".\Asp\options.h">
</File>
</Filter>
<File
RelativePath="ConfigureComponent.exe">
</File>
</Files>
<Globals>
</Globals>
</VisualStudioProject>
--- NEW FILE: relation.h ---
#ifndef RELATION_H
#define RELATION_H
#include "string"
#include "Myutil.h"
class Relation
{
public:
// basic relations
static const std::string containment_str;//"Containment"
static const std::string folder_containment_str;//"FolderContainment"
static const std::string set_membership_str;//"SetMembership"
static const std::string refer_to_str;//"ReferTo"
static const std::string has_aspect_str;//"HasAspect"
static const std::string aspect_member_str;//"AspectMember"
static const std::string has_constraint_str;//"HasConstraint"
static const std::string has_attribute_str;//"HasAttribute"
// complex relations
static const std::string connector_str;//("Connector");
static const std::string connector_src;//("SourceToConnector");
static const std::string connector_dst;//("ConnectorToDestination");
static const std::string connector_descr;//("AssociationClass");
static const std::string equivalence_str;//("Equivalence");
static const std::string equivalence_right;//("EquivRight");
static const std::string equivalence_left;//("EquivLeft");
static const std::string inheritance_str;//("Inheritance");
static const std::string inheritance_base;//("BaseInheritance");
static const std::string inheritance_derived;//("DerivedInheritance");
static const std::string int_inheritance_str;//("InterfaceInheritance");
static const std::string int_inheritance_base;//("BaseIntInheritance");
static const std::string int_inheritance_derived;//("DerivedIntInheritance");
static const std::string imp_inheritance_str;//("ImplementationInheritance");
static const std::string imp_inheritance_base;//("BaseImpInheritance");
static const std::string imp_inheritance_derived;//("DerivedImpInheritance");
static const std::string same_folder_str;//("SameFolder");
static const std::string same_folder_right;//("SameFolderRight");
static const std::string same_folder_left;//("SameFolderLeft");
static const std::string same_aspect_str;//("SameAspect");
static const std::string same_aspect_right;//("SameAspectRight");
static const std::string same_aspect_left;//("SameAspectLeft");
typedef enum
{
// connections which make direct relationship
CONTAINMENT_OP,
FOLDER_CONTAINMENT_OP,
SET_MEMBER_OP,
REFER_TO_OP,
HAS_ASPECT_OP,
ASPECT_MEMBER_OP,
HAS_CONSTRAINT_OP,
HAS_ATTRIBUTE_OP,
// connections which establish indirect relationship
ASSOCIATION_OP, // replaces CONNECTOR
EQUIVALENCE_OP, // replaces EquivLeft, EquivRight // elim
INHERITANCE_OP,
INT_INHERITANCE_OP,
IMP_INHERITANCE_OP,
SAME_FOLDER_OP, // elim
SAME_ASPECT_OP // elim
} OPER_TYPE;
inline std::string getOperationStr() const {
const std::string strings[] = {
"CONTAINMENT_OP",
"FOLDER_CONTAINMENT_OP",
"SET_MEMBER_OP",
"REFER_TO_OP",
"HAS_ASPECT_OP",
"ASPECT_MEMBER_OP",
"HAS_CONSTRAINT_OP",
"HAS_ATTRIBUTE_OP",
"ASSOCIATION_OP",
"EQUIVALENCE_OP",
"INHERITANCE_OP",
"INT_INHERITANCE_OP",
"IMP_INHERITANCE_OP",
"SAME_FOLDER_OP",
"SAME_ASPECT_OP"
};
return strings[m_operation];
}
inline OPER_TYPE getOperation() { return m_operation; }
inline IMgaFCO* getOp1() { return m_operand1; }
inline IMgaFCO* getOp2() { return m_operand2; }
inline IMgaFCO* getOp3() { return m_operand3; }
inline IMgaFCO* getOp4() { return m_operand4; }
inline IMgaFCO* getOp5() { return m_operand5; }
inline void setOperation( OPER_TYPE oper_t) { m_operation = oper_t; }
inline void setOp1(IMgaFCO* op_1) { m_operand1 = op_1; }
inline void setOp2(IMgaFCO* op_2) { m_operand2 = op_2; }
inline void setOp3(IMgaFCO* op_3) { m_operand3 = op_3; }
inline void setOp4(IMgaFCO* op_4) { m_operand4 = op_4; }
inline void setOp5(IMgaFCO* op_5) { m_operand5 = op_5; }
explicit Relation(
OPER_TYPE oper_t,
IMgaFCO* operd1 = (IMgaFCO*)0,
IMgaFCO* operd2 = (IMgaFCO*)0,
IMgaFCO* operd3 = (IMgaFCO*)0,
IMgaFCO* operd4 = (IMgaFCO*)0,
IMgaFCO* operd5 = (IMgaFCO*)0)
: m_operation( oper_t),
m_operand1( operd1),
m_operand2( operd2),
m_operand3( operd3),
m_operand4( operd4),
m_operand5( operd5) { };
~Relation() { }
Relation( const Relation & operand):
m_operation( operand.m_operation),
m_operand1( operand.m_operand1),
m_operand2( operand.m_operand2),
m_operand3( operand.m_operand3),
m_operand4( operand.m_operand4),
m_operand5( operand.m_operand5) { };
const Relation & operator=(const Relation & operand)
{
if ( this == &operand) return *this;
m_operation = operand.m_operation;
m_operand1 = operand.m_operand1;
m_operand2 = operand.m_operand2;
m_operand3 = operand.m_operand3;
m_operand4 = operand.m_operand4;
m_operand5 = operand.m_operand5;
return *this;
}
bool operator==( const Relation& peer)
{
return (m_operation==peer.m_operation) &&
(m_operand1 == peer.m_operand1) &&
(m_operand2 == peer.m_operand2) &&
(m_operand3 == peer.m_operand3) &&
(m_operand4 == peer.m_operand4) &&
(m_operand5 == peer.m_operand5);
}
bool operator<( const Relation& peer) const
{
if ( m_operation != peer.m_operation) return m_operation < peer.m_operation;
int k;
k = Util::name( m_operand1).compare( Util::name( peer.m_operand1));
if( k != 0) return k < 0;
k = Util::name( m_operand2).compare( Util::name( peer.m_operand2));
if( k != 0) return k < 0;
k = Util::name( m_operand3).compare( Util::name( peer.m_operand3));
return ( k < 0);
}
private:
OPER_TYPE m_operation;
IMgaFCO* m_operand1;
IMgaFCO* m_operand2;
IMgaFCO* m_operand3;
IMgaFCO* m_operand4;
IMgaFCO* m_operand5;
};
#endif //RELATION_H
--- NEW FILE: iconDN.ico ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: LogStream.h ---
#ifndef LOGSTREAM_H
#define LOGSTREAM_H
#include <fstream>
#include <string>
#include "MyUtil.h"
class LogStream : public std::ofstream
{
public:
LogStream();
~LogStream();
void flushit();
// friend put-to operators
friend LogStream& operator<<( LogStream& s, msgtype_enum msgtype);
friend LogStream& operator<<( LogStream& s, IMgaFCO* fco);
friend LogStream& operator<<( LogStream& s, const char * r);
friend LogStream& operator<<( LogStream& s, const std::string& r);
friend LogStream& operator<<( LogStream& s, const int i);
CComPtr<IMgaProject> m_proj;
msgtype_enum m_msgtype;
std::string m_buff;
};
#endif //LOGSTREAM_H
--- NEW FILE: Console.h ---
#pragma once
#include "ComponentLib.h"
#include <string>
class Console
{
typedef CComPtr<IGMEOLEApp> GMEAppPtr;
GMEAppPtr m_gme;
public:
Console(void);
~Console(void);
GMEAppPtr getGME( IMgaProject* project);
void init( IMgaProject* project);
void sendMsg( const std::string& p_msg, msgtype_enum p_type);
static ssendMsg( const std::string& p_msg, msgtype_enum p_type);
};
--- NEW FILE: token.h ---
#ifndef TOKENIZER_H
#define TOKENIZER_H
#include "string"
#include "vector"
class Tokenizer
{
public:
void split( const std::string& source, const std::string& delimiter, std::vector< std::string> & strVec);
void trimLeft( std::string& s);
void trimRight( std::string& s);
void removeWSP( std::string& s);
};
#endif // TOKENIZER_H
--- NEW FILE: StdAfx.cpp ---
// stdafx.cpp : source file that includes just the standard includes
// stdafx.pch will be the pre-compiled header
// stdafx.obj will contain the pre-compiled type information
#include "stdafx.h"
#ifdef _ATL_STATIC_REGISTRY
#include <statreg.h>
#if _ATL_VER < 0x0700
#include <statreg.cpp>
#endif // _ATL_VER < 0x0700
#endif // _ATL_STATIC_REGISTRY
#if _ATL_VER < 0x0700
#include <atlimpl.cpp>
#endif // _ATL_VER < 0x0700
--- NEW FILE: StdAfx.h ---
// stdafx.h : include file for standard system include files,
// or project specific include files that are used frequently,
// but are changed infrequently
#if !defined(AFX_STDAFX_H__C4EFDDFC_C095_4509_B571_632F0986D162__INCLUDED_)
#define AFX_STDAFX_H__C4EFDDFC_C095_4509_B571_632F0986D162__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#define STRICT
#ifndef _WIN32_WINNT
#define _WIN32_WINNT 0x0400
#endif
#define _ATL_APARTMENT_THREADED
#include <afxwin.h>
#include <afxdisp.h>
#include <atlbase.h>
//You may derive a class from CComModule and use it if you want to override
//something, but do not change the name of _Module
extern CComModule _Module;
#include <atlcom.h>
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_STDAFX_H__C4EFDDFC_C095_4509_B571_632F0986D162__INCLUDED)
--- NEW FILE: Regexp.h ---
#ifndef __REGEXP_H__
#define __REGEXP_H__
//class CString;
class regexp;
class Regexp
{
public:
enum { NSUBEXP = 10 };
Regexp();
Regexp( LPCTSTR exp, BOOL iCase = 0 );
Regexp( const Regexp &r );
~Regexp();
const Regexp & operator=( const Regexp & r );
bool Match( const TCHAR * s );
int SubStrings() const;
const CString operator[]( unsigned int i ) const;
int SubStart( unsigned int i ) const;
int SubLength( unsigned int i ) const;
CString GetReplaceString( LPCTSTR source ) const;
CString GetErrorString() const;
bool CompiledOK() const;
#if defined( _RE_DEBUG )
void Dump();
#endif
private:
const TCHAR * string; /* used to return substring offsets only */
mutable CString m_szError;
regexp * rc;
void ClearErrorString() const;
int safeIndex( unsigned int i ) const;
};
#endif
--- NEW FILE: token.cpp ---
#include "stdafx.h"
#include "token.h"
void Tokenizer::split( const std::string& source, const std::string& delimiter, std::vector< std::string> & result)
{
if ( delimiter.length() <= 0) return;
unsigned int curr_token_start = 0;
unsigned int curr_token_end = source.find( delimiter, curr_token_start);
while ( curr_token_end != std::string::npos) // more delimiters found
{
if ( curr_token_end - curr_token_start > 0) // not inserting empty token
result.push_back( source.substr( curr_token_start, curr_token_end - curr_token_start));
curr_token_start = curr_token_end + delimiter.length();
curr_token_end = source.find( delimiter, curr_token_start);
}
if ( curr_token_end == std::string::npos && source.length() - curr_token_start > 0 ) // no more delimiters found and we don't insert empty token
result.push_back( source.substr( curr_token_start, source.length() - curr_token_start));
}
void Tokenizer::trimLeft( std::string& s)
{
if ( s.empty()) return;
int i = 0;
while( i < (int) s.length() &&
( s[i] == _T(' ')
|| s[i] == _T('\t')
|| s[i] == _T('\n')))
++i;
//if ( i < (int) s.length())
s.erase(0, i);
}
void Tokenizer::trimRight( std::string& s)
{
if ( s.empty()) return;
int i = (int) s.length() - 1;
while( i >= 0 &&
( s[i] == _T(' ')
|| s[i] == _T('\t')
|| s[i] == _T('\n')))
--i;
//if ( i >= 0)
s.erase(i + 1, s.length() - i - 1);
}
void Tokenizer::removeWSP( std::string& s)
{
if ( s.empty()) return;
std::string r;
for( int i = 0; i < (int) s.length(); ++i)
if ( s[i] != _T(' ')
&& s[i] != _T('\t')
&& s[i] != _T('\n'))
r += s[i];
s = r;
}
--- NEW FILE: logger.cpp ---
#include "stdafx.h"
#include "logger.h"
#include "string"
#include "fstream"
#include "globals.h"
extern Globals global_vars;
extern int ind;
--- NEW FILE: ComponentConfig.h ---
// Component configuration file automatically generated as ComponentConfig.h
// by ConfigureComponent on Fri Mar 07 12:33:25 2008
#define RAWCOMPONENT
// COM UUID-s, names and progID
#define TYPELIB_UUID "C2B6CFE3-0E84-4176-B308-9C94C7E16708"
#define TYPELIB_NAME "MGA Interpreter TypeLibrary (MetaGME8)"
#define COCLASS_UUID "57E3786B-04C4-41E1-8AFE-4DF5BE12DBB6"
#define COCLASS_NAME "MGA Interpreter CoClass (MetaGME8)"
#define COCLASS_PROGID "MGA.Interpreter.MetaGME8"
// This name will appear in the popup window for interpreter selection.
#define COMPONENT_NAME "MetaGME8"
// This text will appear in the toolbar icon tooltip and in the menu.
#define TOOLTIP_TEXT "MetaGME8 Interpreter"
// This #define determines the interpreter type:
#define GME_INTERPRETER
// The name of the paradigm(s). The GME will use this component
// for this paradigm. Separate the names of paradigms by commas.
#define PARADIGMS "MetaGME"
// This is the location of the GME interfaces file (Mga.idl, Meta.idl, etc)
#define GME_BASE ../../../GME
// not defined:
#define BON_ICON_SUPPORT
// not defined: #define BON_CUSTOM_TRANSACTIONS
// not defined: #define REGISTER_SYSTEMWIDE
// Just to please the whims of those Microsoft jerks:
#define COCLASS_UUID_EXPLODED1 0x57E3786B
#define COCLASS_UUID_EXPLODED2 0x04C4
#define COCLASS_UUID_EXPLODED3 0x41E1
#define COCLASS_UUID_EXPLODED4 0x8A
#define COCLASS_UUID_EXPLODED5 0xFE
#define COCLASS_UUID_EXPLODED6 0x4D
#define COCLASS_UUID_EXPLODED7 0xF5
#define COCLASS_UUID_EXPLODED8 0xBE
#define COCLASS_UUID_EXPLODED9 0x12
#define COCLASS_UUID_EXPLODED10 0xDB
#define COCLASS_UUID_EXPLODED11 0xB6
--- NEW FILE: RawComponent.cpp ---
///////////////////////////////////////////////////////////////////////////
// RawComponent.cpp, the main RAW COM component implementation file
// This is the file (along with its header RawComponent.h)
// that the component implementor is expected to modify in the first place
//
///////////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "ComHelp.h"
#include "GMECOM.h"
#include <ComponentConfig.h>
#include "RawComponent.h"
#include "logger.h"
#include <string>
#include "Dumper.h"
#include "NameSpecDlg.h"
#include "globals.h"
Globals global_vars;
NameSpecDlg * dlg;
// this method is called after all the generic initialization is done
// this should be empty, unless application-specific initialization is needed
STDMETHODIMP RawComponent::Initialize(struct IMgaProject *) {
return S_OK;
}
void RawComponent::finalize()
{
m_entities.clear();
m_relations.clear();
m_equivRelations.clear();
//m_toBeDeletedEntities.clear();
m_equivBag.clear();
m_realObj.clear();
Sheet::m_BON_Project_Root_Folder = NULL; // crucial!!!
if ( m_sheet != 0)
{
TO( "Internal error: Merged Paradigm Sheet object still exists.");
delete m_sheet;
m_sheet = 0;
}
}
void RawComponent::scanSubModels( IMgaModel* model)
{
CComPtr<IMgaFCOs> children;
COMTHROW( model->get_ChildFCOs( &children));
long c = 0;
if( children) COMTHROW( children->get_Count( &c));
for( long i = 1; i <= c; ++i)
{
CComPtr<IMgaFCO> ch;
COMTHROW( children->get_Item( i, &ch));
CComQIPtr<IMgaModel> mch( ch); // model child?
if( mch) scanSubModels( mch);
}
}
void RawComponent::scanModels( IMgaModel* model, IMgaFolder* parent)
{
scanSubModels( model);
entityBuilder( model, parent);
}
void RawComponent::scanSubFolders( IMgaFolders* subfolders, CComPtr<IMgaFolders>& result)
{
if( !subfolders) return;
if( !result) return;
// result->Append( subfolders);
long c = 0;
COMTHROW( subfolders->get_Count( &c));
CComPtr<IMgaFolder> ch;
for( long i = 1; i <= c; ++i)
{
COMTHROW( subfolders->get_Item( i, &ch));
result->Append( ch);
CComPtr<IMgaFolders> childfolders;
COMTHROW( ch->get_ChildFolders( &childfolders));
scanSubFolders( childfolders, result);
}
}
void RawComponent::scanProject( IMgaProject* project)
{
try
{
CComPtr<IMgaFolder> rf;
COMTHROW( project->get_RootFolder( &rf));
Sheet::m_BON_Project_Root_Folder = rf;
CComPtr<IMgaFolders> folders;
folders.CoCreateInstance( L"Mga.MgaFolders");
COMTHROW( folders->Append( rf)); // including root folder
CComPtr<IMgaFolders> subfolders;
COMTHROW( rf->get_ChildFolders( &subfolders)); // scan folders (libraries are included also)
// folders->AppendAll( subfolders);
long c = 0;
if( subfolders) COMTHROW( subfolders->get_Count( &c));
CComPtr<IMgaFolder> ch;
for( long i = 1; i <= c; ++i)
{
COMTHROW( subfolders->get_Item( i, &ch));
COMTHROW( folders->Append( ch));
}
long d = 0;
if( folders) COMTHROW( folders->get_Count( &d));
for( long i = 1; i <= d; ++i)
{
CComPtr<IMgaFolder> ch;
COMTHROW( folders->get_Item( i, &ch));
CComPtr<IMgaFCOs> chfcos;
if( ch) COMTHROW( ch->get_ChildFCOs( &chfcos));
long e = 0;
if( chfcos) COMTHROW( chfcos->get_Count( &e));
for( long j = 1; j <= e; ++j)
{
CComPtr<IMgaFCO> inner_ch;
COMTHROW( chfcos->get_Item( j, &inner_ch));
CComQIPtr<IMgaModel> chmod( inner_ch);
if( chmod) scanModels( chmod, ch); // scan all root models
}
}
}
catch(...)
{
global_vars.err << MSG_ERROR << "Exception thrown during project scanning.\n";
}
}
void RawComponent::initMembers( IMgaProject* project)
{
CComBSTR nm;
COMTHROW( project->get_Name( &nm));
m_projectName = Util::Copy( nm);
m_dir = "";
if ( global_vars.silent_mode)
{
CComBSTR connString;
COMTHROW( project->get_ProjectConnStr(&connString));
std::string path = Util::Copy( connString);
int e = path.rfind('\\');
if( e != std::string::npos && path.substr(0, 4) == "MGA=") m_dir = path.substr(4, e-3); // cut leading "MGA=" , preserve tailing '\\'
}
m_entities.clear();
//m_toBeDeletedEntities.clear();
m_relations.clear();
m_equivRelations.clear();
m_realObj.clear();
m_sheet = 0;
}
void RawComponent::createSheet()
{
//
//TODO : create your own Sheet instance (should be a derived class from the Sheet)
// store the pointer in the m_sheet member
m_sheet = Dumper::getInstance();
}
bool RawComponent::populateSheet( IMgaProject* project )
{
m_sheet->setProject( project );
bool error = false;
Entity_Iterator it_1( m_entities.begin());
Any * new_elem = 0;
for( ; it_1 != m_entities.end(); ++it_1 )
{
if ( it_1->isDeleted()) continue;
IMgaFCO* fco( it_1->getPointer());
IMgaFCO* resp( it_1->getRespPointer());
IMgaFolder* parent_folder( it_1->getParentFolder());
IMgaFolder* orig_parent_folder( parent_folder);
if( Util::islibobj( parent_folder)) // element's parent is in a library?
{
// This means we face a nested library, whose rootfolder is also
// write protected, meaning that it's registry can't be written.
// We will use the main rootfolder instead
CComPtr<IMgaFolder> rf;
COMTHROW( project->get_RootFolder( &rf));
parent_folder = rf;
}
if ( !fco) global_vars.err << MSG_ERROR << "Populate sheet: tries to create Rep with empty FCO.\n";
else
{
new_elem = 0;
std::string stereotype = Util::kind( fco);
if ( stereotype == "FCO" )
new_elem = m_sheet->createFcoRep( fco, resp);
else if ( stereotype == "Atom" )
new_elem = m_sheet->createAtomRep( fco, resp);
else if ( stereotype == "Model" )
new_elem = m_sheet->createModelRep( fco, resp);
else if ( stereotype == "Connection" )
new_elem = m_sheet->createConnectionRep( fco, resp);
else if ( stereotype == "Set" )
new_elem = m_sheet->createSetRep( fco, resp);
else if ( stereotype == "Reference" )
new_elem = m_sheet->createReferenceRep( fco, resp);
else if ( stereotype == "Folder" )
new_elem = m_sheet->createFolderRep( fco, resp);//(resp != BON::FCO())?resp:fco);
else if ( stereotype == "Aspect" )
new_elem = m_sheet->createAspectRep( fco, resp);//(resp != BON::FCO())?resp:fco);
else if ( stereotype == "Constraint" )
new_elem = m_sheet->createConstraintRep( fco);
else if ( stereotype == "ConstraintFunc" )
new_elem = m_sheet->createConstraintFuncRep( fco);
else if ( stereotype == "BooleanAttribute" )
new_elem = m_sheet->createBoolAttributeRep( fco);
else if ( stereotype == "EnumAttribute" )
new_elem = m_sheet->createEnumAttributeRep( fco);
else if ( stereotype == "FieldAttribute" )
new_elem = m_sheet->createFieldAttributeRep( fco);
else
{
global_vars.err << MSG_ERROR << "Not inserted into the sheet: " << fco << " of kind: " << Util::kind( fco) << "\n";
error = true;
}
if (new_elem)
{
new_elem->setParentFolder( parent_folder, orig_parent_folder);
if ( m_equivBag.find( fco) != m_equivBag.end())
{
new_elem->setEquivPeers( m_equivBag[ fco]);
new_elem->setDisplayedName( it_1->getDispName());
}
}
}
} // for m_entities
if (error)
{
global_vars.err << MSG_ERROR << "Internal error during creation of entities. Exiting\n";
return false;
}
Relation_Iterator rel_it = m_relations.begin();
for( ; rel_it != m_relations.end(); ++rel_it)
{
Relation::OPER_TYPE oper = rel_it->getOperation();
if ( oper == Relation::INHERITANCE_OP ||
oper == Relation::INT_INHERITANCE_OP ||
oper == Relation::IMP_INHERITANCE_OP)
inheritancesManager( *rel_it);
else if ( oper == Relation::ASSOCIATION_OP)
associationClassManager( *rel_it);
else if ( oper == Relation::REFER_TO_OP)
refersToManager( *rel_it);
else if ( oper == Relation::SET_MEMBER_OP)
setMemberManager( *rel_it);
else if ( oper == Relation::CONTAINMENT_OP)
containmentManager( *rel_it);
else if ( oper == Relation::FOLDER_CONTAINMENT_OP)
folderContainmentManager( *rel_it);
else if ( oper == Relation::HAS_ASPECT_OP)
hasAspectManager( *rel_it);
else if ( oper == Relation::ASPECT_MEMBER_OP)
aspectMemberManager( *rel_it);
else if ( oper == Relation::HAS_CONSTRAINT_OP)
hasConstraintManager( *rel_it);
else if ( oper == Relation::HAS_ATTRIBUTE_OP)
hasAttributeManager( *rel_it);
}
if (error)
{
global_vars.err << MSG_ERROR << "Internal error during the relation establishment. Exiting\n";
return false;
}
return true;
}
bool RawComponent::executeSheet()
{
bool success = false;
try
{
//CRUCIAL step: the role names may be short or long form
success = m_sheet->finalize();
if (success)
success = m_sheet->build();
else
global_vars.err << MSG_ERROR << "Internal error: Sheet::finalize() returned with error\n";
}
catch( std::string exc_str)
{
global_vars.err << MSG_ERROR << "Something went wrong in executeSheet. Msg: " << exc_str << "\n";
success = false;
}
catch(...)
{
global_vars.err << MSG_ERROR << "Something went wrong in executeSheet\n";
success = false;
}
return success;
}
void RawComponent::deleteSheet()
{
if ( m_sheet) delete m_sheet;
m_sheet = 0;
}
// ====================================================
// This is the main component method for Interpereters and Plugins.
// May also be used in case of invokeable Add-Ons
// this is the obsolete component interface
// this present implementation either tries to call InvokeEx, or returns an error;
STDMETHODIMP RawComponent::Invoke(IMgaProject* gme, IMgaFCOs *models, long param) {
#ifdef SUPPORT_OLD_INVOKE
CComPtr<IMgaFCO> focus;
CComVariant parval = param;
return InvokeEx(gme, focus, selected, parvar);
#else
if(interactive) {
AfxMessageBox("This component does not support the obsolete invoke mechanism");
}
return E_MGA_NOT_SUPPORTED;
#endif
}
// This is the main component method for interpereters and plugins.
// May als be used in case of invokeable addons
STDMETHODIMP RawComponent::InvokeEx( IMgaProject *project, IMgaFCO *currentobj, IMgaFCOs *selectedobjs, long param)
{
COMTRY {
if(interactive) {
CComBSTR projname;
CComBSTR focusname = "<nothing>";
CComPtr<IMgaTerritory> terr;
COMTHROW(project->CreateTerritory(NULL, &terr));
COMTHROW(project->BeginTransaction(terr));
try
{
invokeEx( project, currentobj, selectedobjs, param);
finalize();
COMTHROW(project->CommitTransaction());
}
catch(...) {
finalize();
project->AbortTransaction();
throw;
}
}
} COMCATCH(;);
}
void RawComponent::invokeEx( IMgaProject *project, IMgaFCO *currentobj, IMgaFCOs *selectedobjs, long param)
{
// ======================
// Insert application specific code here
global_vars.silent_mode = (param == GME_SILENT_MODE);
//global_vars.silent_mode = true;
initMembers( project);
std::string temp;
if ( !Sheet::makeValidParadigmName( m_projectName, temp))
{
if( !global_vars.silent_mode)
{
m_console.sendMsg("[MetaInterpreter] Invalid or empty paradigm name (Rootfolder name). Please remove spaces and the special characters, except '.' and '_'. Using: \"" + temp + "\".", MSG_ERROR);
CString msg = "Invalid or empty paradigm name: \"";
msg += (m_projectName + "\". Continue using: \"" + temp + "\"?").c_str();
if( AfxMessageBox( (LPCTSTR)msg, MB_YESNO | MB_ICONWARNING) != IDYES)
{
m_console.sendMsg("[MetaInterpreter] Intepretation stopped by the user.", MSG_NORMAL);
return;
}
}
}
if ( Dumper::selectOutputFiles( project, m_projectName, m_dir) > 1)
{
if( !global_vars.silent_mode) m_console.sendMsg("[MetaInterpreter] Output file name selection cancelled by the user or other file operation failed.", MSG_NORMAL);
return;
}
Dumper::selectOptions( project);
global_vars.err.m_proj = project;
CWaitCursor wait;
CTime theTime = CTime::GetCurrentTime();
CString s = theTime.Format("%#c");
s = "METAINTERPRETER LOG STARTED " + s;
// don't create file output anymore
//global_vars.err.open( global_vars.err_file_name.c_str(), std::ios_base::out);
global_vars.err << MSG_NORMAL << std::string( s.GetLength(), '=') << "\n";
global_vars.err << (LPCTSTR) s << "\n";
global_vars.err << MSG_NORMAL << std::string( s.GetLength(), '=') << "\n";
try {
scanProject( project);
CHECK();
m_entities.sort();
m_equivRelations.sort(); // tries to ensure the same order of handling the equivalences
selectFromSameAspectsFolders(); // selects names for the equivalent objects (designates the nameresp pointers)
proxyFinder(); // replaces proxies with the real objects
equivalenceFinder(); // merges the equivalent objects (the relations they are part of)
removeProxiesAndEquiv();
bool cont = nameSelector();
while ( !checkForProxies()) { }
bool do_at_all = true;
if ( do_at_all)
{
if ( Sheet::checkInstance())
global_vars.err << MSG_ERROR << "Internal error: merged paradigm sheet already exists\n";
global_vars.dmp.open( global_vars.xmp_file_name.c_str(), std::ios_base::out);
createSheet();
bool success = false;
try
{
success = populateSheet( project );
if ( success)
success = executeSheet();
else
global_vars.err << MSG_ERROR << "Internal error: PopulateSheet returned with error\n";
}
catch( std::string exc_str)
{
global_vars.err << MSG_ERROR << "Internal error: Exception caught during populate/execute. Msg: " << exc_str << "\n";
}
catch(...)
{
global_vars.err << MSG_ERROR << "Internal error: Exception caught during populate/execute.\n";
}
if ( !Sheet::checkInstance())
global_vars.err << MSG_ERROR << "Internal error: Merged Sheet object doesn't exist\n";
deleteSheet();
global_vars.dmp.close();
if (success)
Dumper::registerIt( global_vars.xmp_file_name);
}
else
global_vars.err << MSG_ERROR << "Exited before populating the Merged Paradigm Sheet. Proxy or other problem may exist.\n";
} catch (...)
{
global_vars.err << MSG_ERROR << "Internal error: Exception thrown by Component.\n";
deleteSheet();
}
if ( Sheet::checkInstance())
global_vars.err << MSG_ERROR << "Internal error: Merged Paradigm Sheet object still exists\n";
global_vars.err << MSG_NORMAL << "\nEND OF LOG\n";
// don't create file output anymore
//global_vars.err.flushit();
//global_vars.err.close();
global_vars.err.m_proj = CComPtr<IMgaProject>( 0);
long r = 0; // remove all items from safe
if( m_safe) COMTHROW( m_safe->get_Count( &r));
while( r > 0) COMTHROW( m_safe->Remove( r--));
}
// GME currently does not use this function
// you only need to implement it if other invokation mechanisms are used
STDMETHODIMP RawComponent::ObjectsInvokeEx( IMgaProject *project, IMgaObject *currentobj, IMgaObjects *selectedobjs, long param) {
if(interactive) {
AfxMessageBox("Tho ObjectsInvoke method is not implemented");
}
return E_MGA_NOT_SUPPORTED;
}
// implement application specific parameter-mechanism in these functions:
STDMETHODIMP RawComponent::get_ComponentParameter(BSTR name, VARIANT *pVal) {
return S_OK;
}
STDMETHODIMP RawComponent::put_ComponentParameter(BSTR name, VARIANT newVal) {
return S_OK;
}
#ifdef GME_ADDON
// these two functions are the main
STDMETHODIMP RawComponent::GlobalEvent(globalevent_enum event) {
if(event == GLOBALEVENT_UNDO) {
AfxMessageBox("UNDO!!");
}
return S_OK;
}
STDMETHODIMP RawComponent::ObjectEvent(IMgaObject * obj, unsigned long eventmask, VARIANT v) {
if(eventmask & OBJEVENT_CREATED) {
CComBSTR objID;
COMTHROW(obj->get_ID(&objID));
AfxMessageBox( "Object created! ObjID: " + CString(objID));
}
return S_OK;
}
#endif
--- NEW FILE: RawComponent.h ---
#ifndef RAWCOMPONENT_H
#define RAWCOMPONENT_H
// Declaration of the main RAW COM component interface class
#ifdef BUILDER_OBJECT_NETWORK
#error This file should only be included in the RAW COM configurations
#endif
#include <string>
#include <list>
#include <map>
#include <algorithm>
#include "entity.h"
#include "relation.h"
#include "Console.h"
#include "FCO.h"
#include "Sheet.h"
class RawComponent {
////////////////////
// Insert your application specific member and method definitions here
public:
RawComponent() { ; }
private:
void finalize();
void invokeEx( IMgaProject *project, IMgaFCO *currentobj, IMgaFCOs *selectedobjs, long param);
Console m_console;
private:
typedef std::list< Entity > Entities;
typedef Entities::iterator Entity_Iterator;
typedef Entities::const_iterator Entity_Const_Iterator;
typedef std::list< Relation > Relations;
typedef Relations::iterator Relation_Iterator;
typedef Relations::const_iterator Relation_Const_Iterator;
typedef CComPtr<IMgaFCO> ObjPointer;
//typedef IMgaFCO* ObjPointer;
typedef std::map< ObjPointer, ObjPointer> RealMap;
typedef std::map< ObjPointer, ObjPointer>::iterator RealMap_Iterator;
typedef std::map< ObjPointer, std::set < ObjPointer > > EquivBag;
typedef std::map< ObjPointer, std::set < ObjPointer > >::iterator EquivBag_Iterator;
CComPtr<IMgaObjects> m_safe;
private: // members
std::string m_projectName;
std::string m_dir; // stores the directory names the interpreter has been invoked with
Entities m_entities;
//Entities m_toBeDeletedEntities;
Relations m_relations;
Relations m_equivRelations;
RealMap m_realObj;
EquivBag m_equivBag;
private: // methods
void initMembers( IMgaProject* project);
void scanProject( IMgaProject* project);
void scanModels( IMgaModel* model, IMgaFolder* parent);
void scanSubModels( IMgaModel* model);
void scanSubFolders( IMgaFolders* folders, CComPtr<IMgaFolders>& result);
void entityBuilder( IMgaModel* model, IMgaFolder* parent);
void selectFromSameAspectsFolders();
void storeEntity( const Entity& p);
void storeRelation( Relation& p);
void storeEquivRelation( Relation& p);
void proxyFinder();
void equivalenceFinder();
void removeProxiesAndEquiv();
bool nameSelector();
int isProxy( const ObjPointer& ptr);
void operandSearchAndReplace( const std::vector<ObjPointer>& proxy_obj, const ObjPointer& real_obj);
void operandSearchAndReplace( const ObjPointer& proxy_obj, const ObjPointer& real_obj);
void insertIntoEquivBag( const ObjPointer& obj1, const ObjPointer& obj2);
void markEquivEntities();
Entity entitySearch( const ObjPointer& p_ptr);
bool checkForProxies();
void CHECK();
private:
Sheet * m_sheet;
void createSheet(); // TODO: modify this method to create your specific object
bool populateSheet( IMgaProject* project );
bool executeSheet();
void deleteSheet();
void inheritancesManager( Relation & );
void refersToManager( Relation & );
void associationClassManager( Relation & );
void setMemberManager( Relation & );
void containmentManager( Relation & );
void folderContainmentManager( Relation & );
void hasAspectManager( Relation & );
void aspectMemberManager( Relation & );
void hasConstraintManager( Relation & );
void hasAttributeManager( Relation & );
// Try not to modify the code below this line
////////////////////
public:
#ifdef GME_ADDON
CComPtr<IMgaProject> project; // this is set before Initialize() is called
CComPtr<IMgaAddOn> addon; // this is set before Initialize() is called
#endif
bool interactive;
STDMETHODIMP Initialize(struct IMgaProject *);
STDMETHODIMP Invoke(IMgaProject* gme, IMgaFCOs *models, long param);
STDMETHODIMP InvokeEx( IMgaProject *project, IMgaFCO *currentobj, IMgaFCOs *selectedobjs, long param);
STDMETHODIMP ObjectsInvokeEx( IMgaProject *project, IMgaObject *currentobj, IMgaObjects *selectedobjs, long param);
STDMETHODIMP get_ComponentParameter(BSTR name, VARIANT *pVal);
STDMETHODIMP put_ComponentParameter(BSTR name, VARIANT newVal);
#ifdef GME_ADDON
STDMETHODIMP GlobalEvent(globalevent_enum event);
STDMETHODIMP ObjectEvent(IMgaObject * obj, unsigned long eventmask, VARIANT v);
#endif
};
#endif //RAWCOMPONENT_H
--- NEW FILE: Component.rc ---
// Microsoft Visual C++ generated resource script.
//
#include "resource.h"
#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 2 resource.
//
#include "afxres.h"
/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
// English (U.S.) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
#ifdef _WIN32
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
#pragma code_page(1252)
#endif //_WIN32
#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// TEXTINCLUDE
//
1 TEXTINCLUDE
BEGIN
"resource.h\0"
END
2 TEXTINCLUDE
BEGIN
"#include ""afxres.h""\r\n"
"\0"
END
3 TEXTINCLUDE
BEGIN
"1 TYPELIB ""ComponentLib.tlb""\r\n"
"\0"
END
#endif // APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Version
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION 1,0,0,1
PRODUCTVERSION 1,0,0,1
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
#else
FILEFLAGS 0x0L
#endif
FILEOS 0x4L
FILETYPE 0x2L
FILESUBTYPE 0x0L
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "040904B0"
BEGIN
VALUE "FileDescription", "Interpreter Module"
VALUE "FileVersion", "1, 0, 0, 1"
VALUE "InternalName", "Interpreter"
VALUE "LegalCopyright", "Copyright 2000"
VALUE "OriginalFilename", "Interpreter.DLL"
VALUE "ProductName", "Interpreter Module"
VALUE "ProductVersion", "1, 0, 0, 1"
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x409, 1200
END
END
/////////////////////////////////////////////////////////////////////////////
//
// Icon
//
// Icon with lowest ID value placed first to ensure application icon
// remains consistent on all systems.
IDI_ICONDN ICON "iconDN.ico"
IDI_COMPICON ICON "compicon.ico"
IDI_ICONUP ICON "iconUP.ico"
/////////////////////////////////////////////////////////////////////////////
//
// DESIGNINFO
//
#ifdef APSTUDIO_INVOKED
GUIDELINES DESIGNINFO
BEGIN
IDD_ASPECT_PAGE, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 300
TOPMARGIN, 7
BOTTOMMARGIN, 232
END
IDD_ASPECTORDER_DLG, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 162
TOPMARGIN, 7
BOTTOMMARGIN, 139
END
IDD_EQUIVDIALOG, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 324
TOPMARGIN, 7
BOTTOMMARGIN, 219
END
IDD_OPTIONS, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 237
TOPMARGIN, 7
BOTTOMMARGIN, 144
END
IDD_EVENTSDLG, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 295
TOPMARGIN, 7
BOTTOMMARGIN, 151
END
END
#endif // APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Dialog
//
IDD_ASPECT_PAGE DIALOG 0, 0, 307, 239
STYLE DS_SETFONT | WS_CHILD | WS_DISABLED | WS_CAPTION
FONT 8, "MS Sans Serif"
BEGIN
END
IDD_ASPECTORDER_DLG DIALOGEX 0, 0, 169, 146
STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Global Aspect Order Dialogue"
FONT 8, "MS Sans Serif", 0, 0, 0x1
BEGIN
DEFPUSHBUTTON "OK",IDOK,15,120,50,14
PUSHBUTTON "Use metamodel defaults",IDCANCEL,75,120,82,14
LISTBOX IDC_LIST3,16,20,110,85,LBS_NOINTEGRALHEIGHT | WS_VSCROLL |
WS_HSCROLL | WS_TABSTOP
PUSHBUTTON "Move Up",IDC_BUTTON1,137,36,16,13,BS_ICON | BS_CENTER |
BS_VCENTER,WS_EX_TRANSPARENT
PUSHBUTTON "Move Down",IDC_BUTTON2,137,75,16,13,BS_ICON | BS_CENTER |
BS_VCENTER,WS_EX_TRANSPARENT
LTEXT "Global aspect order",IDC_STATIC,16,10,94,8
END
IDD_EQUIVDIALOG DIALOGEX 0, 0, 331, 226
STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Name selection for equivalent objects"
FONT 8, "MS Sans Serif", 0, 0, 0x0
BEGIN
DEFPUSHBUTTON "OK",IDOK,74,205,50,14
PUSHBUTTON "Use metamodel defaults",IDCANCEL,173,205,89,14
CONTROL "Select the desired names and displayed names by clicking in the first or second column",
IDC_STATIC,"Static",SS_LEFTNOWORDWRAP | WS_GROUP,7,3,303,
8
END
IDD_OPTIONS DIALOG 0, 0, 244, 151
STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Options"
FONT 8, "MS Sans Serif"
BEGIN
GROUPBOX "Options for constraints generated from cardinalities",
IDC_STATIC,12,10,221,97
LTEXT "Check Containment On:",IDC_STATIC,21,27,94,8
EDITTEXT IDC_EDIT1,123,25,52,12,ES_AUTOHSCROLL
PUSHBUTTON "Events",IDC_BUTTON1,185,25,38,13
LTEXT "Check Folder Containment On:",IDC_STATIC,21,48,98,8
EDITTEXT IDC_EDIT2,123,46,52,12,ES_AUTOHSCROLL
PUSHBUTTON "Events",IDC_BUTTON2,185,46,37,13
LTEXT "Check Connections On:",IDC_STATIC,21,69,94,8
EDITTEXT IDC_EDIT3,123,67,52,12,ES_AUTOHSCROLL
PUSHBUTTON "Events",IDC_BUTTON3,185,67,38,13
LTEXT "Priority",IDC_STATIC,21,89,91,11
EDITTEXT IDC_EDIT4,123,87,30,12,ES_AUTOHSCROLL
CONTROL "Spin1",IDC_SPIN1,"msctls_updown32",UDS_SETBUDDYINT |
UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS,159,87,11,
12
CONTROL "Do not ask these any more",IDC_CHECK1,"Button",
BS_AUTOCHECKBOX | WS_TABSTOP,21,112,111,10
DEFPUSHBUTTON "OK",IDOK,53,129,50,14
PUSHBUTTON "Cancel",IDCANCEL,142,129,50,14
END
IDD_EVENTSDLG DIALOG 0, 0, 302, 158
STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Events"
FONT 8, "MS Sans Serif"
BEGIN
CONTROL "On create",IDC_CHECK1,"Button",BS_AUTOCHECKBOX |
WS_TABSTOP,9,9,123,10
CONTROL "On close model",IDC_CHECK15,"Button",BS_AUTOCHECKBOX |
WS_TABSTOP,168,9,123,10
CONTROL "On new child",IDC_CHECK5,"Button",BS_AUTOCHECKBOX |
WS_TABSTOP,9,24,123,10
CONTROL "On lost child",IDC_CHECK12,"Button",BS_AUTOCHECKBOX |
WS_TABSTOP,168,24,123,10
CONTROL "On delete",IDC_CHECK2,"Button",BS_AUTOCHECKBOX |
WS_TABSTOP,9,39,123,10
CONTROL "On move",IDC_CHECK11,"Button",BS_AUTOCHECKBOX |
WS_TABSTOP,168,39,123,10
CONTROL "On refer",IDC_CHECK13,"Button",BS_AUTOCHECKBOX |
WS_TABSTOP,9,54,123,10
CONTROL "On unreferred",IDC_CHECK18,"Button",BS_AUTOCHECKBOX |
WS_TABSTOP,168,54,123,10
CONTROL "On include in set",IDC_CHECK16,"Button",BS_AUTOCHECKBOX |
WS_TABSTOP,9,69,123,10
CONTROL "On exclude from set",IDC_CHECK19,"Button",
BS_AUTOCHECKBOX | WS_TABSTOP,168,69,123,10
CONTROL "On connect",IDC_CHECK14,"Button",BS_AUTOCHECKBOX |
WS_TABSTOP,9,84,123,10
CONTROL "On disconnect",IDC_CHECK17,"Button",BS_AUTOCHECKBOX |
WS_TABSTOP,168,84,123,10
CONTROL "On derive",IDC_CHECK8,"Button",BS_AUTOCHECKBOX |
WS_TABSTOP,9,99,123,10
CONTROL "On change association",IDC_CHECK6,"Button",
BS_AUTOCHECKBOX | WS_TABSTOP,168,99,123,10
CONTROL "On change property",IDC_CHECK7,"Button",BS_AUTOCHECKBOX |
WS_TABSTOP,9,114,123,10
CONTROL "On change attribute",IDC_CHECK3,"Button",
BS_AUTOCHECKBOX | WS_TABSTOP,168,114,123,10
DEFPUSHBUTTON "OK",IDOK,85,135,50,14
PUSHBUTTON "Cancel",IDCANCEL,162,135,50,14
END
/////////////////////////////////////////////////////////////////////////////
//
// String Table
//
STRINGTABLE
BEGIN
IDS_PROJNAME "Component"
END
#endif // English (U.S.) resources
/////////////////////////////////////////////////////////////////////////////
#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 3 resource.
//
1 TYPELIB "ComponentLib.tlb"
/////////////////////////////////////////////////////////////////////////////
#endif // not APSTUDIO_INVOKED
--- NEW FILE: LogStream.cpp ---
#include "stdafx.h"
#include "LogStream.h"
#include "MyUtil.h"
#include "Console.h"
#include "globals.h"
extern Globals global_vars;
LogStream::LogStream()
: m_proj( 0)
, m_msgtype( MSG_NORMAL)
, m_buff()
{ }
LogStream::~LogStream()
{
m_proj = 0;
m_buff = "";
}
void LogStream::flushit()
{
*this << "\n"; // flush
}
//
// friend put-to operators
LogStream& operator<<( LogStream& stream, msgtype_enum msgtype)
{
if( !stream.m_buff.empty()) stream << "\n"; // like a flush
stream.m_msgtype = msgtype;
/*switch( stream.m_msgtype) {
case MSG_ERROR: stream.write( "Error: ", 7); break;
case MSG_WARNING: stream.write( "Warning: ", 9); break;
case MSG_INFO: stream.write( "Info: ", 5); break;
case MSG_NORMAL: ;
}*/
return stream;
}
LogStream& operator<<( LogStream& stream, IMgaFCO* fco)
{
std::string tok = "<b>Null_object</b>";
if( fco)
{
try {
std::string id, nm;
CComBSTR b_id, b_nm;
COMTHROW( fco->get_ID( &b_id));
COMTHROW( fco->get_Name( &b_nm));
id = Util::Copy( b_id);
nm = Util::Copy( b_nm);
tok = "<A HREF=\"mga:" + id +"\">" + nm + "</A>";
} catch( ...) {
}
}
return stream << tok;
}
LogStream& operator<<( LogStream& stream, const char * r)
{
return stream << std::string( r);
}
LogStream& operator<<( LogStream& stream, const std::string& r)
{
//stream.write( r.c_str(), r.length()); // don't create file output anymore
stream.m_buff += r;
if( r.find('\n') != std::string::npos)
{
if( !global_vars.silent_mode) {
try { Console::ssendMsg( stream.m_buff, stream.m_msgtype); }
catch( ... ) { } // will throw if invoked without the Gui up&running
}
stream.m_buff = "";
}
return stream;
}
LogStream& operator<<( LogStream& stream, const int i)
{
char t[32];
sprintf( t, "%i", i);
return stream << std::string( t);
}
--- NEW FILE: Console.cpp ---
#include "stdafx.h"
#include ".\console.h"
#include "myUtil.h"
Console::Console(void)
: m_gme( 0)
{
}
Console::~Console(void)
{
m_gme = 0;
}
Console::GMEAppPtr Console::getGME( IMgaProject* project)
{
if (!m_gme) {
CComBSTR bstrName("GME.Application");
CComQIPtr<IMgaClient> pClient;
HRESULT hr = project->GetClientByName( bstrName, &pClient);
if (SUCCEEDED( hr) && pClient) {
CComQIPtr<IDispatch> pDispatch;
COMTHROW(pClient->get_OLEServer(&pDispatch));
if (pDispatch) {
COMTHROW(pDispatch.QueryInterface( &m_gme));
}
}
}
return m_gme;
}
void Console::init( IMgaProject* project)
{
m_gme = getGME( project);
}
void Console::sendMsg( const std::string& p_msg, msgtype_enum p_type)
{
if( m_gme)
m_gme->ConsoleMessage( Util::Copy( p_msg), p_type);
else
ssendMsg( p_msg, p_type);
}
//static
Console::ssendMsg( const std::string& p_msg, msgtype_enum p_type)
{
//GMEAppPtr p_gme = getGME( 0);
GMEAppPtr p;
p.CoCreateInstance( L"GME.Application");
p->ConsoleMessage( Util::Copy( p_msg), p_type);
}
--- NEW FILE: logger.h ---
#ifndef LOGGER_H
#define LOGGER_H
#include "string"
#include "fstream"
#include "globals.h"
extern int ind;
extern Globals global_vars;
#define DMP_DEBUG_INFO 0
inline void TOF(const char * msg)
{
#if(DMP_DEBUG_INFO)
std::string fname = global_vars.xmp_file_name + ".debug.log";//"c:\\atemp\\meta.log";
std::ofstream of;
of.open( fname.c_str(), std::ios_base::out | std::ios_base::app);
of << msg << "\n";
of.close();
#endif
}
inline void DMP(const char * msg)
{
global_vars.dmp << msg;
}
inline void ERR_OUT(const char * msg)
{
const char * fname = global_vars.err_file_name.c_str();
std::ofstream of;
of.open( fname, std::ios_base::out | std::ios_base::app);
of << msg << "\n";
of.close();
}
inline void TO(const char * msg)
{
global_vars.err << MSG_INFO << msg << "\n";
#if(0)
if ( global_vars.silent_mode)
ERR_OUT( msg);
else
AfxMessageBox(msg);
TOF(msg);
#endif
}
inline void DMP(const std::string& msg) { DMP( msg.c_str() ); }
inline void TO( const CString& msg) { TO( (LPCTSTR) msg); }
inline void TO( const std::string& msg) { TO( msg.c_str()); }
inline void TOF( const CString& msg) { TOF( (LPCTSTR) msg); }
inline void TOF( const std::string& msg) { TOF( msg.c_str() ); }
inline void ERR_OUT( const CString& msg) { ERR_OUT( (LPCTSTR) msg); }
inline void ERR_OUT( const std::string& msg) { ERR_OUT( msg.c_str() ); }
inline std::string indStr()
{
return std::string( ind, '\t');
}
#endif // LOGGER_H
--- NEW FILE: myutil.h ---
#pragma once
#include <string>
#include "ComponentLib.h"
#include "GMECOM.h"
//interface IMgaFCO;
//interface IMgaFolder;
//interface IMgaProject;
namespace Util
{
CComBSTR Copy( const std::string& str );
std::string Copy( const CComBSTR& bstr );
std::string CopyV( const CComVariant& pvar);
std::string gvbp( IMgaRegNode* p_rn, const std::string& p_path);
void svbp( IMgaRegNode* p_rn, const std::string& p_path, const std::string& p_value);
std::string getReg( IMgaFolder* ptr, const std::string& p_path);
std::string getReg( IMgaFCO* ptr, const std::string& p_path);
void setReg( IMgaFCO* ptr, const std::string& p_path, const std::string& p_value);
bool islibobj( IMgaObject* p_ptr);
bool isproxy( IMgaFCO* p_ptr);
std::string name( IMgaObject* ptr);
std::string name( IMgaFCO* ptr);
std::string kind( IMgaObject* p_ptr);
std::string getStrAttr( IMgaFCO* p_ptr, const std::string& p_attrName);
bool getBoolAttr( IMgaFCO* p_ptr, const std::string& p_attrName);
long getLongAttr( IMgaFCO* p_ptr, const std::string& p_attrName);
bool isAttrStatHere( IMgaFCO* p_fco, const std::string& p_attrName);
IMgaAttribute* getAttrib( IMgaFCO* p_fco, const std::string& p_attrName);
std::string composePath( IMgaObject * ptr, bool p_upUntilFolders = false); // SF/OutputSignal-24-Atom
}
--- NEW FILE: Globals.h ---
#ifndef GLOBALS_H
#define GLOBALS_H
#include "LogStream.h"
#include "fstream"
#include "string"
class Globals
{
public:
Globals()
: xmp_file_name("\\Paradigm.xmp")
, err_file_name("\\Paradigm.xmp.log")
, silent_mode ( false)
, genConstr()
{ }
LogStream err;
std::ofstream dmp;
std::string xmp_file_name;
std::string err_file_name;
bool silent_mode;
class GeneratedConstraints
{
public:
GeneratedConstraints( )
: reg_cont_mask( 0)
, fol_cont_mask( 0)
, connect_mask ( 0)
, priority ( 1)
{ }
int reg_cont_mask;
int fol_cont_mask;
int connect_mask;
int priority;
} genConstr;
};
#endif // GLOBALS_H
--- NEW FILE: relation.cpp ---
#include "stdafx.h"
#include "Relation.h"
const std::string Relation::containment_str("Containment");
const std::string Relation::folder_containment_str("FolderContainment");
const std::string Relation::set_membership_str("SetMembership");
const std::string Relation::refer_to_str("ReferTo");
const std::string Relation::has_aspect_str("HasAspect");
const std::string Relation::aspect_member_str("AspectMember");
const std::string Relation::has_constraint_str("HasConstraint");
const std::string Relation::has_attribute_str("HasAttribute");
const std::string Relation::connector_str("Connector");
const std::string Relation::connector_src("SourceToConnector");
const std::string Relation::connector_dst("ConnectorToDestination");
const std::string Relation::connector_descr("AssociationClass");
const std::string Relation::equivalence_str("Equivalence");
const std::string Relation::equivalence_right("EquivRight");
const std::string Relation::equivalence_left("EquivLeft");
const std::string Relation::inheritance_str("Inheritance");
const std::string Relation::inheritance_base("BaseInheritance");
const std::string Relation::inheritance_derived("DerivedInheritance");
const std::string Relation::int_inheritance_str("InterfaceInheritance");
const std::string Relation::int_inheritance_base("BaseIntInheritance");
const std::string Relation::int_inheritance_derived("DerivedIntInheritance");
const std::string Relation::imp_inheritance_str("ImplementationInheritance");
const std::string Relation::imp_inheritance_base("BaseImpInheritance");
const std::string Relation::imp_inheritance_derived("DerivedImpInheritance");
const std::string Relation::same_folder_str("SameFolder");
const std::string Relation::same_folder_right("SameFolderRight");
const std::string Relation::same_folder_left("SameFolderLeft");
const std::string Relation::same_aspect_str("SameAspect");
const std::string Relation::same_aspect_right("SameAspectRight");
const std::string Relation::same_aspect_left("SameAspectLeft");
--- NEW FILE: component.def ---
; Interpreter.def : Declares the module parameters.
LIBRARY "MetaInterpreter2008.DLL"
EXPORTS
DllCanUnloadNow PRIVATE
DllGetClassObject PRIVATE
DllRegisterServer PRIVATE
DllUnregisterServer PRIVATE
--- NEW FILE: Resource.h ---
//{{NO_DEPENDENCIES}}
// Microsoft Visual C++ generated include file.
// Used by Component.rc
//
#define IDS_PROJNAME 100
#define IDD_ASPECT_ORDER_PAGE 106
#define IDD_ASPECT_PAGE 107
#define IDI_ICON1 199
#define IDC_TAB1 201
#define IDD_ASPECTORDER_DLG 202
#define IDC_BUTTON1 204
#define IDC_BUTTON2 205
#define IDC_LIST3 206
#define IDC_EDIT1 216
#define IDC_EDIT2 217
#define IDC_EDIT3 218
#define IDB_BITMAPUP 219
#define IDC_BUTTON3 219
#define IDB_BITMAPDN 220
#define IDI_ICONDN 221
#define IDC_CHECK1 221
#define IDI_ICONUP 222
#define IDC_CHECK2 222
#define IDC_CHECK3 223
#define IDD_EQUIVDIALOG 224
#define IDD_OPTIONS 225
#define IDC_CHECK5 225
#define IDD_EVENTSDLG 226
#define IDC_CHECK6 226
#define IDC_CHECK7 227
#define IDC_CHECK8 228
#define IDC_CHECK10 230
#define IDC_CHECK11 231
#define IDC_CHECK12 232
#define IDC_CHECK13 233
#define IDC_CHECK14 234
#define IDC_CHECK15 235
#define IDC_CHECK16 238
#define IDC_CHECK17 239
#define IDC_CHECK18 240
#define IDC_CHECK19 241
#define IDC_SPIN1 243
#define IDC_EDIT4 244
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 228
#define _APS_NEXT_COMMAND_VALUE 32768
#define _APS_NEXT_CONTROL_VALUE 245
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif
--- NEW FILE: entity.h ---
#ifndef ENTITY_H
#define ENTITY_H
#include "MyUtil.h"
class Entity
{
public:
explicit Entity( IMgaFolder* parent, IMgaFCO* p, IMgaFCO* p2 = (IMgaFCO*)0)
: m_pointer( p), m_respPointer( p2), m_dispName(), m_parentFolder( parent), m_deleted( false) { }
Entity( const Entity & operand )
: m_pointer(operand.m_pointer)
, m_respPointer( operand.m_respPointer)
, m_dispName( operand.m_dispName)
, m_parentFolder( operand.m_parentFolder)
, m_deleted( operand.m_deleted)
{ }
const Entity& operator=(const Entity& operand)
{
if (&operand == this) return *this;
m_pointer = operand.m_pointer;
m_respPointer = operand.m_respPointer;
m_dispName = operand.m_dispName;
m_parentFolder = operand.m_parentFolder;
m_deleted = operand.m_deleted;
return *this;
}
~Entity() { }
bool operator==( const Entity& peer) { return (m_pointer == peer.m_pointer) && (m_respPointer == peer.m_respPointer) && (m_parentFolder == peer.m_parentFolder) && (m_deleted == peer.m_deleted); }
bool operator!=( const Entity& peer) { return !(*this==peer); }
bool operator<( const Entity& peer) const
{
IMgaFCO* f1 ( getPointer());
IMgaFCO* f2 ( peer.getPointer());
return ( Util::name( f1).compare( Util::name( f2)) < 0);
}
IMgaFCO* getPointer() const { return m_pointer; }
IMgaFCO* getRespPointer() const { return m_respPointer; }
std::string getDispName() const { return m_dispName; }
IMgaFolder* getParentFolder() const { return m_parentFolder; }
void setPointer( IMgaFCO* p) { m_pointer = p; }
void setRespPointer( IMgaFCO* r_p) { m_respPointer = r_p; }
void setDispName( const std::string& dn) { m_dispName = dn; }
void setParentFolder( IMgaFolder* pf) { m_parentFolder = pf; }
bool isDeleted() const { return m_deleted; }
void deleted( const bool val) { m_deleted = val; }
//private:
IMgaFCO* m_pointer;
IMgaFCO* m_respPointer;
std::string m_dispName;
IMgaFolder* m_parentFolder;
bool m_deleted;
};
#endif // ENTITY_H
- Previous message: [GME-commit] GMESRC/Paradigms/MetaGME MetaGME.sln,1.5,1.6
- Next message: [GME-commit] GMESRC/Paradigms/MetaGME/MetaInterpreter2008/asp AspectPage.cpp, NONE, 1.1 AspectPage.h, NONE, 1.1 AspectSpecDlg.cpp, NONE, 1.1 AspectSpecDlg.h, NONE, 1.1 AspectSpecTbl.cpp, NONE, 1.1 AspectSpecTbl.h, NONE, 1.1 EventsDial.cpp, NONE, 1.1 EventsDial.h, NONE, 1.1 GlobalAspOrder.cpp, NONE, 1.1 GlobalAspOrder.h, NONE, 1.1 InPlaceEdit.cpp, NONE, 1.1 InPlaceEdit.h, NONE, 1.1 InPlaceList.cpp, NONE, 1.1 InPlaceList.h, NONE, 1.1 NameSpecDlg.cpp, NONE, 1.1 NameSpecDlg.h, NONE, 1.1 NameSpecTbl.cpp, NONE, 1.1 NameSpecTbl.h, NONE, 1.1 Options.cpp, NONE, 1.1 options.h, NONE, 1.1
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the GME-commit
mailing list