Hier werden die Unterschiede zwischen zwei Versionen angezeigt.
| Beide Seiten der vorigen Revision Vorhergehende Überarbeitung Nächste Überarbeitung | Vorhergehende Überarbeitung | ||
|
scriptstack [2025/12/15 02:36] jango |
scriptstack [2025/12/15 02:50] (aktuell) jango [Routines] |
||
|---|---|---|---|
| Zeile 112: | Zeile 112: | ||
| <code csharp> | <code csharp> | ||
| // define route | // define route | ||
| - | Routine routine = new Routine( | + | Routine routine = new Routine((Type)null, |
| - | (Type)null, " | + | |
| </ | </ | ||
| Zeile 129: | Zeile 128: | ||
| listParameterTypes.Add(typeof(ArrayList)); | listParameterTypes.Add(typeof(ArrayList)); | ||
| - | // define | + | // define |
| - | Routine routine = new Routine( | + | Routine routine = new Routine((Type)null, |
| - | (Type)null, " | + | |
| </ | </ | ||
| Zeile 155: | Zeile 153: | ||
| public class Program : Host | public class Program : Host | ||
| { | { | ||
| - | // class implementation | + | |
| - | | + | private Interpreter interpreter; |
| - | | + | |
| - | { | + | |
| - | | + | { |
| - | | + | interpreter = new Interpreter(script); |
| - | } | + | interpreter.Handler = this; |
| - | | + | } |
| - | { | + | |
| - | if (functionName == " | + | |
| - | { | + | { |
| - | | + | if (functionName == " |
| - | | + | { |
| - | | + | string str = (int)parameters[0]; |
| - | } | + | Console.WriteLine(str); |
| - | | + | return; |
| - | } | + | } |
| + | return null; | ||
| + | } | ||
| + | | ||
| + | } | ||
| </ | </ | ||
| Zeile 184: | Zeile 186: | ||
| <code csharp> | <code csharp> | ||
| // register global Sine function | // register global Sine function | ||
| - | HostFunctionPrototype hostFunctionPrototype | + | Routine routine |
| - | typeof(float), | + | manager.Register(routine, printHandler); |
| - | m_scriptManager.RegisterHostFunction(hostFunctionPrototype, trigHandler); | + | |
| // register global Cosine function | // register global Cosine function | ||
| - | HostFunctionPrototype hostFunctionPrototype | + | routine |
| - | | + | manager.Register(routine, readHandler); |
| - | m_scriptManager.RegisterHostFunction(hostFunctionPrototype, | + | |
| - | // register global Tangent function | + | |
| - | HostFunctionPrototype hostFunctionPrototype = new HostFunctionPrototype( | + | |
| - | typeof(float), | + | |
| - | m_scriptManager.RegisterHostFunction(hostFunctionPrototype, trigHandler); | + | |
| </ | </ | ||