nkf 0.1.0 → 0.1.2

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: 58b94b86db23f7c0d37177682e6518b12e268f419c0cbbff8f8ba80840227a1c
4
- data.tar.gz: 92de3688e975436deeed4bfabe31b3a12316a95666b15555143ed756c415f90e
3
+ metadata.gz: 0fca8170e316160daab166a56fa34027d27e4abce7521ab2513bdefcf9d3adf4
4
+ data.tar.gz: 1a6aef8236f11b7ba4f193246046e7998794120e720a551a00c97e07c0ac58a0
5
5
  SHA512:
6
- metadata.gz: df67191af5aefe0f1064376a3a77019c385004173f2b89499aa3d4ada0a702be84a5cf7f095f5a982eed2915cae87fac70018c6cf8c22f427a27584aed13dadd
7
- data.tar.gz: f999e10fba1b9e82e69512f2bbfdc1bb26e01de4c393652fa5f55591375641d9073f06788cd7a7ee889d701a81f4cbb3c5562eae03e62161c77d12a5d713f8a1
6
+ metadata.gz: 8662cd84b89ec4a88a294b49eebd3d8decfeee1775e6beba4b0340c0e40d4aa6fad36be6a2cdf738bbacb61464330af29a3496e8c387fb5f8030de51acd4015f
7
+ data.tar.gz: 03da0dc729753c36564d36e1c50b31d46006f38d94b0e39eb033bd186709c62da83d04164c3d9f72e90a013e31c65df3f18b56e0393cbd965400e520f6245136
@@ -0,0 +1,7 @@
1
+ # This is a file used by GitHub to ignore the following commits on `git blame`.
2
+ #
3
+ # You can also do the same thing in your local repository with:
4
+ # $ git config --local blame.ignoreRevsFile .git-blame-ignore-revs
5
+
6
+ # Expand tabs
7
+ 564b86c8de70b636d94df815c77c5989a7a45c3b
@@ -0,0 +1,6 @@
1
+ version: 2
2
+ updates:
3
+ - package-ecosystem: 'github-actions'
4
+ directory: '/'
5
+ schedule:
6
+ interval: 'weekly'
@@ -7,18 +7,16 @@ jobs:
7
7
  name: build (${{ matrix.ruby }} / ${{ matrix.os }})
8
8
  strategy:
9
9
  matrix:
10
- ruby: [ 2.7, 2.6, 2.5, head ]
10
+ ruby: [ '3.0', 2.7, 2.6, 2.5, head ]
11
11
  os: [ ubuntu-latest, macos-latest ]
12
12
  runs-on: ${{ matrix.os }}
13
13
  steps:
14
- - uses: actions/checkout@master
14
+ - uses: actions/checkout@v3
15
15
  - name: Set up Ruby
16
16
  uses: ruby/setup-ruby@v1
17
17
  with:
18
18
  ruby-version: ${{ matrix.ruby }}
19
19
  - name: Install dependencies
20
- run: |
21
- gem install bundler --no-document
22
- bundle install
20
+ run: bundle install
23
21
  - name: Run test
24
22
  run: rake compile test
@@ -30,7 +30,7 @@
30
30
  /* --exec-in, --exec-out option
31
31
  * require pipe, fork, execvp and so on.
32
32
  * please undef this on MS-DOS, MinGW
33
- * this is still buggy arround child process
33
+ * this is still buggy around child process
34
34
  */
35
35
  /* #define EXEC_IO */
36
36
 
@@ -144,7 +144,7 @@ static void w_oconv(nkf_char c2, nkf_char c1);
144
144
  static void w_oconv16(nkf_char c2, nkf_char c1);
145
145
  static void w_oconv32(nkf_char c2, nkf_char c1);
146
146
 
