gettextpo 0.1.3 → 0.2.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c2eb5f08e68980571ccd30f9bb661e776084f6f87766e9180567b4501b038c3d
4
- data.tar.gz: b22296f8b7d74673c8328c556acb0cdf59e369c19ec281ca0914b5cbec50817c
3
+ metadata.gz: 9b3af64548353c078af5052c1b203ab5d7ae1ae359b2f47728f10de68127098b
4
+ data.tar.gz: d62fa55845eaf75754b13e05d06e1006933ee1b20444a6de1d8a7fe765d6a876
5
5
  SHA512:
6
- metadata.gz: d0d2f86a241e358acd074ed86460072382cc7331afdaedae52f711e050b3442cb65e0bdee28d3cdd7967039bd4119f4d4713788dbd9feb8db390ec5ca5956e05
7
- data.tar.gz: 5aca003840bf9bba6f601c8faea83a3c16dcbbb9eaec1d6baf27bba2f25c4f8d80f265d36e7fd4caeaf20c9ea9ed802ae7c4fbf0ac44ca6d85a899c0405f1c69
6
+ metadata.gz: 876211285e1120372703d8379b1dbeeed7cf0c636688e0e5eef785611bfe890b8d3a1aea6d89e3785b2c8c6e06f94b61b0dc4e4ab04ecbf3a2d00ae68bf98f5b
7
+ data.tar.gz: ef90df9cf0e3aed603936bf1c902339cb48a97b43d6738d22e7ef57dfd0c667e00abbaf63cb62616ba23e5de65400384d188901a9975bdb49733f8abacdb0b0e
data/CHANGELOG.md CHANGED
@@ -2,6 +2,23 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
+ ## CRuby version 0.2.1 - 2026-03-16
6
+
7
+ - CRuby: Fix to work with gettext 0.23.
8
+
9
+ ## CRuby and mruby version 0.2.0 - 2026-03-15
10
+
11
+ - CRuby and mruby: Add `GettextPO::Message#file_positions`,
12
+ `GettextPO::Message#workflow_flag?`,
13
+ `GettextPO::Message#update_workflow_flag`,
14
+ `GettextPO::Message#workflow_flag_iterator`,
15
+ `GettextPO::Message#sticky_flag?`,
16
+ `GettextPO::Message#update_sticky_flag`, and
17
+ `GettextPO::Message#sticky_flag_iterator` method.
18
+ - CRuby and mruby: Add `GettextPO::FlagIterator#next` method (and the
19
+ class, which is `Enumerable`).
20
+ - mruby: Requires GNU gettext 1.0 or later.
21
+
5
22
  ## CRuby version 0.1.3
6
23
 
7
24
  - CRuby: Fix file not found case.
data/Gemfile ADDED
@@ -0,0 +1,10 @@
1
+ # frozen_string_literal: true
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gemspec
6
+
7
+ gem "irb"
8
+ gem "rake", "~> 13.0"
9
+ gem "rake-compiler"
10
+ gem "test-unit", "~> 3.0"
data/README.md CHANGED
@@ -8,10 +8,10 @@ Currently this supports both CRuby and mruby.
8
8
 
9
9
  ## Installation
10
10
 
11
- Prerequisites: `libgettextpo` library. On Linux and similar systems,
12
- you should be able to install it as a distribution package on most
13
- platforms. For example, on Ubuntu it was as follows
14
- (2026-03-07T15:48:13+09:00):
11
+ Prerequisites: `libgettextpo` library (mruby: version 1.0 or later).
12
+ On Linux and similar systems, you should be able to install it as a
13
+ distribution package on most platforms. For example, on Ubuntu it was
14
+ as follows (2026-03-07T15:48:13+09:00):
15
15
 
