diff options
Diffstat (limited to 'ClojureCLR/Clojure')
80 files changed, 11857 insertions, 0 deletions
diff --git a/ClojureCLR/Clojure/BootstrapCompile/BootstrapCompile.csproj b/ClojureCLR/Clojure/BootstrapCompile/BootstrapCompile.csproj new file mode 100644 index 00000000..fac50dff --- /dev/null +++ b/ClojureCLR/Clojure/BootstrapCompile/BootstrapCompile.csproj @@ -0,0 +1,65 @@ +<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <ProductVersion>9.0.30729</ProductVersion>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{3DBF3359-43B5-47C9-9E4D-CF50D7587F20}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <RootNamespace>BootstrapCompile</RootNamespace>
+ <AssemblyName>BootstrapCompile</AssemblyName>
+ <TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
+ <FileAlignment>512</FileAlignment>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ <DebugSymbols>true</DebugSymbols>
+ <DebugType>full</DebugType>
+ <Optimize>false</Optimize>
+ <OutputPath>bin\Debug\</OutputPath>
+ <DefineConstants>DEBUG;TRACE</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ <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">
+ <RequiredTargetFramework>3.5</RequiredTargetFramework>
+ </Reference>
+ <Reference Include="System.Xml.Linq">
+ <RequiredTargetFramework>3.5</RequiredTargetFramework>
+ </Reference>
+ <Reference Include="System.Data.DataSetExtensions">
+ <RequiredTargetFramework>3.5</RequiredTargetFramework>
+ </Reference>
+ <Reference Include="System.Data" />
+ <Reference Include="System.Xml" />
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="Compile.cs" />
+ <Compile Include="Properties\AssemblyInfo.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="..\Clojure\Clojure.csproj">
+ <Project>{B8089F66-DFBD-4906-BEE0-B317689C2524}</Project>
+ <Name>Clojure</Name>
+ </ProjectReference>
+ </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>
\ No newline at end of file diff --git a/ClojureCLR/Clojure/BootstrapCompile/Compile.cs b/ClojureCLR/Clojure/BootstrapCompile/Compile.cs new file mode 100644 index 00000000..72e09221 --- /dev/null +++ b/ClojureCLR/Clojure/BootstrapCompile/Compile.cs @@ -0,0 +1,75 @@ +using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.IO;
+using clojure.lang;
+using System.Collections;
+using System.Diagnostics;
+
+namespace BootstrapCompile
+{
+ static class Compile
+ {
+
+ const string PATH_PROP = "clojure.compile.path";
+ const string REFLECTION_WARNING_PROP = "clojure.compile.warn-on-reflection";
+
+ static void Main(string[] args)
+ {
+ TextWriter outTW = (TextWriter)RT.OUT.deref();
+ TextWriter errTW = (TextWriter)RT.ERR.deref();
+
+ string path = Environment.GetEnvironmentVariable(PATH_PROP);
+ // TODO: get rid of this when we have the full build process set up
+ path = path ?? ".";
+
+ if ( path == null )
+ {
+ errTW.WriteLine("ERROR: Must set system property {0}",PATH_PROP);
+ errTW.WriteLine("to the location for the compiled .class files.");
+ errTW.WriteLine("This directory must also be on your {0}.",RT.CLOJURE_LOAD_PATH);
+ Environment.Exit(1);
+ }
+
+ string warnVal = Environment.GetEnvironmentVariable(REFLECTION_WARNING_PROP);
+ bool warnOnReflection = warnVal == null ? false : warnVal.Equals(true);
+
+ try
+ {
+ Var.pushThreadBindings(RT.map(
+ Compiler.COMPILE_PATH,path,
+ RT.WARN_ON_REFLECTION,warnOnReflection
+ ));
+
+ Stopwatch sw = new Stopwatch();
+
+ foreach ( string lib in args )
+ {
+ sw.Reset();
+ sw.Start();
+ outTW.Write("Compiling {0} to {1}",lib,path);
+ outTW.Flush();
+ Compiler.COMPILE.invoke(Symbol.intern(lib));
+ sw.Stop();
+ outTW.WriteLine(" -- {0} milliseconds.", sw.ElapsedMilliseconds);
+ }
+ }
+ finally
+ {
+ Var.popThreadBindings();
+ try {
+ outTW.Flush();
+ outTW.Close();
+ }
+ catch ( IOException e)
+ {
+ errTW.WriteLine(e.StackTrace);
+ }
+ }
+
+
+
+ }
+ }
+}
diff --git a/ClojureCLR/Clojure/BootstrapCompile/Properties/AssemblyInfo.cs b/ClojureCLR/Clojure/BootstrapCompile/Properties/AssemblyInfo.cs new file mode 100644 index 00000000..d34a0349 --- /dev/null +++ b/ClojureCLR/Clojure/BootstrapCompile/Properties/AssemblyInfo.cs @@ -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("BootstrapCompile")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("BootstrapCompile")]
+[assembly: AssemblyCopyright("Copyright © 2009")]
+[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("5cd7f55f-06b5-4520-af3e-936776803b57")]
+
+// 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")]
diff --git a/ClojureCLR/Clojure/Clojure.Main/Clojure.Main.csproj b/ClojureCLR/Clojure/Clojure.Main/Clojure.Main.csproj new file mode 100644 index 00000000..3006d806 --- /dev/null +++ b/ClojureCLR/Clojure/Clojure.Main/Clojure.Main.csproj @@ -0,0 +1,73 @@ +<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <ProductVersion>9.0.30729</ProductVersion>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{A9B3BA9E-6955-43E6-9846-54DEFEDCFBFC}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <RootNamespace>Clojure.Main</RootNamespace>
+ <AssemblyName>Clojure.Main</AssemblyName>
+ <TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
+ <FileAlignment>512</FileAlignment>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ <DebugSymbols>true</DebugSymbols>
+ <DebugType>full</DebugType>
+ <Optimize>false</Optimize>
+ <OutputPath>bin\Debug\</OutputPath>
+ <DefineConstants>DEBUG;TRACE</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ <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">
+ <RequiredTargetFramework>3.5</RequiredTargetFramework>
+ </Reference>
+ <Reference Include="System.Xml.Linq">
+ <RequiredTargetFramework>3.5</RequiredTargetFramework>
+ </Reference>
+ <Reference Include="System.Data.DataSetExtensions">
+ <RequiredTargetFramework>3.5</RequiredTargetFramework>
+ </Reference>
+ <Reference Include="System.Data" />
+ <Reference Include="System.Xml" />
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="Main.cs" />
+ <Compile Include="Properties\AssemblyInfo.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="..\..\..\DLR_Main\Src\Runtime\Microsoft.Scripting.Core\Microsoft.Scripting.Core.csproj">
+ <Project>{2AE75F5A-CD1F-4925-9647-AF4D1C282FB4}</Project>
+ <Name>Microsoft.Scripting.Core</Name>
+ </ProjectReference>
+ <ProjectReference Include="..\..\..\DLR_Main\Src\Runtime\Microsoft.Scripting\Microsoft.Scripting.csproj">
+ <Project>{EB66B766-6354-4208-A3D4-AACBDCB5C3B3}</Project>
+ <Name>Microsoft.Scripting</Name>
+ </ProjectReference>
+ <ProjectReference Include="..\Clojure\Clojure.csproj">
+ <Project>{B8089F66-DFBD-4906-BEE0-B317689C2524}</Project>
+ <Name>Clojure</Name>
+ </ProjectReference>
+ </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>
\ No newline at end of file diff --git a/ClojureCLR/Clojure/Clojure.Main/Main.cs b/ClojureCLR/Clojure/Clojure.Main/Main.cs new file mode 100644 index 00000000..e98d9afc --- /dev/null +++ b/ClojureCLR/Clojure/Clojure.Main/Main.cs @@ -0,0 +1,38 @@ +using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using clojure.lang;
+
+namespace Clojure
+{
+ public static class CljMain
+ {
+ private static readonly Symbol CLOJURE_MAIN = Symbol.intern("clojure.main");
+ private static readonly Var REQUIRE = RT.var("clojure.core", "require");
+ private static readonly Var LEGACY_REPL = RT.var("clojure.main", "legacy-repl");
+ private static readonly Var LEGACY_SCRIPT = RT.var("clojure.main", "legacy-script");
+ private static readonly Var MAIN = RT.var("clojure.main", "main");
+
+ static void Main(string[] args)
+ {
+ REQUIRE.invoke(CLOJURE_MAIN);
+ MAIN.applyTo(RT.seq(args));
+ }
+
+ static void legacy_repl(string[] args)
+ {
+ REQUIRE.invoke(CLOJURE_MAIN);
+ LEGACY_REPL.invoke(RT.seq(args));
+
+ }
+
+ static void legacy_script(string[] args)
+ {
+ REQUIRE.invoke(CLOJURE_MAIN);
+ LEGACY_SCRIPT.invoke(RT.seq(args));
+ }
+
+
+ }
+}
diff --git a/ClojureCLR/Clojure/Clojure.Main/Properties/AssemblyInfo.cs b/ClojureCLR/Clojure/Clojure.Main/Properties/AssemblyInfo.cs new file mode 100644 index 00000000..e355cc52 --- /dev/null +++ b/ClojureCLR/Clojure/Clojure.Main/Properties/AssemblyInfo.cs @@ -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("Clojure.Main")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("Clojure.Main")]
+[assembly: AssemblyCopyright("Copyright © 2009")]
+[assembly: AssemblyTrademark("")]
|