File tree 4 files changed +36
-7
lines changed
4 files changed +36
-7
lines changed Original file line number Diff line number Diff line change 8
8
INDENT = " " * 4
9
9
10
10
def generate_data
11
- # generate_encoding_list
12
- # generate_transcoder_list
13
- # generate_transoder_data
14
- # generate_coderange_data
15
- # generate_coderange_list
11
+ generate_encoding_list
12
+ generate_transcoder_list
13
+ generate_transoder_data
14
+ generate_coderange_data
15
+ generate_coderange_list
16
16
generate_fold_data
17
17
end
18
18
@@ -245,9 +245,9 @@ def generate_fold_data
245
245
246
246
when /CaseMappingSpecials/
247
247
open ( "#{ DST_BIN_DIR } /CaseMappingSpecials.bin" , "wb" ) do |f |
248
- size = src [ /CaseMappingSpecials\[ \] \s +=\s +\{ (.*?)\} \; /m , 1 ] . split ( ',' ) . size
248
+ size = src [ /CaseMappingSpecials\[ \] \s +=\s +\{ (.*?)\} \; /m , 1 ] . scan ( /0x \d +/ ) . size
249
249
f << [ size ] . pack ( "N" )
250
- address . step ( address + ( size * 4 - 1 ) , 4 ) . each do |adr |
250
+ address . step ( address + ( size * 4 ) , 4 ) . each do |adr |
251
251
f << binary [ adr , 4 ] . unpack ( "l" ) . pack ( "N" )
252
252
end
253
253
end
Original file line number Diff line number Diff line change @@ -40,6 +40,8 @@ public interface Config {
40
40
final int SpecialIndexWidth = 10 ;
41
41
final int SpecialIndexMask = ((1 << SpecialIndexWidth ) - 1 ) << SpecialIndexShift ;
42
42
43
+ final int SpecialsLengthOffset = 25 ;
44
+
43
45
final int CASE_UPCASE = (1 <<13 ); /* has/needs uppercase mapping */
44
46
final int CASE_DOWNCASE = (1 <<14 ); /* has/needs lowercase mapping */
45
47
final int CASE_TITLECASE = (1 <<15 ); /* has/needs (special) titlecase mapping */
Original file line number Diff line number Diff line change 21
21
22
22
import java .io .DataInputStream ;
23
23
import java .io .IOException ;
24
+ import java .util .ArrayList ;
24
25
25
26
import org .jcodings .ApplyAllCaseFoldFunction ;
26
27
import org .jcodings .CaseFoldCodeItem ;
@@ -631,4 +632,30 @@ private static IntArrayHash<CodeList> initializeUnfold3Hash() {
631
632
632
633
static final IntArrayHash <CodeList > Hash = initializeUnfold3Hash ();
633
634
}
635
+
636
+ private static class CaseMappingSpecials {
637
+ static ArrayList <int []> read () {
638
+ try {
639
+ DataInputStream dis = ArrayReader .openStream ("CaseMappingSpecials" );
640
+ int size = dis .readInt ();
641
+ ArrayList <int []> values = new ArrayList <int []>();
642
+ for (int i = 0 ; i < size ; i ++) {
643
+ int packed = dis .readInt ();
644
+ int length = packed >>> Config .SpecialsLengthOffset ;
645
+ int []codes = new int [length ];
646
+ codes [0 ] = packed & ((1 << Config .SpecialsLengthOffset ) - 1 );
647
+ for (int j = 1 ; j < length ; j ++) {
648
+ i ++;
649
+ codes [j ] = dis .readInt ();
650
+ }
651
+ values .add (codes );
652
+ }
653
+ return values ;
654
+ } catch (IOException ioe ) {
655
+ throw new RuntimeException (ioe );
656
+ }
657
+ }
658
+
659
+ private static ArrayList <int []> Values = read ();
660
+ }
634
661
}
You can’t perform that action at this time.
0 commit comments