private static void CollectActionParameterTypes(LGSPRuleAndMatchingPatterns ruleAndMatchingPatterns, IGraphModel model, out Dictionary<String, List<IFilter>> rulesToFilters, out Dictionary<String, List<String>> filterFunctionsToInputTypes, out Dictionary<String, List<String>> rulesToInputTypes, out Dictionary<String, List<String>> rulesToOutputTypes, out Dictionary<String, List<String>> rulesToTopLevelEntities, out Dictionary<String, List<String>> rulesToTopLevelEntityTypes, out Dictionary<String, List<String>> sequencesToInputTypes, out Dictionary<String, List<String>> sequencesToOutputTypes, out Dictionary<String, List<String>> proceduresToInputTypes, out Dictionary<String, List<String>> proceduresToOutputTypes, out Dictionary<String, bool> proceduresToIsExternal, out Dictionary<String, List<String>> functionsToInputTypes, out Dictionary<String, String> functionsToOutputType, out Dictionary<String, bool> functionsToIsExternal) { rulesToFilters = new Dictionary<String, List<IFilter>>(); filterFunctionsToInputTypes = new Dictionary<String, List<String>>(); rulesToInputTypes = new Dictionary<String, List<String>>(); rulesToOutputTypes = new Dictionary<String, List<String>>(); rulesToTopLevelEntities = new Dictionary<String, List<String>>(); rulesToTopLevelEntityTypes = new Dictionary<String, List<String>>(); sequencesToInputTypes = new Dictionary<String, List<String>>(); sequencesToOutputTypes = new Dictionary<String, List<String>>(); proceduresToInputTypes = new Dictionary<String, List<String>>(); proceduresToOutputTypes = new Dictionary<String, List<String>>(); proceduresToIsExternal = new Dictionary<String, bool>(); functionsToInputTypes = new Dictionary<String, List<String>>(); functionsToOutputType = new Dictionary<String, String>(); functionsToIsExternal = new Dictionary<String, bool>(); foreach(LGSPRulePattern rulePattern in ruleAndMatchingPatterns.Rules) { List<IFilter> filters = new List<IFilter>(); rulesToFilters.Add(rulePattern.PatternGraph.PackagePrefixedName, filters); foreach(IFilter filter in rulePattern.Filters) { filters.Add(filter); if(filter is IFilterFunction) { IFilterFunction filterFunction = (IFilterFunction)filter; List<String> filterFunctionInputTypes = new List<String>(); filterFunctionsToInputTypes.Add(filterFunction.PackagePrefixedName, filterFunctionInputTypes); foreach(GrGenType inputType in filterFunction.Inputs) { filterFunctionInputTypes.Add(TypesHelper.DotNetTypeToXgrsType(inputType)); } } } List<String> inputTypes = new List<String>(); rulesToInputTypes.Add(rulePattern.PatternGraph.PackagePrefixedName, inputTypes); foreach(GrGenType inputType in rulePattern.Inputs) { inputTypes.Add(TypesHelper.DotNetTypeToXgrsType(inputType)); } List<String> outputTypes = new List<String>(); rulesToOutputTypes.Add(rulePattern.PatternGraph.PackagePrefixedName, outputTypes); foreach(GrGenType outputType in rulePattern.Outputs) { outputTypes.Add(TypesHelper.DotNetTypeToXgrsType(outputType)); } List<String> topLevelEntities = new List<String>(); rulesToTopLevelEntities.Add(rulePattern.PatternGraph.PackagePrefixedName, topLevelEntities); foreach(IPatternNode node in rulePattern.PatternGraph.Nodes) { topLevelEntities.Add(node.UnprefixedName); } foreach(IPatternEdge edge in rulePattern.PatternGraph.Edges) { topLevelEntities.Add(edge.UnprefixedName); } foreach(IPatternVariable var in rulePattern.PatternGraph.Variables) { topLevelEntities.Add(var.UnprefixedName); } List<String> topLevelEntityTypes = new List<String>(); rulesToTopLevelEntityTypes.Add(rulePattern.PatternGraph.PackagePrefixedName, topLevelEntityTypes); foreach(IPatternNode node in rulePattern.PatternGraph.Nodes) { topLevelEntityTypes.Add(TypesHelper.DotNetTypeToXgrsType(node.Type)); } foreach(IPatternEdge edge in rulePattern.PatternGraph.Edges) { topLevelEntityTypes.Add(TypesHelper.DotNetTypeToXgrsType(edge.Type)); } foreach(IPatternVariable var in rulePattern.PatternGraph.Variables) { topLevelEntityTypes.Add(TypesHelper.DotNetTypeToXgrsType(var.Type)); } } foreach(DefinedSequenceInfo sequence in ruleAndMatchingPatterns.DefinedSequences) { List<String> inputTypes = new List<String>(); sequencesToInputTypes.Add(sequence.PackagePrefixedName, inputTypes); foreach(GrGenType inputType in sequence.ParameterTypes) { inputTypes.Add(TypesHelper.DotNetTypeToXgrsType(inputType)); } List<String> outputTypes = new List<String>(); sequencesToOutputTypes.Add(sequence.PackagePrefixedName, outputTypes); foreach(GrGenType outputType in sequence.OutParameterTypes) { outputTypes.Add(TypesHelper.DotNetTypeToXgrsType(outputType)); } } foreach(ProcedureInfo procedure in ruleAndMatchingPatterns.Procedures) { List<String> inputTypes = new List<String>(); proceduresToInputTypes.Add(procedure.packagePrefixedName, inputTypes); foreach(GrGenType inputType in procedure.inputs) { inputTypes.Add(TypesHelper.DotNetTypeToXgrsType(inputType)); } List<String> outputTypes = new List<String>(); proceduresToOutputTypes.Add(procedure.packagePrefixedName, outputTypes); foreach(GrGenType outputType in procedure.outputs) { outputTypes.Add(TypesHelper.DotNetTypeToXgrsType(outputType)); } proceduresToIsExternal.Add(procedure.packagePrefixedName, procedure.IsExternal); } foreach(FunctionInfo function in ruleAndMatchingPatterns.Functions) { List<String> inputTypes = new List<String>(); functionsToInputTypes.Add(function.packagePrefixedName, inputTypes); foreach(GrGenType inputType in function.inputs) { inputTypes.Add(TypesHelper.DotNetTypeToXgrsType(inputType)); } functionsToOutputType.Add(function.packagePrefixedName, TypesHelper.DotNetTypeToXgrsType(function.output)); functionsToIsExternal.Add(function.packagePrefixedName, function.IsExternal); } }
private static void CollectActionTypes(Assembly initialAssembly, out Dictionary<String, Type> actionTypes, out Dictionary<String, Type> proceduresTypes, out LGSPRuleAndMatchingPatterns ruleAndMatchingPatterns) { actionTypes = new Dictionary<string, Type>(); proceduresTypes = new Dictionary<String, Type>(); foreach(Type type in initialAssembly.GetTypes()) { if(!type.IsClass || type.IsNotPublic) continue; if(type.BaseType == typeof(LGSPMatchingPattern) || type.BaseType == typeof(LGSPRulePattern)) actionTypes.Add(TypesHelper.GetPackagePrefixedNameFromFullTypeName(type.FullName), type); if(type.Name == "Procedures") proceduresTypes.Add(TypesHelper.GetPackagePrefixedNameFromFullTypeName(type.FullName), type); } ruleAndMatchingPatterns = null; foreach(Type type in initialAssembly.GetTypes()) { if(!type.IsClass || type.IsNotPublic) continue; if(type.BaseType == typeof(LGSPRuleAndMatchingPatterns)) { ruleAndMatchingPatterns = (LGSPRuleAndMatchingPatterns)Activator.CreateInstance(type); break; } } }
private static void DetermineWhetherExternalActionsFileIsNeeded(LGSPRuleAndMatchingPatterns ruleAndMatchingPatterns, out bool isAutoGeneratedFilterExisting, out bool isExternalFilterFunctionExisting, out bool isExternalSequenceExisting) { isAutoGeneratedFilterExisting = false; isExternalFilterFunctionExisting = false; foreach(IRulePattern rulePattern in ruleAndMatchingPatterns.Rules) { foreach(IFilter filter in rulePattern.Filters) { if(filter is IFilterAutoGenerated) isAutoGeneratedFilterExisting = true; else if(((IFilterFunction)filter).IsExternal) isExternalFilterFunctionExisting = true; } } isExternalSequenceExisting = false; foreach(DefinedSequenceInfo sequence in ruleAndMatchingPatterns.DefinedSequences) { if(sequence is ExternalDefinedSequenceInfo) { isExternalSequenceExisting = true; break; } } }
private SourceBuilder GenerateActionsClass(IGraphModel model, String actionsName, String unitName, string statisticsPath, LGSPRuleAndMatchingPatterns ruleAndMatchingPatterns, bool lazyNIC, bool inlineIndependents, bool profile) { SourceBuilder endSource = new SourceBuilder("\n"); endSource.Indent(); if((flags & ProcessSpecFlags.KeepGeneratedFiles) != 0) { endSource.AppendFront("// class which instantiates and stores all the compiled actions of the module,\n"); endSource.AppendFront("// dynamic regeneration and compilation causes the old action to be overwritten by the new one\n"); endSource.AppendFront("// matching/rule patterns are analyzed at creation time here, once, so that later regeneration runs have all the information available\n"); } endSource.AppendFront("public class " + unitName + "Actions : GRGEN_LGSP.LGSPActions\n"); endSource.AppendFront("{\n"); endSource.Indent(); endSource.AppendFront("public " + unitName + "Actions(GRGEN_LGSP.LGSPGraph lgspgraph, " + "string modelAsmName, string actionsAsmName)\n"); endSource.AppendFront(" : base(lgspgraph, modelAsmName, actionsAsmName)\n"); endSource.AppendFront("{\n"); endSource.AppendFront(" InitActions();\n"); endSource.AppendFront("}\n\n"); endSource.AppendFront("public " + unitName + "Actions(GRGEN_LGSP.LGSPGraph lgspgraph)\n"); endSource.AppendFront(" : base(lgspgraph)\n"); endSource.AppendFront("{\n"); endSource.AppendFront(" InitActions();\n"); endSource.AppendFront("}\n\n"); endSource.AppendFront("private void InitActions()\n"); endSource.AppendFront("{\n"); endSource.Indent(); endSource.AppendFrontFormat("packages = new string[{0}];\n", ruleAndMatchingPatterns.Packages.Length); for(int i=0; i<ruleAndMatchingPatterns.Packages.Length; ++i) { String packageName = ruleAndMatchingPatterns.Packages[i]; endSource.AppendFrontFormat("packages[{0}] = \"{1}\";\n", i, packageName); } // we generate analyzer calls, so the runtime structures needed for dynamic matcher (re-)generation // are prepared in the same way as the compile time structures were by the analyzer calls above endSource.AppendFront("GRGEN_LGSP.PatternGraphAnalyzer analyzer = new GRGEN_LGSP.PatternGraphAnalyzer();\n"); foreach(LGSPMatchingPattern matchingPattern in ruleAndMatchingPatterns.RulesAndSubpatterns) { if(matchingPattern is LGSPRulePattern) // normal rule { endSource.AppendFrontFormat("analyzer.AnalyzeNestingOfPatternGraph({1}Rule_{0}.Instance.patternGraph, false);\n", matchingPattern.name, TypesHelper.GetPackagePrefixDot(matchingPattern.PatternGraph.Package)); endSource.AppendFrontFormat("GRGEN_LGSP.PatternGraphAnalyzer.PrepareInline({1}Rule_{0}.Instance.patternGraph);\n", matchingPattern.name, TypesHelper.GetPackagePrefixDot(matchingPattern.PatternGraph.Package)); endSource.AppendFrontFormat("analyzer.RememberMatchingPattern({1}Rule_{0}.Instance);\n", matchingPattern.name, TypesHelper.GetPackagePrefixDot(matchingPattern.PatternGraph.Package)); endSource.AppendFrontFormat("actions.Add(\"{2}\", (GRGEN_LGSP.LGSPAction) " + "{1}Action_{0}.Instance);\n", matchingPattern.name, TypesHelper.GetPackagePrefixDot(matchingPattern.PatternGraph.Package), matchingPattern.PatternGraph.PackagePrefixedName); endSource.AppendFrontFormat("@{2} = {1}Action_{0}.Instance;\n", matchingPattern.name, TypesHelper.GetPackagePrefixDot(matchingPattern.PatternGraph.Package), TypesHelper.PackagePrefixedNameUnderscore(matchingPattern.PatternGraph.Package, matchingPattern.PatternGraph.Name)); } else { endSource.AppendFrontFormat("analyzer.AnalyzeNestingOfPatternGraph({1}Pattern_{0}.Instance.patternGraph, false);\n", matchingPattern.name, TypesHelper.GetPackagePrefixDot(matchingPattern.PatternGraph.Package)); endSource.AppendFrontFormat("GRGEN_LGSP.PatternGraphAnalyzer.PrepareInline({1}Pattern_{0}.Instance.patternGraph);\n", matchingPattern.name, TypesHelper.GetPackagePrefixDot(matchingPattern.PatternGraph.Package)); endSource.AppendFrontFormat("analyzer.RememberMatchingPattern({1}Pattern_{0}.Instance);\n", matchingPattern.name, TypesHelper.GetPackagePrefixDot(matchingPattern.PatternGraph.Package)); } } endSource.AppendFront("analyzer.ComputeInterPatternRelations(false);\n"); foreach(LGSPMatchingPattern matchingPattern in ruleAndMatchingPatterns.RulesAndSubpatterns) { if(matchingPattern is LGSPRulePattern) // normal rule { endSource.AppendFrontFormat("analyzer.AnalyzeWithInterPatternRelationsKnown({1}Rule_{0}.Instance.patternGraph);\n", matchingPattern.name, TypesHelper.GetPackagePrefixDot(matchingPattern.PatternGraph.Package)); } else { endSource.AppendFrontFormat("analyzer.AnalyzeWithInterPatternRelationsKnown({1}Pattern_{0}.Instance.patternGraph);\n", matchingPattern.name, TypesHelper.GetPackagePrefixDot(matchingPattern.PatternGraph.Package)); } } foreach(LGSPMatchingPattern matchingPattern in ruleAndMatchingPatterns.RulesAndSubpatterns) { if(matchingPattern is LGSPRulePattern) // normal rule { endSource.AppendFrontFormat("analyzer.InlineSubpatternUsages({1}Rule_{0}.Instance.patternGraph);\n", matchingPattern.name, TypesHelper.GetPackagePrefixDot(matchingPattern.PatternGraph.Package)); } else { endSource.AppendFrontFormat("analyzer.InlineSubpatternUsages({1}Pattern_{0}.Instance.patternGraph);\n", matchingPattern.name, TypesHelper.GetPackagePrefixDot(matchingPattern.PatternGraph.Package)); } } foreach(LGSPMatchingPattern matchingPattern in ruleAndMatchingPatterns.RulesAndSubpatterns) { if(matchingPattern is LGSPRulePattern) // normal rule { endSource.AppendFrontFormat("{1}Rule_{0}.Instance.patternGraph.maxIsoSpace = 0;\n", matchingPattern.name, TypesHelper.GetPackagePrefixDot(matchingPattern.PatternGraph.Package)); } else { endSource.AppendFrontFormat("{1}Pattern_{0}.Instance.patternGraph.maxIsoSpace = 0;\n", matchingPattern.name, TypesHelper.GetPackagePrefixDot(matchingPattern.PatternGraph.Package)); } } foreach(LGSPMatchingPattern matchingPattern in ruleAndMatchingPatterns.RulesAndSubpatterns) { if(matchingPattern is LGSPRulePattern) // normal rule { endSource.AppendFrontFormat("analyzer.AnalyzeNestingOfPatternGraph({1}Rule_{0}.Instance.patternGraph, true);\n", matchingPattern.name, TypesHelper.GetPackagePrefixDot(matchingPattern.PatternGraph.Package)); } else { endSource.AppendFrontFormat("analyzer.AnalyzeNestingOfPatternGraph({1}Pattern_{0}.Instance.patternGraph, true);\n", matchingPattern.name, TypesHelper.GetPackagePrefixDot(matchingPattern.PatternGraph.Package)); } } endSource.AppendFront("analyzer.ComputeInterPatternRelations(true);\n"); foreach(DefinedSequenceInfo sequence in ruleAndMatchingPatterns.DefinedSequences) { endSource.AppendFrontFormat("RegisterGraphRewriteSequenceDefinition(" + "{1}Sequence_{0}.Instance);\n", sequence.Name, TypesHelper.GetPackagePrefixDot(sequence.Package)); endSource.AppendFrontFormat("@{2} = {1}Sequence_{0}.Instance;\n", sequence.Name, TypesHelper.GetPackagePrefixDot(sequence.Package), TypesHelper.PackagePrefixedNameUnderscore(sequence.Package, sequence.Name)); } foreach(FunctionInfo function in ruleAndMatchingPatterns.Functions) { endSource.AppendFrontFormat("namesToFunctionDefinitions.Add(\"{2}\", {1}FunctionInfo_{0}.Instance);\n", function.name, TypesHelper.GetPackagePrefixDot(function.package), function.packagePrefixedName); } foreach(ProcedureInfo procedure in ruleAndMatchingPatterns.Procedures) { endSource.AppendFrontFormat("namesToProcedureDefinitions.Add(\"{2}\", {1}ProcedureInfo_{0}.Instance);\n", procedure.name, TypesHelper.GetPackagePrefixDot(procedure.package), procedure.packagePrefixedName); } endSource.Unindent(); endSource.AppendFront("}\n"); endSource.AppendFront("\n"); foreach(LGSPMatchingPattern matchingPattern in ruleAndMatchingPatterns.RulesAndSubpatterns) { if(matchingPattern is LGSPRulePattern) // normal rule endSource.AppendFrontFormat("public {1}IAction_{0} @{2};\n", matchingPattern.name, TypesHelper.GetPackagePrefixDot(matchingPattern.PatternGraph.Package), TypesHelper.PackagePrefixedNameUnderscore(matchingPattern.PatternGraph.Package, matchingPattern.PatternGraph.Name)); } endSource.AppendFront("\n"); foreach(DefinedSequenceInfo sequence in ruleAndMatchingPatterns.DefinedSequences) { endSource.AppendFrontFormat("public {1}Sequence_{0} @{2};\n", sequence.Name, TypesHelper.GetPackagePrefixDot(sequence.Package), TypesHelper.PackagePrefixedNameUnderscore(sequence.Package, sequence.Name)); } endSource.AppendFront("\n"); endSource.AppendFront("public override string[] Packages { get { return packages; } }\n"); endSource.AppendFront("private string[] packages;\n"); endSource.AppendFront("\n"); endSource.AppendFront("public override string Name { get { return \"" + actionsName + "\"; } }\n"); endSource.AppendFront("public override string StatisticsPath { get { return " + (statisticsPath != null ? "@\"" + statisticsPath + "\"" : "null") + "; } }\n"); endSource.AppendFront("public override bool LazyNIC { get { return " + (lazyNIC ? "true" : "false") + "; } }\n"); endSource.AppendFront("public override bool InlineIndependents { get { return " + (inlineIndependents ? "true" : "false") + "; } }\n"); endSource.AppendFront("public override bool Profile { get { return " + (profile ? "true" : "false") + "; } }\n\n"); endSource.AppendFront("public override string ModelMD5Hash { get { return \"" + model.MD5Hash + "\"; } }\n"); endSource.Unindent(); endSource.AppendFront("}\n"); return endSource; }
private static void GenerateDefinedSequencesAndFiltersAndFilterStubs(string externalActionsExtensionFilename, bool isAutoGeneratedFilterExisting, bool isExternalFilterFunctionExisting, LGSPRuleAndMatchingPatterns ruleAndMatchingPatterns, LGSPSequenceGenerator seqGen, SourceBuilder externalSource, SourceBuilder source) { foreach(DefinedSequenceInfo sequence in ruleAndMatchingPatterns.DefinedSequences) { if(sequence is ExternalDefinedSequenceInfo) seqGen.GenerateExternalDefinedSequencePlaceholder(externalSource, (ExternalDefinedSequenceInfo)sequence, externalActionsExtensionFilename); } if(isAutoGeneratedFilterExisting || isExternalFilterFunctionExisting) { externalSource.Append("\n"); if(isExternalFilterFunctionExisting) { externalSource.AppendFrontFormat("// You must implement the following filter functions in the same partial class in ./{0}\n", externalActionsExtensionFilename); externalSource.Append("\n"); foreach(LGSPRulePattern rulePattern in ruleAndMatchingPatterns.Rules) { seqGen.GenerateFilterStubs(externalSource, rulePattern); } } if(isAutoGeneratedFilterExisting) { if(isExternalFilterFunctionExisting) externalSource.Append("\n").AppendFront("// ------------------------------------------------------\n\n"); externalSource.AppendFront("// The following filter functions are automatically generated, you don't need to supply any further implementation\n"); externalSource.Append("\n"); foreach(LGSPRulePattern rulePattern in ruleAndMatchingPatterns.Rules) { seqGen.GenerateFilters(externalSource, rulePattern); } } } if(externalSource != null) { externalSource.Append("\n"); externalSource.AppendFront("// ------------------------------------------------------\n"); } foreach(DefinedSequenceInfo sequence in ruleAndMatchingPatterns.DefinedSequences) { if(sequence is ExternalDefinedSequenceInfo) seqGen.GenerateExternalDefinedSequence(externalSource, (ExternalDefinedSequenceInfo)sequence); else seqGen.GenerateDefinedSequence(source, sequence); } }
private static void AnalyzeAndInlineMatchingPatterns(bool inline, LGSPRuleAndMatchingPatterns ruleAndMatchingPatterns) { PatternGraphAnalyzer analyzer = new PatternGraphAnalyzer(); foreach(LGSPMatchingPattern matchingPattern in ruleAndMatchingPatterns.RulesAndSubpatterns) { analyzer.AnalyzeNestingOfPatternGraph(matchingPattern.patternGraph, false); PatternGraphAnalyzer.PrepareInline(matchingPattern.patternGraph); analyzer.RememberMatchingPattern(matchingPattern); } analyzer.ComputeInterPatternRelations(false); foreach(LGSPMatchingPattern matchingPattern in ruleAndMatchingPatterns.RulesAndSubpatterns) { // computes patternpath information, thus only in original pass analyzer.AnalyzeWithInterPatternRelationsKnown(matchingPattern.patternGraph); } if(inline) { foreach(LGSPMatchingPattern matchingPattern in ruleAndMatchingPatterns.RulesAndSubpatterns) { #if DUMP_PATTERNS // dump patterns for debugging - first original version without inlining SourceBuilder builder = new SourceBuilder(true); matchingPattern.patternGraph.DumpOriginal(builder); StreamWriter writer = new StreamWriter(matchingPattern.name + "_pattern_dump.txt"); writer.Write(builder.ToString()); #endif analyzer.InlineSubpatternUsages(matchingPattern.patternGraph); #if DUMP_PATTERNS // - then inlined version builder = new SourceBuilder(true); matchingPattern.patternGraph.DumpInlined(builder); writer.Write(builder.ToString()); writer.Close(); #endif } } // hardcore/ugly parameterization for inlined case, working on inlined members in inlined pass, and original members on original pass // working with accessors encapsulating the inlined versions and the original version behind a common interface to keep the analyze code without case distinctions gets terribly extensive foreach(LGSPMatchingPattern matchingPattern in ruleAndMatchingPatterns.RulesAndSubpatterns) matchingPattern.patternGraph.maxIsoSpace = 0; // reset of max iso space for computation of max iso space of inlined patterns foreach(LGSPMatchingPattern matchingPattern in ruleAndMatchingPatterns.RulesAndSubpatterns) { analyzer.AnalyzeNestingOfPatternGraph(matchingPattern.patternGraph, true); } analyzer.ComputeInterPatternRelations(true); }
private void GenerateAndInsertMatcherSourceCode(IGraphModel model, String actionsName, String unitName, string externalActionsExtensionFilename, LGSPRuleAndMatchingPatterns ruleAndMatchingPatterns, LGSPSequenceGenerator seqGen, bool isAutoGeneratedFilterExisting, bool isExternalFilterFunctionExisting, LGSPGraphStatistics graphStatistics, string statisticsPath, SourceBuilder externalSource, SourceBuilder source) { // analyze the matching patterns, inline the subpatterns when expected to be benefitial // the analyzer must be run before the matcher generation AnalyzeAndInlineMatchingPatterns((flags & ProcessSpecFlags.Noinline) == 0, ruleAndMatchingPatterns); LGSPMatcherGenerator matcherGen = new LGSPMatcherGenerator(model); if((flags & ProcessSpecFlags.KeepGeneratedFiles) != 0) matcherGen.CommentSourceCode = true; if((flags & ProcessSpecFlags.LazyNIC) != 0) matcherGen.LazyNegativeIndependentConditionEvaluation = true; if((flags & ProcessSpecFlags.Noinline) != 0) matcherGen.InlineIndependents = false; if((flags & ProcessSpecFlags.Profile) != 0) matcherGen.Profile = true; foreach(LGSPMatchingPattern matchingPattern in ruleAndMatchingPatterns.RulesAndSubpatterns) { GenerateScheduledSearchPlans(matchingPattern.patternGraph, graphStatistics, matcherGen, !(matchingPattern is LGSPRulePattern), false, null); matcherGen.MergeNegativeAndIndependentSchedulesIntoEnclosingSchedules(matchingPattern.patternGraph); matcherGen.ParallelizeAsNeeded(matchingPattern); matcherGen.GenerateActionAndMatcher(source, matchingPattern, true); } GenerateDefinedSequencesAndFiltersAndFilterStubs(externalActionsExtensionFilename, isAutoGeneratedFilterExisting, isExternalFilterFunctionExisting, ruleAndMatchingPatterns, seqGen, externalSource, source); // the actions class referencing the generated stuff is generated now into // a source builder which is appended at the end of the other generated stuff SourceBuilder endSource = GenerateActionsClass(model, actionsName, unitName, statisticsPath, ruleAndMatchingPatterns, matcherGen.LazyNegativeIndependentConditionEvaluation, matcherGen.InlineIndependents, matcherGen.Profile); source.Append(endSource.ToString()); source.Append("}"); }