/src/wrappers/glib/library/core/glib_warnings_and_assertions.e

http://github.com/tybor/Liberty · Specman e · 261 lines · 2 code · 96 blank · 163 comment · 0 complexity · c1368ffd942710e95c5f89d34bf1ac5c MD5 · raw file

  1. deferred class GLIB_WARNINGS_AND_ASSERTIONS
  2. -- Message Output and Debugging Functions
  3. -- Message Output and Debugging Functions -- functions to output messages and help
  4. -- debug applications.
  5. -- Synopsis
  6. -- #include <glib.h>
  7. -- void g_print (const gchar *format,
  8. -- ...);
  9. -- GPrintFunc g_set_print_handler (GPrintFunc func);
  10. -- void (*GPrintFunc) (const gchar *string);
  11. -- void g_printerr (const gchar *format,
  12. -- ...);
  13. -- GPrintFunc g_set_printerr_handler (GPrintFunc func);
  14. -- #define g_return_if_fail (expr)
  15. -- #define g_return_val_if_fail (expr,val)
  16. -- #define g_return_if_reached ()
  17. -- #define g_return_val_if_reached (val)
  18. -- #define g_assert (expr)
  19. -- #define g_assert_not_reached ()
  20. -- void g_on_error_query (const gchar *prg_name);
  21. -- void g_on_error_stack_trace (const gchar *prg_name);
  22. -- #define G_BREAKPOINT ()
  23. -- Description
  24. -- These functions provide support for outputting messages.
  25. -- Details
  26. -- g_print ()
  27. -- void g_print (const gchar *format,
  28. -- ...);
  29. -- Outputs a formatted message via the print handler. The default print handler
  30. -- simply outputs the message to stdout.
  31. -- g_print() should not be used from within libraries for debugging messages, since
  32. -- it may be redirected by applications to special purpose message windows or even
  33. -- files. Instead, libraries should use g_log(), or the convenience functions
  34. -- g_message(), g_warning() and g_error().
  35. -- format : the message format. See the printf() documentation.
  36. -- ... : the parameters to insert into the format string.
  37. -- ---------------------------------------------------------------------------------
  38. -- g_set_print_handler ()
  39. -- GPrintFunc g_set_print_handler (GPrintFunc func);
  40. -- Sets the print handler. Any messages passed to g_print() will be output via the
  41. -- new handler. The default handler simply outputs the message to stdout. By
  42. -- providing your own handler you can redirect the output, to a GTK+ widget or a log
  43. -- file for example.
  44. -- func : the new print handler.
  45. -- Returns : the old print handler.
  46. -- ---------------------------------------------------------------------------------
  47. -- GPrintFunc ()
  48. -- void (*GPrintFunc) (const gchar *string);
  49. -- Specifies the type of the print handler functions. These are called with the
  50. -- complete formatted string to output.
  51. -- string : the message to be output.
  52. -- ---------------------------------------------------------------------------------
  53. -- g_printerr ()
  54. -- void g_printerr (const gchar *format,
  55. -- ...);
  56. -- Outputs a formatted message via the error message handler. The default handler
  57. -- simply outputs the message to stderr.
  58. -- g_printerr() should not be used from within libraries. Instead g_log() should be
  59. -- used, or the convenience functions g_message(), g_warning() and g_error().
  60. -- format : the message format. See the printf() documentation.
  61. -- ... : the parameters to insert into the format string.
  62. -- ---------------------------------------------------------------------------------
  63. -- g_set_printerr_handler ()
  64. -- GPrintFunc g_set_printerr_handler (GPrintFunc func);
  65. -- Sets the handler for printing error messages. Any messages passed to g_printerr()
  66. -- will be output via the new handler. The default handler simply outputs the
  67. -- message to stderr. By providing your own handler you can redirect the output, to
  68. -- a GTK+ widget or a log file for example.
  69. -- func : the new error message handler.
  70. -- Returns : the old error message handler.
  71. -- ---------------------------------------------------------------------------------
  72. -- g_return_if_fail()
  73. -- #define g_return_if_fail(expr)
  74. -- Returns from the current function if the expression is not true. If the
  75. -- expression evaluates to FALSE, a critical message is logged and the function
  76. -- returns. This can only be used in functions which do not return a value.
  77. -- expr : the expression to check.
  78. -- ---------------------------------------------------------------------------------
  79. -- g_return_val_if_fail()
  80. -- #define g_return_val_if_fail(expr,val)
  81. -- Returns from the current function, returning the value val, if the expression is
  82. -- not true. If the expression evaluates to FALSE, a critical message is logged and
  83. -- val is returned.
  84. -- expr : the expression to check.
  85. -- val : the value to return from the current function if the expression is not
  86. -- true.
  87. -- ---------------------------------------------------------------------------------
  88. -- g_return_if_reached()
  89. -- #define g_return_if_reached()
  90. -- Logs a critical message and returns from the current function. This can only be
  91. -- used in functions which do not return a value.
  92. -- ---------------------------------------------------------------------------------
  93. -- g_return_val_if_reached()
  94. -- #define g_return_val_if_reached(val)
  95. -- Logs a critical message and returns val.
  96. -- val : the value to return from the current function.
  97. -- ---------------------------------------------------------------------------------
  98. -- g_assert()
  99. -- #define g_assert(expr)
  100. -- Debugging macro to terminate the application if the assertion fails. If the
  101. -- assertion fails (i.e. the expression is not true), an error message is logged and
  102. -- the application is terminated.
  103. -- The macro can be turned off in final releases of code by defining
  104. -- G_DISABLE_ASSERT when compiling the application.
  105. -- expr : the expression to check.
  106. -- ---------------------------------------------------------------------------------
  107. -- g_assert_not_reached()
  108. -- #define g_assert_not_reached()
  109. -- Debugging macro to terminate the application if it is ever reached. If it is
  110. -- reached, an error message is logged and the application is terminated.
  111. -- The macro can be turned off in final releases of code by defining
  112. -- G_DISABLE_ASSERT when compiling the application.
  113. -- ---------------------------------------------------------------------------------
  114. -- g_on_error_query ()
  115. -- void g_on_error_query (const gchar *prg_name);
  116. -- Prompts the user with [E]xit, [H]alt, show [S]tack trace or [P]roceed. This
  117. -- function is intended to be used for debugging use only. The following example
  118. -- shows how it can be used together with the g_log() functions.
  119. -- #include <glib.h>
  120. -- static void
  121. -- log_handler (const gchar *log_domain,
  122. -- GLogLevelFlags log_level,
  123. -- const gchar *message,
  124. -- gpointer user_data)
  125. -- {
  126. -- g_log_default_handler (log_domain, log_level, message, user_data);
  127. -- g_on_error_query (MY_PROGRAM_NAME);
  128. -- }
  129. -- int main (int argc, char *argv[])
  130. -- {
  131. -- g_log_set_handler (MY_LOG_DOMAIN,
  132. -- G_LOG_LEVEL_WARNING |
  133. -- G_LOG_LEVEL_ERROR |
  134. -- G_LOG_LEVEL_CRITICAL,
  135. -- log_handler,
  136. -- NULL);
  137. -- /* ... */
  138. -- If [E]xit is selected, the application terminates with a call to _exit(0).
  139. -- If [H]alt is selected, the application enters an infinite loop. The infinite loop
  140. -- can only be stopped by killing the application, or by setting glib_on_error_halt
  141. -- to FALSE (possibly via a debugger).
  142. -- If [S]tack trace is selected, g_on_error_stack_trace() is called. This invokes
  143. -- gdb, which attaches to the current process and shows a stack trace. The prompt is
  144. -- then shown again.
  145. -- If [P]roceed is selected, the function returns.
  146. -- This function may cause different actions on non-UNIX platforms.
  147. -- prg_name : the program name, needed by gdb for the [S]tack trace option. If
  148. -- prg_name is NULL, g_get_prgname() is called to get the program name
  149. -- (which will work correctly if gdk_init() or gtk_init() has been
  150. -- called).
  151. -- ---------------------------------------------------------------------------------
  152. -- g_on_error_stack_trace ()
  153. -- void g_on_error_stack_trace (const gchar *prg_name);
  154. -- Invokes gdb, which attaches to the current process and shows a stack trace.
  155. -- Called by g_on_error_query() when the [S]tack trace option is selected.
  156. -- This function may cause different actions on non-UNIX platforms.
  157. -- prg_name : the program name, needed by gdb for the [S]tack trace option. If
  158. -- prg_name is NULL, g_get_prgname() is called to get the program name
  159. -- (which will work correctly if gdk_init() or gtk_init() has been
  160. -- called).
  161. -- ---------------------------------------------------------------------------------
  162. -- G_BREAKPOINT()
  163. -- #define G_BREAKPOINT()
  164. -- Inserts a breakpoint instruction into the code (on x86 machines only).
  165. end -- class GLIB_WARNINGS_AND_ASSERTIONS