comparison src/tooltalk.c @ 20:859a2309aef8 r19-15b93

Import from CVS: tag r19-15b93
author cvs
date Mon, 13 Aug 2007 08:50:05 +0200
parents 0293115a14e9
children e04119814345
comparison
equal deleted inserted replaced
19:ac1f612d5250 20:859a2309aef8
201 { 201 {
202 CHECK_TOOLTALK_MESSAGE (msg); 202 CHECK_TOOLTALK_MESSAGE (msg);
203 return XTOOLTALK_MESSAGE (msg)->m; 203 return XTOOLTALK_MESSAGE (msg)->m;
204 } 204 }
205 205
206 DEFUN ("tooltalk-message-p", Ftooltalk_message_p, Stooltalk_message_p, 1, 1, 0 /* 206 DEFUN ("tooltalk-message-p", Ftooltalk_message_p, 1, 1, 0, /*
207 Return non-nil if OBJECT is a tooltalk message. 207 Return non-nil if OBJECT is a tooltalk message.
208 */ ) 208 */
209 (object) 209 (object))
210 Lisp_Object object;
211 { 210 {
212 return (TOOLTALK_MESSAGEP (object) ? Qt : Qnil); 211 return (TOOLTALK_MESSAGEP (object) ? Qt : Qnil);
213 } 212 }
214 213
215 214
279 { 278 {
280 CHECK_TOOLTALK_PATTERN (pattern); 279 CHECK_TOOLTALK_PATTERN (pattern);
281 return XTOOLTALK_PATTERN (pattern)->p; 280 return XTOOLTALK_PATTERN (pattern)->p;
282 } 281 }
283 282
284 DEFUN ("tooltalk-pattern-p", Ftooltalk_pattern_p, Stooltalk_pattern_p, 1, 1, 0 /* 283 DEFUN ("tooltalk-pattern-p", Ftooltalk_pattern_p, 1, 1, 0, /*
285 Return non-nil if OBJECT is a tooltalk pattern. 284 Return non-nil if OBJECT is a tooltalk pattern.
286 */ ) 285 */
287 (object) 286 (object))
288 Lisp_Object object;
289 { 287 {
290 return (TOOLTALK_PATTERNP (object) ? Qt : Qnil); 288 return (TOOLTALK_PATTERNP (object) ? Qt : Qnil);
291 } 289 }
292 290
293 291
310 if (tt_is_err (st)) 308 if (tt_is_err (st))
311 signal_error (Qtooltalk_error, 309 signal_error (Qtooltalk_error,
312 Fcons (build_string (tt_status_message (st)), Qnil)); 310 Fcons (build_string (tt_status_message (st)), Qnil));
313 } 311 }
314 312
315 DEFUN ("receive-tooltalk-message", 313 DEFUN ("receive-tooltalk-message", Freceive_tooltalk_message, 0, 2, 0, /*
316 Freceive_tooltalk_message,
317 Sreceive_tooltalk_message,
318 0, 2, 0 /*
319 Run tt_message_receive(). 314 Run tt_message_receive().
320 This function is the process handler for the ToolTalk connection process. 315 This function is the process handler for the ToolTalk connection process.
321 */ ) 316 */
322 (ignore1, ignore2) 317 (ignore1, ignore2))
323 Lisp_Object ignore1, ignore2; /* filters are called with two arguments. */
324 { 318 {
325 /* This function can GC */ 319 /* This function can GC */
326 Tt_message mess = tt_message_receive (); 320 Tt_message mess = tt_message_receive ();
327 Lisp_Object msg = make_tooltalk_message (mess); 321 Lisp_Object msg = make_tooltalk_message (mess);
328 struct gcpro gcpro1; 322 struct gcpro gcpro1;
547 check_status (tt_message_arg_bval (m, n, &value, &len)); 541 check_status (tt_message_arg_bval (m, n, &value, &len));
548 542
549 return make_string (value, len); 543 return make_string (value, len);
550 } 544 }
551 545
552 DEFUN ("get-tooltalk-message-attribute", 546 DEFUN ("get-tooltalk-message-attribute", Fget_tooltalk_message_attribute, 2, 3, 0, /*
553 Fget_tooltalk_message_attribute,
554 Sget_tooltalk_message_attribute,
555 2, 3, 0 /*
556 Return the indicated Tooltalk message attribute. Attributes are 547 Return the indicated Tooltalk message attribute. Attributes are
557 identified by symbols with the same name (underscores and all) as the 548 identified by symbols with the same name (underscores and all) as the
558 suffix of the Tooltalk tt_message_<attribute> function that extracts the value. 549 suffix of the Tooltalk tt_message_<attribute> function that extracts the value.
559 String attribute values are copied, enumerated type values (except disposition) 550 String attribute values are copied, enumerated type values (except disposition)
560 are converted to symbols - e.g. TT_HANDLER is 'TT_HANDLER, uid and gid are 551 are converted to symbols - e.g. TT_HANDLER is 'TT_HANDLER, uid and gid are
579 can be retrieved with the 'arg_type attribute; however, Tooltalk doesn't 570 can be retrieved with the 'arg_type attribute; however, Tooltalk doesn't
580 define any semantics for the string value of 'arg_type. Conventionally 571 define any semantics for the string value of 'arg_type. Conventionally
581 \"string\" is used for strings and \"int\" for 32 bit integers. Note that 572 \"string\" is used for strings and \"int\" for 32 bit integers. Note that
582 Emacs Lisp stores the lengths of strings explicitly (unlike C) so treating the 573 Emacs Lisp stores the lengths of strings explicitly (unlike C) so treating the
583 value returned by 'arg_bval like a string is fine. 574 value returned by 'arg_bval like a string is fine.
584 */ ) 575 */
585 (msg, attribute, argn) 576 (msg, attribute, argn))
586 Lisp_Object msg;
587 Lisp_Object attribute;
588 Lisp_Object argn;
589 { 577 {
590 Tt_message m = unbox_tooltalk_message (msg); 578 Tt_message m = unbox_tooltalk_message (msg);
591 int n = 0; 579 int n = 0;
592 580
593 CHECK_SYMBOL (attribute); 581 CHECK_SYMBOL (attribute);
694 attribute); 682 attribute);
695 683
696 return Qnil; 684 return Qnil;
697 } 685 }
698 686
699 DEFUN ("set-tooltalk-message-attribute", 687 DEFUN ("set-tooltalk-message-attribute",
700 Fset_tooltalk_message_attribute, 688 Fset_tooltalk_message_attribute, 3, 4, 0, /*
701 Sset_tooltalk_message_attribute,
702 3, 4, 0 /*
703 Initialize one Tooltalk message attribute. 689 Initialize one Tooltalk message attribute.
704 690
705 Attribute names and values are the same as for 691 Attribute names and values are the same as for
706 `get-tooltalk-message-attribute'. A property list is provided for user 692 `get-tooltalk-message-attribute'. A property list is provided for user
707 data (instead of the 'user message attribute); see 693 data (instead of the 'user message attribute); see
714 can be used. 700 can be used.
715 701
716 If one of the argument attributes is specified, 'arg_val, 'arg_ival, or 702 If one of the argument attributes is specified, 'arg_val, 'arg_ival, or
717 'arg_bval then argn must be the number of an already created argument. 703 'arg_bval then argn must be the number of an already created argument.
718 New arguments can be added to a message with add-tooltalk-message-arg. 704 New arguments can be added to a message with add-tooltalk-message-arg.
719 */ ) 705 */
720 (value, msg, attribute, argn) 706 (value, msg, attribute, argn))
721 Lisp_Object value;
722 Lisp_Object msg;
723 Lisp_Object attribute;
724 Lisp_Object argn;
725 { 707 {
726 Tt_message m = unbox_tooltalk_message (msg); 708 Tt_message m = unbox_tooltalk_message (msg);
727 int n = 0; 709 int n = 0;
728 710
729 CHECK_SYMBOL (attribute); 711 CHECK_SYMBOL (attribute);
859 signal_simple_error ("invalid value for `set-tooltalk-message-attribute'", 841 signal_simple_error ("invalid value for `set-tooltalk-message-attribute'",
860 attribute); 842 attribute);
861 return Qnil; 843 return Qnil;
862 } 844 }
863 845
864 DEFUN ("return-tooltalk-message", 846 DEFUN ("return-tooltalk-message", Freturn_tooltalk_message, 1, 2, 0, /*
865 Freturn_tooltalk_message,
866 Sreturn_tooltalk_message,
867 1, 2, 0 /*
868 Send a reply to this message. The second argument can be 847 Send a reply to this message. The second argument can be
869 'reply, 'reject or 'fail; the default is 'reply. Before sending 848 'reply, 'reject or 'fail; the default is 'reply. Before sending
870 a reply all message arguments whose mode is TT_INOUT or TT_OUT should 849 a reply all message arguments whose mode is TT_INOUT or TT_OUT should
871 have been filled in - see set-tooltalk-message-attribute. 850 have been filled in - see set-tooltalk-message-attribute.
872 */ ) 851 */
873 (msg, mode) 852 (msg, mode))
874 Lisp_Object msg, mode;
875 { 853 {
876 Tt_message m = unbox_tooltalk_message (msg); 854 Tt_message m = unbox_tooltalk_message (msg);
877 855
878 if (NILP (mode)) 856 if (NILP (mode))
879 mode = Qtt_reply; 857 mode = Qtt_reply;
890 tt_message_fail (m); 868 tt_message_fail (m);
891 869
892 return Qnil; 870 return Qnil;
893 } 871 }
894 872
895 DEFUN ("create-tooltalk-message", 873 DEFUN ("create-tooltalk-message", Fcreate_tooltalk_message, 0, 1, 0, /*
896 Fcreate_tooltalk_message,
897 Screate_tooltalk_message,
898 0, 1, 0 /*
899 Create a new tooltalk message. 874 Create a new tooltalk message.
900 The messages session attribute is initialized to the default session. 875 The messages session attribute is initialized to the default session.
901 Other attributes can be initialized with `set-tooltalk-message-attribute'. 876 Other attributes can be initialized with `set-tooltalk-message-attribute'.
902 `make-tooltalk-message' is the preferred to create and initialize a message. 877 `make-tooltalk-message' is the preferred to create and initialize a message.
903 878
904 Optional arg NO-CALLBACK says don't add a C-level callback at all. 879 Optional arg NO-CALLBACK says don't add a C-level callback at all.
905 Normally don't do that; just don't specify the Lisp callback when 880 Normally don't do that; just don't specify the Lisp callback when
906 calling `make-tooltalk-message'. 881 calling `make-tooltalk-message'.
907 */ ) 882 */
908 (no_callback) 883 (no_callback))
909 Lisp_Object no_callback;
910 { 884 {
911 Tt_message m = tt_message_create (); 885 Tt_message m = tt_message_create ();
912 Lisp_Object msg = make_tooltalk_message (m); 886 Lisp_Object msg = make_tooltalk_message (m);
913 if (NILP (no_callback)) 887 if (NILP (no_callback))
914 { 888 {
917 tt_message_session_set (m, tt_default_session ()); 891 tt_message_session_set (m, tt_default_session ());
918 tt_message_user_set (m, TOOLTALK_MESSAGE_KEY, LISP_TO_VOID (msg)); 892 tt_message_user_set (m, TOOLTALK_MESSAGE_KEY, LISP_TO_VOID (msg));
919 return msg; 893 return msg;
920 } 894 }
921 895
922 DEFUN ("destroy-tooltalk-message", 896 DEFUN ("destroy-tooltalk-message", Fdestroy_tooltalk_message, 1, 1, 0, /*
923 Fdestroy_tooltalk_message,
924 Sdestroy_tooltalk_message,
925 1, 1, 0 /*
926 Apply tt_message_destroy() to the message. 897 Apply tt_message_destroy() to the message.
927 It's not necessary to destroy messages after they've been processed by 898 It's not necessary to destroy messages after they've been processed by
928 a message or pattern callback; the Lisp/Tooltalk callback machinery does 899 a message or pattern callback; the Lisp/Tooltalk callback machinery does
929 this for you. 900 this for you.
930 */ ) 901 */
931 (msg) 902 (msg))
932 Lisp_Object msg;
933 { 903 {
934 Tt_message m = unbox_tooltalk_message (msg); 904 Tt_message m = unbox_tooltalk_message (msg);
935 905
936 if (VALID_TOOLTALK_MESSAGEP (m)) 906 if (VALID_TOOLTALK_MESSAGEP (m))
937 /* #### Should we call Fremhash() here? It seems that 907 /* #### Should we call Fremhash() here? It seems that
953 923
954 return Qnil; 924 return Qnil;
955 } 925 }
956 926
957 927
958 DEFUN ("add-tooltalk-message-arg", 928 DEFUN ("add-tooltalk-message-arg", Fadd_tooltalk_message_arg, 3, 4, 0, /*
959 Fadd_tooltalk_message_arg,
960 Sadd_tooltalk_message_arg,
961 3, 4, 0 /*
962 Append one new argument to the message. 929 Append one new argument to the message.
963 MODE must be one of TT_IN, TT_INOUT, or TT_OUT; VTYPE must be a string; 930 MODE must be one of TT_IN, TT_INOUT, or TT_OUT; VTYPE must be a string;
964 and VALUE can be a string or an integer. Tooltalk doesn't 931 and VALUE can be a string or an integer. Tooltalk doesn't
965 define any semantics for VTYPE, so only the participants in the 932 define any semantics for VTYPE, so only the participants in the
966 protocol you're using need to agree what types mean (if anything). 933 protocol you're using need to agree what types mean (if anything).
967 Conventionally \"string\" is used for strings and \"int\" for 32 bit integers. 934 Conventionally \"string\" is used for strings and \"int\" for 32 bit integers.
968 Arguments can initialized by providing a value or with 935 Arguments can initialized by providing a value or with
969 `set-tooltalk-message-attribute'. The latter is neccessary if you 936 `set-tooltalk-message-attribute'. The latter is neccessary if you
970 want to initialize the argument with a string that can contain 937 want to initialize the argument with a string that can contain
971 embedded nulls (use 'arg_bval). 938 embedded nulls (use 'arg_bval).
972 */ ) 939 */
973 (msg, mode, vtype, value) 940 (msg, mode, vtype, value))
974 Lisp_Object msg, mode, vtype, value;
975 { 941 {
976 Tt_message m = unbox_tooltalk_message (msg); 942 Tt_message m = unbox_tooltalk_message (msg);
977 Tt_mode n; 943 Tt_mode n;
978 944
979 CHECK_STRING (vtype); 945 CHECK_STRING (vtype);
1000 } 966 }
1001 967
1002 return Qnil; 968 return Qnil;
1003 } 969 }
1004 970
1005 DEFUN ("send-tooltalk-message", 971 DEFUN ("send-tooltalk-message", Fsend_tooltalk_message, 1, 1, 0, /*
1006 Fsend_tooltalk_message,
1007 Ssend_tooltalk_message,
1008 1, 1, 0 /*
1009 Send the message on its way. 972 Send the message on its way.
1010 Once the message has been sent it's almost always a good idea to get rid of 973 Once the message has been sent it's almost always a good idea to get rid of
1011 it with `destroy-tooltalk-message'. 974 it with `destroy-tooltalk-message'.
1012 */ ) 975 */
1013 (msg) 976 (msg))
1014 Lisp_Object msg;
1015 { 977 {
1016 Tt_message m = unbox_tooltalk_message (msg); 978 Tt_message m = unbox_tooltalk_message (msg);
1017 979
1018 if (VALID_TOOLTALK_MESSAGEP (m)) 980 if (VALID_TOOLTALK_MESSAGEP (m))
1019 { 981 {
1022 } 984 }
1023 985
1024 return Qnil; 986 return Qnil;
1025 } 987 }
1026 988
1027 DEFUN ("create-tooltalk-pattern", 989 DEFUN ("create-tooltalk-pattern", Fcreate_tooltalk_pattern, 0, 0, 0, /*
1028 Fcreate_tooltalk_pattern,
1029 Screate_tooltalk_pattern,
1030 0, 0, 0 /*
1031 Create a new Tooltalk pattern. 990 Create a new Tooltalk pattern.
1032 Its session attribute is initialized to be the default session. 991 Its session attribute is initialized to be the default session.
1033 */ ) 992 */
1034 () 993 ())
1035 { 994 {
1036 Tt_pattern p = tt_pattern_create (); 995 Tt_pattern p = tt_pattern_create ();
1037 Lisp_Object pattern = make_tooltalk_pattern (p); 996 Lisp_Object pattern = make_tooltalk_pattern (p);
1038 997
1039 tt_pattern_callback_add (p, tooltalk_pattern_callback); 998 tt_pattern_callback_add (p, tooltalk_pattern_callback);
1042 1001
1043 return pattern; 1002 return pattern;
1044 } 1003 }
1045 1004
1046 1005
1047 DEFUN ("destroy-tooltalk-pattern", 1006 DEFUN ("destroy-tooltalk-pattern", Fdestroy_tooltalk_pattern, 1, 1, 0, /*
1048 Fdestroy_tooltalk_pattern,
1049 Sdestroy_tooltalk_pattern,
1050 1, 1, 0 /*
1051 Apply tt_pattern_destroy() to the pattern. 1007 Apply tt_pattern_destroy() to the pattern.
1052 This effectively unregisters the pattern. 1008 This effectively unregisters the pattern.
1053 */ ) 1009 */
1054 (pattern) 1010 (pattern))
1055 Lisp_Object pattern;
1056 { 1011 {
1057 Tt_pattern p = unbox_tooltalk_pattern (pattern); 1012 Tt_pattern p = unbox_tooltalk_pattern (pattern);
1058 1013
1059 if (VALID_TOOLTALK_PATTERNP (p)) 1014 if (VALID_TOOLTALK_PATTERNP (p))
1060 { 1015 {
1064 1019
1065 return Qnil; 1020 return Qnil;
1066 } 1021 }
1067 1022
1068 1023
1069 DEFUN ("add-tooltalk-pattern-attribute", 1024 DEFUN ("add-tooltalk-pattern-attribute", Fadd_tooltalk_pattern_attribute, 3, 3, 0, /*
1070 Fadd_tooltalk_pattern_attribute,
1071 Sadd_tooltalk_pattern_attribute,
1072 3, 3, 0 /*
1073 Add one value to the indicated pattern attribute. 1025 Add one value to the indicated pattern attribute.
1074 All Tooltalk pattern attributes are supported except 'user. The names 1026 All Tooltalk pattern attributes are supported except 'user. The names
1075 of attributes are the same as the Tooltalk accessors used to set them 1027 of attributes are the same as the Tooltalk accessors used to set them
1076 less the \"tooltalk_pattern_\" prefix and the \"_add\" ... 1028 less the \"tooltalk_pattern_\" prefix and the \"_add\" ...
1077 */ ) 1029 */
1078 (value, pattern, attribute) 1030 (value, pattern, attribute))
1079 Lisp_Object value;
1080 Lisp_Object pattern;
1081 Lisp_Object attribute;
1082 { 1031 {
1083 Tt_pattern p = unbox_tooltalk_pattern (pattern); 1032 Tt_pattern p = unbox_tooltalk_pattern (pattern);
1084 1033
1085 CHECK_SYMBOL (attribute); 1034 CHECK_SYMBOL (attribute);
1086 1035
1174 1123
1175 return Qnil; 1124 return Qnil;
1176 } 1125 }
1177 1126
1178 1127
1179 DEFUN ("add-tooltalk-pattern-arg", 1128 DEFUN ("add-tooltalk-pattern-arg", Fadd_tooltalk_pattern_arg, 3, 4, 0, /*
1180 Fadd_tooltalk_pattern_arg,
1181 Sadd_tooltalk_pattern_arg,
1182 3, 4, 0 /*
1183 Add one fully specified argument to a tooltalk pattern. 1129 Add one fully specified argument to a tooltalk pattern.
1184 Mode must be one of TT_IN, TT_INOUT, or TT_OUT, type must be a string. 1130 Mode must be one of TT_IN, TT_INOUT, or TT_OUT, type must be a string.
1185 Value can be an integer, string or nil. If value is an integer then 1131 Value can be an integer, string or nil. If value is an integer then
1186 an integer argument (tt_pattern_iarg_add) added otherwise a string argument 1132 an integer argument (tt_pattern_iarg_add) added otherwise a string argument
1187 is added. At present there's no way to add a binary data argument. 1133 is added. At present there's no way to add a binary data argument.
1188 */ ) 1134 */
1189 (pattern, mode, vtype, value) 1135 (pattern, mode, vtype, value))
1190 Lisp_Object pattern, mode, vtype, value;
1191 { 1136 {
1192 Tt_pattern p = unbox_tooltalk_pattern (pattern); 1137 Tt_pattern p = unbox_tooltalk_pattern (pattern);
1193 Tt_mode n; 1138 Tt_mode n;
1194 1139
1195 CHECK_STRING (vtype); 1140 CHECK_STRING (vtype);
1218 1163
1219 return Qnil; 1164 return Qnil;
1220 } 1165 }
1221 1166
1222 1167
1223 DEFUN ("register-tooltalk-pattern", 1168 DEFUN ("register-tooltalk-pattern", Fregister_tooltalk_pattern, 1, 1, 0, /*
1224 Fregister_tooltalk_pattern,
1225 Sregister_tooltalk_pattern,
1226 1, 1, 0 /*
1227 Emacs will begin receiving messages that match this pattern. 1169 Emacs will begin receiving messages that match this pattern.
1228 */ ) 1170 */
1229 (pattern) 1171 (pattern))
1230 Lisp_Object pattern;
1231 { 1172 {
1232 Tt_pattern p = unbox_tooltalk_pattern (pattern); 1173 Tt_pattern p = unbox_tooltalk_pattern (pattern);
1233 1174
1234 if (VALID_TOOLTALK_PATTERNP (p) && tt_pattern_register (p) == TT_OK) 1175 if (VALID_TOOLTALK_PATTERNP (p) && tt_pattern_register (p) == TT_OK)
1235 { 1176 {
1239 else 1180 else
1240 return Qnil; 1181 return Qnil;
1241 } 1182 }
1242 1183
1243 1184
1244 DEFUN ("unregister-tooltalk-pattern", 1185 DEFUN ("unregister-tooltalk-pattern", Funregister_tooltalk_pattern, 1, 1, 0, /*
1245 Funregister_tooltalk_pattern,
1246 Sunregister_tooltalk_pattern,
1247 1, 1, 0 /*
1248 Emacs will stop receiving messages that match this pattern. 1186 Emacs will stop receiving messages that match this pattern.
1249 */ ) 1187 */
1250 (pattern) 1188 (pattern))
1251 Lisp_Object pattern;
1252 { 1189 {
1253 Tt_pattern p = unbox_tooltalk_pattern (pattern); 1190 Tt_pattern p = unbox_tooltalk_pattern (pattern);
1254 1191
1255 if (VALID_TOOLTALK_PATTERNP (p)) 1192 if (VALID_TOOLTALK_PATTERNP (p))
1256 { 1193 {
1260 1197
1261 return Qnil; 1198 return Qnil;
1262 } 1199 }
1263 1200
1264 1201
1265 DEFUN ("tooltalk-pattern-prop-get", 1202 DEFUN ("tooltalk-pattern-prop-get", Ftooltalk_pattern_prop_get, 2, 2, 0, /*
1266 Ftooltalk_pattern_prop_get,
1267 Stooltalk_pattern_prop_get,
1268 2, 2, 0 /*
1269 Return the value of PROPERTY in tooltalk pattern PATTERN. 1203 Return the value of PROPERTY in tooltalk pattern PATTERN.
1270 This is the last value set with `tooltalk-pattern-prop-set'. 1204 This is the last value set with `tooltalk-pattern-prop-set'.
1271 */ ) 1205 */
1272 (pattern, property) 1206 (pattern, property))
1273 Lisp_Object pattern, property;
1274 { 1207 {
1275 CHECK_TOOLTALK_PATTERN (pattern); 1208 CHECK_TOOLTALK_PATTERN (pattern);
1276 return Fget (XTOOLTALK_PATTERN (pattern)->plist_sym, property, Qnil); 1209 return Fget (XTOOLTALK_PATTERN (pattern)->plist_sym, property, Qnil);
1277 } 1210 }
1278 1211
1279 1212
1280 DEFUN ("tooltalk-pattern-prop-set", 1213 DEFUN ("tooltalk-pattern-prop-set", Ftooltalk_pattern_prop_set, 3, 3, 0, /*
1281 Ftooltalk_pattern_prop_set,
1282 Stooltalk_pattern_prop_set,
1283 3, 3, 0 /*
1284 Set the value of PROPERTY to VALUE in tooltalk pattern PATTERN. 1214 Set the value of PROPERTY to VALUE in tooltalk pattern PATTERN.
1285 It can be retrieved with `tooltalk-pattern-prop-get'. 1215 It can be retrieved with `tooltalk-pattern-prop-get'.
1286 */ ) 1216 */
1287 (pattern, property, value) 1217 (pattern, property, value))
1288 Lisp_Object pattern, property, value;
1289 { 1218 {
1290 CHECK_TOOLTALK_PATTERN (pattern); 1219 CHECK_TOOLTALK_PATTERN (pattern);
1291 return Fput (XTOOLTALK_PATTERN (pattern)->plist_sym, property, value); 1220 return Fput (XTOOLTALK_PATTERN (pattern)->plist_sym, property, value);
1292 } 1221 }
1293 1222
1294 1223
1295 DEFUN ("tooltalk-pattern-plist-get", 1224 DEFUN ("tooltalk-pattern-plist-get", Ftooltalk_pattern_plist_get, 1, 1, 0, /*
1296 Ftooltalk_pattern_plist_get,
1297 Stooltalk_pattern_plist_get,
1298 1, 1, 0 /*
1299 Return the a list of all the properties currently set in PATTERN. 1225 Return the a list of all the properties currently set in PATTERN.
1300 */ ) 1226 */
1301 (pattern) 1227 (pattern))
1302 Lisp_Object pattern;
1303 { 1228 {
1304 CHECK_TOOLTALK_PATTERN (pattern); 1229 CHECK_TOOLTALK_PATTERN (pattern);
1305 return Fcopy_sequence 1230 return Fcopy_sequence
1306 (Fsymbol_plist (XTOOLTALK_PATTERN (pattern)->plist_sym)); 1231 (Fsymbol_plist (XTOOLTALK_PATTERN (pattern)->plist_sym));
1307 } 1232 }
1308 1233
1309 DEFUN ("tooltalk-default-procid", 1234 DEFUN ("tooltalk-default-procid", Ftooltalk_default_procid, 0, 0, 0, /*
1310 Ftooltalk_default_procid,
1311 Stooltalk_default_procid,
1312 0, 0, 0 /*
1313 Return current default process identifier for your process. 1235 Return current default process identifier for your process.
1314 */ ) 1236 */
1315 () 1237 ())
1316 { 1238 {
1317 char *procid = tt_default_procid (); 1239 char *procid = tt_default_procid ();
1318 if (!procid) 1240 if (!procid)
1319 return Qnil; 1241 return Qnil;
1320 return build_string (procid); 1242 return build_string (procid);
1321 } 1243 }
1322 1244
1323 DEFUN ("tooltalk-default-session", 1245 DEFUN ("tooltalk-default-session", Ftooltalk_default_session, 0, 0, 0, /*
1324 Ftooltalk_default_session,
1325 Stooltalk_default_session,
1326 0, 0, 0 /*
1327 Return current default session identifier for the current default procid. 1246 Return current default session identifier for the current default procid.
1328 */ ) 1247 */
1329 () 1248 ())
1330 { 1249 {
1331 char *session = tt_default_session (); 1250 char *session = tt_default_session ();
1332 if (!session) 1251 if (!session)
1333 return Qnil; 1252 return Qnil;
1334 return build_string (session); 1253 return build_string (session);
1354 Vtooltalk_fd, Vtooltalk_fd); 1273 Vtooltalk_fd, Vtooltalk_fd);
1355 if (!NILP (lp)) 1274 if (!NILP (lp))
1356 { 1275 {
1357 /* Don't ask the user for confirmation when exiting Emacs */ 1276 /* Don't ask the user for confirmation when exiting Emacs */
1358 Fprocess_kill_without_query (lp, Qnil); 1277 Fprocess_kill_without_query (lp, Qnil);
1359 XSETSUBR (fil, &Sreceive_tooltalk_message); 1278 XSETSUBR (fil, &SFreceive_tooltalk_message);
1360 set_process_filter (lp, fil, 1); 1279 set_process_filter (lp, fil, 1);
1361 } 1280 }
1362 else 1281 else
1363 { 1282 {
1364 tt_close (); 1283 tt_close ();
1380 tt_message_destroy (exit_msg); 1299 tt_message_destroy (exit_msg);
1381 } 1300 }
1382 #endif 1301 #endif
1383 } 1302 }
1384 1303
1385 DEFUN ("tooltalk-open-connection", 1304 DEFUN ("tooltalk-open-connection", Ftooltalk_open_connection, 0, 0, 0, /*
1386 Ftooltalk_open_connection, Stooltalk_open_connection,
1387 0, 0, 0 /*
1388 Opens a connection to the ToolTalk server. 1305 Opens a connection to the ToolTalk server.
1389 Returns t if successful, nil otherwise. 1306 Returns t if successful, nil otherwise.
1390 */ ) 1307 */
1391 () 1308 ())
1392 { 1309 {
1393 if (!NILP (Vtooltalk_fd)) 1310 if (!NILP (Vtooltalk_fd))
1394 error ("Already connected to ToolTalk."); 1311 error ("Already connected to ToolTalk.");
1395 if (noninteractive) 1312 if (noninteractive)
1396 error ("Can't connect to ToolTalk in batch mode."); 1313 error ("Can't connect to ToolTalk in batch mode.");
1401 1318
1402 void 1319 void
1403 syms_of_tooltalk (void) 1320 syms_of_tooltalk (void)
1404 { 1321 {
1405 defsymbol (&Qtooltalk_messagep, "tooltalk-message-p"); 1322 defsymbol (&Qtooltalk_messagep, "tooltalk-message-p");
1406 defsubr (&Stooltalk_message_p); 1323 DEFSUBR (Ftooltalk_message_p);
1407 defsymbol (&Qtooltalk_patternp, "tooltalk-pattern-p"); 1324 defsymbol (&Qtooltalk_patternp, "tooltalk-pattern-p");
1408 defsubr (&Stooltalk_pattern_p); 1325 DEFSUBR (Ftooltalk_pattern_p);
1409 defsymbol (&Qtooltalk_message_handler_hook, "tooltalk-message-handler-hook"); 1326 defsymbol (&Qtooltalk_message_handler_hook, "tooltalk-message-handler-hook");
1410 defsymbol (&Qtooltalk_pattern_handler_hook, "tooltalk-pattern-handler-hook"); 1327 defsymbol (&Qtooltalk_pattern_handler_hook, "tooltalk-pattern-handler-hook");
1411 defsymbol (&Qtooltalk_unprocessed_message_hook, 1328 defsymbol (&Qtooltalk_unprocessed_message_hook,
1412 "tooltalk-unprocessed-message-hook"); 1329 "tooltalk-unprocessed-message-hook");
1413 1330
1414 defsubr (&Sreceive_tooltalk_message); 1331 DEFSUBR (Freceive_tooltalk_message);
1415 defsubr (&Screate_tooltalk_message); 1332 DEFSUBR (Fcreate_tooltalk_message);
1416 defsubr (&Sdestroy_tooltalk_message); 1333 DEFSUBR (Fdestroy_tooltalk_message);
1417 defsubr (&Sadd_tooltalk_message_arg); 1334 DEFSUBR (Fadd_tooltalk_message_arg);
1418 defsubr (&Sget_tooltalk_message_attribute); 1335 DEFSUBR (Fget_tooltalk_message_attribute);
1419 defsubr (&Sset_tooltalk_message_attribute); 1336 DEFSUBR (Fset_tooltalk_message_attribute);
1420 defsubr (&Ssend_tooltalk_message); 1337 DEFSUBR (Fsend_tooltalk_message);
1421 defsubr (&Sreturn_tooltalk_message); 1338 DEFSUBR (Freturn_tooltalk_message);
1422 defsubr (&Screate_tooltalk_pattern); 1339 DEFSUBR (Fcreate_tooltalk_pattern);
1423 defsubr (&Sdestroy_tooltalk_pattern); 1340 DEFSUBR (Fdestroy_tooltalk_pattern);
1424 defsubr (&Sadd_tooltalk_pattern_attribute); 1341 DEFSUBR (Fadd_tooltalk_pattern_attribute);
1425 defsubr (&Sadd_tooltalk_pattern_arg); 1342 DEFSUBR (Fadd_tooltalk_pattern_arg);
1426 defsubr (&Sregister_tooltalk_pattern); 1343 DEFSUBR (Fregister_tooltalk_pattern);
1427 defsubr (&Sunregister_tooltalk_pattern); 1344 DEFSUBR (Funregister_tooltalk_pattern);
1428 defsubr (&Stooltalk_pattern_plist_get); 1345 DEFSUBR (Ftooltalk_pattern_plist_get);
1429 defsubr (&Stooltalk_pattern_prop_set); 1346 DEFSUBR (Ftooltalk_pattern_prop_set);
1430 defsubr (&Stooltalk_pattern_prop_get); 1347 DEFSUBR (Ftooltalk_pattern_prop_get);
1431 defsubr (&Stooltalk_default_procid); 1348 DEFSUBR (Ftooltalk_default_procid);
1432 defsubr (&Stooltalk_default_session); 1349 DEFSUBR (Ftooltalk_default_session);
1433 defsubr (&Stooltalk_open_connection); 1350 DEFSUBR (Ftooltalk_open_connection);
1434 1351
1435 defsymbol (&Qreceive_tooltalk_message, "receive-tooltalk-message"); 1352 defsymbol (&Qreceive_tooltalk_message, "receive-tooltalk-message");
1436 defsymbol (&Qtt_address, "address"); 1353 defsymbol (&Qtt_address, "address");
1437 defsymbol (&Qtt_args_count, "args_count"); 1354 defsymbol (&Qtt_args_count, "args_count");
1438 defsymbol (&Qtt_arg_bval, "arg_bval"); 1355 defsymbol (&Qtt_arg_bval, "arg_bval");