lwip-contrib-mac/ports/mac/include/arch/macos_debug.h

1 line
1.3 KiB
C

/*
* macos_debug.h
*
*
* Created by Eric Pooch on 2/1/15.
* Copyright 2015 Eric Pooch. All rights reserved.
*
* #include "arch/macos_debug.h" instead of debug.h to take advantage of dialog boxes, etc.
*/
/*
MAC_DIALOG DEF? NO-> LWIP_DEBUGF DEF? NO-> Nothing
YES YES
v v
printf() SER_DEBUG ? -NO-> printf() -> Mac dialog box
v YES
Mac dialog box |-> ser_debug_print() -> Printer port
*/
#define MAC_DIALOG
#undef LWIP_DEBUG
#if defined MAC_DIALOG
#include <stdio.h>
#include "lwip/opt.h"
#endif
/* MAC_DLOGF: Enable modal dialog notices.
* Not for use in timing sensitive portions of code.
* Use MACOS_STATE to send the buffer.
*/
#ifndef MACOS_DEBUG
#define MACOS_DEBUG (LWIP_DBG_ON | LWIP_DBG_LEVEL_WARNING)
#define MACOS_TRACE (LWIP_DBG_OFF | LWIP_DBG_TRACE )
#define MACOS_STATE (LWIP_DBG_ON | LWIP_DBG_STATE | LWIP_DBG_MASK_LEVEL)
#endif
#ifdef MACOS_DIALOG
#define MACOS_DLOGF(debug, message) do { printf message; if (debug & LWIP_DBG_STATE) { fflush(stdout); } } while (0)
#define LWIP_ERROR(message, expression, handler) do { if (!(expression)) { \
MACOS_DLOGF(LWIP_DBG_STATE, ("Error: %s", message)); handler;}} while(0)
#else
#define MACOS_DLOGF(debug, message) LWIP_DEBUGF(debug, message)
#endif /*MAC_DIALOG*/