1 | /*
|
---|
2 | * TOPPERS Software
|
---|
3 | * Toyohashi Open Platform for Embedded Real-Time Systems
|
---|
4 | *
|
---|
5 | * Copyright (C) 2007-2008 by TAKAGI Nobuhisa
|
---|
6 | *
|
---|
7 | * ãLì ÒÍCȺÌ(1)`(4)Ìðð½·êÉÀèC{\tgEF
|
---|
8 | * Ai{\tgEFAðüϵ½àÌðÜÞDȺ¯¶jðgpE¡»Eü
|
---|
9 | * ÏEÄzziȺCpÆÄÔj·é±Æð³Åø·éD
|
---|
10 | * (1) {\tgEFAð\[XR[hÌ`Åp·éêÉÍCãLÌì
|
---|
11 | * \¦C±Ìpð¨æѺL̳ÛØKèªC»ÌÜÜÌ`Å\[
|
---|
12 | * XR[hÉÜÜêÄ¢é±ÆD
|
---|
13 | * (2) {\tgEFAðCCu`®ÈÇC¼Ì\tgEFAJÉg
|
---|
14 | * pÅ«é`ÅÄzz·éêÉÍCÄzzɺ¤hL
|
---|
15 | gip
|
---|
16 | * Ò}j
|
---|
17 | AÈÇjÉCãLÌì \¦C±Ìpð¨æѺL
|
---|
18 | * ̳ÛØKèðfÚ·é±ÆD
|
---|
19 | * (3) {\tgEFAðC@íÉgÝÞÈÇC¼Ì\tgEFAJÉg
|
---|
20 | * pÅ«È¢`ÅÄzz·éêÉÍCÌ¢¸ê©Ìðð½·±
|
---|
21 | * ÆD
|
---|
22 | * (a) Äzzɺ¤hL
|
---|
23 | gipÒ}j
|
---|
24 | AÈÇjÉCãLÌ
|
---|
25 | * ì \¦C±Ìpð¨æѺL̳ÛØKèðfÚ·é±ÆD
|
---|
26 | * (b) ÄzzÌ`ÔðCÊÉèßéû@ÉæÁÄCTOPPERSvWFNgÉ
|
---|
27 | * ñ·é±ÆD
|
---|
28 | * (4) {\tgEFAÌpÉæè¼ÚIܽÍÔÚIɶ¶é¢©Èé¹
|
---|
29 | * Q©çàCãLì Ò¨æÑTOPPERSvWFNgðÆÓ·é±ÆD
|
---|
30 | * ܽC{\tgEFAÌ[UܽÍGh[U©çÌ¢©Èé
|
---|
31 | * RÉîÿ©çàCãLì Ò¨æÑTOPPERSvWFNgð
|
---|
32 | * ÆÓ·é±ÆD
|
---|
33 | *
|
---|
34 | * {\tgEFAÍC³ÛØÅñ³êÄ¢éàÌÅ éDãLì Ò¨
|
---|
35 | * æÑTOPPERSvWFNgÍC{\tgEFAÉÖµÄCÁèÌgpÚI
|
---|
36 | * ÉηéK«àÜßÄC¢©ÈéÛØàsíÈ¢DܽC{\tgEF
|
---|
37 | * AÌpÉæè¼ÚIܽÍÔÚIɶ¶½¢©Èé¹QÉÖµÄàC»
|
---|
38 | * ÌÓCðíÈ¢D
|
---|
39 | *
|
---|
40 | */
|
---|
41 | /*!
|
---|
42 | * \file toppers/oil/cfg1_out.hpp
|
---|
43 | * \brief cfg1_out.c/.srec t@C𵤽ßÌé¾è`
|
---|
44 | *
|
---|
45 | * ±Ìt@CÅè`³êéNX
|
---|
46 | * \code
|
---|
47 | * class cfg1_out;
|
---|
48 | * \endcode
|
---|
49 | */
|
---|
50 | #ifndef TOPPERS_OIL_CFG1_OUT_HPP_
|
---|
51 | #define TOPPERS_OIL_CFG1_OUT_HPP_
|
---|
52 |
|
---|
53 | #include <string>
|
---|
54 | #include <vector>
|
---|
55 | #include <map>
|
---|
56 | #include "toppers/workaround.hpp"
|
---|
57 | #include "toppers/codeset.hpp"
|
---|
58 | #include "toppers/oil/oil_object.hpp"
|
---|
59 |
|
---|
60 | namespace toppers
|
---|
61 | {
|
---|
62 |
|
---|
63 | class macro_processor;
|
---|
64 | class s_record;
|
---|
65 | class nm_symbol;
|
---|
66 |
|
---|
67 | namespace oil
|
---|
68 | {
|
---|
69 | using namespace toppers::oil::oil_definition;
|
---|
70 |
|
---|
71 | /*!
|
---|
72 | * \class cfg1_out cfg1_out.hpp "toppers/oil/cfg1_out.hpp"
|
---|
73 | * \brief cfg1_out.c/.srec t@CÇNX
|
---|
74 | */
|
---|
75 | class cfg1_out
|
---|
76 | {
|
---|
77 | public:
|
---|
78 | struct cfg1_def_t
|
---|
79 | {
|
---|
80 | bool is_signed;
|
---|
81 | std::string name;
|
---|
82 | std::string expression;
|
---|
83 | };
|
---|
84 | typedef std::map< std::string, std::vector< object_definition* > > cfg_obj_map;
|
---|
85 | typedef std::vector< cfg1_def_t > cfg1_def_table;
|
---|
86 |
|
---|
87 | explicit cfg1_out( std::string const& filename, cfg1_def_table const* def_table = 0 );
|
---|
88 | cfg1_out( cfg1_out const& other );
|
---|
89 | virtual ~cfg1_out();
|
---|
90 | cfg1_out& operator = ( cfg1_out const& other )
|
---|
91 | {
|
---|
92 | cfg1_out t( other );
|
---|
93 | swap( t );
|
---|
94 | return *this;
|
---|
95 | }
|
---|
96 |
|
---|
97 | void load_cfg( std::string const& input_file, codeset_t codeset, std::vector<std::string> const* obj_info );
|
---|
98 | void generate( char const* type = 0 ) const;
|
---|
99 | std::string const& get_includes() const;
|
---|
100 |
|
---|
101 | void load_srec();
|
---|
102 | std::tr1::shared_ptr< s_record > get_srec() const;
|
---|
103 | std::tr1::shared_ptr< nm_symbol > get_syms() const;
|
---|
104 | cfg1_def_table const* get_def_table() const;
|
---|
105 | cfg_obj_map merge(void) const;
|
---|
106 | bool is_little_endian() const;
|
---|
107 |
|
---|
108 | void swap( cfg1_out& other )
|
---|
109 | {
|
---|
110 | implementation* t = pimpl_;
|
---|
111 | pimpl_ = other.pimpl_;
|
---|
112 | other.pimpl_ = t;
|
---|
113 | }
|
---|
114 | void swap(cfg_obj_map& other)
|
---|
115 | {
|
---|
116 |
|
---|
117 | }
|
---|
118 |
|
---|
119 | static std::tr1::int32_t make_signed( std::tr1::uint32_t value )
|
---|
120 | {
|
---|
121 | std::tr1::int32_t result;
|
---|
122 | if ( ( value >> 31 ) != 0 )
|
---|
123 | {
|
---|
124 | result = -static_cast< std::tr1::int32_t >( ( value ^ 0xffffffff ) + 1 ); // 2Ìâ\»Éµ©ÎµÈ¢
|
---|
125 | }
|
---|
126 | else
|
---|
127 | {
|
---|
128 | result = static_cast< std::tr1::int32_t >( value );
|
---|
129 | }
|
---|
130 | return result;
|
---|
131 | }
|
---|
132 |
|
---|
133 |
|
---|
134 | protected:
|
---|
135 | struct implementation;
|
---|
136 | explicit cfg1_out( implementation* pimpl ) : pimpl_( pimpl ) {}
|
---|
137 | private:
|
---|
138 | implementation* pimpl_;
|
---|
139 | };
|
---|
140 |
|
---|
141 | }
|
---|
142 | }
|
---|
143 |
|
---|
144 | #endif // ! TOPPERS_OIL_CFG1_OUT_HPP_
|
---|