gettextpo 0.2.0 → 0.3.0

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: d84207e6d2a84f0dd156d3a0638c3637aa5ca90340c3806d384706ded2a974c2
4
- data.tar.gz: 7228e514562ed2bd8ebcdbd5c2ba2dbfb7068d3865621bfde7780c93bf970676
3
+ metadata.gz: 883b42b17eceae60f5baea02d4048198953cf8aa69266998e56543022b00124c
4
+ data.tar.gz: 13767623c26247eb1e9903e2275c3b44b55c9bd91b5e2914fbd6038dcfcfada3
5
5
  SHA512:
6
- metadata.gz: df67f19d3165af0fd428092d2cc35aeb15a55f7300e14440c3cc12222795fd479c7621cb30baf4473768b674549511785b23803b953063621f2526e946d8382d
7
- data.tar.gz: b6d7a3cc904323f13a9d971daad33f197b916d042b9c5bcb4d88d0dec295e2af1cdde36bd9b8405b5a614831a2b99667fd154ed3a68d51b4fa626fe8e3bedbe7
6
+ metadata.gz: dcdf35d913cc25c17183148b8ec755ec900f71f6ebfdbd5b4e1b7d2872d875bdc45e29604c26406554ece67f2c8eda061d15d52b0abc84c968745a02ab38c01b
7
+ data.tar.gz: 062c043c1e964a43742805843b7b3f39bdbdd6193696e69c5d9cbadf5578c7b940b64e2809617417a69b46428378501f4c924167e3123662f6b9e4b47b76bf9e
data/CHANGELOG.md CHANGED
@@ -2,6 +2,16 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
+ ## CRuby and mruby version 0.3.0 - 2026-03-17
6
+
7
+ - Add `GettextPO::File#each_message`,
8
+ `GettextPO::Message#each_workflow_flag`, and
9
+ `GettextPO::Message#each_sticky_flag` methods.
10
+
11
+ ## CRuby version 0.2.1 - 2026-03-16
12
+
13
+ - CRuby: Fix to work with gettext 0.23.
14
+
5
15
  ## CRuby and mruby version 0.2.0 - 2026-03-15
6
16
 
7
17
  - CRuby and mruby: Add `GettextPO::Message#file_positions`,
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"
@@ -170,6 +170,7 @@ static const struct po_xerror_handler gettextpo_xerror_handler = {
170
170
  .xerror2 = gettextpo_xerror2,
171
171
  };
172
172
 
173
+ #ifdef HAVE_PO_MESSAGE_GET_FORMAT
173
174
  /**
174
175
  * Document-class: GettextPO::FlagIterator
175
176
  */
@@ -204,6 +205,7 @@ gettextpo_po_flag_iterator_m_next (VALUE self)
204
205
  else
205
206
  rb_raise (rb_eStopIteration, "no more flag");
206
207
  }
208
+ #endif
207
209
 
208
210
  /**
209
211
  * Document-class: GettextPO::Message
@@ -485,6 +487,11 @@ UPDATE_FLAG (workflow);
485
487
 
486
488
  /**
487
489
  * Document-method: workflow_flag_iterator
490
+ * call-seq: workflow_flag_iterator -> GettextPO::FlagIterator
491
+ *
492
+ * You may find it handy to use the #workflow_flag_iterator method to
493
+ * iterate over the sticky flag. This is for more versatile
494
+ * manipulation.
488
495
  */
489
496
  FLAG_ITER (workflow);
490
497
 
@@ -563,6 +570,11 @@ UPDATE_FLAG (sticky);
563
570
 
564
571
  /**
565
572
  * Document-method: sticky_flag_iterator
573
+ * call-seq: sticky_flag_iterator -> GettextPO::FlagIterator
574
+ *
575
+ * You may find it handy to use the #sticky_flag_iterator method to
576
+ * iterate over the sticky flag. This is for more versatile
577
+ * manipulation.
566
578
  */
567
579
  FLAG_ITER (sticky);
568
580
  #endif
