librtree 1.0.2 → 1.0.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (52) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +11 -2
  3. data/README.md +4 -4
  4. data/ext/rtree/extconf.rb +18 -3
  5. data/ext/rtree/lib/bindex.c +2 -1
  6. data/ext/rtree/lib/branch.c +2 -1
  7. data/ext/rtree/lib/branches.c +2 -2
  8. data/ext/rtree/lib/bsrt.c +8 -18
  9. data/ext/rtree/lib/csv.c +3 -1
  10. data/ext/rtree/lib/error.c +2 -2
  11. data/ext/rtree/lib/json.c +6 -3
  12. data/ext/rtree/lib/mk/Hdr.mk +3 -3
  13. data/ext/rtree/lib/node.c +34 -34
  14. data/ext/rtree/lib/package.c +1 -1
  15. data/ext/rtree/lib/page.c +1 -1
  16. data/ext/rtree/lib/postscript.c +20 -16
  17. data/ext/rtree/lib/{bindex.h → private/bindex.h} +3 -8
  18. data/ext/rtree/lib/{bounds.h → private/bounds.h} +3 -3
  19. data/ext/rtree/lib/{rtree → private}/branch.h +10 -17
  20. data/ext/rtree/lib/{rtree → private}/branches.h +8 -14
  21. data/ext/rtree/lib/{bsrt.h → private/bsrt.h} +5 -5
  22. data/ext/rtree/lib/{constants.h → private/constants.h} +3 -3
  23. data/ext/rtree/lib/{csv.h → private/csv.h} +5 -5
  24. data/ext/rtree/lib/{endianness.h → private/endianness.h} +4 -8
  25. data/ext/rtree/lib/{json.h → private/json.h} +5 -5
  26. data/ext/rtree/lib/private/node.h +86 -0
  27. data/ext/rtree/lib/private/page.h +13 -0
  28. data/ext/rtree/lib/private/postscript.h +17 -0
  29. data/ext/rtree/lib/{rtree → private}/rect.h +6 -14
  30. data/ext/rtree/lib/{rtree → private}/rectf.h +3 -14
  31. data/ext/rtree/lib/private/rtree.h +20 -0
  32. data/ext/rtree/lib/private/search.h +20 -0
  33. data/ext/rtree/lib/private/split.h +15 -0
  34. data/ext/rtree/lib/{spvol.h → private/spvol.h} +3 -3
  35. data/ext/rtree/lib/private/state.h +91 -0
  36. data/ext/rtree/lib/rect.c +4 -1
  37. data/ext/rtree/lib/rectf.c +1 -1
  38. data/ext/rtree/lib/rtree/node.h +0 -75
  39. data/ext/rtree/lib/rtree/postscript.h +19 -21
  40. data/ext/rtree/lib/rtree/search.h +0 -6
  41. data/ext/rtree/lib/rtree/state.h +0 -79
  42. data/ext/rtree/lib/rtree-base.c +64 -4
  43. data/ext/rtree/lib/rtree.h +7 -11
  44. data/ext/rtree/lib/search.c +4 -3
  45. data/ext/rtree/lib/split.c +9 -6
  46. data/ext/rtree/lib/spvol.c +1 -1
  47. data/ext/rtree/lib/state.c +7 -7
  48. data/ext/rtree/rtree.c +18 -18
  49. data/lib/rtree.rb +2 -8
  50. metadata +38 -19
  51. data/ext/rtree/lib/page.h +0 -13
  52. data/ext/rtree/lib/split.h +0 -15
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c35526142564e94d93f091e405467f2ee2df3d294b1a4b8e3a87db66f1229043
4
- data.tar.gz: dffb928767c821a14460f21d06fc1c90e41a7a17a94a8e700fac0c409d65ca59
3
+ metadata.gz: 0b253861945be28133a07d5041b080939164dc3725a4b5b458319899d1ad9b66
4
+ data.tar.gz: 56704611278f67678693ce56e4cec85ae436ba41d534803e0fb8694c39d5b45b
5
5
  SHA512:
