1 #ifndef ARCHITECTURE_H_
2 #define ARCHITECTURE_H_
5 #include <msp/datafile/loader.h>
12 Stores information about an architecture. This includes CPU type, model and
13 bitness and operating system.
18 class Loader: public Msp::DataFile::ObjectLoader<Architecture>
21 Loader(Architecture &);
24 typedef std::list<Pattern> PatternList;
33 std::string toolchain;
36 std::string cross_prefix;
37 std::map<std::string, PatternList> filename_patterns;
40 Architecture(Builder &b, const std::string &spec);
42 const std::string &get_type() const { return type; }
43 const std::string &get_name() const { return name; }
44 const std::string &get_system() const { return system; }
45 unsigned get_bits() const { return bits; }
46 const std::string &get_cpu() const { return cpu; }
47 const std::string &get_fpu() const { return fpu; }
48 const std::string &get_toolchain() const { return toolchain; }
49 bool match_name(const std::string &) const;
50 std::string best_match(const std::vector<std::string> &) const;
51 bool is_native() const { return native; }
52 bool is_cross() const { return !cross_prefix.empty(); }
54 const std::string &get_cross_prefix() const { return cross_prefix; }
57 const PatternList &get_patterns() const;
60 std::string create_filename(const std::string &) const;
64 void add_pattern(const std::string &);
67 static void resolve_aliases(std::vector<std::string> &);
68 void parse_specification(const std::string &);
72 inline const Architecture::PatternList &Architecture::get_patterns() const
74 std::map<std::string, PatternList>::const_iterator i = filename_patterns.find(typeid(T).name());
75 if(i!=filename_patterns.end())
78 static PatternList empty;
83 inline std::string Architecture::create_filename(const std::string &base) const
85 const PatternList &patterns = get_patterns<T>();
86 return patterns.empty() ? base : patterns.front().apply(base);