@@ -801,6 +813,11 @@ gettextpo_po_file_m_domains (VALUE self)
801
813
 
802
814
  /**
803
815
  * call-seq: message_iterator (domain = nil) -> GettextPO::MessageIterator
816
+ *
817
+ * You may find it handy to use the #each_message method instead of
818
+ * this to iterate over the messages. This method is for more
819
+ * versatile manipulation; the returned iterator can insert messages,
820
+ * for example.
804
821
  */
805
822
  VALUE
806
823
  gettextpo_po_file_m_message_iterator (int argc, VALUE *argv, VALUE self)
@@ -1144,9 +1161,11 @@ Init_gettextpo (void)
1144
1161
  rb_define_method (rb_cFilePos, "file", gettextpo_po_filepos_m_file, 0);
1145
1162
  rb_define_method (rb_cFilePos, "start_line",
1146
1163
  gettextpo_po_filepos_m_start_line, 0);
1164
+ #ifdef HAVE_PO_MESSAGE_GET_FORMAT
1147
1165
  rb_cFlagIterator
1148
1166
  = rb_define_class_under (rb_mGettextPO, "FlagIterator", rb_cObject);
1149
1167
  rb_define_alloc_func (rb_cFlagIterator, gettextpo_po_flag_iterator_alloc);
1150
1168
  rb_define_method (rb_cFlagIterator, "next",
1151
1169
  gettextpo_po_flag_iterator_m_next, 0);
1170
+ #endif
1152
1171
  }
@@ -19,5 +19,5 @@
19
19
 
20
20
  module GettextPO
21
21
  # Version of this gem.
22
- VERSION = "0.2.0"
22
+ VERSION = "0.3.0"
23
23
  end
@@ -76,6 +76,41 @@ module GettextPO
76
76
  end
77
77
  positions
78
78
  end
79
+
80
+ def each_sticky_flag # yields: flag
81
+ iter = sticky_flag_iterator
82
+ while true
83
+ begin
84
+ yield iter.next
85
+ rescue StopIteration
86
+ return
87
+ end
88
+ end
89
+ end
90
+
91
+ def each_workflow_flag # yields: flag
92
+ iter = workflow_flag_iterator
93
+ while true
94
+ begin
95
+ yield iter.next
96
+ rescue StopIteration
97
+ return
98
+ end
99
+ end
100
+ end
101
+ end
102
+
103
+ class File
104
+ def each_message(domain = nil) # yields: message
105
+ iter = message_iterator(domain)
106
+ while true
107
+ begin
108
+ yield iter.next
109
+ rescue StopIteration
110
+ return
111
+ end
112
+ end
113
+ end
79
114
  end
80
115
 
81
116
  # This class doesn't provide the +new+ class method. See also
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gettextpo
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - gemmaro
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2026-03-15 00:00:00.000000000 Z
11
+ date: 2026-03-17 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: This gem is a Ruby library for the GNU gettext PO files. This is a C
14
14
  binding of the libgettextpo library, which is part of the GNU gettext package.
@@ -19,38 +19,17 @@ extensions:
19
19
  - ext/gettextpo/extconf.rb
20
20
  extra_rdoc_files: []
21
21
  files:
22
- - ".clang-format"
23
- - ".clangd"
24
- - ".dir-locals.el"
25
- - ".env.example"
26
- - ".envrc"
27
- - ".rdoc_options"
28
22
  - CHANGELOG.md
29
23
  - COPYING
24
+ - Gemfile
30
25
  - README.md
31
26
  - Rakefile
32
- - build_config.rb
33
27
  - ext/gettextpo/extconf.rb
34
28
  - ext/gettextpo/gettextpo.c
35
29
  - ext/gettextpo/gettextpo.h
36
- - include/mrb_gettextpo.h
37
30
  - lib/gettextpo.rb
38
31
  - lib/gettextpo/version.rb
39
- - manifest.scm
40
- - mrbgem.rake
41
- - mrblib/mrb_gettextpo.rb
42
32
  - mrblib/mrb_gettextpo_common.rb
