[aspectc-user] Matching an expression statement

Ferosh Jacob fjacob at crimson.ua.edu
Wed Dec 28 19:55:17 CET 2011



Consider the two files given below.

  file1: main.cc
   1 #include<stdio.h>
    2 void hello();
    3 void hello(){
    4  printf("Replace me\n");
    5 }
    6 int main(){
    7  int i=0;
    8   i++;
    9   hello();
   10   return 0;
   11 }

file2: aspect file
    1 aspect Test {
    2   advice execution("void hello()") : around() {
    3     printf(" New text\n");
    4   }
    5 };


Here the function call is  replaced by another function call, Can you
help with an aspect which can replace an expression statement like  "i++;"
with function call. Say, for the same input file, file1, replace line 8
with printf("New text\n");

I couldn't find a setter, getter pointcut function to do this. Is there
any other way?

Thanks
Ferosh




More information about the aspectc-user mailing list