16
16
  ``` shell
17
17
  apt search libgettextpo
@@ -22,8 +22,11 @@ require "mkmf"
22
22
  # selectively, or entirely remove this flag.
23
23
  append_cflags("-fvisibility=hidden")
24
24
 
25
- have_header("gettext-po.h") or raise "gettext-po.h not found"
25
+ GETTEXTPO = "gettext-po.h"
26
+ have_header(GETTEXTPO) or raise "gettext-po.h not found"
26
27
  have_library("gettextpo") or raise "gettextpo library not found"
27
- # TODO: check library function
28
+
29
+ # Indicates 1.0 or later. <https://savannah.gnu.org/news/?id=10853>
30
+ have_func('po_message_get_format', GETTEXTPO)
28
31
 
29
32
  create_makefile("gettextpo/gettextpo")
@@ -26,7 +26,13 @@
26
26
  #include "gettextpo.h"
27
27
  #include <gettext-po.h>
28
28
  #include <ruby/internal/core/rdata.h>
29
- #include <ruby/internal/intern/variable.h>
29
+ #include <ruby/internal/core/rstring.h>
30
+ #include <ruby/internal/error.h>
31
+ #include <ruby/internal/globals.h>
32
+ #include <ruby/internal/intern/string.h>
33
+ #include <ruby/internal/module.h>
34
+ #include <ruby/internal/scan_args.h>
35
+ #include <ruby/internal/special_consts.h>
30
36
 
31
37
  #define ERROR \
32
38
  rb_const_get (rb_const_get (rb_cObject, rb_intern ("GettextPO")), \
@@ -35,6 +41,7 @@
35
41
  VALUE rb_cMessage;
36
42
  VALUE rb_cMessageIterator;
37
43
  VALUE rb_cFilePos;
44
+ VALUE rb_cFlagIterator;
38
45
 
39
46
  /* ********** error ********** */
40
47
 
@@ -163,6 +170,43 @@ static const struct po_xerror_handler gettextpo_xerror_handler = {
163
170
  .xerror2 = gettextpo_xerror2,
164
171
  };
165
172
 
173
+ #ifdef HAVE_PO_MESSAGE_GET_FORMAT
174
+ /**
175
+ * Document-class: GettextPO::FlagIterator
176
+ */
177
+
178
+ void
179
+ gettextpo_flag_iterator_free (void *iter)
180
+ {
181
+ if (iter)
182
+ po_flag_iterator_free (iter);
183
+ }
184
+
185
+ static const rb_data_type_t gettextpo_po_flag_iterator_type = {
186
+ .wrap_struct_name = "gettextpo PO flag iterator",
187
+ .function = {
188
+ .dfree = gettextpo_flag_iterator_free,
189
+ },
190
+ .flags = RUBY_TYPED_FREE_IMMEDIATELY,
191
+ };
192
+
193
+ VALUE
194
+ gettextpo_po_flag_iterator_alloc (VALUE self)
195
+ {
196
+ return TypedData_Wrap_Struct (self, &gettextpo_po_flag_iterator_type, NULL);
197
+ }
198
+
199
+ static VALUE
200
+ gettextpo_po_flag_iterator_m_next (VALUE self)
201
+ {
202
+ const char *flag = po_flag_next (DATA_PTR (self));
203
+ if (flag)
204
+ return rb_str_new_cstr (flag);
205
+ else
206
+ rb_raise (rb_eStopIteration, "no more flag");
207
+ }
208
+ #endif
209
+
166
210
  /**
167
211
  * Document-class: GettextPO::Message
168
212
  */
@@ -394,11 +438,90 @@ BOOL_GETTER (fuzzy);
394
438
  */
395
439
  BOOL_SETTER (fuzzy);
396
440
 
441
+ #ifdef HAVE_PO_MESSAGE_GET_FORMAT
442
+ #define FLAG_Q(name) \
443
+ static VALUE gettextpo_po_message_m_##name##_flag_q (VALUE self, \
444
+ VALUE flag) \
445
+ { \
446
+ return po_message_has_##name##_flag (DATA_PTR (self), \
447
+ StringValueCStr (flag)) \
448
+ ? Qtrue \
449
+ : Qfalse; \
450
+ }
451
+ #define UPDATE_FLAG(name) \
452
+ static VALUE gettextpo_po_message_m_update_##name##_flag ( \
453
+ int argc, VALUE *argv, VALUE self) \
454
+ { \
455
+ VALUE flag, kwargs; \
456
+ rb_scan_args (argc, argv, "1:", &flag, &kwargs); \
457
+ ID kwargs_ids[] = { rb_intern ("set") }; \
458
+ VALUE kwargs_vals[] = { Qundef }; \
459
+ rb_get_kwargs (kwargs, kwargs_ids, 0, \
460
+ sizeof (kwargs_ids) / sizeof (kwargs_ids[0]), \
461
+ kwargs_vals); \
462
+ \
463
+ po_message_set_##name##_flag (DATA_PTR (self), StringValueCStr (flag), \
464
+ RB_UNDEF_P (kwargs_vals[0]) \
465
+ && RB_TEST (kwargs_vals[0])); \
466
+ return Qnil; \
467
+ }
468
+ #define FLAG_ITER(name) \
469
+ static VALUE gettextpo_po_message_m_##name##_flags_iterator (VALUE self) \
470
+ { \
471
+ VALUE iter = rb_obj_alloc (rb_cFlagIterator); \
472
+ DATA_PTR (iter) = po_message_##name##_flags_iterator (DATA_PTR (self)); \
473
+ return iter; \
474
+ }
475
+
476
+ /**
477
+ * Document-method: workflow_flag?
478
+ * call-seq: workflow_flag? (flag)
479
+ */
480
+ FLAG_Q (workflow);
481
+
482
+ /**
483
+ * Document-method: update_workflow_flag
484
+ * call-seq: update_workflow_flag (flag, set: true)
485
+ */
486
+ UPDATE_FLAG (workflow);
487
+
488
+ /**
489
+ * Document-method: workflow_flag_iterator
490
+ */
491
+ FLAG_ITER (workflow);
492
+
493
+ /**
494
+ * call-seq: format (type)
495
+ *
496
+ * Returns +true+, +false+ (opposite), or +nil+ (none).
497
+ */
498
+ static VALUE
499
+ gettextpo_po_message_m_format (VALUE self, VALUE format)
500
+ {
501
+ int result
502
+ = po_message_get_format (DATA_PTR (self), StringValueCStr (format));
503
+ switch (result)
504
+ {
505
+ case 1:
506
+ return Qtrue;
507
+ break;
508
+ case 0:
509
+ return Qfalse;
510
+ break;
511
+ case -1:
512
+ return Qnil;
513
+ break;
514
+ default:
515
+ rb_raise (ERROR, "unreachable");
516
+ }
517
+ }
518
+ #endif
519
+
397
520
  /**
398
521
  * call-seq: format? (type)
399
522
  */
400
523
  VALUE
401
- gettextpo_po_message_m_format (VALUE self, VALUE format)
524
+ gettextpo_po_message_m_format_q (VALUE self, VALUE format)
402
525
  {
403
526
  return po_message_is_format (DATA_PTR (self), StringValueCStr (format))
404
527
  ? Qtrue
@@ -427,6 +550,25 @@ gettextpo_po_message_m_format_set (int argc, VALUE *argv, VALUE self)
427
550
  return Qnil;
428
551
  }
429
552
 
553
+ #ifdef HAVE_PO_MESSAGE_GET_FORMAT
554
+ /**
555
+ * Document-method: sticky_flag?
556
+ * call-seq: sticky_flag? (flag)
557
+ */
558
+ FLAG_Q (sticky);
559
+
560
+ /**
561
+ * Document-method: update_sticky_flag
562
+ * call-seq: update_sticky_flag (flag, set: true)
563
+ */
564
+ UPDATE_FLAG (sticky);
565
+
566
+ /**
567
+ * Document-method: sticky_flag_iterator
568
+ */
569
+ FLAG_ITER (sticky);
570
+ #endif
571
+
430
572
  /**
431
573
  * call-seq: range? (range)
432
574
  */
@@ -952,9 +1094,33 @@ Init_gettextpo (void)
952
1094
  rb_define_method (rb_cMessage, "fuzzy?", gettextpo_po_message_m_fuzzy, 0);
953
1095
  rb_define_method (rb_cMessage, "fuzzy=", gettextpo_po_message_m_fuzzy_set,
954
1096
  1);
955
- rb_define_method (rb_cMessage, "format?", gettextpo_po_message_m_format, 1);
1097
+
1098
+ #ifdef HAVE_PO_MESSAGE_GET_FORMAT
1099
+ rb_define_method (rb_cMessage, "workflow_flag?",
1100
+ gettextpo_po_message_m_workflow_flag_q, 1);
1101
+ rb_define_method (rb_cMessage, "update_workflow_flag",
1102
+ gettextpo_po_message_m_update_workflow_flag, -1);
1103
+ rb_define_method (rb_cMessage, "workflow_flag_iterator",
1104
+ gettextpo_po_message_m_workflow_flags_iterator, 0);
1105
+ #endif
1106
+
1107
+ rb_define_method (rb_cMessage, "format?", gettextpo_po_message_m_format_q,
1108
+ 1);
1109
+ #ifdef HAVE_PO_MESSAGE_GET_FORMAT
1110
+ rb_define_method (rb_cMessage, "format", gettextpo_po_message_m_format, 1);
1111
+ #endif
956
1112
  rb_define_method (rb_cMessage, "update_format",
957
1113
  gettextpo_po_message_m_format_set, -1);
1114
+
1115
+ #ifdef HAVE_PO_MESSAGE_GET_FORMAT
1116
+ rb_define_method (rb_cMessage, "sticky_flag?",
1117
+ gettextpo_po_message_m_sticky_flag_q, 1);
1118
+ rb_define_method (rb_cMessage, "update_sticky_flag",
1119
+ gettextpo_po_message_m_update_sticky_flag, -1);
1120
+ rb_define_method (rb_cMessage, "sticky_flag_iterator",
1121
+ gettextpo_po_message_m_sticky_flags_iterator, 0);
1122
+ #endif
1123
+
958
1124
  rb_define_method (rb_cMessage, "range?", gettextpo_po_message_m_range, 1);
959
1125
  rb_define_method (rb_cMessage, "range=", gettextpo_po_message_m_range_set,
960
1126
  1);
@@ -980,4 +1146,11 @@ Init_gettextpo (void)
980
1146
  rb_define_method (rb_cFilePos, "file", gettextpo_po_filepos_m_file, 0);
981
1147
  rb_define_method (rb_cFilePos, "start_line",
982
1148
  gettextpo_po_filepos_m_start_line, 0);
1149
+ #ifdef HAVE_PO_MESSAGE_GET_FORMAT
1150
+ rb_cFlagIterator
1151
+ = rb_define_class_under (rb_mGettextPO, "FlagIterator", rb_cObject);
1152
+ rb_define_alloc_func (rb_cFlagIterator, gettextpo_po_flag_iterator_alloc);
1153
+ rb_define_method (rb_cFlagIterator, "next",
1154
+ gettextpo_po_flag_iterator_m_next, 0);
1155
+ #endif
983
1156
  }
@@ -19,5 +19,5 @@
19
19
 
20
20
  module GettextPO
21
21
  # Version of this gem.
22
- VERSION = "0.1.3"
22
+ VERSION = "0.2.1"
23
23
  end
@@ -40,7 +40,7 @@ module GettextPO
40
40
  # This class doesn't provide the +new+ class method. See also
41
41
  # GettextPO::File#message_iterator.
42
42
  class MessageIterator
43
- def self.new
43
+ def self.new # :nodoc:
44
44
  raise NoMethodError,
45
45
  "please use other methods instead, such as GettextPO::File#message_iterator"
46
46
  end
@@ -58,22 +58,54 @@ module GettextPO
58
58
  include Enumerable
59
59
  end
60
60
 
61
- # This class doesn't provide the +new+ class method. Refre to
61
+ # This class doesn't provide the +new+ class method. Refer to
62
62
  # GettextPO::MessageIterator#next or
63
63
  # GettextPO::MessageIterator#insert.
64
64
  class Message
65
- def self.new
65
+ def self.new # :nodoc:
66
66
  raise NoMethodError,
67
67
  "please use other methods instead, such as GettextPO::MessageIterator#next"
68
68
  end
69
+
70
+ def file_positions
71
+ positions = []
72
+ index = 0
73
+ while (pos = filepos(index))
74
+ positions << pos
75
+ index += 1
76
+ end
77
+ positions
78
+ end
69
79
  end
70
80
 
71
81
  # This class doesn't provide the +new+ class method. See also
72
82
  # GettextPO::Message#filepos.
73
83
  class FilePos
74
- def self.new
84
+ def self.new # :nodoc:
75
85
  raise NoMethodError,
76
86
  "please use other methods instead, such as GettextPO::Message#filepos"
77
87
  end
78
88
  end
89
+
90
+ # This class doesn't provide the +new+ class method. See also
91
+ # GettextPO::Message#workflow_flag_iterator and
92
+ # GettextPO::Message#sticky_flag_iterator.
93
+ class FlagIterator
94
+ def self.new # :nodoc:
95
+ raise NoMethodError,
96
+ "please use other methods instead, such as GettextPO::Message#workflow_flag_iterator"
97
+ end
98
+
99
+ def each # yields: flag
100
+ while true
101
+ begin
102
+ yield self.next
103
+ rescue StopIteration
104
+ return self
105
+ end
106
+ end
107
+ end
108
+
109
+ include Enumerable
110
+ end
79
111
  end
metadata CHANGED
@@ -1,13 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gettextpo
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - gemmaro
8
+ autorequire:
8
9
  bindir: bin
9
10
  cert_chain: []
10
- date: 1980-01-02 00:00:00.000000000 Z
11
+ date: 2026-03-16 00:00:00.000000000 Z
11
12
  dependencies: []
12
13
  description: This gem is a Ruby library for the GNU gettext PO files. This is a C
13
14
  binding of the libgettextpo library, which is part of the GNU gettext package.
@@ -18,36 +19,17 @@ extensions:
18
19
  - ext/gettextpo/extconf.rb
19
20
  extra_rdoc_files: []
20
21
  files:
21
- - ".clang-format"
22
- - ".dir-locals.el"
23
- - ".env.example"
24
- - ".envrc"
25
- - ".rdoc_options"
26
22
  - CHANGELOG.md
27
23
  - COPYING
24
+ - Gemfile
28
25
  - README.md
29
26
  - Rakefile
30
- - build_config.rb
31
27
  - ext/gettextpo/extconf.rb
32
28
  - ext/gettextpo/gettextpo.c
33
29
  - ext/gettextpo/gettextpo.h
34
- - include/mrb_gettextpo.h
35
30
  - lib/gettextpo.rb
36
31
  - lib/gettextpo/version.rb
37
- - mrbgem.rake
38
- - mrblib/mrb_gettextpo.rb
39
32
  - mrblib/mrb_gettextpo_common.rb
40
- - mrblib/mrb_gettextpo_version.rb
41
- - sig/gettextpo.rbs
42
- - src/mrb_gettextpo.c
43
- - test.cruby/gettextpo_test.rb
44
- - test.cruby/resources/a.po
45
- - test.cruby/resources/bad.po
46
- - test.cruby/resources/filepos.po
47
- - test.cruby/resources/format.po
48
- - test.cruby/resources/ok.po
49
- - test.cruby/test_helper.rb
50
- - test.cruby/tmp/.keep
51
33
  homepage: https://git.disroot.org/gemmaro/ruby-gettextpo
52
34
  licenses:
53
35
  - GPL-3.0-or-later
@@ -59,6 +41,7 @@ metadata:
59
41
  homepage_uri: https://git.disroot.org/gemmaro/ruby-gettextpo
60
42
  source_code_uri: https://git.disroot.org/gemmaro/ruby-gettextpo
61
43
  wiki_uri: https://git.disroot.org/gemmaro/ruby-gettextpo/wiki
44
+ post_install_message:
62
45
  rdoc_options: []
63
46
  require_paths:
64
47
  - lib
@@ -74,7 +57,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
74
57
  version: '0'
75
58
  requirements:
76
59
  - libgettextpo
77
- rubygems_version: 3.6.9
60
+ rubygems_version: 3.5.22
61
+ signing_key:
78
62
  specification_version: 4
79
63
  summary: GNU gettext PO file parser library
80
64
  test_files: []
data/.clang-format DELETED
@@ -1 +0,0 @@
1
- BasedOnStyle: GNU
data/.dir-locals.el DELETED
@@ -1,6 +0,0 @@
1
- ;;; Directory Local Variables -*- no-byte-compile: t -*-
2
- ;;; For more information see (info "(emacs) Directory Variables")
3
-
4
- ((nil . ((eval . (progn (require 'grep)
5
- (add-to-list 'grep-find-ignored-directories "tmp")
6
- (add-to-list 'grep-find-ignored-directories "doc"))))))
data/.env.example DELETED
@@ -1,2 +0,0 @@
1
- MRUBY_SRC=/path/to/mruby
2
- DEVELOP_MRUBY=no
data/.envrc DELETED
@@ -1,38 +0,0 @@
1
- # Copyright (C) 2026 gemmaro
2
- #
3
- # This program is free software: you can redistribute it and/or modify
4
- # it under the terms of the GNU General Public License as published by
5
- # the Free Software Foundation, either version 3 of the License, or
6
- # (at your option) any later version.
7
- #
8
- # This program is distributed in the hope that it will be useful,
9
- # but WITHOUT ANY WARRANTY; without even the implied warranty of
10
- # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
- # GNU General Public License for more details.
12
- #
13
- # You should have received a copy of the GNU General Public License
14
- # along with this program. If not, see <https://www.gnu.org/licenses/>.
15
-
16
- use guix \
17
- clang \
18
- gcc-toolchain \
19
- ruby \
20
- ruby-rake-compiler \
21
- make \
22
- gettext \
23
- gdb
24
-
25
- dotenv
26
-
27
- if [ "$DEVELOP_MRUBY" != 'yes' ]
28
- then
29
- # CRuby
30
- path_add C_INCLUDE_PATH "$(ruby -e "puts RbConfig::CONFIG['rubyhdrdir']")"
31
- path_add C_INCLUDE_PATH "$(ruby -e "puts RbConfig::CONFIG['rubyarchhdrdir']")"
32
- else
33
- # mruby
34
- env_vars_required MRUBY_SRC
35
- path_add C_INCLUDE_PATH include
36
- path_add C_INCLUDE_PATH "$MRUBY_SRC/include"
37
- path_add C_INCLUDE_PATH "$MRUBY_SRC/build/host/include"
38
- fi
data/.rdoc_options DELETED
@@ -1,12 +0,0 @@
1
- main_page: README.md
2
- exclude:
3
- - tmp
4
- - bin
5
- - Rakefile
6
- - Gemfile
7
- - vendor
8
- - test.cruby/**/*
9
- - build_config.rb.lock
10
- - mrbgem.rake
11
- - mrblib/mrb_gettextpo.rb
12
- - mrblib/mrb_gettextpo_version.rb
data/build_config.rb DELETED
@@ -1,27 +0,0 @@
1
- # Copyright (C) 2026 gemmaro
2
- #
3
- # This program is free software: you can redistribute it and/or modify
4
- # it under the terms of the GNU General Public License as published by
5
- # the Free Software Foundation, either version 3 of the License, or
6
- # (at your option) any later version.
7
- #
8
- # This program is distributed in the hope that it will be useful,
9
- # but WITHOUT ANY WARRANTY; without even the implied warranty of
10
- # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
- # GNU General Public License for more details.
12
- #
13
- # You should have received a copy of the GNU General Public License
14
- # along with this program. If not, see <https://www.gnu.org/licenses/>.
15
-
16
- MRuby::Build.new do |conf|
17
- toolchain :gcc
18
- conf.gem File.expand_path(File.dirname(__FILE__))
19
- conf.linker.libraries << 'gettextpo'
20
- conf.enable_test
21
- conf.gem core: 'hal-posix-io'
22
- conf.gem core: 'mruby-bin-mruby'
23
- conf.gem core: 'mruby-bin-mirb'
24
- conf.cc do |cc|
25
- cc.flags << '-O0'
26
- end
27
- end
@@ -1,24 +0,0 @@
1
- /* Copyright (C) 2026 gemmaro
2
- *
3
- * This program is free software: you can redistribute it and/or modify
4
- * it under the terms of the GNU General Public License as published by
5
- * the Free Software Foundation, either version 3 of the License, or
6
- * (at your option) any later version.
7
-
8
- * This program is distributed in the hope that it will be useful,
9
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
10
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
- * GNU General Public License for more details.
12
-
13
- * You should have received a copy of the GNU General Public License
14
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
15
- */
16
-
17
- #ifndef MRB_GETTEXTPO_H
18
- #define MRB_GETTEXTPO_H
19
-
20
- #include <mruby.h>
21
-
22
- void mrb_gettextpo_gem_init(mrb_state *mrb);
23
-
24
- #endif
data/mrbgem.rake DELETED
@@ -1,24 +0,0 @@
1
- # Copyright (C) 2026 gemmaro
2
- #
3
- # This program is free software: you can redistribute it and/or modify
4
- # it under the terms of the GNU General Public License as published by
5
- # the Free Software Foundation, either version 3 of the License, or
6
- # (at your option) any later version.
7
- #
8
- # This program is distributed in the hope that it will be useful,
9
- # but WITHOUT ANY WARRANTY; without even the implied warranty of
10
- # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
- # GNU General Public License for more details.
12
- #
13
- # You should have received a copy of the GNU General Public License
14
- # along with this program. If not, see <https://www.gnu.org/licenses/>.
15
-
16
- MRuby::Gem::Specification.new('mruby-gettextpo') do |spec|
17
- spec.license = 'GPL-3.0-or-later'
18
- spec.authors = 'gemmaro'
19
- spec.summary = 'GNU gettext PO parser for mruby'
20
- spec.version = '0.1.0'
21
- spec.homepage = 'https://git.disroot.org/gemmaro/ruby-gettextpo'
22
- spec.linker.libraries << 'gettextpo'
23
- spec.add_test_dependency 'mruby-io'
24
- end
@@ -1,58 +0,0 @@
1
- # Copyright (C) 2026 gemmaro
2
- #
3
- # This program is free software: you can redistribute it and/or modify
4
- # it under the terms of the GNU General Public License as published by
5
- # the Free Software Foundation, either version 3 of the License, or
6
- # (at your option) any later version.
7
- #
8
- # This program is distributed in the hope that it will be useful,
9
- # but WITHOUT ANY WARRANTY; without even the implied warranty of
10
- # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
- # GNU General Public License for more details.
12
- #
13
- # You should have received a copy of the GNU General Public License
14
- # along with this program. If not, see <https://www.gnu.org/licenses/>.
15
-
16
- module GettextPO
17
- Error = Class.new(StandardError)
18
-
19
- class File
20
- class << self
21
- # It seems that calling Proc with keyword arguments is not yet
22
- # supported.
23
- alias original_read read
24
- def read(filename, xerror: nil, xerror2: nil)
25
- original_read(filename,
26
- xerror: xerror && Proc.new { |kwargs| xerror.(**kwargs) },
27
- xerror2: xerror2 && Proc.new { |kwargs| xerror2.(**kwargs) })
28
- end
29
- end
30
-
31
- # It seems that calling Proc with keyword arguments is not yet
32
- # supported.
33
- alias original_check_all check_all
34
- def check_all(xerror: nil, xerror2: nil)
35
- original_check_all(xerror: xerror && Proc.new { |kwargs| xerror.(**kwargs) },
36
- xerror2: xerror2 && Proc.new { |kwargs| xerror2.(**kwargs) })
37
- end
38
- end
39
-
40
- class Message
41
- # It seems that calling Proc with keyword arguments is not yet
42
- # supported.
43
- alias original_check_all check_all
44
- def check_all(iterator, xerror: nil, xerror2: nil)
45
- original_check_all(iterator,
46
- xerror: xerror && Proc.new { |kwargs| xerror.(**kwargs) },
47
- xerror2: xerror2 && Proc.new { |kwargs| xerror2.(**kwargs) })
48
- end
49
-
50
- # It seems that calling Proc with keyword arguments is not yet
51
- # supported.
52
- alias original_check_format check_format
53
- def check_format(xerror: nil, xerror2: nil)
54
- original_check_format(xerror: xerror && Proc.new { |kwargs| xerror.(**kwargs) },
55
- xerror2: xerror2 && Proc.new { |kwargs| xerror2.(**kwargs) })
56
- end
57
- end
58
- end