about summary refs log tree commit diff stats
path: root/src/utils/twtstr.nim
diff options
context:
space:
mode:
Diffstat (limited to 'src/utils/twtstr.nim')
-rw-r--r--src/utils/twtstr.nim37
1 files changed, 0 insertions, 37 deletions
diff --git a/src/utils/twtstr.nim b/src/utils/twtstr.nim
index b235651f..da9af19a 100644
--- a/src/utils/twtstr.nim
+++ b/src/utils/twtstr.nim
@@ -7,7 +7,6 @@ import strutils
 import tables
 import unicode
 
-import bindings/libunicode
 import types/opt
 import utils/charcategory
 import utils/map
@@ -576,42 +575,6 @@ proc passRealloc*(opaque: pointer, p: pointer, size: csize_t): pointer
     {.cdecl.} =
   return realloc(p, size)
 
-proc mnormalize*(rs: var seq[Rune], form = UNICODE_NFC) = {.cast(noSideEffect).}:
-  if rs.len == 0: return
-  var outbuf: ptr uint32
-  let p = cast[ptr uint32](unsafeAddr rs[0])
-  let out_len = unicode_normalize(addr outbuf, p, cint(rs.len), form, nil,
-    passRealloc)
-  if out_len < 0:
-    raise newException(Defect, "Unicode normalization failed")
-  if out_len == 0:
-    return
-  rs = cast[seq[Rune]](newSeqUninitialized[uint32](out_len))
-  copyMem(addr rs[0], outbuf, out_len * sizeof(uint32))
-  dealloc(outbuf)
-
-#TODO maybe a utf8 normalization procedure?
-proc mnormalize*(s: var string) =
-  if s.isAscii():
-    return # no need to normalize ascii
-  var rs = s.toRunes()
-  rs.mnormalize()
-  s = $rs
-
-func normalize*(rs: seq[Rune], form = UNICODE_NFC): seq[Rune] = {.cast(noSideEffect).}:
-  if rs.len == 0: return
-  var outbuf: ptr uint32
-  let out_len = unicode_normalize(addr outbuf,
-                                  cast[ptr uint32](unsafeAddr rs[0]),
-                                  cint(rs.len), form, nil, passRealloc)
-  if out_len < 0:
-    raise newException(Defect, "Unicode normalization failed")
-  if out_len == 0:
-    return
-  result = cast[seq[Rune]](newSeqUninitialized[uint32](out_len))
-  copyMem(addr result[0], outbuf, out_len * sizeof(uint32))
-  dealloc(outbuf)
-
 # https://www.w3.org/TR/xml/#NT-Name
 const NameStartCharRanges = [
   (0xC0, 0xD6),