Changeset 7973 for trunk/third-party


Ignore:
Timestamp:
Feb 28, 2009, 2:43:37 PM (13 years ago)
Author:
charles
Message:

better configure-time checking for inotify & kqueue.

Location:
trunk/third-party/filewatcher
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/third-party/filewatcher/FileWatcher.cpp

    r7971 r7973  
    1212#if defined(_WIN32)
    1313#       include "FileWatcherWin32.h"
    14 #elif defined(__APPLE_CC__)
     14#elif defined(WITH_KQUEUE) || defined(__APPLE_CC__)
    1515#       include "FileWatcherOSX.h"
    16 #elif defined(__linux__)
     16#elif defined(WITH_INOTIFY) || defined(__linux__)
    1717#       include "FileWatcherLinux.h"
    1818#else
  • trunk/third-party/filewatcher/FileWatcherLinux.cpp

    r7971 r7973  
    88*/
    99
    10 #ifdef __linux__
     10#if defined(WITH_INOTIFY)
    1111
    1212#include "FileWatcherLinux.h"
     
    164164
    165165
    166 #endif//__linux__
     166#endif // WITH_INOTIFY || __linux__
  • trunk/third-party/filewatcher/FileWatcherOSX.cpp

    r7971 r7973  
    88*/
    99
    10 #ifdef __APPLE_CC__
     10#if defined(WITH_KQUEUE) || defined(__APPLE_CC__)
    1111
    1212#include "FileWatcherOSX.h"
     
    130130};//namespace FW
    131131
    132 #endif//__APPLE_CC__
     132#endif // WITH_KQUEUE || __APPLE_CC__
  • trunk/third-party/filewatcher/FileWatcherOSX.h

    r7971 r7973  
    1515#define _FW_FILEWATCHEROSX_H_
    1616#pragma once
    17 
    18 #ifdef __APPLE_CC__
    1917
    2018#include "FileWatcher.h"
     
    7270};//namespace FW
    7371
    74 #endif//__APPLE_CC__
    75 
    7672#endif//_FW_FILEWATCHEROSX_H_
  • trunk/third-party/filewatcher/FileWatcherWin32.h

    r7971 r7973  
    1616#define _FW_FILEWATCHERWIN32_H_
    1717#pragma once
    18 
    19 #ifdef _WIN32
    2018
    2119#include "FileWatcher.h"
     
    6967};//namespace FW
    7068
    71 #endif//_WIN32
    72 
    7369#endif//_FW_FILEWATCHERWIN32_H_
  • trunk/third-party/filewatcher/file-watcher.cpp

    r7971 r7973  
    2222
    2323    public:
    24         CFW_Impl( const char * dir, CFW_ActionCallback * callback, void * callbackData ):
     24        CFW_Impl( const char         * dir,
     25                  CFW_ActionCallback * callback,
     26                  void               * callbackData ):
    2527            myID( myWatcher.addWatch( dir, this ) ),
    2628            myCallback( callback ),
     
    3234            myWatcher.removeWatch( myID );
    3335        }
    34         virtual void handleFileAction( WatchID watchid, const String& dir, const String& filename, FileWatcher::Action action )
     36
     37    public:
     38        virtual void handleFileAction( WatchID                watchid,
     39                                       const String         & dir,
     40                                       const String         & filename,
     41                                       FileWatcher::Action    action )
    3542        {
    36 std::cerr << __FILE__ << ':' << __LINE__ << " dir is " << dir << " filename is " << filename << std::endl;
    37             (*myCallback)( this, dir.c_str(), filename.c_str(), (CFW_Action)action, myCallbackData );
     43            (*myCallback)( this,
     44                           dir.c_str(),
     45                           filename.c_str(),
     46                           (CFW_Action)action,
     47                           myCallbackData );
    3848        }
    3949        void update( )
     
    4353};
    4454
    45 extern "C" CFW_Watch*
    46 cfw_addWatch( const char * directory, CFW_ActionCallback * callback, void * callbackData )
     55extern "C"
    4756{
    48     return new CFW_Impl( directory, callback, callbackData );
     57    CFW_Watch*
     58    cfw_addWatch( const char * directory, CFW_ActionCallback * callback, void * callbackData )
     59    {
     60        return new CFW_Impl( directory, callback, callbackData );
     61    }
     62
     63    void
     64    cfw_removeWatch( CFW_Watch * watch )
     65    {
     66        if( watch != 0 )
     67            delete watch;
     68    }
     69
     70    void
     71    cfw_update( CFW_Watch * watch )
     72    {
     73        if( watch != 0 )
     74            watch->update( );
     75    }
    4976}
    50 
    51 extern "C" void
    52 cfw_removeWatch( CFW_Watch * watch )
    53 {
    54     delete watch;
    55 }
    56 
    57 extern "C" void
    58 cfw_update( CFW_Watch * watch )
    59 {
    60     watch->update( );
    61 }
  • trunk/third-party/filewatcher/file-watcher.h

    r7971 r7973  
    2929typedef struct CFW_Impl CFW_Watch;
    3030
    31 typedef void ( CFW_ActionCallback )( CFW_Watch*, const char * dir, const char * filename, CFW_Action, void * callbackData );
     31typedef void ( CFW_ActionCallback )( CFW_Watch  * watch,
     32                                     const char * dir,
     33                                     const char * filename,
     34                                     CFW_Action   action,
     35                                     void       * callbackData );
    3236
    33 CFW_Watch*  cfw_addWatch    ( const char * directory, CFW_ActionCallback * callback, void * callbackData );
     37CFW_Watch*  cfw_addWatch    ( const char         * directory,
     38                              CFW_ActionCallback * callback,
     39                              void               * callbackData );
    3440
    35 void        cfw_removeWatch ( CFW_Watch * );
     41void        cfw_removeWatch ( CFW_Watch * watch );
    3642
    37 void        cfw_update      ( CFW_Watch * );
     43void        cfw_update      ( CFW_Watch * watch );
    3844
    3945
Note: See TracChangeset for help on using the changeset viewer.