# \[ruby\_1\_9\_2\] $B%3%s%Q%$%k%(%i!\<(B

**URL:** <https://www.ruby-forum.com/t/ruby-1-9-2-b-3-s-q-k-i-b/188239>\
**Category:** Development\
**Created:** [May 8, 2010, 6:23am UTC](https://www.ruby-forum.com/t/ruby-1-9-2-b-3-s-q-k-i-b/188239 "2010-05-08T06:23:07Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Takahiro\_K](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/76d3ee/32.png) [@Takahiro\_K](https://www.ruby-forum.com/u/Takahiro_K)\
**Post date:** [May 8, 2010, 6:23am UTC](https://www.ruby-forum.com/t/ruby-1-9-2-b-3-s-q-k-i-b/188239/1 "2010-05-08T06:23:07Z")

</div>

ruby\_1\_9\_2e$B%V%i%s%A$N%3%s%Q%$%k$G%(%i!\<$,5/$-$^$9!#e(B

gcc -I. -I.ext/include/i386-netbsdelf5.99.29 -I./include -I.  
-DONIG\_ENC\_REGISTER=rb\_enc\_register -fPIC -g -Wextra  
-Wno-unused-parameter -Wno-parentheses -Wpointer-arith -Wwrite-strings  
-Wno-missing-field-initializers -Wno-long-long -fPIC -pipe -o  
enc/cp949.o -c ./enc/cp949.c  
./enc/cp949.c:56: error: ‘A’ undeclared here (not in a function)  
./enc/cp949.c:56: error: ‘F’ undeclared here (not in a function)  
./enc/cp949.c:68: error: expected ‘,’ or ‘;’ before ‘}’ token  
./enc/cp949.c: In function ‘cp949\_mbc\_enc\_len’:  
./enc/cp949.c:76: error: ‘state\_t’ undeclared (first use in this  
function)  
./enc/cp949.c:76: error: (Each undeclared identifier is reported only  
once  
./enc/cp949.c:76: error: for each function it appears in.)  
./enc/cp949.c:76: error: expected ‘;’ before ‘s’  
./enc/cp949.c:80: error: ‘s’ undeclared (first use in this function)  
./enc/cp949.c:80: error: ‘ACCEPT’ undeclared (first use in this  
function)  
./enc/cp949.c:82: error: ‘trans’ undeclared (first use in this function)  
\*\*\* Error code 1

Stop.  
make: stopped in /usr/local/src/ruby\_1\_9\_2  
\*\*\* Error code 1  
…

e$BC1=c$J%3!\<%I$NDI2C%\_%9$H;W$$$^$9!#e(B

# Index: enc/cp949.c

— enc/cp949.c (e$B%j%S%8%g%se(B 27668)  
+++ enc/cp949.c (e$B:n6H%3%T!\<e(B)  
@@ -48,6 +48,8 @@  
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1  
};

+#define A ACCEPT  
+#define F FAILURE  
static const char CP949\_CAN\_BE\_TRAIL\_TABLE[256] = {  
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,  
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,

e$B$H$3$m$G!"$3$Ne(B A e$B$H$+e(B F e$B$H$$$C$?%^%/%m$G$9$,!"e(B

% egrep ‘define[\t]A[\t]’ enc/\*  
enc/big5.c:#define A ACCEPT  
enc/emacs\_mule.c:#define A ACCEPT  
enc/euc\_jp.c:#define A ACCEPT  
enc/euc\_kr.c:#define A ACCEPT  
enc/euc\_tw.c:#define A ACCEPT  
enc/gb18030.c:#define A ACCEPT  
enc/gbk.c:#define A ACCEPT  
enc/shift\_jis.c:#define A ACCEPT  
enc/utf\_8.c:#define A ACCEPT

e$B$H!“F1$8$b$N$,e(B copy & paste  
e$B$5$l$?$h$&$K;6:\_$7$F$$$^$9!#2?$+$^$H$a$?e(B  
e$BJ}$,NI$$$N$G$O$J$$$G$7$g$&$+!”:#2s$N$h$&$J8m$j$rKI$00UL#$G$b!#e(B

---

<div class="post-metadata">

**Author:** ![Takahiro\_K](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/76d3ee/32.png) [@Takahiro\_K](https://www.ruby-forum.com/u/Takahiro_K)\
**Post date:** [May 8, 2010, 6:24am UTC](https://www.ruby-forum.com/t/ruby-1-9-2-b-3-s-q-k-i-b/188239/2 "2010-05-08T06:24:17Z")

</div>

In message [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
on Sat, 8 May 2010 13:22:22 +0900,  
Takahiro K. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> +#define A ACCEPT  
> +#define F FAILURE  
> static const char CP949\_CAN\_BE\_TRAIL\_TABLE[256] = {  
> 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,  
> 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,  
> e$B$“!”$3$l$@$1$G$O%@%a$G$7$?!"2?$+B-$j$J$$!#e(B;-(

gcc -I. -I.ext/include/i386-netbsdelf5.99.29 -I./include -I.  
-DONIG\_ENC\_REGISTER=rb\_enc\_register -fPIC -g -Wextra  
-Wno-unused-parameter -Wno-parentheses -Wpointer-arith -Wwrite-strings  
-Wno-missing-field-initializers -Wno-long-long -fPIC -pipe -o  
enc/cp949.o -c ./enc/cp949.c  
./enc/cp949.c:58: error: ‘ACCEPT’ undeclared here (not in a function)  
./enc/cp949.c:58: error: ‘FAILURE’ undeclared here (not in a function)  
./enc/cp949.c:70: error: expected ‘,’ or ‘;’ before ‘}’ token

---

<div class="post-metadata">

**Author:** ![Takahiro\_K](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/76d3ee/32.png) [@Takahiro\_K](https://www.ruby-forum.com/u/Takahiro_K)\
**Post date:** [May 8, 2010, 6:35am UTC](https://www.ruby-forum.com/t/ruby-1-9-2-b-3-s-q-k-i-b/188239/3 "2010-05-08T06:35:25Z")

</div>

e$B$I$C$+$GJT=8%\_%9$G$b$"$C$?$N$G$7$g$&$+e(B?  
trunke$B$HHf$Y$k$HItJ,E\*$K7gMn$7e(B  
e$B$F$k$h$&$G$9!#e(B

–  
e$B?@8Me(B e$BN4Gne(B (e$B$+$s$Ye(B e$B$?$+$R$me(B) at e$B;E;v\>le(B

# Index: enc/cp949.c

— enc/cp949.c (e$B%j%S%8%g%se(B 27668)  
+++ enc/cp949.c (e$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EPT = -1, S0 = 0, S1 } state\_t;  
+#define A ACCEPT  
+#define F FAILURE  
+static const signed char trans[][0x100] = {

- { /\* S0 0 1 2 3 4 5 6 7 8 9 a b c d e f \*/
- /\* 0 \*/ A, A, A, A, A, A, A, A, A, A, A, A, A, A, A, A,
- /\* 1 \*/ A, A, A, A, A, A, A, A, A, A, A, A, A, A, A, A,
- /\* 2 \*/ A, A, A, A, A, A, A, A, A, A, A, A, A, A, A, A,
- /\* 3 \*/ A, A, A, A, A, A, A, A, A, A, A, A, A, A, A, A,
- /\* 4 \*/ A, A, A, A, A, A, A, A, A, A, A, A, A, A, A, A,
- /\* 5 \*/ A, A, A, A, A, A, A, A, A, A, A, A, A, A, A, A,
- /\* 6 _/ A, A, A, A, A, A, A, A, A, A, A, A, A, A, A, A,  
/_ 7 _/ A, A, A, A, A, A, A, A, A, A, A, F, F, F, F, F,  
/_ 8 _/ F, A, A, A, A, A, A, A, A, A, A, A, A, A, A, A,  
/_ 9 \*/ A, A, A, A, A, A, A, A, A, A, A, A, A, A, A, A,

---

<div class="post-metadata">

**Author:** ![Takahiro\_K](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/76d3ee/32.png) [@Takahiro\_K](https://www.ruby-forum.com/u/Takahiro_K)\
**Post date:** [May 8, 2010, 9:07am UTC](https://www.ruby-forum.com/t/ruby-1-9-2-b-3-s-q-k-i-b/188239/4 "2010-05-08T09:07:01Z")

</div>

In message  
[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
on Sat, 8 May 2010 15:49:45 +0900,  
Tanaka A. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> 2010e$BG/e(B5e$B7ne(B8e$BF|e(B13:31 Takahiro K. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid):
> 
> > e$B$I$C$+$GJT=8%\_%9$G$b$"$C$?$N$G$7$g$&$+e(B? trunke$B$HHf$Y$k$HItJ,E\*$K7gMn$7e(B  
> > e$B$F$k$h$&$G$9!#e(B
> 
> e$B%j%]%8%H%j$NCf$G$O%U%!%$%k$K0c$$$OL5$$$h$&$G$9!#e(B  
> e$B$&$%$`!"$?$$$X$s\<:Ni$7$^$7$?!#e(B

> e$B%m%0$r$\_$F$be(B r27657 e$B$GJ,4t$7$F$+$iJQ99$5$l$F$$$^$;$s!#e(B
> 
> % svn log -v [http://svn.ruby-lang.org/repos/ruby/branches/ruby\_1\_9\_2/enc/cp949.c|less](http://svn.ruby-lang.org/repos/ruby/branches/ruby_1_9_2/enc/cp949.c%7Cless)  
> e$B$3$A$i$b8+$F$\*$+$7$$$H;W$C$F$$$?$N$G$9$,!“B\>$N%^%7%s$Ge(Bcheckoute$B$7$?$b$Ne(B  
> e$B$OLdBj$”$j$^$;$s$G$7$?!#e(B

e$B$\*A{$,$;$7$?$3$H$r$\*OM$S$7$^$9!#e(B

---

<div class="post-metadata">

**Author:** ![Takahiro\_K](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/76d3ee/32.png) [@Takahiro\_K](https://www.ruby-forum.com/u/Takahiro_K)\
**Post date:** [May 8, 2010, 8:50am UTC](https://www.ruby-forum.com/t/ruby-1-9-2-b-3-s-q-k-i-b/188239/5 "2010-05-08T08:50:37Z")

</div>

2010e$BG/e(B5e$B7ne(B8e$BF|e(B13:31 Takahiro K.  
[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid):

> e$B$I$C$+$GJT=8%\_%9$G$b$"$C$?$N$G$7$g$&$+e(B? trunke$B$HHf$Y$k$HItJ,E\*$K7gMn$7e(B  
> e$B$F$k$h$&$G$9!#e(B

e$B%j%]%8%H%j$NCf$G$O%U%!%$%k$K0c$$$OL5$$$h$&$G$9!#e(B

% svn diff   
[http://svn.ruby-lang.org/repos/ruby/branches/ruby\_1\_9\_2/enc/cp949.c](http://svn.ruby-lang.org/repos/ruby/branches/ruby_1_9_2/enc/cp949.c)   
[http://svn.ruby-lang.org/repos/ruby/trunk/enc/cp949.c](http://svn.ruby-lang.org/repos/ruby/trunk/enc/cp949.c)

e$B%m%0$r$\_$F$be(B r27657 e$B$GJ,4t$7$F$+$iJQ99$5$l$F$$$^$;$s!#e(B

% svn log -v  
[http://svn.ruby-lang.org/repos/ruby/branches/ruby\_1\_9\_2/enc/cp949.c|less](http://svn.ruby-lang.org/repos/ruby/branches/ruby_1_9_2/enc/cp949.c%7Cless)
