ruby-gr 0.0.23 → 0.58.1.0

Sign up to get free protection for your applications and to get access to all the features.
data/lib/grm/ffi.rb CHANGED
@@ -15,7 +15,7 @@ module GRM
15
15
  raise LoadError, 'Could not find GR Framework'
16
16
  end
17
17
 
18
- extend GRCommons::Extern
18
+ extend GRCommons::TryExtern
19
19
 
20
20
  # Currently, the declarations of GRM functions are distributed in several
21
21
  # header files.
@@ -28,6 +28,7 @@ module GRM
28
28
  try_extern 'int grm_args_contains(const grm_args_t *args, const char *keyword)'
29
29
  try_extern 'void grm_args_clear(grm_args_t *args)'
30
30
  try_extern 'void grm_args_remove(grm_args_t *args, const char *key)'
31
+ typealias 'grm_args_ptr_t', 'void*'
31
32
  try_extern 'grm_args_ptr_t grm_length(double value, const char *unit)'
32
33
 
33
34
  # https://github.com/sciapp/gr/blob/master/lib/grm/dump.h
@@ -36,14 +37,17 @@ module GRM
36
37
  try_extern 'char *grm_dump_json_str(void)'
37
38
 
38
39
  # https://github.com/sciapp/gr/blob/master/lib/grm/event.h
40
+ typealias 'grm_event_type_t', 'int' # enum
41
+ typealias 'grm_event_callback_t', 'void*'
39
42
  try_extern 'int grm_register(grm_event_type_t type, grm_event_callback_t callback)'
40
43
  try_extern 'int grm_unregister(grm_event_type_t type)'
41
44
 
42
45
  # https://github.com/sciapp/gr/blob/master/lib/grm/interaction.h
46
+ # FIXME: https://github.com/ruby/fiddle/issues/68
47
+ typealias 'const_int', 'int' # FIXME
43
48
  try_extern 'int grm_input(const grm_args_t *input_args)'
44
- try_extern 'int grm_get_box(const int x1, const int y1, const int x2, const int y2, const int keep_aspect_ratio, int *x, int *y, int *w, int *h)'
45
- try_extern 'grm_input(const grm_args_t *input_args)'
46
- try_extern 'grm_tooltip_info_t *grm_get_tooltip(const int, const int)'
49
+ try_extern 'int grm_get_box(const_int x1, const_int y1, const_int x2, const_int y2, const_int keep_aspect_ratio, int *x, int *y, int *w, int *h)' # FIXME
50
+ try_extern 'grm_tooltip_info_t *grm_get_tooltip(const_int, const_int)' # FIXME
47
51
 
48
52
  # https://github.com/sciapp/gr/blob/master/lib/grm/net.h
49
53
  try_extern 'void *grm_open(int is_receiver, const char *name, unsigned int id,
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby-gr
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.23
4
+ version: 0.58.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - kojix2
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-09-22 00:00:00.000000000 Z
11
+ date: 2021-08-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: histogram
@@ -66,20 +66,6 @@ dependencies:
66
66
  - - ">="
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
- - !ruby/object:Gem::Dependency
70
- name: fiddle
71
- requirement: !ruby/object:Gem::Requirement
72
- requirements:
73
- - - ">="
74
- - !ruby/object:Gem::Version
75
- version: '0'
76
- type: :development
77
- prerelease: false
78
- version_requirements: !ruby/object:Gem::Requirement
79
- requirements:
80
- - - ">="
81
- - !ruby/object:Gem::Version
82
- version: '0'
83
69
  - !ruby/object:Gem::Dependency
84
70
  name: pry
85
71
  requirement: !ruby/object:Gem::Requirement
@@ -162,19 +148,19 @@ files:
162
148
  - lib/gr/ffi.rb
163
149
  - lib/gr/grbase.rb
164
150
  - lib/gr/plot.rb
165
- - lib/gr/plot.rb.md
166
151
  - lib/gr/version.rb
167
152
  - lib/gr3.rb
168
153
  - lib/gr3/ffi.rb
169
154
  - lib/gr3/gr3base.rb
170
155
  - lib/gr3/version.rb
