UserMsg.h 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. /*
  2. * CDE - Common Desktop Environment
  3. *
  4. * Copyright (c) 1993-2012, The Open Group. All rights reserved.
  5. *
  6. * These libraries and programs are free software; you can
  7. * redistribute them and/or modify them under the terms of the GNU
  8. * Lesser General Public License as published by the Free Software
  9. * Foundation; either version 2 of the License, or (at your option)
  10. * any later version.
  11. *
  12. * These libraries and programs are distributed in the hope that
  13. * they will be useful, but WITHOUT ANY WARRANTY; without even the
  14. * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
  15. * PURPOSE. See the GNU Lesser General Public License for more
  16. * details.
  17. *
  18. * You should have received a copy of the GNU Lesser General Public
  19. * License along with these libraries and programs; if not, write
  20. * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
  21. * Floor, Boston, MA 02110-1301 USA
  22. */
  23. /* $TOG: UserMsg.h /main/6 1998/04/09 17:50:49 mgreess $ */
  24. /*
  25. * (c) Copyright 1995 Digital Equipment Corporation.
  26. * (c) Copyright 1988, 1993, 1994, 1995 Hewlett-Packard Company
  27. * (c) Copyright 1993, 1994, 1995 International Business Machines Corp.
  28. * (c) Copyright 1993, 1994, 1995 Sun Microsystems, Inc.
  29. * (c) Copyright 1993, 1994, 1995 Novell, Inc.
  30. * (c) Copyright 1995 FUJITSU LIMITED.
  31. * (c) Copyright 1995 Hitachi.
  32. */
  33. /* -*-C-*-
  34. ********************************************************************************
  35. *
  36. * File: usermsg.h
  37. * Description: Header for error logging routines
  38. * Status: Experimental (Do Not Distribute)
  39. *
  40. ********************************************************************************
  41. */
  42. #ifndef _usermsg_h
  43. #define _usermsg_h
  44. #include <X11/Intrinsic.h>
  45. #ifndef __STDC__
  46. # ifndef const
  47. # define const
  48. # endif
  49. #endif
  50. #include <bms/XeUserMsg.h>
  51. typedef enum {
  52. DtIgnore,
  53. DtInformation,
  54. DtWarning,
  55. DtError,
  56. DtFatalError,
  57. DtInternalError
  58. } DtSeverity;
  59. extern void _DtSimpleError(
  60. char *progName,
  61. DtSeverity severity,
  62. char *help,
  63. char *format,
  64. ...) ;
  65. extern void _DtSimpleErrnoError(
  66. char *progName,
  67. DtSeverity severity,
  68. char *help,
  69. char *format,
  70. ...) ;
  71. #define DtProgName XeProgName
  72. extern int _DtPrintDefaultError(
  73. Display *dpy,
  74. XErrorEvent *event,
  75. char *msg );
  76. #define _DTPRINTDEFAULTERROR_BUFSIZE 1024
  77. extern int _DtPrintDefaultErrorSafe(
  78. Display *dpy,
  79. XErrorEvent *event,
  80. char *msg,
  81. int bytes);
  82. /*
  83. DESCRIPTION:
  84. Supply the standard Xerror output to a buffer (instead of stederr)
  85. so client can do what it wants with it. Also don't exit. Allow
  86. client to decide what to do.
  87. An appropriate thing to do would be to pass the buffer to
  88. DtSimpleError() and return. ie. In your error callback:
  89. {
  90. char errmsg[1024];
  91. int ret ;
  92. ret = _DtPrintDefaultError (style.display, rep, errmsg);
  93. DtSimpleError(DtWarning, "><An X Error has occurred...continuing" ,
  94. errmsg, NULL);
  95. return ret;
  96. }
  97. SYNOPSIS:
  98. int _DtPrintDefaultError (dpy, event, msg)
  99. Display *dpy; The application's display structure.
  100. XErrorEvent *event; Error event returned to error callback.
  101. char *msg; Buffer returning the formatted text of
  102. the error message. It won't be more than
  103. 1024 bytes.
  104. */
  105. #endif /* _usermsg_h */
  106. /* DON'T ADD STUFF AFTER THIS #endif */