home *** CD-ROM | disk | FTP | other *** search
/ ARM Club 1 / ARM_CLUB_CD.iso / contents / apps / program / d / debug / !Debug / debugger < prev    next >
Encoding:
Text File  |  1991-05-07  |  940 b   |  43 lines

  1. /* #include this code into your C risc_os program
  2.  * and call it when you want to display anything
  3.  * Handy..
  4.  * Written by Richard H Heywood
  5.  */
  6.  
  7. #include <string.h>
  8. #include <stdlib.h>
  9. #include <stdio.h>
  10.  
  11. void debug(int line_number, char *message)
  12. {
  13.   /* if the values passed to this make no sense then
  14.    * it will just return quietly */
  15.   
  16.   char buffer[60];
  17.   char help[46];
  18.  
  19.   if (line_number < 1  ||  line_number > 6)
  20.     return;          /* sorry - no such line */
  21.  
  22.   /* copy only the first 45 bytes of the message */
  23.  
  24.   memcpy(help, message, 45);
  25.   help[45] = 0;
  26.  
  27.   sprintf(buffer, "set line%1i$debug %s", line_number, help);
  28.   system(buffer);
  29.   system("set change$debug 1");
  30. }
  31.  
  32.  
  33. void debug_int(int line_number, char *message, int number)
  34.   /* same as above, only prints out an int as well */
  35.   char buffer[60];
  36.                   
  37.   message[45] = 0;
  38.   sprintf(buffer, "%s %i", message, number);
  39.   debug(line_number, buffer);
  40. }
  41.  
  42.