Raymond Toy pushed to branch issue-367-count-octets-for-encoding at cmucl / cmucl Commits: 1a5889eb by Raymond Toy at 2025-01-14T21:18:44-08:00 Rename def-ef-macro ef-octet-count to ef-string-octet-count It's a bit confusing to use `ef-octet-count` defined by `def-ef-macro` and also have a function named `ef-octet-count`. Thus, rename it. While were at it, add a docstring for `string-octet-count`. - - - - - 1 changed file: - src/code/extfmts.lisp Changes: ===================================== src/code/extfmts.lisp ===================================== @@ -1155,15 +1155,18 @@ character and illegal outputs are replaced by a question mark.") (values (if stringp string (lisp::shrink-vector string pos)) (- pos s-start) last-octet new-state)))) -(def-ef-macro ef-octet-count (extfmt lisp::lisp +ef-max+ +ef-oc+) +(def-ef-macro ef-string-octet-count (extfmt lisp::lisp +ef-max+ +ef-oc+) `(lambda (string start end error &aux (total 0) (state nil)) (dotimes (i (- end start) total) (incf total (octet-count ,extfmt (schar string (+ start i)) state error))))) (defun string-octet-count (string &key (start 0) end (external-format :default) error) + "Compute the number of octets needed to convert String using the + specified External-format. The string is bound by Start (defaulting + to 0) and End (defaulting to the end of the string)." (lisp::with-array-data ((string string) (start start) (end end)) - (funcall (ef-octet-count external-format) + (funcall (ef-string-octet-count external-format) string start end error))) (def-ef-macro ef-encode (extfmt lisp::lisp +ef-max+ +ef-en+) View it on GitLab: https://gitlab.common-lisp.net/cmucl/cmucl/-/commit/1a5889ebc36c14498e1cffa3... -- View it on GitLab: https://gitlab.common-lisp.net/cmucl/cmucl/-/commit/1a5889ebc36c14498e1cffa3... You're receiving this email because of your account on gitlab.common-lisp.net.