gmt 0.2.3 → 0.2.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/ext/gmt/gmt.c +37 -10
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 47175ab0f9f220eec500e98bb1b392ec93ae42b61e13c851bae392a0dd4d9d08
|
4
|
+
data.tar.gz: 0f24492604a31c82461d730be0afbc508849ff757939ac99596020f8ffe0c6f7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7fb19342fb1e3480531f02e1d9ca34203791820952c2d683d5294af027a5f9cc8205f9f2ed07fa452b7a0f9bb4dd51b9bafe36e7b08934e745fea6410cfb4c30
|
7
|
+
data.tar.gz: 8e59daf96977b38a4498c7934d04ec302c7044a50af43e07ad36118742c87070d1d1eb268578f4c3a17c41a3c04912d3db1afd849b0e16d96cce98b7b13f9172
|
data/ext/gmt/gmt.c
CHANGED
@@ -1,4 +1,6 @@
|
|
1
1
|
#include <ruby.h>
|
2
|
+
#include <ruby/version.h>
|
3
|
+
|
2
4
|
#include <gmt.h>
|
3
5
|
#include <gmt_version.h>
|
4
6
|
|
@@ -27,6 +29,26 @@ static void raise_if_error(int err, const char *module)
|
|
27
29
|
rb_raise(rb_eRuntimeError, "failed call to GMT module %s", module);
|
28
30
|
}
|
29
31
|
|
32
|
+
static void gmt_free(void*);
|
33
|
+
|
34
|
+
static rb_data_type_t data_type = {
|
35
|
+
.wrap_struct_name = "ruby-gmt-wrap",
|
36
|
+
.function = {
|
37
|
+
.dmark = NULL,
|
38
|
+
.dfree = gmt_free,
|
39
|
+
.dsize = NULL,
|
40
|
+
#if RUBY_API_VERSION_CODE < 20700
|
41
|
+
.reserved = { NULL, NULL }
|
42
|
+
#else
|
43
|
+
.dcompact = NULL,
|
44
|
+
.reserved = { NULL }
|
45
|
+
#endif
|
46
|
+
},
|
47
|
+
.parent = NULL,
|
48
|
+
.data = NULL,
|
49
|
+
.flags = RUBY_TYPED_FREE_IMMEDIATELY
|
50
|
+
};
|
51
|
+
|
30
52
|
/* ruby object interface */
|
31
53
|
|
32
54
|
static void gmt_free(void *p)
|
@@ -38,13 +60,18 @@ static void gmt_free(void *p)
|
|
38
60
|
GMT_Destroy_Session(gmt->session);
|
39
61
|
gmt->session = NULL;
|
40
62
|
}
|
63
|
+
|
64
|
+
free(gmt);
|
41
65
|
}
|
42
66
|
|
43
|
-
static VALUE gmt_alloc(VALUE
|
67
|
+
static VALUE gmt_alloc(VALUE cls)
|
44
68
|
{
|
45
69
|
gmt_t *gmt;
|
46
70
|
|
47
|
-
|
71
|
+
if ((gmt = malloc(sizeof(gmt_t))) == NULL)
|
72
|
+
rb_raise(rb_eNoMemError, "failed to alloc GMT struct");
|
73
|
+
|
74
|
+
VALUE obj = TypedData_Wrap_Struct(cls, &data_type, gmt);
|
48
75
|
|
49
76
|
gmt->session = NULL;
|
50
77
|
|
@@ -55,7 +82,7 @@ static VALUE gmt_init(VALUE self)
|
|
55
82
|
{
|
56
83
|
gmt_t *gmt;
|
57
84
|
|
58
|
-
|
85
|
+
TypedData_Get_Struct(self, gmt_t, &data_type, gmt);
|
59
86
|
|
60
87
|
gmt->session =
|
61
88
|
GMT_Create_Session("Session name", 2, 0, NULL);
|
@@ -70,7 +97,7 @@ static VALUE gmt_release(VALUE self)
|
|
70
97
|
{
|
71
98
|
gmt_t *gmt;
|
72
99
|
|
73
|
-
|
100
|
+
TypedData_Get_Struct(self, gmt_t, &data_type, gmt);
|
74
101
|
|
75
102
|
if (gmt->session)
|
76
103
|
{
|
@@ -89,7 +116,7 @@ static VALUE gmt_simple(const char *name, int argc, VALUE *argv, VALUE self)
|
|
89
116
|
rb_scan_args(argc, argv, "*1", &files, &opts);
|
90
117
|
|
91
118
|
gmt_t *gmt;
|
92
|
-
|
119
|
+
TypedData_Get_Struct(self, gmt_t, &data_type, gmt);
|
93
120
|
raise_unless_class_data(gmt);
|
94
121
|
|
95
122
|
void *session = gmt->session;
|
@@ -114,7 +141,7 @@ static VALUE gmt_simple(const char *name, int argc, VALUE *argv, VALUE self)
|
|
114
141
|
|
115
142
|
The "modern mode" modules (which have a slicker way of routing and
|
116
143
|
combining postscript output) will probably need a different treatment,
|
117
|
-
possibly a more attractive
|
144
|
+
possibly a more attractive one from the Ruby perspective; for now we
|
118
145
|
just limit ourselves to the classic mode.
|
119
146
|
*/
|
120
147
|
|
@@ -218,10 +245,6 @@ GMT_FUN(sphtriangulate)
|
|
218
245
|
|
219
246
|
/* Convert or extract subsets of data */
|
220
247
|
|
221
|
-
#if API_AT_LEAST(6, 2, 0)
|
222
|
-
GMT_FUN(gmtbinstats)
|
223
|
-
#endif
|
224
|
-
|
225
248
|
GMT_FUN(gmtconnect)
|
226
249
|
GMT_FUN(gmtconvert)
|
227
250
|
GMT_FUN(gmtselect)
|
@@ -241,6 +264,10 @@ GMT_FUN(grd2kml)
|
|
241
264
|
GMT_FUN(grd2rgb) /* https://github.com/GenericMappingTools/gmt/pull/425 */
|
242
265
|
#endif
|
243
266
|
|
267
|
+
#if API_AT_LEAST(6, 2, 0)
|
268
|
+
GMT_FUN(gmtbinstats)
|
269
|
+
#endif
|
270
|
+
|
244
271
|
/* trends in 1-D and 2-D data */
|
245
272
|
|
246
273
|
GMT_FUN(fitcircle)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gmt
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- J.J. Green
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-09-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|