Mercurial > hg > xemacs-beta
comparison src/device.c @ 155:43dd3413c7c7 r20-3b4
Import from CVS: tag r20-3b4
author | cvs |
---|---|
date | Mon, 13 Aug 2007 09:39:39 +0200 |
parents | cca96a509cfe |
children | 3d6bfa290dbd |
comparison
equal
deleted
inserted
replaced
154:94141801dd7e | 155:43dd3413c7c7 |
---|---|
493 signal_simple_error_2 ("No such device", type, connection); | 493 signal_simple_error_2 ("No such device", type, connection); |
494 } | 494 } |
495 return device; | 495 return device; |
496 } | 496 } |
497 | 497 |
498 static Lisp_Object | |
499 delete_deviceless_console(Lisp_Object console) | |
500 { | |
501 if (NILP (XCONSOLE (console)->device_list)) | |
502 Fdelete_console(console, Qnil); | |
503 return Qnil; | |
504 } | |
505 | |
498 DEFUN ("make-device", Fmake_device, 2, 3, 0, /* | 506 DEFUN ("make-device", Fmake_device, 2, 3, 0, /* |
499 Create a new device of type TYPE, attached to connection CONNECTION. | 507 Create a new device of type TYPE, attached to connection CONNECTION. |
500 | 508 |
501 The valid values for CONNECTION are device-specific; however, | 509 The valid values for CONNECTION are device-specific; however, |
502 CONNECTION is generally a string. (Specifically, for X devices, | 510 CONNECTION is generally a string. (Specifically, for X devices, |
519 struct console *con; | 527 struct console *con; |
520 Lisp_Object device = Qnil; | 528 Lisp_Object device = Qnil; |
521 Lisp_Object console = Qnil; | 529 Lisp_Object console = Qnil; |
522 Lisp_Object name = Qnil; | 530 Lisp_Object name = Qnil; |
523 struct console_methods *conmeths; | 531 struct console_methods *conmeths; |
532 int speccount = specpdl_depth(); | |
524 | 533 |
525 struct gcpro gcpro1, gcpro2, gcpro3; | 534 struct gcpro gcpro1, gcpro2, gcpro3; |
526 #ifdef HAVE_X_WINDOWS | 535 #ifdef HAVE_X_WINDOWS |
527 /* #### icky-poo. If this is the first X device we are creating, | 536 /* #### icky-poo. If this is the first X device we are creating, |
528 then retrieve the global face resources. We have to do it | 537 then retrieve the global face resources. We have to do it |
561 (connection, ERROR_ME), | 570 (connection, ERROR_ME), |
562 connection); | 571 connection); |
563 console = create_console (name, type, conconnect, props); | 572 console = create_console (name, type, conconnect, props); |
564 } | 573 } |
565 | 574 |
575 record_unwind_protect(delete_deviceless_console, console); | |
576 | |
566 con = XCONSOLE (console); | 577 con = XCONSOLE (console); |
567 d = allocate_device (console); | 578 d = allocate_device (console); |
568 XSETDEVICE (device, d); | 579 XSETDEVICE (device, d); |
569 | 580 |
570 d->devmeths = con->conmeths; | 581 d->devmeths = con->conmeths; |
600 | 611 |
601 /* #### the following should trap errors. */ | 612 /* #### the following should trap errors. */ |
602 setup_device_initial_specifier_tags (d); | 613 setup_device_initial_specifier_tags (d); |
603 | 614 |
604 UNGCPRO; | 615 UNGCPRO; |
616 unbind_to(speccount, Qnil); | |
605 return device; | 617 return device; |
606 } | 618 } |
607 | 619 |
608 /* find a device other than the selected one. Prefer non-stream | 620 /* find a device other than the selected one. Prefer non-stream |
609 devices over stream devices. Maybe stay on the same console. */ | 621 devices over stream devices. Maybe stay on the same console. */ |