~ubuntu-branches/ubuntu/quantal/aspectc++/quantal

« back to all changes in this revision

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

  • Committer: Bazaar Package Importer
  • Author(s): Reinhard Tartler
  • Date: 2008-04-10 17:40:52 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20080410174052-xdnsm7oi8hauyyf1
Tags: 1.0pre4~svn.20080409+dfsg-3
Fix another missing include, this time in Ag++/StdSystem.cc

Show diffs side-by-side

added added

removed removed

Lines of Context:
24
24
/********************************************************/
25
25
 
26
26
#include <iostream>
27
 
using std::cout;
28
 
using std::endl;
 
27
 
 
28
#include <string.h>
29
29
 
30
30
#include "Puma/Unit.h"
31
31
#include "Puma/Token.h"
32
 
using namespace Puma;
33
32
 
34
33
 
35
34
aspect PragmaOnce {
42
41
  pointcut preincluder () = "Puma::PreFileIncluder";
43
42
  
44
43
  // extend the preprocessor parser by the filter state
45
 
  advice preparser () : slice class { Token * _pragma_token; };
 
44
  advice preparser () : slice class { Puma::Token * _pragma_token; };
46
45
 
47
46
  // initialize the filter state
48
47
  advice execution ("% Puma::PreprocessorParser::configure (...)") : after () {
52
51
  
53
52
  // filter #pragma once
54
53
  advice call ("% Puma::PreprocessorParser::parseToken ()") : after () {
55
 
    Token *tok = *tjp->result ();
 
54
    Puma::Token *tok = *tjp->result ();
56
55
    JoinPoint::That &that = *tjp->that ();
57
56
    if (!tok || !tok->is_directive ()) {
58
57
      that._pragma_token = 0;
62
61
      that._pragma_token = tok;
63
62
    }
64
63
    else if (that._pragma_token && strcmp ("once", tok->text ()) == 0) {
65
 
      Unit *unit = (Unit*)tok->belonging_to ();
 
64
      Puma::Unit *unit = (Puma::Unit*)tok->belonging_to ();
66
65
      assert (unit);
67
66
      unit->state ().onlyOnce (true);
68
67
    }
77
76
  // no tokens
78
77
  advice args (unit) && within (preincluder ()) &&
79
78
    execution ("void ...::pushOnStack(...)") : 
80
 
   around (Unit *unit) {
 
79
   around (Puma::Unit *unit) {
81
80
    if (! unit || ! unit->state ().onlyOnce ())
82
81
      tjp->proceed ();
83
82
  }
85
84
  // includeFile shall return 0 if the file was not included
86
85
  advice within (preincluder ()) &&
87
86
  execution ("Puma::Unit * ...::includeFile(...)") : after () {
88
 
    Unit *&unit = *tjp->result ();
 
87
    Puma::Unit *&unit = *tjp->result ();
89
88
    if (unit && unit->state ().onlyOnce ())
90
 
      unit = 0;
 
89
      //unit = 0;
 
90
      tjp->that ()->_guarded = true;
91
91
  }
92
92
    
93
93
protected: