1
0
mirror of https://github.com/fadden/6502bench.git synced 2024-10-12 01:24:01 +00:00
6502bench/SourceGen/SGTestData/2011-hinting.cs
Andy McFadden fac2d6a51f Invoke extension scripts when labels they care about change
We were failing to update properly when a label changed if the label
was one that a plugin cared about.  The problem is that a label
add/remove operation skips the code analysis, and a label edit skips
everything but the display update.  Plugins only run during the code
analysis pass, so changes weren't being reflected in the display
list until something caused it to refresh.

The solution is to ask the plugin if the label being changed is one
that it cares about.  This allows the plugin to use the same
wildcard-match logic that it uses elsewhere.

For efficiency, and to reduce clutter in plugins that don't care
about symbols, a new interface class has been created to handle the
"here are the symbols" call and the "do you care about this label"
call.

The program in Examples/Scripts has been updated to show a very
simple single-call plugin and a slightly more complex multi-call
plugin.
2019-10-13 18:32:53 -07:00

37 lines
1.1 KiB
C#

// Copyright 2018 faddenSoft. All Rights Reserved.
// See the LICENSE.txt file for distribution terms (Apache 2.0).
using System;
using System.Collections.Generic;
using PluginCommon;
namespace RuntimeData.Test2011 {
public class Test2011 : MarshalByRefObject, IPlugin, IPlugin_InlineJsr {
private IApplication mAppRef;
private byte[] mFileData;
public string Identifier {
get {
return "Test 2011-hinting";
}
}
public void Prepare(IApplication appRef, byte[] fileData, AddressTranslate addrTrans) {
mAppRef = appRef;
mFileData = fileData;
mAppRef.DebugLog("Test2011(id=" + AppDomain.CurrentDomain.Id + "): prepare()");
}
public void CheckJsr(int offset, out bool noContinue) {
noContinue = false;
if (offset + 7 < mFileData.Length &&
mFileData[offset + 1] == 0x56 && mFileData[offset + 2] == 0x24) {
mAppRef.SetInlineDataFormat(offset + 3, 4, DataType.NumericLE,
DataSubType.None, null);
}
}
}
}