Loading pkgs/by-name/cl/clps2c-compiler/deps.nix 0 → 100644 +11 −0 Original line number Diff line number Diff line # This file was automatically generated by passthru.fetch-deps. # Please dont edit it manually, your changes might get overwritten! { fetchNuGet }: [ (fetchNuGet { pname = "CommandLineParser"; version = "2.9.1"; hash = "sha256-ApU9y1yX60daSjPk3KYDBeJ7XZByKW8hse9NRZGcjeo="; }) ] pkgs/by-name/cl/clps2c-compiler/package.nix 0 → 100644 +75 −0 Original line number Diff line number Diff line { keystone, fetchFromGitHub, buildDotnetModule, dotnetCorePackages, lib, }: let version = "1.0.1"; pname = "CLPS2C-Compiler"; owner = "NiV-L-A"; keystone-rev = "MIPS-0.9.2"; keystone-sha256 = "sha256-xLkO06ZgnmAavJMP1kjDwXT1hc5eSDXv+4MUkOz6xeo="; keystone-src = ( fetchFromGitHub { name = "keystone"; inherit owner; repo = "keystone"; rev = keystone-rev; sha256 = keystone-sha256; } ); keystone-override = keystone.overrideAttrs (old: { src = keystone-src; }); in buildDotnetModule rec { inherit version pname; srcs = [ (fetchFromGitHub { name = pname; inherit owner; repo = pname; rev = "CLPS2C-Compiler-${version}"; sha256 = "sha256-4gLdrIxyw9BFSxF+EXZqTgUf9Kik6oK7eO9HBUzk4QM="; }) keystone-src ]; sourceRoot = "."; patches = [ ./patches/dont_trim_leading_newline.patch ./patches/build_fixes.patch ./patches/remove_platformtarget.patch ./patches/use_compiled_keystone.patch ./patches/set_langversion.patch ./patches/set_runtimeidentifiers.patch ./patches/keystone_set_targetframework.patch ]; dotnet-sdk = dotnetCorePackages.sdk_8_0; dotnet-runtime = dotnetCorePackages.runtime_8_0; dotnetFlags = [ "-p:TargetFramework=net8.0" ]; nugetDeps = ./deps.nix; runtimeDeps = [ keystone-override ]; projectFile = "CLPS2C-Compiler/CLPS2C-Compiler/CLPS2C-Compiler.csproj"; meta = { homepage = "https://github.com/NiV-L-A/CLPS2C-Compiler"; description = "Compiler for CLPS2C, a domain-specific language built specifically for writing PS2 cheat codes"; mainProgram = "CLPS2C-Compiler"; maintainers = [ lib.maintainers.gigahawk ]; license = lib.licenses.gpl3Only; }; } pkgs/by-name/cl/clps2c-compiler/patches/build_fixes.patch 0 → 100644 +193 −0 Original line number Diff line number Diff line diff --git a/CLPS2C-Compiler/Program.cs b/CLPS2C-Compiler/Program.cs index 6991896..a086433 100644 --- a/CLPS2C-Compiler/CLPS2C-Compiler/Program.cs +++ b/CLPS2C-Compiler/CLPS2C-Compiler/Program.cs @@ -1166,7 +1166,7 @@ namespace CLPS2C_Compiler string Value_1 = ""; string Value_2 = ""; // Handle a bit differently in case there's a label at the start - if (command.Type.EndsWith(':')) + if (command.Type.EndsWith(":")) { OpCode = command.Data[0].ToUpper(); Register = command.Data[1]; @@ -1201,7 +1201,7 @@ namespace CLPS2C_Compiler } Output = $"lui {Register},0x{Value_1}; {OpCode} {Register},{Value_2}({Register})"; - if (command.Type.EndsWith(':')) + if (command.Type.EndsWith(":")) { Output = $"{command.FullLine.Substring(0, command.FullLine.IndexOf(':'))}: {Output}"; } @@ -1589,7 +1589,7 @@ namespace CLPS2C_Compiler while (IfIndex != -1) { - int ExtraIfCount = commands[IfIndex].FullLine.Split("&&", StringSplitOptions.None).Length - 1; + int ExtraIfCount = commands[IfIndex].FullLine.Split(new string[] { "&&" }, StringSplitOptions.None).Length - 1; for (int i = 0; i < ExtraIfCount; i++) { // Add more IF commands @@ -1807,7 +1807,7 @@ namespace CLPS2C_Compiler for (int j = 0; j < commands[i].Data.Count; j++) { string Target = commands[i].Data[j]; - if (Target.StartsWith('+') || Target.StartsWith(',')) + if (Target.StartsWith("+") || Target.StartsWith(",")) { Target = Target.Substring(1).TrimStart(); } @@ -1815,14 +1815,14 @@ namespace CLPS2C_Compiler if (IsVarDeclared(Target, listSets)) { List<string> ListValues = GetSetValueFromTarget(Target, commands[i].ID, listSets); - if (commands[i].Data[j].StartsWith('+') || commands[i].Data[j].StartsWith(',')) + if (commands[i].Data[j].StartsWith("+") || commands[i].Data[j].StartsWith(",")) { ListValues[0] = commands[i].Data[j][0] + ListValues[0]; } for (int k = 1; k < ListValues.Count; k++) { - if (ListValues[k].StartsWith('+') || ListValues[k].StartsWith(',')) + if (ListValues[k].StartsWith("+") || ListValues[k].StartsWith(",")) { ListValues[k] = ListValues[k][0] + ListValues[k].Substring(1).TrimStart(); } @@ -1834,7 +1834,7 @@ namespace CLPS2C_Compiler continue; } - if (commands[i].Data[j].StartsWith('+') || commands[i].Data[j].StartsWith(',')) + if (commands[i].Data[j].StartsWith("+") || commands[i].Data[j].StartsWith(",")) { commands[i].Data[j] = commands[i].Data[j][0] + Target; } @@ -1912,7 +1912,7 @@ namespace CLPS2C_Compiler for (i = i + 1; i < command.Data.Count; i++) { - if (!command.Data[i].StartsWith('+')) + if (!command.Data[i].StartsWith("+")) { break; } @@ -1940,12 +1940,12 @@ namespace CLPS2C_Compiler for (i = i + 1; i < command.Data.Count; i++) { - if (command.Data[i].StartsWith(',')) + if (command.Data[i].StartsWith(",")) { ListOffs.Add(TmpAddress.ToString("X8")); TmpAddress = 0; } - else if (!command.Data[i].StartsWith('+')) + else if (!command.Data[i].StartsWith("+")) { ListOffs.Add(TmpAddress.ToString("X8")); TmpAddress = 0; @@ -1980,7 +1980,7 @@ namespace CLPS2C_Compiler for (i = i + 1; i < command.Data.Count; i++) { - if (!command.Data[i].StartsWith('+')) + if (!command.Data[i].StartsWith("+")) { break; } @@ -2008,7 +2008,7 @@ namespace CLPS2C_Compiler for (i = i + 1; i < command.Data.Count; i++) { - if (!command.Data[i].StartsWith('+')) + if (!command.Data[i].StartsWith("+")) { break; } @@ -2040,7 +2040,7 @@ namespace CLPS2C_Compiler { string Value = ""; uint Sum = 0; - if (command.Data[i].StartsWith('"')) + if (command.Data[i].StartsWith("\"")) { // string Value = command.Data[i]; @@ -2059,7 +2059,7 @@ namespace CLPS2C_Compiler for (i = i + 1; i < command.Data.Count; i++) { string Element = command.Data[i]; - if (!Element.StartsWith('+') || Element == "+") + if (!Element.StartsWith("+") || Element == "+") { // without +, or just '+' SetError(ERROR.WRONG_SYNTAX, command); @@ -2072,7 +2072,7 @@ namespace CLPS2C_Compiler // string if (Sum > 0) { - if (Value.EndsWith('"')) + if (Value.EndsWith("\"")) { Value = Value.TrimEnd('"') + Sum.ToString() + '"'; } @@ -2089,7 +2089,7 @@ namespace CLPS2C_Compiler return ""; } string Tmp = GetSubstringInQuotes(Element, false); - if (Value.EndsWith('"')) + if (Value.EndsWith("\"")) { Value = Value.TrimEnd('"') + Tmp + '"'; } @@ -2112,7 +2112,7 @@ namespace CLPS2C_Compiler if (Sum > 0) { - if (Value.EndsWith('"')) + if (Value.EndsWith("\"")) { Value = Value.TrimEnd('"') + Sum.ToString() + '"'; } diff --git a/CLPS2C-Compiler/Util.cs b/CLPS2C-Compiler/Util.cs index 4560c73..7f82ae6 100644 --- a/CLPS2C-Compiler/CLPS2C-Compiler/Util.cs +++ b/CLPS2C-Compiler/CLPS2C-Compiler/Util.cs @@ -48,7 +48,7 @@ namespace CLPS2C_Compiler // ([^ \t\n\r\f\v(+,]+) - Any other word. This is \S, and '(', '+', ',' MatchCollection Matches = Regex.Matches(line, @"(\(.*\))|(""(?:\\.|[^""])*""?)|(\+\s*((""(?:\\.|[^""])*""?)|([^+""]+?))?(?=\+|$| |,))|(,(""?)([^,""]+?)\8(?=,|$| |\+))|([^ \t\n\r\f\v(+,]+)"); Type = Matches[0].Value.ToUpper(); - Data = Matches.Skip(1).Take(Matches.Count - 1).Select(item => item.Value).ToList(); // Data has every word except first + Data = Matches.Cast<Match>().Skip(1).Take(Matches.Count - 1).Select(item => item.Value).ToList(); // Data has every word except first } public void AppendToTraceback(string file, string fullLine, int lineIdx) @@ -165,7 +165,7 @@ namespace CLPS2C_Compiler else { // It's a comment, count new lines - int newLinesCount = match.Value.Split(Program._newLine).Length - 1; + int newLinesCount = match.Value.Split(new string[] { Program._newLine }, StringSplitOptions.None).Length - 1; return string.Concat(Enumerable.Repeat(Program._newLine, newLinesCount)); } }); @@ -486,7 +486,7 @@ namespace CLPS2C_Compiler for (int i = 0; i < Output.Count; i++) { string Element = Output[i]; - if (Element.StartsWith('+')) + if (Element.StartsWith("+")) { Element = Element.Substring(1).TrimStart(); } @@ -496,7 +496,7 @@ namespace CLPS2C_Compiler List<string> RecursiveValues = GetSetValueFromTarget(Element, SetID, listSets); if (RecursiveValues.Count != 0) { - if (Output[i].StartsWith('+')) + if (Output[i].StartsWith("+")) { RecursiveValues[0] = "+" + RecursiveValues[0]; } pkgs/by-name/cl/clps2c-compiler/patches/dont_trim_leading_newline.patch 0 → 100644 +15 −0 Original line number Diff line number Diff line diff --git a/CLPS2C-Compiler/Program.cs b/CLPS2C-Compiler/Program.cs index 6991896..fe8cd5f 100644 --- a/CLPS2C-Compiler/CLPS2C-Compiler/Program.cs +++ b/CLPS2C-Compiler/CLPS2C-Compiler/Program.cs @@ -90,10 +90,6 @@ namespace CLPS2C_Compiler } else if (OutputLines.Count != 0) { - if (OutputLines[0].StartsWith(_newLine)) - { - OutputLines[0] = OutputLines[0].Substring(2); - } Output += string.Join("", OutputLines); // Convert to PNACH Format pkgs/by-name/cl/clps2c-compiler/patches/keystone_set_targetframework.patch 0 → 100644 +13 −0 Original line number Diff line number Diff line diff --git a/bindings/csharp/Keystone.Net/Keystone.Net.csproj b/bindings/csharp/Keystone.Net/Keystone.Net.csproj index 04801b4..4c6fe15 100644 --- a/keystone/bindings/csharp/Keystone.Net/Keystone.Net.csproj +++ b/keystone/bindings/csharp/Keystone.Net/Keystone.Net.csproj @@ -1,7 +1,7 @@ <Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> - <TargetFramework>netstandard2.0</TargetFramework> + <TargetFramework>net8.0</TargetFramework> <RootNamespace>Keystone</RootNamespace> <Version>1.1.0</Version> Loading
pkgs/by-name/cl/clps2c-compiler/deps.nix 0 → 100644 +11 −0 Original line number Diff line number Diff line # This file was automatically generated by passthru.fetch-deps. # Please dont edit it manually, your changes might get overwritten! { fetchNuGet }: [ (fetchNuGet { pname = "CommandLineParser"; version = "2.9.1"; hash = "sha256-ApU9y1yX60daSjPk3KYDBeJ7XZByKW8hse9NRZGcjeo="; }) ]
pkgs/by-name/cl/clps2c-compiler/package.nix 0 → 100644 +75 −0 Original line number Diff line number Diff line { keystone, fetchFromGitHub, buildDotnetModule, dotnetCorePackages, lib, }: let version = "1.0.1"; pname = "CLPS2C-Compiler"; owner = "NiV-L-A"; keystone-rev = "MIPS-0.9.2"; keystone-sha256 = "sha256-xLkO06ZgnmAavJMP1kjDwXT1hc5eSDXv+4MUkOz6xeo="; keystone-src = ( fetchFromGitHub { name = "keystone"; inherit owner; repo = "keystone"; rev = keystone-rev; sha256 = keystone-sha256; } ); keystone-override = keystone.overrideAttrs (old: { src = keystone-src; }); in buildDotnetModule rec { inherit version pname; srcs = [ (fetchFromGitHub { name = pname; inherit owner; repo = pname; rev = "CLPS2C-Compiler-${version}"; sha256 = "sha256-4gLdrIxyw9BFSxF+EXZqTgUf9Kik6oK7eO9HBUzk4QM="; }) keystone-src ]; sourceRoot = "."; patches = [ ./patches/dont_trim_leading_newline.patch ./patches/build_fixes.patch ./patches/remove_platformtarget.patch ./patches/use_compiled_keystone.patch ./patches/set_langversion.patch ./patches/set_runtimeidentifiers.patch ./patches/keystone_set_targetframework.patch ]; dotnet-sdk = dotnetCorePackages.sdk_8_0; dotnet-runtime = dotnetCorePackages.runtime_8_0; dotnetFlags = [ "-p:TargetFramework=net8.0" ]; nugetDeps = ./deps.nix; runtimeDeps = [ keystone-override ]; projectFile = "CLPS2C-Compiler/CLPS2C-Compiler/CLPS2C-Compiler.csproj"; meta = { homepage = "https://github.com/NiV-L-A/CLPS2C-Compiler"; description = "Compiler for CLPS2C, a domain-specific language built specifically for writing PS2 cheat codes"; mainProgram = "CLPS2C-Compiler"; maintainers = [ lib.maintainers.gigahawk ]; license = lib.licenses.gpl3Only; }; }
pkgs/by-name/cl/clps2c-compiler/patches/build_fixes.patch 0 → 100644 +193 −0 Original line number Diff line number Diff line diff --git a/CLPS2C-Compiler/Program.cs b/CLPS2C-Compiler/Program.cs index 6991896..a086433 100644 --- a/CLPS2C-Compiler/CLPS2C-Compiler/Program.cs +++ b/CLPS2C-Compiler/CLPS2C-Compiler/Program.cs @@ -1166,7 +1166,7 @@ namespace CLPS2C_Compiler string Value_1 = ""; string Value_2 = ""; // Handle a bit differently in case there's a label at the start - if (command.Type.EndsWith(':')) + if (command.Type.EndsWith(":")) { OpCode = command.Data[0].ToUpper(); Register = command.Data[1]; @@ -1201,7 +1201,7 @@ namespace CLPS2C_Compiler } Output = $"lui {Register},0x{Value_1}; {OpCode} {Register},{Value_2}({Register})"; - if (command.Type.EndsWith(':')) + if (command.Type.EndsWith(":")) { Output = $"{command.FullLine.Substring(0, command.FullLine.IndexOf(':'))}: {Output}"; } @@ -1589,7 +1589,7 @@ namespace CLPS2C_Compiler while (IfIndex != -1) { - int ExtraIfCount = commands[IfIndex].FullLine.Split("&&", StringSplitOptions.None).Length - 1; + int ExtraIfCount = commands[IfIndex].FullLine.Split(new string[] { "&&" }, StringSplitOptions.None).Length - 1; for (int i = 0; i < ExtraIfCount; i++) { // Add more IF commands @@ -1807,7 +1807,7 @@ namespace CLPS2C_Compiler for (int j = 0; j < commands[i].Data.Count; j++) { string Target = commands[i].Data[j]; - if (Target.StartsWith('+') || Target.StartsWith(',')) + if (Target.StartsWith("+") || Target.StartsWith(",")) { Target = Target.Substring(1).TrimStart(); } @@ -1815,14 +1815,14 @@ namespace CLPS2C_Compiler if (IsVarDeclared(Target, listSets)) { List<string> ListValues = GetSetValueFromTarget(Target, commands[i].ID, listSets); - if (commands[i].Data[j].StartsWith('+') || commands[i].Data[j].StartsWith(',')) + if (commands[i].Data[j].StartsWith("+") || commands[i].Data[j].StartsWith(",")) { ListValues[0] = commands[i].Data[j][0] + ListValues[0]; } for (int k = 1; k < ListValues.Count; k++) { - if (ListValues[k].StartsWith('+') || ListValues[k].StartsWith(',')) + if (ListValues[k].StartsWith("+") || ListValues[k].StartsWith(",")) { ListValues[k] = ListValues[k][0] + ListValues[k].Substring(1).TrimStart(); } @@ -1834,7 +1834,7 @@ namespace CLPS2C_Compiler continue; } - if (commands[i].Data[j].StartsWith('+') || commands[i].Data[j].StartsWith(',')) + if (commands[i].Data[j].StartsWith("+") || commands[i].Data[j].StartsWith(",")) { commands[i].Data[j] = commands[i].Data[j][0] + Target; } @@ -1912,7 +1912,7 @@ namespace CLPS2C_Compiler for (i = i + 1; i < command.Data.Count; i++) { - if (!command.Data[i].StartsWith('+')) + if (!command.Data[i].StartsWith("+")) { break; } @@ -1940,12 +1940,12 @@ namespace CLPS2C_Compiler for (i = i + 1; i < command.Data.Count; i++) { - if (command.Data[i].StartsWith(',')) + if (command.Data[i].StartsWith(",")) { ListOffs.Add(TmpAddress.ToString("X8")); TmpAddress = 0; } - else if (!command.Data[i].StartsWith('+')) + else if (!command.Data[i].StartsWith("+")) { ListOffs.Add(TmpAddress.ToString("X8")); TmpAddress = 0; @@ -1980,7 +1980,7 @@ namespace CLPS2C_Compiler for (i = i + 1; i < command.Data.Count; i++) { - if (!command.Data[i].StartsWith('+')) + if (!command.Data[i].StartsWith("+")) { break; } @@ -2008,7 +2008,7 @@ namespace CLPS2C_Compiler for (i = i + 1; i < command.Data.Count; i++) { - if (!command.Data[i].StartsWith('+')) + if (!command.Data[i].StartsWith("+")) { break; } @@ -2040,7 +2040,7 @@ namespace CLPS2C_Compiler { string Value = ""; uint Sum = 0; - if (command.Data[i].StartsWith('"')) + if (command.Data[i].StartsWith("\"")) { // string Value = command.Data[i]; @@ -2059,7 +2059,7 @@ namespace CLPS2C_Compiler for (i = i + 1; i < command.Data.Count; i++) { string Element = command.Data[i]; - if (!Element.StartsWith('+') || Element == "+") + if (!Element.StartsWith("+") || Element == "+") { // without +, or just '+' SetError(ERROR.WRONG_SYNTAX, command); @@ -2072,7 +2072,7 @@ namespace CLPS2C_Compiler // string if (Sum > 0) { - if (Value.EndsWith('"')) + if (Value.EndsWith("\"")) { Value = Value.TrimEnd('"') + Sum.ToString() + '"'; } @@ -2089,7 +2089,7 @@ namespace CLPS2C_Compiler return ""; } string Tmp = GetSubstringInQuotes(Element, false); - if (Value.EndsWith('"')) + if (Value.EndsWith("\"")) { Value = Value.TrimEnd('"') + Tmp + '"'; } @@ -2112,7 +2112,7 @@ namespace CLPS2C_Compiler if (Sum > 0) { - if (Value.EndsWith('"')) + if (Value.EndsWith("\"")) { Value = Value.TrimEnd('"') + Sum.ToString() + '"'; } diff --git a/CLPS2C-Compiler/Util.cs b/CLPS2C-Compiler/Util.cs index 4560c73..7f82ae6 100644 --- a/CLPS2C-Compiler/CLPS2C-Compiler/Util.cs +++ b/CLPS2C-Compiler/CLPS2C-Compiler/Util.cs @@ -48,7 +48,7 @@ namespace CLPS2C_Compiler // ([^ \t\n\r\f\v(+,]+) - Any other word. This is \S, and '(', '+', ',' MatchCollection Matches = Regex.Matches(line, @"(\(.*\))|(""(?:\\.|[^""])*""?)|(\+\s*((""(?:\\.|[^""])*""?)|([^+""]+?))?(?=\+|$| |,))|(,(""?)([^,""]+?)\8(?=,|$| |\+))|([^ \t\n\r\f\v(+,]+)"); Type = Matches[0].Value.ToUpper(); - Data = Matches.Skip(1).Take(Matches.Count - 1).Select(item => item.Value).ToList(); // Data has every word except first + Data = Matches.Cast<Match>().Skip(1).Take(Matches.Count - 1).Select(item => item.Value).ToList(); // Data has every word except first } public void AppendToTraceback(string file, string fullLine, int lineIdx) @@ -165,7 +165,7 @@ namespace CLPS2C_Compiler else { // It's a comment, count new lines - int newLinesCount = match.Value.Split(Program._newLine).Length - 1; + int newLinesCount = match.Value.Split(new string[] { Program._newLine }, StringSplitOptions.None).Length - 1; return string.Concat(Enumerable.Repeat(Program._newLine, newLinesCount)); } }); @@ -486,7 +486,7 @@ namespace CLPS2C_Compiler for (int i = 0; i < Output.Count; i++) { string Element = Output[i]; - if (Element.StartsWith('+')) + if (Element.StartsWith("+")) { Element = Element.Substring(1).TrimStart(); } @@ -496,7 +496,7 @@ namespace CLPS2C_Compiler List<string> RecursiveValues = GetSetValueFromTarget(Element, SetID, listSets); if (RecursiveValues.Count != 0) { - if (Output[i].StartsWith('+')) + if (Output[i].StartsWith("+")) { RecursiveValues[0] = "+" + RecursiveValues[0]; }
pkgs/by-name/cl/clps2c-compiler/patches/dont_trim_leading_newline.patch 0 → 100644 +15 −0 Original line number Diff line number Diff line diff --git a/CLPS2C-Compiler/Program.cs b/CLPS2C-Compiler/Program.cs index 6991896..fe8cd5f 100644 --- a/CLPS2C-Compiler/CLPS2C-Compiler/Program.cs +++ b/CLPS2C-Compiler/CLPS2C-Compiler/Program.cs @@ -90,10 +90,6 @@ namespace CLPS2C_Compiler } else if (OutputLines.Count != 0) { - if (OutputLines[0].StartsWith(_newLine)) - { - OutputLines[0] = OutputLines[0].Substring(2); - } Output += string.Join("", OutputLines); // Convert to PNACH Format
pkgs/by-name/cl/clps2c-compiler/patches/keystone_set_targetframework.patch 0 → 100644 +13 −0 Original line number Diff line number Diff line diff --git a/bindings/csharp/Keystone.Net/Keystone.Net.csproj b/bindings/csharp/Keystone.Net/Keystone.Net.csproj index 04801b4..4c6fe15 100644 --- a/keystone/bindings/csharp/Keystone.Net/Keystone.Net.csproj +++ b/keystone/bindings/csharp/Keystone.Net/Keystone.Net.csproj @@ -1,7 +1,7 @@ <Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> - <TargetFramework>netstandard2.0</TargetFramework> + <TargetFramework>net8.0</TargetFramework> <RootNamespace>Keystone</RootNamespace> <Version>1.1.0</Version>