diff --git a/mocha-common/compilers/yaml2mcl/mocha/library/manager/MemoryLibraryManager.py b/mocha-common/compilers/yaml2mcl/mocha/library/manager/MemoryLibraryManager.py index 6a485e5..79a4caf 100644 --- a/mocha-common/compilers/yaml2mcl/mocha/library/manager/MemoryLibraryManager.py +++ b/mocha-common/compilers/yaml2mcl/mocha/library/manager/MemoryLibraryManager.py @@ -24,14 +24,18 @@ class MemoryLibraryManager (MochaLibraryManager): self.filename = "" self.codeDefinitionFileName = "" + self.instance_ops = [ ] + self.attribute_ops = [ ] + self.relationship_ops = [ ] + def process_attribute_ops(self, ops): - self.attribute_ops = ops + self.attribute_ops.extend(ops) def process_instance_ops(self, ops): - self.instance_ops = ops + self.instance_ops.extend(ops) def process_relationship_ops(self, ops): - self.relationship_ops = ops + self.relationship_ops.extend(ops) def update_global_identifiers(self): pass @@ -78,6 +82,7 @@ class MemoryLibraryManager (MochaLibraryManager): # *** SECOND PASS *** # first, go through and load all the instances GUIDs + refs = [ ] insts = [ ] atts = [ ] rels = [ ] @@ -114,8 +119,11 @@ class MemoryLibraryManager (MochaLibraryManager): guids = guid_db.to_list() + defs_db = [ ] + for ref in self.entityReferences: + defs_db.append((ref, self.entityReferences[ref])) - from .sectionfile import SectionFile, Section, GuidSection, InstancesSection, AttributesSection, RelationshipsSection, StringTableSection, ResourcesSection + from .sectionfile import SectionFile, Section, GuidSection, InstancesSection, AttributesSection, RelationshipsSection, StringTableSection, ResourcesSection, DefinitionsSection f = SectionFile("MCX!", 2.0, 15) f.open(self.filename) @@ -125,6 +133,7 @@ class MemoryLibraryManager (MochaLibraryManager): f.sections.append(RelationshipsSection("Relationships", rels)) f.sections.append(StringTableSection("StringTable", strs_db)) f.sections.append(ResourcesSection("Resources", rsrc_db)) + f.sections.append(DefinitionsSection(defs_db)) f.save()