summary refs log tree commit diff stats
path: root/lib/system/widestrs.nim
diff options
context:
space:
mode:
authorFlaviu Tamas <tamasflaviu@gmail.com>2015-05-26 19:32:50 -0400
committerFlaviu Tamas <tamasflaviu@gmail.com>2015-06-07 13:12:18 -0400
commit90ed34db72e8ea8f70d1e86dd2335efe48532fa8 (patch)
tree9d9e46c0ddbb87f562981f072220bd36a7f199cb /lib/system/widestrs.nim
parent075a5e844069979f1fc3782839e9e2cc62c61ad5 (diff)
parentbbb1bdb4a939aa43ed981acc2f96bce918be7d21 (diff)
downloadNim-90ed34db72e8ea8f70d1e86dd2335efe48532fa8.tar.gz
Merge branch 'devel' of https://github.com/Araq/Nim into add-nre
* 'devel' of https://github.com/Araq/Nim:
  Fix #964, fix #1384
  Don't inspect typedescs
Diffstat (limited to 'lib/system/widestrs.nim')
-rw-r--r--lib/system/widestrs.nim15
1 files changed, 8 insertions, 7 deletions
diff --git a/lib/system/widestrs.nim b/lib/system/widestrs.nim
index 1e8bc6791..e7b7f3972 100644
--- a/lib/system/widestrs.nim
+++ b/lib/system/widestrs.nim
@@ -14,8 +14,9 @@ when not declared(NimString):
   {.error: "You must not import this module explicitly".}
 
 type
-  TUtf16Char* = distinct int16
-  WideCString* = ref array[0.. 1_000_000, TUtf16Char]
+  Utf16Char* = distinct int16
+  WideCString* = ref array[0.. 1_000_000, Utf16Char]
+{.deprecated: [TUtf16Char: Utf16Char].}
 
 proc len*(w: WideCString): int =
   ## returns the length of a widestring. This traverses the whole string to
@@ -23,7 +24,7 @@ proc len*(w: WideCString): int =
   while int16(w[result]) != 0'i16: inc result
 
 const
-  UNI_REPLACEMENT_CHAR = TUtf16Char(0xFFFD'i16)
+  UNI_REPLACEMENT_CHAR = Utf16Char(0xFFFD'i16)
   UNI_MAX_BMP = 0x0000FFFF
   UNI_MAX_UTF16 = 0x0010FFFF
   UNI_MAX_UTF32 = 0x7FFFFFFF
@@ -89,16 +90,16 @@ proc newWideCString*(source: cstring, L: int): WideCString =
       if ch >=% UNI_SUR_HIGH_START and ch <=% UNI_SUR_LOW_END:
         result[d] = UNI_REPLACEMENT_CHAR
       else:
-        result[d] = TUtf16Char(toU16(ch))
+        result[d] = Utf16Char(toU16(ch))
     elif ch >% UNI_MAX_UTF16:
       result[d] = UNI_REPLACEMENT_CHAR
     else:
       let ch = ch -% halfBase
-      result[d] = TUtf16Char(toU16((ch shr halfShift) +% UNI_SUR_HIGH_START))
+      result[d] = Utf16Char(toU16((ch shr halfShift) +% UNI_SUR_HIGH_START))
       inc d
-      result[d] = TUtf16Char(toU16((ch and halfMask) +% UNI_SUR_LOW_START))
+      result[d] = Utf16Char(toU16((ch and halfMask) +% UNI_SUR_LOW_START))
     inc d
-  result[d] = TUtf16Char(0'i16)
+  result[d] = Utf16Char(0'i16)
 
 proc newWideCString*(s: cstring): WideCString =
   if s.isNil: return nil