fix a few issues, reset to net8 once again because everything is major fucked

This commit is contained in:
Qrakhen 2025-12-03 16:28:39 +01:00
parent 2b850168f1
commit 3d5736aaa3
14 changed files with 50 additions and 64 deletions

2
.gitignore vendored
View File

@ -2,6 +2,8 @@ Debug/
Release/ Release/
Build/ Build/
bin/ bin/
*/bin/
*/bin/*
obj/ obj/
log/ log/
lib/ lib/

View File

@ -1,41 +1,7 @@
 using Qrakhen.Qamp.Core;
using Qrakhen.Qamp.Core;
using Qrakhen.Qamp.Core.Execution; using Qrakhen.Qamp.Core.Execution;
using Qrakhen.Qamp.Core.Logging; using Qrakhen.Qamp.Core.Logging;
using System.Diagnostics;
using System.Linq.Expressions;
using System.Text; using System.Text;
/*
// do args here too, keep console, etc. output with exit, all the spicy things
// if no file is given for example in args just keep cli live until quit
void Init(string[] args)
{
Console.WriteLine(string.Join(',', args));
string command = args.Length > 1 ? args[0] : args.Length == 1 ? "run" : "cli";
string target = args.Length > 1 ? args[1] : args.Length == 1 ? args[0] : "";
switch (command) {
case "run":
// check wheter .sqi or .sqr file
break;
case "cli":
break;
case "read":
break;
case "digest":
break;
case "help":
break;
}
}
Init(args);
*/
List<char> Ignored = [ '\0', '\b' ]; List<char> Ignored = [ '\0', '\b' ];
LoggerService.Default = LogLevel.Error; LoggerService.Default = LogLevel.Error;
@ -130,6 +96,8 @@ do {
} }
} catch (Exception e) { } catch (Exception e) {
Console.ForegroundColor = ConsoleColor.DarkRed; Console.ForegroundColor = ConsoleColor.DarkRed;
if (e.InnerException != null)
Console.WriteLine($" !? {e.InnerException.Message}");
Console.WriteLine($" !? {e.Message}"); Console.WriteLine($" !? {e.Message}");
if (e.StackTrace != null) { if (e.StackTrace != null) {
Console.Write($" ! "); Console.Write($" ! ");

View File

@ -2,7 +2,7 @@
<PropertyGroup> <PropertyGroup>
<OutputType>Exe</OutputType> <OutputType>Exe</OutputType>
<TargetFramework>net10.0</TargetFramework> <TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings> <ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable> <Nullable>enable</Nullable>
<BaseOutputPath>..\Build\</BaseOutputPath> <BaseOutputPath>..\Build\</BaseOutputPath>

View File

@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<TargetFramework>net10.0</TargetFramework> <TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings> <ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable> <Nullable>enable</Nullable>
<IsPackable>false</IsPackable> <IsPackable>false</IsPackable>

View File

@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<TargetFramework>net10.0</TargetFramework> <TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings> <ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable> <Nullable>enable</Nullable>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks> <AllowUnsafeBlocks>true</AllowUnsafeBlocks>

View File

@ -26,8 +26,6 @@ public class DefaultDialect : Dialect
Define(ContextClose, "}"); Define(ContextClose, "}");
Define(ArrayOpen, "["); Define(ArrayOpen, "[");
Define(ArrayClose, "]"); Define(ArrayClose, "]");
Define(AddItem, "<+");
Define(RemoveItem, "->");
Define(Comma, ","); Define(Comma, ",");
Define(Dot, "."); Define(Dot, ".");
Define(Colon, ":"); Define(Colon, ":");
@ -93,9 +91,10 @@ public class ClassicDialect : DefaultDialect
public ClassicDialect() public ClassicDialect()
{ {
Define(Null, "_"); Define(Null, "_");
Define(AddItem, "<+"); Define(PlusEqual, "<+");
Define(RemoveItem, "->"); Define(MinusEqual, "<-");
Define(Equal, "<~"); Define(Equal, "<~");
Define(Ref, "&");
Define(This, ".~"); Define(This, ".~");
Define(Var, "*~"); Define(Var, "*~");
Define(Return, "<:"); Define(Return, "<:");

View File

@ -140,7 +140,7 @@ public class ExtensionMethod(
var parameterExpressions = new Expression[parameterInfos.Length - 1]; var parameterExpressions = new Expression[parameterInfos.Length - 1];
for (int i = 0; i < parameterInfos.Length; i++) { for (int i = 0; i < parameterExpressions.Length; i++) {
ConstantExpression index = Expression.Constant(i); ConstantExpression index = Expression.Constant(i);
BinaryExpression indexExpression = Expression.ArrayIndex(argsParameter, index); BinaryExpression indexExpression = Expression.ArrayIndex(argsParameter, index);
@ -166,10 +166,9 @@ public class ExtensionMethod(
final = callExpression; final = callExpression;
} }
LambdaExpression lambda = Expression.Lambda(final, selfParameter, argsParameter); var lambda = Expression.Lambda<ExtensionDelegate>(final, selfParameter, argsParameter);
_logger.Verbose($"Done: ", lambda); _logger.Verbose($"Done: ", lambda);
return (ExtensionDelegate)lambda.Compile(); return lambda.Compile();
} }
public static IEnumerable<ExtensionMethod> CompileExtensionsFromType(Type type) public static IEnumerable<ExtensionMethod> CompileExtensionsFromType(Type type)
@ -213,31 +212,33 @@ public class ExtensionMethod(
public static class StringExtensions public static class StringExtensions
{ {
[ExtensionMethod] [ExtensionMethod]
public static long Length(Objects.String self) public static long Length(Value self) // make this possible with Objects.String and auto-detection
{ {
return self.Value?.Length ?? 0; return self.Ptr.As<Objects.String>()?.Value?.Length ?? 0;
} }
[ExtensionMethod] [ExtensionMethod]
public static long IndexOf(Objects.String self, Objects.String needle) public static long IndexOf(Value self, Value needle)
{ {
if (needle.Value is null) string _self = self.Ptr.As<Objects.String>()?.Value ?? "";
string _needle = self.Ptr.As<Objects.String>()?.Value ?? "";
if (_needle.Length < 1 || _self.Length < 1)
return -1; return -1;
return self.Value?.IndexOf(needle.Value) ?? -1; return _self.IndexOf(_needle);
} }
[ExtensionMethod] [ExtensionMethod]
public static Objects.Array Split(Objects.String self, Objects.String splitter) public static Objects.Array Split(Value self, Value splitter)
{ {
string? _splitter = splitter.Value; string? _splitter = splitter.Ptr.As<Objects.String>()?.Value;
string? _string = self.Value; string? _string = self.Ptr.As<Objects.String>()?.Value;
if (_string is null) if (_string is null)
return new Objects.Array([]); return new Objects.Array([]);
if (_splitter is null) if (_splitter is null)
return new Objects.Array([ Obj.Create(self) ]); return new Objects.Array([ self ]);
string[] parts = _string.Split(_splitter); string[] parts = _string.Split(_splitter);
Value[] values = new Value[parts.Length]; Value[] values = new Value[parts.Length];
@ -247,3 +248,13 @@ public static class StringExtensions
return new Objects.Array(values); return new Objects.Array(values);
} }
} }
[ExtensionClass(ValueType = ValueType.Array)]
public static class ArrayExtensions
{
[ExtensionMethod]
public static long Length(Objects.Array self)
{
return self.Data.LongLength;
}
}

View File

@ -1,9 +1,10 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<TargetFramework>net10.0</TargetFramework> <TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings> <ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable> <Nullable>enable</Nullable>
<BaseOutputPath>..\Build\</BaseOutputPath>
<BaseOutputPath>..\Build\</BaseOutputPath> <BaseOutputPath>..\Build\</BaseOutputPath>
<Platforms>AnyCPU;x64</Platforms> <Platforms>AnyCPU;x64</Platforms>
</PropertyGroup> </PropertyGroup>

View File

@ -2,10 +2,12 @@
<PropertyGroup> <PropertyGroup>
<OutputType>WinExe</OutputType> <OutputType>WinExe</OutputType>
<TargetFramework>net10.0-windows</TargetFramework> <TargetFramework>net8.0-windows</TargetFramework>
<Nullable>enable</Nullable> <Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings> <ImplicitUsings>enable</ImplicitUsings>
<UseWPF>true</UseWPF> <UseWPF>true</UseWPF>
<BaseOutputPath>..\Build\</BaseOutputPath>
<Platforms>AnyCPU;x64</Platforms>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>

View File

@ -1,9 +1,11 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<TargetFramework>net10.0</TargetFramework> <TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings> <ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable> <Nullable>enable</Nullable>
<BaseOutputPath>..\Build\</BaseOutputPath>
<Platforms>AnyCPU;x64</Platforms>
</PropertyGroup> </PropertyGroup>
</Project> </Project>

View File

@ -1,9 +1,10 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<TargetFramework>net10.0</TargetFramework> <TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings> <ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable> <Nullable>enable</Nullable>
<BaseOutputPath>..\Build\</BaseOutputPath>
<Platforms>AnyCPU;x64</Platforms> <Platforms>AnyCPU;x64</Platforms>
</PropertyGroup> </PropertyGroup>

View File

@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<TargetFramework>net10.0</TargetFramework> <TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings> <ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable> <Nullable>enable</Nullable>
<AllowUnsafeBlocks>True</AllowUnsafeBlocks> <AllowUnsafeBlocks>True</AllowUnsafeBlocks>

View File

@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<TargetFramework>net10.0</TargetFramework> <TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings> <ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable> <Nullable>enable</Nullable>

View File

@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<TargetFramework>net10.0-windows</TargetFramework> <TargetFramework>net8.0-windows</TargetFramework>
<Nullable>enable</Nullable> <Nullable>enable</Nullable>
<UseWPF>true</UseWPF> <UseWPF>true</UseWPF>
<ImplicitUsings>enable</ImplicitUsings> <ImplicitUsings>enable</ImplicitUsings>