Ver código fonte

Mintest changes

Brian Fiete 5 anos atrás
pai
commit
79ccb33586

+ 1 - 1
BeefBuild/BeefProj.toml

@@ -20,7 +20,7 @@ TargetName = "$(ProjectName)_d"
 OtherLinkFlags = "$(LinkFlags) Comdlg32.lib kernel32.lib user32.lib advapi32.lib shell32.lib IDEHelper64_d.lib Rpcrt4.lib Ole32.lib"
 CLibType = "Dynamic"
 BeefLibType = "DynamicDebug"
-DebugCommandArguments = "-platform=x86_64-none-linux-android21 -workspace=C:/proj/Android/BeefTest/app/src/main/cpp/../beef/\""
+DebugCommandArguments = "-proddir=..\\..\\IDEHelper\\Tests -test"
 DebugWorkingDirectory = "c:\\beef\\ide\\mintest"
 EnvironmentVars = ["_NO_DEBUG_HEAP=1"]
 PreprocessorMacros = ["DEBUG", "CLI"]

+ 3 - 5
BeefTools/TestDLL/TestDLL.cpp

@@ -1,4 +1,5 @@
-#define _ENABLE_ATOMIC_ALIGNMENT_FIX
+//2
+#define _ENABLE_ATOMIC_ALIGNMENT_FIX
 
 #include <windows.h>
 #include <stdlib.h>
@@ -82,7 +83,7 @@ StructA GetSA()
 	return StructA();
 }
 
-// THIS IS VERSION 3.
+// THIS IS VERSION 6.
 extern "C"
 __declspec(dllexport) void Test2(int aa, int bb, int cc, int dd)
 {	
@@ -107,9 +108,6 @@ __declspec(dllexport) void Test2(int aa, int bb, int cc, int dd)
 	int a = 123;
 	int b = 234;
 	int c = 345;
-
-	//GetA();
-	//GetB();
 }
 
 extern "C"

+ 1 - 1
IDE/BeefProj.toml

@@ -25,7 +25,7 @@ OtherLinkFlags = ""
 TargetDirectory = "$(WorkspaceDir)/dist"
 TargetName = "BeefIDE_d"
 OtherLinkFlags = "$(LinkFlags) Comdlg32.lib kernel32.lib user32.lib advapi32.lib shell32.lib IDEHelper64_d.lib"
-DebugCommandArguments = "-proddir=C:\\Beef\\IDE"
+DebugCommandArguments = "-proddir=C:\\_Beef\\TestApp"
 DebugWorkingDirectory = "c:\\Beef\\IDE\\Tests\\EmptyTest"
 EnvironmentVars = ["_NO_DEBUG_HEAP=1"]
 

+ 29 - 1
IDE/mintest/BeefProj.toml

@@ -12,7 +12,7 @@ Description = "Mintest"
 
 [Configs.Debug.Win64]
 CLibType = "Static"
-BeefLibType = "Static"
+BeefLibType = "DynamicDebug"
 StackSize = 4194304
 DebugCommandArguments = "hey=\"yo man\" zag= zoogles boof   stoopers   \"\"\"abc efg\"\"\""
 DebugWorkingDirectory = ".\\"
@@ -26,6 +26,13 @@ OtherLinkFlags = ""
 CLibType = "Static"
 BeefLibType = "Static"
 
+[Configs.Debug.iOS]
+BuildKind = "StaticLib"
+
+[Configs.Debug.aarch64-none-linux-android21]
+BuildKind = "StaticLib"
+RelocType = "PIC"
+
 [Configs.Release.Win64]
 OtherLinkFlags = "$(LinkFlags) C:\\Beef\\BeefTools\\TestDLL\\x64\\Debug\\TestDLL.lib"
 DebugCommandArguments = "hey=\"yo man\" zag= zoogles boof   stoopers   \"abc efg\""
@@ -33,6 +40,13 @@ DebugCommandArguments = "hey=\"yo man\" zag= zoogles boof   stoopers   \"abc efg
 [Configs.Release.WinFart]
 OtherLinkFlags = ""
 
