aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2014-03-26 01:20:49 +0000
committerJustin Clark-Casey (justincc)2014-03-26 01:20:49 +0000
commit62a03a5caced14929a3b77740ffa16f097b8fa2e (patch)
tree0c2a97951594e55fc0735f07be61742fc8bbe508 /OpenSim/Region/ScriptEngine
parentRemove unmaintained and unused YieldProlog scripting language (diff)
downloadopensim-SC_OLD-62a03a5caced14929a3b77740ffa16f097b8fa2e.zip
opensim-SC_OLD-62a03a5caced14929a3b77740ffa16f097b8fa2e.tar.gz
opensim-SC_OLD-62a03a5caced14929a3b77740ffa16f097b8fa2e.tar.bz2
opensim-SC_OLD-62a03a5caced14929a3b77740ffa16f097b8fa2e.tar.xz
Also take YP/commented out JS references from script engine CodeTools.
Fixes build break from d3387d591a2bd496c8315f17b2310d6a6f40a7c3
Diffstat (limited to 'OpenSim/Region/ScriptEngine')
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs40
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/CodeTools/YP2CSConverter.cs117
2 files changed, 0 insertions, 157 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs b/OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs
index a1b8d85..b4640ef 100644
--- a/OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs
@@ -85,9 +85,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools
85 85
86 private static CSharpCodeProvider CScodeProvider = new CSharpCodeProvider(); 86 private static CSharpCodeProvider CScodeProvider = new CSharpCodeProvider();
87 private static VBCodeProvider VBcodeProvider = new VBCodeProvider(); 87 private static VBCodeProvider VBcodeProvider = new VBCodeProvider();
88// private static JScriptCodeProvider JScodeProvider = new JScriptCodeProvider();
89 private static CSharpCodeProvider YPcodeProvider = new CSharpCodeProvider(); // YP is translated into CSharp
90 private static YP2CSConverter YP_Converter = new YP2CSConverter();
91 88
92 // private static int instanceID = new Random().Next(0, int.MaxValue); // Unique number to use on our compiled files 89 // private static int instanceID = new Random().Next(0, int.MaxValue); // Unique number to use on our compiled files
93 private static UInt64 scriptCompileCounter = 0; // And a counter 90 private static UInt64 scriptCompileCounter = 0; // And a counter
@@ -404,12 +401,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools
404 WriteMapFile(assembly + ".map", linemap); 401 WriteMapFile(assembly + ".map", linemap);
405 } 402 }
406 403
407 if (language == enumCompileType.yp)
408 {
409 // Its YP, convert it to C#
410 compileScript = YP_Converter.Convert(Script);
411 }
412
413 switch (language) 404 switch (language)
414 { 405 {
415 case enumCompileType.cs: 406 case enumCompileType.cs:
@@ -424,13 +415,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools
424 compileScript = CreateVBCompilerScript( 415 compileScript = CreateVBCompilerScript(
425 compileScript, m_scriptEngine.ScriptClassName, m_scriptEngine.ScriptBaseClassName); 416 compileScript, m_scriptEngine.ScriptClassName, m_scriptEngine.ScriptBaseClassName);
426 break; 417 break;
427// case enumCompileType.js:
428// compileScript = CreateJSCompilerScript(compileScript, m_scriptEngine.ScriptBaseClassName);
429// break;
430 case enumCompileType.yp:
431 compileScript = CreateYPCompilerScript(
432 compileScript, m_scriptEngine.ScriptClassName,m_scriptEngine.ScriptBaseClassName);
433 break;
434 } 418 }
435 419
436 assembly = CompileFromDotNetText(compileScript, language, asset, assembly); 420 assembly = CompileFromDotNetText(compileScript, language, asset, assembly);
@@ -488,22 +472,6 @@ namespace SecondLife
488 return compileScript; 472 return compileScript;
489 } 473 }
490 474
491 private static string CreateYPCompilerScript(string compileScript, string className, string baseClassName)
492 {
493 compileScript = String.Empty +
494 "using OpenSim.Region.ScriptEngine.Shared.YieldProlog; " +
495 "using OpenSim.Region.ScriptEngine.Shared; using System.Collections.Generic;\r\n" +
496 String.Empty + "namespace SecondLife { " +
497 String.Empty + "public class " + className + " : " + baseClassName + " { \r\n" +
498 //@"public Script() { } " +
499 @"static OpenSim.Region.ScriptEngine.Shared.YieldProlog.YP YP=null; " +
500 @"public " + className + "() { YP= new OpenSim.Region.ScriptEngine.Shared.YieldProlog.YP(); } " +
501 compileScript +
502 "} }\r\n";
503
504 return compileScript;
505 }
506
507 private static string CreateVBCompilerScript(string compileScript, string className, string baseClassName) 475 private static string CreateVBCompilerScript(string compileScript, string className, string baseClassName)
508 { 476 {
509 compileScript = String.Empty + 477 compileScript = String.Empty +
@@ -635,14 +603,6 @@ namespace SecondLife
635 } 603 }
636 } while (!complete); 604 } while (!complete);
637 break; 605 break;
638// case enumCompileType.js:
639// results = JScodeProvider.CompileAssemblyFromSource(
640// parameters, Script);
641// break;
642 case enumCompileType.yp:
643 results = YPcodeProvider.CompileAssemblyFromSource(
644 parameters, Script);
645 break;
646 default: 606 default:
647 throw new Exception("Compiler is not able to recongnize " + 607 throw new Exception("Compiler is not able to recongnize " +
648 "language type \"" + lang.ToString() + "\""); 608 "language type \"" + lang.ToString() + "\"");
diff --git a/OpenSim/Region/ScriptEngine/Shared/CodeTools/YP2CSConverter.cs b/OpenSim/Region/ScriptEngine/Shared/CodeTools/YP2CSConverter.cs
deleted file mode 100644
index 7ea3cfc..0000000
--- a/OpenSim/Region/ScriptEngine/Shared/CodeTools/YP2CSConverter.cs
+++ /dev/null
@@ -1,117 +0,0 @@
1/*
2* Copyright (c) Contributors, http://opensimulator.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4*
5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSimulator Project nor the
13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission.
15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26*
27*/
28
29using System;
30using System.IO;
31using System.Collections.Generic;
32using System.Text;
33using System.Text.RegularExpressions;
34using OpenSim.Region.ScriptEngine.Shared.YieldProlog;
35
36namespace OpenSim.Region.ScriptEngine.Shared.CodeTools
37{
38 public class YP2CSConverter
39 {
40 public YP2CSConverter()
41 {
42 }
43
44 public string Convert(string Script)
45 {
46 string CS_code = GenCode(Script);
47 return CS_code;
48 }
49
50 static string GenCode(string myCode)
51 {
52 Variable TermList = new Variable();
53 Variable FunctionCode = new Variable();
54
55 string CS_code = "";
56
57 int cs_pointer = myCode.IndexOf("\n//cs");
58 if (cs_pointer > 0)
59 {
60 CS_code = myCode.Substring(cs_pointer); // CS code comes after
61 myCode = myCode.Substring(0, cs_pointer);
62 }
63 myCode.Replace("//yp", "%YPCode");
64
65 StringWriter myCS_SW = new StringWriter();
66 StringReader myCode_SR = new StringReader(" yp_nop_header_nop. \n "+myCode + "\n");
67
68 YP.see(myCode_SR);
69 YP.tell(myCS_SW);
70
71 //m_log.Debug("Mycode\n ===================================\n" + myCode+"\n");
72
73// disable warning: don't see how we can code this differently short
74// of rewriting the whole thing
75#pragma warning disable 0168, 0219
76 foreach (bool l1 in Parser.parseInput(TermList))
77 {
78 foreach (bool l2 in YPCompiler.makeFunctionPseudoCode(TermList, FunctionCode))
79 {
80 // ListPair VFC = new ListPair(FunctionCode, new Variable());
81 //m_log.Debug("-------------------------")
82 //m_log.Debug(FunctionCode.ToString())
83 //m_log.Debug("-------------------------")
84 YPCompiler.convertFunctionCSharp(FunctionCode);
85 //YPCompiler.convertStringCodesCSharp(VFC);
86 }
87 }
88#pragma warning restore 0168, 0219
89 YP.seen();
90 myCS_SW.Close();
91 YP.told();
92 StringBuilder bu = myCS_SW.GetStringBuilder();
93 string finalcode = "//YPEncoded\n" + bu.ToString();
94 // FIX script events (we're in the same script)
95 // 'YP.script_event(Atom.a(@"sayit"),' ==> 'sayit('
96 finalcode = Regex.Replace(finalcode,
97 @"YP.script_event\(Atom.a\(\@\""(.*?)""\)\,",
98 @"this.$1(",
99 RegexOptions.Compiled | RegexOptions.Singleline);
100 finalcode = Regex.Replace(finalcode,
101 @"YP.script_event\(Atom.a\(\""(.*?)""\)\,",
102 @"this.$1(",
103 RegexOptions.Compiled | RegexOptions.Singleline);
104 finalcode = Regex.Replace(finalcode,
105 @" static ",
106 @" ",
107 RegexOptions.Compiled | RegexOptions.Singleline);
108
109 finalcode = CS_code+"\n\r"+ finalcode;
110 finalcode = Regex.Replace(finalcode,
111 @"PrologCallback",
112 @"public IEnumerable<bool> ",
113 RegexOptions.Compiled | RegexOptions.Singleline);
114 return finalcode;
115 }
116 }
117}