~ubuntu-branches/ubuntu/utopic/aspectc++/utopic

« back to all changes in this revision

Viewing changes to Puma/src/aspects/TraceSyntax.ah

  • Committer: Bazaar Package Importer
  • Author(s): Reinhard Tartler
  • Date: 2006-04-07 11:56:35 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20060407115635-e8wfgmetasrf2p27
Tags: 0.99+1.0pre3-1
* new upstream release
* Apply patch from Martin Michlmayr for g++-4.1 (Closes: #357901)
* further (simple) patches in Puma/ and AspectC++ for g++-4.1
* note that Puma needs to be rewoven so that it can be compiled
  with g++-4.1. This will be done we switch the default compiler
  version.
* Patch JoinPointRepo.cc so that it doesn't loop endlessly anymore.

Show diffs side-by-side

added added

removed removed

Lines of Context:
51
51
    trace (rule);
52
52
  }
53
53
 
54
 
private:
55
 
  pointcut syntax () = "Puma::Syntax";
56
 
  pointcut parser () = "Puma::Parser";
57
 
 
58
 
  advice syntax () : TraceSyntax __trace;
59
 
 
60
54
public:
61
55
  TraceSyntax () : skipping (0) {}
62
56
 
63
57
  // Create instances an define locator function
64
 
  advice syntax () : TraceSyntax *trace_aspect () 
65
 
   { return &__trace; }
66
58
  static TraceSyntax* aspectOf () 
67
59
   { return thisJoinPoint->that ()->trace_aspect (); }
68
60
 
 
61
  // structural extensions
 
62
  pointcut syntax () = "Puma::Syntax";
 
63
  pointcut parser () = "Puma::Parser";
 
64
 
 
65
  advice syntax () : slice class {
 
66
    TraceSyntax __trace;
 
67
  public:
 
68
    TraceSyntax *trace_aspect () { return &__trace; }
 
69
    TokenProvider *__tp () { return token_provider; }
 
70
  };
 
71
  
 
72
  // add initialization function to Parser
 
73
  advice parser () : slice class {
 
74
  public:
 
75
    void trace (ostream &out, bool tokens = false) {
 
76
      syntax->trace_aspect ()->trace (out, tokens);
 
77
    }
 
78
  };
 
79
  
69
80
  // advice code for rules
70
81
  advice within (derived (syntax ()) && ! syntax ()) &&
71
82
   execution ("%::CTree * Puma::%::%()") : before () 
76
87
    trace (result ? "ACCEPT" : "FAILED", -1);
77
88
  }
78
89
 
79
 
  // trace all token input operations
80
 
  advice syntax () : TokenProvider *__tp () 
81
 
   { return token_provider; }
82
90
  advice within (syntax ()) && execution ("% Puma::%::locate_token()") : after ()
83
91
   { if (! skipping) this->trace (thisJoinPoint->that ()->
84
92
                     __tp ()->current (), "INPUT", "INPUT END"); }
85
93
 
86
94
  // trace reset operations
87
95
  // because of a problem in AspectC++ or PUMA we cannot expose 'state' here!!! fix me.
88
 
advice within (syntax ()) && call ("% Puma::TokenProvider::set_state(...)") /* &&
89
 
  args (state) */ : around (/* TokenProvider::State state */) {
90
 
  bool diff = (*tjp->arg<0>() != tjp->target ()->get_state ());
91
 
  tjp->proceed ();
92
 
  if (diff )
93
 
    trace (**tjp->arg<0>(), "RESET", "INPUT END");
94
 
}
 
96
  advice within (syntax ()) && call ("% Puma::TokenProvider::set_state(...)") /* &&
 
97
    args (state) */ : around (/* TokenProvider::State state */) {
 
98
    bool diff = (*tjp->arg<0>() != tjp->target ()->get_state ());
 
99
    tjp->proceed ();
 
100
    if (diff )
 
101
      trace (**tjp->arg<0>(), "RESET", "INPUT END");
 
102
  }
95
103
 
96
104
  // tracing for token provider calls within skip functions
97
105
  advice within (syntax ()) && call ("% Puma::TokenProvider::next()") : before ()
114
122
    }
115
123
  }
116
124
 
117
 
  advice within (syntax ()) && execution ("% Puma::%::skip(...)") : around ()
118
 
   { skipping++;
119
 
     if (trace_mode ()) tos () << "SKIP: ";
120
 
     thisJoinPoint->action ().trigger ();
121
 
     if (trace_mode ()) tos () << endl;
122
 
     skipping--; }
123
 
 
124
 
  advice within (syntax ()) && execution ("% Puma::%::skip_block()") : around ()
125
 
   { skipping++;
126
 
     if (trace_mode ()) tos () << "SKIP_BLOCK: ";
127
 
     thisJoinPoint->action ().trigger ();
128
 
     if (trace_mode ()) tos () << endl;
129
 
     skipping--; }
130
 
 
131
 
  // add initialization function to Parser
132
 
  advice parser () : void trace (ostream &out, bool tokens = false)
133
 
   { syntax->trace_aspect ()->trace (out, tokens); }
 
125
  advice within (syntax ()) && execution ("% Puma::%::skip(...)") : around () {
 
126
    skipping++;
 
127
    if (trace_mode ()) tos () << "SKIP: ";
 
128
    thisJoinPoint->action ().trigger ();
 
129
    if (trace_mode ()) tos () << endl;
 
130
    skipping--;
 
131
  }
 
132
 
 
133
  advice within (syntax ()) && execution ("% Puma::%::skip_block()") : around () {
 
134
    skipping++;
 
135
    if (trace_mode ()) tos () << "SKIP_BLOCK: ";
 
136
    thisJoinPoint->action ().trigger ();
 
137
    if (trace_mode ()) tos () << endl;
 
138
    skipping--;
 
139
  }
134
140
};
135
141
 
136
142
#endif