home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the 3D Game Programming Gurus / gurus.iso / Articles / XtremeDebugging / monlist5.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  1996-04-10  |  2.0 KB  |  74 lines

  1.  
  2. // INCLUDES /////////////////////////////////////////////////////////////////
  3.  
  4. #define WIN32_LEAN_AND_MEAN  // make sure certain headers are included correctly
  5. #include <windows.h>         // include the standard windows stuff
  6. #include <windowsx.h>        // include the 32 bit stuff
  7. #include <conio.h>
  8. #include <stdlib.h>
  9. #include <malloc.h>
  10. #include <string.h>
  11. #include <stdio.h>
  12. #include <math.h>
  13. #include <io.h>
  14. #include "mono.h"
  15.  
  16. // MAIN //////////////////////////////////////////////////////////////////////////
  17.  
  18. void main(void)
  19. {
  20. // variables used to watch, one of each type
  21.  
  22. char            c    =0;
  23. UCHAR            uc    =0;
  24. short            s    =0;
  25. USHORT            us    =0;
  26. int                i    =0;
  27. unsigned int    ui    =0;
  28. char            string[]="Game Developer";
  29. float            f    =(float)0.0;
  30. int                *ptr= (int *)&i;
  31.  
  32. mono_print debug;    // create an instance of a debugger port
  33.  
  34. // clear the debugging display
  35. debug.clear();
  36.  
  37. // first create watches, note that we simply send the address of each variable cast to void *
  38.     
  39. debug.add_watch("char c",(void *)&c,MONO_WATCH_CHAR                    ,0,0,16);    
  40. debug.add_watch("unsigned char uc",(void *)&uc,MONO_WATCH_UCHAR        ,0,1,16);
  41. debug.add_watch("short s",(void *)&s,MONO_WATCH_SHORT                ,0,2,16);
  42. debug.add_watch("unsigned short us",(void *)&us,MONO_WATCH_USHORT    ,0,3,16);
  43. debug.add_watch("int i",(void *)&i,MONO_WATCH_INT                    ,0,4,16);
  44. debug.add_watch("unsigned int ui",(void *)&ui,MONO_WATCH_UINT        ,0,5,16);
  45. debug.add_watch("string ASCII",(void *)string,MONO_WATCH_STRING        ,0,6,16);
  46. debug.add_watch("string HEX",(void *)string,MONO_WATCH_STRING_HEX    ,0,7,16);
  47. debug.add_watch("float f",(void *)&f,MONO_WATCH_FLOAT                ,0,8,16);
  48. debug.add_watch("ptr",(void *)&ptr,MONO_WATCH_PTR                    ,0,9,16);
  49.  
  50. // enter main loop
  51.  
  52. while(!kbhit())
  53.     {
  54.     // update the watch display with current data     
  55.     debug.update_watches();
  56.  
  57.     // update watch variables each cycle
  58.  
  59.     c++;
  60.     uc++;
  61.     s++;
  62.     us++;
  63.     i++;
  64.     ui++;
  65.     f=f+(float)0.1;
  66.     ptr++;
  67.     
  68.     // wait a sec
  69.     Sleep(200);
  70.  
  71.     } // while
  72.  
  73. } // end main
  74.