[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Dotgnu-pnet-commits] CVS: pnetlib/System/CodeDom/Compiler CodeGenerator
From: |
Rhys Weatherley <address@hidden> |
Subject: |
[Dotgnu-pnet-commits] CVS: pnetlib/System/CodeDom/Compiler CodeGeneratorOptions.cs,NONE,1.1 CodeParser.cs,NONE,1.1 CompilerError.cs,NONE,1.1 CompilerErrorCollection.cs,NONE,1.1 CompilerParameters.cs,NONE,1.1 CompilerResults.cs,NONE,1.1 Executor.cs,NONE,1.1 GeneratorSupport.cs,NONE,1.1 ICodeCompiler.cs,NONE,1.1 ICodeGenerator.cs,NONE,1.1 ICodeParser.cs,NONE,1.1 IndentedTextWriter.cs,NONE,1.1 LanguageOptions.cs,NONE,1.1 Makefile,NONE,1.1 TempFileCollection.cs,NONE,1.1 |
Date: |
Fri, 15 Nov 2002 02:47:01 -0500 |
Update of /cvsroot/dotgnu-pnet/pnetlib/System/CodeDom/Compiler
In directory subversions:/tmp/cvs-serv15320/System/CodeDom/Compiler
Added Files:
CodeGeneratorOptions.cs CodeParser.cs CompilerError.cs
CompilerErrorCollection.cs CompilerParameters.cs
CompilerResults.cs Executor.cs GeneratorSupport.cs
ICodeCompiler.cs ICodeGenerator.cs ICodeParser.cs
IndentedTextWriter.cs LanguageOptions.cs Makefile
TempFileCollection.cs
Log Message:
Implement some of the classes in the "System.CodeDom.Compiler" namespace.
--- NEW FILE ---
/*
* CodeGeneratorOptions.cs - Implementation of the
* System.CodeDom.Compiler.CodeGeneratorOptions class.
*
* Copyright (C) 2002 Southern Storm Software, Pty Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
namespace System.CodeDom.Compiler
{
#if !ECMA_COMPAT
using System.Collections.Specialized;
public class CodeGeneratorOptions
{
// Internal state.
private ListDictionary list;
// Constructor.
public CodeGeneratorOptions()
{
list = new ListDictionary();
}
// Properties.
public bool BlankLinesBetweenMembers
{
get
{
Object value =
list["BlankLinesBetweenMembers"];
if(value != null)
{
return (bool)value;
}
else
{
return true;
}
}
set
{
list["BlankLinesBetweenMembers"] =
value;
}
}
public String BracingStyle
{
get
{
Object value = list["BracingStyle"];
if(value != null)
{
return (String)value;
}
else
{
return "Block";
}
}
set
{
list["BracingStyle"] = value;
}
}
public bool ElseOnClosing
{
get
{
Object value = list["ElseOnClosing"];
if(value != null)
{
return (bool)value;
}
else
{
return false;
}
}
set
{
list["ElseOnClosing"] = value;
}
}
public String IndentString
{
get
{
Object value = list["IndentString"];
if(value != null)
{
return (String)value;
}
else
{
return " ";
}
}
set
{
list["IndentString"] = value;
}
}
public Object this[String index]
{
get
{
return list[index];
}
set
{
list[index] = value;
}
}
}; // class CodeGeneratorOptions
#endif // !ECMA_COMPAT
}; // namespace System.CodeDom.Compiler
--- NEW FILE ---
/*
* CodeParser.cs - Implementation of the
* System.CodeDom.Compiler.CodeParser class.
*
* Copyright (C) 2002 Southern Storm Software, Pty Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
namespace System.CodeDom.Compiler
{
#if !ECMA_COMPAT
using System.IO;
public abstract class CodeParser : ICodeParser
{
// Constructor.
protected CodeParser() {}
// Implement the ICodeParser interface.
public abstract CodeCompileUnit Parse(TextReader codeStream);
}; // class CodeParser
#endif // !ECMA_COMPAT
}; // namespace System.CodeDom.Compiler
--- NEW FILE ---
/*
* CompilerError.cs - Implementation of the
* System.CodeDom.Compiler.CompilerError class.
*
* Copyright (C) 2002 Southern Storm Software, Pty Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
namespace System.CodeDom.Compiler
{
#if !ECMA_COMPAT
public class CompilerError
{
// Internal state.
private String fileName;
private int line;
private int column;
private String errorNumber;
private String errorText;
private bool isWarning;
// Constructors.
public CompilerError()
{
this.fileName = String.Empty;
this.line = 0;
this.column = 0;
this.errorNumber = String.Empty;
this.errorText = String.Empty;
this.isWarning = false;
}
public CompilerError(String fileName, int line, int column,
String errorNumber, String
errorText)
{
this.fileName = fileName;
this.line = line;
this.column = column;
this.errorNumber = errorNumber;
this.errorText = errorText;
this.isWarning = false;
}
// Properties.
public int Column
{
get
{
return column;
}
set
{
column = value;
}
}
public String ErrorNumber
{
get
{
return errorNumber;
}
set
{
errorNumber = value;
}
}
public String ErrorText
{
get
{
return errorText;
}
set
{
errorText = value;
}
}
public String FileName
{
get
{
return fileName;
}
set
{
fileName = value;
}
}
public bool IsWarning
{
get
{
return isWarning;
}
set
{
isWarning = value;
}
}
public int Line
{
get
{
return line;
}
set
{
line = value;
}
}
// Convert this error into a string.
public override String ToString()
{
// TODO
return null;
}
}; // class CompilerError
#endif // !ECMA_COMPAT
}; // namespace System.CodeDom.Compiler
--- NEW FILE ---
/*
* CompilerErrorCollection.cs - Implementation of the
* System.CodeDom.Compiler.CompilerErrorCollection class.
*
* Copyright (C) 2002 Southern Storm Software, Pty Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
namespace System.CodeDom.Compiler
{
#if !ECMA_COMPAT
using System.Collections;
public class CompilerErrorCollection : CollectionBase
{
// Constructors.
public CompilerErrorCollection()
{
}
public CompilerErrorCollection(CompilerError[] value)
{
AddRange(value);
}
public CompilerErrorCollection(CompilerErrorCollection value)
{
AddRange(value);
}
// Properties.
public bool HasErrors
{
get
{
if(Count == 0)
{
return false;
}
foreach(CompilerError error in this)
{
if(!(error.IsWarning))
{
return true;
}
}
return false;
}
}
public bool HasWarnings
{
get
{
if(Count == 0)
{
return false;
}
foreach(CompilerError error in this)
{
if(error.IsWarning)
{
return true;
}
}
return false;
}
}
public CompilerError this[int index]
{
get
{
return (CompilerError)(List[index]);
}
set
{
List[index] = value;
}
}
// Add an error to this collection.
public int Add(CompilerError value)
{
return List.Add(value);
}
// Add a range of errors to this collection.
public void AddRange(CompilerError[] value)
{
foreach(CompilerError error in value)
{
List.Add(error);
}
}
public void AddRange(CompilerErrorCollection value)
{
foreach(CompilerError error in value)
{
List.Add(error);
}
}
// Determine if this collection contains a specific error.
public bool Contains(CompilerError value)
{
return List.Contains(value);
}
// Copy the contents of this collection to an array.
public void CopyTo(CompilerError[] array, int index)
{
List.CopyTo(array, index);
}
// Get the index of a specific error in this collection.
public int IndexOf(CompilerError value)
{
return List.IndexOf(value);
}
// Insert an error into this collection.
public void Insert(int index, CompilerError value)
{
List.Insert(index, value);
}
// Remove an error from this collection.
public void Remove(CompilerError value)
{
int index = List.IndexOf(value);
if(index < 0)
{
throw new ArgumentException
(S._("Arg_NotCollMember"),
"value");
}
List.RemoveAt(index);
}
}; // class CompilerErrorCollection
#endif // !ECMA_COMPAT
}; // namespace System.CodeDom.Compiler
--- NEW FILE ---
/*
* CompilerParameters.cs - Implementation of the
* System.CodeDom.Compiler.CompilerParameters class.
*
* Copyright (C) 2002 Southern Storm Software, Pty Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
namespace System.CodeDom.Compiler
{
#if !ECMA_COMPAT
using System.Collections.Specialized;
using System.Runtime.InteropServices;
[ComVisible(true)]
public class CompilerParameters
{
// Internal state.
private StringCollection referencedAssemblies;
private String outputName;
private bool includeDebugInformation;
private String compilerOptions;
private bool generateExecutable;
private bool generateInMemory;
private String mainClass;
private TempFileCollection tempFiles;
private bool treatWarningsAsErrors;
private IntPtr userToken;
private int warningLevel;
private String win32Resource;
// Constructors.
public CompilerParameters()
: this(null, null, false)
{
// Nothing to do here
}
public CompilerParameters(String[] assemblyNames)
: this(assemblyNames, null, false)
{
// Nothing to do here
}
public CompilerParameters(String[] assemblyNames, String outputName)
: this(assemblyNames, outputName, false)
{
// Nothing to do here
}
public CompilerParameters(String[] assemblyNames, String outputName,
bool
includeDebugInformation)
{
this.outputName = outputName;
this.includeDebugInformation =
includeDebugInformation;
this.warningLevel = -1;
if(assemblyNames != null)
{
ReferencedAssemblies.AddRange(assemblyNames);
}
}
// Properties.
public String CompilerOptions
{
get
{
return compilerOptions;
}
set
{
compilerOptions = value;
}
}
public bool GenerateExecutable
{
get
{
return generateExecutable;
}
set
{
generateExecutable = value;
}
}
public bool GenerateInMemory
{
get
{
return generateInMemory;
}
set
{
generateInMemory = value;
}
}
public bool IncludeDebugInformation
{
get
{
return includeDebugInformation;
}
set
{
includeDebugInformation = value;
}
}
public String MainClass
{
get
{
return mainClass;
}
set
{
mainClass = value;
}
}
public String OutputAssembly
{
get
{
return outputName;
}
set
{
outputName = value;
}
}
public StringCollection ReferencedAssemblies
{
get
{
if(referencedAssemblies == null)
{
referencedAssemblies = new
StringCollection();
}
return referencedAssemblies;
}
}
public TempFileCollection TempFiles
{
get
{
if(tempFiles == null)
{
tempFiles = new
TempFileCollection();
}
return tempFiles;
}
set
{
tempFiles = value;
}
}
public bool TreatWarningsAsErrors
{
get
{
return treatWarningsAsErrors;
}
set
{
treatWarningsAsErrors = value;
}
}
public IntPtr UserToken
{
get
{
return userToken;
}
set
{
userToken = value;
}
}
public int WarningLevel
{
get
{
return warningLevel;
}
set
{
warningLevel = value;
}
}
public String Win32Resource
{
get
{
return win32Resource;
}
set
{
win32Resource = value;
}
}
}; // class CompilerParameters
#endif // !ECMA_COMPAT
}; // namespace System.CodeDom.Compiler
--- NEW FILE ---
/*
* CompilerResults.cs - Implementation of the
* System.CodeDom.Compiler.CompilerResults class.
*
* Copyright (C) 2002 Southern Storm Software, Pty Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
namespace System.CodeDom.Compiler
{
#if !ECMA_COMPAT
using System.Collections.Specialized;
using System.Reflection;
public class CompilerResults
{
// Internal state.
private TempFileCollection tempFiles;
private Assembly compiledAssembly;
private CompilerErrorCollection errors;
private int nativeCompilerReturnValue;
private StringCollection output;
private String pathToAssembly;
// Constructor.
public CompilerResults(TempFileCollection tempFiles)
{
this.tempFiles = tempFiles;
}
// Properties.
public Assembly CompiledAssembly
{
get
{
return compiledAssembly;
}
set
{
compiledAssembly = value;
}
}
public CompilerErrorCollection Errors
{
get
{
if(errors == null)
{
errors = new
CompilerErrorCollection();
}
return errors;
}
}
public int NativeCompilerReturnValue
{
get
{
return nativeCompilerReturnValue;
}
set
{
nativeCompilerReturnValue = value;
}
}
public StringCollection Output
{
get
{
if(output == null)
{
output = new StringCollection();
}
return output;
}
}
public String PathToAssembly
{
get
{
return pathToAssembly;
}
set
{
pathToAssembly = value;
}
}
public TempFileCollection TempFiles
{
get
{
return tempFiles;
}
set
{
tempFiles = value;
}
}
}; // class CompilerResults
#endif // !ECMA_COMPAT
}; // namespace System.CodeDom.Compiler
--- NEW FILE ---
/*
* Executor.cs - Implementation of the
* System.CodeDom.Compiler.Executor class.
*
* Copyright (C) 2002 Southern Storm Software, Pty Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
namespace System.CodeDom.Compiler
{
#if !ECMA_COMPAT
public sealed class Executor
{
// Execute the compiler and wait for it to return.
public static void ExecWait(String cmd, TempFileCollection tempFiles)
{
String outputName = null;
String errorName = null;
ExecWaitWithCapture(IntPtr.Zero, cmd, null,
tempFiles,
ref
outputName, ref errorName);
}
// Execute the compiler and capture its output.
public static int ExecWaitWithCapture
(String cmd, TempFileCollection tempFiles,
ref String outputName, ref String errorName)
{
return ExecWaitWithCapture(IntPtr.Zero, cmd,
null,
tempFiles, ref outputName,
ref errorName);
}
public static int ExecWaitWithCapture
(IntPtr userToken, String cmd,
TempFileCollection tempFiles,
ref String outputName, ref String errorName)
{
return ExecWaitWithCapture(userToken, cmd, null,
tempFiles, ref outputName,
ref errorName);
}
public static int ExecWaitWithCapture
(String cmd, String currentDir,
TempFileCollection tempFiles,
ref String outputName, ref String errorName)
{
return ExecWaitWithCapture(IntPtr.Zero, cmd,
currentDir,
tempFiles, ref outputName,
ref errorName);
}
public static int ExecWaitWithCapture
(IntPtr userToken, String cmd, String
currentDir,
TempFileCollection tempFiles, ref String
outputName,
ref String errorName)
{
// We do not allow the compiler to be launched
this way
// as it is a severe security threat to allow
arbitrary
// command-lines to be passed to the underlying
system.
// Besides, Unix-style systems don't like
command lines
// that consist of a single string. Use
ICodeCompiler
// to compile source files instead of this
class.
throw new NotImplementedException();
}
}; // class Executor
#endif // !ECMA_COMPAT
}; // namespace System.CodeDom.Compiler
--- NEW FILE ---
/*
* GeneratorSupport.cs - Implementation of the
* System.CodeDom.Compiler.GeneratorSupport class.
*
* Copyright (C) 2002 Southern Storm Software, Pty Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
namespace System.CodeDom.Compiler
{
#if !ECMA_COMPAT
[Flags]
public enum GeneratorSupport
{
ArraysOfArrays = 0x00000001,
EntryPointMethod = 0x00000002,
GotoStatements = 0x00000004,
[Obsolete("Use GotoStatements instead")]
GotoStatments = 0x00000004,
MultidimensionalArrays = 0x00000008,
StaticConstructors = 0x00000010,
TryCatchStatements = 0x00000020,
ReturnTypeAttributes = 0x00000040,
DeclareValueTypes = 0x00000080,
DeclareEnums = 0x00000100,
DeclareDelegates = 0x00000200,
DeclareInterfaces = 0x00000400,
DeclareEvents = 0x00000800,
AssemblyAttributes = 0x00001000,
ParameterAttributes = 0x00002000,
ReferenceParameters = 0x00004000,
ChainedConstructorArguments = 0x00008000,
NestedTypes = 0x00010000,
MultipleInterfaceMembers = 0x00020000,
PublicStaticMembers = 0x00040000,
ComplexExpressions = 0x00080000,
Win32Resources = 0x00100000
}; // enum GeneratorSupport
#endif // !ECMA_COMPAT
}; // namespace System.CodeDom.Compiler
--- NEW FILE ---
/*
* ICodeCompiler.cs - Implementation of the
* System.CodeDom.Compiler.ICodeCompiler class.
*
* Copyright (C) 2002 Southern Storm Software, Pty Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
namespace System.CodeDom.Compiler
{
#if !ECMA_COMPAT
public interface ICodeCompiler
{
// Compile an assembly from a CodeDom compile unit.
CompilerResults CompileAssemblyFromDom
(CompilerParameters options, CodeCompileUnit
compilationUnit);
// Compile an assembly from an array of CodeDom compile units.
CompilerResults CompileAssemblyFromDomBatch
(CompilerParameters options, CodeCompileUnit[]
compilationUnits);
// Compile an assembly from the contents of a source file.
CompilerResults CompileAssemblyFromFile
(CompilerParameters options, String fileName);
// Compile an assembly from the contents of an array of source files.
CompilerResults CompileAssemblyFromFileBatch
(CompilerParameters options, String[] fileNames);
// Compile an assembly from the contents of a source string.
CompilerResults CompileAssemblyFromSource
(CompilerParameters options, String source);
// Compile an assembly from the contents of an array of source strings.
CompilerResults CompileAssemblyFromSourceBatch
(CompilerParameters options, String[] sources);
}; // interface ICodeCompiler
#endif // !ECMA_COMPAT
}; // namespace System.CodeDom.Compiler
--- NEW FILE ---
/*
* ICodeGenerator.cs - Implementation of the
* System.CodeDom.Compiler.ICodeGenerator class.
*
* Copyright (C) 2002 Southern Storm Software, Pty Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
namespace System.CodeDom.Compiler
{
#if !ECMA_COMPAT
using System.IO;
public interface ICodeGenerator
{
// Create an escaped identifier if "value" is a language keyword.
String CreateEscapedIdentifier(String value);
// Create a valid identifier if "value" is a language keyword.
String CreateValidIdentifier(String value);
// Generate code from a CodeDom compile unit.
void GenerateCodeFromCompileUnit(CodeCompileUnit e,
TextWriter w,
CodeGeneratorOptions o);
// Generate code from a CodeDom expression.
void GenerateCodeFromExpression(CodeExpression e,
TextWriter w,
CodeGeneratorOptions o);
// Generate code from a CodeDom namespace.
void GenerateCodeFromNamespace(CodeNamespace e,
TextWriter w,
CodeGeneratorOptions o);
// Generate code from a CodeDom statement.
void GenerateCodeFromStatement(CodeStatement e,
TextWriter w,
CodeGeneratorOptions o);
// Generate code from a CodeDom type declaration.
void GenerateCodeFromType(CodeTypeDeclaration e,
TextWriter w,
CodeGeneratorOptions
o);
// Get the type indicated by a CodeDom type reference.
String GetTypeOutput(CodeTypeReference type);
// Determine if "value" is a valid identifier.
bool IsValidIdentifier(String value);
// Determine if this code generator supports a particular
// set of generator options.
bool Supports(GeneratorSupport supports);
// Validate an identifier and throw an exception if not valid.
void ValidateIdentifier(String value);
}; // interface ICodeGenerator
#endif // !ECMA_COMPAT
}; // namespace System.CodeDom.Compiler
--- NEW FILE ---
/*
* ICodeParser.cs - Implementation of the
* System.CodeDom.Compiler.ICodeParser class.
*
* Copyright (C) 2002 Southern Storm Software, Pty Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
namespace System.CodeDom.Compiler
{
#if !ECMA_COMPAT
using System.IO;
public interface ICodeParser
{
// Parse the contents of a source stream into a CodeDom tree.
CodeCompileUnit Parse(TextReader codeStream);
}; // interface ICodeParser
#endif // !ECMA_COMPAT
}; // namespace System.CodeDom.Compiler
--- NEW FILE ---
/*
* IndentedTextWriter.cs - Implementation of the
* System.CodeDom.Compiler.IndentedTextWriter class.
*
* Copyright (C) 2002 Southern Storm Software, Pty Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
namespace System.CodeDom.Compiler
{
#if !ECMA_COMPAT
using System.IO;
using System.Text;
public class IndentedTextWriter : TextWriter
{
// Internal state.
private TextWriter writer;
private String tabString;
private int indent;
private bool atLineStart;
// The default string to use for tabbing.
public const String DefaultTabString = " ";
// Constructors.
public IndentedTextWriter(TextWriter writer)
: this(writer, DefaultTabString)
{
// Nothing to do here.
}
public IndentedTextWriter(TextWriter writer, String tabString)
{
this.writer = writer;
this.tabString = tabString;
this.indent = 0;
this.atLineStart = true;
}
// Get the encoding in use by the underlying text writer.
public override Encoding Encoding
{
get
{
return writer.Encoding;
}
}
// Get or set the current indent level.
public int Indent
{
get
{
return indent;
}
set
{
if(value >= 0)
{
indent = value;
}
else
{
indent = 0;
}
}
}
// Get the writer underlying this object.
public TextWriter InnerWriter
{
get
{
return writer;
}
}
// Get or set the newline string.
public override String NewLine
{
get
{
return writer.NewLine;
}
set
{
writer.NewLine = value;
}
}
// Close this writer.
public override void Close()
{
writer.Close();
}
// Flush this writer.
public override void Flush()
{
writer.Flush();
}
// Output tabs at the start of a line if necessary.
protected void OutputTabs()
{
if(atLineStart)
{
int level = indent;
while(level > 0)
{
writer.Write(tabString);
--level;
}
atLineStart = false;
}
}
// Write values of various types.
public override void Write(bool value)
{
OutputTabs();
writer.Write(value);
}
public override void Write(char value)
{
OutputTabs();
writer.Write(value);
}
public override void Write(char[] value)
{
OutputTabs();
writer.Write(value);
}
public override void Write(double value)
{
OutputTabs();
writer.Write(value);
}
public override void Write(int value)
{
OutputTabs();
writer.Write(value);
}
public override void Write(long value)
{
OutputTabs();
writer.Write(value);
}
public override void Write(Object value)
{
OutputTabs();
writer.Write(value);
}
public override void Write(float value)
{
OutputTabs();
writer.Write(value);
}
public override void Write(String value)
{
OutputTabs();
writer.Write(value);
}
public override void Write(String value, Object arg0)
{
OutputTabs();
writer.Write(value, arg0);
}
public override void Write(String value, Object arg0, Object arg1)
{
OutputTabs();
writer.Write(value, arg0, arg1);
}
public override void Write(String value, Object arg0, Object arg1,
Object arg2)
{
OutputTabs();
writer.Write(value, arg0, arg1, arg2);
}
public override void Write(String value, params Object[] args)
{
OutputTabs();
writer.Write(value, args);
}
public override void Write(char[] value, int index, int count)
{
OutputTabs();
writer.Write(value, index, count);
}
public override void Write(Decimal value)
{
OutputTabs();
writer.Write(value);
}
[CLSCompliant(false)]
public override void Write(uint value)
{
OutputTabs();
writer.Write(value);
}
[CLSCompliant(false)]
public override void Write(ulong value)
{
OutputTabs();
writer.Write(value);
}
// Write values of various types followed by a newline.
public override void WriteLine()
{
OutputTabs();
writer.WriteLine();
atLineStart = true;
}
public override void WriteLine(bool value)
{
OutputTabs();
writer.WriteLine(value);
atLineStart = true;
}
public override void WriteLine(char value)
{
OutputTabs();
writer.WriteLine(value);
atLineStart = true;
}
public override void WriteLine(char[] value)
{
OutputTabs();
writer.WriteLine(value);
atLineStart = true;
}
public override void WriteLine(double value)
{
OutputTabs();
writer.WriteLine(value);
atLineStart = true;
}
public override void WriteLine(int value)
{
OutputTabs();
writer.WriteLine(value);
atLineStart = true;
}
public override void WriteLine(long value)
{
OutputTabs();
writer.WriteLine(value);
atLineStart = true;
}
public override void WriteLine(Object value)
{
OutputTabs();
writer.WriteLine(value);
atLineStart = true;
}
public override void WriteLine(float value)
{
OutputTabs();
writer.WriteLine(value);
atLineStart = true;
}
public override void WriteLine(String value)
{
OutputTabs();
writer.WriteLine(value);
atLineStart = true;
}
public override void WriteLine(String value, Object arg0)
{
OutputTabs();
writer.WriteLine(value, arg0);
atLineStart = true;
}
public override void WriteLine(String value, Object arg0, Object arg1)
{
OutputTabs();
writer.WriteLine(value, arg0, arg1);
atLineStart = true;
}
public override void WriteLine(String value, Object arg0, Object arg1,
Object arg2)
{
OutputTabs();
writer.WriteLine(value, arg0, arg1, arg2);
atLineStart = true;
}
public override void WriteLine(String value, params Object[] args)
{
OutputTabs();
writer.WriteLine(value, args);
atLineStart = true;
}
public override void WriteLine(char[] value, int index, int count)
{
OutputTabs();
writer.WriteLine(value, index, count);
atLineStart = true;
}
public override void WriteLine(Decimal value)
{
OutputTabs();
writer.WriteLine(value);
atLineStart = true;
}
[CLSCompliant(false)]
public override void WriteLine(uint value)
{
OutputTabs();
writer.WriteLine(value);
atLineStart = true;
}
[CLSCompliant(false)]
public override void WriteLine(ulong value)
{
OutputTabs();
writer.WriteLine(value);
atLineStart = true;
}
// Write a string with no tab processing.
public void WriteLineNoTabs(String s)
{
writer.WriteLine(s);
}
}; // class IndentedTextWriter
#endif // !ECMA_COMPAT
}; // namespace System.CodeDom.Compiler
--- NEW FILE ---
/*
* LanguageOptions.cs - Implementation of the
* System.CodeDom.Compiler.LanguageOptions class.
*
* Copyright (C) 2002 Southern Storm Software, Pty Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
namespace System.CodeDom.Compiler
{
#if !ECMA_COMPAT
[Flags]
public enum LanguageOptions
{
None = 0,
CaseInsensitive = 1
}; // enum LanguageOptions
#endif // !ECMA_COMPAT
}; // namespace System.CodeDom.Compiler
--- NEW FILE ---
all:
(cd ../..;make)
--- NEW FILE ---
/*
* TempFileCollection.cs - Implementation of the
* System.CodeDom.Compiler.TempFileCollection class.
*
* Copyright (C) 2002 Southern Storm Software, Pty Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
namespace System.CodeDom.Compiler
{
#if !ECMA_COMPAT
using System.Collections;
public class TempFileCollection : ICollection, IEnumerable, IDisposable
{
// Internal state.
private String tempDir;
private bool keepFiles;
private Hashtable files;
// Constructors.
public TempFileCollection() : this(null, false) {}
public TempFileCollection(String tempDir) : this(tempDir, false) {}
public TempFileCollection(String tempDir, bool keepFiles)
{
this.tempDir = tempDir;
this.keepFiles = keepFiles;
this.files = new Hashtable();
}
// Destructor.
~TempFileCollection()
{
Dispose(false);
}
// Properties.
[TODO]
public String BasePath
{
get
{
// TODO
return null;
}
}
public bool KeepFiles
{
get
{
return keepFiles;
}
set
{
keepFiles = value;
}
}
public String TempDir
{
get
{
if(tempDir != null)
{
return tempDir;
}
else
{
return String.Empty;
}
}
}
// Implement the ICollection interface.
public int Count
{
get
{
return files.Count;
}
}
void ICollection.CopyTo(Array array, int index)
{
files.CopyTo(array, index);
}
bool ICollection.IsSynchronized
{
get
{
return false;
}
}
Object ICollection.SyncRoot
{
get
{
return null;
}
}
// Implement the IEnumerable interface.
public IEnumerator GetEnumerator()
{
return files.Keys.GetEnumerator();
}
// Implement the IDisposable interface.
void IDisposable.Dispose()
{
Dispose(true);
}
// Add an extension to a temporary file.
public String AddExtension(String fileExtension)
{
return AddExtension(fileExtension, keepFiles);
}
[TODO]
public String AddExtension(String fileExtension, bool keepFile)
{
// TODO
return null;
}
// Add a file to this temporary file collection.
[TODO]
public void AddFile(String fileName, bool keepFile)
{
// TODO
}
// Copy the contents of this collection to an array.
public void CopyTo(String[] fileNames, int index)
{
files.Keys.CopyTo(fileNames, index);
}
// Delete the temporary files in this collection.
[TODO]
public void Delete()
{
// TODO
}
// Dispose this collection.
protected virtual void Dispose(bool disposing)
{
Delete();
}
}; // class TempFileCollection
#endif // !ECMA_COMPAT
}; // namespace System.CodeDom.Compiler
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Dotgnu-pnet-commits] CVS: pnetlib/System/CodeDom/Compiler CodeGeneratorOptions.cs,NONE,1.1 CodeParser.cs,NONE,1.1 CompilerError.cs,NONE,1.1 CompilerErrorCollection.cs,NONE,1.1 CompilerParameters.cs,NONE,1.1 CompilerResults.cs,NONE,1.1 Executor.cs,NONE,1.1 GeneratorSupport.cs,NONE,1.1 ICodeCompiler.cs,NONE,1.1 ICodeGenerator.cs,NONE,1.1 ICodeParser.cs,NONE,1.1 IndentedTextWriter.cs,NONE,1.1 LanguageOptions.cs,NONE,1.1 Makefile,NONE,1.1 TempFileCollection.cs,NONE,1.1,
Rhys Weatherley <address@hidden> <=