Oct122012mbedLab
Fork of HTTPClient by
LPC2368/dbg/dbg.h@1:b77740c0a846, 2012-10-12 (annotated)
- Committer:
- psawant9
- Date:
- Fri Oct 12 16:02:09 2012 +0000
- Revision:
- 1:b77740c0a846
- Parent:
- 0:62fac7f06c8d
Done
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
psawant9 | 1:b77740c0a846 | 1 | |
psawant9 | 1:b77740c0a846 | 2 | /* |
psawant9 | 1:b77740c0a846 | 3 | Copyright (c) 2010 Donatien Garnier (donatiengar [at] gmail [dot] com) |
psawant9 | 1:b77740c0a846 | 4 | |
psawant9 | 1:b77740c0a846 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy |
psawant9 | 1:b77740c0a846 | 6 | of this software and associated documentation files (the "Software"), to deal |
psawant9 | 1:b77740c0a846 | 7 | in the Software without restriction, including without limitation the rights |
psawant9 | 1:b77740c0a846 | 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
psawant9 | 1:b77740c0a846 | 9 | copies of the Software, and to permit persons to whom the Software is |
psawant9 | 1:b77740c0a846 | 10 | furnished to do so, subject to the following conditions: |
psawant9 | 1:b77740c0a846 | 11 | |
psawant9 | 1:b77740c0a846 | 12 | The above copyright notice and this permission notice shall be included in |
psawant9 | 1:b77740c0a846 | 13 | all copies or substantial portions of the Software. |
psawant9 | 1:b77740c0a846 | 14 | |
psawant9 | 1:b77740c0a846 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
psawant9 | 1:b77740c0a846 | 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
psawant9 | 1:b77740c0a846 | 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
psawant9 | 1:b77740c0a846 | 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
psawant9 | 1:b77740c0a846 | 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
psawant9 | 1:b77740c0a846 | 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
psawant9 | 1:b77740c0a846 | 21 | THE SOFTWARE. |
psawant9 | 1:b77740c0a846 | 22 | */ |
psawant9 | 1:b77740c0a846 | 23 | |
psawant9 | 1:b77740c0a846 | 24 | /** \file |
psawant9 | 1:b77740c0a846 | 25 | Debugging helpers header file |
psawant9 | 1:b77740c0a846 | 26 | */ |
psawant9 | 1:b77740c0a846 | 27 | |
psawant9 | 1:b77740c0a846 | 28 | //#ifdef DBG_H |
psawant9 | 1:b77740c0a846 | 29 | //#define DBG_H |
psawant9 | 1:b77740c0a846 | 30 | |
psawant9 | 1:b77740c0a846 | 31 | #ifdef __LWIP_DEBUG |
psawant9 | 1:b77740c0a846 | 32 | #define __DEBUG |
psawant9 | 1:b77740c0a846 | 33 | #endif |
psawant9 | 1:b77740c0a846 | 34 | |
psawant9 | 1:b77740c0a846 | 35 | /*! |
psawant9 | 1:b77740c0a846 | 36 | \def __DEBUG |
psawant9 | 1:b77740c0a846 | 37 | To define to enable debugging in one file |
psawant9 | 1:b77740c0a846 | 38 | */ |
psawant9 | 1:b77740c0a846 | 39 | |
psawant9 | 1:b77740c0a846 | 40 | #ifdef __DEBUG |
psawant9 | 1:b77740c0a846 | 41 | |
psawant9 | 1:b77740c0a846 | 42 | #ifndef __DEBUGSTREAM |
psawant9 | 1:b77740c0a846 | 43 | #define __DEBUGSTREAM |
psawant9 | 1:b77740c0a846 | 44 | |
psawant9 | 1:b77740c0a846 | 45 | |
psawant9 | 1:b77740c0a846 | 46 | class DebugStream |
psawant9 | 1:b77740c0a846 | 47 | { |
psawant9 | 1:b77740c0a846 | 48 | public: |
psawant9 | 1:b77740c0a846 | 49 | static void debug(const char* format, ...); |
psawant9 | 1:b77740c0a846 | 50 | static void release(); |
psawant9 | 1:b77740c0a846 | 51 | static void breakPoint(const char* file, int line); |
psawant9 | 1:b77740c0a846 | 52 | private: |
psawant9 | 1:b77740c0a846 | 53 | |
psawant9 | 1:b77740c0a846 | 54 | }; |
psawant9 | 1:b77740c0a846 | 55 | |
psawant9 | 1:b77740c0a846 | 56 | #undef DBG |
psawant9 | 1:b77740c0a846 | 57 | #undef DBG_END |
psawant9 | 1:b77740c0a846 | 58 | #undef BREAK |
psawant9 | 1:b77740c0a846 | 59 | |
psawant9 | 1:b77740c0a846 | 60 | ///Debug output (if enabled), same syntax as printf, with heading info |
psawant9 | 1:b77740c0a846 | 61 | #define DBG(...) do{ DebugStream::debug("[%s:%s@%d] ", __FILE__, __FUNCTION__, __LINE__); DebugStream::debug(__VA_ARGS__); } while(0); |
psawant9 | 1:b77740c0a846 | 62 | |
psawant9 | 1:b77740c0a846 | 63 | ///Debug output (if enabled), same syntax as printf, no heading info |
psawant9 | 1:b77740c0a846 | 64 | #define DBGL(...) do{ DebugStream::debug(__VA_ARGS__); } while(0); |
psawant9 | 1:b77740c0a846 | 65 | #define DBG_END DebugStream::release |
psawant9 | 1:b77740c0a846 | 66 | |
psawant9 | 1:b77740c0a846 | 67 | ///Break point usin serial debug interface (if debug enbaled) |
psawant9 | 1:b77740c0a846 | 68 | #define BREAK() DebugStream::breakPoint(__FILE__, __LINE__) |
psawant9 | 1:b77740c0a846 | 69 | #endif |
psawant9 | 1:b77740c0a846 | 70 | |
psawant9 | 1:b77740c0a846 | 71 | #else |
psawant9 | 1:b77740c0a846 | 72 | #undef DBG |
psawant9 | 1:b77740c0a846 | 73 | #undef DBG_END |
psawant9 | 1:b77740c0a846 | 74 | #undef BREAK |
psawant9 | 1:b77740c0a846 | 75 | #define DBG(...) |
psawant9 | 1:b77740c0a846 | 76 | #define DBG_END() |
psawant9 | 1:b77740c0a846 | 77 | #define BREAK() |
psawant9 | 1:b77740c0a846 | 78 | #endif |
psawant9 | 1:b77740c0a846 | 79 | |
psawant9 | 1:b77740c0a846 | 80 | #ifdef __LWIP_DEBUG |
psawant9 | 1:b77740c0a846 | 81 | #ifndef __SNPRINTF |
psawant9 | 1:b77740c0a846 | 82 | #define __SNPRINTF |
psawant9 | 1:b77740c0a846 | 83 | #include "mbed.h" |
psawant9 | 1:b77740c0a846 | 84 | |
psawant9 | 1:b77740c0a846 | 85 | //int snprintf(char *str, int size, const char *format, ...); |
psawant9 | 1:b77740c0a846 | 86 | #endif |
psawant9 | 1:b77740c0a846 | 87 | #endif |
psawant9 | 1:b77740c0a846 | 88 | |
psawant9 | 1:b77740c0a846 | 89 | #ifdef __LWIP_DEBUG |
psawant9 | 1:b77740c0a846 | 90 | #undef __DEBUG |
psawant9 | 1:b77740c0a846 | 91 | #endif |
psawant9 | 1:b77740c0a846 | 92 | |
psawant9 | 1:b77740c0a846 | 93 | //#endif |
psawant9 | 1:b77740c0a846 | 94 |