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