[IronPython] Scripting an unmanaged app with IronPython?

2009-05-12 Thread Mike Krell
I have an unmanaged app written in C++ / MFC that I'd like to script
in some capacity with IronPython.  I can see perhaps three broad
approaches to doing this:

1.  Somehow hosting IP within the app.  This would be the ideal, but I
don't know if it's possible.  It's clear that I would need to create
some wrappers that mediate between managed and unmanaged code (i.e.,
expose functionality as CLR objects).  But on top of that I'd need to
host IP in the process.  I have Michael F.'s excellent IronPython in
Action and have been reading a little bit about embedding the engine,
but it starts with the premise that the hosting app is itself managed.

2. Create a new managed app that would have access to the wrappers as
in #1 and embed IP in that.  I think this is definitely possible, but
it would have limitations that #1 would not have (e.g., in #1, the
user could still do things from the app's gui)

3.  Have a new managed app that runs as a separate process and
communicates with the unmanaged app, e.g. like COM.  The app currently
does not have COM interfaces and working with COM is a major pain.  Is
there an alternative in the .net world that would be similar but
easier to use?

Thanks in advance for any guidance y'all can offer.

   Mike
___
Users mailing list
Users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com


Re: [IronPython] Scripting an unmanaged app with IronPython?

2009-05-12 Thread Curt Hagenlocher
Is there any reason you wouldn't just do this with CPython? In a past life,
I had a lot of success embedding CPython into a C++ / MFC application.

On Tue, May 12, 2009 at 7:48 AM, Mike Krell mbk.li...@gmail.com wrote:

 I have an unmanaged app written in C++ / MFC that I'd like to script
 in some capacity with IronPython.  I can see perhaps three broad
 approaches to doing this:

 1.  Somehow hosting IP within the app.  This would be the ideal, but I
 don't know if it's possible.  It's clear that I would need to create
 some wrappers that mediate between managed and unmanaged code (i.e.,
 expose functionality as CLR objects).  But on top of that I'd need to
 host IP in the process.  I have Michael F.'s excellent IronPython in
 Action and have been reading a little bit about embedding the engine,
 but it starts with the premise that the hosting app is itself managed.

 2. Create a new managed app that would have access to the wrappers as
 in #1 and embed IP in that.  I think this is definitely possible, but
 it would have limitations that #1 would not have (e.g., in #1, the
 user could still do things from the app's gui)

 3.  Have a new managed app that runs as a separate process and
 communicates with the unmanaged app, e.g. like COM.  The app currently
 does not have COM interfaces and working with COM is a major pain.  Is
 there an alternative in the .net world that would be similar but
 easier to use?

 Thanks in advance for any guidance y'all can offer.

   Mike
 ___
 Users mailing list
 Users@lists.ironpython.com
 http://lists.ironpython.com/listinfo.cgi/users-ironpython.com

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


Re: [IronPython] Scripting an unmanaged app with IronPython?

2009-05-12 Thread Mike Krell
On Tue, May 12, 2009 at 7:58 AM, Curt Hagenlocher c...@hagenlocher.org wrote:
 Is there any reason you wouldn't just do this with CPython? In a past life,
 I had a lot of success embedding CPython into a C++ / MFC application.

Yes, in fact, I've done a limited version of my approach #2 before
using boost.python.  The big win with using IronPython scripting is
access to .net libraries.  Plus I like pushing the envelope -- as
opposed to pushing boulders uphill :-)

   Mike
___
Users mailing list
Users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com


Re: [IronPython] Scripting an unmanaged app with IronPython?

2009-05-12 Thread Steve Baer

Hi Mike,
I did this by creating a C++/CLI DLL that wraps our C++ exported 
classes/functions for .NET. This way there is no .NET code in our core 
C++/MFC executable and you get the effect of IP being hosted in the 
application.


Thanks,
-Steve


- Original Message - 
From: Mike Krell mbk.li...@gmail.com

To: Discussion of IronPython users@lists.ironpython.com
Sent: Tuesday, May 12, 2009 8:12 AM
Subject: Re: [IronPython] Scripting an unmanaged app with IronPython?


On Tue, May 12, 2009 at 7:58 AM, Curt Hagenlocher c...@hagenlocher.org 
wrote:
Is there any reason you wouldn't just do this with CPython? In a past 
life,

I had a lot of success embedding CPython into a C++ / MFC application.


Yes, in fact, I've done a limited version of my approach #2 before
using boost.python.  The big win with using IronPython scripting is
access to .net libraries.  Plus I like pushing the envelope -- as
opposed to pushing boulders uphill :-)

  Mike
___
Users mailing list
Users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com



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


[IronPython] IronPython 2.6 CodePlex Source Update

2009-05-12 Thread merllab
This is an automated email letting you know that sources 
have recently been pushed out.  You can download these newer 
sources directly from 
http://ironpython.codeplex.com/SourceControl/changeset/view/49967.

ADDED SOURCES
$/IronPython/IronPython_Main/Src/Tests/Modes
$/IronPython/IronPython_Main/Src/Tests/Modes/ConsoleFlags.ps1
$/IronPython/IronPython_Main/Src/Tests/Modes/ConsoleHelp.out

DELETED SOURCES
$/IronPython/IronPython_Main/Src/Tests/Modes.ps1

