[aspectc-user] syntax question

Olaf Spinczyk olaf at ivs.cs.uni-magdeburg.de
Tue Feb 12 17:59:08 CET 2002


On Tuesday, 12. February 2002 17:48, you wrote:
> Sorry to appear deficient in the brain cell department but I am still
> having problems with
>
> pointcut ini() = that( "CWnd" ) && execution("int %::OnInitDialog ()");
> advice ini() : void before( CWnd* pWnd ) {...}
>
> I cannot simply use "before()" as I need pWnd inside the function {...},
> how do I bind the argument of before() to the argument of the pointcut?

Ah, sorry...

pointcut ini(CWnd* win) = that(win) && execution("int %::OnInitDialog ()");
advice ini(pWnd) : void before( CWnd* pWnd ) {...}

I didn't test, but I think that's it.

Perhaps it is a good idea to read a bit of the AspectJ documentation 
(www.aspectj.org). The semantics of the language is very close to AspectC++. 
They have many examples how to use pointcuts and how to expose context 
information from join points. Of course the syntax differs a bit.

I hope you will not switch from C++ to Java after this hint ;-). They have a 
version number > 1.0!

Olaf



More information about the aspectc-user mailing list