home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / mitsch75.zip / scheme-7_5_17-src.zip / scheme-7.5.17 / src / microcode / sgx11.c < prev    next >
C/C++ Source or Header  |  1999-01-02  |  2KB  |  68 lines

  1. /* -*-C-*-
  2.  
  3. $Id: sgx11.c,v 1.4 1999/01/02 06:11:34 cph Exp $
  4.  
  5. Copyright (c) 1989-1999 Massachusetts Institute of Technology
  6.  
  7. This program is free software; you can redistribute it and/or modify
  8. it under the terms of the GNU General Public License as published by
  9. the Free Software Foundation; either version 2 of the License, or (at
  10. your option) any later version.
  11.  
  12. This program is distributed in the hope that it will be useful, but
  13. WITHOUT ANY WARRANTY; without even the implied warranty of
  14. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  15. General Public License for more details.
  16.  
  17. You should have received a copy of the GNU General Public License
  18. along with this program; if not, write to the Free Software
  19. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  20. */
  21.  
  22. /* Simple X11 graphics for HP 9000 series 300 machines. */
  23.  
  24. #include <X11/Xlib.h>
  25. #include "scheme.h"
  26. #include "prims.h"
  27. #include "sgraph.h"
  28.  
  29. static int
  30. x_io_error_handler (display)
  31.      Display * display;
  32. {
  33.   fprintf (stderr, "\nX IO Error\n");
  34.   error_external_return ();
  35. }
  36.  
  37. static int
  38. x_error_handler (display, error_event)
  39.      Display * display;
  40.      XErrorEvent * error_event;
  41. {
  42.   char buffer [2048];
  43.  
  44.   XGetErrorText (display, (error_event -> error_code),
  45.          (& buffer), (sizeof (buffer)));
  46.   fprintf (stderr, "\nX Error: %s\n", buffer);
  47.   fprintf (stderr, "         Request code: %d\n",
  48.        (error_event -> request_code));
  49.   fprintf (stderr, "         Error serial: %x\n", (error_event -> serial));
  50.   error_external_return ();
  51. }
  52.  
  53. DEFINE_PRIMITIVE ("X-GRAPHICS-DISPLAY-NAME", Prim_x_graphics_display_name, 1, 1, 0)
  54. {
  55.   PRIMITIVE_HEADER (1);
  56.   PRIMITIVE_RETURN
  57.     (char_pointer_to_string
  58.      (XDisplayName (((ARG_REF (1)) == SHARP_F) ? NULL : (STRING_ARG (1)))));
  59. }
  60.  
  61. DEFINE_PRIMITIVE ("X-GRAPHICS-GRAB-ERROR-HANDLERS", Prim_x_graphics_grab_error_handlers, 0, 0, 0)
  62. {
  63.   PRIMITIVE_HEADER (0);
  64.   XSetErrorHandler (x_error_handler);
  65.   XSetIOErrorHandler (x_io_error_handler);
  66.   PRIMITIVE_RETURN (UNSPECIFIC);
  67. }
  68.