RuCodeGen 0.1.0 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/LICENSE CHANGED
@@ -1,5 +1,5 @@
1
1
  #
2
- # Copyright (c) 2005, Yauheni Akhotnikau
2
+ # Copyright (c) 2005-2006, Yauheni Akhotnikau
3
3
  # All rights reserved.
4
4
  #
5
5
  # Redistribution and use in source and binary forms, with or without modification,
data/NEWS ADDED
@@ -0,0 +1,4 @@
1
+ 2006.05.12 * ������ 0.2.0 *
2
+ ����������� ��������� ���������� RuCodeGen �������� (�.�. ��������,
3
+ ������� ��������� ������ ������� �����, ��������, ������ C++ �����).
4
+
data/README CHANGED
@@ -5,7 +5,8 @@
5
5
  RuCodeGen � ��� ������� ���������� ��� �������������. RuCodeGen ������� �� ����
6
6
  ������ � ���������� ���������� ��� ��������� ���������������, � ���������� ������� ���������������.
7
7
 
8
- ��������� ��. {docs/Principle}[link://files/docs/Principle.html].
8
+ ��������� ��. {docs/Principle}[link://files/docs/Principle.html]
9
+ {docs/EmbededRuCodeGen}[link://files/docs/EmbededRuCodeGen.html].
9
10
 
10
11
  == ������� ��������������
11
12
 
@@ -16,6 +17,7 @@ RuCodeGen
16
17
 
17
18
  * {cpp/value_incapsulator/host_config}[link://files/docs/examples/cpp/value_incapsulator/host_config.html]
18
19
  * {cpp/value_incapsulator/cfg}[link://files/docs/examples/cpp/value_incapsulator/cfg.html]
20
+ * {cpp/value_incapsulator/embeded_cfg}[link://files/docs/examples/cpp/value_incapsulator/embeded_cfg.html]
19
21
  * {cpp/custom/submit_deliver}[link://files/docs/examples/cpp/custom/submit_deliver.html]
20
22
 
21
23
  == �����������
data/Rakefile CHANGED
@@ -4,11 +4,11 @@ Gem::manage_gems
4
4
  require 'rake/gempackagetask'
5
5
 
6
6
  PKG_NAME =
7
- RKG_VERSION = '0.1.0'
7
+ PKG_VERSION = '0.2.0'
8
8
 
9
9
  spec = Gem::Specification.new do |s|
10
10
  s.name = "RuCodeGen"
11
- s.version = "0.1.0"
11
+ s.version = PKG_VERSION
12
12
  s.author = "Yauheni Akhotnikau"
13
13
  s.email = "eao197@yahoo.com"
14
14
  s.homepage = "http://eao197.narod.ru/projects"
@@ -21,7 +21,7 @@ spec = Gem::Specification.new do |s|
21
21
  s.test_file = "tests/ts_rucodegen.rb"
22
22
  s.has_rdoc = true
23
23
  s.rdoc_options = [ '-c', 'windows-1251', '-S', '--main', 'README' ]
24
- s.extra_rdoc_files = [ "README", "Rakefile", "LICENSE" ] + FileList[ "docs/**/*" ].to_a
24
+ s.extra_rdoc_files = [ "README", "Rakefile", "LICENSE", "NEWS" ] + FileList[ "docs/**/*" ].to_a
25
25
  end
26
26
 
27
27
  gem = Rake::GemPackageTask.new( spec ) do |pkg|
@@ -0,0 +1,61 @@
1
+ = ������������ RuCodeGen
2
+
3
+ � ������ 0.2.0 � RuCodeGen ���� ��������� ����������� ���������� RuCodeGen
4
+ �������� ������ ������ ������ (� ������ 0.1.0 RuCodeGen �������� ������ ����
5
+ ������������� � ��������������� � ��������������� Ruby-�����, ������� �
6
+ ���������� �� ���������).
7
+
8
+ ���������� RuCodeGen ������ ���������� �� ������, � ������� ���� ���������
9
+ <tt>RuCodeGen::Embeded::begin</tt>, ����� ������ ���� ��� RuCodeGen ��������,
10
+ ����� ������ � ��������� <tt>RuCodeGen::Embeded::end</tt>. ��������, � C++
11
+ ����������� RuCodeGen ����� ���������, ��������, ���:
12
+
13
+ #if 0 /* RuCodeGen::Embeded::begin */
14
+ ... # RuCodeGen ��������...
15
+ #endif /* RuCodeGen::Embeded::end */
16
+
17
+ ��� ��:
18
+
19
+ /* RuCodeGen::Embeded::begin
20
+ ... # RuCodeGen ��������...
21
+ RuCodeGen::Embeded::end */
22
+
23
+ ��� ��������� ������������ RuCodeGen �������� �������� �����
24
+ process_embeded_rucodegen, ������� �������� �� ���� ��� ����� �� �����������
25
+ ���������� � ����� ������������� (:build ��� :clean). ��������� �������������
26
+ ��� ������������� �������� �����, ��������, ��������� ��������� �������:
27
+
28
+ ruby -e"require 'rubygems'; require_gem 'RuCodeGen'; process_embeded_rucodegen('test.cpp',:build)"
29
+
30
+ ������, ��������������, ��� ������������ RuCodeGen ����� �������������� ������
31
+ �� ������������ �������������, ������� ���� ����� ������������ �������������
32
+ (��������, ������ ��� {Mxx_ru}[http://www.rubyforge.org/projects/mxx-ru].
33
+
34
+ == ������� ������ ������������� RuCodeGen
35
+
36
+ ����� process_embeded_rucodegen �������� ��� ��������� �����, �� ��������� ���
37
+ ���������� � �������� ������ ��� RuCodeGen-���������. ��� ���������
38
+ ������������ � ���� ��������� Ruby-���� � ������
39
+ <tt>src_file-embeded-rucodegen</tt> (��� src_file -- ��� ��� ��������� �����).
40
+ � ������ ���������� ����� ���������� ����������:
41
+
42
+ require 'rubygems'
43
+ require_gem 'RuCodeGen'
44
+
45
+ �.�. process_embeded_rucodegen ��������� ���������� ���� �� ����� RuCodeGen
46
+ ����������, ������� ���� ��������� � �������� ����. ����� ����� �����������
47
+ ruby � ������ ���������� ����� � �������� ��������� � ������������� �������� �
48
+ ������� ��������� ������������� RuCodeGen. ����� ���������� �������������
49
+ ��������� ���� ���������.
50
+
51
+ process_embeded_rucodegen ������� ��������� ����, �� � ������ :build ���������
52
+ ���� � md5-�����. ���� md5-���� ������������ ��� ����������� ��������������
53
+ ��� ����, ����� ��������� ������������� �������������. ���� ����� ���������,
54
+ ��� �������� ���� ����������, � ���������� � ���� RuCodeGen �������� -- ���. �
55
+ ����� ������� md5-��� ��� ���������� ����� ����� ���������� ����������.
56
+ md5-���� ������������ ��� ������ ��� ������� RuCodeGen � ������ :clean.
57
+
58
+ == ������ ������������� ������������� RuCodeGen
59
+
60
+ * {cpp/value_incapsulator/embeded_cfg}[link://files/docs/examples/cpp/value_incapsulator/embeded_cfg.html]
61
+
@@ -0,0 +1,25 @@
1
+ = [Embeded][RuCodeGen::ValueIncapsulator] cfg
2
+
3
+ == ���������������� ������
4
+
5
+ ���������������� ������ ������� ��������������� � C++ ����:
6
+
7
+ :include: examples/cpp/embeded_value_incapsulator/test.cpp
8
+
9
+ ��� ������������� ������������� ����� ��������� ��������� �������:
10
+
11
+ ruby -e"require 'rubygems'; require_gem 'RuCodeGen'; process_embeded_rucodegen('test.cpp',:build)"
12
+
13
+ ���� ��������������� ���������� RuCodeGen � {Mxx_ru}[http://www.rubyforge.org/projects/mxx-ru]:
14
+
15
+ require 'mxx_ru/cpp'
16
+ require 'mxx_ru/cpp/rucodegen'
17
+
18
+ Mxx_ru::Cpp::exe_target {
19
+ target 'test'
20
+
21
+ r = generator( Mxx_ru::Cpp::RuCodeGen.new( self ) )
22
+ r.add_embeded 'test.cpp'
23
+
24
+ cpp_source 'test.cpp'
25
+ }
@@ -0,0 +1,34 @@
1
+ #include <string>
2
+
3
+ std::string
4
+ default_self_mbox() { return "default"; }
5
+
6
+ const unsigned int default_low_watermark = 30;
7
+
8
+ #if 0 /* RuCodeGen::Embeded::begin */
9
+ cpp_value_incapsulator :cfg_t do |c|
10
+ c.decl_file :script_relative => "cfg.decl.hpp"
11
+ c.impl_file :script_relative => "cfg.impl.cpp"
12
+
13
+ c.attr_suffix "_"
14
+
15
+ c.attr :listening_mbox, "std::string"
16
+ c.attr :self_mbox, "std::string", :default => :"default_self_mbox()"
17
+ c.attr :interception_priority, "int", :default => 2
18
+ c.attr :low_watermark, "unsigned int", :default => :default_low_watermark
19
+ c.attr :high_watermark, "unsigned int"
20
+ c.attr :cprov_high_watermark, "unsigned int"
21
+ c.attr :max_life_time, "unsigned int", :default => 60
22
+ c.attr :check_life_time_period, "unsigned int", :default => 5
23
+
24
+ end
25
+ #endif /* RuCodeGen::Embeded::end */
26
+
27
+ #include "cfg.decl.hpp"
28
+ #include "cfg.impl.cpp"
29
+
30
+ int
31
+ main()
32
+ {
33
+ cfg_t cfg;
34
+ }
@@ -9,18 +9,25 @@ require 'rucodegen/run_mode'
9
9
  require 'rucodegen/generation_initiator'
10
10
 
11
11
  END {
12
+ # �� ����� ��������� ���� �������� ������, ���� ��� ���������
13
+ # �� �����, � �� ����� ����������� ����� ����� ��� �����
14
+ # ����� '-e' � ��������� ������. ������������ �������� ��� � ����
15
+ # ������� $0 ����� ����� '-' � '-e' ��������������. ��� �� ���
16
+ # ������� ��������� ������� ������ ����� (�� ������ ������, �.�.
17
+ # ��� ������ ����� ���� ����� ������).
18
+ if ![ '-', '-e' ].member?( $0 ) or File.exists?( $0 )
19
+ RUNMODE = RuCodeGen::RunMode
12
20
 
13
- RUNMODE = RuCodeGen::RunMode
14
-
15
- RUNMODE.detect
21
+ RUNMODE.detect
16
22
  #FIXME: ���������� ��������� �������� run_mode.
17
- if RUNMODE::BUILD == RUNMODE::mode ||
18
- RUNMODE::REBUILD == RUNMODE::mode
19
- RuCodeGen::CodegenInitiator.new( $0 ).initiate(
20
- RUNMODE::REBUILD == RUNMODE::mode )
21
- elsif RUNMODE::CLEAN == RUNMODE::mode
22
- RuCodeGen::CodegenInitiator.new( $0 ).clean
23
+ if RUNMODE::BUILD == RUNMODE::mode ||
24
+ RUNMODE::REBUILD == RUNMODE::mode
25
+ RuCodeGen::CodegenInitiator.new( $0 ).initiate(
26
+ RUNMODE::REBUILD == RUNMODE::mode )
27
+ elsif RUNMODE::CLEAN == RUNMODE::mode
28
+ RuCodeGen::CodegenInitiator.new( $0 ).clean
29
+ end
30
+ # ��������� ������ (DRY_RUN, HELP) ������������.
23
31
  end
24
- # ��������� ������ (DRY_RUN, HELP) ������������.
25
32
  }
26
33
 
@@ -0,0 +1,95 @@
1
+ =begin
2
+
3
+ ���������� ��������� RuCodeGen ��������, ��������� � ������ �����.
4
+
5
+ =end
6
+
7
+ module RuCodeGen
8
+
9
+ module Embeded
10
+
11
+ # �������� ���� ���� RuCodeGen ���������� �� ���������� �����.
12
+ #
13
+ # RuCodeGen �������� ���������� �� ������, � ������� ������������ ���������:
14
+ # RuCodeGen::Embeded::begin
15
+ # � ������������� RuCodeGen �������� �������, � ������� ������������:
16
+ # RuCodeGen::Embeded::end
17
+ #
18
+ # ������ ����������� ����������� RuCodeGen ��������:
19
+ # /* RuCodeGen::Embeded::begin
20
+ # cpp_value_incapsulator cfg_t do |c|
21
+ # ...
22
+ # end
23
+ # RuCodeGen::Embeded::end */
24
+ def Embeded.extract_fragments( file )
25
+ open_mark = /RuCodeGen::Embeded::begin/
26
+ close_mark = /RuCodeGen::Embeded::end/
27
+ expected_mark = open_mark
28
+ open_at = 0
29
+ line_no = 1
30
+
31
+ script_body = File.readlines( file ).inject( '' ) do |body, line|
32
+ if expected_mark == close_mark
33
+ if close_mark =~ line
34
+ expected_mark = open_mark
35
+ else
36
+ fail "#{file}:#{line_no}: open RuCodeGen inside opened fragment " +
37
+ "started at #{open_at}" if open_mark =~ line
38
+
39
+ body << line
40
+ end
41
+ elsif open_mark =~ line
42
+ expected_mark = close_mark
43
+ open_at = line_no
44
+ end
45
+ line_no += 1
46
+
47
+ body
48
+ end
49
+
50
+ fail "#{file}: unclosed RuCodeGen fragment open at #{open_at}" \
51
+ if expected_mark == close_mark
52
+
53
+ script_body
54
+ end
55
+
56
+ # ���������� ������������� ����� ������� ruby ��� ������������ �� ���������
57
+ # ����� ����������������� �������.
58
+ #
59
+ # [_src_file_name_] ��� ��������� �����, �� �������� ��� �������� ������;
60
+ # [_script_] ���������� ������������ �� ��������� ����� �������;
61
+ # [_mode_] ����� ������������� (:build ��� :clean).
62
+ def Embeded.run_generation( src_file_name, script, mode )
63
+ temp_script_name = src_file_name + '-embeded-rucodegen'
64
+ File.open( temp_script_name, 'w' ) do |f|
65
+ f << <<PROLOG
66
+ require 'rubygems'
67
+ require_gem 'RuCodeGen'
68
+
69
+ PROLOG
70
+ f << script
71
+ end
72
+
73
+ begin
74
+ `ruby #{temp_script_name} --mode #{mode}`
75
+ fail "Error running temporary script generated from #{src_file_name}" \
76
+ if $? and $?.exitstatus != 0
77
+ ensure
78
+ # � ����� ������ ��������� ���� ������ ���� ���������.
79
+ File.delete( temp_script_name )
80
+ end
81
+ end
82
+
83
+ end # module Embeded
84
+
85
+ end # module RuCodeGen
86
+
87
+ # ��������� ������������� �� ���������� � ��������� ���� RuCodeGen ���������.
88
+ #
89
+ # [_file_name_] ��� ����� �� ����������� ����������.
90
+ # [_mode_] ����� ������������� (:build ��� :clean).
91
+ def process_embeded_rucodegen( file_name, mode )
92
+ script = RuCodeGen::Embeded.extract_fragments( file_name )
93
+ RuCodeGen::Embeded.run_generation( file_name, script, mode )
94
+ end
95
+
data/lib/rucodegen.rb CHANGED
@@ -1,4 +1,5 @@
1
1
  $:.unshift( File.dirname(__FILE__) )
2
2
 
3
3
  require 'rucodegen/codegen'
4
+ require 'rucodegen/embeded'
4
5
 
@@ -0,0 +1,17 @@
1
+ This is file with embeded RuCodeGen scripts.
2
+
3
+ This text precedeed RuCogeGen script.
4
+
5
+ // RuCodeGen::Embeded::begin
6
+ cpp_value_incapsulator :host_config_t do |c|
7
+ c.decl_file :script_relative => "host_config.impl.hpp"
8
+ c.impl_file :script_relative => "host_config.impl.cpp"
9
+
10
+ c.attr_prefix "m_"
11
+
12
+ c.attr :host, "std::string", :default => "localhost"
13
+ c.attr :post, "short", :default => 8080
14
+ end
15
+ // RuCodeGen::Embeded::end
16
+
17
+ This text follow RuCodeGen script.
@@ -1,21 +1,21 @@
1
-
2
- host_config_t::host_config_t()
3
- : m_host("localhost")
4
- , m_post(8080)
5
-
6
- {}
7
-
8
- const std::string &
9
- host_config_t::host() const
10
- { return m_host; }
11
- void
12
- host_config_t::host( const std::string & v__ )
13
- { m_host = v__; }
14
- short
15
- host_config_t::post() const
16
- { return m_post; }
17
- void
18
- host_config_t::post( short v__ )
19
- { m_post = v__; }
20
-
1
+
2
+ host_config_t::host_config_t()
3
+ : m_host("localhost")
4
+ , m_post(8080)
5
+
6
+ {}
7
+
8
+ const std::string &
9
+ host_config_t::host() const
10
+ { return m_host; }
11
+ void
12
+ host_config_t::host( const std::string & v__ )
13
+ { m_host = v__; }
14
+ short
15
+ host_config_t::post() const
16
+ { return m_post; }
17
+ void
18
+ host_config_t::post( short v__ )
19
+ { m_post = v__; }
20
+
21
21
 
@@ -0,0 +1,9 @@
1
+ cpp_value_incapsulator :host_config_t do |c|
2
+ c.decl_file :script_relative => "host_config.impl.hpp"
3
+ c.impl_file :script_relative => "host_config.impl.cpp"
4
+
5
+ c.attr_prefix "m_"
6
+
7
+ c.attr :host, "std::string", :default => "localhost"
8
+ c.attr :post, "short", :default => 8080
9
+ end
File without changes
@@ -0,0 +1,13 @@
1
+ This file contains only empty RuCodeGen fragments.
2
+
3
+ First fragment:
4
+ RuCodeGen::Embeded::begin
5
+ RuCodeGen::Embeded::end
6
+
7
+ Second fragment:
8
+ RuCodeGen::Embeded::begin
9
+ RuCodeGen::Embeded::end
10
+
11
+ And yet another fragment:
12
+ RuCodeGen::Embeded::begin
13
+ RuCodeGen::Embeded::end
@@ -0,0 +1,7 @@
1
+ This file not empty but does not contains any RuCodeGen fragments
2
+
3
+ Provocation: RuCodeGen
4
+ Provocation: RuCodeGen::Embeded
5
+ Provocation: RuCodeGen::Embeded begin
6
+ Provocation: RuCodeGen::Embeded::begi
7
+
@@ -0,0 +1,21 @@
1
+ This file contains only empty RuCodeGen fragments.
2
+
3
+ First fragment:
4
+ RuCodeGen::Embeded::begin
5
+ # First RuCodeGen fragment.
6
+ RuCodeGen::Embeded::end
7
+
8
+ Second fragment:
9
+ RuCodeGen::Embeded::begin
10
+
11
+ # Second RuCodeGen fragment with some
12
+
13
+ # empty lines and
14
+ # spaces inside
15
+
16
+ RuCodeGen::Embeded::end
17
+
18
+ And yet another fragment:
19
+ RuCodeGen::Embeded::begin
20
+ # Yet another RuCodeGen fragment
21
+
@@ -0,0 +1,22 @@
1
+ This file contains only empty RuCodeGen fragments.
2
+
3
+ First fragment:
4
+ RuCodeGen::Embeded::begin
5
+ # First RuCodeGen fragment.
6
+ RuCodeGen::Embeded::end
7
+
8
+ Second fragment:
9
+ RuCodeGen::Embeded::begin
10
+
11
+ # Second RuCodeGen fragment with some
12
+
13
+ # empty lines and
14
+ # spaces inside
15
+
16
+ RuCodeGen::Embeded::End
17
+
18
+ And yet another fragment:
19
+ RuCodeGen::Embeded::begin
20
+ # Yet another RuCodeGen fragment
21
+
22
+ RuCodeGen::Embeded::end
@@ -0,0 +1,8 @@
1
+ # First RuCodeGen fragment.
2
+
3
+ # Second RuCodeGen fragment with some
4
+
5
+ # empty lines and
6
+ # spaces inside
7
+
8
+ # Yet another RuCodeGen fragment
@@ -0,0 +1,21 @@
1
+ This file contains only empty RuCodeGen fragments.
2
+
3
+ First fragment:
4
+ RuCodeGen::Embeded::begin
5
+ # First RuCodeGen fragment.
6
+ RuCodeGen::Embeded::end
7
+
8
+ Second fragment:
9
+ RuCodeGen::Embeded::begin
10
+
11
+ # Second RuCodeGen fragment with some
12
+
13
+ # empty lines and
14
+ # spaces inside
15
+
16
+ RuCodeGen::Embeded::end
17
+
18
+ And yet another fragment:
19
+ RuCodeGen::Embeded::begin
20
+ # Yet another RuCodeGen fragment
21
+ RuCodeGen::Embeded::end
@@ -0,0 +1,52 @@
1
+ $:.unshift( File.dirname( __FILE__ ) + "/../lib" )
2
+
3
+ require 'test/unit'
4
+
5
+ require 'rucodegen/embeded'
6
+
7
+ class TC_EmbededExtractFragments < Test::Unit::TestCase
8
+ DATA_PATH = File.dirname( __FILE__ ) + '/embeded_data'
9
+
10
+ def test_empty
11
+ s = extract_from( 'in_empty.txt' )
12
+ assert_equal( '', s )
13
+ end
14
+
15
+ def test_no_fragments
16
+ s = extract_from( 'in_no_fragments.txt' )
17
+ assert_equal( '', s )
18
+ end
19
+
20
+ def test_empty_fragments
21
+ s = extract_from( 'in_empty_fragments.txt' )
22
+ assert_equal( '', s )
23
+ end
24
+
25
+ def test_not_empty_fragments
26
+ s = extract_from( 'in_not_empty_fragments.txt' )
27
+ a = extract_answer_file( 'in_not_empty_fragments.answer.txt' )
28
+ assert_equal( a, s )
29
+ end
30
+
31
+ def test_not_closed_last_fragment
32
+ assert_raise( RuntimeError ) {
33
+ extract_from( 'in_not_closed_last_fragment.txt' )
34
+ }
35
+ end
36
+
37
+ def test_not_closed_not_last_fragment
38
+ assert_raise( RuntimeError ) {
39
+ extract_from( 'in_not_closed_not_last_fragment.txt' )
40
+ }
41
+ end
42
+
43
+ protected
44
+ def extract_from( file )
45
+ RuCodeGen::Embeded.extract_fragments( File.join( DATA_PATH, file ) )
46
+ end
47
+
48
+ def extract_answer_file( file )
49
+ File.read( File.join( DATA_PATH, file ) )
50
+ end
51
+ end
52
+
@@ -0,0 +1,84 @@
1
+ RUCODEGEN_SRC_PATH = File.dirname( __FILE__ ) + '/../lib'
2
+
3
+ $:.unshift( RUCODEGEN_SRC_PATH )
4
+
5
+ require 'test/unit'
6
+
7
+ require 'rucodegen/embeded'
8
+
9
+ class TC_EmbededRunRuCodeGen < Test::Unit::TestCase
10
+ DATA_PATH = File.dirname( __FILE__ ) + '/embeded_data'
11
+ SRC_PATH = 'host_config'
12
+ RESULTS_PATH = "#{SRC_PATH}/etalons"
13
+
14
+ def test_standalone
15
+ standalone = "#{SRC_PATH}/standalone.txt"
16
+ s = get_content( standalone )
17
+ process_codegen(
18
+ Proc.new {
19
+ RuCodeGen::Embeded.run_generation(
20
+ File.join( DATA_PATH, standalone ),
21
+ s,
22
+ :build )
23
+ },
24
+ Proc.new {
25
+ RuCodeGen::Embeded.run_generation(
26
+ File.join( DATA_PATH, standalone ),
27
+ s,
28
+ :clean )
29
+ }
30
+ )
31
+ end
32
+
33
+ def test_embeded
34
+ embeded = "#{DATA_PATH}/#{SRC_PATH}/embeded.txt"
35
+ process_codegen(
36
+ Proc.new { process_embeded_rucodegen( embeded, :build ) },
37
+ Proc.new { process_embeded_rucodegen( embeded, :clean ) } )
38
+ end
39
+
40
+ def test_embeded_via_run_ruby
41
+ embeded = "#{DATA_PATH}/#{SRC_PATH}/embeded.txt"
42
+ process_codegen(
43
+ Proc.new {
44
+ `ruby -I#{RUCODEGEN_SRC_PATH} -e"require 'rucodegen'; process_embeded_rucodegen( '#{embeded}', :build )"`
45
+ fail "Unable to build embeded RuCodeGen" if $? and 0 != $?.exitstatus
46
+ },
47
+ Proc.new {
48
+ `ruby -I#{RUCODEGEN_SRC_PATH} -e"require 'rucodegen'; process_embeded_rucodegen( '#{embeded}', :clean )"`
49
+ fail "Unable to clean embeded RuCodeGen" if $? and 0 != $?.exitstatus
50
+ }
51
+ )
52
+ end
53
+
54
+ protected
55
+ def process_codegen( build_block, clean_block )
56
+ header_file = 'host_config.impl.hpp'
57
+ source_file = 'host_config.impl.cpp'
58
+
59
+ assert_nothing_raised { build_block.call }
60
+
61
+ assert_equal(
62
+ get_content( "#{RESULTS_PATH}/#{header_file}" ),
63
+ get_content( "#{SRC_PATH}/#{header_file}" ) )
64
+ assert_equal(
65
+ get_content( "#{RESULTS_PATH}/#{source_file}" ),
66
+ get_content( "#{SRC_PATH}/#{source_file}" ) )
67
+
68
+ assert_nothing_raised { clean_block.call }
69
+
70
+ assert(
71
+ !File.exists?(
72
+ File.join( DATA_PATH, "#{SRC_PATH}/#{header_file}" ) ),
73
+ "'#{SRC_PATH}/#{header_file}' must be deleted" )
74
+ assert(
75
+ !File.exists?(
76
+ File.join( DATA_PATH, "#{SRC_PATH}/#{source_file}" ) ),
77
+ "'#{SRC_PATH}/#{source_file}' must be deleted" )
78
+ end
79
+
80
+ def get_content( file )
81
+ File.read( File.join( DATA_PATH, file ) )
82
+ end
83
+ end
84
+
@@ -9,3 +9,5 @@ require 'tc_codegen_initiator'
9
9
  require 'tc_class_attribute'
10
10
  require 'tc_value_incapsulator'
11
11
  require 'tc_value_incapsulator_gen'
12
+ require 'tc_embeded_extract_fragments'
13
+ require 'tc_embeded_run_rucodegen'
metadata CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.8.10
3
3
  specification_version: 1
4
4
  name: RuCodeGen
5
5
  version: !ruby/object:Gem::Version
6
- version: 0.1.0
7
- date: 2005-11-16
6
+ version: 0.2.0
7
+ date: 2006-05-12
8
8
  summary: Simple code generation tool
9
9
  require_paths:
10
10
  - lib
@@ -27,24 +27,42 @@ platform: ruby
27
27
  authors:
28
28
  - Yauheni Akhotnikau
29
29
  files:
30
+ - tests/embeded_data
30
31
  - tests/generators_test_extension.rb
31
32
  - tests/tc_class_attribute.rb
32
33
  - tests/tc_codegen_initiator.rb
34
+ - tests/tc_embeded_extract_fragments.rb
35
+ - tests/tc_embeded_run_rucodegen.rb
33
36
  - tests/tc_filename_producer.rb
34
37
  - tests/tc_generators.rb
35
38
  - tests/tc_run_mode.rb
36
39
  - tests/tc_value_incapsulator.rb
37
40
  - tests/tc_value_incapsulator_gen.rb
38
41
  - tests/ts_rucodegen.rb
42
+ - tests/embeded_data/host_config
43
+ - tests/embeded_data/in_empty.txt
44
+ - tests/embeded_data/in_empty_fragments.txt
45
+ - tests/embeded_data/in_not_closed_last_fragment.txt
46
+ - tests/embeded_data/in_not_closed_not_last_fragment.txt
47
+ - tests/embeded_data/in_not_empty_fragments.answer.txt
48
+ - tests/embeded_data/in_not_empty_fragments.txt
49
+ - tests/embeded_data/in_no_fragments.txt
50
+ - tests/embeded_data/host_config/embeded.txt
51
+ - tests/embeded_data/host_config/etalons
52
+ - tests/embeded_data/host_config/standalone.txt
53
+ - tests/embeded_data/host_config/etalons/host_config.impl.cpp
54
+ - tests/embeded_data/host_config/etalons/host_config.impl.hpp
39
55
  - lib/rucodegen
40
56
  - lib/rucodegen.rb
41
57
  - lib/rucodegen/begin_end.rb
42
58
  - lib/rucodegen/codegen.rb
59
+ - lib/rucodegen/embeded.rb
43
60
  - lib/rucodegen/filename_producer.rb
44
61
  - lib/rucodegen/generation_initiator.rb
45
62
  - lib/rucodegen/generators.rb
46
63
  - lib/rucodegen/run_mode.rb
47
64
  - lib/rucodegen/value_incapsulator.rb
65
+ - docs/EmbededRuCodeGen
48
66
  - docs/examples
49
67
  - docs/Principle
50
68
  - docs/ValueIncapsulator
@@ -53,24 +71,23 @@ files:
53
71
  - docs/examples/cpp/value_incapsulator
54
72
  - docs/examples/cpp/custom/submit_deliver
55
73
  - docs/examples/cpp/value_incapsulator/cfg
74
+ - docs/examples/cpp/value_incapsulator/embeded_cfg
56
75
  - docs/examples/cpp/value_incapsulator/host_config
57
76
  - examples/cpp
58
77
  - examples/cpp/custom
78
+ - examples/cpp/embeded_value_incapsulator
59
79
  - examples/cpp/value_incapsulator
60
80
  - examples/cpp/custom/submit_deliver
61
81
  - examples/cpp/custom/submit_deliver/submit_deliver.rb
62
82
  - examples/cpp/custom/submit_deliver/submit_deliver_gen.rb
63
- - examples/cpp/value_incapsulator/cfg.decl.hpp
64
- - examples/cpp/value_incapsulator/cfg.impl.cpp
83
+ - examples/cpp/embeded_value_incapsulator/test.cpp
65
84
  - examples/cpp/value_incapsulator/cg-cfg.rb
66
85
  - examples/cpp/value_incapsulator/cg-cfg.test.cpp
67
86
  - examples/cpp/value_incapsulator/cg-host_config.rb
68
- - examples/cpp/value_incapsulator/cout.log
69
- - examples/cpp/value_incapsulator/host_config.impl.cpp
70
- - examples/cpp/value_incapsulator/host_config.impl.hpp
71
87
  - README
72
88
  - Rakefile
73
89
  - LICENSE
90
+ - NEWS
74
91
  test_files:
75
92
  - tests/ts_rucodegen.rb
76
93
  rdoc_options:
@@ -83,6 +100,8 @@ extra_rdoc_files:
83
100
  - README
84
101
  - Rakefile
85
102
  - LICENSE
103
+ - NEWS
104
+ - docs/EmbededRuCodeGen
86
105
  - docs/examples
87
106
  - docs/Principle
88
107
  - docs/ValueIncapsulator
@@ -91,6 +110,7 @@ extra_rdoc_files:
91
110
  - docs/examples/cpp/value_incapsulator
92
111
  - docs/examples/cpp/custom/submit_deliver
93
112
  - docs/examples/cpp/value_incapsulator/cfg
113
+ - docs/examples/cpp/value_incapsulator/embeded_cfg
94
114
  - docs/examples/cpp/value_incapsulator/host_config
95
115
  executables: []
96
116
  extensions: []
@@ -1,51 +0,0 @@
1
-
2
- class cfg_t
3
- {
4
- private :
5
- std::string listening_mbox_;
6
- std::string self_mbox_;
7
- int interception_priority_;
8
- unsigned int low_watermark_;
9
- unsigned int high_watermark_;
10
- unsigned int cprov_high_watermark_;
11
- unsigned int max_life_time_;
12
- unsigned int check_life_time_period_;
13
-
14
- public :
15
- cfg_t();
16
-
17
- const std::string &
18
- listening_mbox() const;
19
- void
20
- listening_mbox( const std::string & v__ );
21
- const std::string &
22
- self_mbox() const;
23
- void
24
- self_mbox( const std::string & v__ );
25
- int
26
- interception_priority() const;
27
- void
28
- interception_priority( int v__ );
29
- unsigned int
30
- low_watermark() const;
31
- void
32
- low_watermark( unsigned int v__ );
33
- unsigned int
34
- high_watermark() const;
35
- void
36
- high_watermark( unsigned int v__ );
37
- unsigned int
38
- cprov_high_watermark() const;
39
- void
40
- cprov_high_watermark( unsigned int v__ );
41
- unsigned int
42
- max_life_time() const;
43
- void
44
- max_life_time( unsigned int v__ );
45
- unsigned int
46
- check_life_time_period() const;
47
- void
48
- check_life_time_period( unsigned int v__ );
49
-
50
- };
51
-
@@ -1,63 +0,0 @@
1
-
2
- cfg_t::cfg_t()
3
- : listening_mbox_()
4
- , self_mbox_(default_self_mbox())
5
- , interception_priority_(2)
6
- , low_watermark_(default_low_watermark)
7
- , high_watermark_(0)
8
- , cprov_high_watermark_(0)
9
- , max_life_time_(60)
10
- , check_life_time_period_(5)
11
-
12
- {}
13
-
14
- const std::string &
15
- cfg_t::listening_mbox() const
16
- { return listening_mbox_; }
17
- void
18
- cfg_t::listening_mbox( const std::string & v__ )
19
- { listening_mbox_ = v__; }
20
- const std::string &
21
- cfg_t::self_mbox() const
22
- { return self_mbox_; }
23
- void
24
- cfg_t::self_mbox( const std::string & v__ )
25
- { self_mbox_ = v__; }
26
- int
27
- cfg_t::interception_priority() const
28
- { return interception_priority_; }
29
- void
30
- cfg_t::interception_priority( int v__ )
31
- { interception_priority_ = v__; }
32
- unsigned int
33
- cfg_t::low_watermark() const
34
- { return low_watermark_; }
35
- void
36
- cfg_t::low_watermark( unsigned int v__ )
37
- { low_watermark_ = v__; }
38
- unsigned int
39
- cfg_t::high_watermark() const
40
- { return high_watermark_; }
41
- void
42
- cfg_t::high_watermark( unsigned int v__ )
43
- { high_watermark_ = v__; }
44
- unsigned int
45
- cfg_t::cprov_high_watermark() const
46
- { return cprov_high_watermark_; }
47
- void
48
- cfg_t::cprov_high_watermark( unsigned int v__ )
49
- { cprov_high_watermark_ = v__; }
50
- unsigned int
51
- cfg_t::max_life_time() const
52
- { return max_life_time_; }
53
- void
54
- cfg_t::max_life_time( unsigned int v__ )
55
- { max_life_time_ = v__; }
56
- unsigned int
57
- cfg_t::check_life_time_period() const
58
- { return check_life_time_period_; }
59
- void
60
- cfg_t::check_life_time_period( unsigned int v__ )
61
- { check_life_time_period_ = v__; }
62
-
63
-
@@ -1,4 +0,0 @@
1
- Usage: cg-host_config [options]
2
- -m, --mode MODE run mode
3
- (build, rebuild, clean, dry-run)
4
- -h, --help show this screen