Ignore:
Timestamp:
May 28, 2009, 4:15:35 PM (11 years ago)
Author:
mikel
Message:

added a bunch of the server-side request-handling code for the swank-listener.

switched the swank loader back on (but made sure swank isn't loaded unless the user default says it should be)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/source/cocoa-ide/start.lisp

    r12141 r12150  
    9191  (values nil nil nil nil))
    9292
    93 #+no
    94 (eval-when (:compile-toplevel :load-toplevel :execute)
    95     (require :swank))
     93;;; preference-start-swank? 
     94;;; returns the current value of the "Start swank server?" user
     95;;; preference
     96(defun preference-start-swank? ()
     97  (let* ((defaults (handler-case (#/values (#/sharedUserDefaultsController ns:ns-user-defaults-controller))
     98                     (serious-condition (c)
     99                       (progn (log-debug "~%ERROR: Unable to get preferences from the Shared User Defaults Controller")
     100                              nil))))
     101         (start-swank-pref (if (and defaults (not (%null-ptr-p defaults)))
     102                               (#/valueForKey: defaults #@"startSwankServer")         
     103                               nil)))
     104    (cond
     105      ;; the user default is not initialized
     106      ((or (null start-swank-pref)
     107           (%null-ptr-p start-swank-pref)) nil)
     108      ;; examine the user default
     109      ;; intValue works on NSNumber or NSString
     110      ;; BUG? if a string value is not a valid representation of an integer,
     111      ;;      intValue returns 0, which means any non-numeric string will have the
     112      ;;      same effect as "0"
     113      ((or (typep start-swank-pref 'ns:ns-number)
     114           (typep start-swank-pref 'ns:ns-string))
     115       (case (#/intValue start-swank-pref)
     116         ;; don't start swank
     117         (0 nil)
     118         ;; start swank
     119         (1 t)
     120         ;; the user default value is incomprehensible
     121         (otherwise (progn
     122                      (log-debug "~%ERROR: Unrecognized value in user preference 'startSwankServer': ~S"
     123                                 start-swank-pref)
     124                      nil))))
     125      ;; the user default value is incomprehensible
     126      (t (progn
     127           (log-debug "~%ERROR: Unrecognized value type in user preference 'startSwankServer': ~S"
     128                      start-swank-pref)
     129           nil)))))
    96130
    97131(defmethod toplevel-function ((a cocoa-application) init-file)
     
    101135    (#_ _exit -1))
    102136  (setq *standalone-cocoa-ide* t)
     137  (when (preference-start-swank?)
     138        (require :swank)
     139        (try-starting-swank))
    103140  (with-slots  (have-interactive-terminal-io) ccl::*current-process*
    104141    (when (and (eql (nth-value 4 (ccl::%stat "/dev/null"))
     
    107144             )
    108145      (setq have-interactive-terminal-io nil)
     146     
    109147      ;; It's probably reasonable to do this here: it's not really IDE-specific
    110       #+no
    111       (try-starting-swank)
    112148      (when (try-connecting-to-altconsole)
    113149        (setq have-interactive-terminal-io t)))
     
    119155
    120156
    121   (defun build-ide (bundle-path)
     157  (Defun build-ide (bundle-path)
    122158    (setq bundle-path (ensure-directory-pathname bundle-path))
    123159
Note: See TracChangeset for help on using the changeset viewer.