comparison src/console.c @ 440:8de8e3f6228a r21-2-28

Import from CVS: tag r21-2-28
author cvs
date Mon, 13 Aug 2007 11:33:38 +0200
parents 3ecd8885ac67
children abe6d1db359e
comparison
equal deleted inserted replaced
439:357dd071b03c 440:8de8e3f6228a
127 XSTRING_DATA (con->name), con->header.uid); 127 XSTRING_DATA (con->name), con->header.uid);
128 128
129 sprintf (buf, "#<%s-console", !CONSOLE_LIVE_P (con) ? "dead" : 129 sprintf (buf, "#<%s-console", !CONSOLE_LIVE_P (con) ? "dead" :
130 CONSOLE_TYPE_NAME (con)); 130 CONSOLE_TYPE_NAME (con));
131 write_c_string (buf, printcharfun); 131 write_c_string (buf, printcharfun);
132 if (CONSOLE_LIVE_P (con)) 132 if (CONSOLE_LIVE_P (con) && !NILP (CONSOLE_CONNECTION (con)))
133 { 133 {
134 write_c_string (" on ", printcharfun); 134 write_c_string (" on ", printcharfun);
135 print_internal (CONSOLE_CONNECTION (con), printcharfun, 1); 135 print_internal (CONSOLE_CONNECTION (con), printcharfun, 1);
136 } 136 }
137 sprintf (buf, " 0x%x>", con->header.uid); 137 sprintf (buf, " 0x%x>", con->header.uid);
353 353
354 static Lisp_Object 354 static Lisp_Object
355 semi_canonicalize_console_connection (struct console_methods *meths, 355 semi_canonicalize_console_connection (struct console_methods *meths,
356 Lisp_Object name, Error_behavior errb) 356 Lisp_Object name, Error_behavior errb)
357 { 357 {
358 return CONTYPE_METH_OR_GIVEN (meths, semi_canonicalize_console_connection, 358 if (HAS_CONTYPE_METH_P (meths, semi_canonicalize_console_connection))
359 (name, errb), name); 359 return CONTYPE_METH (meths, semi_canonicalize_console_connection,
360 (name, errb));
361 else
362 return CONTYPE_METH_OR_GIVEN (meths, canonicalize_console_connection,
363 (name, errb), name);
360 } 364 }
361 365
362 static Lisp_Object 366 static Lisp_Object
363 canonicalize_console_connection (struct console_methods *meths, 367 canonicalize_console_connection (struct console_methods *meths,
364 Lisp_Object name, Error_behavior errb) 368 Lisp_Object name, Error_behavior errb)
365 { 369 {
366 return CONTYPE_METH_OR_GIVEN (meths, canonicalize_console_connection, 370 if (HAS_CONTYPE_METH_P (meths, canonicalize_console_connection))
367 (name, errb), name); 371 return CONTYPE_METH (meths, canonicalize_console_connection,
372 (name, errb));
373 else
374 return CONTYPE_METH_OR_GIVEN (meths, semi_canonicalize_console_connection,
375 (name, errb), name);
368 } 376 }
369 377
370 static Lisp_Object 378 static Lisp_Object
371 find_console_of_type (struct console_methods *meths, Lisp_Object canon) 379 find_console_of_type (struct console_methods *meths, Lisp_Object canon)
372 { 380 {
486 MAYBE_CONMETH (con, init_console, (con, props)); 494 MAYBE_CONMETH (con, init_console, (con, props));
487 495
488 /* Do it this way so that the console list is in order of creation */ 496 /* Do it this way so that the console list is in order of creation */
489 Vconsole_list = nconc2 (Vconsole_list, Fcons (console, Qnil)); 497 Vconsole_list = nconc2 (Vconsole_list, Fcons (console, Qnil));
490 498
491 if (CONMETH (con, initially_selected_for_input, (con))) 499 if (CONMETH_OR_GIVEN (con, initially_selected_for_input, (con), 0))
492 event_stream_select_console (con); 500 event_stream_select_console (con);
493 501
494 UNGCPRO; 502 UNGCPRO;
495 return console; 503 return console;
496 } 504 }
876 if (STRINGP (stuffstring)) 884 if (STRINGP (stuffstring))
877 { 885 {
878 Extcount count; 886 Extcount count;
879 Extbyte *p; 887 Extbyte *p;
880 888
881 GET_STRING_EXT_DATA_ALLOCA (stuffstring, FORMAT_KEYBOARD, p, count); 889 TO_EXTERNAL_FORMAT (LISP_STRING, stuffstring,
890 ALLOCA, (p, count),
891 Qkeyboard);
882 while (count-- > 0) 892 while (count-- > 0)
883 stuff_char (XCONSOLE (Vcontrolling_terminal), *p++); 893 stuff_char (XCONSOLE (Vcontrolling_terminal), *p++);
884 stuff_char (XCONSOLE (Vcontrolling_terminal), '\n'); 894 stuff_char (XCONSOLE (Vcontrolling_terminal), '\n');
885 } 895 }
886 /* Anything we have read ahead, put back for the shell to read. */ 896 /* Anything we have read ahead, put back for the shell to read. */
1097 defsymbol (&Qsuspend_hook, "suspend-hook"); 1107 defsymbol (&Qsuspend_hook, "suspend-hook");
1098 defsymbol (&Qsuspend_resume_hook, "suspend-resume-hook"); 1108 defsymbol (&Qsuspend_resume_hook, "suspend-resume-hook");
1099 } 1109 }
1100 1110
1101 static const struct lrecord_description cte_description_1[] = { 1111 static const struct lrecord_description cte_description_1[] = {
1102 { XD_LISP_OBJECT, offsetof(console_type_entry, symbol), 1 }, 1112 { XD_LISP_OBJECT, offsetof (console_type_entry, symbol) },
1103 { XD_STRUCT_PTR, offsetof(console_type_entry, meths), 1, &console_methods_description }, 1113 { XD_STRUCT_PTR, offsetof (console_type_entry, meths), 1, &console_methods_description },
1104 { XD_END } 1114 { XD_END }
1105 }; 1115 };
1106 1116
1107 static const struct struct_description cte_description = { 1117 static const struct struct_description cte_description = {
1108 sizeof(console_type_entry), 1118 sizeof (console_type_entry),
1109 cte_description_1 1119 cte_description_1
1110 }; 1120 };
1111 1121
1112 static const struct lrecord_description cted_description_1[] = { 1122 static const struct lrecord_description cted_description_1[] = {
1113 XD_DYNARR_DESC(console_type_entry_dynarr, &cte_description), 1123 XD_DYNARR_DESC (console_type_entry_dynarr, &cte_description),
1114 { XD_END } 1124 { XD_END }
1115 }; 1125 };
1116 1126
1117 const struct struct_description cted_description = { 1127 const struct struct_description cted_description = {
1118 sizeof(console_type_entry_dynarr), 1128 sizeof (console_type_entry_dynarr),
1119 cted_description_1 1129 cted_description_1
1120 }; 1130 };
1121 1131
1122 static const struct lrecord_description console_methods_description_1[] = { 1132 static const struct lrecord_description console_methods_description_1[] = {
1123 { XD_LISP_OBJECT, offsetof(struct console_methods, symbol), 2 }, 1133 { XD_LISP_OBJECT, offsetof (struct console_methods, symbol) },
1124 { XD_LISP_OBJECT, offsetof(struct console_methods, image_conversion_list), 1 }, 1134 { XD_LISP_OBJECT, offsetof (struct console_methods, predicate_symbol) },
1135 { XD_LISP_OBJECT, offsetof (struct console_methods, image_conversion_list) },
1125 { XD_END } 1136 { XD_END }
1126 }; 1137 };
1127 1138
1128 const struct struct_description console_methods_description = { 1139 const struct struct_description console_methods_description = {
1129 sizeof(struct console_methods), 1140 sizeof (struct console_methods),
1130 console_methods_description_1 1141 console_methods_description_1
1131 }; 1142 };
1132 1143
1133 1144
1134 void 1145 void
1319 CONSOLE_SLOTS_SIZE); 1330 CONSOLE_SLOTS_SIZE);
1320 } 1331 }
1321 1332
1322 1333
1323 static const struct lrecord_description console_slots_description_1[] = { 1334 static const struct lrecord_description console_slots_description_1[] = {
1324 { XD_LISP_OBJECT, 0, CONSOLE_SLOTS_COUNT }, 1335 { XD_LISP_OBJECT_ARRAY, 0, CONSOLE_SLOTS_COUNT },
1325 { XD_END } 1336 { XD_END }
1326 }; 1337 };
1327 1338
1328 static const struct struct_description console_slots_description = { 1339 static const struct struct_description console_slots_description = {
1329 CONSOLE_SLOTS_SIZE, 1340 CONSOLE_SLOTS_SIZE,
1371 were a prefix key, typing `ESC O P x' would return 1382 were a prefix key, typing `ESC O P x' would return
1372 \[#<keypress-event f1> #<keypress-event x>]. 1383 \[#<keypress-event f1> #<keypress-event x>].
1373 */ ); 1384 */ );
1374 1385
1375 #ifdef HAVE_TTY 1386 #ifdef HAVE_TTY
1376 /* ### Should this somehow go to TTY data? How do we make it 1387 /* #### Should this somehow go to TTY data? How do we make it
1377 accessible from Lisp, then? */ 1388 accessible from Lisp, then? */
1378 DEFVAR_CONSOLE_LOCAL ("tty-erase-char", tty_erase_char /* 1389 DEFVAR_CONSOLE_LOCAL ("tty-erase-char", tty_erase_char /*
1379 The ERASE character as set by the user with stty. 1390 The ERASE character as set by the user with stty.
1380 When this value cannot be determined or would be meaningless (on non-TTY 1391 When this value cannot be determined or would be meaningless (on non-TTY
1381 consoles, for example), it is set to nil. 1392 consoles, for example), it is set to nil.