171
156
  - lib/gr_commons/define_methods.rb
172
- - lib/gr_commons/extern.rb
173
157
  - lib/gr_commons/fiddley.rb
174
158
  - lib/gr_commons/gr_common_utils.rb
175
159
  - lib/gr_commons/gr_commons.rb
160
+ - lib/gr_commons/gr_lib.rb
161
+ - lib/gr_commons/gr_logger.rb
176
162
  - lib/gr_commons/jupyter_support.rb
177
- - lib/gr_commons/search_shared_library.rb
163
+ - lib/gr_commons/try_extern.rb
178
164
  - lib/gr_commons/version.rb
179
165
  - lib/grm.rb
180
166
  - lib/grm/ffi.rb
@@ -200,7 +186,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
200
186
  - !ruby/object:Gem::Version
201
187
  version: '0'
202
188
  requirements: []
203
- rubygems_version: 3.1.2
189
+ rubygems_version: 3.2.22
204
190
  signing_key:
205
191
  specification_version: 4
206
192
  summary: GR for Ruby
data/lib/gr/plot.rb.md DELETED
@@ -1,172 +0,0 @@
1
- This is a memo to think about the structure of Plot/Figure.
2
-
3
- ````ruby
4
-
5
- module GR
6
- # object oriented way
7
- class PlotBase
8
- end
9
-
10
- class Line < PlotBase
11
- end
12
-
13
- class << self
14
- def set_viewport; end
15
-
16
- def minmax; end
17
-
18
- def set_window; end
19
-
20
- def draw_axes; end
21
-
22
- def draw_polar_axes; end
23
-
24
- def _inqtext; end
25
-
26
- def _text; end
27
-
28
- def draw_legend; end
29
-
30
- def draw_colorbar; end
31
-
32
- def colormap; end
33
-
34
- def to_rgba; end
35
-
36
- # Ruby is object-oriented language.
37
- # Julia is more functional...
38
- # def create_context
39
- # end
40
- # def restore_context
41
- # end
42
- # def figure
43
- # end
44
-
45
- # def hold
46
- # end
47
- # def usecolorscheme
48
- # end
49
-
50
- # Set current subplot index.
51
- def subplot; end
52
-
53
- # draw_grid
54
-
55
- # xticks
56
- # yticks
57
- # zticks
58
-
59
- # xticklabels
60
- # yticklabels
61
-
62
- def plot_img; end # should be private?
63
-
64
- def plot_iso; end # should be private?
65
-
66
- def plot_polar; end # should be private?
67
-
68
- # send_meta
69
-
70
- def plot_data; end # should be private?
71
-
72
- def plot_args; end # should be private?
73
-
74
- # Draw one or more line plots.
75
- def plot; end
76
-
77
- # def plot_line_over oplot_line ?
78
-
79
- # Draw one or more step or staircase plots.
80
- def step; end
81
-
82
- # Draw one or more scatter plots.
83
- def scatter; end
84
-
85
- # Draw a stem plot.
86
- def stem; end
87
-
88
- # Draw a bar plot.
89
- def barplot; end
90
-
91
- def hist; end # should be private?
92
-
93
- # Draw a histogram.
94
- def histgram; end
95
-
96
- # Draw a polar histogram.
97
- def polarhistogram; end
98
-
99
- # Draw a contour plot.
100
- def contour; end
101
- # GR.contour is already defined in GR::FFI class.
102
-
103
- # Draw a filled contour plot.
104
- def contourf; end
105
- # GR.contourf is already defined in GR::FFI class.
106
-
107
- # Draw a hexagon binning plot.
108
- def hexbin; end
109
- # GR.hexbin is already defined in GR::FFI class.
110
-
111
- # Draw a heatmap.
112
- def heatmap; end
113
-
114
- def polarheatmap; end
115
-
116
- # Draw a three-dimensional wireframe plot.
117
- def wireframe; end
118
-
119
- # Draw a three-dimensional surface plot.
120
- def surface; end
121
-
122
- def volume; end
123
-
124
- # Draw one or more three-dimensional line plots.
125
- def plot3; end
126
-
127
- # Draw one or more three-dimensional scatter plots.
128
- def scatter3; end
129
-
130
- def redraw; end
131
-
132
- def title; end
133
-
134
- def xlabel; end
135
-
136
- def ylabel; end
137
-
138
- def legend; end
139
-
140
- def xlim; end
141
-
142
- def ylim; end
143
-
144
- def savefig; end
145
-
146
- def meshgrid; end # should be private ?
147
-
148
- def peaks; end # should be private ?
149
-
150
- def imshow; end
151
-
152
- # Draw an isosurface.
153
- def isosurface; end
154
-
155
- # Draw one or more polar plots.
156
- def polar; end
157
-
158
- # Draw a triangular surface plot.
159
- def trisurf; end
160
-
161
- # Draw a triangular contour plot.
162
- def tricont; end
163
-
164
- def shade; end
165
-
166
- # def set_panzoom ?
167
-
168
- # mainloop
169
- end
170
- end
171
-
172
- ```
@@ -1,73 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'pkg-config'
4
-
5
- module GRCommons
6
- # This module helps GR, GR and GRM to search the shared library.
7
- #
8
- # The order of priority:
9
- # 1. RubyInstaller ( for Windows only )
10
- # 2. Environment variable GRDIR
11
- # 3. pkg-config : https://github.com/ruby-gnome/pkg-config
12
- # The following packages (should) support pkg-config.
13
- # - Linux
14
- # - Red Data Tools https://github.com/red-data-tools/packages.red-data-tools.org
15
- # - libgr-dev
16
- # - libgr3-dev
17
- # - libgrm-dev
18
- # - Mac
19
- # - Homebrew https://github.com/Homebrew/homebrew-core
20
- # - libgr
21
- # - Windows
22
- # - MinGW https://github.com/msys2/MINGW-packages
23
- # - mingw-w64-gr
24
- module SearchSharedLibrary
25
- # Search the shared library.
26
- # @note This method does not detect the Operating System.
27
- #
28
- # @param gr_lib_name [String] The actual file name of the shared library.
29
- # @param pkg_name [String] The package name to be used when searching with pkg-configg
30
- def search_shared_library(gr_lib_name, pkg_name)
31
- # Windows + RubyInstaller
32
- if Object.const_defined?(:RubyInstaller)
33
- ENV['GRDIR'] ||= [
34
- RubyInstaller::Runtime.msys2_installation.msys_path,
35
- RubyInstaller::Runtime.msys2_installation.mingwarch
36
- ].join(File::ALT_SEPARATOR)
37
- recursive_search(gr_lib_name, ENV['GRDIR']).tap do |path|
38
- RubyInstaller::Runtime.add_dll_directory(File.dirname(path))
39
- end
40
- # ENV['GRDIR'] (Linux, Mac, Windows)
41
- elsif ENV['GRDIR']
42
- begin
43
- recursive_search(gr_lib_name, ENV['GRDIR'])
44
- rescue StandardError => e
45
- warn "\nWhile searching for #{gr_lib_name} in the directory specified " \
46
- "in the GRDIR environment variable, ENV['GRDIR']=#{ENV['GRDIR']}, " \
47
- "the following error occurred : #{e.message}"
48
- pkg_config_search(gr_lib_name, pkg_name)
49
- end
50
- else
51
- pkg_config_search(gr_lib_name, pkg_name)
52
- end
53
- end
54
-
55
- def recursive_search(name, base_dir)
56
- Dir.chdir(base_dir) do
57
- if path = Dir["**/#{name}"].first # FIXME
58
- File.expand_path(path)
59
- else
60
- raise StandardError "#{name} not found in #{base_dir}"
61
- end
62
- end
63
- end
64
-
65
- def pkg_config_search(gr_lib_name, pkg_name)
66
- PKGConfig.variable(pkg_name, 'sopath')
67
- rescue PackageConfig::NotFoundError => e
68
- raise "#{e.message} Cannot find #{gr_lib_name}. " \
69
- "Please Make sure that GR is installed and the environment ” \
70
- ”variable GRDIR is set correctly."
71
- end
72
- end
73
- end