source: cfg_oil/trunk/toppers/oil/cfg1_out.hpp@ 8

Last change on this file since 8 was 8, checked in by msugi, 13 years ago

ディレクトリ構造の作成,ソース一式とReleaseビルドのコミット.

File size: 4.4 KB
Line 
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–{ƒ\ƒtƒgƒEƒF
8 * ƒAi–{ƒ\ƒtƒgƒEƒFƒA‚ð‰ü•Ï‚µ‚½‚à‚Ì‚ðŠÜ‚ށDˆÈ‰º“¯‚¶j‚ðŽg—pE•¡»E‰ü
9 * •ÏEÄ”z•ziˆÈ‰ºC—˜—p‚ƌĂԁj‚·‚邱‚Ƃ𖳏ž‚Å‹–‘ø‚·‚éD
10 * (1) –{ƒ\ƒtƒgƒEƒFƒA‚ðƒ\[ƒXƒR[ƒh‚ÌŒ`‚Å—˜—p‚·‚éê‡‚ɂ́Cã‹L‚Ì’˜ì
11 * Œ •\Ž¦C‚±‚Ì—˜—pðŒ‚¨‚æ‚щº‹L‚Ì–³•ÛØ‹K’肪C‚»‚Ì‚Ü‚Ü‚ÌŒ`‚Ń\[
12 * ƒXƒR[ƒh’†‚ÉŠÜ‚Ü‚ê‚Ä‚¢‚邱‚ƁD
13 * (2) –{ƒ\ƒtƒgƒEƒFƒA‚ðCƒ‰ƒCƒuƒ‰ƒŠŒ`Ž®‚ȂǁC‘¼‚̃\ƒtƒgƒEƒFƒAŠJ”­‚ÉŽg
14 * —p‚Å‚«‚éŒ`‚ōĔz•z‚·‚éê‡‚ɂ́CÄ”z•z‚É”º‚¤ƒhƒLƒ…
15ƒƒ“ƒgi—˜—p
16 * ŽÒƒ}ƒjƒ…
17ƒAƒ‹‚Ȃǁj‚ɁCã‹L‚Ì’˜ìŒ •\Ž¦C‚±‚Ì—˜—pðŒ‚¨‚æ‚щº‹L
18 * ‚Ì–³•ÛØ‹K’è‚ðŒfÚ‚·‚邱‚ƁD
19 * (3) –{ƒ\ƒtƒgƒEƒFƒA‚ðC‹@Ší‚É‘g‚ݍž‚ނȂǁC‘¼‚̃\ƒtƒgƒEƒFƒAŠJ”­‚ÉŽg
20 * —p‚Å‚«‚È‚¢Œ`‚ōĔz•z‚·‚éê‡‚ɂ́CŽŸ‚Ì‚¢‚¸‚ê‚©‚ÌðŒ‚ð–ž‚½‚·‚±
21 * ‚ƁD
22 * (a) Ä”z•z‚É”º‚¤ƒhƒLƒ…
23ƒƒ“ƒgi—˜—pŽÒƒ}ƒjƒ…
24ƒAƒ‹‚Ȃǁj‚ɁCã‹L‚Ì’˜
25 * ìŒ •\Ž¦C‚±‚Ì—˜—pðŒ‚¨‚æ‚щº‹L‚Ì–³•ÛØ‹K’è‚ðŒfÚ‚·‚邱‚ƁD
26 * (b) Ä”z•z‚ÌŒ`‘Ô‚ðC•Ê‚É’è‚ß‚é•û–@‚É‚æ‚Á‚āCTOPPERSƒvƒƒWƒFƒNƒg‚É
27 * •ñ‚·‚邱‚ƁD
28 * (4) –{ƒ\ƒtƒgƒEƒFƒA‚Ì—˜—p‚É‚æ‚è’¼Ú“I‚Ü‚½‚͊ԐړI‚ɐ¶‚¶‚é‚¢‚©‚Ȃ鑹
29 * ŠQ‚©‚ç‚àCã‹L’˜ìŒ ŽÒ‚¨‚æ‚ÑTOPPERSƒvƒƒWƒFƒNƒg‚ð–Ɛӂ·‚邱‚ƁD
30 * ‚Ü‚½C–{ƒ\ƒtƒgƒEƒFƒA‚̃†[ƒU‚Ü‚½‚̓Gƒ“ƒhƒ†[ƒU‚©‚ç‚Ì‚¢‚©‚Ȃ闝
31 * —R‚ÉŠî‚­¿‹‚©‚ç‚àCã‹L’˜ìŒ ŽÒ‚¨‚æ‚ÑTOPPERSƒvƒƒWƒFƒNƒg‚ð
32 * –Ɛӂ·‚邱‚ƁD
33 *
34 * –{ƒ\ƒtƒgƒEƒFƒA‚́C–³•ÛØ‚Å’ñ‹Ÿ‚³‚ê‚Ä‚¢‚é‚à‚Ì‚Å‚ ‚éDã‹L’˜ìŒ ŽÒ‚¨
35 * ‚æ‚ÑTOPPERSƒvƒƒWƒFƒNƒg‚́C–{ƒ\ƒtƒgƒEƒFƒA‚ÉŠÖ‚µ‚āC“Á’è‚ÌŽg—p–Ú“I
36 * ‚ɑ΂·‚é“K‡«‚àŠÜ‚߂āC‚¢‚©‚È‚é•ÛØ‚às‚í‚È‚¢D‚Ü‚½C–{ƒ\ƒtƒgƒEƒF
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ƒ‹‚Å’è‹`‚³‚ê‚éƒNƒ‰ƒX
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
60namespace 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ƒ‹ŠÇ—ƒNƒ‰ƒX
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_
Note: See TracBrowser for help on using the repository browser.