[aspectc-user] conditional compilation / "advicing"

Olaf Spinczyk Olaf.Spinczyk at informatik.uni-erlangen.de
Thu Oct 31 13:33:46 CET 2002


Hi,

Am Donnerstag 31 Oktober 2002 13:07 schrieb EXTERN Sacher Dominik (Diplomand; 
FV/SLD):
> Dear all!
>
> Are there any ideas around, how to specify
> "conditional aspect-izing" with AspectC++.
> I´m using AspectC++ to build different "aspectized"
> versions out of one sourcetree.
> I need a kind of
> #IFDEF ... #ELSIF ... #ENDIF
> inside the *.ah-file.
>
>
> e.g.
> pointcut pc_SomePointcut ()= ...
>
> #IFDEF BIG_VERSION
> advice pc_SomePointcut() : before() {
>   <aspect-code for big version>
> }
> advice pc_SomePointcut() : after() {
>   <aspect-code for big version>
> }
>
>
> #ELSIF
> advice pc_SomePointcut() : after() {
>   <aspect-code for small version>
> }
>
>
> #ENDIF
>
>
> These do not work, but are there other elegant ways to achieve this?
> I´m thinking about placing the different advice-levels in
> different *.ah-files and renaming the files using the Makefile as needed...

Using the C/C++ preprocessor in ah files always worked for me. Did you add 
"-DBIG_VERSION" to the ac++ command line?

This is not an elegant way to achieve aspect configuration. A makefile driven 
mechanism will be possible when we change the translation scheme from "one 
development tree" to "single translation unit", which is planned.

In our operating system projects we have a more general solution for software 
configuration. We use the "Consulat" Tool (www.pure-systems.com), which 
provides a graphical enviroment to define and select abstract features in a 
"feature model". Then a knowlegde base is used to map the set of selected 
abstract program features to program "components" (classes, functions, 
aspects, or even preprocessor flags), which will then be copied/linked into 
the final translation tree. Large software families can be managed very well 
with this approach.

Yours,

Olaf



More information about the aspectc-user mailing list