[Kde-bindings] Re: py(Qt|KDE) and KDE CVS

Richard Dale Richard_Dale at tipitina.demon.co.uk
Tue Mar 23 09:48:52 UTC 2004


On Monday 22 March 2004 22:32, Marcus wrote:
> On Tuesday 23 March 2004 1:55 am, Richard Dale wrote:
> > Well in my opinion Ashley's Smoke is by far the most innovative software
> > in kdebindings (and KDE?). No contest I'm afraid.
>
> I happen to disagree. SMOKE might be nice for scripting languages, but it
> is far too difficult to use, and there seems to be no documentation for how
> to use it. When I first looked at SMOKE, it looked like a big mess, and it
> still looks like that to me.
I would describe the code generated as similar to the output from yacc or 
bison. So not very human readable, hard to understand but certainly not a 
mess. I think Germain has a good summary on the PerlQt site, I read that to 
start with. We might need to make some minor changes to the api to make 
non-scripting languages more efficient, although it can be used as it is.

I've attached a couple of sample C# files with the Proxy calls. Here is how 
the Proxy is created in QFont.cs:

		protected Object _interceptor = null;
		...

		protected void CreateQFontProxy() {
			SmokeInvocation realProxy = new SmokeInvocation(typeof(QFont), this);
			_interceptor = (QFont) realProxy.GetTransparentProxy();
		}
		private QFont proxyQFont() {
			return (QFont) _interceptor;
		}
		...

And a method call looks like this:

		public void SetPixelSize(int arg1) {
			proxyQFont().SetPixelSize(arg1);
		}

All 20000+ Qt/KDE method calls in the api are funneled to a single Invoke() 
call, in SmokeInvocation.cs:

		public override IMessage Invoke(IMessage myMessage) {
			Console.WriteLine("MyProxy 'Invoke method' Called...");
			if (myMessage is IMethodCallMessage) {
				Console.WriteLine("IMethodCallMessage");
			}
			if (myMessage is IMethodReturnMessage) {
				Console.WriteLine("IMethodReturnMessage");
			}
			if (myMessage is IConstructionCallMessage) {  
 			}                
		}

So the next thing to be done is to add code to look up the method to call in 
the Smoke runtime, then marshall the args in a Object[] array into the C++ 
types. Then call the C++ method, and marshall the return value from C++ to 
C#.

-- Richard


-------------- next part --------------
A non-text attachment was scrubbed...
Name: QFont.cs
Type: text/x-c++src
Size: 9380 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/kde-bindings/attachments/20040323/cd4841aa/attachment.cpp>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: SmokeInvocation.cs
Type: text/x-c++src
Size: 723 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/kde-bindings/attachments/20040323/cd4841aa/attachment-0001.cpp>


More information about the Kde-bindings mailing list