diff options
author | Thomas Grill <xovo@users.sourceforge.net> | 2006-04-18 01:38:08 +0000 |
---|---|---|
committer | Thomas Grill <xovo@users.sourceforge.net> | 2006-04-18 01:38:08 +0000 |
commit | ed0031b621c6cf8824a9a3e588426907244aeb7e (patch) | |
tree | a797d5ee35b65b43f970f331cdee940d7aaced32 /Counter | |
parent | 4e7353f45954a8a5d9aaa3dd40eed3f9f62c2062 (diff) |
implemented class-based method management
very fast native-to-managed transition
most of the logic transferred to the CLR side
svn path=/trunk/externals/clr/; revision=4931
Diffstat (limited to 'Counter')
-rwxr-xr-x | Counter/Counter.cs | 31 | ||||
-rw-r--r-- | Counter/Counter.csproj | 212 |
2 files changed, 124 insertions, 119 deletions
diff --git a/Counter/Counter.cs b/Counter/Counter.cs index 416cb3b..7b370d9 100755 --- a/Counter/Counter.cs +++ b/Counter/Counter.cs @@ -1,29 +1,32 @@ using System; +using PureData; /// <summary> /// Descrizione di riepilogo per Counter. /// </summary> public class Counter: - PureData.External + External { int i_count,i_down,i_up; float step; - public Counter(PureData.AtomList args) + public Counter() { } + + public Counter(Atom[] args) { - this.step = args.Count >= 3?(float)args[2]:1; + this.step = args.Length >= 3?(float)args[2]:1; - float f2 = args.Count >= 2?(float)args[1]:0; - float f1 = args.Count >= 1?(float)args[0]:0; + float f2 = args.Length >= 2?(float)args[1]:0; + float f1 = args.Length >= 1?(float)args[0]:0; - if(args.Count < 2) f2 = f1; + if(args.Length < 2) f2 = f1; this.i_down = (int)((f1<f2)?f1:f2); this.i_up = (int)((f1>f2)?f1:f2); this.i_count = this.i_down; - AddInlet(_list,new PureData.Symbol("bound")); + AddInlet(_list,new Symbol("bound")); AddInlet(ref step); AddOutlet(_float); @@ -33,14 +36,15 @@ public class Counter: // this function MUST exist private static void Setup(Counter obj) { - AddMethod(0,new Method(obj.Bang)); - AddMethod(0,"reset",new Method(obj.Reset)); - AddMethod(0,"set",new MethodFloat(obj.Set)); - AddMethod(0,"bound",new MethodList(obj.Bound)); + AddMethod(obj.Bang); + AddMethod(0,"reset",obj.Reset); + AddMethod(0,"set",obj.Set); + AddMethod(0,"bound",obj.Bound); } protected void Bang() { + float f = this.i_count; int step = (int)this.step; this.i_count += step; @@ -56,7 +60,7 @@ public class Counter: } } - Outlet(0,f); + Outlet(0,f); } protected void Reset() @@ -69,7 +73,7 @@ public class Counter: this.i_count = (int)f; } - protected void Bound(PureData.AtomList args) + protected void Bound(Atom[] args) { float f1 = (float)args[0]; float f2 = (float)args[1]; @@ -77,5 +81,4 @@ public class Counter: this.i_down = (int)((f1<f2)?f1:f2); this.i_up = (int)((f1>f2)?f1:f2); } - } diff --git a/Counter/Counter.csproj b/Counter/Counter.csproj index 4502d55..ab8a5eb 100644 --- a/Counter/Counter.csproj +++ b/Counter/Counter.csproj @@ -1,105 +1,107 @@ -<VisualStudioProject> - <CSHARP - ProjectType = "Local" - ProductVersion = "7.10.3077" - SchemaVersion = "2.0" - ProjectGuid = "{8CFEFB15-2A72-45B5-BC99-3BAFFB2B27C3}" - > - <Build> - <Settings - ApplicationIcon = "" - AssemblyKeyContainerName = "" - AssemblyName = "Counter" - AssemblyOriginatorKeyFile = "" - DefaultClientScript = "JScript" - DefaultHTMLPageLayout = "Grid" - DefaultTargetSchema = "IE50" - DelaySign = "false" - OutputType = "Library" - PreBuildEvent = "" - PostBuildEvent = "" - RootNamespace = "Counter" - RunPostBuildEvent = "OnBuildSuccess" - StartupObject = "" - > - <Config - Name = "Debug" - AllowUnsafeBlocks = "false" - BaseAddress = "285212672" - CheckForOverflowUnderflow = "false" - ConfigurationOverrideFile = "" - DefineConstants = "DEBUG;TRACE" - DocumentationFile = "" - DebugSymbols = "true" - FileAlignment = "4096" - IncrementalBuild = "false" - NoStdLib = "false" - NoWarn = "" - Optimize = "false" - OutputPath = "bin\Debug\" - RegisterForComInterop = "false" - RemoveIntegerChecks = "false" - TreatWarningsAsErrors = "false" - WarningLevel = "4" - /> - <Config - Name = "Release" - AllowUnsafeBlocks = "false" - BaseAddress = "285212672" - CheckForOverflowUnderflow = "false" - ConfigurationOverrideFile = "" - DefineConstants = "TRACE" - DocumentationFile = "" - DebugSymbols = "false" - FileAlignment = "4096" - IncrementalBuild = "false" - NoStdLib = "false" - NoWarn = "" - Optimize = "true" - OutputPath = "bin\Release\" - RegisterForComInterop = "false" - RemoveIntegerChecks = "false" - TreatWarningsAsErrors = "false" - WarningLevel = "4" - /> - </Settings> - <References> - <Reference - Name = "System" - AssemblyName = "System" - HintPath = "..\..\..\..\..\WINDOWS\Microsoft.NET\Framework\v1.1.4322\System.dll" - /> - <Reference - Name = "System.Data" - AssemblyName = "System.Data" - HintPath = "..\..\..\..\..\WINDOWS\Microsoft.NET\Framework\v1.1.4322\System.Data.dll" - /> - <Reference - Name = "System.XML" - AssemblyName = "System.XML" - HintPath = "..\..\..\..\..\WINDOWS\Microsoft.NET\Framework\v1.1.4322\System.XML.dll" - /> - <Reference - Name = "PureData" - Project = "{0015D5E7-B0FB-4F06-B334-225447D1F992}" - Package = "{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}" - /> - </References> - </Build> - <Files> - <Include> - <File - RelPath = "AssemblyInfo.cs" - SubType = "Code" - BuildAction = "Compile" - /> - <File - RelPath = "Counter.cs" - SubType = "Code" - BuildAction = "Compile" - /> - </Include> - </Files> - </CSHARP> -</VisualStudioProject> - +<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <PropertyGroup> + <ProjectType>Local</ProjectType> + <ProductVersion>8.0.50727</ProductVersion> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{8CFEFB15-2A72-45B5-BC99-3BAFFB2B27C3}</ProjectGuid> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <ApplicationIcon> + </ApplicationIcon> + <AssemblyKeyContainerName> + </AssemblyKeyContainerName> + <AssemblyName>Counter</AssemblyName> + <AssemblyOriginatorKeyFile> + </AssemblyOriginatorKeyFile> + <DefaultClientScript>JScript</DefaultClientScript> + <DefaultHTMLPageLayout>Grid</DefaultHTMLPageLayout> + <DefaultTargetSchema>IE50</DefaultTargetSchema> + <DelaySign>false</DelaySign> + <OutputType>Library</OutputType> + <RootNamespace>Counter</RootNamespace> + <RunPostBuildEvent>OnBuildSuccess</RunPostBuildEvent> + <StartupObject> + </StartupObject> + <FileUpgradeFlags> + </FileUpgradeFlags> + <UpgradeBackupLocation> + </UpgradeBackupLocation> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + <OutputPath>bin\Debug\</OutputPath> + <AllowUnsafeBlocks>false</AllowUnsafeBlocks> + <BaseAddress>285212672</BaseAddress> + <CheckForOverflowUnderflow>false</CheckForOverflowUnderflow> + <ConfigurationOverrideFile> + </ConfigurationOverrideFile> + <DefineConstants>DEBUG;TRACE</DefineConstants> + <DocumentationFile> + </DocumentationFile> + <DebugSymbols>true</DebugSymbols> + <FileAlignment>4096</FileAlignment> + <NoStdLib>false</NoStdLib> + <NoWarn> + </NoWarn> + <Optimize>false</Optimize> + <RegisterForComInterop>false</RegisterForComInterop> + <RemoveIntegerChecks>false</RemoveIntegerChecks> + <TreatWarningsAsErrors>false</TreatWarningsAsErrors> + <WarningLevel>4</WarningLevel> + <DebugType>full</DebugType> + <ErrorReport>prompt</ErrorReport> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + <OutputPath>bin\Debug\</OutputPath> + <AllowUnsafeBlocks>false</AllowUnsafeBlocks> + <BaseAddress>285212672</BaseAddress> + <CheckForOverflowUnderflow>false</CheckForOverflowUnderflow> + <ConfigurationOverrideFile> + </ConfigurationOverrideFile> + <DefineConstants>DEBUG;TRACE</DefineConstants> + <DocumentationFile> + </DocumentationFile> + <DebugSymbols>false</DebugSymbols> + <FileAlignment>4096</FileAlignment> + <NoStdLib>false</NoStdLib> + <NoWarn> + </NoWarn> + <Optimize>true</Optimize> + <RegisterForComInterop>false</RegisterForComInterop> + <RemoveIntegerChecks>false</RemoveIntegerChecks> + <TreatWarningsAsErrors>false</TreatWarningsAsErrors> + <WarningLevel>4</WarningLevel> + <DebugType>none</DebugType> + <ErrorReport>prompt</ErrorReport> + </PropertyGroup> + <ItemGroup> + <Reference Include="System"> + <Name>System</Name> + </Reference> + <Reference Include="System.Data"> + <Name>System.Data</Name> + </Reference> + <Reference Include="System.XML"> + <Name>System.XML</Name> + </Reference> + <ProjectReference Include="..\PureData\PureData.csproj"> + <Name>PureData</Name> + <Project>{0015D5E7-B0FB-4F06-B334-225447D1F992}</Project> + <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package> + </ProjectReference> + </ItemGroup> + <ItemGroup> + <Compile Include="AssemblyInfo.cs"> + <SubType>Code</SubType> + </Compile> + <Compile Include="Counter.cs"> + <SubType>Code</SubType> + </Compile> + </ItemGroup> + <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> + <PropertyGroup> + <PreBuildEvent> + </PreBuildEvent> + <PostBuildEvent> + </PostBuildEvent> + </PropertyGroup> +</Project>
\ No newline at end of file |