Function: puny-encode-complex
puny-encode-complex is a byte-compiled function defined in puny.el.gz.
Signature
(puny-encode-complex INSERTION-POINTS STRING)
Source Code
;; Defined in /usr/src/emacs/lisp/net/puny.el.gz
(defun puny-encode-complex (insertion-points string)
(let ((n puny-initial-n)
(delta 0)
(bias puny-initial-bias)
(h insertion-points)
result m ijv q)
(while (< h (length string))
(setq ijv (cl-loop for char across string
when (>= char n)
minimize char))
(setq m ijv)
(setq delta (+ delta (* (- m n) (+ h 1)))
n m)
(cl-loop for char across string
when (< char n)
do (incf delta)
when (= char ijv)
do (progn
(setq q delta)
(cl-loop with k = puny-base
for t1 = (cond
((<= k bias)
puny-tmin)
((>= k (+ bias puny-tmax))
puny-tmax)
(t
(- k bias)))
while (>= q t1)
do (push (puny-encode-digit
(+ t1 (mod (- q t1)
(- puny-base t1))))
result)
do (setq q (/ (- q t1) (- puny-base t1))
k (+ k puny-base)))
(push (puny-encode-digit q) result)
(setq bias (puny-adapt delta (+ h 1) (= h insertion-points))
delta 0
h (1+ h))))
(incf delta)
(incf n))
(nreverse result)))