From d390096d17f30f5ce1fc587b3edd1aa7f1e2b779 Mon Sep 17 00:00:00 2001 From: Marcin Golebiowski Date: Tue, 6 Jul 2021 19:44:22 +0200 Subject: [PATCH 1/2] Use latest packages --- .../SpiceSharpParser.CodeAnalysis.csproj | 6 ++-- .../SpiceSharpParser.IntegrationTests.csproj | 6 ++-- .../SpiceSharpParser.PerformanceTests.csproj | 2 +- .../SpiceSharpParser.Tests.csproj | 4 +-- .../Spice/Evaluation/ExpressionResolver.cs | 2 -- .../Functions/Random/LimitFunction.cs | 29 ------------------- .../Evaluation/Functions/RandomFunctions.cs | 11 ------- .../ResolverFunctions/MaxResolverFunction.cs | 17 ----------- .../ResolverFunctions/MinResolverFunction.cs | 17 ----------- .../Evaluation/SpiceEvaluationContext.cs | 1 - src/SpiceSharpParser/SpiceSharpParser.csproj | 6 ++-- 11 files changed, 12 insertions(+), 89 deletions(-) delete mode 100644 src/SpiceSharpParser/ModelReaders/Netlist/Spice/Evaluation/Functions/Random/LimitFunction.cs delete mode 100644 src/SpiceSharpParser/ModelReaders/Netlist/Spice/Evaluation/ResolverFunctions/MaxResolverFunction.cs delete mode 100644 src/SpiceSharpParser/ModelReaders/Netlist/Spice/Evaluation/ResolverFunctions/MinResolverFunction.cs diff --git a/src/SpiceSharpParser.CodeAnalysis/SpiceSharpParser.CodeAnalysis.csproj b/src/SpiceSharpParser.CodeAnalysis/SpiceSharpParser.CodeAnalysis.csproj index 9e34ed42..8807477d 100644 --- a/src/SpiceSharpParser.CodeAnalysis/SpiceSharpParser.CodeAnalysis.csproj +++ b/src/SpiceSharpParser.CodeAnalysis/SpiceSharpParser.CodeAnalysis.csproj @@ -21,9 +21,9 @@ - - - + + + all runtime; build; native; contentfiles; analyzers diff --git a/src/SpiceSharpParser.IntegrationTests/SpiceSharpParser.IntegrationTests.csproj b/src/SpiceSharpParser.IntegrationTests/SpiceSharpParser.IntegrationTests.csproj index c5bcd4b2..04eedb1b 100644 --- a/src/SpiceSharpParser.IntegrationTests/SpiceSharpParser.IntegrationTests.csproj +++ b/src/SpiceSharpParser.IntegrationTests/SpiceSharpParser.IntegrationTests.csproj @@ -20,10 +20,10 @@ all runtime; build; native; contentfiles; analyzers; buildtransitive - + - - + + all diff --git a/src/SpiceSharpParser.PerformanceTests/SpiceSharpParser.PerformanceTests.csproj b/src/SpiceSharpParser.PerformanceTests/SpiceSharpParser.PerformanceTests.csproj index 252c56a8..2caca53b 100644 --- a/src/SpiceSharpParser.PerformanceTests/SpiceSharpParser.PerformanceTests.csproj +++ b/src/SpiceSharpParser.PerformanceTests/SpiceSharpParser.PerformanceTests.csproj @@ -9,7 +9,7 @@ - + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/src/SpiceSharpParser.Tests/SpiceSharpParser.Tests.csproj b/src/SpiceSharpParser.Tests/SpiceSharpParser.Tests.csproj index e17eab86..0bdb77cb 100644 --- a/src/SpiceSharpParser.Tests/SpiceSharpParser.Tests.csproj +++ b/src/SpiceSharpParser.Tests/SpiceSharpParser.Tests.csproj @@ -20,8 +20,8 @@ - - + + all runtime; build; native; contentfiles; analyzers diff --git a/src/SpiceSharpParser/ModelReaders/Netlist/Spice/Evaluation/ExpressionResolver.cs b/src/SpiceSharpParser/ModelReaders/Netlist/Spice/Evaluation/ExpressionResolver.cs index a1b09920..80cb4b3d 100644 --- a/src/SpiceSharpParser/ModelReaders/Netlist/Spice/Evaluation/ExpressionResolver.cs +++ b/src/SpiceSharpParser/ModelReaders/Netlist/Spice/Evaluation/ExpressionResolver.cs @@ -138,8 +138,6 @@ public Dictionary CreateFunctions() result["poly"] = new PolyResolverFunction(); result["if"] = new IfResolverFunction(); - result["max"] = new MaxResolverFunction(); - result["min"] = new MinResolverFunction(); result["random"] = new RandomResolverFunction(Context); result["gauss"] = new GaussResolverFunction(Context); diff --git a/src/SpiceSharpParser/ModelReaders/Netlist/Spice/Evaluation/Functions/Random/LimitFunction.cs b/src/SpiceSharpParser/ModelReaders/Netlist/Spice/Evaluation/Functions/Random/LimitFunction.cs deleted file mode 100644 index fcb60c77..00000000 --- a/src/SpiceSharpParser/ModelReaders/Netlist/Spice/Evaluation/Functions/Random/LimitFunction.cs +++ /dev/null @@ -1,29 +0,0 @@ -using SpiceSharpParser.Common; - -namespace SpiceSharpParser.ModelReaders.Netlist.Spice.Evaluation.Functions.Random -{ - public class LimitFunction : Function - { - public LimitFunction() - { - Name = "limit"; - ArgumentsCount = 2; - } - - public override double Logic(string image, double[] args, EvaluationContext context) - { - if (args.Length != 2) - { - throw new SpiceSharpParserException("limit expects two arguments: nominal_val, abs_variation"); - } - - var random = context.Randomizer.GetRandomDoubleProvider(); - - double dRand = (2.0 * random.NextDouble()) - 1.0; - double nominal = args[0]; - double variation = args[1]; - - return nominal + (dRand > 0 ? variation : -1 * variation); - } - } -} \ No newline at end of file diff --git a/src/SpiceSharpParser/ModelReaders/Netlist/Spice/Evaluation/Functions/RandomFunctions.cs b/src/SpiceSharpParser/ModelReaders/Netlist/Spice/Evaluation/Functions/RandomFunctions.cs index 38407473..b379720a 100644 --- a/src/SpiceSharpParser/ModelReaders/Netlist/Spice/Evaluation/Functions/RandomFunctions.cs +++ b/src/SpiceSharpParser/ModelReaders/Netlist/Spice/Evaluation/Functions/RandomFunctions.cs @@ -59,17 +59,6 @@ public static IFunction CreateFlat() return new FlatFunction(); } - /// - /// Get a limit() function. - /// - /// - /// A new instance of limit function. - /// - public static IFunction CreateLimit() - { - return new LimitFunction(); - } - /// /// Get a unif() function. /// diff --git a/src/SpiceSharpParser/ModelReaders/Netlist/Spice/Evaluation/ResolverFunctions/MaxResolverFunction.cs b/src/SpiceSharpParser/ModelReaders/Netlist/Spice/Evaluation/ResolverFunctions/MaxResolverFunction.cs deleted file mode 100644 index 45fde6cd..00000000 --- a/src/SpiceSharpParser/ModelReaders/Netlist/Spice/Evaluation/ResolverFunctions/MaxResolverFunction.cs +++ /dev/null @@ -1,17 +0,0 @@ -using SpiceSharpBehavioral.Parsers.Nodes; - -namespace SpiceSharpParser.ModelReaders.Netlist.Spice.Evaluation.ResolverFunctions -{ - public class MaxResolverFunction : DynamicResolverFunction - { - public MaxResolverFunction() - { - Name = "max"; - } - - public override Node GetBody(Node[] argumentValues) - { - return TernaryOperatorNode.Conditional(Node.GreaterThan(argumentValues[0], argumentValues[1]), argumentValues[0], argumentValues[1]); - } - } -} diff --git a/src/SpiceSharpParser/ModelReaders/Netlist/Spice/Evaluation/ResolverFunctions/MinResolverFunction.cs b/src/SpiceSharpParser/ModelReaders/Netlist/Spice/Evaluation/ResolverFunctions/MinResolverFunction.cs deleted file mode 100644 index 736320e0..00000000 --- a/src/SpiceSharpParser/ModelReaders/Netlist/Spice/Evaluation/ResolverFunctions/MinResolverFunction.cs +++ /dev/null @@ -1,17 +0,0 @@ -using SpiceSharpBehavioral.Parsers.Nodes; - -namespace SpiceSharpParser.ModelReaders.Netlist.Spice.Evaluation.ResolverFunctions -{ - public class MinResolverFunction : DynamicResolverFunction - { - public MinResolverFunction() - { - Name = "min"; - } - - public override Node GetBody(Node[] argumentValues) - { - return TernaryOperatorNode.Conditional(Node.LessThan(argumentValues[0], argumentValues[1]), argumentValues[0], argumentValues[1]); - } - } -} diff --git a/src/SpiceSharpParser/ModelReaders/Netlist/Spice/Evaluation/SpiceEvaluationContext.cs b/src/SpiceSharpParser/ModelReaders/Netlist/Spice/Evaluation/SpiceEvaluationContext.cs index 1d67d560..9e5ee15c 100644 --- a/src/SpiceSharpParser/ModelReaders/Netlist/Spice/Evaluation/SpiceEvaluationContext.cs +++ b/src/SpiceSharpParser/ModelReaders/Netlist/Spice/Evaluation/SpiceEvaluationContext.cs @@ -48,7 +48,6 @@ private void CreateSpiceFunctions() MathFunctions.CreateInt(), MathFunctions.CreateInv(), MathFunctions.CreateLimit(), - RandomFunctions.CreateLimit(), RandomFunctions.CreateMc(), MathFunctions.CreateNint(), RandomFunctions.CreateRandom(), diff --git a/src/SpiceSharpParser/SpiceSharpParser.csproj b/src/SpiceSharpParser/SpiceSharpParser.csproj index 2c39bd88..204e5742 100644 --- a/src/SpiceSharpParser/SpiceSharpParser.csproj +++ b/src/SpiceSharpParser/SpiceSharpParser.csproj @@ -35,9 +35,9 @@ - - - + + + all runtime; build; native; contentfiles; analyzers; buildtransitive From b7dc4b4a8509d540bb79a604e9481d6d398477cd Mon Sep 17 00:00:00 2001 From: Marcin Golebiowski Date: Tue, 6 Jul 2021 19:50:14 +0200 Subject: [PATCH 2/2] Update package version --- src/SpiceSharpParser/SpiceSharpParser.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/SpiceSharpParser/SpiceSharpParser.csproj b/src/SpiceSharpParser/SpiceSharpParser.csproj index 204e5742..213866cd 100644 --- a/src/SpiceSharpParser/SpiceSharpParser.csproj +++ b/src/SpiceSharpParser/SpiceSharpParser.csproj @@ -22,7 +22,7 @@ MIT latest - 3.1.0 + 3.1.1