147
- typedef struct {
147
+ typedef const struct {
148
148
  const char *name;
149
149
  nkf_char (*iconv)(nkf_char c2, nkf_char c1, nkf_char c0);
150
150
  void (*oconv)(nkf_char c2, nkf_char c1);
@@ -158,10 +158,10 @@ nkf_native_encoding NkfEncodingUTF_8 = { "UTF-8", w_iconv, w_oconv };
158
158
  nkf_native_encoding NkfEncodingUTF_16 = { "UTF-16", w_iconv16, w_oconv16 };
159
159
  nkf_native_encoding NkfEncodingUTF_32 = { "UTF-32", w_iconv32, w_oconv32 };
160
160
 
161
- typedef struct {
162
- const int id;
161
+ typedef const struct {
162
+ int id;
163
163
  const char *name;
164
- const nkf_native_encoding *base_encoding;
164
+ nkf_native_encoding *base_encoding;
165
165
  } nkf_encoding;
166
166
 
167
167
  nkf_encoding nkf_encoding_table[] = {
@@ -204,9 +204,9 @@ nkf_encoding nkf_encoding_table[] = {
204
204
  {-1, NULL, NULL}
205
205
  };
206
206
 
207
- struct {
207
+ static const struct {
208
208
  const char *name;
209
- const int id;
209
+ int id;
210
210
  } encoding_name_to_id_table[] = {
211
211
  {"US-ASCII", ASCII},
212
212
  {"ASCII", ASCII},
@@ -581,7 +581,7 @@ static const unsigned char cv[]= {
581
581
  0x00,0x00};
582
582
 
583
583
 
584
- /* X0201 kana conversion table for daguten */
584
+ /* X0201 kana conversion table for dakuten */
585
585
  /* 90-9F A0-DF */
586
586
  static const unsigned char dv[]= {
587
587
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
@@ -602,7 +602,7 @@ static const unsigned char dv[]= {
602
602
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
603
603
  0x00,0x00};
604
604
 
605
- /* X0201 kana conversion table for han-daguten */
605
+ /* X0201 kana conversion table for han-dakuten */
606
606
  /* 90-9F A0-DF */
607
607
  static const unsigned char ev[]= {
608
608
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
@@ -623,7 +623,7 @@ static const unsigned char ev[]= {
623
623
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
624
624
  0x00,0x00};
625
625
 
626
- /* X0201 kana to X0213 conversion table for han-daguten */
626
+ /* X0201 kana to X0213 conversion table for han-dakuten */
627
627
  /* 90-9F A0-DF */
628
628
  static const unsigned char ev_x0213[]= {
629
629
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
@@ -3817,7 +3817,7 @@ oconv_newline(void (*func)(nkf_char, nkf_char))
3817
3817
  LF new line
3818
3818
  SP space
3819
3819
 
3820
- This fold algorthm does not preserve heading space in a line.
3820
+ This fold algorithm does not preserve heading space in a line.
3821
3821
  This is the main difference from fmt.
3822
3822
  */
3823
3823
 
@@ -4286,7 +4286,7 @@ static const unsigned char *mime_pattern[] = {
4286
4286
 
4287
4287
 
4288
4288
  /* $B3:Ev$9$k%3!<%I$NM%@hEY$r>e$2$k$?$a$NL\0u(B */
4289
- nkf_char (*mime_priority_func[])(nkf_char c2, nkf_char c1, nkf_char c0) = {
4289
+ static nkf_char (*const mime_priority_func[])(nkf_char c2, nkf_char c1, nkf_char c0) = {
4290
4290
  e_iconv, s_iconv, 0, 0, 0, 0, 0,
4291
4291
  #if defined(UTF8_INPUT_ENABLE)
4292
4292
  w_iconv, w_iconv,
@@ -6787,7 +6787,7 @@ options(unsigned char *cp)
6787
6787
  case 'S': /* Shift_JIS input */
6788
6788
  input_encoding = nkf_enc_from_index(SHIFT_JIS);
6789
6789
  continue;
6790
- case 'Z': /* Convert X0208 alphabet to asii */
6790
+ case 'Z': /* Convert X0208 alphabet to ascii */
6791
6791
  /* alpha_f
6792
6792
  bit:0 Convert JIS X 0208 Alphabet to ASCII
6793
6793
  bit:1 Convert Kankaku to one space
@@ -16,8 +16,8 @@
16
16
  #define X0201_DEFAULT TRUE
17
17
  #endif
18
18
 
19
- #if DEFAULT_NEWLINE == 0x0D0A
20
- #elif DEFAULT_NEWLINE == 0x0D
19
+ #if defined(DEFAULT_NEWLINE) && DEFAULT_NEWLINE == 0x0D0A
20
+ #elif defined(DEFAULT_NEWLINE) && DEFAULT_NEWLINE == 0x0D
21
21
  #else
22
22
  #define DEFAULT_NEWLINE 0x0A
23
23
  #endif
data/ext/nkf/nkf.c CHANGED
@@ -65,11 +65,11 @@ rb_encoding* rb_nkf_enc_get(const char *name)
65
65
  {
66
66
  int idx = rb_enc_find_index(name);
67
67
  if (idx < 0) {
68
- nkf_encoding *nkf_enc = nkf_enc_find(name);
69
- idx = rb_enc_find_index(nkf_enc_name(nkf_enc_to_base_encoding(nkf_enc)));
70
- if (idx < 0) {
71
- idx = rb_define_dummy_encoding(name);
72
- }
68
+ nkf_encoding *nkf_enc = nkf_enc_find(name);
69
+ idx = rb_enc_find_index(nkf_enc_name(nkf_enc_to_base_encoding(nkf_enc)));
70
+ if (idx < 0) {
71
+ idx = rb_define_dummy_encoding(name);
72
+ }
73
73
  }
74
74
  return rb_enc_from_index(idx);
75
75
  }
@@ -83,40 +83,40 @@ int nkf_split_options(const char *arg)
83
83
  int is_single_quoted = FALSE;
84
84
  int is_double_quoted = FALSE;
85
85
  for(i = 0; arg[i]; i++){
86
- if(j == 255){
87
- return -1;
88
- }else if(is_single_quoted){
89
- if(arg[i] == '\''){
90
- is_single_quoted = FALSE;
91
- }else{
92
- option[j++] = arg[i];
93
- }
94
- }else if(is_escaped){
95
- is_escaped = FALSE;
96
- option[j++] = arg[i];
97
- }else if(arg[i] == '\\'){
98
- is_escaped = TRUE;
99
- }else if(is_double_quoted){
100
- if(arg[i] == '"'){
101
- is_double_quoted = FALSE;
102
- }else{
103
- option[j++] = arg[i];
104
- }
105
- }else if(arg[i] == '\''){
106
- is_single_quoted = TRUE;
107
- }else if(arg[i] == '"'){
108
- is_double_quoted = TRUE;
109
- }else if(arg[i] == ' '){
110
- option[j] = '\0';
111
- options(option);
112
- j = 0;
113
- }else{
114
- option[j++] = arg[i];
115
- }
86
+ if(j == 255){
87
+ return -1;
88
+ }else if(is_single_quoted){
89
+ if(arg[i] == '\''){
90
+ is_single_quoted = FALSE;
91
+ }else{
92
+ option[j++] = arg[i];
93
+ }
94
+ }else if(is_escaped){
95
+ is_escaped = FALSE;
96
+ option[j++] = arg[i];
97
+ }else if(arg[i] == '\\'){
98
+ is_escaped = TRUE;
99
+ }else if(is_double_quoted){
100
+ if(arg[i] == '"'){
101
+ is_double_quoted = FALSE;
102
+ }else{
103
+ option[j++] = arg[i];
104
+ }
105
+ }else if(arg[i] == '\''){
106
+ is_single_quoted = TRUE;
107
+ }else if(arg[i] == '"'){
108
+ is_double_quoted = TRUE;
109
+ }else if(arg[i] == ' '){
110
+ option[j] = '\0';
111
+ options(option);
112
+ j = 0;
113
+ }else{
114
+ option[j++] = arg[i];
115
+ }
116
116
  }
117
117
  if(j){
118
- option[j] = '\0';
119
- options(option);
118
+ option[j] = '\0';
119
+ options(option);
120
120
  }
121
121
  return count;
122
122
  }
@@ -170,9 +170,9 @@ rb_nkf_convert(VALUE obj, VALUE opt, VALUE src)
170
170
  rb_str_set_len(tmp, output_ctr);
171
171
 
172
172
  if (mimeout_f)
173
- rb_enc_associate(tmp, rb_usascii_encoding());
173
+ rb_enc_associate(tmp, rb_usascii_encoding());
174
174
  else
175
- rb_enc_associate(tmp, rb_nkf_enc_get(nkf_enc_name(output_encoding)));
175
+ rb_enc_associate(tmp, rb_nkf_enc_get(nkf_enc_name(output_encoding)));
176
176
 
177
177
  return tmp;
178
178
  }
@@ -274,7 +274,7 @@ rb_nkf_guess(VALUE obj, VALUE src)
274
274
  *
275
275
  * {de/en}crypt ROT13/47
276
276
  *
277
- * === -h[123] --hiragana --katakana --katakana-hiragana
277
+ * === \-h[123] --hiragana --katakana --katakana-hiragana
278
278
  *
279
279
  * [-h1 --hiragana] Katakana to Hiragana conversion.
280
280
  *
@@ -299,7 +299,7 @@ rb_nkf_guess(VALUE obj, VALUE src)
299
299
  *
300
300
  * New line preserving line folding.
301
301
  *
302
- * === -Z[0-3]
302
+ * === \-Z[0-3]
303
303
  *
304
304
  * Convert X0208 alphabet (Fullwidth Alphabets) to ASCII.
305
305
  *
@@ -318,7 +318,7 @@ rb_nkf_guess(VALUE obj, VALUE src)
318
318
  * With <b>-x</b>, try to preserve X0208 kana and do not convert X0201 kana to X0208.
319
319
  * In JIS output, ESC-(-I is used. In EUC output, SSO is used.
320
320
  *
321
- * === -B[0-2]
321
+ * === \-B[0-2]
322
322
  *
323
323
  * Assume broken JIS-Kanji input, which lost ESC.
324
324
  * Useful when your site is using old B-News Nihongo patch.
@@ -336,7 +336,7 @@ rb_nkf_guess(VALUE obj, VALUE src)
336
336
  *
337
337
  * Delete \r in line feed, Add \r in line feed.
338
338
  *
339
- * === -m[BQN0]
339
+ * === \-m[BQN0]
340
340
  *
341
341
  * MIME ISO-2022-JP/ISO8859-1 decode. (DEFAULT)
342
342
  * To see ISO8859-1 (Latin-1) -l is necessary.
@@ -358,14 +358,14 @@ rb_nkf_guess(VALUE obj, VALUE src)
358
358
  *
359
359
  * [-MB] MIME encode Base64 stream.
360
360
  *
361
- * [-MQ] Perfome quoted encoding.
361
+ * [-MQ] Perform quoted encoding.
362
362
  *
363
363
  * === -l
364
364
  *
365
365
  * Input and output code is ISO8859-1 (Latin-1) and ISO-2022-JP.
366
366
  * <b>-s</b>, <b>-e</b> and <b>-x</b> are not compatible with this option.
367
367
  *
368
- * === -L[uwm]
368
+ * === \-L[uwm]
369
369
  *
370
370
  * new line mode
371
371
  * Without this option, nkf doesn't convert line breaks.
@@ -458,7 +458,7 @@ rb_nkf_guess(VALUE obj, VALUE src)
458
458
  * with this and -x option, nkf can be used as UTF converter.
459
459
  * (In other words, without this and -x option, nkf doesn't save some characters)
460
460
  *
461
- * When nkf convert string which related to path, you should use this opion.
461
+ * When nkf convert string which related to path, you should use this option.
462
462
  *
463
463
  * === --cap-input
464
464
  *
data/nkf.gemspec CHANGED
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |spec|
2
2
  spec.name = "nkf"
3
- spec.version = "0.1.0"
3
+ spec.version = "0.1.2"
4
4
  spec.authors = ["NARUSE Yui"]
5
5
  spec.email = ["naruse@airemix.jp"]
6
6
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nkf
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - NARUSE Yui
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-09-18 00:00:00.000000000 Z
11
+ date: 2022-12-05 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Ruby extension for Network Kanji Filter
14
14
  email:
@@ -17,6 +17,8 @@ executables: []
17
17
  extensions: []
18
18
  extra_rdoc_files: []
19
19
  files:
20
+ - ".git-blame-ignore-revs"
21
+ - ".github/dependabot.yml"
20
22
  - ".github/workflows/test.yml"
21
23
  - ".gitignore"
22
24
  - Gemfile
@@ -56,7 +58,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
56
58
  - !ruby/object:Gem::Version
57
59
  version: '0'
58
60
  requirements: []
59
- rubygems_version: 3.2.0.rc.1
61
+ rubygems_version: 3.4.0.dev
60
62
  signing_key:
61
63
  specification_version: 4
62
64
  summary: Ruby extension for Network Kanji Filter