~ubuntu-branches/ubuntu/maverick/aspectc++/maverick

« back to all changes in this revision

Viewing changes to AspectC++/AspectIncludes.cc

  • 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:
19
19
#include "AspectIncludes.h"
20
20
#include "AspectInfo.h"
21
21
#include "Naming.h"
 
22
#include "TransformInfo.h"
22
23
 
23
24
#include "Puma/Unit.h"
24
25
#include "Puma/CTree.h"
25
26
#include "Puma/CProject.h"
26
27
#include "Puma/Filename.h"
27
28
 
28
 
// helper function that find the unit in which an aspect 'ai' is defined
29
 
Unit *AspectIncludes::aspect_unit (ACAspectInfo *ai) {
30
 
  return (Unit*)ai->ClassInfo ()->SourceInfo ()->StartToken ()->token ()->
31
 
    belonging_to ();
 
29
// helper function that find the unit in which an advice code is defined
 
30
Unit *AspectIncludes::aspect_unit (JPL_Aspect *a) {
 
31
  return TI_Aspect::unit (*a);
 
32
//  return (Unit*)ai->ClassInfo ()->SourceInfo ()->StartToken ()->token ()->
 
33
//    belonging_to ();
32
34
}
33
35
 
34
36
// this function declares that a unit 'iu' depends on the aspect 'ai'
35
 
void AspectIncludes::insert (Unit *iu, AspectInfo *ai, ACAspectInfo *acai,
36
 
  AspectRef::Kind kind) {
 
37
void AspectIncludes::insert (Unit *iu, AspectInfo *a, AspectRef::Kind kind) {
37
38
  assert (iu);
38
39
 
39
40
  // check if there is already an entry for this unit
41
42
  if (entry == end ()) {
42
43
    // there is no entry for the unit 'iu' yet => make a new one
43
44
    AspectRefSet new_set;
44
 
    new_set.insert (AspectRef (ai, acai, kind));
 
45
    new_set.insert (AspectRef (a, kind));
45
46
    UnitAspectRefMap::insert (value_type (iu, new_set));
46
47
  }
47
48
  else {
48
49
    // entry found add the aspect reference to the stored set
49
50
    AspectRefSet &set = (*entry).second;
50
51
    AspectRefSet::iterator ref_entry =
51
 
      set.find (AspectRef (ai, acai, AspectRef::AR_UNKNOWN));
 
52
      set.find (AspectRef (a, AspectRef::AR_UNKNOWN));
52
53
    if (ref_entry == set.end ()) {
53
54
      // simply insert a new entry if the aspect has not been found
54
 
      set.insert (AspectRef (ai, acai, kind));
 
55
      set.insert (AspectRef (a, kind));
55
56
    }
56
57
    else {
57
58
      // a definition request dominates a declaration request...
63
64
}
64
65
 
65
66
// generate the #include directive for a given aspect header unit
66
 
string AspectIncludes::generate (CProject &project, ACAspectInfo *acai) {
 
67
string AspectIncludes::generate (CProject &project, JPL_Aspect *a) {
67
68
  string include_directive;
68
69
 
69
 
  Unit *unit = aspect_unit (acai);
 
70
  Unit *unit = aspect_unit (a);
70
71
  
71
72
  // get the name, which we have to use to include the file
72
73
  Filename include_file = project.getInclString (unit->name ());
79
80
}
80
81
 
81
82
// generate the #include directives for a given unit
82
 
string AspectIncludes::generate (CProject &prj, const_iterator entry) const {
 
83
string AspectIncludes::generate (const_iterator entry,
 
84
                                 const BackEndProblems &bep) const {
83
85
  string includes;
84
86
  const AspectRefSet &set = (*entry).second;
85
87
  for (AspectRefSet::const_iterator iter = set.begin ();
88
90
    switch ((*iter)._kind) {
89
91
      case AspectRef::AR_DECL: 
90
92
        includes += "class ";
91
 
        includes += (*iter)._concrete_aspect->name ();
 
93
        includes += (*iter)._aspect->name ();
92
94
        includes += ";\n";
93
95
        break;
94
96
      case AspectRef::AR_ADVICE:
95
97
        {
96
 
          includes += (*iter)._concrete_aspect->ifct_decls ();
97
 
          Unit *unit = aspect_unit (*iter);
 
98
          includes += (*iter)._aspect->ifct_decls (bep);
 
99
          Unit *unit = aspect_unit (&(*iter)._aspect->loc ());
98
100
          assert (unit && unit->isFile ());
99
101
          stringstream define;
100
102
          define << "#ifndef __ac_need_";