ScriptStack 1.0.0
A .NET scripting language
Lade ...
Suche ...
Keine Treffer
ScriptStack.Runtime.Host Schnittstellenreferenz

The main interface to create a Host. A Host can implement Routine's to extend its functionality. Mehr ...

Klassendiagramm für ScriptStack.Runtime.Host:
ScriptStack.Runtime.Model

Öffentliche Methoden

object Invoke (string routine, List< object > parameters)
 Called when a Routine is invoked.
 

Ausführliche Beschreibung

The main interface to create a Host. A Host can implement Routine's to extend its functionality.

A Host must implement the Invoke() method. As you can see, it is just an empty declaration to hook in.

Every time a Routine is requested from within a script, this method is invoked.

You have to implement the logic (the function body) inside this method!

The name of the Routine is passed as string as 1st parameter. Parameters are passed as a list of objects as 2nd parameter.

A Host class with a registered "print" Routine would look like the following example.

{
private Manager manager;
private Script script;
private Interpreter interpreter;
public ScriptStack(String[] args)
{
manager = new Manager();
manager.Register(new Routine((Type)null, "print", (Type)null));
script = new Script(manager, args[0]);
interpreter = new Interpreter(script);
interpreter.Handler = this;
while (!interpreter.Finished)
interpreter.Interpret(1);
}
public object Invoke(string routine, List<object> parameters)
{
if (routine == "print")
{
// do some stuff..
}
return null;
}
}
API entry point.
Definition Manager.cs:21
void Register(Model model)
Definition Manager.cs:170
The Interpreter finally interprets the parse tree in form of a token stream returned from the ScriptS...
Definition Interpreter.cs:18
uint Interpret(uint instructions)
Definition Interpreter.cs:1691
bool Finished
Definition Interpreter.cs:1800
A Routine is an abstract representation of a method.
Definition Routine.cs:70
Internal representation of a text file (source code) which can be passed to the Interpreter to execut...
Definition Script.cs:17
The main interface to create a Host. A Host can implement Routine's to extend its functionality.
Definition Host.cs:80
Definition ReadOnlyDictionary.cs:8

You can call Routine's directly by calling the Invoke method on the corresponding handler (Host / Model) passing its name and a list of parameters (if needed)

Routine myRoutine = manager.Routines["print"];
List<object> parameters = new List<object>();
parameters.Add("Hello world");
myRoutine.Handler.Invoke("print", parameters);
ReadOnlyDictionary< String, Routine > Routines
Definition Manager.cs:242
Host Handler
Definition Routine.cs:322
object Invoke(string routine, List< object > parameters)
Called when a Routine is invoked.

Dokumentation der Elementfunktionen

◆ Invoke()

object ScriptStack.Runtime.Host.Invoke ( string routine,
List< object > parameters )

Called when a Routine is invoked.

Parameter
routine
parameters
Rückgabe

Wird benutzt von ScriptStack.Runtime.Interpreter.INV().


Die Dokumentation für diese Schnittstelle wurde erzeugt aufgrund der Datei: