/* #include this code into your C risc_os program
 * and call it when you want to display anything
 * Handy..
 * Written by Richard H Heywood
 */

#include <string.h>
#include <stdlib.h>
#include <stdio.h>

void debug(int line_number, char *message)
{
  /* if the values passed to this make no sense then
   * it will just return quietly */
  
  char buffer[60];
  char help[46];

  if (line_number < 1  ||  line_number > 6)
    return;          /* sorry - no such line */

  /* copy only the first 45 bytes of the message */

  memcpy(help, message, 45);
  help[45] = 0;

  sprintf(buffer, "set line%1i$debug %s", line_number, help);
  system(buffer);
  system("set change$debug 1");
}


void debug_int(int line_number, char *message, int number)
{ 
  /* same as above, only prints out an int as well */
  char buffer[60];
                  
  message[45] = 0;
  sprintf(buffer, "%s %i", message, number);
  debug(line_number, buffer);
}

