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 13<H2>Syntax</H2> 14<dl><dd><pre class="construction"> 15#include <revolution/gx.h> 16 17typedef void (*GXVerifyCallback)(<A href="../Enumerated_Types/GXWarningLevel.html">GXWarningLevel</A> level, 18 u32 id, 19 char* msg); 20 21GXVerifyCallback GXSetVerifyCallback( GXVerifyCallback cb ); 22</pre></dd></dl> 23 24<H2>Arguments</H2> 25<TABLE class="arguments" border="1" > 26 <TBODY> 27 <TR> 28<TH>cb</TH> 29<TD>Pointer to the warning callback function.</TD> 30 </TR> 31 </TBODY> 32</TABLE> 33 34<H2>Return Values</H2> 35<P>Returns a pointer to a previously set callback function.</P> 36 37<H2>Description</H2> 38<P>This function installs a callback that is invoked whenever a verify warning is encountered by the GX API (only in debug builds). GX verification is enabled using the <A href="GXSetVerifyLevel.html"><CODE>GXSetVerifyLevel</CODE></A> function. A default callback is installed by the <A href="GXInit.html"><CODE>GXInit</CODE></A> function as shown below.</P> 39<DL><DD><CODE>void __GXVerifyDefaultCallback(GXWarningLevel level, <BR> u32 id, <BR> const char* msg)<BR> {<BR> OSReport("Level %d, Warning $03d: %s\n", level, id, msg);<BR> }</CODE></DD></DL> 40<P>The callback's argument <SPAN class="argument">id</SPAN> is a number unique for each warning. The <SPAN class="argument">level</SPAN> is the level of the warning encountered. Level 1 represents severe warnings, level 2 signifies medium warnings, and level 3 denotes minor warnings. The <SPAN class="argument">msg</SPAN> argument is a pointer to the warning string. Be aware that the warning ID numbers and message strings are subject to change as GX is revised.</P> 41<P><SPAN class="argument">id</SPAN> allows for selective output of warnings based on their frequency. For example, to turn off a particular warning after it has been encountered three times:</P> 42<DL><DD><CODE>u32 myWarningCount[GXWARN_MAX];<BR> <BR> void myVerifyCallback(GXWarningLevel level, <BR> GXVerifyID id, <BR> const char* msg)<BR> {<BR> if (myWarningCount[id] < 3)<BR> OSReport("Level %d, Warning $03d: %s\n", level, id, msg);<BR> myWarningCount[id]++;<BR> }</CODE></DD></DL> 43<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. The location is only approximate, because many of the warning conditions are evaluated in the <A href="../Geometry/GXBegin.html"><CODE>GXBegin</CODE></A> function.</P> 44 45<H2>See Also</H2> 46<P>None.</P> 47 48<H2>Revision History</H2> 49<P> 502006/03/01 Initial version.<br> 51</P> 52 53<hr><p>CONFIDENTIAL</p></body> 54</HTML>