コード例 #1
0
 private void DumpPropArray(int [] array, int count, bool getCP)
 {
     if (array.Length < count)
     {
         throw new ArgumentOutOfRangeException("count");
     }
     for (int i = 0; i < count; i++)
     {
         uint value = (uint)array [i];
         if (value < 10)
         {
             CSOut.Write("{0}, ", value);
         }
         else
         {
             CSOut.Write("0x{0:X}, ", value);
         }
         COut.Write("{0},", value);
         if (i % 16 == 15)
         {
             int l = getCP ? NUtil.PropCP(i) : i;
             CSOut.WriteLine("// {0:X04}-{1:X04}", l - 15, l);
             COut.WriteLine();
         }
     }
 }
コード例 #2
0
		static int GetNormalizedStringLength (int ch)
		{
			int start = charMapIndex [NUtil.MapIdx (ch)];
			int i = start;
			while (mappedChars [i] != 0)
				i++;
			return i - start;
		}
コード例 #3
0
        private void SetCanonProp(int cp, int cpEnd, int flag)
        {
            int idx = NUtil.MapIdx(cp);

            if (cpEnd < 0)
            {
                mapIndex [idx] = flag;
            }
            else
            {
                int idxEnd = NUtil.MapIdx(cpEnd);
                for (int i = idx; i <= idxEnd; i++)
                {
                    mapIndex [i] = flag;
                }
            }
        }
コード例 #4
0
        private void RebaseUCD()
        {
            mappings.Sort(comparer);
            // mappedChars[0] = 0. This assures that value 0 of
            // mapIndex means there is no mapping.
            int count = 1;

            int [] compressedMapping = new int [mappedCharCount];
            // Update map index.
            int [] newMapIndex = new int [mappings.Count];
            for (int mi = 0; mi < mappings.Count; mi++)
            {
                CharMapping m = (CharMapping)mappings [mi];
                if (mi > 0 && 0 == comparer.Compare(
                        mappings [mi - 1], mappings [mi]))
                {
                    newMapIndex [mi] = newMapIndex [mi - 1];
                    continue;
                }
                newMapIndex [mi] = count;
                for (int i = m.MapIndex; mappedChars [i] != 0; i++)
                {
                    compressedMapping [count++] = mappedChars [i];
                }
                compressedMapping [count++] = 0;
            }
            for (int mi = 0; mi < mappings.Count; mi++)
            {
                ((CharMapping)mappings [mi]).MapIndex = newMapIndex [mi];
            }

            int [] compressedMapIndex = new int [mapIndex.Length];
            foreach (CharMapping m in mappings)
            {
                if (m.CodePoint <= char.MaxValue)
                {
                    compressedMapIndex [NUtil.MapIdx(m.CodePoint)] = m.MapIndex;
                }
            }

            mappedChars     = compressedMapping;
            mapIndex        = compressedMapIndex;
            mappedCharCount = count;
        }
コード例 #5
0
        private void SetProp(int cp, int cpEnd, int flag)
        {
            int idx = NUtil.PropIdx(cp);

            if (idx == 0)
            {
                throw new Exception(String.Format("Codepoint {0:X04} should be included in the indexer.", cp));
            }
            if (cpEnd < 0)
            {
                prop [idx] |= flag;
            }
            else
            {
                int idxEnd = NUtil.PropIdx(cpEnd);
                for (int i = idx; i <= idxEnd; i++)
                {
                    prop [i] |= flag;
                }
            }
        }
コード例 #6
0
		static int CharMapIdx (int cp)
		{
			return charMapIndex [NUtil.MapIdx (cp)];
		}
コード例 #7
0
//		public const int ExpandOnNfd = 256;
//		public const int ExpandOnNfc = 512;
//		public const int ExpandOnNfkd = 1024;
//		public const int ExpandOnNfkc = 2048;

		static uint PropValue (int cp)
		{
			return props [NUtil.PropIdx (cp)];
		}