本文整理匯總了C#中tcl.lang.Interp.dispose方法的典型用法代碼示例。如果您正苦於以下問題:C# Interp.dispose方法的具體用法?C# Interp.dispose怎麽用?C# Interp.dispose使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類tcl.lang.Interp
的用法示例。
在下文中一共展示了Interp.dispose方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: Main
//.........這裏部分代碼省略.........
{
interp.setVar("argv0", fileName, TCL.VarFlag.GLOBAL_ONLY);
interp.setVar("tcl_interactive", "0", TCL.VarFlag.GLOBAL_ONLY);
i++;
argc--;
}
for (; i < args.Length; i++)
{
TclList.append(interp, argv, TclString.newInstance(args[i]));
}
interp.setVar("argv", argv, TCL.VarFlag.GLOBAL_ONLY);
interp.setVar("argc", System.Convert.ToString(argc), TCL.VarFlag.GLOBAL_ONLY);
}
catch (TclException e)
{
throw new TclRuntimeError("unexpected TclException: " + e.Message);
}
finally
{
argv.release();
}
// Normally we would do application specific initialization here.
// However, that feature is not currently supported.
// If a script file was specified then just source that file
// and quit.
Console.WriteLine("C#-TCL version " + Assembly.GetExecutingAssembly().GetName().Version.ToString());
Console.WriteLine("==============================================================");
Console.WriteLine("");
if ((System.Object)fileName != null)
{
try
{
interp.evalFile(fileName);
}
catch (TclException e)
{
TCL.CompletionCode code = e.getCompletionCode();
if (code == TCL.CompletionCode.RETURN)
{
code = interp.updateReturnInfo();
if (code != TCL.CompletionCode.OK)
{
System.Console.Error.WriteLine("command returned bad code: " + code);
if (tcl.lang.ConsoleThread.debug) System.Diagnostics.Debug.WriteLine("command returned bad code: " + code);
}
}
else if (code == TCL.CompletionCode.ERROR)
{
System.Console.Error.WriteLine(interp.getResult().ToString());
if (tcl.lang.ConsoleThread.debug) System.Diagnostics.Debug.WriteLine(interp.getResult().ToString());
System.Diagnostics.Debug.Assert(false, interp.getResult().ToString());
}
else
{
System.Console.Error.WriteLine("command returned bad code: " + code);
if (tcl.lang.ConsoleThread.debug) System.Diagnostics.Debug.WriteLine("command returned bad code: " + code);
}
}
// Note that if the above interp.evalFile() returns the main
// thread will exit. This may bring down the VM and stop
// the execution of Tcl.
//
// If the script needs to handle events, it must call
// vwait or do something similar.
//
// Note that the script can create AWT widgets. This will
// start an AWT event handling thread and keep the VM up. However,
// the interpreter thread (the same as the main thread) would
// have exited and no Tcl scripts can be executed.
interp.dispose();
System.Environment.Exit(0);
}
if ((System.Object)fileName == null)
{
// We are running in interactive mode. Start the ConsoleThread
// that loops, grabbing stdin and passing it to the interp.
ConsoleThread consoleThread = new ConsoleThread(interp);
consoleThread.IsBackground = true;
consoleThread.Start();
// Loop forever to handle user input events in the command line.
Notifier notifier = interp.getNotifier();
while (true)
{
// process events until "exit" is called.
notifier.doOneEvent(TCL.ALL_EVENTS);
}
}
}
}