示例#1
0
 public CodeCompletionSource(ITextBuffer buffer, LabelGraph labelGraph, AsmSimulator asmSimulator)
 {
     this._buffer       = buffer;
     this._labelGraph   = labelGraph;
     this._icons        = new Dictionary <AsmTokenType, ImageSource>();
     this._asmDudeTools = AsmDudeTools.Instance;
     this._asmSimulator = asmSimulator;
     this.Load_Icons();
 }
示例#2
0
 public CodeCompletionSource(ITextBuffer buffer, LabelGraph labelGraph, AsmSimulator asmSimulator)
 {
     this.buffer_       = buffer ?? throw new ArgumentNullException(nameof(buffer));
     this.labelGraph_   = labelGraph ?? throw new ArgumentNullException(nameof(labelGraph));
     this.icons_        = new Dictionary <AsmTokenType, ImageSource>();
     this.asmDudeTools_ = AsmDudeTools.Instance;
     this.asmSimulator_ = asmSimulator ?? throw new ArgumentNullException(nameof(asmSimulator));
     this.Load_Icons();
 }
        public IQuickInfoSource TryCreateQuickInfoSource(ITextBuffer buffer)
        {
            Func <AsmQuickInfoSource> sc = delegate() {
                var labelGraph   = AsmDudeToolsStatic.GetOrCreate_Label_Graph(buffer, this._aggregatorFactory, this._docFactory, this._contentService);
                var asmSimulator = AsmSimulator.GetOrCreate_AsmSimulator(buffer, this._aggregatorFactory);
                return(new AsmQuickInfoSource(buffer, this._aggregatorFactory, labelGraph, asmSimulator));
            };

            return(buffer.Properties.GetOrCreateSingletonProperty(sc));
        }
示例#4
0
        public ITagger <T> CreateTagger <T>(ITextView textView, ITextBuffer buffer) where T : ITag
        {
            Func <ITagger <T> > sc = delegate()
            {
                var          aggregator   = AsmDudeToolsStatic.Get_Aggregator(buffer, this._aggregatorFactory);
                AsmSimulator asmSimulator = AsmSimulator.GetOrCreate_AsmSimulator(buffer, this._aggregatorFactory);
                return(new InfoSquigglesTagger(buffer, aggregator, asmSimulator) as ITagger <T>);
            };

            return(buffer.Properties.GetOrCreateSingletonProperty(sc));
        }
        public ITagger <T> CreateTagger <T>(ITextView textView, ITextBuffer buffer) where T : ITag
        {
            Func <ITagger <T> > sc = delegate()
            {
                var labelGraph   = AsmDudeToolsStatic.GetOrCreate_Label_Graph(buffer, this._aggregatorFactory, this._docFactory, this._contentService);
                var asmSimulator = AsmSimulator.GetOrCreate_AsmSimulator(buffer, this._aggregatorFactory);
                return(new SquigglesTagger(buffer, this._aggregatorFactory, labelGraph, asmSimulator) as ITagger <T>);
            };

            return(buffer.Properties.GetOrCreateSingletonProperty(sc));
        }
示例#6
0
 public AsmQuickInfoSource(
     ITextBuffer buffer,
     IBufferTagAggregatorFactoryService aggregatorFactory,
     LabelGraph labelGraph,
     AsmSimulator asmSimulator)
 {
     this._sourceBuffer = buffer;
     this._aggregator   = AsmDudeToolsStatic.GetOrCreate_Aggregator(buffer, aggregatorFactory);
     this._labelGraph   = labelGraph;
     this._asmSimulator = asmSimulator;
     this._asmDudeTools = AsmDudeTools.Instance;
 }
示例#7
0
 public AsmQuickInfoSource(
     ITextBuffer textBuffer,
     IBufferTagAggregatorFactoryService aggregatorFactory,
     LabelGraph labelGraph,
     AsmSimulator asmSimulator)
 {
     this.textBuffer_   = textBuffer ?? throw new ArgumentNullException(nameof(textBuffer));
     this.aggregator_   = AsmDudeToolsStatic.GetOrCreate_Aggregator(textBuffer, aggregatorFactory);
     this.labelGraph_   = labelGraph ?? throw new ArgumentNullException(nameof(labelGraph));
     this.asmSimulator_ = asmSimulator ?? throw new ArgumentNullException(nameof(asmSimulator));
     this.asmDudeTools_ = AsmDudeTools.Instance;
 }
