From: Andrea Corallo Date: Wed, 10 Jul 2019 19:29:32 +0000 (+0200) Subject: improve function name translation X-Git-Tag: emacs-28.0.90~2727^2~1365 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=749f4ce51f5f7348b9804e83d995a7ec22205727;p=emacs.git improve function name translation --- diff --git a/lisp/emacs-lisp/comp.el b/lisp/emacs-lisp/comp.el index 077e7a1eb33..bac1c6af696 100644 --- a/lisp/emacs-lisp/comp.el +++ b/lisp/emacs-lisp/comp.el @@ -108,6 +108,7 @@ To be used when ncall-conv is nil.") (defun comp-c-func-name (symbol-function) "Given SYMBOL-FUNCTION return a name suitable for the native code." ;; Unfortunatelly not all symbol names are valid as C function names... + ;; Nassi's algorithm. (let* ((orig-name (symbol-name symbol-function)) (crypted (cl-loop with str = (make-string (* 2 (length orig-name)) 0) for j from 0 by 2 @@ -117,7 +118,9 @@ To be used when ncall-conv is nil.") do (aset str (1+ j) (aref byte 1)) finally return str)) (human-readable (replace-regexp-in-string - (rx (not (any "a-z"))) "" orig-name))) + "-" "_" orig-name)) + (human-readable (replace-regexp-in-string + (rx (not (any "a-z_"))) "" human-readable))) (concat "F" crypted "_" human-readable))) (defun comp-decrypt-lambda-list (x) @@ -298,7 +301,7 @@ VAL is known at compile time." (comp-limple ())) ;; Prologue (comp-push-block 'entry) - (comp-emit-annotation (concat "Function: " + (comp-emit-annotation (concat "Lisp function: " (symbol-name (comp-func-symbol-name func)))) (cl-loop for i below (comp-args-mandatory (comp-func-args func)) do (progn