Changeset 6682
- Timestamp:
- Jun 8, 2007, 3:12:53 PM (17 years ago)
- File:
-
- 1 edited
-
branches/ide-1.0/ccl/examples/cocoa-listener.lisp (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/ide-1.0/ccl/examples/cocoa-listener.lisp
r6672 r6682 43 43 ((input-stream :reader cocoa-listener-process-input-stream) 44 44 (output-stream :reader cocoa-listener-process-output-stream) 45 (input-peer-stream :reader cocoa-listener-process-input-peer-stream) 45 46 (backtrace-contexts :initform nil 46 47 :accessor cocoa-listener-process-backtrace-contexts) … … 64 65 #$_PC_MAX_INPUT) 65 66 :encoding :utf-8)) 67 (peer-stream (make-fd-stream peer-fd :direction :output 68 :sharing :lock 69 :elements-per-buffer 70 (#_fpathconf 71 peer-fd 72 #$_PC_MAX_INPUT) 73 :encoding :utf-8)) 66 74 (proc 67 75 (make-mcl-listener-process … … 87 95 (setf (slot-value proc 'input-stream) input-stream) 88 96 (setf (slot-value proc 'output-stream) output-stream) 97 (setf (slot-value proc 'input-peer-stream) peer-stream) 89 98 (setf (slot-value proc 'window) window) 90 99 (setf (slot-value proc 'buffer) buffer) … … 204 213 (:metaclass ns:+ns-object)) 205 214 215 (defmethod hi::document-encoding-name ((doc hemlock-listener-document)) 216 "UTF-8") 217 218 (defmethod user-input-style ((doc hemlock-listener-document)) 219 hi::*listener-input-style*) 220 206 221 (defmethod textview-background-color ((doc hemlock-listener-document)) 207 222 (#/colorWithCalibratedRed:green:blue:alpha: … … 270 285 doc)) 271 286 272 (def-cocoa-default *initial-listener-x-pos* :float 400.0f0 "X position of upper-left corner of initial listener")273 274 (def-cocoa-default *initial-listener-y-pos* :float 400.0f0 "Y position of upper-left corner of initial listener")287 (def-cocoa-default *initial-listener-x-pos* :float -100.0f0 "X position of upper-left corner of initial listener") 288 289 (def-cocoa-default *initial-listener-y-pos* :float 100.0f0 "Y position of upper-left corner of initial listener") 275 290 276 291 (defloadvar *next-listener-x-pos* nil) ; set after defaults initialized … … 284 299 *listener-rows* 285 300 t 286 (textview-background-color self))) 301 (textview-background-color self) 302 (user-input-style self))) 287 303 (controller (make-instance 288 304 'hemlock-listener-window-controller … … 298 314 (#/release controller) 299 315 (ns:with-ns-point (current-point 300 (or *next-listener-x-pos* *initial-listener-x-pos*) 301 (or *next-listener-y-pos* *initial-listener-y-pos*)) 316 (or *next-listener-x-pos* 317 (x-pos-for-window window *initial-listener-x-pos*)) 318 (or *next-listener-y-pos* 319 (y-pos-for-window window *initial-listener-y-pos*))) 302 320 (let* ((new-point (#/cascadeTopLeftFromPoint: window current-point))) 303 321 (setf *next-listener-x-pos* (ns:ns-point-x new-point) … … 393 411 (defmethod hi::send-string-to-listener-process ((process cocoa-listener-process) 394 412 string &key path package) 395 (let* ((fd (selection-input-stream-peer-fd (cocoa-listener-process-input-stream process)))) 396 (%stack-block ((buf 512)) 397 (let* ((nout 0)) 398 (labels ((flush () 399 (when (> nout 0) 400 (fd-write fd buf nout) 401 (setq nout 0))) 402 (out-raw-char (ch) 403 (when (= nout 512) 404 (flush)) 405 (let* ((code (char-code ch))) 406 (if (> code 255) 407 (setq code (char-code #\Sub))) 408 (setf (%get-unsigned-byte buf nout) code) 409 (incf nout))) 410 (out-ch (ch) 411 (when (or (eql ch #\^v) 412 (eql ch #\^p) 413 (eql ch #\newline) 414 (eql ch #\^q)) 415 (out-raw-char #\^q)) 416 (out-raw-char ch)) 417 (out-string (s) 418 (dotimes (i (length s)) 419 (out-ch (char s i))))) 420 (out-raw-char #\^p) 421 (when package (out-string package)) 422 (out-raw-char #\newline) 423 (out-raw-char #\^v) 424 (when path (out-string path)) 425 (out-raw-char #\newline) 426 (out-string string) 427 (flush)))))) 413 (let* ((stream (cocoa-listener-process-input-peer-stream process))) 414 (labels ((out-raw-char (ch) 415 (write-char ch stream)) 416 (out-ch (ch) 417 (when (or (eql ch #\^v) 418 (eql ch #\^p) 419 (eql ch #\newline) 420 (eql ch #\^q)) 421 (out-raw-char #\^q)) 422 (out-raw-char ch)) 423 (out-string (s) 424 (dotimes (i (length s)) 425 (out-ch (char s i))))) 426 (out-raw-char #\^p) 427 (when package (out-string package)) 428 (out-raw-char #\newline) 429 (out-raw-char #\^v) 430 (when path (out-string path)) 431 (out-raw-char #\newline) 432 (out-string string) 433 (force-output stream)))) 428 434 429 435
Note:
See TracChangeset
for help on using the changeset viewer.
