comparison lisp/emacs-lisp/tq.el @ 1187:519c04d69cdc

Doc fixes. Make tq-create autoload.
author Richard M. Stallman <rms@gnu.org>
date Mon, 21 Sep 1992 15:01:37 +0000
parents 2cdce064065f
children e8214d59e98d
comparison
equal deleted inserted replaced
1186:24f248525608 1187:519c04d69cdc
34 ;;; queue. Then we call the function with the closure and the 34 ;;; queue. Then we call the function with the closure and the
35 ;;; collected bytes. 35 ;;; collected bytes.
36 36
37 ;;; Code: 37 ;;; Code:
38 38
39 ;;;###autoload
39 (defun tq-create (process) 40 (defun tq-create (process)
40 "Create and return a transaction queue. PROCESS should be capable 41 "Create and return a transaction queue communicating with PROCESS.
41 of sending and receiving streams of bytes. It may be a local process, 42 PROCESS should be a subprocess capable of sending and receiving
42 or it may be connected to a tcp server on another machine." 43 streams of bytes. It may be a local process, or it may be connected
44 to a tcp server on another machine."
43 (let ((tq (cons nil (cons process 45 (let ((tq (cons nil (cons process
44 (generate-new-buffer 46 (generate-new-buffer
45 (concat " tq-temp-" 47 (concat " tq-temp-"
46 (process-name process))))))) 48 (process-name process)))))))
47 (set-process-filter process 49 (set-process-filter process
66 (defun tq-queue-pop (tq) (setcar tq (cdr (car tq))) (null (car tq))) 68 (defun tq-queue-pop (tq) (setcar tq (cdr (car tq))) (null (car tq)))
67 69
68 70
69 ;;; must add to queue before sending! 71 ;;; must add to queue before sending!
70 (defun tq-enqueue (tq question regexp closure fn) 72 (defun tq-enqueue (tq question regexp closure fn)
71 "Add a transaction to TQ. Send question to the process, and call FN 73 "Add a transaction to transaction queue TQ.
72 with CLOSURE and and the answer, when it appears. The end of the 74 This sends the string QUESTION to the process that TQ communicates with.
73 answer is identified by REGEXP." 75 When the corresponding answer comes back, we call FN
76 with two arguments: CLOSURE, and the answer to the question.
77 REGEXP is a regular expression to match the entire answer;
78 that's how we tell where the answer ends."
74 (tq-queue-add tq regexp closure fn) 79 (tq-queue-add tq regexp closure fn)
75 (process-send-string (tq-process tq) question)) 80 (process-send-string (tq-process tq) question))
76 81
77 (defun tq-close (tq) 82 (defun tq-close (tq)
78 "Shut down the process, and destroy the evidence." 83 "Shut down transaction queue TQ, terminating the process."
79 (delete-process (tq-process tq)) 84 (delete-process (tq-process tq))
80 (kill-buffer (tq-buffer tq))) 85 (kill-buffer (tq-buffer tq)))
81 86
82 (defun tq-filter (tq string) 87 (defun tq-filter (tq string)
83 "Append STRING to the TQ's buffer; then process the new data." 88 "Append STRING to the TQ's buffer; then process the new data."