1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-10 04:22:20 +02:00

Allow clicking on reg in mem window, other minor fixes

This commit is contained in:
Brian Fiete 2019-12-25 12:43:45 -08:00
parent 4dcd7f9c6a
commit 2618b29daa
13 changed files with 96 additions and 32 deletions

View file

@ -141,9 +141,13 @@ namespace System.FFI
{
NotSet = 0,
StdCall = 1,
#unwarn
ThisCall = 1,
#unwarn
FastCall = 1,
#unwarn
MS_CDecl = 1,
#unwarn
Default = 1
}
#else

View file

@ -26,6 +26,7 @@ namespace System.Globalization
TAIWANLUNISOLAR = 21,
PERSIAN = 22,
UMALQURA = 23,
#unwarn
LAST_CALENDAR = 23 // Last calendar ID
}

View file

@ -893,7 +893,9 @@ namespace System.Reflection
// vtable layout mask - Use this mask to retrieve vtable attributes.
VtableLayoutMask = 0x0100,
#unwarn
ReuseSlot = 0x0000, // The default.
#unwarn
NewSlot = 0x0100, // Method always gets a new slot in the vtable.
// end vtable layout mask

View file

@ -32,6 +32,7 @@ namespace System
ENABLE_AAA = 0x10000,
FROM_DEFAULT_CONTEXT = 0x20000,
ACTIVATE_X86_SERVER = 0x40000,
#unwarn
ACTIVATE_32_BIT_SERVER = ACTIVATE_X86_SERVER,
ACTIVATE_64_BIT_SERVER = 0x80000,
ENABLE_CLOAKING = 0x100000,
@ -198,6 +199,8 @@ namespace System
public const int32 KEY_ALL_ACCESS = 0x000f003f;
public const int32 MB_OK = 0;
public const int32 MB_OKCANCEL = 1;
public const int32 MB_YESNO = 4;
public const int32 MB_ICONHAND = 0x10;
public const int32 MB_ICONQUESTION = 0x20;
@ -1361,16 +1364,16 @@ namespace System
[CLink, StdCall]
public static extern IntBool SetFileAttributesW(char16* name, int32 attribs);
[CLink, StdCall]
[Import("user32.lib"), CLink, StdCall]
public static extern int32 MessageBoxA(HWnd hWnd, char8* text, char8* caption, int32 type);
[CLink, StdCall]
[Import("user32.lib"), CLink, StdCall]
public static extern int32 MessageBoxW(HWnd hWnd, char16* text, char16* caption, int32 type);
[CLink, StdCall]
public static extern int32 SetErrorMode(int32 errorMode);
[CLink, StdCall]
[Import("user32.lib"), CLink, StdCall]
public static extern HWnd GetActiveWindow();
[Import("user32.lib"), CLink, StdCall]

View file

@ -143,10 +143,34 @@ void TestMem()
memcpy(cPtr, str, 3);
}
void Test6()
{
}
void Test5(int a, void* b, void* c)
{
}
void Test4(int a, int b, int c)
{
Test5(10, Test6, NULL);
}
void Test3(int a)
{
Test4(100, 200, 300);
}
// THIS IS VERSION 6.
extern "C"
__declspec(dllexport) void Test2(int aa, int bb, int cc, int dd)
{
Test3(10);
char* strP = "Hey yo";
TestMem();
Zorq();

View file

@ -88,6 +88,7 @@
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<OmitFramePointers>true</OmitFramePointers>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
@ -123,6 +124,7 @@
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<OmitFramePointers>true</OmitFramePointers>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
@ -140,6 +142,7 @@
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<OmitFramePointers>true</OmitFramePointers>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>

View file

@ -25,7 +25,7 @@ OtherLinkFlags = ""
TargetDirectory = "$(WorkspaceDir)/dist"
TargetName = "BeefIDE_d"
OtherLinkFlags = "$(LinkFlags) Comdlg32.lib kernel32.lib user32.lib advapi32.lib shell32.lib IDEHelper64_d.lib"
DebugCommandArguments = "-workspace=C:\\Proj\\CycloBuddy"
DebugCommandArguments = "-proddir=C:\\proj\\CycloBuddy"
DebugWorkingDirectory = "c:\\Beef\\IDE\\Tests\\EmptyTest"
EnvironmentVars = ["_NO_DEBUG_HEAP=1"]
@ -49,7 +49,7 @@ OtherLinkFlags = ""
TargetDirectory = "$(WorkspaceDir)/dist"
TargetName = "BeefIDE_d2"
OtherLinkFlags = "$(LinkFlags) Comdlg32.lib kernel32.lib user32.lib advapi32.lib shell32.lib IDEHelper64_d.lib BeefySysLib64_d.lib wsock32.lib"
DebugCommandArguments = "-proddir=C:\\Beef\\IDEHelper\\Tests"
DebugCommandArguments = "-proddir=C:\\Beef\\ide\\mintest"
DebugWorkingDirectory = "$(ProjectDir)\\dist"
EnvironmentVars = ["_NO_DEBUG_HEAP=1"]

View file

@ -216,36 +216,23 @@ namespace Hey.Dude.Bro
}
}
public static void Florgs()
{
}
public static int Main(String[] args)
{
Int i = (.)123;
i = i + i;
function void() func = => Florgs;
int32 val = (int32)(int)(void*)func;
Zangles zang = scope .();
Zangles.GetMe(zang, "hey");
TypeCode tc = .Boolean;
PrintF("Hey\n");
//Test2(1, 2, 3, 4);
/*IHashable ih = (int32)TypeCode.Boolean;
let hashCode = ih.GetHashCode();*/
Object obj = new Object();
int* iPtr = scope .();
int hash = GetHash(iPtr);
//void* ptr = "Hey";
//val = (int32)ptr;
//Test2(1, 2, 3, 4);
//Test2(1, 2, val, 4);
Blurg.Hey();
return 1;
}
@ -334,3 +321,10 @@ static
static int gApsings = 123;
}
/*namespace zSquarf
{
class Zorf
{
}
}*/

