comparison src/device.c @ 563:183866b06e0b

[xemacs-hg @ 2001-05-24 07:50:48 by ben] Makefile.in.in, abbrev.c, alloc.c, buffer.c, bytecode.c, callint.c, callproc.c, casetab.c, chartab.c, cmdloop.c, cmds.c, console-msw.c, console-msw.h, console-stream.c, console-tty.c, console-x.c, console.c, data.c, database.c, debug.c, device-gtk.c, device-msw.c, device-tty.c, device-x.c, device.c, dialog-gtk.c, dialog-msw.c, dialog-x.c, dialog.c, dired-msw.c, dired.c, doc.c, doprnt.c, dragdrop.c, editfns.c, eldap.c, eldap.h, elhash.c, emacs-widget-accessors.c, emacs.c, emodules.c, esd.c, eval.c, event-Xt.c, event-gtk.c, event-msw.c, event-stream.c, events.c, extents.c, faces.c, file-coding.c, fileio.c, filelock.c, floatfns.c, fns.c, font-lock.c, frame-gtk.c, frame-x.c, frame.c, general-slots.h, glade.c, glyphs-gtk.c, glyphs-msw.c, glyphs-widget.c, glyphs-x.c, glyphs.c, glyphs.h, gpmevent.c, gui-gtk.c, gui-x.c, gui.c, gutter.c, hpplay.c, indent.c, input-method-xlib.c, insdel.c, intl.c, keymap.c, libsst.c, libsst.h, linuxplay.c, lisp.h, lread.c, lstream.c, lstream.h, macros.c, marker.c, md5.c, menubar-gtk.c, menubar-msw.c, menubar-x.c, menubar.c, minibuf.c, miscplay.c, miscplay.h, mule-ccl.c, mule-charset.c, mule-wnnfns.c, mule.c, nas.c, ntplay.c, ntproc.c, objects-gtk.c, objects-msw.c, objects-x.c, objects.c, postgresql.c, print.c, process-nt.c, process-unix.c, process.c, ralloc.c, rangetab.c, redisplay.c, scrollbar.c, search.c, select-gtk.c, select-x.c, select.c, sgiplay.c, sheap.c, sound.c, specifier.c, sunplay.c, symbols.c, symeval.h, symsinit.h, syntax.c, sysdep.c, toolbar-msw.c, toolbar.c, tooltalk.c, ui-byhand.c, ui-gtk.c, undo.c, unexaix.c, unexapollo.c, unexconvex.c, unexec.c, widget.c, win32.c, window.c: -- defsymbol -> DEFSYMBOL. -- add an error type to all errors. -- eliminate the error functions in eval.c that let you just use Qerror as the type. -- redo the error API to be more consistent, sensibly named, and easier to use. -- redo the error hierarchy somewhat. create new errors: structure-formation-error, gui-error, invalid-constant, stack-overflow, out-of-memory, process-error, network-error, sound-error, printing-unreadable-object, base64-conversion- error; coding-system-error renamed to text-conversion error; some others. -- fix Mule problems in error strings in emodules.c, tooltalk.c. -- fix error handling in mswin open-network-stream. -- Mule-ize all sound files and clean up the headers. -- nativesound.h -> sound.h and used for all sound files. -- move some shared stuff into glyphs-shared.c: first attempt at eliminating some of the massive GTK code duplication. xemacs.mak: add glyphs-shared.c. xemacs-faq.texi: document how to debug X errors subr.el: fix doc string to reflect reality
author ben
date Thu, 24 May 2001 07:51:33 +0000
parents 9a775fb11bb7
children 190b164ddcac
comparison
equal deleted inserted replaced
562:c775bd016b32 563:183866b06e0b
117 { 117 {
118 struct device *d = XDEVICE (obj); 118 struct device *d = XDEVICE (obj);
119 char buf[256]; 119 char buf[256];
120 120
121 if (print_readably) 121 if (print_readably)
122 error ("printing unreadable object #<device %s 0x%x>", 122 printing_unreadable_object ("#<device %s 0x%x>",
123 XSTRING_DATA (d->name), d->header.uid); 123 XSTRING_DATA (d->name), d->header.uid);
124 124
125 sprintf (buf, "#<%s-device", !DEVICE_LIVE_P (d) ? "dead" : 125 sprintf (buf, "#<%s-device", !DEVICE_LIVE_P (d) ? "dead" :
126 DEVICE_TYPE_NAME (d)); 126 DEVICE_TYPE_NAME (d));
127 write_c_string (buf, printcharfun); 127 write_c_string (buf, printcharfun);
128 if (DEVICE_LIVE_P (d) && !NILP (DEVICE_CONNECTION (d))) 128 if (DEVICE_LIVE_P (d) && !NILP (DEVICE_CONNECTION (d)))
277 if (!NILP (DEVICE_SELECTED_FRAME (XDEVICE (device)))) 277 if (!NILP (DEVICE_SELECTED_FRAME (XDEVICE (device))))
278 Fselect_window (FRAME_SELECTED_WINDOW 278 Fselect_window (FRAME_SELECTED_WINDOW
279 (XFRAME (DEVICE_SELECTED_FRAME (XDEVICE (device)))), 279 (XFRAME (DEVICE_SELECTED_FRAME (XDEVICE (device)))),
280 Qnil); 280 Qnil);
281 else 281 else
282 error ("Can't select a device with no frames"); 282 invalid_operation ("Can't select a device with no frames", Qunbound);
283 return Qnil; 283 return Qnil;
284 } 284 }
285 285
286 void 286 void
287 set_device_selected_frame (struct device *d, Lisp_Object frame) 287 set_device_selected_frame (struct device *d, Lisp_Object frame)
300 { 300 {
301 XSETDEVICE (device, decode_device (device)); 301 XSETDEVICE (device, decode_device (device));
302 CHECK_LIVE_FRAME (frame); 302 CHECK_LIVE_FRAME (frame);
303 303
304 if (! EQ (device, FRAME_DEVICE (XFRAME (frame)))) 304 if (! EQ (device, FRAME_DEVICE (XFRAME (frame))))
305 error ("In `set-device-selected-frame', FRAME is not on DEVICE"); 305 invalid_argument ("In `set-device-selected-frame', FRAME is not on DEVICE", Qunbound);
306 306
307 if (EQ (device, Fselected_device (Qnil))) 307 if (EQ (device, Fselected_device (Qnil)))
308 return Fselect_frame (frame); 308 return Fselect_frame (frame);
309 309
310 set_device_selected_frame (XDEVICE (device), frame); 310 set_device_selected_frame (XDEVICE (device), frame);
485 { 485 {
486 Lisp_Object device = Ffind_device (connection, type); 486 Lisp_Object device = Ffind_device (connection, type);
487 if (NILP (device)) 487 if (NILP (device))
488 { 488 {
489 if (NILP (type)) 489 if (NILP (type))
490 signal_simple_error ("No such device", connection); 490 invalid_argument ("No such device", connection);
491 else 491 else
492 signal_simple_error_2 ("No such device", type, connection); 492 invalid_argument_2 ("No such device", type, connection);
493 } 493 }
494 return device; 494 return device;
495 } 495 }
496 496
497 static Lisp_Object 497 static Lisp_Object
555 555
556 GCPRO3 (device, console, name); 556 GCPRO3 (device, console, name);
557 557
558 conmeths = decode_console_type (type, ERROR_ME_NOT); 558 conmeths = decode_console_type (type, ERROR_ME_NOT);
559 if (!conmeths) 559 if (!conmeths)
560 signal_simple_error ("Invalid device type", type); 560 invalid_constant ("Invalid device type", type);
561 561
562 device = Ffind_device (connection, type); 562 device = Ffind_device (connection, type);
563 if (!NILP (device)) 563 if (!NILP (device))
564 RETURN_UNGCPRO (device); 564 RETURN_UNGCPRO (device);
565 565
881 (device, class)) 881 (device, class))
882 { 882 {
883 struct device *d = decode_device (device); 883 struct device *d = decode_device (device);
884 XSETDEVICE (device, d); 884 XSETDEVICE (device, d);
885 if (!DEVICE_TTY_P (d)) 885 if (!DEVICE_TTY_P (d))
886 signal_simple_error ("Cannot change the class of this device", device); 886 gui_error ("Cannot change the class of this device", device);
887 if (!EQ (class, Qcolor) && !EQ (class, Qmono) && !EQ (class, Qgrayscale)) 887 if (!EQ (class, Qcolor) && !EQ (class, Qmono) && !EQ (class, Qgrayscale))
888 signal_simple_error ("Must be color, mono, or grayscale", class); 888 invalid_constant ("Must be color, mono, or grayscale", class);
889 if (! EQ (DEVICE_CLASS (d), class)) 889 if (! EQ (DEVICE_CLASS (d), class))
890 { 890 {
891 Lisp_Object frmcons; 891 Lisp_Object frmcons;
892 DEVICE_CLASS (d) = class; 892 DEVICE_CLASS (d) = class;
893 DEVICE_FRAME_LOOP (frmcons, d) 893 DEVICE_FRAME_LOOP (frmcons, d)
1065 FROB (swap_buttons); 1065 FROB (swap_buttons);
1066 FROB (show_sounds); 1066 FROB (show_sounds);
1067 FROB (slow_device); 1067 FROB (slow_device);
1068 FROB (security); 1068 FROB (security);
1069 else 1069 else
1070 signal_simple_error ("Invalid device metric symbol", metric); 1070 invalid_constant ("Invalid device metric symbol", metric);
1071 1071
1072 res = DEVMETH_OR_GIVEN (d, device_system_metrics, (d, m), Qunbound); 1072 res = DEVMETH_OR_GIVEN (d, device_system_metrics, (d, m), Qunbound);
1073 return UNBOUNDP(res) ? default_ : res; 1073 return UNBOUNDP(res) ? default_ : res;
1074 1074
1075 #undef FROB 1075 #undef FROB
1184 */ 1184 */
1185 (domain)) 1185 (domain))
1186 { 1186 {
1187 if (!WINDOWP (domain) && !FRAMEP (domain) 1187 if (!WINDOWP (domain) && !FRAMEP (domain)
1188 && !DEVICEP (domain) && !CONSOLEP (domain)) 1188 && !DEVICEP (domain) && !CONSOLEP (domain))
1189 signal_simple_error 1189 invalid_argument
1190 ("Domain must be either a window, frame, device or console", domain); 1190 ("Domain must be either a window, frame, device or console", domain);
1191 1191
1192 return domain_device_type (domain); 1192 return domain_device_type (domain);
1193 } 1193 }
1194 1194
1278 DEFSUBR (Fset_device_baud_rate); 1278 DEFSUBR (Fset_device_baud_rate);
1279 DEFSUBR (Fdevice_baud_rate); 1279 DEFSUBR (Fdevice_baud_rate);
1280 DEFSUBR (Fdomain_device_type); 1280 DEFSUBR (Fdomain_device_type);
1281 DEFSUBR (Fdevice_printer_p); 1281 DEFSUBR (Fdevice_printer_p);
1282 1282
1283 defsymbol (&Qdevicep, "devicep"); 1283 DEFSYMBOL (Qdevicep);
1284 defsymbol (&Qdevice_live_p, "device-live-p"); 1284 DEFSYMBOL (Qdevice_live_p);
1285 1285
1286 defsymbol (&Qcreate_device_hook, "create-device-hook"); 1286 DEFSYMBOL (Qcreate_device_hook);
1287 defsymbol (&Qdelete_device_hook, "delete-device-hook"); 1287 DEFSYMBOL (Qdelete_device_hook);
1288 1288
1289 /* Qcolor defined in general.c */ 1289 /* Qcolor defined in general.c */
1290 defsymbol (&Qgrayscale, "grayscale"); 1290 DEFSYMBOL (Qgrayscale);
1291 defsymbol (&Qmono, "mono"); 1291 DEFSYMBOL (Qmono);
1292 1292
1293 /* Device metrics symbols */ 1293 /* Device metrics symbols */
1294 defsymbol (&Qcolor_default, "color-default"); 1294 DEFSYMBOL (Qcolor_default);
1295 defsymbol (&Qcolor_select, "color-select"); 1295 DEFSYMBOL (Qcolor_select);
1296 defsymbol (&Qcolor_balloon, "color-balloon"); 1296 DEFSYMBOL (Qcolor_balloon);
1297 defsymbol (&Qcolor_3d_face, "color-3d-face"); 1297 DEFSYMBOL (Qcolor_3d_face);
1298 defsymbol (&Qcolor_3d_light, "color-3d-light"); 1298 DEFSYMBOL (Qcolor_3d_light);
1299 defsymbol (&Qcolor_3d_dark, "color-3d-dark"); 1299 DEFSYMBOL (Qcolor_3d_dark);
1300 defsymbol (&Qcolor_menu, "color-menu"); 1300 DEFSYMBOL (Qcolor_menu);
1301 defsymbol (&Qcolor_menu_highlight, "color-menu-highlight"); 1301 DEFSYMBOL (Qcolor_menu_highlight);
1302 defsymbol (&Qcolor_menu_button, "color-menu-button"); 1302 DEFSYMBOL (Qcolor_menu_button);
1303 defsymbol (&Qcolor_menu_disabled, "color-menu-disabled"); 1303 DEFSYMBOL (Qcolor_menu_disabled);
1304 defsymbol (&Qcolor_toolbar, "color-toolbar"); 1304 DEFSYMBOL (Qcolor_toolbar);
1305 defsymbol (&Qcolor_scrollbar, "color-scrollbar"); 1305 DEFSYMBOL (Qcolor_scrollbar);
1306 defsymbol (&Qcolor_desktop, "color-desktop"); 1306 DEFSYMBOL (Qcolor_desktop);
1307 defsymbol (&Qcolor_workspace, "color-workspace"); 1307 DEFSYMBOL (Qcolor_workspace);
1308 defsymbol (&Qfont_default, "font-default"); 1308 DEFSYMBOL (Qfont_default);
1309 defsymbol (&Qfont_menubar, "font-menubar"); 1309 DEFSYMBOL (Qfont_menubar);
1310 defsymbol (&Qfont_dialog, "font-dialog"); 1310 DEFSYMBOL (Qfont_dialog);
1311 defsymbol (&Qsize_cursor, "size-cursor"); 1311 DEFSYMBOL (Qsize_cursor);
1312 defsymbol (&Qsize_scrollbar, "size-scrollbar"); 1312 DEFSYMBOL (Qsize_scrollbar);
1313 defsymbol (&Qsize_menu, "size-menu"); 1313 DEFSYMBOL (Qsize_menu);
1314 defsymbol (&Qsize_toolbar, "size-toolbar"); 1314 DEFSYMBOL (Qsize_toolbar);
1315 defsymbol (&Qsize_toolbar_button, "size-toolbar-button"); 1315 DEFSYMBOL (Qsize_toolbar_button);
1316 defsymbol (&Qsize_toolbar_border, "size-toolbar-border"); 1316 DEFSYMBOL (Qsize_toolbar_border);
1317 defsymbol (&Qsize_icon, "size-icon"); 1317 DEFSYMBOL (Qsize_icon);
1318 defsymbol (&Qsize_icon_small, "size-icon-small"); 1318 DEFSYMBOL (Qsize_icon_small);
1319 defsymbol (&Qsize_device, "size-device"); 1319 DEFSYMBOL (Qsize_device);
1320 defsymbol (&Qsize_workspace, "size-workspace"); 1320 DEFSYMBOL (Qsize_workspace);
1321 defsymbol (&Qoffset_workspace, "offset-workspace"); 1321 DEFSYMBOL (Qoffset_workspace);
1322 defsymbol (&Qsize_device_mm, "size-device-mm"); 1322 DEFSYMBOL (Qsize_device_mm);
1323 defsymbol (&Qnum_bit_planes, "num-bit-planes"); 1323 DEFSYMBOL (Qnum_bit_planes);
1324 defsymbol (&Qnum_color_cells, "num-color-cells"); 1324 DEFSYMBOL (Qnum_color_cells);
1325 defsymbol (&Qdevice_dpi, "device-dpi"); 1325 DEFSYMBOL (Qdevice_dpi);
1326 defsymbol (&Qmouse_buttons, "mouse-buttons"); 1326 DEFSYMBOL (Qmouse_buttons);
1327 defsymbol (&Qswap_buttons, "swap-buttons"); 1327 DEFSYMBOL (Qswap_buttons);
1328 defsymbol (&Qshow_sounds, "show-sounds"); 1328 DEFSYMBOL (Qshow_sounds);
1329 defsymbol (&Qslow_device, "slow-device"); 1329 DEFSYMBOL (Qslow_device);
1330 defsymbol (&Qsecurity, "security"); 1330 DEFSYMBOL (Qsecurity);
1331 } 1331 }
1332 1332
1333 void 1333 void
1334 reinit_vars_of_device (void) 1334 reinit_vars_of_device (void)
1335 { 1335 {