/*
    Robot Interface
    (C) 2006 Jason Hunt
    nulluser@gmail.com
    
    File: utility.cpp
*/

#include <windows.h>
#include <stdio.h>
#include "display.h"

CRITICAL_SECTION debug_lock;

/* Add a byte to a buffer */
void append_byte(unsigned char *buffer, unsigned int &index, unsigned char data)
{
    buffer[index++] = data;
}
/* End of append_byte */


void debug_start(void)
{
   InitializeCriticalSection(&debug_lock);   
    
}
    
    
void debug(char *s)
{
//    return;
    add_line(s);
 EnterCriticalSection(&debug_lock); 
    FILE *f = fopen("debug.txt", "at");
    fprintf(f, "%s\n", s);
    fclose(f);
 LeaveCriticalSection(&debug_lock);     
}
    
