예제 #1
0
        public LabelGraph(
            ITextBuffer buffer,
            IBufferTagAggregatorFactoryService aggregatorFactory,
            ErrorListProvider errorListProvider,
            ITextDocumentFactoryService docFactory,
            IContentType contentType)
        {
            //AsmDudeToolsStatic.Output(string.Format("INFO: LabelGraph: constructor: creating a label graph for {0}", AsmDudeToolsStatic.GetFileName(buffer)));
            this._buffer            = buffer;
            this._aggregatorFactory = aggregatorFactory;
            this._errorListProvider = errorListProvider;
            this._docFactory        = docFactory;
            this._contentType       = contentType;

            this._filenames = new Dictionary <uint, string>();
            this._usedAt    = new Dictionary <string, IList <uint> >();
            this._defAt     = new Dictionary <string, IList <uint> >();
            this._hasLabel  = new HashSet <uint>();
            this._hasDef    = new HashSet <uint>();

            this._thisFilename = AsmDudeToolsStatic.GetFileName(this._buffer);
            this._enabled      = true;
            this._busy         = false;
            this._waiting      = false;
            this._scheduled    = false;

            this._buffer.ChangedLowPriority += this.BufferChanged;
            this.reset_Delayed();
        }
예제 #2
0
        private void reset(object threadContext)
        {
            if (!this._enabled)
            {
                return;
            }

            this._waiting = true;
            Thread.Sleep(AsmDudePackage.msSleepBeforeAsyncExecution);
            this._busy    = true;
            this._waiting = false;

            #region Payload
            lock (_updateLock) {
                DateTime time1 = DateTime.Now;

                _usedAt.Clear();
                _defAt.Clear();
                _hasLabel.Clear();
                _hasDef.Clear();
                _filenames.Clear();
                _filenames.Add(0, AsmDudeToolsStatic.GetFileName(this._buffer));

                this.addAll(this._buffer, 0);

                AsmDudeToolsStatic.printSpeedWarning(time1, "LabelGraph");
                double elapsedSec = (double)(DateTime.Now.Ticks - time1.Ticks) / 10000000;
                if (elapsedSec > AsmDudePackage.slowShutdownThresholdSec)
                {
                    this.disable();
                }
            }
            #endregion Payload

            this.OnResetDoneEvent(new CustomEventArgs("Resetting LabelGraph is finished"));

            this._busy = false;
            if (this._scheduled)
            {
                this._scheduled = false;
                this.reset_Delayed();
            }
        }
예제 #3
0
        private void Reset(object threadContext)
        {
            if (!this.Is_Enabled)
            {
                return;
            }

            this._waiting = true;
            Thread.Sleep(AsmDudePackage.msSleepBeforeAsyncExecution);
            this._busy    = true;
            this._waiting = false;

            #region Payload
            lock (this._updateLock)
            {
                DateTime time1 = DateTime.Now;

                this._usedAt.Clear();
                this._defAt.Clear();
                this._defAt_PROTO.Clear();
                this._hasLabel.Clear();
                this._hasDef.Clear();
                this._filenames.Clear();
                this._filenames.Add(0, AsmDudeToolsStatic.GetFileName(this._buffer));
                this._undefined_includes.Clear();

                const uint fileId = 0; // use fileId=0 for the main file (and use numbers higher than 0 for included files)
                Add_All(this._buffer, fileId);

                AsmDudeToolsStatic.Print_Speed_Warning(time1, "LabelGraph");
                double elapsedSec = (double)(DateTime.Now.Ticks - time1.Ticks) / 10000000;
                if (elapsedSec > AsmDudePackage.slowShutdownThresholdSec)
                {
#                   if DEBUG
                    AsmDudeToolsStatic.Output_WARNING("LabelGraph: Reset: disabled label analysis had I been in Release mode");
#                   else
                    Disable();
#                   endif
                }