6
- metadata.gz: 0447a6e59546922ed8d227e0f3589aae7771243c4e16c24ae46cde5075dae4b1f7be2b1a8526d58adc6c3db379719201fcf370f1251e82773f488046ab66caff
7
- data.tar.gz: 8ed4fd4e3982a4bfbffac9a53f92ae6dfd497ac4e684110d72591e7ec500a4ee2629a5b3a17dad5cc404383eb7aaccf333d7d15a8aeaa943d858a3e973a35d13
6
+ metadata.gz: 904eacdcbbe518f91ccc41d2c03da9191591a0af6e17be87874be1d74525707a10815e68ed0c9c3dacf91afe70384f982723487f3b6434241ec51097745f0f3e
7
+ data.tar.gz: 8be9c36a56b92d1bea25a2ef352cb1e3062b1d197983c92cd11d0f753451573b454b3af22327c05fa300d52f3036561555bd1464faa79ea304d87811ddd4acd2
data/CHANGELOG.md CHANGED
@@ -1,7 +1,16 @@
1
1
  Changelog
2
2
  ---------
3
3
 
4
- ### 1.0.2, pending
4
+ ### 1.0.4, 30-10-2023
5
+
6
+ - Check for `__builtin_ctzl` (and use if found)
7
+
8
+ ### 1.0.3, 16-10-2023
9
+
10
+ - Update to librtree 1.3.0
11
+ - Remove workaround for "optional argument to #exit!" issue
12
+
13
+ ### 1.0.2, 06-04-2023
5
14
 
6
15
  - The `#serialise` method raises if the read from pipe returns
