428
|
1 /* Tooltalk support for Emacs.
|
|
2 Copyright (C) 1993, 1994 Sun Microsystems, Inc.
|
|
3 Copyright (C) 1995 Free Software Foundation, Inc.
|
853
|
4 Copyright (C) 2002 Ben Wing.
|
428
|
5
|
|
6 This file is part of XEmacs.
|
|
7
|
|
8 XEmacs is free software; you can redistribute it and/or modify it
|
|
9 under the terms of the GNU General Public License as published by the
|
|
10 Free Software Foundation; either version 2, or (at your option) any
|
|
11 later version.
|
|
12
|
|
13 XEmacs is distributed in the hope that it will be useful, but WITHOUT
|
|
14 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
15 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
16 for more details.
|
|
17
|
|
18 You should have received a copy of the GNU General Public License
|
|
19 along with XEmacs; see the file COPYING. If not, write to
|
|
20 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
21 Boston, MA 02111-1307, USA. */
|
|
22
|
|
23 /* Synched up with: Not in FSF. */
|
|
24
|
|
25 /* Written by John Rose <john.rose@eng.sun.com>.
|
|
26 Heavily modified and cleaned up by Ben Wing <ben@xemacs.org>. */
|
|
27
|
|
28 #include <config.h>
|
|
29 #include "lisp.h"
|
|
30
|
|
31 #include <X11/Xlib.h>
|
|
32
|
|
33 #include "buffer.h"
|
|
34 #include "elhash.h"
|
|
35 #include "process.h"
|
|
36 #include "tooltalk.h"
|
442
|
37 #include "syssignal.h"
|
428
|
38
|
|
39 Lisp_Object Vtooltalk_fd;
|
|
40
|
|
41 #ifdef TT_DEBUG
|
|
42 static FILE *tooltalk_log_file;
|
|
43 #endif
|
|
44
|
|
45 static Lisp_Object
|
|
46 Vtooltalk_message_handler_hook,
|
|
47 Vtooltalk_pattern_handler_hook,
|
|
48 Vtooltalk_unprocessed_message_hook;
|
|
49
|
|
50 static Lisp_Object
|
|
51 Qtooltalk_message_handler_hook,
|
|
52 Qtooltalk_pattern_handler_hook,
|
|
53 Qtooltalk_unprocessed_message_hook;
|
|
54
|
|
55 static Lisp_Object
|
|
56 Qreceive_tooltalk_message,
|
|
57 Qtt_address,
|
|
58 Qtt_args_count,
|
|
59 Qtt_arg_bval,
|
|
60 Qtt_arg_ival,
|
|
61 Qtt_arg_mode,
|
|
62 Qtt_arg_type,
|
|
63 Qtt_arg_val,
|
|
64 Qtt_class,
|
|
65 Qtt_category,
|
|
66 Qtt_disposition,
|
|
67 Qtt_file,
|
|
68 Qtt_gid,
|
|
69 Qtt_handler,
|
|
70 Qtt_handler_ptype,
|
|
71 Qtt_object,
|
|
72 Qtt_op,
|
|
73 Qtt_opnum,
|
|
74 Qtt_otype,
|
|
75 Qtt_scope,
|
|
76 Qtt_sender,
|
|
77 Qtt_sender_ptype,
|
|
78 Qtt_session,
|
|
79 Qtt_state,
|
|
80 Qtt_status,
|
|
81 Qtt_status_string,
|
|
82 Qtt_uid,
|
|
83 Qtt_callback,
|
|
84 Qtt_plist,
|
|
85 Qtt_prop,
|
|
86
|
|
87 Qtt_reject, /* return-tooltalk-message */
|
|
88 Qtt_reply,
|
|
89 Qtt_fail,
|
|
90
|
|
91 Q_TT_MODE_UNDEFINED, /* enum Tt_mode */
|
|
92 Q_TT_IN,
|
|
93 Q_TT_OUT,
|
|
94 Q_TT_INOUT,
|
|
95 Q_TT_MODE_LAST,
|
|
96
|
|
97 Q_TT_SCOPE_NONE, /* enum Tt_scope */
|
|
98 Q_TT_SESSION,
|
|
99 Q_TT_FILE,
|
|
100 Q_TT_BOTH,
|
|
101 Q_TT_FILE_IN_SESSION,
|
|
102
|
|
103 Q_TT_CLASS_UNDEFINED, /* enum Tt_class */
|
|
104 Q_TT_NOTICE,
|
|
105 Q_TT_REQUEST,
|
|
106 Q_TT_CLASS_LAST,
|
|
107
|
|
108 Q_TT_CATEGORY_UNDEFINED, /* enum Tt_category */
|
|
109 Q_TT_OBSERVE,
|
|
110 Q_TT_HANDLE,
|
|
111 Q_TT_CATEGORY_LAST,
|
|
112
|
|
113 Q_TT_PROCEDURE, /* typedef enum Tt_address */
|
|
114 Q_TT_OBJECT,
|
|
115 Q_TT_HANDLER,
|
|
116 Q_TT_OTYPE,
|
|
117 Q_TT_ADDRESS_LAST,
|
|
118
|
|
119 Q_TT_CREATED, /* enum Tt_state */
|
|
120 Q_TT_SENT,
|
|
121 Q_TT_HANDLED,
|
|
122 Q_TT_FAILED,
|
|
123 Q_TT_QUEUED,
|
|
124 Q_TT_STARTED,
|
|
125 Q_TT_REJECTED,
|
|
126 Q_TT_STATE_LAST,
|
|
127
|
|
128 Q_TT_DISCARD, /* enum Tt_disposition */
|
|
129 Q_TT_QUEUE,
|
|
130 Q_TT_START;
|
|
131
|
|
132 static Lisp_Object Tooltalk_Message_plist_str, Tooltalk_Pattern_plist_str;
|
|
133
|
|
134 Lisp_Object Qtooltalk_error;
|
|
135
|
|
136 /* Used to GCPRO tooltalk message and pattern objects while
|
|
137 they're sitting inside of some active tooltalk message or pattern.
|
|
138 There may not be any other pointers to these objects. */
|
|
139 Lisp_Object Vtooltalk_message_gcpro, Vtooltalk_pattern_gcpro;
|
|
140
|
|
141
|
|
142 /* */
|
|
143 /* machinery for tooltalk-message type */
|
|
144 /* */
|
|
145
|
|
146 Lisp_Object Qtooltalk_messagep;
|
|
147
|
|
148 struct Lisp_Tooltalk_Message
|
|
149 {
|
|
150 struct lcrecord_header header;
|
|
151 Lisp_Object plist_sym, callback;
|
|
152 Tt_message m;
|
|
153 };
|
|
154
|
934
|
155 #ifdef USE_KKCC
|
|
156 static const struct lrecord_description tooltalk_message_description [] = {
|
|
157 { XD_LISP_OBJECT, offsetof (struct Lisp_Tooltalk_Message, callback) },
|
|
158 { XD_LISP_OBJECT, offsetof (struct Lisp_Tooltalk_Message, plist_sym) },
|
|
159 { XD_END }
|
|
160 };
|
|
161 #endif /* USE_KKCC */
|
|
162
|
428
|
163 static Lisp_Object
|
|
164 mark_tooltalk_message (Lisp_Object obj)
|
|
165 {
|
|
166 mark_object (XTOOLTALK_MESSAGE (obj)->callback);
|
|
167 return XTOOLTALK_MESSAGE (obj)->plist_sym;
|
|
168 }
|
|
169
|
|
170 static void
|
|
171 print_tooltalk_message (Lisp_Object obj, Lisp_Object printcharfun,
|
|
172 int escapeflag)
|
|
173 {
|
440
|
174 Lisp_Tooltalk_Message *p = XTOOLTALK_MESSAGE (obj);
|
428
|
175
|
|
176 if (print_readably)
|
563
|
177 printing_unreadable_object ("#<tooltalk_message 0x%x>",
|
|
178 p->header.uid);
|
428
|
179
|
800
|
180 write_fmt_string (printcharfun, "#<tooltalk_message id:0x%lx 0x%x>",
|
|
181 (long) (p->m), p->header.uid);
|
428
|
182 }
|
|
183
|
934
|
184 #ifdef USE_KKCC
|
|
185 DEFINE_LRECORD_IMPLEMENTATION ("tooltalk-message", tooltalk_message,
|
960
|
186 0, /*dumpable-flag*/
|
934
|
187 mark_tooltalk_message, print_tooltalk_message,
|
|
188 0, 0, 0,
|
|
189 tooltalk_message_description,
|
|
190 Lisp_Tooltalk_Message);
|
|
191 #else /* not USE_KKCC */
|
428
|
192 DEFINE_LRECORD_IMPLEMENTATION ("tooltalk-message", tooltalk_message,
|
|
193 mark_tooltalk_message, print_tooltalk_message,
|
|
194 0, 0, 0, 0,
|
440
|
195 Lisp_Tooltalk_Message);
|
934
|
196 #endif /* not USE_KKCC */
|
428
|
197
|
|
198 static Lisp_Object
|
|
199 make_tooltalk_message (Tt_message m)
|
|
200 {
|
|
201 Lisp_Object val;
|
440
|
202 Lisp_Tooltalk_Message *msg =
|
|
203 alloc_lcrecord_type (Lisp_Tooltalk_Message, &lrecord_tooltalk_message);
|
428
|
204
|
|
205 msg->m = m;
|
|
206 msg->callback = Qnil;
|
|
207 msg->plist_sym = Fmake_symbol (Tooltalk_Message_plist_str);
|
793
|
208 return wrap_tooltalk_message (msg);
|
428
|
209 }
|
|
210
|
|
211 Tt_message
|
|
212 unbox_tooltalk_message (Lisp_Object msg)
|
|
213 {
|
|
214 CHECK_TOOLTALK_MESSAGE (msg);
|
|
215 return XTOOLTALK_MESSAGE (msg)->m;
|
|
216 }
|
|
217
|
|
218 DEFUN ("tooltalk-message-p", Ftooltalk_message_p, 1, 1, 0, /*
|
|
219 Return non-nil if OBJECT is a tooltalk message.
|
|
220 */
|
|
221 (object))
|
|
222 {
|
|
223 return TOOLTALK_MESSAGEP (object) ? Qt : Qnil;
|
|
224 }
|
|
225
|
|
226
|
|
227
|
|
228
|
|
229 /* */
|
|
230 /* machinery for tooltalk-pattern type */
|
|
231 /* */
|
|
232
|
|
233 Lisp_Object Qtooltalk_patternp;
|
|
234
|
|
235 struct Lisp_Tooltalk_Pattern
|
|
236 {
|
|
237 struct lcrecord_header header;
|
|
238 Lisp_Object plist_sym, callback;
|
|
239 Tt_pattern p;
|
|
240 };
|
|
241
|
934
|
242 #ifdef USE_KKCC
|
|
243 static const struct lrecord_description tooltalk_pattern_description [] = {
|
|
244 { XD_LISP_OBJECT, offsetof (struct Lisp_Tooltalk_Pattern, callback) },
|
|
245 { XD_LISP_OBJECT, offsetof (struct Lisp_Tooltalk_Pattern, plist_sym) },
|
|
246 { XD_END }
|
|
247 };
|
|
248 #endif /* USE_KKCC */
|
|
249
|
428
|
250 static Lisp_Object
|
|
251 mark_tooltalk_pattern (Lisp_Object obj)
|
|
252 {
|
|
253 mark_object (XTOOLTALK_PATTERN (obj)->callback);
|
|
254 return XTOOLTALK_PATTERN (obj)->plist_sym;
|
|
255 }
|
|
256
|
|
257 static void
|
|
258 print_tooltalk_pattern (Lisp_Object obj, Lisp_Object printcharfun,
|
|
259 int escapeflag)
|
|
260 {
|
440
|
261 Lisp_Tooltalk_Pattern *p = XTOOLTALK_PATTERN (obj);
|
428
|
262
|
|
263 if (print_readably)
|
563
|
264 printing_unreadable_object ("#<tooltalk_pattern 0x%x>",
|
|
265 p->header.uid);
|
428
|
266
|
800
|
267 write_fmt_string (printcharfun, "#<tooltalk_pattern id:0x%lx 0x%x>",
|
|
268 (long) (p->p), p->header.uid);
|
428
|
269 }
|
|
270
|
934
|
271 #ifdef USE_KKCC
|
|
272 DEFINE_LRECORD_IMPLEMENTATION ("tooltalk-pattern", tooltalk_pattern,
|
960
|
273 0, /*dumpable-flag*/
|
934
|
274 mark_tooltalk_pattern, print_tooltalk_pattern,
|
|
275 0, 0, 0,
|
|
276 tooltalk_pattern_description,
|
|
277 Lisp_Tooltalk_Pattern);
|
|
278 #else /* not USE_KKCC */
|
428
|
279 DEFINE_LRECORD_IMPLEMENTATION ("tooltalk-pattern", tooltalk_pattern,
|
|
280 mark_tooltalk_pattern, print_tooltalk_pattern,
|
|
281 0, 0, 0, 0,
|
440
|
282 Lisp_Tooltalk_Pattern);
|
934
|
283 #endif /* not USE_KKCC */
|
428
|
284
|
|
285 static Lisp_Object
|
|
286 make_tooltalk_pattern (Tt_pattern p)
|
|
287 {
|
440
|
288 Lisp_Tooltalk_Pattern *pat =
|
|
289 alloc_lcrecord_type (Lisp_Tooltalk_Pattern, &lrecord_tooltalk_pattern);
|
428
|
290 Lisp_Object val;
|
|
291
|
|
292 pat->p = p;
|
|
293 pat->callback = Qnil;
|
|
294 pat->plist_sym = Fmake_symbol (Tooltalk_Pattern_plist_str);
|
|
295
|
793
|
296 return wrap_tooltalk_pattern (pat);
|
428
|
297 }
|
|
298
|
|
299 static Tt_pattern
|
|
300 unbox_tooltalk_pattern (Lisp_Object pattern)
|
|
301 {
|
|
302 CHECK_TOOLTALK_PATTERN (pattern);
|
|
303 return XTOOLTALK_PATTERN (pattern)->p;
|
|
304 }
|
|
305
|
|
306 DEFUN ("tooltalk-pattern-p", Ftooltalk_pattern_p, 1, 1, 0, /*
|
|
307 Return non-nil if OBJECT is a tooltalk pattern.
|
|
308 */
|
|
309 (object))
|
|
310 {
|
|
311 return TOOLTALK_PATTERNP (object) ? Qt : Qnil;
|
|
312 }
|
|
313
|
|
314
|
|
315
|
|
316
|
|
317 static int
|
|
318 tooltalk_constant_value (Lisp_Object s)
|
|
319 {
|
|
320 if (INTP (s))
|
|
321 return XINT (s);
|
|
322 else if (SYMBOLP (s))
|
|
323 return XINT (XSYMBOL (s)->value);
|
|
324 else
|
|
325 return 0; /* should never occur */
|
|
326 }
|
|
327
|
|
328 static void
|
|
329 check_status (Tt_status st)
|
|
330 {
|
|
331 if (tt_is_err (st))
|
563
|
332 {
|
867
|
333 CIbyte *err;
|
563
|
334
|
|
335 EXTERNAL_TO_C_STRING (tt_status_message (st), err, Qnative);
|
|
336 signal_error (Qtooltalk_error, err, Qunbound);
|
|
337 }
|
428
|
338 }
|
|
339
|
|
340 DEFUN ("receive-tooltalk-message", Freceive_tooltalk_message, 0, 2, 0, /*
|
|
341 Run tt_message_receive().
|
|
342 This function is the process handler for the ToolTalk connection process.
|
|
343 */
|
|
344 (ignore1, ignore2))
|
|
345 {
|
|
346 /* This function can GC */
|
|
347 Tt_message mess = tt_message_receive ();
|
|
348 Lisp_Object message_ = make_tooltalk_message (mess);
|
|
349 struct gcpro gcpro1;
|
|
350
|
|
351 GCPRO1 (message_);
|
|
352 if (mess != NULL && !NILP (Vtooltalk_unprocessed_message_hook))
|
|
353 va_run_hook_with_args (Qtooltalk_unprocessed_message_hook, 1, message_);
|
|
354 UNGCPRO;
|
|
355
|
|
356 /* see comment in event-stream.c about this return value. */
|
|
357 return Qzero;
|
|
358 }
|
|
359
|
|
360 static Tt_callback_action
|
|
361 tooltalk_message_callback (Tt_message m, Tt_pattern p)
|
|
362 {
|
|
363 /* This function can GC */
|
|
364 Lisp_Object cb;
|
|
365 Lisp_Object message_;
|
|
366 Lisp_Object pattern;
|
|
367 struct gcpro gcpro1, gcpro2;
|
|
368
|
|
369 #ifdef TT_DEBUG
|
|
370 int i, j;
|
|
371
|
|
372 fprintf (tooltalk_log_file, "message_cb: %d\n", m);
|
|
373 fprintf (tooltalk_log_file, "op: %s (", tt_message_op (m));
|
|
374 for (j = tt_message_args_count (m), i = 0; i < j; i++) {
|
|
375 fprintf (tooltalk_log_file, "%s \"%s\"", tt_message_arg_type (m, i),
|
|
376 tt_message_arg_val (m, i));
|
|
377 fprintf (tooltalk_log_file, "%s", i == j-1 ? ")" : ", ");
|
|
378 }
|
|
379 fprintf (tooltalk_log_file, "\n\n");
|
|
380 fflush (tooltalk_log_file);
|
|
381 #endif
|
|
382
|
826
|
383 message_ = VOID_TO_LISP (tt_message_user (m, TOOLTALK_MESSAGE_KEY));
|
428
|
384 pattern = make_tooltalk_pattern (p);
|
|
385 cb = XTOOLTALK_MESSAGE (message_)->callback;
|
|
386 GCPRO2 (message_, pattern);
|
|
387 if (!NILP (Vtooltalk_message_handler_hook))
|
|
388 va_run_hook_with_args (Qtooltalk_message_handler_hook, 2,
|
|
389 message_, pattern);
|
|
390
|
|
391 if ((SYMBOLP (cb) && EQ (Qt, Ffboundp (cb))) ||
|
|
392 (CONSP (cb) && EQ (Qlambda, Fcar (cb)) &&
|
|
393 !NILP (Flistp (Fcar (Fcdr (cb))))))
|
|
394 call2 (cb, message_, pattern);
|
|
395 UNGCPRO;
|
|
396
|
|
397 tt_message_destroy (m);
|
|
398 Fremhash (message_, Vtooltalk_message_gcpro);
|
|
399
|
|
400 return TT_CALLBACK_PROCESSED;
|
|
401 }
|
|
402
|
|
403 static Tt_callback_action
|
|
404 tooltalk_pattern_callback (Tt_message m, Tt_pattern p)
|
|
405 {
|
|
406 /* This function can GC */
|
|
407 Lisp_Object cb;
|
|
408 Lisp_Object message_;
|
|
409 Lisp_Object pattern;
|
|
410 struct gcpro gcpro1, gcpro2;
|
|
411
|
|
412 #ifdef TT_DEBUG
|
|
413 int i, j;
|
|
414
|
|
415 fprintf (tooltalk_log_file, "pattern_cb: %d\n", m);
|
|
416 fprintf (tooltalk_log_file, "op: %s (", tt_message_op (m));
|
|
417 for (j = tt_message_args_count (m), i = 0; i < j; i++) {
|
|
418 fprintf (tooltalk_log_file, "%s \"%s\"", tt_message_arg_type (m, i),
|
|
419 tt_message_arg_val (m, i));
|
|
420 fprintf (tooltalk_log_file, "%s", i == j-1 ? ")" : ", ");
|
|
421 }
|
|
422 fprintf (tooltalk_log_file, "\n\n");
|
|
423 fflush (tooltalk_log_file);
|
|
424 #endif
|
|
425
|
|
426 message_ = make_tooltalk_message (m);
|
826
|
427 pattern = VOID_TO_LISP (tt_pattern_user (p, TOOLTALK_PATTERN_KEY));
|
428
|
428 cb = XTOOLTALK_PATTERN (pattern)->callback;
|
|
429 GCPRO2 (message_, pattern);
|
|
430 if (!NILP (Vtooltalk_pattern_handler_hook))
|
|
431 va_run_hook_with_args (Qtooltalk_pattern_handler_hook, 2,
|
|
432 message_, pattern);
|
|
433
|
|
434 if (SYMBOLP (cb) && EQ (Qt, Ffboundp (cb)))
|
|
435 call2 (cb, message_, pattern);
|
|
436 UNGCPRO;
|
|
437
|
|
438 tt_message_destroy (m);
|
|
439 return TT_CALLBACK_PROCESSED;
|
|
440 }
|
|
441
|
|
442 static Lisp_Object
|
|
443 tt_mode_symbol (Tt_mode n)
|
|
444 {
|
|
445 switch (n)
|
|
446 {
|
|
447 case TT_MODE_UNDEFINED: return Q_TT_MODE_UNDEFINED;
|
|
448 case TT_IN: return Q_TT_IN;
|
|
449 case TT_OUT: return Q_TT_OUT;
|
|
450 case TT_INOUT: return Q_TT_INOUT;
|
|
451 case TT_MODE_LAST: return Q_TT_MODE_LAST;
|
|
452 default: return Qnil;
|
|
453 }
|
|
454 }
|
|
455
|
|
456 static Lisp_Object
|
|
457 tt_scope_symbol (Tt_scope n)
|
|
458 {
|
|
459 switch (n)
|
|
460 {
|
|
461 case TT_SCOPE_NONE: return Q_TT_SCOPE_NONE;
|
|
462 case TT_SESSION: return Q_TT_SESSION;
|
|
463 case TT_FILE: return Q_TT_FILE;
|
|
464 case TT_BOTH: return Q_TT_BOTH;
|
|
465 case TT_FILE_IN_SESSION: return Q_TT_FILE_IN_SESSION;
|
|
466 default: return Qnil;
|
|
467 }
|
|
468 }
|
|
469
|
|
470
|
|
471 static Lisp_Object
|
|
472 tt_class_symbol (Tt_class n)
|
|
473 {
|
|
474 switch (n)
|
|
475 {
|
|
476 case TT_CLASS_UNDEFINED: return Q_TT_CLASS_UNDEFINED;
|
|
477 case TT_NOTICE: return Q_TT_NOTICE;
|
|
478 case TT_REQUEST: return Q_TT_REQUEST;
|
|
479 case TT_CLASS_LAST: return Q_TT_CLASS_LAST;
|
|
480 default: return Qnil;
|
|
481 }
|
|
482 }
|
|
483
|
|
484 /*
|
|
485 * This is not being used. Is that a mistake or is this function
|
|
486 * simply not necessary?
|
|
487 */
|
|
488 #if 0
|
|
489 static Lisp_Object
|
|
490 tt_category_symbol (Tt_category n)
|
|
491 {
|
|
492 switch (n)
|
|
493 {
|
|
494 case TT_CATEGORY_UNDEFINED: return Q_TT_CATEGORY_UNDEFINED;
|
|
495 case TT_OBSERVE: return Q_TT_OBSERVE;
|
|
496 case TT_HANDLE: return Q_TT_HANDLE;
|
|
497 case TT_CATEGORY_LAST: return Q_TT_CATEGORY_LAST;
|
|
498 default: return Qnil;
|
|
499 }
|
|
500 }
|
|
501 #endif /* 0 */
|
|
502
|
|
503 static Lisp_Object
|
|
504 tt_address_symbol (Tt_address n)
|
|
505 {
|
|
506 switch (n)
|
|
507 {
|
|
508 case TT_PROCEDURE: return Q_TT_PROCEDURE;
|
|
509 case TT_OBJECT: return Q_TT_OBJECT;
|
|
510 case TT_HANDLER: return Q_TT_HANDLER;
|
|
511 case TT_OTYPE: return Q_TT_OTYPE;
|
|
512 case TT_ADDRESS_LAST: return Q_TT_ADDRESS_LAST;
|
|
513 default: return Qnil;
|
|
514 }
|
|
515 }
|
|
516
|
|
517 static Lisp_Object
|
|
518 tt_state_symbol (Tt_state n)
|
|
519 {
|
|
520 switch (n)
|
|
521 {
|
|
522 case TT_CREATED: return Q_TT_CREATED;
|
|
523 case TT_SENT: return Q_TT_SENT;
|
|
524 case TT_HANDLED: return Q_TT_HANDLED;
|
|
525 case TT_FAILED: return Q_TT_FAILED;
|
|
526 case TT_QUEUED: return Q_TT_QUEUED;
|
|
527 case TT_STARTED: return Q_TT_STARTED;
|
|
528 case TT_REJECTED: return Q_TT_REJECTED;
|
|
529 case TT_STATE_LAST: return Q_TT_STATE_LAST;
|
|
530 default: return Qnil;
|
|
531 }
|
|
532 }
|
|
533
|
|
534 static Lisp_Object
|
771
|
535 tt_build_c_string (char *s)
|
428
|
536 {
|
|
537 return build_string (s ? s : "");
|
|
538 }
|
|
539
|
|
540 static Lisp_Object
|
|
541 tt_opnum_string (int n)
|
|
542 {
|
|
543 char buf[32];
|
|
544
|
|
545 sprintf (buf, "%u", n);
|
|
546 return build_string (buf);
|
|
547 }
|
|
548
|
|
549 static Lisp_Object
|
|
550 tt_message_arg_ival_string (Tt_message m, int n)
|
|
551 {
|
603
|
552 char buf[DECIMAL_PRINT_SIZE (long)];
|
428
|
553 int value;
|
|
554
|
|
555 check_status (tt_message_arg_ival (m, n, &value));
|
|
556 long_to_string (buf, value);
|
|
557 return build_string (buf);
|
|
558 }
|
|
559
|
|
560 static Lisp_Object
|
|
561 tt_message_arg_bval_vector (Tt_message m, int n)
|
|
562 {
|
|
563 /* !!#### This function has not been Mule-ized */
|
867
|
564 Ibyte *value;
|
428
|
565 int len = 0;
|
|
566
|
|
567 check_status (tt_message_arg_bval (m, n, &value, &len));
|
|
568
|
|
569 return make_string (value, len);
|
|
570 }
|
|
571
|
|
572 DEFUN ("get-tooltalk-message-attribute", Fget_tooltalk_message_attribute,
|
|
573 2, 3, 0, /*
|
|
574 Return the indicated Tooltalk message attribute. Attributes are
|
|
575 identified by symbols with the same name (underscores and all) as the
|
|
576 suffix of the Tooltalk tt_message_<attribute> function that extracts the value.
|
|
577 String attribute values are copied, enumerated type values (except disposition)
|
|
578 are converted to symbols - e.g. TT_HANDLER is 'TT_HANDLER, uid and gid are
|
|
579 represented by fixnums (small integers), opnum is converted to a string,
|
|
580 and disposition is converted to a fixnum. We convert opnum (a C int) to a
|
|
581 string, e.g. 123 => "123" because there's no guarantee that opnums will fit
|
|
582 within the range of Lisp integers.
|
|
583
|
|
584 Use the 'plist attribute instead of the C API 'user attribute
|
|
585 for user defined message data. To retrieve the value of a message property
|
|
586 specify the indicator for argn. For example to get the value of a property
|
|
587 called 'rflag, use
|
|
588 (get-tooltalk-message-attribute message 'plist 'rflag)
|
|
589
|
|
590 To get the value of a message argument use one of the 'arg_val (strings),
|
|
591 'arg_ival (integers), or 'arg_bval (strings with embedded nulls), attributes.
|
|
592 For example to get the integer value of the third argument:
|
|
593
|
|
594 (get-tooltalk-message-attribute message 'arg_ival 2)
|
|
595
|
|
596 As you can see, argument numbers are zero based. The type of each argument
|
|
597 can be retrieved with the 'arg_type attribute; however, Tooltalk doesn't
|
|
598 define any semantics for the string value of 'arg_type. Conventionally
|
|
599 "string" is used for strings and "int" for 32 bit integers. Note that
|
|
600 Emacs Lisp stores the lengths of strings explicitly (unlike C) so treating the
|
|
601 value returned by 'arg_bval like a string is fine.
|
|
602 */
|
|
603 (message_, attribute, argn))
|
|
604 {
|
|
605 Tt_message m = unbox_tooltalk_message (message_);
|
|
606 int n = 0;
|
|
607
|
|
608 CHECK_SYMBOL (attribute);
|
|
609 if (EQ (attribute, (Qtt_arg_bval)) ||
|
|
610 EQ (attribute, (Qtt_arg_ival)) ||
|
|
611 EQ (attribute, (Qtt_arg_mode)) ||
|
|
612 EQ (attribute, (Qtt_arg_type)) ||
|
|
613 EQ (attribute, (Qtt_arg_val)))
|
|
614 {
|
|
615 CHECK_INT (argn);
|
|
616 n = XINT (argn);
|
|
617 }
|
|
618
|
|
619 if (!VALID_TOOLTALK_MESSAGEP (m))
|
|
620 return Qnil;
|
|
621
|
|
622 else if (EQ (attribute, Qtt_arg_bval))
|
|
623 return tt_message_arg_bval_vector (m, n);
|
|
624
|
|
625 else if (EQ (attribute, Qtt_arg_ival))
|
|
626 return tt_message_arg_ival_string (m, n);
|
|
627
|
|
628 else if (EQ (attribute, Qtt_arg_mode))
|
|
629 return tt_mode_symbol (tt_message_arg_mode (m, n));
|
|
630
|
|
631 else if (EQ (attribute, Qtt_arg_type))
|
771
|
632 return tt_build_c_string (tt_message_arg_type (m, n));
|
428
|
633
|
|
634 else if (EQ (attribute, Qtt_arg_val))
|
|
635 return tt_message_arg_bval_vector (m, n);
|
|
636
|
|
637 else if (EQ (attribute, Qtt_args_count))
|
|
638 return make_int (tt_message_args_count (m));
|
|
639
|
|
640 else if (EQ (attribute, Qtt_address))
|
|
641 return tt_address_symbol (tt_message_address (m));
|
|
642
|
|
643 else if (EQ (attribute, Qtt_class))
|
|
644 return tt_class_symbol (tt_message_class (m));
|
|
645
|
|
646 else if (EQ (attribute, Qtt_disposition))
|
|
647 return make_int (tt_message_disposition (m));
|
|
648
|
|
649 else if (EQ (attribute, Qtt_file))
|
771
|
650 return tt_build_c_string (tt_message_file (m));
|
428
|
651
|
|
652 else if (EQ (attribute, Qtt_gid))
|
|
653 return make_int (tt_message_gid (m));
|
|
654
|
|
655 else if (EQ (attribute, Qtt_handler))
|
771
|
656 return tt_build_c_string (tt_message_handler (m));
|
428
|
657
|
|
658 else if (EQ (attribute, Qtt_handler_ptype))
|
771
|
659 return tt_build_c_string (tt_message_handler_ptype (m));
|
428
|
660
|
|
661 else if (EQ (attribute, Qtt_object))
|
771
|
662 return tt_build_c_string (tt_message_object (m));
|
428
|
663
|
|
664 else if (EQ (attribute, Qtt_op))
|
771
|
665 return tt_build_c_string (tt_message_op (m));
|
428
|
666
|
|
667 else if (EQ (attribute, Qtt_opnum))
|
|
668 return tt_opnum_string (tt_message_opnum (m));
|
|
669
|
|
670 else if (EQ (attribute, Qtt_otype))
|
771
|
671 return tt_build_c_string (tt_message_otype (m));
|
428
|
672
|
|
673 else if (EQ (attribute, Qtt_scope))
|
|
674 return tt_scope_symbol (tt_message_scope (m));
|
|
675
|
|
676 else if (EQ (attribute, Qtt_sender))
|
771
|
677 return tt_build_c_string (tt_message_sender (m));
|
428
|
678
|
|
679 else if (EQ (attribute, Qtt_sender_ptype))
|
771
|
680 return tt_build_c_string (tt_message_sender_ptype (m));
|
428
|
681
|
|
682 else if (EQ (attribute, Qtt_session))
|
771
|
683 return tt_build_c_string (tt_message_session (m));
|
428
|
684
|
|
685 else if (EQ (attribute, Qtt_state))
|
|
686 return tt_state_symbol (tt_message_state (m));
|
|
687
|
|
688 else if (EQ (attribute, Qtt_status))
|
|
689 return make_int (tt_message_status (m));
|
|
690
|
|
691 else if (EQ (attribute, Qtt_status_string))
|
771
|
692 return tt_build_c_string (tt_message_status_string (m));
|
428
|
693
|
|
694 else if (EQ (attribute, Qtt_uid))
|
|
695 return make_int (tt_message_uid (m));
|
|
696
|
|
697 else if (EQ (attribute, Qtt_callback))
|
|
698 return XTOOLTALK_MESSAGE (message_)->callback;
|
|
699
|
|
700 else if (EQ (attribute, Qtt_prop))
|
|
701 return Fget (XTOOLTALK_MESSAGE (message_)->plist_sym, argn, Qnil);
|
|
702
|
|
703 else if (EQ (attribute, Qtt_plist))
|
|
704 return Fcopy_sequence (Fsymbol_plist
|
|
705 (XTOOLTALK_MESSAGE (message_)->plist_sym));
|
|
706
|
|
707 else
|
563
|
708 invalid_constant ("Invalid value for `get-tooltalk-message-attribute'",
|
428
|
709 attribute);
|
|
710
|
|
711 return Qnil;
|
|
712 }
|
|
713
|
|
714 DEFUN ("set-tooltalk-message-attribute", Fset_tooltalk_message_attribute,
|
|
715 3, 4, 0, /*
|
|
716 Initialize one Tooltalk message attribute.
|
|
717
|
|
718 Attribute names and values are the same as for
|
|
719 `get-tooltalk-message-attribute'. A property list is provided for user
|
|
720 data (instead of the 'user message attribute); see
|
|
721 `get-tooltalk-message-attribute'.
|
|
722
|
|
723 The value of callback should be the name of a function of one argument.
|
|
724 It will be applied to the message and matching pattern each time the state of the
|
|
725 message changes. This is usually used to notice when the messages state has
|
|
726 changed to TT_HANDLED (or TT_FAILED), so that reply argument values
|
|
727 can be used.
|
|
728
|
|
729 If one of the argument attributes is specified, 'arg_val, 'arg_ival, or
|
|
730 'arg_bval then argn must be the number of an already created argument.
|
|
731 New arguments can be added to a message with add-tooltalk-message-arg.
|
|
732 */
|
|
733 (value, message_, attribute, argn))
|
|
734 {
|
|
735 Tt_message m = unbox_tooltalk_message (message_);
|
|
736 int n = 0;
|
440
|
737 Tt_status (*fun_str) (Tt_message, const char *) = 0;
|
428
|
738
|
|
739 CHECK_SYMBOL (attribute);
|
440
|
740
|
428
|
741 if (EQ (attribute, (Qtt_arg_bval)) ||
|
|
742 EQ (attribute, (Qtt_arg_ival)) ||
|
|
743 EQ (attribute, (Qtt_arg_val)))
|
|
744 {
|
|
745 CHECK_INT (argn);
|
|
746 n = XINT (argn);
|
|
747 }
|
|
748
|
|
749 if (!VALID_TOOLTALK_MESSAGEP (m))
|
|
750 return Qnil;
|
|
751
|
440
|
752 if (EQ (attribute, Qtt_address))
|
428
|
753 {
|
|
754 CHECK_TOOLTALK_CONSTANT (value);
|
|
755 tt_message_address_set (m, (Tt_address) tooltalk_constant_value (value));
|
|
756 }
|
|
757 else if (EQ (attribute, Qtt_class))
|
|
758 {
|
|
759 CHECK_TOOLTALK_CONSTANT (value);
|
|
760 tt_message_class_set (m, (Tt_class) tooltalk_constant_value (value));
|
|
761 }
|
|
762 else if (EQ (attribute, Qtt_disposition))
|
|
763 {
|
|
764 CHECK_TOOLTALK_CONSTANT (value);
|
|
765 tt_message_disposition_set (m, ((Tt_disposition)
|
|
766 tooltalk_constant_value (value)));
|
|
767 }
|
|
768 else if (EQ (attribute, Qtt_scope))
|
|
769 {
|
|
770 CHECK_TOOLTALK_CONSTANT (value);
|
|
771 tt_message_scope_set (m, (Tt_scope) tooltalk_constant_value (value));
|
|
772 }
|
440
|
773 else if (EQ (attribute, Qtt_file))
|
|
774 fun_str = tt_message_file_set;
|
|
775 else if (EQ (attribute, Qtt_handler_ptype))
|
|
776 fun_str = tt_message_handler_ptype_set;
|
|
777 else if (EQ (attribute, Qtt_handler))
|
|
778 fun_str = tt_message_handler_set;
|
|
779 else if (EQ (attribute, Qtt_object))
|
|
780 fun_str = tt_message_object_set;
|
|
781 else if (EQ (attribute, Qtt_op))
|
|
782 fun_str = tt_message_op_set;
|
|
783 else if (EQ (attribute, Qtt_otype))
|
|
784 fun_str = tt_message_otype_set;
|
428
|
785 else if (EQ (attribute, Qtt_sender_ptype))
|
440
|
786 fun_str = tt_message_sender_ptype_set;
|
428
|
787 else if (EQ (attribute, Qtt_session))
|
440
|
788 fun_str = tt_message_session_set;
|
|
789 else if (EQ (attribute, Qtt_status_string))
|
|
790 fun_str = tt_message_status_string_set;
|
428
|
791 else if (EQ (attribute, Qtt_arg_bval))
|
|
792 {
|
|
793 Extbyte *value_ext;
|
665
|
794 Bytecount value_ext_len;
|
428
|
795 CHECK_STRING (value);
|
440
|
796 TO_EXTERNAL_FORMAT (LISP_STRING, value,
|
|
797 ALLOCA, (value_ext, value_ext_len),
|
|
798 Qnative);
|
444
|
799 tt_message_arg_bval_set (m, n, (unsigned char *) value_ext, value_ext_len);
|
428
|
800 }
|
|
801 else if (EQ (attribute, Qtt_arg_ival))
|
|
802 {
|
|
803 CHECK_INT (value);
|
|
804 tt_message_arg_ival_set (m, n, XINT (value));
|
|
805 }
|
|
806 else if (EQ (attribute, Qtt_arg_val))
|
|
807 {
|
442
|
808 const char *value_ext;
|
428
|
809 CHECK_STRING (value);
|
442
|
810 LISP_STRING_TO_EXTERNAL (value, value_ext, Qnative);
|
428
|
811 tt_message_arg_val_set (m, n, value_ext);
|
|
812 }
|
|
813 else if (EQ (attribute, Qtt_status))
|
|
814 {
|
|
815 CHECK_INT (value);
|
|
816 tt_message_status_set (m, XINT (value));
|
|
817 }
|
|
818 else if (EQ (attribute, Qtt_callback))
|
|
819 {
|
|
820 CHECK_SYMBOL (value);
|
|
821 XTOOLTALK_MESSAGE (message_)->callback = value;
|
|
822 }
|
|
823 else if (EQ (attribute, Qtt_prop))
|
|
824 {
|
|
825 return Fput (XTOOLTALK_MESSAGE (message_)->plist_sym, argn, value);
|
|
826 }
|
|
827 else
|
563
|
828 invalid_constant ("Invalid value for `set-tooltalk-message-attribute'",
|
428
|
829 attribute);
|
440
|
830
|
|
831 if (fun_str)
|
|
832 {
|
442
|
833 const char *value_ext;
|
440
|
834 CHECK_STRING (value);
|
442
|
835 LISP_STRING_TO_EXTERNAL (value, value_ext, Qnative);
|
440
|
836 (*fun_str) (m, value_ext);
|
|
837 }
|
|
838
|
428
|
839 return Qnil;
|
|
840 }
|
|
841
|
|
842 DEFUN ("return-tooltalk-message", Freturn_tooltalk_message, 1, 2, 0, /*
|
|
843 Send a reply to this message. The second argument can be
|
|
844 'reply, 'reject or 'fail; the default is 'reply. Before sending
|
|
845 a reply all message arguments whose mode is TT_INOUT or TT_OUT should
|
|
846 have been filled in - see set-tooltalk-message-attribute.
|
|
847 */
|
|
848 (message_, mode))
|
|
849 {
|
|
850 Tt_message m = unbox_tooltalk_message (message_);
|
|
851
|
|
852 if (NILP (mode))
|
|
853 mode = Qtt_reply;
|
|
854 else
|
|
855 CHECK_SYMBOL (mode);
|
|
856
|
|
857 if (!VALID_TOOLTALK_MESSAGEP (m))
|
|
858 return Qnil;
|
|
859 else if (EQ (mode, Qtt_reply))
|
|
860 tt_message_reply (m);
|
|
861 else if (EQ (mode, Qtt_reject))
|
|
862 tt_message_reject (m);
|
|
863 else if (EQ (mode, Qtt_fail))
|
|
864 tt_message_fail (m);
|
|
865
|
|
866 return Qnil;
|
|
867 }
|
|
868
|
|
869 DEFUN ("create-tooltalk-message", Fcreate_tooltalk_message, 0, 1, 0, /*
|
|
870 Create a new tooltalk message.
|
|
871 The messages session attribute is initialized to the default session.
|
|
872 Other attributes can be initialized with `set-tooltalk-message-attribute'.
|
|
873 `make-tooltalk-message' is the preferred to create and initialize a message.
|
|
874
|
|
875 Optional arg NO-CALLBACK says don't add a C-level callback at all.
|
|
876 Normally don't do that; just don't specify the Lisp callback when
|
|
877 calling `make-tooltalk-message'.
|
|
878 */
|
|
879 (no_callback))
|
|
880 {
|
|
881 Tt_message m = tt_message_create ();
|
|
882 Lisp_Object message_ = make_tooltalk_message (m);
|
|
883 if (NILP (no_callback))
|
|
884 {
|
|
885 tt_message_callback_add (m, tooltalk_message_callback);
|
|
886 }
|
|
887 tt_message_session_set (m, tt_default_session ());
|
|
888 tt_message_user_set (m, TOOLTALK_MESSAGE_KEY, LISP_TO_VOID (message_));
|
|
889 return message_;
|
|
890 }
|
|
891
|
|
892 DEFUN ("destroy-tooltalk-message", Fdestroy_tooltalk_message, 1, 1, 0, /*
|
|
893 Apply tt_message_destroy() to the message.
|
|
894 It's not necessary to destroy messages after they've been processed by
|
|
895 a message or pattern callback; the Lisp/Tooltalk callback machinery does
|
|
896 this for you.
|
|
897 */
|
|
898 (message_))
|
|
899 {
|
|
900 Tt_message m = unbox_tooltalk_message (message_);
|
|
901
|
|
902 if (VALID_TOOLTALK_MESSAGEP (m))
|
|
903 /* #### Should we call Fremhash() here? It seems that
|
|
904 a common paradigm is
|
|
905
|
|
906 (send-tooltalk-message)
|
|
907 (destroy-tooltalk-message)
|
|
908
|
|
909 which would imply that destroying a sent ToolTalk message
|
|
910 doesn't actually destroy it; when a response is sent back,
|
|
911 the callback for the message will still be called.
|
|
912
|
|
913 But then maybe not: Maybe it really does destroy it,
|
|
914 and the reason for that paradigm is that the author
|
|
915 of `send-tooltalk-message' didn't really know what he
|
|
916 was talking about when he said that it's a good idea
|
|
917 to call `destroy-tooltalk-message' after sending it. */
|
|
918 tt_message_destroy (m);
|
|
919
|
|
920 return Qnil;
|
|
921 }
|
|
922
|
|
923
|
|
924 DEFUN ("add-tooltalk-message-arg", Fadd_tooltalk_message_arg, 3, 4, 0, /*
|
|
925 Append one new argument to the message.
|
|
926 MODE must be one of TT_IN, TT_INOUT, or TT_OUT; VTYPE must be a string;
|
|
927 and VALUE can be a string or an integer. Tooltalk doesn't
|
|
928 define any semantics for VTYPE, so only the participants in the
|
|
929 protocol you're using need to agree what types mean (if anything).
|
|
930 Conventionally "string" is used for strings and "int" for 32 bit integers.
|
|
931 Arguments can initialized by providing a value or with
|
|
932 `set-tooltalk-message-attribute'. The latter is necessary if you
|
|
933 want to initialize the argument with a string that can contain
|
|
934 embedded nulls (use 'arg_bval).
|
|
935 */
|
|
936 (message_, mode, vtype, value))
|
|
937 {
|
|
938 Tt_message m = unbox_tooltalk_message (message_);
|
|
939 Tt_mode n;
|
|
940
|
|
941 CHECK_STRING (vtype);
|
|
942 CHECK_TOOLTALK_CONSTANT (mode);
|
|
943
|
|
944 n = (Tt_mode) tooltalk_constant_value (mode);
|
|
945
|
|
946 if (!VALID_TOOLTALK_MESSAGEP (m))
|
|
947 return Qnil;
|
|
948 {
|
442
|
949 const char *vtype_ext;
|
428
|
950
|
442
|
951 LISP_STRING_TO_EXTERNAL (vtype, vtype_ext, Qnative);
|
428
|
952 if (NILP (value))
|
|
953 tt_message_arg_add (m, n, vtype_ext, NULL);
|
|
954 else if (STRINGP (value))
|
|
955 {
|
442
|
956 const char *value_ext;
|
|
957 LISP_STRING_TO_EXTERNAL (value, value_ext, Qnative);
|
428
|
958 tt_message_arg_add (m, n, vtype_ext, value_ext);
|
|
959 }
|
|
960 else if (INTP (value))
|
|
961 tt_message_iarg_add (m, n, vtype_ext, XINT (value));
|
|
962 }
|
|
963
|
|
964 return Qnil;
|
|
965 }
|
|
966
|
|
967 DEFUN ("send-tooltalk-message", Fsend_tooltalk_message, 1, 1, 0, /*
|
|
968 Send the message on its way.
|
|
969 Once the message has been sent it's almost always a good idea to get rid of
|
|
970 it with `destroy-tooltalk-message'.
|
|
971 */
|
|
972 (message_))
|
|
973 {
|
|
974 Tt_message m = unbox_tooltalk_message (message_);
|
|
975
|
|
976 if (VALID_TOOLTALK_MESSAGEP (m))
|
|
977 {
|
|
978 tt_message_send (m);
|
|
979 Fputhash (message_, Qnil, Vtooltalk_message_gcpro);
|
|
980 }
|
|
981
|
|
982 return Qnil;
|
|
983 }
|
|
984
|
|
985 DEFUN ("create-tooltalk-pattern", Fcreate_tooltalk_pattern, 0, 0, 0, /*
|
|
986 Create a new Tooltalk pattern.
|
|
987 Its session attribute is initialized to be the default session.
|
|
988 */
|
|
989 ())
|
|
990 {
|
|
991 Tt_pattern p = tt_pattern_create ();
|
|
992 Lisp_Object pattern = make_tooltalk_pattern (p);
|
|
993
|
|
994 tt_pattern_callback_add (p, tooltalk_pattern_callback);
|
|
995 tt_pattern_session_add (p, tt_default_session ());
|
|
996 tt_pattern_user_set (p, TOOLTALK_PATTERN_KEY, LISP_TO_VOID (pattern));
|
|
997
|
|
998 return pattern;
|
|
999 }
|
|
1000
|
|
1001
|
|
1002 DEFUN ("destroy-tooltalk-pattern", Fdestroy_tooltalk_pattern, 1, 1, 0, /*
|
|
1003 Apply tt_pattern_destroy() to the pattern.
|
|
1004 This effectively unregisters the pattern.
|
|
1005 */
|
|
1006 (pattern))
|
|
1007 {
|
|
1008 Tt_pattern p = unbox_tooltalk_pattern (pattern);
|
|
1009
|
|
1010 if (VALID_TOOLTALK_PATTERNP (p))
|
|
1011 {
|
|
1012 tt_pattern_destroy (p);
|
|
1013 Fremhash (pattern, Vtooltalk_pattern_gcpro);
|
|
1014 }
|
|
1015
|
|
1016 return Qnil;
|
|
1017 }
|
|
1018
|
|
1019
|
|
1020 DEFUN ("add-tooltalk-pattern-attribute", Fadd_tooltalk_pattern_attribute, 3, 3, 0, /*
|
|
1021 Add one value to the indicated pattern attribute.
|
|
1022 All Tooltalk pattern attributes are supported except 'user. The names
|
|
1023 of attributes are the same as the Tooltalk accessors used to set them
|
|
1024 less the "tooltalk_pattern_" prefix and the "_add" ...
|
|
1025 */
|
|
1026 (value, pattern, attribute))
|
|
1027 {
|
|
1028 Tt_pattern p = unbox_tooltalk_pattern (pattern);
|
|
1029
|
|
1030 CHECK_SYMBOL (attribute);
|
|
1031
|
|
1032 if (!VALID_TOOLTALK_PATTERNP (p))
|
|
1033 return Qnil;
|
|
1034
|
|
1035 else if (EQ (attribute, Qtt_category))
|
|
1036 {
|
|
1037 CHECK_TOOLTALK_CONSTANT (value);
|
|
1038 tt_pattern_category_set (p, ((Tt_category)
|
|
1039 tooltalk_constant_value (value)));
|
|
1040 }
|
|
1041 else if (EQ (attribute, Qtt_address))
|
|
1042 {
|
|
1043 CHECK_TOOLTALK_CONSTANT (value);
|
|
1044 tt_pattern_address_add (p, ((Tt_address)
|
|
1045 tooltalk_constant_value (value)));
|
|
1046 }
|
|
1047 else if (EQ (attribute, Qtt_class))
|
|
1048 {
|
|
1049 CHECK_TOOLTALK_CONSTANT (value);
|
|
1050 tt_pattern_class_add (p, (Tt_class) tooltalk_constant_value (value));
|
|
1051 }
|
|
1052 else if (EQ (attribute, Qtt_disposition))
|
|
1053 {
|
|
1054 CHECK_TOOLTALK_CONSTANT (value);
|
|
1055 tt_pattern_disposition_add (p, ((Tt_disposition)
|
|
1056 tooltalk_constant_value (value)));
|
|
1057 }
|
|
1058 else if (EQ (attribute, Qtt_file))
|
|
1059 {
|
442
|
1060 const char *value_ext;
|
428
|
1061 CHECK_STRING (value);
|
442
|
1062 LISP_STRING_TO_EXTERNAL (value, value_ext, Qnative);
|
428
|
1063 tt_pattern_file_add (p, value_ext);
|
|
1064 }
|
|
1065 else if (EQ (attribute, Qtt_object))
|
|
1066 {
|
442
|
1067 const char *value_ext;
|
428
|
1068 CHECK_STRING (value);
|
442
|
1069 LISP_STRING_TO_EXTERNAL (value, value_ext, Qnative);
|
428
|
1070 tt_pattern_object_add (p, value_ext);
|
|
1071 }
|
|
1072 else if (EQ (attribute, Qtt_op))
|
|
1073 {
|
442
|
1074 const char *value_ext;
|
428
|
1075 CHECK_STRING (value);
|
442
|
1076 LISP_STRING_TO_EXTERNAL (value, value_ext, Qnative);
|
428
|
1077 tt_pattern_op_add (p, value_ext);
|
|
1078 }
|
|
1079 else if (EQ (attribute, Qtt_otype))
|
|
1080 {
|
442
|
1081 const char *value_ext;
|
428
|
1082 CHECK_STRING (value);
|
442
|
1083 LISP_STRING_TO_EXTERNAL (value, value_ext, Qnative);
|
428
|
1084 tt_pattern_otype_add (p, value_ext);
|
|
1085 }
|
|
1086 else if (EQ (attribute, Qtt_scope))
|
|
1087 {
|
|
1088 CHECK_TOOLTALK_CONSTANT (value);
|
|
1089 tt_pattern_scope_add (p, (Tt_scope) tooltalk_constant_value (value));
|
|
1090 }
|
|
1091 else if (EQ (attribute, Qtt_sender))
|
|
1092 {
|
442
|
1093 const char *value_ext;
|
428
|
1094 CHECK_STRING (value);
|
442
|
1095 LISP_STRING_TO_EXTERNAL (value, value_ext, Qnative);
|
428
|
1096 tt_pattern_sender_add (p, value_ext);
|
|
1097 }
|
|
1098 else if (EQ (attribute, Qtt_sender_ptype))
|
|
1099 {
|
442
|
1100 const char *value_ext;
|
428
|
1101 CHECK_STRING (value);
|
442
|
1102 LISP_STRING_TO_EXTERNAL (value, value_ext, Qnative);
|
428
|
1103 tt_pattern_sender_ptype_add (p, value_ext);
|
|
1104 }
|
|
1105 else if (EQ (attribute, Qtt_session))
|
|
1106 {
|
442
|
1107 const char *value_ext;
|
428
|
1108 CHECK_STRING (value);
|
442
|
1109 LISP_STRING_TO_EXTERNAL (value, value_ext, Qnative);
|
428
|
1110 tt_pattern_session_add (p, value_ext);
|
|
1111 }
|
|
1112 else if (EQ (attribute, Qtt_state))
|
|
1113 {
|
|
1114 CHECK_TOOLTALK_CONSTANT (value);
|
|
1115 tt_pattern_state_add (p, (Tt_state) tooltalk_constant_value (value));
|
|
1116 }
|
|
1117 else if (EQ (attribute, Qtt_callback))
|
|
1118 {
|
|
1119 CHECK_SYMBOL (value);
|
|
1120 XTOOLTALK_PATTERN (pattern)->callback = value;
|
|
1121 }
|
|
1122
|
|
1123 return Qnil;
|
|
1124 }
|
|
1125
|
|
1126
|
|
1127 DEFUN ("add-tooltalk-pattern-arg", Fadd_tooltalk_pattern_arg, 3, 4, 0, /*
|
|
1128 Add one fully specified argument to a tooltalk pattern.
|
|
1129 Mode must be one of TT_IN, TT_INOUT, or TT_OUT, type must be a string.
|
|
1130 Value can be an integer, string or nil. If value is an integer then
|
|
1131 an integer argument (tt_pattern_iarg_add) added otherwise a string argument
|
|
1132 is added. At present there's no way to add a binary data argument.
|
|
1133 */
|
|
1134 (pattern, mode, vtype, value))
|
|
1135 {
|
|
1136 Tt_pattern p = unbox_tooltalk_pattern (pattern);
|
|
1137 Tt_mode n;
|
|
1138
|
|
1139 CHECK_STRING (vtype);
|
|
1140 CHECK_TOOLTALK_CONSTANT (mode);
|
|
1141
|
|
1142 n = (Tt_mode) tooltalk_constant_value (mode);
|
|
1143
|
|
1144 if (!VALID_TOOLTALK_PATTERNP (p))
|
|
1145 return Qnil;
|
|
1146
|
|
1147 {
|
442
|
1148 const char *vtype_ext;
|
428
|
1149
|
442
|
1150 LISP_STRING_TO_EXTERNAL (vtype, vtype_ext, Qnative);
|
428
|
1151 if (NILP (value))
|
|
1152 tt_pattern_arg_add (p, n, vtype_ext, NULL);
|
|
1153 else if (STRINGP (value))
|
|
1154 {
|
442
|
1155 const char *value_ext;
|
|
1156 LISP_STRING_TO_EXTERNAL (value, value_ext, Qnative);
|
428
|
1157 tt_pattern_arg_add (p, n, vtype_ext, value_ext);
|
|
1158 }
|
|
1159 else if (INTP (value))
|
|
1160 tt_pattern_iarg_add (p, n, vtype_ext, XINT (value));
|
|
1161 }
|
|
1162
|
|
1163 return Qnil;
|
|
1164 }
|
|
1165
|
|
1166
|
|
1167 DEFUN ("register-tooltalk-pattern", Fregister_tooltalk_pattern, 1, 1, 0, /*
|
|
1168 Emacs will begin receiving messages that match this pattern.
|
|
1169 */
|
|
1170 (pattern))
|
|
1171 {
|
|
1172 Tt_pattern p = unbox_tooltalk_pattern (pattern);
|
|
1173
|
|
1174 if (VALID_TOOLTALK_PATTERNP (p) && tt_pattern_register (p) == TT_OK)
|
|
1175 {
|
|
1176 Fputhash (pattern, Qnil, Vtooltalk_pattern_gcpro);
|
|
1177 return Qt;
|
|
1178 }
|
|
1179 else
|
|
1180 return Qnil;
|
|
1181 }
|
|
1182
|
|
1183
|
|
1184 DEFUN ("unregister-tooltalk-pattern", Funregister_tooltalk_pattern, 1, 1, 0, /*
|
|
1185 Emacs will stop receiving messages that match this pattern.
|
|
1186 */
|
|
1187 (pattern))
|
|
1188 {
|
|
1189 Tt_pattern p = unbox_tooltalk_pattern (pattern);
|
|
1190
|
|
1191 if (VALID_TOOLTALK_PATTERNP (p))
|
|
1192 {
|
|
1193 tt_pattern_unregister (p);
|
|
1194 Fremhash (pattern, Vtooltalk_pattern_gcpro);
|
|
1195 }
|
|
1196
|
|
1197 return Qnil;
|
|
1198 }
|
|
1199
|
|
1200
|
|
1201 DEFUN ("tooltalk-pattern-prop-get", Ftooltalk_pattern_prop_get, 2, 2, 0, /*
|
|
1202 Return the value of PROPERTY in tooltalk pattern PATTERN.
|
|
1203 This is the last value set with `tooltalk-pattern-prop-set'.
|
|
1204 */
|
|
1205 (pattern, property))
|
|
1206 {
|
|
1207 CHECK_TOOLTALK_PATTERN (pattern);
|
|
1208 return Fget (XTOOLTALK_PATTERN (pattern)->plist_sym, property, Qnil);
|
|
1209 }
|
|
1210
|
|
1211
|
|
1212 DEFUN ("tooltalk-pattern-prop-set", Ftooltalk_pattern_prop_set, 3, 3, 0, /*
|
|
1213 Set the value of PROPERTY to VALUE in tooltalk pattern PATTERN.
|
|
1214 It can be retrieved with `tooltalk-pattern-prop-get'.
|
|
1215 */
|
|
1216 (pattern, property, value))
|
|
1217 {
|
|
1218 CHECK_TOOLTALK_PATTERN (pattern);
|
|
1219 return Fput (XTOOLTALK_PATTERN (pattern)->plist_sym, property, value);
|
|
1220 }
|
|
1221
|
|
1222
|
|
1223 DEFUN ("tooltalk-pattern-plist-get", Ftooltalk_pattern_plist_get, 1, 1, 0, /*
|
|
1224 Return the a list of all the properties currently set in PATTERN.
|
|
1225 */
|
|
1226 (pattern))
|
|
1227 {
|
|
1228 CHECK_TOOLTALK_PATTERN (pattern);
|
|
1229 return
|
|
1230 Fcopy_sequence (Fsymbol_plist (XTOOLTALK_PATTERN (pattern)->plist_sym));
|
|
1231 }
|
|
1232
|
|
1233 DEFUN ("tooltalk-default-procid", Ftooltalk_default_procid, 0, 0, 0, /*
|
|
1234 Return current default process identifier for your process.
|
|
1235 */
|
|
1236 ())
|
|
1237 {
|
|
1238 char *procid = tt_default_procid ();
|
|
1239 return procid ? build_string (procid) : Qnil;
|
|
1240 }
|
|
1241
|
|
1242 DEFUN ("tooltalk-default-session", Ftooltalk_default_session, 0, 0, 0, /*
|
|
1243 Return current default session identifier for the current default procid.
|
|
1244 */
|
|
1245 ())
|
|
1246 {
|
|
1247 char *session = tt_default_session ();
|
|
1248 return session ? build_string (session) : Qnil;
|
|
1249 }
|
|
1250
|
|
1251 static void
|
|
1252 init_tooltalk (void)
|
|
1253 {
|
|
1254 /* This function can GC */
|
|
1255 char *retval;
|
|
1256 Lisp_Object lp;
|
|
1257 Lisp_Object fil;
|
|
1258
|
|
1259
|
440
|
1260 /* tt_open() messes with our signal handler flags (at least when no
|
|
1261 ttsessions is running on the machine), therefore we save the
|
428
|
1262 actions and restore them after the call */
|
|
1263 #ifdef HAVE_SIGPROCMASK
|
|
1264 {
|
|
1265 struct sigaction ActSIGQUIT;
|
|
1266 struct sigaction ActSIGINT;
|
|
1267 struct sigaction ActSIGCHLD;
|
|
1268 sigaction (SIGQUIT, NULL, &ActSIGQUIT);
|
|
1269 sigaction (SIGINT, NULL, &ActSIGINT);
|
|
1270 sigaction (SIGCHLD, NULL, &ActSIGCHLD);
|
|
1271 #endif
|
|
1272 retval = tt_open ();
|
|
1273 #ifdef HAVE_SIGPROCMASK
|
|
1274 sigaction (SIGQUIT, &ActSIGQUIT, NULL);
|
|
1275 sigaction (SIGINT, &ActSIGINT, NULL);
|
|
1276 sigaction (SIGCHLD, &ActSIGCHLD, NULL);
|
|
1277 }
|
|
1278 #endif
|
|
1279
|
|
1280
|
|
1281 if (tt_ptr_error (retval) != TT_OK)
|
|
1282 return;
|
|
1283
|
|
1284 Vtooltalk_fd = make_int (tt_fd ());
|
|
1285
|
|
1286 tt_session_join (tt_default_session ());
|
|
1287
|
|
1288 lp = connect_to_file_descriptor (build_string ("tooltalk"), Qnil,
|
|
1289 Vtooltalk_fd, Vtooltalk_fd);
|
|
1290 if (!NILP (lp))
|
|
1291 {
|
|
1292 /* Don't ask the user for confirmation when exiting Emacs */
|
|
1293 Fprocess_kill_without_query (lp, Qnil);
|
793
|
1294 fil = wrap_subr (&SFreceive_tooltalk_message);
|
853
|
1295 set_process_filter (lp, fil, 1, 0);
|
428
|
1296 }
|
|
1297 else
|
|
1298 {
|
|
1299 tt_close ();
|
|
1300 Vtooltalk_fd = Qnil;
|
|
1301 return;
|
|
1302 }
|
|
1303
|
|
1304 #if defined (SOLARIS2)
|
|
1305 /* Apparently the tt_message_send_on_exit() function does not exist
|
|
1306 under SunOS 4.x or IRIX 5 or various other non-Solaris-2 systems.
|
|
1307 No big deal if we don't do the following under those systems. */
|
|
1308 {
|
|
1309 Tt_message exit_msg = tt_message_create ();
|
|
1310
|
|
1311 tt_message_op_set (exit_msg, "emacs-aborted");
|
|
1312 tt_message_scope_set (exit_msg, TT_SESSION);
|
|
1313 tt_message_class_set (exit_msg, TT_NOTICE);
|
|
1314 tt_message_send_on_exit (exit_msg);
|
|
1315 tt_message_destroy (exit_msg);
|
|
1316 }
|
|
1317 #endif
|
|
1318 }
|
|
1319
|
|
1320 DEFUN ("tooltalk-open-connection", Ftooltalk_open_connection, 0, 0, 0, /*
|
|
1321 Opens a connection to the ToolTalk server.
|
|
1322 Returns t if successful, nil otherwise.
|
|
1323 */
|
|
1324 ())
|
|
1325 {
|
|
1326 if (!NILP (Vtooltalk_fd))
|
563
|
1327 signal_error (Qio_error, "Already connected to ToolTalk", Qunbound);
|
428
|
1328 if (noninteractive)
|
563
|
1329 signal_error (Qio_error, "Can't connect to ToolTalk in batch mode", Qunbound);
|
428
|
1330 init_tooltalk ();
|
|
1331 return NILP (Vtooltalk_fd) ? Qnil : Qt;
|
|
1332 }
|
|
1333
|
|
1334
|
|
1335 void
|
|
1336 syms_of_tooltalk (void)
|
|
1337 {
|
442
|
1338 INIT_LRECORD_IMPLEMENTATION (tooltalk_message);
|
|
1339 INIT_LRECORD_IMPLEMENTATION (tooltalk_pattern);
|
|
1340
|
563
|
1341 DEFSYMBOL_MULTIWORD_PREDICATE (Qtooltalk_messagep);
|
428
|
1342 DEFSUBR (Ftooltalk_message_p);
|
563
|
1343 DEFSYMBOL_MULTIWORD_PREDICATE (Qtooltalk_patternp);
|
428
|
1344 DEFSUBR (Ftooltalk_pattern_p);
|
563
|
1345 DEFSYMBOL (Qtooltalk_message_handler_hook);
|
|
1346 DEFSYMBOL (Qtooltalk_pattern_handler_hook);
|
|
1347 DEFSYMBOL (Qtooltalk_unprocessed_message_hook);
|
428
|
1348
|
|
1349 DEFSUBR (Freceive_tooltalk_message);
|
|
1350 DEFSUBR (Fcreate_tooltalk_message);
|
|
1351 DEFSUBR (Fdestroy_tooltalk_message);
|
|
1352 DEFSUBR (Fadd_tooltalk_message_arg);
|
|
1353 DEFSUBR (Fget_tooltalk_message_attribute);
|
|
1354 DEFSUBR (Fset_tooltalk_message_attribute);
|
|
1355 DEFSUBR (Fsend_tooltalk_message);
|
|
1356 DEFSUBR (Freturn_tooltalk_message);
|
|
1357 DEFSUBR (Fcreate_tooltalk_pattern);
|
|
1358 DEFSUBR (Fdestroy_tooltalk_pattern);
|
|
1359 DEFSUBR (Fadd_tooltalk_pattern_attribute);
|
|
1360 DEFSUBR (Fadd_tooltalk_pattern_arg);
|
|
1361 DEFSUBR (Fregister_tooltalk_pattern);
|
|
1362 DEFSUBR (Funregister_tooltalk_pattern);
|
|
1363 DEFSUBR (Ftooltalk_pattern_plist_get);
|
|
1364 DEFSUBR (Ftooltalk_pattern_prop_set);
|
|
1365 DEFSUBR (Ftooltalk_pattern_prop_get);
|
|
1366 DEFSUBR (Ftooltalk_default_procid);
|
|
1367 DEFSUBR (Ftooltalk_default_session);
|
|
1368 DEFSUBR (Ftooltalk_open_connection);
|
|
1369
|
563
|
1370 DEFSYMBOL (Qreceive_tooltalk_message);
|
428
|
1371 defsymbol (&Qtt_address, "address");
|
|
1372 defsymbol (&Qtt_args_count, "args_count");
|
|
1373 defsymbol (&Qtt_arg_bval, "arg_bval");
|
|
1374 defsymbol (&Qtt_arg_ival, "arg_ival");
|
|
1375 defsymbol (&Qtt_arg_mode, "arg_mode");
|
|
1376 defsymbol (&Qtt_arg_type, "arg_type");
|
|
1377 defsymbol (&Qtt_arg_val, "arg_val");
|
|
1378 defsymbol (&Qtt_class, "class");
|
|
1379 defsymbol (&Qtt_category, "category");
|
|
1380 defsymbol (&Qtt_disposition, "disposition");
|
|
1381 defsymbol (&Qtt_file, "file");
|
|
1382 defsymbol (&Qtt_gid, "gid");
|
|
1383 defsymbol (&Qtt_handler, "handler");
|
|
1384 defsymbol (&Qtt_handler_ptype, "handler_ptype");
|
|
1385 defsymbol (&Qtt_object, "object");
|
|
1386 defsymbol (&Qtt_op, "op");
|
|
1387 defsymbol (&Qtt_opnum, "opnum");
|
|
1388 defsymbol (&Qtt_otype, "otype");
|
|
1389 defsymbol (&Qtt_scope, "scope");
|
|
1390 defsymbol (&Qtt_sender, "sender");
|
|
1391 defsymbol (&Qtt_sender_ptype, "sender_ptype");
|
|
1392 defsymbol (&Qtt_session, "session");
|
|
1393 defsymbol (&Qtt_state, "state");
|
|
1394 defsymbol (&Qtt_status, "status");
|
|
1395 defsymbol (&Qtt_status_string, "status_string");
|
|
1396 defsymbol (&Qtt_uid, "uid");
|
|
1397 defsymbol (&Qtt_callback, "callback");
|
|
1398 defsymbol (&Qtt_prop, "prop");
|
|
1399 defsymbol (&Qtt_plist, "plist");
|
|
1400 defsymbol (&Qtt_reject, "reject");
|
|
1401 defsymbol (&Qtt_reply, "reply");
|
|
1402 defsymbol (&Qtt_fail, "fail");
|
|
1403
|
442
|
1404 DEFERROR (Qtooltalk_error, "ToolTalk error", Qio_error);
|
428
|
1405 }
|
|
1406
|
|
1407 void
|
|
1408 vars_of_tooltalk (void)
|
|
1409 {
|
|
1410 Fprovide (intern ("tooltalk"));
|
|
1411
|
|
1412 DEFVAR_LISP ("tooltalk-fd", &Vtooltalk_fd /*
|
|
1413 File descriptor returned by tt_initialize; nil if not connected to ToolTalk.
|
|
1414 */ );
|
|
1415 Vtooltalk_fd = Qnil;
|
|
1416
|
|
1417 DEFVAR_LISP ("tooltalk-message-handler-hook",
|
|
1418 &Vtooltalk_message_handler_hook /*
|
|
1419 List of functions to be applied to each ToolTalk message reply received.
|
|
1420 This will always occur as a result of our sending a request message.
|
|
1421 Functions will be called with two arguments, the message and the
|
|
1422 corresponding pattern. This hook will not be called if the request
|
|
1423 message was created without a C-level callback function (see
|
|
1424 `tooltalk-unprocessed-message-hook').
|
|
1425 */ );
|
|
1426 Vtooltalk_message_handler_hook = Qnil;
|
|
1427
|
|
1428 DEFVAR_LISP ("tooltalk-pattern-handler-hook",
|
|
1429 &Vtooltalk_pattern_handler_hook /*
|
|
1430 List of functions to be applied to each pattern-matching ToolTalk message.
|
|
1431 This is all messages except those handled by `tooltalk-message-handler-hook'.
|
|
1432 Functions will be called with two arguments, the message and the
|
|
1433 corresponding pattern.
|
|
1434 */ );
|
|
1435 Vtooltalk_pattern_handler_hook = Qnil;
|
|
1436
|
|
1437 DEFVAR_LISP ("tooltalk-unprocessed-message-hook",
|
|
1438 &Vtooltalk_unprocessed_message_hook /*
|
|
1439 List of functions to be applied to each unprocessed ToolTalk message.
|
|
1440 Unprocessed messages are messages that didn't match any patterns.
|
|
1441 */ );
|
|
1442 Vtooltalk_unprocessed_message_hook = Qnil;
|
|
1443
|
771
|
1444 Tooltalk_Message_plist_str = build_msg_string ("Tooltalk Message plist");
|
|
1445 Tooltalk_Pattern_plist_str = build_msg_string ("Tooltalk Pattern plist");
|
428
|
1446
|
|
1447 staticpro(&Tooltalk_Message_plist_str);
|
|
1448 staticpro(&Tooltalk_Pattern_plist_str);
|
|
1449
|
|
1450 #define MAKE_CONSTANT(name) do { \
|
|
1451 defsymbol (&Q_ ## name, #name); \
|
|
1452 Fset (Q_ ## name, make_int (name)); \
|
|
1453 } while (0)
|
|
1454
|
|
1455 MAKE_CONSTANT (TT_MODE_UNDEFINED);
|
|
1456 MAKE_CONSTANT (TT_IN);
|
|
1457 MAKE_CONSTANT (TT_OUT);
|
|
1458 MAKE_CONSTANT (TT_INOUT);
|
|
1459 MAKE_CONSTANT (TT_MODE_LAST);
|
|
1460
|
|
1461 MAKE_CONSTANT (TT_SCOPE_NONE);
|
|
1462 MAKE_CONSTANT (TT_SESSION);
|
|
1463 MAKE_CONSTANT (TT_FILE);
|
|
1464 MAKE_CONSTANT (TT_BOTH);
|
|
1465 MAKE_CONSTANT (TT_FILE_IN_SESSION);
|
|
1466
|
|
1467 MAKE_CONSTANT (TT_CLASS_UNDEFINED);
|
|
1468 MAKE_CONSTANT (TT_NOTICE);
|
|
1469 MAKE_CONSTANT (TT_REQUEST);
|
|
1470 MAKE_CONSTANT (TT_CLASS_LAST);
|
|
1471
|
|
1472 MAKE_CONSTANT (TT_CATEGORY_UNDEFINED);
|
|
1473 MAKE_CONSTANT (TT_OBSERVE);
|
|
1474 MAKE_CONSTANT (TT_HANDLE);
|
|
1475 MAKE_CONSTANT (TT_CATEGORY_LAST);
|
|
1476
|
|
1477 MAKE_CONSTANT (TT_PROCEDURE);
|
|
1478 MAKE_CONSTANT (TT_OBJECT);
|
|
1479 MAKE_CONSTANT (TT_HANDLER);
|
|
1480 MAKE_CONSTANT (TT_OTYPE);
|
|
1481 MAKE_CONSTANT (TT_ADDRESS_LAST);
|
|
1482
|
|
1483 MAKE_CONSTANT (TT_CREATED);
|
|
1484 MAKE_CONSTANT (TT_SENT);
|
|
1485 MAKE_CONSTANT (TT_HANDLED);
|
|
1486 MAKE_CONSTANT (TT_FAILED);
|
|
1487 MAKE_CONSTANT (TT_QUEUED);
|
|
1488 MAKE_CONSTANT (TT_STARTED);
|
|
1489 MAKE_CONSTANT (TT_REJECTED);
|
|
1490 MAKE_CONSTANT (TT_STATE_LAST);
|
|
1491
|
|
1492 MAKE_CONSTANT (TT_DISCARD);
|
|
1493 MAKE_CONSTANT (TT_QUEUE);
|
|
1494 MAKE_CONSTANT (TT_START);
|
|
1495
|
|
1496 #undef MAKE_CONSTANT
|
|
1497
|
|
1498 staticpro (&Vtooltalk_message_gcpro);
|
|
1499 staticpro (&Vtooltalk_pattern_gcpro);
|
|
1500 Vtooltalk_message_gcpro =
|
|
1501 make_lisp_hash_table (10, HASH_TABLE_NON_WEAK, HASH_TABLE_EQ);
|
|
1502 Vtooltalk_pattern_gcpro =
|
|
1503 make_lisp_hash_table (10, HASH_TABLE_NON_WEAK, HASH_TABLE_EQ);
|
|
1504 }
|