Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Baulig <martin@novell.com>2006-02-16 17:02:48 +0300
committerMartin Baulig <martin@novell.com>2006-02-16 17:02:48 +0300
commit6c41e551400a0967946c0331354db8417a163241 (patch)
tree6d4aa68188635932c0f62c22fe07397c0203280d /mcs/class/Mono.C5
parent9f8b78196e56e92782404766d65451bcb8a6b156 (diff)
Bringing C5 1.0 into the main branch.
svn path=/trunk/mcs/; revision=56938
Diffstat (limited to 'mcs/class/Mono.C5')
-rw-r--r--mcs/class/Mono.C5/PreProcess/PreProcess.csproj30
-rw-r--r--mcs/class/Mono.C5/PreProcess/Program.cs72
2 files changed, 102 insertions, 0 deletions
diff --git a/mcs/class/Mono.C5/PreProcess/PreProcess.csproj b/mcs/class/Mono.C5/PreProcess/PreProcess.csproj
new file mode 100644
index 00000000000..282f96dbfe8
--- /dev/null
+++ b/mcs/class/Mono.C5/PreProcess/PreProcess.csproj
@@ -0,0 +1,30 @@
+<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <ProductVersion>8.0.40607</ProductVersion>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{6222CA51-7D1A-4D42-B6A7-B5CE9608C18F}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <RootNamespace>PreProcess</RootNamespace>
+ <AssemblyName>PreProcess</AssemblyName>
+ <WarningLevel>4</WarningLevel>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ <DebugSymbols>true</DebugSymbols>
+ <DebugType>full</DebugType>
+ <Optimize>false</Optimize>
+ <OutputPath>.\bin\Debug\</OutputPath>
+ <DefineConstants>DEBUG;TRACE</DefineConstants>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ <DebugSymbols>false</DebugSymbols>
+ <Optimize>true</Optimize>
+ <OutputPath>.\bin\Release\</OutputPath>
+ <DefineConstants>TRACE</DefineConstants>
+ </PropertyGroup>
+ <ItemGroup>
+ <Compile Include="Program.cs" />
+ </ItemGroup>
+ <Import Project="$(MSBuildBinPath)\Microsoft.CSHARP.Targets" />
+</Project> \ No newline at end of file
diff --git a/mcs/class/Mono.C5/PreProcess/Program.cs b/mcs/class/Mono.C5/PreProcess/Program.cs
new file mode 100644
index 00000000000..ca3e9f2c0f0
--- /dev/null
+++ b/mcs/class/Mono.C5/PreProcess/Program.cs
@@ -0,0 +1,72 @@
+/*
+ Copyright (c) 2003-2006 Niels Kokholm and Peter Sestoft
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in
+ all copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+
+using System;
+using System.Text;
+using System.IO;
+
+namespace PreProcess
+{
+ class Program
+ {
+ static void preprocess(string dir, string filein, string fileout, string symbol, string classin, string classout)
+ {
+ fileout = Path.Combine(dir, fileout);
+ string[] contents = File.ReadAllLines(Path.Combine(dir, filein));
+ string symboldef = "#define " + symbol + "not";
+ bool equal = File.Exists(fileout);
+ TextReader oldversion = equal ? new StreamReader(fileout) : null;
+ for (int lineno = 0; lineno < contents.Length; lineno++)
+ {
+ if (contents[lineno].StartsWith(symboldef))
+ contents[lineno] = "#define " + symbol;
+ else
+ contents[lineno] = contents[lineno].Replace(classin, classout);
+ if (equal)
+ equal = contents[lineno] == oldversion.ReadLine();
+ }
+ if (equal && oldversion.ReadLine() == null)
+ {
+ Console.Error.WriteLine("File {0} is up-to-date", fileout);
+ return;
+ }
+ File.WriteAllLines(fileout + "-new", contents);
+ if (oldversion != null)
+ {
+ oldversion.Close();
+ File.Replace(fileout + "-new", fileout, fileout + ".bak");
+ Console.Error.WriteLine("Updated {0}", fileout);
+ }
+ else
+ {
+ File.Move(fileout + "-new", fileout);
+ Console.Error.WriteLine("Created {0}", fileout);
+ }
+ }
+ static void Main(string[] args)
+ {
+ System.Environment.CurrentDirectory = @"..\..\..\C5";
+ preprocess("trees", "RedBlackTreeSet.cs", "RedBlackTreeBag.cs", "BAG", "TreeSet", "TreeBag");
+ preprocess("arrays", "ArrayList.cs", "HashedArrayList.cs", "HASHINDEX", "ArrayList", "HashedArrayList");
+ preprocess("linkedlists", "LinkedList.cs", "HashedLinkedList.cs", "HASHINDEX", "LinkedList", "HashedLinkedList");
+ }
+ }
+}