Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove conditionals for non sbcl common lisp implementations #351

Merged
merged 25 commits into from May 25, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
87e8f62
Remove other compilers from bytes-to-string
May 15, 2017
3b264e5
Remove other compilers from string-to-bytes
May 15, 2017
77d04d3
Remove other compilers from utf8-to-string
May 15, 2017
d2b6ce5
Remove other compilers from string-to-utf8
May 15, 2017
698621a
Remove other compilers from directory-no-deref
May 15, 2017
54e86f2
Remove clisp UNIX flavour getting hack
May 15, 2017
6f1e8a9
Remove other compilers from read-line-from-sysfs
May 15, 2017
a33ef7b
Remove other compilers from execv
May 15, 2017
c1155c2
Remove string-to-bytes
May 15, 2017
cfbe1ef
Remove string-to-utf8
May 15, 2017
b16790d
Remove getenv
May 15, 2017
3933810
Remove workarounds.lisp
May 15, 2017
34d6f40
Remove non sbcl statements from pathnames.lisp
May 15, 2017
2b73af4
Remove non sbcl conditions from manual.lisp
May 15, 2017
d21abf8
Make sbcl the only implementation stumpwm will compile on.
May 15, 2017
b8b306c
Remove non sbcl conditionals from load-stumpwm.lisp.in
May 15, 2017
6af0929
Remove non sbcl conditionals from make-image.lisp.in
May 15, 2017
2bb665c
Removed missed references to getenv and replace with sb-posix:getenv
May 15, 2017
3ec77c0
Revert commits 2bb665c and b16790d
May 16, 2017
04a7f9a
Remove conditionals from stumpwm.asd
May 20, 2017
70bf184
Remove ecl conditional from primitives.lisp
May 20, 2017
88ecf73
Remove call-in-main-thread conditional
May 20, 2017
acb0dd6
Remove ccl implmentation of io-channel-ioport
May 20, 2017
3156590
Remove conditionals from stumpwm.texi.in
May 20, 2017
8b6b94d
Remove non sbcl ioloop
May 20, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion events.lisp
Expand Up @@ -289,7 +289,7 @@ chunks."
(screen-last-msg-highlights screen) '())
(eval-command cmd)
(xlib:change-property win :stumpwm_command_result
(string-to-bytes (format nil "~{~{~a~%~}~}" (nreverse (screen-last-msg screen))))
(sb-ext:string-to-octets (format nil "~{~{~a~%~}~}" (nreverse (screen-last-msg screen))))
:string 8)
(setf (screen-last-msg screen) msgs
(screen-last-msg-highlights screen) hlts))
Expand Down
4 changes: 3 additions & 1 deletion group.lisp
Expand Up @@ -328,7 +328,9 @@ Groups are known as \"virtual desktops\" in the NETWM standard."
(xlib:change-property root :_NET_DESKTOP_NAMES
(let ((names (mapcan
(lambda (group)
(list (string-to-utf8 (group-name group))
(list (sb-ext:string-to-octets
(group-name group)
:external-format :utf-8)
'(0)))
(sort-groups screen))))
(apply #'concatenate 'list names))
Expand Down
359 changes: 131 additions & 228 deletions ioloop.lisp

Large diffs are not rendered by default.

22 changes: 1 addition & 21 deletions load-stumpwm.lisp.in
@@ -1,30 +1,10 @@
(in-package #:cl-user)

#-(or sbcl clisp ccl ecl lispworks6)
#-sbcl
(error "This lisp implementation is not supported.")

(require 'asdf)

#+lispworks
(progn
(setf *compile-print* 1)
(toggle-source-debugging t)
(lw:set-default-character-element-type 'lw:simple-char)

(unless
(dolist (install-path
'("quicklisp" ".quicklisp"))
(let ((quicklisp-init
(merge-pathnames (make-pathname :directory `(:relative ,install-path)
:name "setup.lisp")
(user-homedir-pathname))))
(when (probe-file quicklisp-init)
(load quicklisp-init)
(return t))))

(error "Quicklisp must be installed in order to build StumpWM with ~S."
(lisp-implementation-type))))

(asdf:initialize-source-registry
'(:source-registry
(:directory "@STUMPWM_ASDF_DIR@")
Expand Down
39 changes: 1 addition & 38 deletions make-image.lisp.in
Expand Up @@ -2,7 +2,7 @@

(load "load-stumpwm.lisp")

#-ecl (stumpwm:set-module-dir "@MODULE_DIR@")
(stumpwm:set-module-dir "@MODULE_DIR@")

(when (uiop:version<= "3.1.5" (asdf:asdf-version))
;; We register StumpWM and its dependencies as immutable, to stop ASDF from
Expand All @@ -11,47 +11,10 @@
(dolist (system-name (uiop:symbol-call '#:asdf '#:system-depends-on (asdf:find-system :stumpwm)))
(uiop:symbol-call '#:asdf '#:register-immutable-system system-name)))

#+sbcl
(sb-ext:save-lisp-and-die "stumpwm" :toplevel (lambda ()
;; asdf requires sbcl_home to be set, so set it to the value when the image was built
(sb-posix:putenv (format nil "SBCL_HOME=~A" #.(sb-ext:posix-getenv "SBCL_HOME")))
(stumpwm:stumpwm)
0)
:executable t
:purify t)

#+clisp
(ext:saveinitmem "stumpwm" :init-function (lambda ()
(stumpwm:stumpwm)
(ext:quit))
:executable t :keep-global-handlers t :norc t :documentation "The StumpWM Executable")

#+ccl
(ccl:save-application "stumpwm" :prepend-kernel t :toplevel-function #'stumpwm:stumpwm)

#+ecl
(asdf:make-build 'stumpwm :type :program :monolithic t
:move-here "."
:name-suffix ""
:epilogue-code '(progn
(stumpwm:set-module-dir "@MODULE_DIR@")
(stumpwm:stumpwm)))

;;; if you want to save an image
#+(and lispworks (not lispworks-personal-edition))
(hcl:save-image "stumpwm"
:multiprocessing t
:environment nil
:load-init-files t
:restart-function (compile nil
#'(lambda ()
(stumpwm:stumpwm)
(lw:quit :status 0))))
;;; if you want to save a standalone executable
#+(and nil lispworks (not lispworks-personal-edition))
(lw:deliver #'stumpwm:stumpwm "stumpwm" 0
:interface nil
:multiprocessing t
:keep-pretty-printer t)
#+(and lispworks lispworks-personal-edition)
(warn "StumpWM can be saved as an image only in LispWorks Pro/Enterprise editions.")
31 changes: 5 additions & 26 deletions manual.lisp
Expand Up @@ -25,7 +25,7 @@

(in-package #:stumpwm)

#+sbcl (require :sb-introspect)
(require :sb-introspect)

;; handy for figuring out which symbol is borking the documentation
(defun dprint (sym)
Expand All @@ -45,11 +45,7 @@
(*print-pretty* nil))
(format s "@defun {~a} ~{~a~^ ~}~%~a~&@end defun~%~%"
name
#+sbcl (sb-introspect:function-lambda-list fn)
#+clisp (ext:arglist fn)
#+ccl (ccl:arglist fn)
#+lispworks (lw:function-lambda-list fn)
#- (or sbcl clisp ccl lispworks) '("(Check the code for args list)")
(sb-introspect:function-lambda-list fn)
(documentation fn 'function))
t)))

Expand All @@ -60,21 +56,8 @@
(*print-pretty* nil))
(format s "@defmac {~a} ~{~a~^ ~}~%~a~&@end defmac~%~%"
name
#+sbcl (sb-introspect:function-lambda-list (macro-function symbol))
#+clisp (ext:arglist symbol)
#+ccl (ccl:arglist symbol)
#+lispworks (lw:function-lambda-list symbol)
#- (or sbcl clisp ccl lispworks) '("(Check the code for args list)")
;;; FIXME: when clisp compiles
;;; a macro it discards the
;;; documentation string! So
;;; unless when generating the
;;; manual for clisp, it is
;;; loaded and not compiled
;;; this will return NIL.
#+clisp (or (documentation symbol 'function)
"Due to a bug in clisp, macro function documentation is not generated. Try building the manual using sbcl.")
#-clisp (documentation symbol 'function))
(sb-introspect:function-lambda-list (macro-function symbol))
(documentation symbol 'function))
t)))

(defun generate-variable-doc (s line)
Expand All @@ -99,11 +82,7 @@
(let ((cmd (symbol-function (find-symbol (string-upcase name) :stumpwm))))
(format s "@deffn {Command} ~a ~{~a~^ ~}~%~a~&@end deffn~%~%"
name
#+sbcl (sb-introspect:function-lambda-list cmd)
#+clisp (ext:arglist cmd)
#+ccl (ccl:arglist cmd)
#+lispworks (lw:function-lambda-list cmd)
#- (or sbcl clisp ccl lispworks) '("(Check the code for args list)")
(sb-introspect:function-lambda-list cmd)
(documentation cmd 'function))
t)))

Expand Down
34 changes: 4 additions & 30 deletions pathnames.lisp
Expand Up @@ -70,45 +70,19 @@ form."
the directory named by the non-wild pathname designator DIRNAME."
(when (wild-pathname-p dirname)
(error "Can only make wildcard directories from non-wildcard directories."))
(make-pathname :name #-:cormanlisp :wild #+:cormanlisp "*"
:type #-(or :clisp :cormanlisp) :wild
#+:clisp nil
#+:cormanlisp "*"
(make-pathname :name :wild
:type :wild
:defaults (pathname-as-directory dirname)))
#+:clisp
(defun clisp-subdirectories-wildcard (wildcard)
"Creates a wild pathname specifically for CLISP such that
sub-directories are returned by DIRECTORY."
(make-pathname :directory (append (pathname-directory wildcard)
(list :wild))
:name nil
:type nil
:defaults wildcard))

(defun list-directory (dirname)
"Returns a fresh list of pathnames corresponding to the truenames of
all files within the directory named by the non-wild pathname
designator DIRNAME. The pathnames of sub-directories are returned in
directory form - see PATHNAME-AS-DIRECTORY."
(when (wild-pathname-p dirname)
(error "Can only list concrete directory names."))
#+:ecl
(let ((dir (pathname-as-directory dirname)))
(concatenate 'list
(directory (merge-pathnames (pathname "*/") dir))
(directory (merge-pathnames (pathname "*.*") dir))))
#-:ecl
(error "Can only list concrete directory names."))
(let ((wildcard (directory-wildcard dirname)))
#+:abcl (system::list-directory dirname)
#+(or :sbcl :cmu :scl :lispworks) (directory wildcard)
#+(or :openmcl :digitool) (directory wildcard :directories t)
#+:allegro (directory wildcard :directories-are-files nil)
#+:clisp (nconc (directory wildcard :if-does-not-exist :keep)
(directory (clisp-subdirectories-wildcard wildcard)))
#+:cormanlisp (nconc (directory wildcard)
(cl::directory-subdirs dirname)))
#-(or :sbcl :cmu :scl :lispworks :openmcl :allegro :clisp :cormanlisp :ecl :abcl :digitool)
(error "LIST-DIRECTORY not implemented"))
(directory wildcard)))
(defun list-directory-recursive (dirname &optional flatten-p)
"Returns a list of pathnames corresponding to the truenames all
files within the directory and in any subdirectories. If
Expand Down
9 changes: 0 additions & 9 deletions primitives.lisp
Expand Up @@ -25,8 +25,6 @@

(in-package :stumpwm)

#+ecl (require "clx")

(export '(*suppress-abort-messages*
*suppress-frame-indicator*
*suppress-window-placement-indicator*
Expand Down Expand Up @@ -171,13 +169,6 @@
stumpwm-warning))



(eval-when (:compile-toplevel :load-toplevel :execute)
;; Currently we only support pause-less CALL-IN-MAIN-THREAD for
;; SBCL, since it requires the new io-loop.
#+sbcl
(pushnew :call-in-main-thread *features*))

;;; Message Timer
(defvar *suppress-abort-messages* nil
"Suppress abort message when non-nil.")
Expand Down
5 changes: 4 additions & 1 deletion selection.lisp
Expand Up @@ -56,7 +56,10 @@
(xlib:change-property requestor property (getf *x-selection* selection)
:string 8 :mode :replace :transform #'xlib:char->card8))
(:utf8_string
(xlib:change-property requestor property (string-to-utf8 (getf *x-selection* selection)) target 8 :mode :replace))
(xlib:change-property requestor property (sb-ext:string-to-octets
(getf *x-selection* selection)
:external-format :utf-8)
target 8 :mode :replace))
;; we don't know how to handle anything else
(t
(setf property nil)))
Expand Down
5 changes: 3 additions & 2 deletions stumpwm.asd
Expand Up @@ -13,10 +13,11 @@
:description "A tiling, keyboard driven window manager"
:serial t
:depends-on (#:alexandria
:cl-ppcre #-cmu :clx #+sbcl :sb-posix)
#:cl-ppcre
#:clx
#:sb-posix)
:components ((:file "package")
(:file "primitives")
(:file "workarounds")
(:file "wrappers")
(:file "pathnames")
(:file "font-rendering")
Expand Down
17 changes: 0 additions & 17 deletions stumpwm.lisp
Expand Up @@ -109,11 +109,7 @@ The action is to call FUNCTION with arguments ARGS."
(labels ((append-to-list ()
(sb-thread:with-mutex (*timer-list-lock*)
(setf *timer-list* (merge 'list *timer-list* (list timer) #'< :key #'timer-time)))))
;; If CALL-IN-MAIN-THREAD is supported, the timer should be scheduled in the main thread.
#+call-in-main-thread
(call-in-main-thread #'append-to-list)
#-call-in-main-thread
(append-to-list)
timer)))

(defun cancel-timer (timer)
Expand Down Expand Up @@ -240,12 +236,6 @@ The action is to call FUNCTION with arguments ARGS."
(dolist (event (reverse events))
(funcall event))))

#+ccl
(defmethod io-channel-ioport (io-loop (channel ccl::fd-binary-input-stream))
(declare (ignore io-loop))
(ccl::stream-device channel :input))

#+call-in-main-thread
(defun call-in-main-thread (fn)
(cond (*in-main-thread*
(funcall fn))
Expand All @@ -260,12 +250,6 @@ The action is to call FUNCTION with arguments ARGS."
(write-byte 0 out)
(finish-output out)))))

#-call-in-main-thread
(defun call-in-main-thread (fn)
(if *in-main-thread*
(funcall fn)
(run-with-timer 0 nil fn)))

(defclass display-channel ()
((display :initarg :display)))

Expand Down Expand Up @@ -299,7 +283,6 @@ The action is to call FUNCTION with arguments ARGS."

;; If we have no implementation for the current CL, then
;; don't register the channel.
#+call-in-main-thread
(multiple-value-bind (in out)
(open-pipe)
(let ((channel (make-instance 'request-channel :in in :out out)))
Expand Down
3 changes: 0 additions & 3 deletions stumpwm.texi.in
Expand Up @@ -2329,9 +2329,6 @@ figure out how to do it in the other distribution and write a
statement like this:

@example
#+clisp
(your-clisp-code)
#+sbcl
(your-sbcl-code)
@end example

Expand Down
60 changes: 0 additions & 60 deletions workarounds.lisp

This file was deleted.