hokusai-zero 0.2.4 → 0.2.6.pre.android

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 60ba385e696143a78e04817b46a97087a275026c9747cf5e5234fd4683c13ce8
4
- data.tar.gz: 23d0436b697cfda97a0b92b2ff5f0757d46884c5dd1f5205e29cef399d39c25f
3
+ metadata.gz: ce738bae9af93e8117b6a962e52d140c69ca8dacac118b7830819a8e4d1db585
4
+ data.tar.gz: 0a0cbb5d8f6fb7a35dbcb619e17d06f5d05788c226480b11d546b3e9de7c8813
5
5
  SHA512:
6
- metadata.gz: 3f78976e9cf233d4b10600d7bab64fc1fa44da041422c0473610e4d2c0277ed3f1331fd56c89e842c8d3390f825b0358f75ad5039c0ae97927fe9c4bf3afa544
7
- data.tar.gz: 4f8288e2b15f7e3ebfb58b406aa0d6c9a7f93def3bf6802f538b2cec2aa3a75d2d6b7d10adb7786a682030d2dc3dee85121eda121b64c3fc3a0e4baba6b9e805
6
+ metadata.gz: 1752951b5745a54239c07c9cb3a0b9569105a0011531174a6bfced4b9062466054b098029a72b7562b3f73a89378e422cd13983ff432b0130bcc1a8bce622e6e
7
+ data.tar.gz: cc55da6b2f736f4f637a50115ad294247da5eb5c73fb74785ba2eec790c8476b9aae1d0b97822a65152f27ac924a32fd3a58192594e97b5af9f1bb7479f8db94
data/README.md CHANGED
@@ -12,7 +12,7 @@ A Ruby library for authoring GUI applications
12
12
  In your Gemfile
13
13
 
14
14
  ```ruby
15
- gem "hokusai-zero", "0.2.4"
15
+ gem "hokusai-zero", "0.2.6"
16
16
  ```
17
17
 
18
18
  ## In order to run an application, you will need to install a backend
data/ast/src/core/util.c CHANGED
@@ -3,33 +3,33 @@
3
3
 
4
4
  #include "util.h"
5
5
 
6
- bool hoku_rect_includes_y(hoku_rect rect, float y)
6
+ bool hoku_rect_includes_y(hoku_rect* rect, float y)
7
7
  {
8
- return y > rect.y && y <= (rect.y + rect.h);
8
+ return y > rect->y && y <= (rect->y + rect->h);
9
9
  }
10
10
 
11
- bool hoku_rect_includes_x(hoku_rect rect, float x)
11
+ bool hoku_rect_includes_x(hoku_rect* rect, float x)
12
12
  {
13
- return x > rect.x && x <= (rect.x + rect.w);
13
+ return x > rect->x && x <= (rect->x + rect->w);
14
14
  }
15
15
 
16
- float hoku_rect_x_left(hoku_rect rect, int times)
16
+ float hoku_rect_x_left(hoku_rect* rect, int times)
17
17
  {
18
- return (rect.x - ((rect.w / 2) * times));
18
+ return (rect->x - ((rect->w / 2) * times));
19
19
  }
20
- float hoku_rect_x_right(hoku_rect rect, int times)
20
+ float hoku_rect_x_right(hoku_rect* rect, int times)
21
21
  {
22
- return (rect.x + ((rect.w / 2) * times));
22
+ return (rect->x + ((rect->w / 2) * times));
23
23
  }
24
24
 
25
- float hoku_rect_y_up(hoku_rect rect, int times)
25
+ float hoku_rect_y_up(hoku_rect* rect, int times)
26
26
  {
27
- return (rect.y - ((rect.h / 2) * times));
27
+ return (rect->y - ((rect->h / 2) * times));
28
28
  }
29
29
 
30
- float hoku_rect_y_down(hoku_rect rect, int times)
30
+ float hoku_rect_y_down(hoku_rect* rect, int times)
31
31
  {
32
- return (rect.y + ((rect.h / 2) * times));
32
+ return (rect->y + ((rect->h / 2) * times));
33
33
  }
34
34
 
35
35
  int hoku_selection_init(hoku_selection** selection)