+[Configs.Release.iOS]
+BuildKind = "StaticLib"
+
+[Configs.Release.aarch64-none-linux-android21]
+BuildKind = "StaticLib"
+RelocType = "PIC"
+
 [Configs.Paranoid.Win32]
 CLibType = "Static"
 BeefLibType = "Static"
@@ -47,6 +61,13 @@ OtherLinkFlags = ""
 CLibType = "Static"
 BeefLibType = "Static"
 
+[Configs.Paranoid.iOS]
+BuildKind = "StaticLib"
+
+[Configs.Paranoid.aarch64-none-linux-android21]
+BuildKind = "StaticLib"
+RelocType = "PIC"
+
 [Configs.Test.Win32]
 CLibType = "Static"
 BeefLibType = "Static"
@@ -61,6 +82,13 @@ OtherLinkFlags = ""
 CLibType = "Static"
 BeefLibType = "Static"
 
+[Configs.Test.iOS]
+BuildKind = "StaticLib"
+
+[Configs.Test.aarch64-none-linux-android21]
+BuildKind = "StaticLib"
+RelocType = "PIC"
+
 [ProjectFolder]
 
 [[ProjectFolder.Items]]

+ 79 - 4
IDE/mintest/BeefSpace.toml

@@ -14,8 +14,10 @@ ConfigSelections = {mintest2 = {Enabled = false}}
 IntermediateType = "ObjectAndIRCode"
 COptimizationLevel = "Og"
 
+[[Configs.Debug.Win64.DistinctOptions]]
+Filter = "System.String"
+
 [Configs.Debug.WinFart]
-MachineType = "x86"
 Toolset = "GNU"
 EmitDebugInfo = "No"
 EmitDynamicCastCheck = false
@@ -25,6 +27,23 @@ EnableRealtimeLeakCheck = false
 AllowHotSwapping = false
 AllocStackTraceDepth = 0
 
+[Configs.Debug.Linux64]
+Toolset = "GNU"
+EnableRealtimeLeakCheck = false
+
+[Configs.Debug.macOS]
+Toolset = "GNU"
+EnableRealtimeLeakCheck = false
+
+[Configs.Debug.iOS]
+Toolset = "GNU"
+EnableRealtimeLeakCheck = false
+IntermediateType = "Bitcode"
+
+[Configs.Debug.aarch64-none-linux-android21]
+Toolset = "GNU"
+EnableRealtimeLeakCheck = false
+
 [Configs.Release.Win32]
 Toolset = "GNU"
 BfOptimizationLevel = "OgPlus"
@@ -39,7 +58,6 @@ IntermediateType = "ObjectAndIRCode"
 COptimizationLevel = "O3"
 
 [Configs.Release.WinFart]
-MachineType = "x86"
 Toolset = "GNU"
 BfOptimizationLevel = "O0"
 EmitDebugInfo = "No"
@@ -47,6 +65,19 @@ AllocStackTraceDepth = 0
 IncrementalBuild = true
 COptimizationLevel = "O0"
 
+[Configs.Release.Linux64]
+Toolset = "GNU"
+
+[Configs.Release.macOS]
+Toolset = "GNU"
+
+[Configs.Release.iOS]
+Toolset = "GNU"
+IntermediateType = "Bitcode"
+
+[Configs.Release.aarch64-none-linux-android21]
+Toolset = "GNU"
+
 [Configs.Test.Win32]
 Toolset = "GNU"
 BfSIMDSetting = "None"
@@ -71,7 +102,6 @@ COptimizationLevel = "O2"
 ConfigSelections = {mintest = {Config = "Debug"}}
 
 [Configs.Test.WinFart]
-MachineType = "x86"
 Toolset = "GNU"
 BuildKind = "Normal"
 EmitDebugInfo = "No"
@@ -83,6 +113,27 @@ AllowHotSwapping = false
 AllocStackTraceDepth = 0
 COptimizationLevel = "O2"
 
