176bb8030Smahlzeit /* 2b5553049Smahlzeit * Debug macros for the Midi Kit 3b5553049Smahlzeit * 476bb8030Smahlzeit * Copyright (c) 2002-2003 Matthijs Hollemans 5*263f2c60Smahlzeit * 6*263f2c60Smahlzeit * Permission is hereby granted, free of charge, to any person obtaining a 7*263f2c60Smahlzeit * copy of this software and associated documentation files (the "Software"), 8*263f2c60Smahlzeit * to deal in the Software without restriction, including without limitation 9*263f2c60Smahlzeit * the rights to use, copy, modify, merge, publish, distribute, sublicense, 10*263f2c60Smahlzeit * and/or sell copies of the Software, and to permit persons to whom the 11*263f2c60Smahlzeit * Software is furnished to do so, subject to the following conditions: 12*263f2c60Smahlzeit * 13*263f2c60Smahlzeit * The above copyright notice and this permission notice shall be included in 14*263f2c60Smahlzeit * all copies or substantial portions of the Software. 15*263f2c60Smahlzeit * 16*263f2c60Smahlzeit * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17*263f2c60Smahlzeit * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18*263f2c60Smahlzeit * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19*263f2c60Smahlzeit * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20*263f2c60Smahlzeit * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 21*263f2c60Smahlzeit * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 22*263f2c60Smahlzeit * DEALINGS IN THE SOFTWARE. 23b5553049Smahlzeit */ 24e913fbc1Smahlzeit 25e913fbc1Smahlzeit #ifndef MIDI_DEBUG_H 26e913fbc1Smahlzeit #define MIDI_DEBUG_H 27e913fbc1Smahlzeit 281df1f394Smahlzeit #include <OS.h> 29e913fbc1Smahlzeit #include <stdio.h> 30e913fbc1Smahlzeit 311df1f394Smahlzeit #define WARN(args) { fprintf(stderr, "[midi] WARNING: %s\n", args); } 321df1f394Smahlzeit #define UNIMPLEMENTED { fprintf(stderr, "[midi] UNIMPLEMENTED %s\n",__PRETTY_FUNCTION__); } 33e913fbc1Smahlzeit 341df1f394Smahlzeit #ifdef DEBUG 351df1f394Smahlzeit 361df1f394Smahlzeit #define TRACE(args) { printf("[midi] "); printf args; printf("\n"); } 371df1f394Smahlzeit 381df1f394Smahlzeit #define ASSERT(expr) \ 391df1f394Smahlzeit if (!(expr))\ 401df1f394Smahlzeit {\ 411df1f394Smahlzeit char buf[1024];\ 421df1f394Smahlzeit sprintf(\ 431df1f394Smahlzeit buf, "%s(%d) : Assertion \"%s\" failed!",\ 441df1f394Smahlzeit __FILE__, __LINE__, #expr);\ 451df1f394Smahlzeit debugger(buf);\ 461df1f394Smahlzeit }\ 47e913fbc1Smahlzeit 48e913fbc1Smahlzeit #else 49e913fbc1Smahlzeit 50e913fbc1Smahlzeit #define TRACE(args) 511df1f394Smahlzeit #define ASSERT(expr) 52e913fbc1Smahlzeit 53e913fbc1Smahlzeit #endif 54e913fbc1Smahlzeit 55e913fbc1Smahlzeit #endif // MIDI_DEBUG_H 56