当前位置: 首页>>代码示例>>C#>>正文


C# G25.MergeErrors方法代码示例

本文整理汇总了C#中G25.MergeErrors方法的典型用法代码示例。如果您正苦于以下问题:C# G25.MergeErrors方法的具体用法?C# G25.MergeErrors怎么用?C# G25.MergeErrors使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在G25的用法示例。


在下文中一共展示了G25.MergeErrors方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: WriteFunctions


//.........这里部分代码省略.........
            }

            // start threads to generate code for all converters
            Thread[] converterThreads = new Thread[converterFGS.Count];
            Converter[] converters = new Converter[converterFGS.Count];
            for (int f = 0; f < converterFGS.Count; f++)
            {
                G25.fgs F = converterFGS[f];
                converters[f] = new Converter(S, cgd, F);
                converterThreads[f] = new Thread(converters[f].WriteConverter);
            }
            G25.CG.Shared.Threads.StartThreadArray(converterThreads);

            // find out which plugin can implement which FGS
            Thread[] functionThreads = new Thread[functionFGS.Count];
            G25.CG.Shared.BaseFunctionGenerator[] functionGenerators = new G25.CG.Shared.BaseFunctionGenerator[functionFGS.Count];
            G25.CG.Shared.CGdata[] functionCgd = new G25.CG.Shared.CGdata[functionFGS.Count];
            for (int f = 0; f < functionFGS.Count; f++)
            {
                G25.fgs F = functionFGS[f];

                foreach (G25.CG.Shared.BaseFunctionGenerator P in plugins) // check all C plugins
                {
                    if (P.CanImplement(S, F)) // ask them if they can handle 'F'
                    {
                        // get a clean instance of the code generator and initialize it
                        functionGenerators[f] = System.Activator.CreateInstance(P.GetType()) as BaseFunctionGenerator;
                        functionCgd[f] = new G25.CG.Shared.CGdata(cgd); // m_errors and m_missingDependencies will be shared with main cgd!
                        functionGenerators[f].Init(S, F, functionCgd[f]);
                        F.SetSupportedByPlugin();
                        break;
                    }
                }
                if (!F.GetSupportedByPlugin())
                {// no plugin could do 'F': complain about it
                    System.Console.WriteLine("Warning no suitable plugin for function " + F.Name + "; XML specification: ");
                    System.Console.WriteLine("    " + XML.FunctionToXmlString(S, F));
                }
            }

            // store functionGenerators in FGI, for later use by TestSuite.GenerateCode()
            if (FGI != null)
            {
                FGI.m_functionGenerators = functionGenerators;
                FGI.m_functionCgd = functionCgd;
            }

            // run threads for fill-in of functions
            for (int f = 0; f < functionFGS.Count; f++)
            {
                if (functionGenerators[f] == null) continue;
                functionThreads[f] = new Thread(functionGenerators[f].CompleteFGSentryPoint);
            }
            G25.CG.Shared.Threads.StartThreadArray(functionThreads);
            G25.CG.Shared.Threads.JoinThreadArray(functionThreads);
            //G25.CG.Shared.Threads.RunThreadArraySerially(functionThreads);

            // runs thread for dependency check of functions
            for (int f = 0; f < functionFGS.Count; f++)
            {
                if (functionGenerators[f] == null) continue;
                functionThreads[f] = new Thread(functionGenerators[f].CheckDepenciesEntryPoint);
            }
            G25.CG.Shared.Threads.StartThreadArray(functionThreads);
            G25.CG.Shared.Threads.JoinThreadArray(functionThreads);
            //G25.CG.Shared.Threads.RunThreadArraySerially(functionThreads);

            // runs thread for actual code generation of functions
            for (int f = 0; f < functionFGS.Count; f++)
            {
                if (functionGenerators[f] == null) continue;
                functionThreads[f] = new Thread(functionGenerators[f].WriteFunctionEntryPoint);
            }
            G25.CG.Shared.Threads.StartThreadArray(functionThreads);
            //G25.CG.Shared.Threads.RunThreadArraySerially(functionThreads);

            // join all the converter threads:
            G25.CG.Shared.Threads.JoinThreadArray(converterThreads);

            // join all function generation threads
            G25.CG.Shared.Threads.JoinThreadArray(functionThreads);

            // collect all the results from the threads:
            for (int f = 0; f < converters.Length; f++)
            {
                cgd.m_declSB.Append(converters[f].m_declSB);
                cgd.m_defSB.Append(converters[f].m_defSB);
                cgd.m_inlineDefSB.Append(converters[f].m_inlineDefSB);
                cgd.MergeErrors(converters[f].m_cgd);
            }

            // collect all the results from the threads:
            for (int f = 0; f < functionCgd.Length; f++)
            {
                if (functionGenerators[f] == null) continue;
                cgd.m_declSB.Append(functionCgd[f].m_declSB);
                cgd.m_defSB.Append(functionCgd[f].m_defSB);
                cgd.m_inlineDefSB.Append(functionCgd[f].m_inlineDefSB);
            }
        }
开发者ID:Sciumo,项目名称:gaigen,代码行数:101,代码来源:functions.cs


注:本文中的G25.MergeErrors方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。