Mercurial > repos > rhope
view debugmacros.h @ 75:0083b2f7b3c7
Partially working implementation of List. Modified build scripts to allow use of other compilers. Fixed some bugs involving method implementations on different types returning different numbers of outputs. Added Fold to the 'builtins' in the comipler.
author | Mike Pavone <pavone@retrodev.com> |
---|---|
date | Tue, 06 Jul 2010 07:52:59 -0400 |
parents | 76568becd6d6 |
children |
line wrap: on
line source
#ifndef _DEBUGMACROS_H_ #define _DEBUGMACROS_H_ //#define TEXT_FILE_DEBUG 1 #ifdef TEXT_FILE_DEBUG #include <stdio.h> void * debug_malloc(size_t size, char * msg); #define DEBUGPRINTF(format, ...) fprintf(debugfile, format, __VA_ARGS__); fflush(debugfile) #define DEBUGPUTS(string) fputs(string, debugfile); fflush(debugfile) extern FILE * debugfile; #ifdef MALLOC_DEBUG #define MALLOC(size, msg) debug_malloc(size, msg) #define VIS_FREE(ptr, msg) fprintf(debugfile, "free: %X, %s\n", ptr, msg); fflush(debugfile); free(ptr) #else #define MALLOC(size, msg) malloc(size) #define VIS_FREE(ptr, msg) free(ptr) #endif #else #ifdef BOX_DEBUG #define DEBUGPRINTF(format, ...) sprintf(debugbuffer, format, __VA_ARGS__); MessageBox(NULL, debugbuffer, "Debug", MB_OK) #define DEBUGPUTS(string) MessageBox(NULL, string, "Debug", MB_OK) #else #ifdef CONSOLE_DEBUG #include <stdio.h> #define DEBUGPRINTF(format, ...) printf(format, __VA_ARGS__); fflush(stdout); #define DEBUGPUTS(string) fputs(string, stdout); fflush(stdout); #else #define DEBUGPRINTF #define DEBUGPUTS #define MALLOC(size, msg) malloc(size) #define VIS_FREE(ptr, msg) free(ptr) #endif //CONSOLE_DEBUG #endif //BOX_DEBUG #endif //TEXT_FILE_DEBUG #ifdef WIN32 #ifdef GUI_LIB extern char errorbuffer[1024]; #define ERRORPUTS(string) DEBUGPUTS(string); MessageBox(NULL, string, "Rhope Error", MB_OK); #define ERRORPRINTF(format, ...) DEBUGPRINTF(format, __VA_ARGS__); sprintf(errorbuffer, format, __VA_ARGS__); MessageBox(NULL, errorbuffer, "Rhope Error", MB_OK); #else #define ERRORPUTS(string) DEBUGPUTS(string); puts(string)/*fputs(string, stderr);*/ #define ERRORPRINTF(format, ...) DEBUGPRINTF(format, __VA_ARGS__); printf(format, __VA_ARGS__);/* fprintf(stderr, format, __VA_ARGS__); */ #endif #else #if defined(SEGA) | defined(NINTENDO_DS) #define ERRORPUTS(string) DEBUGPUTS(string); puts(string) #define ERRORPRINTF(format, ...) DEBUGPRINTF(format, __VA_ARGS__); printf(format, __VA_ARGS__) #else #define ERRORPUTS(string) DEBUGPUTS(string); fputs(string, stderr) #define ERRORPRINTF(format, ...) DEBUGPRINTF(format, __VA_ARGS__); fprintf(stderr, format, __VA_ARGS__) #endif #endif #endif //_DEBUGMACROS_H_