7
16
  nil (which it might), so the method (and other methods which
@@ -26,7 +35,7 @@ Changelog
26
35
 
27
36
  - Tidying
28
37
  - Fix warning "undefining the allocator of T_DATA class" on
29
- Ruby 3,2
38
+ Ruby 3.2
30
39
  - No functional changes
31
40
 
32
41
  ### 0.9.0, 07-11-2021
data/README.md CHANGED
@@ -54,12 +54,12 @@ this.
54
54
  If using [rbenv][4], then first set a local version of Ruby to use,
55
55
  then install the gems into your local cache
56
56
 
57
- rbenv local 2.7.0
57
+ rbenv local 3.2.0
58
58
  bundle install
59
59
 
60
- The repository's `.gitignore` ignores **rbenv**'s `.ruby-version`
61
- file, since we don't want to mandate a particular Ruby version
62
- for the package.
60
+ The repository's `.gitignore` ignores **rbenv**'s `.ruby-version` file,
61
+ since we don't want to mandate a particular Ruby version for the package
62
+ (although 3.0 is the minimal version for development at present).
63
63
 
64
64
  If not using **rbenv** then just
65
65
 
data/ext/rtree/extconf.rb CHANGED
@@ -17,7 +17,7 @@ if have_header('endian.h') ||
17
17
  have_header('libkern/OSByteOrder.h') ||
18
18
  have_header('winsock2.h')
19
19
  then
20
- append_cflags("-DWITH_BSRT")
20
+ append_cflags('-DWITH_BSRT')
21
21
  else
22
22
  warn('cannot determine endianness, no BSRT support')
23
23
  end
@@ -25,7 +25,7 @@ end
25
25
  if have_header('jansson.h') &&
26
26
  have_library('jansson', 'json_pack')
27
27
  then
28
- append_cflags("-DWITH_JSON")
28
+ append_cflags('-DWITH_JSON')
29
29
  else
30
30
  warn('cannot find jansson, no JSON support')
31
31
  end
@@ -41,5 +41,20 @@ end
41
41
 
42
42
  have_header('features.h')
43
43
 
44
+ if have_macro('__has_builtin') then
45
+ src = <<~EOF
46
+ #if __has_builtin(__builtin_ctzl)
47
+ #else
48
+ #error no __builtin_ctzl
49
+ #endif
50
+ EOF
51
+ checking_for(checking_message('__builtin_ctzl')) do
52
+ if result = try_compile(src) then
53
+ $defs.push('-DHAVE___BUILTIN_CTZL')
54
+ result
55
+ end
56
+ end
57
+ end
58
+
44
59
  create_header('config.h')
45
- create_makefile("rtree")
60
+ create_makefile('rtree')
@@ -8,7 +8,8 @@
8
8
  #include "config.h"
9
9
  #endif
10
10
 
11
- #include "bindex.h"
11
+ #include "private/bindex.h"
12
+
12
13
  #include "rtree/error.h"
13
14
 
14
15
  #include <errno.h>
@@ -2,7 +2,8 @@
2
2
  #include "config.h"
3
3
  #endif
4
4
 
5
- #include "rtree/branch.h"
5
+ #include "private/branch.h"
6
+ #include "private/state.h"
6
7
 
7
8
  #include <stddef.h>
8
9
  #include <stdalign.h>
@@ -4,14 +4,14 @@
4
4
  not known until runtime, so we have to perform those calculations
5
5
  ourselves. Note that we just do the arithmatic here, no error
6
6
  checking -- so a over-sized index to branches_get() will lead to
7
- a memory error, the caller is epected to do this check themselves
7
+ a memory error, the caller is expected to do this check themselves
8
8
  */
9
9
 
10
10
  #ifdef HAVE_CONFIG_H
11
11
  #include "config.h"
12
12
  #endif
13
13
 
14
- #include "rtree/branches.h"
14
+ #include "private/branches.h"
15
15
 
16
16
  extern branch_t* branches_get(const state_t*, void*, size_t);
17
17
  extern void branches_set(const state_t*, void*, size_t, const branch_t*);
data/ext/rtree/lib/bsrt.c CHANGED
@@ -2,18 +2,20 @@
2
2
  #include "config.h"
3
3
  #endif
4
4
 
5
- #include "bsrt.h"
5
+ #include "private/branch.h"
6
+ #include "private/branches.h"
7
+ #include "private/bsrt.h"
8
+ #include "private/node.h"
6
9
 
7
10
  #include "rtree/error.h"
8
- #include "rtree/branches.h"
9
11
 
10
12
  #include <errno.h>
11
13
  #include <string.h>
12
14
 
13
15
  #ifdef WITH_BSRT
14
16
 
15
- #include "endianness.h"
16
- #include "bounds.h"
17
+ #include "private/endianness.h"
18
+ #include "private/bounds.h"
17
19
 
18
20
  #define BSRT_MAGIC "BSRt"
19
21
  #define BSRT_FOOTER "fin"
@@ -129,28 +131,18 @@ static int write_rect(const state_t *state,
129
131
 
130
132
  for (size_t i = 0 ; i < n ; i++)
131
133
  {
132
- /*
133
- The type-punning to/from char* here is legal (the standard
134
- makes an explicit exception), but cppcheck warns anyway, so
135
- we suppress those warnings
136
- */
137
-
138
134
  char p[k];
139
135
 
140
- /* cppcheck-suppress invalidPointerCast */
141
136
  *(rtree_coord_t*)p = rect[i];
142
137
 
143
138
  #if SIZEOF_RTREE_COORD_T == 4
144
- /* cppcheck-suppress invalidPointerCast */
145
139
  *(uint32_t*)p = htole32(*(uint32_t*)p);
146
140
  #elif SIZEOF_RTREE_COORD_T == 8
147
- /* cppcheck-suppress invalidPointerCast */
148
141
  *(uint64_t*)p = htole64(*(uint64_t*)p);
149
142
  #else
150
143
  #error rtree_coord_t size not handled
151
144
  #endif
152
145
 
153
- /* cppcheck-suppress invalidPointerCast */
154
146
  buffer[i] = *(rtree_coord_t*)p;
155
147
  }
156
148
 
@@ -321,7 +313,7 @@ static int read_v1_header(FILE *stream, uint16_t v[5])
321
313
  return 0;
322
314
  }
323
315
 
324
- static bool read_v1_state_consistent(uint16_t v[5], const state_t *state)
316
+ static bool read_v1_state_consistent(const uint16_t v[5], const state_t *state)
325
317
  {
326
318
  return
327
319
  (v[0] == state_dims(state)) &&
@@ -360,8 +352,6 @@ static int read_v1_rect(FILE *stream,
360
352
  #error rtree_coord_t size not handled
361
353
  #endif
362
354
 
363
- /* cppcheck-suppress invalidPointerCast */
364
-
365
355
  rect[i] = *(rtree_coord_t*)p;
366
356
  }
367
357
 
@@ -592,7 +582,7 @@ static int read_v2_header(FILE *stream, uint16_t v[6])
592
582
  return 0;
593
583
  }
594
584
 
595
- static bool read_v2_state_consistent(uint16_t v[6], const state_t *state)
585
+ static bool read_v2_state_consistent(const uint16_t v[6], const state_t *state)
596
586
  {
597
587
  return
598
588
  (v[0] == state_dims(state)) &&
data/ext/rtree/lib/csv.c CHANGED
@@ -2,7 +2,9 @@
2
2
  #include "config.h"
3
3
  #endif
4
4
 
5
- #include "csv.h"
5
+ #include "private/csv.h"
6
+ #include "private/rtree.h"
7
+ #include "private/state.h"
6
8
 
7
9
  #include "rtree/error.h"
8
10
  #include "rtree/types.h"
@@ -2,10 +2,10 @@
2
2
  #include "config.h"
3
3
  #endif
4
4
 
5
- #include <stdlib.h>
6
-
7
5
  #include "rtree/error.h"
8
6
 
7
+ #include <stdlib.h>
8
+
9
9
  const char* strerror_rtree(int err)
10
10
  {
11
11
  static const char nomsg[] = "unimplemented message";
data/ext/rtree/lib/json.c CHANGED
@@ -2,11 +2,14 @@
2
2
  #include "config.h"
3
3
  #endif
4
4
 
5
- #include "json.h"
6
- #include "bounds.h"
5
+ #include "private/bounds.h"
6
+ #include "private/branch.h"
7
+ #include "private/branches.h"
8
+ #include "private/json.h"
9
+ #include "private/node.h"
10
+ #include "private/rtree.h"
7
11
 
8
12
  #include "rtree/error.h"
9
- #include "rtree/branches.h"
10
13
 
11
14
  #include <errno.h>
12
15
 
@@ -1,3 +1,3 @@
1
- HDR := rtree/branch.h rtree/branches.h rtree/error.h rtree/extent.h \
2
- rtree/node.h rtree/package.h rtree/postscript.h rtree/rect.h \
3
- rtree/rectf.h rtree/search.h rtree/state.h rtree/types.h rtree.h
1
+ HDR := rtree/branch.h rtree/error.h rtree/extent.h rtree/node.h \
2
+ rtree/package.h rtree/postscript.h rtree/rectf.h rtree/search.h \
3
+ rtree/state.h rtree/types.h rtree.h
data/ext/rtree/lib/node.c CHANGED
@@ -2,12 +2,13 @@
2
2
  #include "config.h"
3
3
  #endif
4
4
 
5
- #include "rtree/node.h"
6
- #include "rtree/branches.h"
7
- #include "rtree/rect.h"
8
- #include "rtree/error.h"
5
+ #include "private/branch.h"
6
+ #include "private/branches.h"
7
+ #include "private/node.h"
8
+ #include "private/rect.h"
9
+ #include "private/split.h"
9
10
 
10
- #include "split.h"
11
+ #include "rtree/error.h"
11
12
 
12
13
  #include <stdbool.h>
13
14
  #include <stddef.h>
@@ -307,23 +308,27 @@ node_t* node_add_branch(const state_t *state, node_t *node, branch_t *branch)
307
308
  Pick a branch. Pick the one that will need the smallest increase
308
309
  in volume to accomodate the new (hyper-)rectangle. This will result
309
310
  in the least total volume for the covering rectangles in the current
310
- node. In case of a tie, pick the one which was smaller before, to
311
- get the best resolution when searching.
311
+ node.
312
+
313
+ This is expensive but does not show up directly in the profile since
314
+ it is only called once so obviously inlined.
312
315
  */
313
316
 
314
317
  static int node_pick_branch(const state_t *state,
315
- node_t *node, const rtree_coord_t *rect,
318
+ node_t *node,
319
+ const rtree_coord_t *rect,
316
320
  size_t *index)
317
321
  {
318
- const size_t
319
- dims = state_dims(state);
320
- size_t
321
- index_min = SIZE_MAX;
322
- rtree_coord_t
323
- dvol_min = INFINITY,
324
- vol_min = INFINITY;
325
322
 
326
- for (size_t i = 0 ; i < node_count(node) ; i++)
323
+ const size_t dims = state_dims(state);
324
+ assert(dims > 0);
325
+ rtree_coord_t rect2[2 * dims];
326
+
327
+ const size_t n = node_count(node);
328
+ assert(n > 0);
329
+ rtree_coord_t dvol[n];
330
+
331
+ for (size_t i = 0 ; i < n ; i++)
327
332
  {
328
333
  branch_t *branch;
329
334
 
@@ -331,34 +336,29 @@ static int node_pick_branch(const state_t *state,
331
336
  return RTREE_ERR_GETBRANCH;
332
337
 
333
338
  const rtree_coord_t *rect1 = branch_get_rect(branch);
334
- rtree_coord_t rect2[2 * dims];
335
339
  rect_combine(state, rect, rect1, rect2);
336
340
 
337
341
  rtree_coord_t
338
342
  vol1 = rect_spherical_volume(state, rect1),
339
- vol2 = rect_spherical_volume(state, rect2),
340
- dvol = vol2 - vol1;
343
+ vol2 = rect_spherical_volume(state, rect2);
341
344
 
342
- if ((dvol < dvol_min) || ((dvol == dvol_min) && (vol1 < vol_min)))
345
+ dvol[i] = vol2 - vol1;
346
+ }
347
+
348
+ rtree_coord_t dvol_min = dvol[0];
349
+ size_t index_min = 0;
350
+
351
+ for (size_t i = 1 ; i < n ; i++)
352
+ {
353
+ rtree_coord_t dvol_i = dvol[i];
354
+
355
+ if (dvol_i < dvol_min)
343
356
  {
357
+ dvol_min = dvol_i;
344
358
  index_min = i;
345
- vol_min = vol1;
346
- dvol_min = dvol;
347
359
  }
348
360
  }
349
361
 
350
- /*
351
- This can only happen if no branches are assigned in the above
352
- block, on the first call of it, dvol_min == DBL_MAX, so either
353
- the first case is called, or dvol == DBL_MAX, but dvol is equal
354
- to vol2 - vol1, and vol1, vol2 are non-negative, so vol2 must
355
- be DBL_MAX and vol1 zero, in particular vol1 < vol_min (DBL_MAX),
356
- so the second condition is met.
357
- */
358
-
359
- if (index_min == SIZE_MAX)
360
- return RTREE_ERR_PICKBRANCH;
361
-
362
362
  *index = index_min;
363
363
 
364
364
  return RTREE_OK;
@@ -5,7 +5,7 @@
5
5
 
6
6
  #include "rtree/package.h"
7
7
 
8
- const char rtree_package_version[] = "1.1.4";
8
+ const char rtree_package_version[] = "1.3.0";
9
9
  const char rtree_package_name[] = "librtree";
10
10
  const char rtree_package_url[] = "https://gitlab.com/jjg/librtree";
11
11
  const char rtree_package_bugreport[] = "j.j.green@gmx.co.uk";
data/ext/rtree/lib/page.c CHANGED
@@ -2,7 +2,7 @@
2
2
  #include "config.h"
3
3
  #endif
4
4
 
5
- #include "page.h"
5
+ #include "private/page.h"
6
6
 
7
7
  #ifdef HAVE_UNISTD_H
8
8
  #include <unistd.h>
@@ -2,9 +2,13 @@
2
2
  #include "config.h"
3
3
  #endif
4
4
 
5
- #include "rtree/postscript.h"
6
- #include "rtree/package.h"
5
+ #include "private/branch.h"
6
+ #include "private/node.h"
7
+ #include "private/state.h"
8
+
7
9
  #include "rtree/error.h"
10
+ #include "rtree/package.h"
11
+ #include "rtree/postscript.h"
8
12
 
9
13
  #include <time.h>
10
14
  #include <errno.h>
@@ -32,7 +36,7 @@ typedef struct {
32
36
  typedef struct {
33
37
  const state_t *state;
34
38
  const node_t *root;
35
- const style_t *style;
39
+ const postscript_style_t *style;
36
40
  page_t page;
37
41
  } ps_t;
38
42
 
@@ -45,7 +49,7 @@ static bool clamped(float value)
45
49
  return (value >= 0.0) && (value <= 1.0);
46
50
  }
47
51
 
48
- static int psr_colour(json_t *json, colour_t *colour)
52
+ static int psr_colour(json_t *json, postscript_colour_t *colour)
49
53
  {
50
54
  json_t *json_colour;
51
55
 
@@ -127,7 +131,7 @@ static int psr_colour(json_t *json, colour_t *colour)
127
131
  return 1;
128
132
  }
129
133
 
130
- static int psr_style_level(json_t *json, style_level_t *style_level)
134
+ static int psr_style_level(json_t *json, postscript_style_level_t *style_level)
131
135
  {
132
136
  if (! json_is_object(json))
133
137
  return 1;
@@ -169,7 +173,7 @@ static int psr_style_level(json_t *json, style_level_t *style_level)
169
173
  return 0;
170
174
  }
171
175
 
172
- static style_t* psr_style(json_t *json)
176
+ static postscript_style_t* psr_style(json_t *json)
173
177
  {
174
178
  if (! json_is_array(json))
175
179
  return NULL;
@@ -179,16 +183,16 @@ static style_t* psr_style(json_t *json)
179
183
  if (n == 0)
180
184
  return NULL;
181
185
 
182
- style_level_t *array;
186
+ postscript_style_level_t *array;
183
187
 
184
- if ((array = calloc(n, sizeof(style_level_t))) != NULL)
188
+ if ((array = calloc(n, sizeof(postscript_style_level_t))) != NULL)
185
189
  {
186
190
  size_t i;
187
191
  json_t *json_style;
188
192
 
189
193
  json_array_foreach(json, i, json_style)
190
194
  {
191
- style_level_t *style_level = array + i;
195
+ postscript_style_level_t *style_level = array + i;
192
196
 
193
197
  if (psr_style_level(json_style, style_level) != 0)
194
198
  {
@@ -197,9 +201,9 @@ static style_t* psr_style(json_t *json)
197
201
  }
198
202
  }
199
203
 
200
- style_t *style;
204
+ postscript_style_t *style;
201
205
 
202
- if ((style = malloc(sizeof(style_t))) != NULL)
206
+ if ((style = malloc(sizeof(postscript_style_t))) != NULL)
203
207
  {
204
208
  style->n = n;
205
209
  style->array = array;
@@ -212,14 +216,14 @@ static style_t* psr_style(json_t *json)
212
216
  return NULL;
213
217
  }
214
218
 
215
- style_t* postscript_style_read(FILE *stream)
219
+ postscript_style_t* postscript_style_read(FILE *stream)
216
220
  {
217
221
  const size_t flags = JSON_REJECT_DUPLICATES;
218
222
  json_t *json;
219
223
 
220
224
  if ((json = json_loadf(stream, flags, NULL)) != NULL)
221
225
  {
222
- style_t *style = psr_style(json);
226
+ postscript_style_t *style = psr_style(json);
223
227
  json_decref(json);
224
228
  return style;
225
229
  }
@@ -231,7 +235,7 @@ style_t* postscript_style_read(FILE *stream)
231
235
 
232
236
  #pragma GCC diagnostic push
233
237
  #pragma GCC diagnostic ignored "-Wunused-parameter"
234
- style_t* postscript_style_read(FILE *stream)
238
+ postscript_style_t* postscript_style_read(FILE *stream)
235
239
  {
236
240
  errno = ENOSYS;
237
241
  return NULL;
@@ -240,7 +244,7 @@ style_t* postscript_style_read(FILE *stream)
240
244
 
241
245
  #endif
242
246
 
243
- void postscript_style_destroy(style_t *style)
247
+ void postscript_style_destroy(postscript_style_t *style)
244
248
  {
245
249
  if (style != NULL)
246
250
  free(style->array);
@@ -473,7 +477,7 @@ int postscript_write(const state_t *state,
473
477
  if (i >= ps.style->n)
474
478
  break;
475
479
 
476
- style_level_t style_level = ps.style->array[i];
480
+ postscript_style_level_t style_level = ps.style->array[i];
477
481
  node_level_t level = max_level - i;
478
482
 
479
483
  switch (style_level.fill.colour.model)
@@ -1,14 +1,10 @@
1
1
  /*
2
- bindex.h
2
+ private/bindex.h
3
3
  Copyright (c) J.J. Green 2020
4
4
  */
5
5
 
6
- #ifndef BINDEX_H
7
- #define BINDEX_H
8
-
9
- #ifdef HAVE_CONFIG_H
10
- #include "config.h"
11
- #endif
6
+ #ifndef PRIVATE_BINDEX_H
7
+ #define PRIVATE_BINDEX_H
12
8
 
13
9
  #include <stddef.h>
14
10
 
@@ -27,5 +23,4 @@ int bindex_set(bindex_t*, size_t, size_t);
27
23
  size_t bindex_first_unset(const bindex_t*);
28
24
  size_t bindex_next_unset(const bindex_t*, size_t);
29
25
 
30
-
31
26
  #endif
@@ -1,10 +1,10 @@
1
1
  /*
2
- bounds.h
2
+ private/bounds.h
3
3
  Copyright (c) J.J. Green 2022
4
4
  */
5
5
 
6
- #ifndef BOUNDS_H
7
- #define BOUNDS_H
6
+ #ifndef PRIVATE_BOUNDS_H
7
+ #define PRIVATE_BOUNDS_H
8
8
 
9
9
  #ifndef RTREE_DIMS_MAX
10
10
  #define RTREE_DIMS_MAX 256
@@ -1,23 +1,20 @@
1
1
  /*
2
- rtree/branch.h
3
- Copyright (c) J.J. Green 2019
2
+ private/branch.h
3
+ Copyright (c) J.J. Green 2023
4
4
  */
5
5
 
6
- #ifndef RTREE_BRANCH_H
7
- #define RTREE_BRANCH_H
8
-
9
- #ifdef __cplusplus
10
- extern "C" {
11
- #endif
12
-
13
- #include <stdlib.h>
6
+ #ifndef PRIVATE_BRANCH_H
7
+ #define PRIVATE_BRANCH_H
14
8
 
15
9
  typedef struct branch_t branch_t;
16
10
 
11
+ #include <private/rect.h>
12
+ #include <private/node.h>
13
+ #include <private/state.h>
14
+
17
15
  #include <rtree/types.h>
18
- #include <rtree/state.h>
19
- #include <rtree/node.h>
20
- #include <rtree/rect.h>
16
+
17
+ #include <stddef.h>
21
18
 
22
19
  /*
23
20
  The union is either a pointer to the child-node in the tree, or
@@ -98,8 +95,4 @@ inline rtree_coord_t* branch_get_rect_mutable(branch_t *branch)
98
95
  return branch->rect;
99
96
  }
100
97
 
101
- #ifdef __cplusplus
102
- }
103
- #endif
104
-
105
98
  #endif
@@ -1,22 +1,20 @@
1
1
  /*
2
- rtree/branches.h
2
+ private/branches.h
3
3
  Copyright (c) J.J. Green 2020
4
4
  */
5
5
 
6
- #ifndef RTREE_BRANCHES_H
7
- #define RTREE_BRANCHES_H
6
+ #ifndef PRIVATE_BRANCHES_H
7
+ #define PRIVATE_BRANCHES_H
8
8
 
9
- #ifdef __cplusplus
10
- extern "C" {
11
- #endif
9
+ #include <private/state.h>
10
+ #include <private/branch.h>
11
+
12
+ #include <rtree/error.h>
12
13
 
13
- #include <stdlib.h>
14
+ #include <stddef.h>
14
15
  #include <errno.h>
15
16
  #include <string.h>
16
17
 
17
- #include <rtree/state.h>
18
- #include <rtree/branch.h>
19
- #include <rtree/error.h>
20
18
 
21
19
  inline branch_t* branches_get(const state_t *state, void *buffer, size_t i)
22
20
  {
@@ -31,8 +29,4 @@ inline void branches_set(const state_t *state, void *buffer, size_t i,
31
29
  memcpy(branches_get(state, buffer, i), src, state_branch_size(state));
32
30
  }
33
31
 
34
- #ifdef __cplusplus
35
- }
36
- #endif
37
-
38
32
  #endif
@@ -1,14 +1,14 @@
1
1
  /*
2
- bsrt.h
2
+ private/bsrt.h
3
3
  Copyright (c) J.J. Green 2019
4
4
  */
5
5
 
6
- #ifndef BSRT_H
7
- #define BSRT_H
6
+ #ifndef PRIVATE_BSRT_H
7
+ #define PRIVATE_BSRT_H
8
8
 
9
- #include <stdio.h>
9
+ #include <private/rtree.h>
10
10
 
11
- #include <rtree.h>
11
+ #include <stdio.h>
12
12
 
13
13
  int bsrt_rtree_write(const rtree_t*, FILE*);
14
14
  rtree_t* bsrt_rtree_read(FILE*);
@@ -1,10 +1,10 @@
1
1
  /*
2
- constants.h
2
+ private/constants.h
3
3
  Copyright (c) J.J. Green 2019
4
4
  */
5
5
 
6
- #ifndef CONSTANTS_H
7
- #define CONSTANTS_H
6
+ #ifndef PRIVATE_CONSTANTS_H
7
+ #define PRIVATE_CONSTANTS_H
8
8
 
9
9
  #include <math.h>
10
10