I think having a standard interface for creating consoles would be a great way 
to implement IronPython's console.  Being able to swap in semi-arbitrary 
languages into FooConsole could be useful for a variety of apps.
 
public delegate ConsoleInputHandler(string input);
 
IConsole console = new Console<IronPythonInterpreter>(consoleSettings, 
consoleHistory);
console.OnInput += new ConsoleInputHandler(OnInput);
 
public void OnInput(string input)
{

                
                console.SubmitLine(input);
                 
                switch(console.State)
                {

                                case ConsoleState.ContinueLine: { 
console.Prompt = ConsolePrompt.Continue; break; }
                                case ConsoleState.NewLine: { 
console.ExecuteCurrentLine();  prompt = ConsolePrompt.New; break; }

                }

}
 
.. back to Java sloggery.

________________________________

From: [EMAIL PROTECTED] on behalf of Jim Hugunin
Sent: Fri 4/29/2005 10:46 AM
To: Discussion of IronPython
Subject: RE: [IronPython] Executing a python source from C#



That will generate a SyntaxError just as if you passed a partial block to exec. 
 If you're interested in experimenting with embeddable consoles, you should 
take a look at the code for IronPythonConsole which also uses PythonEngine to 
do its loops.

Ultimately, I think that IronPython should ship with a standard interactive 
console for both winforms and avalon that have a few customization hooks but 
are designed to be easily plugged into your apps.  I'm still not sure if this 
embeddable console should be written in C# or in IronPython itself and am 
curious to hear the results of experiments using either approach.  I'm leaning 
towards the idea of building it, and even the standard command-line console, in 
IronPython.

Thanks - Jim

________________________________________
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Keith J. Farmer
Sent: Friday, April 29, 2005 10:35 AM
To: Discussion of IronPython
Subject: RE: [IronPython] Executing a python source from C#

What happens if we send in a partial block, as might happen when creating an 
embeddable console?
string stmt = "for i in range(6):";
engine.Execute(stmt);
Or is it expected that we ensure that such things don't happen?
 
_______________________________________________
users-ironpython.com mailing list
users-ironpython.com@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com


<<winmail.dat>>

_______________________________________________
users-ironpython.com mailing list
users-ironpython.com@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com

Reply via email to