Function: puny-decode-string-internal
puny-decode-string-internal is a byte-compiled function defined in
puny.el.gz.
Signature
(puny-decode-string-internal STRING)
Source Code
;; Defined in /usr/src/emacs/lisp/net/puny.el.gz
(defun puny-decode-string-internal (string)
(with-temp-buffer
(insert string)
;; The encoded chars are after any final dash, else the whole string.
(let ((encoded (buffer-substring
(if (search-backward "-" nil 'move)
(1+ (point))
(point))
(point-max)))
(ic 0)
(i 0)
(bias puny-initial-bias)
(n puny-initial-n)
out)
(delete-region (point) (point-max))
(while (< ic (length encoded))
(let ((old-i i)
(w 1)
(k puny-base)
digit t1)
(cl-loop do (progn
(setq digit (puny-decode-digit (aref encoded ic)))
(cl-incf ic)
(cl-incf i (* digit w))
(setq t1 (cond
((<= k bias)
puny-tmin)
((>= k (+ bias puny-tmax))
puny-tmax)
(t
(- k bias)))))
while (>= digit t1)
do (setq w (* w (- puny-base t1))
k (+ k puny-base)))
(setq out (1+ (buffer-size)))
(setq bias (puny-adapt (- i old-i) out (= old-i 0))))
(setq n (+ n (/ i out))
i (mod i out))
(goto-char (point-min))
(forward-char i)
(insert (format "%c" n))
(cl-incf i)))
(buffer-string)))