Пример #1
0
        //------------------------------------------------------------
        // CController.RunCompiler
        //
        /// <summary>
        /// <list type="number">
        /// <item><description>Create a COMPILER instance.</description></item>
        /// <item><description>Register input/out files to the COMPILER instance.</description></item>
        /// <item><description>call COMPILER.Complie method.</description></item>
        /// </list>
        /// </summary>
        /// <param name="bindCallback"></param>
        /// <param name="compiler"></param>
        /// <param name="progress"></param>
        /// <returns>if succeeded, return true.returns>
        /// <remarks>
        /// ICSCompiler Helpers
        /// </remarks>
        //------------------------------------------------------------
        internal bool RunCompiler(
            CCompileProgress progress,
            ref COMPILER compiler,
            ICompileCallback bindCallback)
        {
            // Reset the error count here in case there's a problem
            // with one of the input-sets or imports
            this.countOfReportedErrors        = 0;
            this.countOfWarnsReportedAsErrors = 0;
            //bool needsCleanUp = false;
            bool br = true;

            // Instantiate a compiler on the stack
            // Initialize it

            compiler = new COMPILER(this, NameManager);

            // For each imported assemblies and added modules, create INFILESYMs
            // and add then to compiler.MainSymbolManager.MetadataFileRootSym
            br = compiler.Init();
            if (br)
            {
                // For each input set, add the appropriate data to the compiler
                // For outputfile, create an OUTFILESYM and add it to GlobalSymbolManager.FileRootSym.
                // For source files and resource files, create INFILESYM and add then to the OUTFILESYM.

                foreach (CInputSet inpset in this.inputSetList)
                {
                    br = compiler.AddInputSet(inpset);
                    if (!br)
                    {
                        break;
                    }
                }
            }

            // Tell it to compile
            if (br && countOfReportedErrors == 0)
            {
                compiler.CompileCallback.Init(bindCallback);
                br = compiler.Compile(progress);
            }
            return(br);
        }
Пример #2
0
        //------------------------------------------------------------
        // CController.BuildForEnc
        //
        /// <summary></summary>
        /// <param name="pProgress"></param>
        /// <returns></returns>
        //------------------------------------------------------------
        virtual internal bool BuildForEnc(CCompileProgress pProgress)
        {
            // Reset the error count here in case there's a problem
            // with one of the input-sets or imports
            this.countOfReportedErrors = 0;

            COMPILER comp = new COMPILER(this, NameManager);
            bool     br   = true;

            if (comp.Init())
            {
                for (int i = 0; i < inputSetList.Count; ++i)
                {
                    br = comp.AddInputSet(inputSetList[i]);
                    if (!br)
                    {
                        break;
                    }
                }
            }
            Cleanup();
            return(br);
        }