File: ThisJoinPoint.h

package info (click to toggle)
aspectc%2B%2B 1.0pre4~svn.20090918-1
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 117,308 kB
  • ctags: 410,601
  • sloc: cpp: 1,883,007; ansic: 17,279; sh: 2,190; makefile: 1,088
file content (123 lines) | stat: -rw-r--r-- 4,335 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
// This file is part of the AspectC++ compiler 'ac++'.
// Copyright (C) 1999-2003  The 'ac++' developers (see aspectc.org)
//                                                                
// This program is free software;  you can redistribute it and/or 
// modify it under the terms of the GNU General Public License as 
// published by the Free Software Foundation; either version 2 of 
// the License, or (at your option) any later version.            
//                                                                
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of 
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  
// GNU General Public License for more details.                   
//                                                                
// You should have received a copy of the GNU General Public      
// License along with this program; if not, write to the Free     
// Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, 
// MA  02111-1307  USA                                            

#ifndef __ThisJoinPoint_h__
#define __ThisJoinPoint_h__

#include <iostream>
using namespace std;

#include "Puma/Array.h"
#include "BackEndProblems.h"
using namespace Puma;

class JoinPoint;
class Binding;
#ifdef ACMODEL
class ACM_Any;
class ACM_Code;
#else
class JoinPointLoc;
class JPL_Code;
#endif 

namespace Puma {
  class Token;
  class CFunctionInfo;
  class CTypeInfo;
  class CTree;
} // namespace Puma

class ThisJoinPoint {
  enum
    {
      // these values define required information
      SIGNATURE=0x1, ARGS=0x2, ARG=0x4, ARG_TYPE=0x8,
      TYPE=0x10, ID=0x20, RESULT_TYPE=0x40, RESULT=0x80,
      THAT=0x100, TARGET=0x200, JP_TYPE=0x400, ACTION=0x800,
      WRAPPER=0x1000, PROCEED=0x2000, FILENAME=0x4000, LINE=0x8000,
      // does the advice need a pointer 'tjp'
      PTR_NEEDED=0x10000,
      // does the advice need an alias 'thisJoinPoint' for 'tjp'
      PTR_ALIAS_NEEDED=0x20000,
      // does the advice need the type JoinPoint
      TYPE_NEEDED=0x40000
    };
  
  unsigned int _used;
  bool _setup;
  
  void setup_search (CFunctionInfo *func, CTree *node);
  
public:
  ThisJoinPoint () : _used (0), _setup (false) {}
  
  void setup (CFunctionInfo *func);
  void setup (const Binding &binding);
  void conditional () { _used |= (PROCEED|TYPE_NEEDED|PTR_NEEDED); }
  bool setup () const { return _setup; }
    
  bool signature () const { return (_used & SIGNATURE); }
  bool filename () const { return (_used & FILENAME); }
  bool line () const { return (_used & LINE); }
  bool args () const { return (_used & ARGS); }
  bool arg () const { return (_used & ARG); }
  bool argtype() const { return (_used & ARG_TYPE); }
  bool type() const { return (_used & TYPE); }
  bool id() const { return (_used & ID); }
  bool resulttype() const { return (_used & RESULT_TYPE); }
  bool that() const { return (_used & THAT); }
  bool target() const { return (_used & TARGET); }
  bool result() const { return (_used & RESULT); }
  bool jptype() const { return (_used & JP_TYPE); }
  bool action() const { return (_used & ACTION); }
  bool wrapper() const { return (_used & WRAPPER); }
  bool proceed() const { return (_used & PROCEED); }
  
#ifdef ACMODEL
  void gen_tjp_struct (ostream &code, ACM_Code *loc,
                       BackEndProblems &bep, int depth) const;
  void gen_tjp_init (ostream &code, ACM_Code *loc,
                     BackEndProblems &bep, int depth) const;
#else
  void gen_tjp_struct (ostream &code, JPL_Code *loc,
                       BackEndProblems &bep, int depth) const;
  void gen_tjp_init (ostream &code, JPL_Code *loc,
                     BackEndProblems &bep, int depth) const;
#endif
  void dump (ostream &os) const;
  
  bool pointer_needed () const { return (_used & PTR_NEEDED); }
  bool pointer_alias_needed () const { return (_used & PTR_ALIAS_NEEDED); }
  bool type_needed () const { return (_used & TYPE_NEEDED); }
  
  bool useAction() const {
    return action();
  }
  
  void merge (const ThisJoinPoint &from) { _used |= from._used; }
  void clear () { _used = 0; }
  
#ifdef ACMODEL
  static string gen_result_type (ACM_Code *jpl);
#else
  static string gen_result_type (JPL_Code *jpl);
#endif
};
  
#endif // __ThisJoinPoint_h__