示例#8
0
        public ITagger <T> CreateTagger <T>(ITextView textView, ITextBuffer buffer) where T : ITag
        {
            ITagger <T> sc()
            {
                LabelGraph   labelGraph   = AsmDudeToolsStatic.GetOrCreate_Label_Graph(buffer, this.aggregatorFactory_, this.docFactory_, this.contentService_);
                AsmSimulator asmSimulator = AsmSimulator.GetOrCreate_AsmSimulator(buffer, this.aggregatorFactory_);

                return(new SquigglesTagger(buffer, this.aggregatorFactory_, labelGraph, asmSimulator) as ITagger <T>);
            }

            return(buffer.Properties.GetOrCreateSingletonProperty(sc));
        }
        public ICompletionSource TryCreateCompletionSource(ITextBuffer buffer)
        {
            CodeCompletionSource sc()
            {
                LabelGraph   labelGraph   = AsmDudeToolsStatic.GetOrCreate_Label_Graph(buffer, this._aggregatorFactory, this._docFactory, this._contentService);
                AsmSimulator asmSimulator = AsmSimulator.GetOrCreate_AsmSimulator(buffer, this._aggregatorFactory);

                return(new CodeCompletionSource(buffer, labelGraph, asmSimulator));
            }

            return(buffer.Properties.GetOrCreateSingletonProperty(sc));
        }
示例#10
0
        //public IAsyncQuickInfoSource TryCreateQuickInfoSource(ITextBuffer textBuffer) //XYZZY NEW
        public IQuickInfoSource TryCreateQuickInfoSource(ITextBuffer textBuffer) //XYZZY OLD
        {
            AsmDudeToolsStatic.Output_INFO(string.Format("{0}:TryCreateQuickInfoSource", this.ToString()));
            AsmQuickInfoSource sc()
            {
                LabelGraph   labelGraph   = AsmDudeToolsStatic.GetOrCreate_Label_Graph(textBuffer, this._aggregatorFactory, this._docFactory, this._contentService);
                AsmSimulator asmSimulator = AsmSimulator.GetOrCreate_AsmSimulator(textBuffer, this._aggregatorFactory);

                return(new AsmQuickInfoSource(textBuffer, this._aggregatorFactory, labelGraph, asmSimulator));
            }

            return(textBuffer.Properties.GetOrCreateSingletonProperty(sc));
        }
示例#11
0
 public AsmQuickInfoSource(
     ITextBuffer buffer,
     ITagAggregator <AsmTokenTag> aggregator,
     ILabelGraph labelGraph,
     AsmSimulator asmSimulator)
 {
     this._sourceBuffer = buffer;
     this._aggregator   = aggregator;
     this._labelGraph   = labelGraph;
     this._asmSimulator = asmSimulator;
     this._asmDudeTools = AsmDudeTools.Instance;
     this._foreground   = AsmDudeToolsStatic.GetFontColor();
 }
示例#12
0
        internal InfoSquigglesTagger(
            ITextBuffer buffer,
            ITagAggregator <AsmTokenTag> aggregator,
            AsmSimulator asmSimulator)
        {
            //AsmDudeToolsStatic.Output(string.Format("INFO: LabelErrorTagger: constructor"));
            this._sourceBuffer      = buffer;
            this._aggregator        = aggregator;
            this._errorListProvider = AsmDudeTools.Instance.Error_List_Provider;
            this._asmSimulator      = asmSimulator;
            this._foreground        = AsmDudeToolsStatic.GetFontColor();

            this._asmSimulator.Simulate_Done_Event += this.Handle_Simulate_Done_Event;
        }
