Skip to content

Commit

Permalink
cleanup: remove obfuscating feature
Browse files Browse the repository at this point in the history
It's 2016 and I doubt that any non-ansi CL still is used in wild *and*
depends on Quicklisp CLX. Fixes #51.
  • Loading branch information
dkochmanski committed Aug 22, 2016
1 parent 3e51651 commit 982cfab
Show file tree
Hide file tree
Showing 18 changed files with 64 additions and 826 deletions.
123 changes: 28 additions & 95 deletions buffer.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@
,@body)))
,(if (and (null inline) (macroexpand '(use-closures) env))
`(flet ((.with-buffer-body. () ,@body))
#+clx-ansi-common-lisp
(declare (dynamic-extent #'.with-buffer-body.))
(with-buffer-function ,buffer ,timeout #'.with-buffer-body.))
(let ((buf (if (or (symbolp buffer) (constantp buffer))
Expand All @@ -87,13 +86,10 @@
(declare (type display buffer)
(type (or null number) timeout)
(type function function)
#+clx-ansi-common-lisp
(dynamic-extent function)
;; FIXME: This is probably more a bug in SBCL (logged as
;; bug #243)
(ignorable timeout)
#+(and lispm (not clx-ansi-common-lisp))
(sys:downward-funarg function))
(ignorable timeout))
(with-buffer (buffer :timeout timeout :inline t)
(funcall function)))

Expand Down Expand Up @@ -285,10 +281,7 @@
(declare (type display display)
(type (or null gcontext) gc-force))
(declare (type function request-function)
#+clx-ansi-common-lisp
(dynamic-extent request-function)
#+(and lispm (not clx-ansi-common-lisp))
(sys:downward-funarg request-function))
(dynamic-extent request-function))
(with-buffer (display :inline t)
(multiple-value-prog1
(progn
Expand All @@ -300,10 +293,7 @@
(declare (type display display)
(type (or null gcontext) gc-force))
(declare (type function request-function)
#+clx-ansi-common-lisp
(dynamic-extent request-function)
#+(and lispm (not clx-ansi-common-lisp))
(sys:downward-funarg request-function))
(dynamic-extent request-function))
(multiple-value-prog1
(progn
(when gc-force (force-gcontext-changes-internal gc-force))
Expand All @@ -321,10 +311,7 @@
(declare (type display display)
(type generalized-boolean multiple-reply))
(declare (type function request-function reply-function)
#+clx-ansi-common-lisp
(dynamic-extent request-function reply-function)
#+(and lispm (not clx-ansi-common-lisp))
(sys:downward-funarg request-function reply-function))
(dynamic-extent request-function reply-function))
(let ((pending-command nil)
(reply-buffer nil))
(declare (type (or null pending-command) pending-command)
Expand Down Expand Up @@ -495,11 +482,10 @@
(type array-index nitems start index)
(type (or null sequence) data)
(type (or null (function (,totype) t)) transform)
#+clx-ansi-common-lisp (dynamic-extent transform)
#+(and lispm (not clx-ansi-common-lisp)) (sys:downward-funarg transform))
(dynamic-extent transform))
(if transform
(flet ((,ntrans (v) (funcall transform (,transformer v))))
#+clx-ansi-common-lisp (declare (dynamic-extent #',ntrans))
(declare (dynamic-extent #',ntrans))
(,reader reply-buffer result-type nitems #',ntrans data start index))
(,reader reply-buffer result-type nitems #',transformer data start index)))))

Expand All @@ -526,8 +512,7 @@
(type array-index nitems start index)
(type list data)
(type (function (,type) t) transform)
#+clx-ansi-common-lisp (dynamic-extent transform)
#+(and lispm (not clx-ansi-common-lisp)) (sys:downward-funarg transform))
(dynamic-extent transform))
(with-buffer-input (reply-buffer :sizes (,size) :index index)
(do* ((j nitems (index- j 1))
(list (nthcdr start data) (cdr list))
Expand All @@ -554,10 +539,7 @@
(type array-index nitems start index)
(type (simple-array card8 (*)) data))
(declare (type (function (card8) card8) transform)
#+clx-ansi-common-lisp
(dynamic-extent transform)
#+(and lispm (not clx-ansi-common-lisp))
(sys:downward-funarg transform))
(dynamic-extent transform))
(with-vector (data (simple-array card8 (*)))
(with-buffer-input (reply-buffer :sizes (8) :index index)
(do* ((j start (index+ j 1))
Expand Down Expand Up @@ -587,10 +569,7 @@
(type vector data)
(optimize #+cmu(ext:inhibit-warnings 3)))
(declare (type (function (card8) t) transform)
#+clx-ansi-common-lisp
(dynamic-extent transform)
#+(and lispm (not clx-ansi-common-lisp))
(sys:downward-funarg transform))
(dynamic-extent transform))
(with-vector (data vector)
(with-buffer-input (reply-buffer :sizes (8) :index index)
(do* ((j start (index+ j 1))
Expand All @@ -608,8 +587,7 @@
(type array-index nitems start index)
(type (or null sequence) data)
(type (or null (function (,type) t)) transform)
#+clx-ansi-common-lisp (dynamic-extent transform)
#+(and lispm (not clx-ansi-common-lisp)) (sys:downward-funarg transform))
(dynamic-extent transform))
(let ((result (or data (make-sequence result-type nitems))))
(typecase result
(list
Expand Down Expand Up @@ -664,10 +642,7 @@
(type array-index nitems start index)
(type (simple-array card16 (*)) data))
(declare (type (function (card16) card16) transform)
#+clx-ansi-common-lisp
(dynamic-extent transform)
#+(and lispm (not clx-ansi-common-lisp))
(sys:downward-funarg transform))
(dynamic-extent transform))
(with-vector (data (simple-array card16 (*)))
(with-buffer-input (reply-buffer :sizes (16) :index index)
(do* ((j start (index+ j 1))
Expand Down Expand Up @@ -700,10 +675,7 @@
(type vector data)
(optimize #+cmu(ext:inhibit-warnings 3)))
(declare (type (function (card16) t) transform)
#+clx-ansi-common-lisp
(dynamic-extent transform)
#+(and lispm (not clx-ansi-common-lisp))
(sys:downward-funarg transform))
(dynamic-extent transform))
(with-vector (data vector)
(with-buffer-input (reply-buffer :sizes (16) :index index)
(do* ((j start (index+ j 1))
Expand Down Expand Up @@ -749,10 +721,7 @@
(type array-index nitems start index)
(type (simple-array card32 (*)) data))
(declare (type (function (card32) card32) transform)
#+clx-ansi-common-lisp
(dynamic-extent transform)
#+(and lispm (not clx-ansi-common-lisp))
(sys:downward-funarg transform))
(dynamic-extent transform))
(with-vector (data (simple-array card32 (*)))
(with-buffer-input (reply-buffer :sizes (32) :index index)
(do* ((j start (index+ j 1))
Expand Down Expand Up @@ -785,10 +754,7 @@
(type vector data)
(optimize #+cmu(ext:inhibit-warnings 3)))
(declare (type (function (card32) t) transform)
#+clx-ansi-common-lisp
(dynamic-extent transform)
#+(and lispm (not clx-ansi-common-lisp))
(sys:downward-funarg transform))
(dynamic-extent transform))
(with-vector (data vector)
(with-buffer-input (reply-buffer :sizes (32) :index index)
(do* ((j start (index+ j 1))
Expand Down Expand Up @@ -816,11 +782,10 @@
(type sequence data)
(type array-index boffset start end)
(type (or null (function (t) ,fromtype)) transform)
#+clx-ansi-common-lisp (dynamic-extent transform)
#+(and lispm (not clx-ansi-common-lisp)) (sys:downward-funarg transform))
(dynamic-extent transform))
(if transform
(flet ((,ntrans (x) (,transformer (the ,fromtype (funcall transform x)))))
#+clx-ansi-common-lisp (declare (dynamic-extent #',ntrans))
(declare (dynamic-extent #',ntrans))
(,writer buffer boffset data start end #',ntrans))
(,writer buffer boffset data start end #',transformer)))))

Expand Down Expand Up @@ -849,8 +814,7 @@
(type list data)
(type array-index boffset start end)
(type (function (t) ,type) transform)
#+clx-ansi-common-lisp (dynamic-extent transform)
#+(and lispm (not clx-ansi-common-lisp)) (sys:downward-funarg transform))
(dynamic-extent transform))
(writing-buffer-chunks ,type
((list (nthcdr start data)))
((type list list))
Expand Down Expand Up @@ -902,10 +866,7 @@
(type (simple-array card8 (*)) data)
(type array-index boffset start end))
(declare (type (function (card8) card8) transform)
#+clx-ansi-common-lisp
(dynamic-extent transform)
#+(and lispm (not clx-ansi-common-lisp))
(sys:downward-funarg transform))
(dynamic-extent transform))
(with-vector (data (simple-array card8 (*)))
(writing-buffer-chunks card8
((index start))
Expand Down Expand Up @@ -936,10 +897,7 @@
(type vector data)
(type array-index boffset start end))
(declare (type (function (t) card8) transform)
#+clx-ansi-common-lisp
(dynamic-extent transform)
#+(and lispm (not clx-ansi-common-lisp))
(sys:downward-funarg transform))
(dynamic-extent transform))
(with-vector (data vector)
(writing-buffer-chunks card8
((index start))
Expand All @@ -957,8 +915,7 @@
(type sequence data)
(type array-index boffset start end)
(type (or null (function (t) ,type)) transform)
#+clx-ansi-common-lisp (dynamic-extent transform)
#+(and lispm (not clx-ansi-common-lisp)) (sys:downward-funarg transform))
(dynamic-extent transform))
(typecase data
(list
(if transform
Expand Down Expand Up @@ -1017,10 +974,7 @@
(type (simple-array card16 (*)) data)
(type array-index boffset start end))
(declare (type (function (card16) card16) transform)
#+clx-ansi-common-lisp
(dynamic-extent transform)
#+(and lispm (not clx-ansi-common-lisp))
(sys:downward-funarg transform))
(dynamic-extent transform))
(with-vector (data (simple-array card16 (*)))
(writing-buffer-chunks card16
((index start))
Expand Down Expand Up @@ -1063,10 +1017,7 @@
(type array-index boffset start end)
(optimize #+cmu(ext:inhibit-warnings 3)))
(declare (type (function (t) card16) transform)
#+clx-ansi-common-lisp
(dynamic-extent transform)
#+(and lispm (not clx-ansi-common-lisp))
(sys:downward-funarg transform))
(dynamic-extent transform))
(with-vector (data vector)
(writing-buffer-chunks card16
((index start))
Expand Down Expand Up @@ -1119,10 +1070,7 @@
(type (simple-array int16 (*)) data)
(type array-index boffset start end))
(declare (type (function (int16) int16) transform)
#+clx-ansi-common-lisp
(dynamic-extent transform)
#+(and lispm (not clx-ansi-common-lisp))
(sys:downward-funarg transform))
(dynamic-extent transform))
(with-vector (data (simple-array int16 (*)))
(writing-buffer-chunks int16
((index start))
Expand Down Expand Up @@ -1165,10 +1113,7 @@
(type array-index boffset start end)
(optimize #+cmu(ext:inhibit-warnings 3)))
(declare (type (function (t) int16) transform)
#+clx-ansi-common-lisp
(dynamic-extent transform)
#+(and lispm (not clx-ansi-common-lisp))
(sys:downward-funarg transform))
(dynamic-extent transform))
(with-vector (data vector)
(writing-buffer-chunks int16
((index start))
Expand Down Expand Up @@ -1221,10 +1166,7 @@
(type (simple-array card32 (*)) data)
(type array-index boffset start end))
(declare (type (function (card32) card32) transform)
#+clx-ansi-common-lisp
(dynamic-extent transform)
#+(and lispm (not clx-ansi-common-lisp))
(sys:downward-funarg transform))
(dynamic-extent transform))
(with-vector (data (simple-array card32 (*)))
(writing-buffer-chunks card32
((index start))
Expand Down Expand Up @@ -1267,10 +1209,7 @@
(type array-index boffset start end)
(optimize #+cmu(ext:inhibit-warnings 3)))
(declare (type (function (t) card32) transform)
#+clx-ansi-common-lisp
(dynamic-extent transform)
#+(and lispm (not clx-ansi-common-lisp))
(sys:downward-funarg transform))
(dynamic-extent transform))
(with-vector (data vector)
(writing-buffer-chunks card32
((index start))
Expand Down Expand Up @@ -1359,10 +1298,7 @@
(type (simple-array card16 (*)) data)
(type array-index boffset start end))
(declare (type (function (card16) card16) transform)
#+clx-ansi-common-lisp
(dynamic-extent transform)
#+(and lispm (not clx-ansi-common-lisp))
(sys:downward-funarg transform))
(dynamic-extent transform))
(with-vector (data (simple-array card16 (*)))
(writing-buffer-chunks card16
((index start))
Expand Down Expand Up @@ -1396,10 +1332,7 @@
(type array-index boffset start end)
(optimize #+cmu(ext:inhibit-warnings 3)))
(declare (type (function (t) card16) transform)
#+clx-ansi-common-lisp
(dynamic-extent transform)
#+(and lispm (not clx-ansi-common-lisp))
(sys:downward-funarg transform))
(dynamic-extent transform))
(with-vector (data vector)
(writing-buffer-chunks card16
((index start))
Expand Down
2 changes: 0 additions & 2 deletions clx.asd
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@
(defpackage :clx-system (:use :cl :asdf))
(in-package :clx-system)

(pushnew :clx-ansi-common-lisp *features*)

(defclass clx-source-file (cl-source-file) ())
(defclass xrender-source-file (clx-source-file) ())

Expand Down
14 changes: 0 additions & 14 deletions clx.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -159,20 +159,6 @@

(deftype card4 () '(unsigned-byte 4))

#-clx-ansi-common-lisp
(deftype real (&optional (min '*) (max '*))
(labels ((convert (limit floatp)
(typecase limit
(number (if floatp (float limit 0s0) (rational limit)))
(list (map 'list #'convert limit))
(otherwise limit))))
`(or (float ,(convert min t) ,(convert max t))
(rational ,(convert min nil) ,(convert max nil)))))

#-clx-ansi-common-lisp
(deftype base-char ()
'string-char)

; Note that we are explicitly using a different rgb representation than what
; is actually transmitted in the protocol.

Expand Down
Loading

0 comments on commit 982cfab

Please sign in to comment.