43
- - mrblib/mrb_gettextpo_version.rb
44
- - sig/gettextpo.rbs
45
- - src/mrb_gettextpo.c
46
- - test.cruby/gettextpo_test.rb
47
- - test.cruby/resources/a.po
48
- - test.cruby/resources/bad.po
49
- - test.cruby/resources/filepos.po
50
- - test.cruby/resources/format.po
51
- - test.cruby/resources/ok.po
52
- - test.cruby/test_helper.rb
53
- - test.cruby/tmp/.keep
54
33
  homepage: https://git.disroot.org/gemmaro/ruby-gettextpo
55
34
  licenses:
56
35
  - GPL-3.0-or-later
data/.clang-format DELETED
@@ -1 +0,0 @@
1
- BasedOnStyle: GNU
data/.clangd DELETED
@@ -1,2 +0,0 @@
1
- CompileFlags:
2
- Add: [-DHAVE_PO_MESSAGE_GET_FORMAT]
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,31 +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
-
18
- dotenv
19
-
20
- if [ "$DEVELOP_MRUBY" != 'yes' ]
21
- then
22
- # CRuby
23
- path_add C_INCLUDE_PATH "$(ruby -e "puts RbConfig::CONFIG['rubyhdrdir']")"
24
- path_add C_INCLUDE_PATH "$(ruby -e "puts RbConfig::CONFIG['rubyarchhdrdir']")"
25
- else
26
- # mruby
27
- env_vars_required MRUBY_SRC
28
- path_add C_INCLUDE_PATH include
29
- path_add C_INCLUDE_PATH "$MRUBY_SRC/include"
30
- path_add C_INCLUDE_PATH "$MRUBY_SRC/build/host/include"
31
- fi
data/.rdoc_options DELETED
@@ -1,14 +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
13
- - manifest.scm
14
- - ext/gettextpo/extconf.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/manifest.scm DELETED
@@ -1,43 +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-modules (guix packages)
17
- (guix download)
18
- (guix profiles)
19
- (gnu packages gettext)
20
- (gnu packages gdb)
21
- (gnu packages commencement)
22
- (gnu packages llvm)
23
- (gnu packages ruby)
24
- (gnu packages ruby-check)
25
- (gnu packages base))
26
-
27
- (define-public gnu-gettext-1.0
28
- (package/inherit gnu-gettext
29
- (version "1.0")
30
- (source (origin
31
- (method url-fetch)
32
- (uri (string-append "mirror://gnu/gettext/gettext-" version
33
- ".tar.gz"))
34
- (sha256 (base32
35
- "06jgjxnm5xhw0d0zwl9birlwfxfgfqhk9q029j3h9941r5wrpnc5"))))))
36
-
37
- (packages->manifest (list gnu-gettext-1.0
38
- gcc-toolchain
39
- gdb
40
- clang
41
- ruby-3.3
42
- ruby-rake-compiler
43
- gnu-make))
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
@@ -1,23 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- #--
4
- # Copyright (C) 2026 gemmaro
5
- #
6
- # This program is free software: you can redistribute it and/or modify
7
- # it under the terms of the GNU General Public License as published by
8
- # the Free Software Foundation, either version 3 of the License, or
9
- # (at your option) any later version.
10
- #
11
- # This program is distributed in the hope that it will be useful,
12
- # but WITHOUT ANY WARRANTY; without even the implied warranty of
13
- # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
- # GNU General Public License for more details.
15
- #
16
- # You should have received a copy of the GNU General Public License
17
- # along with this program. If not, see <https://www.gnu.org/licenses/>.
18
- #++
19
-
20
- module GettextPO
21
- # Version of this gem.
22
- VERSION = "0.2.0"
23
- end
data/sig/gettextpo.rbs DELETED
@@ -1,4 +0,0 @@
1
- module GettextPO
2
- VERSION: String
3
- # See the writing guide of rbs: https://github.com/ruby/rbs#guides
4
- end