Initial function project commit

This commit is contained in:
Jordan Wages 2025-08-19 23:45:55 -05:00
commit 49902cda2a
7 changed files with 97 additions and 9 deletions

View file

@ -10,5 +10,11 @@ namespace csmic
{
public required string Name { get; set; }
public required FunctionValue Value { get; set; }
public FunctionArgument(string name, FunctionValue fv)
{
this.Name = name;
this.Value = fv;
}
}
}

View 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>

View file

@ -5,10 +5,15 @@
<RootNamespace>cs_mic.core</RootNamespace>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<GeneratePackageOnBuild>False</GeneratePackageOnBuild>
<Version>2.0.0-beta-01</Version>
<PackageId>cs-mic</PackageId>
</PropertyGroup>
<Target Name="PreBuild" BeforeTargets="PreBuildEvent">
<Exec Command="dotnet tool run coco -namespace csmic.Interpreter -frames $(ProjectDir)cocor $(ProjectDir)cocor/Interpreter.atg" />
</Target>
<Import Project="NuGetPublish.targets" Condition="Exists('NuGetPublish.targets')" />
</Project>

View file

@ -12,6 +12,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "tests", "tests\tests.csproj", "{F356A0E2-1338-43FE-B4C0-1AE7C9F0685F}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "stdlib", "stdlib\stdlib.csproj", "{F7AD600D-4247-49CE-9A26-B20C6F2FF6AE}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
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}.Release|Any CPU.ActiveCfg = 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
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE

21
src/stdlib/Constants.cs Normal file
View 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");
}
}
}

View 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
View 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>