+[Configs.Test.Linux64]
+Toolset = "GNU"
+EnableRealtimeLeakCheck = false
+COptimizationLevel = "O2"
+
+[Configs.Test.macOS]
+Toolset = "GNU"
+EnableRealtimeLeakCheck = false
+COptimizationLevel = "O2"
+
+[Configs.Test.iOS]
+Toolset = "GNU"
+EnableRealtimeLeakCheck = false
+IntermediateType = "Bitcode"
+COptimizationLevel = "O2"
+
+[Configs.Test.aarch64-none-linux-android21]
+Toolset = "GNU"
+EnableRealtimeLeakCheck = false
+COptimizationLevel = "O2"
+
 [Configs.Paranoid.Win32]
 Toolset = "GNU"
 EmitDynamicCastCheck = false
@@ -103,7 +154,6 @@ COptimizationLevel = "O2"
 ConfigSelections = {mintest2 = {Enabled = false}}
 
 [Configs.Paranoid.WinFart]
-MachineType = "x86"
 Toolset = "GNU"
 EmitDebugInfo = "No"
 EmitDynamicCastCheck = false
@@ -114,3 +164,28 @@ EnableSideStack = false
 AllowHotSwapping = false
 AllocStackTraceDepth = 0
 COptimizationLevel = "O2"
+
+[Configs.Paranoid.Linux64]
+Toolset = "GNU"
+EnableRealtimeLeakCheck = false
+EnableSideStack = false
+COptimizationLevel = "O2"
+
+[Configs.Paranoid.macOS]
+Toolset = "GNU"
+EnableRealtimeLeakCheck = false
+EnableSideStack = false
+COptimizationLevel = "O2"
+
+[Configs.Paranoid.iOS]
+Toolset = "GNU"
+EnableRealtimeLeakCheck = false
+EnableSideStack = false
+IntermediateType = "Bitcode"
+COptimizationLevel = "O2"
+
+[Configs.Paranoid.aarch64-none-linux-android21]
+Toolset = "GNU"
+EnableRealtimeLeakCheck = false
+EnableSideStack = false
+COptimizationLevel = "O2"

+ 12 - 0
IDE/mintest/minlib/src/System/String.bf

@@ -982,6 +982,18 @@ namespace System
 			}
 			ptr
 		}
+
+		/*public mixin ToNewCStr()
+		{
+			char8* ptr = null;
+			if (mPtr != null)
+			{
+				ptr = new:mixin char8[mLength + 1]* (?);
+				Internal.MemCpy(ptr, mPtr, mLength);
+				ptr[mLength] = 0;
+			}
+			ptr
+		}*/
 	}
 
 	static

+ 24 - 2
IDE/mintest/mintest2/src/main4.bf

@@ -1,12 +1,34 @@
 using System;
 // Zapples
 
+struct StructA<T>
+{
+	public T mVal;
+
+	public static bool operator< <TOther>(StructA<T> lhs, TOther rhs) where bool : operator T < TOther
+	{
+		return true;
+	}
 
-static
+	/*public static TResult operator+<TOther, TResult>(StructA<T> lhs, TOther rhs)
+		where TResult = operator T * TOther
+	{
+		return lhs.mVal * rhs;
+	}*/
+}
+
+class TestA
 {
 	
 
-	
+	public void Bloop()
+	{
+		StructA<float> sa;
+		sa.mVal = 1.23f;
+		let res = sa < 100;
+
+		int a = 1 * 2;
+	}
 }
 
 /*class Mintest2

+ 6 - 0
IDE/mintest/src/main.bf

@@ -196,6 +196,12 @@ namespace Hey.Dude.Bro
 
 		public static int Main(String[] args)
 		{
+			TypeCode tc = .Boolean;
+
+			PrintF("Hey\n");
+
+			//Test2(1, 2, 3, 4);
+
 			/*IHashable ih = (int32)TypeCode.Boolean;
 			let hashCode = ih.GetHashCode();*/
 

+ 77 - 189
IDE/mintest/src/main3.bf

@@ -9,270 +9,158 @@ using System.Threading;
 //#define A
 //#define B
 