MODIFIED SOURCES
$/IronPython/IronPython_Main/Src/Tests/Modes/ConsoleFlags.ps1
$/IronPython/IronPython_Main/Src/Tests/Modes/ConsoleHelp.out
$/IronPython/IronPython_Main/Src/Tests/interop/com/apps/word.py

$/IronPython/IronPython_Main/Src/Runtime/Microsoft.Scripting/Utils/ArrayUtils.cs

$/IronPython/IronPython_Main/Src/Runtime/Microsoft.Scripting/Utils/ValueArray.cs

$/IronPython/IronPython_Main/Src/Runtime/Microsoft.Scripting/Actions/DefaultBinder.cs

$/IronPython/IronPython_Main/Src/Runtime/Microsoft.Scripting/Utils/CollectionUtils.cs

$/IronPython/IronPython_Main/Src/IronPython/Runtime/Binding/FastGetBase.cs

$/IronPython/IronPython_Main/Src/IronPython/Runtime/PythonFunction.Generated.cs
$/IronPython/IronPython_Main/Src/IronPython/Lib/iptest/assert_util.py
$/IronPython/IronPython_Main/Lib/iptest/assert_util.py

$/IronPython/IronPython_Main/Src/IronPython/Runtime/Binding/PythonGetMemberBinder.cs
$/IronPython/IronPython_Main/Src/Tests/test_interpret_sanity.py
$/IronPython/IronPython_Main/Src/Tests/test_namebinding.py
$/IronPython/IronPython_Main/Src/Tests/test_math.py
$/IronPython/IronPython_Main/Src/Tests/test_doc.py
$/IronPython/IronPython_Main/Src/Tests/test_dict.py
$/IronPython/IronPython_Main/Src/IronPython/Hosting/PythonCommandLine.cs

CHECKIN COMMENTS

Changeset Id: 867352
Date: 5/11/2009 8:10:04 PM

(dinov) DLR outer layer (just making a couple of helpers more accessible)  
IronPython

Implements instance binding for common instance members which we can easily 
support pre-compiled rules for:
This EXCLUDES com objects and IDOs and any strongly typed 
literals other than List/string (we hit list and string during startup), types 
w/ GetBoundMember/GetCustomMember dynamic lookups
It includes methods, events, properties (using reflected 
caller).  Fields are always compiled still.
The biggest win is obviously methods in that for say “l = []; 
l.append” we no longer need to generate code.

Also fixes Seo’s problem w/ interactive code vs. statements and Jeff’s problem 
w/ = 14 arguments all w/ defaults.



(Shelveset: FastInstanceBindingFinal2;REDMOND\dinov | SNAP CheckinId: 8310)

Changeset Id: 867020
Date: 5/11/2009 4:49:17 PM

(dfugate) * Dev10 409920 (test_namebinding.py) - non-repro with today's bits
* Dev10 148342 (test_sys.py) - partially fixed.  Still missing 
sys.__excepthook__
* iptest.assert_util - preserve_syspath was misspelled
* renamed Modes.ps1 to ConsoleFlags.ps1 and enhanced the ipy.exe -h test
* test_dict.py - added verification for test_dict_inherit
* CodePlex 20251 (test_doc.py) - added a regression test.  Fixed
* test_math.py - added test_log_neg
* test_namebinding.py - enabled a block of code under -X:Interpret mode
* interop.com.apps.word - minor refactoring plus a regression test for 
test_word_basic
* moved/renamed test_mode_20.GenericTest


(Shelveset: CP57;REDMOND\dfugate | SNAP CheckinId: 8309)

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


[IronPython] unsupported operand type(s) for operator overloading.

2009-05-12 Thread 李兵
Hi,
   I implemented '' operator overloading in C# class.  But When I used
ScriptRuntime compile the expression that use '' operator, I got a
exception 'unsupported operand type(s) for  operator overloading'.
The following is C# code.

  public static  Group operator (Condition left, Condition right) {
if (left == null) {
throw new ArgumentNullException(left);
}
if (right == null) {
throw new ArgumentNullException(right);
}
 Group re = new  Group(left, right, LogicalOperator.And);
return re;
}

IronPython expression like this ' A.Create(Audit) ==  A.Create(Test1) 
A.CreateProperty(Sum) == A.Create(Test2) '

I tried to convert '' to 'and'. Although no exception, I lost the left
expression.

Anyone can help me? Thanks.
___
Users mailing list
Users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com


Re: [IronPython] unsupported operand type(s) for operator overloading.

2009-05-12 Thread Seo Sanghyeon
2009/5/13 李兵 dreamwinte...@gmail.com:
 IronPython expression like this ' A.Create(Audit) ==  A.Create(Test1) 
 A.CreateProperty(Sum) == A.Create(Test2) '

This is a rare pitfall. In C (and C#), == has higher precedence than
, but in Python,  has higher precedence than ==. So IronPython is
complaining that it can't process A.Create(Test1) 
A.CreateProperty(Sum).

Probably you meant (A.Create(Audit) == A.Create(Test1)) 
(A.CreateProperty(Sum) == A.Create(Test2))?

-- 
Seo Sanghyeon
___
Users mailing list
Users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com


[IronPython] Inspect Module

2009-05-12 Thread Davy Mitchell
Hi Folks,

Is there a reason why Inspect is missing from the 2.6 msi? It is
present in 2.01.

Thanks,
Davy Mitchell

http://daftspaniel.blogspot.com
___
Users mailing list
Users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com