LSL ScriptEngine now only needs to inherit from BaseClass and we will be MUCH closer to complete LSL support than we were yesterday.

afrisby
Tedd Hansen 2007-08-12 16:44:57 +00:00
parent 95b89096c4
commit 734f288290
2 changed files with 47 additions and 0 deletions

View File

@ -0,0 +1,45 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.IO;
using Microsoft.CSharp;
using System.CodeDom.Compiler;
namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
{
class Compiler
{
private LSL2CS.Converter.LSL2CSConverter LSL_Converter = new LSL2CS.Converter.LSL2CSConverter();
private CSharpCodeProvider codeProvider = new CSharpCodeProvider();
//private ICodeCompiler icc = codeProvider.CreateCompiler();
public string Compile(string LSOFileName)
{
string OutFile = Path.GetFileNameWithoutExtension(LSOFileName);
// TODO: Add error handling
string CS_Code = LSL_Converter.Convert(File.ReadAllText(LSOFileName));
System.CodeDom.Compiler.CompilerParameters parameters = new CompilerParameters();
parameters.GenerateExecutable = true;
parameters.OutputAssembly = OutFile;
CompilerResults results = codeProvider.CompileAssemblyFromSource(parameters, CS_Code);
// TODO: Return errors to user somehow
if (results.Errors.Count > 0)
{
foreach (CompilerError CompErr in results.Errors)
{
Console.WriteLine("Line number " + CompErr.Line +
", Error Number: " + CompErr.ErrorNumber +
", '" + CompErr.ErrorText + ";");
}
}
return OutFile;
}
}
}

View File

@ -29,6 +29,8 @@ namespace LSL2CS.Converter
public string Convert(string Script)
{
string Return = "";
QUOTES.Clear();
//
// Prepare script for processing