pax_global_header00006660000000000000000000000064122345153620014515gustar00rootroot0000000000000052 comment=81f0bdf052e4ed27215232979972b939e69a44b4 jcodings-jcodings-1.0.11/000077500000000000000000000000001223451536200151735ustar00rootroot00000000000000jcodings-jcodings-1.0.11/.gitignore000066400000000000000000000000071223451536200171600ustar00rootroot00000000000000target jcodings-jcodings-1.0.11/LICENSE.txt000066400000000000000000000020001223451536200170060ustar00rootroot00000000000000Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. jcodings-jcodings-1.0.11/MANIFEST.MF000066400000000000000000000001541223451536200166250ustar00rootroot00000000000000Implementation-Title: JCodings (Byte based encoding support library for java) Implementation-Version: 1.0.7 jcodings-jcodings-1.0.11/README.md000066400000000000000000000002531223451536200164520ustar00rootroot00000000000000jcodings ======== Java-based codings helper classes for Joni and JRuby ## License JCodings is released under the [MIT License](http://www.opensource.org/licenses/MIT). jcodings-jcodings-1.0.11/build.xml000066400000000000000000000022271223451536200170170ustar00rootroot00000000000000 jcodings-jcodings-1.0.11/pom.xml000066400000000000000000000065231223451536200165160ustar00rootroot00000000000000 4.0.0 org.jruby.jcodings jcodings 1.0.11 JCodings Byte based encoding support library for java org.sonatype.oss oss-parent 7 Github https://github.com/jruby/jcodings/issues scm:git:git://github.com/jruby/jcodings.git scm:git:git@github.com:jruby/jcodings.git https://github.com/jruby/jcodings MIT License http://www.opensource.org/licenses/mit-license.php repo lopex Marcin Mielzynski lopx@gazeta.pl junit junit 4.10 test src scripts test jcodings org.apache.maven.wagon wagon-webdav-jackrabbit 2.1 maven-source-plugin 2.2.1 attach-sources jar maven-javadoc-plugin 2.9 attach-javadocs jar maven-compiler-plugin 3.1 1.5 1.5 maven-jar-plugin 2.4 MANIFEST.MF maven-resources-plugin 2.6 resources **/*.bin jcodings-jcodings-1.0.11/resources/000077500000000000000000000000001223451536200172055ustar00rootroot00000000000000jcodings-jcodings-1.0.11/resources/tables/000077500000000000000000000000001223451536200204575ustar00rootroot00000000000000jcodings-jcodings-1.0.11/resources/tables/CR_ASCII.bin000066400000000000000000000000201223451536200223550ustar00rootroot00000000000000jcodings-jcodings-1.0.11/resources/tables/CR_ASCII_Hex_Digit.bin000066400000000000000000000000401223451536200243030ustar00rootroot0000000000000009AFafjcodings-jcodings-1.0.11/resources/tables/CR_Age_1_1.bin000066400000000000000000000044101223451536200226700ustar00rootroot00000000000000A PE`atuzz~~ OQ\^1VY_a  !:@R`mp    9 < M P T X p       ( * 0 2 3 5 6 8 9 < < > B G H K M Y \ ^ ^ f t       ( * 0 2 3 6 9 < C G H K M V W \ ] _ a f p       ( * 3 5 9 > D F H J M U V ` a f o       ( * 9 > C F H J M W W ` a f o:?[Y_ EHMPWYY[[]]_} . 0 F j p t !!8!S!!!""####z$$$$@$J$`$%%%%&&&&o'''' ' ''')'K'M'M'O'R'V'V'X'^'a'g'v'''''0070?0?0A0000011,11111222 2C2`2{22222233v3{333N-68<>>@ACDF?P #0DIRTfhkprttv^ajcodings-jcodings-1.0.11/resources/tables/CR_Age_2_0.bin000066400000000000000000000047101223451536200226730ustar00rootroot00000000000000q8PE`atuzz~~ OQ\^1VY_a  !:@R`mp    9 < M P T X p       ( * 0 2 3 5 6 8 9 < < > B G H K M Y \ ^ ^ f t       ( * 0 2 3 6 9 < C G H K M V W \ ] _ a f p       ( * 3 5 9 > D F H J M U V ` a f o       ( * 9 > C F H J M W W ` a f o:?[GIiqY_ EHMPWYY[[]]_} . 0 F j p t !!8!S!!!""####z$$$$@$J$`$%%%%&&&&o'''' ' ''')'K'M'M'O'R'V'V'X'^'a'g'v'''''0070?0?0A0000011,11111222 2C2`2{22222233v3{333Nף-68<>>@ACDF?P #0DIRTfhkprttv^a jcodings-jcodings-1.0.11/resources/tables/CR_Age_2_1.bin000066400000000000000000000047101223451536200226740ustar00rootroot00000000000000q8PE`atuzz~~ OQ\^1VY_a  !:@R`mp    9 < M P T X p       ( * 0 2 3 5 6 8 9 < < > B G H K M Y \ ^ ^ f t       ( * 0 2 3 6 9 < C G H K M V W \ ] _ a f p       ( * 3 5 9 > D F H J M U V ` a f o       ( * 9 > C F H J M W W ` a f o:?[GIiqY_ EHMPWYY[[]]_} . 0 F j p t !!8!S!!!""####z$$$$@$J$`$%%%%&&&&o'''' ' ''')'K'M'M'O'R'V'V'X'^'a'g'v'''''0070?0?0A0000011,11111222 2C2`2{22222233v3{333Nף-68<>>@ACDF?P #0DIRTfhkprttv^a jcodings-jcodings-1.0.11/resources/tables/CR_Age_3_0.bin000066400000000000000000000056201223451536200226750ustar00rootroot00000000000000q"3PN`btuzz~~1VY_a  !:@U`mp ,0J    9 < M P T X p       ( * 0 2 3 5 6 8 9 < < > B G H K M Y \ ^ ^ f t       ( * 0 2 3 6 9 < C G H K M V W \ ] _ a f p       ( * 3 5 9 > D F H J M U V ` a f o       ( * 9 > C F H J M W W ` a f o :?[GIjq!#')*,269@YY_FHHJMPVXXZ]` FHZa|v w EHMPWYY[[]]_} F H M j p t !!:!S!!!""##{#}#$$&$@$J$`$%%%%&&&&q'''' ' ''')'K'M'M'O'R'V'V'X'^'a'g'v'''''((....////00:0>0?0A0000011,11111222 2C2`2{22222233v3{3334MNף-68<>>@ACDF?P #0DIRTfhkprttv^a jcodings-jcodings-1.0.11/resources/tables/CR_Age_3_1.bin000066400000000000000000000062301223451536200226740ustar00rootroot00000000000000%"3PN`btuzz~~1VY_a  !:@U`mp ,0J    9 < M P T X p       ( * 0 2 3 5 6 8 9 < < > B G H K M Y \ ^ ^ f t       ( * 0 2 3 6 9 < C G H K M V W \ ] _ a f p       ( * 3 5 9 > D F H J M U V ` a f o       ( * 9 > C F H J M W W ` a f o :?[GIjq!#')*,269@YY_FHHJMPVXXZ]` FHZa|v w EHMPWYY[[]]_} F H M j p t !!:!S!!!""##{#}#$$&$@$J$`$%%%%&&&&q'''' ' ''')'K'M'M'O'R'V'V'X'^'a'g'v'''''((....////00:0>0?0A0000011,11111222 2C2`2{22222233v3{3334MNף-68<>>@ACDF?P #0DIRTfhkprttv^a #0J%(M&*TVԜԞԟԢԢԥԦԩԬԮԹԻԻԽ  9;>@DFFJPR֣֨  jcodings-jcodings-1.0.11/resources/tables/CR_Age_3_2.bin000066400000000000000000000061601223451536200226770ustar00rootroot00000000000000 "3PO`otuzz~~1VY_a  !:@U` ,0J    9 < M P T X p       ( * 0 2 3 5 6 8 9 < < > B G H K M Y \ ^ ^ f t       ( * 0 2 3 6 9 < C G H K M V W \ ] _ a f p       ( * 3 5 9 > D F H J M U V ` a f o       ( * 9 > C F H J M W W ` a f o :?[GIjq!#')*,269@YY_FHHJMPVXXZ]` FHZa|v  6@S`lnprs w EHMPWYY[[]]_} R W W _ c j q t !!:!=!K!S!!#$$&$@$J$`$%&&&&&}&&'''' ' ''')'K'M'M'O'R'V'V'X'^'a''''''''*....////00?0A00011,11111122 2C2Q2{222233v3{3334MNף-0j68<>>@ACDF?P #0FIRTfhkptv #0J%(M&*TVԜԞԟԢԢԥԦԩԬԮԹԻԻԽ  9;>@DFFJPR֣֨  jcodings-jcodings-1.0.11/resources/tables/CR_Age_4_0.bin000066400000000000000000000063501223451536200226770ustar00rootroot0000000000000096PW]otuzz~~1VY_a !:@X` JMO  9 < M P T X p       ( * 0 2 3 5 6 8 9 < < > B G H K M Y \ ^ ^ f t       ( * 0 2 3 5 9 < C G H K M V W \ ] _ a f q       ( * 3 5 9 > D F H J M U V ` a f o       ( * 9 > C F H J M W W ` a f o :?[GIjq!#')*,269@YY_FHHJMPVXXZ]` FHZa|v  6@S`lnprs w +0;@@Dmptk EHMPWYY[[]]_} T W W _ c j q t !!;!=!K!S!!#$$&$@$J$`&&&}&&&&'''' ' ''')'K'M'M'O'R'V'V'X'^'a''''''''+ ....////00?0A00011,11111122 2C2P2}223MMף-0j68<>>@ACDF?P #0RTfhkptv  &(:<=?MP]37? #0J 578<<??&*VTVԜԞԟԢԢԥԦԩԬԮԹԻԻԽ  9;>@DFFJPR֣֨  jcodings-jcodings-1.0.11/resources/tables/CR_Age_4_1.bin000066400000000000000000000065701223451536200227040ustar00rootroot00000000000000]APotuzz~~1VY_a !:@^` JMm  9 < M P T X p } }       ( * 0 2 3 5 6 8 9 < < > B G H K M Y \ ^ ^ f t       ( * 0 2 3 5 9 < C G H K M V W \ ] _ a f q       ( * 3 5 9 > D F H J M U V ` a f o       ( * 9 > C F H J M W W ` a f o :?[GIjq!#')*,269@YY_HJMPVXXZ]`Z_|v  6@S`lnprs w +0;@@Dmpt EHMPWYY[[]]_} c j q t !!L!S!!#$$&$@$J$`&&&'''' ' ''')'K'M'M'O'R'V'V'X'^'a''''''''''+,,.,0,^,,,-%-0-e-o-o------------------........////00?0A00011,1111111122 2C2P23MM+ף-0jp68<>>@ACDF?P #0RTfhkptv  &(:<=?MP]37 #0J 578<<??          3 8 : ? G P X&*EVTVԜԞԟԢԢԥԦԩԬԮԹԻԻԽ  9;>@DFFJPR֥֨  jcodings-jcodings-1.0.11/resources/tables/CR_Age_5_0.bin000066400000000000000000000067101223451536200227000ustar00rootroot00000000000000qotuz~1VY_a !:@^` JMm  9 < M P T X p {        ( * 0 2 3 5 6 8 9 < < > B G H K M Y \ ^ ^ f t       ( * 0 2 3 5 9 < C G H K M V W \ ] _ a f q       ( * 3 5 9 > D F H J M U V ` a f o       ( * 9 > C F H J M W W ` a f o :?[GIjq!#')*,269@YY_HJMPVXXZ]`Z_|v  6@S`lnprs w +0;@@DmptKP| EHMPWYY[[]]_} c j q t !!N!S!!#$$&$@$J$`&&&'''' ' ''')'K'M'M'O'R'V'V'X'^'a''''''''''++ +#,,.,0,^,`,l,t,w,,,-%-0-e-o-o------------------........////00?0A00011,1111111122 2C2P23MM !+@wף-0jp68<>>@ACDF?P #0RTfhkptv  &(:<=?MP]37 #0J 578<<??              3 8 : ? G P X #n$$b$p$s&*EV`qTVԜԞԟԢԢԥԦԩԬԮԹԻԻԽ  9;>@DFFJPR֥֨  jcodings-jcodings-1.0.11/resources/tables/CR_Age_5_1.bin000066400000000000000000000071001223451536200226730ustar00rootroot00000000000000wz~#1VY_a!^` JM  9 < M P T X r {        ( * 0 2 3 5 6 8 9 < < > B G H K M Q Q Y \ ^ ^ f u       ( * 0 2 3 5 9 < D G H K M V W \ ] _ c f q       ( * 3 5 9 = D F H J M U V X Y ` c f o x        ( * 9 = D F H J M W W ` c f u y  :?[GIlqY_HJMPVXXZ]`Z_|v  6@S`lnprs w +0;@@DmptKP|7;IM EHMPWYY[[]]_} d j q t !!O!S!!#$$&$@$J$`&&&&&'''' ' ''')'K'M'M'O'R'V'V'X'^'a''''''''''+L+P+T,,.,0,^,`,o,q,},,,-%-0-e-o-o-------------------.0....////00?0A00011-1111111122 2C2P23MM+@_bs|+@wS__6@MPY\_ף-0jp68<>>@ACDF?P &0RTfhkptv  &(:<=?MP]37 #0J 578<<??    9 ? ?          3 8 : ? G P X #n$$b$p$s&)EV`qTVԜԞԟԢԢԥԦԩԬԮԹԻԻԽ  9;>@DFFJPR֥֨+0  jcodings-jcodings-1.0.11/resources/tables/CR_Age_5_2.bin000066400000000000000000000076001223451536200227010ustar00rootroot00000000000000wz~%1VY_a!^` JM-0> 9 < N P U X r y        ( * 0 2 3 5 6 8 9 < < > B G H K M Q Q Y \ ^ ^ f u       ( * 0 2 3 5 9 < D G H K M V W \ ] _ c f q       ( * 3 5 9 = D F H J M U V X Y ` c f o x        ( * 9 = D F H J M W W ` c f u y  :?[GIlqHJMPVXXZ]`Z_|  6@S`lnprs w +0;@@Dmpt^`|KP|7;IM EHMPWYY[[]]_} d j q t !!!#$$&$@$J$`&&&&&&&'''' ' ''')'K'M'M'O'R'V'^'a''''''''''+L+P+Y,,.,0,^,`,,-%-0-e-o-o-------------------.1....////00?0A00011-1111111122 23MM+@_bs|+09@wS_|6@MPY\{ףװ-0mp68<>>@ACDF?P &0RTfhkptv  &(:<=?MP]37 #0J 578<<?UW_    9 ? ?          3 8 : ? G P X `   5 9 U X r x   H`~ #n$$b$p$s04.&)EV`qTVԜԞԟԢԢԥԦԩԬԮԹԻԻԽ  9;>@DFFJPR֥֨+0 .11==??BBFFJNWW__yy{|1@H4  jcodings-jcodings-1.0.11/resources/tables/CR_Age_6_0.bin000066400000000000000000000100001223451536200226640ustar00rootroot00000000000000wz~'1VY_a JM-0>@[^^ w y        ( * 0 2 3 5 6 8 9 < < > B G H K M Q Q Y \ ^ ^ f u       ( * 0 2 3 5 9 < D G H K M V W \ ] _ c f w       ( * 3 5 9 = D F H J M U V X Y ` c f o x        : = D F H J N W W ` c f u y  :?[GIlqHJMPVXXZ]`Z]|  6@S`lnprs w +0;@@Dmpt^`|KP|7;IM EHMPWYY[[]]_} d j q t !!!#$$&$@$J$`&'''''+L+P+Y,,.,0,^,`,,-%-0-e-o-p-------------------.1....////00?0A00011-1111111122 23MM+@s|+09@wS_|6@MPY\{  &(.ףװ-0mp68<>>@ACDF?P &0RTfhkptv  &(:<=?MP]37 #0J 578<<?UW_    9 ? ?          3 8 : ? G P X `   5 9 U X r x   H`~MRo #n$$b$p$s04.hj8&)EV`qTVԜԞԟԢԢԥԦԩԬԮԹԻԻԽ  9;>@DFFJPR֥֨+0 .0ip:@HPQ 057|>@@B=Pg %(+--035@EOs4@  jcodings-jcodings-1.0.11/resources/tables/CR_Alnum.bin000066400000000000000000000077601223451536200226230ustar00rootroot0000000000000009AZazEEptvwz}'1VYYa WYin?M,@X ; = L N P U c f o q w y        ( * 0 2 3 5 6 8 9 > B G H K L Q Q Y \ ^ ^ f u       ( * 0 2 3 5 9 = D G H K L V W \ ] _ c f o q q       ( * 3 5 9 = D F H J L U V X Y ` c f o       : = D F H J L N N W W ` c f o z  :@FMMPY )@GIlq688;IPbehnHJMPVXXZ]`Z__lo  3@S`lnprs w +08Fmpt ^at35CEKPY5@IM} EHMPWYY[[]]_} q q   !!!!! !!!!!!$!$!&!&!(!(!*!-!/!9!<!?!E!I!N!N!`!$$,,.,0,^,`,,,--%-0-e-o-o--------------------././000!0)0105080<0A000000011-11111114MN +@n" '@s*0R`|6@MPY`vzz  &(.ףװ-0mp(*68<>>@ACDF=Pptv!:AZf  &(:<=?MP]@t0J 578<<?U    9          3 ` |  5 @ U ` r  HEfo #n$$b04.hj8TVԜԞԟԢԢԥԦԩԬԮԹԻԻԽ  9;>@DFFJPR֥֨46NPnp׈׊רת4@jcodings-jcodings-1.0.11/resources/tables/CR_Alphabetic.bin000066400000000000000000000074701223451536200236010ustar00rootroot00000000000000AZazEEptvwz}'1VYYa WY_n?M,@X ; = L N P U c q w y        ( * 0 2 3 5 6 8 9 > B G H K L Q Q Y \ ^ ^ p u       ( * 0 2 3 5 9 = D G H K L V W \ ] _ c q q       ( * 3 5 9 = D F H J L U V X Y ` c       : = D F H J L N N W W ` c z  :@FMM@GIlq688;?PbehnHJMPVXXZ]`Z__lo  3@S`lnprs w +08Pmpt ^at35CEK5MOZ} EHMPWYY[[]]_} q q   !!!!! !!!!!!$!$!&!&!(!(!*!-!/!9!<!?!E!I!N!N!`!$$,,.,0,^,`,,,--%-0-e-o-o--------------------././000!0)0105080<0A000000011-11111114MN *+@n" '@s *0R`|6@M`vzz  &(.ףװ-0mp(*68<>>@ACDF=Pptv!:AZf  &(:<=?MP]@t0J 578<<?U    9          3 ` |  5 @ U ` r  HE #n$$b04.hj8TVԜԞԟԢԢԥԦԩԬԮԹԻԻԽ  9;>@DFFJPR֥֨46NPnp׈׊רת4@jcodings-jcodings-1.0.11/resources/tables/CR_Any.bin000066400000000000000000000000201223451536200222540ustar00rootroot00000000000000jcodings-jcodings-1.0.11/resources/tables/CR_Arabic.bin000066400000000000000000000002401223451536200227120ustar00rootroot00000000000000'   ?AJV^joqPP=Pptv`~jcodings-jcodings-1.0.11/resources/tables/CR_Armenian.bin000066400000000000000000000000601223451536200232630ustar00rootroot00000000000000 1VY_ajcodings-jcodings-1.0.11/resources/tables/CR_Assigned.bin000066400000000000000000000076601223451536200233030ustar00rootroot00000000000000wz~'1VY_a JM-0>@[^^ w y        ( * 0 2 3 5 6 8 9 < < > B G H K M Q Q Y \ ^ ^ f u       ( * 0 2 3 5 9 < D G H K M V W \ ] _ c f w       ( * 3 5 9 = D F H J M U V X Y ` c f o x        : = D F H J N W W ` c f u y  :?[GIlqHJMPVXXZ]`Z]|  6@S`lnprs w +0;@@Dmpt^`|KP|7;IM EHMPWYY[[]]_} d j q t !!!#$$&$@$J$`&'''''+L+P+Y,,.,0,^,`,,-%-0-e-o-p-------------------.1....////00?0A00011-1111111122 23MM+@s|+09@wS_|6@MPY\{  &(.ףװ-0mp68<>>@ACDF?P &0RTfhkptv  &(:<=?MP]37 #0J 578<<?UW_    9 ? ?          3 8 : ? G P X `   5 9 U X r x   H`~MRo #n$$b$p$s04.hj8&)EV`qTVԜԞԟԢԢԥԦԩԬԮԹԻԻԽ  9;>@DFFJPR֥֨+0 .0ip:@HPQ 057|>@@B=Pg %(+--035@EOs4@ jcodings-jcodings-1.0.11/resources/tables/CR_Avestan.bin000066400000000000000000000000301223451536200231270ustar00rootroot00000000000000  5 9 ?jcodings-jcodings-1.0.11/resources/tables/CR_Balinese.bin000066400000000000000000000000301223451536200232500ustar00rootroot00000000000000KP|jcodings-jcodings-1.0.11/resources/tables/CR_Bamum.bin000066400000000000000000000000301223451536200225670ustar00rootroot00000000000000hj8jcodings-jcodings-1.0.11/resources/tables/CR_Batak.bin000066400000000000000000000000301223451536200225500ustar00rootroot00000000000000jcodings-jcodings-1.0.11/resources/tables/CR_Bengali.bin000066400000000000000000000001701223451536200230740ustar00rootroot00000000000000 jcodings-jcodings-1.0.11/resources/tables/CR_Bidi_Control.bin000066400000000000000000000000301223451536200240750ustar00rootroot00000000000000   * .jcodings-jcodings-1.0.11/resources/tables/CR_Blank.bin000066400000000000000000000001201223451536200225550ustar00rootroot00000000000000  / / _ _00jcodings-jcodings-1.0.11/resources/tables/CR_Bopomofo.bin000066400000000000000000000000401223451536200233070ustar00rootroot0000000000000011-11jcodings-jcodings-1.0.11/resources/tables/CR_Brahmi.bin000066400000000000000000000000301223451536200227300ustar00rootroot00000000000000MRojcodings-jcodings-1.0.11/resources/tables/CR_Braille.bin000066400000000000000000000000201223451536200230770ustar00rootroot00000000000000((jcodings-jcodings-1.0.11/resources/tables/CR_Buginese.bin000066400000000000000000000000301223451536200232670ustar00rootroot00000000000000jcodings-jcodings-1.0.11/resources/tables/CR_Buhid.bin000066400000000000000000000000201223451536200225600ustar00rootroot00000000000000@Sjcodings-jcodings-1.0.11/resources/tables/CR_C.bin000066400000000000000000000002501223451536200217140ustar00rootroot00000000000000)  * . ` d j osz jcodings-jcodings-1.0.11/resources/tables/CR_Canadian_Aboriginal.bin000066400000000000000000000000301223451536200253530ustar00rootroot00000000000000jcodings-jcodings-1.0.11/resources/tables/CR_Carian.bin000066400000000000000000000000201223451536200227220ustar00rootroot00000000000000jcodings-jcodings-1.0.11/resources/tables/CR_Case_Ignorable.bin000066400000000000000000000042601223451536200243740ustar00rootroot00000000000000+''..::^^``otuzzYY@@K_pp0J-Y[  : : < < A H M M Q W b c q q   < < A B G H K M Q Q p q u u   < < ? ? A D M M V V b c > @ F H J M U V b c A D M M b c 114:FN557799q~-0279:=>XY^`qt]_24RSrs  CC "'(229;VVX^``bbels|446:<<BBks,367x},axx    $ $ ' ' * . ` d j o q q   ,},},,-o-o----././000*0/01050;0;0000 or|}!pp %&&-GQ).1256CCLLpp &RRUU>>@@pp       8 : ? ?8FgisтхыѪѭBD jcodings-jcodings-1.0.11/resources/tables/CR_Cased.bin000066400000000000000000000016101223451536200225520ustar00rootroot00000000000000pAZazEEpsvwz}'1Va EHMPWYY[[]]_} !!!!! !!!!!!$!$!&!&!(!(!*!-!/!4!9!9!<!?!E!I!N!N!`!!!$$,,.,0,^,`,,,--%@m"!:AZOTVԜԞԟԢԢԥԦԩԬԮԹԻԻԽ  9;>@DFFJPR֥֨46NPnp׈׊רתjcodings-jcodings-1.0.11/resources/tables/CR_Cc.bin000066400000000000000000000000301223451536200220530ustar00rootroot00000000000000jcodings-jcodings-1.0.11/resources/tables/CR_Cf.bin000066400000000000000000000002001223451536200220550ustar00rootroot00000000000000  * . ` d j osz jcodings-jcodings-1.0.11/resources/tables/CR_Cham.bin000066400000000000000000000000501223451536200224000ustar00rootroot00000000000000 6@MPY\_jcodings-jcodings-1.0.11/resources/tables/CR_Changes_When_Casefolded.bin000066400000000000000000000110201223451536200261710ustar00rootroot00000000000000AAZ      ""$$&&((**,,..0022446699;;==??AACCEEGGIJLLNNPPRRTTVVXXZZ\\^^``bbddffhhjjllnnpprrttvvxy{{}}      ""$$&&((**,,..0022:;=>AACFHHJJLLNNEEpprrvv/``bbddffhhjjllnnpprrttvvxxzz||~~      ""$$&&1V      ""$$&&((**,,..0022446688::<<>>@@BBDDFFHHJJLLNNPPRRTTVVXXZZ\\^^``bbddffhhjjllnnpprrttvvxxzz||~~(/8?HMYY[[]]__ho!&!&!*!+!2!2!`!o!!$$,,.,`,`,b,d,g,g,i,i,k,k,m,p,r,r,u,u,~,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,@@BBDDFFHHJJLLNNPPRRTTVVXXZZ\\^^``bbddffhhjjll""$$&&((**,,..22446688::<<>>@@BBDDFFHHJJLLNNPPRRTTVVXXZZ\\^^``bbddffhhjjllnnyy{{}~!:'jcodings-jcodings-1.0.11/resources/tables/CR_Changes_When_Casemapped.bin000066400000000000000000000014401223451536200262070ustar00rootroot00000000000000cAZaz79 "3:TVWYY[[``cceehikkooqruu}}EEpsvw{}'1Vayy}} EHMPWYY[[]]_}!&!&!*!+!2!2!N!N!`!!!$$,,.,0,^,`,p,r,s,u,v,~,,,--%@m"/2oy!:AZOjcodings-jcodings-1.0.11/resources/tables/CR_Changes_When_Lowercased.bin000066400000000000000000000106701223451536200262420ustar00rootroot00000000000000m6AZ      ""$$&&((**,,..0022446699;;==??AACCEEGGJJLLNNPPRRTTVVXXZZ\\^^``bbddffhhjjllnnpprrttvvxy{{}}      ""$$&&((**,,..0022:;=>AACFHHJJLLNNpprrvv/``bbddffhhjjllnnpprrttvvxxzz||~~      ""$$&&1V      ""$$&&((**,,..0022446688::<<>>@@BBDDFFHHJJLLNNPPRRTTVVXXZZ\\^^``bbddffhhjjllnnpprrttvvxxzz||~~(/8?HMYY[[]]__ho!&!&!*!+!2!2!`!o!!$$,,.,`,`,b,d,g,g,i,i,k,k,m,p,r,r,u,u,~,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,@@BBDDFFHHJJLLNNPPRRTTVVXXZZ\\^^``bbddffhhjjll""$$&&((**,,..22446688::<<>>@@BBDDFFHHJJLLNNPPRRTTVVXXZZ\\^^``bbddffhhjjllnnyy{{}~!:'jcodings-jcodings-1.0.11/resources/tables/CR_Changes_When_Titlecased.bin000066400000000000000000000111001223451536200262200ustar00rootroot00000000000000Gaz      !!##%%''))++--//11335577::<<>>@@BBDDFFHIKKMMOOQQSSUUWWYY[[]]__aacceeggiikkmmooqqssuuwwzz||~      ##%%''))++--//1133<<?@BBGGIIKKMMOTVWYY[[``cceehikkooqruu}}EEqqssww{}0_aacceeggiikkmmooqqssuuwwyy{{}}      !!##%%''ayy}}      !!##%%''))++--//1133557799;;==??AACCEEGGIIKKMMOOQQSSUUWWYY[[]]__aacceeggiikkmmooqqssuuwwyy{{}} '07@EPW`gp}!N!N!p!!!$$,0,^,a,a,e,f,h,h,j,j,l,l,s,s,v,v,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,--%AACCEEGGIIKKMMOOQQSSUUWWYY[[]]__aacceeggiikkmm##%%''))++--//33557799;;==??AACCEEGGIIKKMMOOQQSSUUWWYY[[]]__aacceeggiikkmmoozz||AZ(Ojcodings-jcodings-1.0.11/resources/tables/CR_Changes_When_Uppercased.bin000066400000000000000000000110701223451536200262400ustar00rootroot00000000000000Faz      !!##%%''))++--//11335577::<<>>@@BBDDFFHIKKMMOOQQSSUUWWYY[[]]__aacceeggiikkmmooqqssuuwwzz||~      ##%%''))++--//1133<<?@BBGGIIKKMMOTVWYY[[``cceehikkooqruu}}EEqqssww{}0_aacceeggiikkmmooqqssuuwwyy{{}}      !!##%%''ayy}}      !!##%%''))++--//1133557799;;==??AACCEEGGIIKKMMOOQQSSUUWWYY[[]]__aacceeggiikkmmooqqssuuwwyy{{}} '07@EPW`gp}!N!N!p!!!$$,0,^,a,a,e,f,h,h,j,j,l,l,s,s,v,v,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,--%AACCEEGGIIKKMMOOQQSSUUWWYY[[]]__aacceeggiikkmm##%%''))++--//33557799;;==??AACCEEGGIIKKMMOOQQSSUUWWYY[[]]__aacceeggiikkmmoozz||AZ(Ojcodings-jcodings-1.0.11/resources/tables/CR_Cherokee.bin000066400000000000000000000000201223451536200232520ustar00rootroot00000000000000jcodings-jcodings-1.0.11/resources/tables/CR_Cn.bin000066400000000000000000000076601223451536200221060ustar00rootroot00000000000000xy(0WX``KL./??\]_ x x      ) ) 1 1 4 4 7 7 : ; = = C F I J N P R X ] ] _ e v      ) ) 1 1 4 4 : ; E F I J N U X [ ^ ^ d e x     ) ) 4 4 : < E E I I N T W W Z _ d e p w      ; < E E I I O V X _ d e v x ;>\HHmpIINOWWYY^_[\}  7?T_mmqqtx,/<?ACnou__}~LO}8:JLFGNOXXZZ\\^^~ e i r s !!##$'$?$K$_''''''+M+O+Z+,/,/,_,_,,-&-/-f-n-q-~------------------.2.....////0@0@00111.101111112222MM,?t{,/:?xT^}7?NOZ[|''/פׯ./no77==??BBEE@O'/SSgglouu  '';;>>NO^46$/K  669;=>VV`   : > @          4 7 ; > H O Y _   6 8 V W s w   I_NQp#o#$c$o$t/4/gj9'(FW_rUUԝԝԠԡԣԤԧԨԭԭԺԺԼԼ  ::??EEGIQQ֦֧,/ //jo;?IOR!/66}??AA>Oh&',,./44ADPt5?jcodings-jcodings-1.0.11/resources/tables/CR_Co.bin000066400000000000000000000000401223451536200220700ustar00rootroot00000000000000jcodings-jcodings-1.0.11/resources/tables/CR_Common.bin000066400000000000000000000025201223451536200227640ustar00rootroot00000000000000S@[`{tt~~  @@`i d e p p??56  d j p t ~ !!%!'!)!,!1!3!M!O!_!!!#$$&$@$J$`&'''''')+L+P+Y..1//000000 00070<0?00000011112 2_223X3MM!09>?0RTfhk ;@[epp37?&)fjzуфьѩѮV`qTVԜԞԟԢԢԥԦԩԬԮԹԻԻԽ  9;>@DFFJPR֥֨+0 .0ip:@HPQ 057|>@@B=Pg %(+--035@EOs jcodings-jcodings-1.0.11/resources/tables/CR_Coptic.bin000066400000000000000000000000401223451536200227500ustar00rootroot00000000000000,,,,jcodings-jcodings-1.0.11/resources/tables/CR_Cs.bin000066400000000000000000000000201223451536200220720ustar00rootroot00000000000000jcodings-jcodings-1.0.11/resources/tables/CR_Cuneiform.bin000066400000000000000000000000401223451536200234560ustar00rootroot00000000000000 #n$$b$p$sjcodings-jcodings-1.0.11/resources/tables/CR_Cypriot.bin000066400000000000000000000000701223451536200231630ustar00rootroot00000000000000  578<<??jcodings-jcodings-1.0.11/resources/tables/CR_Cyrillic.bin000066400000000000000000000001001223451536200232760ustar00rootroot00000000000000'++xx--@s|jcodings-jcodings-1.0.11/resources/tables/CR_Dash.bin000066400000000000000000000002401223451536200224100ustar00rootroot00000000000000'--   S S { { ""....0000000012XXcc jcodings-jcodings-1.0.11/resources/tables/CR_Default_Ignorable_Code_Point.bin000066400000000000000000000002001223451536200271760ustar00rootroot00000000000000OO_`   * . ` o1d1dszjcodings-jcodings-1.0.11/resources/tables/CR_Deprecated.bin000066400000000000000000000001201223451536200235660ustar00rootroot00000000000000 IIsswwyy j o#)#* jcodings-jcodings-1.0.11/resources/tables/CR_Deseret.bin000066400000000000000000000000201223451536200231200ustar00rootroot00000000000000Ojcodings-jcodings-1.0.11/resources/tables/CR_Devanagari.bin000066400000000000000000000000701223451536200235730ustar00rootroot00000000000000  P S c f o q w y jcodings-jcodings-1.0.11/resources/tables/CR_Diacritic.bin000066400000000000000000000016601223451536200234330ustar00rootroot00000000000000u^^``NPW]btuzzYYKRWX0J < < M M Q T q q < < M M < < M M M M M M GLNN557799>?779:9;u|44DDks67x},j,,././0*0/0000oo|}!+.SS{{ &>>@@ppgimr{тхыѪѭjcodings-jcodings-1.0.11/resources/tables/CR_Egyptian_Hieroglyphs.bin000066400000000000000000000000201223451536200256620ustar00rootroot0000000000000004.jcodings-jcodings-1.0.11/resources/tables/CR_Ethiopic.bin000066400000000000000000000004101223451536200232740ustar00rootroot00000000000000A HJMPVXXZ]`Z]|------------------  &(.jcodings-jcodings-1.0.11/resources/tables/CR_Extender.bin000066400000000000000000000002501223451536200233100ustar00rootroot00000000000000)@@FFCC66{{0001050000 ppppjcodings-jcodings-1.0.11/resources/tables/CR_Georgian.bin000066400000000000000000000000501223451536200232630ustar00rootroot00000000000000 --%jcodings-jcodings-1.0.11/resources/tables/CR_Glagolitic.bin000066400000000000000000000000301223451536200236040ustar00rootroot00000000000000,,.,0,^jcodings-jcodings-1.0.11/resources/tables/CR_Gothic.bin000066400000000000000000000000201223451536200227420ustar00rootroot000000000000000Jjcodings-jcodings-1.0.11/resources/tables/CR_Graph.bin000066400000000000000000000077301223451536200226050ustar00rootroot00000000000000!~wz~'1VY_a JM-0>@[^^ w y        ( * 0 2 3 5 6 8 9 < < > B G H K M Q Q Y \ ^ ^ f u       ( * 0 2 3 5 9 < D G H K M V W \ ] _ c f w       ( * 3 5 9 = D F H J M U V X Y ` c f o x        : = D F H J N W W ` c f u y  :?[GIlqHJMPVXXZ]`Z]|  6@S`lnprs  w +0;@@Dmpt^`|KP|7;IM EHMPWYY[[]]_} ' * . 0 ^ ` d j q t !!!#$$&$@$J$`&'''''+L+P+Y,,.,0,^,`,,-%-0-e-o-p-------------------.1....////00?0A00011-1111111122 23MM+@s|+09@wS_|6@MPY\{  &(.ףװ-0mp68<>>@ACDF?P &0RTfhkptv  &(:<=?MP]37 #0J 578<<?UW_    9 ? ?          3 8 : ? G P X `   5 9 U X r x   H`~MRo #n$$b$p$s04.hj8&)EV`qTVԜԞԟԢԢԥԦԩԬԮԹԻԻԽ  9;>@DFFJPR֥֨+0 .0ip:@HPQ 057|>@@B=Pg %(+--035@EOs4@ jcodings-jcodings-1.0.11/resources/tables/CR_Grapheme_Base.bin000066400000000000000000000112501223451536200242160ustar00rootroot00000000000000T ~pwz~'1VY_aJ`oq /M$$((0>@X^^  9 ; ; = @ I L N P X a d w y        ( * 0 2 3 5 6 8 9 > @ Y \ ^ ^ f o r t       ( * 0 2 3 5 9 = = @ @ G H K L \ ] _ a f w       ( * 3 5 9 = = A D X Y ` a f o x        : = = ? @ F H J L N N ` a f u y  023?FO[46688:GIl,1188;<?WZ]apuHJMPVXXZ]`Z`|  156@Q`lnp  w#&)+0138@@DmptUWWaacdmr355;;=ACKPjt|+45;IM EHMPWYY[[]]_}  ' / _ p q t !!!#$$&$@$J$`&'''''+L+P+Y,,.,0,^,`,,-%-0-e-o-p------------------..1....////00)000?0A00011-1111111122 23MM+@nss~ $'+09@w%.FRS_|(/034@BDKMMPY\{  &(.ףװ-0mp68<>>@ACDF?P0RTfhkptv  &(:<=?MP]37 #0J 578<<?UW_    9 ? ?        3 @ G P X `   5 9 U X r x   H`~7GMRo #n$$b$p$s04.hj8&)dffjmуфьѩѮAEEV`qTVԜԞԟԢԢԥԦԩԬԮԹԻԻԽ  9;>@DFFJPR֥֨+0 .0ip:@HPQ 057|>@@B=Pg %(+--035@EOs4@jcodings-jcodings-1.0.11/resources/tables/CR_Grapheme_Extend.bin000066400000000000000000000033001223451536200245700ustar00rootroot00000000000000oK_pp0J#%')-Y[  : : < < A H M M Q W b c   < < A B G H K M Q Q p q u u   < < > ? A D M M V W b c > @ F H J M U V b c > > A D M M W W b c 114:GN557799q~-0279:=>XY^`qt]_24RSrs   "'(229;VVX^``bbels|446:<<BBks,367 ,,----0*0/00or|} %&&-GQ).1256CCLL &       8 : ? ?8Feeginr{тхыѪѭBDjcodings-jcodings-1.0.11/resources/tables/CR_Grapheme_Link.bin000066400000000000000000000003601223451536200242410ustar00rootroot00000000000000; M M M M M M M M M M ::9:44``DD--SS ? ?FFjcodings-jcodings-1.0.11/resources/tables/CR_Greek.bin000066400000000000000000000004201223451536200225660ustar00rootroot00000000000000C!psuwz}&*]afj EHMPWYY[[]]_}!&!&@Ejcodings-jcodings-1.0.11/resources/tables/CR_Gujarati.bin000066400000000000000000000001701223451536200233010ustar00rootroot00000000000000 jcodings-jcodings-1.0.11/resources/tables/CR_Gurmukhi.bin000066400000000000000000000002101223451536200233210ustar00rootroot00000000000000!       ( * 0 2 3 5 6 8 9 < < > B G H K M Q Q Y \ ^ ^ f ujcodings-jcodings-1.0.11/resources/tables/CR_Han.bin000066400000000000000000000002101223451536200222340ustar00rootroot00000000000000!....//00000!0)080;4MN-0mp4@jcodings-jcodings-1.0.11/resources/tables/CR_Hangul.bin000066400000000000000000000001701223451536200227510ustar00rootroot000000000000000.0/111222`2~`|ףװjcodings-jcodings-1.0.11/resources/tables/CR_Hanunoo.bin000066400000000000000000000000201223451536200231340ustar00rootroot00000000000000 4jcodings-jcodings-1.0.11/resources/tables/CR_Hebrew.bin000066400000000000000000000001201223451536200227420ustar00rootroot00000000000000 68<>>@ACDFOjcodings-jcodings-1.0.11/resources/tables/CR_Hex_Digit.bin000066400000000000000000000000701223451536200233760ustar00rootroot00000000000000 09AFaf!&AFjcodings-jcodings-1.0.11/resources/tables/CR_Hiragana.bin000066400000000000000000000000501223451536200232420ustar00rootroot00000000000000 0A000jcodings-jcodings-1.0.11/resources/tables/CR_Hyphen.bin000066400000000000000000000001301223451536200227620ustar00rootroot00000000000000 --  ..00cc eejcodings-jcodings-1.0.11/resources/tables/CR_IDS_Binary_Operator.bin000066400000000000000000000000301223451536200253240ustar00rootroot00000000000000////jcodings-jcodings-1.0.11/resources/tables/CR_IDS_Trinary_Operator.bin000066400000000000000000000000201223451536200255270ustar00rootroot00000000000000//jcodings-jcodings-1.0.11/resources/tables/CR_ID_Continue.bin000066400000000000000000000100301223451536200236670ustar00rootroot0000000000000009AZ__aztvwz}'1VYYa inJM-@[ c f o q w y        ( * 0 2 3 5 6 8 9 < < > B G H K M Q Q Y \ ^ ^ f u       ( * 0 2 3 5 9 < D G H K M V W \ ] _ c f o q q       ( * 3 5 9 = D F H J M U V X Y ` c f o       : = D F H J N W W ` c f o z  :@NPY )557799>GIlqIPHJMPVXXZ]`Z]_iqlo  4@S`lnprs   w +0;Fmpt ^`|KPYks7@IM} EHMPWYY[[]]_} ? @ T T q q   !!!!! !!!!!!$!$!&!&!(!(!*!9!<!?!E!I!N!N!`!,,.,0,^,`,,,--%-0-e-o-o--------------------000!0/0105080<0A000000011-11111114MN +@o|}"'@s-0S`|6@MPY`vz{  &(.ףװ-0mp(*68<>>@ACDF=P &34MOptv!:??AZf  &(:<=?MP]@t0J 578<<?U    9          3 8 : ? ? ` |  5 @ U ` r  HFfo #n$$b04.hj8eimr{тхыѪѭBDTVԜԞԟԢԢԥԦԩԬԮԹԻԻԽ  9;>@DFFJPR֥֨46NPnp׈׊רת4@jcodings-jcodings-1.0.11/resources/tables/CR_ID_Start.bin000066400000000000000000000066601223451536200232160ustar00rootroot00000000000000kAZazptvwz}'1VYYa Jnoq/M$$((@X  9 = = P P X a q w y      ( * 0 2 3 5 6 8 9 Y \ ^ ^ r t     ( * 0 2 3 5 9 = = \ ] _ a q q     ( * 3 5 9 = = X Y ` a     : = = N N ` a z  023@F@GIl*??PUZ]aaefnpuHJMPVXXZ]`Zlo  1@Q`lnp wPmpt T3EK#MOZ} EHMPWYY[[]]_} q q   !!!!! !!!!!!$!$!&!&!(!(!*!9!<!?!E!I!N!N!`!,,.,0,^,`,,,--%-0-e-o-o------------------000!0)0105080<0A000000011-11111114MN *+@n" "@s %0F`|(@BDK`vzz  &(.ףװ-0mp(*68<>>@ACDF=Pptv!:AZf  &(:<=?MP]@t0J 578<<?U    9        3 ` |  5 @ U ` r  H7 #n$$b04.hj8TVԜԞԟԢԢԥԦԩԬԮԹԻԻԽ  9;>@DFFJPR֥֨46NPnp׈׊רת4@jcodings-jcodings-1.0.11/resources/tables/CR_Ideographic.bin000066400000000000000000000001501223451536200237470ustar00rootroot00000000000000 000!0)080:4MN-0mp4@jcodings-jcodings-1.0.11/resources/tables/CR_Imperial_Aramaic.bin000066400000000000000000000000301223451536200247050ustar00rootroot00000000000000@UW_jcodings-jcodings-1.0.11/resources/tables/CR_Inherited.bin000066400000000000000000000003101223451536200234420ustar00rootroot000000000000001oKU__pp Q R 0*0-00 &gi{тхыѪѭjcodings-jcodings-1.0.11/resources/tables/CR_Inscriptional_Pahlavi.bin000066400000000000000000000000301223451536200260100ustar00rootroot00000000000000 ` r x jcodings-jcodings-1.0.11/resources/tables/CR_Inscriptional_Parthian.bin000066400000000000000000000000301223451536200261720ustar00rootroot00000000000000 @ U X _jcodings-jcodings-1.0.11/resources/tables/CR_Javanese.bin000066400000000000000000000000401223451536200232630ustar00rootroot00000000000000jcodings-jcodings-1.0.11/resources/tables/CR_Join_Control.bin000066400000000000000000000000201223451536200241240ustar00rootroot00000000000000 jcodings-jcodings-1.0.11/resources/tables/CR_Kaithi.bin000066400000000000000000000000201223451536200227360ustar00rootroot00000000000000jcodings-jcodings-1.0.11/resources/tables/CR_Kannada.bin000066400000000000000000000001701223451536200230700ustar00rootroot00000000000000 jcodings-jcodings-1.0.11/resources/tables/CR_Katakana.bin000066400000000000000000000001101223451536200232400ustar00rootroot000000000000000000112233Wfoqjcodings-jcodings-1.0.11/resources/tables/CR_Kayah_Li.bin000066400000000000000000000000201223451536200232060ustar00rootroot00000000000000/jcodings-jcodings-1.0.11/resources/tables/CR_Kharoshthi.bin000066400000000000000000000001101223451536200236310ustar00rootroot00000000000000          3 8 : ? G P Xjcodings-jcodings-1.0.11/resources/tables/CR_Khmer.bin000066400000000000000000000000501223451536200225760ustar00rootroot00000000000000 jcodings-jcodings-1.0.11/resources/tables/CR_L.bin000066400000000000000000000066401223451536200217360ustar00rootroot00000000000000gAZazptvwz}'1VYYa Jnoq/M$$((@X  9 = = P P X a q w y      ( * 0 2 3 5 6 8 9 Y \ ^ ^ r t     ( * 0 2 3 5 9 = = \ ] _ a q q     ( * 3 5 9 = = X Y ` a     : = = N N ` a z  023@F@GIl*??PUZ]aaefnpuHJMPVXXZ]`Zlo  1@Q`lnp wPmpt T3EK#MOZ} EHMPWYY[[]]_} q q   !!!!! !!!!!!$!$!&!&!(!(!*!-!/!9!<!?!E!I!N!N!!,,.,0,^,`,,,--%-0-e-o-o------------------././0001050;0<0A000000011-11111114MN *+@n" "@s %0F`|(@BDK`vzz  &(.ףװ-0mp(*68<>>@ACDF=Pptv!:AZf  &(:<=?MP]0@BI 578<<?U    9        3 ` |  5 @ U ` r  H7 #n04.hj8TVԜԞԟԢԢԥԦԩԬԮԹԻԻԽ  9;>@DFFJPR֥֨46NPnp׈׊רת4@jcodings-jcodings-1.0.11/resources/tables/CR_Lao.bin000066400000000000000000000002301223451536200222430ustar00rootroot00000000000000%jcodings-jcodings-1.0.11/resources/tables/CR_Latin.bin000066400000000000000000000003701223451536200226040ustar00rootroot00000000000000=AZaz%,\bekwy q q   !*!+!2!2!N!N!`!,`,"!:AZjcodings-jcodings-1.0.11/resources/tables/CR_Lepcha.bin000066400000000000000000000000401223451536200227230ustar00rootroot000000000000007;IMOjcodings-jcodings-1.0.11/resources/tables/CR_Limbu.bin000066400000000000000000000000601223451536200226010ustar00rootroot00000000000000  +0;@@DOjcodings-jcodings-1.0.11/resources/tables/CR_Linear_B.bin000066400000000000000000000001001223451536200231770ustar00rootroot00000000000000  &(:<=?MP]jcodings-jcodings-1.0.11/resources/tables/CR_Lisu.bin000066400000000000000000000000201223451536200224410ustar00rootroot00000000000000jcodings-jcodings-1.0.11/resources/tables/CR_Ll.bin000066400000000000000000000114201223451536200221020ustar00rootroot00000000000000aaz      !!##%%''))++--//11335578::<<>>@@BBDDFFHIKKMMOOQQSSUUWWYY[[]]__aacceeggiikkmmooqqssuuwwzz||~      !!##%%''))++--//1139<<?@BBGGIIKKMMOqqssww{}0_aacceeggiikkmmooqqssuuwwyy{{}}      !!##%%''a+bwy      !!##%%''))++--//1133557799;;==??AACCEEGGIIKKMMOOQQSSUUWWYY[[]]__aacceeggiikkmmooqqssuuwwyy{{}} '07@EPW`gp}! ! !!!!!/!/!4!4!9!9!<!=!F!I!N!N!!,0,^,a,a,e,f,h,h,j,j,l,l,q,q,s,t,v,|,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,--%AACCEEGGIIKKMMOOQQSSUUWWYY[[]]__aacceeggiikkmm##%%''))++--/133557799;;==??AACCEEGGIIKKMMOOQQSSUUWWYY[[]]__aacceeggiikkmmooqxzz||AZ(O3NTVgԂԛԶԹԻԻԽ7RkՆ՟պ";Vo֊֥6NPUp׈׊׏תjcodings-jcodings-1.0.11/resources/tables/CR_Lm.bin000066400000000000000000000006201223451536200221030ustar00rootroot00000000000000c1ttzzYY@@$$(( q qFFCCx},axx q q   ,},}-o-o././0001050;0;0000 ppppppjcodings-jcodings-1.0.11/resources/tables/CR_Lo.bin000066400000000000000000000050401223451536200221060ustar00rootroot00000000000000C ?AJnoq/M@X  9 = = P P X a r w y      ( * 0 2 3 5 6 8 9 Y \ ^ ^ r t     ( * 0 2 3 5 9 = = \ ] _ a q q     ( * 3 5 9 = = X Y ` a     : = = N N ` a z  023@E@GIl*??PUZ]aaefnpuHJMPVXXZ]`Zlo  1@Q`lnp BDwPmpt T3EK#MOZw!5!8-0-e------------------000<0<0A000000011-11111114MN *+nn "@s %0F`|(@BDK`oqvzz  &(.ףװ-0mp(*68<>>@ACDF=Pptvfoq  &(:<=?MP]0@BIP 578<<?U    9        3 ` |  5 @ U ` r  H7 #n04.hj84@jcodings-jcodings-1.0.11/resources/tables/CR_Logical_Order_Exception.bin000066400000000000000000000000601223451536200262540ustar00rootroot00000000000000 @Djcodings-jcodings-1.0.11/resources/tables/CR_Lowercase.bin000066400000000000000000000114501223451536200234620ustar00rootroot00000000000000daz      !!##%%''))++--//11335578::<<>>@@BBDDFFHIKKMMOOQQSSUUWWYY[[]]__aacceeggiikkmmooqqssuuwwzz||~      !!##%%''))++--//1139<<?@BBGGIIKKMMOEEqqsswwz}0_aacceeggiikkmmooqqssuuwwyy{{}}      !!##%%''a      !!##%%''))++--//1133557799;;==??AACCEEGGIIKKMMOOQQSSUUWWYY[[]]__aacceeggiikkmmooqqssuuwwyy{{}} '07@EPW`gp} ! ! !!!!!/!/!4!4!9!9!<!=!F!I!N!N!p!!!$$,0,^,a,a,e,f,h,h,j,j,l,l,q,q,s,t,v,},,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,--%AACCEEGGIIKKMMOOQQSSUUWWYY[[]]__aacceeggiikkmm##%%''))++--/133557799;;==??AACCEEGGIIKKMMOOQQSSUUWWYY[[]]__aacceeggiikkmmoxzz||AZ(O3NTVgԂԛԶԹԻԻԽ7RkՆ՟պ";Vo֊֥6NPUp׈׊׏תjcodings-jcodings-1.0.11/resources/tables/CR_Lt.bin000066400000000000000000000001301223451536200221060ustar00rootroot00000000000000 jcodings-jcodings-1.0.11/resources/tables/CR_Lu.bin000066400000000000000000000113401223451536200221140ustar00rootroot00000000000000[AZ      ""$$&&((**,,..0022446699;;==??AACCEEGGJJLLNNPPRRTTVVXXZZ\\^^``bbddffhhjjllnnpprrttvvxy{{}}      ""$$&&((**,,..0022:;=>AACFHHJJLLNNpprrvv/``bbddffhhjjllnnpprrttvvxxzz||~~      ""$$&&1V      ""$$&&((**,,..0022446688::<<>>@@BBDDFFHHJJLLNNPPRRTTVVXXZZ\\^^``bbddffhhjjllnnpprrttvvxxzz||~~(/8?HMYY[[]]__ho!!!!! ! !!!!!!!$!$!&!&!(!(!*!-!0!3!>!?!E!E!!,,.,`,`,b,d,g,g,i,i,k,k,m,p,r,r,u,u,~,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,@@BBDDFFHHJJLLNNPPRRTTVVXXZZ\\^^``bbddffhhjjll""$$&&((**,,..22446688::<<>>@@BBDDFFHHJJLLNNPPRRTTVVXXZZ\\^^``bbddffhhjjllnnyy{{}~!:'4MhԁԜԜԞԟԢԢԥԦԩԬԮԵ  89;>@DFFJPlՅՠչ!<Up։֨4Vnארjcodings-jcodings-1.0.11/resources/tables/CR_Lycian.bin000066400000000000000000000000201223451536200227440ustar00rootroot00000000000000jcodings-jcodings-1.0.11/resources/tables/CR_Lydian.bin000066400000000000000000000000301223451536200227460ustar00rootroot00000000000000  9 ? ?jcodings-jcodings-1.0.11/resources/tables/CR_M.bin000066400000000000000000000030201223451536200217240ustar00rootroot00000000000000oK_pp0J#%')-Y[  : < > O Q W b c   < < > B G H K M Q Q p q u u   < < > D G H K M V W b c   > D F H J M U V b c   > D F H J M W W b c 114:GN557799>?q+>VY^`bdgmqt]_24RSrs   +0;U^`|4Dks$7 ,,----0*0/00or|} #'&-GS)6CCLM{{ &       8 : ? ?8Feimr{тхыѪѭBDjcodings-jcodings-1.0.11/resources/tables/CR_Malayalam.bin000066400000000000000000000001401223451536200234260ustar00rootroot00000000000000       : = D F H J N W W ` c f u y jcodings-jcodings-1.0.11/resources/tables/CR_Mandaic.bin000066400000000000000000000000301223451536200230620ustar00rootroot00000000000000@[^^jcodings-jcodings-1.0.11/resources/tables/CR_Math.bin000066400000000000000000000015301223451536200224250ustar00rootroot00000000000000j++<>^^||~~   2 4 @ @ D D R R a d z ~ !!!!! !!!!!!$!$!(!)!,!-!/!1!3!8!<!I!K!K!!!!!!!!!!!!!!!"## # #!#|#|########%%%%%%%%%%%%%%%%%%%%&&&@&@&B&B&`&c&m&o'''''')*+0+D+G+L))afhh <<>>\\^^TVԜԞԟԢԢԥԦԩԬԮԹԻԻԽ  9;>@DFFJPR֥֨jcodings-jcodings-1.0.11/resources/tables/CR_Mc.bin000066400000000000000000000016201223451536200220730ustar00rootroot00000000000000q   ; ; > @ I L N O   > @   > > @ @ G H K L W W   A D   > @ F H J L W W >?+,1188;<VWbdgm#&)+0138UUWWaacdmr55;;=ACD$+45#$''RS/034MM{{efmrjcodings-jcodings-1.0.11/resources/tables/CR_Me.bin000066400000000000000000000000501223451536200220710ustar00rootroot00000000000000  prjcodings-jcodings-1.0.11/resources/tables/CR_Meetei_Mayek.bin000066400000000000000000000000301223451536200240640ustar00rootroot00000000000000jcodings-jcodings-1.0.11/resources/tables/CR_Mn.bin000066400000000000000000000031401223451536200221050ustar00rootroot00000000000000oK_pp0J#%')-Y[  : : < < A H M M Q W b c   < < A B G H K M Q Q p q u u   < < ? ? A D M M V V b c > @ F H J M U V b c A D M M b c 114:GN557799q~-0279:=>XY^`qt]_24RSrs   "'(229;VVX^``bbels|446:<<BBks,367 ,,----0*0/00oo|} %&&-GQ).1256CCLL &       8 : ? ?8Fgi{тхыѪѭBDjcodings-jcodings-1.0.11/resources/tables/CR_Mongolian.bin000066400000000000000000000000701223451536200234550ustar00rootroot00000000000000  wjcodings-jcodings-1.0.11/resources/tables/CR_Myanmar.bin000066400000000000000000000000301223451536200231320ustar00rootroot00000000000000`{jcodings-jcodings-1.0.11/resources/tables/CR_N.bin000066400000000000000000000012401223451536200217270ustar00rootroot00000000000000S09`i f o f o f o r w f o x ~ f uPY 3@Ii|FOPY@IPY p p t y !P!!!$`$$$'v',,000!0)080:112 2)2Q2_2222 )05 PY3@x #AAJJX_   @ G } ~ X _ x `~Ro$$b`q jcodings-jcodings-1.0.11/resources/tables/CR_NEWLINE.bin000066400000000000000000000000201223451536200226260ustar00rootroot00000000000000 jcodings-jcodings-1.0.11/resources/tables/CR_Nd.bin000066400000000000000000000004701223451536200220770ustar00rootroot00000000000000M&09`i f o f o f o f o f oPY )@IFOPY@IPY ) PYfojcodings-jcodings-1.0.11/resources/tables/CR_New_Tai_Lue.bin000066400000000000000000000000501223451536200236630ustar00rootroot00000000000000 jcodings-jcodings-1.0.11/resources/tables/CR_Nko.bin000066400000000000000000000000201223451536200222540ustar00rootroot00000000000000jcodings-jcodings-1.0.11/resources/tables/CR_Nl.bin000066400000000000000000000001501223451536200221020ustar00rootroot00000000000000 !`!!!000!0)080:@tAAJJ$$bjcodings-jcodings-1.0.11/resources/tables/CR_No.bin000066400000000000000000000005201223451536200221060ustar00rootroot00000000000000S) r w x ~ p u*3i| p p t y !P!_!!$`$$$'v',,112 2)2Q2_2222053ux #X_   @ G } ~ X _ x `~Re`q jcodings-jcodings-1.0.11/resources/tables/CR_Noncharacter_Code_Point.bin000066400000000000000000000002301223451536200262420ustar00rootroot00000000000000% jcodings-jcodings-1.0.11/resources/tables/CR_Ogham.bin000066400000000000000000000000201223451536200225600ustar00rootroot00000000000000jcodings-jcodings-1.0.11/resources/tables/CR_Ol_Chiki.bin000066400000000000000000000000201223451536200232060ustar00rootroot00000000000000Pjcodings-jcodings-1.0.11/resources/tables/CR_Old_Italic.bin000066400000000000000000000000301223451536200235310ustar00rootroot00000000000000 #jcodings-jcodings-1.0.11/resources/tables/CR_Old_Persian.bin000066400000000000000000000000301223451536200237250ustar00rootroot00000000000000jcodings-jcodings-1.0.11/resources/tables/CR_Old_South_Arabian.bin000066400000000000000000000000201223451536200250420ustar00rootroot00000000000000 ` jcodings-jcodings-1.0.11/resources/tables/CR_Old_Turkic.bin000066400000000000000000000000201223451536200235640ustar00rootroot00000000000000  Hjcodings-jcodings-1.0.11/resources/tables/CR_Oriya.bin000066400000000000000000000001701223451536200226160ustar00rootroot00000000000000       ( * 0 2 3 5 9 < D G H K M V W \ ] _ c f wjcodings-jcodings-1.0.11/resources/tables/CR_Osmanya.bin000066400000000000000000000000301223451536200231350ustar00rootroot00000000000000jcodings-jcodings-1.0.11/resources/tables/CR_Other_Alphabetic.bin000066400000000000000000000022201223451536200247260ustar00rootroot00000000000000#EEKWY_pp0?#%'),  : ; > L N O U W b c   > B G H K L Q Q p q u u   > D G H K L V W b c   > D F H J L U V b c   > D F H J L W W b c 114:MMq+688;>VY^`bbghqt__23RSrs +08U^at5C$5$$--#'&*GR)6CCLM      8Ejcodings-jcodings-1.0.11/resources/tables/CR_Other_Default_Ignorable_Code_Point.bin000066400000000000000000000001301223451536200303410ustar00rootroot00000000000000 OO_` e i1d1djcodings-jcodings-1.0.11/resources/tables/CR_Other_Grapheme_Extend.bin000066400000000000000000000002101223451536200257260ustar00rootroot00000000000000! > > W W > > W W eenrjcodings-jcodings-1.0.11/resources/tables/CR_Other_ID_Continue.bin000066400000000000000000000000501223451536200250310ustar00rootroot00000000000000 iqjcodings-jcodings-1.0.11/resources/tables/CR_Other_ID_Start.bin000066400000000000000000000000401223451536200243410ustar00rootroot00000000000000!!!.!.00jcodings-jcodings-1.0.11/resources/tables/CR_Other_Lowercase.bin000066400000000000000000000001601223451536200246170ustar00rootroot00000000000000 EEzz,axx !p!$$,},}ppjcodings-jcodings-1.0.11/resources/tables/CR_Other_Math.bin000066400000000000000000000014501223451536200235670ustar00rootroot00000000000000d^^   2 4 @ @ a d } ~ !!!!! !!!!!!$!$!(!)!,!-!/!1!3!8!<!?!E!I!!!!!!!!!!!!!!!!!!!!!!!!!!!!########%%%%%%%%%%%%%%%%%%&&&@&@&B&B&`&c&m&n''''))))))aacchh<<>>TVԜԞԟԢԢԥԦԩԬԮԹԻԻԽ  9;>@DFFJPR֥֨46NPnp׈׊רתjcodings-jcodings-1.0.11/resources/tables/CR_Other_Uppercase.bin000066400000000000000000000000301223451536200246160ustar00rootroot00000000000000!`!o$$jcodings-jcodings-1.0.11/resources/tables/CR_P.bin000066400000000000000000000020601223451536200217320ustar00rootroot00000000000000 !#%*,/:;?@[]__{{}}~~Z_    jm 0>^^ d e p p OOZ[:=JOahmn56 DEZ`;?~  ' 0 C E Q S ^ } ~ #)#*'h'u'''')))))),,,,-p-p....0.100000000000=0=0000 ss~~tw./__\_>?0RTacchhjk  ;=??[[]]_eWW   ? ? P X   9 ?GM$p$sjcodings-jcodings-1.0.11/resources/tables/CR_Pattern_Syntax.bin000066400000000000000000000003501223451536200245160ustar00rootroot000000000000009!/:@[^``{~  ' 0 > A S U ^!$_%'u'+..0000 0000>?EFjcodings-jcodings-1.0.11/resources/tables/CR_Pattern_White_Space.bin000066400000000000000000000000601223451536200254210ustar00rootroot00000000000000    ( )jcodings-jcodings-1.0.11/resources/tables/CR_Pc.bin000066400000000000000000000000701223451536200220740ustar00rootroot00000000000000 __ ? @ T T34MO??jcodings-jcodings-1.0.11/resources/tables/CR_Pd.bin000066400000000000000000000002001223451536200220700ustar00rootroot00000000000000--  ....0000000012XXcc jcodings-jcodings-1.0.11/resources/tables/CR_Pe.bin000066400000000000000000000010701223451536200220770ustar00rootroot00000000000000F))]]}};;== F F ~ ~ #*#*'i'i'k'k'm'm'o'o'q'q's's'u'u'''''''''''')))))))))))))))))))))))))))).#.#.%.%.'.'.).)0 0 0 0 0 0 00000000000000??6688::<<>>@@BBDDHHZZ\\^^ ==]]``ccjcodings-jcodings-1.0.11/resources/tables/CR_Pf.bin000066400000000000000000000001301223451536200220740ustar00rootroot00000000000000     : :..... . . . ...!.!jcodings-jcodings-1.0.11/resources/tables/CR_Phags_Pa.bin000066400000000000000000000000201223451536200232070ustar00rootroot00000000000000@wjcodings-jcodings-1.0.11/resources/tables/CR_Phoenician.bin000066400000000000000000000000301223451536200236030ustar00rootroot00000000000000    jcodings-jcodings-1.0.11/resources/tables/CR_Pi.bin000066400000000000000000000001401223451536200221000ustar00rootroot00000000000000       9 9..... . . . ... . jcodings-jcodings-1.0.11/resources/tables/CR_Po.bin000066400000000000000000000020101223451536200221040ustar00rootroot00000000000000!#%'**,,./:;?@\\~~Z_    jm 0>^^ d e p p OOZ[JOahmn56 DEZ`;?~   ' 0 8 ; > A C G Q S S U ^,,,,-p-p..... . .........*...0.1000=0=00 ss~~tw./__\_00EFILPRTW_ahhjk  <<aadeWW   ? ? P X   9 ?GM$p$sjcodings-jcodings-1.0.11/resources/tables/CR_Print.bin000066400000000000000000000077001223451536200226350ustar00rootroot00000000000000 ~wz~'1VY_a JM-0>@[^^ w y        ( * 0 2 3 5 6 8 9 < < > B G H K M Q Q Y \ ^ ^ f u       ( * 0 2 3 5 9 < D G H K M V W \ ] _ c f w       ( * 3 5 9 = D F H J M U V X Y ` c f o x        : = D F H J N W W ` c f u y  :?[GIlqHJMPVXXZ]`Z]|  6@S`lnprs w +0;@@Dmpt^`|KP|7;IM EHMPWYY[[]]_} ' * d j q t !!!#$$&$@$J$`&'''''+L+P+Y,,.,0,^,`,,-%-0-e-o-p-------------------.1....////00?0A00011-1111111122 23MM+@s|+09@wS_|6@MPY\{  &(.ףװ-0mp68<>>@ACDF?P &0RTfhkptv  &(:<=?MP]37 #0J 578<<?UW_    9 ? ?          3 8 : ? G P X `   5 9 U X r x   H`~MRo #n$$b$p$s04.hj8&)EV`qTVԜԞԟԢԢԥԦԩԬԮԹԻԻԽ  9;>@DFFJPR֥֨+0 .0ip:@HPQ 057|>@@B=Pg %(+--035@EOs4@ jcodings-jcodings-1.0.11/resources/tables/CR_Ps.bin000066400000000000000000000011101223451536200221100ustar00rootroot00000000000000H(([[{{::<<     E E } } #)#)'h'h'j'j'l'l'n'n'p'p'r'r't't'''''''''''')))))))))))))))))))))))))))).".".$.$.&.&.(.(000 0 0 0 00000000000000>>557799;;==??AACCGGYY[[]];;[[__bbjcodings-jcodings-1.0.11/resources/tables/CR_Quotation_Mark.bin000066400000000000000000000001501223451536200244660ustar00rootroot00000000000000 ""''   9 :0 000ADbcjcodings-jcodings-1.0.11/resources/tables/CR_Radical.bin000066400000000000000000000000401223451536200230660ustar00rootroot00000000000000....//jcodings-jcodings-1.0.11/resources/tables/CR_Rejang.bin000066400000000000000000000000301223451536200227340ustar00rootroot000000000000000S__jcodings-jcodings-1.0.11/resources/tables/CR_Runic.bin000066400000000000000000000000301223451536200226060ustar00rootroot00000000000000jcodings-jcodings-1.0.11/resources/tables/CR_S.bin000066400000000000000000000032101223451536200217330ustar00rootroot00000000000000$$++<>^^``||~~uu   p p   y y??446688``@@ajt| D D R R z | !!!!!! !!!!!!#!%!%!'!'!)!)!.!.!:!;!@!D!J!M!O!O!#(#+#$$&$@$J$$%&''g'''''''''))))))+L+P+Y,,....////00000 0 06070>0?00111111222*2P2`2222233MM !(+69wy))bbdfii >>@@\\^^7?y&)djlуфьѩѮAEEV55OOoo׉׉שש+0.0ip:@HPQ 057|>@@B=Pg %(+--035@EOsjcodings-jcodings-1.0.11/resources/tables/CR_STerm.bin000066400000000000000000000006001223451536200225630ustar00rootroot00000000000000_/!!..??\\^^ d eJKbbghnn56  DEZ[^_;<~ < = G I....00vw//]_RRVWaa V WGHjcodings-jcodings-1.0.11/resources/tables/CR_Samaritan.bin000066400000000000000000000000301223451536200234450ustar00rootroot00000000000000-0>jcodings-jcodings-1.0.11/resources/tables/CR_Saurashtra.bin000066400000000000000000000000301223451536200236430ustar00rootroot00000000000000jcodings-jcodings-1.0.11/resources/tables/CR_Sc.bin000066400000000000000000000002101223451536200220730ustar00rootroot00000000000000!$$  ?? 88iijcodings-jcodings-1.0.11/resources/tables/CR_Shavian.bin000066400000000000000000000000201223451536200231160ustar00rootroot00000000000000Pjcodings-jcodings-1.0.11/resources/tables/CR_Sinhala.bin000066400000000000000000000001401223451536200231070ustar00rootroot00000000000000 jcodings-jcodings-1.0.11/resources/tables/CR_Sk.bin000066400000000000000000000003401223451536200221070ustar00rootroot000000000000007^^``uu00 !>>@@jcodings-jcodings-1.0.11/resources/tables/CR_Sm.bin000066400000000000000000000010301223451536200221060ustar00rootroot00000000000000B++<>||~~ D D R R z | !!!@!D!K!K!!!!!!!!!!!!!!!!!!!"## # #!#|#|####%%%%%%&o&o'''''''''')))))))*+0+D+G+L))bbdf \\^^55OOoo׉׉ששjcodings-jcodings-1.0.11/resources/tables/CR_So.bin000066400000000000000000000024501223451536200221170ustar00rootroot00000000000000I p p   y y446688``@@ajt|!!!!!! !!!!!!#!%!%!'!'!)!)!.!.!:!;!J!J!L!M!O!O!!!!!!!!!!!!!!!!!!### ##"#(#+#{#}#####$$&$@$J$$%%%%%%&&n&p&''g''((++/+E+F+P+Y,,....////00000 0 06070>0?111111222*2P2`2222233MM(+6799wy7?y&)djlуфьѩѮAEEV+0.0ip:@HPQ 057|>@@B=Pg %(+--035@EOsjcodings-jcodings-1.0.11/resources/tables/CR_Soft_Dotted.bin000066400000000000000000000004001223451536200237450ustar00rootroot00000000000000?ij//IIhhVVXXbb-- q q!H!I,|,|"#VWԊԋԾԿ&'Z[ՎՏ*+^_֒֓jcodings-jcodings-1.0.11/resources/tables/CR_Sundanese.bin000066400000000000000000000000301223451536200234530ustar00rootroot00000000000000jcodings-jcodings-1.0.11/resources/tables/CR_Syloti_Nagri.bin000066400000000000000000000000201223451536200241300ustar00rootroot00000000000000+jcodings-jcodings-1.0.11/resources/tables/CR_Syriac.bin000066400000000000000000000000401223451536200227610ustar00rootroot00000000000000 JMOjcodings-jcodings-1.0.11/resources/tables/CR_Tagalog.bin000066400000000000000000000000301223451536200231040ustar00rootroot00000000000000 jcodings-jcodings-1.0.11/resources/tables/CR_Tagbanwa.bin000066400000000000000000000000401223451536200232530ustar00rootroot00000000000000`lnprsjcodings-jcodings-1.0.11/resources/tables/CR_Tai_Le.bin000066400000000000000000000000301223451536200226630ustar00rootroot00000000000000Pmptjcodings-jcodings-1.0.11/resources/tables/CR_Tai_Tham.bin000066400000000000000000000000601223451536200232170ustar00rootroot00000000000000  ^`|jcodings-jcodings-1.0.11/resources/tables/CR_Tai_Viet.bin000066400000000000000000000000301223451536200232320ustar00rootroot00000000000000jcodings-jcodings-1.0.11/resources/tables/CR_Tamil.bin000066400000000000000000000002101223451536200225740ustar00rootroot00000000000000! jcodings-jcodings-1.0.11/resources/tables/CR_Telugu.bin000066400000000000000000000001701223451536200230000ustar00rootroot00000000000000       ( * 3 5 9 = D F H J M U V X Y ` c f o x jcodings-jcodings-1.0.11/resources/tables/CR_Terminal_Punctuation.bin000066400000000000000000000010401223451536200256740ustar00rootroot00000000000000C!!,,..:;??~~     0>^^ d eZ[ JKahmn DEZ[]_;?~ < = G I....00 vw//]_PRTW aaddWW   : ?GM$p$sjcodings-jcodings-1.0.11/resources/tables/CR_Thaana.bin000066400000000000000000000000201223451536200227210ustar00rootroot00000000000000jcodings-jcodings-1.0.11/resources/tables/CR_Thai.bin000066400000000000000000000000301223451536200224130ustar00rootroot00000000000000:@[jcodings-jcodings-1.0.11/resources/tables/CR_Tibetan.bin000066400000000000000000000001001223451536200231120ustar00rootroot00000000000000GIlqjcodings-jcodings-1.0.11/resources/tables/CR_Tifinagh.bin000066400000000000000000000000401223451536200232600ustar00rootroot00000000000000-0-e-o-p--jcodings-jcodings-1.0.11/resources/tables/CR_Ugaritic.bin000066400000000000000000000000301223451536200232750ustar00rootroot00000000000000jcodings-jcodings-1.0.11/resources/tables/CR_Unified_Ideograph.bin000066400000000000000000000001501223451536200250760ustar00rootroot00000000000000 4MN!!#$')4@jcodings-jcodings-1.0.11/resources/tables/CR_Unknown.bin000066400000000000000000000076401223451536200232030ustar00rootroot00000000000000xy(0WX``KL./??\]_ x x      ) ) 1 1 4 4 7 7 : ; = = C F I J N P R X ] ] _ e v      ) ) 1 1 4 4 : ; E F I J N U X [ ^ ^ d e x     ) ) 4 4 : < E E I I N T W W Z _ d e p w      ; < E E I I O V X _ d e v x ;>\HHmpIINOWWYY^_[\}  7?T_mmqqtx,/<?ACnou__}~LO}8:JLFGNOXXZZ\\^^~ e i r s !!##$'$?$K$_''''''+M+O+Z+,/,/,_,_,,-&-/-f-n-q-~------------------.2.....////0@0@00111.101111112222MM,?t{,/:?xT^}7?NOZ[|''/פׯ./no77==??BBEE@O'/SSgglouu  '';;>>NO^46$/K  669;=>VV`   : > @          4 7 ; > H O Y _   6 8 V W s w   I_NQp#o#$c$o$t/4/gj9'(FW_rUUԝԝԠԡԣԤԧԨԭԭԺԺԼԼ  ::??EEGIQQ֦֧,/ //jo;?IOR!/66}??AA>Oh&',,./44ADPt5?jcodings-jcodings-1.0.11/resources/tables/CR_Uppercase.bin000066400000000000000000000113601223451536200234650ustar00rootroot00000000000000]AZ      ""$$&&((**,,..0022446699;;==??AACCEEGGJJLLNNPPRRTTVVXXZZ\\^^``bbddffhhjjllnnpprrttvvxy{{}}      ""$$&&((**,,..0022:;=>AACFHHJJLLNNpprrvv/``bbddffhhjjllnnpprrttvvxxzz||~~      ""$$&&1V      ""$$&&((**,,..0022446688::<<>>@@BBDDFFHHJJLLNNPPRRTTVVXXZZ\\^^``bbddffhhjjllnnpprrttvvxxzz||~~(/8?HMYY[[]]__ho!!!!! ! !!!!!!!$!$!&!&!(!(!*!-!0!3!>!?!E!E!`!o!!$$,,.,`,`,b,d,g,g,i,i,k,k,m,p,r,r,u,u,~,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,@@BBDDFFHHJJLLNNPPRRTTVVXXZZ\\^^``bbddffhhjjll""$$&&((**,,..22446688::<<>>@@BBDDFFHHJJLLNNPPRRTTVVXXZZ\\^^``bbddffhhjjllnnyy{{}~!:'4MhԁԜԜԞԟԢԢԥԦԩԬԮԵ  89;>@DFFJPlՅՠչ!<Up։֨4Vnארjcodings-jcodings-1.0.11/resources/tables/CR_Vai.bin000066400000000000000000000000201223451536200222440ustar00rootroot00000000000000+jcodings-jcodings-1.0.11/resources/tables/CR_Variation_Selector.bin000066400000000000000000000000401223451536200253230ustar00rootroot00000000000000  jcodings-jcodings-1.0.11/resources/tables/CR_White_Space.bin000066400000000000000000000001401223451536200237230ustar00rootroot00000000000000  ( ) / / _ _00jcodings-jcodings-1.0.11/resources/tables/CR_Word.bin000066400000000000000000000100301223451536200224420ustar00rootroot0000000000000009AZ__aztvwz}'1VYYa inJM-@[ c f o q w y        ( * 0 2 3 5 6 8 9 < < > B G H K M Q Q Y \ ^ ^ f u       ( * 0 2 3 5 9 < D G H K M V W \ ] _ c f o q q       ( * 3 5 9 = D F H J M U V X Y ` c f o       : = D F H J N W W ` c f o z  :@NPY )557799>GIlqIPHJMPVXXZ]`Z]_lo  4@S`lnprs   w +0;Fmpt ^`|KPYks7@IM} EHMPWYY[[]]_} ? @ T T q q   !!!!! !!!!!!$!$!&!&!(!(!*!-!/!9!<!?!E!I!N!N!`!$$,,.,0,^,`,,,--%-0-e-o-o--------------------././000!0/0105080<0A00000000011-11111114MN +@r|}"'@s-0S`|6@MPY`vz{  &(.ףװ-0mp(*68<>>@ACDF=P &34MOptv!:??AZf  &(:<=?MP]@t0J 578<<?U    9          3 8 : ? ? ` |  5 @ U ` r  HFfo #n$$b04.hj8eimr{тхыѪѭBDTVԜԞԟԢԢԥԦԩԬԮԹԻԻԽ  9;>@DFFJPR֥֨46NPnp׈׊רת4@jcodings-jcodings-1.0.11/resources/tables/CR_XID_Continue.bin000066400000000000000000000101201223451536200240170ustar00rootroot00000000000000 09AZ__aztvw{}'1VYYa inJM-@[ c f o q w y        ( * 0 2 3 5 6 8 9 < < > B G H K M Q Q Y \ ^ ^ f u       ( * 0 2 3 5 9 < D G H K M V W \ ] _ c f o q q       ( * 3 5 9 = D F H J M U V X Y ` c f o       : = D F H J N W W ` c f o z  :@NPY )557799>GIlqIPHJMPVXXZ]`Z]_iqlo  4@S`lnprs   w +0;Fmpt ^`|KPYks7@IM} EHMPWYY[[]]_} ? @ T T q q   !!!!! !!!!!!$!$!&!&!(!(!*!9!<!?!E!I!N!N!`!,,.,0,^,`,,,--%-0-e-o-o--------------------000!0/0105080<0A00000000011-11111114MN +@o|}"'@s-0S`|6@MPY`vz{  &(.ףװ-0mp(*68<>>@ACDF]d=P &34MOqqsswwyy{{}}!:??AZf  &(:<=?MP]@t0J 578<<?U    9          3 8 : ? ? ` |  5 @ U ` r  HFfo #n$$b04.hj8eimr{тхыѪѭBDTVԜԞԟԢԢԥԦԩԬԮԹԻԻԽ  9;>@DFFJPR֥֨46NPnp׈׊רת4@jcodings-jcodings-1.0.11/resources/tables/CR_XID_Start.bin000066400000000000000000000067501223451536200233460ustar00rootroot00000000000000yAZazptvw{}'1VYYa Jnoq/M$$((@X  9 = = P P X a q w y      ( * 0 2 3 5 6 8 9 Y \ ^ ^ r t     ( * 0 2 3 5 9 = = \ ] _ a q q     ( * 3 5 9 = = X Y ` a     : = = N N ` a z  022@F@GIl*??PUZ]aaefnpuHJMPVXXZ]`Zlo  1@Q`lnp wPmpt T3EK#MOZ} EHMPWYY[[]]_} q q   !!!!! !!!!!!$!$!&!&!(!(!*!9!<!?!E!I!N!N!`!,,.,0,^,`,,,--%-0-e-o-o------------------000!0)0105080<0A000000011-11111114MN *+@n" "@s %0F`|(@BDK`vzz  &(.ףװ-0mp(*68<>>@ACDF]d=Pqqsswwyy{{}}!:AZf  &(:<=?MP]@t0J 578<<?U    9        3 ` |  5 @ U ` r  H7 #n$$b04.hj8TVԜԞԟԢԢԥԦԩԬԮԹԻԻԽ  9;>@DFFJPR֥֨46NPnp׈׊רת4@jcodings-jcodings-1.0.11/resources/tables/CR_Yi.bin000066400000000000000000000000301223451536200221070ustar00rootroot00000000000000jcodings-jcodings-1.0.11/resources/tables/CR_Z.bin000066400000000000000000000001201223451536200217370ustar00rootroot00000000000000  ( ) / / _ _00jcodings-jcodings-1.0.11/resources/tables/CR_Zl.bin000066400000000000000000000000201223451536200221120ustar00rootroot00000000000000 ( (jcodings-jcodings-1.0.11/resources/tables/CR_Zp.bin000066400000000000000000000000201223451536200221160ustar00rootroot00000000000000 ) )jcodings-jcodings-1.0.11/resources/tables/CR_Zs.bin000066400000000000000000000001101223451536200221210ustar00rootroot00000000000000  / / _ _00jcodings-jcodings-1.0.11/resources/tables/CaseFold_From.bin000066400000000000000000000075201223451536200236200ustar00rootroot00000000000000ABCDEFGHJKLMNOPQRSTUVWXYZ   "$&(*,.2469;=?ACEGIJLNPRTVXZ\^`bdfhjlnprtvxy{}   "$&(*,.02;=AE      !"#$%&'()*+,-./`bdfhjlnprtvxz|~  123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUV   "$&(*,.02468:<>@BDFHJLNPRTVXZ\^`bdfhjlnprtvxz|~     ()*+,-./89:;<=>?HIJKLMPRTVY[]_hijklmno!&!*!+!`!a!b!c!d!e!f!g!h!i!j!k!l!m!n!o$$$$$$$$$$$$$$$$$$$$$$$$$$,,,,,,,,,, , , , , ,,,,,,,,,,,,,,,,,,, ,!,",#,$,%,&,',(,),*,+,,,-,.,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,!"#$%&'()*+,-./0123456789:      !"#$%&'jcodings-jcodings-1.0.11/resources/tables/CaseFold_Locale_From.bin000066400000000000000000000000141223451536200250660ustar00rootroot00000000000000I0jcodings-jcodings-1.0.11/resources/tables/CaseFold_Locale_To.bin000066400000000000000000000000301223451536200245430ustar00rootroot00000000000000iijcodings-jcodings-1.0.11/resources/tables/CaseFold_To.bin000066400000000000000000000201641223451536200232760ustar00rootroot00000000000000abcdefghjklmnopqrstuvwxyzss   !#%')+-/357:<>@BDFHnKMOQSUWY[]_acegikmoqsuwz|~sSTVWY[`cihoruj    #%')+-/13<PQRSTUVWXYZ[\]^_0123456789:;<=>?@ABCDEFGHIJKLMNOacegikmoqsuwy{}   abcdefghijklmnopqrstuvwxyz{|}~e---------- - - - - ------------------- -!-"-#-$-%   !#%')+-/13579;=?ACEGIKMOQSUWY[]_acegikmoqsuwy{}h1tw y aa !"#$%&'01234567@ABCDEBQSUW`abcdefg !"#$%&' !"#$%&'`abcdefg`abcdefgpBBpqtBBrstuBBvwBBz{|BBxy|}k!p!q!r!s!t!u!v!w!x!y!z!{!|!}!~!$$$$$$$$$$$$$$$$$$$$$$$$$$,0,1,2,3,4,5,6,7,8,9,:,;,<,=,>,?,@,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z,[,\,],^,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,fffiflffifflststtvtetk~vtmABCDEFGHIJKLMNOPQRSTUVWXYZ()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOjcodings-jcodings-1.0.11/resources/tables/CaseUnfold_11_From.bin000066400000000000000000000065441223451536200244710ustar00rootroot00000000000000Xabcdefghjklmnopqrstuvwxyz   !#%')+-/357:<>@BDFHKMOQSUWY[]_acegikmoqsuwz|~   #%')+-/13<STVWY[`chioru0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_acegikmoqsuwy{}   abcdefghijklmnopqrstuvwxyz{|}~   !#%')+-/13579;=?ACEGIKMOQSUWY[]_acegikmoqsuwy{} !"#$%&'01234567@ABCDEQSUW`abcdefgpqrstuvwxyz{|}!p!q!r!s!t!u!v!w!x!y!z!{!|!}!~!$$$$$$$$$$$$$$$$$$$$$$$$$$,0,1,2,3,4,5,6,7,8,9,:,;,<,=,>,?,@,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z,[,\,],^,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,---------- - - - - ------------------- -!-"-#-$-%ABCDEFGHIJKLMNOPQRSTUVWXYZ()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOjcodings-jcodings-1.0.11/resources/tables/CaseUnfold_11_Locale_From.bin000066400000000000000000000000101223451536200257260ustar00rootroot00000000000000ijcodings-jcodings-1.0.11/resources/tables/CaseUnfold_11_Locale_To.bin000066400000000000000000000000141223451536200254110ustar00rootroot00000000000000Ijcodings-jcodings-1.0.11/resources/tables/CaseUnfold_11_To.bin000066400000000000000000000154301223451536200241420ustar00rootroot00000000000000XABCDEFGHJ!*KLMNOPQRSTUVWXYZ!+x   "$&(*,.2469;=?ACEGJLNPRTVXZ\^`bdfhjlnprtvy{}=   "$&(*,.02;AE!& !"#$%&'()*+,-./     `bdfhjlnprtvxz|~  123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUV   "$&(*,.02468:<>@BDFHJLNPRTVXZ\^`bdfhjlnprtvxz|~     ()*+,-./89:;<=>?HIJKLMY[]_hijklmno!`!a!b!c!d!e!f!g!h!i!j!k!l!m!n!o$$$$$$$$$$$$$$$$$$$$$$$$$$,,,,,,,,,, , , , , ,,,,,,,,,,,,,,,,,,, ,!,",#,$,%,&,',(,),*,+,,,-,.,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,!"#$%&'()*+,-./0123456789:      !"#$%&'jcodings-jcodings-1.0.11/resources/tables/CaseUnfold_12.bin000066400000000000000000000023741223451536200235040ustar00rootroot00000000000000tafffiflh1j sssttw y nIBBBPBBetetktmtv~v !"#$%&'`abcdefgpt|jcodings-jcodings-1.0.11/resources/tables/CaseUnfold_12_Locale.bin000066400000000000000000000000301223451536200247460ustar00rootroot00000000000000i0jcodings-jcodings-1.0.11/resources/tables/CaseUnfold_13.bin000066400000000000000000000005341223451536200235010ustar00rootroot00000000000000ffifflBBBBRTBVBjcodings-jcodings-1.0.11/scripts/000077500000000000000000000000001223451536200166625ustar00rootroot00000000000000jcodings-jcodings-1.0.11/scripts/EncodingListTemplate.java000066400000000000000000000022551223451536200236070ustar00rootroot00000000000000/* * Permission is hereby granted, free of charge, to any person obtaining a copy of * this software and associated documentation files (the "Software"), to deal in * the Software without restriction, including without limitation the rights to * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies * of the Software, and to permit persons to whom the Software is furnished to do * so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ package org.jcodings; final class EncodingList { static final String[][] LIST = new String[][] { %{body} }; }jcodings-jcodings-1.0.11/scripts/ExractTranscoders.rb000066400000000000000000000151541223451536200226530ustar00rootroot00000000000000require 'open-uri' repo_path = ARGV.first # path to ruby repo trans_path = "#{repo_path}/enc/trans" dst_dir = "../src/org/jcodings" dst_bin_dir = "../resources/tables" trans_dir = "#{dst_dir}/transcode" trans_dst_dir = "#{trans_dir}/specific" INDENT = " " * 4 NOMAP = 0x01 # /* direct map */ ONEbt = 0x02 # /* one byte payload */ TWObt = 0x03 # /* two bytes payload */ THREEbt = 0x05 # /* three bytes payload */ FOURbt = 0x06 # /* four bytes payload, UTF-8 only, macros start at getBT0 */ INVALID = 0x07 # /* invalid byte sequence */ UNDEF = 0x09 # /* legal but undefined */ ZERObt = 0x0A # /* zero bytes of payload, i.e. remove */ FUNii = 0x0B # /* function from info to info */ FUNsi = 0x0D # /* function from start to info */ FUNio = 0x0E # /* function from info to output */ FUNso = 0x0F # /* function from start to output */ STR1 = 0x11 # /* string 4 <= len <= 259 bytes: 1byte length + content */ GB4bt = 0x12 # /* GB18030 four bytes payload */ FUNsio = 0x13 # /* function from start and info to output */ WORDINDEX_SHIFT_BITS = 2 def WORDINDEX2INFO widx widx << WORDINDEX_SHIFT_BITS end def makeSTR1LEN len len - 4 end def makeSTR1 bi (bi << 6) | STR1 end def o1 b1 (b1 << 8) | ONEbt end def o2 b1, b2 (b1 << 8) | (b2 << 16) | TWObt end def o3 b1, b2, b3 ((b1 << 8) | (b2 << 16) | (b3 << 24) | THREEbt) & 0xffffffff end def o4 b0, b1, b2, b3 ((b1 << 8) | (b2 << 16) | (b3 << 24) | ((b0 & 0x07) << 5) | FOURbt) & 0xffffffff end def g4 b0, b1, b2, b3 ((b0 << 8) | (b2 << 16) | ((b1 & 0xf) << 24) | ((b3 & 0x0f) << 28) | GB4bt) & 0xffffffff end def funsio diff (diff << 8) & FUNsio end def assert_eq a, b, msg = "" raise "unmet condition: #{a.inspect} == #{b.inspect}, info #{msg}" unless a == b end def assert_not_eq a, b, msg = "" raise "unmet condition: #{a.inspect} != #{b.inspect}, info: #{msg}" unless a != b end def assert raise "unmet condition" unless yield end t = Time.now template = open("TranscoderTemplate.java").read transcoder_list = [] generic_list = [] Dir["#{trans_path}/*.c"].reject{|f| f =~ /transdb/}.each do |f| src = open(f).read defs = Hash[src.scan(/#define\s+(.*?)\s+(.*)/)] src = src.gsub(/#define\s+(.*?)\s+(.*)/, "") name = f[/(\w+)\.c/, 1].split('_').map{|e| e.capitalize}.join("") src =~ /\w+?_byte_array\[(\d+?)\]\s+=\s+\{(.*?)\}\;/m byte_array_size = $1.to_i byte_array = $2 byte_array = byte_array.gsub(/\w+?\(.+?\)/){|e| eval e} byte_array = byte_array.gsub(/0x(\w+)/){|e| e.to_i(16).to_s} byte_array = byte_array.split(",").map{|e|e.strip} assert_eq(byte_array.last, "") # trailing comma byte_array.pop assert_eq(byte_array.size, byte_array_size) assert_eq(byte_array.all?{|b| b =~ /\d+/}, true) byte_array = byte_array.map(&:to_i) assert_eq(byte_array.all?{|b| b >= 0 && b <= 255}, true) open("#{dst_bin_dir}/Transcoder_#{name}_ByteArray.bin", "wb") do|f| f << [byte_array_size].pack("N") byte_array.each{|b| f << b.chr} end src =~ /\w+?_word_array\[(\d+?)\]\s+=\s+\{(.*?)\}\;/m word_array_size = $1.to_i word_array = $2 ["INVALID", "UNDEF", "NOMAP", "FUNso", "FUNsi"].each{|c|defs[c] = Object.const_get(c)} word_array = word_array.gsub(/\w+?\(.+?\)/){|e| eval e} word_array = word_array.split(',').map{|e|e.strip} assert_eq(word_array.last, "") # trailing comma word_array.pop assert_eq(word_array.size, word_array_size) word_array = word_array.map do |b| if b =~ /^\d+$/ b.to_i else v = defs[b] assert_not_eq(v, nil, b) v = case v when Fixnum v when /(\w+?\(.+?\))/ v = eval(v) assert_eq(v.class, Fixnum) v when String assert_eq(v =~ /^\d+$/, 0) v.to_i else raise "unknown type" end defs[b] = v v end end assert_eq(word_array.all?{|e|e >= 0 && e <= 4294967295}, true) open("#{dst_bin_dir}/Transcoder_#{name}_WordArray.bin", "wb") do|f| f << [word_array_size].pack("N") word_array.each{|b| f << [b].pack("N")} end src.scan(/static\s+const\s+rb_transcoder.*?(\w+)\s+=\s+\{(.+?)\};/m) do |t_name, body| n = t_name.split('_') t_name = n[1].capitalize t_name += '_' + n[2..-1].join('_') unless n[2..-1].empty? body = body.gsub(/(\/\*.*?\*\/)/, "").split(',').map{|e|e.strip} src, dst, tree_start, table_info, iul, max_in, max_out, conv, state_size, state_init, state_fini, *funcs = body info = defs[table_info].split(',').map{|e|e.strip}[0..-2] b_arr, b_arr_length, w_arr, w_arr_length = info assert_eq(b_arr_length.to_i, byte_array_size) assert_eq(w_arr_length.to_i, word_array_size) specific = !funcs.all?{|f| f == "NULL"} state_size = "0" if state_size == "sizeof(struct from_utf8_mac_status)" # super_name = specific ? "Base_#{t_name}_Transcoder" : "Transcoder" puts "specific transcoder #{t_name} doesnt exist" if specific and not File.exist?("#{trans_dst_dir}/#{t_name}_Transcoder.java") ts = defs[tree_start] ts = case ts when Fixnum ts when /^\d+$/ ts.to_i when /(\w+?\(.+?\))/ eval(ts) else raise "error #{defs[tree_start]}" end if specific and false # initial generation open("#{trans_dst_dir}/#{t_name}_Transcoder.java", "wb") << template. gsub(/%\{name\}/, "#{t_name}_Transcoder"). sub(/%\{super\}/, "Transcoder"). sub(/%\{super_ctor\}/, [src, dst, ts, "\"#{name}\"", iul, max_in, max_out, "AsciiCompatibility.#{conv.split('_').last.upcase}", state_size].join(', ')) end generic_list << [src, dst, ts, "\"#{name}\"", iul, max_in, max_out, "AsciiCompatibility.#{conv.split('_').last.upcase}", state_size] transcoder_list << [src, dst, t_name, specific] end end open("#{trans_dir}/TranscoderList.java", "wb") << open("TranscoderListTemplate.java").read. sub(/%\{list\}/, transcoder_list.map{|src, dst, cls, specific| "#{INDENT*2}{#{src}, #{dst}, #{specific ? '"' + cls + '"' : 'null /*' + cls + '*/'}}"}.join(",\n")). sub(/%\{generic\}/, generic_list.map{|g| "#{INDENT*2}new GenericTranscoderEntry(#{g.join(', ')})"}.join(",\n")) p Time.now - t jcodings-jcodings-1.0.11/scripts/ExtractTables.rb000066400000000000000000000077461223451536200217720ustar00rootroot00000000000000require 'open-uri' repo_path = ARGV.first # path to ruby repo enc_path = "#{repo_path}/enc" folds_src = open("#{enc_path}/unicode.c").read unicode_src = open("#{enc_path}/unicode/name2ctype.src").read dst_dir = "../src/org/jcodings" dst_bin_dir = "../resources/tables" enc_dir = "#{dst_dir}/unicode" INDENT = " " * 4 def assert_eq a, b, msg = "" raise "unmet condition: #{a.inspect} == #{b.inspect}, info #{msg}" unless a == b end def assert_not_eq a, b, msg = "" raise "unmet condition: #{a.inspect} != #{b.inspect}, info: #{msg}" unless a != b end def extract_to to, file to = to.map do |t| case t when /^0x[0-9a-f]+$/ t.to_i(16) else t = t.split(',').map{|t|t.strip} assert_eq(t.all?{|e|e =~ /^0x[0-9a-f]+$/}, true) t.map{|t| t.to_i(16)} end end open(file, "wb") do |f| f << [to.size].pack("N") to.each do |t| case t when Fixnum f << [1].pack("N") f << [t].pack("N") when Array f << [t.size].pack("N") t.each{|tx| f << [tx].pack("N")} else raise "foo" end end end end folds = folds_src.scan(/static\s+const\s+(\w+)\s+(\w+)\[\]\s+=\s+\{(.*?)\}\;/m).map do |(type, name, tab)| case type when /Case(\w+)_11_Type/ from, to = tab.scan(/(\w+).+\{\w+?.+?\{(.+?)\s?\}/).transpose assert_eq(to.size, from.size) assert_eq(from.all?{|e| e =~ /^0x[0-9a-f]+$/}, true) from = from.map{|e| e.to_i(16)} open("#{dst_bin_dir}/#{name}_From.bin", "wb") do |f| f << [from.size].pack("N") from.each{|fr| f << [fr].pack("N")} end extract_to to, "#{dst_bin_dir}/#{name}_To.bin" when "CaseUnfold_12_Type", "CaseUnfold_13_Type" fld = tab.scan(/\{\s?\{(.+?)\}.+\{\w+?.+?\{(.+?)\s?\}/).flatten extract_to fld, "#{dst_bin_dir}/#{name}.bin" else raise "error" end end unicode_src.scan(/static\s+const\s+(\w+)\s+(\w+)\[\]\s+=\s+\{(.*?)\}\;/m).each do |(type, name, tab)| tab = tab.split(",").map{|e|e.strip} assert_eq(tab.last, "") tab.pop size = tab.size head = tab.shift assert_eq(head =~ /^\d+$/, 0) head = head.to_i assert_eq(tab[1..-1].all?{|e| e =~ /^0x[0-9a-f]+$/}, true) tab = tab.map{|e| e.to_i(16)} assert_eq(tab.all?{|e|e >= 0 && e <= 4294967295}, true) open("#{dst_bin_dir}/#{name}.bin", "wb") do |f| f << [size].pack("N") f << [head].pack("N") tab.each{|e| f << [e].pack("N") } end end cr_map = unicode_src.scan(/#define (CR_.*?) (.*)/).inject(Hash.new{|h, k|k}){|h, (k,v)| h[k] = v;h} aliases = unicode_src[/%%(.*?)%%/m, 1].scan(/(.*?),\s+(\d+)/).inject(Hash.new{|h, k| h[k] = []}){|h, (name, num)| h[num.to_i] << name; h}.inject({}) do |h, (k, v)| full, *abbr = v.map{|e|e.strip} h[full] = abbr h end unicode_src.scan(/CodeRanges\[\]\s+=\s+\{(.*?)\}\;/m) do |e| names = e.first.scan(/CR_\w+/) cnames = names.map do |c| n = c[/CR_(.*)/, 1] px = case n when /Age_(\d)_(\d)/ "age=#{$1}.#{$2}" else n.tr('_', '').downcase end ([px] + aliases[px].to_a).map{|n| "#{INDENT * 4}new CodeRangeEntry(\"#{n}\", \"#{cr_map[c]}\")"}.join(",\n") end open("#{enc_dir}/UnicodeProperties.java", "wb") do |f| f << open("UnicodePropertiesTemplate.java", "rb").read. sub(/%\{stdcrs\}/, cnames[0..14].join(",\n")). sub(/%\{extcrs\}/, cnames.join(",\n")) end end enc_db = open("#{repo_path}/encdb.h").read.tr('()', '').scan(/ENC_([A-Z_]+)(.*?);/m).reject{|a, b| a =~ /DEFINE/} open("#{dst_dir}/EncodingList.java", "wb"){|f| f << open("EncodingListTemplate.java", "rb").read. sub(/%\{body\}/, enc_db.map{|cmd, from, to| "#{INDENT*2}{\"#{cmd[0,1]}\", #{from}#{to.nil? ? "" : to}}"}.join(",\n"))} jcodings-jcodings-1.0.11/scripts/TranscoderListTemplate.java000066400000000000000000000025461223451536200241700ustar00rootroot00000000000000/* * Permission is hereby granted, free of charge, to any person obtaining a copy of * this software and associated documentation files (the "Software"), to deal in * the Software without restriction, including without limitation the rights to * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies * of the Software, and to permit persons to whom the Software is furnished to do * so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ package org.jcodings.transcode; import org.jcodings.transcode.Transcoder.GenericTranscoderEntry; final class TranscoderList { static final String[][] LIST = new String[][] { %{list} }; static final GenericTranscoderEntry[] GENERIC_LIST = new GenericTranscoderEntry[] { %{generic} }; }jcodings-jcodings-1.0.11/scripts/TranscoderTemplate.java000066400000000000000000000025451223451536200233330ustar00rootroot00000000000000/* * Permission is hereby granted, free of charge, to any person obtaining a copy of * this software and associated documentation files (the "Software"), to deal in * the Software without restriction, including without limitation the rights to * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies * of the Software, and to permit persons to whom the Software is furnished to do * so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ package org.jcodings.transcode.specific; import org.jcodings.transcode.AsciiCompatibility; import org.jcodings.transcode.Transcoder; public class %{name} extends %{super} { protected %{name} () { super(%{super_ctor}); } public static final Transcoder INSTANCE = new %{name}(); } jcodings-jcodings-1.0.11/scripts/UnicodePropertiesTemplate.java000066400000000000000000000026341223451536200246710ustar00rootroot00000000000000/* * Permission is hereby granted, free of charge, to any person obtaining a copy of * this software and associated documentation files (the "Software"), to deal in * the Software without restriction, including without limitation the rights to * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies * of the Software, and to permit persons to whom the Software is furnished to do * so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ package org.jcodings.unicode; import org.jcodings.Config; import org.jcodings.unicode.UnicodeEncoding.CodeRangeEntry; public class UnicodeProperties { static final CodeRangeEntry[]CodeRangeTable = Config.USE_UNICODE_PROPERTIES ? new CodeRangeEntry[] { %{extcrs} } : new CodeRangeEntry[] { %{stdcrs} }; } jcodings-jcodings-1.0.11/src/000077500000000000000000000000001223451536200157625ustar00rootroot00000000000000jcodings-jcodings-1.0.11/src/org/000077500000000000000000000000001223451536200165515ustar00rootroot00000000000000jcodings-jcodings-1.0.11/src/org/jcodings/000077500000000000000000000000001223451536200203515ustar00rootroot00000000000000jcodings-jcodings-1.0.11/src/org/jcodings/AbstractEncoding.java000066400000000000000000000111001223451536200244170ustar00rootroot00000000000000/* * Permission is hereby granted, free of charge, to any person obtaining a copy of * this software and associated documentation files (the "Software"), to deal in * the Software without restriction, including without limitation the rights to * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies * of the Software, and to permit persons to whom the Software is furnished to do * so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ package org.jcodings; import org.jcodings.ascii.AsciiTables; import org.jcodings.constants.PosixBracket; import org.jcodings.exception.CharacterPropertyException; import org.jcodings.exception.ErrorMessages; abstract class AbstractEncoding extends Encoding { private final short CTypeTable[]; protected AbstractEncoding(String name, int minLength, int maxLength, short[]CTypeTable) { super(name, minLength, maxLength); this.CTypeTable = CTypeTable; } protected AbstractEncoding(String name, int minLength, int maxLength, short[]CTypeTable, boolean isDummy) { super(name, minLength, maxLength, isDummy); this.CTypeTable = CTypeTable; } /** CTYPE_TO_BIT */ private static int CTypeToBit(int ctype) { return 1 << ctype; } /** ONIGENC_IS_XXXXXX_CODE_CTYPE */ protected final boolean isCodeCTypeInternal(int code, int ctype) { return (CTypeTable[code] & CTypeToBit(ctype)) != 0; } /** onigenc_is_mbc_newline_0x0a / used also by multibyte encodings * */ @Override public boolean isNewLine(byte[]bytes, int p, int end) { return p < end ? bytes[p] == (byte)0x0a : false; } protected final int asciiMbcCaseFold(int flag, byte[]bytes, IntHolder pp, int end, byte[]lower) { lower[0] = AsciiTables.ToLowerCaseTable[bytes[pp.value] & 0xff]; pp.value++; return 1; } /** onigenc_ascii_mbc_case_fold */ @Override public int mbcCaseFold(int flag, byte[]bytes, IntHolder pp, int end, byte[]lower) { return asciiMbcCaseFold(flag, bytes, pp, end, lower); } protected final void asciiApplyAllCaseFold(int flag, ApplyAllCaseFoldFunction fun, Object arg) { int[]code = new int[]{0}; for (int i=0; i p) { if (!(EncLen[bytes[--p_] & 0xff] > 1)) { p_++; break; } } } int len = length(bytes, p_, end); if (p_ + len > s) return p_; p_ += len; return p_ + ((s - p_) & ~1); } @Override public boolean isReverseMatchAllowed(byte[]bytes, int p, int end) { return !CanBeTrailTable[bytes[p] & 0xff]; } }jcodings-jcodings-1.0.11/src/org/jcodings/CaseFoldCodeItem.java000066400000000000000000000026501223451536200243110ustar00rootroot00000000000000/* * Permission is hereby granted, free of charge, to any person obtaining a copy of * this software and associated documentation files (the "Software"), to deal in * the Software without restriction, including without limitation the rights to * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies * of the Software, and to permit persons to whom the Software is furnished to do * so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ package org.jcodings; public class CaseFoldCodeItem { static final int ENC_MAX_COMP_CASE_FOLD_CODE_LEN = 3; public final int byteLen; public final int codeLen; public final int code[]; public CaseFoldCodeItem(int byteLen, int codeLen, int[]code) { this.byteLen = byteLen; this.codeLen = codeLen; this.code = code; } } jcodings-jcodings-1.0.11/src/org/jcodings/CaseFoldMapEncoding.java000066400000000000000000000124011223451536200247770ustar00rootroot00000000000000/* * Permission is hereby granted, free of charge, to any person obtaining a copy of * this software and associated documentation files (the "Software"), to deal in * the Software without restriction, including without limitation the rights to * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies * of the Software, and to permit persons to whom the Software is furnished to do * so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ package org.jcodings; public abstract class CaseFoldMapEncoding extends SingleByteEncoding { protected final int[][]CaseFoldMap; protected final boolean foldFlag; protected CaseFoldMapEncoding(String name, short[]CTypeTable, byte[]LowerCaseTable, int[][]CaseFoldMap) { this(name, CTypeTable, LowerCaseTable, CaseFoldMap, true); } protected CaseFoldMapEncoding(String name, short[]CTypeTable, byte[]LowerCaseTable, int[][]CaseFoldMap, boolean foldFlag) { super(name, CTypeTable, LowerCaseTable); this.CaseFoldMap = CaseFoldMap; this.foldFlag = foldFlag; } /** onigenc_apply_all_case_fold_with_map */ protected final int applyAllCaseFoldWithMap(int mapSize, int[][]map, boolean essTsettFlag, int flag, ApplyAllCaseFoldFunction fun, Object arg) { asciiApplyAllCaseFold(flag, fun, arg); int[]code = new int[]{0}; for (int i=0; i p + 1 && (bytes[p+1] == (byte)0x53 || bytes[p+1] == (byte)0x73)) { /* SS */ CaseFoldCodeItem item1 = new CaseFoldCodeItem(2, 1, new int[]{0xdf}); return new CaseFoldCodeItem[]{item0, item1}; } else { return new CaseFoldCodeItem[]{item0}; } } else if (0x61 <= b && b <= 0x7a) { CaseFoldCodeItem item0 = new CaseFoldCodeItem(1, 1, new int[]{b - 0x20}); if (b == 0x73 && essTsettFlag && end >p + 1 && (bytes[p+1] == (byte)0x73 || bytes[p+1] == (byte)0x53)) { /* ss */ CaseFoldCodeItem item1 = new CaseFoldCodeItem(2, 1, new int[]{0xdf}); return new CaseFoldCodeItem[]{item0, item1}; } else { return new CaseFoldCodeItem[]{item0}; } } else if (b == 0xdf && essTsettFlag) { CaseFoldCodeItem item0 = new CaseFoldCodeItem(1, 2, new int[]{'s', 's'}); CaseFoldCodeItem item1 = new CaseFoldCodeItem(1, 2, new int[]{'S', 'S'}); CaseFoldCodeItem item2 = new CaseFoldCodeItem(1, 2, new int[]{'s', 'S'}); CaseFoldCodeItem item3 = new CaseFoldCodeItem(1, 2, new int[]{'S', 's'}); return new CaseFoldCodeItem[]{item0, item1, item2, item3}; } else { for (int i=0; i> 1; if (code > p[(x << 1) + 2]) { low = x + 1; } else { high = x; } } return low < n && code >= p[(low << 1) + 1]; } public static boolean isInCodeRange(int[]p, int offset, int code) { int low = 0; int n = p[offset]; int high = n ; while (low < high) { int x = (low + high) >> 1; if (code > p[(x << 1) + 2 + offset]) { low = x + 1; } else { high = x; } } return low < n && code >= p[(low << 1) + 1 + offset]; } } jcodings-jcodings-1.0.11/src/org/jcodings/Config.java000066400000000000000000000035561223451536200224320ustar00rootroot00000000000000/* * Permission is hereby granted, free of charge, to any person obtaining a copy of * this software and associated documentation files (the "Software"), to deal in * the Software without restriction, including without limitation the rights to * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies * of the Software, and to permit persons to whom the Software is furnished to do * so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ package org.jcodings; public interface Config { final boolean VANILLA = false; final int ENC_CASE_FOLD_TURKISH_AZERI = (1<<20); final int INTERNAL_ENC_CASE_FOLD_MULTI_CHAR = (1<<30); final int ENC_CASE_FOLD_MIN = INTERNAL_ENC_CASE_FOLD_MULTI_CHAR; final int ENC_CASE_FOLD_DEFAULT = ENC_CASE_FOLD_MIN; /* work size */ final int ENC_CODE_TO_MBC_MAXLEN = 7; final int ENC_MBC_CASE_FOLD_MAXLEN = 18; final int ENC_MAX_COMP_CASE_FOLD_CODE_LEN = 3; final int ENC_GET_CASE_FOLD_CODES_MAX_NUM = 13; /* 13 => Unicode:0x1ffc */ final boolean USE_UNICODE_CASE_FOLD_TURKISH_AZERI = false; final boolean USE_UNICODE_ALL_LINE_TERMINATORS = false; final boolean USE_CRNL_AS_LINE_TERMINATOR = false; final boolean USE_UNICODE_PROPERTIES = true; } jcodings-jcodings-1.0.11/src/org/jcodings/Encoding.java000066400000000000000000000415761223451536200227570ustar00rootroot00000000000000/* * Permission is hereby granted, free of charge, to any person obtaining a copy of * this software and associated documentation files (the "Software"), to deal in * the Software without restriction, including without limitation the rights to * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies * of the Software, and to permit persons to whom the Software is furnished to do * so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ package org.jcodings; import java.nio.charset.Charset; import org.jcodings.ascii.AsciiTables; import org.jcodings.constants.CharacterType; import org.jcodings.exception.EncodingException; import org.jcodings.exception.ErrorMessages; import org.jcodings.exception.InternalException; import org.jcodings.util.BytesHash; public abstract class Encoding implements Cloneable { public static final int CHAR_INVALID = -1; private static int count; protected final int minLength, maxLength; protected final boolean isFixedWidth, isSingleByte, isDummy, isAsciiCompatible; protected byte[]name; protected int hashCode; private int index; protected Charset charset = null; protected Encoding(String name, int minLength, int maxLength, boolean isDummy) { setName(name); this.minLength = minLength; this.maxLength = maxLength; this.isFixedWidth = minLength == maxLength; this.isSingleByte = isFixedWidth && minLength == 1; this.index = count++; this.isDummy = isDummy; this.isAsciiCompatible = minLength == 1 && !isDummy; } protected Encoding(String name, int minLength, int maxLength) { this(name, minLength, maxLength, false); } protected final void setName(String name) { this.name = name.getBytes(); this.hashCode = BytesHash.hashCode(this.name, 0, this.name.length); } protected final void setName(byte[]name) { this.name = name; this.hashCode = BytesHash.hashCode(this.name, 0, this.name.length); } @Override public final String toString() { return new String(name); } @Override public final boolean equals(Object other) { return this == other; } @Override public final int hashCode() { return hashCode; } public final int getIndex() { return index; } public final byte[]getName() { return name; } public final boolean isDummy() { return isDummy; } public final boolean isAsciiCompatible() { return isAsciiCompatible; } /** * If this encoding is capable of being represented by a Java Charset * then provide it. */ public Charset getCharset() { if (!isDummy() && charset == null && getCharsetName() != null) { charset = Charset.forName(getCharsetName()); } return charset; } public String getCharsetName() { // Enebo: I thought about just defaulting this to getName(), but then // for encodings which are unlikely to have charsets will constantly be // Charset.forName(), which seems like it would dramatically slow down // in that case over just getting a null back. So we are only overriding // based on very likely charsets. return null; } public Encoding replicate(byte[]name) { try { Encoding clone = (Encoding)clone(); clone.setName(name); clone.index = count++; return clone; } catch (CloneNotSupportedException cnse){ throw new EncodingException(ErrorMessages.ERR_COULD_NOT_REPLICATE, new String(name)); } } /** * Returns character length given character head * returns 1 for singlebyte encodings or performs direct length table lookup for multibyte ones. * * @param c * Character head * Oniguruma equivalent: mbc_enc_len * * To be deprecated very soon (use length(byte[]bytes, int p, int end) version) */ public abstract int length(byte c); /** * Returns character length given stream, character position and stream end * returns 1 for singlebyte encodings or performs sanity validations for multibyte ones * and returns the character length, missing characters in the stream otherwise * * @return * 0 Never * > 0 Valid character, length returned * -1 Illegal/malformed character * < -1 (-1 - n) Number of missing bytes for character in p...end range * * Oniguruma equivalent: mbc_enc_len * modified for 1.9 purposes, */ public abstract int length(byte[]bytes, int p, int end); /** * Returns maximum character byte length that can appear in an encoding * * Oniguruma equivalent: max_enc_len */ public final int maxLength() { return maxLength; } /* ONIGENC_MBC_MAXLEN_DIST */ public final int maxLengthDistance() { return maxLength(); } /** * Returns minimum character byte length that can appear in an encoding * * Oniguruma equivalent: min_enc_len */ public final int minLength() { return minLength; } /** * Returns true if bytes[p] is a head of a new line character * * Oniguruma equivalent: is_mbc_newline */ public abstract boolean isNewLine(byte[]bytes, int p, int end); /** * Returns code point for a character * * Oniguruma equivalent: mbc_to_code */ public abstract int mbcToCode(byte[]bytes, int p, int end); /** * Returns character length given a code point * * Oniguruma equivalent: code_to_mbclen */ public abstract int codeToMbcLength(int code); /** * Extracts code point into it's multibyte representation * * @return character length for the given code point * * Oniguruma equivalent: code_to_mbc */ public abstract int codeToMbc(int code, byte[]bytes, int p); /** * Performs case folding for a character at bytes[pp.value] * * @param flag case fold flag * @param pp an IntHolder that points at character head * @param to a buffer where to extract case folded character * * Oniguruma equivalent: mbc_case_fold */ public abstract int mbcCaseFold(int flag, byte[]bytes, IntHolder pp, int end, byte[]to); /** * Returns lower case table if it's safe to use it directly, otherwise null * Used for fast case insensitive matching for some singlebyte encodings * * @return lower case table */ public byte[] toLowerCaseTable() {return null;} /** * Expand case folds given a character class (used for case insensitive matching) * * @param flag case fold flag * @param fun case folding functor (look at: ApplyCaseFold) * @param arg case folding functor argument (look at: ApplyCaseFoldArg) * * Oniguruma equivalent: apply_all_case_fold */ public abstract void applyAllCaseFold(int flag, ApplyAllCaseFoldFunction fun, Object arg); /** * Expand AST string nodes into their folded alternatives (look at: Analyser.expandCaseFoldString) * * Oniguruma equivalent: get_case_fold_codes_by_str */ public abstract CaseFoldCodeItem[]caseFoldCodesByString(int flag, byte[]bytes, int p, int end); /** * Returns character type given character type name (used when e.g. \p{Alpha}) * * Oniguruma equivalent: property_name_to_ctype */ public abstract int propertyNameToCType(byte[]bytes, int p, int end); /** * Perform a check whether given code is of given character type (e.g. used by isWord(someByte) and similar methods) * * @param code a code point of a character * @param ctype a character type to check against * * Oniguruma equivalent: is_code_ctype */ public abstract boolean isCodeCType(int code, int ctype); /** * Returns code range for a given character type * * Oniguruma equivalent: get_ctype_code_range */ public abstract int[]ctypeCodeRange(int ctype, IntHolder sbOut); /** * Seeks the previous character head in a stream * * Oniguruma equivalent: left_adjust_char_head * * @param bytes byte stream * @param p position * @param s stop * @param end end */ public abstract int leftAdjustCharHead(byte[]bytes, int p, int s, int end); /** * Returns true if it's safe to use reversal Boyer-Moore search fail fast algorithm * * Oniguruma equivalent: is_allowed_reverse_match */ public abstract boolean isReverseMatchAllowed(byte[]bytes, int p, int end); /* onigenc_get_right_adjust_char_head / ONIGENC_LEFT_ADJUST_CHAR_HEAD */ public final int rightAdjustCharHead(byte[]bytes, int p, int s, int end) { int p_ = leftAdjustCharHead(bytes, p, s, end); if (p_ < s) p_ += length(bytes, p_, end); return p_; } /* onigenc_get_right_adjust_char_head_with_prev */ public final int rightAdjustCharHeadWithPrev(byte[]bytes, int p, int s, int end, IntHolder prev) { int p_ = leftAdjustCharHead(bytes, p, s, end); if (p_ < s) { if (prev != null) prev.value = p_; p_ += length(bytes, p_, end); } else { if (prev != null) prev.value = -1; /* Sorry */ } return p_; } /* onigenc_get_prev_char_head */ public final int prevCharHead(byte[]bytes, int p, int s, int end) { if (s <= p) return -1; // ?? return leftAdjustCharHead(bytes, p, s - 1, end); } /* onigenc_step_back */ public final int stepBack(byte[]bytes, int p, int s, int end, int n) { while (s != -1 && n-- > 0) { if (s <= p) return -1; s = leftAdjustCharHead(bytes, p, s - 1, end); } return s; } /* onigenc_step */ public final int step(byte[]bytes, int p, int end, int n) { int q = p; while (n-- > 0) { q += length(bytes, q, end); } return q <= end ? q : -1; } /* onigenc_strlen */ public abstract int strLength(byte[]bytes, int p, int end); public abstract int strCodeAt(byte[]bytes, int p, int end, int index); /* onigenc_strlen_null */ public final int strLengthNull(byte[]bytes, int p, int end) { int n = 0; while (true) { if (bytes[p] == 0) { int len = minLength(); if (len == 1) return n; int q = p + 1; while (len > 1) { if (bytes[q] != 0) break; q++; len--; } if (len == 1) return n; } p += length(bytes, p, end); n++; } } /* onigenc_str_bytelen_null */ public final int strByteLengthNull(byte[]bytes, int p, int end) { int p_, start; p_ = start = 0; while (true) { if (bytes[p_] == 0) { int len = minLength(); if (len == 1) return p_ - start; int q = p_ + 1; while (len > 1) { if (q >= bytes.length) return p_ - start; if (bytes[q] != 0) break; q++; len--; } if (len == 1) return p_ - start; } p_ += length(bytes, p_, end); } } /* onigenc_with_ascii_strncmp */ public final int strNCmp(byte[]bytes, int p, int end, byte[]ascii, int asciiP, int n) { while (n-- > 0) { if (p >= end) return ascii[asciiP]; int c = mbcToCode(bytes, p, end); int x = ascii[asciiP] - c; if (x != 0) return x; asciiP++; p += length(bytes, p, end); } return 0; } public final boolean isNewLine(int code) { return isCodeCType(code, CharacterType.NEWLINE); } public final boolean isGraph(int code) { return isCodeCType(code, CharacterType.GRAPH); } public final boolean isPrint(int code) { return isCodeCType(code, CharacterType.PRINT); } public final boolean isAlnum(int code) { return isCodeCType(code, CharacterType.ALNUM); } public final boolean isAlpha(int code) { return isCodeCType(code, CharacterType.ALPHA); } public final boolean isLower(int code) { return isCodeCType(code, CharacterType.LOWER); } public final boolean isUpper(int code) { return isCodeCType(code, CharacterType.UPPER); } public final boolean isCntrl(int code) { return isCodeCType(code, CharacterType.CNTRL); } public final boolean isPunct(int code) { return isCodeCType(code, CharacterType.PUNCT); } public final boolean isSpace(int code) { return isCodeCType(code, CharacterType.SPACE); } public final boolean isBlank(int code) { return isCodeCType(code, CharacterType.BLANK); } public final boolean isDigit(int code) { return isCodeCType(code, CharacterType.DIGIT); } public final boolean isXDigit(int code) { return isCodeCType(code, CharacterType.XDIGIT); } public final boolean isWord(int code) { return isCodeCType(code, CharacterType.WORD); } // ONIGENC_IS_MBC_WORD public final boolean isMbcWord(byte[]bytes, int p, int end) { return isWord(mbcToCode(bytes, p, end)); } // IS_CODE_SB_WORD public final boolean isSbWord(int code) { return isAscii(code) && isWord(code); } // ONIGENC_IS_MBC_HEAD public final boolean isMbcHead(byte[]bytes, int p, int end) { return length(bytes, p, end) != 1; } public boolean isMbcCrnl(byte[]bytes, int p, int end) { return mbcToCode(bytes, p, end) == 13 && isNewLine(bytes, p + length(bytes, p, end), end); } // ============================================================ // helpers // ============================================================ public static int digitVal(int code) { return code - '0'; } public static int odigitVal(int code) { return digitVal(code); } public final int xdigitVal(int code) { if (isDigit(code)) { return digitVal(code); } else { return isUpper(code) ? code - 'A' + 10 : code - 'a' + 10; } } // ONIGENC_IS_MBC_ASCII public static boolean isMbcAscii(byte b) { return (b & 0xff) < 128; // b > 0 ? } // ONIGENC_IS_CODE_ASCII public static boolean isAscii(int code) { return code < 128; } public static boolean isAscii(byte b) { return b >= 0; } public static byte asciiToLower(int c) { return AsciiTables.ToLowerCaseTable[c]; } public static byte asciiToUpper(int c) { return AsciiTables.ToUpperCaseTable[c]; } public static boolean isWordGraphPrint(int ctype) { return ctype == CharacterType.WORD || ctype == CharacterType.GRAPH || ctype == CharacterType.PRINT; } public final int mbcodeStartPosition() { return minLength() > 1 ? 0 : 0x80; } public final boolean isSingleByte() { return isSingleByte; } public final boolean isFixedWidth() { return isFixedWidth; } public static final byte NEW_LINE = (byte)0x0a; public static Encoding load(String name) { String encClassName = "org.jcodings.specific." + name + "Encoding"; Class encClass; try { encClass = Class.forName(encClassName); } catch (ClassNotFoundException cnfe) { throw new InternalException(ErrorMessages.ERR_ENCODING_CLASS_DEF_NOT_FOUND, encClassName); } try { return (Encoding)encClass.getField("INSTANCE").get(encClass); } catch (Exception e) { throw new InternalException(ErrorMessages.ERR_ENCODING_LOAD_ERROR, encClassName); } } } jcodings-jcodings-1.0.11/src/org/jcodings/EncodingDB.java000066400000000000000000000167261223451536200231640ustar00rootroot00000000000000/* * Permission is hereby granted, free of charge, to any person obtaining a copy of * this software and associated documentation files (the "Software"), to deal in * the Software without restriction, including without limitation the rights to * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies * of the Software, and to permit persons to whom the Software is furnished to do * so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ package org.jcodings; import org.jcodings.exception.ErrorMessages; import org.jcodings.exception.InternalException; import org.jcodings.specific.ASCIIEncoding; import org.jcodings.util.CaseInsensitiveBytesHash; public class EncodingDB { public static final class Entry { private static int count; private final Entry base; private Encoding encoding; private final String encodingClass; private final int index; private final boolean isDummy; private final byte[]name; private Entry (byte[]name, String encodingClass, Entry base, boolean isDummy) { this.name = name; this.encodingClass = encodingClass; this.base = base; this.isDummy = isDummy; index = count++; } // declare Entry(String encodingClass) { this(null, encodingClass, null, false); } // replicate Entry(byte[]name, Entry base) { this(name, base.encodingClass, base, false); } // dummy Entry(byte[]name) { this(name, ascii.encodingClass, ascii, true); } @Override public int hashCode() { return encodingClass.hashCode(); } public Entry getBase() { return base; } public Encoding getEncoding() { if (encoding == null) { if (name == null) { encoding = Encoding.load(encodingClass); } else { if (isDummy) { encoding = ASCIIEncoding.DUMMY.replicate(name); } else { encoding = Encoding.load(encodingClass).replicate(name); } } } return encoding; } public String getEncodingClass() { return encodingClass; } public int getIndex() { return index; } public boolean isDummy() { return isDummy; } } private static String[] builtin = { "ASCII-8BIT", "ASCII", "Big5", "BIG5", "Big5-HKSCS", "Big5HKSCS", "Big5-UAO", "Big5UAO", "CP949", "CP949", "Emacs-Mule", "EmacsMule", "EUC-JP", "EUCJP", "EUC-KR", "EUCKR", "EUC-TW", "EUCTW", "GB18030", "GB18030", "GBK", "GBK", "ISO-8859-1", "ISO8859_1", "ISO-8859-2", "ISO8859_2", "ISO-8859-3", "ISO8859_3", "ISO-8859-4", "ISO8859_4", "ISO-8859-5", "ISO8859_5", "ISO-8859-6", "ISO8859_6", "ISO-8859-7", "ISO8859_7", "ISO-8859-8", "ISO8859_8", "ISO-8859-9", "ISO8859_9", "ISO-8859-10", "ISO8859_10", "ISO-8859-11", "ISO8859_11", // "ISO-8859-12", "ISO8859_12", "ISO-8859-13", "ISO8859_13", "ISO-8859-14", "ISO8859_14", "ISO-8859-15", "ISO8859_15", "ISO-8859-16", "ISO8859_16", "KOI8-R", "KOI8R", "KOI8-U", "KOI8U", "Shift_JIS", "SJIS", "US-ASCII", "USASCII", "UTF-8", "UTF8", "UTF-16BE", "UTF16BE", "UTF-16LE", "UTF16LE", "UTF-32BE", "UTF32BE", "UTF-32LE", "UTF32LE", "Windows-1251", "CP1251", "GB2312", "EUCKR" // done via rb_enc_register }; static Entry ascii; static final CaseInsensitiveBytesHash encodings = new CaseInsensitiveBytesHash(builtin.length); static final CaseInsensitiveBytesHash aliases = new CaseInsensitiveBytesHash(builtin.length); public static final CaseInsensitiveBytesHash getEncodings() { return encodings; } public static final CaseInsensitiveBytesHash getAliases() { return aliases; } public static void declare(String name, String encodingClass) { byte[]bytes = name.getBytes(); if (encodings.get(bytes) != null) throw new InternalException(ErrorMessages.ERR_ENCODING_ALREADY_REGISTERED, name); encodings.putDirect(bytes, new Entry(encodingClass)); } public static void alias(String alias, String original) { byte[]origBytes = original.getBytes(); Entry originalEntry = encodings.get(origBytes); if (originalEntry == null) throw new InternalException(ErrorMessages.ERR_NO_SUCH_ENCODNG, original); byte[]aliasBytes = alias.getBytes(); if (aliases.get(aliasBytes) != null) throw new InternalException(ErrorMessages.ERR_ENCODING_ALIAS_ALREADY_REGISTERED, alias); aliases.putDirect(aliasBytes, originalEntry); } public static void replicate(String replica, String original) { byte[]origBytes = original.getBytes(); Entry originalEntry = encodings.get(origBytes); if (originalEntry == null) throw new InternalException(ErrorMessages.ERR_NO_SUCH_ENCODNG, original); byte[]replicaBytes = replica.getBytes(); if (encodings.get(replicaBytes) != null) throw new InternalException(ErrorMessages.ERR_ENCODING_REPLICA_ALREADY_REGISTERED, replica); encodings.putDirect(replicaBytes, new Entry(replicaBytes, originalEntry)); } public static void set_base(String name, String original) { } public static void dummy(String name) { byte[]bytes = name.getBytes(); if (encodings.get(bytes) != null) throw new InternalException(ErrorMessages.ERR_ENCODING_ALREADY_REGISTERED, name); encodings.putDirect(bytes, new Entry(bytes)); } static { for (int i = 0; i < builtin.length / 2; i++) { declare(builtin[i << 1], builtin[(i << 1) + 1]); } builtin = null; ascii = encodings.get("ASCII-8BIT".getBytes()); String[][]encList = EncodingList.LIST; for (int i = 0; i < encList.length; i++) { String[]enc = encList[i]; switch (enc[0].charAt(0)) { case 'R': replicate(enc[1], enc[2]); break; case 'A': alias(enc[1], enc[2]); break; case 'S': set_base(enc[1], enc[2]); break; case 'D': dummy(enc[1]); break; default: throw new InternalException("Unknown flag: " + enc[0].charAt(0)); } } } } jcodings-jcodings-1.0.11/src/org/jcodings/EncodingList.java000066400000000000000000000145501223451536200236030ustar00rootroot00000000000000/* * Permission is hereby granted, free of charge, to any person obtaining a copy of * this software and associated documentation files (the "Software"), to deal in * the Software without restriction, including without limitation the rights to * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies * of the Software, and to permit persons to whom the Software is furnished to do * so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ package org.jcodings; final class EncodingList { static final String[][] LIST = new String[][] { {"A", "BINARY", "ASCII-8BIT"}, {"R", "IBM437", "ASCII-8BIT"}, {"A", "CP437", "IBM437"}, {"R", "IBM737", "ASCII-8BIT"}, {"A", "CP737", "IBM737"}, {"R", "IBM775", "ASCII-8BIT"}, {"A", "CP775", "IBM775"}, {"R", "CP850", "ASCII-8BIT"}, {"A", "IBM850", "CP850"}, {"R", "IBM852", "ASCII-8BIT"}, {"R", "CP852", "IBM852"}, {"R", "IBM855", "ASCII-8BIT"}, {"R", "CP855", "IBM855"}, {"R", "IBM857", "ASCII-8BIT"}, {"A", "CP857", "IBM857"}, {"R", "IBM860", "ASCII-8BIT"}, {"A", "CP860", "IBM860"}, {"R", "IBM861", "ASCII-8BIT"}, {"A", "CP861", "IBM861"}, {"R", "IBM862", "ASCII-8BIT"}, {"A", "CP862", "IBM862"}, {"R", "IBM863", "ASCII-8BIT"}, {"A", "CP863", "IBM863"}, {"R", "IBM864", "ASCII-8BIT"}, {"A", "CP864", "IBM864"}, {"R", "IBM865", "ASCII-8BIT"}, {"A", "CP865", "IBM865"}, {"R", "IBM866", "ASCII-8BIT"}, {"A", "CP866", "IBM866"}, {"R", "IBM869", "ASCII-8BIT"}, {"A", "CP869", "IBM869"}, {"R", "Windows-1258", "ASCII-8BIT"}, {"A", "CP1258", "Windows-1258"}, {"R", "GB1988", "ASCII-8BIT"}, {"R", "macCentEuro", "ASCII-8BIT"}, {"R", "macCroatian", "ASCII-8BIT"}, {"R", "macCyrillic", "ASCII-8BIT"}, {"R", "macGreek", "ASCII-8BIT"}, {"R", "macIceland", "ASCII-8BIT"}, {"R", "macRoman", "ASCII-8BIT"}, {"R", "macRomania", "ASCII-8BIT"}, {"R", "macThai", "ASCII-8BIT"}, {"R", "macTurkish", "ASCII-8BIT"}, {"R", "macUkraine", "ASCII-8BIT"}, {"R", "CP950", "Big5"}, {"S", "Big5-HKSCS", "Big5"}, {"A", "Big5-HKSCS:2008", "Big5-HKSCS"}, {"R", "CP951", "Big5-HKSCS"}, {"S", "Big5-UAO", "Big5"}, {"R", "stateless-ISO-2022-JP", "Emacs-Mule"}, {"A", "eucJP", "EUC-JP" /* UI-OSF Application Platform Profile for Japanese Environment Version 1.1 */}, {"R", "eucJP-ms", "EUC-JP" /* TOG/JVC CDE/Motif Technical WG */}, {"A", "euc-jp-ms", "eucJP-ms"}, {"R", "CP51932", "EUC-JP"}, {"A", "eucKR", "EUC-KR"}, {"A", "eucTW", "EUC-TW"}, {"A", "EUC-CN", "GB2312"}, {"A", "eucCN", "GB2312"}, {"R", "GB12345", "GB2312"}, {"A", "CP936", "GBK"}, {"D", "ISO-2022-JP"}, {"A", "ISO2022-JP", "ISO-2022-JP"}, {"R", "ISO-2022-JP-2", "ISO-2022-JP"}, {"A", "ISO2022-JP2", "ISO-2022-JP-2"}, {"R", "CP50220", "ISO-2022-JP"}, {"R", "CP50221", "ISO-2022-JP"}, {"A", "ISO8859-1", "ISO-8859-1"}, {"R", "Windows-1252", "ISO-8859-1"}, {"A", "CP1252", "Windows-1252"}, {"A", "ISO8859-2", "ISO-8859-2"}, {"R", "Windows-1250", "ISO-8859-2"}, {"A", "CP1250", "Windows-1250"}, {"A", "ISO8859-3", "ISO-8859-3"}, {"A", "ISO8859-4", "ISO-8859-4"}, {"A", "ISO8859-5", "ISO-8859-5"}, {"A", "ISO8859-6", "ISO-8859-6"}, {"R", "Windows-1256", "ISO-8859-6"}, {"A", "CP1256", "Windows-1256"}, {"A", "ISO8859-7", "ISO-8859-7"}, {"R", "Windows-1253", "ISO-8859-7"}, {"A", "CP1253", "Windows-1253"}, {"A", "ISO8859-8", "ISO-8859-8"}, {"R", "Windows-1255", "ISO-8859-8"}, {"A", "CP1255", "Windows-1255"}, {"A", "ISO8859-9", "ISO-8859-9"}, {"R", "Windows-1254", "ISO-8859-9"}, {"A", "CP1254", "Windows-1254"}, {"A", "ISO8859-10", "ISO-8859-10"}, {"A", "ISO8859-11", "ISO-8859-11"}, {"R", "TIS-620", "ISO-8859-11"}, {"R", "Windows-874", "ISO-8859-11"}, {"A", "CP874", "Windows-874"}, {"A", "ISO8859-13", "ISO-8859-13"}, {"R", "Windows-1257", "ISO-8859-13"}, {"A", "CP1257", "Windows-1257"}, {"A", "ISO8859-14", "ISO-8859-14"}, {"A", "ISO8859-15", "ISO-8859-15"}, {"A", "ISO8859-16", "ISO-8859-16"}, {"A", "CP878", "KOI8-R"}, {"R", "Windows-31J", "Shift_JIS"}, {"A", "CP932", "Windows-31J"}, {"A", "csWindows31J", "Windows-31J" /* IANA. IE6 don't accept Windows-31J but csWindows31J. */}, {"A", "SJIS", "Windows-31J"}, {"A", "PCK", "Windows-31J"}, {"R", "MacJapanese", "Shift_JIS"}, {"A", "MacJapan", "MacJapanese"}, {"A", "ASCII", "US-ASCII"}, {"A", "ANSI_X3.4-1968", "US-ASCII"}, {"A", "646", "US-ASCII"}, {"D", "UTF-7"}, {"A", "CP65000", "UTF-7"}, {"A", "CP65001", "UTF-8"}, {"R", "UTF8-MAC", "UTF-8"}, {"A", "UTF-8-MAC", "UTF8-MAC"}, {"A", "UTF-8-HFS", "UTF8-MAC" /* Emacs 23.2 */}, {"D", "UTF-16"}, {"D", "UTF-32"}, {"A", "UCS-2BE", "UTF-16BE"}, {"A", "UCS-4BE", "UTF-32BE"}, {"A", "UCS-4LE", "UTF-32LE"}, {"A", "CP1251", "Windows-1251"}, {"R", "UTF8-DoCoMo", "UTF-8"}, {"R", "SJIS-DoCoMo", "Windows-31J"}, {"R", "UTF8-KDDI", "UTF-8"}, {"R", "SJIS-KDDI", "Windows-31J"}, {"R", "ISO-2022-JP-KDDI", "ISO-2022-JP"}, {"R", "stateless-ISO-2022-JP-KDDI", "stateless-ISO-2022-JP"}, {"R", "UTF8-SoftBank", "UTF-8"}, {"R", "SJIS-SoftBank", "Windows-31J"} }; }jcodings-jcodings-1.0.11/src/org/jcodings/EucEncoding.java000066400000000000000000000035151223451536200234030ustar00rootroot00000000000000/* * Permission is hereby granted, free of charge, to any person obtaining a copy of * this software and associated documentation files (the "Software"), to deal in * the Software without restriction, including without limitation the rights to * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies * of the Software, and to permit persons to whom the Software is furnished to do * so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ package org.jcodings; public abstract class EucEncoding extends MultiByteEncoding { protected EucEncoding(String name, int minLength, int maxLength, int[]EncLen, int[][]Trans, short[]CTypeTable) { super(name, minLength, maxLength, EncLen, Trans, CTypeTable); } protected abstract boolean isLead(int c); @Override public int leftAdjustCharHead(byte[]bytes, int p, int s, int end) { /* In this encoding mb-trail bytes doesn't mix with single bytes. */ if (s <= p) return s; int p_ = s; while (!isLead(bytes[p_] & 0xff) && p_ > p) p_--; int len = length(bytes, p_, end); if (p_ + len > s) return p_; p_ += len; return p_ + ((s - p_) & ~1); } } jcodings-jcodings-1.0.11/src/org/jcodings/ISOEncoding.java000066400000000000000000000043701223451536200233210ustar00rootroot00000000000000/* * Permission is hereby granted, free of charge, to any person obtaining a copy of * this software and associated documentation files (the "Software"), to deal in * the Software without restriction, including without limitation the rights to * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies * of the Software, and to permit persons to whom the Software is furnished to do * so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ package org.jcodings; public abstract class ISOEncoding extends CaseFoldMapEncoding { protected ISOEncoding(String name, short[]CTypeTable, byte[]LowerCaseTable, int[][]CaseFoldMap) { this(name, CTypeTable, LowerCaseTable, CaseFoldMap, true); } protected ISOEncoding(String name, short[]CTypeTable, byte[]LowerCaseTable, int[][]CaseFoldMap, boolean foldFlag) { super(name, CTypeTable, LowerCaseTable, CaseFoldMap, foldFlag); } @Override public String getCharsetName() { return new String(getName()); } /** iso_*_mbc_case_fold */ @Override public int mbcCaseFold(int flag, byte[]bytes, IntHolder pp, int end, byte[]lower) { int p = pp.value; int lowerP = 0; if (bytes[p] == (byte)0xdf && (flag & Config.INTERNAL_ENC_CASE_FOLD_MULTI_CHAR) != 0) { lower[lowerP++] = 's'; lower[lowerP] = 's'; pp.value++; return 2; } lower[lowerP] = LowerCaseTable[bytes[p] & 0xff]; pp.value++; return 1; } @Override public boolean isCodeCType(int code, int ctype) { return code < 256 ? isCodeCTypeInternal(code, ctype) : false; } } jcodings-jcodings-1.0.11/src/org/jcodings/IntHolder.java000066400000000000000000000021771223451536200231130ustar00rootroot00000000000000/* * Permission is hereby granted, free of charge, to any person obtaining a copy of * this software and associated documentation files (the "Software"), to deal in * the Software without restriction, including without limitation the rights to * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies * of the Software, and to permit persons to whom the Software is furnished to do * so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ package org.jcodings; public class IntHolder { public int value; } jcodings-jcodings-1.0.11/src/org/jcodings/MultiByteEncoding.java000066400000000000000000000171011223451536200246010ustar00rootroot00000000000000/* * Permission is hereby granted, free of charge, to any person obtaining a copy of * this software and associated documentation files (the "Software"), to deal in * the Software without restriction, including without limitation the rights to * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies * of the Software, and to permit persons to whom the Software is furnished to do * so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ package org.jcodings; import org.jcodings.ascii.AsciiTables; import org.jcodings.exception.EncodingException; import org.jcodings.exception.ErrorMessages; public abstract class MultiByteEncoding extends AbstractEncoding { protected final int EncLen[]; protected static final int A = -1; // ACCEPT protected static final int F = -2; // FAILURE protected final int Trans[][]; protected final int TransZero[]; protected MultiByteEncoding(String name, int minLength, int maxLength, int[]EncLen, int[][]Trans, short[]CTypeTable) { super(name, minLength, maxLength, CTypeTable); this.EncLen = EncLen; this.Trans = Trans; this.TransZero = Trans != null ? Trans[0] : null; } @Override public int length(byte c) { return EncLen[c & 0xff]; } protected final int missing(int n) { return -1 - n; } protected final int missing(int b, int delta) { return missing(EncLen[b] - delta); } protected final int safeLengthForUptoFourGreatedThan127(byte[]bytes, int p ,int end) { int b = bytes[p] & 0xff; int s = TransZero[b]; if (s < 0) return s == A ? 1 : CHAR_INVALID; return lengthForTwoUptoFour(bytes, p, end, b, s); } protected final int safeLengthForUptoFour(byte[]bytes, int p ,int end) { int b = bytes[p] & 0xff; int s = TransZero[b]; if (s < 0) return s == A ? 1 : CHAR_INVALID; return lengthForTwoUptoFour(bytes, p, end, b, s); } protected final int lengthForTwoUptoFour(byte[]bytes, int p, int end, int b, int s) { if (++p == end) return missing(b, 1); s = Trans[s][bytes[p] & 0xff]; if (s < 0) return s == A ? 2 : CHAR_INVALID; return lengthForThreeUptoFour(bytes, p, end, b, s); } private int lengthForThreeUptoFour(byte[]bytes, int p, int end, int b, int s) { if (++p == end) return missing(b, 2); s = Trans[s][bytes[p] & 0xff]; if (s < 0) return s == A ? 3 : CHAR_INVALID; if (++p == end) return missing(b, 3); s = Trans[s][bytes[p] & 0xff]; return s == A ? 4 : CHAR_INVALID; } protected final int safeLengthForUptoThree(byte[]bytes, int p, int end) { int b = bytes[p] & 0xff; int s = TransZero[b]; if (s < 0) return s == A ? 1 : CHAR_INVALID; return lengthForTwoUptoThree(bytes, p, end, b, s); } private int lengthForTwoUptoThree(byte[]bytes, int p, int end, int b, int s) { if (++p == end) return missing(b, 1); s = Trans[s][bytes[p] & 0xff]; if (s < 0) return s == A ? 2 : CHAR_INVALID; return lengthForThree(bytes, p, end, b, s); } private int lengthForThree(byte[]bytes, int p, int end, int b, int s) { if (++p == end) return missing(b, 2); s = Trans[s][bytes[p] & 0xff]; return s == A ? 3 : CHAR_INVALID; } protected final int safeLengthForUptoTwo(byte[]bytes, int p, int end) { int b = bytes[p] & 0xff; int s = TransZero[b]; if (s < 0) return s == A ? 1 : CHAR_INVALID; return lengthForTwo(bytes, p, end, b, s); } private int lengthForTwo(byte[]bytes, int p, int end, int b, int s) { if (++p == end) return missing(b, 1); s = Trans[s][bytes[p] & 0xff]; return s == A ? 2 : CHAR_INVALID; } protected final int mbnMbcToCode(byte[]bytes, int p, int end) { int len = length(bytes, p, end); int n = bytes[p++] & 0xff; if (len == 1) return n; for (int i=1; i= end) break; int c = bytes[p++] & 0xff; n <<= 8; n += c; } return n; } protected final int mbnMbcCaseFold(int flag, byte[]bytes, IntHolder pp, int end, byte[]lower) { int p = pp.value; int lowerP = 0; if (isAscii(bytes[p] & 0xff)) { lower[lowerP] = AsciiTables.ToLowerCaseTable[bytes[p] & 0xff]; pp.value++; return 1; } else { int len = length(bytes, p, end); for (int i=0; i>> 8) & 0xff); } bytes[p_++] = (byte)(code & 0xff); if (length(bytes, p, p_) != (p_ - p)) throw new EncodingException(ErrorMessages.ERR_INVALID_CODE_POINT_VALUE); return p_ - p; } protected final int mb4CodeToMbc(int code, byte[]bytes, int p) { int p_ = p; if ((code & 0xff000000) != 0) bytes[p_++] = (byte)((code >>> 24) & 0xff); if ((code & 0xff0000) != 0 || p_ != p) bytes[p_++] = (byte)((code >>> 16) & 0xff); if ((code & 0xff00) != 0 || p_ != p) bytes[p_++] = (byte)((code >>> 8) & 0xff); bytes[p_++] = (byte)(code & 0xff); if (length(bytes, p, p_) != (p_ - p)) throw new EncodingException(ErrorMessages.ERR_INVALID_CODE_POINT_VALUE); return p_ - p; } protected final boolean mb2IsCodeCType(int code, int ctype) { if (code < 128) { return isCodeCTypeInternal(code, ctype); // configured with ascii } else { if (isWordGraphPrint(ctype)) { return codeToMbcLength(code) > 1; } } return false; } protected final boolean mb4IsCodeCType(int code, int ctype) { return mb2IsCodeCType(code, ctype); } /* onigenc_strlen */ public int strLength(byte[]bytes, int p, int end) { int n = 0; int q = p; while (q < end) { q += length(bytes, q, end); n++; } return n; } public int strCodeAt(byte[]bytes, int p, int end, int index) { int n = 0; int q = p; while (q < end) { if (n == index) return mbcToCode(bytes, q, end); q += length(bytes, q, end); n++; } return -1; } } jcodings-jcodings-1.0.11/src/org/jcodings/ObjPtr.java000066400000000000000000000024361223451536200224210ustar00rootroot00000000000000/* * Permission is hereby granted, free of charge, to any person obtaining a copy of * this software and associated documentation files (the "Software"), to deal in * the Software without restriction, including without limitation the rights to * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies * of the Software, and to permit persons to whom the Software is furnished to do * so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ package org.jcodings; public final class ObjPtr { public ObjPtr() { this(null); } public ObjPtr(T p) { this.p = p; } public T p; static final ObjPtr NULL = new ObjPtr(); } jcodings-jcodings-1.0.11/src/org/jcodings/Ptr.java000066400000000000000000000024111223451536200217570ustar00rootroot00000000000000/* * Permission is hereby granted, free of charge, to any person obtaining a copy of * this software and associated documentation files (the "Software"), to deal in * the Software without restriction, including without limitation the rights to * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies * of the Software, and to permit persons to whom the Software is furnished to do * so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ package org.jcodings; public final class Ptr { public Ptr() { this(0); } public Ptr(int p) { this.p = p; } public int p; public static final Ptr NULL = new Ptr(0); } jcodings-jcodings-1.0.11/src/org/jcodings/SingleByteEncoding.java000066400000000000000000000072741223451536200247420ustar00rootroot00000000000000/* * Permission is hereby granted, free of charge, to any person obtaining a copy of * this software and associated documentation files (the "Software"), to deal in * the Software without restriction, including without limitation the rights to * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies * of the Software, and to permit persons to whom the Software is furnished to do * so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ package org.jcodings; import org.jcodings.exception.EncodingException; import org.jcodings.exception.ErrorMessages; public abstract class SingleByteEncoding extends AbstractEncoding { protected final byte[] LowerCaseTable; protected int codeSize = 0xff; protected SingleByteEncoding(String name, short[] CTypeTable, byte[] LowerCaseTable) { super(name, 1, 1, CTypeTable); this.LowerCaseTable = LowerCaseTable; } protected SingleByteEncoding(String name, short[] CTypeTable, byte[] LowerCaseTable, boolean isDummy) { super(name, 1, 1, CTypeTable, isDummy); this.LowerCaseTable = LowerCaseTable; } protected SingleByteEncoding(String name, short[] CTypeTable, byte[] LowerCaseTable, boolean isDummy, int codeSize) { this(name, CTypeTable, LowerCaseTable, isDummy); this.codeSize = codeSize; } /** onigenc_single_byte_mbc_enc_len */ @Override public int length(byte c) { return 1; } @Override public int length(byte[] bytes, int p, int end) { return 1; } @Override public final int strLength(byte[] bytes, int p, int end) { return end - p; } @Override public int strCodeAt(byte[] bytes, int p, int end, int index) { return bytes[index] & 0xff; } // onigenc_is_mbc_newline_0x0a here /** onigenc_single_byte_mbc_to_code */ @Override public int mbcToCode(byte[] bytes, int p, int end) { return bytes[p] & 0xff; } /** onigenc_single_byte_code_to_mbclen */ @Override public int codeToMbcLength(int code) { if (Config.VANILLA) { if (code <= codeSize) return 1; throw new EncodingException(ErrorMessages.ERR_INVALID_CODE_POINT_VALUE); } else { return 1; } } /** onigenc_single_byte_code_to_mbc */ @Override public final int codeToMbc(int code, byte[] bytes, int p) { if (code > codeSize) throw new EncodingException("out of range char"); bytes[p] = (byte)(code & 0xff); // c implementation also uses mask here return 1; } /** onigenc_not_support_get_ctype_code_range */ @Override public final int[] ctypeCodeRange(int ctype, IntHolder sbOut) { return null; } /** onigenc_single_byte_left_adjust_char_head */ @Override public final int leftAdjustCharHead(byte[] bytes, int p, int s, int end) { return s; } /** onigenc_always_true_is_allowed_reverse_match */ @Override public final boolean isReverseMatchAllowed(byte[] bytes, int p, int end) { return true; } } jcodings-jcodings-1.0.11/src/org/jcodings/ascii/000077500000000000000000000000001223451536200214415ustar00rootroot00000000000000jcodings-jcodings-1.0.11/src/org/jcodings/ascii/AsciiTables.java000066400000000000000000000272231223451536200244750ustar00rootroot00000000000000/* * Permission is hereby granted, free of charge, to any person obtaining a copy of * this software and associated documentation files (the "Software"), to deal in * the Software without restriction, including without limitation the rights to * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies * of the Software, and to permit persons to whom the Software is furnished to do * so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ package org.jcodings.ascii; public class AsciiTables { public static final short AsciiCtypeTable[] = { 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x420c, 0x4209, 0x4208, 0x4208, 0x4208, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4284, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x7ca2, 0x7ca2, 0x7ca2, 0x7ca2, 0x7ca2, 0x7ca2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x51a0, 0x41a0, 0x78e2, 0x78e2, 0x78e2, 0x78e2, 0x78e2, 0x78e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x4008, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 }; public static final byte ToLowerCaseTable[] = { (byte)'\000', (byte)'\001', (byte)'\002', (byte)'\003', (byte)'\004', (byte)'\005', (byte)'\006', (byte)'\007', (byte)'\010', (byte)'\011', (byte)'\012', (byte)'\013', (byte)'\014', (byte)'\015', (byte)'\016', (byte)'\017', (byte)'\020', (byte)'\021', (byte)'\022', (byte)'\023', (byte)'\024', (byte)'\025', (byte)'\026', (byte)'\027', (byte)'\030', (byte)'\031', (byte)'\032', (byte)'\033', (byte)'\034', (byte)'\035', (byte)'\036', (byte)'\037', (byte)'\040', (byte)'\041', (byte)'\042', (byte)'\043', (byte)'\044', (byte)'\045', (byte)'\046', (byte)'\047', (byte)'\050', (byte)'\051', (byte)'\052', (byte)'\053', (byte)'\054', (byte)'\055', (byte)'\056', (byte)'\057', (byte)'\060', (byte)'\061', (byte)'\062', (byte)'\063', (byte)'\064', (byte)'\065', (byte)'\066', (byte)'\067', (byte)'\070', (byte)'\071', (byte)'\072', (byte)'\073', (byte)'\074', (byte)'\075', (byte)'\076', (byte)'\077', (byte)'\100', (byte)'\141', (byte)'\142', (byte)'\143', (byte)'\144', (byte)'\145', (byte)'\146', (byte)'\147', (byte)'\150', (byte)'\151', (byte)'\152', (byte)'\153', (byte)'\154', (byte)'\155', (byte)'\156', (byte)'\157', (byte)'\160', (byte)'\161', (byte)'\162', (byte)'\163', (byte)'\164', (byte)'\165', (byte)'\166', (byte)'\167', (byte)'\170', (byte)'\171', (byte)'\172', (byte)'\133', (byte)'\134', (byte)'\135', (byte)'\136', (byte)'\137', (byte)'\140', (byte)'\141', (byte)'\142', (byte)'\143', (byte)'\144', (byte)'\145', (byte)'\146', (byte)'\147', (byte)'\150', (byte)'\151', (byte)'\152', (byte)'\153', (byte)'\154', (byte)'\155', (byte)'\156', (byte)'\157', (byte)'\160', (byte)'\161', (byte)'\162', (byte)'\163', (byte)'\164', (byte)'\165', (byte)'\166', (byte)'\167', (byte)'\170', (byte)'\171', (byte)'\172', (byte)'\173', (byte)'\174', (byte)'\175', (byte)'\176', (byte)'\177', (byte)'\200', (byte)'\201', (byte)'\202', (byte)'\203', (byte)'\204', (byte)'\205', (byte)'\206', (byte)'\207', (byte)'\210', (byte)'\211', (byte)'\212', (byte)'\213', (byte)'\214', (byte)'\215', (byte)'\216', (byte)'\217', (byte)'\220', (byte)'\221', (byte)'\222', (byte)'\223', (byte)'\224', (byte)'\225', (byte)'\226', (byte)'\227', (byte)'\230', (byte)'\231', (byte)'\232', (byte)'\233', (byte)'\234', (byte)'\235', (byte)'\236', (byte)'\237', (byte)'\240', (byte)'\241', (byte)'\242', (byte)'\243', (byte)'\244', (byte)'\245', (byte)'\246', (byte)'\247', (byte)'\250', (byte)'\251', (byte)'\252', (byte)'\253', (byte)'\254', (byte)'\255', (byte)'\256', (byte)'\257', (byte)'\260', (byte)'\261', (byte)'\262', (byte)'\263', (byte)'\264', (byte)'\265', (byte)'\266', (byte)'\267', (byte)'\270', (byte)'\271', (byte)'\272', (byte)'\273', (byte)'\274', (byte)'\275', (byte)'\276', (byte)'\277', (byte)'\300', (byte)'\301', (byte)'\302', (byte)'\303', (byte)'\304', (byte)'\305', (byte)'\306', (byte)'\307', (byte)'\310', (byte)'\311', (byte)'\312', (byte)'\313', (byte)'\314', (byte)'\315', (byte)'\316', (byte)'\317', (byte)'\320', (byte)'\321', (byte)'\322', (byte)'\323', (byte)'\324', (byte)'\325', (byte)'\326', (byte)'\327', (byte)'\330', (byte)'\331', (byte)'\332', (byte)'\333', (byte)'\334', (byte)'\335', (byte)'\336', (byte)'\337', (byte)'\340', (byte)'\341', (byte)'\342', (byte)'\343', (byte)'\344', (byte)'\345', (byte)'\346', (byte)'\347', (byte)'\350', (byte)'\351', (byte)'\352', (byte)'\353', (byte)'\354', (byte)'\355', (byte)'\356', (byte)'\357', (byte)'\360', (byte)'\361', (byte)'\362', (byte)'\363', (byte)'\364', (byte)'\365', (byte)'\366', (byte)'\367', (byte)'\370', (byte)'\371', (byte)'\372', (byte)'\373', (byte)'\374', (byte)'\375', (byte)'\376', (byte)'\377', }; public static final byte ToUpperCaseTable[] = { (byte)'\000', (byte)'\001', (byte)'\002', (byte)'\003', (byte)'\004', (byte)'\005', (byte)'\006', (byte)'\007', (byte)'\010', (byte)'\011', (byte)'\012', (byte)'\013', (byte)'\014', (byte)'\015', (byte)'\016', (byte)'\017', (byte)'\020', (byte)'\021', (byte)'\022', (byte)'\023', (byte)'\024', (byte)'\025', (byte)'\026', (byte)'\027', (byte)'\030', (byte)'\031', (byte)'\032', (byte)'\033', (byte)'\034', (byte)'\035', (byte)'\036', (byte)'\037', (byte)'\040', (byte)'\041', (byte)'\042', (byte)'\043', (byte)'\044', (byte)'\045', (byte)'\046', (byte)'\047', (byte)'\050', (byte)'\051', (byte)'\052', (byte)'\053', (byte)'\054', (byte)'\055', (byte)'\056', (byte)'\057', (byte)'\060', (byte)'\061', (byte)'\062', (byte)'\063', (byte)'\064', (byte)'\065', (byte)'\066', (byte)'\067', (byte)'\070', (byte)'\071', (byte)'\072', (byte)'\073', (byte)'\074', (byte)'\075', (byte)'\076', (byte)'\077', (byte)'\100', (byte)'\101', (byte)'\102', (byte)'\103', (byte)'\104', (byte)'\105', (byte)'\106', (byte)'\107', (byte)'\110', (byte)'\111', (byte)'\112', (byte)'\113', (byte)'\114', (byte)'\115', (byte)'\116', (byte)'\117', (byte)'\120', (byte)'\121', (byte)'\122', (byte)'\123', (byte)'\124', (byte)'\125', (byte)'\126', (byte)'\127', (byte)'\130', (byte)'\131', (byte)'\132', (byte)'\133', (byte)'\134', (byte)'\135', (byte)'\136', (byte)'\137', (byte)'\140', (byte)'\101', (byte)'\102', (byte)'\103', (byte)'\104', (byte)'\105', (byte)'\106', (byte)'\107', (byte)'\110', (byte)'\111', (byte)'\112', (byte)'\113', (byte)'\114', (byte)'\115', (byte)'\116', (byte)'\117', (byte)'\120', (byte)'\121', (byte)'\122', (byte)'\123', (byte)'\124', (byte)'\125', (byte)'\126', (byte)'\127', (byte)'\130', (byte)'\131', (byte)'\132', (byte)'\173', (byte)'\174', (byte)'\175', (byte)'\176', (byte)'\177', (byte)'\200', (byte)'\201', (byte)'\202', (byte)'\203', (byte)'\204', (byte)'\205', (byte)'\206', (byte)'\207', (byte)'\210', (byte)'\211', (byte)'\212', (byte)'\213', (byte)'\214', (byte)'\215', (byte)'\216', (byte)'\217', (byte)'\220', (byte)'\221', (byte)'\222', (byte)'\223', (byte)'\224', (byte)'\225', (byte)'\226', (byte)'\227', (byte)'\230', (byte)'\231', (byte)'\232', (byte)'\233', (byte)'\234', (byte)'\235', (byte)'\236', (byte)'\237', (byte)'\240', (byte)'\241', (byte)'\242', (byte)'\243', (byte)'\244', (byte)'\245', (byte)'\246', (byte)'\247', (byte)'\250', (byte)'\251', (byte)'\252', (byte)'\253', (byte)'\254', (byte)'\255', (byte)'\256', (byte)'\257', (byte)'\260', (byte)'\261', (byte)'\262', (byte)'\263', (byte)'\264', (byte)'\265', (byte)'\266', (byte)'\267', (byte)'\270', (byte)'\271', (byte)'\272', (byte)'\273', (byte)'\274', (byte)'\275', (byte)'\276', (byte)'\277', (byte)'\300', (byte)'\301', (byte)'\302', (byte)'\303', (byte)'\304', (byte)'\305', (byte)'\306', (byte)'\307', (byte)'\310', (byte)'\311', (byte)'\312', (byte)'\313', (byte)'\314', (byte)'\315', (byte)'\316', (byte)'\317', (byte)'\320', (byte)'\321', (byte)'\322', (byte)'\323', (byte)'\324', (byte)'\325', (byte)'\326', (byte)'\327', (byte)'\330', (byte)'\331', (byte)'\332', (byte)'\333', (byte)'\334', (byte)'\335', (byte)'\336', (byte)'\337', (byte)'\340', (byte)'\341', (byte)'\342', (byte)'\343', (byte)'\344', (byte)'\345', (byte)'\346', (byte)'\347', (byte)'\350', (byte)'\351', (byte)'\352', (byte)'\353', (byte)'\354', (byte)'\355', (byte)'\356', (byte)'\357', (byte)'\360', (byte)'\361', (byte)'\362', (byte)'\363', (byte)'\364', (byte)'\365', (byte)'\366', (byte)'\367', (byte)'\370', (byte)'\371', (byte)'\372', (byte)'\373', (byte)'\374', (byte)'\375', (byte)'\376', (byte)'\377', }; public static final int LowerMap[][] = { {0x41, 0x61}, {0x42, 0x62}, {0x43, 0x63}, {0x44, 0x64}, {0x45, 0x65}, {0x46, 0x66}, {0x47, 0x67}, {0x48, 0x68}, {0x49, 0x69}, {0x4a, 0x6a}, {0x4b, 0x6b}, {0x4c, 0x6c}, {0x4d, 0x6d}, {0x4e, 0x6e}, {0x4f, 0x6f}, {0x50, 0x70}, {0x51, 0x71}, {0x52, 0x72}, {0x53, 0x73}, {0x54, 0x74}, {0x55, 0x75}, {0x56, 0x76}, {0x57, 0x77}, {0x58, 0x78}, {0x59, 0x79}, {0x5a, 0x7a} }; }jcodings-jcodings-1.0.11/src/org/jcodings/constants/000077500000000000000000000000001223451536200223655ustar00rootroot00000000000000jcodings-jcodings-1.0.11/src/org/jcodings/constants/CharacterType.java000066400000000000000000000046051223451536200257730ustar00rootroot00000000000000/* * Permission is hereby granted, free of charge, to any person obtaining a copy of * this software and associated documentation files (the "Software"), to deal in * the Software without restriction, including without limitation the rights to * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies * of the Software, and to permit persons to whom the Software is furnished to do * so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ package org.jcodings.constants; public interface CharacterType { final int NEWLINE = 0; final int ALPHA = 1; final int BLANK = 2; final int CNTRL = 3; final int DIGIT = 4; final int GRAPH = 5; final int LOWER = 6; final int PRINT = 7; final int PUNCT = 8; final int SPACE = 9; final int UPPER = 10; final int XDIGIT = 11; final int WORD = 12; final int ALNUM = 13; /* alpha || digit */ final int ASCII = 14; final int SPECIAL_MASK = 256; final int S = SPECIAL_MASK | SPACE; final int D = SPECIAL_MASK | DIGIT; final int W = SPECIAL_MASK | WORD; final int MAX_STD_CTYPE = 14; final int BIT_NEWLINE = (1<< NEWLINE); final int BIT_ALPHA = (1<< ALPHA); final int BIT_BLANK = (1<< BLANK); final int BIT_CNTRL = (1<< CNTRL); final int BIT_DIGIT = (1<< DIGIT); final int BIT_GRAPH = (1<< GRAPH); final int BIT_LOWER = (1<< LOWER); final int BIT_PRINT = (1<< PRINT); final int BIT_PUNCT = (1<< PUNCT); final int BIT_SPACE = (1<< SPACE); final int BIT_UPPER = (1<< UPPER); final int BIT_XDIGIT = (1<< XDIGIT); final int BIT_WORD = (1<< WORD); final int BIT_ALNUM = (1<< ALNUM); final int BIT_ASCII = (1<< ASCII); } jcodings-jcodings-1.0.11/src/org/jcodings/constants/PosixBracket.java000066400000000000000000000044651223451536200256370ustar00rootroot00000000000000/* * Permission is hereby granted, free of charge, to any person obtaining a copy of * this software and associated documentation files (the "Software"), to deal in * the Software without restriction, including without limitation the rights to * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies * of the Software, and to permit persons to whom the Software is furnished to do * so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ package org.jcodings.constants; import org.jcodings.util.CaseInsensitiveBytesHash; public class PosixBracket{ public static final byte[][] PBSNamesLower = { "alnum".getBytes(), "alpha".getBytes(), "blank".getBytes(), "cntrl".getBytes(), "digit".getBytes(), "graph".getBytes(), "lower".getBytes(), "print".getBytes(), "punct".getBytes(), "space".getBytes(), "upper".getBytes(), "xdigit".getBytes(), "ascii".getBytes(), "word".getBytes() }; public static final int PBSValues[] = { CharacterType.ALNUM, CharacterType.ALPHA, CharacterType.BLANK, CharacterType.CNTRL, CharacterType.DIGIT, CharacterType.GRAPH, CharacterType.LOWER, CharacterType.PRINT, CharacterType.PUNCT, CharacterType.SPACE, CharacterType.UPPER, CharacterType.XDIGIT, CharacterType.ASCII, CharacterType.WORD, }; public static final CaseInsensitiveBytesHash PBSTableUpper = new CaseInsensitiveBytesHash(PBSNamesLower.length + 5); static { for (int i=0; i 0xffffff) return 0; if ((code & 0xff0000) >= 0x800000) return 3; if ((code & 0xff00) >= 0x8000) return 2; } throw new EncodingException(ErrorMessages.ERR_INVALID_CODE_POINT_VALUE); } @Override public int codeToMbc(int code, byte[]bytes, int p) { int p_ = p; if ((code & 0xff0000) != 0) bytes[p_++] = (byte)((code >> 16) & 0xff); // need mask here ?? if ((code & 0xff00) != 0) bytes[p_++] = (byte)((code >> 8) & 0xff); bytes[p_++] = (byte)(code & 0xff); if (length(bytes, p, p_) != p_ - p) throw new EncodingException(ErrorMessages.ERR_INVALID_CODE_POINT_VALUE); return p_ - p; } @Override public int mbcCaseFold(int flag, byte[]bytes, IntHolder pp, int end, byte[]lower) { int p = pp.value; int lowerP = 0; if (isMbcAscii(bytes[p])) { lower[lowerP] = AsciiTables.ToLowerCaseTable[bytes[p] & 0xff]; pp.value++; return 1; } else { int len = length(bytes, p, end); for (int i=0; i 0xfe - 0xa1; } @Override public boolean isReverseMatchAllowed(byte[]bytes, int p, int end) { int c = bytes[p] & 0xff; return c <= 0x7e || c == 0x8e || c == 0x8f; } private static final int CR_Hiragana[] = { 1, 0xa4a1, 0xa4f3 }; /* CR_Hiragana */ private static final int CR_Katakana[] = { 3, 0xa5a1, 0xa5f6, 0xaaa6, 0xaaaf, 0xaab1, 0xaadd }; /* CR_Katakana */ private static final int PropertyList[][] = new int[][] { CR_Hiragana, CR_Katakana }; private static final CaseInsensitiveBytesHash CTypeNameHash = new CaseInsensitiveBytesHash(); static { CTypeNameHash.put("Hiragana".getBytes(), 1 + CharacterType.MAX_STD_CTYPE); CTypeNameHash.put("Katakana".getBytes(), 2 + CharacterType.MAX_STD_CTYPE); } @Override public int propertyNameToCType(byte[]bytes, int p, int end) { Integer ctype; if ((ctype = CTypeNameHash.get(bytes, p, end)) == null) { return super.propertyNameToCType(bytes, p, end); } return ctype; } @Override public boolean isCodeCType(int code, int ctype) { if (ctype <= CharacterType.MAX_STD_CTYPE) { if (code < 128) { // ctype table is configured with ASCII return isCodeCTypeInternal(code, ctype); } else { if (isWordGraphPrint(ctype)) { return codeToMbcLength(code) > 1; } } } else { ctype -= (CharacterType.MAX_STD_CTYPE + 1); if (ctype >= PropertyList.length) throw new InternalException(ErrorMessages.ERR_TYPE_BUG); return CodeRange.isInCodeRange(PropertyList[ctype], code); } return false; } @Override public int[]ctypeCodeRange(int ctype, IntHolder sbOut) { if (ctype <= CharacterType.MAX_STD_CTYPE) { return null; } else { sbOut.value = 0x80; ctype -= (CharacterType.MAX_STD_CTYPE + 1); if (ctype >= PropertyList.length) throw new InternalException(ErrorMessages.ERR_TYPE_BUG); return PropertyList[ctype]; } } static final int EUCJPEncLen[] = { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1 }; } jcodings-jcodings-1.0.11/src/org/jcodings/specific/BaseSJISEncoding.java000066400000000000000000000166621223451536200260260ustar00rootroot00000000000000/* * Permission is hereby granted, free of charge, to any person obtaining a copy of * this software and associated documentation files (the "Software"), to deal in * the Software without restriction, including without limitation the rights to * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies * of the Software, and to permit persons to whom the Software is furnished to do * so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ package org.jcodings.specific; import org.jcodings.CanBeTrailTableEncoding; import org.jcodings.CodeRange; import org.jcodings.Config; import org.jcodings.IntHolder; import org.jcodings.ascii.AsciiTables; import org.jcodings.constants.CharacterType; import org.jcodings.exception.EncodingException; import org.jcodings.exception.ErrorMessages; import org.jcodings.exception.InternalException; import org.jcodings.util.BytesHash; abstract class BaseSJISEncoding extends CanBeTrailTableEncoding { protected BaseSJISEncoding(int[][]Trans) { super("Shift_JIS", 1, 2, SjisEncLen, Trans, AsciiTables.AsciiCtypeTable, SJIS_CAN_BE_TRAIL_TABLE); } @Override public String getCharsetName() { return "windows-31j"; } @Override public int mbcToCode(byte[]bytes, int p, int end) { return mbnMbcToCode(bytes, p, end); } @Override public int codeToMbcLength(int code) { if (code < 256) { return SjisEncLen[code] == 1 ? 1 : 0; } else if (code <= 0xffff) { return 2; } else { throw new EncodingException(ErrorMessages.ERR_INVALID_CODE_POINT_VALUE); } } @Override public int codeToMbc(int code, byte[]bytes, int p) { int p_ = p; if ((code & 0xff00) != 0) bytes[p_++] = (byte)(((code >> 8) & 0xff)); bytes[p_++] = (byte)(code & 0xff); return p_ - p; } @Override public int mbcCaseFold(int flag, byte[]bytes, IntHolder pp, int end, byte[]lower) { return mbnMbcCaseFold(flag, bytes, pp, end, lower); } private static final int CR_Hiragana[] = { 1, 0x829f, 0x82f1 }; /* CR_Hiragana */ private static final int CR_Katakana[] = { 4, 0x00a6, 0x00af, 0x00b1, 0x00dd, 0x8340, 0x837e, 0x8380, 0x8396, }; /* CR_Katakana */ private static final int PropertyList[][] = new int[][] { CR_Hiragana, CR_Katakana }; private static final BytesHash CTypeNameHash = new BytesHash(); static { CTypeNameHash.put("Hiragana".getBytes(), 1 + CharacterType.MAX_STD_CTYPE); CTypeNameHash.put("Katakana".getBytes(), 2 + CharacterType.MAX_STD_CTYPE); } @Override public int propertyNameToCType(byte[]bytes, int p, int end) { Integer ctype; if ((ctype = CTypeNameHash.get(bytes, p, end)) == null) { return super.propertyNameToCType(bytes, p, end); } return ctype; } @Override public boolean isCodeCType(int code, int ctype) { if (ctype <= CharacterType.MAX_STD_CTYPE) { if (code < 128) { // ctype table is configured with ASCII return isCodeCTypeInternal(code, ctype); } else { if (isWordGraphPrint(ctype)) { if (Config.VANILLA) { return codeToMbcLength(code) > 1; } else { return true; } } } } else { ctype -= (CharacterType.MAX_STD_CTYPE + 1); if (ctype >= PropertyList.length) throw new InternalException(ErrorMessages.ERR_TYPE_BUG); return CodeRange.isInCodeRange(PropertyList[ctype], code); } return false; } @Override public int[]ctypeCodeRange(int ctype, IntHolder sbOut) { if (ctype <= CharacterType.MAX_STD_CTYPE) { return null; } else { sbOut.value = 0x80; ctype -= (CharacterType.MAX_STD_CTYPE + 1); if (ctype >= PropertyList.length) throw new InternalException(ErrorMessages.ERR_TYPE_BUG); return PropertyList[ctype]; } } static final boolean SJIS_CAN_BE_TRAIL_TABLE[] = { false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, false, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, false, false, false }; static final int SjisEncLen[] = { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1 }; } jcodings-jcodings-1.0.11/src/org/jcodings/specific/BaseUTF8Encoding.java000066400000000000000000000171151223451536200257760ustar00rootroot00000000000000/* * Permission is hereby granted, free of charge, to any person obtaining a copy of * this software and associated documentation files (the "Software"), to deal in * the Software without restriction, including without limitation the rights to * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies * of the Software, and to permit persons to whom the Software is furnished to do * so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ package org.jcodings.specific; import org.jcodings.Config; import org.jcodings.IntHolder; import org.jcodings.ascii.AsciiTables; import org.jcodings.exception.EncodingException; import org.jcodings.exception.ErrorMessages; import org.jcodings.unicode.UnicodeEncoding; abstract class BaseUTF8Encoding extends UnicodeEncoding { static final boolean USE_INVALID_CODE_SCHEME = true; protected BaseUTF8Encoding(int[]EncLen, int[][]Trans) { super("UTF-8", 1, 6, EncLen, Trans); } @Override public String getCharsetName() { return "UTF-8"; } @Override public boolean isNewLine(byte[]bytes, int p, int end) { if (p < end) { if (bytes[p] == (byte)0x0a) return true; if (Config.USE_UNICODE_ALL_LINE_TERMINATORS) { if (!Config.USE_CRNL_AS_LINE_TERMINATOR) { if (bytes[p] == (byte)0x0d) return true; } if (p + 1 < end) { // & 0xff... if (bytes[p+1] == (byte)0x85 && bytes[p] == (byte)0xc2) return true; /* U+0085 */ if (p + 2 < end) { if ((bytes[p+2] == (byte)0xa8 || bytes[p+2] == (byte)0xa9) && bytes[p+1] == (byte)0x80 && bytes[p] == (byte)0xe2) return true; /* U+2028, U+2029 */ } } } // USE_UNICODE_ALL_LINE_TERMINATORS } return false; } private static final int INVALID_CODE_FE = 0xfffffffe; private static final int INVALID_CODE_FF = 0xffffffff; // private static final int VALID_CODE_LIMIT = 0x7fffffff; @Override public int codeToMbcLength(int code) { if ((code & 0xffffff80) == 0) { return 1; } else if ((code & 0xfffff800) == 0) { return 2; } else if ((code & 0xffff0000) == 0) { return 3; } else if ((code & 0xffe00000) == 0) { return 4; } else if ((code & 0xfc000000) == 0) { return 5; } else if ((code & 0x80000000) == 0) { return 6; } else if (USE_INVALID_CODE_SCHEME && code == INVALID_CODE_FE) { return 1; } else if (USE_INVALID_CODE_SCHEME && code == INVALID_CODE_FF) { return 1; } else { throw new EncodingException(ErrorMessages.ERR_INVALID_CODE_POINT_VALUE); } } @Override public int mbcToCode(byte[]bytes, int p, int end) { int len = length(bytes, p, end); int c = bytes[p++] & 0xff; if (len > 1) { len--; int n = c & ((1 << (6 - len)) - 1); while (len-- != 0) { c = bytes[p++] & 0xff; n = (n << 6) | (c & ((1 << 6) - 1)); } return n; } else { if (USE_INVALID_CODE_SCHEME) { if (c > 0xfd) return c == 0xfe ? INVALID_CODE_FE : INVALID_CODE_FF; } return c; } } static byte trailS(int code, int shift) { return (byte)((((code) >>> (shift)) & 0x3f) | 0x80); } static byte trail0(int code) { return (byte)(((code) & 0x3f) | 0x80); } @Override public int codeToMbc(int code, byte[]bytes, int p) { int p_ = p; if ((code & 0xffffff80) == 0) { bytes[p_] = (byte)code; return 1; } else { if ((code & 0xfffff800) == 0) { bytes[p_++] = (byte)(((code >>> 6) & 0x1f) | 0xc0); } else if ((code & 0xffff0000) == 0) { bytes[p_++] = (byte)(((code >>> 12) & 0x0f) | 0xe0); bytes[p_++] = trailS(code, 6); } else if ((code & 0xffe00000) == 0) { bytes[p_++] = (byte)(((code >>> 18) & 0x07) | 0xf0); bytes[p_++] = trailS(code, 12); bytes[p_++] = trailS(code, 6); } else if ((code & 0xfc000000) == 0) { bytes[p_++] = (byte)(((code >>> 24) & 0x03) | 0xf8); bytes[p_++] = trailS(code, 18); bytes[p_++] = trailS(code, 12); bytes[p_++] = trailS(code, 6); } else if ((code & 0x80000000) == 0) { bytes[p_++] = (byte)(((code >>> 30) & 0x01) | 0xfc); bytes[p_++] = trailS(code, 24); bytes[p_++] = trailS(code, 18); bytes[p_++] = trailS(code, 12); bytes[p_++] = trailS(code, 6); } else if (USE_INVALID_CODE_SCHEME && code == INVALID_CODE_FE) { bytes[p_] = (byte)0xfe; return 1; } else if (USE_INVALID_CODE_SCHEME && code == INVALID_CODE_FF) { bytes[p_] = (byte)0xff; return 1; } else { throw new EncodingException(ErrorMessages.ERR_TOO_BIG_WIDE_CHAR_VALUE); } bytes[p_++] = trail0(code); return p_ - p; } } // utf8_mbc_case_fold @Override public int mbcCaseFold(int flag, byte[]bytes, IntHolder pp, int end, byte[]fold) { int p = pp.value; int foldP = 0; if (isMbcAscii(bytes[p])) { if (Config.USE_UNICODE_CASE_FOLD_TURKISH_AZERI) { if ((flag & Config.ENC_CASE_FOLD_TURKISH_AZERI) != 0) { if (bytes[p] == (byte)0x49) { fold[foldP++] = (byte)0xc4l; fold[foldP] = (byte)0xb1; pp.value++; return 2; } } } // USE_UNICODE_CASE_FOLD_TURKISH_AZERI fold[foldP] = AsciiTables.ToLowerCaseTable[bytes[p] & 0xff]; pp.value++; return 1; /* return byte length of converted char to lower */ } else { return super.mbcCaseFold(flag, bytes, pp, end, fold); } } /** utf8_get_ctype_code_range */ @Override public int[]ctypeCodeRange(int ctype, IntHolder sbOut) { sbOut.value = 0x80; return super.ctypeCodeRange(ctype); // onigenc_unicode_ctype_code_range } private static boolean utf8IsLead(int c) { return ((c & 0xc0) & 0xff) != 0x80; } /** utf8_left_adjust_char_head */ @Override public int leftAdjustCharHead(byte[]bytes, int p, int s, int end) { if (s <= p) return s; int p_ = s; while (!utf8IsLead(bytes[p_] & 0xff) && p_ > p) p_--; return p_; } /** onigenc_always_true_is_allowed_reverse_match */ @Override public boolean isReverseMatchAllowed(byte[]bytes, int p, int end) { return true; } } jcodings-jcodings-1.0.11/src/org/jcodings/specific/Big5HKSCSEncoding.java000066400000000000000000000046711223451536200260420ustar00rootroot00000000000000/* * Permission is hereby granted, free of charge, to any person obtaining a copy of * this software and associated documentation files (the "Software"), to deal in * the Software without restriction, including without limitation the rights to * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies * of the Software, and to permit persons to whom the Software is furnished to do * so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ package org.jcodings.specific; public final class Big5HKSCSEncoding extends BaseBIG5Encoding { protected Big5HKSCSEncoding() { super("Big5-HKSCS", Big5HKSCSEncLen, 2); } static final int Big5HKSCSEncLen[] = { /* LEN 0 1 2 3 4 5 6 7 8 9 A B C D E F */ /* 0 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 1 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 2 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 3 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 4 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 5 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 6 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 7 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 8 */ 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 9 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* A */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* B */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* C */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* D */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* E */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* F */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, }; public static final Big5HKSCSEncoding INSTANCE = new Big5HKSCSEncoding(); } jcodings-jcodings-1.0.11/src/org/jcodings/specific/Big5UAOEncoding.java000066400000000000000000000046531223451536200256130ustar00rootroot00000000000000/* * Permission is hereby granted, free of charge, to any person obtaining a copy of * this software and associated documentation files (the "Software"), to deal in * the Software without restriction, including without limitation the rights to * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies * of the Software, and to permit persons to whom the Software is furnished to do * so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ package org.jcodings.specific; public final class Big5UAOEncoding extends BaseBIG5Encoding { protected Big5UAOEncoding() { super("Big5-UAO", Big5UAOEncLen, 2); } static final int Big5UAOEncLen[] = { /* LEN 0 1 2 3 4 5 6 7 8 9 A B C D E F */ /* 0 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 1 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 2 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 3 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 4 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 5 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 6 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 7 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 8 */ 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 9 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* A */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* B */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* C */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* D */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* E */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* F */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, }; public static final Big5UAOEncoding INSTANCE = new Big5UAOEncoding(); } jcodings-jcodings-1.0.11/src/org/jcodings/specific/CP1251Encoding.java000066400000000000000000000214251223451536200252670ustar00rootroot00000000000000/* * Permission is hereby granted, free of charge, to any person obtaining a copy of * this software and associated documentation files (the "Software"), to deal in * the Software without restriction, including without limitation the rights to * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies * of the Software, and to permit persons to whom the Software is furnished to do * so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ package org.jcodings.specific; import org.jcodings.CaseFoldMapEncoding; import org.jcodings.IntHolder; final public class CP1251Encoding extends CaseFoldMapEncoding { protected CP1251Encoding() { super("Windows-1251", CP1251_CtypeTable, CP1251_ToLowerCaseTable, CP1251_CaseFoldMap, false); } @Override public int mbcCaseFold(int flag, byte[]bytes, IntHolder pp, int end, byte[]lower) { int p = pp.value; int lowerP = 0; lower[lowerP] = LowerCaseTable[bytes[p] & 0xff]; pp.value++; return 1; } @Override public boolean isCodeCType(int code, int ctype) { return code < 256 ? isCodeCTypeInternal(code, ctype) : false; } static final short CP1251_CtypeTable[] = { 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x428c, 0x4209, 0x4208, 0x4208, 0x4208, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4284, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x7ca2, 0x7ca2, 0x7ca2, 0x7ca2, 0x7ca2, 0x7ca2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x51a0, 0x41a0, 0x78e2, 0x78e2, 0x78e2, 0x78e2, 0x78e2, 0x78e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x4008, 0x34a2, 0x34a2, 0x01a0, 0x30e2, 0x01a0, 0x01a0, 0x01a0, 0x01a0, 0x0000, 0x01a0, 0x34a2, 0x01a0, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x30e2, 0x01a0, 0x01a0, 0x01a0, 0x01a0, 0x01a0, 0x01a0, 0x01a0, 0x0008, 0x0000, 0x30e2, 0x01a0, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x0280, 0x34a2, 0x30e2, 0x34a2, 0x01a0, 0x34a2, 0x01a0, 0x01a0, 0x34a2, 0x01a0, 0x34a2, 0x01a0, 0x01a0, 0x01a0, 0x01a0, 0x34a2, 0x01a0, 0x01a0, 0x34a2, 0x30e2, 0x30e2, 0x31e2, 0x01a0, 0x01a0, 0x30e2, 0x0000, 0x30e2, 0x01a0, 0x30e2, 0x34a2, 0x30e2, 0x30e2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2 }; static final byte CP1251_ToLowerCaseTable[] = new byte[]{ (byte)'\000', (byte)'\001', (byte)'\002', (byte)'\003', (byte)'\004', (byte)'\005', (byte)'\006', (byte)'\007', (byte)'\010', (byte)'\011', (byte)'\012', (byte)'\013', (byte)'\014', (byte)'\015', (byte)'\016', (byte)'\017', (byte)'\020', (byte)'\021', (byte)'\022', (byte)'\023', (byte)'\024', (byte)'\025', (byte)'\026', (byte)'\027', (byte)'\030', (byte)'\031', (byte)'\032', (byte)'\033', (byte)'\034', (byte)'\035', (byte)'\036', (byte)'\037', (byte)'\040', (byte)'\041', (byte)'\042', (byte)'\043', (byte)'\044', (byte)'\045', (byte)'\046', (byte)'\047', (byte)'\050', (byte)'\051', (byte)'\052', (byte)'\053', (byte)'\054', (byte)'\055', (byte)'\056', (byte)'\057', (byte)'\060', (byte)'\061', (byte)'\062', (byte)'\063', (byte)'\064', (byte)'\065', (byte)'\066', (byte)'\067', (byte)'\070', (byte)'\071', (byte)'\072', (byte)'\073', (byte)'\074', (byte)'\075', (byte)'\076', (byte)'\077', (byte)'\100', (byte)'\141', (byte)'\142', (byte)'\143', (byte)'\144', (byte)'\145', (byte)'\146', (byte)'\147', (byte)'\150', (byte)'\151', (byte)'\152', (byte)'\153', (byte)'\154', (byte)'\155', (byte)'\156', (byte)'\157', (byte)'\160', (byte)'\161', (byte)'\162', (byte)'\163', (byte)'\164', (byte)'\165', (byte)'\166', (byte)'\167', (byte)'\170', (byte)'\171', (byte)'\172', (byte)'\133', (byte)'\134', (byte)'\135', (byte)'\136', (byte)'\137', (byte)'\140', (byte)'\141', (byte)'\142', (byte)'\143', (byte)'\144', (byte)'\145', (byte)'\146', (byte)'\147', (byte)'\150', (byte)'\151', (byte)'\152', (byte)'\153', (byte)'\154', (byte)'\155', (byte)'\156', (byte)'\157', (byte)'\160', (byte)'\161', (byte)'\162', (byte)'\163', (byte)'\164', (byte)'\165', (byte)'\166', (byte)'\167', (byte)'\170', (byte)'\171', (byte)'\172', (byte)'\173', (byte)'\174', (byte)'\175', (byte)'\176', (byte)'\177', (byte)'\220', (byte)'\203', (byte)'\202', (byte)'\203', (byte)'\204', (byte)'\205', (byte)'\206', (byte)'\207', (byte)'\210', (byte)'\211', (byte)'\232', (byte)'\213', (byte)'\234', (byte)'\235', (byte)'\236', (byte)'\237', (byte)'\220', (byte)'\221', (byte)'\222', (byte)'\223', (byte)'\224', (byte)'\225', (byte)'\226', (byte)'\227', (byte)'\230', (byte)'\231', (byte)'\232', (byte)'\233', (byte)'\234', (byte)'\235', (byte)'\236', (byte)'\237', (byte)'\240', (byte)'\242', (byte)'\242', (byte)'\274', (byte)'\244', (byte)'\264', (byte)'\246', (byte)'\247', (byte)'\270', (byte)'\251', (byte)'\272', (byte)'\253', (byte)'\254', (byte)'\255', (byte)'\256', (byte)'\277', (byte)'\260', (byte)'\261', (byte)'\263', (byte)'\263', (byte)'\264', (byte)'\265', (byte)'\266', (byte)'\267', (byte)'\270', (byte)'\271', (byte)'\272', (byte)'\273', (byte)'\274', (byte)'\276', (byte)'\276', (byte)'\277', (byte)'\340', (byte)'\341', (byte)'\342', (byte)'\343', (byte)'\344', (byte)'\345', (byte)'\346', (byte)'\347', (byte)'\350', (byte)'\351', (byte)'\352', (byte)'\353', (byte)'\354', (byte)'\355', (byte)'\356', (byte)'\357', (byte)'\360', (byte)'\361', (byte)'\362', (byte)'\363', (byte)'\364', (byte)'\365', (byte)'\366', (byte)'\367', (byte)'\370', (byte)'\371', (byte)'\372', (byte)'\373', (byte)'\374', (byte)'\375', (byte)'\376', (byte)'\377', (byte)'\340', (byte)'\341', (byte)'\342', (byte)'\343', (byte)'\344', (byte)'\345', (byte)'\346', (byte)'\347', (byte)'\350', (byte)'\351', (byte)'\352', (byte)'\353', (byte)'\354', (byte)'\355', (byte)'\356', (byte)'\357', (byte)'\360', (byte)'\361', (byte)'\362', (byte)'\363', (byte)'\364', (byte)'\365', (byte)'\366', (byte)'\367', (byte)'\370', (byte)'\371', (byte)'\372', (byte)'\373', (byte)'\374', (byte)'\375', (byte)'\376', (byte)'\377' }; static final int CP1251_CaseFoldMap[][] = { { 0xb8, 0xa8 }, { 0xe0, 0xc0 }, { 0xe1, 0xc1 }, { 0xe2, 0xc2 }, { 0xe3, 0xc3 }, { 0xe4, 0xc4 }, { 0xe5, 0xc5 }, { 0xe6, 0xc6 }, { 0xe7, 0xc7 }, { 0xe8, 0xc8 }, { 0xe9, 0xc9 }, { 0xea, 0xca }, { 0xeb, 0xcb }, { 0xec, 0xcc }, { 0xed, 0xcd }, { 0xee, 0xce }, { 0xef, 0xcf }, { 0xf0, 0xd0 }, { 0xf1, 0xd1 }, { 0xf2, 0xd2 }, { 0xf3, 0xd3 }, { 0xf4, 0xd4 }, { 0xf5, 0xd5 }, { 0xf6, 0xd6 }, { 0xf7, 0xd7 }, { 0xf8, 0xd8 }, { 0xf9, 0xd9 }, { 0xfa, 0xda }, { 0xfb, 0xdb }, { 0xfc, 0xdc }, { 0xfd, 0xdd }, { 0xfe, 0xde }, { 0xff, 0xdf } }; public static final CP1251Encoding INSTANCE = new CP1251Encoding(); } jcodings-jcodings-1.0.11/src/org/jcodings/specific/CP949Encoding.java000066400000000000000000000170601223451536200252240ustar00rootroot00000000000000/* * Permission is hereby granted, free of charge, to any person obtaining a copy of * this software and associated documentation files (the "Software"), to deal in * the Software without restriction, including without limitation the rights to * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies * of the Software, and to permit persons to whom the Software is furnished to do * so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ package org.jcodings.specific; import org.jcodings.CanBeTrailTableEncoding; import org.jcodings.Config; import org.jcodings.IntHolder; import org.jcodings.ascii.AsciiTables; public final class CP949Encoding extends CanBeTrailTableEncoding { private static final String CP949 = "CP949"; protected CP949Encoding() { super(CP949, 1, 2, CP949EncLen, CP949Trans, AsciiTables.AsciiCtypeTable, CP949_CAN_BE_TRAIL_TABLE); } @Override public String getCharsetName() { return CP949; } @Override public int length(byte[]bytes, int p, int end) { if (Config.VANILLA){ return length(bytes[p]); } else { return safeLengthForUptoTwo(bytes, p, end); } } @Override public int mbcToCode(byte[]bytes, int p, int end) { return mbnMbcToCode(bytes, p, end); } @Override public int codeToMbcLength(int code) { return mb2CodeToMbcLength(code); } @Override public int codeToMbc(int code, byte[]bytes, int p) { return mb2CodeToMbc(code, bytes, p); } @Override public int mbcCaseFold(int flag, byte[]bytes, IntHolder pp, int end, byte[]lower) { return mbnMbcCaseFold(flag, bytes, pp, end, lower); } @Override public boolean isCodeCType(int code, int ctype) { return mb2IsCodeCType(code, ctype); } @Override public int[]ctypeCodeRange(int ctype, IntHolder sbOut) { return null; } static final boolean CP949_CAN_BE_TRAIL_TABLE[] = { false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, false, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, false }; static final int CP949EncLen[] = { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1 }; private static final int CP949Trans[][] = Config.VANILLA ? null : new int[][]{ { /* 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, A, A, A, A, A, /* 8 */ A, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 9 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* a */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* b */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* c */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* d */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* e */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* f */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, F }, { /* S1 0 1 2 3 4 5 6 7 8 9 a b c d e f */ /* 0 */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* 1 */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* 2 */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* 3 */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* 4 */ F, 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, F, F, F, F, F, /* 6 */ F, 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, /* a */ A, A, A, A, A, A, A, A, A, A, A, A, A, A, A, A, /* b */ A, A, A, A, A, A, A, A, A, A, A, A, A, A, A, A, /* c */ A, A, A, A, A, A, A, A, A, A, A, A, A, A, A, A, /* d */ A, A, A, A, A, A, A, A, A, A, A, A, A, A, A, A, /* e */ A, A, A, A, A, A, A, A, A, A, A, A, A, A, A, A, /* f */ A, A, A, A, A, A, A, A, A, A, A, A, A, A, A, F } }; public static final CP949Encoding INSTANCE = new CP949Encoding(); } jcodings-jcodings-1.0.11/src/org/jcodings/specific/EUCJPEncoding.java000066400000000000000000000121071223451536200253170ustar00rootroot00000000000000/* * Permission is hereby granted, free of charge, to any person obtaining a copy of * this software and associated documentation files (the "Software"), to deal in * the Software without restriction, including without limitation the rights to * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies * of the Software, and to permit persons to whom the Software is furnished to do * so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ package org.jcodings.specific; import org.jcodings.Config; public final class EUCJPEncoding extends BaseEUCJPEncoding { private static final String EUC_JP = "EUC-JP"; protected EUCJPEncoding() { super(EUCJPTrans); } @Override public int length(byte[]bytes, int p, int end) { if (Config.VANILLA) { return length(bytes[p]); } else { return safeLengthForUptoThree(bytes, p, end); } } @Override public String getCharsetName() { return EUC_JP; } private static final int EUCJPTrans[][] = Config.VANILLA ? null : new int[][]{ { /* 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, A, A, A, A, A, /* 8 */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, 1, 2, /* 9 */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* a */ F, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* b */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* c */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* d */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* e */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* f */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, F }, { /* S1 0 1 2 3 4 5 6 7 8 9 a b c d e f */ /* 0 */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* 1 */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* 2 */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* 3 */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* 4 */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* 5 */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* 6 */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* 7 */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* 8 */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* 9 */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* a */ F, A, A, A, A, A, A, A, A, A, A, A, A, A, A, A, /* b */ A, A, A, A, A, A, A, A, A, A, A, A, A, A, A, A, /* c */ A, A, A, A, A, A, A, A, A, A, A, A, A, A, A, A, /* d */ A, A, A, A, A, A, A, A, A, A, A, A, A, A, A, A, /* e */ A, A, A, A, A, A, A, A, A, A, A, A, A, A, A, A, /* f */ A, A, A, A, A, A, A, A, A, A, A, A, A, A, A, F }, { /* S2 0 1 2 3 4 5 6 7 8 9 a b c d e f */ /* 0 */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* 1 */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* 2 */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* 3 */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* 4 */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* 5 */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* 6 */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* 7 */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* 8 */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* 9 */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* a */ F, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* b */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* c */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* d */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* e */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* f */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, F } }; public static final EUCJPEncoding INSTANCE = new EUCJPEncoding(); } jcodings-jcodings-1.0.11/src/org/jcodings/specific/EUCKREncoding.java000066400000000000000000000136031223451536200253240ustar00rootroot00000000000000/* * Permission is hereby granted, free of charge, to any person obtaining a copy of * this software and associated documentation files (the "Software"), to deal in * the Software without restriction, including without limitation the rights to * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies * of the Software, and to permit persons to whom the Software is furnished to do * so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ package org.jcodings.specific; import org.jcodings.Config; import org.jcodings.EucEncoding; import org.jcodings.IntHolder; import org.jcodings.ascii.AsciiTables; public final class EUCKREncoding extends EucEncoding { protected EUCKREncoding() { super("EUC-KR", 1, 2, EUCKREncLen, EUCKRTrans, AsciiTables.AsciiCtypeTable); } @Override public int length(byte[]bytes, int p, int end) { if (Config.VANILLA){ return length(bytes[p]); } else { return safeLengthForUptoTwo(bytes, p, end); } } @Override public int mbcToCode(byte[]bytes, int p, int end) { return mbnMbcToCode(bytes, p, end); } @Override public int codeToMbcLength(int code) { return mb2CodeToMbcLength(code); } @Override public int codeToMbc(int code, byte[]bytes, int p) { return mb2CodeToMbc(code, bytes, p); } @Override public int mbcCaseFold(int flag, byte[]bytes, IntHolder pp, int end, byte[]lower) { return mbnMbcCaseFold(flag, bytes, pp, end, lower); } @Override public boolean isCodeCType(int code, int ctype) { return mb2IsCodeCType(code, ctype); } @Override public int[]ctypeCodeRange(int ctype, IntHolder sbOut) { return null; } // euckr_islead protected boolean isLead(int c) { return ((c) < 0xa1 || (c) == 0xff); } @Override public boolean isReverseMatchAllowed(byte[]bytes, int p, int end) { int c = bytes[p] & 0xff; return c <= 0x7e; } static final int EUCKREncLen[] = { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1 }; private static final int EUCKRTrans[][] = Config.VANILLA ? null : new int[][]{ { /* 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, A, A, A, A, A, /* 8 */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* 9 */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* a */ F, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* b */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* c */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* d */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* e */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* f */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, F }, { /* S1 0 1 2 3 4 5 6 7 8 9 a b c d e f */ /* 0 */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* 1 */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* 2 */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* 3 */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* 4 */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* 5 */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* 6 */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* 7 */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* 8 */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* 9 */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* a */ F, A, A, A, A, A, A, A, A, A, A, A, A, A, A, A, /* b */ A, A, A, A, A, A, A, A, A, A, A, A, A, A, A, A, /* c */ A, A, A, A, A, A, A, A, A, A, A, A, A, A, A, A, /* d */ A, A, A, A, A, A, A, A, A, A, A, A, A, A, A, A, /* e */ A, A, A, A, A, A, A, A, A, A, A, A, A, A, A, A, /* f */ A, A, A, A, A, A, A, A, A, A, A, A, A, A, A, F } }; public static final EUCKREncoding INSTANCE = new EUCKREncoding(); } jcodings-jcodings-1.0.11/src/org/jcodings/specific/EUCTWEncoding.java000066400000000000000000000205501223451536200253410ustar00rootroot00000000000000/* * Permission is hereby granted, free of charge, to any person obtaining a copy of * this software and associated documentation files (the "Software"), to deal in * the Software without restriction, including without limitation the rights to * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies * of the Software, and to permit persons to whom the Software is furnished to do * so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ package org.jcodings.specific; import org.jcodings.Config; import org.jcodings.EucEncoding; import org.jcodings.IntHolder; import org.jcodings.ascii.AsciiTables; public final class EUCTWEncoding extends EucEncoding { private static final String EUC_TW = "EUC-TW"; protected EUCTWEncoding() { super(EUC_TW, 1, 4, EUCTWEncLen, EUCTWTrans, AsciiTables.AsciiCtypeTable); } @Override public String getCharsetName() { return EUC_TW; } @Override public int length(byte[]bytes, int p, int end) { if (Config.VANILLA) { return length(bytes[p]); } else { return safeLengthForUptoFour(bytes, p, end); } } @Override public int mbcToCode(byte[]bytes, int p, int end) { return mbnMbcToCode(bytes, p, end); } @Override public int codeToMbcLength(int code) { return mb4CodeToMbcLength(code); } @Override public int codeToMbc(int code, byte[]bytes, int p) { return mb4CodeToMbc(code, bytes, p); } @Override public int mbcCaseFold(int flag, byte[]bytes, IntHolder pp, int end, byte[]lower) { return mbnMbcCaseFold(flag, bytes, pp, end, lower); } @Override public boolean isCodeCType(int code, int ctype) { return mb4IsCodeCType(code, ctype); } @Override public int[] ctypeCodeRange(int ctype, IntHolder sbOut) { return null; } // euckr_islead @Override protected boolean isLead(int c) { if (Config.VANILLA) { return ((c < 0xa1 && c != 0x8e) || c == 0xff); } else { return (c - 0xa1) > 0xfe - 0xa1; } } @Override public boolean isReverseMatchAllowed(byte[]bytes, int p, int end) { int c = bytes[p] & 0xff; return c <= 0x7e; } static final int EUCTWEncLen[] = { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1 }; private static final int EUCTWTrans[][] = Config.VANILLA ? null : new int[][]{ { /* 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, A, A, A, A, A, /* 8 */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, 2, F, /* 9 */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* a */ F, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* b */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* c */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* d */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* e */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* f */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, F }, { /* S1 0 1 2 3 4 5 6 7 8 9 a b c d e f */ /* 0 */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* 1 */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* 2 */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* 3 */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* 4 */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* 5 */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* 6 */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* 7 */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* 8 */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* 9 */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* a */ F, A, A, A, A, A, A, A, A, A, A, A, A, A, A, A, /* b */ A, A, A, A, A, A, A, A, A, A, A, A, A, A, A, A, /* c */ A, A, A, A, A, A, A, A, A, A, A, A, A, A, A, A, /* d */ A, A, A, A, A, A, A, A, A, A, A, A, A, A, A, A, /* e */ A, A, A, A, A, A, A, A, A, A, A, A, A, A, A, A, /* f */ A, A, A, A, A, A, A, A, A, A, A, A, A, A, A, F }, { /* S2 0 1 2 3 4 5 6 7 8 9 a b c d e f */ /* 0 */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* 1 */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* 2 */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* 3 */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* 4 */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* 5 */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* 6 */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* 7 */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* 8 */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* 9 */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* a */ F, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* b */ 3, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* c */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* d */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* e */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* f */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F }, { /* S3 0 1 2 3 4 5 6 7 8 9 a b c d e f */ /* 0 */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* 1 */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* 2 */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* 3 */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* 4 */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* 5 */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* 6 */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* 7 */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* 8 */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* 9 */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* a */ F, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* b */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* c */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* d */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* e */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* f */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, F } }; public static final EUCTWEncoding INSTANCE = new EUCTWEncoding(); } jcodings-jcodings-1.0.11/src/org/jcodings/specific/EmacsMuleEncoding.java000066400000000000000000000315271223451536200263330ustar00rootroot00000000000000/* * Permission is hereby granted, free of charge, to any person obtaining a copy of * this software and associated documentation files (the "Software"), to deal in * the Software without restriction, including without limitation the rights to * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies * of the Software, and to permit persons to whom the Software is furnished to do * so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ package org.jcodings.specific; import org.jcodings.Config; import org.jcodings.IntHolder; import org.jcodings.MultiByteEncoding; import org.jcodings.ascii.AsciiTables; import org.jcodings.exception.EncodingException; import org.jcodings.exception.ErrorMessages; public final class EmacsMuleEncoding extends MultiByteEncoding { protected EmacsMuleEncoding() { super("Emacs-Mule", 1, 4, EmacsMuleEncLen, EmacsMuleTrans, AsciiTables.AsciiCtypeTable); } @Override public int length(byte[]bytes, int p, int end) { if (Config.VANILLA){ return length(bytes[p]); } else { return safeLengthForUptoFour(bytes, p, end); } } @Override public int mbcToCode(byte[]bytes, int p, int end) { return mbnMbcToCode(bytes, p, end); } @Override public int codeToMbcLength(int code) { // TODO: this won't work with signed values, probably need to move to long or use bitwise 'and' and masks if (isAscii(code)) { return 1; } else if (code > 0xffffffff) { return 0; } else if ((code & 0xff000000) >= 0x80000000) { return 4; } else if ((code & 0xff0000) >= 0x800000) { return 3; } else if ((code & 0xff00) >= 0x8000) { return 2; } throw new EncodingException(ErrorMessages.ERR_INVALID_CODE_POINT_VALUE); } @Override public int codeToMbc(int code, byte[]bytes, int p) { // TODO: check if mb4CodeToMbc is enough (too much code duplication in 1.9 sources) int p_ = p; if ((code & 0xff000000) != 0) bytes[p_++] = (byte)((code >>> 24) & 0xff); if ((code & 0xff0000) != 0) bytes[p_++] = (byte)((code >>> 16) & 0xff); if ((code & 0xff00) != 0 ) bytes[p_++] = (byte)((code >>> 8) & 0xff); bytes[p_++] = (byte)(code & 0xff); if (length(bytes, p, p_) != (p_ - p)) throw new EncodingException(ErrorMessages.ERR_INVALID_CODE_POINT_VALUE); return p_ - p; } @Override public int mbcCaseFold(int flag, byte[]bytes, IntHolder pp, int end, byte[]lower) { return mbnMbcCaseFold(flag, bytes, pp, end, lower); } @Override public boolean isCodeCType(int code, int ctype) { if (code < 128) { return isCodeCTypeInternal(code, ctype); // configured with ascii } else { return codeToMbcLength(code) > 1; } } @Override public int[]ctypeCodeRange(int ctype, IntHolder sbOut) { return null; } private static boolean islead(int c) { return c < 0x9d; } @Override public int leftAdjustCharHead(byte[] bytes, int p, int s, int end) { if (s <= p) return s; int p_ = s; while (!islead(bytes[p_] & 0xff) && p_ > p) p_--; return p_; }; @Override public boolean isReverseMatchAllowed(byte[]bytes, int p, int end) { return true; } static final int EmacsMuleEncLen[] = { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 }; private static final int EmacsMuleTrans[][] = Config.VANILLA ? null : new int[][]{ { /* 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, A, A, A, A, A, /* 8 */ F, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 9 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 4, 5, 6, F, F, /* a */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* b */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* c */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* d */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* e */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* f */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F }, { /* S1 0 1 2 3 4 5 6 7 8 9 a b c d e f */ /* 0 */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* 1 */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* 2 */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* 3 */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* 4 */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* 5 */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* 6 */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* 7 */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* 8 */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* 9 */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* a */ A, A, A, A, A, A, A, A, A, A, A, A, A, A, A, A, /* b */ A, A, A, A, A, A, A, A, A, A, A, A, A, A, A, A, /* c */ A, A, A, A, A, A, A, A, A, A, A, A, A, A, A, A, /* d */ A, A, A, A, A, A, A, A, A, A, A, A, A, A, A, A, /* e */ A, A, A, A, A, A, A, A, A, A, A, A, A, A, A, A, /* f */ A, A, A, A, A, A, A, A, A, A, A, A, A, A, A, A }, { /* S2 0 1 2 3 4 5 6 7 8 9 a b c d e f */ /* 0 */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* 1 */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* 2 */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* 3 */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* 4 */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* 5 */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* 6 */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* 7 */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* 8 */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* 9 */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* a */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* b */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* c */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* d */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* e */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* f */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 }, { /* S3 0 1 2 3 4 5 6 7 8 9 a b c d e f */ /* 0 */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* 1 */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* 2 */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* 3 */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* 4 */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* 5 */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* 6 */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* 7 */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* 8 */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* 9 */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* a */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* b */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* c */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* d */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* e */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* f */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F }, { /* S4 0 1 2 3 4 5 6 7 8 9 a b c d e f */ /* 0 */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* 1 */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* 2 */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* 3 */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* 4 */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* 5 */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* 6 */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* 7 */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* 8 */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* 9 */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* a */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* b */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* c */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* d */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* e */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* f */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F }, { /* S5 0 1 2 3 4 5 6 7 8 9 a b c d e f */ /* 0 */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* 1 */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* 2 */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* 3 */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* 4 */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* 5 */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* 6 */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* 7 */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* 8 */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* 9 */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* a */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* b */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* c */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* d */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* e */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* f */ 2, 2, 2, 2, 2, F, F, F, F, F, F, F, F, F, F, F }, { /* S6 0 1 2 3 4 5 6 7 8 9 a b c d e f */ /* 0 */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* 1 */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* 2 */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* 3 */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* 4 */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* 5 */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* 6 */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* 7 */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* 8 */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* 9 */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* a */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* b */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* c */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* d */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* e */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* f */ F, F, F, F, F, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, F }, }; public static final EmacsMuleEncoding INSTANCE = new EmacsMuleEncoding(); } jcodings-jcodings-1.0.11/src/org/jcodings/specific/GB18030Encoding.java000066400000000000000000000507231223451536200253430ustar00rootroot00000000000000/* * Permission is hereby granted, free of charge, to any person obtaining a copy of * this software and associated documentation files (the "Software"), to deal in * the Software without restriction, including without limitation the rights to * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies * of the Software, and to permit persons to whom the Software is furnished to do * so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ package org.jcodings.specific; import org.jcodings.Config; import org.jcodings.IntHolder; import org.jcodings.MultiByteEncoding; import org.jcodings.ascii.AsciiTables; public final class GB18030Encoding extends MultiByteEncoding { private static final String GB18030 = "GB18030"; protected GB18030Encoding() { super(GB18030, 1, 4, null, GB18030Trans, AsciiTables.AsciiCtypeTable); } @Override public int length(byte[]bytes, int p, int end) { if (Config.VANILLA) { if (GB18030_MAP[bytes[p] & 0xff] != CM) return 1; int c = GB18030_MAP[bytes[p + 1] & 0xff]; if (c == C4) return 4; if (c == C1) return 1; /* illegal sequence */ return 2; } else { int s = TransZero[bytes[p] & 0xff]; if (s < 0) return s == A ? 1 : CHAR_INVALID; return lengthForTwoUptoFour(bytes, p, end, s); } } private int lengthForTwoUptoFour(byte[]bytes, int p, int end, int s) { if (++p == end) return missing(1); s = Trans[s][bytes[p] & 0xff]; if (s < 0) return s == A ? 2 : CHAR_INVALID; return lengthForThreeUptoFour(bytes, p, end, s); } private int lengthForThreeUptoFour(byte[]bytes, int p, int end, int s) { if (++p == end) return missing(2); s = Trans[s][bytes[p] & 0xff]; if (s < 0) return s == A ? 3 : CHAR_INVALID; if (++p == end) return missing(1); s = Trans[s][bytes[p] & 0xff]; return s == A ? 4 : CHAR_INVALID; } @Override public int mbcToCode(byte[]bytes, int p, int end) { return mbnMbcToCode(bytes, p, end); } @Override public int codeToMbcLength(int code) { return mb4CodeToMbcLength(code); } @Override public int codeToMbc(int code, byte[]bytes, int p) { return mb4CodeToMbc(code, bytes, p); } @Override public int mbcCaseFold(int flag, byte[]bytes, IntHolder pp, int end, byte[]lower) { return mbnMbcCaseFold(flag, bytes, pp, end, lower); } @Override public boolean isCodeCType(int code, int ctype) { return mb4IsCodeCType(code, ctype); } @Override public int[] ctypeCodeRange(int ctype, IntHolder sbOut) { return null; } @Override public String getCharsetName() { return GB18030; } private enum State { START, One_C2, One_C4, One_CM, Odd_CM_One_CX, Even_CM_One_CX, /* CMC4 : pair of "CM C4" */ One_CMC4, Odd_CMC4, One_C4_Odd_CMC4, Even_CMC4, One_C4_Even_CMC4, Odd_CM_Odd_CMC4, Even_CM_Odd_CMC4, Odd_CM_Even_CMC4, Even_CM_Even_CMC4, /* C4CM : pair of "C4 CM" */ Odd_C4CM, One_CM_Odd_C4CM, Even_C4CM, One_CM_Even_C4CM, Even_CM_Odd_C4CM, Odd_CM_Odd_C4CM, Even_CM_Even_C4CM, Odd_CM_Even_C4CM }; @Override public int leftAdjustCharHead(byte[]bytes, int p, int s, int end) { State state = State.START; for (int p_ = s; p_ >= p; p_--) { switch (state) { case START: switch (GB18030_MAP[bytes[p_] & 0xff]) { case C1: return s; case C2: state = State.One_C2; /* C2 */ break; case C4: state = State.One_C4; /* C4 */ break; case CM: state = State.One_CM; /* CM */ break; } break; case One_C2: /* C2 */ switch (GB18030_MAP[bytes[p_] & 0xff]) { case C1: case C2: case C4: return s; case CM: state = State.Odd_CM_One_CX; /* CM C2 */ break; } break; case One_C4: /* C4 */ switch (GB18030_MAP[bytes[p_] & 0xff]) { case C1: case C2: case C4: return s; case CM: state = State.One_CMC4; break; } break; case One_CM: /* CM */ switch (GB18030_MAP[bytes[p_] & 0xff]) { case C1: case C2: return s; case C4: state = State.Odd_C4CM; break; case CM: state = State.Odd_CM_One_CX; /* CM CM */ break; } break; case Odd_CM_One_CX: /* CM C2 */ /* CM CM */ /* CM CM CM C4 */ switch (GB18030_MAP[bytes[p_] & 0xff]) { case C1: case C2: case C4: return (s - 1); case CM: state = State.Even_CM_One_CX; break; } break; case Even_CM_One_CX: /* CM CM C2 */ /* CM CM CM */ /* CM CM C4 */ switch (GB18030_MAP[bytes[p_] & 0xff]) { case C1: case C2: case C4: return s; case CM: state = State.Odd_CM_One_CX; break; } break; case One_CMC4: /* CM C4 */ switch (GB18030_MAP[bytes[p_] & 0xff]) { case C1: case C2: return (s - 1); case C4: state = State.One_C4_Odd_CMC4; /* C4 CM C4 */ break; case CM: state = State.Even_CM_One_CX; /* CM CM C4 */ break; } break; case Odd_CMC4: /* CM C4 CM C4 CM C4 */ switch (GB18030_MAP[bytes[p_] & 0xff]) { case C1: case C2: return (s - 1); case C4: state = State.One_C4_Odd_CMC4; break; case CM: state = State.Odd_CM_Odd_CMC4; break; } break; case One_C4_Odd_CMC4: /* C4 CM C4 */ switch (GB18030_MAP[bytes[p_] & 0xff]) { case C1: case C2: case C4: return (s - 1); case CM: state = State.Even_CMC4; /* CM C4 CM C4 */ break; } break; case Even_CMC4: /* CM C4 CM C4 */ switch (GB18030_MAP[bytes[p_] & 0xff]) { case C1: case C2: return (s - 3); case C4: state = State.One_C4_Even_CMC4; break; case CM: state = State.Odd_CM_Even_CMC4; break; } break; case One_C4_Even_CMC4: /* C4 CM C4 CM C4 */ switch (GB18030_MAP[bytes[p_] & 0xff]) { case C1: case C2: case C4: return (s - 3); case CM: state = State.Odd_CMC4; break; } break; case Odd_CM_Odd_CMC4: /* CM CM C4 CM C4 CM C4 */ switch (GB18030_MAP[bytes[p_] & 0xff]) { case C1: case C2: case C4: return (s - 3); case CM: state = State.Even_CM_Odd_CMC4; break; } break; case Even_CM_Odd_CMC4: /* CM CM CM C4 CM C4 CM C4 */ switch (GB18030_MAP[bytes[p_] & 0xff]) { case C1: case C2: case C4: return (s - 1); case CM: state = State.Odd_CM_Odd_CMC4; break; } break; case Odd_CM_Even_CMC4: /* CM CM C4 CM C4 */ switch (GB18030_MAP[bytes[p_] & 0xff]) { case C1: case C2: case C4: return (s - 1); case CM: state = State.Even_CM_Even_CMC4; break; } break; case Even_CM_Even_CMC4: /* CM CM CM C4 CM C4 */ switch (GB18030_MAP[bytes[p_] & 0xff]) { case C1: case C2: case C4: return (s - 3); case CM: state = State.Odd_CM_Even_CMC4; break; } break; case Odd_C4CM: /* C4 CM */ /* C4 CM C4 CM C4 CM*/ switch (GB18030_MAP[bytes[p_] & 0xff]) { case C1: case C2: case C4: return s; case CM: state = State.One_CM_Odd_C4CM; /* CM C4 CM */ break; } break; case One_CM_Odd_C4CM: /* CM C4 CM */ /* CM C4 CM C4 CM C4 CM */ switch (GB18030_MAP[bytes[p_] & 0xff]) { case C1: case C2: return (s - 2); /* |CM C4 CM */ case C4: state = State.Even_C4CM; break; case CM: state = State.Even_CM_Odd_C4CM; break; } break; case Even_C4CM: /* C4 CM C4 CM */ switch (GB18030_MAP[bytes[p_] & 0xff]) { case C1: case C2: case C4: return (s - 2); /* C4|CM C4 CM */ case CM: state = State.One_CM_Even_C4CM; break; } break; case One_CM_Even_C4CM: /* CM C4 CM C4 CM */ switch (GB18030_MAP[bytes[p_] & 0xff]) { case C1: case C2: return (s - 0); /*|CM C4 CM C4|CM */ case C4: state = State.Odd_C4CM; break; case CM: state = State.Even_CM_Even_C4CM; break; } break; case Even_CM_Odd_C4CM: /* CM CM C4 CM */ switch (GB18030_MAP[bytes[p_] & 0xff]) { case C1: case C2: case C4: return (s - 0); /* |CM CM|C4|CM */ case CM: state = State.Odd_CM_Odd_C4CM; break; } break; case Odd_CM_Odd_C4CM: /* CM CM CM C4 CM */ switch (GB18030_MAP[bytes[p_] & 0xff]) { case C1: case C2: case C4: return (s - 2); /* |CM CM|CM C4 CM */ case CM: state = State.Even_CM_Odd_C4CM; break; } break; case Even_CM_Even_C4CM: /* CM CM C4 CM C4 CM */ switch (GB18030_MAP[bytes[p_] & 0xff]) { case C1: case C2: case C4: return (s - 2); /* |CM CM|C4|CM C4 CM */ case CM: state = State.Odd_CM_Even_C4CM; break; } break; case Odd_CM_Even_C4CM: /* CM CM CM C4 CM C4 CM */ switch (GB18030_MAP[bytes[p_] & 0xff]) { case C1: case C2: case C4: return (s - 0); /* |CM CM|CM C4 CM C4|CM */ case CM: state = State.Even_CM_Even_C4CM; break; } break; } } switch (state) { case START: return (s - 0); case One_C2: return (s - 0); case One_C4: return (s - 0); case One_CM: return (s - 0); case Odd_CM_One_CX: return (s - 1); case Even_CM_One_CX: return (s - 0); case One_CMC4: return (s - 1); case Odd_CMC4: return (s - 1); case One_C4_Odd_CMC4: return (s - 1); case Even_CMC4: return (s - 3); case One_C4_Even_CMC4: return (s - 3); case Odd_CM_Odd_CMC4: return (s - 3); case Even_CM_Odd_CMC4: return (s - 1); case Odd_CM_Even_CMC4: return (s - 1); case Even_CM_Even_CMC4: return (s - 3); case Odd_C4CM: return (s - 0); case One_CM_Odd_C4CM: return (s - 2); case Even_C4CM: return (s - 2); case One_CM_Even_C4CM: return (s - 0); case Even_CM_Odd_C4CM: return (s - 0); case Odd_CM_Odd_C4CM: return (s - 2); case Even_CM_Even_C4CM: return (s - 2); case Odd_CM_Even_C4CM: return (s - 0); } return s; } @Override public boolean isReverseMatchAllowed(byte[]bytes, int p, int end) { return GB18030_MAP[bytes[p] & 0xff] == C1; } private static final int C1 = 0; /* one-byte char */ private static final int C2 = 1; /* one-byte or second of two-byte char */ private static final int C4 = 2; /* one-byte or second or fourth of four-byte char */ private static final int CM = 3; /* first of two- or four-byte char or second of two-byte char */ private static final int GB18030_MAP[] = { C1, C1, C1, C1, C1, C1, C1, C1, C1, C1, C1, C1, C1, C1, C1, C1, C1, C1, C1, C1, C1, C1, C1, C1, C1, C1, C1, C1, C1, C1, C1, C1, C1, C1, C1, C1, C1, C1, C1, C1, C1, C1, C1, C1, C1, C1, C1, C1, C4, C4, C4, C4, C4, C4, C4, C4, C4, C4, C1, C1, C1, C1, C1, C1, C2, C2, C2, C2, C2, C2, C2, C2, C2, C2, C2, C2, C2, C2, C2, C2, C2, C2, C2, C2, C2, C2, C2, C2, C2, C2, C2, C2, C2, C2, C2, C2, C2, C2, C2, C2, C2, C2, C2, C2, C2, C2, C2, C2, C2, C2, C2, C2, C2, C2, C2, C2, C2, C2, C2, C2, C2, C2, C2, C2, C2, C2, C2, C1, C2, CM, CM, CM, CM, CM, CM, CM, CM, CM, CM, CM, CM, CM, CM, CM, CM, CM, CM, CM, CM, CM, CM, CM, CM, CM, CM, CM, CM, CM, CM, CM, CM, CM, CM, CM, CM, CM, CM, CM, CM, CM, CM, CM, CM, CM, CM, CM, CM, CM, CM, CM, CM, CM, CM, CM, CM, CM, CM, CM, CM, CM, CM, CM, CM, CM, CM, CM, CM, CM, CM, CM, CM, CM, CM, CM, CM, CM, CM, CM, CM, CM, CM, CM, CM, CM, CM, CM, CM, CM, CM, CM, CM, CM, CM, CM, CM, CM, CM, CM, CM, CM, CM, CM, CM, CM, CM, CM, CM, CM, CM, CM, CM, CM, CM, CM, CM, CM, CM, CM, CM, CM, CM, CM, CM, CM, CM, C1 }; private static final int GB18030Trans[][] = Config.VANILLA ? null : new int[][]{ { /* 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, A, A, A, A, A, /* 8 */ F, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 9 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* a */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* b */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* c */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* d */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* e */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* f */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, F }, { /* S1 0 1 2 3 4 5 6 7 8 9 a b c d e f */ /* 0 */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* 1 */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* 2 */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* 3 */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, F, F, F, F, F, F, /* 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, A, A, A, A, F, /* 8 */ A, 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, /* a */ A, A, A, A, A, A, A, A, A, A, A, A, A, A, A, A, /* b */ A, A, A, A, A, A, A, A, A, A, A, A, A, A, A, A, /* c */ A, A, A, A, A, A, A, A, A, A, A, A, A, A, A, A, /* d */ A, A, A, A, A, A, A, A, A, A, A, A, A, A, A, A, /* e */ A, A, A, A, A, A, A, A, A, A, A, A, A, A, A, A, /* f */ A, A, A, A, A, A, A, A, A, A, A, A, A, A, A, F }, { /* S2 0 1 2 3 4 5 6 7 8 9 a b c d e f */ /* 0 */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* 1 */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* 2 */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* 3 */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* 4 */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* 5 */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* 6 */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* 7 */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* 8 */ F, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 9 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* a */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* b */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* c */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* d */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* e */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* f */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, F }, { /* S3 0 1 2 3 4 5 6 7 8 9 a b c d e f */ /* 0 */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* 1 */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* 2 */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* 3 */ A, A, A, A, A, A, A, A, A, A, F, F, F, F, F, F, /* 4 */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* 5 */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* 6 */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* 7 */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* 8 */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* 9 */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* a */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* b */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* c */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* d */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* e */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* f */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F } }; public static final GB18030Encoding INSTANCE = new GB18030Encoding(); } jcodings-jcodings-1.0.11/src/org/jcodings/specific/GBKEncoding.java000066400000000000000000000170271223451536200250620ustar00rootroot00000000000000/* * Permission is hereby granted, free of charge, to any person obtaining a copy of * this software and associated documentation files (the "Software"), to deal in * the Software without restriction, including without limitation the rights to * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies * of the Software, and to permit persons to whom the Software is furnished to do * so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ package org.jcodings.specific; import org.jcodings.CanBeTrailTableEncoding; import org.jcodings.Config; import org.jcodings.IntHolder; import org.jcodings.ascii.AsciiTables; public final class GBKEncoding extends CanBeTrailTableEncoding { private static final String GBK = "GBK"; protected GBKEncoding() { super(GBK, 1, 2, GBKEncLen, GBKTrans, AsciiTables.AsciiCtypeTable, GBK_CAN_BE_TRAIL_TABLE); } @Override public int length(byte[]bytes, int p, int end) { if (Config.VANILLA) { return length(bytes[p]); } else { return safeLengthForUptoTwo(bytes, p, end); } } @Override public int mbcToCode(byte[]bytes, int p, int end) { return mbnMbcToCode(bytes, p, end); } @Override public int codeToMbcLength(int code) { return mb2CodeToMbcLength(code); } @Override public int codeToMbc(int code, byte[]bytes, int p) { return mb2CodeToMbc(code, bytes, p); } @Override public int mbcCaseFold(int flag, byte[]bytes, IntHolder pp, int end, byte[]lower) { return mbnMbcCaseFold(flag, bytes, pp, end, lower); } @Override public boolean isCodeCType(int code, int ctype) { return mb2IsCodeCType(code, ctype); } @Override public int[]ctypeCodeRange(int ctype, IntHolder sbOut) { return null; } @Override public String getCharsetName() { return GBK; } static final boolean GBK_CAN_BE_TRAIL_TABLE[] = { false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, false, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, false }; static final int GBKEncLen[] = { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1 }; private static final int GBKTrans[][] = Config.VANILLA ? null : new int[][]{ { /* 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, A, A, A, A, A, /* 8 */ A, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 9 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* a */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* b */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* c */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* d */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* e */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* f */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, F }, { /* S1 0 1 2 3 4 5 6 7 8 9 a b c d e f */ /* 0 */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* 1 */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* 2 */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* 3 */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* 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, A, A, A, A, F, /* 8 */ A, 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, /* a */ A, A, A, A, A, A, A, A, A, A, A, A, A, A, A, A, /* b */ A, A, A, A, A, A, A, A, A, A, A, A, A, A, A, A, /* c */ A, A, A, A, A, A, A, A, A, A, A, A, A, A, A, A, /* d */ A, A, A, A, A, A, A, A, A, A, A, A, A, A, A, A, /* e */ A, A, A, A, A, A, A, A, A, A, A, A, A, A, A, A, /* f */ A, A, A, A, A, A, A, A, A, A, A, A, A, A, A, F } }; public static final GBKEncoding INSTANCE = new GBKEncoding(); } jcodings-jcodings-1.0.11/src/org/jcodings/specific/ISO8859_10Encoding.java000066400000000000000000000211701223451536200257410ustar00rootroot00000000000000/* * Permission is hereby granted, free of charge, to any person obtaining a copy of * this software and associated documentation files (the "Software"), to deal in * the Software without restriction, including without limitation the rights to * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies * of the Software, and to permit persons to whom the Software is furnished to do * so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ package org.jcodings.specific; import org.jcodings.ISOEncoding; public final class ISO8859_10Encoding extends ISOEncoding { protected ISO8859_10Encoding() { super("ISO-8859-10", ISO8859_10CtypeTable, ISO8859_10ToLowerCaseTable, ISO8859_10CaseFoldMap); } static final short ISO8859_10CtypeTable[] = { 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x420c, 0x4209, 0x4208, 0x4208, 0x4208, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4284, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x7ca2, 0x7ca2, 0x7ca2, 0x7ca2, 0x7ca2, 0x7ca2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x51a0, 0x41a0, 0x78e2, 0x78e2, 0x78e2, 0x78e2, 0x78e2, 0x78e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x4008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0284, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x00a0, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x01a0, 0x34a2, 0x34a2, 0x00a0, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x01a0, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x01a0, 0x30e2, 0x30e2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2 }; static final byte ISO8859_10ToLowerCaseTable[] = new byte[]{ (byte)'\000', (byte)'\001', (byte)'\002', (byte)'\003', (byte)'\004', (byte)'\005', (byte)'\006', (byte)'\007', (byte)'\010', (byte)'\011', (byte)'\012', (byte)'\013', (byte)'\014', (byte)'\015', (byte)'\016', (byte)'\017', (byte)'\020', (byte)'\021', (byte)'\022', (byte)'\023', (byte)'\024', (byte)'\025', (byte)'\026', (byte)'\027', (byte)'\030', (byte)'\031', (byte)'\032', (byte)'\033', (byte)'\034', (byte)'\035', (byte)'\036', (byte)'\037', (byte)'\040', (byte)'\041', (byte)'\042', (byte)'\043', (byte)'\044', (byte)'\045', (byte)'\046', (byte)'\047', (byte)'\050', (byte)'\051', (byte)'\052', (byte)'\053', (byte)'\054', (byte)'\055', (byte)'\056', (byte)'\057', (byte)'\060', (byte)'\061', (byte)'\062', (byte)'\063', (byte)'\064', (byte)'\065', (byte)'\066', (byte)'\067', (byte)'\070', (byte)'\071', (byte)'\072', (byte)'\073', (byte)'\074', (byte)'\075', (byte)'\076', (byte)'\077', (byte)'\100', (byte)'\141', (byte)'\142', (byte)'\143', (byte)'\144', (byte)'\145', (byte)'\146', (byte)'\147', (byte)'\150', (byte)'\151', (byte)'\152', (byte)'\153', (byte)'\154', (byte)'\155', (byte)'\156', (byte)'\157', (byte)'\160', (byte)'\161', (byte)'\162', (byte)'\163', (byte)'\164', (byte)'\165', (byte)'\166', (byte)'\167', (byte)'\170', (byte)'\171', (byte)'\172', (byte)'\133', (byte)'\134', (byte)'\135', (byte)'\136', (byte)'\137', (byte)'\140', (byte)'\141', (byte)'\142', (byte)'\143', (byte)'\144', (byte)'\145', (byte)'\146', (byte)'\147', (byte)'\150', (byte)'\151', (byte)'\152', (byte)'\153', (byte)'\154', (byte)'\155', (byte)'\156', (byte)'\157', (byte)'\160', (byte)'\161', (byte)'\162', (byte)'\163', (byte)'\164', (byte)'\165', (byte)'\166', (byte)'\167', (byte)'\170', (byte)'\171', (byte)'\172', (byte)'\173', (byte)'\174', (byte)'\175', (byte)'\176', (byte)'\177', (byte)'\200', (byte)'\201', (byte)'\202', (byte)'\203', (byte)'\204', (byte)'\205', (byte)'\206', (byte)'\207', (byte)'\210', (byte)'\211', (byte)'\212', (byte)'\213', (byte)'\214', (byte)'\215', (byte)'\216', (byte)'\217', (byte)'\220', (byte)'\221', (byte)'\222', (byte)'\223', (byte)'\224', (byte)'\225', (byte)'\226', (byte)'\227', (byte)'\230', (byte)'\231', (byte)'\232', (byte)'\233', (byte)'\234', (byte)'\235', (byte)'\236', (byte)'\237', (byte)'\240', (byte)'\261', (byte)'\262', (byte)'\263', (byte)'\264', (byte)'\265', (byte)'\266', (byte)'\247', (byte)'\270', (byte)'\271', (byte)'\272', (byte)'\273', (byte)'\274', (byte)'\255', (byte)'\276', (byte)'\277', (byte)'\260', (byte)'\261', (byte)'\262', (byte)'\263', (byte)'\264', (byte)'\265', (byte)'\266', (byte)'\267', (byte)'\270', (byte)'\271', (byte)'\272', (byte)'\273', (byte)'\274', (byte)'\275', (byte)'\276', (byte)'\277', (byte)'\340', (byte)'\341', (byte)'\342', (byte)'\343', (byte)'\344', (byte)'\345', (byte)'\346', (byte)'\347', (byte)'\350', (byte)'\351', (byte)'\352', (byte)'\353', (byte)'\354', (byte)'\355', (byte)'\356', (byte)'\357', (byte)'\360', (byte)'\361', (byte)'\362', (byte)'\363', (byte)'\364', (byte)'\365', (byte)'\366', (byte)'\367', (byte)'\370', (byte)'\371', (byte)'\372', (byte)'\373', (byte)'\374', (byte)'\375', (byte)'\376', (byte)'\337', (byte)'\340', (byte)'\341', (byte)'\342', (byte)'\343', (byte)'\344', (byte)'\345', (byte)'\346', (byte)'\347', (byte)'\350', (byte)'\351', (byte)'\352', (byte)'\353', (byte)'\354', (byte)'\355', (byte)'\356', (byte)'\357', (byte)'\360', (byte)'\361', (byte)'\362', (byte)'\363', (byte)'\364', (byte)'\365', (byte)'\366', (byte)'\367', (byte)'\370', (byte)'\371', (byte)'\372', (byte)'\373', (byte)'\374', (byte)'\375', (byte)'\376', (byte)'\377' }; static final int ISO8859_10CaseFoldMap[][] = { { 0xa1, 0xb1 }, { 0xa2, 0xb2 }, { 0xa3, 0xb3 }, { 0xa4, 0xb4 }, { 0xa5, 0xb5 }, { 0xa6, 0xb6 }, { 0xa8, 0xb8 }, { 0xa9, 0xb9 }, { 0xaa, 0xba }, { 0xab, 0xbb }, { 0xac, 0xbc }, { 0xae, 0xbe }, { 0xaf, 0xbf }, { 0xc0, 0xe0 }, { 0xc1, 0xe1 }, { 0xc2, 0xe2 }, { 0xc3, 0xe3 }, { 0xc4, 0xe4 }, { 0xc5, 0xe5 }, { 0xc6, 0xe6 }, { 0xc7, 0xe7 }, { 0xc8, 0xe8 }, { 0xc9, 0xe9 }, { 0xca, 0xea }, { 0xcb, 0xeb }, { 0xcc, 0xec }, { 0xcd, 0xed }, { 0xce, 0xee }, { 0xcf, 0xef }, { 0xd0, 0xf0 }, { 0xd1, 0xf1 }, { 0xd2, 0xf2 }, { 0xd3, 0xf3 }, { 0xd4, 0xf4 }, { 0xd5, 0xf5 }, { 0xd6, 0xf6 }, { 0xd7, 0xf7 }, { 0xd8, 0xf8 }, { 0xd9, 0xf9 }, { 0xda, 0xfa }, { 0xdb, 0xfb }, { 0xdc, 0xfc }, { 0xdd, 0xfd }, { 0xde, 0xfe } }; public static final ISO8859_10Encoding INSTANCE = new ISO8859_10Encoding(); } jcodings-jcodings-1.0.11/src/org/jcodings/specific/ISO8859_11Encoding.java000066400000000000000000000106661223451536200257520ustar00rootroot00000000000000/* * Permission is hereby granted, free of charge, to any person obtaining a copy of * this software and associated documentation files (the "Software"), to deal in * the Software without restriction, including without limitation the rights to * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies * of the Software, and to permit persons to whom the Software is furnished to do * so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ package org.jcodings.specific; import org.jcodings.ApplyAllCaseFoldFunction; import org.jcodings.CaseFoldCodeItem; import org.jcodings.ISOEncoding; import org.jcodings.IntHolder; import org.jcodings.ascii.AsciiTables; public final class ISO8859_11Encoding extends ISOEncoding { protected ISO8859_11Encoding() { super("ISO-8859-11", ISO8859_11CtypeTable, AsciiTables.ToLowerCaseTable, null); } @Override public int mbcCaseFold(int flag, byte[]bytes, IntHolder pp, int end, byte[]lower) { return asciiMbcCaseFold(flag, bytes, pp, end, lower); } @Override public final byte[]toLowerCaseTable() { return LowerCaseTable; } @Override public void applyAllCaseFold(int flag, ApplyAllCaseFoldFunction fun, Object arg) { asciiApplyAllCaseFold(flag, fun, arg); } @Override public CaseFoldCodeItem[]caseFoldCodesByString(int flag, byte[]bytes, int p, int end) { return asciiCaseFoldCodesByString(flag, bytes, p, end); } static final short ISO8859_11CtypeTable[] = { 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x420c, 0x4209, 0x4208, 0x4208, 0x4208, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4284, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x7ca2, 0x7ca2, 0x7ca2, 0x7ca2, 0x7ca2, 0x7ca2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x51a0, 0x41a0, 0x78e2, 0x78e2, 0x78e2, 0x78e2, 0x78e2, 0x78e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x4008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0284, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x0000, 0x0000, 0x0000, 0x0000, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x0000, 0x0000, 0x0000, 0x0000 }; public static final ISO8859_11Encoding INSTANCE = new ISO8859_11Encoding(); } jcodings-jcodings-1.0.11/src/org/jcodings/specific/ISO8859_13Encoding.java000066400000000000000000000204471223451536200257520ustar00rootroot00000000000000/* * Permission is hereby granted, free of charge, to any person obtaining a copy of * this software and associated documentation files (the "Software"), to deal in * the Software without restriction, including without limitation the rights to * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies * of the Software, and to permit persons to whom the Software is furnished to do * so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ package org.jcodings.specific; import org.jcodings.ISOEncoding; public final class ISO8859_13Encoding extends ISOEncoding { protected ISO8859_13Encoding() { super("ISO-8859-13", ISO8859_13CtypeTable, ISO8859_13ToLowerCaseTable, ISO8859_13CaseFoldMap); } static final short ISO8859_13CtypeTable[] = { 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x420c, 0x4209, 0x4208, 0x4208, 0x4208, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4284, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x7ca2, 0x7ca2, 0x7ca2, 0x7ca2, 0x7ca2, 0x7ca2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x51a0, 0x41a0, 0x78e2, 0x78e2, 0x78e2, 0x78e2, 0x78e2, 0x78e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x4008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0284, 0x01a0, 0x00a0, 0x00a0, 0x00a0, 0x01a0, 0x00a0, 0x00a0, 0x34a2, 0x00a0, 0x34a2, 0x01a0, 0x00a0, 0x01a0, 0x00a0, 0x34a2, 0x00a0, 0x00a0, 0x10a0, 0x10a0, 0x01a0, 0x30e2, 0x00a0, 0x01a0, 0x30e2, 0x10a0, 0x30e2, 0x01a0, 0x10a0, 0x10a0, 0x10a0, 0x30e2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x00a0, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x00a0, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x01a0 }; static final byte ISO8859_13ToLowerCaseTable[] = new byte[]{ (byte)'\000', (byte)'\001', (byte)'\002', (byte)'\003', (byte)'\004', (byte)'\005', (byte)'\006', (byte)'\007', (byte)'\010', (byte)'\011', (byte)'\012', (byte)'\013', (byte)'\014', (byte)'\015', (byte)'\016', (byte)'\017', (byte)'\020', (byte)'\021', (byte)'\022', (byte)'\023', (byte)'\024', (byte)'\025', (byte)'\026', (byte)'\027', (byte)'\030', (byte)'\031', (byte)'\032', (byte)'\033', (byte)'\034', (byte)'\035', (byte)'\036', (byte)'\037', (byte)'\040', (byte)'\041', (byte)'\042', (byte)'\043', (byte)'\044', (byte)'\045', (byte)'\046', (byte)'\047', (byte)'\050', (byte)'\051', (byte)'\052', (byte)'\053', (byte)'\054', (byte)'\055', (byte)'\056', (byte)'\057', (byte)'\060', (byte)'\061', (byte)'\062', (byte)'\063', (byte)'\064', (byte)'\065', (byte)'\066', (byte)'\067', (byte)'\070', (byte)'\071', (byte)'\072', (byte)'\073', (byte)'\074', (byte)'\075', (byte)'\076', (byte)'\077', (byte)'\100', (byte)'\141', (byte)'\142', (byte)'\143', (byte)'\144', (byte)'\145', (byte)'\146', (byte)'\147', (byte)'\150', (byte)'\151', (byte)'\152', (byte)'\153', (byte)'\154', (byte)'\155', (byte)'\156', (byte)'\157', (byte)'\160', (byte)'\161', (byte)'\162', (byte)'\163', (byte)'\164', (byte)'\165', (byte)'\166', (byte)'\167', (byte)'\170', (byte)'\171', (byte)'\172', (byte)'\133', (byte)'\134', (byte)'\135', (byte)'\136', (byte)'\137', (byte)'\140', (byte)'\141', (byte)'\142', (byte)'\143', (byte)'\144', (byte)'\145', (byte)'\146', (byte)'\147', (byte)'\150', (byte)'\151', (byte)'\152', (byte)'\153', (byte)'\154', (byte)'\155', (byte)'\156', (byte)'\157', (byte)'\160', (byte)'\161', (byte)'\162', (byte)'\163', (byte)'\164', (byte)'\165', (byte)'\166', (byte)'\167', (byte)'\170', (byte)'\171', (byte)'\172', (byte)'\173', (byte)'\174', (byte)'\175', (byte)'\176', (byte)'\177', (byte)'\200', (byte)'\201', (byte)'\202', (byte)'\203', (byte)'\204', (byte)'\205', (byte)'\206', (byte)'\207', (byte)'\210', (byte)'\211', (byte)'\212', (byte)'\213', (byte)'\214', (byte)'\215', (byte)'\216', (byte)'\217', (byte)'\220', (byte)'\221', (byte)'\222', (byte)'\223', (byte)'\224', (byte)'\225', (byte)'\226', (byte)'\227', (byte)'\230', (byte)'\231', (byte)'\232', (byte)'\233', (byte)'\234', (byte)'\235', (byte)'\236', (byte)'\237', (byte)'\240', (byte)'\241', (byte)'\242', (byte)'\243', (byte)'\244', (byte)'\245', (byte)'\246', (byte)'\247', (byte)'\270', (byte)'\251', (byte)'\272', (byte)'\253', (byte)'\254', (byte)'\255', (byte)'\256', (byte)'\277', (byte)'\260', (byte)'\261', (byte)'\262', (byte)'\263', (byte)'\264', (byte)'\265', (byte)'\266', (byte)'\267', (byte)'\270', (byte)'\271', (byte)'\272', (byte)'\273', (byte)'\274', (byte)'\275', (byte)'\276', (byte)'\277', (byte)'\340', (byte)'\341', (byte)'\342', (byte)'\343', (byte)'\344', (byte)'\345', (byte)'\346', (byte)'\347', (byte)'\350', (byte)'\351', (byte)'\352', (byte)'\353', (byte)'\354', (byte)'\355', (byte)'\356', (byte)'\357', (byte)'\360', (byte)'\361', (byte)'\362', (byte)'\363', (byte)'\364', (byte)'\365', (byte)'\366', (byte)'\327', (byte)'\370', (byte)'\371', (byte)'\372', (byte)'\373', (byte)'\374', (byte)'\375', (byte)'\376', (byte)'\337', (byte)'\340', (byte)'\341', (byte)'\342', (byte)'\343', (byte)'\344', (byte)'\345', (byte)'\346', (byte)'\347', (byte)'\350', (byte)'\351', (byte)'\352', (byte)'\353', (byte)'\354', (byte)'\355', (byte)'\356', (byte)'\357', (byte)'\360', (byte)'\361', (byte)'\362', (byte)'\363', (byte)'\364', (byte)'\365', (byte)'\366', (byte)'\367', (byte)'\370', (byte)'\371', (byte)'\372', (byte)'\373', (byte)'\374', (byte)'\375', (byte)'\376', (byte)'\377' }; static final int ISO8859_13CaseFoldMap[][] = { { 0xc0, 0xe0 }, { 0xc1, 0xe1 }, { 0xc2, 0xe2 }, { 0xc3, 0xe3 }, { 0xc4, 0xe4 }, { 0xc5, 0xe5 }, { 0xc6, 0xe6 }, { 0xc7, 0xe7 }, { 0xc8, 0xe8 }, { 0xc9, 0xe9 }, { 0xca, 0xea }, { 0xcb, 0xeb }, { 0xcc, 0xec }, { 0xcd, 0xed }, { 0xce, 0xee }, { 0xcf, 0xef }, { 0xd0, 0xf0 }, { 0xd1, 0xf1 }, { 0xd2, 0xf2 }, { 0xd3, 0xf3 }, { 0xd4, 0xf4 }, { 0xd5, 0xf5 }, { 0xd6, 0xf6 }, { 0xd8, 0xf8 }, { 0xd9, 0xf9 }, { 0xda, 0xfa }, { 0xdb, 0xfb }, { 0xdc, 0xfc }, { 0xdd, 0xfd }, { 0xde, 0xfe } }; public static final ISO8859_13Encoding INSTANCE = new ISO8859_13Encoding(); } jcodings-jcodings-1.0.11/src/org/jcodings/specific/ISO8859_14Encoding.java000066400000000000000000000211711223451536200257460ustar00rootroot00000000000000/* * Permission is hereby granted, free of charge, to any person obtaining a copy of * this software and associated documentation files (the "Software"), to deal in * the Software without restriction, including without limitation the rights to * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies * of the Software, and to permit persons to whom the Software is furnished to do * so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ package org.jcodings.specific; import org.jcodings.ISOEncoding; public final class ISO8859_14Encoding extends ISOEncoding { protected ISO8859_14Encoding() { super("ISO-8859-14", ISO8859_14CtypeTable, ISO8859_14ToLowerCaseTable, ISO8859_14CaseFoldMap); } static final short ISO8859_14CtypeTable[] = { 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x420c, 0x4209, 0x4208, 0x4208, 0x4208, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4284, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x7ca2, 0x7ca2, 0x7ca2, 0x7ca2, 0x7ca2, 0x7ca2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x51a0, 0x41a0, 0x78e2, 0x78e2, 0x78e2, 0x78e2, 0x78e2, 0x78e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x4008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0284, 0x34a2, 0x30e2, 0x00a0, 0x34a2, 0x30e2, 0x34a2, 0x00a0, 0x34a2, 0x00a0, 0x34a2, 0x30e2, 0x34a2, 0x01a0, 0x00a0, 0x34a2, 0x34a2, 0x30e2, 0x34a2, 0x30e2, 0x34a2, 0x30e2, 0x00a0, 0x34a2, 0x30e2, 0x30e2, 0x30e2, 0x34a2, 0x30e2, 0x34a2, 0x30e2, 0x30e2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2 }; static final byte ISO8859_14ToLowerCaseTable[] = new byte[]{ (byte)'\000', (byte)'\001', (byte)'\002', (byte)'\003', (byte)'\004', (byte)'\005', (byte)'\006', (byte)'\007', (byte)'\010', (byte)'\011', (byte)'\012', (byte)'\013', (byte)'\014', (byte)'\015', (byte)'\016', (byte)'\017', (byte)'\020', (byte)'\021', (byte)'\022', (byte)'\023', (byte)'\024', (byte)'\025', (byte)'\026', (byte)'\027', (byte)'\030', (byte)'\031', (byte)'\032', (byte)'\033', (byte)'\034', (byte)'\035', (byte)'\036', (byte)'\037', (byte)'\040', (byte)'\041', (byte)'\042', (byte)'\043', (byte)'\044', (byte)'\045', (byte)'\046', (byte)'\047', (byte)'\050', (byte)'\051', (byte)'\052', (byte)'\053', (byte)'\054', (byte)'\055', (byte)'\056', (byte)'\057', (byte)'\060', (byte)'\061', (byte)'\062', (byte)'\063', (byte)'\064', (byte)'\065', (byte)'\066', (byte)'\067', (byte)'\070', (byte)'\071', (byte)'\072', (byte)'\073', (byte)'\074', (byte)'\075', (byte)'\076', (byte)'\077', (byte)'\100', (byte)'\141', (byte)'\142', (byte)'\143', (byte)'\144', (byte)'\145', (byte)'\146', (byte)'\147', (byte)'\150', (byte)'\151', (byte)'\152', (byte)'\153', (byte)'\154', (byte)'\155', (byte)'\156', (byte)'\157', (byte)'\160', (byte)'\161', (byte)'\162', (byte)'\163', (byte)'\164', (byte)'\165', (byte)'\166', (byte)'\167', (byte)'\170', (byte)'\171', (byte)'\172', (byte)'\133', (byte)'\134', (byte)'\135', (byte)'\136', (byte)'\137', (byte)'\140', (byte)'\141', (byte)'\142', (byte)'\143', (byte)'\144', (byte)'\145', (byte)'\146', (byte)'\147', (byte)'\150', (byte)'\151', (byte)'\152', (byte)'\153', (byte)'\154', (byte)'\155', (byte)'\156', (byte)'\157', (byte)'\160', (byte)'\161', (byte)'\162', (byte)'\163', (byte)'\164', (byte)'\165', (byte)'\166', (byte)'\167', (byte)'\170', (byte)'\171', (byte)'\172', (byte)'\173', (byte)'\174', (byte)'\175', (byte)'\176', (byte)'\177', (byte)'\200', (byte)'\201', (byte)'\202', (byte)'\203', (byte)'\204', (byte)'\205', (byte)'\206', (byte)'\207', (byte)'\210', (byte)'\211', (byte)'\212', (byte)'\213', (byte)'\214', (byte)'\215', (byte)'\216', (byte)'\217', (byte)'\220', (byte)'\221', (byte)'\222', (byte)'\223', (byte)'\224', (byte)'\225', (byte)'\226', (byte)'\227', (byte)'\230', (byte)'\231', (byte)'\232', (byte)'\233', (byte)'\234', (byte)'\235', (byte)'\236', (byte)'\237', (byte)'\240', (byte)'\242', (byte)'\242', (byte)'\243', (byte)'\245', (byte)'\245', (byte)'\253', (byte)'\247', (byte)'\270', (byte)'\251', (byte)'\272', (byte)'\253', (byte)'\274', (byte)'\255', (byte)'\256', (byte)'\377', (byte)'\261', (byte)'\261', (byte)'\263', (byte)'\263', (byte)'\265', (byte)'\265', (byte)'\266', (byte)'\271', (byte)'\270', (byte)'\271', (byte)'\272', (byte)'\277', (byte)'\274', (byte)'\276', (byte)'\276', (byte)'\277', (byte)'\340', (byte)'\341', (byte)'\342', (byte)'\343', (byte)'\344', (byte)'\345', (byte)'\346', (byte)'\347', (byte)'\350', (byte)'\351', (byte)'\352', (byte)'\353', (byte)'\354', (byte)'\355', (byte)'\356', (byte)'\357', (byte)'\360', (byte)'\361', (byte)'\362', (byte)'\363', (byte)'\364', (byte)'\365', (byte)'\366', (byte)'\367', (byte)'\370', (byte)'\371', (byte)'\372', (byte)'\373', (byte)'\374', (byte)'\375', (byte)'\376', (byte)'\337', (byte)'\340', (byte)'\341', (byte)'\342', (byte)'\343', (byte)'\344', (byte)'\345', (byte)'\346', (byte)'\347', (byte)'\350', (byte)'\351', (byte)'\352', (byte)'\353', (byte)'\354', (byte)'\355', (byte)'\356', (byte)'\357', (byte)'\360', (byte)'\361', (byte)'\362', (byte)'\363', (byte)'\364', (byte)'\365', (byte)'\366', (byte)'\367', (byte)'\370', (byte)'\371', (byte)'\372', (byte)'\373', (byte)'\374', (byte)'\375', (byte)'\376', (byte)'\377' }; static final int ISO8859_14CaseFoldMap[][] = { { 0xa1, 0xa2 }, { 0xa4, 0xa5 }, { 0xa6, 0xab }, { 0xa8, 0xb8 }, { 0xaa, 0xba }, { 0xac, 0xbc }, { 0xaf, 0xff }, { 0xb0, 0xb1 }, { 0xb2, 0xb3 }, { 0xb4, 0xb5 }, { 0xb7, 0xb9 }, { 0xbb, 0xbf }, { 0xbd, 0xbe }, { 0xc0, 0xe0 }, { 0xc1, 0xe1 }, { 0xc2, 0xe2 }, { 0xc3, 0xe3 }, { 0xc4, 0xe4 }, { 0xc5, 0xe5 }, { 0xc6, 0xe6 }, { 0xc7, 0xe7 }, { 0xc8, 0xe8 }, { 0xc9, 0xe9 }, { 0xca, 0xea }, { 0xcb, 0xeb }, { 0xcc, 0xec }, { 0xcd, 0xed }, { 0xce, 0xee }, { 0xcf, 0xef }, { 0xd0, 0xf0 }, { 0xd1, 0xf1 }, { 0xd2, 0xf2 }, { 0xd3, 0xf3 }, { 0xd4, 0xf4 }, { 0xd5, 0xf5 }, { 0xd6, 0xf6 }, { 0xd7, 0xf7 }, { 0xd8, 0xf8 }, { 0xd9, 0xf9 }, { 0xda, 0xfa }, { 0xdb, 0xfb }, { 0xdc, 0xfc }, { 0xdd, 0xfd }, { 0xde, 0xfe } }; public static final ISO8859_14Encoding INSTANCE = new ISO8859_14Encoding(); } jcodings-jcodings-1.0.11/src/org/jcodings/specific/ISO8859_15Encoding.java000066400000000000000000000206111223451536200257450ustar00rootroot00000000000000/* * Permission is hereby granted, free of charge, to any person obtaining a copy of * this software and associated documentation files (the "Software"), to deal in * the Software without restriction, including without limitation the rights to * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies * of the Software, and to permit persons to whom the Software is furnished to do * so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ package org.jcodings.specific; import org.jcodings.ISOEncoding; public final class ISO8859_15Encoding extends ISOEncoding { protected ISO8859_15Encoding() { super("ISO-8859-15", ISO8859_15CtypeTable, ISO8859_15ToLowerCaseTable, ISO8859_15CaseFoldMap); } static final short ISO8859_15CtypeTable[] = { 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x420c, 0x4209, 0x4208, 0x4208, 0x4208, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4284, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x7ca2, 0x7ca2, 0x7ca2, 0x7ca2, 0x7ca2, 0x7ca2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x51a0, 0x41a0, 0x78e2, 0x78e2, 0x78e2, 0x78e2, 0x78e2, 0x78e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x4008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0284, 0x01a0, 0x00a0, 0x00a0, 0x00a0, 0x00a0, 0x34a2, 0x00a0, 0x30e2, 0x00a0, 0x30e2, 0x01a0, 0x00a0, 0x01a0, 0x00a0, 0x00a0, 0x00a0, 0x00a0, 0x10a0, 0x10a0, 0x34a2, 0x30e2, 0x00a0, 0x01a0, 0x30e2, 0x10a0, 0x30e2, 0x01a0, 0x34a2, 0x30e2, 0x34a2, 0x01a0, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x00a0, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x00a0, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2 }; static final byte ISO8859_15ToLowerCaseTable[] = new byte[]{ (byte)'\000', (byte)'\001', (byte)'\002', (byte)'\003', (byte)'\004', (byte)'\005', (byte)'\006', (byte)'\007', (byte)'\010', (byte)'\011', (byte)'\012', (byte)'\013', (byte)'\014', (byte)'\015', (byte)'\016', (byte)'\017', (byte)'\020', (byte)'\021', (byte)'\022', (byte)'\023', (byte)'\024', (byte)'\025', (byte)'\026', (byte)'\027', (byte)'\030', (byte)'\031', (byte)'\032', (byte)'\033', (byte)'\034', (byte)'\035', (byte)'\036', (byte)'\037', (byte)'\040', (byte)'\041', (byte)'\042', (byte)'\043', (byte)'\044', (byte)'\045', (byte)'\046', (byte)'\047', (byte)'\050', (byte)'\051', (byte)'\052', (byte)'\053', (byte)'\054', (byte)'\055', (byte)'\056', (byte)'\057', (byte)'\060', (byte)'\061', (byte)'\062', (byte)'\063', (byte)'\064', (byte)'\065', (byte)'\066', (byte)'\067', (byte)'\070', (byte)'\071', (byte)'\072', (byte)'\073', (byte)'\074', (byte)'\075', (byte)'\076', (byte)'\077', (byte)'\100', (byte)'\141', (byte)'\142', (byte)'\143', (byte)'\144', (byte)'\145', (byte)'\146', (byte)'\147', (byte)'\150', (byte)'\151', (byte)'\152', (byte)'\153', (byte)'\154', (byte)'\155', (byte)'\156', (byte)'\157', (byte)'\160', (byte)'\161', (byte)'\162', (byte)'\163', (byte)'\164', (byte)'\165', (byte)'\166', (byte)'\167', (byte)'\170', (byte)'\171', (byte)'\172', (byte)'\133', (byte)'\134', (byte)'\135', (byte)'\136', (byte)'\137', (byte)'\140', (byte)'\141', (byte)'\142', (byte)'\143', (byte)'\144', (byte)'\145', (byte)'\146', (byte)'\147', (byte)'\150', (byte)'\151', (byte)'\152', (byte)'\153', (byte)'\154', (byte)'\155', (byte)'\156', (byte)'\157', (byte)'\160', (byte)'\161', (byte)'\162', (byte)'\163', (byte)'\164', (byte)'\165', (byte)'\166', (byte)'\167', (byte)'\170', (byte)'\171', (byte)'\172', (byte)'\173', (byte)'\174', (byte)'\175', (byte)'\176', (byte)'\177', (byte)'\200', (byte)'\201', (byte)'\202', (byte)'\203', (byte)'\204', (byte)'\205', (byte)'\206', (byte)'\207', (byte)'\210', (byte)'\211', (byte)'\212', (byte)'\213', (byte)'\214', (byte)'\215', (byte)'\216', (byte)'\217', (byte)'\220', (byte)'\221', (byte)'\222', (byte)'\223', (byte)'\224', (byte)'\225', (byte)'\226', (byte)'\227', (byte)'\230', (byte)'\231', (byte)'\232', (byte)'\233', (byte)'\234', (byte)'\235', (byte)'\236', (byte)'\237', (byte)'\240', (byte)'\241', (byte)'\242', (byte)'\243', (byte)'\244', (byte)'\245', (byte)'\250', (byte)'\247', (byte)'\250', (byte)'\251', (byte)'\252', (byte)'\253', (byte)'\254', (byte)'\255', (byte)'\256', (byte)'\257', (byte)'\260', (byte)'\261', (byte)'\262', (byte)'\263', (byte)'\270', (byte)'\265', (byte)'\266', (byte)'\267', (byte)'\270', (byte)'\271', (byte)'\272', (byte)'\273', (byte)'\275', (byte)'\275', (byte)'\377', (byte)'\277', (byte)'\340', (byte)'\341', (byte)'\342', (byte)'\343', (byte)'\344', (byte)'\345', (byte)'\346', (byte)'\347', (byte)'\350', (byte)'\351', (byte)'\352', (byte)'\353', (byte)'\354', (byte)'\355', (byte)'\356', (byte)'\357', (byte)'\360', (byte)'\361', (byte)'\362', (byte)'\363', (byte)'\364', (byte)'\365', (byte)'\366', (byte)'\327', (byte)'\370', (byte)'\371', (byte)'\372', (byte)'\373', (byte)'\374', (byte)'\375', (byte)'\376', (byte)'\337', (byte)'\340', (byte)'\341', (byte)'\342', (byte)'\343', (byte)'\344', (byte)'\345', (byte)'\346', (byte)'\347', (byte)'\350', (byte)'\351', (byte)'\352', (byte)'\353', (byte)'\354', (byte)'\355', (byte)'\356', (byte)'\357', (byte)'\360', (byte)'\361', (byte)'\362', (byte)'\363', (byte)'\364', (byte)'\365', (byte)'\366', (byte)'\367', (byte)'\370', (byte)'\371', (byte)'\372', (byte)'\373', (byte)'\374', (byte)'\375', (byte)'\376', (byte)'\377' }; static final int ISO8859_15CaseFoldMap[][] = { { 0xa6, 0xa8 }, { 0xb4, 0xb8 }, { 0xbc, 0xbd }, { 0xbe, 0xff }, { 0xc0, 0xe0 }, { 0xc1, 0xe1 }, { 0xc2, 0xe2 }, { 0xc3, 0xe3 }, { 0xc4, 0xe4 }, { 0xc5, 0xe5 }, { 0xc6, 0xe6 }, { 0xc7, 0xe7 }, { 0xc8, 0xe8 }, { 0xc9, 0xe9 }, { 0xca, 0xea }, { 0xcb, 0xeb }, { 0xcc, 0xec }, { 0xcd, 0xed }, { 0xce, 0xee }, { 0xcf, 0xef }, { 0xd0, 0xf0 }, { 0xd1, 0xf1 }, { 0xd2, 0xf2 }, { 0xd3, 0xf3 }, { 0xd4, 0xf4 }, { 0xd5, 0xf5 }, { 0xd6, 0xf6 }, { 0xd8, 0xf8 }, { 0xd9, 0xf9 }, { 0xda, 0xfa }, { 0xdb, 0xfb }, { 0xdc, 0xfc }, { 0xdd, 0xfd }, { 0xde, 0xfe } }; public static final ISO8859_15Encoding INSTANCE = new ISO8859_15Encoding(); } jcodings-jcodings-1.0.11/src/org/jcodings/specific/ISO8859_16Encoding.java000066400000000000000000000210611223451536200257460ustar00rootroot00000000000000/* * Permission is hereby granted, free of charge, to any person obtaining a copy of * this software and associated documentation files (the "Software"), to deal in * the Software without restriction, including without limitation the rights to * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies * of the Software, and to permit persons to whom the Software is furnished to do * so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ package org.jcodings.specific; import org.jcodings.ISOEncoding; public final class ISO8859_16Encoding extends ISOEncoding { protected ISO8859_16Encoding() { super("ISO-8859-16", ISO8859_16CtypeTable, ISO8859_16ToLowerCaseTable, ISO8859_16CaseFoldMap); } static final short ISO8859_16CtypeTable[] = { 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x420c, 0x4209, 0x4208, 0x4208, 0x4208, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4284, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x7ca2, 0x7ca2, 0x7ca2, 0x7ca2, 0x7ca2, 0x7ca2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x51a0, 0x41a0, 0x78e2, 0x78e2, 0x78e2, 0x78e2, 0x78e2, 0x78e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x4008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0284, 0x34a2, 0x30e2, 0x34a2, 0x00a0, 0x01a0, 0x34a2, 0x00a0, 0x30e2, 0x00a0, 0x34a2, 0x01a0, 0x34a2, 0x01a0, 0x30e2, 0x34a2, 0x00a0, 0x00a0, 0x34a2, 0x30e2, 0x34a2, 0x01a0, 0x00a0, 0x01a0, 0x30e2, 0x30e2, 0x30e2, 0x01a0, 0x34a2, 0x30e2, 0x34a2, 0x30e2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2 }; static final byte ISO8859_16ToLowerCaseTable[] = new byte[]{ (byte)'\000', (byte)'\001', (byte)'\002', (byte)'\003', (byte)'\004', (byte)'\005', (byte)'\006', (byte)'\007', (byte)'\010', (byte)'\011', (byte)'\012', (byte)'\013', (byte)'\014', (byte)'\015', (byte)'\016', (byte)'\017', (byte)'\020', (byte)'\021', (byte)'\022', (byte)'\023', (byte)'\024', (byte)'\025', (byte)'\026', (byte)'\027', (byte)'\030', (byte)'\031', (byte)'\032', (byte)'\033', (byte)'\034', (byte)'\035', (byte)'\036', (byte)'\037', (byte)'\040', (byte)'\041', (byte)'\042', (byte)'\043', (byte)'\044', (byte)'\045', (byte)'\046', (byte)'\047', (byte)'\050', (byte)'\051', (byte)'\052', (byte)'\053', (byte)'\054', (byte)'\055', (byte)'\056', (byte)'\057', (byte)'\060', (byte)'\061', (byte)'\062', (byte)'\063', (byte)'\064', (byte)'\065', (byte)'\066', (byte)'\067', (byte)'\070', (byte)'\071', (byte)'\072', (byte)'\073', (byte)'\074', (byte)'\075', (byte)'\076', (byte)'\077', (byte)'\100', (byte)'\141', (byte)'\142', (byte)'\143', (byte)'\144', (byte)'\145', (byte)'\146', (byte)'\147', (byte)'\150', (byte)'\151', (byte)'\152', (byte)'\153', (byte)'\154', (byte)'\155', (byte)'\156', (byte)'\157', (byte)'\160', (byte)'\161', (byte)'\162', (byte)'\163', (byte)'\164', (byte)'\165', (byte)'\166', (byte)'\167', (byte)'\170', (byte)'\171', (byte)'\172', (byte)'\133', (byte)'\134', (byte)'\135', (byte)'\136', (byte)'\137', (byte)'\140', (byte)'\141', (byte)'\142', (byte)'\143', (byte)'\144', (byte)'\145', (byte)'\146', (byte)'\147', (byte)'\150', (byte)'\151', (byte)'\152', (byte)'\153', (byte)'\154', (byte)'\155', (byte)'\156', (byte)'\157', (byte)'\160', (byte)'\161', (byte)'\162', (byte)'\163', (byte)'\164', (byte)'\165', (byte)'\166', (byte)'\167', (byte)'\170', (byte)'\171', (byte)'\172', (byte)'\173', (byte)'\174', (byte)'\175', (byte)'\176', (byte)'\177', (byte)'\200', (byte)'\201', (byte)'\202', (byte)'\203', (byte)'\204', (byte)'\205', (byte)'\206', (byte)'\207', (byte)'\210', (byte)'\211', (byte)'\212', (byte)'\213', (byte)'\214', (byte)'\215', (byte)'\216', (byte)'\217', (byte)'\220', (byte)'\221', (byte)'\222', (byte)'\223', (byte)'\224', (byte)'\225', (byte)'\226', (byte)'\227', (byte)'\230', (byte)'\231', (byte)'\232', (byte)'\233', (byte)'\234', (byte)'\235', (byte)'\236', (byte)'\237', (byte)'\240', (byte)'\242', (byte)'\242', (byte)'\263', (byte)'\245', (byte)'\245', (byte)'\250', (byte)'\247', (byte)'\250', (byte)'\251', (byte)'\272', (byte)'\253', (byte)'\256', (byte)'\255', (byte)'\256', (byte)'\277', (byte)'\260', (byte)'\261', (byte)'\271', (byte)'\263', (byte)'\270', (byte)'\265', (byte)'\266', (byte)'\267', (byte)'\270', (byte)'\271', (byte)'\272', (byte)'\273', (byte)'\275', (byte)'\275', (byte)'\377', (byte)'\277', (byte)'\340', (byte)'\341', (byte)'\342', (byte)'\343', (byte)'\344', (byte)'\345', (byte)'\346', (byte)'\347', (byte)'\350', (byte)'\351', (byte)'\352', (byte)'\353', (byte)'\354', (byte)'\355', (byte)'\356', (byte)'\357', (byte)'\360', (byte)'\361', (byte)'\362', (byte)'\363', (byte)'\364', (byte)'\365', (byte)'\366', (byte)'\367', (byte)'\370', (byte)'\371', (byte)'\372', (byte)'\373', (byte)'\374', (byte)'\375', (byte)'\376', (byte)'\337', (byte)'\340', (byte)'\341', (byte)'\342', (byte)'\343', (byte)'\344', (byte)'\345', (byte)'\346', (byte)'\347', (byte)'\350', (byte)'\351', (byte)'\352', (byte)'\353', (byte)'\354', (byte)'\355', (byte)'\356', (byte)'\357', (byte)'\360', (byte)'\361', (byte)'\362', (byte)'\363', (byte)'\364', (byte)'\365', (byte)'\366', (byte)'\367', (byte)'\370', (byte)'\371', (byte)'\372', (byte)'\373', (byte)'\374', (byte)'\375', (byte)'\376', (byte)'\377' }; static final int ISO8859_16CaseFoldMap[][] = { { 0xa1, 0xa2 }, { 0xa3, 0xb3 }, { 0xa6, 0xa8 }, { 0xaa, 0xba }, { 0xac, 0xae }, { 0xaf, 0xbf }, { 0xb2, 0xb9 }, { 0xb4, 0xb8 }, { 0xbc, 0xbd }, { 0xbe, 0xff }, { 0xc0, 0xe0 }, { 0xc1, 0xe1 }, { 0xc2, 0xe2 }, { 0xc3, 0xe3 }, { 0xc4, 0xe4 }, { 0xc5, 0xe5 }, { 0xc6, 0xe6 }, { 0xc7, 0xe7 }, { 0xc8, 0xe8 }, { 0xc9, 0xe9 }, { 0xca, 0xea }, { 0xcb, 0xeb }, { 0xcc, 0xec }, { 0xcd, 0xed }, { 0xce, 0xee }, { 0xcf, 0xef }, { 0xd0, 0xf0 }, { 0xd1, 0xf1 }, { 0xd2, 0xf2 }, { 0xd3, 0xf3 }, { 0xd4, 0xf4 }, { 0xd5, 0xf5 }, { 0xd6, 0xf6 }, { 0xd7, 0xf7 }, { 0xd8, 0xf8 }, { 0xd9, 0xf9 }, { 0xda, 0xfa }, { 0xdb, 0xfb }, { 0xdc, 0xfc }, { 0xdd, 0xfd }, { 0xde, 0xfe } }; public static final ISO8859_16Encoding INSTANCE = new ISO8859_16Encoding(); } jcodings-jcodings-1.0.11/src/org/jcodings/specific/ISO8859_1Encoding.java000066400000000000000000000352261223451536200256700ustar00rootroot00000000000000/* * Permission is hereby granted, free of charge, to any person obtaining a copy of * this software and associated documentation files (the "Software"), to deal in * the Software without restriction, including without limitation the rights to * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies * of the Software, and to permit persons to whom the Software is furnished to do * so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ package org.jcodings.specific; import org.jcodings.ApplyAllCaseFoldFunction; import org.jcodings.CaseFoldCodeItem; import org.jcodings.ISOEncoding; public final class ISO8859_1Encoding extends ISOEncoding { protected ISO8859_1Encoding() { super("ISO-8859-1", ISO8859_1CtypeTable, ISO8859_1ToLowerCaseTable, ISO8859_1CaseFoldMap); } @Override public void applyAllCaseFold(int flag, ApplyAllCaseFoldFunction fun, Object arg) { applyAllCaseFoldWithMap(CaseFoldMap.length, CaseFoldMap, true, flag, fun, arg); } /** get_case_fold_codes_by_str */ @Override public CaseFoldCodeItem[]caseFoldCodesByString(int flag, byte[]bytes, int p, int end) { int b = bytes[p] & 0xff; if (0x41 <= b && b <= 0x5a) { CaseFoldCodeItem item0 = new CaseFoldCodeItem(1, 1, new int[]{b + 0x20}); if (b == 0x53 && end > p + 1 && (bytes[p+1] == (byte)0x53 || bytes[p+1] == (byte)0x73)) { /* ss */ CaseFoldCodeItem item1 = new CaseFoldCodeItem(2, 1, new int[]{0xdf}); return new CaseFoldCodeItem[]{item0, item1}; } else { return new CaseFoldCodeItem[]{item0}; } } else if (0x61 <= b && b <= 0x7a) { CaseFoldCodeItem item0 = new CaseFoldCodeItem(1, 1, new int[]{b - 0x20}); if (b == 0x73 && end > p + 1 && (bytes[p+1] == (byte)0x73 || bytes[p+1] == (byte)0x53)) { /* ss */ CaseFoldCodeItem item1 = new CaseFoldCodeItem(2, 1, new int[]{0xdf}); return new CaseFoldCodeItem[]{item0, item1}; } else { return new CaseFoldCodeItem[]{item0}; } } else if (0xc0 <= b && b <= 0xcf) { return new CaseFoldCodeItem[]{new CaseFoldCodeItem(1, 1, new int[]{b + 0x20})}; } else if (0xd0 <= b && b <= 0xdf) { if (b == 0xdf) { CaseFoldCodeItem item0 = new CaseFoldCodeItem(1, 2, new int[]{'s', 's'}); CaseFoldCodeItem item1 = new CaseFoldCodeItem(1, 2, new int[]{'S', 'S'}); CaseFoldCodeItem item2 = new CaseFoldCodeItem(1, 2, new int[]{'s', 'S'}); CaseFoldCodeItem item3 = new CaseFoldCodeItem(1, 2, new int[]{'S', 's'}); return new CaseFoldCodeItem[]{item0, item1, item2, item3}; } else if (b != 0xd7) { return new CaseFoldCodeItem[]{new CaseFoldCodeItem(1, 1, new int[]{b + 0x20})}; } } else if (0xe0 <= b && b <= 0xef) { return new CaseFoldCodeItem[]{new CaseFoldCodeItem(1, 1, new int[]{b - 0x20})}; } else if (0xf0 <= b && b <= 0xfe) { if (b != 0xf7) { return new CaseFoldCodeItem[]{new CaseFoldCodeItem(1, 1, new int[]{b - 0x20})}; } } return EMPTY_FOLD_CODES; } static final short ISO8859_1CtypeTable[] = { 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x420c, 0x4209, 0x4208, 0x4208, 0x4208, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4284, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x7ca2, 0x7ca2, 0x7ca2, 0x7ca2, 0x7ca2, 0x7ca2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x51a0, 0x41a0, 0x78e2, 0x78e2, 0x78e2, 0x78e2, 0x78e2, 0x78e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x4008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0284, 0x01a0, 0x00a0, 0x00a0, 0x00a0, 0x00a0, 0x00a0, 0x00a0, 0x00a0, 0x00a0, 0x30e2, 0x01a0, 0x00a0, 0x01a0, 0x00a0, 0x00a0, 0x00a0, 0x00a0, 0x10a0, 0x10a0, 0x00a0, 0x30e2, 0x00a0, 0x01a0, 0x00a0, 0x10a0, 0x30e2, 0x01a0, 0x10a0, 0x10a0, 0x10a0, 0x01a0, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x00a0, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x00a0, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2 }; static final byte ISO8859_1ToLowerCaseTable[] = new byte[]{ (byte)'\000', (byte)'\001', (byte)'\002', (byte)'\003', (byte)'\004', (byte)'\005', (byte)'\006', (byte)'\007', (byte)'\010', (byte)'\011', (byte)'\012', (byte)'\013', (byte)'\014', (byte)'\015', (byte)'\016', (byte)'\017', (byte)'\020', (byte)'\021', (byte)'\022', (byte)'\023', (byte)'\024', (byte)'\025', (byte)'\026', (byte)'\027', (byte)'\030', (byte)'\031', (byte)'\032', (byte)'\033', (byte)'\034', (byte)'\035', (byte)'\036', (byte)'\037', (byte)'\040', (byte)'\041', (byte)'\042', (byte)'\043', (byte)'\044', (byte)'\045', (byte)'\046', (byte)'\047', (byte)'\050', (byte)'\051', (byte)'\052', (byte)'\053', (byte)'\054', (byte)'\055', (byte)'\056', (byte)'\057', (byte)'\060', (byte)'\061', (byte)'\062', (byte)'\063', (byte)'\064', (byte)'\065', (byte)'\066', (byte)'\067', (byte)'\070', (byte)'\071', (byte)'\072', (byte)'\073', (byte)'\074', (byte)'\075', (byte)'\076', (byte)'\077', (byte)'\100', (byte)'\141', (byte)'\142', (byte)'\143', (byte)'\144', (byte)'\145', (byte)'\146', (byte)'\147', (byte)'\150', (byte)'\151', (byte)'\152', (byte)'\153', (byte)'\154', (byte)'\155', (byte)'\156', (byte)'\157', (byte)'\160', (byte)'\161', (byte)'\162', (byte)'\163', (byte)'\164', (byte)'\165', (byte)'\166', (byte)'\167', (byte)'\170', (byte)'\171', (byte)'\172', (byte)'\133', (byte)'\134', (byte)'\135', (byte)'\136', (byte)'\137', (byte)'\140', (byte)'\141', (byte)'\142', (byte)'\143', (byte)'\144', (byte)'\145', (byte)'\146', (byte)'\147', (byte)'\150', (byte)'\151', (byte)'\152', (byte)'\153', (byte)'\154', (byte)'\155', (byte)'\156', (byte)'\157', (byte)'\160', (byte)'\161', (byte)'\162', (byte)'\163', (byte)'\164', (byte)'\165', (byte)'\166', (byte)'\167', (byte)'\170', (byte)'\171', (byte)'\172', (byte)'\173', (byte)'\174', (byte)'\175', (byte)'\176', (byte)'\177', (byte)'\200', (byte)'\201', (byte)'\202', (byte)'\203', (byte)'\204', (byte)'\205', (byte)'\206', (byte)'\207', (byte)'\210', (byte)'\211', (byte)'\212', (byte)'\213', (byte)'\214', (byte)'\215', (byte)'\216', (byte)'\217', (byte)'\220', (byte)'\221', (byte)'\222', (byte)'\223', (byte)'\224', (byte)'\225', (byte)'\226', (byte)'\227', (byte)'\230', (byte)'\231', (byte)'\232', (byte)'\233', (byte)'\234', (byte)'\235', (byte)'\236', (byte)'\237', (byte)'\240', (byte)'\241', (byte)'\242', (byte)'\243', (byte)'\244', (byte)'\245', (byte)'\246', (byte)'\247', (byte)'\250', (byte)'\251', (byte)'\252', (byte)'\253', (byte)'\254', (byte)'\255', (byte)'\256', (byte)'\257', (byte)'\260', (byte)'\261', (byte)'\262', (byte)'\263', (byte)'\264', (byte)'\265', (byte)'\266', (byte)'\267', (byte)'\270', (byte)'\271', (byte)'\272', (byte)'\273', (byte)'\274', (byte)'\275', (byte)'\276', (byte)'\277', (byte)'\340', (byte)'\341', (byte)'\342', (byte)'\343', (byte)'\344', (byte)'\345', (byte)'\346', (byte)'\347', (byte)'\350', (byte)'\351', (byte)'\352', (byte)'\353', (byte)'\354', (byte)'\355', (byte)'\356', (byte)'\357', (byte)'\360', (byte)'\361', (byte)'\362', (byte)'\363', (byte)'\364', (byte)'\365', (byte)'\366', (byte)'\327', (byte)'\370', (byte)'\371', (byte)'\372', (byte)'\373', (byte)'\374', (byte)'\375', (byte)'\376', (byte)'\337', (byte)'\340', (byte)'\341', (byte)'\342', (byte)'\343', (byte)'\344', (byte)'\345', (byte)'\346', (byte)'\347', (byte)'\350', (byte)'\351', (byte)'\352', (byte)'\353', (byte)'\354', (byte)'\355', (byte)'\356', (byte)'\357', (byte)'\360', (byte)'\361', (byte)'\362', (byte)'\363', (byte)'\364', (byte)'\365', (byte)'\366', (byte)'\367', (byte)'\370', (byte)'\371', (byte)'\372', (byte)'\373', (byte)'\374', (byte)'\375', (byte)'\376', (byte)'\377' }; static final byte ISO8859_1ToUpperCaseTable[] = new byte[]{ (byte)'\000', (byte)'\001', (byte)'\002', (byte)'\003', (byte)'\004', (byte)'\005', (byte)'\006', (byte)'\007', (byte)'\010', (byte)'\011', (byte)'\012', (byte)'\013', (byte)'\014', (byte)'\015', (byte)'\016', (byte)'\017', (byte)'\020', (byte)'\021', (byte)'\022', (byte)'\023', (byte)'\024', (byte)'\025', (byte)'\026', (byte)'\027', (byte)'\030', (byte)'\031', (byte)'\032', (byte)'\033', (byte)'\034', (byte)'\035', (byte)'\036', (byte)'\037', (byte)'\040', (byte)'\041', (byte)'\042', (byte)'\043', (byte)'\044', (byte)'\045', (byte)'\046', (byte)'\047', (byte)'\050', (byte)'\051', (byte)'\052', (byte)'\053', (byte)'\054', (byte)'\055', (byte)'\056', (byte)'\057', (byte)'\060', (byte)'\061', (byte)'\062', (byte)'\063', (byte)'\064', (byte)'\065', (byte)'\066', (byte)'\067', (byte)'\070', (byte)'\071', (byte)'\072', (byte)'\073', (byte)'\074', (byte)'\075', (byte)'\076', (byte)'\077', (byte)'\100', (byte)'\101', (byte)'\102', (byte)'\103', (byte)'\104', (byte)'\105', (byte)'\106', (byte)'\107', (byte)'\110', (byte)'\111', (byte)'\112', (byte)'\113', (byte)'\114', (byte)'\115', (byte)'\116', (byte)'\117', (byte)'\120', (byte)'\121', (byte)'\122', (byte)'\123', (byte)'\124', (byte)'\125', (byte)'\126', (byte)'\127', (byte)'\130', (byte)'\131', (byte)'\132', (byte)'\133', (byte)'\134', (byte)'\135', (byte)'\136', (byte)'\137', (byte)'\140', (byte)'\101', (byte)'\102', (byte)'\103', (byte)'\104', (byte)'\105', (byte)'\106', (byte)'\107', (byte)'\110', (byte)'\111', (byte)'\112', (byte)'\113', (byte)'\114', (byte)'\115', (byte)'\116', (byte)'\117', (byte)'\120', (byte)'\121', (byte)'\122', (byte)'\123', (byte)'\124', (byte)'\125', (byte)'\126', (byte)'\127', (byte)'\130', (byte)'\131', (byte)'\132', (byte)'\173', (byte)'\174', (byte)'\175', (byte)'\176', (byte)'\177', (byte)'\200', (byte)'\201', (byte)'\202', (byte)'\203', (byte)'\204', (byte)'\205', (byte)'\206', (byte)'\207', (byte)'\210', (byte)'\211', (byte)'\212', (byte)'\213', (byte)'\214', (byte)'\215', (byte)'\216', (byte)'\217', (byte)'\220', (byte)'\221', (byte)'\222', (byte)'\223', (byte)'\224', (byte)'\225', (byte)'\226', (byte)'\227', (byte)'\230', (byte)'\231', (byte)'\232', (byte)'\233', (byte)'\234', (byte)'\235', (byte)'\236', (byte)'\237', (byte)'\240', (byte)'\241', (byte)'\242', (byte)'\243', (byte)'\244', (byte)'\245', (byte)'\246', (byte)'\247', (byte)'\250', (byte)'\251', (byte)'\252', (byte)'\253', (byte)'\254', (byte)'\255', (byte)'\256', (byte)'\257', (byte)'\260', (byte)'\261', (byte)'\262', (byte)'\263', (byte)'\264', (byte)'\265', (byte)'\266', (byte)'\267', (byte)'\270', (byte)'\271', (byte)'\272', (byte)'\273', (byte)'\274', (byte)'\275', (byte)'\276', (byte)'\277', (byte)'\300', (byte)'\301', (byte)'\302', (byte)'\303', (byte)'\304', (byte)'\305', (byte)'\306', (byte)'\307', (byte)'\310', (byte)'\311', (byte)'\312', (byte)'\313', (byte)'\314', (byte)'\315', (byte)'\316', (byte)'\317', (byte)'\320', (byte)'\321', (byte)'\322', (byte)'\323', (byte)'\324', (byte)'\325', (byte)'\326', (byte)'\327', (byte)'\330', (byte)'\331', (byte)'\332', (byte)'\333', (byte)'\334', (byte)'\335', (byte)'\336', (byte)'\337', (byte)'\300', (byte)'\301', (byte)'\302', (byte)'\303', (byte)'\304', (byte)'\305', (byte)'\306', (byte)'\307', (byte)'\310', (byte)'\311', (byte)'\312', (byte)'\313', (byte)'\314', (byte)'\315', (byte)'\316', (byte)'\317', (byte)'\320', (byte)'\321', (byte)'\322', (byte)'\323', (byte)'\324', (byte)'\325', (byte)'\326', (byte)'\367', (byte)'\330', (byte)'\331', (byte)'\332', (byte)'\333', (byte)'\334', (byte)'\335', (byte)'\336', (byte)'\377', }; static final int ISO8859_1CaseFoldMap[][] = { { 0xc0, 0xe0 }, { 0xc1, 0xe1 }, { 0xc2, 0xe2 }, { 0xc3, 0xe3 }, { 0xc4, 0xe4 }, { 0xc5, 0xe5 }, { 0xc6, 0xe6 }, { 0xc7, 0xe7 }, { 0xc8, 0xe8 }, { 0xc9, 0xe9 }, { 0xca, 0xea }, { 0xcb, 0xeb }, { 0xcc, 0xec }, { 0xcd, 0xed }, { 0xce, 0xee }, { 0xcf, 0xef }, { 0xd0, 0xf0 }, { 0xd1, 0xf1 }, { 0xd2, 0xf2 }, { 0xd3, 0xf3 }, { 0xd4, 0xf4 }, { 0xd5, 0xf5 }, { 0xd6, 0xf6 }, { 0xd8, 0xf8 }, { 0xd9, 0xf9 }, { 0xda, 0xfa }, { 0xdb, 0xfb }, { 0xdc, 0xfc }, { 0xdd, 0xfd }, { 0xde, 0xfe } }; public static final ISO8859_1Encoding INSTANCE = new ISO8859_1Encoding(); } jcodings-jcodings-1.0.11/src/org/jcodings/specific/ISO8859_2Encoding.java000066400000000000000000000210151223451536200256600ustar00rootroot00000000000000/* * Permission is hereby granted, free of charge, to any person obtaining a copy of * this software and associated documentation files (the "Software"), to deal in * the Software without restriction, including without limitation the rights to * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies * of the Software, and to permit persons to whom the Software is furnished to do * so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ package org.jcodings.specific; import org.jcodings.ISOEncoding; public final class ISO8859_2Encoding extends ISOEncoding { protected ISO8859_2Encoding() { super("ISO-8859-2", ISO8859_2CtypeTable, ISO8859_2ToLowerCaseTable, ISO8859_2CaseFoldMap); } static final short ISO8859_2CtypeTable[] = { 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x420c, 0x4209, 0x4208, 0x4208, 0x4208, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4284, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x7ca2, 0x7ca2, 0x7ca2, 0x7ca2, 0x7ca2, 0x7ca2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x51a0, 0x41a0, 0x78e2, 0x78e2, 0x78e2, 0x78e2, 0x78e2, 0x78e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x4008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0284, 0x34a2, 0x00a0, 0x34a2, 0x00a0, 0x34a2, 0x34a2, 0x00a0, 0x00a0, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x01a0, 0x34a2, 0x34a2, 0x00a0, 0x30e2, 0x00a0, 0x30e2, 0x00a0, 0x30e2, 0x30e2, 0x00a0, 0x00a0, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x00a0, 0x30e2, 0x30e2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x00a0, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x00a0, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x00a0 }; static final byte ISO8859_2ToLowerCaseTable[] = new byte[]{ (byte)'\000', (byte)'\001', (byte)'\002', (byte)'\003', (byte)'\004', (byte)'\005', (byte)'\006', (byte)'\007', (byte)'\010', (byte)'\011', (byte)'\012', (byte)'\013', (byte)'\014', (byte)'\015', (byte)'\016', (byte)'\017', (byte)'\020', (byte)'\021', (byte)'\022', (byte)'\023', (byte)'\024', (byte)'\025', (byte)'\026', (byte)'\027', (byte)'\030', (byte)'\031', (byte)'\032', (byte)'\033', (byte)'\034', (byte)'\035', (byte)'\036', (byte)'\037', (byte)'\040', (byte)'\041', (byte)'\042', (byte)'\043', (byte)'\044', (byte)'\045', (byte)'\046', (byte)'\047', (byte)'\050', (byte)'\051', (byte)'\052', (byte)'\053', (byte)'\054', (byte)'\055', (byte)'\056', (byte)'\057', (byte)'\060', (byte)'\061', (byte)'\062', (byte)'\063', (byte)'\064', (byte)'\065', (byte)'\066', (byte)'\067', (byte)'\070', (byte)'\071', (byte)'\072', (byte)'\073', (byte)'\074', (byte)'\075', (byte)'\076', (byte)'\077', (byte)'\100', (byte)'\141', (byte)'\142', (byte)'\143', (byte)'\144', (byte)'\145', (byte)'\146', (byte)'\147', (byte)'\150', (byte)'\151', (byte)'\152', (byte)'\153', (byte)'\154', (byte)'\155', (byte)'\156', (byte)'\157', (byte)'\160', (byte)'\161', (byte)'\162', (byte)'\163', (byte)'\164', (byte)'\165', (byte)'\166', (byte)'\167', (byte)'\170', (byte)'\171', (byte)'\172', (byte)'\133', (byte)'\134', (byte)'\135', (byte)'\136', (byte)'\137', (byte)'\140', (byte)'\141', (byte)'\142', (byte)'\143', (byte)'\144', (byte)'\145', (byte)'\146', (byte)'\147', (byte)'\150', (byte)'\151', (byte)'\152', (byte)'\153', (byte)'\154', (byte)'\155', (byte)'\156', (byte)'\157', (byte)'\160', (byte)'\161', (byte)'\162', (byte)'\163', (byte)'\164', (byte)'\165', (byte)'\166', (byte)'\167', (byte)'\170', (byte)'\171', (byte)'\172', (byte)'\173', (byte)'\174', (byte)'\175', (byte)'\176', (byte)'\177', (byte)'\200', (byte)'\201', (byte)'\202', (byte)'\203', (byte)'\204', (byte)'\205', (byte)'\206', (byte)'\207', (byte)'\210', (byte)'\211', (byte)'\212', (byte)'\213', (byte)'\214', (byte)'\215', (byte)'\216', (byte)'\217', (byte)'\220', (byte)'\221', (byte)'\222', (byte)'\223', (byte)'\224', (byte)'\225', (byte)'\226', (byte)'\227', (byte)'\230', (byte)'\231', (byte)'\232', (byte)'\233', (byte)'\234', (byte)'\235', (byte)'\236', (byte)'\237', (byte)'\240', (byte)'\261', (byte)'\242', (byte)'\263', (byte)'\244', (byte)'\265', (byte)'\266', (byte)'\247', (byte)'\250', (byte)'\271', (byte)'\272', (byte)'\273', (byte)'\274', (byte)'\255', (byte)'\276', (byte)'\277', (byte)'\260', (byte)'\261', (byte)'\262', (byte)'\263', (byte)'\264', (byte)'\265', (byte)'\266', (byte)'\267', (byte)'\270', (byte)'\271', (byte)'\272', (byte)'\273', (byte)'\274', (byte)'\275', (byte)'\276', (byte)'\277', (byte)'\340', (byte)'\341', (byte)'\342', (byte)'\343', (byte)'\344', (byte)'\345', (byte)'\346', (byte)'\347', (byte)'\350', (byte)'\351', (byte)'\352', (byte)'\353', (byte)'\354', (byte)'\355', (byte)'\356', (byte)'\357', (byte)'\360', (byte)'\361', (byte)'\362', (byte)'\363', (byte)'\364', (byte)'\365', (byte)'\366', (byte)'\327', (byte)'\370', (byte)'\371', (byte)'\372', (byte)'\373', (byte)'\374', (byte)'\375', (byte)'\376', (byte)'\337', (byte)'\340', (byte)'\341', (byte)'\342', (byte)'\343', (byte)'\344', (byte)'\345', (byte)'\346', (byte)'\347', (byte)'\350', (byte)'\351', (byte)'\352', (byte)'\353', (byte)'\354', (byte)'\355', (byte)'\356', (byte)'\357', (byte)'\360', (byte)'\361', (byte)'\362', (byte)'\363', (byte)'\364', (byte)'\365', (byte)'\366', (byte)'\367', (byte)'\370', (byte)'\371', (byte)'\372', (byte)'\373', (byte)'\374', (byte)'\375', (byte)'\376', (byte)'\377' }; static final int ISO8859_2CaseFoldMap[][] = { { 0xa1, 0xb1 }, { 0xa3, 0xb3 }, { 0xa5, 0xb5 }, { 0xa6, 0xb6 }, { 0xa9, 0xb9 }, { 0xaa, 0xba }, { 0xab, 0xbb }, { 0xac, 0xbc }, { 0xae, 0xbe }, { 0xaf, 0xbf }, { 0xc0, 0xe0 }, { 0xc1, 0xe1 }, { 0xc2, 0xe2 }, { 0xc3, 0xe3 }, { 0xc4, 0xe4 }, { 0xc5, 0xe5 }, { 0xc6, 0xe6 }, { 0xc7, 0xe7 }, { 0xc8, 0xe8 }, { 0xc9, 0xe9 }, { 0xca, 0xea }, { 0xcb, 0xeb }, { 0xcc, 0xec }, { 0xcd, 0xed }, { 0xce, 0xee }, { 0xcf, 0xef }, { 0xd0, 0xf0 }, { 0xd1, 0xf1 }, { 0xd2, 0xf2 }, { 0xd3, 0xf3 }, { 0xd4, 0xf4 }, { 0xd5, 0xf5 }, { 0xd6, 0xf6 }, { 0xd8, 0xf8 }, { 0xd9, 0xf9 }, { 0xda, 0xfa }, { 0xdb, 0xfb }, { 0xdc, 0xfc }, { 0xdd, 0xfd }, { 0xde, 0xfe } }; public static final ISO8859_2Encoding INSTANCE = new ISO8859_2Encoding(); } jcodings-jcodings-1.0.11/src/org/jcodings/specific/ISO8859_3Encoding.java000066400000000000000000000206261223451536200256700ustar00rootroot00000000000000/* * Permission is hereby granted, free of charge, to any person obtaining a copy of * this software and associated documentation files (the "Software"), to deal in * the Software without restriction, including without limitation the rights to * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies * of the Software, and to permit persons to whom the Software is furnished to do * so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ package org.jcodings.specific; import org.jcodings.ISOEncoding; public final class ISO8859_3Encoding extends ISOEncoding { protected ISO8859_3Encoding() { super("ISO-8859-3", ISO8859_3CtypeTable, ISO8859_3ToLowerCaseTable, ISO8859_3CaseFoldMap); } static final short ISO8859_3CtypeTable[] = { 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x420c, 0x4209, 0x4208, 0x4208, 0x4208, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4284, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x7ca2, 0x7ca2, 0x7ca2, 0x7ca2, 0x7ca2, 0x7ca2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x51a0, 0x41a0, 0x78e2, 0x78e2, 0x78e2, 0x78e2, 0x78e2, 0x78e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x4008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0284, 0x34a2, 0x00a0, 0x00a0, 0x00a0, 0x0000, 0x34a2, 0x00a0, 0x00a0, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x01a0, 0x0000, 0x34a2, 0x00a0, 0x30e2, 0x10a0, 0x10a0, 0x00a0, 0x30e2, 0x30e2, 0x01a0, 0x00a0, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x11a0, 0x0000, 0x30e2, 0x34a2, 0x34a2, 0x34a2, 0x0000, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x0000, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x00a0, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x0000, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x0000, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x00a0, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x00a0 }; static final byte ISO8859_3ToLowerCaseTable[] = new byte[]{ (byte)'\000', (byte)'\001', (byte)'\002', (byte)'\003', (byte)'\004', (byte)'\005', (byte)'\006', (byte)'\007', (byte)'\010', (byte)'\011', (byte)'\012', (byte)'\013', (byte)'\014', (byte)'\015', (byte)'\016', (byte)'\017', (byte)'\020', (byte)'\021', (byte)'\022', (byte)'\023', (byte)'\024', (byte)'\025', (byte)'\026', (byte)'\027', (byte)'\030', (byte)'\031', (byte)'\032', (byte)'\033', (byte)'\034', (byte)'\035', (byte)'\036', (byte)'\037', (byte)'\040', (byte)'\041', (byte)'\042', (byte)'\043', (byte)'\044', (byte)'\045', (byte)'\046', (byte)'\047', (byte)'\050', (byte)'\051', (byte)'\052', (byte)'\053', (byte)'\054', (byte)'\055', (byte)'\056', (byte)'\057', (byte)'\060', (byte)'\061', (byte)'\062', (byte)'\063', (byte)'\064', (byte)'\065', (byte)'\066', (byte)'\067', (byte)'\070', (byte)'\071', (byte)'\072', (byte)'\073', (byte)'\074', (byte)'\075', (byte)'\076', (byte)'\077', (byte)'\100', (byte)'\141', (byte)'\142', (byte)'\143', (byte)'\144', (byte)'\145', (byte)'\146', (byte)'\147', (byte)'\150', (byte)'\151', (byte)'\152', (byte)'\153', (byte)'\154', (byte)'\155', (byte)'\156', (byte)'\157', (byte)'\160', (byte)'\161', (byte)'\162', (byte)'\163', (byte)'\164', (byte)'\165', (byte)'\166', (byte)'\167', (byte)'\170', (byte)'\171', (byte)'\172', (byte)'\133', (byte)'\134', (byte)'\135', (byte)'\136', (byte)'\137', (byte)'\140', (byte)'\141', (byte)'\142', (byte)'\143', (byte)'\144', (byte)'\145', (byte)'\146', (byte)'\147', (byte)'\150', (byte)'\151', (byte)'\152', (byte)'\153', (byte)'\154', (byte)'\155', (byte)'\156', (byte)'\157', (byte)'\160', (byte)'\161', (byte)'\162', (byte)'\163', (byte)'\164', (byte)'\165', (byte)'\166', (byte)'\167', (byte)'\170', (byte)'\171', (byte)'\172', (byte)'\173', (byte)'\174', (byte)'\175', (byte)'\176', (byte)'\177', (byte)'\200', (byte)'\201', (byte)'\202', (byte)'\203', (byte)'\204', (byte)'\205', (byte)'\206', (byte)'\207', (byte)'\210', (byte)'\211', (byte)'\212', (byte)'\213', (byte)'\214', (byte)'\215', (byte)'\216', (byte)'\217', (byte)'\220', (byte)'\221', (byte)'\222', (byte)'\223', (byte)'\224', (byte)'\225', (byte)'\226', (byte)'\227', (byte)'\230', (byte)'\231', (byte)'\232', (byte)'\233', (byte)'\234', (byte)'\235', (byte)'\236', (byte)'\237', (byte)'\240', (byte)'\261', (byte)'\242', (byte)'\243', (byte)'\244', (byte)'\245', (byte)'\266', (byte)'\247', (byte)'\250', (byte)'\271', (byte)'\272', (byte)'\273', (byte)'\274', (byte)'\255', (byte)'\256', (byte)'\277', (byte)'\260', (byte)'\261', (byte)'\262', (byte)'\263', (byte)'\264', (byte)'\265', (byte)'\266', (byte)'\267', (byte)'\270', (byte)'\271', (byte)'\272', (byte)'\273', (byte)'\274', (byte)'\275', (byte)'\276', (byte)'\277', (byte)'\340', (byte)'\341', (byte)'\342', (byte)'\303', (byte)'\344', (byte)'\345', (byte)'\346', (byte)'\347', (byte)'\350', (byte)'\351', (byte)'\352', (byte)'\353', (byte)'\354', (byte)'\355', (byte)'\356', (byte)'\357', (byte)'\320', (byte)'\361', (byte)'\362', (byte)'\363', (byte)'\364', (byte)'\365', (byte)'\366', (byte)'\327', (byte)'\370', (byte)'\371', (byte)'\372', (byte)'\373', (byte)'\374', (byte)'\375', (byte)'\376', (byte)'\337', (byte)'\340', (byte)'\341', (byte)'\342', (byte)'\343', (byte)'\344', (byte)'\345', (byte)'\346', (byte)'\347', (byte)'\350', (byte)'\351', (byte)'\352', (byte)'\353', (byte)'\354', (byte)'\355', (byte)'\356', (byte)'\357', (byte)'\360', (byte)'\361', (byte)'\362', (byte)'\363', (byte)'\364', (byte)'\365', (byte)'\366', (byte)'\367', (byte)'\370', (byte)'\371', (byte)'\372', (byte)'\373', (byte)'\374', (byte)'\375', (byte)'\376', (byte)'\377' }; static final int ISO8859_3CaseFoldMap[][] = { { 0xa1, 0xb1 }, { 0xa6, 0xb6 }, { 0xa9, 0xb9 }, { 0xaa, 0xba }, { 0xab, 0xbb }, { 0xac, 0xbc }, { 0xaf, 0xbf }, { 0xc0, 0xe0 }, { 0xc1, 0xe1 }, { 0xc2, 0xe2 }, { 0xc4, 0xe4 }, { 0xc5, 0xe5 }, { 0xc6, 0xe6 }, { 0xc7, 0xe7 }, { 0xc8, 0xe8 }, { 0xc9, 0xe9 }, { 0xca, 0xea }, { 0xcb, 0xeb }, { 0xcc, 0xec }, { 0xcd, 0xed }, { 0xce, 0xee }, { 0xcf, 0xef }, { 0xd1, 0xf1 }, { 0xd2, 0xf2 }, { 0xd3, 0xf3 }, { 0xd4, 0xf4 }, { 0xd5, 0xf5 }, { 0xd6, 0xf6 }, { 0xd8, 0xf8 }, { 0xd9, 0xf9 }, { 0xda, 0xfa }, { 0xdb, 0xfb }, { 0xdc, 0xfc }, { 0xdd, 0xfd }, { 0xde, 0xfe } }; public static final ISO8859_3Encoding INSTANCE = new ISO8859_3Encoding(); } jcodings-jcodings-1.0.11/src/org/jcodings/specific/ISO8859_4Encoding.java000066400000000000000000000207651223451536200256750ustar00rootroot00000000000000/* * Permission is hereby granted, free of charge, to any person obtaining a copy of * this software and associated documentation files (the "Software"), to deal in * the Software without restriction, including without limitation the rights to * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies * of the Software, and to permit persons to whom the Software is furnished to do * so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ package org.jcodings.specific; import org.jcodings.ISOEncoding; public final class ISO8859_4Encoding extends ISOEncoding { protected ISO8859_4Encoding() { super("ISO-8859-4", ISO8859_4CtypeTable, ISO8859_4ToLowerCaseTable, ISO8859_4CaseFoldMap); } static final short ISO8859_4CtypeTable[] = { 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x420c, 0x4209, 0x4208, 0x4208, 0x4208, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4284, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x7ca2, 0x7ca2, 0x7ca2, 0x7ca2, 0x7ca2, 0x7ca2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x51a0, 0x41a0, 0x78e2, 0x78e2, 0x78e2, 0x78e2, 0x78e2, 0x78e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x4008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0284, 0x34a2, 0x30e2, 0x34a2, 0x00a0, 0x34a2, 0x34a2, 0x00a0, 0x00a0, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x01a0, 0x34a2, 0x00a0, 0x00a0, 0x30e2, 0x00a0, 0x30e2, 0x00a0, 0x30e2, 0x30e2, 0x00a0, 0x00a0, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x34a2, 0x30e2, 0x30e2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x00a0, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x00a0, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x00a0 }; static final byte ISO8859_4ToLowerCaseTable[] = new byte[]{ (byte)'\000', (byte)'\001', (byte)'\002', (byte)'\003', (byte)'\004', (byte)'\005', (byte)'\006', (byte)'\007', (byte)'\010', (byte)'\011', (byte)'\012', (byte)'\013', (byte)'\014', (byte)'\015', (byte)'\016', (byte)'\017', (byte)'\020', (byte)'\021', (byte)'\022', (byte)'\023', (byte)'\024', (byte)'\025', (byte)'\026', (byte)'\027', (byte)'\030', (byte)'\031', (byte)'\032', (byte)'\033', (byte)'\034', (byte)'\035', (byte)'\036', (byte)'\037', (byte)'\040', (byte)'\041', (byte)'\042', (byte)'\043', (byte)'\044', (byte)'\045', (byte)'\046', (byte)'\047', (byte)'\050', (byte)'\051', (byte)'\052', (byte)'\053', (byte)'\054', (byte)'\055', (byte)'\056', (byte)'\057', (byte)'\060', (byte)'\061', (byte)'\062', (byte)'\063', (byte)'\064', (byte)'\065', (byte)'\066', (byte)'\067', (byte)'\070', (byte)'\071', (byte)'\072', (byte)'\073', (byte)'\074', (byte)'\075', (byte)'\076', (byte)'\077', (byte)'\100', (byte)'\141', (byte)'\142', (byte)'\143', (byte)'\144', (byte)'\145', (byte)'\146', (byte)'\147', (byte)'\150', (byte)'\151', (byte)'\152', (byte)'\153', (byte)'\154', (byte)'\155', (byte)'\156', (byte)'\157', (byte)'\160', (byte)'\161', (byte)'\162', (byte)'\163', (byte)'\164', (byte)'\165', (byte)'\166', (byte)'\167', (byte)'\170', (byte)'\171', (byte)'\172', (byte)'\133', (byte)'\134', (byte)'\135', (byte)'\136', (byte)'\137', (byte)'\140', (byte)'\141', (byte)'\142', (byte)'\143', (byte)'\144', (byte)'\145', (byte)'\146', (byte)'\147', (byte)'\150', (byte)'\151', (byte)'\152', (byte)'\153', (byte)'\154', (byte)'\155', (byte)'\156', (byte)'\157', (byte)'\160', (byte)'\161', (byte)'\162', (byte)'\163', (byte)'\164', (byte)'\165', (byte)'\166', (byte)'\167', (byte)'\170', (byte)'\171', (byte)'\172', (byte)'\173', (byte)'\174', (byte)'\175', (byte)'\176', (byte)'\177', (byte)'\200', (byte)'\201', (byte)'\202', (byte)'\203', (byte)'\204', (byte)'\205', (byte)'\206', (byte)'\207', (byte)'\210', (byte)'\211', (byte)'\212', (byte)'\213', (byte)'\214', (byte)'\215', (byte)'\216', (byte)'\217', (byte)'\220', (byte)'\221', (byte)'\222', (byte)'\223', (byte)'\224', (byte)'\225', (byte)'\226', (byte)'\227', (byte)'\230', (byte)'\231', (byte)'\232', (byte)'\233', (byte)'\234', (byte)'\235', (byte)'\236', (byte)'\237', (byte)'\240', (byte)'\261', (byte)'\242', (byte)'\263', (byte)'\244', (byte)'\265', (byte)'\266', (byte)'\247', (byte)'\250', (byte)'\271', (byte)'\272', (byte)'\273', (byte)'\274', (byte)'\255', (byte)'\276', (byte)'\257', (byte)'\260', (byte)'\261', (byte)'\262', (byte)'\263', (byte)'\264', (byte)'\265', (byte)'\266', (byte)'\267', (byte)'\270', (byte)'\271', (byte)'\272', (byte)'\273', (byte)'\274', (byte)'\277', (byte)'\276', (byte)'\277', (byte)'\340', (byte)'\341', (byte)'\342', (byte)'\343', (byte)'\344', (byte)'\345', (byte)'\346', (byte)'\347', (byte)'\350', (byte)'\351', (byte)'\352', (byte)'\353', (byte)'\354', (byte)'\355', (byte)'\356', (byte)'\357', (byte)'\360', (byte)'\361', (byte)'\362', (byte)'\363', (byte)'\364', (byte)'\365', (byte)'\366', (byte)'\327', (byte)'\370', (byte)'\371', (byte)'\372', (byte)'\373', (byte)'\374', (byte)'\375', (byte)'\376', (byte)'\337', (byte)'\340', (byte)'\341', (byte)'\342', (byte)'\343', (byte)'\344', (byte)'\345', (byte)'\346', (byte)'\347', (byte)'\350', (byte)'\351', (byte)'\352', (byte)'\353', (byte)'\354', (byte)'\355', (byte)'\356', (byte)'\357', (byte)'\360', (byte)'\361', (byte)'\362', (byte)'\363', (byte)'\364', (byte)'\365', (byte)'\366', (byte)'\367', (byte)'\370', (byte)'\371', (byte)'\372', (byte)'\373', (byte)'\374', (byte)'\375', (byte)'\376', (byte)'\377' }; static final int ISO8859_4CaseFoldMap[][] = { { 0xa1, 0xb1 }, { 0xa3, 0xb3 }, { 0xa5, 0xb5 }, { 0xa6, 0xb6 }, { 0xa9, 0xb9 }, { 0xaa, 0xba }, { 0xab, 0xbb }, { 0xac, 0xbc }, { 0xae, 0xbe }, { 0xc0, 0xe0 }, { 0xc1, 0xe1 }, { 0xc2, 0xe2 }, { 0xc3, 0xe3 }, { 0xc4, 0xe4 }, { 0xc5, 0xe5 }, { 0xc6, 0xe6 }, { 0xc7, 0xe7 }, { 0xc8, 0xe8 }, { 0xc9, 0xe9 }, { 0xca, 0xea }, { 0xcb, 0xeb }, { 0xcc, 0xec }, { 0xcd, 0xed }, { 0xce, 0xee }, { 0xcf, 0xef }, { 0xd0, 0xf0 }, { 0xd1, 0xf1 }, { 0xd2, 0xf2 }, { 0xd3, 0xf3 }, { 0xd4, 0xf4 }, { 0xd5, 0xf5 }, { 0xd6, 0xf6 }, { 0xd8, 0xf8 }, { 0xd9, 0xf9 }, { 0xda, 0xfa }, { 0xdb, 0xfb }, { 0xdc, 0xfc }, { 0xdd, 0xfd }, { 0xde, 0xfe } }; public static final ISO8859_4Encoding INSTANCE = new ISO8859_4Encoding(); } jcodings-jcodings-1.0.11/src/org/jcodings/specific/ISO8859_5Encoding.java000066400000000000000000000220041223451536200256620ustar00rootroot00000000000000/* * Permission is hereby granted, free of charge, to any person obtaining a copy of * this software and associated documentation files (the "Software"), to deal in * the Software without restriction, including without limitation the rights to * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies * of the Software, and to permit persons to whom the Software is furnished to do * so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ package org.jcodings.specific; import org.jcodings.ISOEncoding; import org.jcodings.IntHolder; public final class ISO8859_5Encoding extends ISOEncoding { protected ISO8859_5Encoding() { super("ISO-8859-5", ISO8859_5CtypeTable, ISO8859_5ToLowerCaseTable, ISO8859_5CaseFoldMap, false); } @Override public int mbcCaseFold(int flag, byte[]bytes, IntHolder pp, int end, byte[]lower) { int p = pp.value; lower[0] = LowerCaseTable[bytes[p] & 0xff]; pp.value++; return 1; } @Override public final byte[]toLowerCaseTable() { return LowerCaseTable; } static final short ISO8859_5CtypeTable[] = { 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x420c, 0x4209, 0x4208, 0x4208, 0x4208, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4284, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x7ca2, 0x7ca2, 0x7ca2, 0x7ca2, 0x7ca2, 0x7ca2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x51a0, 0x41a0, 0x78e2, 0x78e2, 0x78e2, 0x78e2, 0x78e2, 0x78e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x4008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0284, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x01a0, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x00a0, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x00a0, 0x30e2, 0x30e2 }; static final byte ISO8859_5ToLowerCaseTable[] = new byte[]{ (byte)'\000', (byte)'\001', (byte)'\002', (byte)'\003', (byte)'\004', (byte)'\005', (byte)'\006', (byte)'\007', (byte)'\010', (byte)'\011', (byte)'\012', (byte)'\013', (byte)'\014', (byte)'\015', (byte)'\016', (byte)'\017', (byte)'\020', (byte)'\021', (byte)'\022', (byte)'\023', (byte)'\024', (byte)'\025', (byte)'\026', (byte)'\027', (byte)'\030', (byte)'\031', (byte)'\032', (byte)'\033', (byte)'\034', (byte)'\035', (byte)'\036', (byte)'\037', (byte)'\040', (byte)'\041', (byte)'\042', (byte)'\043', (byte)'\044', (byte)'\045', (byte)'\046', (byte)'\047', (byte)'\050', (byte)'\051', (byte)'\052', (byte)'\053', (byte)'\054', (byte)'\055', (byte)'\056', (byte)'\057', (byte)'\060', (byte)'\061', (byte)'\062', (byte)'\063', (byte)'\064', (byte)'\065', (byte)'\066', (byte)'\067', (byte)'\070', (byte)'\071', (byte)'\072', (byte)'\073', (byte)'\074', (byte)'\075', (byte)'\076', (byte)'\077', (byte)'\100', (byte)'\141', (byte)'\142', (byte)'\143', (byte)'\144', (byte)'\145', (byte)'\146', (byte)'\147', (byte)'\150', (byte)'\151', (byte)'\152', (byte)'\153', (byte)'\154', (byte)'\155', (byte)'\156', (byte)'\157', (byte)'\160', (byte)'\161', (byte)'\162', (byte)'\163', (byte)'\164', (byte)'\165', (byte)'\166', (byte)'\167', (byte)'\170', (byte)'\171', (byte)'\172', (byte)'\133', (byte)'\134', (byte)'\135', (byte)'\136', (byte)'\137', (byte)'\140', (byte)'\141', (byte)'\142', (byte)'\143', (byte)'\144', (byte)'\145', (byte)'\146', (byte)'\147', (byte)'\150', (byte)'\151', (byte)'\152', (byte)'\153', (byte)'\154', (byte)'\155', (byte)'\156', (byte)'\157', (byte)'\160', (byte)'\161', (byte)'\162', (byte)'\163', (byte)'\164', (byte)'\165', (byte)'\166', (byte)'\167', (byte)'\170', (byte)'\171', (byte)'\172', (byte)'\173', (byte)'\174', (byte)'\175', (byte)'\176', (byte)'\177', (byte)'\200', (byte)'\201', (byte)'\202', (byte)'\203', (byte)'\204', (byte)'\205', (byte)'\206', (byte)'\207', (byte)'\210', (byte)'\211', (byte)'\212', (byte)'\213', (byte)'\214', (byte)'\215', (byte)'\216', (byte)'\217', (byte)'\220', (byte)'\221', (byte)'\222', (byte)'\223', (byte)'\224', (byte)'\225', (byte)'\226', (byte)'\227', (byte)'\230', (byte)'\231', (byte)'\232', (byte)'\233', (byte)'\234', (byte)'\235', (byte)'\236', (byte)'\237', (byte)'\240', (byte)'\361', (byte)'\362', (byte)'\363', (byte)'\364', (byte)'\365', (byte)'\366', (byte)'\367', (byte)'\370', (byte)'\371', (byte)'\372', (byte)'\373', (byte)'\374', (byte)'\255', (byte)'\376', (byte)'\377', (byte)'\320', (byte)'\321', (byte)'\322', (byte)'\323', (byte)'\324', (byte)'\325', (byte)'\326', (byte)'\327', (byte)'\330', (byte)'\331', (byte)'\332', (byte)'\333', (byte)'\334', (byte)'\335', (byte)'\336', (byte)'\337', (byte)'\340', (byte)'\341', (byte)'\342', (byte)'\343', (byte)'\344', (byte)'\345', (byte)'\346', (byte)'\347', (byte)'\350', (byte)'\351', (byte)'\352', (byte)'\353', (byte)'\354', (byte)'\355', (byte)'\356', (byte)'\357', (byte)'\320', (byte)'\321', (byte)'\322', (byte)'\323', (byte)'\324', (byte)'\325', (byte)'\326', (byte)'\327', (byte)'\330', (byte)'\331', (byte)'\332', (byte)'\333', (byte)'\334', (byte)'\335', (byte)'\336', (byte)'\337', (byte)'\340', (byte)'\341', (byte)'\342', (byte)'\343', (byte)'\344', (byte)'\345', (byte)'\346', (byte)'\347', (byte)'\350', (byte)'\351', (byte)'\352', (byte)'\353', (byte)'\354', (byte)'\355', (byte)'\356', (byte)'\357', (byte)'\360', (byte)'\361', (byte)'\362', (byte)'\363', (byte)'\364', (byte)'\365', (byte)'\366', (byte)'\367', (byte)'\370', (byte)'\371', (byte)'\372', (byte)'\373', (byte)'\374', (byte)'\375', (byte)'\376', (byte)'\377' }; static final int ISO8859_5CaseFoldMap[][] = { { 0xa1, 0xf1 }, { 0xa2, 0xf2 }, { 0xa3, 0xf3 }, { 0xa4, 0xf4 }, { 0xa5, 0xf5 }, { 0xa6, 0xf6 }, { 0xa7, 0xf7 }, { 0xa8, 0xf8 }, { 0xa9, 0xf9 }, { 0xaa, 0xfa }, { 0xab, 0xfb }, { 0xac, 0xfc }, { 0xae, 0xfe }, { 0xaf, 0xff }, { 0xb0, 0xd0 }, { 0xb1, 0xd1 }, { 0xb2, 0xd2 }, { 0xb3, 0xd3 }, { 0xb4, 0xd4 }, { 0xb5, 0xd5 }, { 0xb6, 0xd6 }, { 0xb7, 0xd7 }, { 0xb8, 0xd8 }, { 0xb9, 0xd9 }, { 0xba, 0xda }, { 0xbb, 0xdb }, { 0xbc, 0xdc }, { 0xbd, 0xdd }, { 0xbe, 0xdf }, { 0xbf, 0xdf }, { 0xc0, 0xe0 }, { 0xc1, 0xe1 }, { 0xc2, 0xe2 }, { 0xc3, 0xe3 }, { 0xc4, 0xe4 }, { 0xc5, 0xe5 }, { 0xc6, 0xe6 }, { 0xc7, 0xe7 }, { 0xc8, 0xe8 }, { 0xc9, 0xe9 }, { 0xca, 0xea }, { 0xcb, 0xeb }, { 0xcc, 0xec }, { 0xcd, 0xed }, { 0xce, 0xee }, { 0xcf, 0xef } }; public static final ISO8859_5Encoding INSTANCE = new ISO8859_5Encoding(); } jcodings-jcodings-1.0.11/src/org/jcodings/specific/ISO8859_6Encoding.java000066400000000000000000000106571223451536200256760ustar00rootroot00000000000000/* * Permission is hereby granted, free of charge, to any person obtaining a copy of * this software and associated documentation files (the "Software"), to deal in * the Software without restriction, including without limitation the rights to * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies * of the Software, and to permit persons to whom the Software is furnished to do * so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ package org.jcodings.specific; import org.jcodings.ApplyAllCaseFoldFunction; import org.jcodings.CaseFoldCodeItem; import org.jcodings.ISOEncoding; import org.jcodings.IntHolder; import org.jcodings.ascii.AsciiTables; public final class ISO8859_6Encoding extends ISOEncoding { protected ISO8859_6Encoding() { super("ISO-8859-6", ISO8859_6CtypeTable, AsciiTables.ToLowerCaseTable, null); } @Override public int mbcCaseFold(int flag, byte[]bytes, IntHolder pp, int end, byte[]lower) { return asciiMbcCaseFold(flag, bytes, pp, end, lower); } @Override public final byte[]toLowerCaseTable() { return LowerCaseTable; } @Override public void applyAllCaseFold(int flag, ApplyAllCaseFoldFunction fun, Object arg) { asciiApplyAllCaseFold(flag, fun, arg); } @Override public CaseFoldCodeItem[]caseFoldCodesByString(int flag, byte[]bytes, int p, int end) { return asciiCaseFoldCodesByString(flag, bytes, p, end); } static final short ISO8859_6CtypeTable[] = { 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x420c, 0x4209, 0x4208, 0x4208, 0x4208, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4284, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x7ca2, 0x7ca2, 0x7ca2, 0x7ca2, 0x7ca2, 0x7ca2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x51a0, 0x41a0, 0x78e2, 0x78e2, 0x78e2, 0x78e2, 0x78e2, 0x78e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x4008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0284, 0x0000, 0x0000, 0x0000, 0x00a0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x01a0, 0x01a0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x01a0, 0x0000, 0x0000, 0x0000, 0x01a0, 0x0000, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 }; public static final ISO8859_6Encoding INSTANCE = new ISO8859_6Encoding(); } jcodings-jcodings-1.0.11/src/org/jcodings/specific/ISO8859_7Encoding.java000066400000000000000000000213441223451536200256720ustar00rootroot00000000000000/* * Permission is hereby granted, free of charge, to any person obtaining a copy of * this software and associated documentation files (the "Software"), to deal in * the Software without restriction, including without limitation the rights to * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies * of the Software, and to permit persons to whom the Software is furnished to do * so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ package org.jcodings.specific; import org.jcodings.ISOEncoding; import org.jcodings.IntHolder; public final class ISO8859_7Encoding extends ISOEncoding { protected ISO8859_7Encoding() { super("ISO-8859-7", ISO8859_7CtypeTable, ISO8859_7ToLowerCaseTable, ISO8859_7CaseFoldMap, false); } @Override public int mbcCaseFold(int flag, byte[]bytes, IntHolder pp, int end, byte[]lower) { int p = pp.value; lower[0] = LowerCaseTable[bytes[p] & 0xff]; pp.value++; return 1; } @Override public final byte[]toLowerCaseTable() { return LowerCaseTable; } static final short ISO8859_7CtypeTable[] = { 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x420c, 0x4209, 0x4208, 0x4208, 0x4208, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4284, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x7ca2, 0x7ca2, 0x7ca2, 0x7ca2, 0x7ca2, 0x7ca2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x51a0, 0x41a0, 0x78e2, 0x78e2, 0x78e2, 0x78e2, 0x78e2, 0x78e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x4008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0284, 0x01a0, 0x01a0, 0x00a0, 0x0000, 0x0000, 0x00a0, 0x00a0, 0x00a0, 0x00a0, 0x0000, 0x01a0, 0x00a0, 0x01a0, 0x0000, 0x01a0, 0x00a0, 0x00a0, 0x10a0, 0x10a0, 0x00a0, 0x00a0, 0x34a2, 0x01a0, 0x34a2, 0x34a2, 0x34a2, 0x01a0, 0x34a2, 0x10a0, 0x34a2, 0x34a2, 0x30e2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x0000, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x0000 }; static final byte ISO8859_7ToLowerCaseTable[] = new byte[]{ (byte)'\000', (byte)'\001', (byte)'\002', (byte)'\003', (byte)'\004', (byte)'\005', (byte)'\006', (byte)'\007', (byte)'\010', (byte)'\011', (byte)'\012', (byte)'\013', (byte)'\014', (byte)'\015', (byte)'\016', (byte)'\017', (byte)'\020', (byte)'\021', (byte)'\022', (byte)'\023', (byte)'\024', (byte)'\025', (byte)'\026', (byte)'\027', (byte)'\030', (byte)'\031', (byte)'\032', (byte)'\033', (byte)'\034', (byte)'\035', (byte)'\036', (byte)'\037', (byte)'\040', (byte)'\041', (byte)'\042', (byte)'\043', (byte)'\044', (byte)'\045', (byte)'\046', (byte)'\047', (byte)'\050', (byte)'\051', (byte)'\052', (byte)'\053', (byte)'\054', (byte)'\055', (byte)'\056', (byte)'\057', (byte)'\060', (byte)'\061', (byte)'\062', (byte)'\063', (byte)'\064', (byte)'\065', (byte)'\066', (byte)'\067', (byte)'\070', (byte)'\071', (byte)'\072', (byte)'\073', (byte)'\074', (byte)'\075', (byte)'\076', (byte)'\077', (byte)'\100', (byte)'\141', (byte)'\142', (byte)'\143', (byte)'\144', (byte)'\145', (byte)'\146', (byte)'\147', (byte)'\150', (byte)'\151', (byte)'\152', (byte)'\153', (byte)'\154', (byte)'\155', (byte)'\156', (byte)'\157', (byte)'\160', (byte)'\161', (byte)'\162', (byte)'\163', (byte)'\164', (byte)'\165', (byte)'\166', (byte)'\167', (byte)'\170', (byte)'\171', (byte)'\172', (byte)'\133', (byte)'\134', (byte)'\135', (byte)'\136', (byte)'\137', (byte)'\140', (byte)'\141', (byte)'\142', (byte)'\143', (byte)'\144', (byte)'\145', (byte)'\146', (byte)'\147', (byte)'\150', (byte)'\151', (byte)'\152', (byte)'\153', (byte)'\154', (byte)'\155', (byte)'\156', (byte)'\157', (byte)'\160', (byte)'\161', (byte)'\162', (byte)'\163', (byte)'\164', (byte)'\165', (byte)'\166', (byte)'\167', (byte)'\170', (byte)'\171', (byte)'\172', (byte)'\173', (byte)'\174', (byte)'\175', (byte)'\176', (byte)'\177', (byte)'\200', (byte)'\201', (byte)'\202', (byte)'\203', (byte)'\204', (byte)'\205', (byte)'\206', (byte)'\207', (byte)'\210', (byte)'\211', (byte)'\212', (byte)'\213', (byte)'\214', (byte)'\215', (byte)'\216', (byte)'\217', (byte)'\220', (byte)'\221', (byte)'\222', (byte)'\223', (byte)'\224', (byte)'\225', (byte)'\226', (byte)'\227', (byte)'\230', (byte)'\231', (byte)'\232', (byte)'\233', (byte)'\234', (byte)'\235', (byte)'\236', (byte)'\237', (byte)'\240', (byte)'\241', (byte)'\242', (byte)'\243', (byte)'\244', (byte)'\245', (byte)'\246', (byte)'\247', (byte)'\250', (byte)'\251', (byte)'\252', (byte)'\253', (byte)'\254', (byte)'\255', (byte)'\256', (byte)'\257', (byte)'\260', (byte)'\261', (byte)'\262', (byte)'\263', (byte)'\264', (byte)'\265', (byte)'\334', (byte)'\267', (byte)'\335', (byte)'\336', (byte)'\337', (byte)'\273', (byte)'\374', (byte)'\275', (byte)'\375', (byte)'\376', (byte)'\300', (byte)'\341', (byte)'\342', (byte)'\343', (byte)'\344', (byte)'\345', (byte)'\346', (byte)'\347', (byte)'\350', (byte)'\351', (byte)'\352', (byte)'\353', (byte)'\354', (byte)'\355', (byte)'\356', (byte)'\357', (byte)'\360', (byte)'\361', (byte)'\322', (byte)'\363', (byte)'\364', (byte)'\365', (byte)'\366', (byte)'\367', (byte)'\370', (byte)'\371', (byte)'\372', (byte)'\373', (byte)'\334', (byte)'\335', (byte)'\336', (byte)'\337', (byte)'\340', (byte)'\341', (byte)'\342', (byte)'\343', (byte)'\344', (byte)'\345', (byte)'\346', (byte)'\347', (byte)'\350', (byte)'\351', (byte)'\352', (byte)'\353', (byte)'\354', (byte)'\355', (byte)'\356', (byte)'\357', (byte)'\360', (byte)'\361', (byte)'\362', (byte)'\363', (byte)'\364', (byte)'\365', (byte)'\366', (byte)'\367', (byte)'\370', (byte)'\371', (byte)'\372', (byte)'\373', (byte)'\374', (byte)'\375', (byte)'\376', (byte)'\377' }; static final int ISO8859_7CaseFoldMap[][] = { { 0xb6, 0xdc }, { 0xb8, 0xdd }, { 0xb9, 0xde }, { 0xba, 0xdf }, { 0xbc, 0xfc }, { 0xbe, 0xfd }, { 0xbf, 0xfe }, { 0xc1, 0xe1 }, { 0xc2, 0xe2 }, { 0xc3, 0xe3 }, { 0xc4, 0xe4 }, { 0xc5, 0xe5 }, { 0xc6, 0xe6 }, { 0xc7, 0xe7 }, { 0xc8, 0xe8 }, { 0xc9, 0xe9 }, { 0xca, 0xea }, { 0xcb, 0xeb }, { 0xcc, 0xec }, { 0xcd, 0xed }, { 0xce, 0xee }, { 0xcf, 0xef }, { 0xd0, 0xf0 }, { 0xd1, 0xf1 }, { 0xd2, 0xf2 }, { 0xd3, 0xf3 }, { 0xd4, 0xf4 }, { 0xd5, 0xf5 }, { 0xd6, 0xf6 }, { 0xd7, 0xf7 }, { 0xd8, 0xf8 }, { 0xd9, 0xf9 }, { 0xda, 0xfa }, { 0xdb, 0xfb } }; public static final ISO8859_7Encoding INSTANCE = new ISO8859_7Encoding(); } jcodings-jcodings-1.0.11/src/org/jcodings/specific/ISO8859_8Encoding.java000066400000000000000000000106571223451536200257000ustar00rootroot00000000000000/* * Permission is hereby granted, free of charge, to any person obtaining a copy of * this software and associated documentation files (the "Software"), to deal in * the Software without restriction, including without limitation the rights to * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies * of the Software, and to permit persons to whom the Software is furnished to do * so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ package org.jcodings.specific; import org.jcodings.ApplyAllCaseFoldFunction; import org.jcodings.CaseFoldCodeItem; import org.jcodings.ISOEncoding; import org.jcodings.IntHolder; import org.jcodings.ascii.AsciiTables; public final class ISO8859_8Encoding extends ISOEncoding { protected ISO8859_8Encoding() { super("ISO-8859-8", ISO8859_8CtypeTable, AsciiTables.ToLowerCaseTable, null); } @Override public int mbcCaseFold(int flag, byte[]bytes, IntHolder pp, int end, byte[]lower) { return asciiMbcCaseFold(flag, bytes, pp, end, lower); } @Override public final byte[]toLowerCaseTable() { return LowerCaseTable; } @Override public void applyAllCaseFold(int flag, ApplyAllCaseFoldFunction fun, Object arg) { asciiApplyAllCaseFold(flag, fun, arg); } @Override public CaseFoldCodeItem[]caseFoldCodesByString(int flag, byte[]bytes, int p, int end) { return asciiCaseFoldCodesByString(flag, bytes, p, end); } static final short ISO8859_8CtypeTable[] = { 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x420c, 0x4209, 0x4208, 0x4208, 0x4208, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4284, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x7ca2, 0x7ca2, 0x7ca2, 0x7ca2, 0x7ca2, 0x7ca2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x51a0, 0x41a0, 0x78e2, 0x78e2, 0x78e2, 0x78e2, 0x78e2, 0x78e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x4008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0284, 0x0000, 0x00a0, 0x00a0, 0x00a0, 0x00a0, 0x00a0, 0x00a0, 0x00a0, 0x00a0, 0x00a0, 0x01a0, 0x00a0, 0x01a0, 0x00a0, 0x00a0, 0x00a0, 0x00a0, 0x10a0, 0x10a0, 0x00a0, 0x30e2, 0x00a0, 0x01a0, 0x00a0, 0x10a0, 0x00a0, 0x01a0, 0x10a0, 0x10a0, 0x10a0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x01a0, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 }; public static final ISO8859_8Encoding INSTANCE = new ISO8859_8Encoding(); } jcodings-jcodings-1.0.11/src/org/jcodings/specific/ISO8859_9Encoding.java000066400000000000000000000204341223451536200256730ustar00rootroot00000000000000/* * Permission is hereby granted, free of charge, to any person obtaining a copy of * this software and associated documentation files (the "Software"), to deal in * the Software without restriction, including without limitation the rights to * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies * of the Software, and to permit persons to whom the Software is furnished to do * so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ package org.jcodings.specific; import org.jcodings.ISOEncoding; public final class ISO8859_9Encoding extends ISOEncoding { protected ISO8859_9Encoding() { super("ISO-8859-9", ISO8859_9CtypeTable, ISO8859_9ToLowerCaseTable, ISO8859_9CaseFoldMap); } static final short ISO8859_9CtypeTable[] = { 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x420c, 0x4209, 0x4208, 0x4208, 0x4208, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4284, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x7ca2, 0x7ca2, 0x7ca2, 0x7ca2, 0x7ca2, 0x7ca2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x51a0, 0x41a0, 0x78e2, 0x78e2, 0x78e2, 0x78e2, 0x78e2, 0x78e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x4008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0284, 0x01a0, 0x00a0, 0x00a0, 0x00a0, 0x00a0, 0x00a0, 0x00a0, 0x00a0, 0x00a0, 0x30e2, 0x01a0, 0x00a0, 0x01a0, 0x00a0, 0x00a0, 0x00a0, 0x00a0, 0x10a0, 0x10a0, 0x00a0, 0x30e2, 0x00a0, 0x01a0, 0x00a0, 0x10a0, 0x30e2, 0x01a0, 0x10a0, 0x10a0, 0x10a0, 0x01a0, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x00a0, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x00a0, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2 }; static final byte ISO8859_9ToLowerCaseTable[] = new byte[]{ (byte)'\000', (byte)'\001', (byte)'\002', (byte)'\003', (byte)'\004', (byte)'\005', (byte)'\006', (byte)'\007', (byte)'\010', (byte)'\011', (byte)'\012', (byte)'\013', (byte)'\014', (byte)'\015', (byte)'\016', (byte)'\017', (byte)'\020', (byte)'\021', (byte)'\022', (byte)'\023', (byte)'\024', (byte)'\025', (byte)'\026', (byte)'\027', (byte)'\030', (byte)'\031', (byte)'\032', (byte)'\033', (byte)'\034', (byte)'\035', (byte)'\036', (byte)'\037', (byte)'\040', (byte)'\041', (byte)'\042', (byte)'\043', (byte)'\044', (byte)'\045', (byte)'\046', (byte)'\047', (byte)'\050', (byte)'\051', (byte)'\052', (byte)'\053', (byte)'\054', (byte)'\055', (byte)'\056', (byte)'\057', (byte)'\060', (byte)'\061', (byte)'\062', (byte)'\063', (byte)'\064', (byte)'\065', (byte)'\066', (byte)'\067', (byte)'\070', (byte)'\071', (byte)'\072', (byte)'\073', (byte)'\074', (byte)'\075', (byte)'\076', (byte)'\077', (byte)'\100', (byte)'\141', (byte)'\142', (byte)'\143', (byte)'\144', (byte)'\145', (byte)'\146', (byte)'\147', (byte)'\150', (byte)'\151', (byte)'\152', (byte)'\153', (byte)'\154', (byte)'\155', (byte)'\156', (byte)'\157', (byte)'\160', (byte)'\161', (byte)'\162', (byte)'\163', (byte)'\164', (byte)'\165', (byte)'\166', (byte)'\167', (byte)'\170', (byte)'\171', (byte)'\172', (byte)'\133', (byte)'\134', (byte)'\135', (byte)'\136', (byte)'\137', (byte)'\140', (byte)'\141', (byte)'\142', (byte)'\143', (byte)'\144', (byte)'\145', (byte)'\146', (byte)'\147', (byte)'\150', (byte)'\151', (byte)'\152', (byte)'\153', (byte)'\154', (byte)'\155', (byte)'\156', (byte)'\157', (byte)'\160', (byte)'\161', (byte)'\162', (byte)'\163', (byte)'\164', (byte)'\165', (byte)'\166', (byte)'\167', (byte)'\170', (byte)'\171', (byte)'\172', (byte)'\173', (byte)'\174', (byte)'\175', (byte)'\176', (byte)'\177', (byte)'\200', (byte)'\201', (byte)'\202', (byte)'\203', (byte)'\204', (byte)'\205', (byte)'\206', (byte)'\207', (byte)'\210', (byte)'\211', (byte)'\212', (byte)'\213', (byte)'\214', (byte)'\215', (byte)'\216', (byte)'\217', (byte)'\220', (byte)'\221', (byte)'\222', (byte)'\223', (byte)'\224', (byte)'\225', (byte)'\226', (byte)'\227', (byte)'\230', (byte)'\231', (byte)'\232', (byte)'\233', (byte)'\234', (byte)'\235', (byte)'\236', (byte)'\237', (byte)'\240', (byte)'\241', (byte)'\242', (byte)'\243', (byte)'\244', (byte)'\245', (byte)'\246', (byte)'\247', (byte)'\250', (byte)'\251', (byte)'\252', (byte)'\253', (byte)'\254', (byte)'\255', (byte)'\256', (byte)'\257', (byte)'\260', (byte)'\261', (byte)'\262', (byte)'\263', (byte)'\264', (byte)'\265', (byte)'\266', (byte)'\267', (byte)'\270', (byte)'\271', (byte)'\272', (byte)'\273', (byte)'\274', (byte)'\275', (byte)'\276', (byte)'\277', (byte)'\340', (byte)'\341', (byte)'\342', (byte)'\343', (byte)'\344', (byte)'\345', (byte)'\346', (byte)'\347', (byte)'\350', (byte)'\351', (byte)'\352', (byte)'\353', (byte)'\354', (byte)'\355', (byte)'\356', (byte)'\357', (byte)'\360', (byte)'\361', (byte)'\362', (byte)'\363', (byte)'\364', (byte)'\365', (byte)'\366', (byte)'\327', (byte)'\370', (byte)'\371', (byte)'\372', (byte)'\373', (byte)'\374', (byte)'\335', (byte)'\376', (byte)'\337', (byte)'\340', (byte)'\341', (byte)'\342', (byte)'\343', (byte)'\344', (byte)'\345', (byte)'\346', (byte)'\347', (byte)'\350', (byte)'\351', (byte)'\352', (byte)'\353', (byte)'\354', (byte)'\355', (byte)'\356', (byte)'\357', (byte)'\360', (byte)'\361', (byte)'\362', (byte)'\363', (byte)'\364', (byte)'\365', (byte)'\366', (byte)'\367', (byte)'\370', (byte)'\371', (byte)'\372', (byte)'\373', (byte)'\374', (byte)'\375', (byte)'\376', (byte)'\377' }; static final int ISO8859_9CaseFoldMap[][] = { { 0xc0, 0xe0 }, { 0xc1, 0xe1 }, { 0xc2, 0xe2 }, { 0xc3, 0xe3 }, { 0xc4, 0xe4 }, { 0xc5, 0xe5 }, { 0xc6, 0xe6 }, { 0xc7, 0xe7 }, { 0xc8, 0xe8 }, { 0xc9, 0xe9 }, { 0xca, 0xea }, { 0xcb, 0xeb }, { 0xcc, 0xec }, { 0xcd, 0xed }, { 0xce, 0xee }, { 0xcf, 0xef }, { 0xd0, 0xf0 }, { 0xd1, 0xf1 }, { 0xd2, 0xf2 }, { 0xd3, 0xf3 }, { 0xd4, 0xf4 }, { 0xd5, 0xf5 }, { 0xd6, 0xf6 }, { 0xd8, 0xf8 }, { 0xd9, 0xf9 }, { 0xda, 0xfa }, { 0xdb, 0xfb }, { 0xdc, 0xfc }, { 0xdd, 0xfd }, { 0xde, 0xfe } }; public static final ISO8859_9Encoding INSTANCE = new ISO8859_9Encoding(); } jcodings-jcodings-1.0.11/src/org/jcodings/specific/KOI8Encoding.java000066400000000000000000000236011223451536200251640ustar00rootroot00000000000000/* * Permission is hereby granted, free of charge, to any person obtaining a copy of * this software and associated documentation files (the "Software"), to deal in * the Software without restriction, including without limitation the rights to * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies * of the Software, and to permit persons to whom the Software is furnished to do * so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ package org.jcodings.specific; import org.jcodings.CaseFoldMapEncoding; import org.jcodings.IntHolder; final public class KOI8Encoding extends CaseFoldMapEncoding { protected KOI8Encoding() { super("KOI8", KOI8_CtypeTable, KOI8_ToLowerCaseTable, KOI8_CaseFoldMap, false); } private static final int ENC_CASE_FOLD_ASCII_CASE = 0; private static final int ONIGENC_CASE_FOLD_NONASCII_CASE = 0; @Override public int mbcCaseFold(int flag, byte[]bytes, IntHolder pp, int end, byte[]lower) { int p = pp.value; int lowerP = 0; if (((flag & ENC_CASE_FOLD_ASCII_CASE) !=0 && isAscii(bytes[p] & 0xff)) || ((flag & ONIGENC_CASE_FOLD_NONASCII_CASE) !=0 && !isAscii(bytes[p] & 0xff))) { lower[lowerP] = LowerCaseTable[bytes[p] & 0xff]; } else { lower[lowerP] = bytes[p]; } pp.value++; return 1; /* return byte length of converted char to lower */ } @Override public boolean isCodeCType(int code, int ctype) { return code < 256 ? isCodeCTypeInternal(code, ctype) : false; } static final short KOI8_CtypeTable[] = { 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x420c, 0x4209, 0x4208, 0x4208, 0x4208, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4284, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x7ca2, 0x7ca2, 0x7ca2, 0x7ca2, 0x7ca2, 0x7ca2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x51a0, 0x41a0, 0x78e2, 0x78e2, 0x78e2, 0x78e2, 0x78e2, 0x78e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x4008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0284, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2 }; static final byte KOI8_ToLowerCaseTable[] = new byte[]{ (byte)'\000', (byte)'\001', (byte)'\002', (byte)'\003', (byte)'\004', (byte)'\005', (byte)'\006', (byte)'\007', (byte)'\010', (byte)'\011', (byte)'\012', (byte)'\013', (byte)'\014', (byte)'\015', (byte)'\016', (byte)'\017', (byte)'\020', (byte)'\021', (byte)'\022', (byte)'\023', (byte)'\024', (byte)'\025', (byte)'\026', (byte)'\027', (byte)'\030', (byte)'\031', (byte)'\032', (byte)'\033', (byte)'\034', (byte)'\035', (byte)'\036', (byte)'\037', (byte)'\040', (byte)'\041', (byte)'\042', (byte)'\043', (byte)'\044', (byte)'\045', (byte)'\046', (byte)'\047', (byte)'\050', (byte)'\051', (byte)'\052', (byte)'\053', (byte)'\054', (byte)'\055', (byte)'\056', (byte)'\057', (byte)'\060', (byte)'\061', (byte)'\062', (byte)'\063', (byte)'\064', (byte)'\065', (byte)'\066', (byte)'\067', (byte)'\070', (byte)'\071', (byte)'\072', (byte)'\073', (byte)'\074', (byte)'\075', (byte)'\076', (byte)'\077', (byte)'\100', (byte)'\141', (byte)'\142', (byte)'\143', (byte)'\144', (byte)'\145', (byte)'\146', (byte)'\147', (byte)'\150', (byte)'\151', (byte)'\152', (byte)'\153', (byte)'\154', (byte)'\155', (byte)'\156', (byte)'\157', (byte)'\160', (byte)'\161', (byte)'\162', (byte)'\163', (byte)'\164', (byte)'\165', (byte)'\166', (byte)'\167', (byte)'\170', (byte)'\171', (byte)'\172', (byte)'\133', (byte)'\134', (byte)'\135', (byte)'\136', (byte)'\137', (byte)'\140', (byte)'\141', (byte)'\142', (byte)'\143', (byte)'\144', (byte)'\145', (byte)'\146', (byte)'\147', (byte)'\150', (byte)'\151', (byte)'\152', (byte)'\153', (byte)'\154', (byte)'\155', (byte)'\156', (byte)'\157', (byte)'\160', (byte)'\161', (byte)'\162', (byte)'\163', (byte)'\164', (byte)'\165', (byte)'\166', (byte)'\167', (byte)'\170', (byte)'\171', (byte)'\172', (byte)'\173', (byte)'\174', (byte)'\175', (byte)'\176', (byte)'\177', (byte)'\200', (byte)'\201', (byte)'\202', (byte)'\203', (byte)'\204', (byte)'\205', (byte)'\206', (byte)'\207', (byte)'\210', (byte)'\211', (byte)'\212', (byte)'\213', (byte)'\214', (byte)'\215', (byte)'\216', (byte)'\217', (byte)'\220', (byte)'\221', (byte)'\222', (byte)'\223', (byte)'\224', (byte)'\225', (byte)'\226', (byte)'\227', (byte)'\230', (byte)'\231', (byte)'\232', (byte)'\233', (byte)'\234', (byte)'\235', (byte)'\236', (byte)'\237', (byte)'\240', (byte)'\241', (byte)'\242', (byte)'\243', (byte)'\244', (byte)'\245', (byte)'\246', (byte)'\247', (byte)'\250', (byte)'\251', (byte)'\252', (byte)'\253', (byte)'\254', (byte)'\255', (byte)'\256', (byte)'\257', (byte)'\260', (byte)'\261', (byte)'\262', (byte)'\263', (byte)'\264', (byte)'\265', (byte)'\266', (byte)'\267', (byte)'\270', (byte)'\271', (byte)'\272', (byte)'\273', (byte)'\274', (byte)'\275', (byte)'\276', (byte)'\277', (byte)'\300', (byte)'\301', (byte)'\302', (byte)'\303', (byte)'\304', (byte)'\305', (byte)'\306', (byte)'\307', (byte)'\310', (byte)'\311', (byte)'\312', (byte)'\313', (byte)'\314', (byte)'\315', (byte)'\316', (byte)'\317', (byte)'\320', (byte)'\321', (byte)'\322', (byte)'\323', (byte)'\324', (byte)'\325', (byte)'\326', (byte)'\327', (byte)'\330', (byte)'\331', (byte)'\332', (byte)'\333', (byte)'\334', (byte)'\335', (byte)'\336', (byte)'\337', (byte)'\300', (byte)'\301', (byte)'\302', (byte)'\303', (byte)'\304', (byte)'\305', (byte)'\306', (byte)'\307', (byte)'\310', (byte)'\311', (byte)'\312', (byte)'\313', (byte)'\314', (byte)'\315', (byte)'\316', (byte)'\317', (byte)'\320', (byte)'\321', (byte)'\322', (byte)'\323', (byte)'\324', (byte)'\325', (byte)'\326', (byte)'\327', (byte)'\330', (byte)'\331', (byte)'\332', (byte)'\333', (byte)'\334', (byte)'\335', (byte)'\336', (byte)'\337' }; static final int KOI8_CaseFoldMap[][] = { { 0xc0, 0xe0 }, { 0xc1, 0xe1 }, { 0xc2, 0xe2 }, { 0xc3, 0xe3 }, { 0xc4, 0xe4 }, { 0xc5, 0xe5 }, { 0xc6, 0xe6 }, { 0xc7, 0xe7 }, { 0xc8, 0xe8 }, { 0xc9, 0xe9 }, { 0xca, 0xea }, { 0xcb, 0xeb }, { 0xcc, 0xec }, { 0xcd, 0xed }, { 0xce, 0xee }, { 0xcf, 0xef }, { 0xd0, 0xf0 }, { 0xd1, 0xf1 }, { 0xd2, 0xf2 }, { 0xd3, 0xf3 }, { 0xd4, 0xf4 }, { 0xd5, 0xf5 }, { 0xd6, 0xf6 }, { 0xd7, 0xf7 }, { 0xd8, 0xf8 }, { 0xd9, 0xf9 }, { 0xda, 0xfa }, { 0xdb, 0xfb }, { 0xdc, 0xfc }, { 0xdd, 0xfd }, { 0xde, 0xfe }, { 0xdf, 0xff }, { 0xe0, 0xc0 }, { 0xe1, 0xc1 }, { 0xe2, 0xc2 }, { 0xe3, 0xc3 }, { 0xe4, 0xc4 }, { 0xe5, 0xc5 }, { 0xe6, 0xc6 }, { 0xe7, 0xc7 }, { 0xe8, 0xc8 }, { 0xe9, 0xc9 }, { 0xea, 0xca }, { 0xeb, 0xcb }, { 0xec, 0xcc }, { 0xed, 0xcd }, { 0xee, 0xce }, { 0xef, 0xcf }, { 0xf0, 0xd0 }, { 0xf1, 0xd1 }, { 0xf2, 0xd2 }, { 0xf3, 0xd3 }, { 0xf4, 0xd4 }, { 0xf5, 0xd5 }, { 0xf6, 0xd6 }, { 0xf7, 0xd7 }, { 0xf8, 0xd8 }, { 0xf9, 0xd9 }, { 0xfa, 0xda }, { 0xfb, 0xdb }, { 0xfc, 0xdc }, { 0xfe, 0xde }, { 0xff, 0xdf } }; public static final KOI8Encoding INSTANCE = new KOI8Encoding(); } jcodings-jcodings-1.0.11/src/org/jcodings/specific/KOI8REncoding.java000066400000000000000000000213731223451536200253120ustar00rootroot00000000000000/* * Permission is hereby granted, free of charge, to any person obtaining a copy of * this software and associated documentation files (the "Software"), to deal in * the Software without restriction, including without limitation the rights to * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies * of the Software, and to permit persons to whom the Software is furnished to do * so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ package org.jcodings.specific; import org.jcodings.CaseFoldMapEncoding; import org.jcodings.IntHolder; final public class KOI8REncoding extends CaseFoldMapEncoding { protected KOI8REncoding() { super("KOI8-R", KOI8R_CtypeTable, KOI8R_ToLowerCaseTable, KOI8R_CaseFoldMap, false); } @Override public int mbcCaseFold(int flag, byte[]bytes, IntHolder pp, int end, byte[]lower) { int p = pp.value; int lowerP = 0; lower[lowerP] = LowerCaseTable[bytes[p] & 0xff]; pp.value++; return 1; } @Override public boolean isCodeCType(int code, int ctype) { return code < 256 ? isCodeCTypeInternal(code, ctype) : false; } static final short KOI8R_CtypeTable[] = { 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x420c, 0x4209, 0x4208, 0x4208, 0x4208, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4284, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x7ca2, 0x7ca2, 0x7ca2, 0x7ca2, 0x7ca2, 0x7ca2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x51a0, 0x41a0, 0x78e2, 0x78e2, 0x78e2, 0x78e2, 0x78e2, 0x78e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x4008, 0x00a0, 0x00a0, 0x00a0, 0x00a0, 0x00a0, 0x00a0, 0x00a0, 0x00a0, 0x00a0, 0x00a0, 0x00a0, 0x00a0, 0x00a0, 0x00a0, 0x00a0, 0x00a0, 0x00a0, 0x00a0, 0x00a0, 0x00a0, 0x00a0, 0x00a0, 0x00a0, 0x00a0, 0x00a0, 0x00a0, 0x0284, 0x00a0, 0x00a0, 0x10a0, 0x01a0, 0x00a0, 0x00a0, 0x00a0, 0x00a0, 0x30e2, 0x00a0, 0x00a0, 0x00a0, 0x00a0, 0x00a0, 0x00a0, 0x00a0, 0x00a0, 0x00a0, 0x00a0, 0x00a0, 0x00a0, 0x00a0, 0x00a0, 0x00a0, 0x34a2, 0x00a0, 0x00a0, 0x00a0, 0x00a0, 0x00a0, 0x00a0, 0x00a0, 0x00a0, 0x00a0, 0x00a0, 0x00a0, 0x00a0, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2 }; static final byte KOI8R_ToLowerCaseTable[] = { (byte)'\000', (byte)'\001', (byte)'\002', (byte)'\003', (byte)'\004', (byte)'\005', (byte)'\006', (byte)'\007', (byte)'\010', (byte)'\011', (byte)'\012', (byte)'\013', (byte)'\014', (byte)'\015', (byte)'\016', (byte)'\017', (byte)'\020', (byte)'\021', (byte)'\022', (byte)'\023', (byte)'\024', (byte)'\025', (byte)'\026', (byte)'\027', (byte)'\030', (byte)'\031', (byte)'\032', (byte)'\033', (byte)'\034', (byte)'\035', (byte)'\036', (byte)'\037', (byte)'\040', (byte)'\041', (byte)'\042', (byte)'\043', (byte)'\044', (byte)'\045', (byte)'\046', (byte)'\047', (byte)'\050', (byte)'\051', (byte)'\052', (byte)'\053', (byte)'\054', (byte)'\055', (byte)'\056', (byte)'\057', (byte)'\060', (byte)'\061', (byte)'\062', (byte)'\063', (byte)'\064', (byte)'\065', (byte)'\066', (byte)'\067', (byte)'\070', (byte)'\071', (byte)'\072', (byte)'\073', (byte)'\074', (byte)'\075', (byte)'\076', (byte)'\077', (byte)'\100', (byte)'\141', (byte)'\142', (byte)'\143', (byte)'\144', (byte)'\145', (byte)'\146', (byte)'\147', (byte)'\150', (byte)'\151', (byte)'\152', (byte)'\153', (byte)'\154', (byte)'\155', (byte)'\156', (byte)'\157', (byte)'\160', (byte)'\161', (byte)'\162', (byte)'\163', (byte)'\164', (byte)'\165', (byte)'\166', (byte)'\167', (byte)'\170', (byte)'\171', (byte)'\172', (byte)'\133', (byte)'\134', (byte)'\135', (byte)'\136', (byte)'\137', (byte)'\140', (byte)'\141', (byte)'\142', (byte)'\143', (byte)'\144', (byte)'\145', (byte)'\146', (byte)'\147', (byte)'\150', (byte)'\151', (byte)'\152', (byte)'\153', (byte)'\154', (byte)'\155', (byte)'\156', (byte)'\157', (byte)'\160', (byte)'\161', (byte)'\162', (byte)'\163', (byte)'\164', (byte)'\165', (byte)'\166', (byte)'\167', (byte)'\170', (byte)'\171', (byte)'\172', (byte)'\173', (byte)'\174', (byte)'\175', (byte)'\176', (byte)'\177', (byte)'\200', (byte)'\201', (byte)'\202', (byte)'\203', (byte)'\204', (byte)'\205', (byte)'\206', (byte)'\207', (byte)'\210', (byte)'\211', (byte)'\212', (byte)'\213', (byte)'\214', (byte)'\215', (byte)'\216', (byte)'\217', (byte)'\220', (byte)'\221', (byte)'\222', (byte)'\223', (byte)'\224', (byte)'\225', (byte)'\226', (byte)'\227', (byte)'\230', (byte)'\231', (byte)'\232', (byte)'\233', (byte)'\234', (byte)'\235', (byte)'\236', (byte)'\237', (byte)'\240', (byte)'\241', (byte)'\242', (byte)'\243', (byte)'\244', (byte)'\245', (byte)'\246', (byte)'\247', (byte)'\250', (byte)'\251', (byte)'\252', (byte)'\253', (byte)'\254', (byte)'\255', (byte)'\256', (byte)'\257', (byte)'\260', (byte)'\261', (byte)'\262', (byte)'\243', (byte)'\264', (byte)'\265', (byte)'\266', (byte)'\267', (byte)'\270', (byte)'\271', (byte)'\272', (byte)'\273', (byte)'\274', (byte)'\275', (byte)'\276', (byte)'\277', (byte)'\300', (byte)'\301', (byte)'\302', (byte)'\303', (byte)'\304', (byte)'\305', (byte)'\306', (byte)'\307', (byte)'\310', (byte)'\311', (byte)'\312', (byte)'\313', (byte)'\314', (byte)'\315', (byte)'\316', (byte)'\317', (byte)'\320', (byte)'\321', (byte)'\322', (byte)'\323', (byte)'\324', (byte)'\325', (byte)'\326', (byte)'\327', (byte)'\330', (byte)'\331', (byte)'\332', (byte)'\333', (byte)'\334', (byte)'\335', (byte)'\336', (byte)'\337', (byte)'\300', (byte)'\301', (byte)'\302', (byte)'\303', (byte)'\304', (byte)'\305', (byte)'\306', (byte)'\307', (byte)'\310', (byte)'\311', (byte)'\312', (byte)'\313', (byte)'\314', (byte)'\315', (byte)'\316', (byte)'\317', (byte)'\320', (byte)'\321', (byte)'\322', (byte)'\323', (byte)'\324', (byte)'\325', (byte)'\326', (byte)'\327', (byte)'\330', (byte)'\331', (byte)'\332', (byte)'\333', (byte)'\334', (byte)'\335', (byte)'\336', (byte)'\337' }; static final int KOI8R_CaseFoldMap[][] = { { 0xa3, 0xb3 }, { 0xc0, 0xe0 }, { 0xc1, 0xe1 }, { 0xc2, 0xe2 }, { 0xc3, 0xe3 }, { 0xc4, 0xe4 }, { 0xc5, 0xe5 }, { 0xc6, 0xe6 }, { 0xc7, 0xe7 }, { 0xc8, 0xe8 }, { 0xc9, 0xe9 }, { 0xca, 0xea }, { 0xcb, 0xeb }, { 0xcc, 0xec }, { 0xcd, 0xed }, { 0xce, 0xee }, { 0xcf, 0xef }, { 0xd0, 0xf0 }, { 0xd1, 0xf1 }, { 0xd2, 0xf2 }, { 0xd3, 0xf3 }, { 0xd4, 0xf4 }, { 0xd5, 0xf5 }, { 0xd6, 0xf6 }, { 0xd7, 0xf7 }, { 0xd8, 0xf8 }, { 0xd9, 0xf9 }, { 0xda, 0xfa }, { 0xdb, 0xfb }, { 0xdc, 0xfc }, { 0xdd, 0xfd }, { 0xde, 0xfe }, { 0xdf, 0xff } }; public static final KOI8REncoding INSTANCE = new KOI8REncoding(); } jcodings-jcodings-1.0.11/src/org/jcodings/specific/KOI8UEncoding.java000066400000000000000000000215331223451536200253130ustar00rootroot00000000000000/* * Permission is hereby granted, free of charge, to any person obtaining a copy of * this software and associated documentation files (the "Software"), to deal in * the Software without restriction, including without limitation the rights to * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies * of the Software, and to permit persons to whom the Software is furnished to do * so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ package org.jcodings.specific; import org.jcodings.CaseFoldMapEncoding; import org.jcodings.IntHolder; final public class KOI8UEncoding extends CaseFoldMapEncoding { protected KOI8UEncoding() { super("KOI8-U", KOI8U_CtypeTable, KOI8U_ToLowerCaseTable, KOI8U_CaseFoldMap, false); } @Override public int mbcCaseFold(int flag, byte[]bytes, IntHolder pp, int end, byte[]lower) { int p = pp.value; int lowerP = 0; lower[lowerP] = LowerCaseTable[bytes[p] & 0xff]; pp.value++; return 1; } @Override public boolean isCodeCType(int code, int ctype) { return code < 256 ? isCodeCTypeInternal(code, ctype) : false; } static final short KOI8U_CtypeTable[] = { 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x420c, 0x4209, 0x4208, 0x4208, 0x4208, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4284, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x7ca2, 0x7ca2, 0x7ca2, 0x7ca2, 0x7ca2, 0x7ca2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x51a0, 0x41a0, 0x78e2, 0x78e2, 0x78e2, 0x78e2, 0x78e2, 0x78e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x4008, 0x00a0, 0x00a0, 0x00a0, 0x00a0, 0x00a0, 0x00a0, 0x00a0, 0x00a0, 0x00a0, 0x00a0, 0x00a0, 0x00a0, 0x00a0, 0x00a0, 0x00a0, 0x00a0, 0x00a0, 0x00a0, 0x00a0, 0x00a0, 0x00a0, 0x00a0, 0x00a0, 0x00a0, 0x00a0, 0x00a0, 0x0284, 0x00a0, 0x00a0, 0x10a0, 0x01a0, 0x00a0, 0x00a0, 0x00a0, 0x00a0, 0x30e2, 0x30e2, 0x00a0, 0x30e2, 0x30e2, 0x00a0, 0x00a0, 0x00a0, 0x00a0, 0x00a0, 0x30e2, 0x00a0, 0x00a0, 0x00a0, 0x00a0, 0x00a0, 0x34a2, 0x34a2, 0x00a0, 0x34a2, 0x34a2, 0x00a0, 0x00a0, 0x00a0, 0x00a0, 0x00a0, 0x34a2, 0x00a0, 0x00a0, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2 }; static final byte KOI8U_ToLowerCaseTable[] = { (byte)'\000', (byte)'\001', (byte)'\002', (byte)'\003', (byte)'\004', (byte)'\005', (byte)'\006', (byte)'\007', (byte)'\010', (byte)'\011', (byte)'\012', (byte)'\013', (byte)'\014', (byte)'\015', (byte)'\016', (byte)'\017', (byte)'\020', (byte)'\021', (byte)'\022', (byte)'\023', (byte)'\024', (byte)'\025', (byte)'\026', (byte)'\027', (byte)'\030', (byte)'\031', (byte)'\032', (byte)'\033', (byte)'\034', (byte)'\035', (byte)'\036', (byte)'\037', (byte)'\040', (byte)'\041', (byte)'\042', (byte)'\043', (byte)'\044', (byte)'\045', (byte)'\046', (byte)'\047', (byte)'\050', (byte)'\051', (byte)'\052', (byte)'\053', (byte)'\054', (byte)'\055', (byte)'\056', (byte)'\057', (byte)'\060', (byte)'\061', (byte)'\062', (byte)'\063', (byte)'\064', (byte)'\065', (byte)'\066', (byte)'\067', (byte)'\070', (byte)'\071', (byte)'\072', (byte)'\073', (byte)'\074', (byte)'\075', (byte)'\076', (byte)'\077', (byte)'\100', (byte)'\141', (byte)'\142', (byte)'\143', (byte)'\144', (byte)'\145', (byte)'\146', (byte)'\147', (byte)'\150', (byte)'\151', (byte)'\152', (byte)'\153', (byte)'\154', (byte)'\155', (byte)'\156', (byte)'\157', (byte)'\160', (byte)'\161', (byte)'\162', (byte)'\163', (byte)'\164', (byte)'\165', (byte)'\166', (byte)'\167', (byte)'\170', (byte)'\171', (byte)'\172', (byte)'\133', (byte)'\134', (byte)'\135', (byte)'\136', (byte)'\137', (byte)'\140', (byte)'\141', (byte)'\142', (byte)'\143', (byte)'\144', (byte)'\145', (byte)'\146', (byte)'\147', (byte)'\150', (byte)'\151', (byte)'\152', (byte)'\153', (byte)'\154', (byte)'\155', (byte)'\156', (byte)'\157', (byte)'\160', (byte)'\161', (byte)'\162', (byte)'\163', (byte)'\164', (byte)'\165', (byte)'\166', (byte)'\167', (byte)'\170', (byte)'\171', (byte)'\172', (byte)'\173', (byte)'\174', (byte)'\175', (byte)'\176', (byte)'\177', (byte)'\200', (byte)'\201', (byte)'\202', (byte)'\203', (byte)'\204', (byte)'\205', (byte)'\206', (byte)'\207', (byte)'\210', (byte)'\211', (byte)'\212', (byte)'\213', (byte)'\214', (byte)'\215', (byte)'\216', (byte)'\217', (byte)'\220', (byte)'\221', (byte)'\222', (byte)'\223', (byte)'\224', (byte)'\225', (byte)'\226', (byte)'\227', (byte)'\230', (byte)'\231', (byte)'\232', (byte)'\233', (byte)'\234', (byte)'\235', (byte)'\236', (byte)'\237', (byte)'\240', (byte)'\241', (byte)'\242', (byte)'\243', (byte)'\244', (byte)'\245', (byte)'\246', (byte)'\247', (byte)'\250', (byte)'\251', (byte)'\252', (byte)'\253', (byte)'\254', (byte)'\255', (byte)'\256', (byte)'\257', (byte)'\260', (byte)'\261', (byte)'\262', (byte)'\243', (byte)'\244', (byte)'\265', (byte)'\246', (byte)'\247', (byte)'\270', (byte)'\271', (byte)'\272', (byte)'\273', (byte)'\274', (byte)'\255', (byte)'\276', (byte)'\277', (byte)'\300', (byte)'\301', (byte)'\302', (byte)'\303', (byte)'\304', (byte)'\305', (byte)'\306', (byte)'\307', (byte)'\310', (byte)'\311', (byte)'\312', (byte)'\313', (byte)'\314', (byte)'\315', (byte)'\316', (byte)'\317', (byte)'\320', (byte)'\321', (byte)'\322', (byte)'\323', (byte)'\324', (byte)'\325', (byte)'\326', (byte)'\327', (byte)'\330', (byte)'\331', (byte)'\332', (byte)'\333', (byte)'\334', (byte)'\335', (byte)'\336', (byte)'\337', (byte)'\300', (byte)'\301', (byte)'\302', (byte)'\303', (byte)'\304', (byte)'\305', (byte)'\306', (byte)'\307', (byte)'\310', (byte)'\311', (byte)'\312', (byte)'\313', (byte)'\314', (byte)'\315', (byte)'\316', (byte)'\317', (byte)'\320', (byte)'\321', (byte)'\322', (byte)'\323', (byte)'\324', (byte)'\325', (byte)'\326', (byte)'\327', (byte)'\330', (byte)'\331', (byte)'\332', (byte)'\333', (byte)'\334', (byte)'\335', (byte)'\336', (byte)'\337' }; static final int KOI8U_CaseFoldMap[][] = { { 0xa3, 0xb3 }, { 0xa4, 0xb4 }, { 0xa6, 0xb6 }, { 0xa7, 0xb7 }, { 0xad, 0xbd }, { 0xc0, 0xe0 }, { 0xc1, 0xe1 }, { 0xc2, 0xe2 }, { 0xc3, 0xe3 }, { 0xc4, 0xe4 }, { 0xc5, 0xe5 }, { 0xc6, 0xe6 }, { 0xc7, 0xe7 }, { 0xc8, 0xe8 }, { 0xc9, 0xe9 }, { 0xca, 0xea }, { 0xcb, 0xeb }, { 0xcc, 0xec }, { 0xcd, 0xed }, { 0xce, 0xee }, { 0xcf, 0xef }, { 0xd0, 0xf0 }, { 0xd1, 0xf1 }, { 0xd2, 0xf2 }, { 0xd3, 0xf3 }, { 0xd4, 0xf4 }, { 0xd5, 0xf5 }, { 0xd6, 0xf6 }, { 0xd7, 0xf7 }, { 0xd8, 0xf8 }, { 0xd9, 0xf9 }, { 0xda, 0xfa }, { 0xdb, 0xfb }, { 0xdc, 0xfc }, { 0xdd, 0xfd }, { 0xde, 0xfe }, { 0xdf, 0xff } }; public static final KOI8UEncoding INSTANCE = new KOI8UEncoding(); } jcodings-jcodings-1.0.11/src/org/jcodings/specific/NonStrictEUCJPEncoding.java000066400000000000000000000026501223451536200271650ustar00rootroot00000000000000/* * Permission is hereby granted, free of charge, to any person obtaining a copy of * this software and associated documentation files (the "Software"), to deal in * the Software without restriction, including without limitation the rights to * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies * of the Software, and to permit persons to whom the Software is furnished to do * so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ package org.jcodings.specific; public final class NonStrictEUCJPEncoding extends BaseEUCJPEncoding { protected NonStrictEUCJPEncoding() { super(null); } @Override public int length(byte[]bytes, int p, int end) { return length(bytes[p]); } public static final NonStrictEUCJPEncoding INSTANCE = new NonStrictEUCJPEncoding(); } jcodings-jcodings-1.0.11/src/org/jcodings/specific/NonStrictSJISEncoding.java000066400000000000000000000026431223451536200270710ustar00rootroot00000000000000/* * Permission is hereby granted, free of charge, to any person obtaining a copy of * this software and associated documentation files (the "Software"), to deal in * the Software without restriction, including without limitation the rights to * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies * of the Software, and to permit persons to whom the Software is furnished to do * so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ package org.jcodings.specific; public final class NonStrictSJISEncoding extends BaseSJISEncoding { protected NonStrictSJISEncoding() { super(null); } @Override public int length(byte[]bytes, int p, int end) { return length(bytes[p]); } public static final NonStrictSJISEncoding INSTANCE = new NonStrictSJISEncoding(); } jcodings-jcodings-1.0.11/src/org/jcodings/specific/NonStrictUTF8Encoding.java000066400000000000000000000050671223451536200270520ustar00rootroot00000000000000/* * Permission is hereby granted, free of charge, to any person obtaining a copy of * this software and associated documentation files (the "Software"), to deal in * the Software without restriction, including without limitation the rights to * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies * of the Software, and to permit persons to whom the Software is furnished to do * so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ package org.jcodings.specific; public final class NonStrictUTF8Encoding extends BaseUTF8Encoding { protected NonStrictUTF8Encoding() { super(UTF8EncLen, UTF8Encoding.UTF8Trans); } @Override public int length(byte[]bytes, int p, int end) { int len = safeLengthForUptoFour(bytes, p, end); return len < 0 ? 1 : len; } private static final int UTF8EncLen[] = { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 1, 1 }; public static final NonStrictUTF8Encoding INSTANCE = new NonStrictUTF8Encoding(); @Override public boolean isCodeCType(int code, int ctype) { return code >= 0 && super.isCodeCType(code, ctype); } } jcodings-jcodings-1.0.11/src/org/jcodings/specific/SJISEncoding.java000066400000000000000000000075131223451536200252260ustar00rootroot00000000000000/* * Permission is hereby granted, free of charge, to any person obtaining a copy of * this software and associated documentation files (the "Software"), to deal in * the Software without restriction, including without limitation the rights to * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies * of the Software, and to permit persons to whom the Software is furnished to do * so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ package org.jcodings.specific; import org.jcodings.Config; public final class SJISEncoding extends BaseSJISEncoding { protected SJISEncoding() { super(SjisTrans); } @Override public int length(byte[]bytes, int p, int end) { if (Config.VANILLA) { return length(bytes[p]); } else { return safeLengthForUptoTwo(bytes, p, end); } } private static final int SjisTrans[][] = Config.VANILLA ? null : new int[][]{ { /* 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, A, A, A, A, A, /* 8 */ F, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 9 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* a */ F, A, A, A, A, A, A, A, A, A, A, A, A, A, A, A, /* b */ A, A, A, A, A, A, A, A, A, A, A, A, A, A, A, A, /* c */ A, A, A, A, A, A, A, A, A, A, A, A, A, A, A, A, /* d */ A, A, A, A, A, A, A, A, A, A, A, A, A, A, A, A, /* e */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* f */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, F, F, F }, { /* S1 0 1 2 3 4 5 6 7 8 9 a b c d e f */ /* 0 */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* 1 */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* 2 */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* 3 */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* 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, A, A, A, A, F, /* 8 */ A, 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, /* a */ A, A, A, A, A, A, A, A, A, A, A, A, A, A, A, A, /* b */ A, A, A, A, A, A, A, A, A, A, A, A, A, A, A, A, /* c */ A, A, A, A, A, A, A, A, A, A, A, A, A, A, A, A, /* d */ A, A, A, A, A, A, A, A, A, A, A, A, A, A, A, A, /* e */ A, A, A, A, A, A, A, A, A, A, A, A, A, A, A, A, /* f */ A, A, A, A, A, A, A, A, A, A, A, A, A, F, F, F } }; public static final SJISEncoding INSTANCE = new SJISEncoding(); } jcodings-jcodings-1.0.11/src/org/jcodings/specific/USASCIIEncoding.java000066400000000000000000000037101223451536200255510ustar00rootroot00000000000000/* * Permission is hereby granted, free of charge, to any person obtaining a copy of * this software and associated documentation files (the "Software"), to deal in * the Software without restriction, including without limitation the rights to * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies * of the Software, and to permit persons to whom the Software is furnished to do * so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ package org.jcodings.specific; import org.jcodings.SingleByteEncoding; import org.jcodings.ascii.AsciiTables; public final class USASCIIEncoding extends SingleByteEncoding { protected USASCIIEncoding() { super("US-ASCII", AsciiTables.AsciiCtypeTable, AsciiTables.ToLowerCaseTable, false, 0x7f); } @Override public int length(byte[] bytes, int p, int end) { return (bytes[p] & 0x80) == 0 ? 1 : -1; } @Override public final byte[] toLowerCaseTable() { return LowerCaseTable; } @Override public String getCharsetName() { return "US-ASCII"; } /** ascii_is_code_ctype / ONIGENC_IS_ASCII_CODE_CTYPE */ @Override public boolean isCodeCType(int code, int ctype) { return code < 128 ? isCodeCTypeInternal(code, ctype) : false; } public static final USASCIIEncoding INSTANCE = new USASCIIEncoding(); } jcodings-jcodings-1.0.11/src/org/jcodings/specific/UTF16BEEncoding.java000066400000000000000000000171711223451536200254730ustar00rootroot00000000000000/* * Permission is hereby granted, free of charge, to any person obtaining a copy of * this software and associated documentation files (the "Software"), to deal in * the Software without restriction, including without limitation the rights to * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies * of the Software, and to permit persons to whom the Software is furnished to do * so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ package org.jcodings.specific; import org.jcodings.Config; import org.jcodings.IntHolder; import org.jcodings.ascii.AsciiTables; import org.jcodings.unicode.UnicodeEncoding; public final class UTF16BEEncoding extends UnicodeEncoding { protected UTF16BEEncoding() { super("UTF-16BE", 2, 4, UTF16EncLen); } @Override public int length(byte[]bytes, int p, int end) { if (Config.VANILLA) { return length(bytes[p]); } else { int b = bytes[p] & 0xff; if (!isSurrogate(b)) { return end - p >= 2 ? 2 : missing(1); } if (isSurrogateFirst(b)) { switch (end - p) { case 1: return missing(3); case 2: return missing(2); case 3: if (isSurrogateSecond(bytes[p + 2] & 0xff)) return missing(1); default: if (isSurrogateSecond(bytes[p + 2] & 0xff)) return 4; } } } return CHAR_INVALID; } @Override public boolean isNewLine(byte[]bytes, int p, int end) { if (p + 1 < end) { if (bytes[p + 1] == (byte)0x0a && bytes[p] == (byte)0x00) return true; if (Config.USE_UNICODE_ALL_LINE_TERMINATORS) { if ((!Config.USE_CRNL_AS_LINE_TERMINATOR && bytes[p+1] == (byte)0x0d) || bytes[p+1] == (byte)0x85 && bytes[p] == (byte)0x00) return true; if (bytes[p] == (byte)0x20 && (bytes[p+1] == (byte)0x29 || bytes[p+1] == (byte)0x28)) return true; } } return false; } @Override public int mbcToCode(byte[]bytes, int p, int end) { final int code; if (isSurrogateFirst(bytes[p] & 0xff)) { if (Config.VANILLA) { code = ((((bytes[p + 0] & 0xff - 0xd8) << 2) + ((bytes[p + 1] & 0xff & 0xc0) >> 6) + 1) << 16) + ((((bytes[p + 1] & 0xff & 0x3f) << 2) + (bytes[p + 2] & 0xff - 0xdc)) << 8) + bytes[p + 3] & 0xff; } else { code = (((((bytes[p + 0] & 0xff) << 8) + (bytes[p + 1] & 0xff)) & 0x03ff) << 10) + ((((bytes[p + 2] & 0xff) << 8) + (bytes[p + 3] & 0xff)) & 0x03ff) + 0x10000; } } else { code = (bytes[p + 0] & 0xff) * 256 + (bytes[p + 1] & 0xff); } return code; } @Override public int codeToMbcLength(int code) { return code > 0xffff ? 4 : 2; } @Override public int codeToMbc(int code, byte[]bytes, int p) { int p_ = p; if (code > 0xffff) { if (Config.VANILLA) { int plane = (code >>> 16) - 1; bytes[p_++] = (byte)((plane >>> 2) + 0xd8); int high = (code & 0xff00) >>> 8; bytes[p_++] = (byte)(((plane & 0x03) << 6) + (high >>> 2)); bytes[p_++] = (byte)((high & 0x03) + 0xdc); bytes[p_] = (byte)(code & 0xff); } else { int high = (code >>> 10) + 0xd7c0; int low = (code & 0x3ff) + 0xdc00; bytes[p_++] = (byte)((high >>> 8) & 0xff); bytes[p_++] = (byte)(high & 0xff); bytes[p_++] = (byte)((low >>> 8) & 0xff); bytes[p_] = (byte)(low & 0xff); } return 4; } else { bytes[p_++] = (byte)((code & 0xff00) >>> 8); bytes[p_++] = (byte)(code & 0xff); return 2; } } @Override public int mbcCaseFold(int flag, byte[]bytes, IntHolder pp, int end, byte[]fold) { int p = pp.value; int foldP = 0; if (isAscii(bytes[p+1] & 0xff) && bytes[p] == 0) { p++; if (Config.USE_UNICODE_CASE_FOLD_TURKISH_AZERI) { if ((flag & Config.ENC_CASE_FOLD_TURKISH_AZERI) != 0) { if (bytes[p] == (byte)0x49) { fold[foldP++] = (byte)0x01; fold[foldP] = (byte)0x31; pp.value += 2; return 2; } } } // USE_UNICODE_CASE_FOLD_TURKISH_AZERI fold[foldP++] = 0; fold[foldP] = AsciiTables.ToLowerCaseTable[bytes[p] & 0xff]; pp.value += 2; return 2; } else { return super.mbcCaseFold(flag, bytes, pp, end, fold); } } /** onigenc_utf16_32_get_ctype_code_range */ @Override public int[]ctypeCodeRange(int ctype, IntHolder sbOut) { sbOut.value = 0x00; return super.ctypeCodeRange(ctype); } @Override public int leftAdjustCharHead(byte[]bytes, int p, int s, int end) { if (s <= p) return s; if ((s - p) % 2 == 1) s--; if (isSurrogateSecond(bytes[s] & 0xff) && s > p + 1) s -= 2; return s; } @Override public boolean isReverseMatchAllowed(byte[]bytes, int p, int end) { return false; } static final int UTF16EncLen[] = { 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 }; private static boolean isSurrogateFirst(int c) { if (Config.VANILLA) { return c >= 0xd8 && c <= 0xdb; } else { return (c & 0xfc) == 0xd8; } } private static boolean isSurrogateSecond(int c) { if (Config.VANILLA) { return c >= 0xdc && c <= 0xdf; } else { return (c & 0xfc) == 0xdc; } } private static boolean isSurrogate(int c) { if (Config.VANILLA) { return (c & 0xf8) == 0; } else { return (c & 0xf8) == 0xd8; } } public static final UTF16BEEncoding INSTANCE = new UTF16BEEncoding(); } jcodings-jcodings-1.0.11/src/org/jcodings/specific/UTF16LEEncoding.java000066400000000000000000000153031223451536200255000ustar00rootroot00000000000000/* * Permission is hereby granted, free of charge, to any person obtaining a copy of * this software and associated documentation files (the "Software"), to deal in * the Software without restriction, including without limitation the rights to * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies * of the Software, and to permit persons to whom the Software is furnished to do * so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ package org.jcodings.specific; import org.jcodings.Config; import org.jcodings.IntHolder; import org.jcodings.ascii.AsciiTables; import org.jcodings.unicode.UnicodeEncoding; public final class UTF16LEEncoding extends UnicodeEncoding { protected UTF16LEEncoding() { super("UTF-16LE", 2, 4, UTF16BEEncoding.UTF16EncLen); } @Override public int length(byte c) { return EncLen[(c & 0xff) + 1]; } @Override public int length(byte[]bytes, int p, int end) { if (Config.VANILLA) { return length(bytes[p]); } else { int length = end - p; if (length < 2) return missing(1); int b = bytes[p + 1] & 0xff; if (!isSurrogate(b)) return 2; if (isSurrogateFirst(b)) { if (length < 4) return missing(4 - length); if (isSurrogateSecond(bytes[p + 3] & 0xff)) return 4; } return CHAR_INVALID; } } @Override public boolean isNewLine(byte[]bytes, int p, int end) { if (p + 1 < end) { if (bytes[p] == (byte)0x0a && bytes[p + 1] == (byte)0x00) return true; if (Config.USE_UNICODE_ALL_LINE_TERMINATORS) { if ((!Config.USE_CRNL_AS_LINE_TERMINATOR && bytes[p] == (byte)0x0d) || bytes[p] == (byte)0x85 && bytes[p + 1] == (byte)0x00) return true; if (bytes[p + 1] == (byte)0x20 && (bytes[p] == (byte)0x29 || bytes[p] == (byte)0x28)) return true; } } return false; } @Override public int mbcToCode(byte[]bytes, int p, int end) { final int code; if (isSurrogateFirst(bytes[p + 1] & 0xff)) { if (Config.VANILLA) { code = ((((bytes[p + 1] & 0xff - 0xd8) << 2) + ((bytes[p + 0] & 0xff & 0xc0) >> 6) + 1) << 16) + ((((bytes[p + 0] & 0xff & 0x3f) << 2) + (bytes[p + 2] & 0xff - 0xdc)) << 8) + bytes[p + 3] & 0xff; } else { int c0 = bytes[p] & 0xff; int c1 = bytes[p + 1] & 0xff; code = ((((c1 << 8) + c0) & 0x03ff) << 10) + ((((bytes[p + 3] & 0xff) << 8) + (bytes[p + 2] & 0xff)) & 0x03ff) + 0x10000; } } else { code = (bytes[p + 1] & 0xff) * 256 + (bytes[p + 0] & 0xff); } return code; } @Override public int codeToMbcLength(int code) { return code > 0xffff ? 4 : 2; } @Override public int codeToMbc(int code, byte[]bytes, int p) { int p_ = p; if (code > 0xffff) { if (Config.VANILLA) { int plane = (code >>> 16) - 1; int high = (code & 0xff00) >>> 8; bytes[p_++] = (byte)(((plane & 0x03) << 6) + (high >>> 2)); bytes[p_++] = (byte)((plane >>> 2) + 0xd8); bytes[p_++] = (byte)(code & 0xff); bytes[p_ ] = (byte)((high & 0x03) + 0xdc); } else { int high = (code >>> 10) + 0xd7c0; int low = (code & 0x3ff) + 0xdc00; bytes[p_++] = (byte)(high & 0xff); bytes[p_++] = (byte)((high >>> 8) & 0xff); bytes[p_++] = (byte)(low & 0xff); bytes[p_] = (byte)((low >>> 8) & 0xff); } return 4; } else { bytes[p_++] = (byte)(code & 0xff); bytes[p_++] = (byte)((code & 0xff00) >>> 8); return 2; } } @Override public int mbcCaseFold(int flag, byte[]bytes, IntHolder pp, int end, byte[]fold) { int p = pp.value; int foldP = 0; if (isAscii(bytes[p] & 0xff) && bytes[p + 1] == 0) { if (Config.USE_UNICODE_CASE_FOLD_TURKISH_AZERI) { if ((flag & Config.ENC_CASE_FOLD_TURKISH_AZERI) != 0) { if (bytes[p] == (byte)0x49) { fold[foldP++] = (byte)0x01; fold[foldP] = (byte)0x31; pp.value += 2; return 2; } } } // USE_UNICODE_CASE_FOLD_TURKISH_AZERI fold[foldP++] = AsciiTables.ToLowerCaseTable[bytes[p] & 0xff]; fold[foldP] = 0; pp.value += 2; return 2; } else { return super.mbcCaseFold(flag, bytes, pp, end, fold); } } /** onigenc_utf16_32_get_ctype_code_range */ @Override public int[]ctypeCodeRange(int ctype, IntHolder sbOut) { sbOut.value = 0x00; return super.ctypeCodeRange(ctype); } @Override public int leftAdjustCharHead(byte[]bytes, int p, int s, int end) { if (s <= p) return s; if ((s - p) % 2 == 1) s--; if (isSurrogateSecond(bytes[s + 1] & 0xff) && s > p + 1) s -= 2; return s; } @Override public boolean isReverseMatchAllowed(byte[]bytes, int p, int end) { return false; } private static boolean isSurrogateFirst(int c) { if (Config.VANILLA) { return c >= 0xd8 && c <= 0xdb; } else { return (c & 0xfc) == 0xd8; } } private static boolean isSurrogateSecond(int c) { if (Config.VANILLA) { return c >= 0xdc && c <= 0xdf; } else { return (c & 0xfc) == 0xdc; } } private static boolean isSurrogate(int c) { if (Config.VANILLA) { return (c & 0xf8) == 0; } else { return (c & 0xf8) == 0xd8; } } public static final UTF16LEEncoding INSTANCE = new UTF16LEEncoding(); } jcodings-jcodings-1.0.11/src/org/jcodings/specific/UTF32BEEncoding.java000066400000000000000000000073561223451536200254750ustar00rootroot00000000000000/* * Permission is hereby granted, free of charge, to any person obtaining a copy of * this software and associated documentation files (the "Software"), to deal in * the Software without restriction, including without limitation the rights to * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies * of the Software, and to permit persons to whom the Software is furnished to do * so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ package org.jcodings.specific; import org.jcodings.Config; import org.jcodings.IntHolder; import org.jcodings.ascii.AsciiTables; import org.jcodings.unicode.FixedWidthUnicodeEncoding; public final class UTF32BEEncoding extends FixedWidthUnicodeEncoding { protected UTF32BEEncoding() { super("UTF-32BE", 4); } @Override public boolean isNewLine(byte[]bytes, int p, int end) { if (p + 3 < end) { if (bytes[p + 3] == (byte)0x0a && bytes[p + 2] == 0 && bytes[p + 1] == 0 && bytes[p] == 0) return true; if (Config.USE_UNICODE_ALL_LINE_TERMINATORS) { if ((Config.USE_CRNL_AS_LINE_TERMINATOR && bytes[p + 3] == (byte)0x0d) || bytes[p + 3] == (byte)0x85 && bytes[p + 2] == 0 && bytes[p + 1] == 0 && bytes[p] == 0) return true; if (bytes[p + 2] == (byte)0x20 && (bytes[p + 3] == (byte)0x29 || bytes[p + 3] == (byte)0x28) && bytes[p + 1] == 0 && bytes[p] == 0) return true; } // USE_UNICODE_ALL_LINE_TERMINATORS } return false; } @Override public int mbcToCode(byte[]bytes, int p, int end) { return (((bytes[p] & 0xff) * 256 + (bytes[p + 1] & 0xff)) * 256 + (bytes[p + 2] & 0xff)) * 256 + (bytes[p + 3] & 0xff); } @Override public int codeToMbc(int code, byte[]bytes, int p) { int p_ = p; bytes[p_++] = (byte)((code & 0xff000000) >>> 24); bytes[p_++] = (byte)((code & 0xff0000) >>> 16); bytes[p_++] = (byte)((code & 0xff00) >>> 8); bytes[p_++] = (byte) (code & 0xff); return 4; } @Override public int mbcCaseFold(int flag, byte[]bytes, IntHolder pp, int end, byte[]fold) { int p = pp.value; int foldP = 0; if (isAscii(bytes[p + 3] & 0xff) && bytes[p + 2] == 0 && bytes[p + 1] == 0 && bytes[p] == 0) { fold[foldP++] = 0; fold[foldP++] = 0; if (Config.USE_UNICODE_CASE_FOLD_TURKISH_AZERI) { if ((flag & Config.ENC_CASE_FOLD_TURKISH_AZERI) != 0) { if (bytes[p + 3] == (byte)0x49) { fold[foldP++] = (byte)0x01; fold[foldP] = (byte)0x31; pp.value += 4; return 4; } } } // USE_UNICODE_CASE_FOLD_TURKISH_AZERI fold[foldP++] = 0; fold[foldP] = AsciiTables.ToLowerCaseTable[bytes[p + 3] & 0xff]; pp.value += 4; return 4; } else { return super.mbcCaseFold(flag, bytes, pp, end, fold); } } public static UTF32BEEncoding INSTANCE = new UTF32BEEncoding(); } jcodings-jcodings-1.0.11/src/org/jcodings/specific/UTF32LEEncoding.java000066400000000000000000000071741223451536200255050ustar00rootroot00000000000000/* * Permission is hereby granted, free of charge, to any person obtaining a copy of * this software and associated documentation files (the "Software"), to deal in * the Software without restriction, including without limitation the rights to * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies * of the Software, and to permit persons to whom the Software is furnished to do * so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ package org.jcodings.specific; import org.jcodings.Config; import org.jcodings.IntHolder; import org.jcodings.ascii.AsciiTables; import org.jcodings.unicode.FixedWidthUnicodeEncoding; public final class UTF32LEEncoding extends FixedWidthUnicodeEncoding { protected UTF32LEEncoding() { super("UTF-32LE", 4); } @Override public boolean isNewLine(byte[]bytes, int p, int end) { if (p + 3 < end) { if (bytes[p] == (byte)0x0a && bytes[p + 1] == 0 && bytes[p + 2] == 0 && bytes[p + 3] == 0) return true; if (Config.USE_UNICODE_ALL_LINE_TERMINATORS) { if ((Config.USE_CRNL_AS_LINE_TERMINATOR && bytes[p] == (byte)0x0d) || bytes[p] == (byte)0x85 && bytes[p + 1] == 0 && bytes[p + 2] == 0 && bytes[3] == 0) return true; if (bytes[p + 1] == (byte)0x20 && (bytes[p] == (byte)0x29 || bytes[p] == (byte)0x28) && bytes[p + 2] == 0 && bytes[p + 3] == 0) return true; } // USE_UNICODE_ALL_LINE_TERMINATORS } return false; } @Override public int mbcToCode(byte[]bytes, int p, int end) { return (((bytes[p + 3] & 0xff) * 256 + (bytes[p + 2] & 0xff)) * 256 + (bytes[p + 1] & 0xff)) * 256 + (bytes[p] & 0xff); } @Override public int codeToMbc(int code, byte[]bytes, int p) { int p_ = p; bytes[p_++] = (byte) (code & 0xff); bytes[p_++] = (byte)((code & 0xff00) >>> 8); bytes[p_++] = (byte)((code & 0xff0000) >>> 16); bytes[p_++] = (byte)((code & 0xff000000) >>> 24); return 4; } @Override public int mbcCaseFold(int flag, byte[]bytes, IntHolder pp, int end, byte[]fold) { int p = pp.value; int foldP = 0; if (isAscii(bytes[p] & 0xff) && bytes[p + 1] == 0 && bytes[p + 2] == 0 && bytes[p + 3] == 0) { if (Config.USE_UNICODE_CASE_FOLD_TURKISH_AZERI && (flag & Config.ENC_CASE_FOLD_TURKISH_AZERI) != 0) { if (bytes[p] == (byte)0x49) { fold[foldP++] = (byte)0x31; fold[foldP] = (byte)0x01; } } else { fold[foldP++] = AsciiTables.ToLowerCaseTable[bytes[p] & 0xff]; fold[foldP++] = 0; } // USE_UNICODE_CASE_FOLD_TURKISH_AZERI fold[foldP++] = 0; fold[foldP] = 0; pp.value += 4; return 4; } else { return super.mbcCaseFold(flag, bytes, pp, end, fold); } } public static UTF32LEEncoding INSTANCE = new UTF32LEEncoding(); } jcodings-jcodings-1.0.11/src/org/jcodings/specific/UTF8Encoding.java000066400000000000000000000270651223451536200252100ustar00rootroot00000000000000/* * Permission is hereby granted, free of charge, to any person obtaining a copy of * this software and associated documentation files (the "Software"), to deal in * the Software without restriction, including without limitation the rights to * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies * of the Software, and to permit persons to whom the Software is furnished to do * so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ package org.jcodings.specific; import org.jcodings.Config; public final class UTF8Encoding extends BaseUTF8Encoding { protected UTF8Encoding() { super(UTF8EncLen, UTF8Trans); } @Override public int length(byte[]bytes, int p, int end) { if (Config.VANILLA) { return length(bytes[p]); } else { int b = bytes[p] & 0xff; if (b <= 127) return 1; int s = TransZero[b]; if (s < 0) return CHAR_INVALID; return lengthForTwoUptoFour(bytes, p, end, b, s); } } private static final int UTF8EncLen[] = { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 }; static final int UTF8Trans[][] = Config.VANILLA ? null : new int[][]{ { /* 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, A, A, A, A, A, /* 8 */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* 9 */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* a */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* b */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* c */ F, F, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* d */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* e */ 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 3, 3, /* f */ 5, 6, 6, 6, 7, F, F, F, F, F, F, F, F, F, F, F }, { /* S1 0 1 2 3 4 5 6 7 8 9 a b c d e f */ /* 0 */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* 1 */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* 2 */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* 3 */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* 4 */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* 5 */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* 6 */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* 7 */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* 8 */ A, 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, /* a */ A, A, A, A, A, A, A, A, A, A, A, A, A, A, A, A, /* b */ A, A, A, A, A, A, A, A, A, A, A, A, A, A, A, A, /* c */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* d */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* e */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* f */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F }, { /* S2 0 1 2 3 4 5 6 7 8 9 a b c d e f */ /* 0 */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* 1 */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* 2 */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* 3 */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* 4 */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* 5 */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* 6 */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* 7 */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* 8 */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* 9 */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* a */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* b */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* c */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* d */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* e */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* f */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F }, { /* S3 0 1 2 3 4 5 6 7 8 9 a b c d e f */ /* 0 */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* 1 */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* 2 */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* 3 */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* 4 */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* 5 */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* 6 */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* 7 */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* 8 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 9 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* a */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* b */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* c */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* d */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* e */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* f */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F }, { /* S4 0 1 2 3 4 5 6 7 8 9 a b c d e f */ /* 0 */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* 1 */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* 2 */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* 3 */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* 4 */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* 5 */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* 6 */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* 7 */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* 8 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 9 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* a */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* b */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* c */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* d */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* e */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* f */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F }, { /* S5 0 1 2 3 4 5 6 7 8 9 a b c d e f */ /* 0 */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* 1 */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* 2 */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* 3 */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* 4 */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* 5 */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* 6 */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* 7 */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* 8 */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* 9 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* a */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* b */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* c */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* d */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* e */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* f */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F }, { /* S6 0 1 2 3 4 5 6 7 8 9 a b c d e f */ /* 0 */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* 1 */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* 2 */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* 3 */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* 4 */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* 5 */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* 6 */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* 7 */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* 8 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 9 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* a */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* b */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* c */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* d */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* e */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* f */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F }, { /* S7 0 1 2 3 4 5 6 7 8 9 a b c d e f */ /* 0 */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* 1 */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* 2 */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* 3 */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* 4 */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* 5 */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* 6 */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* 7 */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* 8 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 9 */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* a */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* b */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* c */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* d */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* e */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, /* f */ F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F } }; public static final UTF8Encoding INSTANCE = new UTF8Encoding(); } jcodings-jcodings-1.0.11/src/org/jcodings/transcode/000077500000000000000000000000001223451536200223335ustar00rootroot00000000000000jcodings-jcodings-1.0.11/src/org/jcodings/transcode/AsciiCompatibility.java000066400000000000000000000025421223451536200267630ustar00rootroot00000000000000/* * Permission is hereby granted, free of charge, to any person obtaining a copy of * this software and associated documentation files (the "Software"), to deal in * the Software without restriction, including without limitation the rights to * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies * of the Software, and to permit persons to whom the Software is furnished to do * so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ package org.jcodings.transcode; public enum AsciiCompatibility { CONVERTER, DECODER, ENCODER; boolean isConverter() { return this == CONVERTER; } boolean isDecoder() { return this == DECODER; } boolean isEncoder() { return this == ENCODER; } }jcodings-jcodings-1.0.11/src/org/jcodings/transcode/Buffer.java000066400000000000000000000024561223451536200244160ustar00rootroot00000000000000/* * Permission is hereby granted, free of charge, to any person obtaining a copy of * this software and associated documentation files (the "Software"), to deal in * the Software without restriction, including without limitation the rights to * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies * of the Software, and to permit persons to whom the Software is furnished to do * so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ package org.jcodings.transcode; class Buffer { int bufStart, dataStart, dataEnd, bufEnd; byte[] bytes; void allocate(int num) { bytes = new byte[num]; bufStart = dataStart = dataEnd = 0; bufEnd = num; } } jcodings-jcodings-1.0.11/src/org/jcodings/transcode/EConv.java000066400000000000000000000711641223451536200242210ustar00rootroot00000000000000/* * Permission is hereby granted, free of charge, to any person obtaining a copy of * this software and associated documentation files (the "Software"), to deal in * the Software without restriction, including without limitation the rights to * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies * of the Software, and to permit persons to whom the Software is furnished to do * so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ package org.jcodings.transcode; import static org.jcodings.util.CaseInsensitiveBytesHash.caseInsensitiveEquals; import org.jcodings.Ptr; import org.jcodings.exception.InternalException; public final class EConv implements EConvFlags { int flags; byte[] source, destination; // source/destination encoding names boolean started = false; byte[] replacementString; int replacementLength; byte[] replacementEncoding; Buffer inBuf = new Buffer(); EConvElement[] elements; int numTranscoders; int numFinished; Transcoding lastTranscoding; final LastError lastError = new LastError(); @Override public String toString() { return new String(source) + " => " + new String(destination); } EConv(int nHint) { if (nHint < 0) nHint = 1; elements = new EConvElement[nHint]; lastError.result = EConvResult.SourceBufferEmpty; } static final class EConvElement extends Buffer { EConvElement(Transcoding transcoding) { this.transcoding = transcoding; lastResult = EConvResult.SourceBufferEmpty; } final Transcoding transcoding; EConvResult lastResult; @Override public String toString() { String s = "EConv " + transcoding.toString() + "\n"; s += " last result: " + lastResult; return s; } } static final class LastError { EConvResult result; Transcoding errorTranscoding; byte[] source, destination; byte[] errorBytes; int errorBytesP, errorBytesEnd; int readAgainLength; void reset() { result = null; errorTranscoding = null; source = destination = null; errorBytes = null; errorBytesP = errorBytesEnd = 0; readAgainLength = 0; } @Override public String toString() { String s = "Last Error " + (source == null ? "null" : new String(source)) + " => " + (destination == null ? "null" : new String(destination)) + "\n"; s += " result: " + result.toString() + "\n"; s += " error bytes: " + (errorBytes == null ? "null" : new String(errorBytes, errorBytesP, errorBytesP + errorBytesEnd)) + "\n"; s += " read again length: " + readAgainLength; return s; } } static final byte[] NULL_STRING = new byte[0]; static final int[] NULL_POINTER = new int[0]; static boolean decorator(byte[] source, byte[] destination) { return source.length == 0; } /* rb_econv_add_transcoder_at */ void addTranscoderAt(Transcoder transcoder, int i) { if (numTranscoders == elements.length) { EConvElement[] tmp = new EConvElement[elements.length * 2]; System.arraycopy(elements, 0, tmp, 0, i); System.arraycopy(elements, i, tmp, i + 1, elements.length - i); elements = tmp; } else { System.arraycopy(elements, i, elements, i + 1, elements.length - i - 1); } elements[i] = new EConvElement(transcoder.transcoding(0)); elements[i].allocate(4096); numTranscoders++; if (!decorator(transcoder.source, transcoder.destination)) { for (int j = numTranscoders - 1; i <= j; j--) { Transcoding tc = elements[j].transcoding; Transcoder tr = tc.transcoder; if (!decorator(tr.source, tr.destination)) { lastTranscoding = tc; break; } } } } /* trans_sweep */ private int transSweep(byte[] in, Ptr inPtr, int inStop, byte[] out, Ptr outPtr, int outStop, int flags, int start) { boolean try_ = true; final Ptr ipp = new Ptr(); final Ptr opp = new Ptr(); while (try_) { for (int i = 0; i < numTranscoders; i++) { EConvElement te = elements[i]; final int is, os; final byte[] ibytes, obytes; if (i == 0) { ipp.p = inPtr.p; is = inStop; ibytes = in; } else { EConvElement previousTE = elements[i - 1]; ipp.p = previousTE.dataStart; // !!!! is = previousTE.dataEnd; ibytes = previousTE.bytes; } if (i == numTranscoders - 1) { opp.p = outPtr.p; os = outStop; obytes = out; } else { if (te.bufStart != te.dataStart) { int len = te.dataEnd - te.dataStart; int off = te.dataStart - te.bufStart; System.arraycopy(te.bytes, te.dataStart, te.bytes, te.bufStart, len); te.dataStart = te.bufStart; te.dataEnd -= off; } opp.p = te.dataEnd; os = te.bufEnd; obytes = te.bytes; } int f = flags; if (numFinished != i) f |= PARTIAL_INPUT; if (i == 0 && (flags & AFTER_OUTPUT) != 0) { start = 1; flags &= ~AFTER_OUTPUT; } if (i != 0) f &= ~AFTER_OUTPUT; int iold = ipp.p; int oold = opp.p; EConvResult res; te.lastResult = res = te.transcoding.convert(ibytes, ipp, is, obytes, opp, os, f); if (iold != ipp.p || oold != opp.p) try_ = true; switch (res) { case InvalidByteSequence: case IncompleteInput: case UndefinedConversion: case AfterOutput: return i; case DestinationBufferFull: case SourceBufferEmpty: break; case Finished: numFinished = i + 1; break; } } } return -1; } /* rb_trans_conv */ private EConvResult transConv(byte[] in, Ptr inPtr, int inStop, byte[] out, Ptr outPtr, int outStop, int flags, Ptr resultPositionPtr) { // null check if (elements[0].lastResult == EConvResult.AfterOutput) elements[0].lastResult = EConvResult.SourceBufferEmpty; for (int i = numTranscoders = 1; i >= 0; i--) { switch (elements[i].lastResult) { case InvalidByteSequence: case IncompleteInput: case UndefinedConversion: case AfterOutput: case Finished: return transConvNeedReport(in, inPtr, inStop, out, outPtr, outStop, flags, resultPositionPtr, i + 1, i); case DestinationBufferFull: case SourceBufferEmpty: break; default: throw new InternalException("unexpected transcode last result"); } } /* /^[sd]+$/ is confirmed. but actually /^s*d*$/. */ if (elements[numTranscoders - 1].lastResult == EConvResult.DestinationBufferFull && (flags & AFTER_OUTPUT) != 0) { EConvResult res = transConv(NULL_STRING, Ptr.NULL, 0, out, outPtr, outStop, (flags & ~AFTER_OUTPUT) | PARTIAL_INPUT, resultPositionPtr); return res.isSourceBufferEmpty() ? EConvResult.AfterOutput : res; } return transConvNeedReport(in, inPtr, inStop, out, outPtr, outStop, flags, resultPositionPtr, 0, -1); } private EConvResult transConvNeedReport(byte[] in, Ptr inPtr, int inStop, byte[] out, Ptr outPtr, int outStop, int flags, Ptr resultPositionPtr, int sweepStart, int needReportIndex) { do { needReportIndex = transSweep(in, inPtr, inStop, out, outPtr, outStop, flags, sweepStart); sweepStart = needReportIndex + 1; } while (needReportIndex != -1 && needReportIndex != numTranscoders - 1); for (int i = numTranscoders - 1; i >= 0; i--) { if (elements[i].lastResult != EConvResult.SourceBufferEmpty) { EConvResult res = elements[i].lastResult; switch (res) { case InvalidByteSequence: case IncompleteInput: case UndefinedConversion: case AfterOutput: elements[i].lastResult = EConvResult.SourceBufferEmpty; } if (resultPositionPtr != null) resultPositionPtr.p = i; return res; } } if (resultPositionPtr != null) resultPositionPtr.p = -1; return EConvResult.SourceBufferEmpty; } /* rb_econv_convert0 */ private EConvResult convertInternal(byte[] in, Ptr inPtr, int inStop, byte[] out, Ptr outPtr, int outStop, int flags) { lastError.reset(); EConvResult res; int len; if (numTranscoders == 0) { if (inBuf.bytes != null && inBuf.dataStart != inBuf.dataEnd) { if (outStop - outPtr.p < inBuf.dataEnd - inBuf.dataStart) { len = outStop - outPtr.p; System.arraycopy(inBuf, inBuf.dataStart, out, outPtr.p, len); outPtr.p = outStop; inBuf.dataStart += len; return convertInternalResult(EConvResult.DestinationBufferFull, null); } len = inBuf.dataEnd - inBuf.dataStart; System.arraycopy(inBuf, inBuf.dataStart, out, outPtr.p, len); outPtr.p += len; inBuf.dataStart = inBuf.dataEnd = inBuf.bufStart; if ((flags & AFTER_OUTPUT) != 0) return convertInternalResult(EConvResult.AfterOutput, null); } if (outStop - outPtr.p < inStop - inPtr.p) { len = outStop - outPtr.p; } else { len = inStop - inPtr.p; } if (len > 0 && (flags & AFTER_OUTPUT) != 0) { out[outPtr.p++] = in[inPtr.p++]; return convertInternalResult(EConvResult.AfterOutput, null); } System.arraycopy(in, inPtr.p, out, outPtr.p, len); outPtr.p += len; inPtr.p += len; if (inPtr.p != inStop) { res = EConvResult.DestinationBufferFull; } else if ((flags & PARTIAL_INPUT) != 0) { res = EConvResult.SourceBufferEmpty; } else { res = EConvResult.Finished; } return convertInternalResult(res, null); } boolean hasOutput = false; EConvElement elem = elements[numTranscoders - 1]; if (elem.bytes != null) { int dataStart = elem.dataStart; int dataEnd = elem.dataEnd; byte[] data = elem.bytes; if (dataStart != dataEnd) { if (outStop - outPtr.p < dataEnd - dataStart) { len = outStop = outPtr.p; System.arraycopy(data, dataStart, out, outPtr.p, len); outPtr.p = outStop; elem.dataStart += len; return convertInternalResult(EConvResult.DestinationBufferFull, null); } len = dataEnd - dataStart; System.arraycopy(data, dataStart, out, outPtr.p, len); outPtr.p += len; elem.dataStart = elem.dataEnd = elem.bufStart; hasOutput = true; } } Ptr resultPosition = new Ptr(0); if (inBuf != null && inBuf.dataStart != inBuf.dataEnd) { Ptr inDataStartPtr = new Ptr(inBuf.dataStart); res = transConv(inBuf.bytes, inDataStartPtr, inBuf.dataEnd, out, outPtr, outStop, (flags & ~AFTER_OUTPUT) | PARTIAL_INPUT, resultPosition); inBuf.dataStart = inDataStartPtr.p; if (!res.isSourceBufferEmpty()) return convertInternalResult(EConvResult.SourceBufferEmpty, resultPosition); } if (hasOutput && (flags & AFTER_OUTPUT) != 0 && inPtr.p != inStop) { inStop = inPtr.p; res = transConv(in, inPtr, inStop, out, outPtr, outStop, flags, resultPosition); if (res.isSourceBufferEmpty()) res = EConvResult.AfterOutput; } else if ((flags & AFTER_OUTPUT) != 0 || numTranscoders == 1) { res = transConv(in, inPtr, inStop, out, outPtr, outStop, flags, resultPosition); } else { flags |= AFTER_OUTPUT; do { res = transConv(in, inPtr, inStop, out, outPtr, outStop, flags, resultPosition); } while (res.isAfterOutput()); } return convertInternalResult(res, resultPosition); } private EConvResult convertInternalResult(EConvResult res, Ptr resultPosition) { lastError.result = res; switch (res) { case InvalidByteSequence: case IncompleteInput: case UndefinedConversion: Transcoding errorTranscoding = elements[resultPosition.p].transcoding; lastError.errorTranscoding = errorTranscoding; lastError.source = errorTranscoding.transcoder.source; lastError.destination = errorTranscoding.transcoder.destination; lastError.errorBytes = errorTranscoding.readBuf; lastError.errorBytesP = 0; lastError.errorBytesEnd = errorTranscoding.recognizedLength; // ??? lastError.readAgainLength = errorTranscoding.readAgainLength; } return res; } /* rb_econv_convert */ private EConvResult convert(byte[] in, Ptr inPtr, int inStop, byte[] out, Ptr outPtr, int outStop, int flags) { started = true; // null check resume: while (true) { EConvResult ret = convertInternal(in, inPtr, inStop, out, outPtr, outStop, flags); if (ret.isInvalidByteSequence() || ret.isIncompleteInput()) { switch (this.flags & INVALID_MASK) { case INVALID_REPLACE: if (outputReplacementCharacter() == 0) continue resume; } } if (ret.isUndefinedConversion()) { switch (this.flags & UNDEF_MASK) { case UNDEF_REPLACE: if (outputReplacementCharacter() == 0) continue resume; break; case UNDEF_HEX_CHARREF: if (outputHexCharref() == 0) continue resume; break; } } return ret; } } /* output_hex_charref */ private int outputHexCharref() { final byte[] utfBytes; final int utfP; int utfLen; if (caseInsensitiveEquals(lastError.source, "UTF-32BE".getBytes())) { utfBytes = lastError.errorBytes; utfP = lastError.errorBytesP; utfLen = lastError.errorBytesEnd - lastError.errorBytesP; } else { Ptr utfLenA = new Ptr(); byte[] utfBuf = new byte[1024]; // ?? utfBytes = allocateConvertedString(lastError.source, "UTF-32BE".getBytes(), lastError.errorBytes, lastError.errorBytesP, lastError.errorBytesEnd - lastError.errorBytesP, utfBuf, utfLenA); if (utfBytes == null) return -1; utfP = 0; utfLen = utfLenA.p; } if (utfLen % 4 != 0) return -1; int p = utfP; while (4 <= utfLen) { int u = 0; // long ?? u += (utfBytes[p] & 0xff) << 24; u += (utfBytes[p + 1] & 0xff) << 16; u += (utfBytes[p + 2] & 0xff) << 8; u += (utfBytes[p + 3]); byte[] charrefbuf = String.format("&#x%X;", u).getBytes(); // use faster sprintf ?? if (insertOuput(charrefbuf, charrefbuf.length, "US-ASCII".getBytes()) == -1) return -1; p += 4; utfLen -= 4; } return 0; } /* rb_econv_encoding_to_insert_output */ private byte[] encodingToInsertOutput() { Transcoding transcoding = lastTranscoding; if (transcoding == null) return NULL_STRING; Transcoder transcoder = transcoding.transcoder; return transcoder.compatibility.isEncoder() ? transcoder.source : transcoder.destination; } /* allocate_converted_string */ private static byte[] allocateConvertedString(byte[] source, byte[] destination, byte[] str, int strP, int strLen, byte[] callerDstBuf, Ptr dstLenPtr) { int dstBufSize; if (callerDstBuf != null) { dstBufSize = callerDstBuf.length; } else if (strLen == 0) { dstBufSize = 1; // ?? } else { dstBufSize = strLen; } EConv ec = TranscoderDB.open(source, destination, 0); if (ec == null) return null; byte[] dstStr; if (callerDstBuf != null) { dstStr = callerDstBuf; } else { dstStr = new byte[dstBufSize]; } int dstLen = 0; Ptr sp = new Ptr(strP); Ptr dp = new Ptr(dstLen); EConvResult res = ec.convert(str, sp, strP + strLen, dstStr, dp, dstBufSize, 0); while (res.isDestinationBufferFull()) { dstBufSize *= 2; byte[] tmp = new byte[dstBufSize]; System.arraycopy(dstStr, 0, tmp, 0, dstBufSize / 2); dstStr = tmp; dp.p = dstLen; // ?? res = ec.convert(str, sp, strP + strLen, dstStr, dp, dstBufSize, 0); dstLen = dp.p; } if (!res.isFinished()) return null; ec.close(); dstLenPtr.p = dstLen; return dstStr; } /* rb_econv_insert_output */ int insertOuput(byte[] str, int strLen, byte[] strEncoding) { byte[] insertEncoding = encodingToInsertOutput(); byte[] insertBuf = new byte[4096]; started = true; if (strLen == 0) return 0; final byte[] insertStr; final int insertLen; if (caseInsensitiveEquals(insertEncoding, strEncoding)) { insertStr = str; insertLen = strLen; } else { Ptr insertLenP = new Ptr(); insertStr = allocateConvertedString(strEncoding, insertEncoding, str, 0, strLen, insertBuf, insertLenP); insertLen = insertLenP.p; } int need = insertLen; final int lastTranscodingIndex = numTranscoders - 1; final Transcoding transcoding; Buffer buf; if (numTranscoders == 0) { transcoding = null; buf = inBuf; } else if (elements[lastTranscodingIndex].transcoding.transcoder.compatibility.isEncoder()) { transcoding = elements[lastTranscodingIndex].transcoding; need += transcoding.readAgainLength; if (need < insertLen) return -1; if (lastTranscodingIndex == 0) { buf = inBuf; } else { buf = elements[lastTranscodingIndex - 1]; } } else { transcoding = elements[lastTranscodingIndex].transcoding; buf = elements[lastTranscodingIndex]; } if (buf == null) { buf = new Buffer(); buf.allocate(need); } else if (need > (buf.bufEnd - buf.dataEnd)) { System.arraycopy(buf.bytes, buf.dataStart, buf.bytes, buf.bufStart, buf.dataEnd - buf.dataStart); buf.dataEnd = buf.dataStart + (buf.dataEnd - buf.dataStart); buf.dataStart = buf.bufStart; if (need > (buf.bufEnd - buf.dataEnd)) { int s = (buf.dataEnd - buf.bufStart) + need; if (need > s) return -1; byte[] tmp = new byte[s]; System.arraycopy(buf.bytes, buf.bufStart, tmp, 0, s); // ?? buf.bytes = tmp; buf.dataStart = 0; buf.dataEnd = buf.dataEnd - buf.bufStart; buf.bufStart = 0; buf.bufEnd = 0; } } System.arraycopy(insertStr, 0, buf, buf.dataEnd, insertLen); buf.dataEnd += insertLen; if (transcoding != null && transcoding.transcoder.compatibility.isEncoder()) { System.arraycopy(transcoding.readBuf, transcoding.recognizedLength, buf, buf.dataEnd, transcoding.readAgainLength); buf.dataEnd = transcoding.readAgainLength; transcoding.readAgainLength = 0; } return 0; } /* rb_econv_close */ void close() { for (int i = 0; i < numTranscoders; i++) { elements[i].transcoding.close(); } } /* rb_econv_putbackable */ int putbackable() { return numTranscoders == 0 ? 0 : elements[0].transcoding.readAgainLength; } /* rb_econv_putback */ void putback(byte[] bytes, int p, int len) { if (numTranscoders == 0 || len == 0) return; Transcoding transcoding = elements[0].transcoding; System.arraycopy(transcoding.readBuf, transcoding.recognizedLength + transcoding.readAgainLength, bytes, p, len); transcoding.readAgainLength -= len; } /* rb_econv_add_converter */ boolean addConverter(byte[] source, byte[] destination, int n) { if (started) return false; TranscoderDB.Entry entry = TranscoderDB.getEntry(source, destination); if (entry == null) return false; Transcoder transcoder = entry.getTranscoder(); if (transcoder == null) return false; addTranscoderAt(transcoder, n); return true; } /* rb_econv_decorate_at */ boolean decorateAt(byte[] decorator, int n) { return addConverter(NULL_STRING, decorator, n); } /* rb_econv_decorate_at_last */ boolean decorateAtFirst(byte[] decorator) { if (numTranscoders == 0) return decorateAt(decorator, 0); Transcoder transcoder = elements[0].transcoding.transcoder; if (!decorator(transcoder.source, transcoder.destination) && transcoder.compatibility.isDecoder()) { return decorateAt(decorator, 1); } return decorateAt(decorator, 0); } /* rb_econv_decorate_at_last */ boolean decorateAtLast(byte[] decorator) { if (numTranscoders == 0) return decorateAt(decorator, 0); Transcoder transcoder = elements[numTranscoders - 1].transcoding.transcoder; if (!decorator(transcoder.source, transcoder.destination) && transcoder.compatibility.isDecoder()) { return decorateAt(decorator, numTranscoders - 1); } return decorateAt(decorator, numTranscoders); } /* rb_econv_binmode */ private void binmode() { Transcoder[] transcoders = new Transcoder[3]; int n = 0; if ((flags & UNIVERSAL_NEWLINE_DECORATOR) != 0) { TranscoderDB.Entry entry = TranscoderDB.getEntry(NULL_STRING, "universal_newline".getBytes()); if (entry.getTranscoder() != null) transcoders[n++] = entry.getTranscoder(); } if ((flags & CRLF_NEWLINE_DECORATOR) != 0) { TranscoderDB.Entry entry = TranscoderDB.getEntry(NULL_STRING, "crlf_newline".getBytes()); if (entry.getTranscoder() != null) transcoders[n++] = entry.getTranscoder(); } if ((flags & CR_NEWLINE_DECORATOR) != 0) { TranscoderDB.Entry entry = TranscoderDB.getEntry(NULL_STRING, "cr_newline".getBytes()); if (entry.getTranscoder() != null) transcoders[n++] = entry.getTranscoder(); } int nTrans = numTranscoders; int j = 0; for (int i = 0; i < nTrans; i++) { int k; for (k = 0; k < n; k++) { if (transcoders[k] == elements[i].transcoding.transcoder) break; } if (k == n) { elements[j] = elements[i]; j++; } else { elements[i].transcoding.close(); numTranscoders--; } } flags &= ~NEWLINE_DECORATOR_MASK; } /* econv_description, rb_econv_open_exc, make_econv_exception */ /* more_output_buffer */ /* make_replacement */ private int makeReplacement() { if (replacementString != null) return 0; byte[] insEnc = encodingToInsertOutput(); final byte[] replEnc; final int len; final byte[] replacement; if (insEnc.length != 0) { // Transcoding transcoding = lastTranscoding; // Transcoder transcoder = transcoding.transcoder; // Encoding enc = EncodingDB.getEncodings().get(transcoder.destination).getEncoding(); // get_replacement_character if (caseInsensitiveEquals(insEnc, "UTF-8".getBytes())) { len = 3; replEnc = "UTF-8".getBytes(); replacement = new byte[] { (byte) 0xEF, (byte) 0xBF, (byte) 0xBD }; } else { len = 1; replEnc = "US-ASCII".getBytes(); replacement = new byte[] { '?' }; } } else { len = 1; replEnc = NULL_STRING; replacement = new byte[] { '?' }; } replacementString = replacement; replacementLength = len; replacementEncoding = replEnc; return 0; } /* rb_econv_set_replacement */ int setReplacement(byte[] str, int p, int len, byte[] encname) { byte[] encname2 = encodingToInsertOutput(); final byte[] str2; final int p2 = 0; final int len2; if (caseInsensitiveEquals(encname, encname2)) { str2 = new byte[len]; System.arraycopy(str, p, str2, 0, len); // ?? len2 = len; encname2 = encname; } else { Ptr len2p = new Ptr(); str2 = allocateConvertedString(encname, encname2, str, p, len, null, len2p); if (str == null) return -1; len2 = len2p.p; } replacementString = str2; replacementLength = len2; replacementEncoding = encname2; return 0; } /* output_replacement_character */ int outputReplacementCharacter() { if (makeReplacement() == -1) return -1; if (insertOuput(replacementString, replacementLength, replacementEncoding) == -1) return -1; return 0; } public String toStringFull() { String s = "EConv " + new String(source) + " => " + new String(destination) + "\n"; s += " started: " + started + "\n"; s += " replacement string: " + (replacementString == null ? "null" : new String(replacementString, 0, replacementLength)) + "\n"; s += " replacement encoding: " + (replacementEncoding == null ? "null" : new String(replacementEncoding)) + "\n"; s += "\n"; for (int i = 0; i < numTranscoders; i++) { s += " element " + i + ": " + elements[i].toString() + "\n"; } s += "\n"; s += " lastTranscoding: " + lastTranscoding + "\n"; s += " last error: " + (lastError == null ? "null" : lastError.toString()); return s; } }jcodings-jcodings-1.0.11/src/org/jcodings/transcode/EConvFlags.java000066400000000000000000000042621223451536200251710ustar00rootroot00000000000000/* * Permission is hereby granted, free of charge, to any person obtaining a copy of * this software and associated documentation files (the "Software"), to deal in * the Software without restriction, including without limitation the rights to * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies * of the Software, and to permit persons to whom the Software is furnished to do * so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ package org.jcodings.transcode; public interface EConvFlags { final int ERROR_HANDLER_MASK = 0x000000ff; final int INVALID_MASK = 0x0000000f; final int INVALID_REPLACE = 0x00000002; final int UNDEF_MASK = 0x000000f0; final int UNDEF_REPLACE = 0x00000020; final int UNDEF_HEX_CHARREF = 0x00000030; final int DECORATOR_MASK = 0x0000ff00; final int NEWLINE_DECORATOR_MASK = 0x00003f00; final int UNIVERSAL_NEWLINE_DECORATOR = 0x00000100; final int CRLF_NEWLINE_DECORATOR = 0x00001000; final int CR_NEWLINE_DECORATOR = 0x00002000; final int XML_TEXT_DECORATOR = 0x00004000; final int XML_ATTR_CONTENT_DECORATOR = 0x00008000; final int STATEFUL_DECORATOR_MASK = 0x00f00000; final int XML_ATTR_QUOTE_DECORATOR = 0x00100000; final int PARTIAL_INPUT = 0x00010000; final int AFTER_OUTPUT = 0x00020000; final int MAX_ECFLAGS_DECORATORS = 32; }jcodings-jcodings-1.0.11/src/org/jcodings/transcode/EConvResult.java000066400000000000000000000034651223451536200254170ustar00rootroot00000000000000/* * Permission is hereby granted, free of charge, to any person obtaining a copy of * this software and associated documentation files (the "Software"), to deal in * the Software without restriction, including without limitation the rights to * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies * of the Software, and to permit persons to whom the Software is furnished to do * so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ package org.jcodings.transcode; public enum EConvResult { InvalidByteSequence, UndefinedConversion, DestinationBufferFull, SourceBufferEmpty, Finished, AfterOutput, IncompleteInput; boolean isInvalidByteSequence() { return this == InvalidByteSequence; } boolean isUndefinedConversion() { return this == UndefinedConversion; } boolean isDestinationBufferFull() { return this == DestinationBufferFull; } boolean isSourceBufferEmpty() { return this == SourceBufferEmpty; } boolean isFinished() { return this == Finished; } boolean isAfterOutput() { return this == AfterOutput; } boolean isIncompleteInput() { return this == IncompleteInput; } }jcodings-jcodings-1.0.11/src/org/jcodings/transcode/GenericTranscoder.java000066400000000000000000000034641223451536200266060ustar00rootroot00000000000000/* * Permission is hereby granted, free of charge, to any person obtaining a copy of * this software and associated documentation files (the "Software"), to deal in * the Software without restriction, including without limitation the rights to * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies * of the Software, and to permit persons to whom the Software is furnished to do * so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ package org.jcodings.transcode; final class GenericTranscoder extends Transcoder { protected GenericTranscoder(String source, String destination, int treeStart, String arrayKey, int inputUnitLength, int maxInput, int maxOutput, AsciiCompatibility compatibility, int stateSize) { super(source, destination, treeStart, arrayKey, inputUnitLength, maxInput, maxOutput, compatibility, stateSize); } protected GenericTranscoder(byte[] source, byte[] destination, int treeStart, String arrayKey, int inputUnitLength, int maxInput, int maxOutput, AsciiCompatibility compatibility, int stateSize) { super(source, destination, treeStart, arrayKey, inputUnitLength, maxInput, maxOutput, compatibility, stateSize); } } jcodings-jcodings-1.0.11/src/org/jcodings/transcode/TranscodeTableSupport.java000066400000000000000000000057151223451536200274750ustar00rootroot00000000000000/* * Permission is hereby granted, free of charge, to any person obtaining a copy of * this software and associated documentation files (the "Software"), to deal in * the Software without restriction, including without limitation the rights to * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies * of the Software, and to permit persons to whom the Software is furnished to do * so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ package org.jcodings.transcode; public class TranscodeTableSupport implements TranscodingInstruction { public static final int WORDINDEX_SHIFT_BITS = 2; public static int WORDINDEX2INFO(int widx) { return widx << WORDINDEX_SHIFT_BITS; } public static int INFO2WORDINDEX(int info) { return info >>> WORDINDEX_SHIFT_BITS; } public static int makeSTR1(int bi) { return (bi << 6) | STR1; } public static byte makeSTR1LEN(int len) { return (byte)(len - 4); } public static int o1(int b1) { return (b1 << 8) | ONEbt; } public static int o2(int b1, int b2) { return (b1 << 8) | (b2 << 16) | TWObt; } /* * 0xffffffff mask is dead code here, but no need to use longs since we can mask against 0xffffffffL in the clients * to simulate unsigned ints on jvm */ public static int o3(int b1, int b2, int b3) { return ((b1 << 8) | (b2 << 16) | (b3 << 24) | THREEbt) & 0xffffffff; } public static int o4(int b0, int b1, int b2, int b3) { return ((b1 << 8) | (b2 << 16) | (b3 << 24) | ((b0 & 0x07) << 5) | FOURbt) & 0xffffffff; } public static int g4(int b0, int b1, int b2, int b3) { return ((b0 << 8) | (b2 << 16) | ((b1 & 0xf) << 24) | ((b3 & 0x0f) << 28) | GB4bt) & 0xffffffff; } public static int funsio(int diff) { return (diff << 8) & FUNsio; } public static int getBT1(int a) { return a >>> 8; } public static int getBT2(int a) { return a >>> 16; } public static int getBT3(int a) { return a >>> 24; } public static int getBT0(int a) { return ((a >>> 5) & 0x07) | 0xf0; /* for UTF-8 only */ } public static int o2FUNii(int b1, int b2) { return (b1 << 8) | (b2 << 16) | FUNii; } }jcodings-jcodings-1.0.11/src/org/jcodings/transcode/Transcoder.java000066400000000000000000000155261223451536200253130ustar00rootroot00000000000000/* * Permission is hereby granted, free of charge, to any person obtaining a copy of * this software and associated documentation files (the "Software"), to deal in * the Software without restriction, including without limitation the rights to * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies * of the Software, and to permit persons to whom the Software is furnished to do * so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ package org.jcodings.transcode; import org.jcodings.exception.ErrorMessages; import org.jcodings.exception.InternalException; import org.jcodings.util.ArrayReader; import org.jcodings.util.BytesHash; import org.jcodings.util.ObjHash; public abstract class Transcoder implements TranscodingInstruction { protected Transcoder(byte[] source, byte[] destination, int treeStart, String arrayKey, int inputUnitLength, int maxInput, int maxOutput, AsciiCompatibility compatibility, int stateSize) { this.source = source; this.destination = destination; this.hashCode = BytesHash.hashCode(this.source, 0, this.source.length); this.treeStart = treeStart; byte[] bytes = byteArrayHash.get(arrayKey); if (bytes == null) byteArrayHash.put(arrayKey, bytes = ArrayReader.readByteArray("Transcoder_" + arrayKey + "_ByteArray")); this.byteArray = bytes; int[] ints = wordArrayHash.get(arrayKey); if (ints == null) wordArrayHash.put(arrayKey, ints = ArrayReader.readIntArray("Transcoder_" + arrayKey + "_WordArray")); this.intArray = ints; this.inputUnitLength = inputUnitLength; this.maxInput = maxInput; this.maxOutput = maxOutput; this.compatibility = compatibility; this.stateSize = stateSize; this.state = stateSize == 0 ? null : new byte[stateSize]; } protected Transcoder(String source, String destination, int treeStart, String arrayKey, int inputUnitLength, int maxInput, int maxOutput, AsciiCompatibility compatibility, int stateSize) { this(source.getBytes(), destination.getBytes(), treeStart, arrayKey, inputUnitLength, maxInput, maxOutput, compatibility, stateSize); } final byte[] source, destination; final int hashCode; final int treeStart; final byte[] byteArray; final int[] intArray; // static final int wordSize = 4; final int inputUnitLength, maxInput, maxOutput; final AsciiCompatibility compatibility; final int stateSize; final byte[] state; public int stateInit() { return 0; } public int stateFinish() { return 0; } public Object infoToInfo(Object o) { return o; } public Object startToInfo(Object o) { return o; } public int infoToOutput(byte[] p, int size) { return 0; } public int startToOutput(byte[] p, int size) { return 0; } public int finish(byte[] p, int size) { return 0; } public int resetSize() { return 0; } public int resetState(byte[] p, int size) { return 0; } public int startToOutput(byte[] p, int size, Object o, byte[] p2, int size2) { return 0; } /* rb_transcoding_open_by_transcoder */ public final Transcoding transcoding(int flags) { Transcoding transcoding = new Transcoding(this); transcoding.flags = flags; // ... return transcoding; } public static Transcoder load(String name) { String encClassName = "org.jcodings.transcode.specific." + name + "_Transcoder"; Class encClass; try { encClass = Class.forName(encClassName); } catch (ClassNotFoundException cnfe) { throw new InternalException(ErrorMessages.ERR_TRANSCODER_CLASS_DEF_NOT_FOUND, encClassName); } try { return (Transcoder) encClass.getField("INSTANCE").get(encClass); } catch (Exception e) { throw new InternalException(ErrorMessages.ERR_TRANSCODER_LOAD_ERROR, encClassName); } } static final class GenericTranscoderEntry { final byte[] source, destination; final String arrayKey; final int treeStart, inputUnitLength, maxInput, maxOutput, stateSize; final AsciiCompatibility compatibility; GenericTranscoderEntry(String source, String destination, int treeStart, String arrayKey, int inputUnitLength, int maxInput, int maxOutput, AsciiCompatibility compatibility, int stateSize) { this.source = source.getBytes(); this.destination = destination.getBytes(); this.treeStart = treeStart; this.arrayKey = arrayKey; this.inputUnitLength = inputUnitLength; this.maxInput = maxInput; this.maxOutput = maxOutput; this.compatibility = compatibility; this.stateSize = stateSize; } Transcoder createTranscoder() { return new GenericTranscoder(source, destination, treeStart, arrayKey, inputUnitLength, maxInput, maxOutput, compatibility, stateSize); } } static final ObjHash byteArrayHash = new ObjHash(); static final ObjHash wordArrayHash = new ObjHash(); @Override public String toString() { return new String(source) + " => " + new String(destination); } public String toStringFull() { String s = "Transcoder (" + new String(source) + " => " + new String(destination) + ")\n"; s += " class: " + getClass().getSimpleName() + "\n"; s += " treeStart: " + treeStart + "\n"; s += " byteArray:" + byteArray.length + " ("; for (int i = 0; i < 20; i++) { s += (byteArray[i] & 0xff) + ", "; } s += "...)\n"; s += " wordArray:" + intArray.length + " ("; for (int i = 0; i < 20; i++) { s += (intArray[i] & 0xffffffffl) + ", "; } s += "...)\n"; s += " input unit length: " + inputUnitLength + "\n"; s += " max input: " + maxInput + "\n"; s += " max output: " + maxOutput + "\n"; s += " compatibility: " + compatibility + "\n"; s += " state size: " + stateSize + "\n"; return s; } }jcodings-jcodings-1.0.11/src/org/jcodings/transcode/TranscoderDB.java000066400000000000000000000273131223451536200255160ustar00rootroot00000000000000/* * Permission is hereby granted, free of charge, to any person obtaining a copy of * this software and associated documentation files (the "Software"), to deal in * the Software without restriction, including without limitation the rights to * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies * of the Software, and to permit persons to whom the Software is furnished to do * so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ package org.jcodings.transcode; import static org.jcodings.transcode.EConv.NULL_STRING; import static org.jcodings.util.CaseInsensitiveBytesHash.caseInsensitiveEquals; import java.util.Arrays; import org.jcodings.ObjPtr; import org.jcodings.exception.ErrorMessages; import org.jcodings.exception.TranscoderException; import org.jcodings.transcode.Transcoder.GenericTranscoderEntry; import org.jcodings.util.CaseInsensitiveBytesHash; import org.jcodings.util.Hash; public class TranscoderDB implements EConvFlags { public static final class Entry { private String transcoderClass; private final byte[] source, destination; private Transcoder transcoder; private Entry(byte[] source, byte[] destination) { this.source = source; this.destination = destination; } public byte[] getSource() { return source; } public byte[] getDestination() { return destination; } /* load_transcoder_entry */ public Transcoder getTranscoder() { if (transcoder == null) { if (transcoderClass != null) { transcoder = Transcoder.load(transcoderClass); } else { GenericTranscoderEntry[] list = TranscoderList.GENERIC_LIST; for (int i = 0; i < list.length; i++) { GenericTranscoderEntry entry = list[i]; if (Arrays.equals(source, entry.source) && Arrays.equals(destination, entry.destination)) { transcoder = entry.createTranscoder(); break; } } } } return transcoder; } } public static final CaseInsensitiveBytesHash> transcoders = new CaseInsensitiveBytesHash>(); /* make_transcoder_entry */ static Entry makeEntry(byte[] source, byte[] destination) { CaseInsensitiveBytesHash sHash = transcoders.get(source); if (sHash == null) { sHash = new CaseInsensitiveBytesHash(); transcoders.putDirect(source, sHash); } Entry entry = sHash.get(destination); if (entry == null) { entry = new Entry(source, destination); sHash.putDirect(destination, entry); } else { throw new TranscoderException(ErrorMessages.ERR_TRANSCODER_ALREADY_REGISTERED, new String(source + " to " + new String(destination))); } return entry; } /* get_transcoder_entry */ static Entry getEntry(byte[] source, byte[] destination) { CaseInsensitiveBytesHash sHash = transcoders.get(source); return sHash == null ? null : sHash.get(destination); } /* rb_register_transcoder */ static void register(Transcoder transcoder) { Entry entry = makeEntry(transcoder.source, transcoder.destination); if (entry.transcoder != null) throw new TranscoderException(ErrorMessages.ERR_TRANSCODER_ALREADY_REGISTERED, new String(transcoder.source + " to " + new String(transcoder.destination))); entry.transcoder = transcoder; } /* declare_transcoder */ static void declare(byte[] source, byte[] destination, String transcoderClass) { Entry entry = makeEntry(source, destination); entry.transcoderClass = transcoderClass; } static final class SearchPathQueue { ObjPtr next = new ObjPtr(); byte[] encoding; } interface SearchPathCallback { void call(byte[] source, byte[] destination, int depth); } /* transcode_search_path */ static int searchPath(byte[] source, byte[] destination, SearchPathCallback callback) { if (caseInsensitiveEquals(source, destination)) return -1; ObjPtr bfsQueue = new ObjPtr(); SearchPathQueue queue = new SearchPathQueue(); queue.encoding = source; ObjPtr bfsLastQueue = queue.next; bfsQueue.p = queue; CaseInsensitiveBytesHash bfsVisited = new CaseInsensitiveBytesHash(); bfsVisited.put(source, NULL_STRING); while (bfsQueue.p != null) { queue = bfsQueue.p; bfsQueue.p = queue.next.p; if (bfsQueue.p == null) bfsLastQueue = bfsQueue; CaseInsensitiveBytesHash table2 = transcoders.get(queue.encoding); if (table2 == null) continue; Entry entry = table2.get(destination); if (entry != null) { bfsVisited.put(destination, queue.encoding); byte[] enc = destination; int depth, pathLength = 0; while (true) { byte[] tmp = bfsVisited.get(enc); if (tmp == NULL_STRING) break; pathLength++; enc = tmp; } depth = pathLength; enc = destination; while (true) { byte[] tmp = bfsVisited.get(enc); if (tmp == NULL_STRING) break; callback.call(tmp, enc, --depth); enc = tmp; } return pathLength; } else { byte[] bfsBaseEnc = queue.encoding; for (Hash.HashEntry o : table2.entryIterator()) { CaseInsensitiveBytesHash.CaseInsensitiveBytesHashEntry e = (CaseInsensitiveBytesHash.CaseInsensitiveBytesHashEntry) o; byte[] dname = e.bytes; if (bfsVisited.get(dname) == null) { SearchPathQueue q = new SearchPathQueue(); q.encoding = dname; q.next.p = null; bfsLastQueue.p = q; bfsLastQueue = q.next; bfsVisited.putDirect(dname, bfsBaseEnc); } } bfsBaseEnc = null; } } // while return -1; } /* rb_econv_open_by_transcoder_entries */ private static EConv openByTrascoderEntries(int n, Entry[] entries) { EConv econv = new EConv(n); for (int i = 0; i < n; i++) { Transcoder transcoder = entries[i].getTranscoder(); econv.addTranscoderAt(transcoder, econv.numTranscoders); } return econv; } /* rb_econv_open0 */ private static EConv open0(byte[] source, byte[] destination, int ecflags) { // final Encoding senc = EncodingDB.getEncodings().get(source).getEncoding(); // final Encoding denc = EncodingDB.getEncodings().get(destination).getEncoding(); final int numTrans; final Entry[] entries; if (source.length == 0 && destination.length == 0) { numTrans = 0; entries = null; } else { final ObjPtr lentries = new ObjPtr(); numTrans = searchPath(source, destination, new SearchPathCallback() { int additional = 0; public void call(byte[] source, byte[] destination, int depth) { if (lentries.p == null) lentries.p = new Entry[depth + 1 + additional]; lentries.p[depth] = getEntry(source, destination); } }); entries = lentries.p; } EConv econv = openByTrascoderEntries(numTrans, entries); econv.flags = ecflags; econv.source = source; econv.destination = destination; return econv; } /* decorator_names */ private static int decoratorNames(int ecflags, byte[][] decorators) { switch (ecflags & NEWLINE_DECORATOR_MASK) { case UNIVERSAL_NEWLINE_DECORATOR: case CRLF_NEWLINE_DECORATOR: case CR_NEWLINE_DECORATOR: case 0: break; default: return -1; } if (((ecflags & XML_TEXT_DECORATOR) != 0) && ((ecflags & XML_ATTR_CONTENT_DECORATOR) != 0)) return -1; int num = 0; if ((ecflags & XML_TEXT_DECORATOR) != 0) decorators[num++] = "xml_text_escape".getBytes(); if ((ecflags & XML_ATTR_CONTENT_DECORATOR) != 0) decorators[num++] = "xml_attr_content_escape".getBytes(); if ((ecflags & XML_ATTR_QUOTE_DECORATOR) != 0) decorators[num++] = "xml_attr_quote".getBytes(); if ((ecflags & CRLF_NEWLINE_DECORATOR) != 0) decorators[num++] = "crlf_newline".getBytes(); if ((ecflags & CR_NEWLINE_DECORATOR) != 0) decorators[num++] = "cr_newline".getBytes(); if ((ecflags & UNIVERSAL_NEWLINE_DECORATOR) != 0) decorators[num] = "universal_newline".getBytes(); return num; } /* rb_econv_open */ static EConv open(byte[] source, byte[] destination, int ecflags) { byte[][] decorators = new byte[MAX_ECFLAGS_DECORATORS][]; int num = decoratorNames(ecflags, decorators); if (num == -1) return null; EConv econv = open0(source, destination, ecflags & ERROR_HANDLER_MASK); for (int i = 0; i < num; i++) { if (!econv.decorateAtLast(decorators[i])) { econv.close(); return null; } } econv.flags |= ecflags & ~ERROR_HANDLER_MASK; return econv; } /* rb_econv_asciicompat_encoding */// ?? to transcoderdb ? static byte[] asciiCompatibleEncoding(byte[] asciiCompatName) { CaseInsensitiveBytesHash dTable = TranscoderDB.transcoders.get(asciiCompatName); if (dTable == null || dTable.size() != 1) return null; byte[] asciiCN = null; for (Entry e : dTable) { if (!EConv.decorator(e.source, e.destination)) { Transcoder transcoder = e.getTranscoder(); if (transcoder != null && transcoder.compatibility.isDecoder()) { asciiCN = transcoder.destination; break; } } } return asciiCN; } static { String[][] transList = TranscoderList.LIST; for (int i = 0; i < transList.length; i++) { String[] trans = transList[i]; declare(trans[0].getBytes(), trans[1].getBytes(), trans[2]); } } } jcodings-jcodings-1.0.11/src/org/jcodings/transcode/TranscoderList.java000066400000000000000000001031171223451536200261410ustar00rootroot00000000000000/* * Permission is hereby granted, free of charge, to any person obtaining a copy of * this software and associated documentation files (the "Software"), to deal in * the Software without restriction, including without limitation the rights to * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies * of the Software, and to permit persons to whom the Software is furnished to do * so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ package org.jcodings.transcode; import org.jcodings.transcode.Transcoder.GenericTranscoderEntry; final class TranscoderList { static final String[][] LIST = new String[][] { {"Big5", "UTF-8", null /*From_Big5*/}, {"UTF-8", "Big5", null /*To_Big5*/}, {"CP950", "UTF-8", null /*From_CP950*/}, {"UTF-8", "CP950", null /*To_CP950*/}, {"Big5-HKSCS", "UTF-8", null /*From_Big5_HKSCS*/}, {"UTF-8", "Big5-HKSCS", null /*To_Big5_HKSCS*/}, {"CP951", "UTF-8", null /*From_CP951*/}, {"UTF-8", "CP951", null /*To_CP951*/}, {"Big5-UAO", "UTF-8", null /*From_Big5_UAO*/}, {"UTF-8", "Big5-UAO", null /*To_Big5_UAO*/}, {"GB2312", "UTF-8", null /*From_GB2312*/}, {"GB12345", "UTF-8", null /*From_GB12345*/}, {"UTF-8", "GB2312", null /*To_GB2312*/}, {"UTF-8", "GB12345", null /*To_GB12345*/}, {"UTF8-DoCoMo", "UTF8-KDDI", null /*From_UTF8_DoCoMo_to_UTF8_KDDI*/}, {"UTF8-DoCoMo", "UTF8-SoftBank", null /*From_UTF8_DoCoMo_to_UTF8_SoftBank*/}, {"UTF8-DoCoMo", "UTF-8", null /*From_UTF8_DoCoMo*/}, {"UTF8-KDDI", "UTF8-DoCoMo", null /*From_UTF8_KDDI_to_UTF8_DoCoMo*/}, {"UTF8-KDDI", "UTF8-SoftBank", null /*From_UTF8_KDDI_to_UTF8_SoftBank*/}, {"UTF8-KDDI", "UTF-8", null /*From_UTF8_KDDI*/}, {"UTF8-SoftBank", "UTF8-DoCoMo", null /*From_UTF8_SoftBank_to_UTF8_DoCoMo*/}, {"UTF8-SoftBank", "UTF8-KDDI", null /*From_UTF8_SoftBank_to_UTF8_KDDI*/}, {"UTF8-SoftBank", "UTF-8", null /*From_UTF8_SoftBank*/}, {"UTF-8", "UTF8-DoCoMo", null /*To_UTF8_DoCoMo*/}, {"UTF-8", "UTF8-KDDI", null /*To_UTF8_KDDI*/}, {"UTF-8", "UTF8-SoftBank", null /*To_UTF8_SoftBank*/}, {"stateless-ISO-2022-JP-KDDI", "UTF8-KDDI", null /*From_stateless_ISO_2022_JP_KDDI_to_UTF8_KDDI*/}, {"UTF8-KDDI", "stateless-ISO-2022-JP-KDDI", null /*From_UTF8_KDDI_to_stateless_ISO_2022_JP_KDDI*/}, {"ISO-2022-JP-KDDI", "stateless-ISO-2022-JP-KDDI", "Iso2022jp_kddi_decoder"}, {"stateless-ISO-2022-JP-KDDI", "ISO-2022-JP-KDDI", "Iso2022jp_kddi_encoder"}, {"SJIS-DOCOMO", "UTF8-DOCOMO", null /*From_SJIS_DOCOMO_to_UTF8_DOCOMO*/}, {"UTF8-DOCOMO", "SJIS-DOCOMO", null /*From_UTF8_DOCOMO_to_SJIS_DOCOMO*/}, {"SJIS-KDDI", "UTF8-KDDI", null /*From_SJIS_KDDI_to_UTF8_KDDI*/}, {"UTF8-KDDI", "SJIS-KDDI", null /*From_UTF8_KDDI_to_SJIS_KDDI*/}, {"SJIS-SoftBank", "UTF8-SoftBank", null /*From_SJIS_SoftBank_to_UTF8_SoftBank*/}, {"UTF8-SoftBank", "SJIS-SoftBank", null /*From_UTF8_SoftBank_to_SJIS_SoftBank*/}, {"", "amp_escape", null /*From__to_amp_escape*/}, {"", "xml_text_escape", null /*From__to_xml_text_escape*/}, {"", "xml_attr_content_escape", null /*From__to_xml_attr_content_escape*/}, {"", "xml_attr_quote", "Escape_xml_attr_quote"}, {"GB18030", "UTF-8", "From_GB18030"}, {"UTF-8", "GB18030", "To_GB18030"}, {"GBK", "UTF-8", null /*From_GBK*/}, {"UTF-8", "GBK", null /*To_GBK*/}, {"ISO-2022-JP", "stateless-ISO-2022-JP", "Iso2022jp_decoder"}, {"stateless-ISO-2022-JP", "ISO-2022-JP", "Iso2022jp_encoder"}, {"stateless-ISO-2022-JP", "EUC-JP", "Stateless_iso2022jp_to_eucjp"}, {"EUC-JP", "stateless-ISO-2022-JP", "Eucjp_to_stateless_iso2022jp"}, {"CP50220", "cp51932", "Cp50220_decoder"}, {"CP50221", "cp51932", "Cp50221_decoder"}, {"CP51932", "CP50221", "Cp50221_encoder"}, {"CP51932", "CP50220", "Cp50220_encoder"}, {"EUC-JP", "Shift_JIS", "Eucjp2sjis"}, {"Shift_JIS", "EUC-JP", "Sjis2eucjp"}, {"EUC-JP", "UTF-8", null /*From_EUC_JP*/}, {"eucJP-ms", "UTF-8", null /*From_eucJP_ms*/}, {"CP51932", "UTF-8", null /*From_CP51932*/}, {"UTF-8", "EUC-JP", null /*To_EUC_JP*/}, {"UTF-8", "eucJP-ms", null /*To_eucJP_ms*/}, {"UTF-8", "CP51932", null /*To_CP51932*/}, {"Shift_JIS", "UTF-8", null /*From_Shift_JIS*/}, {"Windows-31J", "UTF-8", null /*From_Windows_31J*/}, {"UTF-8", "Shift_JIS", null /*To_Shift_JIS*/}, {"UTF-8", "Windows-31J", null /*To_Windows_31J*/}, {"UTF-8", "EUC-KR", null /*To_EUC_KR*/}, {"EUC-KR", "UTF-8", null /*From_EUC_KR*/}, {"UTF-8", "CP949", null /*To_CP949*/}, {"CP949", "UTF-8", null /*From_CP949*/}, {"US-ASCII", "UTF-8", null /*From_US_ASCII*/}, {"UTF-8", "US-ASCII", null /*To_US_ASCII*/}, {"ASCII-8BIT", "UTF-8", null /*From_ASCII_8BIT*/}, {"UTF-8", "ASCII-8BIT", null /*To_ASCII_8BIT*/}, {"ISO-8859-1", "UTF-8", null /*From_ISO_8859_1*/}, {"UTF-8", "ISO-8859-1", null /*To_ISO_8859_1*/}, {"ISO-8859-2", "UTF-8", null /*From_ISO_8859_2*/}, {"UTF-8", "ISO-8859-2", null /*To_ISO_8859_2*/}, {"ISO-8859-3", "UTF-8", null /*From_ISO_8859_3*/}, {"UTF-8", "ISO-8859-3", null /*To_ISO_8859_3*/}, {"ISO-8859-4", "UTF-8", null /*From_ISO_8859_4*/}, {"UTF-8", "ISO-8859-4", null /*To_ISO_8859_4*/}, {"ISO-8859-5", "UTF-8", null /*From_ISO_8859_5*/}, {"UTF-8", "ISO-8859-5", null /*To_ISO_8859_5*/}, {"ISO-8859-6", "UTF-8", null /*From_ISO_8859_6*/}, {"UTF-8", "ISO-8859-6", null /*To_ISO_8859_6*/}, {"ISO-8859-7", "UTF-8", null /*From_ISO_8859_7*/}, {"UTF-8", "ISO-8859-7", null /*To_ISO_8859_7*/}, {"ISO-8859-8", "UTF-8", null /*From_ISO_8859_8*/}, {"UTF-8", "ISO-8859-8", null /*To_ISO_8859_8*/}, {"ISO-8859-9", "UTF-8", null /*From_ISO_8859_9*/}, {"UTF-8", "ISO-8859-9", null /*To_ISO_8859_9*/}, {"ISO-8859-10", "UTF-8", null /*From_ISO_8859_10*/}, {"UTF-8", "ISO-8859-10", null /*To_ISO_8859_10*/}, {"ISO-8859-11", "UTF-8", null /*From_ISO_8859_11*/}, {"UTF-8", "ISO-8859-11", null /*To_ISO_8859_11*/}, {"ISO-8859-13", "UTF-8", null /*From_ISO_8859_13*/}, {"UTF-8", "ISO-8859-13", null /*To_ISO_8859_13*/}, {"ISO-8859-14", "UTF-8", null /*From_ISO_8859_14*/}, {"UTF-8", "ISO-8859-14", null /*To_ISO_8859_14*/}, {"ISO-8859-15", "UTF-8", null /*From_ISO_8859_15*/}, {"UTF-8", "ISO-8859-15", null /*To_ISO_8859_15*/}, {"WINDOWS-874", "UTF-8", null /*From_WINDOWS_874*/}, {"UTF-8", "WINDOWS-874", null /*To_WINDOWS_874*/}, {"WINDOWS-1250", "UTF-8", null /*From_WINDOWS_1250*/}, {"UTF-8", "WINDOWS-1250", null /*To_WINDOWS_1250*/}, {"WINDOWS-1251", "UTF-8", null /*From_WINDOWS_1251*/}, {"UTF-8", "WINDOWS-1251", null /*To_WINDOWS_1251*/}, {"WINDOWS-1252", "UTF-8", null /*From_WINDOWS_1252*/}, {"UTF-8", "WINDOWS-1252", null /*To_WINDOWS_1252*/}, {"WINDOWS-1253", "UTF-8", null /*From_WINDOWS_1253*/}, {"UTF-8", "WINDOWS-1253", null /*To_WINDOWS_1253*/}, {"WINDOWS-1254", "UTF-8", null /*From_WINDOWS_1254*/}, {"UTF-8", "WINDOWS-1254", null /*To_WINDOWS_1254*/}, {"WINDOWS-1255", "UTF-8", null /*From_WINDOWS_1255*/}, {"UTF-8", "WINDOWS-1255", null /*To_WINDOWS_1255*/}, {"WINDOWS-1256", "UTF-8", null /*From_WINDOWS_1256*/}, {"UTF-8", "WINDOWS-1256", null /*To_WINDOWS_1256*/}, {"WINDOWS-1257", "UTF-8", null /*From_WINDOWS_1257*/}, {"UTF-8", "WINDOWS-1257", null /*To_WINDOWS_1257*/}, {"IBM437", "UTF-8", null /*From_IBM437*/}, {"UTF-8", "IBM437", null /*To_IBM437*/}, {"IBM775", "UTF-8", null /*From_IBM775*/}, {"UTF-8", "IBM775", null /*To_IBM775*/}, {"IBM737", "UTF-8", null /*From_IBM737*/}, {"UTF-8", "IBM737", null /*To_IBM737*/}, {"IBM852", "UTF-8", null /*From_IBM852*/}, {"UTF-8", "IBM852", null /*To_IBM852*/}, {"IBM855", "UTF-8", null /*From_IBM855*/}, {"UTF-8", "IBM855", null /*To_IBM855*/}, {"IBM857", "UTF-8", null /*From_IBM857*/}, {"UTF-8", "IBM857", null /*To_IBM857*/}, {"IBM860", "UTF-8", null /*From_IBM860*/}, {"UTF-8", "IBM860", null /*To_IBM860*/}, {"IBM861", "UTF-8", null /*From_IBM861*/}, {"UTF-8", "IBM861", null /*To_IBM861*/}, {"IBM862", "UTF-8", null /*From_IBM862*/}, {"UTF-8", "IBM862", null /*To_IBM862*/}, {"IBM863", "UTF-8", null /*From_IBM863*/}, {"UTF-8", "IBM863", null /*To_IBM863*/}, {"IBM865", "UTF-8", null /*From_IBM865*/}, {"UTF-8", "IBM865", null /*To_IBM865*/}, {"IBM866", "UTF-8", null /*From_IBM866*/}, {"UTF-8", "IBM866", null /*To_IBM866*/}, {"IBM869", "UTF-8", null /*From_IBM869*/}, {"UTF-8", "IBM869", null /*To_IBM869*/}, {"MACCROATIAN", "UTF-8", null /*From_MACCROATIAN*/}, {"UTF-8", "MACCROATIAN", null /*To_MACCROATIAN*/}, {"MACCYRILLIC", "UTF-8", null /*From_MACCYRILLIC*/}, {"UTF-8", "MACCYRILLIC", null /*To_MACCYRILLIC*/}, {"MACGREEK", "UTF-8", null /*From_MACGREEK*/}, {"UTF-8", "MACGREEK", null /*To_MACGREEK*/}, {"MACICELAND", "UTF-8", null /*From_MACICELAND*/}, {"UTF-8", "MACICELAND", null /*To_MACICELAND*/}, {"MACROMAN", "UTF-8", null /*From_MACROMAN*/}, {"UTF-8", "MACROMAN", null /*To_MACROMAN*/}, {"MACROMANIA", "UTF-8", null /*From_MACROMANIA*/}, {"UTF-8", "MACROMANIA", null /*To_MACROMANIA*/}, {"MACTURKISH", "UTF-8", null /*From_MACTURKISH*/}, {"UTF-8", "MACTURKISH", null /*To_MACTURKISH*/}, {"MACUKRAINE", "UTF-8", null /*From_MACUKRAINE*/}, {"UTF-8", "MACUKRAINE", null /*To_MACUKRAINE*/}, {"KOI8-U", "UTF-8", null /*From_KOI8_U*/}, {"UTF-8", "KOI8-U", null /*To_KOI8_U*/}, {"KOI8-R", "UTF-8", null /*From_KOI8_R*/}, {"UTF-8", "KOI8-R", null /*To_KOI8_R*/}, {"TIS-620", "UTF-8", null /*From_TIS_620*/}, {"UTF-8", "TIS-620", null /*To_TIS_620*/}, {"CP850", "UTF-8", null /*From_CP850*/}, {"UTF-8", "CP850", null /*To_CP850*/}, {"CP852", "UTF-8", null /*From_CP852*/}, {"UTF-8", "CP852", null /*To_CP852*/}, {"CP855", "UTF-8", null /*From_CP855*/}, {"UTF-8", "CP855", null /*To_CP855*/}, {"UTF-8", "UTF8-MAC", null /*To_UTF8_MAC*/}, {"UTF8-MAC", "UTF-8", "From_UTF8_MAC"}, {"UTF-16BE", "UTF-8", "From_UTF_16BE"}, {"UTF-8", "UTF-16BE", "To_UTF_16BE"}, {"UTF-16LE", "UTF-8", "From_UTF_16LE"}, {"UTF-8", "UTF-16LE", "To_UTF_16LE"}, {"UTF-32BE", "UTF-8", "From_UTF_32BE"}, {"UTF-8", "UTF-32BE", "To_UTF_32BE"}, {"UTF-32LE", "UTF-8", "From_UTF_32LE"}, {"UTF-8", "UTF-32LE", "To_UTF_32LE"}, {"UTF-16", "UTF-8", "From_UTF_16"}, {"UTF-32", "UTF-8", "From_UTF_32"}, {"UTF-8", "UTF-16", "To_UTF_16"}, {"UTF-8", "UTF-32", "To_UTF_32"} }; static final GenericTranscoderEntry[] GENERIC_LIST = new GenericTranscoderEntry[] { new GenericTranscoderEntry("Big5", "UTF-8", 57100, "Big5", 1, 2, 1, AsciiCompatibility.CONVERTER, 0), new GenericTranscoderEntry("UTF-8", "Big5", 120168, "Big5", 1, 4, 2, AsciiCompatibility.CONVERTER, 0), new GenericTranscoderEntry("CP950", "UTF-8", 144368, "Big5", 1, 2, 1, AsciiCompatibility.CONVERTER, 0), new GenericTranscoderEntry("UTF-8", "CP950", 172296, "Big5", 1, 4, 2, AsciiCompatibility.CONVERTER, 0), new GenericTranscoderEntry("Big5-HKSCS", "UTF-8", 195416, "Big5", 1, 2, 1, AsciiCompatibility.CONVERTER, 0), new GenericTranscoderEntry("UTF-8", "Big5-HKSCS", 288228, "Big5", 1, 4, 2, AsciiCompatibility.CONVERTER, 0), new GenericTranscoderEntry("CP951", "UTF-8", 309868, "Big5", 1, 2, 1, AsciiCompatibility.CONVERTER, 0), new GenericTranscoderEntry("UTF-8", "CP951", 325724, "Big5", 1, 4, 2, AsciiCompatibility.CONVERTER, 0), new GenericTranscoderEntry("Big5-UAO", "UTF-8", 351812, "Big5", 1, 2, 1, AsciiCompatibility.CONVERTER, 0), new GenericTranscoderEntry("UTF-8", "Big5-UAO", 436940, "Big5", 1, 4, 2, AsciiCompatibility.CONVERTER, 0), new GenericTranscoderEntry("GB2312", "UTF-8", 31136, "Chinese", 1, 2, 1, AsciiCompatibility.CONVERTER, 0), new GenericTranscoderEntry("GB12345", "UTF-8", 59848, "Chinese", 1, 2, 1, AsciiCompatibility.CONVERTER, 0), new GenericTranscoderEntry("UTF-8", "GB2312", 96820, "Chinese", 1, 4, 2, AsciiCompatibility.CONVERTER, 0), new GenericTranscoderEntry("UTF-8", "GB12345", 130816, "Chinese", 1, 4, 2, AsciiCompatibility.CONVERTER, 0), new GenericTranscoderEntry("UTF8-DoCoMo", "UTF8-KDDI", 1176, "Emoji", 1, 4, 6, AsciiCompatibility.CONVERTER, 0), new GenericTranscoderEntry("UTF8-DoCoMo", "UTF8-SoftBank", 2148, "Emoji", 1, 4, 6, AsciiCompatibility.CONVERTER, 0), new GenericTranscoderEntry("UTF8-DoCoMo", "UTF-8", 2616, "Emoji", 1, 4, 4, AsciiCompatibility.CONVERTER, 0), new GenericTranscoderEntry("UTF8-KDDI", "UTF8-DoCoMo", 5684, "Emoji", 1, 4, 6, AsciiCompatibility.CONVERTER, 0), new GenericTranscoderEntry("UTF8-KDDI", "UTF8-SoftBank", 9996, "Emoji", 1, 4, 6, AsciiCompatibility.CONVERTER, 0), new GenericTranscoderEntry("UTF8-KDDI", "UTF-8", 11544, "Emoji", 1, 4, 8, AsciiCompatibility.CONVERTER, 0), new GenericTranscoderEntry("UTF8-SoftBank", "UTF8-DoCoMo", 12784, "Emoji", 1, 4, 6, AsciiCompatibility.CONVERTER, 0), new GenericTranscoderEntry("UTF8-SoftBank", "UTF8-KDDI", 14812, "Emoji", 1, 4, 3, AsciiCompatibility.CONVERTER, 0), new GenericTranscoderEntry("UTF8-SoftBank", "UTF-8", 15460, "Emoji", 1, 4, 8, AsciiCompatibility.CONVERTER, 0), new GenericTranscoderEntry("UTF-8", "UTF8-DoCoMo", 17620, "Emoji", 1, 4, 6, AsciiCompatibility.CONVERTER, 0), new GenericTranscoderEntry("UTF-8", "UTF8-KDDI", 21120, "Emoji", 1, 4, 6, AsciiCompatibility.CONVERTER, 0), new GenericTranscoderEntry("UTF-8", "UTF8-SoftBank", 24060, "Emoji", 1, 4, 6, AsciiCompatibility.CONVERTER, 0), new GenericTranscoderEntry("stateless-ISO-2022-JP-KDDI", "UTF8-KDDI", 33996, "EmojiIso2022Kddi", 1, 3, 1, AsciiCompatibility.CONVERTER, 0), new GenericTranscoderEntry("UTF8-KDDI", "stateless-ISO-2022-JP-KDDI", 76404, "EmojiIso2022Kddi", 1, 4, 3, AsciiCompatibility.CONVERTER, 0), new GenericTranscoderEntry("ISO-2022-JP-KDDI", "stateless-ISO-2022-JP-KDDI", 56, "EmojiIso2022Kddi", 1, 3, 3, AsciiCompatibility.DECODER, 1), new GenericTranscoderEntry("stateless-ISO-2022-JP-KDDI", "ISO-2022-JP-KDDI", 108, "EmojiIso2022Kddi", 1, 3, 5, AsciiCompatibility.ENCODER, 1), new GenericTranscoderEntry("SJIS-DOCOMO", "UTF8-DOCOMO", 39616, "EmojiSjisDocomo", 1, 2, 1, AsciiCompatibility.CONVERTER, 0), new GenericTranscoderEntry("UTF8-DOCOMO", "SJIS-DOCOMO", 84704, "EmojiSjisDocomo", 1, 4, 2, AsciiCompatibility.CONVERTER, 0), new GenericTranscoderEntry("SJIS-KDDI", "UTF8-KDDI", 39616, "EmojiSjisKddi", 1, 2, 1, AsciiCompatibility.CONVERTER, 0), new GenericTranscoderEntry("UTF8-KDDI", "SJIS-KDDI", 88668, "EmojiSjisKddi", 1, 4, 2, AsciiCompatibility.CONVERTER, 0), new GenericTranscoderEntry("SJIS-SoftBank", "UTF8-SoftBank", 39616, "EmojiSjisSoftbank", 1, 2, 1, AsciiCompatibility.CONVERTER, 0), new GenericTranscoderEntry("UTF8-SoftBank", "SJIS-SoftBank", 84704, "EmojiSjisSoftbank", 1, 4, 2, AsciiCompatibility.CONVERTER, 0), new GenericTranscoderEntry("", "amp_escape", 8, "Escape", 1, 1, 5, AsciiCompatibility.CONVERTER, 0), new GenericTranscoderEntry("", "xml_text_escape", 32, "Escape", 1, 1, 5, AsciiCompatibility.CONVERTER, 0), new GenericTranscoderEntry("", "xml_attr_content_escape", 60, "Escape", 1, 1, 6, AsciiCompatibility.CONVERTER, 0), new GenericTranscoderEntry("", "xml_attr_quote", 72, "Escape", 1, 1, 7, AsciiCompatibility.ENCODER, 1), new GenericTranscoderEntry("GB18030", "UTF-8", 57668, "Gb18030", 1, 4, 4, AsciiCompatibility.CONVERTER, 0), new GenericTranscoderEntry("UTF-8", "GB18030", 115576, "Gb18030", 1, 4, 4, AsciiCompatibility.CONVERTER, 0), new GenericTranscoderEntry("GBK", "UTF-8", 89284, "Gbk", 1, 2, 1, AsciiCompatibility.CONVERTER, 0), new GenericTranscoderEntry("UTF-8", "GBK", 182912, "Gbk", 1, 4, 2, AsciiCompatibility.CONVERTER, 0), new GenericTranscoderEntry("ISO-2022-JP", "stateless-ISO-2022-JP", 56, "Iso2022", 1, 3, 3, AsciiCompatibility.DECODER, 1), new GenericTranscoderEntry("stateless-ISO-2022-JP", "ISO-2022-JP", 108, "Iso2022", 1, 3, 5, AsciiCompatibility.ENCODER, 1), new GenericTranscoderEntry("stateless-ISO-2022-JP", "EUC-JP", 128, "Iso2022", 1, 3, 2, AsciiCompatibility.CONVERTER, 0), new GenericTranscoderEntry("EUC-JP", "stateless-ISO-2022-JP", 192, "Iso2022", 1, 3, 3, AsciiCompatibility.CONVERTER, 0), new GenericTranscoderEntry("CP50220", "cp51932", 244, "Iso2022", 1, 3, 3, AsciiCompatibility.DECODER, 1), new GenericTranscoderEntry("CP50221", "cp51932", 244, "Iso2022", 1, 3, 3, AsciiCompatibility.DECODER, 1), new GenericTranscoderEntry("CP51932", "CP50221", 268, "Iso2022", 1, 3, 5, AsciiCompatibility.ENCODER, 1), new GenericTranscoderEntry("CP51932", "CP50220", 268, "Iso2022", 1, 3, 5, AsciiCompatibility.ENCODER, 3), new GenericTranscoderEntry("EUC-JP", "Shift_JIS", 88, "Japanese", 1, 3, 2, AsciiCompatibility.CONVERTER, 0), new GenericTranscoderEntry("Shift_JIS", "EUC-JP", 132, "Japanese", 1, 2, 2, AsciiCompatibility.CONVERTER, 0), new GenericTranscoderEntry("EUC-JP", "UTF-8", 54488, "JapaneseEuc", 1, 3, 1, AsciiCompatibility.CONVERTER, 0), new GenericTranscoderEntry("eucJP-ms", "UTF-8", 64480, "JapaneseEuc", 1, 3, 1, AsciiCompatibility.CONVERTER, 0), new GenericTranscoderEntry("CP51932", "UTF-8", 66380, "JapaneseEuc", 1, 2, 1, AsciiCompatibility.CONVERTER, 0), new GenericTranscoderEntry("UTF-8", "EUC-JP", 125780, "JapaneseEuc", 1, 4, 3, AsciiCompatibility.CONVERTER, 0), new GenericTranscoderEntry("UTF-8", "eucJP-ms", 144752, "JapaneseEuc", 1, 4, 3, AsciiCompatibility.CONVERTER, 0), new GenericTranscoderEntry("UTF-8", "CP51932", 179440, "JapaneseEuc", 1, 4, 2, AsciiCompatibility.CONVERTER, 0), new GenericTranscoderEntry("Shift_JIS", "UTF-8", 28448, "JapaneseSjis", 1, 2, 1, AsciiCompatibility.CONVERTER, 0), new GenericTranscoderEntry("Windows-31J", "UTF-8", 40648, "JapaneseSjis", 1, 2, 1, AsciiCompatibility.CONVERTER, 0), new GenericTranscoderEntry("UTF-8", "Shift_JIS", 75704, "JapaneseSjis", 1, 4, 2, AsciiCompatibility.CONVERTER, 0), new GenericTranscoderEntry("UTF-8", "Windows-31J", 104500, "JapaneseSjis", 1, 4, 2, AsciiCompatibility.CONVERTER, 0), new GenericTranscoderEntry("UTF-8", "EUC-KR", 44104, "Korean", 1, 4, 2, AsciiCompatibility.CONVERTER, 0), new GenericTranscoderEntry("EUC-KR", "UTF-8", 78484, "Korean", 1, 2, 1, AsciiCompatibility.CONVERTER, 0), new GenericTranscoderEntry("UTF-8", "CP949", 126392, "Korean", 1, 4, 2, AsciiCompatibility.CONVERTER, 0), new GenericTranscoderEntry("CP949", "UTF-8", 196860, "Korean", 1, 2, 1, AsciiCompatibility.CONVERTER, 0), new GenericTranscoderEntry("US-ASCII", "UTF-8", 8, "SingleByte", 1, 1, 1, AsciiCompatibility.CONVERTER, 0), new GenericTranscoderEntry("UTF-8", "US-ASCII", 132, "SingleByte", 1, 4, 1, AsciiCompatibility.CONVERTER, 0), new GenericTranscoderEntry("ASCII-8BIT", "UTF-8", 148, "SingleByte", 1, 1, 1, AsciiCompatibility.CONVERTER, 0), new GenericTranscoderEntry("UTF-8", "ASCII-8BIT", 132, "SingleByte", 1, 4, 1, AsciiCompatibility.CONVERTER, 0), new GenericTranscoderEntry("ISO-8859-1", "UTF-8", 672, "SingleByte", 1, 1, 1, AsciiCompatibility.CONVERTER, 0), new GenericTranscoderEntry("UTF-8", "ISO-8859-1", 1260, "SingleByte", 1, 4, 1, AsciiCompatibility.CONVERTER, 0), new GenericTranscoderEntry("ISO-8859-2", "UTF-8", 1784, "SingleByte", 1, 1, 1, AsciiCompatibility.CONVERTER, 0), new GenericTranscoderEntry("UTF-8", "ISO-8859-2", 2440, "SingleByte", 1, 4, 1, AsciiCompatibility.CONVERTER, 0), new GenericTranscoderEntry("ISO-8859-3", "UTF-8", 2940, "SingleByte", 1, 1, 1, AsciiCompatibility.CONVERTER, 0), new GenericTranscoderEntry("UTF-8", "ISO-8859-3", 3568, "SingleByte", 1, 4, 1, AsciiCompatibility.CONVERTER, 0), new GenericTranscoderEntry("ISO-8859-4", "UTF-8", 4092, "SingleByte", 1, 1, 1, AsciiCompatibility.CONVERTER, 0), new GenericTranscoderEntry("UTF-8", "ISO-8859-4", 4748, "SingleByte", 1, 4, 1, AsciiCompatibility.CONVERTER, 0), new GenericTranscoderEntry("ISO-8859-5", "UTF-8", 5272, "SingleByte", 1, 1, 1, AsciiCompatibility.CONVERTER, 0), new GenericTranscoderEntry("UTF-8", "ISO-8859-5", 5928, "SingleByte", 1, 4, 1, AsciiCompatibility.CONVERTER, 0), new GenericTranscoderEntry("ISO-8859-6", "UTF-8", 6276, "SingleByte", 1, 1, 1, AsciiCompatibility.CONVERTER, 0), new GenericTranscoderEntry("UTF-8", "ISO-8859-6", 6712, "SingleByte", 1, 4, 1, AsciiCompatibility.CONVERTER, 0), new GenericTranscoderEntry("ISO-8859-7", "UTF-8", 7228, "SingleByte", 1, 1, 1, AsciiCompatibility.CONVERTER, 0), new GenericTranscoderEntry("UTF-8", "ISO-8859-7", 7912, "SingleByte", 1, 4, 1, AsciiCompatibility.CONVERTER, 0), new GenericTranscoderEntry("ISO-8859-8", "UTF-8", 8296, "SingleByte", 1, 1, 1, AsciiCompatibility.CONVERTER, 0), new GenericTranscoderEntry("UTF-8", "ISO-8859-8", 8808, "SingleByte", 1, 4, 1, AsciiCompatibility.CONVERTER, 0), new GenericTranscoderEntry("ISO-8859-9", "UTF-8", 9332, "SingleByte", 1, 1, 1, AsciiCompatibility.CONVERTER, 0), new GenericTranscoderEntry("UTF-8", "ISO-8859-9", 9696, "SingleByte", 1, 4, 1, AsciiCompatibility.CONVERTER, 0), new GenericTranscoderEntry("ISO-8859-10", "UTF-8", 10220, "SingleByte", 1, 1, 1, AsciiCompatibility.CONVERTER, 0), new GenericTranscoderEntry("UTF-8", "ISO-8859-10", 10896, "SingleByte", 1, 4, 1, AsciiCompatibility.CONVERTER, 0), new GenericTranscoderEntry("ISO-8859-11", "UTF-8", 11392, "SingleByte", 1, 1, 1, AsciiCompatibility.CONVERTER, 0), new GenericTranscoderEntry("UTF-8", "ISO-8859-11", 11992, "SingleByte", 1, 4, 1, AsciiCompatibility.CONVERTER, 0), new GenericTranscoderEntry("ISO-8859-13", "UTF-8", 12516, "SingleByte", 1, 1, 1, AsciiCompatibility.CONVERTER, 0), new GenericTranscoderEntry("UTF-8", "ISO-8859-13", 13192, "SingleByte", 1, 4, 1, AsciiCompatibility.CONVERTER, 0), new GenericTranscoderEntry("ISO-8859-14", "UTF-8", 13716, "SingleByte", 1, 1, 1, AsciiCompatibility.CONVERTER, 0), new GenericTranscoderEntry("UTF-8", "ISO-8859-14", 14452, "SingleByte", 1, 4, 1, AsciiCompatibility.CONVERTER, 0), new GenericTranscoderEntry("ISO-8859-15", "UTF-8", 14976, "SingleByte", 1, 1, 1, AsciiCompatibility.CONVERTER, 0), new GenericTranscoderEntry("UTF-8", "ISO-8859-15", 15360, "SingleByte", 1, 4, 1, AsciiCompatibility.CONVERTER, 0), new GenericTranscoderEntry("WINDOWS-874", "UTF-8", 15764, "SingleByte", 1, 1, 1, AsciiCompatibility.CONVERTER, 0), new GenericTranscoderEntry("UTF-8", "WINDOWS-874", 15928, "SingleByte", 1, 4, 1, AsciiCompatibility.CONVERTER, 0), new GenericTranscoderEntry("WINDOWS-1250", "UTF-8", 16436, "SingleByte", 1, 1, 1, AsciiCompatibility.CONVERTER, 0), new GenericTranscoderEntry("UTF-8", "WINDOWS-1250", 16992, "SingleByte", 1, 4, 1, AsciiCompatibility.CONVERTER, 0), new GenericTranscoderEntry("WINDOWS-1251", "UTF-8", 17516, "SingleByte", 1, 1, 1, AsciiCompatibility.CONVERTER, 0), new GenericTranscoderEntry("UTF-8", "WINDOWS-1251", 18152, "SingleByte", 1, 4, 1, AsciiCompatibility.CONVERTER, 0), new GenericTranscoderEntry("WINDOWS-1252", "UTF-8", 18660, "SingleByte", 1, 1, 1, AsciiCompatibility.CONVERTER, 0), new GenericTranscoderEntry("UTF-8", "WINDOWS-1252", 18960, "SingleByte", 1, 4, 1, AsciiCompatibility.CONVERTER, 0), new GenericTranscoderEntry("WINDOWS-1253", "UTF-8", 19420, "SingleByte", 1, 1, 1, AsciiCompatibility.CONVERTER, 0), new GenericTranscoderEntry("UTF-8", "WINDOWS-1253", 19932, "SingleByte", 1, 4, 1, AsciiCompatibility.CONVERTER, 0), new GenericTranscoderEntry("WINDOWS-1254", "UTF-8", 20432, "SingleByte", 1, 1, 1, AsciiCompatibility.CONVERTER, 0), new GenericTranscoderEntry("UTF-8", "WINDOWS-1254", 20548, "SingleByte", 1, 4, 1, AsciiCompatibility.CONVERTER, 0), new GenericTranscoderEntry("WINDOWS-1255", "UTF-8", 20984, "SingleByte", 1, 1, 1, AsciiCompatibility.CONVERTER, 0), new GenericTranscoderEntry("UTF-8", "WINDOWS-1255", 21756, "SingleByte", 1, 4, 3, AsciiCompatibility.CONVERTER, 0), new GenericTranscoderEntry("WINDOWS-1256", "UTF-8", 22280, "SingleByte", 1, 1, 1, AsciiCompatibility.CONVERTER, 0), new GenericTranscoderEntry("UTF-8", "WINDOWS-1256", 23024, "SingleByte", 1, 4, 1, AsciiCompatibility.CONVERTER, 0), new GenericTranscoderEntry("WINDOWS-1257", "UTF-8", 23504, "SingleByte", 1, 1, 1, AsciiCompatibility.CONVERTER, 0), new GenericTranscoderEntry("UTF-8", "WINDOWS-1257", 23724, "SingleByte", 1, 4, 1, AsciiCompatibility.CONVERTER, 0), new GenericTranscoderEntry("IBM437", "UTF-8", 24248, "SingleByte", 1, 1, 1, AsciiCompatibility.CONVERTER, 0), new GenericTranscoderEntry("UTF-8", "IBM437", 25084, "SingleByte", 1, 4, 1, AsciiCompatibility.CONVERTER, 0), new GenericTranscoderEntry("IBM775", "UTF-8", 25608, "SingleByte", 1, 1, 1, AsciiCompatibility.CONVERTER, 0), new GenericTranscoderEntry("UTF-8", "IBM775", 26252, "SingleByte", 1, 4, 1, AsciiCompatibility.CONVERTER, 0), new GenericTranscoderEntry("IBM737", "UTF-8", 26776, "SingleByte", 1, 1, 1, AsciiCompatibility.CONVERTER, 0), new GenericTranscoderEntry("UTF-8", "IBM737", 27288, "SingleByte", 1, 4, 1, AsciiCompatibility.CONVERTER, 0), new GenericTranscoderEntry("IBM852", "UTF-8", 27812, "SingleByte", 1, 1, 1, AsciiCompatibility.CONVERTER, 0), new GenericTranscoderEntry("UTF-8", "IBM852", 28428, "SingleByte", 1, 4, 1, AsciiCompatibility.CONVERTER, 0), new GenericTranscoderEntry("IBM855", "UTF-8", 28952, "SingleByte", 1, 1, 1, AsciiCompatibility.CONVERTER, 0), new GenericTranscoderEntry("UTF-8", "IBM855", 29504, "SingleByte", 1, 4, 1, AsciiCompatibility.CONVERTER, 0), new GenericTranscoderEntry("IBM857", "UTF-8", 30020, "SingleByte", 1, 1, 1, AsciiCompatibility.CONVERTER, 0), new GenericTranscoderEntry("UTF-8", "IBM857", 30532, "SingleByte", 1, 4, 1, AsciiCompatibility.CONVERTER, 0), new GenericTranscoderEntry("IBM860", "UTF-8", 31056, "SingleByte", 1, 1, 1, AsciiCompatibility.CONVERTER, 0), new GenericTranscoderEntry("UTF-8", "IBM860", 31444, "SingleByte", 1, 4, 1, AsciiCompatibility.CONVERTER, 0), new GenericTranscoderEntry("IBM861", "UTF-8", 31968, "SingleByte", 1, 1, 1, AsciiCompatibility.CONVERTER, 0), new GenericTranscoderEntry("UTF-8", "IBM861", 32280, "SingleByte", 1, 4, 1, AsciiCompatibility.CONVERTER, 0), new GenericTranscoderEntry("IBM862", "UTF-8", 32804, "SingleByte", 1, 1, 1, AsciiCompatibility.CONVERTER, 0), new GenericTranscoderEntry("UTF-8", "IBM862", 33048, "SingleByte", 1, 4, 1, AsciiCompatibility.CONVERTER, 0), new GenericTranscoderEntry("IBM863", "UTF-8", 33572, "SingleByte", 1, 1, 1, AsciiCompatibility.CONVERTER, 0), new GenericTranscoderEntry("UTF-8", "IBM863", 33952, "SingleByte", 1, 4, 1, AsciiCompatibility.CONVERTER, 0), new GenericTranscoderEntry("IBM865", "UTF-8", 34476, "SingleByte", 1, 1, 1, AsciiCompatibility.CONVERTER, 0), new GenericTranscoderEntry("UTF-8", "IBM865", 34788, "SingleByte", 1, 4, 1, AsciiCompatibility.CONVERTER, 0), new GenericTranscoderEntry("IBM866", "UTF-8", 35312, "SingleByte", 1, 1, 1, AsciiCompatibility.CONVERTER, 0), new GenericTranscoderEntry("UTF-8", "IBM866", 35768, "SingleByte", 1, 4, 1, AsciiCompatibility.CONVERTER, 0), new GenericTranscoderEntry("IBM869", "UTF-8", 36260, "SingleByte", 1, 1, 1, AsciiCompatibility.CONVERTER, 0), new GenericTranscoderEntry("UTF-8", "IBM869", 36776, "SingleByte", 1, 4, 1, AsciiCompatibility.CONVERTER, 0), new GenericTranscoderEntry("MACCROATIAN", "UTF-8", 37300, "SingleByte", 1, 1, 1, AsciiCompatibility.CONVERTER, 0), new GenericTranscoderEntry("UTF-8", "MACCROATIAN", 38132, "SingleByte", 1, 4, 1, AsciiCompatibility.CONVERTER, 0), new GenericTranscoderEntry("MACCYRILLIC", "UTF-8", 38656, "SingleByte", 1, 1, 1, AsciiCompatibility.CONVERTER, 0), new GenericTranscoderEntry("UTF-8", "MACCYRILLIC", 39360, "SingleByte", 1, 4, 1, AsciiCompatibility.CONVERTER, 0), new GenericTranscoderEntry("MACGREEK", "UTF-8", 39884, "SingleByte", 1, 1, 1, AsciiCompatibility.CONVERTER, 0), new GenericTranscoderEntry("UTF-8", "MACGREEK", 40584, "SingleByte", 1, 4, 1, AsciiCompatibility.CONVERTER, 0), new GenericTranscoderEntry("MACICELAND", "UTF-8", 41108, "SingleByte", 1, 1, 1, AsciiCompatibility.CONVERTER, 0), new GenericTranscoderEntry("UTF-8", "MACICELAND", 41824, "SingleByte", 1, 4, 1, AsciiCompatibility.CONVERTER, 0), new GenericTranscoderEntry("MACROMAN", "UTF-8", 42348, "SingleByte", 1, 1, 1, AsciiCompatibility.CONVERTER, 0), new GenericTranscoderEntry("UTF-8", "MACROMAN", 42832, "SingleByte", 1, 4, 1, AsciiCompatibility.CONVERTER, 0), new GenericTranscoderEntry("MACROMANIA", "UTF-8", 43356, "SingleByte", 1, 1, 1, AsciiCompatibility.CONVERTER, 0), new GenericTranscoderEntry("UTF-8", "MACROMANIA", 43732, "SingleByte", 1, 4, 1, AsciiCompatibility.CONVERTER, 0), new GenericTranscoderEntry("MACTURKISH", "UTF-8", 44252, "SingleByte", 1, 1, 1, AsciiCompatibility.CONVERTER, 0), new GenericTranscoderEntry("UTF-8", "MACTURKISH", 44608, "SingleByte", 1, 4, 1, AsciiCompatibility.CONVERTER, 0), new GenericTranscoderEntry("MACUKRAINE", "UTF-8", 45132, "SingleByte", 1, 1, 1, AsciiCompatibility.CONVERTER, 0), new GenericTranscoderEntry("UTF-8", "MACUKRAINE", 45356, "SingleByte", 1, 4, 1, AsciiCompatibility.CONVERTER, 0), new GenericTranscoderEntry("KOI8-U", "UTF-8", 45880, "SingleByte", 1, 1, 1, AsciiCompatibility.CONVERTER, 0), new GenericTranscoderEntry("UTF-8", "KOI8-U", 46664, "SingleByte", 1, 4, 1, AsciiCompatibility.CONVERTER, 0), new GenericTranscoderEntry("KOI8-R", "UTF-8", 47188, "SingleByte", 1, 1, 1, AsciiCompatibility.CONVERTER, 0), new GenericTranscoderEntry("UTF-8", "KOI8-R", 47720, "SingleByte", 1, 4, 1, AsciiCompatibility.CONVERTER, 0), new GenericTranscoderEntry("TIS-620", "UTF-8", 48084, "SingleByte", 1, 1, 1, AsciiCompatibility.CONVERTER, 0), new GenericTranscoderEntry("UTF-8", "TIS-620", 48128, "SingleByte", 1, 4, 1, AsciiCompatibility.CONVERTER, 0), new GenericTranscoderEntry("CP850", "UTF-8", 48652, "SingleByte", 1, 1, 1, AsciiCompatibility.CONVERTER, 0), new GenericTranscoderEntry("UTF-8", "CP850", 49200, "SingleByte", 1, 4, 1, AsciiCompatibility.CONVERTER, 0), new GenericTranscoderEntry("CP852", "UTF-8", 27812, "SingleByte", 1, 1, 1, AsciiCompatibility.CONVERTER, 0), new GenericTranscoderEntry("UTF-8", "CP852", 28428, "SingleByte", 1, 4, 1, AsciiCompatibility.CONVERTER, 0), new GenericTranscoderEntry("CP855", "UTF-8", 28952, "SingleByte", 1, 1, 1, AsciiCompatibility.CONVERTER, 0), new GenericTranscoderEntry("UTF-8", "CP855", 29504, "SingleByte", 1, 4, 1, AsciiCompatibility.CONVERTER, 0), new GenericTranscoderEntry("UTF-8", "UTF8-MAC", 4804, "Utf8Mac", 1, 4, 9, AsciiCompatibility.CONVERTER, 0), new GenericTranscoderEntry("UTF8-MAC", "UTF-8", 4928, "Utf8Mac", 1, 4, 10, AsciiCompatibility.ENCODER, 0), new GenericTranscoderEntry("UTF-16BE", "UTF-8", 188, "Utf1632", 2, 4, 4, AsciiCompatibility.DECODER, 0), new GenericTranscoderEntry("UTF-8", "UTF-16BE", 416, "Utf1632", 1, 4, 4, AsciiCompatibility.ENCODER, 0), new GenericTranscoderEntry("UTF-16LE", "UTF-8", 52, "Utf1632", 2, 4, 4, AsciiCompatibility.DECODER, 0), new GenericTranscoderEntry("UTF-8", "UTF-16LE", 416, "Utf1632", 1, 4, 4, AsciiCompatibility.ENCODER, 0), new GenericTranscoderEntry("UTF-32BE", "UTF-8", 252, "Utf1632", 4, 4, 4, AsciiCompatibility.DECODER, 0), new GenericTranscoderEntry("UTF-8", "UTF-32BE", 416, "Utf1632", 1, 4, 4, AsciiCompatibility.ENCODER, 0), new GenericTranscoderEntry("UTF-32LE", "UTF-8", 128, "Utf1632", 4, 4, 4, AsciiCompatibility.DECODER, 0), new GenericTranscoderEntry("UTF-8", "UTF-32LE", 416, "Utf1632", 1, 4, 4, AsciiCompatibility.ENCODER, 0), new GenericTranscoderEntry("UTF-16", "UTF-8", 276, "Utf1632", 2, 4, 4, AsciiCompatibility.DECODER, 1), new GenericTranscoderEntry("UTF-32", "UTF-8", 300, "Utf1632", 4, 4, 4, AsciiCompatibility.DECODER, 1), new GenericTranscoderEntry("UTF-8", "UTF-16", 416, "Utf1632", 1, 4, 4, AsciiCompatibility.ENCODER, 1), new GenericTranscoderEntry("UTF-8", "UTF-32", 416, "Utf1632", 1, 4, 4, AsciiCompatibility.ENCODER, 1) }; }jcodings-jcodings-1.0.11/src/org/jcodings/transcode/Transcoding.java000066400000000000000000000174731223451536200254650ustar00rootroot00000000000000/* * Permission is hereby granted, free of charge, to any person obtaining a copy of * this software and associated documentation files (the "Software"), to deal in * the Software without restriction, including without limitation the rights to * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies * of the Software, and to permit persons to whom the Software is furnished to do * so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ package org.jcodings.transcode; import org.jcodings.Ptr; import org.jcodings.exception.TranscoderException; public class Transcoding implements TranscodingInstruction { public Transcoding(Transcoder transcoder) { this.transcoder = transcoder; this.readBuf = new byte[transcoder.maxInput]; this.writeBuf = new byte[transcoder.maxOutput]; } final Transcoder transcoder; int flags; int resumePosition; int nextTable; int nextInfo; byte nextByte; int outputIndex; int recognizedLength, readAgainLength; final byte[] readBuf; int writeBuffOff, writeBuffLen; final byte[] writeBuf; byte[] state; void close() { transcoder.stateFinish(); } private int charStart; private byte[] charStartBytes; @Override public String toString() { return "Transcoding for transcoder " + transcoder.toString(); } /* transcode_char_start */ int charStart() { if (recognizedLength > inCharStart - inPos.p) { System.arraycopy(inBytes, inCharStart, readBuf, recognizedLength, inP - inCharStart); charStart = 0; charStartBytes = readBuf; } else { charStart = inCharStart - recognizedLength; charStartBytes = inBytes; } return recognizedLength + (inP - inCharStart); } /* rb_transcoding_convert */ EConvResult convert(byte[] in, Ptr inPtr, int inStop, byte[] out, Ptr outPtr, int outStop, int flags) { return null; } private EConvResult transcodeRestartable(byte[] in, Ptr inStart, int intStop, byte[] out, Ptr outStart, int outStop, int opt) { if (readAgainLength != 0) { byte[] readAgainBuf = new byte[readAgainLength]; Ptr readAgainPos = new Ptr(0); int readAgainStop = readAgainLength; System.arraycopy(readBuf, recognizedLength, readAgainBuf, readAgainPos.p, readAgainLength); readAgainLength = 0; EConvResult res = transcodeRestartable0(readAgainBuf, readAgainPos, readAgainStop, out, outStart, outStop, opt | EConv.PARTIAL_INPUT); if (!res.isSourceBufferEmpty()) { System.arraycopy(readAgainBuf, readAgainPos.p, readBuf, recognizedLength + readAgainLength, readAgainStop - readAgainPos.p); readAgainLength += readAgainStop - readAgainPos.p; } } return transcodeRestartable0(in, inStart, intStop, out, outStart, outStop, opt); } int inCharStart; byte[] inBytes, outBytes; int inP, outP; int outStop, inStop; Ptr inPos, outPos; int readAgainL; int opt; private EConvResult transcodeRestartable0(byte[] in, Ptr inStart, int intStop, byte[] out, Ptr outStart, int outStop, int opt) { inPos = inStart; inP = inCharStart = inStart.p; outPos = outStart; readAgainL = 0; inBytes = in; outBytes = out; return null; } private EConvResult transcodeSwitch() { int jump = resumePosition != 0 ? resumePosition : (nextInfo & 0xff); while (true) { switch (jump) { case NOMAP: int p = inCharStart; writeBuffOff = 0; while (p < inP) { writeBuf[writeBuffOff++] = inBytes[p++]; } writeBuffLen = writeBuffOff; writeBuffOff = 0; while (writeBuffOff < writeBuffLen) { if (outStop - outP < 1) return suspend(NOMAP_RESUME_1); outBytes[outP++] = writeBuf[writeBuffOff++]; } continue; case NOMAP_RESUME_1: do { if (outStop - outP < 1) return suspend(NOMAP_RESUME_1); outBytes[outP++] = writeBuf[writeBuffOff++]; } while (writeBuffOff < writeBuffLen); case 0x00: case 0x04: case 0x08: case 0x0C: case 0x10: case 0x14: case 0x18: case 0x1C: if (suspendAfterOutput()) return suspend(EConvResult.AfterOutput, ZeroXResume_1); case ZeroXResume_1: if (inP >= inStop) { if ((opt & EConvFlags.PARTIAL_INPUT) == 0) return suspend(EConvResult.AfterOutput, ZeroXResume_2); return suspend(EConvResult.SourceBufferEmpty, ZeroXResume_2); } case ZeroXResume_2: while (inP >= inStop) { if ((opt & EConvFlags.PARTIAL_INPUT) == 0) return suspend(EConvResult.AfterOutput, ZeroXResume_2); return suspend(EConvResult.SourceBufferEmpty, ZeroXResume_2); } nextByte = inBytes[inP++]; nextTable = nextInfo; case ZERObt: /* drop input */ case ONEbt: case TWObt: case THREEbt: case FOURbt: case GB4bt: case STR1: case FUNii: case FUNsi: case FUNio: case FUNso: case FUNsio: case INVALID: case UNDEF: default: throw new TranscoderException("unknown transcoding instruction: " + jump); } } // return null; } private EConvResult transcodeInstruction_NoMap() { return transcodeInstruction_NoMap_resume_3(); } private EConvResult transcodeInstruction_NoMap_resume_3() { while (writeBuffOff < writeBuffLen) { outBytes[outP++] = writeBuf[writeBuffOff++]; return suspend(3); } return null; } // SUSPEND private EConvResult suspend(EConvResult ret, int num) { resumePosition = num; if (inP - inCharStart > 0) System.arraycopy(inBytes, inCharStart, readBuf, recognizedLength, inP - inCharStart); inPos.p = inP; outPos.p = outP; recognizedLength += inP - inCharStart; if (readAgainL != 0) { recognizedLength -= readAgainL; readAgainLength = readAgainL; } return ret; } // SUSPEND_OBUF private EConvResult suspend(int num) { while (outStop - outP < 1) { return suspend(EConvResult.DestinationBufferFull, num); } return null; } private boolean suspendAfterOutput() { return (opt & EConvFlags.AFTER_OUTPUT) != 0 && outPos.p != outP; } public static int getGB4bt0(int a) { return a >>> 8; } public static int getGB4bt1(int a) { return ((a >>> 24) & 0xf) | 0x30; } public static int getGB4bt2(int a) { return a >>> 16; } public static int getGB4bt3(int a) { return ((a >>> 28) & 0x0f) | 0x30; } }jcodings-jcodings-1.0.11/src/org/jcodings/transcode/TranscodingInstruction.java000066400000000000000000000045661223451536200277260ustar00rootroot00000000000000/* * Permission is hereby granted, free of charge, to any person obtaining a copy of * this software and associated documentation files (the "Software"), to deal in * the Software without restriction, including without limitation the rights to * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies * of the Software, and to permit persons to whom the Software is furnished to do * so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ package org.jcodings.transcode; interface TranscodingInstruction { final int NOMAP = 0x01; /* direct map */ final int ONEbt = 0x02; /* one byte payload */ final int TWObt = 0x03; /* two bytes payload */ final int THREEbt = 0x05; /* three bytes payload */ final int FOURbt = 0x06; /* four bytes payload, UTF-8 only, macros start at getBT0 */ final int INVALID = 0x07; /* invalid byte sequence */ final int UNDEF = 0x09; /* legal but undefined */ final int ZERObt = 0x0A; /* zero bytes of payload, i.e. remove */ final int FUNii = 0x0B; /* function from info to info */ final int FUNsi = 0x0D; /* function from start to info */ final int FUNio = 0x0E; /* function from info to output */ final int FUNso = 0x0F; /* function from start to output */ final int STR1 = 0x11; /* string 4 <= len <= 259 bytes: 1byte length + content */ final int GB4bt = 0x12; /* GB18030 four bytes payload */ final int FUNsio = 0x13; /* function from start and info to output */ final int LAST = 0x1C; final int NOMAP_RESUME_1 = LAST + 1; final int ZeroXResume_1 = LAST + 2; final int ZeroXResume_2 = LAST + 3; }jcodings-jcodings-1.0.11/src/org/jcodings/transcode/specific/000077500000000000000000000000001223451536200241205ustar00rootroot00000000000000jcodings-jcodings-1.0.11/src/org/jcodings/transcode/specific/Cp50220_decoder_Transcoder.java000066400000000000000000000027371223451536200316000ustar00rootroot00000000000000/* * Permission is hereby granted, free of charge, to any person obtaining a copy of * this software and associated documentation files (the "Software"), to deal in * the Software without restriction, including without limitation the rights to * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies * of the Software, and to permit persons to whom the Software is furnished to do * so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ package org.jcodings.transcode.specific; import org.jcodings.transcode.AsciiCompatibility; import org.jcodings.transcode.Transcoder; public class Cp50220_decoder_Transcoder extends Transcoder { protected Cp50220_decoder_Transcoder () { super("CP50220", "cp51932", 244, "Iso2022", 1, 3, 3, AsciiCompatibility.DECODER, 1); } public static final Transcoder INSTANCE = new Cp50220_decoder_Transcoder(); } jcodings-jcodings-1.0.11/src/org/jcodings/transcode/specific/Cp50220_encoder_Transcoder.java000066400000000000000000000027371223451536200316120ustar00rootroot00000000000000/* * Permission is hereby granted, free of charge, to any person obtaining a copy of * this software and associated documentation files (the "Software"), to deal in * the Software without restriction, including without limitation the rights to * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies * of the Software, and to permit persons to whom the Software is furnished to do * so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ package org.jcodings.transcode.specific; import org.jcodings.transcode.AsciiCompatibility; import org.jcodings.transcode.Transcoder; public class Cp50220_encoder_Transcoder extends Transcoder { protected Cp50220_encoder_Transcoder () { super("CP51932", "CP50220", 268, "Iso2022", 1, 3, 5, AsciiCompatibility.ENCODER, 3); } public static final Transcoder INSTANCE = new Cp50220_encoder_Transcoder(); } jcodings-jcodings-1.0.11/src/org/jcodings/transcode/specific/Cp50221_decoder_Transcoder.java000066400000000000000000000027371223451536200316010ustar00rootroot00000000000000/* * Permission is hereby granted, free of charge, to any person obtaining a copy of * this software and associated documentation files (the "Software"), to deal in * the Software without restriction, including without limitation the rights to * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies * of the Software, and to permit persons to whom the Software is furnished to do * so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ package org.jcodings.transcode.specific; import org.jcodings.transcode.AsciiCompatibility; import org.jcodings.transcode.Transcoder; public class Cp50221_decoder_Transcoder extends Transcoder { protected Cp50221_decoder_Transcoder () { super("CP50221", "cp51932", 244, "Iso2022", 1, 3, 3, AsciiCompatibility.DECODER, 1); } public static final Transcoder INSTANCE = new Cp50221_decoder_Transcoder(); } jcodings-jcodings-1.0.11/src/org/jcodings/transcode/specific/Cp50221_encoder_Transcoder.java000066400000000000000000000027371223451536200316130ustar00rootroot00000000000000/* * Permission is hereby granted, free of charge, to any person obtaining a copy of * this software and associated documentation files (the "Software"), to deal in * the Software without restriction, including without limitation the rights to * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies * of the Software, and to permit persons to whom the Software is furnished to do * so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ package org.jcodings.transcode.specific; import org.jcodings.transcode.AsciiCompatibility; import org.jcodings.transcode.Transcoder; public class Cp50221_encoder_Transcoder extends Transcoder { protected Cp50221_encoder_Transcoder () { super("CP51932", "CP50221", 268, "Iso2022", 1, 3, 5, AsciiCompatibility.ENCODER, 1); } public static final Transcoder INSTANCE = new Cp50221_encoder_Transcoder(); } jcodings-jcodings-1.0.11/src/org/jcodings/transcode/specific/Escape_xml_attr_quote_Transcoder.java000066400000000000000000000027571223451536200335110ustar00rootroot00000000000000/* * Permission is hereby granted, free of charge, to any person obtaining a copy of * this software and associated documentation files (the "Software"), to deal in * the Software without restriction, including without limitation the rights to * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies * of the Software, and to permit persons to whom the Software is furnished to do * so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ package org.jcodings.transcode.specific; import org.jcodings.transcode.AsciiCompatibility; import org.jcodings.transcode.Transcoder; public class Escape_xml_attr_quote_Transcoder extends Transcoder { protected Escape_xml_attr_quote_Transcoder () { super("", "xml_attr_quote", 72, "Escape", 1, 1, 7, AsciiCompatibility.ENCODER, 1); } public static final Transcoder INSTANCE = new Escape_xml_attr_quote_Transcoder(); } jcodings-jcodings-1.0.11/src/org/jcodings/transcode/specific/Eucjp2sjis_Transcoder.java000066400000000000000000000027231223451536200311740ustar00rootroot00000000000000/* * Permission is hereby granted, free of charge, to any person obtaining a copy of * this software and associated documentation files (the "Software"), to deal in * the Software without restriction, including without limitation the rights to * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies * of the Software, and to permit persons to whom the Software is furnished to do * so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ package org.jcodings.transcode.specific; import org.jcodings.transcode.AsciiCompatibility; import org.jcodings.transcode.Transcoder; public class Eucjp2sjis_Transcoder extends Transcoder { protected Eucjp2sjis_Transcoder () { super("EUC-JP", "Shift_JIS", 88, "Japanese", 1, 3, 2, AsciiCompatibility.CONVERTER, 0); } public static final Transcoder INSTANCE = new Eucjp2sjis_Transcoder(); } Eucjp_to_stateless_iso2022jp_Transcoder.java000066400000000000000000000030251223451536200344410ustar00rootroot00000000000000jcodings-jcodings-1.0.11/src/org/jcodings/transcode/specific/* * Permission is hereby granted, free of charge, to any person obtaining a copy of * this software and associated documentation files (the "Software"), to deal in * the Software without restriction, including without limitation the rights to * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies * of the Software, and to permit persons to whom the Software is furnished to do * so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ package org.jcodings.transcode.specific; import org.jcodings.transcode.AsciiCompatibility; import org.jcodings.transcode.Transcoder; public class Eucjp_to_stateless_iso2022jp_Transcoder extends Transcoder { protected Eucjp_to_stateless_iso2022jp_Transcoder () { super("EUC-JP", "stateless-ISO-2022-JP", 192, "Iso2022", 1, 3, 3, AsciiCompatibility.CONVERTER, 0); } public static final Transcoder INSTANCE = new Eucjp_to_stateless_iso2022jp_Transcoder(); } jcodings-jcodings-1.0.11/src/org/jcodings/transcode/specific/From_GB18030_Transcoder.java000066400000000000000000000027301223451536200310200ustar00rootroot00000000000000/* * Permission is hereby granted, free of charge, to any person obtaining a copy of * this software and associated documentation files (the "Software"), to deal in * the Software without restriction, including without limitation the rights to * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies * of the Software, and to permit persons to whom the Software is furnished to do * so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ package org.jcodings.transcode.specific; import org.jcodings.transcode.AsciiCompatibility; import org.jcodings.transcode.Transcoder; public class From_GB18030_Transcoder extends Transcoder { protected From_GB18030_Transcoder () { super("GB18030", "UTF-8", 57668, "Gb18030", 1, 4, 4, AsciiCompatibility.CONVERTER, 0); } public static final Transcoder INSTANCE = new From_GB18030_Transcoder(); } jcodings-jcodings-1.0.11/src/org/jcodings/transcode/specific/From_UTF8_MAC_Transcoder.java000066400000000000000000000027321223451536200313440ustar00rootroot00000000000000/* * Permission is hereby granted, free of charge, to any person obtaining a copy of * this software and associated documentation files (the "Software"), to deal in * the Software without restriction, including without limitation the rights to * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies * of the Software, and to permit persons to whom the Software is furnished to do * so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ package org.jcodings.transcode.specific; import org.jcodings.transcode.AsciiCompatibility; import org.jcodings.transcode.Transcoder; public class From_UTF8_MAC_Transcoder extends Transcoder { protected From_UTF8_MAC_Transcoder () { super("UTF8-MAC", "UTF-8", 4928, "Utf8Mac", 1, 4, 10, AsciiCompatibility.ENCODER, 0); } public static final Transcoder INSTANCE = new From_UTF8_MAC_Transcoder(); } jcodings-jcodings-1.0.11/src/org/jcodings/transcode/specific/From_UTF_16BE_Transcoder.java000066400000000000000000000027301223451536200313070ustar00rootroot00000000000000/* * Permission is hereby granted, free of charge, to any person obtaining a copy of * this software and associated documentation files (the "Software"), to deal in * the Software without restriction, including without limitation the rights to * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies * of the Software, and to permit persons to whom the Software is furnished to do * so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ package org.jcodings.transcode.specific; import org.jcodings.transcode.AsciiCompatibility; import org.jcodings.transcode.Transcoder; public class From_UTF_16BE_Transcoder extends Transcoder { protected From_UTF_16BE_Transcoder () { super("UTF-16BE", "UTF-8", 188, "Utf1632", 2, 4, 4, AsciiCompatibility.DECODER, 0); } public static final Transcoder INSTANCE = new From_UTF_16BE_Transcoder(); } jcodings-jcodings-1.0.11/src/org/jcodings/transcode/specific/From_UTF_16LE_Transcoder.java000066400000000000000000000027271223451536200313270ustar00rootroot00000000000000/* * Permission is hereby granted, free of charge, to any person obtaining a copy of * this software and associated documentation files (the "Software"), to deal in * the Software without restriction, including without limitation the rights to * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies * of the Software, and to permit persons to whom the Software is furnished to do * so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ package org.jcodings.transcode.specific; import org.jcodings.transcode.AsciiCompatibility; import org.jcodings.transcode.Transcoder; public class From_UTF_16LE_Transcoder extends Transcoder { protected From_UTF_16LE_Transcoder () { super("UTF-16LE", "UTF-8", 52, "Utf1632", 2, 4, 4, AsciiCompatibility.DECODER, 0); } public static final Transcoder INSTANCE = new From_UTF_16LE_Transcoder(); } jcodings-jcodings-1.0.11/src/org/jcodings/transcode/specific/From_UTF_16_Transcoder.java000066400000000000000000000027201223451536200310770ustar00rootroot00000000000000/* * Permission is hereby granted, free of charge, to any person obtaining a copy of * this software and associated documentation files (the "Software"), to deal in * the Software without restriction, including without limitation the rights to * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies * of the Software, and to permit persons to whom the Software is furnished to do * so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ package org.jcodings.transcode.specific; import org.jcodings.transcode.AsciiCompatibility; import org.jcodings.transcode.Transcoder; public class From_UTF_16_Transcoder extends Transcoder { protected From_UTF_16_Transcoder () { super("UTF-16", "UTF-8", 276, "Utf1632", 2, 4, 4, AsciiCompatibility.DECODER, 1); } public static final Transcoder INSTANCE = new From_UTF_16_Transcoder(); } jcodings-jcodings-1.0.11/src/org/jcodings/transcode/specific/From_UTF_32BE_Transcoder.java000066400000000000000000000027301223451536200313050ustar00rootroot00000000000000/* * Permission is hereby granted, free of charge, to any person obtaining a copy of * this software and associated documentation files (the "Software"), to deal in * the Software without restriction, including without limitation the rights to * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies * of the Software, and to permit persons to whom the Software is furnished to do * so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ package org.jcodings.transcode.specific; import org.jcodings.transcode.AsciiCompatibility; import org.jcodings.transcode.Transcoder; public class From_UTF_32BE_Transcoder extends Transcoder { protected From_UTF_32BE_Transcoder () { super("UTF-32BE", "UTF-8", 252, "Utf1632", 4, 4, 4, AsciiCompatibility.DECODER, 0); } public static final Transcoder INSTANCE = new From_UTF_32BE_Transcoder(); } jcodings-jcodings-1.0.11/src/org/jcodings/transcode/specific/From_UTF_32LE_Transcoder.java000066400000000000000000000027301223451536200313170ustar00rootroot00000000000000/* * Permission is hereby granted, free of charge, to any person obtaining a copy of * this software and associated documentation files (the "Software"), to deal in * the Software without restriction, including without limitation the rights to * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies * of the Software, and to permit persons to whom the Software is furnished to do * so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ package org.jcodings.transcode.specific; import org.jcodings.transcode.AsciiCompatibility; import org.jcodings.transcode.Transcoder; public class From_UTF_32LE_Transcoder extends Transcoder { protected From_UTF_32LE_Transcoder () { super("UTF-32LE", "UTF-8", 128, "Utf1632", 4, 4, 4, AsciiCompatibility.DECODER, 0); } public static final Transcoder INSTANCE = new From_UTF_32LE_Transcoder(); } jcodings-jcodings-1.0.11/src/org/jcodings/transcode/specific/From_UTF_32_Transcoder.java000066400000000000000000000027201223451536200310750ustar00rootroot00000000000000/* * Permission is hereby granted, free of charge, to any person obtaining a copy of * this software and associated documentation files (the "Software"), to deal in * the Software without restriction, including without limitation the rights to * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies * of the Software, and to permit persons to whom the Software is furnished to do * so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ package org.jcodings.transcode.specific; import org.jcodings.transcode.AsciiCompatibility; import org.jcodings.transcode.Transcoder; public class From_UTF_32_Transcoder extends Transcoder { protected From_UTF_32_Transcoder () { super("UTF-32", "UTF-8", 300, "Utf1632", 4, 4, 4, AsciiCompatibility.DECODER, 1); } public static final Transcoder INSTANCE = new From_UTF_32_Transcoder(); } jcodings-jcodings-1.0.11/src/org/jcodings/transcode/specific/Iso2022jp_decoder_Transcoder.java000066400000000000000000000027661223451536200322410ustar00rootroot00000000000000/* * Permission is hereby granted, free of charge, to any person obtaining a copy of * this software and associated documentation files (the "Software"), to deal in * the Software without restriction, including without limitation the rights to * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies * of the Software, and to permit persons to whom the Software is furnished to do * so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ package org.jcodings.transcode.specific; import org.jcodings.transcode.AsciiCompatibility; import org.jcodings.transcode.Transcoder; public class Iso2022jp_decoder_Transcoder extends Transcoder { protected Iso2022jp_decoder_Transcoder () { super("ISO-2022-JP", "stateless-ISO-2022-JP", 56, "Iso2022", 1, 3, 3, AsciiCompatibility.DECODER, 1); } public static final Transcoder INSTANCE = new Iso2022jp_decoder_Transcoder(); } jcodings-jcodings-1.0.11/src/org/jcodings/transcode/specific/Iso2022jp_encoder_Transcoder.java000066400000000000000000000027671223451536200322540ustar00rootroot00000000000000/* * Permission is hereby granted, free of charge, to any person obtaining a copy of * this software and associated documentation files (the "Software"), to deal in * the Software without restriction, including without limitation the rights to * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies * of the Software, and to permit persons to whom the Software is furnished to do * so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ package org.jcodings.transcode.specific; import org.jcodings.transcode.AsciiCompatibility; import org.jcodings.transcode.Transcoder; public class Iso2022jp_encoder_Transcoder extends Transcoder { protected Iso2022jp_encoder_Transcoder () { super("stateless-ISO-2022-JP", "ISO-2022-JP", 108, "Iso2022", 1, 3, 5, AsciiCompatibility.ENCODER, 1); } public static final Transcoder INSTANCE = new Iso2022jp_encoder_Transcoder(); } jcodings-jcodings-1.0.11/src/org/jcodings/transcode/specific/Iso2022jp_kddi_decoder_Transcoder.java000066400000000000000000000030301223451536200332150ustar00rootroot00000000000000/* * Permission is hereby granted, free of charge, to any person obtaining a copy of * this software and associated documentation files (the "Software"), to deal in * the Software without restriction, including without limitation the rights to * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies * of the Software, and to permit persons to whom the Software is furnished to do * so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ package org.jcodings.transcode.specific; import org.jcodings.transcode.AsciiCompatibility; import org.jcodings.transcode.Transcoder; public class Iso2022jp_kddi_decoder_Transcoder extends Transcoder { protected Iso2022jp_kddi_decoder_Transcoder () { super("ISO-2022-JP-KDDI", "stateless-ISO-2022-JP-KDDI", 56, "EmojiIso2022Kddi", 1, 3, 3, AsciiCompatibility.DECODER, 1); } public static final Transcoder INSTANCE = new Iso2022jp_kddi_decoder_Transcoder(); } jcodings-jcodings-1.0.11/src/org/jcodings/transcode/specific/Iso2022jp_kddi_encoder_Transcoder.java000066400000000000000000000030311223451536200332300ustar00rootroot00000000000000/* * Permission is hereby granted, free of charge, to any person obtaining a copy of * this software and associated documentation files (the "Software"), to deal in * the Software without restriction, including without limitation the rights to * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies * of the Software, and to permit persons to whom the Software is furnished to do * so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ package org.jcodings.transcode.specific; import org.jcodings.transcode.AsciiCompatibility; import org.jcodings.transcode.Transcoder; public class Iso2022jp_kddi_encoder_Transcoder extends Transcoder { protected Iso2022jp_kddi_encoder_Transcoder () { super("stateless-ISO-2022-JP-KDDI", "ISO-2022-JP-KDDI", 108, "EmojiIso2022Kddi", 1, 3, 5, AsciiCompatibility.ENCODER, 1); } public static final Transcoder INSTANCE = new Iso2022jp_kddi_encoder_Transcoder(); } jcodings-jcodings-1.0.11/src/org/jcodings/transcode/specific/Sjis2eucjp_Transcoder.java000066400000000000000000000027241223451536200311750ustar00rootroot00000000000000/* * Permission is hereby granted, free of charge, to any person obtaining a copy of * this software and associated documentation files (the "Software"), to deal in * the Software without restriction, including without limitation the rights to * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies * of the Software, and to permit persons to whom the Software is furnished to do * so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ package org.jcodings.transcode.specific; import org.jcodings.transcode.AsciiCompatibility; import org.jcodings.transcode.Transcoder; public class Sjis2eucjp_Transcoder extends Transcoder { protected Sjis2eucjp_Transcoder () { super("Shift_JIS", "EUC-JP", 132, "Japanese", 1, 2, 2, AsciiCompatibility.CONVERTER, 0); } public static final Transcoder INSTANCE = new Sjis2eucjp_Transcoder(); } Stateless_iso2022jp_to_eucjp_Transcoder.java000066400000000000000000000030251223451536200344410ustar00rootroot00000000000000jcodings-jcodings-1.0.11/src/org/jcodings/transcode/specific/* * Permission is hereby granted, free of charge, to any person obtaining a copy of * this software and associated documentation files (the "Software"), to deal in * the Software without restriction, including without limitation the rights to * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies * of the Software, and to permit persons to whom the Software is furnished to do * so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ package org.jcodings.transcode.specific; import org.jcodings.transcode.AsciiCompatibility; import org.jcodings.transcode.Transcoder; public class Stateless_iso2022jp_to_eucjp_Transcoder extends Transcoder { protected Stateless_iso2022jp_to_eucjp_Transcoder () { super("stateless-ISO-2022-JP", "EUC-JP", 128, "Iso2022", 1, 3, 2, AsciiCompatibility.CONVERTER, 0); } public static final Transcoder INSTANCE = new Stateless_iso2022jp_to_eucjp_Transcoder(); } jcodings-jcodings-1.0.11/src/org/jcodings/transcode/specific/To_GB18030_Transcoder.java000066400000000000000000000027231223451536200305010ustar00rootroot00000000000000/* * Permission is hereby granted, free of charge, to any person obtaining a copy of * this software and associated documentation files (the "Software"), to deal in * the Software without restriction, including without limitation the rights to * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies * of the Software, and to permit persons to whom the Software is furnished to do * so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ package org.jcodings.transcode.specific; import org.jcodings.transcode.AsciiCompatibility; import org.jcodings.transcode.Transcoder; public class To_GB18030_Transcoder extends Transcoder { protected To_GB18030_Transcoder () { super("UTF-8", "GB18030", 115576, "Gb18030", 1, 4, 4, AsciiCompatibility.CONVERTER, 0); } public static final Transcoder INSTANCE = new To_GB18030_Transcoder(); } jcodings-jcodings-1.0.11/src/org/jcodings/transcode/specific/To_UTF_16BE_Transcoder.java000066400000000000000000000027221223451536200307670ustar00rootroot00000000000000/* * Permission is hereby granted, free of charge, to any person obtaining a copy of * this software and associated documentation files (the "Software"), to deal in * the Software without restriction, including without limitation the rights to * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies * of the Software, and to permit persons to whom the Software is furnished to do * so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ package org.jcodings.transcode.specific; import org.jcodings.transcode.AsciiCompatibility; import org.jcodings.transcode.Transcoder; public class To_UTF_16BE_Transcoder extends Transcoder { protected To_UTF_16BE_Transcoder () { super("UTF-8", "UTF-16BE", 416, "Utf1632", 1, 4, 4, AsciiCompatibility.ENCODER, 0); } public static final Transcoder INSTANCE = new To_UTF_16BE_Transcoder(); } jcodings-jcodings-1.0.11/src/org/jcodings/transcode/specific/To_UTF_16LE_Transcoder.java000066400000000000000000000027221223451536200310010ustar00rootroot00000000000000/* * Permission is hereby granted, free of charge, to any person obtaining a copy of * this software and associated documentation files (the "Software"), to deal in * the Software without restriction, including without limitation the rights to * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies * of the Software, and to permit persons to whom the Software is furnished to do * so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ package org.jcodings.transcode.specific; import org.jcodings.transcode.AsciiCompatibility; import org.jcodings.transcode.Transcoder; public class To_UTF_16LE_Transcoder extends Transcoder { protected To_UTF_16LE_Transcoder () { super("UTF-8", "UTF-16LE", 416, "Utf1632", 1, 4, 4, AsciiCompatibility.ENCODER, 0); } public static final Transcoder INSTANCE = new To_UTF_16LE_Transcoder(); } jcodings-jcodings-1.0.11/src/org/jcodings/transcode/specific/To_UTF_16_Transcoder.java000066400000000000000000000027121223451536200305570ustar00rootroot00000000000000/* * Permission is hereby granted, free of charge, to any person obtaining a copy of * this software and associated documentation files (the "Software"), to deal in * the Software without restriction, including without limitation the rights to * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies * of the Software, and to permit persons to whom the Software is furnished to do * so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ package org.jcodings.transcode.specific; import org.jcodings.transcode.AsciiCompatibility; import org.jcodings.transcode.Transcoder; public class To_UTF_16_Transcoder extends Transcoder { protected To_UTF_16_Transcoder () { super("UTF-8", "UTF-16", 416, "Utf1632", 1, 4, 4, AsciiCompatibility.ENCODER, 1); } public static final Transcoder INSTANCE = new To_UTF_16_Transcoder(); } jcodings-jcodings-1.0.11/src/org/jcodings/transcode/specific/To_UTF_32BE_Transcoder.java000066400000000000000000000027221223451536200307650ustar00rootroot00000000000000/* * Permission is hereby granted, free of charge, to any person obtaining a copy of * this software and associated documentation files (the "Software"), to deal in * the Software without restriction, including without limitation the rights to * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies * of the Software, and to permit persons to whom the Software is furnished to do * so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ package org.jcodings.transcode.specific; import org.jcodings.transcode.AsciiCompatibility; import org.jcodings.transcode.Transcoder; public class To_UTF_32BE_Transcoder extends Transcoder { protected To_UTF_32BE_Transcoder () { super("UTF-8", "UTF-32BE", 416, "Utf1632", 1, 4, 4, AsciiCompatibility.ENCODER, 0); } public static final Transcoder INSTANCE = new To_UTF_32BE_Transcoder(); } jcodings-jcodings-1.0.11/src/org/jcodings/transcode/specific/To_UTF_32LE_Transcoder.java000066400000000000000000000027221223451536200307770ustar00rootroot00000000000000/* * Permission is hereby granted, free of charge, to any person obtaining a copy of * this software and associated documentation files (the "Software"), to deal in * the Software without restriction, including without limitation the rights to * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies * of the Software, and to permit persons to whom the Software is furnished to do * so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ package org.jcodings.transcode.specific; import org.jcodings.transcode.AsciiCompatibility; import org.jcodings.transcode.Transcoder; public class To_UTF_32LE_Transcoder extends Transcoder { protected To_UTF_32LE_Transcoder () { super("UTF-8", "UTF-32LE", 416, "Utf1632", 1, 4, 4, AsciiCompatibility.ENCODER, 0); } public static final Transcoder INSTANCE = new To_UTF_32LE_Transcoder(); } jcodings-jcodings-1.0.11/src/org/jcodings/transcode/specific/To_UTF_32_Transcoder.java000066400000000000000000000027121223451536200305550ustar00rootroot00000000000000/* * Permission is hereby granted, free of charge, to any person obtaining a copy of * this software and associated documentation files (the "Software"), to deal in * the Software without restriction, including without limitation the rights to * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies * of the Software, and to permit persons to whom the Software is furnished to do * so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ package org.jcodings.transcode.specific; import org.jcodings.transcode.AsciiCompatibility; import org.jcodings.transcode.Transcoder; public class To_UTF_32_Transcoder extends Transcoder { protected To_UTF_32_Transcoder () { super("UTF-8", "UTF-32", 416, "Utf1632", 1, 4, 4, AsciiCompatibility.ENCODER, 1); } public static final Transcoder INSTANCE = new To_UTF_32_Transcoder(); } jcodings-jcodings-1.0.11/src/org/jcodings/unicode/000077500000000000000000000000001223451536200217775ustar00rootroot00000000000000jcodings-jcodings-1.0.11/src/org/jcodings/unicode/FixedWidthUnicodeEncoding.java000066400000000000000000000050561223451536200276650ustar00rootroot00000000000000/* * Permission is hereby granted, free of charge, to any person obtaining a copy of * this software and associated documentation files (the "Software"), to deal in * the Software without restriction, including without limitation the rights to * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies * of the Software, and to permit persons to whom the Software is furnished to do * so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ package org.jcodings.unicode; import org.jcodings.IntHolder; public abstract class FixedWidthUnicodeEncoding extends UnicodeEncoding { protected final int shift; protected FixedWidthUnicodeEncoding(String name, int width) { super(name, width, width, null); shift = log2(width); } @Override public final int length(byte c) { return minLength; } @Override public final int length(byte[]bytes, int p, int end) { return minLength; } @Override public final int strLength(byte[]bytes, int p, int end) { return (end - p) >>> shift; } @Override public final int strCodeAt(byte[]bytes, int p, int end, int index) { return mbcToCode(bytes, p + (index << shift), end); } @Override public final int codeToMbcLength(int code) { return minLength; } /** onigenc_utf16_32_get_ctype_code_range */ @Override public final int[]ctypeCodeRange(int ctype, IntHolder sbOut) { sbOut.value = 0x00; return super.ctypeCodeRange(ctype); } @Override public final int leftAdjustCharHead(byte[]bytes, int p, int s, int end) { if (s <= p) return s; return s - ((s - p) % maxLength); } @Override public final boolean isReverseMatchAllowed(byte[]bytes, int p, int end) { return false; } private static int log2(int n){ int log = 0; while ((n >>>= 1) != 0) log++; return log; } } jcodings-jcodings-1.0.11/src/org/jcodings/unicode/UnicodeEncoding.java000066400000000000000000000544301223451536200257050ustar00rootroot00000000000000/* * Permission is hereby granted, free of charge, to any person obtaining a copy of * this software and associated documentation files (the "Software"), to deal in * the Software without restriction, including without limitation the rights to * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies * of the Software, and to permit persons to whom the Software is furnished to do * so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ package org.jcodings.unicode; import static org.jcodings.util.ArrayReader.readIntArray; import static org.jcodings.util.ArrayReader.readNestedIntArray; import org.jcodings.ApplyAllCaseFoldFunction; import org.jcodings.CaseFoldCodeItem; import org.jcodings.CodeRange; import org.jcodings.Config; import org.jcodings.IntHolder; import org.jcodings.MultiByteEncoding; import org.jcodings.constants.CharacterType; import org.jcodings.exception.CharacterPropertyException; import org.jcodings.exception.ErrorMessages; import org.jcodings.util.ArrayReader; import org.jcodings.util.CaseInsensitiveBytesHash; import org.jcodings.util.IntArrayHash; import org.jcodings.util.IntHash; public abstract class UnicodeEncoding extends MultiByteEncoding { private static final int PROPERTY_NAME_MAX_SIZE = 20; protected UnicodeEncoding(String name, int minLength, int maxLength, int[]EncLen) { // ASCII type tables for all Unicode encodings super(name, minLength, maxLength, EncLen, null, UNICODE_ISO_8859_1_CTypeTable); } protected UnicodeEncoding(String name, int minLength, int maxLength, int[]EncLen, int[][]Trans) { // ASCII type tables for all Unicode encodings super(name, minLength, maxLength, EncLen, Trans, UNICODE_ISO_8859_1_CTypeTable); } @Override public String getCharsetName() { return new String(getName()); } // onigenc_unicode_is_code_ctype @Override public boolean isCodeCType(int code, int ctype) { if (Config.USE_UNICODE_PROPERTIES) { if (ctype <= CharacterType.MAX_STD_CTYPE && code < 256) return isCodeCTypeInternal(code, ctype); } else { if (code < 256) return isCodeCTypeInternal(code, ctype); } if (ctype > UnicodeProperties.CodeRangeTable.length) throw new InternalError(ErrorMessages.ERR_TYPE_BUG); return CodeRange.isInCodeRange(UnicodeProperties.CodeRangeTable[ctype].getRange(), code); } // onigenc_unicode_ctype_code_range protected final int[]ctypeCodeRange(int ctype) { if (ctype >= UnicodeProperties.CodeRangeTable.length) throw new InternalError(ErrorMessages.ERR_TYPE_BUG); return UnicodeProperties.CodeRangeTable[ctype].getRange(); } // onigenc_unicode_property_name_to_ctype @Override public int propertyNameToCType(byte[]name, int p, int end) { byte[]buf = new byte[PROPERTY_NAME_MAX_SIZE]; int p_ = p; int len = 0; while(p_ < end) { int code = mbcToCode(name, p_, end); if (code >= 0x80) throw new CharacterPropertyException(ErrorMessages.ERR_INVALID_CHAR_PROPERTY_NAME); buf[len++] = (byte)code; if (len >= PROPERTY_NAME_MAX_SIZE) throw new CharacterPropertyException(ErrorMessages.ERR_INVALID_CHAR_PROPERTY_NAME, name, p, end); p_ += length(name, p_, end); } Integer ctype = CTypeName.CTypeNameHash.get(buf, 0, len); if (ctype == null) throw new CharacterPropertyException(ErrorMessages.ERR_INVALID_CHAR_PROPERTY_NAME, name, p, end); return ctype; } // onigenc_unicode_mbc_case_fold @Override public int mbcCaseFold(int flag, byte[]bytes, IntHolder pp, int end, byte[]fold) { int p = pp.value; int foldP = 0; int code = mbcToCode(bytes, p, end); int len = length(bytes, p, end); pp.value += len; if (Config.USE_UNICODE_CASE_FOLD_TURKISH_AZERI) { if ((flag & Config.ENC_CASE_FOLD_TURKISH_AZERI) != 0) { if (code == 0x0049) { return codeToMbc(0x0131, fold, foldP); } else if (code == 0x0130) { return codeToMbc(0x0069, fold, foldP); } } } int to[] = CaseFold.FoldHash.get(code); if (to != null) { if (to.length == 1) { return codeToMbc(to[0], fold, foldP); } else { int rlen = 0; for (int i=0; i CTypeNameHash = initializeCTypeNameTable(); private static CaseInsensitiveBytesHash initializeCTypeNameTable() { CaseInsensitiveBytesHash table = new CaseInsensitiveBytesHash(); for (int i = 0; i < UnicodeProperties.CodeRangeTable.length; i++) { table.putDirect(UnicodeProperties.CodeRangeTable[i].name, i); } return table; } } private static class CaseFold { private static final int CaseFold_From[] = readIntArray("CaseFold_From"); private static final int CaseFold_To[][] = readNestedIntArray("CaseFold_To"); private static final int CaseFold_Locale_From[] = readIntArray("CaseFold_Locale_From"); private static final int CaseFold_Locale_To[][] = readNestedIntArray("CaseFold_Locale_To"); private static IntHash initializeFoldHash() { IntHash fold = new IntHash(1200); for (int i = 0; i < CaseFold_From.length; i++) fold.putDirect(CaseFold_From[i], CaseFold_To[i]); for (int i = 0; i < CaseFold_Locale_From.length; i++) fold.putDirect(CaseFold_Locale_From[i], CaseFold_Locale_To[i]); return fold; } static final IntHashFoldHash = initializeFoldHash(); } private static class CaseFold11 { private static final int CaseUnfold_11_From[] = readIntArray("CaseUnfold_11_From"); private static final int CaseUnfold_11_To[][] = readNestedIntArray("CaseUnfold_11_To"); private static final int CaseUnfold_11_Locale_From[] = readIntArray("CaseUnfold_11_Locale_From"); private static final int CaseUnfold_11_Locale_To[][] = readNestedIntArray("CaseUnfold_11_Locale_To"); private static IntHash initializeUnfold1Hash() { IntHash unfold1 = new IntHash(1000); for (int i = 0; i < CaseUnfold_11_From.length; i++) unfold1.putDirect(CaseUnfold_11_From[i], CaseUnfold_11_To[i]); for (int i = 0; i < CaseUnfold_11_Locale_From.length; i++) unfold1.putDirect(CaseUnfold_11_Locale_From[i], CaseUnfold_11_Locale_To[i]); return unfold1; } static final IntHash Unfold1Hash = initializeUnfold1Hash(); } private static class CaseFold12 { private static final int CaseUnfold_12[][] = readNestedIntArray("CaseUnfold_12"); private static final int CaseUnfold_12_Locale[][] = readNestedIntArray("CaseUnfold_12_Locale"); private static IntArrayHash initializeUnfold2Hash() { IntArrayHash unfold2 = new IntArrayHash(200); for (int i = 0; i < CaseUnfold_12.length; i += 2) unfold2.putDirect(CaseUnfold_12[i], CaseUnfold_12[i + 1]); for (int i = 0; i < CaseUnfold_12_Locale.length; i += 2) unfold2.putDirect(CaseUnfold_12_Locale[i], CaseUnfold_12_Locale[i + 1]); return unfold2; } static final IntArrayHash Unfold2Hash = initializeUnfold2Hash(); } private static class CaseFold13 { private static final int CaseUnfold_13[][] = readNestedIntArray("CaseUnfold_13"); private static IntArrayHash initializeUnfold3Hash() { IntArrayHash unfold3 = new IntArrayHash(30); for (int i = 0; i < CaseUnfold_13.length; i += 2) unfold3.putDirect(CaseUnfold_13[i], CaseUnfold_13[i + 1]); return unfold3; } static final IntArrayHash Unfold3Hash = initializeUnfold3Hash(); } } jcodings-jcodings-1.0.11/src/org/jcodings/unicode/UnicodeProperties.java000066400000000000000000000633621223451536200263170ustar00rootroot00000000000000/* * Permission is hereby granted, free of charge, to any person obtaining a copy of * this software and associated documentation files (the "Software"), to deal in * the Software without restriction, including without limitation the rights to * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies * of the Software, and to permit persons to whom the Software is furnished to do * so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ package org.jcodings.unicode; import org.jcodings.Config; import org.jcodings.unicode.UnicodeEncoding.CodeRangeEntry; public class UnicodeProperties { static final CodeRangeEntry[]CodeRangeTable = Config.USE_UNICODE_PROPERTIES ? new CodeRangeEntry[] { new CodeRangeEntry("newline", "CR_NEWLINE"), new CodeRangeEntry("alpha", "CR_Alphabetic"), new CodeRangeEntry("blank", "CR_Blank"), new CodeRangeEntry("cntrl", "CR_Cc"), new CodeRangeEntry("digit", "CR_Nd"), new CodeRangeEntry("graph", "CR_Graph"), new CodeRangeEntry("lower", "CR_Lowercase"), new CodeRangeEntry("print", "CR_Print"), new CodeRangeEntry("punct", "CR_P"), new CodeRangeEntry("space", "CR_White_Space"), new CodeRangeEntry("upper", "CR_Uppercase"), new CodeRangeEntry("xdigit", "CR_ASCII_Hex_Digit"), new CodeRangeEntry("word", "CR_Word"), new CodeRangeEntry("alnum", "CR_Alnum"), new CodeRangeEntry("ascii", "CR_ASCII"), new CodeRangeEntry("any", "CR_Any"), new CodeRangeEntry("assigned", "CR_Assigned"), new CodeRangeEntry("c", "CR_C"), new CodeRangeEntry("other", "CR_C"), new CodeRangeEntry("cc", "CR_Cc"), new CodeRangeEntry("control", "CR_Cc"), new CodeRangeEntry("cf", "CR_Cf"), new CodeRangeEntry("format", "CR_Cf"), new CodeRangeEntry("cn", "CR_Cn"), new CodeRangeEntry("unassigned", "CR_Cn"), new CodeRangeEntry("co", "CR_Co"), new CodeRangeEntry("privateuse", "CR_Co"), new CodeRangeEntry("cs", "CR_Cs"), new CodeRangeEntry("surrogate", "CR_Cs"), new CodeRangeEntry("l", "CR_L"), new CodeRangeEntry("letter", "CR_L"), new CodeRangeEntry("ll", "CR_Ll"), new CodeRangeEntry("lowercaseletter", "CR_Ll"), new CodeRangeEntry("lm", "CR_Lm"), new CodeRangeEntry("modifierletter", "CR_Lm"), new CodeRangeEntry("lo", "CR_Lo"), new CodeRangeEntry("otherletter", "CR_Lo"), new CodeRangeEntry("lt", "CR_Lt"), new CodeRangeEntry("titlecaseletter", "CR_Lt"), new CodeRangeEntry("lu", "CR_Lu"), new CodeRangeEntry("uppercaseletter", "CR_Lu"), new CodeRangeEntry("m", "CR_M"), new CodeRangeEntry("mark", "CR_M"), new CodeRangeEntry("mc", "CR_Mc"), new CodeRangeEntry("spacingmark", "CR_Mc"), new CodeRangeEntry("me", "CR_Me"), new CodeRangeEntry("enclosingmark", "CR_Me"), new CodeRangeEntry("mn", "CR_Mn"), new CodeRangeEntry("nonspacingmark", "CR_Mn"), new CodeRangeEntry("n", "CR_N"), new CodeRangeEntry("number", "CR_N"), new CodeRangeEntry("nd", "CR_Nd"), new CodeRangeEntry("decimalnumber", "CR_Nd"), new CodeRangeEntry("nl", "CR_Nl"), new CodeRangeEntry("letternumber", "CR_Nl"), new CodeRangeEntry("no", "CR_No"), new CodeRangeEntry("othernumber", "CR_No"), new CodeRangeEntry("p", "CR_P"), new CodeRangeEntry("punctuation", "CR_P"), new CodeRangeEntry("pc", "CR_Pc"), new CodeRangeEntry("connectorpunctuation", "CR_Pc"), new CodeRangeEntry("pd", "CR_Pd"), new CodeRangeEntry("dashpunctuation", "CR_Pd"), new CodeRangeEntry("pe", "CR_Pe"), new CodeRangeEntry("closepunctuation", "CR_Pe"), new CodeRangeEntry("pf", "CR_Pf"), new CodeRangeEntry("finalpunctuation", "CR_Pf"), new CodeRangeEntry("pi", "CR_Pi"), new CodeRangeEntry("initialpunctuation", "CR_Pi"), new CodeRangeEntry("po", "CR_Po"), new CodeRangeEntry("otherpunctuation", "CR_Po"), new CodeRangeEntry("ps", "CR_Ps"), new CodeRangeEntry("openpunctuation", "CR_Ps"), new CodeRangeEntry("s", "CR_S"), new CodeRangeEntry("symbol", "CR_S"), new CodeRangeEntry("sc", "CR_Sc"), new CodeRangeEntry("currencysymbol", "CR_Sc"), new CodeRangeEntry("sk", "CR_Sk"), new CodeRangeEntry("modifiersymbol", "CR_Sk"), new CodeRangeEntry("sm", "CR_Sm"), new CodeRangeEntry("mathsymbol", "CR_Sm"), new CodeRangeEntry("so", "CR_So"), new CodeRangeEntry("othersymbol", "CR_So"), new CodeRangeEntry("z", "CR_Z"), new CodeRangeEntry("separator", "CR_Z"), new CodeRangeEntry("zl", "CR_Zl"), new CodeRangeEntry("lineseparator", "CR_Zl"), new CodeRangeEntry("zp", "CR_Zp"), new CodeRangeEntry("paragraphseparator", "CR_Zp"), new CodeRangeEntry("zs", "CR_Zs"), new CodeRangeEntry("spaceseparator", "CR_Zs"), new CodeRangeEntry("math", "CR_Math"), new CodeRangeEntry("alphabetic", "CR_Alphabetic"), new CodeRangeEntry("lowercase", "CR_Lowercase"), new CodeRangeEntry("uppercase", "CR_Uppercase"), new CodeRangeEntry("cased", "CR_Cased"), new CodeRangeEntry("caseignorable", "CR_Case_Ignorable"), new CodeRangeEntry("ci", "CR_Case_Ignorable"), new CodeRangeEntry("changeswhenlowercased", "CR_Changes_When_Lowercased"), new CodeRangeEntry("cwl", "CR_Changes_When_Lowercased"), new CodeRangeEntry("changeswhenuppercased", "CR_Changes_When_Uppercased"), new CodeRangeEntry("cwu", "CR_Changes_When_Uppercased"), new CodeRangeEntry("changeswhentitlecased", "CR_Changes_When_Titlecased"), new CodeRangeEntry("cwt", "CR_Changes_When_Titlecased"), new CodeRangeEntry("changeswhencasefolded", "CR_Changes_When_Casefolded"), new CodeRangeEntry("cwcf", "CR_Changes_When_Casefolded"), new CodeRangeEntry("changeswhencasemapped", "CR_Changes_When_Casemapped"), new CodeRangeEntry("cwcm", "CR_Changes_When_Casemapped"), new CodeRangeEntry("idstart", "CR_ID_Start"), new CodeRangeEntry("ids", "CR_ID_Start"), new CodeRangeEntry("idcontinue", "CR_ID_Continue"), new CodeRangeEntry("idc", "CR_ID_Continue"), new CodeRangeEntry("xidstart", "CR_XID_Start"), new CodeRangeEntry("xids", "CR_XID_Start"), new CodeRangeEntry("xidcontinue", "CR_XID_Continue"), new CodeRangeEntry("xidc", "CR_XID_Continue"), new CodeRangeEntry("defaultignorablecodepoint", "CR_Default_Ignorable_Code_Point"), new CodeRangeEntry("di", "CR_Default_Ignorable_Code_Point"), new CodeRangeEntry("graphemeextend", "CR_Grapheme_Extend"), new CodeRangeEntry("grext", "CR_Grapheme_Extend"), new CodeRangeEntry("graphemebase", "CR_Grapheme_Base"), new CodeRangeEntry("grbase", "CR_Grapheme_Base"), new CodeRangeEntry("graphemelink", "CR_Grapheme_Link"), new CodeRangeEntry("grlink", "CR_Grapheme_Link"), new CodeRangeEntry("common", "CR_Common"), new CodeRangeEntry("zyyy", "CR_Common"), new CodeRangeEntry("latin", "CR_Latin"), new CodeRangeEntry("latn", "CR_Latin"), new CodeRangeEntry("greek", "CR_Greek"), new CodeRangeEntry("grek", "CR_Greek"), new CodeRangeEntry("cyrillic", "CR_Cyrillic"), new CodeRangeEntry("cyrl", "CR_Cyrillic"), new CodeRangeEntry("armenian", "CR_Armenian"), new CodeRangeEntry("armn", "CR_Armenian"), new CodeRangeEntry("hebrew", "CR_Hebrew"), new CodeRangeEntry("hebr", "CR_Hebrew"), new CodeRangeEntry("arabic", "CR_Arabic"), new CodeRangeEntry("arab", "CR_Arabic"), new CodeRangeEntry("syriac", "CR_Syriac"), new CodeRangeEntry("syrc", "CR_Syriac"), new CodeRangeEntry("thaana", "CR_Thaana"), new CodeRangeEntry("thaa", "CR_Thaana"), new CodeRangeEntry("devanagari", "CR_Devanagari"), new CodeRangeEntry("deva", "CR_Devanagari"), new CodeRangeEntry("bengali", "CR_Bengali"), new CodeRangeEntry("beng", "CR_Bengali"), new CodeRangeEntry("gurmukhi", "CR_Gurmukhi"), new CodeRangeEntry("guru", "CR_Gurmukhi"), new CodeRangeEntry("gujarati", "CR_Gujarati"), new CodeRangeEntry("gujr", "CR_Gujarati"), new CodeRangeEntry("oriya", "CR_Oriya"), new CodeRangeEntry("orya", "CR_Oriya"), new CodeRangeEntry("tamil", "CR_Tamil"), new CodeRangeEntry("taml", "CR_Tamil"), new CodeRangeEntry("telugu", "CR_Telugu"), new CodeRangeEntry("telu", "CR_Telugu"), new CodeRangeEntry("kannada", "CR_Kannada"), new CodeRangeEntry("knda", "CR_Kannada"), new CodeRangeEntry("malayalam", "CR_Malayalam"), new CodeRangeEntry("mlym", "CR_Malayalam"), new CodeRangeEntry("sinhala", "CR_Sinhala"), new CodeRangeEntry("sinh", "CR_Sinhala"), new CodeRangeEntry("thai", "CR_Thai"), new CodeRangeEntry("lao", "CR_Lao"), new CodeRangeEntry("laoo", "CR_Lao"), new CodeRangeEntry("tibetan", "CR_Tibetan"), new CodeRangeEntry("tibt", "CR_Tibetan"), new CodeRangeEntry("myanmar", "CR_Myanmar"), new CodeRangeEntry("mymr", "CR_Myanmar"), new CodeRangeEntry("georgian", "CR_Georgian"), new CodeRangeEntry("geor", "CR_Georgian"), new CodeRangeEntry("hangul", "CR_Hangul"), new CodeRangeEntry("hang", "CR_Hangul"), new CodeRangeEntry("ethiopic", "CR_Ethiopic"), new CodeRangeEntry("ethi", "CR_Ethiopic"), new CodeRangeEntry("cherokee", "CR_Cherokee"), new CodeRangeEntry("cher", "CR_Cherokee"), new CodeRangeEntry("canadianaboriginal", "CR_Canadian_Aboriginal"), new CodeRangeEntry("cans", "CR_Canadian_Aboriginal"), new CodeRangeEntry("ogham", "CR_Ogham"), new CodeRangeEntry("ogam", "CR_Ogham"), new CodeRangeEntry("runic", "CR_Runic"), new CodeRangeEntry("runr", "CR_Runic"), new CodeRangeEntry("khmer", "CR_Khmer"), new CodeRangeEntry("khmr", "CR_Khmer"), new CodeRangeEntry("mongolian", "CR_Mongolian"), new CodeRangeEntry("mong", "CR_Mongolian"), new CodeRangeEntry("hiragana", "CR_Hiragana"), new CodeRangeEntry("hira", "CR_Hiragana"), new CodeRangeEntry("katakana", "CR_Katakana"), new CodeRangeEntry("kana", "CR_Katakana"), new CodeRangeEntry("bopomofo", "CR_Bopomofo"), new CodeRangeEntry("bopo", "CR_Bopomofo"), new CodeRangeEntry("han", "CR_Han"), new CodeRangeEntry("hani", "CR_Han"), new CodeRangeEntry("yi", "CR_Yi"), new CodeRangeEntry("yiii", "CR_Yi"), new CodeRangeEntry("olditalic", "CR_Old_Italic"), new CodeRangeEntry("ital", "CR_Old_Italic"), new CodeRangeEntry("gothic", "CR_Gothic"), new CodeRangeEntry("goth", "CR_Gothic"), new CodeRangeEntry("deseret", "CR_Deseret"), new CodeRangeEntry("dsrt", "CR_Deseret"), new CodeRangeEntry("inherited", "CR_Inherited"), new CodeRangeEntry("zinh", "CR_Inherited"), new CodeRangeEntry("qaai", "CR_Inherited"), new CodeRangeEntry("tagalog", "CR_Tagalog"), new CodeRangeEntry("tglg", "CR_Tagalog"), new CodeRangeEntry("hanunoo", "CR_Hanunoo"), new CodeRangeEntry("hano", "CR_Hanunoo"), new CodeRangeEntry("buhid", "CR_Buhid"), new CodeRangeEntry("buhd", "CR_Buhid"), new CodeRangeEntry("tagbanwa", "CR_Tagbanwa"), new CodeRangeEntry("tagb", "CR_Tagbanwa"), new CodeRangeEntry("limbu", "CR_Limbu"), new CodeRangeEntry("limb", "CR_Limbu"), new CodeRangeEntry("taile", "CR_Tai_Le"), new CodeRangeEntry("tale", "CR_Tai_Le"), new CodeRangeEntry("linearb", "CR_Linear_B"), new CodeRangeEntry("linb", "CR_Linear_B"), new CodeRangeEntry("ugaritic", "CR_Ugaritic"), new CodeRangeEntry("ugar", "CR_Ugaritic"), new CodeRangeEntry("shavian", "CR_Shavian"), new CodeRangeEntry("shaw", "CR_Shavian"), new CodeRangeEntry("osmanya", "CR_Osmanya"), new CodeRangeEntry("osma", "CR_Osmanya"), new CodeRangeEntry("cypriot", "CR_Cypriot"), new CodeRangeEntry("cprt", "CR_Cypriot"), new CodeRangeEntry("braille", "CR_Braille"), new CodeRangeEntry("brai", "CR_Braille"), new CodeRangeEntry("buginese", "CR_Buginese"), new CodeRangeEntry("bugi", "CR_Buginese"), new CodeRangeEntry("coptic", "CR_Coptic"), new CodeRangeEntry("copt", "CR_Coptic"), new CodeRangeEntry("qaac", "CR_Coptic"), new CodeRangeEntry("newtailue", "CR_New_Tai_Lue"), new CodeRangeEntry("talu", "CR_New_Tai_Lue"), new CodeRangeEntry("glagolitic", "CR_Glagolitic"), new CodeRangeEntry("glag", "CR_Glagolitic"), new CodeRangeEntry("tifinagh", "CR_Tifinagh"), new CodeRangeEntry("tfng", "CR_Tifinagh"), new CodeRangeEntry("sylotinagri", "CR_Syloti_Nagri"), new CodeRangeEntry("sylo", "CR_Syloti_Nagri"), new CodeRangeEntry("oldpersian", "CR_Old_Persian"), new CodeRangeEntry("xpeo", "CR_Old_Persian"), new CodeRangeEntry("kharoshthi", "CR_Kharoshthi"), new CodeRangeEntry("khar", "CR_Kharoshthi"), new CodeRangeEntry("balinese", "CR_Balinese"), new CodeRangeEntry("bali", "CR_Balinese"), new CodeRangeEntry("cuneiform", "CR_Cuneiform"), new CodeRangeEntry("xsux", "CR_Cuneiform"), new CodeRangeEntry("phoenician", "CR_Phoenician"), new CodeRangeEntry("phnx", "CR_Phoenician"), new CodeRangeEntry("phagspa", "CR_Phags_Pa"), new CodeRangeEntry("phag", "CR_Phags_Pa"), new CodeRangeEntry("nko", "CR_Nko"), new CodeRangeEntry("nkoo", "CR_Nko"), new CodeRangeEntry("sundanese", "CR_Sundanese"), new CodeRangeEntry("sund", "CR_Sundanese"), new CodeRangeEntry("lepcha", "CR_Lepcha"), new CodeRangeEntry("lepc", "CR_Lepcha"), new CodeRangeEntry("olchiki", "CR_Ol_Chiki"), new CodeRangeEntry("olck", "CR_Ol_Chiki"), new CodeRangeEntry("vai", "CR_Vai"), new CodeRangeEntry("vaii", "CR_Vai"), new CodeRangeEntry("saurashtra", "CR_Saurashtra"), new CodeRangeEntry("saur", "CR_Saurashtra"), new CodeRangeEntry("kayahli", "CR_Kayah_Li"), new CodeRangeEntry("kali", "CR_Kayah_Li"), new CodeRangeEntry("rejang", "CR_Rejang"), new CodeRangeEntry("rjng", "CR_Rejang"), new CodeRangeEntry("lycian", "CR_Lycian"), new CodeRangeEntry("lyci", "CR_Lycian"), new CodeRangeEntry("carian", "CR_Carian"), new CodeRangeEntry("cari", "CR_Carian"), new CodeRangeEntry("lydian", "CR_Lydian"), new CodeRangeEntry("lydi", "CR_Lydian"), new CodeRangeEntry("cham", "CR_Cham"), new CodeRangeEntry("taitham", "CR_Tai_Tham"), new CodeRangeEntry("lana", "CR_Tai_Tham"), new CodeRangeEntry("taiviet", "CR_Tai_Viet"), new CodeRangeEntry("tavt", "CR_Tai_Viet"), new CodeRangeEntry("avestan", "CR_Avestan"), new CodeRangeEntry("avst", "CR_Avestan"), new CodeRangeEntry("egyptianhieroglyphs", "CR_Egyptian_Hieroglyphs"), new CodeRangeEntry("egyp", "CR_Egyptian_Hieroglyphs"), new CodeRangeEntry("samaritan", "CR_Samaritan"), new CodeRangeEntry("samr", "CR_Samaritan"), new CodeRangeEntry("lisu", "CR_Lisu"), new CodeRangeEntry("bamum", "CR_Bamum"), new CodeRangeEntry("bamu", "CR_Bamum"), new CodeRangeEntry("javanese", "CR_Javanese"), new CodeRangeEntry("java", "CR_Javanese"), new CodeRangeEntry("meeteimayek", "CR_Meetei_Mayek"), new CodeRangeEntry("mtei", "CR_Meetei_Mayek"), new CodeRangeEntry("imperialaramaic", "CR_Imperial_Aramaic"), new CodeRangeEntry("armi", "CR_Imperial_Aramaic"), new CodeRangeEntry("oldsoutharabian", "CR_Old_South_Arabian"), new CodeRangeEntry("sarb", "CR_Old_South_Arabian"), new CodeRangeEntry("inscriptionalparthian", "CR_Inscriptional_Parthian"), new CodeRangeEntry("prti", "CR_Inscriptional_Parthian"), new CodeRangeEntry("inscriptionalpahlavi", "CR_Inscriptional_Pahlavi"), new CodeRangeEntry("phli", "CR_Inscriptional_Pahlavi"), new CodeRangeEntry("oldturkic", "CR_Old_Turkic"), new CodeRangeEntry("orkh", "CR_Old_Turkic"), new CodeRangeEntry("kaithi", "CR_Kaithi"), new CodeRangeEntry("kthi", "CR_Kaithi"), new CodeRangeEntry("batak", "CR_Batak"), new CodeRangeEntry("batk", "CR_Batak"), new CodeRangeEntry("brahmi", "CR_Brahmi"), new CodeRangeEntry("brah", "CR_Brahmi"), new CodeRangeEntry("mandaic", "CR_Mandaic"), new CodeRangeEntry("mand", "CR_Mandaic"), new CodeRangeEntry("whitespace", "CR_White_Space"), new CodeRangeEntry("wspace", "CR_White_Space"), new CodeRangeEntry("bidicontrol", "CR_Bidi_Control"), new CodeRangeEntry("bidic", "CR_Bidi_Control"), new CodeRangeEntry("joincontrol", "CR_Join_Control"), new CodeRangeEntry("joinc", "CR_Join_Control"), new CodeRangeEntry("dash", "CR_Dash"), new CodeRangeEntry("hyphen", "CR_Hyphen"), new CodeRangeEntry("quotationmark", "CR_Quotation_Mark"), new CodeRangeEntry("qmark", "CR_Quotation_Mark"), new CodeRangeEntry("terminalpunctuation", "CR_Terminal_Punctuation"), new CodeRangeEntry("term", "CR_Terminal_Punctuation"), new CodeRangeEntry("othermath", "CR_Other_Math"), new CodeRangeEntry("omath", "CR_Other_Math"), new CodeRangeEntry("hexdigit", "CR_Hex_Digit"), new CodeRangeEntry("hex", "CR_Hex_Digit"), new CodeRangeEntry("asciihexdigit", "CR_ASCII_Hex_Digit"), new CodeRangeEntry("ahex", "CR_ASCII_Hex_Digit"), new CodeRangeEntry("otheralphabetic", "CR_Other_Alphabetic"), new CodeRangeEntry("oalpha", "CR_Other_Alphabetic"), new CodeRangeEntry("ideographic", "CR_Ideographic"), new CodeRangeEntry("ideo", "CR_Ideographic"), new CodeRangeEntry("diacritic", "CR_Diacritic"), new CodeRangeEntry("dia", "CR_Diacritic"), new CodeRangeEntry("extender", "CR_Extender"), new CodeRangeEntry("ext", "CR_Extender"), new CodeRangeEntry("otherlowercase", "CR_Other_Lowercase"), new CodeRangeEntry("olower", "CR_Other_Lowercase"), new CodeRangeEntry("otheruppercase", "CR_Other_Uppercase"), new CodeRangeEntry("oupper", "CR_Other_Uppercase"), new CodeRangeEntry("noncharactercodepoint", "CR_Noncharacter_Code_Point"), new CodeRangeEntry("nchar", "CR_Noncharacter_Code_Point"), new CodeRangeEntry("othergraphemeextend", "CR_Other_Grapheme_Extend"), new CodeRangeEntry("ogrext", "CR_Other_Grapheme_Extend"), new CodeRangeEntry("idsbinaryoperator", "CR_IDS_Binary_Operator"), new CodeRangeEntry("idsb", "CR_IDS_Binary_Operator"), new CodeRangeEntry("idstrinaryoperator", "CR_IDS_Trinary_Operator"), new CodeRangeEntry("idst", "CR_IDS_Trinary_Operator"), new CodeRangeEntry("radical", "CR_Radical"), new CodeRangeEntry("unifiedideograph", "CR_Unified_Ideograph"), new CodeRangeEntry("uideo", "CR_Unified_Ideograph"), new CodeRangeEntry("otherdefaultignorablecodepoint", "CR_Other_Default_Ignorable_Code_Point"), new CodeRangeEntry("odi", "CR_Other_Default_Ignorable_Code_Point"), new CodeRangeEntry("deprecated", "CR_Deprecated"), new CodeRangeEntry("dep", "CR_Deprecated"), new CodeRangeEntry("softdotted", "CR_Soft_Dotted"), new CodeRangeEntry("sd", "CR_Soft_Dotted"), new CodeRangeEntry("logicalorderexception", "CR_Logical_Order_Exception"), new CodeRangeEntry("loe", "CR_Logical_Order_Exception"), new CodeRangeEntry("otheridstart", "CR_Other_ID_Start"), new CodeRangeEntry("oids", "CR_Other_ID_Start"), new CodeRangeEntry("otheridcontinue", "CR_Other_ID_Continue"), new CodeRangeEntry("oidc", "CR_Other_ID_Continue"), new CodeRangeEntry("sterm", "CR_STerm"), new CodeRangeEntry("variationselector", "CR_Variation_Selector"), new CodeRangeEntry("vs", "CR_Variation_Selector"), new CodeRangeEntry("patternwhitespace", "CR_Pattern_White_Space"), new CodeRangeEntry("patws", "CR_Pattern_White_Space"), new CodeRangeEntry("patternsyntax", "CR_Pattern_Syntax"), new CodeRangeEntry("patsyn", "CR_Pattern_Syntax"), new CodeRangeEntry("unknown", "CR_Unknown"), new CodeRangeEntry("zzzz", "CR_Unknown"), new CodeRangeEntry("age=1.1", "CR_Age_1_1"), new CodeRangeEntry("age=2.0", "CR_Age_2_0"), new CodeRangeEntry("age=2.1", "CR_Age_2_1"), new CodeRangeEntry("age=3.0", "CR_Age_3_0"), new CodeRangeEntry("age=3.1", "CR_Age_3_1"), new CodeRangeEntry("age=3.2", "CR_Age_3_2"), new CodeRangeEntry("age=4.0", "CR_Age_4_0"), new CodeRangeEntry("age=4.1", "CR_Age_4_1"), new CodeRangeEntry("age=5.0", "CR_Age_5_0"), new CodeRangeEntry("age=5.1", "CR_Age_5_1"), new CodeRangeEntry("age=5.2", "CR_Age_5_2"), new CodeRangeEntry("age=6.0", "CR_Age_6_0") } : new CodeRangeEntry[] { new CodeRangeEntry("newline", "CR_NEWLINE"), new CodeRangeEntry("alpha", "CR_Alphabetic"), new CodeRangeEntry("blank", "CR_Blank"), new CodeRangeEntry("cntrl", "CR_Cc"), new CodeRangeEntry("digit", "CR_Nd"), new CodeRangeEntry("graph", "CR_Graph"), new CodeRangeEntry("lower", "CR_Lowercase"), new CodeRangeEntry("print", "CR_Print"), new CodeRangeEntry("punct", "CR_P"), new CodeRangeEntry("space", "CR_White_Space"), new CodeRangeEntry("upper", "CR_Uppercase"), new CodeRangeEntry("xdigit", "CR_ASCII_Hex_Digit"), new CodeRangeEntry("word", "CR_Word"), new CodeRangeEntry("alnum", "CR_Alnum"), new CodeRangeEntry("ascii", "CR_ASCII") }; } jcodings-jcodings-1.0.11/src/org/jcodings/util/000077500000000000000000000000001223451536200213265ustar00rootroot00000000000000jcodings-jcodings-1.0.11/src/org/jcodings/util/ArrayCopy.java000066400000000000000000000037771223451536200241200ustar00rootroot00000000000000/* * Permission is hereby granted, free of charge, to any person obtaining a copy of * this software and associated documentation files (the "Software"), to deal in * the Software without restriction, including without limitation the rights to * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies * of the Software, and to permit persons to whom the Software is furnished to do * so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ package org.jcodings.util; public class ArrayCopy { public static byte[] int2byte(int[]src) { int srcLength = src.length; byte[]dst = new byte[srcLength << 2]; for (int i=0; i>> 0) & 0xff); dst[j++] = (byte) ((x >>> 8) & 0xff); dst[j++] = (byte) ((x >>> 16) & 0xff); dst[j++] = (byte) ((x >>> 24) & 0xff); } return dst; } public static int[] byte2int(byte[]src) { int dstLength = src.length >>> 2; int[]dst = new int[dstLength]; for (int i=0; i extends Hash{ public BytesHash() { super(); } public BytesHash(int size) { super(size); } protected void init() { head = new BytesHashEntry(); } public final static class BytesHashEntry extends HashEntry { public final byte[]bytes; public final int p; public final int end; public BytesHashEntry(int hash, HashEntry next, V value, byte[]bytes, int p, int end, HashEntry head) { super(hash, next, value, head); this.bytes = bytes; this.p = p; this.end = end; } public BytesHashEntry() { super(); bytes = null; p = end = 0; } public boolean equals(byte[]bytes, int p, int end) { if (this.end - this.p != end - p) return false; if (this.bytes == bytes) return true; int q = this.p; while (q < this.end) if (this.bytes[q++] != bytes[p++]) return false; return true; } } public static int hashCode(byte[]bytes, int p, int end) { int key = 0; while (p < end) key = ((key << 16) + (key << 6) - key) + (int)(bytes[p++]); // & 0xff ? we have to match jruby string hash key = key + (key >> 5); return key; } public V put(byte[]bytes, V value) { return put(bytes, 0, bytes.length, value); } public V put(byte[]bytes, int p, int end, V value) { checkResize(); int hash = hashValue(hashCode(bytes, p, end)); int i = bucketIndex(hash, table.length); for (BytesHashEntry entry = (BytesHashEntry)table[i]; entry != null; entry = (BytesHashEntry)entry.next) { if (entry.hash == hash && entry.equals(bytes, p, end)) { entry.value = value; return value; } } table[i] = new BytesHashEntry(hash, table[i], value, bytes, p, end, head); size++; return null; } public void putDirect(byte[]bytes, V value) { putDirect(bytes, 0, bytes.length, value); } public void putDirect(byte[]bytes, int p, int end, V value) { checkResize(); final int hash = hashValue(hashCode(bytes, p, end)); final int i = bucketIndex(hash, table.length); table[i] = new BytesHashEntry(hash, table[i], value, bytes, p, end, head); size++; } public V get(byte[]bytes) { return get(bytes, 0, bytes.length); } public V get(byte[]bytes, int p, int end) { int hash = hashValue(hashCode(bytes, p, end)); for (BytesHashEntry entry = (BytesHashEntry)table[bucketIndex(hash, table.length)]; entry != null; entry = (BytesHashEntry)entry.next) { if (entry.hash == hash && entry.equals(bytes, p, end)) return entry.value; } return null; } public V delete(byte[]bytes) { return delete(bytes, 0, bytes.length); } public V delete(byte[]bytes, int p, int end) { int hash = hashValue(hashCode(bytes, p, end)); int i = bucketIndex(hash, table.length); BytesHashEntry entry = (BytesHashEntry)table[i]; if (entry == null) return null; if (entry.hash == hash && entry.equals(bytes, p, end)) { table[i] = entry.next; size--; entry.remove(); return entry.value; } for (; entry.next != null; entry = (BytesHashEntry)entry.next) { HashEntry tmp = entry.next; if (tmp.hash == hash && entry.equals(bytes, p, end)) { entry.next = entry.next.next; size--; tmp.remove(); return tmp.value; } } return null; } } jcodings-jcodings-1.0.11/src/org/jcodings/util/CaseInsensitiveBytesHash.java000066400000000000000000000147251223451536200271110ustar00rootroot00000000000000/* * Permission is hereby granted, free of charge, to any person obtaining a copy of * this software and associated documentation files (the "Software"), to deal in * the Software without restriction, including without limitation the rights to * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies * of the Software, and to permit persons to whom the Software is furnished to do * so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ package org.jcodings.util; import static org.jcodings.ascii.AsciiTables.ToLowerCaseTable; public final class CaseInsensitiveBytesHash extends Hash{ public CaseInsensitiveBytesHash() { super(); } public CaseInsensitiveBytesHash(int size) { super(size); } protected void init() { head = new CaseInsensitiveBytesHashEntry(); } public final static class CaseInsensitiveBytesHashEntry extends HashEntry { public final byte[]bytes; public final int p; public final int end; public CaseInsensitiveBytesHashEntry(int hash, HashEntry next, V value, byte[]bytes, int p, int end, HashEntry head) { super(hash, next, value, head); this.bytes = bytes; this.p = p; this.end = end; } public CaseInsensitiveBytesHashEntry() { super(); bytes = null; p = end = 0; } public boolean equals(byte[]bytes, int p, int end) { if (this.end - this.p != end - p) return false; if (this.bytes == bytes) return true; int q = this.p; while (q < this.end) if (ToLowerCaseTable[this.bytes[q++] & 0xff] != ToLowerCaseTable[bytes[p++] & 0xff]) return false; return true; } } public static int hashCode(byte[]bytes, int p, int end) { int key = 0; while (p < end) key = ((key << 16) + (key << 6) - key) + (int)(ToLowerCaseTable[bytes[p++] & 0xff]); // & 0xff ? we have to match jruby string hash key = key + (key >> 5); return key; } public V put(byte[]bytes, V value) { return put(bytes, 0, bytes.length, value); } public V put(byte[]bytes, int p, int end, V value) { checkResize(); int hash = hashValue(hashCode(bytes, p, end)); int i = bucketIndex(hash, table.length); for (CaseInsensitiveBytesHashEntry entry = (CaseInsensitiveBytesHashEntry)table[i]; entry != null; entry = (CaseInsensitiveBytesHashEntry)entry.next) { if (entry.hash == hash && entry.equals(bytes, p, end)) { entry.value = value; return value; } } table[i] = new CaseInsensitiveBytesHashEntry(hash, table[i], value, bytes, p, end, head); size++; return null; } public void putDirect(byte[]bytes, V value) { putDirect(bytes, 0, bytes.length, value); } public void putDirect(byte[]bytes, int p, int end, V value) { checkResize(); final int hash = hashValue(hashCode(bytes, p, end)); final int i = bucketIndex(hash, table.length); table[i] = new CaseInsensitiveBytesHashEntry(hash, table[i], value, bytes, p, end, head); size++; } public V get(byte[]bytes) { return get(bytes, 0, bytes.length); } public V get(byte[]bytes, int p, int end) { int hash = hashValue(hashCode(bytes, p, end)); for (CaseInsensitiveBytesHashEntry entry = (CaseInsensitiveBytesHashEntry)table[bucketIndex(hash, table.length)]; entry != null; entry = (CaseInsensitiveBytesHashEntry)entry.next) { if (entry.hash == hash && entry.equals(bytes, p, end)) return entry.value; } return null; } public V delete(byte[]bytes) { return delete(bytes, 0, bytes.length); } public V delete(byte[]bytes, int p, int end) { int hash = hashValue(hashCode(bytes, p, end)); int i = bucketIndex(hash, table.length); CaseInsensitiveBytesHashEntry entry = (CaseInsensitiveBytesHashEntry)table[i]; if (entry == null) return null; if (entry.hash == hash && entry.equals(bytes, p, end)) { table[i] = entry.next; size--; entry.remove(); return entry.value; } for (; entry.next != null; entry = (CaseInsensitiveBytesHashEntry)entry.next) { HashEntry tmp = entry.next; if (tmp.hash == hash && entry.equals(bytes, p, end)) { entry.next = entry.next.next; size--; tmp.remove(); return tmp.value; } } return null; } @Override public CaseInsensitiveBytesHashEntryIterator entryIterator() { return new CaseInsensitiveBytesHashEntryIterator(); } public class CaseInsensitiveBytesHashEntryIterator extends HashEntryIterator { @Override public CaseInsensitiveBytesHashEntry next() { return (CaseInsensitiveBytesHashEntry)super.next(); } // @Override // public Iterator iterator() { // return (CaseInsensitiveBytesHashEntryIterator)this; // } // @Override // public Iterator> iterator() { // return this; // } } public static boolean caseInsensitiveEquals(byte[]bytes, int p, int end, byte[]oBytes, int oP, int oEnd) { if (oEnd - oP != end - p) return false; if (oBytes == bytes) return true; int q = oP; while (q < oEnd) if (ToLowerCaseTable[oBytes[q++] & 0xff] != ToLowerCaseTable[bytes[p++] & 0xff]) return false; return true; } public static boolean caseInsensitiveEquals(byte[]bytes, byte[] oBytes) { return caseInsensitiveEquals(bytes, 0, bytes.length, oBytes, 0, oBytes.length); } } jcodings-jcodings-1.0.11/src/org/jcodings/util/Hash.java000066400000000000000000000132161223451536200230570ustar00rootroot00000000000000/* * Permission is hereby granted, free of charge, to any person obtaining a copy of * this software and associated documentation files (the "Software"), to deal in * the Software without restriction, including without limitation the rights to * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies * of the Software, and to permit persons to whom the Software is furnished to do * so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ package org.jcodings.util; import java.util.Iterator; import org.jcodings.exception.InternalException; public abstract class Hash implements Iterable { protected HashEntry[]table; protected int size; private static final int PRIMES[] = { 8 + 3, 16 + 3, 32 + 5, 64 + 3, 128 + 3, 256 + 27, 512 + 9, 1024 + 9, 2048 + 5, 4096 + 3, 8192 + 27, 16384 + 43, 32768 + 3, 65536 + 45, 131072 + 29, 262144 + 3, 524288 + 21, 1048576 + 7, 2097152 + 17, 4194304 + 15, 8388608 + 9, 16777216 + 43, 33554432 + 35, 67108864 + 15, 134217728 + 29, 268435456 + 3, 536870912 + 11, 1073741824 + 85, 0 }; private static final int INITIAL_CAPACITY = PRIMES[0]; private static final int MAXIMUM_CAPACITY = 1 << 30; public Hash() { table = new HashEntry[INITIAL_CAPACITY]; init(); } protected HashEntry head; protected abstract void init(); public Hash(int size) { for (int i=0, n=MIN_CAPA; i size) { table = new HashEntry[PRIMES[i]]; init(); return; } } throw new InternalException("run out of polynomials"); } public final int size() { return size; } public static class HashEntry { final int hash; protected HashEntry next, before, after; public V value; HashEntry(int hash, HashEntry next, V value, HashEntry head) { this.hash = hash; this.next = next; this.value = value; after = head; before = head.before; before.after = this; after.before = this; } void remove() { before.after = after; after.before = before; } HashEntry() { hash = 0; before = after = this; } public int getHash() { return hash; } } private static final int MIN_CAPA = 8; // private static final int DENSITY = 5; protected final void checkResize() { if (size == table.length) { // size / table.length > DENSITY int forSize = table.length + 1; // size + 1; for (int i=0, newCapacity = MIN_CAPA; i < PRIMES.length; i++, newCapacity <<= 1) { if (newCapacity > forSize) { resize(PRIMES[i]); return; } } return; } } protected final void resize(int newCapacity) { final HashEntry[] oldTable = table; final HashEntry[] newTable = new HashEntry[newCapacity]; for (int j = 0; j < oldTable.length; j++) { HashEntry entry = oldTable[j]; oldTable[j] = null; while (entry != null) { HashEntry next = entry.next; int i = bucketIndex(entry.hash, newCapacity); entry.next = newTable[i]; newTable[i] = entry; entry = next; } } table = newTable; } protected static int bucketIndex(final int h, final int length) { return (h % length); } private static final int HASH_SIGN_BIT_MASK = ~(1 << 31); protected static int hashValue(int h) { return h & HASH_SIGN_BIT_MASK; } public Iterator iterator() { return new HashIterator(); } public class HashIterator implements Iterator { HashEntry next; public HashIterator() { next = head.after; } public boolean hasNext() { return next != head; } public V next() { HashEntry e = next; next = e.after; return e.value; } public void remove() { throw new InternalException("not supported operation exception"); } } public HashEntryIterator entryIterator() { return new HashEntryIterator(); } public class HashEntryIterator implements Iterator>, Iterable> { HashEntry next; public HashEntryIterator() { next = head.after; } public Iterator> iterator() { return this; } public boolean hasNext() { return next != head; } public HashEntry next() { HashEntry e = next; next = e.after; return e; } public void remove() { throw new InternalException("not supported operation exception"); } } } jcodings-jcodings-1.0.11/src/org/jcodings/util/IntArrayHash.java000066400000000000000000000112631223451536200245310ustar00rootroot00000000000000/* * Permission is hereby granted, free of charge, to any person obtaining a copy of * this software and associated documentation files (the "Software"), to deal in * the Software without restriction, including without limitation the rights to * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies * of the Software, and to permit persons to whom the Software is furnished to do * so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ package org.jcodings.util; public final class IntArrayHash extends Hash{ public IntArrayHash() { super(); } public IntArrayHash(int size) { super(size); } protected void init() { head = new IntArrayHashEntry(); } public final static class IntArrayHashEntry extends HashEntry { public final int[]key; public IntArrayHashEntry(int hash, HashEntry next, V value, int[]key, HashEntry head) { super(hash, next, value, head); this.key = key; } public IntArrayHashEntry() { super(); key = null; } public boolean equals(int[]key) { if (this.key == key) return true; if (this.key.length != key.length) return false; switch(key.length) { case 1: return this.key[0] == key[0]; case 2: return this.key[0] == key[0] && this.key[1] == key[1]; case 3: return this.key[0] == key[0] && this.key[1] == key[1] && this.key[2] == key[2]; case 4: return this.key[0] == key[0] && this.key[1] == key[1] && this.key[2] == key[2] && this.key[3] == key[3]; default: for (int i=0; i entry = (IntArrayHashEntry)table[i]; entry != null; entry = (IntArrayHashEntry)entry.next) { if (entry.hash == hash && entry.equals(key)) { entry.value = value; return value; } } table[i] = new IntArrayHashEntry(hash, table[i], value, key, head); size++; return null; } public void putDirect(int[]key, V value) { checkResize(); final int hash = hashValue(hashCode(key)); final int i = bucketIndex(hash, table.length); table[i] = new IntArrayHashEntry(hash, table[i], value, key, head); size++; } public V get(int ... key) { int hash = hashValue(hashCode(key)); for (IntArrayHashEntry entry = (IntArrayHashEntry)table[bucketIndex(hash, table.length)]; entry != null; entry = (IntArrayHashEntry)entry.next) { if (entry.hash == hash && entry.equals(key)) return entry.value; } return null; } public V delete(int ... key) { int hash = hashValue(hashCode(key)); int i = bucketIndex(hash, table.length); IntArrayHashEntry entry = (IntArrayHashEntry)table[i]; if (entry == null) return null; if (entry.hash == hash && entry.equals(key)) { table[i] = entry.next; size--; entry.remove(); return entry.value; } for (; entry.next != null; entry = (IntArrayHashEntry)entry.next) { HashEntry tmp = entry.next; if (tmp.hash == hash && entry.equals(key)) { entry.next = entry.next.next; size--; tmp.remove(); return tmp.value; } } return null; } } jcodings-jcodings-1.0.11/src/org/jcodings/util/IntHash.java000066400000000000000000000065301223451536200235330ustar00rootroot00000000000000/* * Permission is hereby granted, free of charge, to any person obtaining a copy of * this software and associated documentation files (the "Software"), to deal in * the Software without restriction, including without limitation the rights to * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies * of the Software, and to permit persons to whom the Software is furnished to do * so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ package org.jcodings.util; public class IntHash extends Hash { public IntHash() { super(); } public IntHash(int size) { super(size); } protected void init() { head = new IntHashEntry(); } public static final class IntHashEntry extends HashEntry { public IntHashEntry(int hash, HashEntry next, V value, HashEntry head) { super(hash, next, value, head); } public IntHashEntry() { super(); } } public V put(int key, V value) { checkResize(); int hash = hashValue(key); int i = bucketIndex(hash, table.length); for (IntHashEntry entry = (IntHashEntry)table[i]; entry != null; entry = (IntHashEntry)entry.next) { if (entry.hash == hash) { entry.value = value; return value; } } table[i] = new IntHashEntry(hash, table[i], value, head); size++; return null; } public void putDirect(int key, V value) { checkResize(); final int hash = hashValue(key); final int i = bucketIndex(hash, table.length); table[i] = new IntHashEntry(hash, table[i], value, head); size++; } public V get(int key) { int hash = hashValue(key); for (IntHashEntry entry = (IntHashEntry)table[bucketIndex(hash, table.length)]; entry != null; entry = (IntHashEntry)entry.next) { if (entry.hash == hash) return entry.value; } return null; } public V delete(int key) { int hash = hashValue(key); int i = bucketIndex(hash, table.length); IntHashEntry entry = (IntHashEntry)table[i]; if (entry == null) return null; if (entry.hash == hash) { table[i] = entry.next; size--; entry.remove(); return entry.value; } for (; entry.next != null; entry = (IntHashEntry)entry.next) { HashEntry tmp = entry.next; if (tmp.hash == hash && entry.equals(key)) { entry.next = entry.next.next; size--; tmp.remove(); return tmp.value; } } return null; } } jcodings-jcodings-1.0.11/src/org/jcodings/util/ObjHash.java000066400000000000000000000073721223451536200235200ustar00rootroot00000000000000/* * Permission is hereby granted, free of charge, to any person obtaining a copy of * this software and associated documentation files (the "Software"), to deal in * the Software without restriction, including without limitation the rights to * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies * of the Software, and to permit persons to whom the Software is furnished to do * so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ package org.jcodings.util; public final class ObjHash extends Hash { protected void init() { head = new ObjHashEntry(); } public final static class ObjHashEntry extends HashEntry { public final K key; public ObjHashEntry(int hash, HashEntry next, V value, K key, HashEntry head) { super(hash, next, value, head); this.key = key; } public ObjHashEntry() { super(); key = null; } public boolean equals(Object key) { if (this.key == key) return true; return this.key.equals(key); } } public V put(K key, V value) { checkResize(); int hash = hashValue(key.hashCode()); int i = bucketIndex(hash, table.length); K k; for (ObjHashEntry entry = (ObjHashEntry)table[i]; entry != null; entry = (ObjHashEntry)entry.next) { if (entry.hash == hash && ((k = entry.key) == key || key.equals(k))) { entry.value = value; return value; } } table[i] = new ObjHashEntry(hash, table[i], value, key, head); size++; return null; } public void putDirect(K key, V value) { checkResize(); final int hash = hashValue(key.hashCode()); final int i = bucketIndex(hash, table.length); table[i] = new ObjHashEntry(hash, table[i], value, key, head); size++; } public V get(K key) { int hash = hashValue(key.hashCode()); K k; for (ObjHashEntry entry = (ObjHashEntry)table[bucketIndex(hash, table.length)]; entry != null; entry = (ObjHashEntry)entry.next) { if (entry.hash == hash && ((k = entry.key) == key || key.equals(k))) return entry.value; } return null; } public V delete(K key) { int hash = hashValue(key.hashCode()); int i = bucketIndex(hash, table.length); ObjHashEntry entry = (ObjHashEntry)table[i]; if (entry == null) return null; K k; if (entry.hash == hash && ((k = entry.key) == key || key.equals(k))) { table[i] = entry.next; size--; entry.remove(); return entry.value; } for (; entry.next != null; entry = (ObjHashEntry)entry.next) { HashEntry tmp = entry.next; if (tmp.hash == hash && ((k = entry.key) == key || key.equals(k))) { entry.next = entry.next.next; size--; tmp.remove(); return tmp.value; } } return null; } } jcodings-jcodings-1.0.11/test/000077500000000000000000000000001223451536200161525ustar00rootroot00000000000000jcodings-jcodings-1.0.11/test/org/000077500000000000000000000000001223451536200167415ustar00rootroot00000000000000jcodings-jcodings-1.0.11/test/org/jcodings/000077500000000000000000000000001223451536200205415ustar00rootroot00000000000000jcodings-jcodings-1.0.11/test/org/jcodings/specific/000077500000000000000000000000001223451536200223265ustar00rootroot00000000000000jcodings-jcodings-1.0.11/test/org/jcodings/specific/TestASCIIEncoding.java000066400000000000000000000041731223451536200263350ustar00rootroot00000000000000/* * Permission is hereby granted, free of charge, to any person obtaining a copy of * this software and associated documentation files (the "Software"), to deal in * the Software without restriction, including without limitation the rights to * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies * of the Software, and to permit persons to whom the Software is furnished to do * so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ package org.jcodings.specific; import org.jcodings.exception.EncodingException; import org.jcodings.specific.ASCIIEncoding; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertArrayEquals; import org.junit.Rule; import org.junit.Test; import org.junit.rules.ExpectedException; public class TestASCIIEncoding { @Rule public ExpectedException expectedException = ExpectedException.none(); @Test public void testValidCodeToMbcLength() { assertEquals(1, ASCIIEncoding.INSTANCE.codeToMbcLength(0xff)); } @Test public void testValidCodeToMbc() { byte[] buffer = new byte[1]; assertEquals(1, ASCIIEncoding.INSTANCE.codeToMbc(0xff, buffer, 0)); assertArrayEquals(new byte[]{ -1 }, buffer); } @Test public void testInvalidCodeToMbc() { expectedException.expect(EncodingException.class); expectedException.expectMessage("out of range char"); byte[] buffer = new byte[1]; assertEquals(1, ASCIIEncoding.INSTANCE.codeToMbc(0x100, buffer, 0)); } } jcodings-jcodings-1.0.11/test/org/jcodings/specific/TestBig5.java000077500000000000000000000013551223451536200246260ustar00rootroot00000000000000package org.jcodings.specific; import static org.junit.Assert.assertEquals; import static org.junit.Assume.assumeTrue; import java.nio.charset.Charset; import org.jcodings.specific.BIG5Encoding; import org.junit.Test; public class TestBig5 { @Test public void testGetCharset() { Charset Big5 = Charset.forName("Big5"); assumeTrue(Big5 != null); assertEquals("Big5Encoding.charset should be 'Big5'", Big5, BIG5Encoding.INSTANCE.getCharset()); } @Test public void testGetCharsetName() { assertEquals("Big5Encoding.charsetName should be 'Big5'", "Big5".toUpperCase(), BIG5Encoding.INSTANCE.getCharsetName().toUpperCase()); } } jcodings-jcodings-1.0.11/test/org/jcodings/specific/TestEUCJP.java000077500000000000000000000013421223451536200247020ustar00rootroot00000000000000package org.jcodings.specific; import static org.junit.Assert.assertEquals; import static org.junit.Assume.assumeTrue; import java.nio.charset.Charset; import org.jcodings.specific.EUCJPEncoding; import org.junit.Test; public class TestEUCJP { @Test public void testGetCharset() { Charset EUCJP = Charset.forName("EUC-JP"); assumeTrue(EUCJP != null); assertEquals("EUCJPEncoding.charset should be 'EUC-JP'", EUCJP, EUCJPEncoding.INSTANCE.getCharset()); } @Test public void testGetCharsetName() { assertEquals("EUCJPEncoding.charsetName should be 'EUC-JP'", "EUC-JP", EUCJPEncoding.INSTANCE.getCharsetName()); } } jcodings-jcodings-1.0.11/test/org/jcodings/specific/TestEmacsMule.java000066400000000000000000000010051223451536200257000ustar00rootroot00000000000000package org.jcodings.specific; import static org.junit.Assert.assertEquals; import org.jcodings.specific.EmacsMuleEncoding; import org.junit.Test; public class TestEmacsMule { @Test public void testRightAdjustCharHeadAscii() { byte[] str = new byte[]{(byte)'a', (byte)'b', (byte)'c', (byte)',', (byte)'d', (byte)'e', (byte)'f'}; int t = EmacsMuleEncoding.INSTANCE.rightAdjustCharHead(str, 0, 3, 7); assertEquals("rightAdjustCharHead did not adjust properly", 3, t); } } jcodings-jcodings-1.0.11/test/org/jcodings/specific/TestGBK.java000077500000000000000000000032631223451536200244430ustar00rootroot00000000000000package org.jcodings.specific; import static org.junit.Assert.assertEquals; import static org.junit.Assume.assumeTrue; import java.nio.charset.Charset; import org.jcodings.Encoding; import org.jcodings.EncodingDB; import org.jcodings.EncodingDB.Entry; import org.jcodings.specific.GBKEncoding; import org.jcodings.util.CaseInsensitiveBytesHash; import org.junit.Before; import org.junit.Test; public class TestGBK { private CaseInsensitiveBytesHash encodings; @Before public void setUp() throws Exception { encodings = EncodingDB.getEncodings(); } @Test public void testGBK() { String charset_name = Charset.defaultCharset().displayName(); assumeTrue(charset_name.equals("GBK")); Encoding from_jcodings = encodings.get(charset_name.getBytes()).getEncoding(); assertEquals("the encoding got from jcodings should also be GBK, same as input", charset_name, from_jcodings.toString()); } @Test public void testGBKEncoding() { assertEquals("GBKEncoding.INSTANCE should be of type GBKEncoding", GBKEncoding.class.getCanonicalName(), GBKEncoding.INSTANCE.getClass().getCanonicalName()); } @Test public void testGetCharset() { Charset GBK = Charset.forName("GBK"); assumeTrue(GBK != null); assertEquals("GBKEncoding.charset should be 'GBK'", GBK, GBKEncoding.INSTANCE.getCharset()); } @Test public void testGetCharsetName() { assertEquals("GBKEncoding.charsetName should be 'GBK'", "GBK", GBKEncoding.INSTANCE.getCharsetName()); } } jcodings-jcodings-1.0.11/test/org/jcodings/specific/TestUSASCIIEncoding.java000066400000000000000000000044641223451536200266100ustar00rootroot00000000000000/* * Permission is hereby granted, free of charge, to any person obtaining a copy of * this software and associated documentation files (the "Software"), to deal in * the Software without restriction, including without limitation the rights to * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies * of the Software, and to permit persons to whom the Software is furnished to do * so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ package org.jcodings.specific; import org.jcodings.exception.EncodingException; import org.jcodings.specific.ASCIIEncoding; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertArrayEquals; import org.jcodings.specific.USASCIIEncoding; import org.junit.Rule; import org.junit.Test; import org.junit.rules.ExpectedException; public class TestUSASCIIEncoding { @Rule public ExpectedException expectedException = ExpectedException.none(); /** * codeToMbcLength always returns 1, even when codepoint is invalid, * as Config.VANILLA == false. */ @Test public void testValidCodeToMbcLength() { assertEquals(1, ASCIIEncoding.INSTANCE.codeToMbcLength(0xff)); } @Test public void testValidCodeToMbc() { byte[] buffer = new byte[1]; assertEquals(1, USASCIIEncoding.INSTANCE.codeToMbc(0x7f, buffer, 0)); assertArrayEquals(new byte[]{0x7f}, buffer); } @Test public void testInvalidCodeToMbc() { expectedException.expect(EncodingException.class); expectedException.expectMessage("out of range char"); byte[] buffer = new byte[1]; assertEquals(1, USASCIIEncoding.INSTANCE.codeToMbc(0x80, buffer, 0)); } }