@@ -68,28 +68,28 @@ bool hoku_selection_selected(hoku_selection* selection, float x, float y, float
68
68
  bool right = selection->start_x <= selection->stop_x;
69
69
 
70
70
  hoku_rect hit_box = (hoku_rect){.x=x, .y=y, .w=width, .h=height};
71
- float x_shifted_right = hoku_rect_x_right(hit_box, 1);
72
- float y_shifted_up = hoku_rect_y_up(hit_box, 2);
73
- float y_shifted_down = hoku_rect_y_down(hit_box, 2);
71
+ float x_shifted_right = hoku_rect_x_right(&hit_box, 1);
72
+ float y_shifted_up = hoku_rect_y_up(&hit_box, 2);
73
+ float y_shifted_down = hoku_rect_y_down(&hit_box, 2);
74
74
  float end_y = y + height;
75
75
 
76
76
  return (
77
77
  (down &&
78
78
  // first line of multiline selection
79
- ((x_shifted_right > sx && end_y < ey && hoku_rect_includes_y(hit_box, sy)) ||
79
+ ((x_shifted_right > sx && end_y < ey && hoku_rect_includes_y(&hit_box, sy)) ||
80
80
  // last line of multiline selection
81
81
  (x_shifted_right <= ex && y_shifted_up + hit_box.h < ey && hit_box.y > sy) ||
82
82
  // middle line (all selected)
83
83
  (hit_box.y > sy && end_y < ey))) ||
84
84
  (up &&
85
85
  // first line of multiline selection
86
- ((x_shifted_right <= sx && hit_box.y > ey && hoku_rect_includes_y(hit_box, sy)) ||
86
+ ((x_shifted_right <= sx && hit_box.y > ey && hoku_rect_includes_y(&hit_box, sy)) ||
87
87
  // last line of multiline selection
88
88
  (x_shifted_right >= ex && y_shifted_down > ey && end_y < sy) ||
89
89
  // middle line (all selected)
90
90
  (hit_box.y > ey && hit_box.y + hit_box.h < sy))) ||
91
91
  // single line selection
92
- ((hoku_rect_includes_y(hit_box, sy) && hoku_rect_includes_y(hit_box, ey)) &&
92
+ ((hoku_rect_includes_y(&hit_box, sy) && hoku_rect_includes_y(&hit_box, ey)) &&
93
93
  ((left && x_shifted_right < sx && x_shifted_right > ex) || (right && x_shifted_right > sx && x_shifted_right < ex)))
94
94
  );
95
95
  }
@@ -108,7 +108,7 @@ hoku_cursor_position hoku_selection_cursor_get(hoku_selection* selection)
108
108
  return pos;
109
109
  }
110
110
 
111
- int hoku_selection_cursor_set(hoku_selection* selection, hoku_cursor_position cursor)
111
+ int hoku_selection_cursor_set(hoku_selection* selection, hoku_cursor_position* cursor)
112
112
  {
113
113
  if (selection->cursor == NULL)
114
114
  {
@@ -117,10 +117,10 @@ int hoku_selection_cursor_set(hoku_selection* selection, hoku_cursor_position cu
117
117
  if (selection->cursor == NULL) return -1;
118
118
  }
119
119
 
120
- selection->cursor->x = cursor.x;
121
- selection->cursor->y = cursor.y;
122
- selection->cursor->w = cursor.w;
123
- selection->cursor->h = cursor.h;
120
+ selection->cursor->x = cursor->x;
121
+ selection->cursor->y = cursor->y;
122
+ selection->cursor->w = cursor->w;
123
+ selection->cursor->h = cursor->h;
124
124
 
125
125
  return 0;
126
126
  }
data/ast/src/core/util.h CHANGED
@@ -30,16 +30,16 @@ typedef struct HokuSelection
30
30
  hoku_cursor_position* cursor;
31
31
  } hoku_selection;
32
32
 
33
- bool hoku_rect_includes_y(hoku_rect rect, float y);
34
- bool hoku_rect_includes_x(hoku_rect rect, float x);
35
- float hoku_rect_x_left(hoku_rect rect, int times);
36
- float hoku_rect_x_right(hoku_rect rect, int times);
37
- float hoku_rect_y_up(hoku_rect rect, int times);
38
- float hoku_rect_y_down(hoku_rect rect, int times);
33
+ bool hoku_rect_includes_y(hoku_rect* rect, float y);
34
+ bool hoku_rect_includes_x(hoku_rect* rect, float x);
35
+ float hoku_rect_x_left(hoku_rect* rect, int times);
36
+ float hoku_rect_x_right(hoku_rect* rect, int times);
37
+ float hoku_rect_y_up(hoku_rect* rect, int times);
38
+ float hoku_rect_y_down(hoku_rect* rect, int times);
39
39
 
40
40
  int hoku_selection_init(hoku_selection** selection);
41
41
  bool hoku_selection_selected(hoku_selection* selection, float x, float y, float width, float height);
42
- int hoku_selection_cursor_set(hoku_selection* selection, hoku_cursor_position cursor);
42
+ int hoku_selection_cursor_set(hoku_selection* selection, hoku_cursor_position* cursor);
43
43
  void hoku_selection_cursor_free(hoku_selection* selection);
44
44
  void hoku_selection_free(hoku_selection* selection);
45
45
 
data/ext/extconf.rb CHANGED
@@ -4,12 +4,18 @@ require "mini_portile2"
4
4
  if MiniPortile.darwin?
5
5
  suffix = "dylib"
6
6
  ext = "tar.gz"
7
+ md4cext = "a"
8
+ MDFLAGS = ""
7
9
  elsif MiniPortile.linux?
8
10
  suffix = "so"
9
11
  ext = "tar.gz"
12
+ md4cext = "a"
13
+ MDFLAGS = "-DCMAKE_POSITION_INDEPENDENT_CODE=ON"
10
14
  elsif MiniPortile.windows?
11
15
  suffix = "dll"
12
16
  ext = "zip"
17
+ md4cext = "a"
18
+ MDFLAGS = ""
13
19
  else
14
20
  raise "Currently only supporting darwin and linux"
15
21
  end
@@ -26,7 +32,6 @@ tree_sitter.tap do |t|
26
32
  end
27
33
 
28
34
  def t.install
29
- return if installed?
30
35
 
31
36
  execute('install', %Q(#{make_cmd} all install CC=gcc AR=ar PREFIX=#{File.expand_path(port_path)}), { env: { "PREFIX" => File.expand_path(port_path) }})
32
37
  end
@@ -40,7 +45,7 @@ md4c = MiniPortileCMake.new("md4c", "0.5.2")
40
45
  md4c.files = ["https://github.com/mity/md4c/archive/refs/tags/release-0.5.2.#{ext}"]
41
46
 
42
47
  def md4c.cmake_compile_flags
43
- [*super, "-DBUILD_SHARED_LIBS=OFF"]
48
+ [*super, "-DBUILD_SHARED_LIBS=OFF", "-DCMAKE_POSITION_INDEPENDENT_CODE=ON"]
44
49
  end
45
50
 
46
51
  md4c.cook
@@ -51,8 +56,8 @@ cwd = "#{__dir__}"
51
56
 
52
57
  files = %w[ast/src/core/hml.c ast/src/core/ast.c ast/rc/core/style.c ast/src/core/input.c ast/src/core/component.c ast/src/core/util.c ast/src/core/text.c grammar/src/parser.c grammar/src/scanner.c ast/include/hashmap.c]
53
58
  objects = %w[hml.o ast.o style.o input.o component.o util.o text.o parser.o scanner.o hashmap.o]
54
- libraries = [File.expand_path("#{tree_sitter.path}/lib/libtree-sitter.a"), File.expand_path("#{md4c.path}/lib/libmd4c.a")]
55
- src_files = ["#{tree_sitter.path}/lib/libtree-sitter.a", "#{md4c.path}/lib/libmd4c.a", "#{pre}/ast/src/core/hml.c", "#{pre}/ast/src/core/ast.c", "#{pre}/ast/src/core/style.c", "#{pre}/ast/src/core/input.c", "#{pre}/ast/src/core/component.c", "#{pre}/ast/src/core/util.c", "#{pre}/ast/src/core/text.c", "#{pre}/grammar/src/parser.c", "#{pre}/grammar/src/scanner.c", "#{pre}/ast/include/hashmap.c"]
59
+ libraries = [File.expand_path("#{tree_sitter.path}/lib/libtree-sitter.a"), File.expand_path("#{md4c.path}/lib/libmd4c.#{md4cext}")]
60
+ src_files = ["#{tree_sitter.path}/lib/libtree-sitter.a", "#{md4c.path}/lib/libmd4c.#{md4cext}", "#{pre}/ast/src/core/hml.c", "#{pre}/ast/src/core/ast.c", "#{pre}/ast/src/core/style.c", "#{pre}/ast/src/core/input.c", "#{pre}/ast/src/core/component.c", "#{pre}/ast/src/core/util.c", "#{pre}/ast/src/core/text.c", "#{pre}/grammar/src/parser.c", "#{pre}/grammar/src/scanner.c", "#{pre}/ast/include/hashmap.c"]
56
61
  if MiniPortile.windows?
57
62
  cflags = "-shared -Wall -Wl,--export-all-symbols -Wl,--enable-auto-import"
58
63
  mkdir = "mkdir #{pre}\\vendor\\lib"
@@ -84,4 +89,4 @@ File.open("Makefile", "w") do |io|
84
89
  #{"\t"}rm -f #{File.expand_path("vendor/lib/libhokusai.*")}
85
90
  #{"\t"}rm -f #{File.expand_path("vendor/lib/libmd4c.*")}
86
91
  EOF
87
- end
92
+ end
data/hokusai.gemspec CHANGED
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'hokusai-zero'
3
- s.version = '0.2.4'
3
+ s.version = '0.2.6-android'
4
4
  s.licenses = ['MIT']
5
5
  s.summary = "A Ruby library for writing GUI applications"
6
6
  s.authors = ["skinnyjames"]
@@ -352,16 +352,16 @@ module LibHokusai
352
352
 
353
353
  attach_function :hoku_selection_init, [:pointer], :int
354
354
  attach_function :hoku_selection_selected, [HokuSelection.by_ref, :float, :float, :float, :float], :bool
355
- attach_function :hoku_selection_cursor_set, [HokuSelection.by_ref, HokuCursorPosition.by_value], :int
355
+ attach_function :hoku_selection_cursor_set, [HokuSelection.by_ref, HokuCursorPosition.by_ref], :int
356
356
  attach_function :hoku_selection_cursor_free, [HokuSelection.by_ref], :void
357
357
  attach_function :hoku_selection_free, [HokuSelection.by_ref], :void
358
358
 
359
- attach_function :hoku_rect_includes_y, [HmlRect.by_value, :float], :bool
360
- attach_function :hoku_rect_includes_x, [HmlRect.by_value, :float], :bool
361
- attach_function :hoku_rect_x_left, [HmlRect.by_value, :int], :float
362
- attach_function :hoku_rect_x_right, [HmlRect.by_value, :int], :float
363
- attach_function :hoku_rect_y_up, [HmlRect.by_value, :int], :float
364
- attach_function :hoku_rect_y_down, [HmlRect.by_value, :int], :float
359
+ attach_function :hoku_rect_includes_y, [HmlRect.by_ref, :float], :bool
360
+ attach_function :hoku_rect_includes_x, [HmlRect.by_ref, :float], :bool
361
+ attach_function :hoku_rect_x_left, [HmlRect.by_ref, :int], :float
362
+ attach_function :hoku_rect_x_right, [HmlRect.by_ref, :int], :float
363
+ attach_function :hoku_rect_y_up, [HmlRect.by_ref, :int], :float
364
+ attach_function :hoku_rect_y_down, [HmlRect.by_ref, :int], :float
365
365
 
366
366
  class HokuChar < FFI::Struct
367
367
  layout :offset, :int,
metadata CHANGED
@@ -1,13 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hokusai-zero
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.4
4
+ version: 0.2.6.pre.android
5
5
  platform: ruby
6
6
  authors:
7
7
  - skinnyjames
8
+ autorequire:
8
9
  bindir: bin
9
10
  cert_chain: []
10
- date: 1980-01-02 00:00:00.000000000 Z
11
+ date: 2025-06-28 00:00:00.000000000 Z
11
12
  dependencies:
12
13
  - !ruby/object:Gem::Dependency
13
14
  name: ffi
@@ -93,6 +94,7 @@ dependencies:
93
94
  - - ">="
94
95
  - !ruby/object:Gem::Version
95
96
  version: '0'
97
+ description:
96
98
  email: zero@skinnyjames.net
97
99
  executables: []
98
100
  extensions:
@@ -295,6 +297,7 @@ licenses:
295
297
  - MIT
296
298
  metadata:
297
299
  source_code_uri: https://codeberg.org/skinnyjames/hokusai
300
+ post_install_message:
298
301
  rdoc_options: []
299
302
  require_paths:
300
303
  - ui/src
@@ -309,7 +312,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
309
312
  - !ruby/object:Gem::Version
310
313
  version: '0'
311
314
  requirements: []
312
- rubygems_version: 3.6.7
315
+ rubygems_version: 3.5.22
316
+ signing_key:
313
317
  specification_version: 4
314
318
  summary: A Ruby library for writing GUI applications
315
319
  test_files: []