cauterize 0.0.1.pre13 → 0.0.1.pre14
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +33 -33
- data/.rspec +1 -1
- data/.travisci.yml +4 -4
- data/Gemfile +4 -4
- data/LICENSE.txt +21 -21
- data/README.md +177 -177
- data/Rakefile +54 -54
- data/bin/cauterize +61 -61
- data/cauterize.gemspec +27 -27
- data/example/Cauterize +68 -68
- data/example/build.sh +25 -25
- data/example/c_example_support/empty_main.c +1 -1
- data/example/c_example_support/example_project_config.c +11 -11
- data/example/c_example_support/example_project_config.h +15 -15
- data/example/ruby_ex.rb +14 -14
- data/lib/cauterize.rb +117 -117
- data/lib/cauterize/base_type.rb +78 -78
- data/lib/cauterize/builders.rb +41 -41
- data/lib/cauterize/builders/c/buildable.rb +91 -91
- data/lib/cauterize/builders/c/builtin.rb +43 -43
- data/lib/cauterize/builders/c/composite.rb +57 -57
- data/lib/cauterize/builders/c/enumeration.rb +60 -60
- data/lib/cauterize/builders/c/fixed_array.rb +74 -74
- data/lib/cauterize/builders/c/group.rb +143 -143
- data/lib/cauterize/builders/c/scalar.rb +34 -34
- data/lib/cauterize/builders/c/variable_array.rb +98 -98
- data/lib/cauterize/builders/cs/buildable.rb +59 -59
- data/lib/cauterize/builders/cs/builtin.rb +22 -22
- data/lib/cauterize/builders/cs/composite.rb +21 -21
- data/lib/cauterize/builders/cs/csarray.rb +32 -32
- data/lib/cauterize/builders/cs/enumeration.rb +21 -21
- data/lib/cauterize/builders/cs/fixed_array.rb +27 -27
- data/lib/cauterize/builders/cs/group.rb +32 -32
- data/lib/cauterize/builders/cs/scalar.rb +10 -10
- data/lib/cauterize/builders/cs/variable_array.rb +40 -34
- data/lib/cauterize/builders/doc/buildable.rb +30 -30
- data/lib/cauterize/builders/doc/builtin.rb +21 -21
- data/lib/cauterize/builders/doc/composite.rb +23 -23
- data/lib/cauterize/builders/doc/enumeration.rb +24 -24
- data/lib/cauterize/builders/doc/fixed_array.rb +26 -26
- data/lib/cauterize/builders/doc/group.rb +29 -29
- data/lib/cauterize/builders/doc/scalar.rb +21 -21
- data/lib/cauterize/builders/doc/variable_array.rb +26 -26
- data/lib/cauterize/builders/ruby/buildable.rb +11 -11
- data/lib/cauterize/builders/ruby/builtin.rb +25 -25
- data/lib/cauterize/builders/ruby/composite.rb +26 -26
- data/lib/cauterize/builders/ruby/enumeration.rb +27 -27
- data/lib/cauterize/builders/ruby/fixed_array.rb +20 -20
- data/lib/cauterize/builders/ruby/group.rb +35 -35
- data/lib/cauterize/builders/ruby/scalar.rb +19 -19
- data/lib/cauterize/builders/ruby/variable_array.rb +22 -22
- data/lib/cauterize/builtin.rb +62 -62
- data/lib/cauterize/c_builder.rb +103 -103
- data/lib/cauterize/cauterize.rb +76 -76
- data/lib/cauterize/composite.rb +64 -64
- data/lib/cauterize/cs_builder.rb +58 -58
- data/lib/cauterize/doc_builder.rb +34 -34
- data/lib/cauterize/enumeration.rb +98 -98
- data/lib/cauterize/fixed_array.rb +50 -50
- data/lib/cauterize/formatter.rb +67 -67
- data/lib/cauterize/group.rb +81 -81
- data/lib/cauterize/representation.rb +32 -32
- data/lib/cauterize/ruby_builder.rb +44 -44
- data/lib/cauterize/scalar.rb +53 -53
- data/lib/cauterize/snake_case.rb +21 -21
- data/lib/cauterize/variable_array.rb +55 -55
- data/lib/cauterize/version.rb +3 -3
- data/spec/base_type_spec.rb +251 -251
- data/spec/builders/c/buildable_spec.rb +25 -25
- data/spec/builders/c/builtin_spec.rb +22 -22
- data/spec/builders/c/composite_spec.rb +50 -50
- data/spec/builders/c/enumeration_spec.rb +95 -95
- data/spec/builders/c/fixed_array_spec.rb +36 -36
- data/spec/builders/c/group_spec.rb +140 -140
- data/spec/builders/c/scalar_spec.rb +26 -26
- data/spec/builders/c/variable_array_spec.rb +48 -48
- data/spec/builders/cs/buildable_spec.rb +8 -8
- data/spec/builders/cs/composite_spec.rb +32 -32
- data/spec/builders/cs/enumeration_spec.rb +33 -33
- data/spec/builders/cs/fixed_array_spec.rb +41 -41
- data/spec/builders/cs/group_spec.rb +56 -56
- data/spec/builders/cs/scalar_spec.rb +7 -7
- data/spec/builders/cs/variable_array_spec.rb +49 -45
- data/spec/builders/doc/buildable_spec.rb +25 -25
- data/spec/builders_spec.rb +57 -57
- data/spec/builtin_spec.rb +43 -43
- data/spec/c_builder_spec.rb +176 -176
- data/spec/cauterize_spec.rb +15 -15
- data/spec/composite_spec.rb +77 -77
- data/spec/cs_builder_spec.rb +115 -115
- data/spec/doc_builder_spec.rb +260 -260
- data/spec/enumeration_spec.rb +145 -145
- data/spec/fixed_array_spec.rb +61 -61
- data/spec/group_spec.rb +111 -111
- data/spec/ruby_builder_spec.rb +83 -83
- data/spec/ruby_generated_spec.rb +735 -735
- data/spec/scalar_spec.rb +44 -44
- data/spec/spec_helper.rb +122 -122
- data/spec/support/shared_examples_for_array_buildables.rb +22 -22
- data/spec/support/shared_examples_for_c_buildables.rb +103 -103
- data/spec/support/shared_examples_for_sane_c_buildables.rb +22 -22
- data/spec/support/shared_examples_for_stubbed_functions.rb +18 -18
- data/spec/support/spec_sample_model.rb +74 -74
- data/spec/test_main.c +13 -13
- data/spec/variable_array_spec.rb +73 -73
- data/support/c/src/cauterize.c +75 -75
- data/support/c/src/cauterize.h +60 -60
- data/support/c/src/cauterize_debug.h +29 -29
- data/support/c/src/cauterize_util.h +8 -8
- data/support/c/test/greatest.h +536 -536
- data/support/c/test/test.c +166 -166
- data/support/cs/src/CauterizeCompositeFormatter.cs +0 -0
- data/support/cs/src/CauterizeContainerFormatter.cs +0 -0
- data/support/cs/src/CauterizeEnumFormatter.cs +0 -0
- data/support/cs/src/CauterizeException.cs +15 -15
- data/support/cs/src/CauterizeFixedArrayFormatter.cs +2 -2
- data/support/cs/src/CauterizeFormatter.cs +0 -0
- data/support/cs/src/CauterizeGroupFormatter.cs +0 -0
- data/support/cs/src/CauterizeTypeFormatterFactory.cs +0 -0
- data/support/cs/src/CauterizeTypes.cs +46 -12
- data/support/cs/src/CauterizeVariableArrayFormatter.cs +1 -1
- data/support/cs/src/ICauterizeTypeFormatter.cs +0 -0
- data/support/cs/src/OrderAttribute.cs +0 -0
- data/support/cs/src/PrimitiveSupport.cs +12 -0
- data/support/cs/test/CauterizeCompositeFormatterTest.cs +0 -0
- data/support/cs/test/CauterizeEnumFormatterTest.cs +0 -0
- data/support/cs/test/CauterizeFixedArrayFormatterTest.cs +0 -0
- data/support/cs/test/CauterizeFormatterTest.cs +0 -0
- data/support/cs/test/CauterizeGroupFormatterTest.cs +0 -0
- data/support/cs/test/CauterizeIntegrationTest.cs +0 -0
- data/support/cs/test/CauterizePrimitiveFormatterTest.cs +0 -0
- data/support/cs/test/CauterizeTypeFormatterFactoryTest.cs +0 -0
- data/support/cs/test/CauterizeVariableArrayFormatterTest.cs +0 -0
- data/support/cs/test/OrderAttributeTest.cs +0 -0
- data/support/ruby/src/cauterize_ruby_baseclasses.rb +367 -367
- data/support/ruby/src/cauterize_ruby_builtins.rb +148 -148
- metadata +20 -20
data/Rakefile
CHANGED
@@ -1,54 +1,54 @@
|
|
1
|
-
require 'tmpdir'
|
2
|
-
require 'fileutils'
|
3
|
-
require 'bundler/gem_tasks'
|
4
|
-
require 'rspec/core/rake_task'
|
5
|
-
|
6
|
-
RSpec::Core::RakeTask.new(:spec)
|
7
|
-
|
8
|
-
task :default => :spec
|
9
|
-
task :default => :greatest
|
10
|
-
|
11
|
-
desc "Run C tests"
|
12
|
-
task :greatest do
|
13
|
-
Dir.mktmpdir do |d|
|
14
|
-
test_suite_path = File.join(d, "test_suite.c")
|
15
|
-
mk_test_suite_file(test_suite_path)
|
16
|
-
|
17
|
-
args = "-pedantic -Wall -Wextra -Werror -std=c99 -Isupport/c/test -Isupport/c/src -I#{d}"
|
18
|
-
srcs = "support/c/src/cauterize.c support/c/test/test.c"
|
19
|
-
bin = File.join(d, "test.bin")
|
20
|
-
sh "gcc #{args} #{srcs} -o #{bin}"
|
21
|
-
sh bin
|
22
|
-
end
|
23
|
-
end
|
24
|
-
|
25
|
-
desc "Run C# tests"
|
26
|
-
task :nunit do
|
27
|
-
cd "support/cs" do
|
28
|
-
FileUtils.mkdir_p "lib"
|
29
|
-
sh "dmcs -target:library -out:lib/Cauterize.dll src/*.cs"
|
30
|
-
references = "-r:lib/nunit.framework.dll -r:lib/Moq.dll -r:lib/Cauterize.dll"
|
31
|
-
sh "dmcs -target:library #{references} -out:lib/Cauterize.Test.dll test/*.cs"
|
32
|
-
sh "#{nunit} lib/*.dll"
|
33
|
-
end
|
34
|
-
end
|
35
|
-
|
36
|
-
def nunit
|
37
|
-
"nunit-console4"
|
38
|
-
end
|
39
|
-
|
40
|
-
# Support Methods
|
41
|
-
|
42
|
-
SUITE_ENTRY_TEMPLATE = " RUN_TEST(%s);"
|
43
|
-
|
44
|
-
def mk_test_suite_file(path)
|
45
|
-
test_files = Dir["support/c/test/*.c"]
|
46
|
-
suite_text = test_files.map do |test_file|
|
47
|
-
File.read(test_file).lines.map do |l|
|
48
|
-
m = l.match(/^TEST (?<sym>[^\(]+)\(\)/)
|
49
|
-
m ? m[:sym] : nil
|
50
|
-
end.compact
|
51
|
-
end.flatten.map {|t| SUITE_ENTRY_TEMPLATE % t}.join("\n") + "\n"
|
52
|
-
|
53
|
-
File.open(path, "wb") {|fh| fh.write(suite_text)}
|
54
|
-
end
|
1
|
+
require 'tmpdir'
|
2
|
+
require 'fileutils'
|
3
|
+
require 'bundler/gem_tasks'
|
4
|
+
require 'rspec/core/rake_task'
|
5
|
+
|
6
|
+
RSpec::Core::RakeTask.new(:spec)
|
7
|
+
|
8
|
+
task :default => :spec
|
9
|
+
task :default => :greatest
|
10
|
+
|
11
|
+
desc "Run C tests"
|
12
|
+
task :greatest do
|
13
|
+
Dir.mktmpdir do |d|
|
14
|
+
test_suite_path = File.join(d, "test_suite.c")
|
15
|
+
mk_test_suite_file(test_suite_path)
|
16
|
+
|
17
|
+
args = "-pedantic -Wall -Wextra -Werror -std=c99 -Isupport/c/test -Isupport/c/src -I#{d}"
|
18
|
+
srcs = "support/c/src/cauterize.c support/c/test/test.c"
|
19
|
+
bin = File.join(d, "test.bin")
|
20
|
+
sh "gcc #{args} #{srcs} -o #{bin}"
|
21
|
+
sh bin
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
desc "Run C# tests"
|
26
|
+
task :nunit do
|
27
|
+
cd "support/cs" do
|
28
|
+
FileUtils.mkdir_p "lib"
|
29
|
+
sh "dmcs -target:library -out:lib/Cauterize.dll src/*.cs"
|
30
|
+
references = "-r:lib/nunit.framework.dll -r:lib/Moq.dll -r:lib/Cauterize.dll"
|
31
|
+
sh "dmcs -target:library #{references} -out:lib/Cauterize.Test.dll test/*.cs"
|
32
|
+
sh "#{nunit} lib/*.dll"
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
def nunit
|
37
|
+
"nunit-console4"
|
38
|
+
end
|
39
|
+
|
40
|
+
# Support Methods
|
41
|
+
|
42
|
+
SUITE_ENTRY_TEMPLATE = " RUN_TEST(%s);"
|
43
|
+
|
44
|
+
def mk_test_suite_file(path)
|
45
|
+
test_files = Dir["support/c/test/*.c"]
|
46
|
+
suite_text = test_files.map do |test_file|
|
47
|
+
File.read(test_file).lines.map do |l|
|
48
|
+
m = l.match(/^TEST (?<sym>[^\(]+)\(\)/)
|
49
|
+
m ? m[:sym] : nil
|
50
|
+
end.compact
|
51
|
+
end.flatten.map {|t| SUITE_ENTRY_TEMPLATE % t}.join("\n") + "\n"
|
52
|
+
|
53
|
+
File.open(path, "wb") {|fh| fh.write(suite_text)}
|
54
|
+
end
|
data/bin/cauterize
CHANGED
@@ -1,61 +1,61 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
LIB_PATH = File.dirname(__FILE__) + "/../lib"
|
4
|
-
|
5
|
-
$LOAD_PATH.unshift LIB_PATH
|
6
|
-
|
7
|
-
require 'thor'
|
8
|
-
require 'cauterize/cauterize'
|
9
|
-
|
10
|
-
class CmdLineException < Exception; end
|
11
|
-
|
12
|
-
class CauterizeCmdline < Thor
|
13
|
-
desc "generate [language] [target_dir] [[description file]]",
|
14
|
-
"Generate sources for [language] in [target_dir]."
|
15
|
-
method_option :omit_support, :type => :boolean,
|
16
|
-
:desc => "Omit the support files needed by Cauterize",
|
17
|
-
:default => false
|
18
|
-
method_option :force, :type => :boolean,
|
19
|
-
:desc => "Bravely overwrite files in non-empty directories",
|
20
|
-
:default => false
|
21
|
-
def generate(language, target_dir, desc_file = nil)
|
22
|
-
if not options[:force] and Dir.exist?(target_dir) and Dir[target_dir + "/*"].size > 0
|
23
|
-
raise CmdLineException.new("Directory '#{target_dir}' isn't empty. Cowardly quitting.")
|
24
|
-
end
|
25
|
-
|
26
|
-
desc_file ||= "Cauterize"
|
27
|
-
|
28
|
-
if not File.exist? desc_file
|
29
|
-
raise CmdLineException.new("The description file #{desc_file} does not exist.")
|
30
|
-
end
|
31
|
-
|
32
|
-
language = language.downcase
|
33
|
-
if %w(c cs ruby doc).include? language
|
34
|
-
Cauterize.generate language, target_dir, desc_file
|
35
|
-
else
|
36
|
-
raise CmdLineException.new("Language '#{language}' is not supported.")
|
37
|
-
end
|
38
|
-
|
39
|
-
# Copy the cauterize support files.
|
40
|
-
unless options[:omit_support]
|
41
|
-
support_path = File.join(File.dirname(__FILE__),"../support/#{language}/src")
|
42
|
-
Dir["#{support_path}/*"].each do |path|
|
43
|
-
FileUtils.cp(path, target_dir)
|
44
|
-
end
|
45
|
-
end
|
46
|
-
end
|
47
|
-
|
48
|
-
desc "version",
|
49
|
-
"Prints the cauterize version to the screen."
|
50
|
-
def version
|
51
|
-
puts "cauterize-" + Cauterize::VERSION
|
52
|
-
end
|
53
|
-
end
|
54
|
-
|
55
|
-
begin
|
56
|
-
CauterizeCmdline.start
|
57
|
-
rescue CmdLineException => ex
|
58
|
-
puts ex.message
|
59
|
-
end
|
60
|
-
|
61
|
-
# vim: set syntax=ruby ts=2 sw=2 et ai
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
LIB_PATH = File.dirname(__FILE__) + "/../lib"
|
4
|
+
|
5
|
+
$LOAD_PATH.unshift LIB_PATH
|
6
|
+
|
7
|
+
require 'thor'
|
8
|
+
require 'cauterize/cauterize'
|
9
|
+
|
10
|
+
class CmdLineException < Exception; end
|
11
|
+
|
12
|
+
class CauterizeCmdline < Thor
|
13
|
+
desc "generate [language] [target_dir] [[description file]]",
|
14
|
+
"Generate sources for [language] in [target_dir]."
|
15
|
+
method_option :omit_support, :type => :boolean,
|
16
|
+
:desc => "Omit the support files needed by Cauterize",
|
17
|
+
:default => false
|
18
|
+
method_option :force, :type => :boolean,
|
19
|
+
:desc => "Bravely overwrite files in non-empty directories",
|
20
|
+
:default => false
|
21
|
+
def generate(language, target_dir, desc_file = nil)
|
22
|
+
if not options[:force] and Dir.exist?(target_dir) and Dir[target_dir + "/*"].size > 0
|
23
|
+
raise CmdLineException.new("Directory '#{target_dir}' isn't empty. Cowardly quitting.")
|
24
|
+
end
|
25
|
+
|
26
|
+
desc_file ||= "Cauterize"
|
27
|
+
|
28
|
+
if not File.exist? desc_file
|
29
|
+
raise CmdLineException.new("The description file #{desc_file} does not exist.")
|
30
|
+
end
|
31
|
+
|
32
|
+
language = language.downcase
|
33
|
+
if %w(c cs ruby doc).include? language
|
34
|
+
Cauterize.generate language, target_dir, desc_file
|
35
|
+
else
|
36
|
+
raise CmdLineException.new("Language '#{language}' is not supported.")
|
37
|
+
end
|
38
|
+
|
39
|
+
# Copy the cauterize support files.
|
40
|
+
unless options[:omit_support]
|
41
|
+
support_path = File.join(File.dirname(__FILE__),"../support/#{language}/src")
|
42
|
+
Dir["#{support_path}/*"].each do |path|
|
43
|
+
FileUtils.cp(path, target_dir)
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
desc "version",
|
49
|
+
"Prints the cauterize version to the screen."
|
50
|
+
def version
|
51
|
+
puts "cauterize-" + Cauterize::VERSION
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
begin
|
56
|
+
CauterizeCmdline.start
|
57
|
+
rescue CmdLineException => ex
|
58
|
+
puts ex.message
|
59
|
+
end
|
60
|
+
|
61
|
+
# vim: set syntax=ruby ts=2 sw=2 et ai
|
data/cauterize.gemspec
CHANGED
@@ -1,27 +1,27 @@
|
|
1
|
-
# -*- encoding: utf-8 -*-
|
2
|
-
lib = File.expand_path('../lib', __FILE__)
|
3
|
-
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
-
require 'cauterize/version'
|
5
|
-
|
6
|
-
Gem::Specification.new do |gem|
|
7
|
-
gem.name = "cauterize"
|
8
|
-
gem.version = Cauterize::VERSION
|
9
|
-
gem.authors = ["John Van Enk"]
|
10
|
-
gem.email = ["vanenkj@gmail.com"]
|
11
|
-
gem.summary = %q{Tools to generate structures and mashalers suitable for static-memory environments.}
|
12
|
-
gem.description = %q{Tools to generate C structures and marshalers with a Ruby DSL.}
|
13
|
-
gem.homepage = "https://github.com/sw17ch/cauterize"
|
14
|
-
|
15
|
-
gem.files = `git ls-files`.split($/)
|
16
|
-
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
17
|
-
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
18
|
-
gem.require_paths = ["lib"]
|
19
|
-
|
20
|
-
gem.add_dependency 'rake', '>= 0.9.2.0'
|
21
|
-
gem.add_dependency 'thor', '>= 0.16.0'
|
22
|
-
gem.add_dependency 'require_all', '>= 1.2.1'
|
23
|
-
gem.add_dependency 'bindata', '>= 1.5'
|
24
|
-
|
25
|
-
gem.add_development_dependency 'rspec', '>= 2.12.0'
|
26
|
-
gem.add_development_dependency 'mocha', '>= 0.13.0'
|
27
|
-
end
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'cauterize/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |gem|
|
7
|
+
gem.name = "cauterize"
|
8
|
+
gem.version = Cauterize::VERSION
|
9
|
+
gem.authors = ["John Van Enk"]
|
10
|
+
gem.email = ["vanenkj@gmail.com"]
|
11
|
+
gem.summary = %q{Tools to generate structures and mashalers suitable for static-memory environments.}
|
12
|
+
gem.description = %q{Tools to generate C structures and marshalers with a Ruby DSL.}
|
13
|
+
gem.homepage = "https://github.com/sw17ch/cauterize"
|
14
|
+
|
15
|
+
gem.files = `git ls-files`.split($/)
|
16
|
+
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
17
|
+
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
18
|
+
gem.require_paths = ["lib"]
|
19
|
+
|
20
|
+
gem.add_dependency 'rake', '>= 0.9.2.0'
|
21
|
+
gem.add_dependency 'thor', '>= 0.16.0'
|
22
|
+
gem.add_dependency 'require_all', '>= 1.2.1'
|
23
|
+
gem.add_dependency 'bindata', '>= 1.5'
|
24
|
+
|
25
|
+
gem.add_development_dependency 'rspec', '>= 2.12.0'
|
26
|
+
gem.add_development_dependency 'mocha', '>= 0.13.0'
|
27
|
+
end
|
data/example/Cauterize
CHANGED
@@ -1,68 +1,68 @@
|
|
1
|
-
set_name("example_project")
|
2
|
-
set_version("1.2.3")
|
3
|
-
|
4
|
-
scalar(:bigint) { |t| t.type_name(:int32) }
|
5
|
-
scalar(:usmallint) { |t| t.type_name(:uint8) }
|
6
|
-
|
7
|
-
variable_array(:uint8_buffer) do |a|
|
8
|
-
a.array_type :uint8
|
9
|
-
a.array_size 128
|
10
|
-
end
|
11
|
-
|
12
|
-
enumeration(:color) do |e|
|
13
|
-
e.value :red
|
14
|
-
e.value :blue
|
15
|
-
e.value :green
|
16
|
-
end
|
17
|
-
|
18
|
-
enumeration(:large_value) do |e|
|
19
|
-
e.value :negative, -500
|
20
|
-
e.value :positive, 500
|
21
|
-
end
|
22
|
-
|
23
|
-
fixed_array(:color_list) do |a|
|
24
|
-
a.array_type :color
|
25
|
-
a.array_size 41
|
26
|
-
end
|
27
|
-
|
28
|
-
composite(:weirdness) do |c|
|
29
|
-
c.field :val, :large_value
|
30
|
-
c.field :num, :int8
|
31
|
-
end
|
32
|
-
|
33
|
-
fixed_array(:color_list_list) do |a|
|
34
|
-
a.array_type :color_list
|
35
|
-
a.array_size 4
|
36
|
-
end
|
37
|
-
|
38
|
-
variable_array(:numbers) do |a|
|
39
|
-
a.array_type :bigint
|
40
|
-
a.array_size 128
|
41
|
-
end
|
42
|
-
|
43
|
-
composite(:nonsensical) do |c|
|
44
|
-
c.field :color, :color
|
45
|
-
c.field :color_list, :color_list
|
46
|
-
c.field :numbers, :numbers
|
47
|
-
c.field :a_float, :float64
|
48
|
-
c.field :a_bool, :bool
|
49
|
-
end
|
50
|
-
|
51
|
-
composite(:crazy) do |c|
|
52
|
-
c.field :first_numbers, :numbers
|
53
|
-
c.field :second_numbers, :numbers
|
54
|
-
c.field :third_numbers, :numbers
|
55
|
-
end
|
56
|
-
|
57
|
-
group(:insanity) do |g|
|
58
|
-
g.field :nonsensical, :nonsensical
|
59
|
-
g.field :crazy, :crazy
|
60
|
-
g.dataless :any_empty_entry
|
61
|
-
g.dataless :another_empty
|
62
|
-
end
|
63
|
-
|
64
|
-
group(:wat) do |g|
|
65
|
-
g.field :arrrr, :color_list_list
|
66
|
-
g.field :coooo, :color
|
67
|
-
g.dataless :ohnoes
|
68
|
-
end
|
1
|
+
set_name("example_project")
|
2
|
+
set_version("1.2.3")
|
3
|
+
|
4
|
+
scalar(:bigint) { |t| t.type_name(:int32) }
|
5
|
+
scalar(:usmallint) { |t| t.type_name(:uint8) }
|
6
|
+
|
7
|
+
variable_array(:uint8_buffer) do |a|
|
8
|
+
a.array_type :uint8
|
9
|
+
a.array_size 128
|
10
|
+
end
|
11
|
+
|
12
|
+
enumeration(:color) do |e|
|
13
|
+
e.value :red
|
14
|
+
e.value :blue
|
15
|
+
e.value :green
|
16
|
+
end
|
17
|
+
|
18
|
+
enumeration(:large_value) do |e|
|
19
|
+
e.value :negative, -500
|
20
|
+
e.value :positive, 500
|
21
|
+
end
|
22
|
+
|
23
|
+
fixed_array(:color_list) do |a|
|
24
|
+
a.array_type :color
|
25
|
+
a.array_size 41
|
26
|
+
end
|
27
|
+
|
28
|
+
composite(:weirdness) do |c|
|
29
|
+
c.field :val, :large_value
|
30
|
+
c.field :num, :int8
|
31
|
+
end
|
32
|
+
|
33
|
+
fixed_array(:color_list_list) do |a|
|
34
|
+
a.array_type :color_list
|
35
|
+
a.array_size 4
|
36
|
+
end
|
37
|
+
|
38
|
+
variable_array(:numbers) do |a|
|
39
|
+
a.array_type :bigint
|
40
|
+
a.array_size 128
|
41
|
+
end
|
42
|
+
|
43
|
+
composite(:nonsensical) do |c|
|
44
|
+
c.field :color, :color
|
45
|
+
c.field :color_list, :color_list
|
46
|
+
c.field :numbers, :numbers
|
47
|
+
c.field :a_float, :float64
|
48
|
+
c.field :a_bool, :bool
|
49
|
+
end
|
50
|
+
|
51
|
+
composite(:crazy) do |c|
|
52
|
+
c.field :first_numbers, :numbers
|
53
|
+
c.field :second_numbers, :numbers
|
54
|
+
c.field :third_numbers, :numbers
|
55
|
+
end
|
56
|
+
|
57
|
+
group(:insanity) do |g|
|
58
|
+
g.field :nonsensical, :nonsensical
|
59
|
+
g.field :crazy, :crazy
|
60
|
+
g.dataless :any_empty_entry
|
61
|
+
g.dataless :another_empty
|
62
|
+
end
|
63
|
+
|
64
|
+
group(:wat) do |g|
|
65
|
+
g.field :arrrr, :color_list_list
|
66
|
+
g.field :coooo, :color
|
67
|
+
g.dataless :ohnoes
|
68
|
+
end
|
data/example/build.sh
CHANGED
@@ -1,25 +1,25 @@
|
|
1
|
-
#!/bin/sh
|
2
|
-
|
3
|
-
rm -rf doc_cauterize_output
|
4
|
-
../bin/cauterize generate doc doc_cauterize_output
|
5
|
-
|
6
|
-
rm -rf c_cauterize_output
|
7
|
-
../bin/cauterize generate c c_cauterize_output
|
8
|
-
|
9
|
-
CFLAGS="-Wall -Werror -Wextra"
|
10
|
-
INCLUDES="-Ic_cauterize_output -Ic_example_support"
|
11
|
-
DEFINES="-DUSE_CAUTERIZE_CONFIG_HEADER"
|
12
|
-
|
13
|
-
gcc $CFLAGS $INCLUDES $DEFINES c_example_support/example_project_config.c \
|
14
|
-
c_example_support/empty_main.c \
|
15
|
-
c_cauterize_output/cauterize.c \
|
16
|
-
c_cauterize_output/example_project.c \
|
17
|
-
-o c_cauterize_output/example_project
|
18
|
-
|
19
|
-
rm -rf cs_cauterize_output
|
20
|
-
../bin/cauterize generate cs cs_cauterize_output
|
21
|
-
|
22
|
-
dmcs cs_cauterize_output/*.cs -target:library -out:cs_cauterize_output/example_project.dll
|
23
|
-
|
24
|
-
rm -rf ruby_cauterize_output
|
25
|
-
../bin/cauterize generate ruby ruby_cauterize_output
|
1
|
+
#!/bin/sh
|
2
|
+
|
3
|
+
rm -rf doc_cauterize_output
|
4
|
+
../bin/cauterize generate doc doc_cauterize_output
|
5
|
+
|
6
|
+
rm -rf c_cauterize_output
|
7
|
+
../bin/cauterize generate c c_cauterize_output
|
8
|
+
|
9
|
+
CFLAGS="-Wall -Werror -Wextra"
|
10
|
+
INCLUDES="-Ic_cauterize_output -Ic_example_support"
|
11
|
+
DEFINES="-DUSE_CAUTERIZE_CONFIG_HEADER"
|
12
|
+
|
13
|
+
gcc $CFLAGS $INCLUDES $DEFINES c_example_support/example_project_config.c \
|
14
|
+
c_example_support/empty_main.c \
|
15
|
+
c_cauterize_output/cauterize.c \
|
16
|
+
c_cauterize_output/example_project.c \
|
17
|
+
-o c_cauterize_output/example_project
|
18
|
+
|
19
|
+
rm -rf cs_cauterize_output
|
20
|
+
../bin/cauterize generate cs cs_cauterize_output
|
21
|
+
|
22
|
+
dmcs cs_cauterize_output/*.cs -target:library -out:cs_cauterize_output/example_project.dll
|
23
|
+
|
24
|
+
rm -rf ruby_cauterize_output
|
25
|
+
../bin/cauterize generate ruby ruby_cauterize_output
|