Update copyright to LGPL on all files
[dyninst.git] / dyninstAPI / h / BPatch_sourceObj.h
1 /*
2  * Copyright (c) 1996-2009 Barton P. Miller
3  * 
4  * We provide the Paradyn Parallel Performance Tools (below
5  * described as "Paradyn") on an AS IS basis, and do not warrant its
6  * validity or performance.  We reserve the right to update, modify,
7  * or discontinue this software at any time.  We shall have no
8  * obligation to supply such updates or modifications or any other
9  * form of support to you.
10  * 
11  * By your use of Paradyn, you understand and agree that we (or any
12  * other person or entity with proprietary rights in Paradyn) are
13  * under no obligation to provide either maintenance services,
14  * update services, notices of latent defects, or correction of
15  * defects for Paradyn.
16  * 
17  * This library is free software; you can redistribute it and/or
18  * modify it under the terms of the GNU Lesser General Public
19  * License as published by the Free Software Foundation; either
20  * version 2.1 of the License, or (at your option) any later version.
21  * 
22  * This library is distributed in the hope that it will be useful,
23  * but WITHOUT ANY WARRANTY; without even the implied warranty of
24  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
25  * Lesser General Public License for more details.
26  * 
27  * You should have received a copy of the GNU Lesser General Public
28  * License along with this library; if not, write to the Free Software
29  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
30  */
31
32 #ifndef _BPatch_sourceObj_h_
33 #define _BPatch_sourceObj_h_
34
35 #include "BPatch_dll.h"
36 #include "BPatch_Vector.h"
37
38 class BPatch_type;
39 class BPatch_variableExpr;
40 class BPatch_point;
41
42 #ifdef IBM_BPATCH_COMPAT
43 #define BPatch_unknownLanguage BPatch_language_unknown
44 #endif
45 typedef enum BPatch_language {
46     BPatch_c, 
47     BPatch_cPlusPlus, 
48     BPatch_fortran, 
49     BPatch_fortran77, 
50     BPatch_fortran90,
51     BPatch_f90_demangled_stabstr, 
52     BPatch_fortran95,
53     BPatch_assembly, 
54     BPatch_mixed, 
55     BPatch_hpf, 
56     BPatch_java, 
57 #ifdef IBM_BPATCH_COMPAT
58     BPatch_language_unknown 
59 #else
60     BPatch_unknownLanguage 
61 #endif
62 } BPatch_language;
63
64 typedef enum BPatch_sourceType {
65 #ifdef IBM_BPATCH_COMPAT
66     BPatch_sourceUnknown,
67 #else
68     BPatch_sourceUnknown_type,
69 #endif
70     BPatch_sourceProgram,
71     BPatch_sourceModule,
72     BPatch_sourceFunction,
73     BPatch_sourceOuterLoop,
74     BPatch_sourceLoop,
75 #ifdef IBM_BPATCH_COMPAT
76     BPatch_sourceTypeBlock,
77 #else
78     BPatch_srcBlock,
79 #endif
80     BPatch_sourceStatement
81 } BPatch_sourceType;
82
83
84 class BPATCH_DLL_EXPORT BPatch_sourceObj {
85  public:
86     virtual ~BPatch_sourceObj() { };
87
88       BPatch_sourceType getSrcType() { return _srcType; }
89       virtual bool getSourceObj(BPatch_Vector<BPatch_sourceObj *> &) = 0;
90       virtual bool getVariables(BPatch_Vector<BPatch_variableExpr *> &) = 0;
91       virtual BPatch_sourceObj *getObjParent() = 0;
92
93       //BPatch_Vector<BPatch_variableExpr *> *findVariable(const char *name);
94       BPatch_language getLanguage() { return _srcLanguage; }
95       const char *getLanguageStr() {return strLanguage(_srcLanguage);}
96       //BPatch_type *getType(char *name);
97       //BPatch_Vector<char *> *getLoadedFileNames();
98       //char *getName(char *buf, unsigned int len);
99       //int getNameLen();
100
101 #ifdef IBM_BPATCH_COMPAT
102       virtual bool getAddressRange(void*& /*_startAddress*/, void*& /*_endAddress*/) {return false;}
103       virtual bool getLineNumbers(unsigned int & /*_startLine*/, unsigned int  & /*_endLine*/) {return false;}
104       virtual void getIncPoints(BPatch_Vector<BPatch_point *> & /*vect*/) {return;}
105       virtual void getExcPoints(BPatch_Vector<BPatch_point *> & /*vect*/) {return;}
106 #endif
107   protected:
108       enum BPatch_sourceType _srcType;
109       BPatch_language _srcLanguage;
110       void setLanguage(BPatch_language lang) { _srcLanguage = lang; }
111
112     const char *strLanguage(BPatch_language l) {
113         switch(l) {
114         case BPatch_c: return "BPatch_c";
115         case BPatch_cPlusPlus: return "BPatch_cPlusPlus";
116         case BPatch_fortran: return "BPatch_fortran";
117         case BPatch_fortran77: return "BPatch_fortran77";
118         case BPatch_fortran90: return "BPatch_fortran90";
119         case BPatch_f90_demangled_stabstr: return "BPatch_fortran90_demangled_stabstr";
120         case BPatch_fortran95: return "BPatch_fortran95";
121         case BPatch_assembly: return "BPatch_assembly";
122         case BPatch_mixed: return "BPatch_mixed";
123         case BPatch_hpf: return "BPatch_hpf";
124         case BPatch_java: return "BPatch_java";
125         case BPatch_unknownLanguage: return "BPatch_unknownLanguage";
126         default: return "strLanguage:  bad conversion -- FIXME";
127         }
128         return "strLanguage:  bad conversion -- FIXME";
129       }
130
131 };
132
133 #endif