rice 4.6.1 → 4.7.1

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.
Files changed (187) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +38 -0
  3. data/CMakeLists.txt +0 -4
  4. data/Rakefile +2 -8
  5. data/bin/rice-doc.rb +211 -0
  6. data/bin/rice-rbs.rb +92 -0
  7. data/include/rice/rice.hpp +4694 -3704
  8. data/include/rice/stl.hpp +840 -294
  9. data/lib/rice/doc/cpp_reference.rb +166 -0
  10. data/lib/rice/doc/doxygen.rb +294 -0
  11. data/lib/rice/doc/mkdocs.rb +298 -0
  12. data/lib/rice/doc/rice.rb +29 -0
  13. data/lib/rice/doc/ruby.rb +37 -0
  14. data/lib/rice/doc.rb +5 -0
  15. data/lib/{make_rice_headers.rb → rice/make_rice_headers.rb} +3 -0
  16. data/lib/rice/native.rb +18 -0
  17. data/lib/rice/native_registry.rb +21 -0
  18. data/lib/rice/parameter.rb +7 -0
  19. data/lib/rice/rbs.rb +104 -0
  20. data/lib/rice/version.rb +1 -1
  21. data/lib/rice.rb +4 -0
  22. data/lib/rubygems/cmake_builder.rb +24 -27
  23. data/rice/Arg.hpp +4 -4
  24. data/rice/Arg.ipp +4 -4
  25. data/rice/Buffer.hpp +32 -28
  26. data/rice/Buffer.ipp +306 -178
  27. data/rice/Data_Object.ipp +136 -88
  28. data/rice/Data_Type.hpp +5 -7
  29. data/rice/Data_Type.ipp +48 -29
  30. data/rice/Enum.ipp +15 -21
  31. data/rice/Function.hpp +17 -0
  32. data/rice/Function.ipp +13 -0
  33. data/rice/Pointer.hpp +15 -0
  34. data/rice/Pointer.ipp +49 -0
  35. data/rice/Return.hpp +1 -1
  36. data/rice/Return.ipp +2 -2
  37. data/rice/api.hpp +30 -0
  38. data/rice/cpp_api/Array.hpp +4 -4
  39. data/rice/cpp_api/Array.ipp +50 -5
  40. data/rice/cpp_api/Class.hpp +0 -5
  41. data/rice/cpp_api/Class.ipp +19 -0
  42. data/rice/cpp_api/Hash.ipp +20 -0
  43. data/rice/cpp_api/Module.hpp +6 -3
  44. data/rice/cpp_api/Module.ipp +49 -11
  45. data/rice/cpp_api/Object.ipp +31 -2
  46. data/rice/cpp_api/String.hpp +1 -2
  47. data/rice/cpp_api/String.ipp +21 -1
  48. data/rice/cpp_api/Struct.ipp +5 -0
  49. data/rice/cpp_api/Symbol.ipp +43 -0
  50. data/rice/cpp_api/shared_methods.hpp +12 -12
  51. data/rice/detail/MethodInfo.hpp +4 -2
  52. data/rice/detail/MethodInfo.ipp +19 -3
  53. data/rice/detail/ModuleRegistry.hpp +18 -0
  54. data/rice/detail/ModuleRegistry.ipp +25 -0
  55. data/rice/detail/Native.hpp +45 -2
  56. data/rice/detail/Native.ipp +196 -6
  57. data/rice/detail/NativeAttributeGet.hpp +9 -4
  58. data/rice/detail/NativeAttributeGet.ipp +65 -11
  59. data/rice/detail/NativeAttributeSet.hpp +4 -0
  60. data/rice/detail/NativeAttributeSet.ipp +30 -2
  61. data/rice/detail/NativeCallbackFFI.ipp +2 -2
  62. data/rice/detail/NativeCallbackSimple.ipp +1 -1
  63. data/rice/detail/NativeFunction.hpp +11 -49
  64. data/rice/detail/NativeFunction.ipp +82 -379
  65. data/rice/detail/NativeInvoker.hpp +74 -0
  66. data/rice/detail/NativeInvoker.ipp +197 -0
  67. data/rice/detail/NativeIterator.hpp +4 -0
  68. data/rice/detail/NativeIterator.ipp +19 -0
  69. data/rice/detail/NativeMethod.hpp +97 -0
  70. data/rice/detail/NativeMethod.ipp +332 -0
  71. data/rice/detail/NativeProc.hpp +51 -0
  72. data/rice/detail/NativeProc.ipp +133 -0
  73. data/rice/detail/NativeRegistry.hpp +8 -0
  74. data/rice/detail/NativeRegistry.ipp +26 -0
  75. data/rice/detail/Parameter.hpp +47 -0
  76. data/rice/detail/Parameter.ipp +105 -0
  77. data/rice/detail/Proc.ipp +14 -13
  78. data/rice/detail/Registries.hpp +1 -0
  79. data/rice/detail/RubyType.hpp +0 -2
  80. data/rice/detail/RubyType.ipp +15 -33
  81. data/rice/detail/Type.hpp +44 -8
  82. data/rice/detail/Type.ipp +151 -49
  83. data/rice/detail/TypeRegistry.hpp +3 -0
  84. data/rice/detail/TypeRegistry.ipp +17 -27
  85. data/rice/detail/Types.ipp +430 -0
  86. data/rice/detail/Wrapper.hpp +12 -0
  87. data/rice/detail/Wrapper.ipp +45 -2
  88. data/rice/detail/from_ruby.ipp +567 -1073
  89. data/rice/detail/ruby.hpp +1 -0
  90. data/rice/detail/to_ruby.ipp +4 -635
  91. data/rice/libc/file.ipp +3 -6
  92. data/rice/rice.hpp +22 -12
  93. data/rice/rice_api/Arg.hpp +7 -0
  94. data/rice/rice_api/Arg.ipp +9 -0
  95. data/rice/rice_api/ModuleRegistry.hpp +7 -0
  96. data/rice/rice_api/ModuleRegistry.ipp +10 -0
  97. data/rice/rice_api/Native.hpp +7 -0
  98. data/rice/rice_api/Native.ipp +52 -0
  99. data/rice/rice_api/NativeRegistry.hpp +7 -0
  100. data/rice/rice_api/NativeRegistry.ipp +21 -0
  101. data/rice/rice_api/Parameter.hpp +7 -0
  102. data/rice/rice_api/Parameter.ipp +11 -0
  103. data/rice/rice_api/Registries.hpp +6 -0
  104. data/rice/rice_api/Registries.ipp +12 -0
  105. data/rice/rice_api/TypeRegistry.hpp +7 -0
  106. data/rice/rice_api/TypeRegistry.ipp +10 -0
  107. data/rice/stl/complex.ipp +35 -0
  108. data/rice/stl/exception.ipp +20 -7
  109. data/rice/stl/filesystem.hpp +6 -0
  110. data/rice/stl/filesystem.ipp +34 -0
  111. data/rice/stl/map.ipp +13 -21
  112. data/rice/stl/monostate.ipp +37 -1
  113. data/rice/stl/multimap.ipp +17 -24
  114. data/rice/stl/optional.ipp +47 -2
  115. data/rice/stl/pair.ipp +23 -58
  116. data/rice/stl/reference_wrapper.ipp +22 -1
  117. data/rice/stl/set.ipp +17 -9
  118. data/rice/stl/shared_ptr.ipp +44 -17
  119. data/rice/stl/string.ipp +175 -7
  120. data/rice/stl/string_view.ipp +23 -0
  121. data/rice/stl/tuple.ipp +38 -9
  122. data/rice/stl/unique_ptr.ipp +46 -2
  123. data/rice/stl/unordered_map.ipp +13 -21
  124. data/rice/stl/variant.ipp +47 -11
  125. data/rice/stl/vector.ipp +183 -104
  126. data/rice/stl.hpp +1 -0
  127. data/rice/traits/function_traits.hpp +2 -2
  128. data/rice/traits/method_traits.hpp +5 -16
  129. data/rice/traits/rice_traits.hpp +24 -4
  130. data/rice.gemspec +10 -22
  131. data/test/embed_ruby.cpp +0 -3
  132. data/test/test_Array.cpp +38 -38
  133. data/test/test_Attribute.cpp +187 -2
  134. data/test/test_Buffer.cpp +302 -26
  135. data/test/test_Callback.cpp +2 -3
  136. data/test/test_Class.cpp +5 -5
  137. data/test/test_Data_Object.cpp +1 -56
  138. data/test/test_Data_Type.cpp +20 -30
  139. data/test/test_Enum.cpp +4 -46
  140. data/test/test_From_Ruby.cpp +89 -82
  141. data/test/test_GVL.cpp +109 -0
  142. data/test/test_Iterator.cpp +1 -1
  143. data/test/test_Keep_Alive_No_Wrapper.cpp +5 -3
  144. data/test/test_Module.cpp +8 -9
  145. data/test/test_Object.cpp +1 -1
  146. data/test/test_Overloads.cpp +58 -10
  147. data/test/test_Stl_Map.cpp +8 -8
  148. data/test/test_Stl_Multimap.cpp +4 -4
  149. data/test/test_Stl_Pair.cpp +5 -3
  150. data/test/test_Stl_SharedPtr.cpp +24 -12
  151. data/test/test_Stl_String_View.cpp +10 -0
  152. data/test/test_Stl_Tuple.cpp +1 -1
  153. data/test/test_Stl_UniquePtr.cpp +8 -0
  154. data/test/test_Stl_Unordered_Map.cpp +9 -9
  155. data/test/test_Stl_Variant.cpp +9 -3
  156. data/test/test_Stl_Vector.cpp +118 -13
  157. data/test/test_Symbol.cpp +12 -0
  158. data/test/test_To_Ruby.cpp +35 -28
  159. data/test/test_Type.cpp +256 -53
  160. data/test/unittest.hpp +35 -0
  161. metadata +52 -34
  162. data/rice/Init.hpp +0 -8
  163. data/rice/Init.ipp +0 -8
  164. data/rice/detail/RubyFunction.hpp +0 -31
  165. data/rice/detail/RubyFunction.ipp +0 -77
  166. data/sample/callbacks/extconf.rb +0 -5
  167. data/sample/callbacks/sample_callbacks.cpp +0 -35
  168. data/sample/callbacks/test.rb +0 -28
  169. data/sample/enum/extconf.rb +0 -5
  170. data/sample/enum/sample_enum.cpp +0 -40
  171. data/sample/enum/test.rb +0 -8
  172. data/sample/inheritance/animals.cpp +0 -82
  173. data/sample/inheritance/extconf.rb +0 -5
  174. data/sample/inheritance/test.rb +0 -7
  175. data/sample/map/extconf.rb +0 -5
  176. data/sample/map/map.cpp +0 -73
  177. data/sample/map/test.rb +0 -7
  178. data/test/ext/t1/Foo.hpp +0 -10
  179. data/test/ext/t1/extconf.rb +0 -4
  180. data/test/ext/t1/t1.cpp +0 -13
  181. data/test/ext/t2/extconf.rb +0 -4
  182. data/test/ext/t2/t2.cpp +0 -11
  183. data/test/ruby/test_callbacks_sample.rb +0 -28
  184. data/test/ruby/test_multiple_extensions.rb +0 -18
  185. data/test/ruby/test_multiple_extensions_same_class.rb +0 -14
  186. data/test/ruby/test_multiple_extensions_with_inheritance.rb +0 -20
  187. /data/test/{test_Stl_Type.cpp → test_Stl_Type_Info.cpp} +0 -0
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7751b2018cc34ce9a256db07afdac1c1334f10df1c858e08943cfe65ccc3a0b0
4
- data.tar.gz: a8e25ea390438e8ba30450501f955724e25a1fe6fcdc9b0504a393ac60af9585
3
+ metadata.gz: c8d106501ff928ca481358d579bffe110efebbd4a98f3de141b8a4e6a853b17a
4
+ data.tar.gz: 900e679ee80f32d547487133911dfa1ccdd087a41414fb44a1c8b144fec15278
5
5
  SHA512:
