diff --git a/Beef.sln b/Beef.sln
index 71525de7..d0679726 100644
--- a/Beef.sln
+++ b/Beef.sln
@@ -405,7 +405,7 @@ Global
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
- VD_Solution = |§r|§n|§r|§n |§r|§n X86|§r|§n |§r|§n
SolutionGuid = {460361DC-9F40-4AE7-B647-82D5D69B70DC}
+ VD_Solution = |§r|§n|§r|§n |§r|§n X86|§r|§n |§r|§n
EndGlobalSection
EndGlobal
diff --git a/BeefLibs/Beefy2D/src/BFApp.bf b/BeefLibs/Beefy2D/src/BFApp.bf
index 89d769f3..e6f68a3d 100644
--- a/BeefLibs/Beefy2D/src/BFApp.bf
+++ b/BeefLibs/Beefy2D/src/BFApp.bf
@@ -1,7 +1,6 @@
using System;
using System.Collections.Generic;
using System.Text;
-using System.Runtime.InteropServices;
using System.Diagnostics;
using System.IO;
using Beefy.gfx;
diff --git a/BeefLibs/Beefy2D/src/BFWindow.bf b/BeefLibs/Beefy2D/src/BFWindow.bf
index 6e6903e8..3dc95c47 100644
--- a/BeefLibs/Beefy2D/src/BFWindow.bf
+++ b/BeefLibs/Beefy2D/src/BFWindow.bf
@@ -1,7 +1,6 @@
using System;
using System.Collections.Generic;
using System.Text;
-using System.Runtime.InteropServices;
using System.Diagnostics;
using Beefy.gfx;
using Beefy.sys;
diff --git a/BeefLibs/Beefy2D/src/Utils.bf b/BeefLibs/Beefy2D/src/Utils.bf
index 63bd03a9..e3bdde0f 100644
--- a/BeefLibs/Beefy2D/src/Utils.bf
+++ b/BeefLibs/Beefy2D/src/Utils.bf
@@ -1,7 +1,6 @@
using System;
using System.Collections.Generic;
using System.Text;
-using System.Runtime.InteropServices;
using System.Reflection;
using System.Threading;
using System.IO;
diff --git a/BeefLibs/Beefy2D/src/gfx/ConstantDataDefinition.bf b/BeefLibs/Beefy2D/src/gfx/ConstantDataDefinition.bf
index 0c2cbb39..7a726e2b 100644
--- a/BeefLibs/Beefy2D/src/gfx/ConstantDataDefinition.bf
+++ b/BeefLibs/Beefy2D/src/gfx/ConstantDataDefinition.bf
@@ -2,7 +2,6 @@ using System;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;
-using System.Runtime.InteropServices;
using System.Reflection;
using System.Diagnostics;
diff --git a/BeefLibs/Beefy2D/src/gfx/DrawLayer.bf b/BeefLibs/Beefy2D/src/gfx/DrawLayer.bf
index c1b37661..09b8b4df 100644
--- a/BeefLibs/Beefy2D/src/gfx/DrawLayer.bf
+++ b/BeefLibs/Beefy2D/src/gfx/DrawLayer.bf
@@ -1,6 +1,5 @@
using System;
using System.Collections.Generic;
-using System.Runtime.InteropServices;
using System.Text;
using Beefy.widgets;
using Beefy;
diff --git a/BeefLibs/Beefy2D/src/gfx/Font.bf b/BeefLibs/Beefy2D/src/gfx/Font.bf
index f85effd8..fddb5d92 100644
--- a/BeefLibs/Beefy2D/src/gfx/Font.bf
+++ b/BeefLibs/Beefy2D/src/gfx/Font.bf
@@ -1,5 +1,4 @@
using System;
-using System.Runtime.InteropServices;
using System.Collections.Generic;
using System.Text;
using System.IO;
diff --git a/BeefLibs/Beefy2D/src/gfx/Graphics.bf b/BeefLibs/Beefy2D/src/gfx/Graphics.bf
index 38552d58..17cc13c2 100644
--- a/BeefLibs/Beefy2D/src/gfx/Graphics.bf
+++ b/BeefLibs/Beefy2D/src/gfx/Graphics.bf
@@ -1,7 +1,6 @@
using System;
using System.Collections.Generic;
using System.Text;
-using System.Runtime.InteropServices;
using Beefy.utils;
using Beefy.geom;
using System.Diagnostics;
diff --git a/BeefLibs/Beefy2D/src/gfx/Image.bf b/BeefLibs/Beefy2D/src/gfx/Image.bf
index 0df2ea4b..275ceaf8 100644
--- a/BeefLibs/Beefy2D/src/gfx/Image.bf
+++ b/BeefLibs/Beefy2D/src/gfx/Image.bf
@@ -1,7 +1,6 @@
using System;
using System.Collections.Generic;
using System.Text;
-using System.Runtime.InteropServices;
using Beefy.utils;
using System.Diagnostics;
diff --git a/BeefLibs/Beefy2D/src/gfx/Model.bf b/BeefLibs/Beefy2D/src/gfx/Model.bf
index dc47ee35..fc1ef489 100644
--- a/BeefLibs/Beefy2D/src/gfx/Model.bf
+++ b/BeefLibs/Beefy2D/src/gfx/Model.bf
@@ -1,7 +1,6 @@
using System;
using System.Collections.Generic;
using System.Text;
-using System.Runtime.InteropServices;
using System.Threading.Tasks;
using Beefy;
using Beefy.utils;
diff --git a/BeefLibs/Beefy2D/src/gfx/RenderState.bf b/BeefLibs/Beefy2D/src/gfx/RenderState.bf
index dc769822..31f6713d 100644
--- a/BeefLibs/Beefy2D/src/gfx/RenderState.bf
+++ b/BeefLibs/Beefy2D/src/gfx/RenderState.bf
@@ -1,6 +1,5 @@
using System;
using System.Collections.Generic;
-using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
using Beefy;
diff --git a/BeefLibs/Beefy2D/src/gfx/Shader.bf b/BeefLibs/Beefy2D/src/gfx/Shader.bf
index 53f73ddf..c2835f4e 100644
--- a/BeefLibs/Beefy2D/src/gfx/Shader.bf
+++ b/BeefLibs/Beefy2D/src/gfx/Shader.bf
@@ -1,7 +1,6 @@
using System;
using System.Collections.Generic;
using System.Text;
-using System.Runtime.InteropServices;
namespace Beefy.gfx
{
diff --git a/BeefLibs/Beefy2D/src/gfx/Vertex3D.bf b/BeefLibs/Beefy2D/src/gfx/Vertex3D.bf
index 8326728f..6823c9fa 100644
--- a/BeefLibs/Beefy2D/src/gfx/Vertex3D.bf
+++ b/BeefLibs/Beefy2D/src/gfx/Vertex3D.bf
@@ -2,7 +2,6 @@ using System;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;
-using System.Runtime.InteropServices;
namespace Beefy.gfx
{
diff --git a/BeefLibs/Beefy2D/src/gfx/VertexDefinition.bf b/BeefLibs/Beefy2D/src/gfx/VertexDefinition.bf
index a1622f17..87f89356 100644
--- a/BeefLibs/Beefy2D/src/gfx/VertexDefinition.bf
+++ b/BeefLibs/Beefy2D/src/gfx/VertexDefinition.bf
@@ -2,7 +2,6 @@ using System;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;
-using System.Runtime.InteropServices;
using System.Reflection;
using System.Diagnostics;
diff --git a/BeefLibs/Beefy2D/src/res/PSDReader.bf b/BeefLibs/Beefy2D/src/res/PSDReader.bf
index ff663221..dd53c74c 100644
--- a/BeefLibs/Beefy2D/src/res/PSDReader.bf
+++ b/BeefLibs/Beefy2D/src/res/PSDReader.bf
@@ -1,7 +1,6 @@
using System;
using System.Collections.Generic;
using System.Text;
-using System.Runtime.InteropServices;
using Beefy.gfx;
namespace Beefy.res
diff --git a/BeefLibs/Beefy2D/src/res/ResourceManager.bf b/BeefLibs/Beefy2D/src/res/ResourceManager.bf
index 784d66e5..90e05d00 100644
--- a/BeefLibs/Beefy2D/src/res/ResourceManager.bf
+++ b/BeefLibs/Beefy2D/src/res/ResourceManager.bf
@@ -4,7 +4,6 @@ using System.Text;
using System.Reflection;
using Beefy.utils;
using Beefy.gfx;
-using System.Runtime.InteropServices;
namespace Beefy.res
{
diff --git a/BeefLibs/Beefy2D/src/res/SoundBank.bf b/BeefLibs/Beefy2D/src/res/SoundBank.bf
index a545b9a5..2bb7e1bf 100644
--- a/BeefLibs/Beefy2D/src/res/SoundBank.bf
+++ b/BeefLibs/Beefy2D/src/res/SoundBank.bf
@@ -1,7 +1,6 @@
using System;
using System.Collections.Generic;
using System.Text;
-using System.Runtime.InteropServices;
using Beefy;
namespace Beefy.res
diff --git a/BeefLibs/Beefy2D/src/res/SoundEvent.bf b/BeefLibs/Beefy2D/src/res/SoundEvent.bf
index 259cc5c9..963becc3 100644
--- a/BeefLibs/Beefy2D/src/res/SoundEvent.bf
+++ b/BeefLibs/Beefy2D/src/res/SoundEvent.bf
@@ -1,7 +1,6 @@
using System;
using System.Collections.Generic;
using System.Text;
-using System.Runtime.InteropServices;
using Beefy;
namespace Beefy.res
diff --git a/BeefLibs/Beefy2D/src/res/SoundParameter.bf b/BeefLibs/Beefy2D/src/res/SoundParameter.bf
index cc87b457..aa2c8990 100644
--- a/BeefLibs/Beefy2D/src/res/SoundParameter.bf
+++ b/BeefLibs/Beefy2D/src/res/SoundParameter.bf
@@ -1,7 +1,6 @@
using System;
using System.Collections.Generic;
using System.Text;
-using System.Runtime.InteropServices;
using Beefy;
namespace Beefy.res
diff --git a/BeefLibs/Beefy2D/src/sys/SysMenu.bf b/BeefLibs/Beefy2D/src/sys/SysMenu.bf
index a2a9b2b5..495d50a6 100644
--- a/BeefLibs/Beefy2D/src/sys/SysMenu.bf
+++ b/BeefLibs/Beefy2D/src/sys/SysMenu.bf
@@ -3,7 +3,6 @@ using System.Collections.Generic;
using System.Text;
using Beefy.widgets;
using Beefy;
-using System.Runtime.InteropServices;
namespace Beefy.sys
{
diff --git a/BeefLibs/Beefy2D/src/theme/dark/DarkTooltip.bf b/BeefLibs/Beefy2D/src/theme/dark/DarkTooltip.bf
index d2600cbd..ed609cd9 100644
--- a/BeefLibs/Beefy2D/src/theme/dark/DarkTooltip.bf
+++ b/BeefLibs/Beefy2D/src/theme/dark/DarkTooltip.bf
@@ -82,6 +82,7 @@ namespace Beefy.theme.dark
public ~this()
{
+ Debug.Assert(mHasClosed);
Detach();
}
@@ -187,11 +188,6 @@ namespace Beefy.theme.dark
if (mWidgetWindow != null)
{
- WidgetWindow.sOnMouseDown.Remove(scope => HandleMouseDown, true);
- WidgetWindow.sOnMouseWheel.Remove(scope => HandleMouseWheel, true);
- WidgetWindow.sOnMenuItemSelected.Remove(scope => HandleSysMenuItemSelected, true);
- WidgetWindow.sOnKeyDown.Remove(scope => HandleKeyDown, true);
-
mWidgetWindow.Close();
}
mCloseEvent();
@@ -249,6 +245,18 @@ namespace Beefy.theme.dark
Close();
}
+
+ protected override void RemovedFromWindow()
+ {
+ base.RemovedFromWindow();
+
+ Debug.Assert(mHasClosed);
+
+ WidgetWindow.sOnMouseDown.Remove(scope => HandleMouseDown, true);
+ WidgetWindow.sOnMouseWheel.Remove(scope => HandleMouseWheel, true);
+ WidgetWindow.sOnMenuItemSelected.Remove(scope => HandleSysMenuItemSelected, true);
+ WidgetWindow.sOnKeyDown.Remove(scope => HandleKeyDown, true);
+ }
}
static class DarkTooltipManager
diff --git a/BeefLibs/Beefy2D/src/utils/BeefPerf.bf b/BeefLibs/Beefy2D/src/utils/BeefPerf.bf
index d162c63c..dba781ea 100644
--- a/BeefLibs/Beefy2D/src/utils/BeefPerf.bf
+++ b/BeefLibs/Beefy2D/src/utils/BeefPerf.bf
@@ -1,5 +1,4 @@
using System;
-using System.Runtime.InteropServices;
namespace Beefy.utils
{
diff --git a/BeefLibs/Beefy2D/src/utils/PerfTimer.bf b/BeefLibs/Beefy2D/src/utils/PerfTimer.bf
index 0bc7d415..7328c757 100644
--- a/BeefLibs/Beefy2D/src/utils/PerfTimer.bf
+++ b/BeefLibs/Beefy2D/src/utils/PerfTimer.bf
@@ -1,6 +1,5 @@
using System;
using System.Collections.Generic;
-using System.Runtime.InteropServices;
using System.Text;
namespace Beefy.utils
diff --git a/BeefLibs/Beefy2D/src/widgets/ButtonWidget.bf b/BeefLibs/Beefy2D/src/widgets/ButtonWidget.bf
index ef328c64..6dbac60e 100644
--- a/BeefLibs/Beefy2D/src/widgets/ButtonWidget.bf
+++ b/BeefLibs/Beefy2D/src/widgets/ButtonWidget.bf
@@ -2,7 +2,6 @@ using System;
using System.Collections.Generic;
using System.Text;
using Beefy.gfx;
-using System.Runtime.InteropServices;
namespace Beefy.widgets
{
diff --git a/BeefLibs/Beefy2D/src/widgets/EditWidget.bf b/BeefLibs/Beefy2D/src/widgets/EditWidget.bf
index 10879703..7f285bfe 100644
--- a/BeefLibs/Beefy2D/src/widgets/EditWidget.bf
+++ b/BeefLibs/Beefy2D/src/widgets/EditWidget.bf
@@ -1,6 +1,5 @@
using System;
using System.Collections.Generic;
-using System.Runtime.InteropServices;
using System.Diagnostics;
using System.Text;
using System.Threading;
diff --git a/BeefLibs/Beefy2D/src/widgets/ListView.bf b/BeefLibs/Beefy2D/src/widgets/ListView.bf
index a7101b49..7bbb6add 100644
--- a/BeefLibs/Beefy2D/src/widgets/ListView.bf
+++ b/BeefLibs/Beefy2D/src/widgets/ListView.bf
@@ -852,7 +852,7 @@ namespace Beefy.widgets
newSelection = GetRoot();
while (newSelection.mChildAreaHeight > 0)
{
- newSelection = GetRoot().mChildItems[GetRoot().mChildItems.Count - 1];
+ newSelection = newSelection.mChildItems[newSelection.mChildItems.Count - 1];
}
case KeyCode.PageUp:
int32 numIterations = (int32)(mScrollContentContainer.mHeight / selectedItem.mSelfHeight);
diff --git a/BeefLibs/corlib/src/System/Attribute.bf b/BeefLibs/corlib/src/System/Attribute.bf
index d5d3ee03..d80e506c 100644
--- a/BeefLibs/corlib/src/System/Attribute.bf
+++ b/BeefLibs/corlib/src/System/Attribute.bf
@@ -277,33 +277,6 @@ namespace System
public bool Profile;
}
- namespace Runtime.InteropServices
- {
- public enum CallingConvention
- {
- Winapi = 1,
- Cdecl = 2,
- StdCall = 3,
- ThisCall = 4,
- FastCall = 5,
-
- Default = Cdecl
- }
-
- [AttributeUsage(AttributeTargets.Method /*3*/)]
- public struct DllImportAttribute : Attribute
- {
- public this(String dllName)
- {
- CallingConvention = .Default;
- CLink = false;
- }
-
- public CallingConvention CallingConvention;
- public bool CLink;
- }
- }
-
public struct ImportAttribute : Attribute
{
public this(String libName)
@@ -311,6 +284,11 @@ namespace System
}
}
+ public struct ExportAttribute : Attribute
+ {
+
+ }
+
[AttributeUsage(AttributeTargets.StaticField | AttributeTargets.Field, .NotInherited)]
public struct ThreadStaticAttribute : Attribute
{
diff --git a/BeefLibs/corlib/src/System/Collections/Generic/Dictionary.bf b/BeefLibs/corlib/src/System/Collections/Generic/Dictionary.bf
index 8474e523..e34e1039 100644
--- a/BeefLibs/corlib/src/System/Collections/Generic/Dictionary.bf
+++ b/BeefLibs/corlib/src/System/Collections/Generic/Dictionary.bf
@@ -261,7 +261,7 @@ namespace System.Collections.Generic
return -1;
}
- private int FindEntryAlt(TOther key) where TOther : IOpEquals, IHashable
+ private int FindEntryWith(TAltKey key) where TAltKey : IOpEquals, IHashable
{
if (mBuckets != null)
{
@@ -545,6 +545,20 @@ namespace System.Collections.Generic
return false;
}
+ public bool TryGetWith(TAltKey key, out TKey matchKey, out TValue value) where TAltKey : IOpEquals, IHashable
+ {
+ int_cosize i = (int_cosize)FindEntryWith(key);
+ if (i >= 0)
+ {
+ matchKey = mEntries[i].mKey;
+ value = mEntries[i].mValue;
+ return true;
+ }
+ matchKey = default(TKey);
+ value = default(TValue);
+ return false;
+ }
+
public TValue GetValueOrDefault(TKey key)
{
int_cosize i = (int_cosize)FindEntry(key);
diff --git a/BeefLibs/corlib/src/System/Collections/IEnumerator.bf b/BeefLibs/corlib/src/System/Collections/IEnumerator.bf
index 79b192ed..89855c8a 100644
--- a/BeefLibs/corlib/src/System/Collections/IEnumerator.bf
+++ b/BeefLibs/corlib/src/System/Collections/IEnumerator.bf
@@ -1,5 +1,4 @@
using System;
-using System.Runtime.InteropServices;
namespace System.Collections.Generic
{
diff --git a/BeefLibs/corlib/src/System/DateTimeOffset.bf b/BeefLibs/corlib/src/System/DateTimeOffset.bf
index d02c00c3..3d3ad8d7 100644
--- a/BeefLibs/corlib/src/System/DateTimeOffset.bf
+++ b/BeefLibs/corlib/src/System/DateTimeOffset.bf
@@ -8,7 +8,6 @@ namespace System {
using System;
using System.Threading;
using System.Globalization;
- using System.Runtime.InteropServices;
using System.Runtime.CompilerServices;
using System.Diagnostics.Contracts;
diff --git a/BeefLibs/corlib/src/System/Double.bf b/BeefLibs/corlib/src/System/Double.bf
index 5293e110..31f524e4 100644
--- a/BeefLibs/corlib/src/System/Double.bf
+++ b/BeefLibs/corlib/src/System/Double.bf
@@ -6,7 +6,6 @@ namespace System
{
using System;
using System.Globalization;
- using System.Runtime.InteropServices;
using System.Runtime.CompilerServices;
using System.Diagnostics.Contracts;
using System.Diagnostics;
diff --git a/BeefLibs/corlib/src/System/Globalization/CalendarData.bf b/BeefLibs/corlib/src/System/Globalization/CalendarData.bf
index c801ed7c..9a56c4dc 100644
--- a/BeefLibs/corlib/src/System/Globalization/CalendarData.bf
+++ b/BeefLibs/corlib/src/System/Globalization/CalendarData.bf
@@ -6,7 +6,6 @@ namespace System.Globalization
{
using System;
- using System.Runtime.InteropServices;
using System.Runtime.CompilerServices;
using System.Diagnostics.Contracts;
using System.Diagnostics;
diff --git a/BeefLibs/corlib/src/System/Globalization/DateTimeFormat.bf b/BeefLibs/corlib/src/System/Globalization/DateTimeFormat.bf
index 996c274c..91f3d260 100644
--- a/BeefLibs/corlib/src/System/Globalization/DateTimeFormat.bf
+++ b/BeefLibs/corlib/src/System/Globalization/DateTimeFormat.bf
@@ -8,7 +8,6 @@ namespace System {
using System.Globalization;
using System.Collections.Generic;
using System.Runtime.CompilerServices;
- using System.Runtime.InteropServices;
using System.Security;
using System.Diagnostics.Contracts;
diff --git a/BeefLibs/corlib/src/System/IO/FileOptions.bf b/BeefLibs/corlib/src/System/IO/FileOptions.bf
index 683c6f72..bfd49f19 100644
--- a/BeefLibs/corlib/src/System/IO/FileOptions.bf
+++ b/BeefLibs/corlib/src/System/IO/FileOptions.bf
@@ -3,7 +3,6 @@
// The original source was submitted to https://github.com/Microsoft/referencesource
using System;
-using System.Runtime.InteropServices;
namespace System.IO
{
diff --git a/BeefLibs/corlib/src/System/Native.bf b/BeefLibs/corlib/src/System/Native.bf
index 05604878..6ec4e098 100644
--- a/BeefLibs/corlib/src/System/Native.bf
+++ b/BeefLibs/corlib/src/System/Native.bf
@@ -1,5 +1,4 @@
using System.IO;
-using System.Runtime.InteropServices;
namespace System
{
diff --git a/BeefLibs/corlib/src/System/Nullable.bf b/BeefLibs/corlib/src/System/Nullable.bf
index 868c0f30..47afc62f 100644
--- a/BeefLibs/corlib/src/System/Nullable.bf
+++ b/BeefLibs/corlib/src/System/Nullable.bf
@@ -1,7 +1,6 @@
using System.Reflection;
using System.Collections.Generic;
using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
using System.Diagnostics;
namespace System
diff --git a/BeefLibs/corlib/src/System/String.bf b/BeefLibs/corlib/src/System/String.bf
index 3382d76e..a5ec0a32 100644
--- a/BeefLibs/corlib/src/System/String.bf
+++ b/BeefLibs/corlib/src/System/String.bf
@@ -399,11 +399,11 @@ namespace System
}
}
- public int GetHashCode()
+ static int GetHashCode(char8* ptr, int length)
{
- int charsLeft = mLength;
+ int charsLeft = length;
int hash = 0;
- char8* curPtr = Ptr;
+ char8* curPtr = ptr;
let intSize = sizeof(int);
while (charsLeft >= intSize)
{
@@ -422,6 +422,11 @@ namespace System
return hash;
}
+ public int GetHashCode()
+ {
+ return GetHashCode(Ptr, mLength);
+ }
+
public override void ToString(String strBuffer)
{
strBuffer.Append(this);
@@ -2495,7 +2500,7 @@ namespace System
}
}
- public struct StringView : Span, IFormattable, IPrintable
+ public struct StringView : Span, IFormattable, IPrintable, IOpEquals, IHashable
{
public this()
{
@@ -2579,6 +2584,11 @@ namespace System
}
}
+ public int GetHashCode()
+ {
+ return String.[Friend]GetHashCode(mPtr, mLength);
+ }
+
public override void ToString(String strBuffer)
{
strBuffer.Append(mPtr, mLength);
@@ -2840,11 +2850,13 @@ namespace System
return String.UnQuoteString(Ptr, Length, outString);
}
+ [NoDiscard]
public StringView Substring(int pos)
{
return .(this, pos);
}
+ [NoDiscard]
public StringView Substring(int pos, int length)
{
return .(this, pos, length);
diff --git a/BeefLibs/corlib/src/System/TimeZoneInfo.bf b/BeefLibs/corlib/src/System/TimeZoneInfo.bf
index 3d62c930..87c28d40 100644
--- a/BeefLibs/corlib/src/System/TimeZoneInfo.bf
+++ b/BeefLibs/corlib/src/System/TimeZoneInfo.bf
@@ -34,7 +34,6 @@ namespace System {
using System.Globalization;
using System.IO;
using System.Runtime.CompilerServices;
- using System.Runtime.InteropServices;
using System.Security;
using System.Text;
using System.Threading;
diff --git a/BeefLibs/corlib/src/System/Windows.bf b/BeefLibs/corlib/src/System/Windows.bf
index 81cba9b8..825163a5 100644
--- a/BeefLibs/corlib/src/System/Windows.bf
+++ b/BeefLibs/corlib/src/System/Windows.bf
@@ -1,7 +1,6 @@
#if BF_PLATFORM_WINDOWS
using System.IO;
-using System.Runtime.InteropServices;
using System.Collections.Generic;
using System.Text;
@@ -9,7 +8,6 @@ namespace System
{
class Windows
{
-
public struct COM_IUnknown
{
public enum ClsContext : uint32
@@ -1245,6 +1243,9 @@ namespace System
public static extern IntBool GetFileMUIPath(uint32 dwFlags, char16* pcwszFilePath, char16* pwszLanguage, uint32* pcchLanguage,
char16* pwszFileMUIPath, uint32* pcchFileMUIPath, uint64* pululEnumerator);
+ [CLink, StdCall]
+ public static extern HInstance LoadLibraryW(char16* libFileName);
+
[CLink, StdCall]
public static extern HInstance LoadLibraryExW(char16* libFileName, HModule hFile, uint32 dwFlags);
diff --git a/BeefRT/BeefDbg/BeefDbg.vcxproj b/BeefRT/BeefDbg/BeefDbg.vcxproj
index fef23340..ed515f77 100644
--- a/BeefRT/BeefDbg/BeefDbg.vcxproj
+++ b/BeefRT/BeefDbg/BeefDbg.vcxproj
@@ -1,6 +1,22 @@
+
+ Debug Static CStatic
+ Win32
+
+
+ Debug Static CStatic
+ x64
+
+
+ Debug Static
+ Win32
+
+
+ Debug Static
+ x64
+
Debug
Win32
@@ -9,6 +25,22 @@
Debug
x64
+
+ Release Static CStatic
+ Win32
+
+
+ Release Static CStatic
+ x64
+
+
+ Release Static
+ Win32
+
+
+ Release Static
+ x64
+
Release
Win32
@@ -31,12 +63,36 @@
v141
Unicode
+
+ DynamicLibrary
+ true
+ v141
+ Unicode
+
+
+ DynamicLibrary
+ true
+ v141
+ Unicode
+
DynamicLibrary
true
v141
Unicode
+
+ StaticLibrary
+ true
+ v141
+ Unicode
+
+
+ StaticLibrary
+ true
+ v141
+ Unicode
+
DynamicLibrary
false
@@ -44,6 +100,20 @@
true
Unicode
+
+ StaticLibrary
+ false
+ v141
+ true
+ Unicode
+
+
+ StaticLibrary
+ false
+ v141
+ true
+ Unicode
+
DynamicLibrary
false
@@ -51,6 +121,20 @@
true
Unicode
+
+ StaticLibrary
+ false
+ v141
+ true
+ Unicode
+
+
+ StaticLibrary
+ false
+ v141
+ true
+ Unicode
+
@@ -66,55 +150,119 @@
true
+ true
+ true
true
+ true
+ true
true
+ true
+ true
true
+ true
+ true
true
+ true
+ true
true
+ true
+ true
true
+ true
+ true
true
+ true
+ true
true
+ true
+ true
true
+ true
+ true
true
+ true
+ true
true
+ true
+ true
true
+ true
+ true
true
+ true
+ true
true
+ true
+ true
true
+ true
+ true
true
+ true
+ true
true
+ true
+ true
true
+ true
+ true
true
+ true
+ true
true
+ true
+ true
true
+ true
+ true
true
+ true
+ true
true
+ true
+ true
true
+ true
+ true
true
+ true
+ true
true
+ true
+ true
true
+ true
+ true
true
+ true
+ true
true
+ true
+ true
true
+ true
+ true
true
+ true
+ true
@@ -124,9 +272,17 @@
true
+ true
+ true
true
+ true
+ true
true
+ true
+ true
true
+ true
+ true
@@ -135,12 +291,28 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -160,9 +332,17 @@
true
+ true
+ true
true
+ true
+ true
true
+ true
+ true
true
+ true
+ true
@@ -240,45 +420,152 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Beef$(BeefFilesVersion)Dbg64_d
$(SolutionDir)\ide\dist\
+
+ Beef$(BeefFilesVersion)Dbg64_ssd
+ $(SolutionDir)\ide\dist\
+
+
+ Beef$(BeefFilesVersion)Dbg64_sd
+ $(SolutionDir)\ide\dist\
+
Beef$(BeefFilesVersion)Dbg64
$(SolutionDir)\ide\dist\
false
+
+ Beef$(BeefFilesVersion)Dbg64_ss
+ $(SolutionDir)\ide\dist\
+ false
+
+
+ Beef$(BeefFilesVersion)Dbg64_s
+ $(SolutionDir)\ide\dist\
+ false
+
$(SolutionDir)\ide\dist\
Beef$(BeefFilesVersion)Dbg32_d
+
+ $(SolutionDir)\ide\dist\
+ Beef$(BeefFilesVersion)Dbg32_ssd
+
+
+ $(SolutionDir)\ide\dist\
+ Beef$(BeefFilesVersion)Dbg32_sd
+
$(SolutionDir)\ide\dist\
Beef$(BeefFilesVersion)Dbg32
+
+ $(SolutionDir)\ide\dist\
+ Beef$(BeefFilesVersion)Dbg32_ss
+
+
+ $(SolutionDir)\ide\dist\
+ Beef$(BeefFilesVersion)Dbg32_s
+
Level3
Disabled
- BP_DISABLED;BF_NO_BFAPP;BFRT_DYNAMIC;WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions)
+ BFRTDBG;BP_DISABLED;BF_NO_BFAPP;BFRT_DYNAMIC;WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions)
.;../;../..;../../BeefySysLib/third_party;../../BeefySysLib;../../BeefySysLib/platform/win;../gperftools/src;../gperftools/src/windows
MultiThreadedDebug
+ ProgramDatabase
+
+
+ Windows
+ DebugFull
+ 0x00DB0000
+ false
+
+
+
+
+
+
+
+
+ Level3
+ Disabled
+ BFRTDBG;BP_DISABLED;BF_NO_BFAPP;BFRT_DYNAMIC;WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions)
+ .;../;../..;../../BeefySysLib/third_party;../../BeefySysLib;../../BeefySysLib/platform/win;../gperftools/src;../gperftools/src/windows
+ MultiThreadedDebug
+ ProgramDatabase
+
+
+ Windows
+ DebugFull
+ 0x00DB0000
+ false
+
+
+
+
+
+
+
+
+ Level3
+ Disabled
+ BFRTDBG;BP_DISABLED;BF_NO_BFAPP;BFRT_DYNAMIC;WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions)
+ .;../;../..;../../BeefySysLib/third_party;../../BeefySysLib;../../BeefySysLib/platform/win;../gperftools/src;../gperftools/src/windows
+ MultiThreadedDebug
+ ProgramDatabase
Windows
@@ -295,7 +582,7 @@
Level3
Disabled
- BP_DISABLED;BF_NO_BFAPP;BFRT_DYNAMIC;WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions)
+ BFRTDBG;BP_DISABLED;BF_NO_BFAPP;BFRT_DYNAMIC;WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions)
.;../;../..;../../BeefySysLib/third_party;../../BeefySysLib;../../BeefySysLib/platform/win;../gperftools/src;../gperftools/src/windows
@@ -313,6 +600,54 @@
+
+
+
+
+ Level3
+ Disabled
+ BFRTDBG;BP_DISABLED;BF_NO_BFAPP;WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions)
+ .;../;../..;../../BeefySysLib/third_party;../../BeefySysLib;../../BeefySysLib/platform/win;../gperftools/src;../gperftools/src/windows
+
+
+ false
+ MultiThreadedDebug
+
+
+ Windows
+ DebugFull
+ $(SolutionDir)\ide\dist\$(TargetName).dll
+ $(SolutionDir)\ide\dist\$(TargetName).lib
+ false
+ true
+
+
+
+
+
+
+
+
+ Level3
+ Disabled
+ BFRTDBG;BP_DISABLED;BF_NO_BFAPP;WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions)
+ .;../;../..;../../BeefySysLib/third_party;../../BeefySysLib;../../BeefySysLib/platform/win;../gperftools/src;../gperftools/src/windows
+
+
+ false
+ MultiThreadedDebugDLL
+
+
+ Windows
+ DebugFull
+ $(SolutionDir)\ide\dist\$(TargetName).dll
+ $(SolutionDir)\ide\dist\$(TargetName).lib
+ false
+ true
+
+
+
+
Level3
@@ -321,9 +656,50 @@
MaxSpeed
true
true
- BP_DISABLED;BF_NO_BFAPP;BFRT_DYNAMIC;WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions)
+ BFRTDBG;BP_DISABLED;BF_NO_BFAPP;BFRT_DYNAMIC;WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions)
.;../;../..;../../BeefySysLib/third_party;../../BeefySysLib;../../BeefySysLib/platform/win;../gperftools/src;../gperftools/src/windows
MultiThreaded
+ false
+
+
+ Windows
+ DebugFull
+ true
+ true
+
+
+
+
+ Level3
+
+
+ MaxSpeed
+ true
+ true
+ BFRTDBG;BP_DISABLED;BF_NO_BFAPP;BFRT_DYNAMIC;WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions)
+ .;../;../..;../../BeefySysLib/third_party;../../BeefySysLib;../../BeefySysLib/platform/win;../gperftools/src;../gperftools/src/windows
+ MultiThreaded
+ false
+
+
+ Windows
+ DebugFull
+ true
+ true
+
+
+
+
+ Level3
+
+
+ MaxSpeed
+ true
+ true
+ BFRTDBG;BP_DISABLED;BF_NO_BFAPP;BFRT_DYNAMIC;WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions)
+ .;../;../..;../../BeefySysLib/third_party;../../BeefySysLib;../../BeefySysLib/platform/win;../gperftools/src;../gperftools/src/windows
+ MultiThreadedDLL
+ false
Windows
@@ -340,7 +716,7 @@
MaxSpeed
true
true
- BP_DISABLED;BF_NO_BFAPP;BFRT_DYNAMIC;WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions)
+ BFRTDBG;BP_DISABLED;BF_NO_BFAPP;BFRT_DYNAMIC;WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions)
.;../;../..;../../BeefySysLib/third_party;../../BeefySysLib;../../BeefySysLib/platform/win;../gperftools/src;../gperftools/src/windows
false
MultiThreaded
@@ -354,6 +730,50 @@
$(SolutionDir)\ide\dist\$(TargetName).lib
+
+
+ Level3
+
+
+ MaxSpeed
+ true
+ true
+ BFRTDBG;BP_DISABLED;BF_NO_BFAPP;WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions)
+ .;../;../..;../../BeefySysLib/third_party;../../BeefySysLib;../../BeefySysLib/platform/win;../gperftools/src;../gperftools/src/windows
+ false
+ MultiThreaded
+
+
+ Windows
+ DebugFull
+ true
+ true
+ $(SolutionDir)\ide\dist\$(TargetName).dll
+ $(SolutionDir)\ide\dist\$(TargetName).lib
+
+
+
+
+ Level3
+
+
+ MaxSpeed
+ true
+ true
+ BFRTDBG;BP_DISABLED;BF_NO_BFAPP;WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions)
+ .;../;../..;../../BeefySysLib/third_party;../../BeefySysLib;../../BeefySysLib/platform/win;../gperftools/src;../gperftools/src/windows
+ false
+ MultiThreadedDLL
+
+
+ Windows
+ DebugFull
+ true
+ true
+ $(SolutionDir)\ide\dist\$(TargetName).dll
+ $(SolutionDir)\ide\dist\$(TargetName).lib
+
+
diff --git a/BeefRT/BeefRT.vcxproj b/BeefRT/BeefRT.vcxproj
index 79beb101..ae055d27 100644
--- a/BeefRT/BeefRT.vcxproj
+++ b/BeefRT/BeefRT.vcxproj
@@ -478,6 +478,7 @@
MultiThreadedDebugDLL
false
false
+ ProgramDatabase
Windows
@@ -497,6 +498,7 @@
MultiThreadedDebugDLL
false
false
+ ProgramDatabase
Windows
@@ -516,6 +518,7 @@
MultiThreadedDebug
false
false
+ ProgramDatabase
Windows
@@ -534,7 +537,7 @@
false
- MultiThreadedDebugDLL
+ MultiThreadedDebug
stdcpp17
false
diff --git a/BeefRT/dbg/DbgInternal.cpp b/BeefRT/dbg/DbgInternal.cpp
index f243d392..1b25d4c9 100644
--- a/BeefRT/dbg/DbgInternal.cpp
+++ b/BeefRT/dbg/DbgInternal.cpp
@@ -2,23 +2,15 @@
#define HEAPHOOK
#include
-
-//#include
#include
#include
#include
-//#include
//#define OBJECT_GUARD_END_SIZE 8
#define OBJECT_GUARD_END_SIZE 0
//#define BF_USE_STOMP_ALLOC 1
-//extern "C"
-//{
-//#include "gperftools/stacktrace.h"
-//}
-
#ifdef _MSC_VER
#include
#pragma intrinsic(_ReturnAddress)
@@ -36,8 +28,8 @@
USING_NS_BF;
#ifdef BF_PLATFORM_WINDOWS
-bf::System::Runtime::BfRtCallbacks gBfRtCallbacks;
-BfRtFlags gBfRtFlags = (BfRtFlags)0;
+bf::System::Runtime::BfRtCallbacks gBfRtDbgCallbacks;
+BfRtFlags gBfRtDbgFlags = (BfRtFlags)0;
#endif
namespace bf
@@ -47,8 +39,6 @@ namespace bf
class Object;
class Exception;
- //System::Threading::Thread* gMainThread;
-
class Internal
{
public:
@@ -169,7 +159,7 @@ Beefy::StringT<0> gDbgErrorString;
extern DbgRawAllocData sEmptyAllocData;
extern DbgRawAllocData sObjectAllocData;
-#define SETUP_ERROR(str, skip) gDbgErrorString = str; gBfRtCallbacks.DebugMessageData_SetupError(str, skip)
+#define SETUP_ERROR(str, skip) gDbgErrorString = str; gBfRtDbgCallbacks.DebugMessageData_SetupError(str, skip)
#ifdef BF_PLATFORM_WINDOWS
#define BF_CAPTURE_STACK(skipCount, outFrames, wantCount) (int)RtlCaptureStackBackTrace(skipCount, wantCount, (void**)outFrames, NULL)
@@ -198,10 +188,15 @@ void bf::System::Runtime::Dbg_Init(int version, int flags, BfRtCallbacks* callba
BfpSystem_FatalError(StrFormat("BeefDbg build version '%d' does not match requested version '%d'", BFRT_VERSION, version).c_str(), "BEEF FATAL ERROR");
}
- gBfRtCallbacks = *callbacks;
- gBfRtFlags = (BfRtFlags)flags;
+ if (gBfRtDbgCallbacks.Alloc != NULL)
+ {
+ BfpSystem_FatalError(StrFormat("BeefDbg already initialized. Multiple executable modules in the same process cannot dynamically link to the Beef debug runtime.").c_str(), "BEEF FATAL ERROR");
+ }
+
+ gBfRtDbgCallbacks = *callbacks;
+ gBfRtDbgFlags = (BfRtFlags)flags;
#ifdef BF_GC_SUPPORTED
- gGCDbgData.mDbgFlags = gBfRtFlags;
+ gGCDbgData.mDbgFlags = gBfRtDbgFlags;
#endif
}
@@ -215,8 +210,8 @@ void* bf::System::Runtime::Dbg_GetCrashInfoFunc()
void Internal::Dbg_MarkObjectDeleted(bf::System::Object* object)
{
- BF_ASSERT((gBfRtFlags & BfRtFlags_ObjectHasDebugFlags) != 0);
- if ((gBfRtFlags & BfRtFlags_ObjectHasDebugFlags) != 0)
+ BF_ASSERT((gBfRtDbgFlags & BfRtFlags_ObjectHasDebugFlags) != 0);
+ if ((gBfRtDbgFlags & BfRtFlags_ObjectHasDebugFlags) != 0)
object->mObjectFlags = (BfObjectFlags)((object->mObjectFlags & ~BfObjectFlag_StackAlloc) | BfObjectFlag_Deleted);
#ifdef BF_GC_SUPPORTED
gBFGC.ObjectDeleteRequested(object);
@@ -293,10 +288,10 @@ intptr Internal::Dbg_PrepareStackTrace(intptr baseAllocSize, intptr maxStackTrac
bf::System::Object* Internal::Dbg_ObjectAlloc(bf::System::Reflection::TypeInstance* typeInst, intptr size)
{
- BF_ASSERT((gBfRtFlags & BfRtFlags_ObjectHasDebugFlags) != 0);
+ BF_ASSERT((gBfRtDbgFlags & BfRtFlags_ObjectHasDebugFlags) != 0);
Object* result;
int allocSize = BF_ALIGN(size, typeInst->mInstAlign);
- uint8* allocBytes = (uint8*)BfObjectAllocate(allocSize, typeInst->GetType());
+ uint8* allocBytes = (uint8*)BfObjectAllocate(allocSize, typeInst->_GetType());
// int dataOffset = (int)(sizeof(intptr) * 2);
// memset(allocBytes + dataOffset, 0, size - dataOffset);
result = (bf::System::Object*)allocBytes;
@@ -322,7 +317,7 @@ bf::System::Object* Internal::Dbg_ObjectAlloc(bf::System::ClassVData* classVData
intptr allocSize = size;
bool largeAllocInfo = false;
- if ((gBfRtFlags & BfRtFlags_ObjectHasDebugFlags) != 0)
+ if ((gBfRtDbgFlags & BfRtFlags_ObjectHasDebugFlags) != 0)
{
if (maxStackTraceDepth > 1)
{
@@ -343,7 +338,7 @@ bf::System::Object* Internal::Dbg_ObjectAlloc(bf::System::ClassVData* classVData
#endif
bf::System::Object* result;
- if ((gBfRtFlags & BfRtFlags_LeakCheck) != 0)
+ if ((gBfRtDbgFlags & BfRtFlags_LeakCheck) != 0)
{
allocSize = BF_ALIGN(allocSize, align);
uint8* allocBytes = (uint8*)BfObjectAllocate(allocSize, classVData->mType);
@@ -362,21 +357,21 @@ bf::System::Object* Internal::Dbg_ObjectAlloc(bf::System::ClassVData* classVData
sAllocSizes[classVData->mType->mTypeId] += size;
result = (bf::System::Object*)(allocPtr + 16);
#else
- if ((gBfRtFlags & BfRtFlags_DebugAlloc) != 0)
+ if ((gBfRtDbgFlags & BfRtFlags_DebugAlloc) != 0)
{
uint8* allocBytes = (uint8*)BfRawAllocate(allocSize, &sObjectAllocData, NULL, 0);
result = (bf::System::Object*)allocBytes;
}
else
{
- uint8* allocBytes = (uint8*)gBfRtCallbacks.Alloc(allocSize);
+ uint8* allocBytes = (uint8*)gBfRtDbgCallbacks.Alloc(allocSize);
result = (bf::System::Object*)allocBytes;
}
#endif
}
#ifndef BFRT_NODBGFLAGS
- if ((gBfRtFlags & BfRtFlags_ObjectHasDebugFlags) != 0)
+ if ((gBfRtDbgFlags & BfRtFlags_ObjectHasDebugFlags) != 0)
{
// The order is very important here-
// Once we set mDbgAllocInfo, the memory will be recognized by the GC as being a valid object.
@@ -429,7 +424,7 @@ bf::System::Object* Internal::Dbg_ObjectAlloc(bf::System::ClassVData* classVData
void Internal::Dbg_ObjectStackInit(bf::System::Object* result, bf::System::ClassVData* classVData)
{
- BF_ASSERT((gBfRtFlags & BfRtFlags_ObjectHasDebugFlags) != 0);
+ BF_ASSERT((gBfRtDbgFlags & BfRtFlags_ObjectHasDebugFlags) != 0);
result->mClassVData = (intptr)classVData | (intptr)BfObjectFlag_StackAlloc;
#ifndef BFRT_NODBGFLAGS
@@ -468,7 +463,7 @@ static void SetupDbgAllocInfo(bf::System::Object* result, intptr origSize)
void Internal::Dbg_ObjectCreated(bf::System::Object* result, intptr size, bf::System::ClassVData* classVData)
{
- BF_ASSERT((gBfRtFlags & BfRtFlags_ObjectHasDebugFlags) != 0);
+ BF_ASSERT((gBfRtDbgFlags & BfRtFlags_ObjectHasDebugFlags) != 0);
#ifndef BFRT_NODBGFLAGS
BF_ASSERT_REL((result->mClassVData & ~(BfObjectFlag_Allocated | BfObjectFlag_Mark3)) == (intptr)classVData);
result->mDbgAllocInfo = (intptr)BF_RETURN_ADDRESS;
@@ -477,7 +472,7 @@ void Internal::Dbg_ObjectCreated(bf::System::Object* result, intptr size, bf::Sy
void Internal::Dbg_ObjectCreatedEx(bf::System::Object* result, intptr origSize, bf::System::ClassVData* classVData)
{
- BF_ASSERT((gBfRtFlags & BfRtFlags_ObjectHasDebugFlags) != 0);
+ BF_ASSERT((gBfRtDbgFlags & BfRtFlags_ObjectHasDebugFlags) != 0);
#ifndef BFRT_NODBGFLAGS
BF_ASSERT_REL((result->mClassVData & ~(BfObjectFlag_Allocated | BfObjectFlag_Mark3)) == (intptr)classVData);
SetupDbgAllocInfo(result, origSize);
@@ -486,7 +481,7 @@ void Internal::Dbg_ObjectCreatedEx(bf::System::Object* result, intptr origSize,
void Internal::Dbg_ObjectAllocated(bf::System::Object* result, intptr size, bf::System::ClassVData* classVData)
{
- BF_ASSERT((gBfRtFlags & BfRtFlags_ObjectHasDebugFlags) != 0);
+ BF_ASSERT((gBfRtDbgFlags & BfRtFlags_ObjectHasDebugFlags) != 0);
result->mClassVData = (intptr)classVData;
#ifndef BFRT_NODBGFLAGS
result->mDbgAllocInfo = (intptr)BF_RETURN_ADDRESS;
@@ -495,14 +490,14 @@ void Internal::Dbg_ObjectAllocated(bf::System::Object* result, intptr size, bf::
void Internal::Dbg_ObjectAllocatedEx(bf::System::Object* result, intptr origSize, bf::System::ClassVData* classVData)
{
- BF_ASSERT((gBfRtFlags & BfRtFlags_ObjectHasDebugFlags) != 0);
+ BF_ASSERT((gBfRtDbgFlags & BfRtFlags_ObjectHasDebugFlags) != 0);
result->mClassVData = (intptr)classVData;
SetupDbgAllocInfo(result, origSize);
}
void Internal::Dbg_ObjectPreDelete(bf::System::Object* object)
{
- BF_ASSERT((gBfRtFlags & BfRtFlags_ObjectHasDebugFlags) != 0);
+ BF_ASSERT((gBfRtDbgFlags & BfRtFlags_ObjectHasDebugFlags) != 0);
#ifndef BFRT_NODBGFLAGS
const char* errorPtr = NULL;
@@ -539,7 +534,7 @@ void Internal::Dbg_ObjectPreDelete(bf::System::Object* object)
errorStr += StrFormat(" (%s)0x%@\n", typeName.c_str(), object);
SETUP_ERROR(errorStr.c_str(), 2);
BF_DEBUG_BREAK();
- gBfRtCallbacks.DebugMessageData_Fatal();
+ gBfRtDbgCallbacks.DebugMessageData_Fatal();
return;
}
#endif
@@ -547,7 +542,7 @@ void Internal::Dbg_ObjectPreDelete(bf::System::Object* object)
void Internal::Dbg_ObjectPreCustomDelete(bf::System::Object* object)
{
- BF_ASSERT((gBfRtFlags & BfRtFlags_ObjectHasDebugFlags) != 0);
+ BF_ASSERT((gBfRtDbgFlags & BfRtFlags_ObjectHasDebugFlags) != 0);
const char* errorPtr = NULL;
@@ -566,7 +561,7 @@ void Internal::Dbg_ObjectPreCustomDelete(bf::System::Object* object)
errorStr += StrFormat(" (%s)0x%@\n", typeName.c_str(), object);
SETUP_ERROR(errorStr.c_str(), 2);
BF_DEBUG_BREAK();
- gBfRtCallbacks.DebugMessageData_Fatal();
+ gBfRtDbgCallbacks.DebugMessageData_Fatal();
return;
}
}
diff --git a/BeefRT/dbg/gc.cpp b/BeefRT/dbg/gc.cpp
index 4ac5d451..68cc6a2b 100644
--- a/BeefRT/dbg/gc.cpp
+++ b/BeefRT/dbg/gc.cpp
@@ -34,7 +34,7 @@
#include "gc.h"
#ifdef BF_GC_SUPPORTED
-
+
#include
#include "BeefySysLib/Common.h"
#include "BeefySysLib/BFApp.h"
@@ -180,12 +180,12 @@ void BFGC::MarkMembers(bf::System::Object* obj)
if (((obj->mObjectFlags & BF_OBJECTFLAG_DELETED) != 0) && (!mMarkingDeleted))
{
mMarkingDeleted = true;
- gBfRtCallbacks.Object_GCMarkMembers(obj);
+ gBfRtDbgCallbacks.Object_GCMarkMembers(obj);
mMarkingDeleted = false;
}
else
{
- gBfRtCallbacks.Object_GCMarkMembers(obj);
+ gBfRtDbgCallbacks.Object_GCMarkMembers(obj);
}
}
@@ -636,7 +636,7 @@ BFGC::BFGC()
mGCThread = NULL;
- gGCDbgData.mDbgFlags = gBfRtFlags;
+ gGCDbgData.mDbgFlags = gBfRtDbgFlags;
ThreadCache::InitTSD();
if (UNLIKELY(Static::pageheap() == NULL)) ThreadCache::InitModule();
gGCDbgData.mObjRootPtr = Static::pageheap()->pagemap_.root_;
@@ -767,7 +767,7 @@ void BFCheckObjectSize(bf::System::Object* obj, int size)
void BFGC::ConservativeScan(void* startAddr, int length)
{
- if ((gBfRtFlags & BfRtFlags_ObjectHasDebugFlags) == 0)
+ if ((gBfRtDbgFlags & BfRtFlags_ObjectHasDebugFlags) == 0)
return;
BFLOG2(GCLog::EVENT_CONSERVATIVE_SCAN, (intptr)startAddr, (intptr)startAddr + length);
@@ -877,7 +877,7 @@ bool BFGC::HandlePendingGCData()
void BFGC::SweepSpan(tcmalloc_obj::Span* span, int expectedStartPage)
{
- if ((gBfRtFlags & BfRtFlags_ObjectHasDebugFlags) == 0)
+ if ((gBfRtDbgFlags & BfRtFlags_ObjectHasDebugFlags) == 0)
return;
if (span->location != tcmalloc_obj::Span::IN_USE)
@@ -980,7 +980,7 @@ void BFGC::SweepSpan(tcmalloc_obj::Span* span, int expectedStartPage)
mSweepInfo.mLeakObjects.push_back(obj);
}
- BFLOG2(GCLog::EVENT_LEAK, (intptr)obj, (intptr)obj->GetType());
+ BFLOG2(GCLog::EVENT_LEAK, (intptr)obj, (intptr)obj->_GetType());
#ifdef BF_GC_LOG_ENABLED
gGCLog.Write();
#endif
@@ -1160,8 +1160,8 @@ void BFGC::ProcessSweepInfo()
//TODO: Testing!
//OutputDebugStrF(gDbgErrorString.c_str());
- gBfRtCallbacks.SetErrorString(gDbgErrorString.c_str());
- gBfRtCallbacks.DebugMessageData_SetupError(errorStr.c_str(), 1);
+ gBfRtDbgCallbacks.SetErrorString(gDbgErrorString.c_str());
+ gBfRtDbgCallbacks.DebugMessageData_SetupError(errorStr.c_str(), 1);
BF_DEBUG_BREAK();
}
@@ -1614,7 +1614,7 @@ void BFGC::FinishCollect()
{
//OutputDebugStrF("Collected %d objects\n", mFinalizeList.size());
- if ((gBfRtFlags & BfRtFlags_ObjectHasDebugFlags) == 0)
+ if ((gBfRtDbgFlags & BfRtFlags_ObjectHasDebugFlags) == 0)
return;
mLastFreeCount = 0;
@@ -1711,7 +1711,7 @@ void BFGC::FinishCollect()
{
// Temporarily remove object flags so GetType() won't fail
obj->mObjectFlags = BfObjectFlag_None;
- bf::System::Type* type = obj->GetType();
+ bf::System::Type* type = obj->_GetType();
//auto pairVal = sizeMap.insert(std::make_pair(type, 0));
//int newSize = pairVal.first->second + objSize;
int* sizePtr = NULL;
@@ -2046,7 +2046,7 @@ void BFGC::ObjReportHandleSpan(tcmalloc_obj::Span* span, int expectedStartPage,
int objectFlags = obj->mObjectFlags;
if ((objectFlags & BF_OBJECTFLAG_DELETED) == 0)
{
- bf::System::Type* type = obj->GetType();
+ bf::System::Type* type = obj->_GetType();
//auto pairVal = sizeMap.insert(std::make_pair(type, 0));
//int newSize = pairVal.first->second + elementSize;
//pairVal.first->second = newSize;
diff --git a/BeefRT/dbg/gc.h b/BeefRT/dbg/gc.h
index e18e29ae..cb2d45f9 100644
--- a/BeefRT/dbg/gc.h
+++ b/BeefRT/dbg/gc.h
@@ -436,15 +436,7 @@ namespace bf
{
private:
BFRT_EXPORT static void Init();
- BFRT_EXPORT static void Run();
- static void MarkAllStaticMembers()
- {
- gBfRtCallbacks.GC_MarkAllStaticMembers();
- }
- static bool CallRootCallbacks()
- {
- return gBfRtCallbacks.GC_CallRootCallbacks();
- }
+ BFRT_EXPORT static void Run();
BFRT_EXPORT static void ReportTLSMember(intptr tlsIndex, void* ptr, void* markFunc);
BFRT_EXPORT static void StopCollecting();
BFRT_EXPORT static void AddStackMarkableObject(Object* obj);
@@ -460,11 +452,11 @@ namespace bf
//static void ToLeakString(Object* obj, String* strBuffer);
static void DoMarkAllStaticMembers()
{
- MarkAllStaticMembers();
+ BFRTCALLBACKS.GC_MarkAllStaticMembers();
}
static bool DoCallRootCallbacks()
{
- return CallRootCallbacks();
+ return BFRTCALLBACKS.GC_CallRootCallbacks();
}
BFRT_EXPORT static void SetAutoCollectPeriod(intptr periodMS);
BFRT_EXPORT static void SetCollectFreeThreshold(intptr freeBytes);
diff --git a/BeefRT/dbg/gc_raw.cpp b/BeefRT/dbg/gc_raw.cpp
index 2d933ce0..053d0d8b 100644
--- a/BeefRT/dbg/gc_raw.cpp
+++ b/BeefRT/dbg/gc_raw.cpp
@@ -1,4 +1,3 @@
-
#define _WIN32_WINNT _WIN32_WINNT_WIN8
// This spits out interesting stats periodically to the console
@@ -74,7 +73,7 @@ void BFGC::RawInit()
void BFGC::RawMarkSpan(tcmalloc_raw::Span* span, int expectedStartPage)
{
- if ((gBfRtFlags & BfRtFlags_ObjectHasDebugFlags) == 0)
+ if ((gBfRtDbgFlags & BfRtFlags_ObjectHasDebugFlags) == 0)
return;
if (span->location != tcmalloc_raw::Span::IN_USE)
@@ -278,7 +277,7 @@ void BFGC::RawReportHandleSpan(tcmalloc_raw::Span* span, int expectedStartPage,
if (rawAllocData->mType != NULL)
{
int typeSize;
- if ((gBfRtFlags & BfRtFlags_ObjectHasDebugFlags) != 0)
+ if ((gBfRtDbgFlags & BfRtFlags_ObjectHasDebugFlags) != 0)
typeSize = rawAllocData->mType->mSize;
else
typeSize = ((bf::System::Type_NOFLAGS*)rawAllocData->mType)->mSize;
@@ -449,8 +448,8 @@ void BFGC::RawShutdown()
BF_ASSERT(mSweepInfo.mLeakCount > 0);
- gBfRtCallbacks.SetErrorString(gDbgErrorString.c_str());
- gBfRtCallbacks.DebugMessageData_SetupError(errorStr.c_str(), 0);
+ gBfRtDbgCallbacks.SetErrorString(gDbgErrorString.c_str());
+ gBfRtDbgCallbacks.DebugMessageData_SetupError(errorStr.c_str(), 0);
BF_DEBUG_BREAK();
}
else
diff --git a/BeefRT/rt/BfObjects.h b/BeefRT/rt/BfObjects.h
index bb9329eb..3c064327 100644
--- a/BeefRT/rt/BfObjects.h
+++ b/BeefRT/rt/BfObjects.h
@@ -121,8 +121,16 @@ namespace bf
}
}
-extern bf::System::Runtime::BfRtCallbacks gBfRtCallbacks;
-extern BfRtFlags gBfRtFlags;
+#ifdef BFRTDBG
+#define BFRTCALLBACKS gBfRtDbgCallbacks
+#define BFRTFLAGS gBfRtDbgFlags
+#else
+#define BFRTCALLBACKS gBfRtCallbacks
+#define BFRTFLAGS gBfRtFlags
+#endif
+
+extern bf::System::Runtime::BfRtCallbacks BFRTCALLBACKS;
+extern BfRtFlags BFRTFLAGS;
namespace bf
{
@@ -155,9 +163,9 @@ namespace bf
};
#endif
- Type* GetType()
+ Type* _GetType()
{
- return gBfRtCallbacks.Object_GetType(this);
+ return BFRTCALLBACKS.Object_GetType(this);
}
Type* GetTypeSafe()
@@ -275,7 +283,7 @@ namespace bf
const char* CStr()
{
- return gBfRtCallbacks.String_ToCStr(this);
+ return BFRTCALLBACKS.String_ToCStr(this);
}
};
}
diff --git a/BeefRT/rt/Internal.cpp b/BeefRT/rt/Internal.cpp
index f400d142..82ddb297 100644
--- a/BeefRT/rt/Internal.cpp
+++ b/BeefRT/rt/Internal.cpp
@@ -261,6 +261,11 @@ void bf::System::Runtime::Init(int version, int flags, BfRtCallbacks* callbacks)
BfpSystem_Init(BFP_VERSION, sysInitFlags);
BfpSystem_AddCrashInfoFunc(GetCrashInfo);
+ if (gBfRtCallbacks.Alloc != NULL)
+ {
+ BfpSystem_FatalError(StrFormat("BeefRT already initialized. Multiple executable modules in the same process cannot dynamically link to the Beef runtime.").c_str(), "BEEF FATAL ERROR");
+ }
+
if (version != BFRT_VERSION)
{
BfpSystem_FatalError(StrFormat("BeefRT build version '%d' does not match requested version '%d'", BFRT_VERSION, version).c_str(), "BEEF FATAL ERROR");
diff --git a/BeefRT/rt/Object.cpp b/BeefRT/rt/Object.cpp
index 05981d2b..f2f3e09d 100644
--- a/BeefRT/rt/Object.cpp
+++ b/BeefRT/rt/Object.cpp
@@ -4,19 +4,19 @@ USING_NS_BF;
Beefy::String bf::System::Object::GetTypeName()
{
- String* strObj = gBfRtCallbacks.String_Alloc();
- Type* type = GetType();
- gBfRtCallbacks.Type_GetFullName(type, strObj);
+ String* strObj = BFRTCALLBACKS.String_Alloc();
+ Type* type = _GetType();
+ BFRTCALLBACKS.Type_GetFullName(type, strObj);
Beefy::String str = strObj->CStr();
- gBfRtCallbacks.Object_Delete(strObj);
+ BFRTCALLBACKS.Object_Delete(strObj);
return str;
}
Beefy::String bf::System::Type::GetFullName()
{
- String* strObj = gBfRtCallbacks.String_Alloc();
- gBfRtCallbacks.Type_GetFullName(this, strObj);
+ String* strObj = BFRTCALLBACKS.String_Alloc();
+ BFRTCALLBACKS.Type_GetFullName(this, strObj);
Beefy::String str = strObj->CStr();
- gBfRtCallbacks.Object_Delete(strObj);
+ BFRTCALLBACKS.Object_Delete(strObj);
return str;
}
diff --git a/BeefRT/rt/Thread.h b/BeefRT/rt/Thread.h
index 5acf3ee1..f7942783 100644
--- a/BeefRT/rt/Thread.h
+++ b/BeefRT/rt/Thread.h
@@ -70,27 +70,27 @@ namespace bf
static Thread* Alloc()
{
- return gBfRtCallbacks.Thread_Alloc();
+ return BFRTCALLBACKS.Thread_Alloc();
}
BfInternalThread* GetInternalThread()
{
- return gBfRtCallbacks.Thread_GetInternalThread(this);
+ return BFRTCALLBACKS.Thread_GetInternalThread(this);
}
BfDbgInternalThread* Dbg_GetInternalThread()
{
- return (BfDbgInternalThread*)gBfRtCallbacks.Thread_GetInternalThread(this);
+ return (BfDbgInternalThread*)BFRTCALLBACKS.Thread_GetInternalThread(this);
}
void SetInternalThread(BfInternalThread* internalThread)
{
- gBfRtCallbacks.Thread_SetInternalThread(this, internalThread);
+ BFRTCALLBACKS.Thread_SetInternalThread(this, internalThread);
}
int GetMaxStackSize()
{
- return gBfRtCallbacks.Thread_GetMaxStackSize(this);
+ return BFRTCALLBACKS.Thread_GetMaxStackSize(this);
}
};
}
diff --git a/BeefTools/BeefInstall/BeefProj.toml b/BeefTools/BeefInstall/BeefProj.toml
deleted file mode 100644
index 538a1118..00000000
--- a/BeefTools/BeefInstall/BeefProj.toml
+++ /dev/null
@@ -1,11 +0,0 @@
-FileVersion = 1
-
-[Project]
-Name = "BeefInstall"
-StartupObject = "BeefInstall.Program"
-
-[ProjectFolder]
-
-[[ProjectFolder.Items]]
-Type = "Source"
-Path = "../../IDE/src/util/Zip.bf"
diff --git a/BeefTools/BeefInstall/BeefSpace.toml b/BeefTools/BeefInstall/BeefSpace.toml
deleted file mode 100644
index dd17dd2b..00000000
--- a/BeefTools/BeefInstall/BeefSpace.toml
+++ /dev/null
@@ -1,6 +0,0 @@
-FileVersion = 1
-Projects = {BeefInstall = {Path = "."}}
-Unlocked = ["corlib"]
-
-[Workspace]
-StartupProject = "BeefInstall"
diff --git a/BeefTools/BeefInstall/BeefSpace_User.toml b/BeefTools/BeefInstall/BeefSpace_User.toml
deleted file mode 100644
index a8ad3555..00000000
--- a/BeefTools/BeefInstall/BeefSpace_User.toml
+++ /dev/null
@@ -1,136 +0,0 @@
-FileVersion = 1
-LastConfig = "Debug"
-LastPlatform = "Win64"
-RecentFilesList = ["c:\\Beef\\BeefTools\\BeefInstall\\src\\Program.bf", "c:\\Beef\\IDE\\src\\util\\Zip.bf", "c:\\beef\\BeefLibs\\corlib\\src\\System\\String.bf"]
-
-[MainWindow]
-X = 148
-Y = 85
-Width = 1724
-Height = 1830
-
-[MainDockingFrame]
-Type = "DockingFrame"
-SplitType = 2
-
-[[MainDockingFrame.DockedWidgets]]
-RequestedWidth = 350.0
-RequestedHeight = 200.0
-SizePriority = 200.0
-Type = "DockingFrame"
-SplitType = 1
-
-[[MainDockingFrame.DockedWidgets.DockedWidgets]]
-RequestedWidth = 200.0
-RequestedHeight = 200.0
-Type = "TabbedView"
-
-[[MainDockingFrame.DockedWidgets.DockedWidgets.Tabs]]
-Active = true
-TabLabel = "Workspace"
-TabWidth = 115.0
-Type = "ProjectPanel"
-
-[[MainDockingFrame.DockedWidgets.DockedWidgets]]
-IsFillWidget = true
-Permanent = true
-RequestedWidth = 150.0
-RequestedHeight = 150.0
-SizePriority = 150.0
-DefaultDocumentsTabbedView = true
-Type = "TabbedView"
-
-[[MainDockingFrame.DockedWidgets.DockedWidgets.Tabs]]
-TabLabel = "String.bf"
-TabWidth = 89.0
-Type = "SourceViewPanel"
-FilePath = "c:\\beef\\BeefLibs\\corlib\\src\\System\\String.bf"
-CursorPos = 41778
-VertPos = 24600.0
-ProjectName = "corlib"
-
-[[MainDockingFrame.DockedWidgets.DockedWidgets.Tabs]]
-TabLabel = "Zip.bf"
-TabWidth = 63.0
-Type = "SourceViewPanel"
-FilePath = "c:\\Beef\\IDE\\src\\util\\Zip.bf"
-CursorPos = 3000
-VertPos = 540.0
-ProjectName = "BeefInstall"
-
-[[MainDockingFrame.DockedWidgets.DockedWidgets.Tabs]]
-Active = true
-TabLabel = "Program.bf"
-TabWidth = 96.0
-Type = "SourceViewPanel"
-FilePath = "c:\\Beef\\BeefTools\\BeefInstall\\src\\Program.bf"
-CursorPos = 1398
-ProjectName = "BeefInstall"
-
-[[MainDockingFrame.DockedWidgets]]
-RequestedWidth = 250.0
-RequestedHeight = 250.0
-Type = "DockingFrame"
-SplitType = 1
-
-[[MainDockingFrame.DockedWidgets.DockedWidgets]]
-RequestedWidth = 250.0
-RequestedHeight = 250.0
-SizePriority = 0.5
-Type = "TabbedView"
-
-[[MainDockingFrame.DockedWidgets.DockedWidgets.Tabs]]
-TabLabel = "Memory"
-TabWidth = 99.0
-Type = "MemoryPanel"
-AutoResize = "Auto_Mul8"
-RequestedWidth = 300.0
-
-[[MainDockingFrame.DockedWidgets.DockedWidgets.Tabs]]
-TabLabel = "Watch"
-TabWidth = 86.0
-Type = "WatchPanel"
-Columns = [{Width = 200.0}, {Width = 200.0}, {Width = 200.0}]
-
-[[MainDockingFrame.DockedWidgets.DockedWidgets.Tabs]]
-Active = true
-TabLabel = "Auto"
-TabWidth = 77.0
-Type = "AutoWatchPanel"
-Columns = [{Width = 200.0}, {Width = 200.0}, {Width = 200.0}]
-
-[[MainDockingFrame.DockedWidgets.DockedWidgets]]
-RequestedWidth = 250.0
-RequestedHeight = 250.0
-SizePriority = 0.5
-Type = "TabbedView"
-
-[[MainDockingFrame.DockedWidgets.DockedWidgets.Tabs]]
-TabLabel = "Find Results"
-TabWidth = 119.0
-Type = "FindResultsPanel"
-
-[[MainDockingFrame.DockedWidgets.DockedWidgets.Tabs]]
-TabLabel = "Threads"
-TabWidth = 97.0
-Type = "ThreadPanel"
-
-[[MainDockingFrame.DockedWidgets.DockedWidgets.Tabs]]
-TabLabel = "Call Stack"
-TabWidth = 105.0
-Type = "CallStackPanel"
-
-[[MainDockingFrame.DockedWidgets.DockedWidgets.Tabs]]
-TabLabel = "Immediate"
-TabWidth = 111.0
-Type = "ImmediatePanel"
-
-[[MainDockingFrame.DockedWidgets.DockedWidgets.Tabs]]
-Active = true
-TabLabel = "Output"
-TabWidth = 90.0
-Type = "OutputPanel"
-
-[DebuggerDisplayTypes.""]
-IntDisplayType = "Default"
-MmDisplayType = "Default"
diff --git a/BeefTools/BeefInstall/Stub/BeefProj.toml b/BeefTools/BeefInstall/Stub/BeefProj.toml
new file mode 100644
index 00000000..9f9ece73
--- /dev/null
+++ b/BeefTools/BeefInstall/Stub/BeefProj.toml
@@ -0,0 +1,25 @@
+FileVersion = 1
+
+[Project]
+Name = "Stub"
+StartupObject = "BIStub.Program"
+
+[Configs.Debug.Win64]
+TargetDirectory = "$(WorkspaceDir)/../dist"
+TargetName = "$(ProjectName)_d"
+BeefLibType = "Static"
+
+[Configs.Release.Win64]
+TargetDirectory = "$(WorkspaceDir)/../dist"
+
+[Configs.Paranoid.Win64]
+TargetDirectory = "$(WorkspaceDir)/../dist"
+
+[Configs.Test.Win64]
+TargetDirectory = "$(WorkspaceDir)/../dist"
+
+[ProjectFolder]
+
+[[ProjectFolder.Items]]
+Type = "Source"
+Path = "../../../IDE/src/util/Zip.bf"
diff --git a/BeefTools/BeefInstall/Stub/BeefSpace.toml b/BeefTools/BeefInstall/Stub/BeefSpace.toml
new file mode 100644
index 00000000..20dde47b
--- /dev/null
+++ b/BeefTools/BeefInstall/Stub/BeefSpace.toml
@@ -0,0 +1,11 @@
+FileVersion = 1
+Projects = {Stub = {Path = "."}}
+Unlocked = ["corlib"]
+
+[Workspace]
+StartupProject = "Stub"
+
+[Configs.Debug.Win64]
+AllocType = "CRT"
+EnableObjectDebugFlags = false
+IntermediateType = "ObjectAndIRCode"
diff --git a/BeefTools/BeefInstall/src/CabFile.bf b/BeefTools/BeefInstall/Stub/src/CabFile.bf
similarity index 99%
rename from BeefTools/BeefInstall/src/CabFile.bf
rename to BeefTools/BeefInstall/Stub/src/CabFile.bf
index 51338475..4a8526ca 100644
--- a/BeefTools/BeefInstall/src/CabFile.bf
+++ b/BeefTools/BeefInstall/Stub/src/CabFile.bf
@@ -1,6 +1,7 @@
using System;
using System.IO;
-namespace BeefInstall
+
+namespace System.Windows
{
class CabFile
{
diff --git a/BeefTools/BeefInstall/Stub/src/PEFile.bf b/BeefTools/BeefInstall/Stub/src/PEFile.bf
new file mode 100644
index 00000000..7a8131ea
--- /dev/null
+++ b/BeefTools/BeefInstall/Stub/src/PEFile.bf
@@ -0,0 +1,236 @@
+using System;
+
+namespace System.Windows
+{
+ class PEFile
+ {
+ public const uint16 PE_MACHINE_X86 = 0x14c;
+ public const uint16 PE_MACHINE_X64 = 0x8664;
+
+ [CRepr]
+ public struct PEHeader
+ {
+ public uint16 e_magic; // Magic number
+ public uint16 e_cblp; // uint8s on last page of file
+ public uint16 e_cp; // Pages in file
+ public uint16 e_crlc; // Relocations
+ public uint16 e_cparhdr; // Size of header in paragraphs
+ public uint16 e_minalloc; // Minimum extra paragraphs needed
+ public uint16 e_maxalloc; // Maximum extra paragraphs needed
+ public uint16 e_ss; // Initial (relative) SS value
+ public uint16 e_sp; // Initial SP value
+ public uint16 e_csum; // Checksum
+ public uint16 e_ip; // Initial IP value
+ public uint16 e_cs; // Initial (relative) CS value
+ public uint16 e_lfarlc; // File address of relocation table
+ public uint16 e_ovno; // Overlay number
+ public uint16[4] e_res; // Reserved uint16s
+ public uint16 e_oemid; // OEM identifier (for e_oeminfo)
+ public uint16 e_oeminfo; // OEM information; e_oemid specific
+ public uint16[10] e_res2; // Reserved uint16s
+ public int32 e_lfanew; // File address of new exe header
+ };
+
+
+ [CRepr]
+ public struct PEFileHeader
+ {
+ public uint16 mMachine;
+ public uint16 mNumberOfSections;
+ public uint32 mTimeDateStamp;
+ public uint32 mPointerToSymbolTable;
+ public uint32 mNumberOfSymbols;
+ public uint16 mSizeOfOptionalHeader;
+ public uint16 mCharacteristics;
+ };
+
+ [CRepr]
+ public struct PEImportObjectHeader
+ {
+ public uint16 mSig1;
+ public uint16 mSig2;
+ public uint16 mVersion;
+ public uint16 mMachine;
+ public uint32 mTimeDateStamp;
+ public uint32 mDataSize;
+ public uint16 mHint;
+ public uint16 mType;
+ };
+
+ [CRepr]
+ public struct PEDataDirectory
+ {
+ public uint32 mVirtualAddress;
+ public uint32 mSize;
+ };
+
+ [CRepr]
+ public struct PEOptionalHeader32
+ {
+ //
+ // Standard fields.
+ //
+
+ public uint16 mMagic;
+ public uint8 mMajorLinkerVersion;
+ public uint8 mMinorLinkerVersion;
+ public uint32 mSizeOfCode;
+ public uint32 mSizeOfInitializedData;
+ public uint32 mSizeOfUninitializedData;
+ public uint32 mAddressOfEntryPoint;
+ public uint32 mBaseOfCode;
+ public uint32 mBaseOfData;
+
+ //
+ // NT additional fields.
+ //
+
+ public uint32 mImageBase;
+ public uint32 mSectionAlignment;
+ public uint32 mFileAlignment;
+ public uint16 mMajorOperatingSystemVersion;
+ public uint16 mMinorOperatingSystemVersion;
+ public uint16 mMajorImageVersion;
+ public uint16 mMinorImageVersion;
+ public uint16 mMajorSubsystemVersion;
+ public uint16 mMinorSubsystemVersion;
+ public uint32 mReserved1;
+ public uint32 mSizeOfImage;
+ public uint32 mSizeOfHeaders;
+ public uint32 mCheckSum;
+ public uint16 mSubsystem;
+ public uint16 mDllCharacteristics;
+ public uint32 mSizeOfStackReserve;
+ public uint32 mSizeOfStackCommit;
+ public uint32 mSizeOfHeapReserve;
+ public uint32 mSizeOfHeapCommit;
+ public uint32 mLoaderFlags;
+ public uint32 mNumberOfRvaAndSizes;
+ public PEDataDirectory[16] mDataDirectory;
+ };
+
+ [CRepr]
+ public struct PEOptionalHeader64
+ {
+ //
+ // Standard fields.
+ //
+
+ public uint16 mMagic;
+ public uint8 mMajorLinkerVersion;
+ public uint8 mMinorLinkerVersion;
+ public uint32 mSizeOfCode;
+ public uint32 mSizeOfInitializedData;
+ public uint32 mSizeOfUninitializedData;
+ public uint32 mAddressOfEntryPoint;
+ public uint32 mBaseOfCode;
+
+ //
+ // NT additional fields.
+ //
+
+ public uint64 mImageBase;
+ public uint32 mSectionAlignment;
+ public uint32 mFileAlignment;
+ public uint16 mMajorOperatingSystemVersion;
+ public uint16 mMinorOperatingSystemVersion;
+ public uint16 mMajorImageVersion;
+ public uint16 mMinorImageVersion;
+ public uint16 mMajorSubsystemVersion;
+ public uint16 mMinorSubsystemVersion;
+ public uint32 mReserved1;
+ public uint32 mSizeOfImage;
+ public uint32 mSizeOfHeaders;
+ public uint32 mCheckSum;
+ public uint16 mSubsystem;
+ public uint16 mDllCharacteristics;
+ public uint64 mSizeOfStackReserve;
+ public uint64 mSizeOfStackCommit;
+ public uint64 mSizeOfHeapReserve;
+ public uint64 mSizeOfHeapCommit;
+ public uint32 mLoaderFlags;
+ public uint32 mNumberOfRvaAndSizes;
+ public PEDataDirectory[16] mDataDirectory;
+ };
+
+ [CRepr]
+ struct PE_NTHeaders32
+ {
+ uint32 mSignature;
+ PEFileHeader mFileHeader;
+ PEOptionalHeader32 mOptionalHeader;
+ };
+
+ [CRepr]
+ public struct PE_NTHeaders64
+ {
+ public uint32 mSignature;
+ public PEFileHeader mFileHeader;
+ public PEOptionalHeader64 mOptionalHeader;
+ };
+
+ const int IMAGE_SIZEOF_SHORT_NAME = 8;
+
+ [CRepr]
+ public struct PESectionHeader
+ {
+ public char8[IMAGE_SIZEOF_SHORT_NAME] mName;
+ public uint32 mVirtualSize;
+ public uint32 mVirtualAddress;
+ public uint32 mSizeOfRawData;
+ public uint32 mPointerToRawData;
+ public uint32 mPointerToRelocations;
+ public uint32 mPointerToLineNumbers;
+ public uint16 mNumberOfRelocations;
+ public uint16 mNumberOfLineNumbers;
+ public uint32 mCharacteristics;
+ };
+
+ [CRepr]
+ struct COFFRelocation
+ {
+ uint32 mVirtualAddress;
+ uint32 mSymbolTableIndex;
+ uint16 mType;
+ };
+
+ [CRepr]
+ struct PE_SymInfo
+ {
+ [Union]
+ public struct Name
+ {
+ public char8[8] mName;
+ public int32[2] mNameOfs;
+ }
+
+ public Name mName;
+
+ /*union
+ {
+ char mName[8];
+ int32 mNameOfs[2];
+ };*/
+
+ public int32 mValue;
+ public uint16 mSectionNum;
+ public uint16 mType;
+ public int8 mStorageClass;
+ public int8 mNumOfAuxSymbols;
+ };
+
+ [CRepr]
+ struct PE_SymInfoAux
+ {
+ public uint32 mLength;
+ public uint16 mNumberOfRelocations;
+ public uint16 mNumberOfLinenumbers;
+ public uint32 mCheckSum;
+ public uint16 mNumber;
+ public uint8 mSelection;
+ public char8 mUnused;
+ public char8 mUnused2;
+ public char8 mUnused3;
+ };
+ }
+}
diff --git a/BeefTools/BeefInstall/Stub/src/Program.bf b/BeefTools/BeefInstall/Stub/src/Program.bf
new file mode 100644
index 00000000..e5bf82e0
--- /dev/null
+++ b/BeefTools/BeefInstall/Stub/src/Program.bf
@@ -0,0 +1,179 @@
+using System;
+using IDE.Util;
+using System.IO;
+using System.Windows;
+
+namespace BIStub
+{
+ class Program
+ {
+ bool mFailed;
+
+ void Fail(StringView str)
+ {
+ if (mFailed)
+ return;
+ mFailed = true;
+ Windows.MessageBoxA(default, scope String..AppendF("ERROR: {}", str), "FATAL ERROR", Windows.MB_ICONHAND);
+ }
+
+ bool HandleCommandLineParam(String key, String value)
+ {
+ return false;
+ }
+
+ void UnhandledCommandLine(String key, String value)
+ {
+
+ }
+
+ void ParseCommandLine(String[] args)
+ {
+ for (var str in args)
+ {
+ int eqPos = str.IndexOf('=');
+ if (eqPos == -1)
+ {
+ if (!HandleCommandLineParam(str, null))
+ UnhandledCommandLine(str, null);
+ }
+ else
+ {
+ var cmd = scope String(str, 0, eqPos);
+ var param = scope String(str, eqPos + 1);
+ if (!HandleCommandLineParam(cmd, param))
+ UnhandledCommandLine(cmd, param);
+ }
+ }
+ }
+
+ Result ExtractTo(ZipFile zipFile, StringView destDir, StringView subStr)
+ {
+ String fileName = scope .();
+ String destPath = scope .();
+
+ for (int i < zipFile.GetNumFiles())
+ {
+ ZipFile.Entry entry = scope .();
+ if (zipFile.SelectEntry(i, entry) case .Err)
+ continue;
+
+ fileName.Clear();
+ entry.GetFileName(fileName);
+
+ if (!fileName.StartsWith(subStr))
+ continue;
+
+ destPath.Clear();
+ destPath.Append(destDir);
+ destPath.Append('/');
+ destPath.Append(fileName);
+
+ if (entry.IsDirectory)
+ {
+ if (Directory.CreateDirectory(destPath) case .Err)
+ return .Err;
+ }
+ else
+ {
+ if (entry.ExtractToFile(destPath) case .Err)
+ return .Err;
+ }
+ }
+
+ return .Ok;
+ }
+
+ void CheckPE()
+ {
+ let module = Windows.GetModuleHandleW(null);
+ uint8* moduleData = (uint8*)(int)module;
+ PEFile.PEHeader* header = (.)moduleData;
+
+ PEFile.PE_NTHeaders64* hdr64 = (.)(moduleData + header.e_lfanew);
+ if (hdr64.mFileHeader.mMachine == PEFile.PE_MACHINE_X64)
+ {
+ int fileEnd = 0;
+
+ for (int sectIdx < hdr64.mFileHeader.mNumberOfSections)
+ {
+ PEFile.PESectionHeader* sectHdrHead = (.)((uint8*)(hdr64 + 1)) + sectIdx;
+ fileEnd = Math.Max(fileEnd, sectHdrHead.mPointerToRawData + sectHdrHead.mSizeOfRawData);
+ }
+
+
+ }
+ }
+
+ public function void InstallFunc(StringView dest, StringView filter);
+ public function int ProgressFunc();
+ public function void CancelFunc();
+
+ public function void StartFunc(InstallFunc installFunc, ProgressFunc progressFunc, CancelFunc cancelFunc);
+
+ static void UI_Install(StringView dest, StringView filter)
+ {
+
+ }
+
+ static int UI_GetProgress()
+ {
+ return 0;
+ }
+
+ static void UI_Cancel()
+ {
+
+ }
+
+ void StartUI(StringView dir)
+ {
+ String destLib = scope .();
+ destLib.Append(dir);
+ destLib.Append("/../dist/StubUI_d.dll");
+
+ var lib = Windows.LoadLibraryW(destLib.ToScopedNativeWChar!());
+ if (lib.IsInvalid)
+ {
+ Fail(scope String()..AppendF("Failed to load installer UI '{}'", destLib));
+ return;
+ }
+
+ StartFunc startFunc = (.)Windows.GetProcAddress(lib, "Start");
+ if (startFunc == null)
+ {
+ Fail(scope String()..AppendF("Failed to initialize installer UI '{}'", destLib));
+ return;
+ }
+
+ startFunc(=> UI_Install, => UI_GetProgress, => UI_Cancel);
+ }
+
+ void Run()
+ {
+ String cwd = scope .();
+ Directory.GetCurrentDirectory(cwd);
+ StartUI(cwd);
+
+ CheckPE();
+
+ ZipFile zipFile = scope .();
+ zipFile.Open(@"c:\\temp\\build_1827.zip");
+ ExtractTo(zipFile, @"c:\temp\unzip", .());
+
+ CabFile cabFile = scope .();
+ cabFile.Init();
+ cabFile.Copy();
+ }
+
+ static int Main(String[] args)
+ {
+
+ Program pg = new Program();
+ pg.ParseCommandLine(args);
+ pg.Run();
+ delete pg;
+ return 0;
+ }
+ }
+}
diff --git a/BeefTools/BeefInstall/StubUI/Beef042Dbg64.dll b/BeefTools/BeefInstall/StubUI/Beef042Dbg64.dll
new file mode 100644
index 00000000..4eae2288
Binary files /dev/null and b/BeefTools/BeefInstall/StubUI/Beef042Dbg64.dll differ
diff --git a/BeefTools/BeefInstall/StubUI/Beef042RT64.dll b/BeefTools/BeefInstall/StubUI/Beef042RT64.dll
new file mode 100644
index 00000000..f5e8bd3a
Binary files /dev/null and b/BeefTools/BeefInstall/StubUI/Beef042RT64.dll differ
diff --git a/BeefTools/BeefInstall/StubUI/BeefProj.toml b/BeefTools/BeefInstall/StubUI/BeefProj.toml
new file mode 100644
index 00000000..da98affb
--- /dev/null
+++ b/BeefTools/BeefInstall/StubUI/BeefProj.toml
@@ -0,0 +1,24 @@
+FileVersion = 1
+Dependencies = {corlib = "*", Beefy2D = "*"}
+
+[Project]
+Name = "StubUI"
+TargetType = "BeefDynLib"
+StartupObject = "Program"
+DefaultNamespace = "BIStubUI"
+
+[Configs.Debug.Win64]
+TargetDirectory = "$(WorkspaceDir)/../dist"
+TargetName = "$(ProjectName)_d"
+OtherLinkFlags = "$(LinkFlags) BeefySysLib64_d.lib"
+PostBuildCmds = ["Sleep(1000)", "cmd.exe /c echo Hey!", "CopyFilesIfNewer(\"$(WorkspaceDir)/../../../IDE/dist/BeefySysLib*.*\", \"$(WorkspaceDir)/../dist\")"]
+DebugCommand = "$(WorkspaceDir)\\..\\dist\\Stub_d.exe"
+
+[Configs.Release.Win64]
+TargetDirectory = "$(WorkspaceDir)/../dist"
+
+[Configs.Paranoid.Win64]
+TargetDirectory = "$(WorkspaceDir)/../dist"
+
+[Configs.Test.Win64]
+TargetDirectory = "$(WorkspaceDir)/../dist"
diff --git a/BeefTools/BeefInstall/StubUI/BeefSpace.toml b/BeefTools/BeefInstall/StubUI/BeefSpace.toml
new file mode 100644
index 00000000..bb37a711
--- /dev/null
+++ b/BeefTools/BeefInstall/StubUI/BeefSpace.toml
@@ -0,0 +1,10 @@
+FileVersion = 1
+Projects = {StubUI = {Path = "."}, Beefy2D = "*"}
+Unlocked = ["corlib"]
+
+[Workspace]
+StartupProject = "StubUI"
+
+[Configs.Debug.Win64]
+AllocType = "CRT"
+IntermediateType = "ObjectAndIRCode"
diff --git a/BeefTools/BeefInstall/StubUI/StubUI_d.dll b/BeefTools/BeefInstall/StubUI/StubUI_d.dll
new file mode 100644
index 00000000..73af9b01
Binary files /dev/null and b/BeefTools/BeefInstall/StubUI/StubUI_d.dll differ
diff --git a/BeefTools/BeefInstall/StubUI/StubUI_d.dll.build.txt b/BeefTools/BeefInstall/StubUI/StubUI_d.dll.build.txt
new file mode 100644
index 00000000..bc462c38
--- /dev/null
+++ b/BeefTools/BeefInstall/StubUI/StubUI_d.dll.build.txt
@@ -0,0 +1,2 @@
+IDE Process 43756
+-out:c:\Beef\BeefTools\BeefInstall\StubUI\StubUI_d.dll -dll -implib:"c:\Beef\BeefTools\BeefInstall\StubUI\StubUI_d.lib" c:\Beef\BeefTools\BeefInstall\StubUI/build/Debug_Win64/StubUI/BIStubUI_Program.obj c:\Beef\BeefTools\BeefInstall\StubUI/build/Debug_Win64/corlib/DELEGATE_void_PTR_char8_outPtr_PTR_int32_outSize_PTR_System_Platform_Result_outR__.obj c:\Beef\BeefTools\BeefInstall\StubUI/build/Debug_Win64/corlib/GLOBALS_.obj c:\Beef\BeefTools\BeefInstall\StubUI/build/Debug_Win64/corlib/System_Array.obj c:\Beef\BeefTools\BeefInstall\StubUI/build/Debug_Win64/corlib/System_Array1_System_Collections_Generic_HashSet_System_String_Slot.obj c:\Beef\BeefTools\BeefInstall\StubUI/build/Debug_Win64/corlib/System_Array1_System_Globalization_CalendarData.obj c:\Beef\BeefTools\BeefInstall\StubUI/build/Debug_Win64/corlib/System_Array1_System_Object.obj c:\Beef\BeefTools\BeefInstall\StubUI/build/Debug_Win64/corlib/System_Array1_System_String.obj c:\Beef\BeefTools\BeefInstall\StubUI/build/Debug_Win64/corlib/System_Array1_char16.obj c:\Beef\BeefTools\BeefInstall\StubUI/build/Debug_Win64/corlib/System_Array1_char8.obj c:\Beef\BeefTools\BeefInstall\StubUI/build/Debug_Win64/corlib/System_Array1_int.obj c:\Beef\BeefTools\BeefInstall\StubUI/build/Debug_Win64/corlib/System_Array1_int32.obj c:\Beef\BeefTools\BeefInstall\StubUI/build/Debug_Win64/corlib/System_BitConverter.obj c:\Beef\BeefTools\BeefInstall\StubUI/build/Debug_Win64/corlib/System_Boolean.obj c:\Beef\BeefTools\BeefInstall\StubUI/build/Debug_Win64/corlib/System_CallStackAddr.obj c:\Beef\BeefTools\BeefInstall\StubUI/build/Debug_Win64/corlib/System_Char16.obj c:\Beef\BeefTools\BeefInstall\StubUI/build/Debug_Win64/corlib/System_Char32.obj c:\Beef\BeefTools\BeefInstall\StubUI/build/Debug_Win64/corlib/System_Char8.obj c:\Beef\BeefTools\BeefInstall\StubUI/build/Debug_Win64/corlib/System_ClassVData.obj c:\Beef\BeefTools\BeefInstall\StubUI/build/Debug_Win64/corlib/System_Collections_Generic_HashSet_System_String.obj c:\Beef\BeefTools\BeefInstall\StubUI/build/Debug_Win64/corlib/System_Collections_Generic_HashSet_System_String_Enumerator.obj c:\Beef\BeefTools\BeefInstall\StubUI/build/Debug_Win64/corlib/System_Collections_Generic_HashSet_System_String_Slot.obj c:\Beef\BeefTools\BeefInstall\StubUI/build/Debug_Win64/corlib/System_Collections_Generic_List_System_GC_RootCallback.obj c:\Beef\BeefTools\BeefInstall\StubUI/build/Debug_Win64/corlib/System_Collections_Generic_List_System_GC_RootCallback_Enumerator.obj c:\Beef\BeefTools\BeefInstall\StubUI/build/Debug_Win64/corlib/System_Collections_Generic_List_System_Object.obj c:\Beef\BeefTools\BeefInstall\StubUI/build/Debug_Win64/corlib/System_Collections_Generic_List_System_Object_Enumerator.obj c:\Beef\BeefTools\BeefInstall\StubUI/build/Debug_Win64/corlib/System_Collections_Generic_List_System_String.obj c:\Beef\BeefTools\BeefInstall\StubUI/build/Debug_Win64/corlib/System_Collections_Generic_List_System_String_Enumerator.obj c:\Beef\BeefTools\BeefInstall\StubUI/build/Debug_Win64/corlib/System_CompilerSettings.obj c:\Beef\BeefTools\BeefInstall\StubUI/build/Debug_Win64/corlib/System_DateTime.obj c:\Beef\BeefTools\BeefInstall\StubUI/build/Debug_Win64/corlib/System_DateTimeKind.obj c:\Beef\BeefTools\BeefInstall\StubUI/build/Debug_Win64/corlib/System_DayOfWeek.obj c:\Beef\BeefTools\BeefInstall\StubUI/build/Debug_Win64/corlib/System_DbgRawAllocData.obj c:\Beef\BeefTools\BeefInstall\StubUI/build/Debug_Win64/corlib/System_Delegate.obj c:\Beef\BeefTools\BeefInstall\StubUI/build/Debug_Win64/corlib/System_Diagnostics_Debug.obj c:\Beef\BeefTools\BeefInstall\StubUI/build/Debug_Win64/corlib/System_Double.obj c:\Beef\BeefTools\BeefInstall\StubUI/build/Debug_Win64/corlib/System_Enum.obj c:\Beef\BeefTools\BeefInstall\StubUI/build/Debug_Win64/corlib/System_Event_System_GC_RootCallback.obj c:\Beef\BeefTools\BeefInstall\StubUI/build/Debug_Win64/corlib/System_Event_System_GC_RootCallback_Enumerator.obj c:\Beef\BeefTools\BeefInstall\StubUI/build/Debug_Win64/corlib/System_Function.obj c:\Beef\BeefTools\BeefInstall\StubUI/build/Debug_Win64/corlib/System_GC.obj c:\Beef\BeefTools\BeefInstall\StubUI/build/Debug_Win64/corlib/System_GC_RootCallback.obj c:\Beef\BeefTools\BeefInstall\StubUI/build/Debug_Win64/corlib/System_Globalization_Calendar.obj c:\Beef\BeefTools\BeefInstall\StubUI/build/Debug_Win64/corlib/System_Globalization_CalendarAlgorithmType.obj c:\Beef\BeefTools\BeefInstall\StubUI/build/Debug_Win64/corlib/System_Globalization_CalendarData.obj c:\Beef\BeefTools\BeefInstall\StubUI/build/Debug_Win64/corlib/System_Globalization_CalendarWeekRule.obj c:\Beef\BeefTools\BeefInstall\StubUI/build/Debug_Win64/corlib/System_Globalization_CultureData.obj c:\Beef\BeefTools\BeefInstall\StubUI/build/Debug_Win64/corlib/System_Globalization_CultureInfo.obj c:\Beef\BeefTools\BeefInstall\StubUI/build/Debug_Win64/corlib/System_Globalization_DateTimeFormatFlags.obj c:\Beef\BeefTools\BeefInstall\StubUI/build/Debug_Win64/corlib/System_Globalization_DateTimeFormatInfo.obj c:\Beef\BeefTools\BeefInstall\StubUI/build/Debug_Win64/corlib/System_Globalization_MonthNameStyles.obj c:\Beef\BeefTools\BeefInstall\StubUI/build/Debug_Win64/corlib/System_Globalization_NumberFormatInfo.obj c:\Beef\BeefTools\BeefInstall\StubUI/build/Debug_Win64/corlib/System_Globalization_NumberStyles.obj c:\Beef\BeefTools\BeefInstall\StubUI/build/Debug_Win64/corlib/System_Globalization_OwnedString.obj c:\Beef\BeefTools\BeefInstall\StubUI/build/Debug_Win64/corlib/System_Guid.obj c:\Beef\BeefTools\BeefInstall\StubUI/build/Debug_Win64/corlib/System_Int.obj c:\Beef\BeefTools\BeefInstall\StubUI/build/Debug_Win64/corlib/System_Int32.obj c:\Beef\BeefTools\BeefInstall\StubUI/build/Debug_Win64/corlib/System_Int32_ParseError.obj c:\Beef\BeefTools\BeefInstall\StubUI/build/Debug_Win64/corlib/System_Int64.obj c:\Beef\BeefTools\BeefInstall\StubUI/build/Debug_Win64/corlib/System_Int64_ParseError.obj c:\Beef\BeefTools\BeefInstall\StubUI/build/Debug_Win64/corlib/System_Int_ParseError.obj c:\Beef\BeefTools\BeefInstall\StubUI/build/Debug_Win64/corlib/System_Internal.obj c:\Beef\BeefTools\BeefInstall\StubUI/build/Debug_Win64/corlib/System_Math.obj c:\Beef\BeefTools\BeefInstall\StubUI/build/Debug_Win64/corlib/System_MidpointRounding.obj c:\Beef\BeefTools\BeefInstall\StubUI/build/Debug_Win64/corlib/System_Nullable_System_Reflection_FieldInfo.obj c:\Beef\BeefTools\BeefInstall\StubUI/build/Debug_Win64/corlib/System_Object.obj c:\Beef\BeefTools\BeefInstall\StubUI/build/Debug_Win64/corlib/System_Platform.obj c:\Beef\BeefTools\BeefInstall\StubUI/build/Debug_Win64/corlib/System_Platform_BfpCritSect.obj c:\Beef\BeefTools\BeefInstall\StubUI/build/Debug_Win64/corlib/System_Platform_BfpDynLib.obj c:\Beef\BeefTools\BeefInstall\StubUI/build/Debug_Win64/corlib/System_Platform_BfpEvent.obj c:\Beef\BeefTools\BeefInstall\StubUI/build/Debug_Win64/corlib/System_Platform_BfpEventFlags.obj c:\Beef\BeefTools\BeefInstall\StubUI/build/Debug_Win64/corlib/System_Platform_BfpEventResult.obj c:\Beef\BeefTools\BeefInstall\StubUI/build/Debug_Win64/corlib/System_Platform_BfpFile.obj c:\Beef\BeefTools\BeefInstall\StubUI/build/Debug_Win64/corlib/System_Platform_BfpFileAttributes.obj c:\Beef\BeefTools\BeefInstall\StubUI/build/Debug_Win64/corlib/System_Platform_BfpFileCopyKind.obj c:\Beef\BeefTools\BeefInstall\StubUI/build/Debug_Win64/corlib/System_Platform_BfpFileCreateFlags.obj c:\Beef\BeefTools\BeefInstall\StubUI/build/Debug_Win64/corlib/System_Platform_BfpFileCreateKind.obj c:\Beef\BeefTools\BeefInstall\StubUI/build/Debug_Win64/corlib/System_Platform_BfpFileResult.obj c:\Beef\BeefTools\BeefInstall\StubUI/build/Debug_Win64/corlib/System_Platform_BfpFileSeekKind.obj c:\Beef\BeefTools\BeefInstall\StubUI/build/Debug_Win64/corlib/System_Platform_BfpFileStdKind.obj c:\Beef\BeefTools\BeefInstall\StubUI/build/Debug_Win64/corlib/System_Platform_BfpFileWatcher.obj c:\Beef\BeefTools\BeefInstall\StubUI/build/Debug_Win64/corlib/System_Platform_BfpFileWatcherFlags.obj c:\Beef\BeefTools\BeefInstall\StubUI/build/Debug_Win64/corlib/System_Platform_BfpFindFileData.obj c:\Beef\BeefTools\BeefInstall\StubUI/build/Debug_Win64/corlib/System_Platform_BfpFindFileFlags.obj c:\Beef\BeefTools\BeefInstall\StubUI/build/Debug_Win64/corlib/System_Platform_BfpKillFlags.obj c:\Beef\BeefTools\BeefInstall\StubUI/build/Debug_Win64/corlib/System_Platform_BfpLibResult.obj c:\Beef\BeefTools\BeefInstall\StubUI/build/Debug_Win64/corlib/System_Platform_BfpProcess.obj c:\Beef\BeefTools\BeefInstall\StubUI/build/Debug_Win64/corlib/System_Platform_BfpProcessResult.obj c:\Beef\BeefTools\BeefInstall\StubUI/build/Debug_Win64/corlib/System_Platform_BfpSpawn.obj c:\Beef\BeefTools\BeefInstall\StubUI/build/Debug_Win64/corlib/System_Platform_BfpSpawnFlags.obj c:\Beef\BeefTools\BeefInstall\StubUI/build/Debug_Win64/corlib/System_Platform_BfpSpawnResult.obj c:\Beef\BeefTools\BeefInstall\StubUI/build/Debug_Win64/corlib/System_Platform_BfpSysDirectoryKind.obj c:\Beef\BeefTools\BeefInstall\StubUI/build/Debug_Win64/corlib/System_Platform_BfpSystemResult.obj c:\Beef\BeefTools\BeefInstall\StubUI/build/Debug_Win64/corlib/System_Platform_BfpTimeStamp.obj c:\Beef\BeefTools\BeefInstall\StubUI/build/Debug_Win64/corlib/System_Platform_Result.obj c:\Beef\BeefTools\BeefInstall\StubUI/build/Debug_Win64/corlib/System_Reflection_ArrayType.obj c:\Beef\BeefTools\BeefInstall\StubUI/build/Debug_Win64/corlib/System_Reflection_BindingFlags.obj c:\Beef\BeefTools\BeefInstall\StubUI/build/Debug_Win64/corlib/System_Reflection_FieldFlags.obj c:\Beef\BeefTools\BeefInstall\StubUI/build/Debug_Win64/corlib/System_Reflection_FieldInfo.obj c:\Beef\BeefTools\BeefInstall\StubUI/build/Debug_Win64/corlib/System_Reflection_FieldInfo_Enumerator.obj c:\Beef\BeefTools\BeefInstall\StubUI/build/Debug_Win64/corlib/System_Reflection_FieldInfo_Error.obj c:\Beef\BeefTools\BeefInstall\StubUI/build/Debug_Win64/corlib/System_Reflection_MethodFlags.obj c:\Beef\BeefTools\BeefInstall\StubUI/build/Debug_Win64/corlib/System_Reflection_MethodInfo.obj c:\Beef\BeefTools\BeefInstall\StubUI/build/Debug_Win64/corlib/System_Reflection_MethodInfo_CallError.obj c:\Beef\BeefTools\BeefInstall\StubUI/build/Debug_Win64/corlib/System_Reflection_MethodInfo_Enumerator.obj c:\Beef\BeefTools\BeefInstall\StubUI/build/Debug_Win64/corlib/System_Reflection_PointerType.obj c:\Beef\BeefTools\BeefInstall\StubUI/build/Debug_Win64/corlib/System_Reflection_SizedArrayType.obj c:\Beef\BeefTools\BeefInstall\StubUI/build/Debug_Win64/corlib/System_Reflection_SpecializedGenericType.obj c:\Beef\BeefTools\BeefInstall\StubUI/build/Debug_Win64/corlib/System_Reflection_TypeFlags.obj c:\Beef\BeefTools\BeefInstall\StubUI/build/Debug_Win64/corlib/System_Reflection_TypeId.obj c:\Beef\BeefTools\BeefInstall\StubUI/build/Debug_Win64/corlib/System_Reflection_TypeInstance.obj c:\Beef\BeefTools\BeefInstall\StubUI/build/Debug_Win64/corlib/System_Reflection_TypeInstance_FieldData.obj c:\Beef\BeefTools\BeefInstall\StubUI/build/Debug_Win64/corlib/System_Reflection_TypeInstance_FieldSplatData.obj c:\Beef\BeefTools\BeefInstall\StubUI/build/Debug_Win64/corlib/System_Reflection_TypeInstance_MethodData.obj c:\Beef\BeefTools\BeefInstall\StubUI/build/Debug_Win64/corlib/System_Reflection_TypeInstance_ParamData.obj c:\Beef\BeefTools\BeefInstall\StubUI/build/Debug_Win64/corlib/System_Reflection_TypeInstance_ParamFlags.obj c:\Beef\BeefTools\BeefInstall\StubUI/build/Debug_Win64/corlib/System_Reflection_UnspecializedGenericType.obj c:\Beef\BeefTools\BeefInstall\StubUI/build/Debug_Win64/corlib/System_Reflection_UnspecializedGenericType_GenericParam.obj c:\Beef\BeefTools\BeefInstall\StubUI/build/Debug_Win64/corlib/System_Result_PTR_System_GC_RootCallback.obj c:\Beef\BeefTools\BeefInstall\StubUI/build/Debug_Win64/corlib/System_Result_PTR_System_Object.obj c:\Beef\BeefTools\BeefInstall\StubUI/build/Debug_Win64/corlib/System_Result_PTR_System_String.obj c:\Beef\BeefTools\BeefInstall\StubUI/build/Debug_Win64/corlib/System_Result_PTR_char8.obj c:\Beef\BeefTools\BeefInstall\StubUI/build/Debug_Win64/corlib/System_Result_PTR_void.obj c:\Beef\BeefTools\BeefInstall\StubUI/build/Debug_Win64/corlib/System_Result_System_DateTime.obj c:\Beef\BeefTools\BeefInstall\StubUI/build/Debug_Win64/corlib/System_Result_System_DayOfWeek.obj c:\Beef\BeefTools\BeefInstall\StubUI/build/Debug_Win64/corlib/System_Result_System_GC_RootCallback.obj c:\Beef\BeefTools\BeefInstall\StubUI/build/Debug_Win64/corlib/System_Result_System_Guid.obj c:\Beef\BeefTools\BeefInstall\StubUI/build/Debug_Win64/corlib/System_Result_System_Object.obj c:\Beef\BeefTools\BeefInstall\StubUI/build/Debug_Win64/corlib/System_Result_System_Reflection_FieldInfo.obj c:\Beef\BeefTools\BeefInstall\StubUI/build/Debug_Win64/corlib/System_Result_System_Reflection_MethodInfo.obj c:\Beef\BeefTools\BeefInstall\StubUI/build/Debug_Win64/corlib/System_Result_System_Reflection_MethodInfo_System_Type_MethodError.obj c:\Beef\BeefTools\BeefInstall\StubUI/build/Debug_Win64/corlib/System_Result_System_String.obj c:\Beef\BeefTools\BeefInstall\StubUI/build/Debug_Win64/corlib/System_Result_System_StringView.obj c:\Beef\BeefTools\BeefInstall\StubUI/build/Debug_Win64/corlib/System_Result_System_TimeSpan.obj c:\Beef\BeefTools\BeefInstall\StubUI/build/Debug_Win64/corlib/System_Result_System_Variant.obj c:\Beef\BeefTools\BeefInstall\StubUI/build/Debug_Win64/corlib/System_Result_System_Variant_System_Reflection_MethodInfo_CallError.obj c:\Beef\BeefTools\BeefInstall\StubUI/build/Debug_Win64/corlib/System_Result_bool.obj c:\Beef\BeefTools\BeefInstall\StubUI/build/Debug_Win64/corlib/System_Result_char32.obj c:\Beef\BeefTools\BeefInstall\StubUI/build/Debug_Win64/corlib/System_Result_char8.obj c:\Beef\BeefTools\BeefInstall\StubUI/build/Debug_Win64/corlib/System_Result_double.obj c:\Beef\BeefTools\BeefInstall\StubUI/build/Debug_Win64/corlib/System_Result_int.obj c:\Beef\BeefTools\BeefInstall\StubUI/build/Debug_Win64/corlib/System_Result_int32_System_Int32_ParseError.obj c:\Beef\BeefTools\BeefInstall\StubUI/build/Debug_Win64/corlib/System_Result_int64.obj c:\Beef\BeefTools\BeefInstall\StubUI/build/Debug_Win64/corlib/System_Result_int64_System_Int64_ParseError.obj c:\Beef\BeefTools\BeefInstall\StubUI/build/Debug_Win64/corlib/System_Result_int_System_Int_ParseError.obj c:\Beef\BeefTools\BeefInstall\StubUI/build/Debug_Win64/corlib/System_Result_uint64_System_UInt64_ParseError.obj c:\Beef\BeefTools\BeefInstall\StubUI/build/Debug_Win64/corlib/System_Result_void.obj c:\Beef\BeefTools\BeefInstall\StubUI/build/Debug_Win64/corlib/System_Result_void_System_Platform_Result.obj c:\Beef\BeefTools\BeefInstall\StubUI/build/Debug_Win64/corlib/System_Result_void_System_Reflection_FieldInfo_Error.obj c:\Beef\BeefTools\BeefInstall\StubUI/build/Debug_Win64/corlib/System_Runtime.obj c:\Beef\BeefTools\BeefInstall\StubUI/build/Debug_Win64/corlib/System_Runtime_BfDebugMessageData.obj c:\Beef\BeefTools\BeefInstall\StubUI/build/Debug_Win64/corlib/System_Runtime_BfDebugMessageData_MessageType.obj c:\Beef\BeefTools\BeefInstall\StubUI/build/Debug_Win64/corlib/System_Runtime_BfRtCallbacks.obj c:\Beef\BeefTools\BeefInstall\StubUI/build/Debug_Win64/corlib/System_Runtime_RtCrashReportKind.obj c:\Beef\BeefTools\BeefInstall\StubUI/build/Debug_Win64/corlib/System_Runtime_RtFlags.obj c:\Beef\BeefTools\BeefInstall\StubUI/build/Debug_Win64/corlib/System_Span_System_String.obj c:\Beef\BeefTools\BeefInstall\StubUI/build/Debug_Win64/corlib/System_Span_char16.obj c:\Beef\BeefTools\BeefInstall\StubUI/build/Debug_Win64/corlib/System_Span_char8.obj c:\Beef\BeefTools\BeefInstall\StubUI/build/Debug_Win64/corlib/System_Span_int32.obj c:\Beef\BeefTools\BeefInstall\StubUI/build/Debug_Win64/corlib/System_String.obj c:\Beef\BeefTools\BeefInstall\StubUI/build/Debug_Win64/corlib/System_StringComparison.obj c:\Beef\BeefTools\BeefInstall\StubUI/build/Debug_Win64/corlib/System_StringSplitEnumerator.obj c:\Beef\BeefTools\BeefInstall\StubUI/build/Debug_Win64/corlib/System_StringSplitOptions.obj c:\Beef\BeefTools\BeefInstall\StubUI/build/Debug_Win64/corlib/System_StringView.obj c:\Beef\BeefTools\BeefInstall\StubUI/build/Debug_Win64/corlib/System_String_CreateFlags.obj c:\Beef\BeefTools\BeefInstall\StubUI/build/Debug_Win64/corlib/System_String_RawEnumerator.obj c:\Beef\BeefTools\BeefInstall\StubUI/build/Debug_Win64/corlib/System_String_UTF8Enumerator.obj c:\Beef\BeefTools\BeefInstall\StubUI/build/Debug_Win64/corlib/System_Threading_Interlocked.obj c:\Beef\BeefTools\BeefInstall\StubUI/build/Debug_Win64/corlib/System_Threading_Interlocked_AtomicOrdering.obj c:\Beef\BeefTools\BeefInstall\StubUI/build/Debug_Win64/corlib/System_Threading_Interlocked_FenceAtomicOrdering.obj c:\Beef\BeefTools\BeefInstall\StubUI/build/Debug_Win64/corlib/System_Threading_Interlocked_LoadAtomicOrdering.obj c:\Beef\BeefTools\BeefInstall\StubUI/build/Debug_Win64/corlib/System_Threading_Interlocked_RMWAtomicOrdering.obj c:\Beef\BeefTools\BeefInstall\StubUI/build/Debug_Win64/corlib/System_Threading_Interlocked_StoreAtomicOrdering.obj c:\Beef\BeefTools\BeefInstall\StubUI/build/Debug_Win64/corlib/System_Threading_Monitor.obj c:\Beef\BeefTools\BeefInstall\StubUI/build/Debug_Win64/corlib/System_Threading_Monitor_MonitorLockInstance.obj c:\Beef\BeefTools\BeefInstall\StubUI/build/Debug_Win64/corlib/System_Threading_ParameterizedThreadStart.obj c:\Beef\BeefTools\BeefInstall\StubUI/build/Debug_Win64/corlib/System_Threading_Thread.obj c:\Beef\BeefTools\BeefInstall\StubUI/build/Debug_Win64/corlib/System_Threading_ThreadPriority.obj c:\Beef\BeefTools\BeefInstall\StubUI/build/Debug_Win64/corlib/System_Threading_ThreadStart.obj c:\Beef\BeefTools\BeefInstall\StubUI/build/Debug_Win64/corlib/System_Threading_ThreadState.obj c:\Beef\BeefTools\BeefInstall\StubUI/build/Debug_Win64/corlib/System_Threading_Thread_RuntimeThreadInit.obj c:\Beef\BeefTools\BeefInstall\StubUI/build/Debug_Win64/corlib/System_TimeSpan.obj c:\Beef\BeefTools\BeefInstall\StubUI/build/Debug_Win64/corlib/System_Type.obj c:\Beef\BeefTools\BeefInstall\StubUI/build/Debug_Win64/corlib/System_TypeCode.obj c:\Beef\BeefTools\BeefInstall\StubUI/build/Debug_Win64/corlib/System_Type_MethodError.obj c:\Beef\BeefTools\BeefInstall\StubUI/build/Debug_Win64/corlib/System_UInt64.obj c:\Beef\BeefTools\BeefInstall\StubUI/build/Debug_Win64/corlib/System_UInt64_ParseError.obj c:\Beef\BeefTools\BeefInstall\StubUI/build/Debug_Win64/corlib/System_UnicodeNormalizationOptions.obj c:\Beef\BeefTools\BeefInstall\StubUI/build/Debug_Win64/corlib/System_ValueType.obj c:\Beef\BeefTools\BeefInstall\StubUI/build/Debug_Win64/corlib/System_Variant.obj c:\Beef\BeefTools\BeefInstall\StubUI/build/Debug_Win64/corlib/System_Void.obj c:\Beef\BeefTools\BeefInstall\StubUI/build/Debug_Win64/corlib/TUPLE_.obj c:\Beef\BeefTools\BeefInstall\StubUI/build/Debug_Win64/corlib/TUPLE_U14@partialResult_int.obj c:\Beef\BeefTools\BeefInstall\StubUI/build/Debug_Win64/corlib/TUPLE_U14@partialResult_int32.obj c:\Beef\BeefTools\BeefInstall\StubUI/build/Debug_Win64/corlib/TUPLE_U14@partialResult_int64.obj c:\Beef\BeefTools\BeefInstall\StubUI/build/Debug_Win64/corlib/TUPLE_U14@partialResult_uint64.obj c:\Beef\BeefTools\BeefInstall\StubUI/build/Debug_Win64/corlib/TUPLE_U2@c_char32U4@idx_intU4@len_int.obj c:\Beef\BeefTools\BeefInstall\StubUI/build/Debug_Win64/corlib/TUPLE_U2@c_char32U4@len_int.obj c:\Beef\BeefTools\BeefInstall\StubUI/build/Debug_Win64/corlib/TUPLE_U4@err_System_Int32_ParseError.obj c:\Beef\BeefTools\BeefInstall\StubUI/build/Debug_Win64/corlib/TUPLE_U4@err_System_Int64_ParseError.obj c:\Beef\BeefTools\BeefInstall\StubUI/build/Debug_Win64/corlib/TUPLE_U4@err_System_Int_ParseError.obj c:\Beef\BeefTools\BeefInstall\StubUI/build/Debug_Win64/corlib/TUPLE_U4@err_System_Platform_Result.obj c:\Beef\BeefTools\BeefInstall\StubUI/build/Debug_Win64/corlib/TUPLE_U4@err_System_Reflection_FieldInfo_Error.obj c:\Beef\BeefTools\BeefInstall\StubUI/build/Debug_Win64/corlib/TUPLE_U4@err_System_Reflection_MethodInfo_CallError.obj c:\Beef\BeefTools\BeefInstall\StubUI/build/Debug_Win64/corlib/TUPLE_U4@err_System_Type_MethodError.obj c:\Beef\BeefTools\BeefInstall\StubUI/build/Debug_Win64/corlib/TUPLE_U4@err_System_UInt64_ParseError.obj c:\Beef\BeefTools\BeefInstall\StubUI/build/Debug_Win64/corlib/TUPLE_U4@err_void.obj c:\Beef\BeefTools\BeefInstall\StubUI/build/Debug_Win64/corlib/TUPLE_U4@val_PTR_System_GC_RootCallback.obj c:\Beef\BeefTools\BeefInstall\StubUI/build/Debug_Win64/corlib/TUPLE_U4@val_PTR_System_Object.obj c:\Beef\BeefTools\BeefInstall\StubUI/build/Debug_Win64/corlib/TUPLE_U4@val_PTR_System_String.obj c:\Beef\BeefTools\BeefInstall\StubUI/build/Debug_Win64/corlib/TUPLE_U4@val_PTR_char8.obj c:\Beef\BeefTools\BeefInstall\StubUI/build/Debug_Win64/corlib/TUPLE_U4@val_PTR_void.obj c:\Beef\BeefTools\BeefInstall\StubUI/build/Debug_Win64/corlib/TUPLE_U4@val_System_DateTime.obj c:\Beef\BeefTools\BeefInstall\StubUI/build/Debug_Win64/corlib/TUPLE_U4@val_System_DayOfWeek.obj c:\Beef\BeefTools\BeefInstall\StubUI/build/Debug_Win64/corlib/TUPLE_U4@val_System_GC_RootCallback.obj c:\Beef\BeefTools\BeefInstall\StubUI/build/Debug_Win64/corlib/TUPLE_U4@val_System_Guid.obj c:\Beef\BeefTools\BeefInstall\StubUI/build/Debug_Win64/corlib/TUPLE_U4@val_System_Object.obj c:\Beef\BeefTools\BeefInstall\StubUI/build/Debug_Win64/corlib/TUPLE_U4@val_System_Reflection_FieldInfo.obj c:\Beef\BeefTools\BeefInstall\StubUI/build/Debug_Win64/corlib/TUPLE_U4@val_System_Reflection_MethodInfo.obj c:\Beef\BeefTools\BeefInstall\StubUI/build/Debug_Win64/corlib/TUPLE_U4@val_System_String.obj c:\Beef\BeefTools\BeefInstall\StubUI/build/Debug_Win64/corlib/TUPLE_U4@val_System_StringView.obj c:\Beef\BeefTools\BeefInstall\StubUI/build/Debug_Win64/corlib/TUPLE_U4@val_System_TimeSpan.obj c:\Beef\BeefTools\BeefInstall\StubUI/build/Debug_Win64/corlib/TUPLE_U4@val_System_Variant.obj c:\Beef\BeefTools\BeefInstall\StubUI/build/Debug_Win64/corlib/TUPLE_U4@val_bool.obj c:\Beef\BeefTools\BeefInstall\StubUI/build/Debug_Win64/corlib/TUPLE_U4@val_char32.obj c:\Beef\BeefTools\BeefInstall\StubUI/build/Debug_Win64/corlib/TUPLE_U4@val_char8.obj c:\Beef\BeefTools\BeefInstall\StubUI/build/Debug_Win64/corlib/TUPLE_U4@val_double.obj c:\Beef\BeefTools\BeefInstall\StubUI/build/Debug_Win64/corlib/TUPLE_U4@val_int.obj c:\Beef\BeefTools\BeefInstall\StubUI/build/Debug_Win64/corlib/TUPLE_U4@val_int32.obj c:\Beef\BeefTools\BeefInstall\StubUI/build/Debug_Win64/corlib/TUPLE_U4@val_int64.obj c:\Beef\BeefTools\BeefInstall\StubUI/build/Debug_Win64/corlib/TUPLE_U4@val_uint64.obj c:\Beef\BeefTools\BeefInstall\StubUI/build/Debug_Win64/corlib/TUPLE_U4@val_void.obj c:\Beef\BeefTools\BeefInstall\StubUI/build/Debug_Win64/corlib/TUPLE_U9@paramIdx_int32.obj c:\Beef\BeefTools\BeefInstall\StubUI/build/Debug_Win64/corlib/TUPLE_U9@startIdx_intU7@length_int.obj c:\Beef\BeefTools\BeefInstall\StubUI/build/Debug_Win64/corlib/TUPLE_char32_int.obj c:\Beef\BeefTools\BeefInstall\StubUI/build/Debug_Win64/corlib/TUPLE_char32_int_int.obj c:\Beef\BeefTools\BeefInstall\StubUI/build/Debug_Win64/StubUI/vdata.obj -defaultlib:libcmtd -nologo -incremental:no -pdb:c:\Beef\BeefTools\BeefInstall\StubUI\StubUI_d.pdb -debug -opt:noref -libpath:"C:\Program Files (x86)\Windows Kits\10\Lib\10.0.18362.0\um\x64" -libpath:"C:\Program Files (x86)\Windows Kits\10\Lib\10.0.18362.0\ucrt\x64" -libpath:"C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\VC\Tools\MSVC\14.16.27023\lib\x64" -libpath:"c:\beef\ide\dist\lib\x64" -libpath:c:\Beef\BeefTools\BeefInstall\StubUI Beef042RT64.lib Beef042Dbg64.lib
\ No newline at end of file
diff --git a/BeefTools/BeefInstall/StubUI/StubUI_d.exp b/BeefTools/BeefInstall/StubUI/StubUI_d.exp
new file mode 100644
index 00000000..5cb3af9a
Binary files /dev/null and b/BeefTools/BeefInstall/StubUI/StubUI_d.exp differ
diff --git a/BeefTools/BeefInstall/StubUI/StubUI_d.lib b/BeefTools/BeefInstall/StubUI/StubUI_d.lib
new file mode 100644
index 00000000..999486ee
Binary files /dev/null and b/BeefTools/BeefInstall/StubUI/StubUI_d.lib differ
diff --git a/BeefTools/BeefInstall/StubUI/StubUI_d.pdb b/BeefTools/BeefInstall/StubUI/StubUI_d.pdb
new file mode 100644
index 00000000..0e5a6b90
Binary files /dev/null and b/BeefTools/BeefInstall/StubUI/StubUI_d.pdb differ
diff --git a/BeefTools/BeefInstall/StubUI/src/BIApp.bf b/BeefTools/BeefInstall/StubUI/src/BIApp.bf
new file mode 100644
index 00000000..19a26bcf
--- /dev/null
+++ b/BeefTools/BeefInstall/StubUI/src/BIApp.bf
@@ -0,0 +1,41 @@
+using System;
+using Beefy;
+using Beefy.widgets;
+
+namespace BIStubUI
+{
+ class BIApp : BFApp
+ {
+ public function void InstallFunc(StringView dest, StringView filter);
+ public function int ProgressFunc();
+ public function void CancelFunc();
+
+ public InstallFunc mInstallFunc;
+ public ProgressFunc mProgressFunc;
+ public CancelFunc mCancelFunc;
+
+ Widget mRootWidget;
+ WidgetWindow mMainWindow;
+
+ const int cWidth = 700;
+ const int cHeight = 700;
+
+ public override void Init()
+ {
+ base.Init();
+
+ BFWindow.Flags windowFlags = BFWindow.Flags.Border | BFWindow.Flags.SysMenu | //| BFWindow.Flags.CaptureMediaKeys |
+ BFWindow.Flags.Caption | BFWindow.Flags.Minimize | BFWindow.Flags.QuitOnClose;
+
+ mRootWidget = new Widget();
+ mMainWindow = new WidgetWindow(null, "Beef Installer", 0, 0, cWidth, cHeight, windowFlags, mRootWidget);
+ mMainWindow.SetMinimumSize(480, 360);
+ mMainWindow.mIsMainWindow = true;
+ }
+ }
+
+ static
+ {
+ public static BIApp gApp;
+ }
+}
diff --git a/BeefTools/BeefInstall/StubUI/src/Program.bf b/BeefTools/BeefInstall/StubUI/src/Program.bf
new file mode 100644
index 00000000..c7d22d49
--- /dev/null
+++ b/BeefTools/BeefInstall/StubUI/src/Program.bf
@@ -0,0 +1,38 @@
+using System;
+using System.Diagnostics;
+
+namespace BIStubUI
+{
+ class Program
+ {
+ public static this()
+ {
+ Debug.WriteLine("Initializing StubUI");
+ }
+
+ public static ~this()
+ {
+ Debug.WriteLine("Deinitializing StubUI");
+ }
+
+ [Export]
+ public static void Start(BIApp.InstallFunc installFunc, BIApp.ProgressFunc progressFunc, BIApp.CancelFunc cancelFunc)
+ {
+ gApp = new BIApp();
+ gApp.mInstallFunc = installFunc;
+ gApp.mProgressFunc = progressFunc;
+ gApp.mCancelFunc = cancelFunc;
+ gApp.Run();
+ }
+
+ public static void Hello()
+ {
+
+ }
+
+ public static int Main(String[] args)
+ {
+ return 0;
+ }
+ }
+}
diff --git a/BeefTools/BeefInstall/src/Program.bf b/BeefTools/BeefInstall/src/Program.bf
deleted file mode 100644
index da357c3b..00000000
--- a/BeefTools/BeefInstall/src/Program.bf
+++ /dev/null
@@ -1,96 +0,0 @@
-using System;
-using IDE.Util;
-using System.IO;
-
-namespace BeefInstall
-{
- class Program
- {
- bool HandleCommandLineParam(String key, String value)
- {
- return false;
- }
-
- void UnhandledCommandLine(String key, String value)
- {
-
- }
-
- void ParseCommandLine(String[] args)
- {
- for (var str in args)
- {
- int eqPos = str.IndexOf('=');
- if (eqPos == -1)
- {
- if (!HandleCommandLineParam(str, null))
- UnhandledCommandLine(str, null);
- }
- else
- {
- var cmd = scope String(str, 0, eqPos);
- var param = scope String(str, eqPos + 1);
- if (!HandleCommandLineParam(cmd, param))
- UnhandledCommandLine(cmd, param);
- }
- }
- }
-
- Result ExtractTo(ZipFile zipFile, StringView destDir, StringView subStr)
- {
- String fileName = scope .();
- String destPath = scope .();
-
- for (int i < zipFile.GetNumFiles())
- {
- ZipFile.Entry entry = scope .();
- if (zipFile.SelectEntry(i, entry) case .Err)
- continue;
-
- fileName.Clear();
- entry.GetFileName(fileName);
-
- if (!fileName.StartsWith(subStr))
- continue;
-
- destPath.Clear();
- destPath.Append(destDir);
- destPath.Append('/');
- destPath.Append(fileName);
-
- if (entry.IsDirectory)
- {
- if (Directory.CreateDirectory(destPath) case .Err)
- return .Err;
- }
- else
- {
- if (entry.ExtractToFile(destPath) case .Err)
- return .Err;
- }
- }
-
- return .Ok;
- }
-
- void Run()
- {
- ZipFile zipFile = scope .();
- zipFile.Open(@"c:\\temp\\build_1827.zip");
- ExtractTo(zipFile, @"c:\temp\unzip", .());
-
- CabFile cabFile = scope .();
- cabFile.Init();
- cabFile.Copy();
- }
-
- static int Main(String[] args)
- {
- Program pg = new Program();
- pg.ParseCommandLine(args);
- pg.Run();
- delete pg;
- return 0;
- }
- }
-}
diff --git a/BeefySysLib/BeefySysLib.vcxproj b/BeefySysLib/BeefySysLib.vcxproj
index c1a7365b..b264e7c0 100644
--- a/BeefySysLib/BeefySysLib.vcxproj
+++ b/BeefySysLib/BeefySysLib.vcxproj
@@ -247,6 +247,7 @@
WIN32;_DEBUG;_WINDOWS;BFSYSLIB_STATIC;%(PreprocessorDefinitions)
./; ./platform/win/; third_party/agg-2.4/include; third_party/agg-2.4/include/platform/win32; third_party/; third_party/libffi/i686-pc-cygwin; third_party/libffi/i686-pc-cygwin/include; third_party/libffi/include
MultiThreadedDebug
+ false
Windows
diff --git a/IDE/BeefProj.toml b/IDE/BeefProj.toml
index 7b0541b9..9cd34f24 100644
--- a/IDE/BeefProj.toml
+++ b/IDE/BeefProj.toml
@@ -27,7 +27,7 @@ TargetDirectory = "$(WorkspaceDir)/dist"
TargetName = "BeefIDE_d"
OtherLinkFlags = "$(LinkFlags) Comdlg32.lib kernel32.lib user32.lib advapi32.lib shell32.lib IDEHelper64_d.lib BeefySysLib64_d.lib"
CLibType = "Dynamic"
-DebugCommandArguments = "-proddir=C:\\Beef\\BeefTools\\BeefInstall"
+DebugCommandArguments = "-open=c:\\proj\\TestCPP\\TestCPP.bfdbg"
DebugWorkingDirectory = "c:\\Beef\\IDE\\Tests\\EmptyTest"
EnvironmentVars = ["_NO_DEBUG_HEAP=1"]
diff --git a/IDE/BeefSpace_User.toml b/IDE/BeefSpace_User.toml
index 8454d090..9dcca02f 100644
--- a/IDE/BeefSpace_User.toml
+++ b/IDE/BeefSpace_User.toml
@@ -1,13 +1,14 @@
FileVersion = 1
LastConfig = "Debug"
LastPlatform = "Win64"
-RecentFilesList = ["c:\\beef\\ide\\src\\util\\Zip.bf", "c:\\beef\\ide\\src\\ui\\AutoComplete.bf"]
+RecentFilesList = ["c:\\beef\\ide\\src\\IDEApp.bf", "c:\\beef\\IDEHelper\\DebugManager.cpp", "c:\\beef\\IDEHelper\\Compiler\\BfModule.cpp", "c:\\beef\\IDEHelper\\Compiler\\BfCompiler.cpp", "c:\\beef\\ide\\src\\BuildContext.bf", "c:\\beef\\beefrt\\dbg\\gc.cpp", "c:\\beef\\ide\\src\\ScriptManager.bf", "c:\\beef\\ide\\src\\Project.bf", "c:\\beef\\ide\\src\\CommandQueueManager.bf", "c:\\Beef\\BeefLibs\\corlib\\src\\System\\String.bf"]
+StepFilters = ["System.StringView.operator System.StringView"]
[MainWindow]
-X = 679
-Y = 504
-Width = 2487
-Height = 1554
+X = 1021
+Y = 227
+Width = 2206
+Height = 1810
[MainDockingFrame]
Type = "DockingFrame"
@@ -41,39 +42,346 @@ DefaultDocumentsTabbedView = true
Type = "TabbedView"
[[MainDockingFrame.DockedWidgets.DockedWidgets.Tabs]]
-Active = true
-TabLabel = "Zip.bf"
-TabWidth = 73.0
+TabLabel = "DebugManager.cpp"
+TabWidth = 156.0
Type = "SourceViewPanel"
-FilePath = "c:\\beef\\ide\\src\\util\\Zip.bf"
-CursorPos = 2802
-VertPos = 780.0
+FilePath = "c:\\beef\\IDEHelper\\DebugManager.cpp"
+CursorPos = 15042
+VertPos = 8490.0
+ProjectName = "IDEHelper"
+
+[[MainDockingFrame.DockedWidgets.DockedWidgets.Tabs]]
+TabLabel = "CommandQueueManager.bf"
+TabWidth = 205.0
+Type = "SourceViewPanel"
+FilePath = "c:\\beef\\ide\\src\\CommandQueueManager.bf"
+CursorPos = 896
+VertPos = 1170.0
ProjectName = "IDE"
+[[MainDockingFrame.DockedWidgets.DockedWidgets.Tabs]]
+TabLabel = "ProjectProperties.bf"
+TabWidth = 145.0
+Type = "SourceViewPanel"
+FilePath = "c:\\beef\\ide\\src\\ui\\ProjectProperties.bf"
+CursorPos = 1930
+VertPos = 270.0
+ProjectName = "IDE"
+
+[[MainDockingFrame.DockedWidgets.DockedWidgets.Tabs]]
+TabLabel = "ProjectPanel.bf"
+TabWidth = 116.0
+Type = "SourceViewPanel"
+FilePath = "c:\\beef\\ide\\src\\ui\\ProjectPanel.bf"
+CursorPos = 58964
+VertPos = 25350.0
+ProjectName = "IDE"
+
+[[MainDockingFrame.DockedWidgets.DockedWidgets.Tabs]]
+TabLabel = "Directory.bf"
+TabWidth = 98.0
+Type = "SourceViewPanel"
+FilePath = "c:\\Beef\\BeefLibs\\corlib\\src\\System\\IO\\Directory.bf"
+CursorPos = 294
+ProjectName = "corlib"
+
[[MainDockingFrame.DockedWidgets.DockedWidgets.Tabs]]
TabLabel = "AutoComplete.bf"
-TabWidth = 138.0
+TabWidth = 128.0
Type = "SourceViewPanel"
FilePath = "c:\\beef\\ide\\src\\ui\\AutoComplete.bf"
-CursorPos = 3588
-VertPos = 2205.0
+CursorPos = 5948
+VertPos = 3060.0
ProjectName = "IDE"
[[MainDockingFrame.DockedWidgets.DockedWidgets.Tabs]]
-TabLabel = "Disassembly"
-TabWidth = 122.0
-Type = "DisassemblyPanel"
+TabLabel = "Stopwatch.bf"
+TabWidth = 105.0
+Type = "SourceViewPanel"
+FilePath = "c:\\Beef\\BeefLibs\\corlib\\src\\System\\Diagnostics\\Stopwatch.bf"
+CursorPos = 309
+ProjectName = "corlib"
+
+[[MainDockingFrame.DockedWidgets.DockedWidgets.Tabs]]
+TabLabel = "IComparable.bf"
+TabWidth = 120.0
+Type = "SourceViewPanel"
+FilePath = "c:\\Beef\\BeefLibs\\corlib\\src\\System\\IComparable.bf"
+CursorPos = 404
+ProjectName = "corlib"
+
+[[MainDockingFrame.DockedWidgets.DockedWidgets.Tabs]]
+TabLabel = "Dictionary.bf"
+TabWidth = 103.0
+Type = "SourceViewPanel"
+FilePath = "c:\\Beef\\BeefLibs\\corlib\\src\\System\\Collections\\Generic\\Dictionary.bf"
+CursorPos = 13141
+ProjectName = "corlib"
+
+[[MainDockingFrame.DockedWidgets.DockedWidgets.Tabs]]
+TabLabel = "Workspace.bf"
+TabWidth = 110.0
+Type = "SourceViewPanel"
+FilePath = "c:\\beef\\ide\\src\\Workspace.bf"
+CursorPos = 10820
+VertPos = 5745.0
+ProjectName = "IDE"
+
+[[MainDockingFrame.DockedWidgets.DockedWidgets.Tabs]]
+TabLabel = "Project.bf"
+TabWidth = 85.0
+Type = "SourceViewPanel"
+FilePath = "c:\\beef\\ide\\src\\Project.bf"
+CursorPos = 31286
+VertPos = 16875.0
+ProjectName = "IDE"
+
+[[MainDockingFrame.DockedWidgets.DockedWidgets.Tabs]]
+TabLabel = "gc.cpp"
+TabWidth = 69.0
+Type = "SourceViewPanel"
+FilePath = "c:\\beef\\beefrt\\dbg\\gc.cpp"
+CursorPos = 29571
+VertPos = 16845.0
+
+[[MainDockingFrame.DockedWidgets.DockedWidgets.Tabs]]
+TabLabel = "String.bf"
+TabWidth = 79.0
+Type = "SourceViewPanel"
+FilePath = "c:\\Beef\\BeefLibs\\corlib\\src\\System\\String.bf"
+CursorPos = 20322
+VertPos = 11775.0
+ProjectName = "corlib"
+
+[[MainDockingFrame.DockedWidgets.DockedWidgets.Tabs]]
+TabLabel = "ImmediatePanel.bf"
+TabWidth = 137.0
+Type = "SourceViewPanel"
+FilePath = "c:\\beef\\ide\\src\\ui\\ImmediatePanel.bf"
+CursorPos = 1248
+ProjectName = "IDE"
+
+[[MainDockingFrame.DockedWidgets.DockedWidgets.Tabs]]
+TabLabel = "StatusBar.bf"
+TabWidth = 98.0
+Type = "SourceViewPanel"
+FilePath = "c:\\beef\\ide\\src\\ui\\StatusBar.bf"
+CursorPos = 11876
+ProjectName = "IDE"
+
+[[MainDockingFrame.DockedWidgets.DockedWidgets.Tabs]]
+TabLabel = "ImmediateWidget.bf"
+TabWidth = 148.0
+Type = "SourceViewPanel"
+FilePath = "c:\\beef\\ide\\src\\ui\\ImmediateWidget.bf"
+CursorPos = 10575
+VertPos = 4425.0
+ProjectName = "IDE"
+
+[[MainDockingFrame.DockedWidgets.DockedWidgets.Tabs]]
+TabLabel = "ScriptManager.bf"
+TabWidth = 130.0
+Type = "SourceViewPanel"
+FilePath = "c:\\beef\\ide\\src\\ScriptManager.bf"
+CursorPos = 46372
+VertPos = 29080.0
+ProjectName = "IDE"
+
+[[MainDockingFrame.DockedWidgets.DockedWidgets.Tabs]]
+TabLabel = "ListView.bf"
+TabWidth = 91.0
+Type = "SourceViewPanel"
+FilePath = "c:\\beef\\BeefLibs\\Beefy2D\\src\\widgets\\ListView.bf"
+CursorPos = 24610
+ProjectName = "Beefy2D"
+
+[[MainDockingFrame.DockedWidgets.DockedWidgets.Tabs]]
+TabLabel = "EditWidget.bf"
+TabWidth = 109.0
+Type = "SourceViewPanel"
+FilePath = "c:\\beef\\BeefLibs\\Beefy2D\\src\\widgets\\EditWidget.bf"
+CursorPos = 70859
+ProjectName = "Beefy2D"
+
+[[MainDockingFrame.DockedWidgets.DockedWidgets.Tabs]]
+TabLabel = "OpenFileInSolutionDialog.bf"
+TabWidth = 191.0
+Type = "SourceViewPanel"
+FilePath = "c:\\beef\\ide\\src\\ui\\OpenFileInSolutionDialog.bf"
+CursorPos = 3378
+ProjectName = "IDE"
+
+[[MainDockingFrame.DockedWidgets.DockedWidgets.Tabs]]
+TabLabel = "InstalledProjectDialog.bf"
+TabWidth = 171.0
+Type = "SourceViewPanel"
+FilePath = "c:\\beef\\ide\\src\\ui\\InstalledProjectDialog.bf"
+CursorPos = 2662
+ProjectName = "IDE"
+
+[[MainDockingFrame.DockedWidgets.DockedWidgets.Tabs]]
+TabLabel = "ClassViewPanel.bf"
+TabWidth = 133.0
+Type = "SourceViewPanel"
+FilePath = "c:\\beef\\ide\\src\\ui\\ClassViewPanel.bf"
+CursorPos = 10536
+ProjectName = "IDE"
+
+[[MainDockingFrame.DockedWidgets.DockedWidgets.Tabs]]
+TabLabel = "BinaryDataWidget.bf"
+TabWidth = 149.0
+Type = "SourceViewPanel"
+FilePath = "c:\\beef\\ide\\src\\ui\\BinaryDataWidget.bf"
+CursorPos = 87580
+ProjectName = "IDE"
+
+[[MainDockingFrame.DockedWidgets.DockedWidgets.Tabs]]
+TabLabel = "BfIRBuilder.cpp"
+TabWidth = 116.0
+Type = "SourceViewPanel"
+FilePath = "c:\\beef\\IDEHelper\\Compiler\\BfIRBuilder.cpp"
+CursorPos = 132547
+ProjectName = "IDEHelper"
+
+[[MainDockingFrame.DockedWidgets.DockedWidgets.Tabs]]
+TabLabel = "BfIRCodeGen.cpp"
+TabWidth = 131.0
+Type = "SourceViewPanel"
+FilePath = "c:\\beef\\IDEHelper\\Compiler\\BfIRCodeGen.cpp"
+CursorPos = 124783
+ProjectName = "IDEHelper"
+
+[[MainDockingFrame.DockedWidgets.DockedWidgets.Tabs]]
+TabLabel = "memory"
+TabWidth = 78.0
+Type = "SourceViewPanel"
+FilePath = "c:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Professional\\VC\\Tools\\MSVC\\14.21.27702\\include\\memory"
+CursorPos = 68115
+
+[[MainDockingFrame.DockedWidgets.DockedWidgets.Tabs]]
+TabLabel = "Verifier.cpp"
+TabWidth = 96.0
+Type = "SourceViewPanel"
+FilePath = "c:\\Beef\\extern\\llvm-project_8_0_0\\llvm\\lib\\IR\\Verifier.cpp"
+CursorPos = 189261
+
+[[MainDockingFrame.DockedWidgets.DockedWidgets.Tabs]]
+TabLabel = "BfExprEvaluator.cpp"
+TabWidth = 145.0
+Type = "SourceViewPanel"
+FilePath = "c:\\beef\\IDEHelper\\Compiler\\BfExprEvaluator.cpp"
+CursorPos = 395532
+ProjectName = "IDEHelper"
+
+[[MainDockingFrame.DockedWidgets.DockedWidgets.Tabs]]
+TabLabel = "BfModule.cpp"
+TabWidth = 111.0
+Type = "SourceViewPanel"
+FilePath = "c:\\beef\\IDEHelper\\Compiler\\BfModule.cpp"
+CursorPos = 701696
+VertPos = 303765.0
+ProjectName = "IDEHelper"
+
+[[MainDockingFrame.DockedWidgets.DockedWidgets.Tabs]]
+TabLabel = "Result.bf"
+TabWidth = 80.0
+Type = "SourceViewPanel"
+FilePath = "c:\\Beef\\BeefLibs\\corlib\\src\\System\\Result.bf"
+CursorPos = 699
+ProjectName = "corlib"
+
+[[MainDockingFrame.DockedWidgets.DockedWidgets.Tabs]]
+TabLabel = "LegacyPassManager.cpp"
+TabWidth = 173.0
+Type = "SourceViewPanel"
+FilePath = "c:\\Beef\\extern\\llvm-project_8_0_0\\llvm\\lib\\IR\\LegacyPassManager.cpp"
+CursorPos = 56552
+
+[[MainDockingFrame.DockedWidgets.DockedWidgets.Tabs]]
+TabLabel = "LexicalScopes.cpp"
+TabWidth = 135.0
+Type = "SourceViewPanel"
+FilePath = "c:\\Beef\\extern\\llvm-project_8_0_0\\llvm\\lib\\CodeGen\\LexicalScopes.cpp"
+CursorPos = 6263
+
+[[MainDockingFrame.DockedWidgets.DockedWidgets.Tabs]]
+TabLabel = "TimeZoneInfo.bf"
+TabWidth = 124.0
+Type = "SourceViewPanel"
+FilePath = "c:\\Beef\\BeefLibs\\corlib\\src\\System\\TimeZoneInfo.bf"
+CursorPos = 118021
+ProjectName = "corlib"
+
+[[MainDockingFrame.DockedWidgets.DockedWidgets.Tabs]]
+TabLabel = "Windows.bf"
+TabWidth = 98.0
+Type = "SourceViewPanel"
+FilePath = "c:\\Beef\\BeefLibs\\corlib\\src\\System\\Windows.bf"
+CursorPos = 40234
+ProjectName = "corlib"
+
+[[MainDockingFrame.DockedWidgets.DockedWidgets.Tabs]]
+TabLabel = "Platform.cpp"
+TabWidth = 104.0
+Type = "SourceViewPanel"
+FilePath = "c:\\beef\\BeefySysLib\\platform\\win\\Platform.cpp"
+CursorPos = 59719
+ProjectName = "BeefySysLib"
+
+[[MainDockingFrame.DockedWidgets.DockedWidgets.Tabs]]
+TabLabel = "BfCompiler.bf"
+TabWidth = 108.0
+Type = "SourceViewPanel"
+FilePath = "c:\\beef\\ide\\src\\Compiler\\BfCompiler.bf"
+CursorPos = 7397
+ProjectName = "IDE"
+
+[[MainDockingFrame.DockedWidgets.DockedWidgets.Tabs]]
+TabLabel = "BfCompiler.cpp"
+TabWidth = 118.0
+Type = "SourceViewPanel"
+FilePath = "c:\\beef\\IDEHelper\\Compiler\\BfCompiler.cpp"
+CursorPos = 181147
+VertPos = 82605.0
+ProjectName = "IDEHelper"
+
+[[MainDockingFrame.DockedWidgets.DockedWidgets.Tabs]]
+TabLabel = "WinDebugger.cpp"
+TabWidth = 135.0
+Type = "SourceViewPanel"
+FilePath = "c:\\beef\\IDEHelper\\WinDebugger.cpp"
+CursorPos = 120268
+ProjectName = "Debugger64"
+
+[[MainDockingFrame.DockedWidgets.DockedWidgets.Tabs]]
+TabLabel = "BuildContext.bf"
+TabWidth = 117.0
+Type = "SourceViewPanel"
+FilePath = "c:\\beef\\ide\\src\\BuildContext.bf"
+CursorPos = 3642
+VertPos = 1395.0
+ProjectName = "IDE"
+
+[[MainDockingFrame.DockedWidgets.DockedWidgets.Tabs]]
+Active = true
+TabLabel = "IDEApp.bf"
+TabWidth = 88.0
+Type = "SourceViewPanel"
+FilePath = "c:\\beef\\ide\\src\\IDEApp.bf"
+CursorPos = 320852
+VertPos = 158655.0
+ProjectName = "IDE"
[[MainDockingFrame.DockedWidgets]]
RequestedWidth = 250.0
-RequestedHeight = 553.0
+RequestedHeight = 408.0
Type = "DockingFrame"
SplitType = 1
[[MainDockingFrame.DockedWidgets.DockedWidgets]]
RequestedWidth = 250.0
RequestedHeight = 250.0
-SizePriority = 0.443346
+SizePriority = 0.4483547
Type = "TabbedView"
[[MainDockingFrame.DockedWidgets.DockedWidgets.Tabs]]
@@ -99,7 +407,7 @@ TabLabel = "Watch"
TabWidth = 86.0
Type = "WatchPanel"
Columns = [{Width = 306.0}, {Width = 675.0}, {Width = 200.0}]
-Items = [""]
+Items = ["this", "instIdx", "mcBlock", "bfProject", "gApp", ""]
[[MainDockingFrame.DockedWidgets.DockedWidgets.Tabs]]
TabLabel = "Auto"
@@ -110,7 +418,7 @@ Columns = [{Width = 200.0}, {Width = 442.0}, {Width = 200.0}]
[[MainDockingFrame.DockedWidgets.DockedWidgets]]
RequestedWidth = 910.0
RequestedHeight = 793.0
-SizePriority = 0.203422
+SizePriority = 0.1984133
Type = "TabbedView"
[[MainDockingFrame.DockedWidgets.DockedWidgets.Tabs]]
@@ -146,6 +454,31 @@ TabLabel = "Output"
TabWidth = 90.0
Type = "OutputPanel"
+[[Breakpoints]]
+File = "c:\\Beef\\extern\\llvm-project_8_0_0\\llvm\\lib\\IR\\Verifier.cpp"
+Line = 4875
+Column = 6
+
+[[Breakpoints]]
+File = "c:\\Beef\\extern\\llvm-project_8_0_0\\llvm\\lib\\IR\\Verifier.cpp"
+Line = 214
+Column = 4
+
+[[Breakpoints]]
+File = "c:\\beef\\ide\\src\\Workspace.bf"
+Line = 661
+Column = 3
+
+[[Bookmarks]]
+File = "c:\\beef\\ide\\src\\BuildContext.bf"
+Line = 465
+Column = 6
+
+[[Bookmarks]]
+File = "c:\\beef\\ide\\src\\BuildContext.bf"
+Line = 465
+Column = 6
+
[DebuggerDisplayTypes.""]
-IntDisplayType = "Default"
+IntDisplayType = "Hexadecimal"
MmDisplayType = "Default"
diff --git a/IDE/Tests/BugW001/BeefProj.toml b/IDE/Tests/BugW001/BeefProj.toml
new file mode 100644
index 00000000..36b8e196
--- /dev/null
+++ b/IDE/Tests/BugW001/BeefProj.toml
@@ -0,0 +1,5 @@
+FileVersion = 1
+
+[Project]
+Name = "BugW001"
+StartupObject = "BugW001.Program"
diff --git a/IDE/Tests/BugW001/BeefSpace.toml b/IDE/Tests/BugW001/BeefSpace.toml
new file mode 100644
index 00000000..a3e5083d
--- /dev/null
+++ b/IDE/Tests/BugW001/BeefSpace.toml
@@ -0,0 +1,8 @@
+FileVersion = 1
+Projects = {BugW001 = {Path = "."}}
+
+[Workspace]
+StartupProject = "BugW001"
+
+[Configs.Debug.Win64]
+BfOptimizationLevel = "O0"
diff --git a/IDE/Tests/BugW001/scripts/Test.txt b/IDE/Tests/BugW001/scripts/Test.txt
new file mode 100644
index 00000000..44d5a7ca
--- /dev/null
+++ b/IDE/Tests/BugW001/scripts/Test.txt
@@ -0,0 +1,9 @@
+# This tests extensions on Result, where the void* operator would be double-declared in the IR
+
+ShowFile("src/Program.bf")
+GotoText("//Main_Start")
+ToggleBreakpoint()
+RunWithCompiling()
+
+ToggleCommentAt("Result_Get")
+Compile()
\ No newline at end of file
diff --git a/IDE/Tests/BugW001/src/Program.bf b/IDE/Tests/BugW001/src/Program.bf
new file mode 100644
index 00000000..594632ed
--- /dev/null
+++ b/IDE/Tests/BugW001/src/Program.bf
@@ -0,0 +1,18 @@
+#pragma warning disable 168
+
+using System;
+
+namespace BugW001
+{
+ class Program
+ {
+ static void Main()
+ {
+ //Main_Start
+ Result result = .();
+ /*Result_Get
+ void* vp = result;
+ */
+ }
+ }
+}
diff --git a/IDE/mintest/BeefSpace.toml b/IDE/mintest/BeefSpace.toml
index 6442203f..be668c8f 100644
--- a/IDE/mintest/BeefSpace.toml
+++ b/IDE/mintest/BeefSpace.toml
@@ -10,6 +10,7 @@ IntermediateType = "ObjectAndIRCode"
ConfigSelections = {mintest2 = {Enabled = false}}
[Configs.Debug.Win64]
+BfOptimizationLevel = "O0"
IntermediateType = "ObjectAndIRCode"
COptimizationLevel = "Og"
diff --git a/IDE/mintest/minlib/src/System/Attribute.bf b/IDE/mintest/minlib/src/System/Attribute.bf
index 3954f60a..f631b1af 100644
--- a/IDE/mintest/minlib/src/System/Attribute.bf
+++ b/IDE/mintest/minlib/src/System/Attribute.bf
@@ -291,33 +291,6 @@ namespace System
public bool Profile;
}
- namespace Runtime.InteropServices
- {
- public enum CallingConvention
- {
- Winapi = 1,
- Cdecl = 2,
- StdCall = 3,
- ThisCall = 4,
- FastCall = 5,
-
- Default = Cdecl
- }
-
- [AttributeUsage(AttributeTargets.Method /*3*/)]
- public struct DllImportAttribute : Attribute
- {
- public this(String dllName)
- {
- CallingConvention = .Default;
- CLink = false;
- }
-
- public CallingConvention CallingConvention;
- public bool CLink;
- }
- }
-
public struct ImportAttribute : Attribute
{
public this(String libName)
@@ -325,6 +298,11 @@ namespace System
}
}
+ public struct ExportAttribute : Attribute
+ {
+
+ }
+
[AttributeUsage(AttributeTargets.StaticField | AttributeTargets.Field, .NotInherited)]
public struct ThreadStaticAttribute : Attribute
{
diff --git a/IDE/mintest/minlib/src/System/Collections/Generic/List.bf b/IDE/mintest/minlib/src/System/Collections/Generic/List.bf
index 57bcb3b7..ecfc0d2b 100644
--- a/IDE/mintest/minlib/src/System/Collections/Generic/List.bf
+++ b/IDE/mintest/minlib/src/System/Collections/Generic/List.bf
@@ -7,7 +7,6 @@
#endif
using System;
-using System.Runtime;
using System.Diagnostics;
using System.Diagnostics.Contracts;
using System.Threading;
diff --git a/IDE/mintest/minlib/src/System/Collections/IEnumerator.bf b/IDE/mintest/minlib/src/System/Collections/IEnumerator.bf
index 378b90dc..0a9ad699 100644
--- a/IDE/mintest/minlib/src/System/Collections/IEnumerator.bf
+++ b/IDE/mintest/minlib/src/System/Collections/IEnumerator.bf
@@ -1,5 +1,4 @@
using System;
-using System.Runtime.InteropServices;
namespace System.Collections
{
diff --git a/IDE/mintest/minlib/src/System/Double.bf b/IDE/mintest/minlib/src/System/Double.bf
index e906b382..e3da0e03 100644
--- a/IDE/mintest/minlib/src/System/Double.bf
+++ b/IDE/mintest/minlib/src/System/Double.bf
@@ -19,7 +19,6 @@ namespace System
///#if GENERICS_WORK
/// using System.Numerics;
///#endif
- using System.Runtime.InteropServices;
using System.Diagnostics.Contracts;
public struct Double : double, IHashable, IOpComparable, IOpNegatable, ICanBeNaN /*: IComparable, IFormattable, IConvertible
diff --git a/IDE/mintest/minlib/src/System/Math.bf b/IDE/mintest/minlib/src/System/Math.bf
index f340838f..47254eaa 100644
--- a/IDE/mintest/minlib/src/System/Math.bf
+++ b/IDE/mintest/minlib/src/System/Math.bf
@@ -16,7 +16,6 @@ namespace System
{
//This class contains only static members and doesn't require serialization.
using System;
- using System.Runtime;
using System.Diagnostics.Contracts;
using System.Diagnostics;
diff --git a/IDE/mintest/minlib/src/System/Nullable.bf b/IDE/mintest/minlib/src/System/Nullable.bf
index 7828e88e..6638b3f3 100644
--- a/IDE/mintest/minlib/src/System/Nullable.bf
+++ b/IDE/mintest/minlib/src/System/Nullable.bf
@@ -1,6 +1,5 @@
using System.Reflection;
using System.Collections.Generic;
-using System.Runtime.InteropServices;
using System.Diagnostics;
namespace System
diff --git a/IDE/mintest/minlib/src/System/Threading/Monitor.bf b/IDE/mintest/minlib/src/System/Threading/Monitor.bf
index 629dbca9..47a4ad46 100644
--- a/IDE/mintest/minlib/src/System/Threading/Monitor.bf
+++ b/IDE/mintest/minlib/src/System/Threading/Monitor.bf
@@ -20,7 +20,6 @@
namespace System.Threading
{
using System;
- using System.Runtime;
using System.Threading;
using System.Diagnostics.Contracts;
using System.Diagnostics;
diff --git a/IDE/mintest/mintest.bfuser b/IDE/mintest/mintest.bfuser
deleted file mode 100644
index 14b6bd13..00000000
--- a/IDE/mintest/mintest.bfuser
+++ /dev/null
@@ -1,387 +0,0 @@
-LastConfig = "Debug"
-LastPlatform = "Win64"
-RecentFilesList = ["c:\\beef\\ide\\mintest\\src\\main2.cs", "c:\\beef\\ide\\mintest\\src\\main3.cs", "c:\\beef\\ide\\mintest\\src\\main.cs", "c:\\beef\\ide\\mintest\\minlib\\src\\System\\String.cs", "c:\\beef\\ide\\mintest\\minlib\\src\\System\\Collections\\Generic\\List.bf", "c:\\beef\\ide\\mintest\\minlib\\src\\System\\Array.cs", "c:\\beef\\ide\\mintest\\minlib\\src\\System\\IComparable.cs", "c:\\beef\\ide\\mintest\\minlib\\src\\System\\Collections\\Generic\\Dictionary.bf", "c:\\beef\\ide\\mintest\\minlib\\src\\System\\Object.cs", "Disassembly"]
-
-[MainWindow]
-X = 128
-Y = 166
-Width = 2434
-Height = 1847
-
-[MainDockingFrame]
-Type = "DockingFrame"
-SplitType = 2
-
-[[MainDockingFrame.DockedWidgets]]
-RequestedWidth = 250.000000
-RequestedHeight = 1133.000000
-SizePriority = 1133.000000
-Type = "DockingFrame"
-SplitType = 1
-
-[[MainDockingFrame.DockedWidgets.DockedWidgets]]
-RequestedWidth = 263.000000
-RequestedHeight = 250.000000
-SizePriority = 0.000000
-Type = "TabbedView"
-
-[[MainDockingFrame.DockedWidgets.DockedWidgets.Tabs]]
-TabLabel = "Workspace"
-TabWidth = 95.000000
-Type = "ProjectPanel"
-
-[[MainDockingFrame.DockedWidgets.DockedWidgets]]
-IsFillWidget = true
-RequestedWidth = 1639.000000
-RequestedHeight = 150.000000
-SizePriority = 1639.000000
-DefaultDocumentsTabbedView = true
-Type = "TabbedView"
-
-[[MainDockingFrame.DockedWidgets.DockedWidgets.Tabs]]
-TabLabel = "Contracts.cs"
-TabWidth = 110.000000
-Type = "SourceViewPanel"
-FilePath = "c:\\beef\\ide\\mintest\\minlib\\src\\System\\Diagnostics\\Contracts\\Contracts.cs"
-CursorPos = 2270
-VertPos = 0.000000
-ProjectName = "minlib"
-
-[[MainDockingFrame.DockedWidgets.DockedWidgets.Tabs]]
-TabLabel = "internal.cpp"
-TabWidth = 108.000000
-Type = "SourceViewPanel"
-FilePath = "c:\\beef\\beefrt\\rt\\internal.cpp"
-CursorPos = 20281
-VertPos = 0.000000
-
-[[MainDockingFrame.DockedWidgets.DockedWidgets.Tabs]]
-TabLabel = "main4.cs"
-TabWidth = 90.000000
-Type = "SourceViewPanel"
-FilePath = "c:\\beef\\ide\\mintest\\mintest2\\src\\main4.cs"
-CursorPos = 182
-VertPos = 0.000000
-ProjectName = "mintest2"
-
-[[MainDockingFrame.DockedWidgets.DockedWidgets.Tabs]]
-TabLabel = "Internal.cs"
-TabWidth = 98.000000
-Type = "SourceViewPanel"
-FilePath = "c:\\beef\\ide\\mintest\\minlib\\src\\System\\Internal.cs"
-CursorPos = 2881
-VertPos = 0.000000
-ProjectName = "minlib"
-
-[[MainDockingFrame.DockedWidgets.DockedWidgets.Tabs]]
-TabLabel = "Array.cs"
-TabWidth = 86.000000
-Type = "SourceViewPanel"
-FilePath = "c:\\beef\\ide\\mintest\\minlib\\src\\System\\Array.cs"
-CursorPos = 608
-VertPos = 0.000000
-ProjectName = "minlib"
-
-[[MainDockingFrame.DockedWidgets.DockedWidgets.Tabs]]
-TabLabel = "Variant.cs"
-TabWidth = 96.000000
-Type = "SourceViewPanel"
-FilePath = "c:\\beef\\ide\\mintest\\minlib\\src\\System\\Variant.cs"
-CursorPos = 4292
-VertPos = 0.000000
-ProjectName = "minlib"
-
-[[MainDockingFrame.DockedWidgets.DockedWidgets.Tabs]]
-TabLabel = "String.cs"
-TabWidth = 89.000000
-Type = "SourceViewPanel"
-FilePath = "c:\\beef\\ide\\mintest\\minlib\\src\\System\\String.cs"
-CursorPos = 10914
-VertPos = 0.000000
-ProjectName = "minlib"
-
-[[MainDockingFrame.DockedWidgets.DockedWidgets.Tabs]]
-TabLabel = "Runtime.bf"
-TabWidth = 102.000000
-Type = "SourceViewPanel"
-FilePath = "c:\\beef\\ide\\mintest\\minlib\\src\\System\\Runtime.bf"
-CursorPos = 2021
-VertPos = 0.000000
-ProjectName = "minlib"
-
-[[MainDockingFrame.DockedWidgets.DockedWidgets.Tabs]]
-TabLabel = "List.bf"
-TabWidth = 74.000000
-Type = "SourceViewPanel"
-FilePath = "c:\\beef\\ide\\mintest\\minlib\\src\\System\\Collections\\Generic\\List.bf"
-CursorPos = 9410
-VertPos = 0.000000
-ProjectName = "minlib"
-
-[[MainDockingFrame.DockedWidgets.DockedWidgets.Tabs]]
-TabLabel = "Event.bf"
-TabWidth = 86.000000
-Type = "SourceViewPanel"
-FilePath = "c:\\beef\\ide\\mintest\\minlib\\src\\System\\Event.bf"
-CursorPos = 743
-VertPos = 0.000000
-ProjectName = "minlib"
-
-[[MainDockingFrame.DockedWidgets.DockedWidgets.Tabs]]
-TabLabel = "IEnumerator.cs"
-TabWidth = 125.000000
-Type = "SourceViewPanel"
-FilePath = "c:\\beef\\ide\\mintest\\minlib\\src\\System\\Collections\\IEnumerator.cs"
-CursorPos = 464
-VertPos = 0.000000
-ProjectName = "minlib"
-
-[[MainDockingFrame.DockedWidgets.DockedWidgets.Tabs]]
-TabLabel = "Type.cs"
-TabWidth = 83.000000
-Type = "SourceViewPanel"
-FilePath = "c:\\beef\\ide\\mintest\\minlib\\src\\System\\Type.cs"
-CursorPos = 1538
-VertPos = 0.000000
-ProjectName = "minlib"
-
-[[MainDockingFrame.DockedWidgets.DockedWidgets.Tabs]]
-TabLabel = "Disassembly"
-TabWidth = 112.000000
-Type = "DisassemblyPanel"
-
-[[MainDockingFrame.DockedWidgets.DockedWidgets.Tabs]]
-TabLabel = "Object.cs"
-TabWidth = 93.000000
-Type = "SourceViewPanel"
-FilePath = "c:\\beef\\ide\\mintest\\minlib\\src\\System\\Object.cs"
-CursorPos = 452
-VertPos = 0.000000
-ProjectName = "minlib"
-
-[[MainDockingFrame.DockedWidgets.DockedWidgets.Tabs]]
-TabLabel = "main2.cs"
-TabWidth = 90.000000
-Type = "SourceViewPanel"
-FilePath = "c:\\beef\\ide\\mintest\\src\\main2.cs"
-CursorPos = 2845
-VertPos = 3060.000000
-ProjectName = "mintest"
-
-[[MainDockingFrame.DockedWidgets.DockedWidgets.Tabs]]
-TabLabel = "main3.cs"
-TabWidth = 90.000000
-Type = "SourceViewPanel"
-FilePath = "c:\\beef\\ide\\mintest\\src\\main3.cs"
-CursorPos = 1954
-VertPos = 0.000000
-ProjectName = "mintest"
-
-[[MainDockingFrame.DockedWidgets.DockedWidgets.Tabs]]
-TabLabel = "main.cs"
-TabWidth = 83.000000
-Type = "SourceViewPanel"
-FilePath = "c:\\beef\\ide\\mintest\\src\\main.cs"
-CursorPos = 4383
-VertPos = 0.000000
-ProjectName = "mintest"
-
-[[MainDockingFrame.DockedWidgets.DockedWidgets.Tabs]]
-TabLabel = "Nullable.cs"
-TabWidth = 103.000000
-Type = "SourceViewPanel"
-FilePath = "c:\\beef\\ide\\mintest\\minlib\\src\\System\\Nullable.cs"
-CursorPos = 623
-VertPos = 0.000000
-ProjectName = "minlib"
-
-[[MainDockingFrame.DockedWidgets.DockedWidgets.Tabs]]
-TabLabel = "GC.cs"
-TabWidth = 72.000000
-Type = "SourceViewPanel"
-FilePath = "c:\\beef\\ide\\mintest\\minlib\\src\\System\\GC.cs"
-CursorPos = 1934
-VertPos = 0.000000
-ProjectName = "minlib"
-
-[[MainDockingFrame.DockedWidgets.DockedWidgets.Tabs]]
-TabLabel = "testdll.cpp"
-TabWidth = 100.000000
-Type = "SourceViewPanel"
-FilePath = "c:\\beef\\beeftools\\testdll\\testdll.cpp"
-CursorPos = 939
-VertPos = 0.000000
-
-[[MainDockingFrame.DockedWidgets.DockedWidgets.Tabs]]
-TabLabel = "stdio.h"
-TabWidth = 79.000000
-Type = "SourceViewPanel"
-FilePath = "c:\\program files (x86)\\windows kits\\10\\include\\10.0.16299.0\\ucrt\\stdio.h"
-CursorPos = 27765
-VertPos = 0.000000
-
-[[MainDockingFrame.DockedWidgets.DockedWidgets.Tabs]]
-TabLabel = "Profiler.bf"
-TabWidth = 96.000000
-Type = "SourceViewPanel"
-FilePath = "c:\\beef\\ide\\mintest\\minlib\\src\\System\\Diagnostics\\Profiler.bf"
-CursorPos = 450
-VertPos = 0.000000
-ProjectName = "minlib"
-
-[[MainDockingFrame.DockedWidgets.DockedWidgets.Tabs]]
-TabLabel = "Dictionary.bf"
-TabWidth = 113.000000
-Type = "SourceViewPanel"
-FilePath = "c:\\beef\\ide\\mintest\\minlib\\src\\System\\Collections\\Generic\\Dictionary.bf"
-CursorPos = 3575
-VertPos = 0.000000
-ProjectName = "minlib"
-
-[[MainDockingFrame.DockedWidgets.DockedWidgets.Tabs]]
-TabLabel = "IComparable.cs"
-TabWidth = 130.000000
-Type = "SourceViewPanel"
-FilePath = "c:\\beef\\ide\\mintest\\minlib\\src\\System\\IComparable.cs"
-CursorPos = 75
-VertPos = 0.000000
-ProjectName = "minlib"
-
-[[MainDockingFrame.DockedWidgets.DockedWidgets]]
-RequestedWidth = 291.000000
-RequestedHeight = 250.000000
-SizePriority = 0.000000
-Type = "TabbedView"
-
-[[MainDockingFrame.DockedWidgets.DockedWidgets.Tabs]]
-TabLabel = "Properties"
-TabWidth = 90.000000
-Type = "PropertiesPanel"
-
-[[MainDockingFrame.DockedWidgets]]
-RequestedWidth = 250.000000
-RequestedHeight = 540.000000
-SizePriority = 0.000000
-Type = "DockingFrame"
-SplitType = 1
-
-[[MainDockingFrame.DockedWidgets.DockedWidgets]]
-RequestedWidth = 920.000000
-RequestedHeight = 250.000000
-SizePriority = 0.396523
-Type = "TabbedView"
-
-[[MainDockingFrame.DockedWidgets.DockedWidgets.Tabs]]
-TabLabel = "Auto"
-TabWidth = 150.000000
-Type = "AutoWatchPanel"
-Items = ["args", "str", ""]
-
-[[MainDockingFrame.DockedWidgets.DockedWidgets.Tabs.Columns]]
-Width = 225.000000
-
-[[MainDockingFrame.DockedWidgets.DockedWidgets.Tabs.Columns]]
-Width = 498.000000
-
-[[MainDockingFrame.DockedWidgets.DockedWidgets.Tabs.Columns]]
-Width = 275.000000
-
-[[MainDockingFrame.DockedWidgets.DockedWidgets.Tabs]]
-TabLabel = "Watch"
-TabWidth = 150.000000
-Type = "WatchPanel"
-Items = ["args", "z", ""]
-
-[[MainDockingFrame.DockedWidgets.DockedWidgets.Tabs.Columns]]
-Width = 264.000000
-
-[[MainDockingFrame.DockedWidgets.DockedWidgets.Tabs.Columns]]
-Width = 984.000000
-
-[[MainDockingFrame.DockedWidgets.DockedWidgets.Tabs.Columns]]
-Width = 275.000000
-
-[[MainDockingFrame.DockedWidgets.DockedWidgets.Tabs]]
-TabLabel = "Memory"
-TabWidth = 150.000000
-Type = "MemoryPanel"
-
-[[MainDockingFrame.DockedWidgets.DockedWidgets.Tabs]]
-TabLabel = "Breakpoints"
-TabWidth = 150.000000
-Type = "BreakpointPanel"
-
-[[MainDockingFrame.DockedWidgets.DockedWidgets]]
-RequestedWidth = 777.000000
-RequestedHeight = 250.000000
-SizePriority = 0.603477
-Type = "TabbedView"
-
-[[MainDockingFrame.DockedWidgets.DockedWidgets.Tabs]]
-TabLabel = "Threads"
-TabWidth = 150.000000
-Type = "ThreadPanel"
-
-[[MainDockingFrame.DockedWidgets.DockedWidgets.Tabs]]
-TabLabel = "Immediate"
-TabWidth = 150.000000
-Type = "ImmediatePanel"
-
-[[MainDockingFrame.DockedWidgets.DockedWidgets.Tabs]]
-TabLabel = "Output"
-TabWidth = 150.000000
-Type = "OutputPanel"
-
-[[MainDockingFrame.DockedWidgets.DockedWidgets.Tabs]]
-TabLabel = "Find Results"
-TabWidth = 150.000000
-Type = "FindResultsPanel"
-
-[[MainDockingFrame.DockedWidgets.DockedWidgets.Tabs]]
-TabLabel = "Call Stack"
-TabWidth = 150.000000
-Type = "CallStackPanel"
-
-[[Bookmarks]]
-File = "c:\\beef\\IDE\\mintest\\main.cs"
-Line = 306
-Column = 3
-
-[[Bookmarks]]
-File = "c:\\beef\\IDE\\mintest\\main.cs"
-Line = 56
-Column = 2
-
-[[Bookmarks]]
-File = "c:\\beef\\IDE\\mintest\\main2.cs"
-Line = 8
-Column = 0
-
-[[Bookmarks]]
-File = "c:\\beef\\IDE\\mintest\\main3.cs"
-Line = 177
-Column = 2
-
-[DebuggerDisplayTypes]
-
-[DebuggerDisplayTypes.""]
-IntDisplayType = "Hexadecimal"
-MmDisplayType = "Default"
-
-[[StepFilters]]
-Filter = "System::Internal::ThrowIndexOutOfRange"
-
-[[StepFilters]]
-Filter = "BfObjectStackInit"
-
-[[StepFilters]]
-Filter = "[].this"
-
-[[StepFilters]]
-Filter = "std::basic_string<>::basic_string<>"
-
-[[StepFilters]]
-Filter = "System.StringView.this"
-
-[[StepFilters]]
-Filter = "TestA::TestA"
diff --git a/IDE/mintest/src/main.bf b/IDE/mintest/src/main.bf
index b79417cc..acb4fd0a 100644
--- a/IDE/mintest/src/main.bf
+++ b/IDE/mintest/src/main.bf
@@ -15,7 +15,6 @@ using System;
using System.Threading;
using System.Collections.Generic;
using System.Diagnostics;
-using System.Runtime.InteropServices;
using System.Diagnostics;
using System.Collections.Generic;
using System.Collections;
@@ -178,13 +177,18 @@ namespace Hey.Dude.Bro
public static int Main(String[] args)
{
- while (true)
+ Blurg.Hey();
+
+ /*while (true)
{
int a = 0;
}
int* iPtr = null;
- *iPtr = 123;
+ *iPtr = 123;*/
+
+ GC.SetAutoCollectPeriod(20);
+ Thread.Sleep(1000);
String str = scope .("Boops!");
int len = str.GetLength();
@@ -196,7 +200,7 @@ namespace Hey.Dude.Bro
//Thread.Sleep(500);
- Test2(1, 2, 3, 4);
+ //Test2(1, 2, 3, 4);
thread.Join();
diff --git a/IDE/mintest/src/main2.bf b/IDE/mintest/src/main2.bf
index e69de29b..1f15fa26 100644
--- a/IDE/mintest/src/main2.bf
+++ b/IDE/mintest/src/main2.bf
@@ -0,0 +1,7 @@
+class Snorf
+{
+ struct Bloog
+ {
+ int mA;
+ }
+}
diff --git a/IDE/mintest/src/main3.bf b/IDE/mintest/src/main3.bf
index 281a7cdd..dbddf695 100644
--- a/IDE/mintest/src/main3.bf
+++ b/IDE/mintest/src/main3.bf
@@ -80,13 +80,6 @@ class ClassF : ClassE
}
-class Snorf
-{
- public static void Borf(ClassD cd)
- {
- cd.Poo();
- }
-}
[NoDiscard("Use this value!")]
struct TestStruct
@@ -97,70 +90,33 @@ struct TestStruct
class Blurg
{
- public static void UseTS(TestStruct ts)
+ [Export, CLink, StdCall]
+ public static void Poof()
{
- int c = ts.mA;
+ PrintF("Poofs!\n");
}
- [NoDiscard("Why you no use me?")]
- public static int UseMe()
+ [Export, CLink, StdCall]
+ public static void Poof2()
{
- return 999;
- }
-
- public static TestStruct UseIt()
- {
- return .();
- }
-
- mixin FartOut(int a)
- {
- a = 0;
-
- //let c = 1;
- //c = 3;
- //int b = 123;
- //int c = 99;
+ PrintF("Poofs2!\n");
}
public static void Hey()
{
- mixin Fart(int a)
- {
- //a = 0;
- //int b = 123;
- //int c = 99;
- }
+ Snorf sn = scope .();
- /*int c = 222;
- Fart!(c);*/
+ Result voidPtrResult = default;
- //int __CRASH_AUTOVARIABLE__ = 123;
-
- //UseIt();
-
- //UseMe();
-
- //int a;
+ //void* val = voidPtrResult;
- for (int i < 10)
- {
- int a = 0;
- }
+ //Result ts = .Ok(.());
- TestStruct ts = .();
- ts.mA = 111;
- ts.mB = 222;
- UseTS(ts);
+ //let val = ts.Get();
+ //Snorf.Bloog bl = .();
- ClassD cd = null;
- //let str = cd.mStr;
-
-
-#if A || B
- ClassC cc = scope .();
-#endif
+ //Poof();
}
}
diff --git a/IDE/src/BuildContext.bf b/IDE/src/BuildContext.bf
new file mode 100644
index 00000000..d740a753
--- /dev/null
+++ b/IDE/src/BuildContext.bf
@@ -0,0 +1,1062 @@
+using System.Collections.Generic;
+using System;
+using IDE.Compiler;
+using System.IO;
+using System.Diagnostics;
+using Beefy;
+using IDE.util;
+
+namespace IDE
+{
+ class BuildContext
+ {
+ public Project mHotProject;
+ public Workspace.Options mWorkspaceOptions;
+ public Dictionary mImpLibMap = new .() ~
+ {
+ for (let val in _.Values)
+ delete val;
+ delete _;
+ };
+ public ScriptManager mScriptManager ~ delete _;
+
+ public bool Failed
+ {
+ get
+ {
+ if (mScriptManager != null)
+ return mScriptManager.mFailed;
+ return false;
+ }
+ }
+
+ public enum CustomBuildCommandResult
+ {
+ NoCommands,
+ HadCommands,
+ Failed
+ }
+
+ public CustomBuildCommandResult QueueProjectCustomBuildCommands(Project project, String targetPath, Project.BuildCommandTrigger trigger, List cmdList)
+ {
+ if (cmdList.IsEmpty)
+ return .NoCommands;
+
+ if (trigger == .Never)
+ return .NoCommands;
+
+ if ((trigger == .IfFilesChanged) && (!project.mForceCustomCommands))
+ {
+ int64 highestDateTime = 0;
+
+ int64 targetDateTime = File.GetLastWriteTime(targetPath).Get().ToFileTime();
+
+ bool forceRebuild = false;
+
+ for (var depName in project.mDependencies)
+ {
+ var depProject = gApp.mWorkspace.FindProject(depName.mProjectName);
+ if (depProject != null)
+ {
+ if (depProject.mLastDidBuild)
+ forceRebuild = true;
+ }
+ }
+
+ project.WithProjectItems(scope [&] (projectItem) =>
+ {
+ var projectSource = projectItem as ProjectSource;
+ var importPath = scope String();
+ projectSource.GetFullImportPath(importPath);
+ Result fileDateTime = File.GetLastWriteTime(importPath);
+ if (fileDateTime case .Ok)
+ {
+ let date = fileDateTime.Get().ToFileTime();
+ /*if (date > targetDateTime)
+ Console.WriteLine("Custom build higher time: {0}", importPath);*/
+ highestDateTime = Math.Max(highestDateTime, date);
+ }
+ });
+
+ if ((highestDateTime <= targetDateTime) && (!forceRebuild))
+ return .NoCommands;
+
+ project.mLastDidBuild = true;
+ }
+
+ Workspace.Options workspaceOptions = gApp.GetCurWorkspaceOptions();
+ Project.Options options = gApp.GetCurProjectOptions(project);
+
+ bool didCommands = false;
+
+ let targetName = scope String("Project ", project.mProjectName);
+
+ //Console.WriteLine("Executing custom command {0} {1} {2}", highestDateTime, targetDateTime, forceRebuild);
+ for (let origCustomCmd in cmdList)
+ {
+ bool isCommand = false;
+ for (let c in origCustomCmd.RawChars)
+ {
+ if ((c == '\"') || (c == '$'))
+ break;
+ if (c == '(')
+ isCommand = true;
+ }
+
+ String customCmd = scope String();
+
+ if (isCommand)
+ {
+ customCmd.Append(origCustomCmd);
+ }
+ else
+ {
+ customCmd.Append("%exec ");
+ gApp.ResolveConfigString(workspaceOptions, project, options, origCustomCmd, "custom command", customCmd);
+ }
+
+ if (customCmd.IsWhiteSpace)
+ continue;
+
+ if (mScriptManager == null)
+ {
+ mScriptManager = new .();
+ mScriptManager.mProjectName = new String(project.mProjectName);
+ mScriptManager.mAllowCompiling = true;
+ mScriptManager.mSoftFail = true;
+ mScriptManager.mVerbosity = gApp.mVerbosity;
+ didCommands = true;
+ }
+
+ mScriptManager.QueueCommands(customCmd, project.mProjectName, .NoLines);
+ continue;
+ }
+
+ if (didCommands)
+ {
+ mScriptManager.QueueCommands(scope String()..AppendF("%targetComplete {}", project.mProjectName), targetName, .NoLines);
+
+ let targetCompleteCmd = new IDEApp.TargetCompletedCmd(project);
+ targetCompleteCmd.mIsReady = false;
+ gApp.mExecutionQueue.Add(targetCompleteCmd);
+ project.mNeedsTargetRebuild = true;
+ }
+
+ return didCommands ? .HadCommands : .Failed;
+ }
+
+ bool QueueProjectGNULink(Project project, String targetPath, Workspace.Options workspaceOptions, Project.Options options, String objectsArg)
+ {
+ bool isDebug = gApp.mConfigName.IndexOf("Debug", true) != -1;
+
+#if BF_PLATFORM_WINDOWS
+ String llvmDir = scope String(IDEApp.sApp.mInstallDir);
+ IDEUtils.FixFilePath(llvmDir);
+ llvmDir.Append("llvm/");
+#else
+ String llvmDir = "";
+#endif
+
+ //String error = scope String();
+
+ bool isExe = project.mGeneralOptions.mTargetType != Project.TargetType.BeefLib;
+ if (isExe)
+ {
+ String linkLine = scope String(isDebug ? "-g " : "-g -O2 "); //-O2 -Rpass=inline
+ //(doClangCPP ? "-lc++abi " : "") +
+
+ linkLine.Append("-o ");
+ IDEUtils.AppendWithOptionalQuotes(linkLine, targetPath);
+ linkLine.Append(" ");
+
+ /*if (options.mBuildOptions.mLinkerType == Project.LinkerType.GCC)
+ {
+ // ...
+ }
+ else
+ {
+ linkLine.Append("--target=");
+ GetTargetName(workspaceOptions, linkLine);
+ linkLine.Append(" ");
+ }*/
+
+ if ((project.mGeneralOptions.mTargetType == Project.TargetType.BeefWindowsApplication) ||
+ (project.mGeneralOptions.mTargetType == Project.TargetType.C_WindowsApplication))
+ {
+ linkLine.Append("-mwindows ");
+ }
+
+ linkLine.Append("-no-pie ");
+
+ linkLine.Append(objectsArg);
+
+ //var destDir = scope String();
+ //Path.GetDirectoryName();
+
+ //TODO: Make an option
+ if (options.mBuildOptions.mCLibType == Project.CLibType.Static)
+ {
+ linkLine.Append("-static-libgcc -static-libstdc++ ");
+ }
+ else
+ {
+#if BF_PLATFORM_WINDOWS
+ String[] mingwFiles;
+ String fromDir;
+ if (workspaceOptions.mMachineType == Workspace.MachineType.x86)
+ {
+ fromDir = scope:: String(llvmDir, "i686-w64-mingw32/bin/");
+ mingwFiles = scope:: String[] { "libgcc_s_dw2-1.dll", "libstdc++-6.dll" };
+ }
+ else
+ {
+ fromDir = scope:: String(llvmDir, "x86_64-w64-mingw32/bin/");
+ mingwFiles = scope:: String[] { "libgcc_s_seh-1.dll", "libstdc++-6.dll", "libwinpthread-1.dll" };
+ }
+ for (var mingwFile in mingwFiles)
+ {
+ String fromPath = scope String(fromDir, mingwFile);
+ //string toPath = projectBuildDir + "/" + mingwFile;
+ String toPath = scope String();
+ Path.GetDirectoryPath(targetPath, toPath);
+ toPath.Append("/", mingwFile);
+ if (!File.Exists(toPath))
+ {
+ if (File.Copy(fromPath, toPath) case .Err)
+ {
+ gApp.OutputLineSmart("ERROR: Failed to copy mingw file {0}", fromPath);
+ return false;
+ }
+ }
+ }
+#endif
+ }
+
+ List depProjectList = scope List();
+ gApp.GetDependentProjectList(project, depProjectList);
+ if (depProjectList.Count > 0)
+ {
+ for (var dep in project.mDependencies)
+ {
+ var depProject = gApp.mWorkspace.FindProject(dep.mProjectName);
+ if (depProject == null)
+ {
+ gApp.OutputLine("Failed to locate dependent library: {0}", dep.mProjectName);
+ return false;
+ }
+ else
+ {
+ /*if (depProject.mNeedsTargetRebuild)
+ project.mNeedsTargetRebuild = true;*/
+
+ var depOptions = gApp.GetCurProjectOptions(depProject);
+
+ if (depOptions.mClangObjectFiles != null)
+ {
+ var argBuilder = scope IDEApp.ArgBuilder(linkLine, true);
+
+ for (var fileName in depOptions.mClangObjectFiles)
+ {
+ //AppendWithOptionalQuotes(linkLine, fileName);
+ argBuilder.AddFileName(fileName);
+ argBuilder.AddSep();
+ }
+ }
+
+
+ /*String depLibTargetPath = scope String();
+ ResolveConfigString(depProject, depOptions, "$(TargetPath)", error, depLibTargetPath);
+ IDEUtils.FixFilePath(depLibTargetPath);
+
+ String depDir = scope String();
+ Path.GetDirectoryName(depLibTargetPath, depDir);
+ String depFileName = scope String();
+ Path.GetFileNameWithoutExtension(depLibTargetPath, depFileName);
+
+ AppendWithOptionalQuotes(linkLine, depLibTargetPath);
+ linkLine.Append(" ");*/
+ }
+ }
+ }
+
+#if BF_PLATFORM_WINDOWS
+ String gccExePath = "c:/mingw/bin/g++.exe";
+ String clangExePath = scope String(llvmDir, "bin/clang++.exe");
+#else
+ String gccExePath = "/usr/bin/c++";
+ String clangExePath = scope String("/usr/bin/c++");
+#endif
+
+ if (project.mNeedsTargetRebuild)
+ {
+ if (File.Delete(targetPath) case .Err)
+ {
+ gApp.OutputLine("Failed to delete {0}", targetPath);
+ return false;
+ }
+
+ if (workspaceOptions.mToolsetType == .GNU)
+ {
+ if (workspaceOptions.mMachineType == Workspace.MachineType.x86)
+ {
+ }
+ else
+ {
+ IDEUtils.AppendWithOptionalQuotes(linkLine, scope String("-L", llvmDir, "/x86_64-w64-mingw32/lib"));
+ linkLine.Append(" ");
+ IDEUtils.AppendWithOptionalQuotes(linkLine, scope String("-L", llvmDir, "/lib/gcc/x86_64-w64-mingw32/5.2.0"));
+ linkLine.Append(" ");
+ }
+ }
+ else // Microsoft
+ {
+ if (workspaceOptions.mMachineType == Workspace.MachineType.x86)
+ {
+ //linkLine.Append("-L\"C:\\Program Files (x86)\\Windows Kits\\10\\Lib\\10.0.10586.0\\ucrt\\x86\" ");
+ for (var libPath in gApp.mSettings.mVSSettings.mLib32Paths)
+ {
+ linkLine.AppendF("-L\"{0}\" ", libPath);
+ }
+ }
+ else
+ {
+ /*linkLine.Append("-L\"C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\lib\\amd64\" ");
+ linkLine.Append("-L\"C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\atlmfc\\lib\\amd64\" ");
+ linkLine.Append("-L\"C:\\Program Files (x86)\\Windows Kits\\10\\lib\\10.0.14393.0\\ucrt\\x64\" ");
+ linkLine.Append("-L\"C:\\Program Files (x86)\\Windows Kits\\10\\lib\\10.0.14393.0\\um\\x64\" ");*/
+ for (var libPath in gApp.mSettings.mVSSettings.mLib64Paths)
+ {
+ linkLine.AppendF("-L\"{0}\" ", libPath);
+ }
+ }
+ }
+
+ if (options.mBuildOptions.mOtherLinkFlags.Length != 0)
+ {
+ var linkFlags = scope String();
+ gApp.ResolveConfigString(workspaceOptions, project, options, options.mBuildOptions.mOtherLinkFlags, "link flags", linkFlags);
+ linkLine.Append(linkFlags, " ");
+ }
+
+ String compilerExePath = (workspaceOptions.mToolsetType == .GNU) ? gccExePath : clangExePath;
+ String workingDir = scope String();
+ if (!llvmDir.IsEmpty)
+ {
+ workingDir.Append(llvmDir, "bin");
+ }
+ else
+ {
+ workingDir.Append(gApp.mInstallDir);
+ }
+
+ var runCmd = gApp.QueueRun(compilerExePath, linkLine, workingDir, .UTF8);
+ runCmd.mOnlyIfNotFailed = true;
+ var tagetCompletedCmd = new IDEApp.TargetCompletedCmd(project);
+ tagetCompletedCmd.mOnlyIfNotFailed = true;
+ gApp.mExecutionQueue.Add(tagetCompletedCmd);
+
+ String logStr = scope String();
+ logStr.AppendF("IDE Process {0}\r\n", Platform.BfpProcess_GetCurrentId());
+ logStr.Append(linkLine);
+ String targetLogPath = scope String(targetPath, ".build.txt");
+ Utils.WriteTextFile(targetLogPath, logStr);
+
+ project.mLastDidBuild = true;
+ }
+ }
+
+ return true;
+ }
+
+ public static void GetPdbPath(String targetPath, Workspace.Options workspaceOptions, Project.Options options, String outPdbPath)
+ {
+ int lastDotPos = targetPath.LastIndexOf('.');
+ outPdbPath.Append(targetPath, 0, lastDotPos);
+ if (workspaceOptions.mToolsetType == .LLVM)
+ outPdbPath.Append("_lld");
+ outPdbPath.Append(".pdb");
+ }
+
+ public static void GetRtLibNames(Workspace.Options workspaceOptions, Project.Options options, bool dynName, String outRt, String outDbg)
+ {
+ if ((!dynName) || (options.mBuildOptions.mBeefLibType != .Static))
+ {
+ outRt.Append("Beef", IDEApp.sRTVersionStr, "RT");
+ outRt.Append((workspaceOptions.mMachineType == .x86) ? "32" : "64");
+ switch (options.mBuildOptions.mBeefLibType)
+ {
+ case .Dynamic:
+ case .DynamicDebug: outRt.Append("_d");
+ case .Static:
+ switch (options.mBuildOptions.mCLibType)
+ {
+ case .None:
+ case .Dynamic, .SystemMSVCRT: outRt.Append("_s");
+ case .DynamicDebug: outRt.Append("_sd");
+ case .Static: outRt.Append("_ss");
+ case .StaticDebug: outRt.Append("_ssd");
+ }
+ }
+ outRt.Append(dynName ? ".dll" : ".lib");
+ }
+
+ if ((workspaceOptions.mEnableObjectDebugFlags) || (workspaceOptions.mAllocType == .Debug))
+ {
+ outDbg.Append("Beef", IDEApp.sRTVersionStr, "Dbg");
+ outDbg.Append((workspaceOptions.mMachineType == .x86) ? "32" : "64");
+ if (options.mBuildOptions.mBeefLibType == .DynamicDebug)
+ outDbg.Append("_d");
+ outDbg.Append(dynName ? ".dll" : ".lib");
+ }
+
+ /*if ((workspaceOptions.mEnableObjectDebugFlags) &&
+ ((!dynName) || (options.mBuildOptions.mBeefLibType != .Static)))
+ {
+ outDbg.Append("Beef", IDEApp.sRTVersionStr, "Dbg");
+ outDbg.Append((workspaceOptions.mMachineType == .x86) ? "32" : "64");
+ switch (options.mBuildOptions.mBeefLibType)
+ {
+ case .Dynamic:
+ case .DynamicDebug: outDbg.Append("_d");
+ case .Static:
+ switch (options.mBuildOptions.mCLibType)
+ {
+ case .None:
+ case .Dynamic, .SystemMSVCRT: outDbg.Append("_s");
+ case .DynamicDebug: outDbg.Append("_sd");
+ case .Static: outDbg.Append("_ss");
+ case .StaticDebug: outDbg.Append("_ssd");
+ }
+ }
+ outDbg.Append(dynName ? ".dll" : ".lib");
+ }*/
+ }
+
+ bool QueueProjectMSLink(Project project, String targetPath, String configName, Workspace.Options workspaceOptions, Project.Options options, String objectsArg)
+ {
+ String llvmDir = scope String(IDEApp.sApp.mInstallDir);
+ IDEUtils.FixFilePath(llvmDir);
+ llvmDir.Append("llvm/");
+
+ TestManager.ProjectInfo testProjectInfo = null;
+ if (gApp.mTestManager != null)
+ testProjectInfo = gApp.mTestManager.GetProjectInfo(project);
+
+ bool isExe = (project.mGeneralOptions.mTargetType != Project.TargetType.BeefLib) || (testProjectInfo != null);
+ if (isExe)
+ {
+ String linkLine = scope String();
+
+ linkLine.Append("-out:");
+ IDEUtils.AppendWithOptionalQuotes(linkLine, targetPath);
+ linkLine.Append(" ");
+
+ if (testProjectInfo != null)
+ linkLine.Append("-subsystem:console ");
+ else if (project.mGeneralOptions.mTargetType == .BeefWindowsApplication)
+ linkLine.Append("-subsystem:windows ");
+ else if (project.mGeneralOptions.mTargetType == .C_WindowsApplication)
+ linkLine.Append("-subsystem:console ");
+ else if (project.mGeneralOptions.mTargetType == .BeefDynLib)
+ {
+ linkLine.Append("-dll ");
+
+ if (targetPath.EndsWith(".dll", .InvariantCultureIgnoreCase))
+ {
+ linkLine.Append("-implib:\"");
+ linkLine.Append(targetPath, 0, targetPath.Length - 4);
+ linkLine.Append(".lib\" ");
+ }
+ }
+
+ linkLine.Append(objectsArg);
+
+ //var destDir = scope String();
+ //Path.GetDirectoryName();
+
+ //TODO: Allow selecting lib file. Check date when copying instead of just ALWAYS copying...
+ LibBlock:
+ {
+ List stdLibFileNames = scope .(2);
+ String fromDir;
+
+ fromDir = scope String(gApp.mInstallDir);
+
+ bool AddLib(String dllName)
+ {
+ stdLibFileNames.Add(dllName);
+
+ String fromPath = scope String(fromDir, dllName);
+ String toPath = scope String();
+ Path.GetDirectoryPath(targetPath, toPath);
+ toPath.Append("/", dllName);
+ if (File.CopyIfNewer(fromPath, toPath) case .Err)
+ {
+ gApp.OutputLine("Failed to copy lib file {0}", fromPath);
+ return false;
+ }
+ return true;
+ }
+
+ String rtName = scope String();
+ String dbgName = scope String();
+ GetRtLibNames(workspaceOptions, options, true, rtName, dbgName);
+ if (!rtName.IsEmpty)
+ if (!AddLib(rtName))
+ return false;
+ if (!dbgName.IsEmpty)
+ if (!AddLib(dbgName))
+ return false;
+ switch (workspaceOptions.mAllocType)
+ {
+ case .JEMalloc:
+ if (!AddLib("jemalloc.dll"))
+ return false;
+ default:
+ }
+ }
+
+ List depProjectList = scope List();
+ gApp.GetDependentProjectList(project, depProjectList);
+ if (depProjectList.Count > 0)
+ {
+ for (var dep in project.mDependencies)
+ {
+ var depProject = gApp.mWorkspace.FindProject(dep.mProjectName);
+ if (depProject == null)
+ {
+ gApp.OutputLine("Failed to locate dependent library: {0}", dep.mProjectName);
+ return false;
+ }
+ else
+ {
+ /*if (depProject.mNeedsTargetRebuild)
+ project.mNeedsTargetRebuild = true;*/
+
+ var depOptions = gApp.GetCurProjectOptions(depProject);
+ if (depOptions != null)
+ {
+ if (depOptions.mClangObjectFiles != null)
+ {
+ var argBuilder = scope IDEApp.ArgBuilder(linkLine, true);
+
+ for (var fileName in depOptions.mClangObjectFiles)
+ {
+ //AppendWithOptionalQuotes(linkLine, fileName);
+ argBuilder.AddFileName(fileName);
+ argBuilder.AddSep();
+ }
+ }
+ }
+
+ if (depProject.mGeneralOptions.mTargetType == .BeefDynLib)
+ {
+ if (mImpLibMap.TryGetValue(depProject, var libPath))
+ {
+ IDEUtils.AppendWithOptionalQuotes(linkLine, libPath);
+ linkLine.Append(" ");
+ }
+ }
+
+
+ /*String depLibTargetPath = scope String();
+ ResolveConfigString(depProject, depOptions, "$(TargetPath)", error, depLibTargetPath);
+ IDEUtils.FixFilePath(depLibTargetPath);
+
+ String depDir = scope String();
+ Path.GetDirectoryName(depLibTargetPath, depDir);
+ String depFileName = scope String();
+ Path.GetFileNameWithoutExtension(depLibTargetPath, depFileName);
+
+ AppendWithOptionalQuotes(linkLine, depLibTargetPath);
+ linkLine.Append(" ");*/
+ }
+ }
+ }
+
+ if (project.mNeedsTargetRebuild)
+ {
+ /*if (File.Delete(targetPath).Failed(true))
+ {
+ OutputLine("Failed to delete {0}", targetPath);
+ return false;
+ }*/
+
+ switch (options.mBuildOptions.mCLibType)
+ {
+ case .None:
+ linkLine.Append("-nodefaultlib ");
+ case .Dynamic:
+ //linkLine.Append((workspaceOptions.mMachineType == .x86) ? "-defaultlib:msvcprt " : "-defaultlib:msvcrt ");
+ linkLine.Append("-defaultlib:msvcrt ");
+ case .Static:
+ //linkLine.Append((workspaceOptions.mMachineType == .x86) ? "-defaultlib:libcpmt " : "-defaultlib:libcmt ");
+ linkLine.Append("-defaultlib:libcmt ");
+ case .DynamicDebug:
+ //linkLine.Append((workspaceOptions.mMachineType == .x86) ? "-defaultlib:msvcprtd " : "-defaultlib:msvcrtd ");
+ linkLine.Append("-defaultlib:msvcrtd ");
+ case .StaticDebug:
+ //linkLine.Append((workspaceOptions.mMachineType == .x86) ? "-defaultlib:libcpmtd " : "-defaultlib:libcmtd ");
+ linkLine.Append("-defaultlib:libcmtd ");
+ case .SystemMSVCRT:
+ linkLine.Append("-nodefaultlib ");
+
+ String minRTModName = scope String();
+ if ((project.mGeneralOptions.mTargetType == .BeefWindowsApplication) ||
+ (project.mGeneralOptions.mTargetType == .C_WindowsApplication))
+ minRTModName.Append("g");
+ if (options.mBuildOptions.mBeefLibType == .DynamicDebug)
+ minRTModName.Append("d");
+ if (!minRTModName.IsEmpty)
+ minRTModName.Insert(0, "_");
+
+ if (workspaceOptions.mMachineType == .x86)
+ linkLine.Append(gApp.mInstallDir, @"lib\x86\msvcrt.lib Beef", IDEApp.sRTVersionStr,"MinRT32", minRTModName, ".lib ");
+ else
+ linkLine.Append(gApp.mInstallDir, @"lib\x64\msvcrt.lib Beef", IDEApp.sRTVersionStr,"MinRT64", minRTModName, ".lib ");
+ linkLine.Append("ntdll.lib user32.lib kernel32.lib gdi32.lib winmm.lib shell32.lib ole32.lib rpcrt4.lib chkstk.obj -ignore:4049 -ignore:4217 ");
+ }
+ linkLine.Append("-nologo ");
+ //linkLine.Append("-fixed ");
+
+ // Incremental just seems to be slower for Beef. Test on larger projects to verify
+ linkLine.Append("-incremental:no ");
+
+ if (options.mBuildOptions.mStackSize > 0)
+ linkLine.AppendF("-stack:{} ", options.mBuildOptions.mStackSize);
+
+ linkLine.Append("-pdb:");
+ let pdbName = scope String();
+ GetPdbPath(targetPath, workspaceOptions, options, pdbName);
+ IDEUtils.AppendWithOptionalQuotes(linkLine, pdbName);
+ linkLine.Append(" ");
+
+ //TODO: Only add -debug if we have some debug info?
+ //if (isDebug)
+ if (workspaceOptions.mEmitDebugInfo != .No)
+ linkLine.Append("-debug ");
+
+ if (workspaceOptions.mBfOptimizationLevel.IsOptimized())
+ //linkLine.Append("-opt:ref -verbose ");
+ linkLine.Append("-opt:ref ");
+ else
+ linkLine.Append("-opt:noref ");
+
+ if (workspaceOptions.mMachineType == .x86)
+ {
+ //linkLine.Append("-libpath:\"C:\\Program Files (x86)\\Windows Kits\\10\\Lib\\10.0.10586.0\\ucrt\\x86\" ");
+ for (var libPath in gApp.mSettings.mVSSettings.mLib32Paths)
+ {
+ linkLine.AppendF("-libpath:\"{0}\" ", libPath);
+ }
+ linkLine.Append("-libpath:\"", gApp.mInstallDir, "lib\\x86\" ");
+ }
+ else
+ {
+ /*linkLine.Append("-libpath:\"C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\lib\\amd64\" ");
+ linkLine.Append("-libpath:\"C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\atlmfc\\lib\\amd64\" ");
+ linkLine.Append("-libpath:\"C:\\Program Files (x86)\\Windows Kits\\10\\lib\\10.0.14393.0\\ucrt\\x64\" ");
+ linkLine.Append("-libpath:\"C:\\Program Files (x86)\\Windows Kits\\10\\lib\\10.0.14393.0\\um\\x64\" ");*/
+ for (var libPath in gApp.mSettings.mVSSettings.mLib64Paths)
+ {
+ linkLine.AppendF("-libpath:\"{0}\" ", libPath);
+ }
+ linkLine.Append("-libpath:\"", gApp.mInstallDir, "lib\\x64\" ");
+ }
+
+ String targetDir = scope String();
+ Path.GetDirectoryPath(targetPath, targetDir);
+ linkLine.Append("-libpath:");
+ IDEUtils.AppendWithOptionalQuotes(linkLine, targetDir);
+ linkLine.Append(" ");
+
+ if (options.mBuildOptions.mOtherLinkFlags.Length != 0)
+ {
+ var linkFlags = scope String();
+ gApp.ResolveConfigString(workspaceOptions, project, options, options.mBuildOptions.mOtherLinkFlags, "link flags", linkFlags);
+ linkLine.Append(linkFlags, " ");
+ }
+
+ let winOptions = project.mWindowsOptions;
+ /*if (!String.IsNullOrWhiteSpace(project.mWindowsOptions.mManifestFile))
+ {
+ String manifestPath = scope String();
+ String error = scope String();
+ ResolveConfigString(project, options, winOptions.mManifestFile, error, manifestPath);
+ if (!manifestPath.IsWhiteSpace)
+ {
+ linkLine.Append("/MANIFEST:EMBED /MANIFESTINPUT:");
+ IDEUtils.AppendWithOptionalQuotes(linkLine, manifestPath);
+ linkLine.Append(" ");
+ }
+ }*/
+
+ // Put back
+ if ((!String.IsNullOrWhiteSpace(project.mWindowsOptions.mIconFile)) ||
+ (!String.IsNullOrWhiteSpace(project.mWindowsOptions.mManifestFile)) ||
+ (winOptions.HasVersionInfo()))
+ {
+ String projectBuildDir = scope String();
+ gApp.GetProjectBuildDir(project, projectBuildDir);
+
+ String resOutPath = scope String();
+ resOutPath.Append(projectBuildDir, "\\Resource.res");
+
+ String iconPath = scope String();
+ gApp.ResolveConfigString(workspaceOptions, project, options, winOptions.mIconFile, "icon file", iconPath);
+
+ // Generate resource
+ Result CreateResourceFile()
+ {
+ ResourceGen resGen = scope ResourceGen();
+ if (resGen.Start(resOutPath) case .Err)
+ {
+ gApp.OutputErrorLine("Failed to create resource file '{0}'", resOutPath);
+ return .Err;
+ }
+ if (!iconPath.IsWhiteSpace)
+ {
+ Path.GetAbsolutePath(scope String(iconPath), project.mProjectDir, iconPath..Clear());
+ if (resGen.AddIcon(iconPath) case .Err)
+ {
+ gApp.OutputErrorLine("Failed to add icon");
+ return .Err;
+ }
+ }
+
+ let targetFileName = scope String();
+ Path.GetFileName(targetPath, targetFileName);
+
+ if (resGen.AddVersion(winOptions.mDescription, winOptions.mComments, winOptions.mCompany, winOptions.mProduct,
+ winOptions.mCopyright, winOptions.mFileVersion, winOptions.mProductVersion, targetFileName) case .Err)
+ {
+ gApp.OutputErrorLine("Failed to add version");
+ return .Err;
+ }
+
+ String manifestPath = scope String();
+ gApp.ResolveConfigString(workspaceOptions, project, options, winOptions.mManifestFile, "manifest file", manifestPath);
+ if (!manifestPath.IsWhiteSpace)
+ {
+ Path.GetAbsolutePath(scope String(manifestPath), project.mProjectDir, manifestPath..Clear());
+ if (resGen.AddManifest(manifestPath) case .Err)
+ {
+ gApp.OutputErrorLine("Failed to add manifest file");
+ return .Err;
+ }
+ }
+
+ Try!(resGen.Finish());
+ return .Ok;
+ }
+
+ if (CreateResourceFile() case .Err)
+ {
+ gApp.OutputErrorLine("Failed to generate resource file: {0}", resOutPath);
+ return false;
+ }
+
+ IDEUtils.AppendWithOptionalQuotes(linkLine, resOutPath);
+ }
+
+
+ //String linkerPath = "C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\bin\\amd64\\link.exe";
+
+ let binPath = (workspaceOptions.mMachineType == .x86) ? gApp.mSettings.mVSSettings.mBin32Path : gApp.mSettings.mVSSettings.mBin64Path;
+ if (binPath.IsWhiteSpace)
+ {
+ gApp.OutputErrorLine("Visual Studio tool path not configured. Check Visual Studio configuration in File\\Preferences\\Settings.");
+ return false;
+ }
+
+ String linkerPath = scope String();
+ linkerPath.Append(binPath);
+ linkerPath.Append("/link.exe");
+ if (workspaceOptions.mToolsetType == .LLVM)
+ {
+ linkerPath.Clear();
+ linkerPath.Append(gApp.mInstallDir);
+ linkerPath.Append(@"llvm\bin\lld-link.exe");
+ //linkerPath = @"C:\Program Files\LLVM\bin\lld-link.exe";
+
+ var ltoType = workspaceOptions.mLTOType;
+ if (options.mBeefOptions.mLTOType != null)
+ ltoType = options.mBeefOptions.mLTOType.Value;
+
+ if (ltoType == .Thin)
+ {
+ linkLine.Append(" /lldltocache:");
+
+ String ltoPath = scope String();
+ Path.GetDirectoryPath(targetPath, ltoPath);
+ ltoPath.Append("/ltocache");
+ IDEUtils.AppendWithOptionalQuotes(linkLine, ltoPath);
+ }
+ }
+ //String linkerPath = "C:\\Beef\\IDE\\dist\\BeefLink.exe";
+
+ //QueueRun(compilerExePath, linkLine, @"c:\mingw\bin", (options.mGeneralOptions.mLinkerType == Project.LinkerType.Clang) && (linkLine.Length > 1024));
+ //QueueRun(compilerExePath, linkLine, @"c:\mingw\bin", (linkLine.Length > 1024));
+
+ var runCmd = gApp.QueueRun(linkerPath, linkLine, gApp.mInstallDir, .UTF16WithBom);
+ runCmd.mOnlyIfNotFailed = true;
+ var tagetCompletedCmd = new IDEApp.TargetCompletedCmd(project);
+ tagetCompletedCmd.mOnlyIfNotFailed = true;
+ gApp.mExecutionQueue.Add(tagetCompletedCmd);
+
+ String logStr = scope String();
+ logStr.AppendF("IDE Process {0}\r\n", Platform.BfpProcess_GetCurrentId());
+ logStr.Append(linkLine);
+ String targetLogPath = scope String(targetPath, ".build.txt");
+ Utils.WriteTextFile(targetLogPath, logStr);
+
+ project.mLastDidBuild = true;
+ }
+ }
+
+ return true;
+ }
+
+ public bool QueueProjectCompile(Project project, Project hotProject, IDEApp.BuildCompletedCmd completedCompileCmd, List hotFileNames, bool runAfter)
+ {
+ project.mLastDidBuild = false;
+
+ TestManager.ProjectInfo testProjectInfo = null;
+ if (gApp.mTestManager != null)
+ testProjectInfo = gApp.mTestManager.GetProjectInfo(project);
+
+ var configSelection = gApp.GetCurConfigSelection(project);
+ Project.Options options = gApp.GetCurProjectOptions(project);
+ if (options == null)
+ return true;
+
+ Workspace.Options workspaceOptions = gApp.GetCurWorkspaceOptions();
+ BfCompiler bfCompiler = gApp.mBfBuildCompiler;
+ var bfProject = gApp.mBfBuildSystem.mProjectMap[project];
+ bool bfHadOutputChanges;
+ List bfFileNames = scope List();
+ bfCompiler.GetOutputFileNames(bfProject, true, out bfHadOutputChanges, bfFileNames);
+ defer ClearAndDeleteItems(bfFileNames);//DeleteAndClearItems!(bfFileNames);
+ if (bfHadOutputChanges)
+ project.mNeedsTargetRebuild = true;
+
+ List allFileNames = scope List();
+ List clangAllObjNames = scope List();
+ //List clangObjNames = scope List();
+
+ gApp.GetClangFiles(project.mRootFolder, allFileNames);
+
+ String workspaceBuildDir = scope String();
+ gApp.GetWorkspaceBuildDir(workspaceBuildDir);
+ String projectBuildDir = scope String();
+ gApp.GetProjectBuildDir(project, projectBuildDir);
+ if (!projectBuildDir.IsEmpty)
+ Directory.CreateDirectory(projectBuildDir).IgnoreError();
+
+ //List buildFileNames = new List();
+
+ String targetPath = scope String();
+
+ String outputDir = scope String();
+ String absOutputDir = scope String();
+
+ if (testProjectInfo != null)
+ {
+ absOutputDir.Append(projectBuildDir);
+ outputDir = absOutputDir;
+ targetPath.Append(outputDir, "/", project.mProjectName);
+#if BF_PLATFORM_WINDOWS
+ targetPath.Append(".exe");
+#endif
+
+ Debug.Assert(testProjectInfo.mTestExePath == null);
+ testProjectInfo.mTestExePath = new String(targetPath);
+ }
+ else
+ {
+ gApp.ResolveConfigString(workspaceOptions, project, options, options.mBuildOptions.mTargetDirectory, "target directory", outputDir);
+ Path.GetAbsolutePath(project.mProjectDir, outputDir, absOutputDir);
+ outputDir = absOutputDir;
+ gApp.ResolveConfigString(workspaceOptions, project, options, "$(TargetPath)", "target path", targetPath);
+ }
+ IDEUtils.FixFilePath(targetPath);
+ if (!File.Exists(targetPath))
+ {
+ project.mNeedsTargetRebuild = true;
+
+ String targetDir = scope String();
+ Path.GetDirectoryPath(targetPath, targetDir);
+ if (!targetDir.IsEmpty)
+ Directory.CreateDirectory(targetDir).IgnoreError();
+ }
+
+ if (project.mGeneralOptions.mTargetType == .BeefDynLib)
+ {
+ if (targetPath.EndsWith(".dll", .InvariantCultureIgnoreCase))
+ {
+ String libPath = new .();
+ libPath.Append(targetPath, 0, targetPath.Length - 4);
+ libPath.Append(".lib");
+ mImpLibMap.Add(project, libPath);
+ }
+ }
+
+ switch (QueueProjectCustomBuildCommands(project, targetPath, runAfter ? options.mBuildOptions.mBuildCommandsOnRun : options.mBuildOptions.mBuildCommandsOnCompile, options.mBuildOptions.mPostBuildCmds))
+ {
+ case .NoCommands:
+ case .HadCommands:
+ case .Failed:
+ completedCompileCmd.mFailed = true;
+ }
+
+ if (project.mGeneralOptions.mTargetType == .CustomBuild)
+ {
+ return true;
+ }
+
+#if IDE_C_SUPPORT
+ bool buildAll = false;
+ String buildStringFilePath = scope String();
+ mDepClang.GetBuildStringFileName(projectBuildDir, project, buildStringFilePath);
+ String newBuildString = scope String();
+ GetClangBuildString(project, options, workspaceOptions, true, newBuildString);
+ String clangBuildString = scope String();
+ GetClangBuildString(project, options, workspaceOptions, false, clangBuildString);
+ newBuildString.Append("|", clangBuildString);
+
+ if (mDepClang.mDoDependencyCheck)
+ {
+ String prependStr = scope String();
+ options.mCOptions.mCompilerType.ToString(prependStr);
+ prependStr.Append("|");
+ newBuildString.Insert(0, prependStr);
+ String oldBuildString;
+ mDepClang.mProjectBuildString.TryGetValue(project, out oldBuildString);
+
+ if (oldBuildString == null)
+ {
+ oldBuildString = new String();
+ File.ReadAllText(buildStringFilePath, oldBuildString).IgnoreError();
+ mDepClang.mProjectBuildString[project] = oldBuildString;
+ }
+
+ if (newBuildString != oldBuildString)
+ {
+ buildAll = true;
+
+ if (case .Err = File.WriteAllText(buildStringFilePath, newBuildString))
+ OutputLine("Failed to write {0}", buildStringFilePath);
+
+ delete oldBuildString;
+ mDepClang.mProjectBuildString[project] = new String(newBuildString);
+ }
+ }
+
+ using (mDepClang.mMonitor.Enter())
+ {
+ if (options.mClangObjectFiles == null)
+ options.mClangObjectFiles = new List();
+ else
+ ClearAndDeleteItems(options.mClangObjectFiles);
+
+ for (var projectSource in allFileNames)
+ {
+ var fileEntry = mDepClang.GetProjectEntry(projectSource);
+ Debug.Assert((fileEntry != null) || (!mDepClang.mCompileWaitsForQueueEmpty));
+
+ String filePath = scope String();
+ projectSource.GetFullImportPath(filePath);
+ String baseName = scope String();
+ Path.GetFileNameWithoutExtension(filePath, baseName);
+ String objName = stack String();
+ objName.Append(projectBuildDir, "/", baseName, (options.mCOptions.mGenerateLLVMAsm ? ".ll" : ".obj"));
+
+ if (filePath.Contains("test2.cpp"))
+ {
+ NOP!();
+ }
+
+ bool needsRebuild = true;
+ if ((!buildAll) && (fileEntry != null))
+ {
+ mDepClang.SetEntryObjFileName(fileEntry, objName);
+ mDepClang.SetEntryBuildStringFileName(fileEntry, buildStringFilePath);
+ needsRebuild = mDepClang.DoesEntryNeedRebuild(fileEntry);
+ }
+ if (needsRebuild)
+ {
+ if (hotProject != null)
+ {
+ OutputLine("Hot swap detected disallowed C/C++ change: {0}", filePath);
+ return false;
+ }
+
+ project.mNeedsTargetRebuild = true;
+ var runCmd = CompileSource(project, workspaceOptions, options, filePath);
+ runCmd.mParallelGroup = 1;
+ }
+
+ options.mClangObjectFiles.Add(new String(objName));
+
+ if (hotProject != null)
+ continue;
+
+ clangAllObjNames.Add(objName);
+
+ IdSpan sourceCharIdData;
+ String sourceCode = scope String();
+ FindProjectSourceContent(projectSource, out sourceCharIdData, true, sourceCode);
+ mWorkspace.ProjectSourceCompiled(projectSource, sourceCode, sourceCharIdData);
+ sourceCharIdData.Dispose();
+
+ String* fileEntryPtr;
+ if (completedCompileCmd.mClangCompiledFiles.Add(filePath, out fileEntryPtr))
+ *fileEntryPtr = new String(filePath);
+ }
+ }
+#endif
+
+ String llvmDir = scope String(IDEApp.sApp.mInstallDir);
+ IDEUtils.FixFilePath(llvmDir);
+ llvmDir.Append("llvm/");
+
+ if (hotProject != null)
+ {
+ if ((hotProject == project) || (hotProject.HasDependency(project.mProjectName)))
+ {
+ for (var fileName in bfFileNames)
+ hotFileNames.Add(new String(fileName));
+ }
+
+ return true;
+ }
+
+ String objectsArg = scope String();
+ var argBuilder = scope IDEApp.ArgBuilder(objectsArg, workspaceOptions.mToolsetType != .GNU);
+ for (var bfFileName in bfFileNames)
+ {
+ argBuilder.AddFileName(bfFileName);
+ argBuilder.AddSep();
+ }
+
+ for (var objName in clangAllObjNames)
+ {
+ IDEUtils.AppendWithOptionalQuotes(objectsArg, objName);
+ objectsArg.Append(" ");
+ }
+
+ if (workspaceOptions.mToolsetType == .GNU)
+ {
+ if (!QueueProjectGNULink(project, targetPath, workspaceOptions, options, objectsArg))
+ return false;
+ }
+ else // MS
+ {
+ if (!QueueProjectMSLink(project, targetPath, configSelection.mConfig, workspaceOptions, options, objectsArg))
+ return false;
+ }
+
+ return true;
+ }
+ }
+}
diff --git a/IDE/src/Clang/ClangCompiler.bf b/IDE/src/Clang/ClangCompiler.bf
index 48d2749c..a4fa44c1 100644
--- a/IDE/src/Clang/ClangCompiler.bf
+++ b/IDE/src/Clang/ClangCompiler.bf
@@ -2,7 +2,6 @@ using System;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;
-using System.Runtime.InteropServices;
using System.Diagnostics;
using System.IO;
using Beefy.widgets;
diff --git a/IDE/src/Clang/ClangHelper.bf b/IDE/src/Clang/ClangHelper.bf
index b03b6cd5..668bbafe 100644
--- a/IDE/src/Clang/ClangHelper.bf
+++ b/IDE/src/Clang/ClangHelper.bf
@@ -5,7 +5,6 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
-using System.Runtime.InteropServices;
using Beefy.widgets;
using IDE.Compiler;
diff --git a/IDE/src/Compiler/BfCompiler.bf b/IDE/src/Compiler/BfCompiler.bf
index b2cde9e3..48e465f2 100644
--- a/IDE/src/Compiler/BfCompiler.bf
+++ b/IDE/src/Compiler/BfCompiler.bf
@@ -2,7 +2,6 @@ using System;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;
-using System.Runtime.InteropServices;
using System.Threading;
using System.Diagnostics;
using Beefy.widgets;
diff --git a/IDE/src/Compiler/BfParser.bf b/IDE/src/Compiler/BfParser.bf
index fed6e8af..34338aff 100644
--- a/IDE/src/Compiler/BfParser.bf
+++ b/IDE/src/Compiler/BfParser.bf
@@ -2,7 +2,6 @@ using System;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;
-using System.Runtime.InteropServices;
using System.Diagnostics;
using Beefy.widgets;
using Beefy.utils;
diff --git a/IDE/src/Compiler/BfPassInstance.bf b/IDE/src/Compiler/BfPassInstance.bf
index 4f64fced..65684f4b 100644
--- a/IDE/src/Compiler/BfPassInstance.bf
+++ b/IDE/src/Compiler/BfPassInstance.bf
@@ -2,7 +2,6 @@ using System;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;
-using System.Runtime.InteropServices;
using Beefy.utils;
using System.Diagnostics;
using System.Threading;
diff --git a/IDE/src/Compiler/BfProject.bf b/IDE/src/Compiler/BfProject.bf
index e180d011..815ee9d1 100644
--- a/IDE/src/Compiler/BfProject.bf
+++ b/IDE/src/Compiler/BfProject.bf
@@ -2,7 +2,6 @@ using System;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;
-using System.Runtime.InteropServices;
using System.Diagnostics;
namespace IDE.Compiler
diff --git a/IDE/src/Compiler/BfResolvePassData.bf b/IDE/src/Compiler/BfResolvePassData.bf
index b0880aeb..bc078f52 100644
--- a/IDE/src/Compiler/BfResolvePassData.bf
+++ b/IDE/src/Compiler/BfResolvePassData.bf
@@ -2,7 +2,6 @@ using System;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;
-using System.Runtime.InteropServices;
namespace IDE.Compiler
{
diff --git a/IDE/src/Compiler/BfSystem.bf b/IDE/src/Compiler/BfSystem.bf
index f29eee1c..15d49780 100644
--- a/IDE/src/Compiler/BfSystem.bf
+++ b/IDE/src/Compiler/BfSystem.bf
@@ -3,7 +3,6 @@ using System.Collections.Generic;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
-using System.Runtime.InteropServices;
using System.Diagnostics;
namespace IDE.Compiler
diff --git a/IDE/src/Debugger/Breakpoint.bf b/IDE/src/Debugger/Breakpoint.bf
index 76278139..eda460a6 100644
--- a/IDE/src/Debugger/Breakpoint.bf
+++ b/IDE/src/Debugger/Breakpoint.bf
@@ -2,7 +2,6 @@ using System;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;
-using System.Runtime.InteropServices;
using Beefy.gfx;
using Beefy.theme.dark;
using System.IO;
diff --git a/IDE/src/Debugger/Callbacks.bf b/IDE/src/Debugger/Callbacks.bf
index 77b3a7d9..e7c20c98 100644
--- a/IDE/src/Debugger/Callbacks.bf
+++ b/IDE/src/Debugger/Callbacks.bf
@@ -1,5 +1,4 @@
using System;
-using System.Runtime.InteropServices;
using IDE;
namespace Debugger
diff --git a/IDE/src/Debugger/DebugManager.bf b/IDE/src/Debugger/DebugManager.bf
index bdf6f25d..bc6909c7 100644
--- a/IDE/src/Debugger/DebugManager.bf
+++ b/IDE/src/Debugger/DebugManager.bf
@@ -2,7 +2,6 @@ using System;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;
-using System.Runtime.InteropServices;
using System.Diagnostics;
using Beefy.utils;
using IDE.util;
diff --git a/IDE/src/Debugger/Profiler.bf b/IDE/src/Debugger/Profiler.bf
index cbdd6fa9..e8f2492c 100644
--- a/IDE/src/Debugger/Profiler.bf
+++ b/IDE/src/Debugger/Profiler.bf
@@ -2,7 +2,6 @@ using System;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;
-using System.Runtime.InteropServices;
using System.Diagnostics;
using Beefy.utils;
diff --git a/IDE/src/Debugger/StepFilter.bf b/IDE/src/Debugger/StepFilter.bf
index 2f17c8e5..280cafb0 100644
--- a/IDE/src/Debugger/StepFilter.bf
+++ b/IDE/src/Debugger/StepFilter.bf
@@ -1,6 +1,5 @@
using System;
using System.Collections.Generic;
-using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
diff --git a/IDE/src/IDEApp.bf b/IDE/src/IDEApp.bf
index 644f4fdd..c78e3155 100644
--- a/IDE/src/IDEApp.bf
+++ b/IDE/src/IDEApp.bf
@@ -16,7 +16,6 @@ using Beefy.events;
using Beefy.geom;
using Beefy.res;
using System.Diagnostics;
-using System.Runtime.InteropServices;
using Beefy.utils;
using IDE.Debugger;
using IDE.Compiler;
@@ -207,6 +206,7 @@ namespace IDE
public BfSystem mBfBuildSystem ~ delete _;
public BfCompiler mBfBuildCompiler;
public int mCompileSinceCleanCount;
+ public BuildContext mBuildContext ~ delete _;
#if IDE_C_SUPPORT
public ClangCompiler mDepClang ~ delete _;
#endif
@@ -237,6 +237,7 @@ namespace IDE
public bool mTargetHadFirstBreak = false;
public bool mTargetStartWithStep = false;
public Breakpoint mMainBreakpoint;
+ public Breakpoint mMainBreakpoint2;
public bool mInDisassemblyView;
public bool mIsAttachPendingSourceShow;
public bool mStepOverExternalFiles;
@@ -326,12 +327,12 @@ namespace IDE
DeferredOpenKind mDeferredOpen;
String mDeferredOpenFileName;
- class ExecutionCmd
+ public class ExecutionCmd
{
public bool mOnlyIfNotFailed;
}
- class BuildCompletedCmd : ExecutionCmd
+ public class BuildCompletedCmd : ExecutionCmd
{
public Stopwatch mStopwatch ~ delete _;
public String mHotProjectName ~ delete _;
@@ -369,24 +370,25 @@ namespace IDE
public bool mWasCompiled;
}
- class TargetCompletedCmd : ExecutionCmd
+ public class TargetCompletedCmd : ExecutionCmd
{
+ public Project mProject;
+ public bool mIsReady = true;
+
public this(Project project)
{
mProject = project;
}
-
- public Project mProject;
}
- enum ArgsFileKind
+ public enum ArgsFileKind
{
None,
UTF8,
UTF16WithBom
}
- class ExecutionQueueCmd : ExecutionCmd
+ public class ExecutionQueueCmd : ExecutionCmd
{
public String mFileName ~ delete _;
public String mArgs ~ delete _;
@@ -395,7 +397,7 @@ namespace IDE
public ArgsFileKind mUseArgsFile;
public int32 mParallelGroup = -1;
}
- List mExecutionQueue = new List() ~ DeleteContainerAndItems!(_);
+ public List mExecutionQueue = new List() ~ DeleteContainerAndItems!(_);
public class ExecutionInstance
{
@@ -451,7 +453,7 @@ namespace IDE
{
get
{
- return (mExecutionInstances.Count > 0) || (mExecutionQueue.Count > 0);
+ return (mExecutionInstances.Count > 0) || (mExecutionQueue.Count > 0) || (mBuildContext != null);
}
}
@@ -785,6 +787,7 @@ namespace IDE
let data = scope StructuredData();
if (data.Load(filePath) case .Err)
{
+ CreateDefaultLayout();
OutputErrorLine("Failed to load debug session '{}'", filePath);
return;
}
@@ -1829,17 +1832,21 @@ namespace IDE
SaveFileDialog dialog = scope .();
let activeWindow = GetActiveWindow();
+ let workspaceOptions = GetCurWorkspaceOptions();
let options = GetCurProjectOptions(project);
if (!options.mDebugOptions.mCommand.IsWhiteSpace)
{
+ String execCmd = scope .();
+ ResolveConfigString(workspaceOptions, project, options, options.mDebugOptions.mCommand, "command", execCmd);
+
String initialDir = scope .();
- Path.GetDirectoryPath(options.mDebugOptions.mCommand, initialDir);
+ Path.GetDirectoryPath(execCmd, initialDir);
dialog.InitialDirectory = initialDir;
dialog.SetFilter("Debug Session (*.bfdbg)|*.bfdbg");
dialog.DefaultExt = ".bfdbg";
String fileName = scope .();
- Path.GetFileName(options.mDebugOptions.mCommand, fileName);
+ Path.GetFileNameWithoutExtension(execCmd, fileName);
if (!fileName.IsEmpty)
{
fileName.Append(".bfdbg");
@@ -4045,9 +4052,14 @@ namespace IDE
if (var processBfCompileCmd = cmd as ProcessBfCompileCmd)
{
+ }
+ else if (var buildCompleteCmd = cmd as BuildCompletedCmd)
+ {
+
}
else
{
+ delete cmd;
@cmd.Remove();
}
}
@@ -4057,6 +4069,9 @@ namespace IDE
executionInstance.Cancel();
}
}
+
+ if ((mBuildContext != null) && (mBuildContext.mScriptManager != null))
+ mBuildContext.mScriptManager.Cancel();
}
TabbedView FindTabbedView(DockingFrame dockingFrame, int32 xDir, int32 yDir)
@@ -6274,6 +6289,14 @@ namespace IDE
}
else
mWorkspace.mDir = fullDir;
+ case "-open":
+ String.NewOrSet!(mDeferredOpenFileName, value);
+ if (mDeferredOpenFileName.EndsWith(".bfdbg", .OrdinalIgnoreCase))
+ mDeferredOpen = .DebugSession;
+ else if (mDeferredOpenFileName.EndsWith(".dmp", .OrdinalIgnoreCase))
+ mDeferredOpen = .CrashDump;
+ else
+ mDeferredOpen = .File;
default:
return false;
}
@@ -6828,7 +6851,7 @@ namespace IDE
return null;
}
- void GetClangFiles(ProjectFolder projectFolder, List clangFiles)
+ public void GetClangFiles(ProjectFolder projectFolder, List clangFiles)
{
for (var item in projectFolder.mChildItems)
{
@@ -6866,7 +6889,7 @@ namespace IDE
const int cArgFileThreshold = 0x7800;
- ExecutionQueueCmd QueueRun(String fileName, String args, String workingDir, ArgsFileKind argsFileKind = .None)
+ public ExecutionQueueCmd QueueRun(String fileName, String args, String workingDir, ArgsFileKind argsFileKind = .None)
{
var executionQueueCmd = new ExecutionQueueCmd();
executionQueueCmd.mFileName = new String(fileName);
@@ -7179,7 +7202,21 @@ namespace IDE
#endif
if ((next is ProcessBfCompileCmd) && (mBfBuildCompiler.HasQueuedCommands() || (waitForBuildClang)))
return;
- defer(scope) delete next;
+ /*if (next is BuildCompletedCmd)
+ {
+ if (mBuildContext != null)
+ return;
+ }*/
+ if (let targetCompletedCmd = next as TargetCompletedCmd)
+ {
+ if ((mBuildContext == null) || (!mBuildContext.Failed))
+ {
+ if (!targetCompletedCmd.mIsReady)
+ return;
+ }
+ }
+
+ defer delete next;
mExecutionQueue.RemoveAt(0);
bool ignoreCommand = false;
@@ -7244,6 +7281,7 @@ namespace IDE
{
var targetCompletedCmd = (TargetCompletedCmd)next;
targetCompletedCmd.mProject.mNeedsTargetRebuild = false;
+ targetCompletedCmd.mProject.mForceCustomCommands = false;
}
else if (next is StartDebugCmd)
{
@@ -7281,6 +7319,11 @@ namespace IDE
if (!completedCompileCmd.mFailed)
mDepClang.mDoDependencyCheck = false;
#endif
+ if (mBuildContext != null)
+ {
+ if (mBuildContext.Failed)
+ buildCompletedCmd.mFailed = true;
+ }
CompileResult(buildCompletedCmd.mHotProjectName, !buildCompletedCmd.mFailed);
@@ -7966,39 +8009,6 @@ namespace IDE
return passInstance;
}
- void GetRtLibNames(Workspace.Options workspaceOptions, Project.Options options, bool dynName, String outRt, String outDbg)
- {
- if ((!dynName) || (options.mBuildOptions.mBeefLibType != .Static))
- {
- outRt.Append("Beef", sRTVersionStr, "RT");
- outRt.Append((workspaceOptions.mMachineType == .x86) ? "32" : "64");
- switch (options.mBuildOptions.mBeefLibType)
- {
- case .Dynamic:
- case .DynamicDebug: outRt.Append("_d");
- case .Static:
- switch (options.mBuildOptions.mCLibType)
- {
- case .None:
- case .Dynamic, .SystemMSVCRT: outRt.Append("_s");
- case .DynamicDebug: outRt.Append("_sd");
- case .Static: outRt.Append("_ss");
- case .StaticDebug: outRt.Append("_ssd");
- }
- }
- outRt.Append(dynName ? ".dll" : ".lib");
- }
-
- if ((workspaceOptions.mEnableObjectDebugFlags) || (workspaceOptions.mAllocType == .Debug))
- {
- outDbg.Append("Beef", sRTVersionStr, "Dbg");
- outDbg.Append((workspaceOptions.mMachineType == .x86) ? "32" : "64");
- if (options.mBuildOptions.mBeefLibType == .DynamicDebug)
- outDbg.Append("_d");
- outDbg.Append(dynName ? ".dll" : ".lib");
- }
- }
-
public bool DoResolveConfigString(Workspace.Options workspaceOptions, Project project, Project.Options options, StringView configString, String error, String result)
{
int i = result.Length;
@@ -8052,9 +8062,11 @@ namespace IDE
DoResolveConfigString(workspaceOptions, project, options, options.mBuildOptions.mTargetName, error, newString);
#if BF_PLATFORM_WINDOWS
- if (project.mGeneralOptions.mTargetType == Project.TargetType.BeefLib)
+ if (project.mGeneralOptions.mTargetType == .BeefLib)
newString.Append(".lib");
- else if (project.mGeneralOptions.mTargetType != Project.TargetType.CustomBuild)
+ else if (project.mGeneralOptions.mTargetType == .BeefDynLib)
+ newString.Append(".dll");
+ else if (project.mGeneralOptions.mTargetType != .CustomBuild)
newString.Append(".exe");
#else
if (project.mGeneralOptions.mTargetType == Project.TargetType.BeefLib)
@@ -8062,7 +8074,13 @@ namespace IDE
#endif
}
case "ProjectDir":
- newString = project.mProjectDir;
+ if (project.IsDebugSession)
+ {
+ newString = scope:: String();
+ Path.GetDirectoryPath(project.mProjectPath, newString);
+ }
+ else
+ newString = project.mProjectDir;
case "BuildDir":
newString = scope:: String();
GetProjectBuildDir(project, newString);
@@ -8072,7 +8090,7 @@ namespace IDE
#if BF_PLATFORM_WINDOWS
String rtName = scope String();
String dbgName = scope String();
- GetRtLibNames(workspaceOptions, options, false, rtName, dbgName);
+ BuildContext.GetRtLibNames(workspaceOptions, options, false, rtName, dbgName);
newString.Append(rtName);
if (!dbgName.IsEmpty)
newString.Append(" ", dbgName);
@@ -8118,14 +8136,18 @@ namespace IDE
{
case "Configuration":
newString = mConfigName;
- break;
case "Platform":
newString = mPlatformName;
- break;
case "WorkspaceDir":
if (mWorkspace.mDir != null)
newString = mWorkspace.mDir;
- break;
+ else if (project.IsDebugSession)
+ {
+ newString = scope:: String();
+ Path.GetDirectoryPath(project.mProjectPath, newString);
+ }
+ case "BeefPath":
+ newString = gApp.mInstallDir;
default:
}
}
@@ -8425,238 +8447,6 @@ namespace IDE
#endif
}
- bool QueueProjectGNULink(Project project, String targetPath, Workspace.Options workspaceOptions, Project.Options options, String objectsArg)
- {
- bool isDebug = mConfigName.IndexOf("Debug", true) != -1;
-
-#if BF_PLATFORM_WINDOWS
- String llvmDir = scope String(IDEApp.sApp.mInstallDir);
- IDEUtils.FixFilePath(llvmDir);
- llvmDir.Append("llvm/");
-#else
- String llvmDir = "";
-#endif
-
- //String error = scope String();
-
- bool isExe = project.mGeneralOptions.mTargetType != Project.TargetType.BeefLib;
- if (isExe)
- {
- String linkLine = scope String(isDebug ? "-g " : "-g -O2 "); //-O2 -Rpass=inline
- //(doClangCPP ? "-lc++abi " : "") +
-
- linkLine.Append("-o ");
- IDEUtils.AppendWithOptionalQuotes(linkLine, targetPath);
- linkLine.Append(" ");
-
- /*if (options.mBuildOptions.mLinkerType == Project.LinkerType.GCC)
- {
- // ...
- }
- else
- {
- linkLine.Append("--target=");
- GetTargetName(workspaceOptions, linkLine);
- linkLine.Append(" ");
- }*/
-
- if ((project.mGeneralOptions.mTargetType == Project.TargetType.BeefWindowsApplication) ||
- (project.mGeneralOptions.mTargetType == Project.TargetType.C_WindowsApplication))
- {
- linkLine.Append("-mwindows ");
- }
-
- linkLine.Append("-no-pie ");
-
- linkLine.Append(objectsArg);
-
- //var destDir = scope String();
- //Path.GetDirectoryName();
-
- //TODO: Make an option
- if (options.mBuildOptions.mCLibType == Project.CLibType.Static)
- {
- linkLine.Append("-static-libgcc -static-libstdc++ ");
- }
- else
- {
-#if BF_PLATFORM_WINDOWS
- String[] mingwFiles;
- String fromDir;
- if (workspaceOptions.mMachineType == Workspace.MachineType.x86)
- {
- fromDir = scope:: String(llvmDir, "i686-w64-mingw32/bin/");
- mingwFiles = scope:: String[] { "libgcc_s_dw2-1.dll", "libstdc++-6.dll" };
- }
- else
- {
- fromDir = scope:: String(llvmDir, "x86_64-w64-mingw32/bin/");
- mingwFiles = scope:: String[] { "libgcc_s_seh-1.dll", "libstdc++-6.dll", "libwinpthread-1.dll" };
- }
- for (var mingwFile in mingwFiles)
- {
- String fromPath = scope String(fromDir, mingwFile);
- //string toPath = projectBuildDir + "/" + mingwFile;
- String toPath = scope String();
- Path.GetDirectoryPath(targetPath, toPath);
- toPath.Append("/", mingwFile);
- if (!File.Exists(toPath))
- {
- if (File.Copy(fromPath, toPath) case .Err)
- {
- OutputLineSmart("ERROR: Failed to copy mingw file {0}", fromPath);
- return false;
- }
- }
- }
-#endif
- }
-
- List depProjectList = scope List();
- GetDependentProjectList(project, depProjectList);
- if (depProjectList.Count > 0)
- {
- for (var dep in project.mDependencies)
- {
- var depProject = mWorkspace.FindProject(dep.mProjectName);
- if (depProject == null)
- {
- OutputLine("Failed to locate dependent library: {0}", dep.mProjectName);
- return false;
- }
- else
- {
- /*if (depProject.mNeedsTargetRebuild)
- project.mNeedsTargetRebuild = true;*/
-
- var depOptions = GetCurProjectOptions(depProject);
-
- if (depOptions.mClangObjectFiles != null)
- {
- var argBuilder = scope ArgBuilder(linkLine, true);
-
- for (var fileName in depOptions.mClangObjectFiles)
- {
- //AppendWithOptionalQuotes(linkLine, fileName);
- argBuilder.AddFileName(fileName);
- argBuilder.AddSep();
- }
- }
-
-
- /*String depLibTargetPath = scope String();
- ResolveConfigString(depProject, depOptions, "$(TargetPath)", error, depLibTargetPath);
- IDEUtils.FixFilePath(depLibTargetPath);
-
- String depDir = scope String();
- Path.GetDirectoryName(depLibTargetPath, depDir);
- String depFileName = scope String();
- Path.GetFileNameWithoutExtension(depLibTargetPath, depFileName);
-
- AppendWithOptionalQuotes(linkLine, depLibTargetPath);
- linkLine.Append(" ");*/
- }
- }
- }
-
-#if BF_PLATFORM_WINDOWS
- String gccExePath = "c:/mingw/bin/g++.exe";
- String clangExePath = scope String(llvmDir, "bin/clang++.exe");
-#else
- String gccExePath = "/usr/bin/c++";
- String clangExePath = scope String("/usr/bin/c++");
-#endif
-
- if (project.mNeedsTargetRebuild)
- {
- if (File.Delete(targetPath) case .Err)
- {
- OutputLine("Failed to delete {0}", targetPath);
- return false;
- }
-
- if (workspaceOptions.mToolsetType == .GNU)
- {
- if (workspaceOptions.mMachineType == Workspace.MachineType.x86)
- {
- }
- else
- {
- IDEUtils.AppendWithOptionalQuotes(linkLine, scope String("-L", llvmDir, "/x86_64-w64-mingw32/lib"));
- linkLine.Append(" ");
- IDEUtils.AppendWithOptionalQuotes(linkLine, scope String("-L", llvmDir, "/lib/gcc/x86_64-w64-mingw32/5.2.0"));
- linkLine.Append(" ");
- }
- }
- else // Microsoft
- {
- if (workspaceOptions.mMachineType == Workspace.MachineType.x86)
- {
- //linkLine.Append("-L\"C:\\Program Files (x86)\\Windows Kits\\10\\Lib\\10.0.10586.0\\ucrt\\x86\" ");
- for (var libPath in mSettings.mVSSettings.mLib32Paths)
- {
- linkLine.AppendF("-L\"{0}\" ", libPath);
- }
- }
- else
- {
- /*linkLine.Append("-L\"C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\lib\\amd64\" ");
- linkLine.Append("-L\"C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\atlmfc\\lib\\amd64\" ");
- linkLine.Append("-L\"C:\\Program Files (x86)\\Windows Kits\\10\\lib\\10.0.14393.0\\ucrt\\x64\" ");
- linkLine.Append("-L\"C:\\Program Files (x86)\\Windows Kits\\10\\lib\\10.0.14393.0\\um\\x64\" ");*/
- for (var libPath in mSettings.mVSSettings.mLib64Paths)
- {
- linkLine.AppendF("-L\"{0}\" ", libPath);
- }
- }
- }
-
- if (options.mBuildOptions.mOtherLinkFlags.Length != 0)
- {
- var linkFlags = scope String();
- ResolveConfigString(workspaceOptions, project, options, options.mBuildOptions.mOtherLinkFlags, "link flags", linkFlags);
- linkLine.Append(linkFlags, " ");
- }
-
- String compilerExePath = (workspaceOptions.mToolsetType == .GNU) ? gccExePath : clangExePath;
- String workingDir = scope String();
- if (!llvmDir.IsEmpty)
- {
- workingDir.Append(llvmDir, "bin");
- }
- else
- {
- workingDir.Append(mInstallDir);
- }
-
- var runCmd = QueueRun(compilerExePath, linkLine, workingDir, .UTF8);
- runCmd.mOnlyIfNotFailed = true;
- var tagetCompletedCmd = new TargetCompletedCmd(project);
- tagetCompletedCmd.mOnlyIfNotFailed = true;
- mExecutionQueue.Add(tagetCompletedCmd);
-
- String logStr = scope String();
- logStr.AppendF("IDE Process {0}\r\n", Platform.BfpProcess_GetCurrentId());
- logStr.Append(linkLine);
- String targetLogPath = scope String(targetPath, ".build.txt");
- Utils.WriteTextFile(targetLogPath, logStr);
-
- project.mLastDidBuild = true;
- }
- }
-
- return true;
- }
-
- void GetPdbPath(String targetPath, Workspace.Options workspaceOptions, Project.Options options, String outPdbPath)
- {
- int lastDotPos = targetPath.LastIndexOf('.');
- outPdbPath.Append(targetPath, 0, lastDotPos);
- if (workspaceOptions.mToolsetType == .LLVM)
- outPdbPath.Append("_lld");
- outPdbPath.Append(".pdb");
- }
-
void GetTargetPaths(Project project, Workspace.Options workspaceOptions, Project.Options options, List outPaths)
{
String targetPath = scope String();
@@ -8670,379 +8460,14 @@ namespace IDE
if (workspaceOptions.mToolsetType != .GNU)
{
String pdbPath = scope String();
- GetPdbPath(targetPath, workspaceOptions, options, pdbPath);
+ BuildContext.GetPdbPath(targetPath, workspaceOptions, options, pdbPath);
outPaths.Add(new String(pdbPath));
}
}
#endif
}
- bool QueueProjectMSLink(Project project, String targetPath, String configName, Workspace.Options workspaceOptions, Project.Options options, String objectsArg)
- {
- String llvmDir = scope String(IDEApp.sApp.mInstallDir);
- IDEUtils.FixFilePath(llvmDir);
- llvmDir.Append("llvm/");
-
- TestManager.ProjectInfo testProjectInfo = null;
- if (mTestManager != null)
- testProjectInfo = mTestManager.GetProjectInfo(project);
-
- bool isExe = (project.mGeneralOptions.mTargetType != Project.TargetType.BeefLib) || (testProjectInfo != null);
- if (isExe)
- {
- String linkLine = scope String();
-
- linkLine.Append("-out:");
- IDEUtils.AppendWithOptionalQuotes(linkLine, targetPath);
- linkLine.Append(" ");
-
- if (testProjectInfo != null)
- linkLine.Append("-subsystem:console ");
- else if (project.mGeneralOptions.mTargetType == Project.TargetType.BeefWindowsApplication)
- linkLine.Append("-subsystem:windows ");
- else if (project.mGeneralOptions.mTargetType == Project.TargetType.C_WindowsApplication)
- linkLine.Append("-subsystem:console ");
-
- linkLine.Append(objectsArg);
-
- //var destDir = scope String();
- //Path.GetDirectoryName();
-
- //TODO: Allow selecting lib file. Check date when copying instead of just ALWAYS copying...
- LibBlock:
- {
- List stdLibFileNames = scope .(2);
- String fromDir;
-
- fromDir = scope String(mInstallDir);
-
- bool AddLib(String dllName)
- {
- stdLibFileNames.Add(dllName);
-
- String fromPath = scope String(fromDir, dllName);
- String toPath = scope String();
- Path.GetDirectoryPath(targetPath, toPath);
- toPath.Append("/", dllName);
- if (File.CopyIfNewer(fromPath, toPath) case .Err)
- {
- OutputLine("Failed to copy lib file {0}", fromPath);
- return false;
- }
- return true;
- }
-
- String rtName = scope String();
- String dbgName = scope String();
- GetRtLibNames(workspaceOptions, options, true, rtName, dbgName);
- if (!rtName.IsEmpty)
- if (!AddLib(rtName))
- return false;
- if (!dbgName.IsEmpty)
- if (!AddLib(dbgName))
- return false;
- switch (workspaceOptions.mAllocType)
- {
- case .JEMalloc:
- if (!AddLib("jemalloc.dll"))
- return false;
- default:
- }
- }
-
- List depProjectList = scope List();
- GetDependentProjectList(project, depProjectList);
- if (depProjectList.Count > 0)
- {
- for (var dep in project.mDependencies)
- {
- var depProject = mWorkspace.FindProject(dep.mProjectName);
- if (depProject == null)
- {
- OutputLine("Failed to locate dependent library: {0}", dep.mProjectName);
- return false;
- }
- else
- {
- /*if (depProject.mNeedsTargetRebuild)
- project.mNeedsTargetRebuild = true;*/
-
- var depOptions = GetCurProjectOptions(depProject);
- if (depOptions != null)
- {
- if (depOptions.mClangObjectFiles != null)
- {
- var argBuilder = scope ArgBuilder(linkLine, true);
-
- for (var fileName in depOptions.mClangObjectFiles)
- {
- //AppendWithOptionalQuotes(linkLine, fileName);
- argBuilder.AddFileName(fileName);
- argBuilder.AddSep();
- }
- }
- }
-
-
- /*String depLibTargetPath = scope String();
- ResolveConfigString(depProject, depOptions, "$(TargetPath)", error, depLibTargetPath);
- IDEUtils.FixFilePath(depLibTargetPath);
-
- String depDir = scope String();
- Path.GetDirectoryName(depLibTargetPath, depDir);
- String depFileName = scope String();
- Path.GetFileNameWithoutExtension(depLibTargetPath, depFileName);
-
- AppendWithOptionalQuotes(linkLine, depLibTargetPath);
- linkLine.Append(" ");*/
- }
- }
- }
-
- if (project.mNeedsTargetRebuild)
- {
- /*if (File.Delete(targetPath).Failed(true))
- {
- OutputLine("Failed to delete {0}", targetPath);
- return false;
- }*/
-
- switch (options.mBuildOptions.mCLibType)
- {
- case .None:
- linkLine.Append("-nodefaultlib ");
- case .Dynamic:
- //linkLine.Append((workspaceOptions.mMachineType == .x86) ? "-defaultlib:msvcprt " : "-defaultlib:msvcrt ");
- linkLine.Append("-defaultlib:msvcrt ");
- case .Static:
- //linkLine.Append((workspaceOptions.mMachineType == .x86) ? "-defaultlib:libcpmt " : "-defaultlib:libcmt ");
- linkLine.Append("-defaultlib:libcmt ");
- case .DynamicDebug:
- //linkLine.Append((workspaceOptions.mMachineType == .x86) ? "-defaultlib:msvcprtd " : "-defaultlib:msvcrtd ");
- linkLine.Append("-defaultlib:msvcrtd ");
- case .StaticDebug:
- //linkLine.Append((workspaceOptions.mMachineType == .x86) ? "-defaultlib:libcpmtd " : "-defaultlib:libcmtd ");
- linkLine.Append("-defaultlib:libcmtd ");
- case .SystemMSVCRT:
- linkLine.Append("-nodefaultlib ");
-
- String minRTModName = scope String();
- if ((project.mGeneralOptions.mTargetType == .BeefWindowsApplication) ||
- (project.mGeneralOptions.mTargetType == .C_WindowsApplication))
- minRTModName.Append("g");
- if (options.mBuildOptions.mBeefLibType == .DynamicDebug)
- minRTModName.Append("d");
- if (!minRTModName.IsEmpty)
- minRTModName.Insert(0, "_");
-
- if (workspaceOptions.mMachineType == .x86)
- linkLine.Append(mInstallDir, @"lib\x86\msvcrt.lib Beef", sRTVersionStr,"MinRT32", minRTModName, ".lib ");
- else
- linkLine.Append(mInstallDir, @"lib\x64\msvcrt.lib Beef", sRTVersionStr,"MinRT64", minRTModName, ".lib ");
- linkLine.Append("ntdll.lib user32.lib kernel32.lib gdi32.lib winmm.lib shell32.lib ole32.lib rpcrt4.lib chkstk.obj -ignore:4049 -ignore:4217 ");
- }
- linkLine.Append("-nologo ");
- //linkLine.Append("-fixed ");
-
- // Incremental just seems to be slower for Beef. Test on larger projects to verify
- linkLine.Append("-incremental:no ");
-
- if (options.mBuildOptions.mStackSize > 0)
- linkLine.AppendF("-stack:{} ", options.mBuildOptions.mStackSize);
-
- linkLine.Append("-pdb:");
- let pdbName = scope String();
- GetPdbPath(targetPath, workspaceOptions, options, pdbName);
- IDEUtils.AppendWithOptionalQuotes(linkLine, pdbName);
- linkLine.Append(" ");
-
- //TODO: Only add -debug if we have some debug info?
- //if (isDebug)
- if (workspaceOptions.mEmitDebugInfo != .No)
- linkLine.Append("-debug ");
-
- if (workspaceOptions.mBfOptimizationLevel.IsOptimized())
- //linkLine.Append("-opt:ref -verbose ");
- linkLine.Append("-opt:ref ");
- else
- linkLine.Append("-opt:noref ");
-
- if (workspaceOptions.mMachineType == .x86)
- {
- //linkLine.Append("-libpath:\"C:\\Program Files (x86)\\Windows Kits\\10\\Lib\\10.0.10586.0\\ucrt\\x86\" ");
- for (var libPath in mSettings.mVSSettings.mLib32Paths)
- {
- linkLine.AppendF("-libpath:\"{0}\" ", libPath);
- }
- linkLine.Append("-libpath:\"", mInstallDir, "lib\\x86\" ");
- }
- else
- {
- /*linkLine.Append("-libpath:\"C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\lib\\amd64\" ");
- linkLine.Append("-libpath:\"C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\atlmfc\\lib\\amd64\" ");
- linkLine.Append("-libpath:\"C:\\Program Files (x86)\\Windows Kits\\10\\lib\\10.0.14393.0\\ucrt\\x64\" ");
- linkLine.Append("-libpath:\"C:\\Program Files (x86)\\Windows Kits\\10\\lib\\10.0.14393.0\\um\\x64\" ");*/
- for (var libPath in mSettings.mVSSettings.mLib64Paths)
- {
- linkLine.AppendF("-libpath:\"{0}\" ", libPath);
- }
- linkLine.Append("-libpath:\"", mInstallDir, "lib\\x64\" ");
- }
-
- String targetDir = scope String();
- Path.GetDirectoryPath(targetPath, targetDir);
- linkLine.Append("-libpath:");
- IDEUtils.AppendWithOptionalQuotes(linkLine, targetDir);
- linkLine.Append(" ");
-
- if (options.mBuildOptions.mOtherLinkFlags.Length != 0)
- {
- var linkFlags = scope String();
- ResolveConfigString(workspaceOptions, project, options, options.mBuildOptions.mOtherLinkFlags, "link flags", linkFlags);
- linkLine.Append(linkFlags, " ");
- }
-
- let winOptions = project.mWindowsOptions;
- /*if (!String.IsNullOrWhiteSpace(project.mWindowsOptions.mManifestFile))
- {
- String manifestPath = scope String();
- String error = scope String();
- ResolveConfigString(project, options, winOptions.mManifestFile, error, manifestPath);
- if (!manifestPath.IsWhiteSpace)
- {
- linkLine.Append("/MANIFEST:EMBED /MANIFESTINPUT:");
- IDEUtils.AppendWithOptionalQuotes(linkLine, manifestPath);
- linkLine.Append(" ");
- }
- }*/
-
- // Put back
- if ((!String.IsNullOrWhiteSpace(project.mWindowsOptions.mIconFile)) ||
- (!String.IsNullOrWhiteSpace(project.mWindowsOptions.mManifestFile)) ||
- (winOptions.HasVersionInfo()))
- {
- String projectBuildDir = scope String();
- GetProjectBuildDir(project, projectBuildDir);
-
- String resOutPath = scope String();
- resOutPath.Append(projectBuildDir, "\\Resource.res");
-
- String iconPath = scope String();
- ResolveConfigString(workspaceOptions, project, options, winOptions.mIconFile, "icon file", iconPath);
-
- // Generate resource
- Result CreateResourceFile()
- {
- ResourceGen resGen = scope ResourceGen();
- if (resGen.Start(resOutPath) case .Err)
- {
- OutputErrorLine("Failed to create resource file '{0}'", resOutPath);
- return .Err;
- }
- if (!iconPath.IsWhiteSpace)
- {
- Path.GetAbsolutePath(scope String(iconPath), project.mProjectDir, iconPath..Clear());
- if (resGen.AddIcon(iconPath) case .Err)
- {
- OutputErrorLine("Failed to add icon");
- return .Err;
- }
- }
-
- let targetFileName = scope String();
- Path.GetFileName(targetPath, targetFileName);
-
- if (resGen.AddVersion(winOptions.mDescription, winOptions.mComments, winOptions.mCompany, winOptions.mProduct,
- winOptions.mCopyright, winOptions.mFileVersion, winOptions.mProductVersion, targetFileName) case .Err)
- {
- OutputErrorLine("Failed to add version");
- return .Err;
- }
-
- String manifestPath = scope String();
- ResolveConfigString(workspaceOptions, project, options, winOptions.mManifestFile, "manifest file", manifestPath);
- if (!manifestPath.IsWhiteSpace)
- {
- Path.GetAbsolutePath(scope String(manifestPath), project.mProjectDir, manifestPath..Clear());
- if (resGen.AddManifest(manifestPath) case .Err)
- {
- OutputErrorLine("Failed to add manifest file");
- return .Err;
- }
- }
-
- Try!(resGen.Finish());
- return .Ok;
- }
-
- if (CreateResourceFile() case .Err)
- {
- OutputErrorLine("Failed to generate resource file: {0}", resOutPath);
- return false;
- }
-
- IDEUtils.AppendWithOptionalQuotes(linkLine, resOutPath);
- }
-
-
- //String linkerPath = "C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\bin\\amd64\\link.exe";
-
- let binPath = (workspaceOptions.mMachineType == .x86) ? mSettings.mVSSettings.mBin32Path : mSettings.mVSSettings.mBin64Path;
- if (binPath.IsWhiteSpace)
- {
- OutputErrorLine("Visual Studio tool path not configured. Check Visual Studio configuration in File\\Preferences\\Settings.");
- return false;
- }
-
- String linkerPath = scope String();
- linkerPath.Append(binPath);
- linkerPath.Append("/link.exe");
- if (workspaceOptions.mToolsetType == .LLVM)
- {
- linkerPath.Clear();
- linkerPath.Append(mInstallDir);
- linkerPath.Append(@"llvm\bin\lld-link.exe");
- //linkerPath = @"C:\Program Files\LLVM\bin\lld-link.exe";
-
- var ltoType = workspaceOptions.mLTOType;
- if (options.mBeefOptions.mLTOType != null)
- ltoType = options.mBeefOptions.mLTOType.Value;
-
- if (ltoType == .Thin)
- {
- linkLine.Append(" /lldltocache:");
-
- String ltoPath = scope String();
- Path.GetDirectoryPath(targetPath, ltoPath);
- ltoPath.Append("/ltocache");
- IDEUtils.AppendWithOptionalQuotes(linkLine, ltoPath);
- }
- }
- //String linkerPath = "C:\\Beef\\IDE\\dist\\BeefLink.exe";
-
- //QueueRun(compilerExePath, linkLine, @"c:\mingw\bin", (options.mGeneralOptions.mLinkerType == Project.LinkerType.Clang) && (linkLine.Length > 1024));
- //QueueRun(compilerExePath, linkLine, @"c:\mingw\bin", (linkLine.Length > 1024));
-
- var runCmd = QueueRun(linkerPath, linkLine, mInstallDir, .UTF16WithBom);
- runCmd.mOnlyIfNotFailed = true;
- var tagetCompletedCmd = new TargetCompletedCmd(project);
- tagetCompletedCmd.mOnlyIfNotFailed = true;
- mExecutionQueue.Add(tagetCompletedCmd);
-
- String logStr = scope String();
- logStr.AppendF("IDE Process {0}\r\n", Platform.BfpProcess_GetCurrentId());
- logStr.Append(linkLine);
- String targetLogPath = scope String(targetPath, ".build.txt");
- Utils.WriteTextFile(targetLogPath, logStr);
-
- project.mLastDidBuild = true;
- }
- }
-
- return true;
- }
-
- class ArgBuilder
+ public class ArgBuilder
{
String mTarget;
bool mDoLongBreak;
@@ -9100,367 +8525,12 @@ namespace IDE
}
}
- bool QueueProjectCustomBuildCommands(Project project, String targetPath, Project.BuildCommandTrigger trigger, List cmdList)
- {
- if (cmdList.IsEmpty)
- return true;
-
- if (trigger == .Never)
- return true;
-
- if (trigger == .IfFilesChanged)
- {
- int64 highestDateTime = 0;
-
- int64 targetDateTime = File.GetLastWriteTime(targetPath).Get().ToFileTime();
-
- bool forceRebuild = false;
-
- for (var depName in project.mDependencies)
- {
- var depProject = mWorkspace.FindProject(depName.mProjectName);
- if (depProject != null)
- {
- if (depProject.mLastDidBuild)
- forceRebuild = true;
- }
- }
-
- project.WithProjectItems(scope [&] (projectItem) =>
- {
- var projectSource = projectItem as ProjectSource;
- var importPath = scope String();
- projectSource.GetFullImportPath(importPath);
- Result fileDateTime = File.GetLastWriteTime(importPath);
- if (fileDateTime case .Ok)
- {
- let date = fileDateTime.Get().ToFileTime();
- /*if (date > targetDateTime)
- Console.WriteLine("Custom build higher time: {0}", importPath);*/
- highestDateTime = Math.Max(highestDateTime, date);
- }
- });
-
- if ((highestDateTime <= targetDateTime) && (!forceRebuild))
- return true;
-
- project.mLastDidBuild = true;
- }
-
- Workspace.Options workspaceOptions = GetCurWorkspaceOptions();
- Project.Options options = GetCurProjectOptions(project);
-
- //Console.WriteLine("Executing custom command {0} {1} {2}", highestDateTime, targetDateTime, forceRebuild);
- for (let origCustomCmd in cmdList)
- {
- var exePath = scope String();
- String customCmd = scope String();
- ResolveConfigString(workspaceOptions, project, options, origCustomCmd, "custom command", customCmd);
- int spacePos;
- if (customCmd.StartsWith("\""))
- {
- spacePos = customCmd.IndexOf('"', 1) + 1;
- if (spacePos != -1)
- exePath.Append(customCmd, 1, spacePos - 2);
- }
- else
- {
- spacePos = customCmd.IndexOf(' ');
- if (spacePos != -1)
- exePath.Append(customCmd, 0, spacePos);
- }
-
- if ((spacePos == -1) && (!customCmd.IsEmpty))
- {
- OutputErrorLine("Invalid custom command '{0}' in project '{1}'", customCmd, project.mProjectName);
- return false;
- }
-
- if (spacePos > 0)
- {
- project.mNeedsTargetRebuild = true;
- var exeArgs = scope String();
- exeArgs.Append(customCmd, spacePos + 1);
- QueueRun(exePath, exeArgs, IDEApp.sApp.mInstallDir);
- mExecutionQueue.Add(new TargetCompletedCmd(project));
- }
- }
-
- return true;
- }
-
- bool QueueProjectCompile(Project project, Project hotProject, BuildCompletedCmd completedCompileCmd, List hotFileNames, bool runAfter)
- {
- project.mLastDidBuild = false;
-
- TestManager.ProjectInfo testProjectInfo = null;
- if (mTestManager != null)
- testProjectInfo = mTestManager.GetProjectInfo(project);
-
- var configSelection = GetCurConfigSelection(project);
- Project.Options options = GetCurProjectOptions(project);
- if (options == null)
- return true;
-
- Workspace.Options workspaceOptions = GetCurWorkspaceOptions();
- BfCompiler bfCompiler = mBfBuildCompiler;
- var bfProject = mBfBuildSystem.mProjectMap[project];
- bool bfHadOutputChanges;
- List bfFileNames = scope List();
- bfCompiler.GetOutputFileNames(bfProject, true, out bfHadOutputChanges, bfFileNames);
- defer ClearAndDeleteItems(bfFileNames);//DeleteAndClearItems!(bfFileNames);
- if (bfHadOutputChanges)
- project.mNeedsTargetRebuild = true;
-
- List allFileNames = scope List();
- List clangAllObjNames = scope List();
- //List clangObjNames = scope List();
-
- GetClangFiles(project.mRootFolder, allFileNames);
-
- String workspaceBuildDir = scope String();
- GetWorkspaceBuildDir(workspaceBuildDir);
- String projectBuildDir = scope String();
- GetProjectBuildDir(project, projectBuildDir);
- if (!projectBuildDir.IsEmpty)
- Directory.CreateDirectory(projectBuildDir).IgnoreError();
-
- //List buildFileNames = new List();
-
- String targetPath = scope String();
-
- String outputDir = scope String();
- String absOutputDir = scope String();
-
- if (testProjectInfo != null)
- {
- absOutputDir.Append(projectBuildDir);
- outputDir = absOutputDir;
- targetPath.Append(outputDir, "/", project.mProjectName);
-#if BF_PLATFORM_WINDOWS
- targetPath.Append(".exe");
-#endif
-
- Debug.Assert(testProjectInfo.mTestExePath == null);
- testProjectInfo.mTestExePath = new String(targetPath);
- }
- else
- {
- ResolveConfigString(workspaceOptions, project, options, options.mBuildOptions.mTargetDirectory, "target directory", outputDir);
- Path.GetAbsolutePath(project.mProjectDir, outputDir, absOutputDir);
- outputDir = absOutputDir;
- ResolveConfigString(workspaceOptions, project, options, "$(TargetPath)", "target path", targetPath);
- }
- IDEUtils.FixFilePath(targetPath);
- if (!File.Exists(targetPath))
- {
- project.mNeedsTargetRebuild = true;
-
- String targetDir = scope String();
- Path.GetDirectoryPath(targetPath, targetDir);
- if (!targetDir.IsEmpty)
- Directory.CreateDirectory(targetDir).IgnoreError();
- }
-
- if (!QueueProjectCustomBuildCommands(project, targetPath, runAfter ? options.mBuildOptions.mBuildCommandsOnRun : options.mBuildOptions.mBuildCommandsOnCompile, options.mBuildOptions.mPostBuildCmds))
- completedCompileCmd.mFailed = true;
-
- if (project.mGeneralOptions.mTargetType == Project.TargetType.CustomBuild)
- {
- /*if (options.mBuildOptions.mPostBuildCmds.IsEmpty)
- return true;
-
- int64 highestDateTime = 0;
-
- int64 targetDateTime = File.GetLastWriteTime(targetPath).Get().ToFileTime();
-
- bool forceRebuild = false;
-
- for (var depName in project.mDependencies)
- {
- var depProject = mWorkspace.FindProject(depName.mProjectName);
- if (depProject != null)
- {
- if (depProject.mLastDidBuild)
- forceRebuild = true;
- }
- }
-
- project.WithProjectItems(scope [&] (projectItem) =>
- {
- var projectSource = projectItem as ProjectSource;
- var importPath = scope String();
- projectSource.GetFullImportPath(importPath);
- Result fileDateTime = File.GetLastWriteTime(importPath);
- if (fileDateTime case .Ok)
- {
- let date = fileDateTime.Get().ToFileTime();
- /*if (date > targetDateTime)
- Console.WriteLine("Custom build higher time: {0}", importPath);*/
- highestDateTime = Math.Max(highestDateTime, date);
- }
- });
-
- if ((highestDateTime > targetDateTime) || (forceRebuild))
- {
- QueueProjectCustomBuildCommands(project, options.mBuildOptions.mPostBuildCmds);
- project.mLastDidBuild = true;
- }*/
-
- return true;
- }
-
-#if IDE_C_SUPPORT
- bool buildAll = false;
- String buildStringFilePath = scope String();
- mDepClang.GetBuildStringFileName(projectBuildDir, project, buildStringFilePath);
- String newBuildString = scope String();
- GetClangBuildString(project, options, workspaceOptions, true, newBuildString);
- String clangBuildString = scope String();
- GetClangBuildString(project, options, workspaceOptions, false, clangBuildString);
- newBuildString.Append("|", clangBuildString);
-
- if (mDepClang.mDoDependencyCheck)
- {
- String prependStr = scope String();
- options.mCOptions.mCompilerType.ToString(prependStr);
- prependStr.Append("|");
- newBuildString.Insert(0, prependStr);
- String oldBuildString;
- mDepClang.mProjectBuildString.TryGetValue(project, out oldBuildString);
-
- if (oldBuildString == null)
- {
- oldBuildString = new String();
- File.ReadAllText(buildStringFilePath, oldBuildString).IgnoreError();
- mDepClang.mProjectBuildString[project] = oldBuildString;
- }
-
- if (newBuildString != oldBuildString)
- {
- buildAll = true;
-
- if (case .Err = File.WriteAllText(buildStringFilePath, newBuildString))
- OutputLine("Failed to write {0}", buildStringFilePath);
-
- delete oldBuildString;
- mDepClang.mProjectBuildString[project] = new String(newBuildString);
- }
- }
-
- using (mDepClang.mMonitor.Enter())
- {
- if (options.mClangObjectFiles == null)
- options.mClangObjectFiles = new List();
- else
- ClearAndDeleteItems(options.mClangObjectFiles);
-
- for (var projectSource in allFileNames)
- {
- var fileEntry = mDepClang.GetProjectEntry(projectSource);
- Debug.Assert((fileEntry != null) || (!mDepClang.mCompileWaitsForQueueEmpty));
-
- String filePath = scope String();
- projectSource.GetFullImportPath(filePath);
- String baseName = scope String();
- Path.GetFileNameWithoutExtension(filePath, baseName);
- String objName = stack String();
- objName.Append(projectBuildDir, "/", baseName, (options.mCOptions.mGenerateLLVMAsm ? ".ll" : ".obj"));
-
- if (filePath.Contains("test2.cpp"))
- {
- NOP!();
- }
-
- bool needsRebuild = true;
- if ((!buildAll) && (fileEntry != null))
- {
- mDepClang.SetEntryObjFileName(fileEntry, objName);
- mDepClang.SetEntryBuildStringFileName(fileEntry, buildStringFilePath);
- needsRebuild = mDepClang.DoesEntryNeedRebuild(fileEntry);
- }
- if (needsRebuild)
- {
- if (hotProject != null)
- {
- OutputLine("Hot swap detected disallowed C/C++ change: {0}", filePath);
- return false;
- }
-
- project.mNeedsTargetRebuild = true;
- var runCmd = CompileSource(project, workspaceOptions, options, filePath);
- runCmd.mParallelGroup = 1;
- }
-
- options.mClangObjectFiles.Add(new String(objName));
-
- if (hotProject != null)
- continue;
-
- clangAllObjNames.Add(objName);
-
- IdSpan sourceCharIdData;
- String sourceCode = scope String();
- FindProjectSourceContent(projectSource, out sourceCharIdData, true, sourceCode);
- mWorkspace.ProjectSourceCompiled(projectSource, sourceCode, sourceCharIdData);
- sourceCharIdData.Dispose();
-
- String* fileEntryPtr;
- if (completedCompileCmd.mClangCompiledFiles.Add(filePath, out fileEntryPtr))
- *fileEntryPtr = new String(filePath);
- }
- }
-#endif
-
- String llvmDir = scope String(IDEApp.sApp.mInstallDir);
- IDEUtils.FixFilePath(llvmDir);
- llvmDir.Append("llvm/");
-
- if (hotProject != null)
- {
- if ((hotProject == project) || (hotProject.HasDependency(project.mProjectName)))
- {
- for (var fileName in bfFileNames)
- hotFileNames.Add(new String(fileName));
- }
-
- return true;
- }
-
- String objectsArg = scope String();
- var argBuilder = scope ArgBuilder(objectsArg, workspaceOptions.mToolsetType != .GNU);
- for (var bfFileName in bfFileNames)
- {
- argBuilder.AddFileName(bfFileName);
- argBuilder.AddSep();
- }
-
- for (var objName in clangAllObjNames)
- {
- IDEUtils.AppendWithOptionalQuotes(objectsArg, objName);
- objectsArg.Append(" ");
- }
-
- if (workspaceOptions.mToolsetType == .GNU)
- {
- if (!QueueProjectGNULink(project, targetPath, workspaceOptions, options, objectsArg))
- return false;
- }
- else // MS
- {
- if (!QueueProjectMSLink(project, targetPath, configSelection.mConfig, workspaceOptions, options, objectsArg))
- return false;
- }
-
- return true;
- }
-
Project FindProject(String projectName)
{
return mWorkspace.FindProject(projectName);
}
- bool GetDependentProjectList(Project project, List orderedProjectList, List projectStack = null)
+ public bool GetDependentProjectList(Project project, List orderedProjectList, List projectStack = null)
{
var useProjectStack = projectStack;
if ((useProjectStack != null) && (useProjectStack.Contains(project)))
@@ -9768,9 +8838,14 @@ namespace IDE
bool success = true;
List hotFileNames = scope List();
defer ClearAndDeleteItems(hotFileNames);
+ Debug.Assert(mBuildContext == null);
+ DeleteAndNullify!(mBuildContext);
+ mBuildContext = new .();
+ mBuildContext.mWorkspaceOptions = GetCurWorkspaceOptions();
+
for (var project in orderedProjectList)
{
- if (!QueueProjectCompile(project, hotProject, completedCompileCmd, hotFileNames, runAfter))
+ if (!mBuildContext.QueueProjectCompile(project, hotProject, completedCompileCmd, hotFileNames, runAfter))
success = false;
}
@@ -10240,7 +9315,12 @@ namespace IDE
(project.mGeneralOptions.mTargetType == Project.TargetType.BeefWindowsApplication))
mMainBreakpoint = mDebugger.CreateSymbolBreakpoint("-BeefMain");
else
+ {
mMainBreakpoint = mDebugger.CreateSymbolBreakpoint("-main");
+#if BF_PLATFORM_WINDOWS
+ //mMainBreakpoint2 = mDebugger.CreateSymbolBreakpoint("-WinMain");
+#endif
+ }
}
return true;
@@ -11162,6 +10242,10 @@ namespace IDE
for (var project in mWorkspace.mProjects)
{
+ // Force running the "if files changed" commands
+ project.mForceCustomCommands = true;
+ project.mNeedsTargetRebuild = true;
+
// Don't delete custom build artifacts
if (project.mGeneralOptions.mTargetType == .CustomBuild)
continue;
@@ -11170,6 +10254,8 @@ namespace IDE
defer ClearAndDeleteItems(projectFiles);
let options = GetCurProjectOptions(project);
+ if (options == null)
+ continue;
GetTargetPaths(project, workspaceOptions, options, projectFiles);
for (let filePath in projectFiles)
@@ -11529,8 +10615,16 @@ namespace IDE
{
BfLog.LogDbg("Deleting mMainBreakpoint 1\n");
// Couldn't bind to main breakpoint, bind to entry point address
- mDebugger.DeleteBreakpoint(mMainBreakpoint);
- mMainBreakpoint = mDebugger.CreateSymbolBreakpoint("."); // Magic symbol for "entry point"
+ // "." is the magic symbol for "entry point"
+ String[] tryNames = scope .("WinMain", ".");
+
+ for (let name in tryNames)
+ {
+ mDebugger.DeleteBreakpoint(mMainBreakpoint);
+ mMainBreakpoint = mDebugger.CreateSymbolBreakpoint("WinMain");
+ if ((name == ".") || (mMainBreakpoint.IsBound()))
+ break;
+ }
}
wantsContinue = true;
@@ -11661,6 +10755,22 @@ namespace IDE
mWantsRehupCallstack = false;
}
}
+
+ if (mBuildContext != null)
+ {
+ bool isCompiling = (!mExecutionInstances.IsEmpty) || (!mExecutionQueue.IsEmpty);
+ if (mBuildContext.mScriptManager != null)
+ {
+ mBuildContext.mScriptManager.Update();
+ if ((mBuildContext.mScriptManager.HasQueuedCommands) && (!mBuildContext.mScriptManager.mFailed))
+ isCompiling = true;
+ }
+
+ if (!isCompiling)
+ {
+ DeleteAndNullify!(mBuildContext);
+ }
+ }
}
public void ShowPassOutput(BfPassInstance bfPassInstance)
diff --git a/IDE/src/IDEUtils.bf b/IDE/src/IDEUtils.bf
index d2dc9cb1..8df248b7 100644
--- a/IDE/src/IDEUtils.bf
+++ b/IDE/src/IDEUtils.bf
@@ -5,7 +5,6 @@ using System.Threading.Tasks;
using System.IO;
using Beefy.widgets;
using Beefy.utils;
-using System.Runtime.InteropServices;
using Beefy;
using Beefy.gfx;
using Beefy.theme.dark;
diff --git a/IDE/src/Project.bf b/IDE/src/Project.bf
index 6f23adfa..c9adff3b 100644
--- a/IDE/src/Project.bf
+++ b/IDE/src/Project.bf
@@ -13,7 +13,6 @@ using IDE.ui;
using IDE.Util;
using System.Threading;
using System.Diagnostics;
-using System.Runtime.InteropServices;
namespace IDE
{
@@ -300,6 +299,9 @@ namespace IDE
if (mIncludeKind != .Manual)
return .None;
+ if (mParentFolder.mPath == null)
+ return .SimpleSource;
+
var expectPath = scope String();
expectPath.Append(mParentFolder.mPath);
expectPath.Append(Path.DirectorySeparatorChar);
@@ -829,12 +831,13 @@ namespace IDE
public enum TargetType
{
case BeefConsoleApplication,
- BeefWindowsApplication,
- BeefLib,
- CustomBuild,
- C_ConsoleApplication,
- C_WindowsApplication,
- BeefTest;
+ BeefWindowsApplication,
+ BeefLib,
+ BeefDynLib,
+ CustomBuild,
+ C_ConsoleApplication,
+ C_WindowsApplication,
+ BeefTest;
public bool IsBeef
{
@@ -843,9 +846,10 @@ namespace IDE
switch (this)
{
case BeefConsoleApplication,
- BeefWindowsApplication,
- BeefLib,
- BeefTest: return true;
+ BeefWindowsApplication,
+ BeefLib,
+ BeefDynLib,
+ BeefTest: return true;
default: return false;
}
}
@@ -1162,6 +1166,7 @@ namespace IDE
//public String mLastImportDir = new String() ~ delete _;
public bool mHasChanged;
public bool mNeedsTargetRebuild;
+ public bool mForceCustomCommands;
public bool mEnabled = true;
public bool mLocked;
public bool mLockedDefault;
diff --git a/IDE/src/ScriptManager.bf b/IDE/src/ScriptManager.bf
index c50bf1e8..ff9f8f9d 100644
--- a/IDE/src/ScriptManager.bf
+++ b/IDE/src/ScriptManager.bf
@@ -15,6 +15,8 @@ namespace IDE
{
class ScriptManager
{
+ public static ScriptManager sActiveManager;
+
class Target
{
public class Cmd
@@ -27,20 +29,29 @@ namespace IDE
public Dictionary mCmds = new .() ~ DeleteDictionyAndKeysAndItems!(_);
}
+ public enum CmdFlags
+ {
+ None,
+ NoLines
+ }
+
public class QueuedCmd
{
public String mCondition ~ delete _;
+ public CmdFlags mFlags;
public bool mHandled = true;
public String mCmd ~ delete _;
public String mSrcFile ~ delete _;
public int mLineNum = -1;
public int mIntParam;
+ public int mExecIdx;
public bool mNoWait;
+ public Stopwatch mStopWatch ~ delete _;
}
- ScriptHelper mScriptHelper = new ScriptHelper() ~ delete _;
+ ScriptHelper mScriptHelper = new ScriptHelper(this) ~ delete _;
Target mRoot = new Target() ~ delete _;
Dictionary mVars = new .() ~
{
@@ -52,13 +63,18 @@ namespace IDE
delete _;
};
List mCmdList = new .() ~ DeleteContainerAndItems!(_);
- bool mFailed;
+ public bool mFailed;
+ public bool mCancelled;
public QueuedCmd mCurCmd;
public Stopwatch mTimeoutStopwatch ~ delete _;
public int mTimeoutMS;
public String mExpectingError ~ delete _;
public bool mHadExpectingError;
public int mDoneTicks;
+ public bool mAllowCompiling;
+ public bool mSoftFail;
+ public Verbosity mVerbosity = .Quiet;
+ public String mProjectName ~ delete _;
public bool Failed
{
@@ -146,9 +162,16 @@ namespace IDE
var errStr = scope String(err);
if (mCurCmd != null)
{
- errStr.AppendF(" at line {0} in {1}\n\t{2}", mCurCmd.mLineNum + 1, mCurCmd.mSrcFile, mCurCmd.mCmd);
+ if (mCurCmd.mFlags.HasFlag(.NoLines))
+ errStr.AppendF(" in {}\n\t{}", mCurCmd.mSrcFile, mCurCmd.mCmd);
+ else
+ errStr.AppendF(" at line {} in {}\n\t{}", mCurCmd.mLineNum + 1, mCurCmd.mSrcFile, mCurCmd.mCmd);
}
- gApp.Fail(errStr);
+
+ if (mSoftFail)
+ gApp.OutputErrorLine(errStr);
+ else
+ gApp.Fail(errStr);
//TODO:
//gApp.mRunningTestScript = false;
@@ -165,7 +188,7 @@ namespace IDE
mFailed = false;
}
- public void QueueCommands(StreamReader streamReader, StringView filePath)
+ public void QueueCommands(StreamReader streamReader, StringView filePath, CmdFlags flags)
{
int lineNum = 0;
@@ -179,6 +202,7 @@ namespace IDE
if ((!line.IsEmpty) && (!line.StartsWith("#")))
{
QueuedCmd queuedCmd = new .();
+ queuedCmd.mFlags = flags;
queuedCmd.mSrcFile = new String(filePath);
queuedCmd.mLineNum = lineNum;
@@ -223,6 +247,13 @@ namespace IDE
}
}
+ public void QueueCommands(StringView cmds, StringView filePath, CmdFlags flags)
+ {
+ StringStream strStream = scope .(cmds, .Reference);
+ StreamReader reader = scope .(strStream);
+ QueueCommands(reader, filePath, flags);
+ }
+
public void QueueCommandFile(StringView filePath)
{
let streamReader = scope StreamReader();
@@ -232,7 +263,7 @@ namespace IDE
return;
}
- QueueCommands(streamReader, filePath);
+ QueueCommands(streamReader, filePath, .None);
}
public void SetTimeoutMS(int timeoutMS)
@@ -245,14 +276,56 @@ namespace IDE
mTimeoutMS = timeoutMS;
}
- public void Exec(StringView cmdLineView)
+ public void Exec(StringView cmd)
{
- var cmdLineView;
- cmdLineView.Trim();
+ var cmd;
+ cmd.Trim();
- if ((cmdLineView.StartsWith("#")) || (cmdLineView.IsEmpty))
+ if ((cmd.StartsWith("#")) || (cmd.IsEmpty))
return;
+ if (cmd.StartsWith("%exec "))
+ {
+ mScriptHelper.ExecuteRaw(scope String(cmd, "%exec ".Length));
+ return;
+ }
+
+ if (cmd.StartsWith("%targetComplete "))
+ {
+ let projectName = cmd.Substring("%targetComplete ".Length);
+
+ if (gApp.mExecutionQueue.IsEmpty)
+ return;
+
+ bool matched = false;
+ if (var targetCompleteCmd = gApp.mExecutionQueue[0] as IDEApp.TargetCompletedCmd)
+ {
+ if (targetCompleteCmd.mProject.mProjectName == projectName)
+ {
+ targetCompleteCmd.mIsReady = true;
+ matched = true;
+ }
+ }
+
+ if (!matched)
+ {
+ mCurCmd.mHandled = false;
+ }
+ return;
+ }
+
+ if (mCurCmd.mExecIdx == 0)
+ {
+ if (mVerbosity >= .Normal)
+ {
+ gApp.OutputLine("Executing Command: {}", cmd);
+ if (mVerbosity >= .Detailed)
+ {
+ mCurCmd.mStopWatch = new .(true);
+ }
+ }
+ }
+
StringView varName = .();
/*int eqPos = cmdLineView.IndexOf('=');
@@ -267,20 +340,20 @@ namespace IDE
StringView methodName;
List