-class ClassA
+struct StructA
 {
-	public virtual void ClassA0()
-	{
-	}
+	public int mA;
 
-	public virtual void ClassA1()
+	public static StructA operator+(StructA lhs, float rhs)
 	{
+		StructA newVal = .();
+		newVal.mA = lhs.mA + (int)rhs;
+		return newVal;
 	}
 }
 
-class ClassB
+struct StructB
 {
-}
+	public int mA;
 
-#if B
-class ClassC : ClassB
-{
-	public override void ToString(System.String strBuffer)
-	{
-		base.ToString(strBuffer);
-	}
-}
-#elif A
-class ClassC : ClassA
-{
-	public override void ToString(System.String strBuffer)
+	public static bool operator==(StructA lhs, StructB rhs)
 	{
-		base.ToString(strBuffer);
+		return lhs.mA == rhs.mA;
 	}
 }
-#endif
 
-class ClassD
-{
-	public String mStr;
-	int mA6;
 
-	public virtual void Poo()
-	{
-		PrintF("Poo\n");
-	}
+struct StructC
+{
+	public int mA;
 
-	public virtual void Poo2()
+	public static operator StructD(StructC val)
 	{
-		PrintF("Poo2\n");
+		StructD conv;
+		conv.mA = val.mA;
+		return conv;
 	}
 }
 
-class ClassD2
+struct StructD
 {
-	int mA5;
-
-}
+	public int mA;
 
-class ClassE : ClassD
-{
-	public void Zog2()
+	public static operator StructD(StructC val)
 	{
+		StructC conv;
+		conv.mA = val.mA;
+		return conv;
 	}
 }
 
-class ClassF : ClassE
-{
-}
-
-[NoDiscard("Use this value!")]
-struct TestStruct
+struct StructE
 {
 	public int mA;
-	public int mB;
-}
-
-class Bloozer
-{
-	int mA;
-}
-
-enum Zorf : IDisposable
-{
-	case A;
-		case B;
 
-	public void Dispose()
+	public static operator StructD(StructE val)
 	{
+		StructC conv;
+		conv.mA = val.mA;
+		return conv;
 	}
 }
 
-class IFaceA
+class ClassA
 {
-	public static void Fart()
-	{
-	}
+	public int mA;
 }
 
-class Zlips : IFaceA, IDisposable
+struct StructK
 {
-	static void Fart()
-	{
-	}
 
-	public void Dispose()
-	{
-		PrintF("Disposed");
-	}
 }
 
-class Testo
+struct StructL : StructK
 {
-	public this()
-	{
-		PrintF("Testo this %p\n", this);
-	} public ~this()
-	{
-		PrintF("Testo ~this %p\n", this);
-	}
+	public int mA;
 }
 
-class Norg
+struct Checker
 {
-	public String mVal;
-	public int32 mA;
-	public int32 mB;
-
-	public int32 GetIt(int32 a, int32 b, int32 c)
-	{
-		return a + b + c + mA;
-	}
-
-	public static int32 GetIt(Blurg bl, int32 a, int32 b, int32 c)
+	public static int CheckIt(int* iPtr, int len)
 	{
-		return a + b + c + bl.mA;
+		int acc = 0;
+		for (int i < len)
+		{
+			acc += iPtr[i];
+		}
+		return acc;
 	}
 
-	public virtual int Zorf
+	public static int CheckItSpan(int* iPtr, int len)
 	{
-		set
-		{
-			mA = (.)value;
-		}
+		Span<int> span = .(iPtr, len);
 
-		get
+		int acc = 0;
+		for (int i < len)
 		{
-			return mA;
+			acc += span[i];
 		}
+		return acc;
 	}
 
-	public virtual int GetVal()
+	public static int CheckItSpanOpt(int* iPtr, int len)
 	{
-		return 99;
-	}
-}
+		OptSpan<int> span = .(iPtr, len);
 
-class Norg2 : Norg
-{
-	public int mVal2;
-
-	public int Zof => 123;
-
-	public int GetIt() => 234;
-
-	/*public override int Zorf
-	{
-		set
+		int acc = 0;
+		for (int i < len)
 		{
-			base.Zorf = 123;
+			acc += span[i];
 		}
-	}*/
-
-}
-
-enum TestEnumA
-{
-	A,
-	B,
-	C
-}
-
-[AttributeUsage(.Field, .ReflectAttribute, ReflectUser=.All)]
-struct FoofAttribute : Attribute
-{
-	int32 mA;
-	int32 mB;
-	int32 mC;
-
-	public this(int32 a, int32 b, int32 c)
-	{
-		mA = a;
-		mB = b;
-		mC = c;
+		return acc;
 	}
 }
 
 struct Blurg
 {
-	[Foof(1, 2, 3)]
-	public String mVal;
-	public int32 mA;
-	public int32 mB;
-
-	public this()
+	static int GetHash<T>(T val) where T : IHashable
 	{
-		mVal = "z";
-		mA = 111;
-		mB = 222;
+		return val.GetHashCode();
 	}
 
-	void TestIt(String a, String b)
+	public static int32 LongCall(
+		int abcdefghijklmnopqrstuvwxyz0,
+		int abcdefghijklmnopqrstuvwxyz1,
+		int abcdefghijklmnopqrstuvwxyz2,
+		int abcdefghijklmnopqrstuvwxyz3,
+		int abcdefghijklmnopqrstuvwxyz4,
+		int abcdefghijklmnopqrstuvwxyz5,
+		int abcdefghijklmnopqrstuvwxyz6,
+		int abcdefghijklmnopqrstuvwxyz7,
+		int abcdefghijklmnopqrstuvwxyz8,
+		int abcdefghijklmnopqrstuvwxyz9
+		)
 	{
-	}
-
-	TestStruct GetTS()
-	{
-		return .();
-	}
-
-	static void Test(int a, int b)
-	{
-		PrintF("a0");
-	}
-
-	[Error("This property can only be accessed directly from a typeof() expression")]
-	static void Test(int a, int b, int c)
-	{
-	}
-
-	public static Result<int> GetMe()
-	{
-		return 123;
+		return 0;
 	}
 
 	public static int32 Hey()
 	{
-		let t = typeof(Self);
-		let field = t.GetField("mVal").Value;
-		var foofAttrib = field.GetCustomAttribute<FoofAttribute>();
+		TypeCode tc = .Boolean;
+		//int h = GetHash(tc);
 
-		//for (TypeCode tc < .Boolean)
+		var val = tc.Underlying;
+		var valRef = ref tc.UnderlyingRef;
 
-		//Test(1, 2, 3);
+		let maxVal = typeof(TypeCode).MaxValue;
 
-		/*TestEnumA ta = .A;
-		IHashable ih = ta;*/
+		int a = 100;
 
-		return 123;
-	}
+		String str = new:gCRTAlloc String(a);
 
-}
+		delete:gCRTAlloc str;
 
-struct Florg
-{
-	int mA = 123;
 
-	public void Dispose() mut
-	{
+		return 123;
 	}
-}
 
-class CustomAlloc
-{
-	public void* Alloc(int size, int align)
-	{
-		//return Internal.Malloc(size);
-		return null;
-	}
 }
-

+ 3 - 0
IDEHelper/Tests/BeefSpace.toml

@@ -6,6 +6,7 @@ StartupProject = "Tests"
 
 [Configs.Debug.Win64]
 BfOptimizationLevel = "O0"
+IntermediateType = "ObjectAndIRCode"
 
 [Configs.Test.Win64]
 IntermediateType = "ObjectAndIRCode"
@@ -14,9 +15,11 @@ ConfigSelections = {TestsB = {Config = "Test"}}
 
 [Configs.Test.Linux64]
 IntermediateType = "ObjectAndIRCode"
+COptimizationLevel = "O2"
 ConfigSelections = {TestsB = {Config = "Test"}}
 
 [Configs.Test.macOS]
+COptimizationLevel = "O2"
 ConfigSelections = {TestsB = {Config = "Test"}}
 
 [Configs.TestFail.Win64]