Initial function project commit
This commit is contained in:
parent
0e230f7a49
commit
49902cda2a
7 changed files with 97 additions and 9 deletions
|
@ -10,5 +10,11 @@ namespace csmic
|
||||||
{
|
{
|
||||||
public required string Name { get; set; }
|
public required string Name { get; set; }
|
||||||
public required FunctionValue Value { get; set; }
|
public required FunctionValue Value { get; set; }
|
||||||
|
|
||||||
|
public FunctionArgument(string name, FunctionValue fv)
|
||||||
|
{
|
||||||
|
this.Name = name;
|
||||||
|
this.Value = fv;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
6
src/core/NuGetPublish.targets
Normal file
6
src/core/NuGetPublish.targets
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<!-- Placeholder target file for NuGet publishing -->
|
||||||
|
<Target Name="PublishNuGet" AfterTargets="Pack">
|
||||||
|
<Exec Command="dotnet nuget push --source wagenet-git bin\Release\cs-mic.$(Version).nupkg" />
|
||||||
|
</Target>
|
||||||
|
</Project>
|
|
@ -1,14 +1,19 @@
|
||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>net9.0</TargetFramework>
|
<TargetFramework>net9.0</TargetFramework>
|
||||||
<RootNamespace>cs_mic.core</RootNamespace>
|
<RootNamespace>cs_mic.core</RootNamespace>
|
||||||
<ImplicitUsings>enable</ImplicitUsings>
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
</PropertyGroup>
|
<GeneratePackageOnBuild>False</GeneratePackageOnBuild>
|
||||||
|
<Version>2.0.0-beta-01</Version>
|
||||||
|
<PackageId>cs-mic</PackageId>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
<Target Name="PreBuild" BeforeTargets="PreBuildEvent">
|
<Target Name="PreBuild" BeforeTargets="PreBuildEvent">
|
||||||
<Exec Command="dotnet tool run coco -namespace csmic.Interpreter -frames $(ProjectDir)cocor $(ProjectDir)cocor/Interpreter.atg" />
|
<Exec Command="dotnet tool run coco -namespace csmic.Interpreter -frames $(ProjectDir)cocor $(ProjectDir)cocor/Interpreter.atg" />
|
||||||
</Target>
|
</Target>
|
||||||
|
|
||||||
|
<Import Project="NuGetPublish.targets" Condition="Exists('NuGetPublish.targets')" />
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
|
|
@ -12,6 +12,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
|
||||||
EndProject
|
EndProject
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "tests", "tests\tests.csproj", "{F356A0E2-1338-43FE-B4C0-1AE7C9F0685F}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "tests", "tests\tests.csproj", "{F356A0E2-1338-43FE-B4C0-1AE7C9F0685F}"
|
||||||
EndProject
|
EndProject
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "stdlib", "stdlib\stdlib.csproj", "{F7AD600D-4247-49CE-9A26-B20C6F2FF6AE}"
|
||||||
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
Debug|Any CPU = Debug|Any CPU
|
Debug|Any CPU = Debug|Any CPU
|
||||||
|
@ -27,6 +29,10 @@ Global
|
||||||
{F356A0E2-1338-43FE-B4C0-1AE7C9F0685F}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{F356A0E2-1338-43FE-B4C0-1AE7C9F0685F}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
{F356A0E2-1338-43FE-B4C0-1AE7C9F0685F}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
{F356A0E2-1338-43FE-B4C0-1AE7C9F0685F}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
{F356A0E2-1338-43FE-B4C0-1AE7C9F0685F}.Release|Any CPU.Build.0 = Release|Any CPU
|
{F356A0E2-1338-43FE-B4C0-1AE7C9F0685F}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{F7AD600D-4247-49CE-9A26-B20C6F2FF6AE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{F7AD600D-4247-49CE-9A26-B20C6F2FF6AE}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{F7AD600D-4247-49CE-9A26-B20C6F2FF6AE}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{F7AD600D-4247-49CE-9A26-B20C6F2FF6AE}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
HideSolutionNode = FALSE
|
HideSolutionNode = FALSE
|
||||||
|
|
21
src/stdlib/Constants.cs
Normal file
21
src/stdlib/Constants.cs
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
namespace csmic.stdlib
|
||||||
|
{
|
||||||
|
public class Constants
|
||||||
|
{
|
||||||
|
public void Initialize(InputInterpreter inputInterpreter)
|
||||||
|
{
|
||||||
|
if(inputInterpreter == null)
|
||||||
|
{
|
||||||
|
throw new ArgumentNullException("inputInterpreter", "Cannot initialize a null InputInterpreter.");
|
||||||
|
}
|
||||||
|
|
||||||
|
inputInterpreter.Interpret("pi :: 3.1415926535897931");
|
||||||
|
inputInterpreter.Interpret("e :: 2.7182818284590451");
|
||||||
|
inputInterpreter.Interpret("tau :: 6.2831853071795862");
|
||||||
|
inputInterpreter.Interpret("phi :: 1.6180339887498948");
|
||||||
|
inputInterpreter.Interpret("goldenratio :: 1.6180339887498948");
|
||||||
|
inputInterpreter.Interpret("eurler :: 0.5772156649015329");
|
||||||
|
inputInterpreter.Interpret("omega :: 0.5671432904097839");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
27
src/stdlib/functions/AbsoluteValue.cs
Normal file
27
src/stdlib/functions/AbsoluteValue.cs
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
using csmic;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace stdlib.functions
|
||||||
|
{
|
||||||
|
public class AbsoluteValue : ICodedFunction
|
||||||
|
{
|
||||||
|
public IEnumerable<FunctionArgument> ExpectedArguments
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
yield return new FunctionArgument() { };
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public FunctionValue ReturnValue => throw new NotImplementedException();
|
||||||
|
|
||||||
|
public FunctionValue Execute(params FunctionArgument[] args)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
17
src/stdlib/stdlib.csproj
Normal file
17
src/stdlib/stdlib.csproj
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<TargetFramework>net9.0</TargetFramework>
|
||||||
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
|
<Nullable>enable</Nullable>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\core\core.csproj" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<Folder Include="functions\hyperbolic\" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
</Project>
|
Loading…
Add table
Add a link
Reference in a new issue