3.1.5.2.26 InitKoreanScriptMap

This algorithm specifies the initialization of a data structure that is required for the special processing of Korean script members.

 COMMENT InitKoreanScriptMap
 COMMENT
 COMMENT  On Entry:  global KoreanScriptMap - presumed to be null
 COMMENT
 COMMENT  On Exit:   global KoreanScriptMap - initialized to map
 COMMENT                                      scripts to Korean
 COMMENT
 COMMENT  This procedure initializes the Korean, causing ideographic
 COMMENT  scripts to sort prior to other scripts for the Korean.
 COMMENT
  
 PROCEDURE InitKoreanScriptMap
  
 SET KoreanScriptMap to new array of 256 null bytes
  
 // Initialize the "scripts" prior to first script (Latin, script 14)
 FOR counter is 0 to FIRST_SCRIPT - 1
      SET KoreanScriptMap[counter] to counter
 ENDFOR counter
  
 // For Korean the Ideographs sort to the first script,
 // so start with that index
 SET NewScript to FIRST_SCRIPT
  
 // Test if the IDEOGRAPH script is part of a multiple weights script
  
 // For convenience hard code the information from the
 // unisort.txt section SORTTABLES\MULTIPLEWEIGHTS
 // IDEOGRAPHS are 128 through 241,
 // map them to FIRST_SCRIPT through 127
 FOR counter is IDEOGRAPH to 241
      SET KoreanScriptMap[counter] to NewScript
      INCREMENT NewScript
 ENDFOR
  
 // Now set the remaining unset scripts the next NewScript value
 FOR counter is 0 to MAX_SCRIPTS - 1
      // If the value has not been set yet, set it to the next value
      IF KoreanScriptMap[counter] is null THEN
           SET KoreanScriptMap[counter] to NewScript
           INCREMENT NewScript
      ENDIF
 ENDFOR