[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
CommToolBox Help
- To: INFO-MCL@CAMBRIDGE.APPLE.COM
- Subject: CommToolBox Help
- From: CAMPER@AppleLink.Apple.COM (Camper, Dan)
- Date: 10 Aug 93 19:24 GMT
I've just started a project that would involve multiple communication sessions
and I was hoping to use the CommToolBox for its flexibility. I'm unable to
change tools using CTB's built-in routines, however -- I always, always wind up
with an "unexpectedly quit - Type 1 error" dialog right when I make the
appropriate call. Everything seems to initialize correctly since I can
retrieve configuration information and whatnot before attempting the #_CMChoose
call.
The sample code below is what I'm working with. It creates a plain window with
some buttons that I was going to use to test the various toolbox calls. I had
just started with the Connection Manager stuff, so two of the three buttons
don't do anything.
Can anyone tell me what's going on? I suspect that "something" isn't being
initialized properly but I'll be darned if I can figure out what it is. Any
help would be appreciated!
Dan
===============================================================================
(ccl::require-interface :connections)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defclass ctb-window (color-dialog)
((terminal-handle :initform nil
:initarg :terminal
:accessor terminal-handle)
(connection-handle :initform nil
:initarg :connection
:accessor connection-handle)
(transfer-handle :initform nil
:initarg :transfer
:accessor transfer-handle)
))
(defmethod window-close :before ((w ctb-window))
(if (handlep (terminal-handle w)) (#_TMDispose (terminal-handle w)))
(if (handlep (connection-handle w)) (#_CMDispose (connection-handle w)))
(if (handlep (transfer-handle w)) (#_FTDispose (transfer-handle w))))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defun make-ctb-window ()
(let ((w (make-instance 'ctb-window
:window-type :document
:color-p t
:view-position #@(1 41)
:view-size #@(630 440)
:view-font '("Chicago" 12 :srcor :plain)
:window-title "CTB Window"
:window-show nil
:view-subviews
(list (make-dialog-item 'button-dialog-item
#@(34 20)
#@(163 16)
"Connection Tool"
'nil
:dialog-item-action
#'(lambda (self)
(eval-enqueue
(list 'ctb-configure-connection-tool
(view-window self))))
:default-button nil)
(make-dialog-item 'button-dialog-item
#@(220 20)
#@(163 16)
"Terminal Tool"
'nil
:default-button nil)
(make-dialog-item 'button-dialog-item
#@(417 20)
#@(163 16)
"Transfer Tool"
'nil
:default-button nil)))))
(with-cursor *watch-cursor*
(init-ctb-window w)
(window-show w))))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defmethod init-ctb-window ((w ctb-window))
(block up-and-out
(progn ; Connection Tool initialization
(with-pstrs ((tool-name "Apple Modem Tool"))
(let ((procid (#_CMGetProcID tool-name)))
(when (minusp procid)
(error (format nil "Error getting ProcID for connection tool (~D)"
procid))
(return-from up-and-out))
(rlet ((buffer-sizes :CMBufferSizes))
(rset buffer-sizes (:CMBufferSizes.Array #$cmDataIn) 0)
(rset buffer-sizes (:CMBufferSizes.Array #$cmDataOut) 0)
(rset buffer-sizes (:CMBufferSizes.Array #$cmCntlIn) 0)
(rset buffer-sizes (:CMBufferSizes.Array #$cmCntlOut) 0)
(rset buffer-sizes (:CMBufferSizes.Array #$cmAttnIn) 0)
(rset buffer-sizes (:CMBufferSizes.Array #$cmAttnOut) 0)
(setf (connection-handle w) (#_CMNew procid #$CMData
buffer-sizes 69 0))
(let ((err (#_CMValidate (connection-handle w))))
(if err
(error "Error validating Connection Tool")
(format t "~%Connection Tool Initialized OK.")))))))
(progn ; Terminal Tool initialization
)
(progn ; Transfer Tool initialization
)
))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;
(defmethod ctb-configure-connection-tool ((w ctb-window)
&optional (home-point #@(20 40)))
(let ((result (#_CMChoose (connection-handle w) home-point (%null-ptr))))
result))
(defmethod get-ctb-connection-configuration ((w ctb-window))
(let ((result (#_CMGetConfig (connection-handle w))))
(if (macptrp result)
(%get-cstring result)
(format nil "~%Error: ~A" result))))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;
(progn
(format t "~%Initializing...")
(format t "~%~5TCRM Initialization: ~A" (#_InitCRM))
(format t "~%~5TCTB Initialization: ~A" (#_InitCTBUtilities))
(format t "~%~5TConnection Manager: ~A" (#_InitCM))
(format t "~%~5TTerminal Manager: ~A" (#_InitTM))
(format t "~%~5TTransfer Manager: ~A" (#_InitFT))
)