Changeset 839


Ignore:
Timestamp:
Mar 18, 2011, 10:37:39 PM (14 years ago)
Author:
Dmitry A. Kuminov
Message:

xsystray: Put primitive logging macros to the header to make them accessible in any source.

Location:
trunk/src/3rdparty/os2/xsystray
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/3rdparty/os2/xsystray/apilib/xsystray.c

    r837 r839  
    3232#define XSTAPI_IMPL
    3333#include "xsystray.h"
     34
     35//#define ENABLE_LOG_TO "c:\\xsystray_api.dbg"
    3436
    3537#include "w_xsystray.h"
  • trunk/src/3rdparty/os2/xsystray/plugin/w_xsystray.c

    r837 r839  
    4747#include <string.h>
    4848#include <stdlib.h>
    49 #include <stdarg.h>
    5049
    5150// generic headers
     
    7776#include "shared\center.h"              // public XCenter interfaces
    7877
     78//#define ENABLE_LOG_TO "c:\\xsystray_plugin.dbg"
     79
    7980#include "w_xsystray.h"
    8081
     
    106107#define TTM_UPDATETIPTEXT           (TTM_FIRST + 9)
    107108#define TTM_SHOWTOOLTIPNOW          (TTM_FIRST + 17)
    108 
    109 // primitive debug logging to a file
    110 #if 0
    111 static void __LOG_WORKER(const char *fmt, ...)
    112 {
    113     static FILE *f = NULL;
    114     if (f == NULL)
    115     {
    116         f = fopen("c:\\xsystray.dbg", "a");
    117         setbuf(f, NULL);
    118     }
    119     if (f != NULL)
    120     {
    121         va_list vl;
    122         va_start(vl, fmt);
    123         vfprintf(f, fmt, vl);
    124         va_end(vl);
    125     }
    126 }
    127 #define LOG(m)  do { __LOG_WORKER m; } while(0)
    128 #define LOGF(m) do { __LOG_WORKER("%s: ", __FUNCTION__); __LOG_WORKER m; } while(0)
    129 #else
    130 #define LOG(m)  do {} while (0)
    131 #define LOGF(m) do {} while (0)
    132 #endif
    133109
    134110/* ******************************************************************
  • trunk/src/3rdparty/os2/xsystray/plugin/w_xsystray.h

    r837 r839  
    1919 */
    2020
    21 #ifndef XSYSTRAY_HEADER_INCLUDED
    22 #define XSYSTRAY_HEADER_INCLUDED
     21#ifndef W_XSYSTRAY_HEADER_INCLUDED
     22#define W_XSYSTRAY_HEADER_INCLUDED
     23
     24#include <sys/builtin.h>        // atomics
     25
     26// primitive debug logging to a file (usage: #define ENABLE_LOG_TO "some_file")
     27#ifdef ENABLE_LOG_TO
     28#include <stdio.h>
     29#include <stdarg.h>
     30static void __LOG_WORKER(const char *fmt, ...)
     31{
     32    static FILE *f = NULL;
     33    if (f == NULL)
     34    {
     35        f = fopen(ENABLE_LOG_TO, "a");
     36        setbuf(f, NULL);
     37    }
     38    if (f != NULL)
     39    {
     40        va_list vl;
     41        va_start(vl, fmt);
     42        vfprintf(f, fmt, vl);
     43        va_end(vl);
     44    }
     45}
     46#define LOG(m)  do { __LOG_WORKER m; } while(0)
     47#define LOGF(m) do { __LOG_WORKER("%s: ", __FUNCTION__); __LOG_WORKER m; } while(0)
     48#else
     49#define LOG(m)  do {} while (0)
     50#define LOGF(m) do {} while (0)
     51#endif
    2352
    2453#include "xsystray.h"
    25 
    26 #include <sys/builtin.h>        // atomics
    2754
    2855#define XSYSTRAY_VERSION_MAJOR 0
     
    204231}
    205232
    206 #endif // XSYSTRAY_HEADER_INCLUDED
    207 
    208 
     233#endif // W_XSYSTRAY_HEADER_INCLUDED
     234
     235
Note: See TracChangeset for help on using the changeset viewer.