View file

@ -1,3 +1,5 @@
//using Squarf;
//GORB
#pragma warning disable 168
@ -6,10 +8,19 @@ using System.Collections.Generic;
using System.Diagnostics;
using System.Threading;
enum EnumA
{
Abo = 1,
Boop = _*2,
Croop = _*2,
}
struct Blurg
{
public static int32 Hey()
{
int a = 123;
int* aPtr = &a;
return (int32)123;
}

View file

@ -4282,7 +4282,7 @@ namespace IDE
return result;
}
public void RecordHistoryLocation(bool includeLastActive = false, bool b = true)
public void RecordHistoryLocation(bool includeLastActive = false)
{
var sourceViewPanel = GetActiveSourceViewPanel(includeLastActive);
if (sourceViewPanel != null)

View file

@ -495,6 +495,7 @@ namespace IDE.ui
public uint32 mDisplayColor;
public bool mIsReg;
public bool mIsVisible;
public Rect? mDrawRect;
public this(BinaryDataWidget binaryDataWidget, StringView expr, int memStart, int size, StringView displayName, uint32 displayColor, bool isReg)
{
@ -861,6 +862,9 @@ namespace IDE.ui
{
base.Draw(g);
for (var te in mTrackedExprs)
te.mDrawRect = null;
int barThickness = (int)GS!(1.5f);
/*
@ -1429,6 +1433,8 @@ namespace IDE.ui
}
}
for (var kvp in trackedRegYDict)
{
var te = kvp.key;
@ -1441,6 +1447,9 @@ namespace IDE.ui
var useFont = IDEApp.sApp.mTinyCodeFont;
float strWidth = useFont.GetWidth(te.mExpr);
bool shortLine = trackedRegYShortLines[lineIdx];
var useLineSpacing = useFont.GetLineSpacing();
te.mDrawRect = Rect(barX, barY, strWidth + GS!(2), useLineSpacing + GS!(2));
if (te.mDisplayName.StartsWith("$"))
continue;
@ -1448,7 +1457,6 @@ namespace IDE.ui
using (g.PushColor(te.mDisplayColor))
{
var regsOnThisLine = trackedRegsByLine[lineIdx].Count;
var useLineSpacing = useFont.GetLineSpacing();
float barYAdj = barY + useLineSpacing*0.5f + GS!(1);
float barGoalYAdj = barGoalY + useLineSpacing*0.5f + GS!(1);
if (regsOnThisLine == 2)
@ -1699,6 +1707,18 @@ namespace IDE.ui
var selection = GetSelectionForDisplayPosition(x, y, 1, 1);
if (selection == null)
{
for (var te in mTrackedExprs)
{
if ((var rect = te.mDrawRect) && (rect.Contains(x, y)))
{
SelectRange(te.mCurValue, 0);
break;
}
}
}
if (selection != null)
{
delete mCurKeyCursor;

View file

@ -687,7 +687,9 @@ namespace IDE.ui
if (folder.mIncludeKind != .Auto)
folder.mProject.SetChanged();
gApp.RecordHistoryLocation(true);
gApp.ShowProjectItem(projectSource);
gApp.RecordHistoryLocation(true);
}
int CompareListViewItem(ListViewItem left, ListViewItem right)

View file

@ -7938,7 +7938,7 @@ BfIRValue BfModule::CastToValue(BfAstNode* srcNode, BfTypedValue typedVal, BfTyp
{
if ((!ignoreErrors) && (!typedVal.mType->GetUnderlyingType()->IsVoid()) && ((castFlags & BfCastFlags_FromCompiler) == 0))
{
Fail(StrFormat("Unable to cast direct from '%s' to '%s', consider casting to void* first", TypeToString(typedVal.mType).c_str(), TypeToString(toType).c_str()), srcNode);
Fail(StrFormat("Unable to cast directly from '%s' to '%s', consider casting to void* first", TypeToString(typedVal.mType).c_str(), TypeToString(toType).c_str()), srcNode);
}
auto toPrimitive = (BfPrimitiveType*)toType;
@ -7950,7 +7950,7 @@ BfIRValue BfModule::CastToValue(BfAstNode* srcNode, BfTypedValue typedVal, BfTyp
{
if ((!ignoreErrors) && (!toType->GetUnderlyingType()->IsVoid()) && ((castFlags & BfCastFlags_FromCompiler) == 0))
{
Fail(StrFormat("Unable to cast direct from '%s' to '%s', consider casting to void* first", TypeToString(typedVal.mType).c_str(), TypeToString(toType).c_str()), srcNode);
Fail(StrFormat("Unable to cast directly from '%s' to '%s', consider casting to void* first", TypeToString(typedVal.mType).c_str(), TypeToString(toType).c_str()), srcNode);
}
return mBfIRBuilder->CreateIntToPtr(typedVal.mValue, mBfIRBuilder->MapType(toType));