示例#13
0
        public void SetAsmSim(AsmSimulator asmSimulator, Rn reg, int lineNumber, bool isExpanded)
        {
            Contract.Requires(asmSimulator != null);

            this.asmSimulator_ = asmSimulator;
            this.lineNumber_   = lineNumber;

            bool empty = true;

            if (this.asmSimulator_.Enabled & Settings.Default.AsmSim_Show_Register_In_Register_Tooltip)
            {
                this.AsmSimGridExpander.IsExpanded     = isExpanded;
                this.AsmSimGridExpanderNumeration.Text = Settings.Default.AsmSim_Show_Register_In_Register_Tooltip_Numeration;

                this.Generate(true, reg);
                this.Generate(false, reg);
                empty = false;
            }

            this.AsmSimGridExpander.Visibility = empty ? Visibility.Collapsed : Visibility.Visible;
            this.AsmSimGridBorder.Visibility   = empty ? Visibility.Collapsed : Visibility.Visible;

            this.AsmSimGridExpanderNumeration.SelectionChanged += (sender, i) =>
            {
                string         numerationStr = ((sender as ComboBox).SelectedItem as ComboBoxItem).Content.ToString();
                NumerationEnum numeration    = AsmSourceTools.ParseNumeration(numerationStr, false);
                if (numeration == NumerationEnum.UNKNOWN)
                {
                    AsmDudeToolsStatic.Output_WARNING("SetAsmSim:smSimGridExpanderNumeration.SelectionChanged: unknown numerationStr=" + numerationStr);
                }
                //AsmDudeToolsStatic.Output_INFO("AsmSimGridExpanderNumeration:SelectionChanged: numeration="+ numeration);

                string content_before = this.asmSimulator_.Get_Register_Value_If_Already_Computed(reg, this.lineNumber_, true, numeration);
                if (content_before != null)
                {
                    this.textBox_before_.Text = content_before;
                }

                string content_after = this.asmSimulator_.Get_Register_Value_If_Already_Computed(reg, this.lineNumber_, false, numeration);
                if (content_after != null)
                {
                    this.textBox_after_.Text = content_after;
                }
            };
        }
示例#14
0
        internal SquigglesTagger(
            ITextBuffer buffer,
            IBufferTagAggregatorFactoryService aggregatorFactory,
            LabelGraph labelGraph,
            AsmSimulator asmSimulator)
        {
            //AsmDudeToolsStatic.Output_INFO("SquigglesTagger: constructor");
            this._sourceBuffer      = buffer;
            this._aggregator        = AsmDudeToolsStatic.GetOrCreate_Aggregator(buffer, aggregatorFactory);
            this._errorListProvider = AsmDudeTools.Instance.Error_List_Provider;
            this._foreground        = AsmDudeToolsStatic.GetFontColor();

            this._labelGraph = labelGraph;
            if (this._labelGraph.Enabled)
            {
                this._labelGraph.Reset_Done_Event += (o, i) =>
                {
                    this.Update_Squiggles_Tasks_Async().ConfigureAwait(false);
                    this.Update_Error_Tasks_Labels_Async().ConfigureAwait(false);
                };
                this._labelGraph.Reset();
            }

            this._asmSimulator = asmSimulator;
            if (this._asmSimulator.Enabled)
            {
                this._asmSimulator.Line_Updated_Event += (o, e) =>
                {
                    //AsmDudeToolsStatic.Output_INFO("SquigglesTagger:Handling _asmSimulator.Line_Updated_Event: event from " + o + ". Line " + e.LineNumber + ": "+e.Message);
                    this.Update_Squiggles_Tasks_Async(e.LineNumber).ConfigureAwait(false);
                    this.Update_Error_Task_AsmSimAsync(e.LineNumber, e.Message).ConfigureAwait(false);
                };
                this._asmSimulator.Reset_Done_Event += (o, e) =>
                {
                    AsmDudeToolsStatic.Output_INFO("SquigglesTagger:Handling _asmSimulator.Reset_Done_Event: event from " + o);
                    //this.Update_Error_Tasks_AsmSim_Async();
                };
                this._asmSimulator.Reset();
            }
        }
