Otawa  0.10
ASTLoader.h
Go to the documentation of this file.
1 /*
2  * ASTLoader class interface
3  *
4  * This file is part of OTAWA
5  * Copyright (c) 2005, IRIT UPS.
6  *
7  * OTAWA is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 2 of the License, or
10  * (at your option) any later version.
11  *
12  * OTAWA is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with OTAWA; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
20  */
21 #ifndef OTAWA_AST_AST_LOADER_H
22 #define OTAWA_AST_AST_LOADER_H
23 
24 #include <elm/genstruct/Vector.h>
25 #include <otawa/proc/Processor.h>
26 
27 // Externals
28 namespace otawa {
29  namespace ast { class ASTLoader; }
30  class File;
31 }
32 int ast_parse(otawa::ast::ASTLoader *loader);
33 void ast_error(otawa::ast::ASTLoader *loader, const char *msg);
34 
35 namespace otawa { namespace ast {
36 
37 // ASTLoader class
38 class ASTLoader: public Processor {
39  friend int ::ast_parse(ASTLoader *loader);
40  friend void ::ast_error(ASTLoader *loader, const char *msg);
41 
46 
47  void onError(const char *fmt, ...);
49  address_t findLabel(elm::String raw_label);
50 public:
51  static p::declare reg;
52 
53  // Constructors
54  ASTLoader(p::declare& r = reg);
55 
56  // Processor overload
57  virtual void configure(PropList& props);
58  virtual void processWorkSpace(WorkSpace *ws);
59 };
60 
61 } } // otawa::ast
62 
63 #endif // OTAWA_AST_AST_LOADER_H
static p::declare reg
Definition: ASTLoader.h:51
Class to declare simple a processor.
Definition: Registration.h:213
virtual void processWorkSpace(WorkSpace *ws)
Process the given framework.
Definition: ast_ASTLoader.cpp:103
void onError(const char *fmt,...)
Definition: ast_ASTLoader.cpp:93
ASTLoader(p::declare &r=reg)
Build a new AST loader.
Definition: ast_ASTLoader.cpp:53
This class represents a file involved in the building of a process.
Definition: File.h:43
dtd::Element exit(dtd::make("exit", _EXIT).attr(id))
elm::genstruct::Vector< String > calls
Definition: ASTLoader.h:43
The processor class is implemented by all code processor.
Definition: Processor.h:49
This class may be used for loading AST from an external file using the Heptane format (see doc/ direc...
Definition: ASTLoader.h:38
address_t findLabel(elm::String raw_label)
Resolve an Heptane label to an address.
Definition: ast_ASTLoader.cpp:221
dtd::Element entry(dtd::make("entry", _ENTRY).attr(id))
A workspace represents a program, its run-time and all information about WCET computation or any othe...
Definition: WorkSpace.h:67
The representation of an address in OTAWA.
Definition: base.h:54
WorkSpace * ws
Definition: ASTLoader.h:44
elm::String path
Definition: ASTLoader.h:42
int ast_parse(otawa::ast::ASTLoader *loader)
virtual void configure(PropList &props)
Definition: ast_ASTLoader.cpp:86
This is the base class for the representation of programs as Abstract Syntax Trees.
Definition: AST.h:53
This a list of properties.
Definition: PropList.h:63
File * file
Definition: ASTLoader.h:45
void ast_error(otawa::ast::ASTLoader *loader, const char *msg)
Definition: ast_parser.cpp:1735
AST * makeBlock(elm::CString entry, elm::CString exit)
Build a block or a sequence of calls and block from the recorded calls and the entry and exit of the ...
Definition: ast_ASTLoader.cpp:143