/usr/share/emacs/site-lisp/SuperCollider/sclang-util.el is in supercollider-emacs 1:3.6.3~repack-5.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 | ;; copyright 2003-2005 stefan kersten <steve@k-hornz.de>
;;
;; This program is free software; you can redistribute it and/or
;; modify it under the terms of the GNU General Public License as
;; published by the Free Software Foundation; either version 2 of the
;; License, or (at your option) any later version.
;;
;; This program is distributed in the hope that it will be useful, but
;; WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
;; General Public License for more details.
;;
;; You should have received a copy of the GNU General Public License
;; along with this program; if not, write to the Free Software
;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
;; USA
(defun sclang-message (string &rest args)
(message "SCLang: %s" (apply 'format string args)))
(defun sclang-make-buffer-name (string &optional private-p)
(concat (and private-p " ") "*SCLang:" string "*"))
(defun sclang-make-prompt-string (prompt default)
(if (and default (string-match "\\(:\\)\\s *" prompt))
(replace-match
(format " (default %s):" default)
'fixedcase 'literal prompt 1)
prompt))
(defun sclang-string-to-int32 (str)
"Convert first 4 bytes of str (network byteorder) to 32 bit integer."
(logior (lsh (logand (aref str 0) #XFF) 24)
(lsh (logand (aref str 1) #XFF) 16)
(lsh (logand (aref str 2) #XFF) 8)
(logand (aref str 3) #XFF)))
(defun sclang-int32-to-string (n)
"Convert 32 bit integer n to 4 byte string (network byte order)."
(let ((str (make-string 4 0)))
(aset str 0 (logand (lsh n -24) #XFF))
(aset str 1 (logand (lsh n -16) #XFF))
(aset str 2 (logand (lsh n -8) #XFF))
(aset str 3 (logand n #XFF))
str))
(defun sclang-compress-newlines (&optional buffer)
(with-current-buffer (or buffer (current-buffer))
(save-excursion
(goto-char (point-min))
(while (not (eobp))
(if (and (bolp) (eolp)
(save-excursion
(forward-line -1)
(and (bolp) (eolp))))
(delete-char 1)
(forward-line 1))))))
(eval-when-compile
(defmacro sclang-save-buffer-state (varlist &rest body)
"Bind variables according to VARLIST and eval BODY restoring buffer state."
`(let* ,(append varlist
'((modified (buffer-modified-p)) (buffer-undo-list t)
(inhibit-read-only t) (inhibit-point-motion-hooks t)
(inhibit-modification-hooks t)
deactivate-mark buffer-file-name buffer-file-truename))
(unwind-protect
,@body
(when (and (not modified) (buffer-modified-p))
(set-buffer-modified-p nil))))))
;; (defun sclang-create-image (file-name &rest props)
;; (when (file-exists-p file-name)
;; (let ((coding-system-for-read 'no-conversion)
;; (coding-system-for-write 'no-conversion)
;; (inhibit-quit t))
;; (with-temp-buffer
;; (when (equal 0 (call-process "anytopnm" file-name (list (current-buffer) nil)))
;; (apply
;; 'create-image
;; (buffer-substring-no-properties (point-min) (point-max))
;; nil t props))))))
(provide 'sclang-util)
;; EOF
|