3.1.5.2.5 TestHungarianCharacterSequences

This algorithm checks if the specified UTF-16 string has a Hungarian special-character sequence for the specified locale in the specific string index.

Hungarian contains special character sequences in which the first character of the string designates a string that is equivalent to the last three characters of the string. For example, the string "ddzs" is actually treated as the string "dzsdzs" for the purposes of generating the sort key. This function checks to see if the specified locale is Hungarian, and it also checks to see if the next two characters starting in the specified index are the same. If so, this indicates that it is a likely Hungarian special-character sequence.

 COMMENT TestHungarianCharacterSequences
 COMMENT
 COMMENT  On Entry:  SortLocale    - Locale to use for linguistic data
 COMMENT             SourceString  - Unicode String to look for Hungarian
 COMMENT                             special character sequence in
 COMMENT             SourceIndex   - Index of character in string to
 COMMENT                             look for start of
 COMMENT                             Hungarian special character sequence
 COMMENT
 COMMENT  On Exit:   Result        - Set to true if a Hungarian special
 COMMENT                             character sequence
 COMMENT                             was found
 COMMENT
     
 PROCEDURE TestHungarianCharacterSequences(IN SortLocale : LCID,
                                 IN SourceString : Unicode String,
                                 IN SourceIndex : 32 bit integer,
                                 OUT Result : Boolean)
  
 // Hungarian special character sequence only happen to Hungarian
 // Note that this can be found in unisort.txt in the 
 // SORTTABLES\DOUBLECOMPRESSION section, however since
 // there's only 1 locale just hard code it here.
 IF SortLocale not equal to LCID_HUNGARIAN) THEN
     SET Result to false
     RETURN
 ENDIF
  
 // first test to make sure more data is available                         
 IF SourceIndex + 1 is greater than or equal to
                       Length(SourceString) THEN
     SET Result to false
     RETURN
 ENDIF
  
 // CMP_MASKOFF_CW (e7) is not necessary
 // since it was already masked off
 SET FirstWeight to CALL GetCharacterWeights WITH
         (SortLocale, SourceString[SourceIndex])
 SET SecondWeight to CALL GetCharacterWeights WITH
         (SortLocale, SourceString[SourceIndex + 1])
  
 IF FirstWeight is equal to SecondWeight THEN
     SET Result to true
 ELSE
     SET Result to false
 ENDIF
  
 RETURN