示例#15
0
        internal SquigglesTagger(
            ITextBuffer buffer,
            IBufferTagAggregatorFactoryService aggregatorFactory,
            LabelGraph labelGraph,
            AsmSimulator asmSimulator)
        {
            //AsmDudeToolsStatic.Output_INFO("SquigglesTagger: constructor");
            this.sourceBuffer_      = buffer ?? throw new ArgumentNullException(nameof(buffer));
            this.aggregator_        = AsmDudeToolsStatic.GetOrCreate_Aggregator(buffer, aggregatorFactory);
            this.errorListProvider_ = AsmDudeTools.Instance.Error_List_Provider;
            this.foreground_        = AsmDudeToolsStatic.GetFontColor();

            this.labelGraph_ = labelGraph ?? throw new ArgumentNullException(nameof(labelGraph));
            if (this.labelGraph_.Enabled)
            {
                this.labelGraph_.Reset_Done_Event += (o, i) =>
                {
                    this.Update_Squiggles_Tasks_Async().ConfigureAwait(true);
                    this.Update_Error_Tasks_Labels_Async().ConfigureAwait(true);
                };
                this.labelGraph_.Reset();
            }

            this.asmSimulator_ = asmSimulator ?? throw new ArgumentNullException(nameof(asmSimulator));
            if (this.asmSimulator_.Enabled)
            {
                this.asmSimulator_.Line_Updated_Event += (o, e) =>
                {
                    //AsmDudeToolsStatic.Output_INFO("SquigglesTagger:Handling asmSimulator_.Line_Updated_Event: event from " + o + ". Line " + e.LineNumber + ": "+e.Message);
                    this.Update_Squiggles_Tasks_Async(e.LineNumber).ConfigureAwait(true);
                    this.Update_Error_Task_AsmSimAsync(e.LineNumber, e.Message).ConfigureAwait(true);
                };
                this.asmSimulator_.Reset_Done_Event += (o, e) =>
                {
                    AsmDudeToolsStatic.Output_INFO("SquigglesTagger:Handling asmSimulator_.Reset_Done_Event: event from " + o);
                    //this.Update_Error_Tasks_AsmSim_Async();
                };
                this.asmSimulator_.Reset();
            }
        }
        public void SetAsmSim(AsmSimulator asmSimulator, int lineNumber, bool isExpanded)
        {
            this._asmSimulator = asmSimulator;
            this._lineNumber   = lineNumber;

            bool empty = true;

            if (this._asmSimulator.Enabled & Settings.Default.AsmSim_Show_Register_In_Instruction_Tooltip)
            {
                this._itemsOnPage = new List <TextBox>();

                this.AsmSimGridExpander.IsExpanded     = isExpanded;
                this.AsmSimGridExpanderNumeration.Text = Settings.Default.AsmSim_Show_Register_In_Instruction_Tooltip_Numeration;

                var(ReadReg, WriteReg, ReadFlag, WriteFlag, MemRead, MemWrite) = this._asmSimulator.Get_Usage(lineNumber);
                var readReg  = new HashSet <Rn>(ReadReg);
                var writeReg = new HashSet <Rn>(WriteReg);

                this.GenerateHeader();
                int row = 2;

                foreach (Rn reg in Enum.GetValues(typeof(Rn)))
                {
                    bool b1 = readReg.Contains(reg);
                    bool b2 = writeReg.Contains(reg);
                    if (b1 || b2)
                    {
                        empty = false;
                        if (b1)
                        {
                            this.Generate(reg, true, row);
                        }
                        if (b2)
                        {
                            this.Generate(reg, false, row);
                        }
                        row++;
                    }
                }

                foreach (Flags flag in FlagTools.GetFlags(ReadFlag | WriteFlag))
                {
                    if (flag == Flags.NONE)
                    {
                        continue;
                    }
                    bool b1 = ReadFlag.HasFlag(flag);
                    bool b2 = WriteFlag.HasFlag(flag);
                    if (b1 || b2)
                    {
                        empty = false;
                        if (b1)
                        {
                            this.Generate(flag, true, row);
                        }
                        if (b2)
                        {
                            this.Generate(flag, false, row);
                        }
                        row++;
                    }
                }
            }

            this.AsmSimGridExpander.Visibility = (empty) ? Visibility.Collapsed : Visibility.Visible;
            this.AsmSimGridBorder.Visibility   = (empty) ? Visibility.Collapsed : Visibility.Visible;

            this.AsmSimGridExpanderNumeration.SelectionChanged += (sender, i) =>
            {
                string         numerationStr = ((sender as ComboBox).SelectedItem as ComboBoxItem).Content.ToString();
                NumerationEnum numeration    = AsmSourceTools.ParseNumeration(numerationStr);
                if (numeration == NumerationEnum.UNKNOWN)
                {
                    AsmDudeToolsStatic.Output_WARNING("SetAsmSim:smSimGridExpanderNumeration.SelectionChanged: unknown numerationStr=" + numerationStr);
                }
                //AsmDudeToolsStatic.Output_INFO("AsmSimGridExpanderNumeration:SelectionChanged: numeration="+ numeration);

                foreach (var textBox in this._itemsOnPage)
                {
                    var info = textBox.Tag as ButtonInfo;

                    string content = (info.reg == Rn.NOREG)
                        ? this._asmSimulator.Get_Flag_Value_If_Already_Computed(info.flag, this._lineNumber, info.before)
                        : this._asmSimulator.Get_Register_Value_If_Already_Computed(info.reg, this._lineNumber, info.before, numeration);

                    if (content != null)
                    {
                        textBox.Text = info.reg.ToString() + " = " + content;
                    }
                }
            };
        }