示例#1
0
        //------------------------------------------------------------
        // CErrorSuppression.Revert
        //
        /// <summary>
        /// If this stores old value false,
        /// restore to CController.SurpressErrors and clear this fields.
        /// </summary>
        //------------------------------------------------------------
        internal void Revert()
        {
            if (isSet)
            {
                DebugUtil.Assert(controller != null);

                if (!suppressOld)
                {
                    controller.SuppressErrors = false;
                }
                isSet       = false;
                suppressOld = false;
                controller  = null;
            }
            DebugUtil.Assert(!isSet && !suppressOld && controller == null);
        }
示例#2
0
        //------------------------------------------------------------
        // CErrorSuppression.Suppress
        //
        /// <summary>
        /// <para>Save the value of CController.SurpressErrors,
        /// and set CController.SurpressErrors true.</para>
        /// <para>If this is already set, cannot set new value,
        /// need to call Revert method.</para>
        /// </summary>
        /// <param name="cntr"></param>
        //------------------------------------------------------------
        internal void Suppress(CController cntr)
        {
            DebugUtil.Assert(cntr != null);

            if (isSet)
            {
                DebugUtil.Assert(controller == cntr);
                return;
            }
            DebugUtil.Assert(controller == null && !suppressOld);
            controller  = cntr;
            suppressOld = cntr.SuppressErrors;
            if (!suppressOld)
            {
                cntr.SuppressErrors = true;
            }
            isSet = true;
        }
示例#3
0
        internal bool SuppressErrors = false;   // m_fSuppressErrors

        //------------------------------------------------------------
        // CController.CreateInstance (static)
        //
        /// <summary></summary>
        /// <param name="flags"></param>
        /// <param name="host"></param>
        /// <param name="nameManager"></param>
        /// <returns></returns>
        //------------------------------------------------------------
        internal static CController CreateInstance(
            CompilerCreationFlags flags,
            ConsoleOutput cout,
            CNameManager nameManager)
        {
            // Create a name table if we weren't given one
            if (nameManager == null)
            {
                nameManager = CNameManager.CreateInstance();
            }

            // Create a compiler controller object.  It's the one that exposes ICSCompiler,
            // and manages objects whose lifespan extend beyond a single compilation.

            CController cntr = new CController();

            cntr.Initialize(flags, cout, nameManager);
            return(cntr);
        }
示例#4
0
        //------------------------------------------------------------
        // CommandLineCompiler.Compile
        //
        /// <summary>
        /// <para>Compile by arguments.</para>
        /// <para>In sscli, this method is the main entry point.</para>
        /// </summary>
        /// <param name="args"></param>
        /// <returns></returns>
        //------------------------------------------------------------
        internal int Compile(string[] args)
        {
            CNameManager     nameManager = CNameManager.CreateInstance();
            CscConsoleOutput cout        = new CscConsoleOutput(new Uncs.SystemConsole());

            CompilerCreationFlags flags      = CompilerCreationFlags.TRACKCOMMENTS;
            CController           controller = CController.CreateInstance(flags, cout, nameManager);

            cout.SetController(controller);

            COptionManager optManger = controller.OptionManager;

            optManger.DefaultTarget = TargetType.Exe;

            optManger.SetCommandArguments(args);
            optManger.ProcessResponseFiles();
            optManger.ProcessPreSwitches();
            if (controller.HadError)
            {
                return(1);
            }

            if (!optManger.NoLogo)
            {
                cout.PrintBanner();
            }

            if (optManger.ShowHelp)
            {
                OptionInfoManager.PrintCSCHelp(cout);
            }
            else
            {
                optManger.ProcessOptions(Uncs.CommandID.CSC);
                if (!controller.HadError)
                {
                    controller.Compile(null);
                }
            }

            return(controller.HadError?1:0);
        }
示例#5
0
        //------------------------------------------------------------
        // CSourceText.Initialize
        //
        /// <summary>
        /// Read the source file.
        /// </summary>
        /// <param name="fileName">source file name.</param>
        /// <param name="computeChecksum">If true, calculate the checksum.</param>
        /// <param name="encoding">Encoding instance of the source text</param>
        /// <param name="controller">To output error messages.</param>
        /// <returns>If failed to read the file, return false.</returns>
        //------------------------------------------------------------
        internal bool Initialize(
            FileInfo srcFileInfo,
            bool computeChecksum,
            System.Text.Encoding encoding,
            CController controller)
        {
            Exception excp = null;

            // Remember the file name as given to us
            this.sourceFileInfo = srcFileInfo;
            if (srcFileInfo == null)
            {
                sourceText = null;
                return(false);
            }

            if (!IOUtil.ReadTextFile(srcFileInfo.FullName, encoding, out sourceText, out excp))
            {
                sourceText = null;
                controller.ReportError(ERRORKIND.ERROR, excp);
                return(false);
            }
            return(true);
        }
示例#6
0
        //internal CInputSet m_pNext;

        //------------------------------------------------------------
        // CInputSet Constructor
        //
        /// <summary></summary>
        /// <param name="cntr"></param>
        //------------------------------------------------------------
        internal CInputSet(CController cntr)
        {
            DebugUtil.Assert(cntr != null);
            this.controller = cntr;
        }
示例#7
0
 //------------------------------------------------------------
 // CErrorSuppression Constructor (2)
 //
 /// <summary></summary>
 /// <param name="cntr"></param>
 //------------------------------------------------------------
 internal CErrorSuppression(CController cntr)
 {
     Suppress(cntr);
 }
示例#8
0
 //------------------------------------------------------------
 // ConsoleOutput.SetController
 //
 /// <summary></summary>
 /// <param name="contr"></param>
 //------------------------------------------------------------
 virtual internal void SetController(CController contr)
 {
     this.controller = contr;
 }
示例#9
0
        private bool dontDoHashes    = false;   // m_bDontDoHashes      : 1;

        //------------------------------------------------------------
        // CAsmLink Constructor
        //
        /// <summary></summary>
        /// <param name="cntr"></param>
        //------------------------------------------------------------
        internal CAsmLink(CController cntr)
        {
            DebugUtil.Assert(cntr != null);
            this.controller = cntr;
        }