1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
2<HTML>
3<HEAD>
4<META http-equiv="Content-Type" content="text/html; charset=windows-1252">
5<META name="GENERATOR" content="IBM WebSphere Studio Homepage Builder Version 6.5.0.0 for Windows">
6<META http-equiv="Content-Style-Type" content="text/css">
7<LINK rel="stylesheet" type="text/css" href="../../CSS/revolution.css">
8<TITLE>GXSetVerifyCallback</TITLE>
9</HEAD>
10<BODY>
11<H1 align="left">GXSetVerifyCallback</H1>
12<H2>C Specification</H2>
13<DL>
14  <DD>
15  <PRE><CODE>#include &lt;revolution/gx.h&gt;</CODE></PRE>
16  <DD>
17  <PRE><CODE>typedef void (*GXVerifyCallback)(<A href="../Enumerated_Types/GXWarningLevel.html">GXWarningLevel</A> level,
18                                 u32            id,
19                                 char*          msg);
20
21GXVerifyCallback GXSetVerifyCallback( GXVerifyCallback cb );</CODE></PRE>
22</DL>
23<H2>Arguments</H2>
24<DIV align="left">
25<TABLE border="1" cellpadding="3" cellspacing="0.1">
26  <TBODY>
27    <TR>
28<TD width="120" bgcolor="#ffffe8"><CODE><EM><STRONG>cb</STRONG></EM></CODE></TD>
29<TD width="520">pointer to the warning callback function</TD>
30    </TR>
31  </TBODY>
32</TABLE>
33</DIV>
34<H2>Return Values</H2>
35<P>Returns a pointer to a previously set callback function.</P>
36<H2>Description</H2>
37<P>This function installs a callback that is invoked whenever a verify warning is encountered by the GX API (only in debug builds).&nbsp;GX verification is enabled using <a href="GXSetVerifyLevel.html"><code>GXSetVerifyLevel</code></a>.&nbsp;A default callback is installed by <a href="GXInit.html"><code>GXInit</code></a> as shown below:</P>
38<BLOCKQUOTE><CODE>void __GXVerifyDefaultCallback(GXWarningLevel level, <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; u32&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; id, <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; const char*&nbsp;&nbsp; msg)<BR> {<BR> &nbsp;&nbsp;&nbsp; OSReport(&quot;Level %d, Warning $03d: %s\n&quot;, level, id, msg);<BR> }</CODE></BLOCKQUOTE>
39<P>The callback's argument <em><strong><code>id</code></strong></em> is a number unique for each warning.&nbsp;<em><strong><code>Level</code></strong></em> is the level of the warning encountered.&nbsp;Level 1 represents severe warnings, level 2 signifies medium warnings, and level 3 denotes minor warnings.&nbsp;The argument <em><strong><code>msg</code></strong></em> is a pointer to the warning string.&nbsp;Be aware that the warning ID numbers and message strings are subject to change as GX is revised.</P>
40<P><code>id</code> allows for selective printing of warnings based on their frequency.&nbsp;For example, to turn off a particular warning after it has been encountered three times:</P>
41<BLOCKQUOTE><CODE>u32 myWarningCount[GXWARN_MAX];<BR> <BR> void myVerifyCallback(GXWarningLevel level, <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; GXVerifyID &nbsp;&nbsp;&nbsp; id, <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; const char*&nbsp;&nbsp; msg)<BR> {<BR> &nbsp;&nbsp;&nbsp; if (myWarningCount[id] &lt; 3)<BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; OSReport(&quot;Level %d, Warning $03d: %s\n&quot;, level, id, msg);<BR> &nbsp;&nbsp;&nbsp; myWarningCount[id]++;<BR> }</CODE></BLOCKQUOTE>
42<P>By placing a breakpoint in the verify callback function with the debugger, you can ascertain the approximate location in the source code that a warning occurred by examining the stack trace when the breakpoint is encountered.&nbsp;The location is only approximate, because many of the warning conditions are evaluated at <a href="../Geometry/GXBegin.html"><code>GXBegin</code></a>.</P>
43
44
45<H2>See Also</H2>
46<H2>Revision History</H2>
47<P>2006/03/01 Initial version.</P>
48<hr>
49<P>CONFIDENTIAL</p>
50</BODY>
51</HTML>