6
- metadata.gz: 7ac0157d22f781cf34dd1d4704df142bc42e34d811c73c1e24ef3fbb3247161f2a0e76d80584aadc09eb6d97181dbb4a957518161a9afb89f61166cce08983bc
7
- data.tar.gz: 38e129eb196928cba4bf2f003651fc7e273df2abaf605664d76cd036993d70c507e4c31fa4e09e61252c8ef71aa701390c80a2247f20419e95d37a674002be26
6
+ metadata.gz: 33837b467af9b734848a7ef09b552ed2ab25f7f86c6fdedbc8f6c85dc42137d2ca46e9fd812198b99baa4af94f1f659d15530f9ecf36a2e147d3ddfb5f3c02ff
7
+ data.tar.gz: 11bccd16adcb9a117a5ce80c91b219b1102a1fde56086542528a4684cedc84631261c6afb583dbebb0c25c3a2b1908c2196197f36c79cfc7db7322ab104d0388
data/CHANGELOG.md CHANGED
@@ -1,3 +1,41 @@
1
+ ## 4.7.1 (2025-10-28)
2
+ Updates:
3
+ * Update overload resolution to take into account function arguments that are tagged as buffers via Arg("").setBuffer().
4
+ * Make second parameter optional for Array#push and update docs
5
+ * Remove ostruct runtime dependency
6
+
7
+ ## 4.7.0 (2025-10-22)
8
+ Updates:
9
+ * Refactor Native wrappers - functions, methods, attributes and procs - to enable introspection API
10
+ * Introduce Pointer<T> class to wrap pointers to fundamental types and arrays.
11
+ * Add new methods Arg#setBuffer and Return#setBuffer to indicate that a C++ pointer references an array of objects versus a single object
12
+ * Add a new Introspection API that exposes Rice internals to Ruby
13
+ * Using the Introspection API, add support for generating RBS files for extensions. See bin/rice-rbs.rb
14
+ * Using the Introspection API, add support for generating Markdown documentation for extensions. See bin/rice-doc.rb
15
+ * Don't create attribute writers for const attributes
16
+ * Support attribute setters for Enums
17
+ * Support wrapping std::vector<std::unique_ptr<T>>
18
+ * Update Array#push to not always copy C++ instances. This lays the foundation for extracting references and pointers from tuples, variants and optionals.
19
+ * Add very basic support for creating std::filesystem::path instances
20
+ * Remove toy samples and test libraries. These will be replaced by a new gem that wraps the BitMapPlusPlus library (https://github.com/baderouaich/BitmapPlusPlus)
21
+ * Add support for std::runtime_error since some libraries use that as a base exception class (thus when Rice wraps custom exceptions it also needs to wrap the base class)
22
+ * Improve std::vector indexing to more closely match Ruby for negative index values
23
+ * Correctly encode UTF8 Ruby class names in exception messages
24
+ * Add support for disabling Ruby's global interpreter lock (GIL) when calling native functions
25
+
26
+ Breaking Changes:
27
+ * Custom implementations of From_Ruby must include a custom constructor:
28
+ ```
29
+ explicit From_Ruby(Arg* arg)
30
+ ```
31
+ * Custom implementations of To_Ruby must include a custom constructor:
32
+ ```
33
+ explicit To_Ruby(Return* returnInfo)
34
+ ```
35
+ * You can no longer pass a Buffer<T> to an API that takes a pointer. Instead use Buffer<T>#data or Buffer<T>::release
36
+ * The Rice_Init method has been removed.
37
+ * Array#push requires a second argument.
38
+
1
39
  ## 4.6.1 (2025-06-25)
2
40
  * Improve attribute handling. Correctly deal with non-copyable/assignable attributes and return references instead of copies of objects
3
41
  * Improve Buffer implementation to deal with 4 cases:
data/CMakeLists.txt CHANGED
@@ -25,7 +25,3 @@ endif ()
25
25
 
26
26
  # Include sub-projects.
27
27
  add_subdirectory ("test")
28
- add_subdirectory ("sample/callbacks")
29
- add_subdirectory ("sample/enum")
30
- add_subdirectory ("sample/inheritance")
31
- add_subdirectory ("sample/map")
data/Rakefile CHANGED
@@ -17,13 +17,7 @@ is_mswin = !RbConfig::CONFIG['host_os'].match(/mswin/).nil?
17
17
  MAKE = is_mswin ? 'nmake' : 'make'
18
18
 
19
19
  unittest = File.join(__dir__, "test", "unittest#{RbConfig::CONFIG['EXEEXT']}")
20
- sample_callbacks = File.join(__dir__, "sample", "callbacks", "sample_callbacks.so")
21
- sample_enum = File.join(__dir__, "sample", "enum", "sample_enum.so")
22
- sample_inheritance = File.join(__dir__, "sample", "inheritance", "animals.so")
23
- sample_map = File.join(__dir__, "sample", "map", "map.so")
24
- test_ext1 = File.join(__dir__, "test", "ext", "t1", "t1.so")
25
- test_ext2 = File.join(__dir__, "test", "ext", "t2", "t2.so")
26
- binaries = [unittest, sample_callbacks, sample_enum, sample_inheritance, sample_map, test_ext1, test_ext2]
20
+ binaries = [unittest]
27
21
 
28
22
  binaries.each do |asset|
29
23
  file asset do
@@ -90,7 +84,7 @@ FileUtils.mkdir_p(include_dir) #unless File.exists?('include')
90
84
  desc "Update rice header files"
91
85
  task :headers do
92
86
  FileUtils.rm_rf(File.join(include_dir, "rice", "*"))
93
- path = File.join(__dir__, 'lib', 'make_rice_headers.rb')
87
+ path = File.join(__dir__, 'lib', 'rice', 'make_rice_headers.rb')
94
88
  # Execute make_rice_headers.rb
95
89
  run_command(Gem.ruby, path)
96
90
  end
data/bin/rice-doc.rb ADDED
@@ -0,0 +1,211 @@
1
+ require 'libxml-ruby'
2
+
3
+ # Require rice
4
+ require_relative '../lib/rice'
5
+ require_relative '../lib/rice/doc'
6
+
7
+ # Now setup option parser
8
+ require 'optparse'
9
+
10
+ module Rice
11
+ # == Synopsis
12
+ #
13
+ # Generates Mkdocs for a Rice extension
14
+ #
15
+ # == Usage
16
+ # rice-doc [options] <rice_extension_library>
17
+ #
18
+ # Options:
19
+ # -o, --output=path Output directory
20
+ # -v, --version Show version (1.1.0)
21
+ # -h, --help Show help message
22
+
23
+ class Cmd
24
+ # :enddoc:
25
+ attr_accessor :options
26
+
27
+ def option_parser
28
+ OptionParser.new do |opts|
29
+ opts.banner = "rice-doc #{Rice::VERSION}\n" +
30
+ "Usage: rice-doc [options] <rice_extension_library_path>"
31
+
32
+ opts.separator ""
33
+ opts.separator "Options:"
34
+
35
+ opts.on('-o path', '--output=path',
36
+ 'Output generated mkdoc files to the specified directory') do |dir|
37
+ options.output = File.expand_path(dir)
38
+ end
39
+
40
+ opts.on_tail("-v version", "--version", "Show version (#{Rice::VERSION})") do
41
+ puts "ruby_prof " + Rice::VERSION
42
+ exit
43
+ end
44
+
45
+ opts.on_tail("-h", "--help", "Show help message") do
46
+ puts opts
47
+ exit
48
+ end
49
+ end
50
+ end
51
+
52
+ def parse_args
53
+ @options = Struct.new(:exec, :extension, :output).new
54
+ options.extension = nil
55
+ options.output = nil
56
+
57
+ # Make sure the user specified at least one file
58
+ if ARGV.length < 1 and not options.exec
59
+ puts self.option_parser
60
+ puts ""
61
+ puts "Must specify a rice extension"
62
+ exit(-1)
63
+ end
64
+
65
+ self.option_parser.parse! ARGV
66
+
67
+ if options.output.nil?
68
+ puts "Must specify an output directory with -o/--output option"
69
+ exit(-1)
70
+ elsif !Dir.exist?(options.output)
71
+ puts "Creating output directory '#{options.output}'"
72
+ Dir.mkdir(options.output)
73
+ end
74
+
75
+ options.extension = ARGV.shift
76
+
77
+ options
78
+ rescue OptionParser::InvalidOption, OptionParser::InvalidArgument, OptionParser::MissingArgument => e
79
+ puts self.option_parser
80
+ puts e.message
81
+ exit(-1)
82
+ end
83
+ end
84
+ end
85
+
86
+ # Parse command line options
87
+ cmd = Rice::Cmd.new
88
+ options = cmd.parse_args
89
+
90
+ # Load the extension
91
+ require options.extension
92
+
93
+ # Get modules and classes
94
+ modules = Rice::Registries.instance.modules.modules
95
+ klasses = Rice::Registries.instance.types.klasses
96
+
97
+ # Doxygen documentation
98
+ doxygen_root = "https://docs.opencv.org/4.x"
99
+ doxygen_index = "https://docs.opencv.org/4.x/opencv.tag"
100
+ #doxygen_index = "c:/Users/cfis/Downloads/opencv.tag"
101
+ type_mappings = {/^enum\s*/i => '',
102
+ /^union\s*/i => '',
103
+ /<.*>/ => '',
104
+ '::debug_build_guard' => ''}
105
+
106
+ method_mappings = {'Cv' => {'agast' => 'AGAST',
107
+ 'approx_poly_dp' => 'approxPolyDP',
108
+ 'calc_optical_flow_pyr_lk' => 'calcOpticalFlowPyrLK',
109
+ 'calibrate_camera_ro' => 'calibrateCameraRO',
110
+ 'cam_shift' => 'CamShift',
111
+ 'compose_rt' => 'composeRT',
112
+ 'compute_ecc' => 'computeECC',
113
+ 'create_clahe' => 'createCLAHE',
114
+ 'current_ui_framework' => 'currentUIFramework',
115
+ 'create_align_mtb' => 'createAlignMTB',
116
+ 'create_background_subtractor_knn' => 'createBackgroundSubtractorKNN',
117
+ 'create_background_subtractor_mog2' => 'createBackgroundSubtractorMOG2',
118
+ 'denoise_tvl1' => 'denoise_TVL1',
119
+ 'emd' => 'EMD',
120
+ 'estimate_affine_2d' => 'estimateAffine2D',
121
+ 'estimate_affine_partial_2d' => 'estimateAffinePartial2D',
122
+ 'fast' => 'FAST',
123
+ 'filter_2d' => 'filter2D',
124
+ 'find_chessboard_corners_sb?' => 'findChessboardCornersSB',
125
+ 'find_transform_ecc' => 'findTransformECC',
126
+ 'fit_ellipse_ams' => 'fitEllipseAMS',
127
+ 'flip_nd' => 'flipND',
128
+ 'gaussian_blur' => 'GaussianBlur',
129
+ 'get_cpu_features_line' => 'getCPUFeaturesLine',
130
+ 'get_cpu_tick_count' => 'getCPUTickCount',
131
+ 'get_number_of_cp_us' => 'getNumberOfCPUs',
132
+ 'get_optimal_dft_size' => 'getOptimalDFTSize',
133
+ 'get_rotation_matrix_2d' => 'getRotationMatrix2D',
134
+ 'get_valid_disparity_roi' => 'getValidDisparityROI',
135
+ 'group_rectangles_meanshift' => 'groupRectangles_meanshift',
136
+ 'have_open_vx?' => 'haveOpenVX',
137
+ 'hough_circles' => 'HoughCircles',
138
+ 'hough_lines' => 'HoughLines',
139
+ 'hough_lines_p' => 'HoughLinesP',
140
+ 'hough_lines_point_set' => 'HoughLinesPointSet',
141
+ 'hu_moments' => 'HuMoments',
142
+ 'init_camera_matrix_2d' => 'initCameraMatrix2D',
143
+ 'lu' => 'LU',
144
+ 'lut' => 'LUT',
145
+ 'pca_back_project' => 'PCABackProject',
146
+ 'pca_compute' => 'PCACompute',
147
+ 'pca_project' => 'PCAProject',
148
+ 'psnr' => 'PSNR',
149
+ 'rq_decomp3x3' => 'RQDecomp3x3',
150
+ 'select_roi ' => 'selectROI',
151
+ 'sep_filter_2d' => 'sepFilter2D',
152
+ 'set_rng_seed' => 'setRNGSeed',
153
+ 'set_use_open_vx' => 'setUseOpenVX',
154
+ 'solve_lp' => 'solveLP',
155
+ 'solve_pn_p_refine_lm' => 'solvePnPRefineLM',
156
+ 'solve_pn_p_refine_vvs' => 'solvePnPRefineVVS',
157
+ 'sv_back_subst' => 'SVBackSubst',
158
+ 'sv_decomp' => 'SVDecomp',
159
+ 'the_rng' => 'theRNG',
160
+ 'transpose_nd' => 'transposeND',
161
+ 'use_open_vx?' => 'useOpenVX',
162
+ 'wrapper_emd' => 'wrapperEMD'},
163
+ 'Cv::AsyncArray' => {'_get_impl' => '_getImpl',
164
+ 'wait_for?' => 'wait_for'},
165
+ 'Cv::BackgroundSubtractorKNN' => {'getk_nn_samples' => 'getkNNSamples',
166
+ 'setk_nn_samples' => 'setkNNSamples'},
167
+ 'Cv::Cuda::DeviceInfo' => {'device_id' => 'deviceID',
168
+ 'ecc_enabled?' => 'ECCEnabled',
169
+ 'max_surface_2d' => 'maxSurface2D',
170
+ 'max_texture_2d' => 'maxTexture2D',
171
+ 'pci_bus_id' => 'pciBusID',
172
+ 'pci_device_id' => 'pciDeviceID',
173
+ 'pci_domain_id' => 'pciDomainID'},
174
+ 'Cv::Cuda::GpuMat' => {'adjust_roi' => 'adjustROI',
175
+ 'locate_roi' => 'locateROI'},
176
+ 'Cv::Cuda::GpuMatND' => {'to_gpu_mat' => 'operator GpuMat'},
177
+ 'Cv::FaceDetectorYN' => {'get_nms_threshold' => 'getNMSThreshold'},
178
+ 'Cv::FaceRecognizerSF' => {'set_nms_threshold' => 'setNMSThreshold'},
179
+ 'Cv::HOGDescriptor' => {'detect_multi_scale_roi' => 'detectMultiScaleROI',
180
+ 'detect_roi' => 'detectROI'},
181
+ 'Cv::HOGDescriptor::DescriptorStorageFormat' => {'set_svm_detector' => 'setSVMDetector'},
182
+ 'Cv::Hfloat' => {'to_float' => 'operator float'},
183
+ 'Cv::Mat' => {'locate_roi' => 'locateROI'},
184
+ 'Cv::Ml::ANN_MLP' => {'get_rprop_dw0' => 'getRpropDW0',
185
+ 'get_rprop_dw_max' => 'getRpropDWMax',
186
+ 'get_rprop_dw_min' => 'getRpropDWMin',
187
+ 'get_rprop_dw_minus' => 'getRpropDWMinus',
188
+ 'get_rprop_dw_plus' => 'getRpropDWPlus',
189
+ 'set_anneal_energy_rng' => 'setAnnealEnergyRNG',
190
+ 'set_rprop_dw0' => 'setRpropDW0',
191
+ 'set_rprop_dw_max' => 'setRpropDWMax',
192
+ 'set_rprop_dw_min' => 'setRpropDWMin',
193
+ 'set_rprop_dw_minus' => 'setRpropDWMinus',
194
+ 'set_rprop_dw_plus' => 'setRpropDWPlus'},
195
+ 'Cv::Ml::DTrees' => {'get_cv_folds' => 'getCVFolds',
196
+ 'get_use1_se_rule?' => 'getUse1SERule',
197
+ 'set_cv_folds' => 'setCVFolds',
198
+ 'set_use1_se_rule' => 'setUse1SERule'},
199
+ 'Cv::Ml::RTrees' => {'get_oob_error' => 'getOOBError'}
200
+ }
201
+
202
+ doxygen_resolver = Rice::Doc::Doxygen.new(doxygen_root, doxygen_index, type_mappings, method_mappings)
203
+
204
+ # Setup resolvers per namespace
205
+ resolvers = {nil => Rice::Doc::Ruby.new,
206
+ 'Cv' => doxygen_resolver,
207
+ 'Rice' => Rice::Doc::Rice.new,
208
+ 'Std' => Rice::Doc::CppReference.new}
209
+
210
+ generator = Rice::Doc::Mkdocs.new(modules + klasses, resolvers, options.output)
211
+ generator.generate
data/bin/rice-rbs.rb ADDED
@@ -0,0 +1,92 @@
1
+ #! /usr/bin/env ruby
2
+
3
+ require 'bundler/setup'
4
+
5
+ # Require rice
6
+ require 'rice'
7
+
8
+ # Now setup option parser
9
+ require 'optparse'
10
+
11
+ module Rice
12
+ # == Synopsis
13
+ #
14
+ # Generates rbs files for a Rice extension
15
+ #
16
+ # == Usage
17
+ # rice-rbs [options] <rice_extension_library>
18
+ #
19
+ # Options:
20
+ # -o, --output=path Output directory
21
+ # -v, --version Show version (1.1.0)
22
+ # -h, --help Show help message
23
+
24
+ class Cmd
25
+ # :enddoc:
26
+ attr_accessor :options
27
+
28
+ def option_parser
29
+ OptionParser.new do |opts|
30
+ opts.banner = "rice-rbs #{Rice::VERSION}\n" +
31
+ "Usage: rice-rbs [options] <rice_extension_library_path>"
32
+
33
+ opts.separator ""
34
+ opts.separator "Options:"
35
+
36
+ opts.on('-o path', '--output=path',
37
+ 'Output generated Rbs files to the specified directory') do |dir|
38
+ options.output = File.expand_path(dir)
39
+ end
40
+
41
+ opts.on_tail("-v version", "--version", "Show version (#{Rice::VERSION})") do
42
+ puts "ruby_prof " + Rice::VERSION
43
+ exit
44
+ end
45
+
46
+ opts.on_tail("-h", "--help", "Show help message") do
47
+ puts opts
48
+ exit
49
+ end
50
+ end
51
+ end
52
+
53
+ def parse_args
54
+ @options = Struct.new(:exec, :extension, :output).new
55
+ options.extension = nil
56
+ options.output = nil
57
+
58
+ # Make sure the user specified at least one file
59
+ if ARGV.length < 1 and not options.exec
60
+ puts self.option_parser
61
+ puts ""
62
+ puts "Must specify a rice extension"
63
+ exit(-1)
64
+ end
65
+
66
+ self.option_parser.parse! ARGV
67
+
68
+ if options.output.nil?
69
+ puts "Must specify an output directory with -o/--output option"
70
+ exit(-1)
71
+ elsif !Dir.exist?(options.output)
72
+ puts "Creating output directory '#{options.output}'"
73
+ Dir.mkdir(options.output)
74
+ end
75
+
76
+ options.extension = ARGV.shift
77
+
78
+ options
79
+ rescue OptionParser::InvalidOption, OptionParser::InvalidArgument, OptionParser::MissingArgument => e
80
+ puts self.option_parser
81
+ puts e.message
82
+ exit(-1)
83
+ end
84
+ end
85
+ end
86
+
87
+ # Parse command line options
88
+ cmd = Rice::Cmd.new
89
+ options = cmd.parse_args
90
+
91
+ rbs = Rice::Rbs.new(options.extension, options.output)
92
+ rbs.generate