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