From 3d5736aaa3ff510f5433b53ccac97cfb0a8366d6 Mon Sep 17 00:00:00 2001 From: Qrakhen Date: Wed, 3 Dec 2025 16:28:39 +0100 Subject: [PATCH] fix a few issues, reset to net8 once again because everything is major fucked --- .gitignore | 2 + Qrakhen.Qamp.CLI/Program.cs | 38 ++----------------- Qrakhen.Qamp.CLI/Qrakhen.Qamp.CLI.csproj | 2 +- .../Qrakhen.Qamp.Core.Tests.csproj | 2 +- Qrakhen.Qamp.Core/Qrakhen.Qamp.Core.csproj | 2 +- Qrakhen.Qamp.Core/Tokenization/Dialect.cs | 7 ++-- Qrakhen.Qamp.Core/Values/ExtensionMethod.cs | 37 +++++++++++------- .../Qrakhen.Qamp.Digest.csproj | 5 ++- .../Qrakhen.Qamp.Editor.csproj | 4 +- .../Qrakhen.Qamp.Memory.csproj | 4 +- .../Qrakhen.Qamp.Reader.csproj | 5 ++- .../Qrakhen.Qamp.Runtime.csproj | 2 +- Qrakhen.Qamp.Tests/Qrakhen.Qamp.Tests.csproj | 2 +- .../Qrakhen.TilingFrames.csproj | 2 +- 14 files changed, 50 insertions(+), 64 deletions(-) diff --git a/.gitignore b/.gitignore index 05f6a5a..12bcbe8 100644 --- a/.gitignore +++ b/.gitignore @@ -2,6 +2,8 @@ Debug/ Release/ Build/ bin/ +*/bin/ +*/bin/* obj/ log/ lib/ diff --git a/Qrakhen.Qamp.CLI/Program.cs b/Qrakhen.Qamp.CLI/Program.cs index 0187be7..da1d7f0 100644 --- a/Qrakhen.Qamp.CLI/Program.cs +++ b/Qrakhen.Qamp.CLI/Program.cs @@ -1,41 +1,7 @@ - -using Qrakhen.Qamp.Core; +using Qrakhen.Qamp.Core; using Qrakhen.Qamp.Core.Execution; using Qrakhen.Qamp.Core.Logging; -using System.Diagnostics; -using System.Linq.Expressions; 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 Ignored = [ '\0', '\b' ]; LoggerService.Default = LogLevel.Error; @@ -130,6 +96,8 @@ do { } } catch (Exception e) { Console.ForegroundColor = ConsoleColor.DarkRed; + if (e.InnerException != null) + Console.WriteLine($" !? {e.InnerException.Message}"); Console.WriteLine($" !? {e.Message}"); if (e.StackTrace != null) { Console.Write($" ! "); diff --git a/Qrakhen.Qamp.CLI/Qrakhen.Qamp.CLI.csproj b/Qrakhen.Qamp.CLI/Qrakhen.Qamp.CLI.csproj index 6c86437..82e16ac 100644 --- a/Qrakhen.Qamp.CLI/Qrakhen.Qamp.CLI.csproj +++ b/Qrakhen.Qamp.CLI/Qrakhen.Qamp.CLI.csproj @@ -2,7 +2,7 @@ Exe - net10.0 + net8.0 enable enable ..\Build\ diff --git a/Qrakhen.Qamp.Core.Tests/Qrakhen.Qamp.Core.Tests.csproj b/Qrakhen.Qamp.Core.Tests/Qrakhen.Qamp.Core.Tests.csproj index 887faea..08440ef 100644 --- a/Qrakhen.Qamp.Core.Tests/Qrakhen.Qamp.Core.Tests.csproj +++ b/Qrakhen.Qamp.Core.Tests/Qrakhen.Qamp.Core.Tests.csproj @@ -1,7 +1,7 @@  - net10.0 + net8.0 enable enable false diff --git a/Qrakhen.Qamp.Core/Qrakhen.Qamp.Core.csproj b/Qrakhen.Qamp.Core/Qrakhen.Qamp.Core.csproj index bdef87d..d1daa9a 100644 --- a/Qrakhen.Qamp.Core/Qrakhen.Qamp.Core.csproj +++ b/Qrakhen.Qamp.Core/Qrakhen.Qamp.Core.csproj @@ -1,7 +1,7 @@  - net10.0 + net8.0 enable enable true diff --git a/Qrakhen.Qamp.Core/Tokenization/Dialect.cs b/Qrakhen.Qamp.Core/Tokenization/Dialect.cs index 8761a31..ae46cee 100644 --- a/Qrakhen.Qamp.Core/Tokenization/Dialect.cs +++ b/Qrakhen.Qamp.Core/Tokenization/Dialect.cs @@ -26,8 +26,6 @@ public class DefaultDialect : Dialect Define(ContextClose, "}"); Define(ArrayOpen, "["); Define(ArrayClose, "]"); - Define(AddItem, "<+"); - Define(RemoveItem, "->"); Define(Comma, ","); Define(Dot, "."); Define(Colon, ":"); @@ -93,9 +91,10 @@ public class ClassicDialect : DefaultDialect public ClassicDialect() { Define(Null, "_"); - Define(AddItem, "<+"); - Define(RemoveItem, "->"); + Define(PlusEqual, "<+"); + Define(MinusEqual, "<-"); Define(Equal, "<~"); + Define(Ref, "&"); Define(This, ".~"); Define(Var, "*~"); Define(Return, "<:"); diff --git a/Qrakhen.Qamp.Core/Values/ExtensionMethod.cs b/Qrakhen.Qamp.Core/Values/ExtensionMethod.cs index cf5082e..a811a85 100644 --- a/Qrakhen.Qamp.Core/Values/ExtensionMethod.cs +++ b/Qrakhen.Qamp.Core/Values/ExtensionMethod.cs @@ -140,7 +140,7 @@ public class ExtensionMethod( 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); BinaryExpression indexExpression = Expression.ArrayIndex(argsParameter, index); @@ -166,10 +166,9 @@ public class ExtensionMethod( final = callExpression; } - LambdaExpression lambda = Expression.Lambda(final, selfParameter, argsParameter); - + var lambda = Expression.Lambda(final, selfParameter, argsParameter); _logger.Verbose($"Done: ", lambda); - return (ExtensionDelegate)lambda.Compile(); + return lambda.Compile(); } public static IEnumerable CompileExtensionsFromType(Type type) @@ -213,31 +212,33 @@ public class ExtensionMethod( public static class StringExtensions { [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()?.Value?.Length ?? 0; } [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()?.Value ?? ""; + string _needle = self.Ptr.As()?.Value ?? ""; + if (_needle.Length < 1 || _self.Length < 1) return -1; - return self.Value?.IndexOf(needle.Value) ?? -1; + return _self.IndexOf(_needle); } [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? _string = self.Value; + string? _splitter = splitter.Ptr.As()?.Value; + string? _string = self.Ptr.As()?.Value; if (_string is null) return new Objects.Array([]); if (_splitter is null) - return new Objects.Array([ Obj.Create(self) ]); + return new Objects.Array([ self ]); string[] parts = _string.Split(_splitter); Value[] values = new Value[parts.Length]; @@ -247,3 +248,13 @@ public static class StringExtensions 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; + } +} diff --git a/Qrakhen.Qamp.Digest/Qrakhen.Qamp.Digest.csproj b/Qrakhen.Qamp.Digest/Qrakhen.Qamp.Digest.csproj index d39e2e5..f2f434b 100644 --- a/Qrakhen.Qamp.Digest/Qrakhen.Qamp.Digest.csproj +++ b/Qrakhen.Qamp.Digest/Qrakhen.Qamp.Digest.csproj @@ -1,11 +1,12 @@  - net10.0 + net8.0 enable enable ..\Build\ - AnyCPU;x64 + ..\Build\ + AnyCPU;x64 diff --git a/Qrakhen.Qamp.Editor/Qrakhen.Qamp.Editor.csproj b/Qrakhen.Qamp.Editor/Qrakhen.Qamp.Editor.csproj index e9a980a..1b30255 100644 --- a/Qrakhen.Qamp.Editor/Qrakhen.Qamp.Editor.csproj +++ b/Qrakhen.Qamp.Editor/Qrakhen.Qamp.Editor.csproj @@ -2,10 +2,12 @@ WinExe - net10.0-windows + net8.0-windows enable enable true + ..\Build\ + AnyCPU;x64 diff --git a/Qrakhen.Qamp.Memory/Qrakhen.Qamp.Memory.csproj b/Qrakhen.Qamp.Memory/Qrakhen.Qamp.Memory.csproj index b760144..9093267 100644 --- a/Qrakhen.Qamp.Memory/Qrakhen.Qamp.Memory.csproj +++ b/Qrakhen.Qamp.Memory/Qrakhen.Qamp.Memory.csproj @@ -1,9 +1,11 @@  - net10.0 + net8.0 enable enable + ..\Build\ + AnyCPU;x64 diff --git a/Qrakhen.Qamp.Reader/Qrakhen.Qamp.Reader.csproj b/Qrakhen.Qamp.Reader/Qrakhen.Qamp.Reader.csproj index dc5ea10..9093267 100644 --- a/Qrakhen.Qamp.Reader/Qrakhen.Qamp.Reader.csproj +++ b/Qrakhen.Qamp.Reader/Qrakhen.Qamp.Reader.csproj @@ -1,10 +1,11 @@  - net10.0 + net8.0 enable enable - AnyCPU;x64 + ..\Build\ + AnyCPU;x64 diff --git a/Qrakhen.Qamp.Runtime/Qrakhen.Qamp.Runtime.csproj b/Qrakhen.Qamp.Runtime/Qrakhen.Qamp.Runtime.csproj index 8394389..d0afaed 100644 --- a/Qrakhen.Qamp.Runtime/Qrakhen.Qamp.Runtime.csproj +++ b/Qrakhen.Qamp.Runtime/Qrakhen.Qamp.Runtime.csproj @@ -1,7 +1,7 @@  - net10.0 + net8.0 enable enable True diff --git a/Qrakhen.Qamp.Tests/Qrakhen.Qamp.Tests.csproj b/Qrakhen.Qamp.Tests/Qrakhen.Qamp.Tests.csproj index 56bc533..9c5b30a 100644 --- a/Qrakhen.Qamp.Tests/Qrakhen.Qamp.Tests.csproj +++ b/Qrakhen.Qamp.Tests/Qrakhen.Qamp.Tests.csproj @@ -1,7 +1,7 @@ - net10.0 + net8.0 enable enable diff --git a/Qrakhen.TilingFrames/Qrakhen.TilingFrames.csproj b/Qrakhen.TilingFrames/Qrakhen.TilingFrames.csproj index 48ef7c9..62bbe54 100644 --- a/Qrakhen.TilingFrames/Qrakhen.TilingFrames.csproj +++ b/Qrakhen.TilingFrames/Qrakhen.TilingFrames.csproj @@ -1,7 +1,7 @@  - net10.0-windows + net8.0-windows enable true enable