Skip to content

Commit

Permalink
Merge pull request CosmosOS#9 from CosmosOS/master
Browse files Browse the repository at this point in the history
New playground project for Emile
  • Loading branch information
Myvar committed May 11, 2015
2 parents bfe5d73 + 0d10ade commit 9cae768
Show file tree
Hide file tree
Showing 6 changed files with 180 additions and 0 deletions.
6 changes: 6 additions & 0 deletions Users/Emile/Emile.TestApp/App.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
</startup>
</configuration>
60 changes: 60 additions & 0 deletions Users/Emile/Emile.TestApp/Emile.TestApp.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{99A78D26-0277-4882-97BE-F5A0FA90CBCF}</ProjectGuid>
<OutputType>Exe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Emile.TestApp</RootNamespace>
<AssemblyName>Emile.TestApp</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="ReallySimpleAllocator.cs" />
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>
41 changes: 41 additions & 0 deletions Users/Emile/Emile.TestApp/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Emile.TestApp
{
internal class Program
{
private static unsafe void Main(string[] args)
{
var xMemoryBlock = new int[1024*1024*2];
var xMemoryBlockSize = xMemoryBlock.Length * 4;
// we have an 8 MB block now
fixed (int* xStart = &xMemoryBlock[0])
{
ReallySimpleAllocator.Initialize(xStart, xMemoryBlockSize);

// now you can just use if however you like:


// allocate a 1 kilobyte block
var xBlock1 = ReallySimpleAllocator.Allocate(1024);

// another one
var xBlock2 = ReallySimpleAllocator.Allocate(1024);

ReallySimpleAllocator.Free(xBlock1);
xBlock1 = ReallySimpleAllocator.Allocate(1024);

// etc



// there's no need to cleanup.
}

}
}
}
36 changes: 36 additions & 0 deletions Users/Emile/Emile.TestApp/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;

// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Emile.TestApp")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Emile.TestApp")]
[assembly: AssemblyCopyright("Copyright © 2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]

// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("e112ace8-b4a3-47a5-8b91-f189888846f7")]

// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
22 changes: 22 additions & 0 deletions Users/Emile/Emile.TestApp/ReallySimpleAllocator.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
using System;

namespace Emile.TestApp
{
public unsafe static class ReallySimpleAllocator
{
public static void Initialize(int* startAddress, int length)
{
throw new NotImplementedException();
}

public static int* Allocate(int length)
{
throw new NotImplementedException();
}

public static void Free(int* pointer)
{
throw new NotImplementedException();
}
}
}
15 changes: 15 additions & 0 deletions source/Cosmos.sln
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SentinelHAL", "..\Users\Sen
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ElfMap2DebugDb", "ElfMap2DebugDb\ElfMap2DebugDb.csproj", "{BD054B3B-D183-4C19-BBD3-E853B736818A}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Emile.TestApp", "..\Users\Emile\Emile.TestApp\Emile.TestApp.csproj", "{99A78D26-0277-4882-97BE-F5A0FA90CBCF}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -1046,6 +1048,18 @@ Global
{BD054B3B-D183-4C19-BBD3-E853B736818A}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{BD054B3B-D183-4C19-BBD3-E853B736818A}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{BD054B3B-D183-4C19-BBD3-E853B736818A}.Release|x86.ActiveCfg = Release|Any CPU
{99A78D26-0277-4882-97BE-F5A0FA90CBCF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{99A78D26-0277-4882-97BE-F5A0FA90CBCF}.Debug|Any CPU.Build.0 = Debug|Any CPU
{99A78D26-0277-4882-97BE-F5A0FA90CBCF}.Debug|Itanium.ActiveCfg = Debug|Any CPU
{99A78D26-0277-4882-97BE-F5A0FA90CBCF}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{99A78D26-0277-4882-97BE-F5A0FA90CBCF}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{99A78D26-0277-4882-97BE-F5A0FA90CBCF}.Debug|x86.ActiveCfg = Debug|Any CPU
{99A78D26-0277-4882-97BE-F5A0FA90CBCF}.Release|Any CPU.ActiveCfg = Release|Any CPU
{99A78D26-0277-4882-97BE-F5A0FA90CBCF}.Release|Any CPU.Build.0 = Release|Any CPU
{99A78D26-0277-4882-97BE-F5A0FA90CBCF}.Release|Itanium.ActiveCfg = Release|Any CPU
{99A78D26-0277-4882-97BE-F5A0FA90CBCF}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{99A78D26-0277-4882-97BE-F5A0FA90CBCF}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{99A78D26-0277-4882-97BE-F5A0FA90CBCF}.Release|x86.ActiveCfg = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down Expand Up @@ -1126,5 +1140,6 @@ Global
{C296973C-63D7-4A29-95B1-9FC6F36A83EE} = {45E223F1-F219-4D48-96EC-85E0E0065BE7}
{ABE135D1-ACF8-4C25-A5DF-A96F013242C5} = {45E223F1-F219-4D48-96EC-85E0E0065BE7}
{BD054B3B-D183-4C19-BBD3-E853B736818A} = {6A15C540-8278-4B9C-B890-FA57FB6AE6A6}
{99A78D26-0277-4882-97BE-F5A0FA90CBCF} = {EE39BC20-06D5-49F7-943A-58C1C1B179D3}
EndGlobalSection
EndGlobal

0 comments on commit 9cae768

Please sign in to comment.