Changeset 4832


Ignore:
Timestamp:
Aug 1, 2012, 2:17:25 PM (7 years ago)
Author:
wisk
Message:

add regex feature for win32

Location:
zzuf/trunk
Files:
2 added
8 edited

Legend:

Unmodified
Added
Removed
  • zzuf/trunk/msvc/config.h

    r4809 r4832  
    7979/* #undef HAVE_RECVMSG */
    8080/* #undef HAVE_REGEX_H */
     81#define HAVE_REGEX_H 1
    8182#define HAVE_REOPENFILE 1
    8283/* #undef HAVE_SETENV */
  • zzuf/trunk/msvc/libzzuf.vcxproj

    r4675 r4832  
    110110    <ClInclude Include="..\src\common\random.h" />
    111111    <ClInclude Include="..\src\common\ranges.h" />
     112    <ClInclude Include="..\src\com_regexp.hpp" />
    112113    <ClInclude Include="..\src\libzzuf\debug.h" />
    113114    <ClInclude Include="..\src\libzzuf\lib-load.h" />
     
    122123    <ClCompile Include="..\src\common\random.c" />
    123124    <ClCompile Include="..\src\common\ranges.c" />
     125    <ClCompile Include="..\src\com_regexp.cpp">
     126      <CompileAs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">CompileAsCpp</CompileAs>
     127      <CompileAs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">CompileAsCpp</CompileAs>
     128    </ClCompile>
    124129    <ClCompile Include="..\src\libzzuf\debug.c" />
    125130    <ClCompile Include="..\src\libzzuf\lib-fd.c" />
  • zzuf/trunk/msvc/zzuf.vcxproj

    r4813 r4832  
    9999    <ClInclude Include="..\src\common\random.h" />
    100100    <ClInclude Include="..\src\common\ranges.h" />
     101    <ClInclude Include="..\src\com_regexp.hpp" />
    101102    <ClInclude Include="..\src\md5.h" />
    102103    <ClInclude Include="..\src\myfork.h" />
     
    110111    <ClCompile Include="..\src\common\random.c" />
    111112    <ClCompile Include="..\src\common\ranges.c" />
     113    <ClCompile Include="..\src\com_regexp.cpp">
     114      <CompileAs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">CompileAsCpp</CompileAs>
     115      <CompileAs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">CompileAsCpp</CompileAs>
     116    </ClCompile>
    112117    <ClCompile Include="..\src\md5.c" />
    113118    <ClCompile Include="..\src\myfork.c" />
  • zzuf/trunk/src/common/fd.c

    r4676 r4832  
    2525#include <stdlib.h>
    2626#if defined HAVE_REGEX_H
    27 #   include <regex.h>
     27#   if _WIN32
     28#       include "../com_regexp.hpp"
     29#   else
     30#       include <regex.h>
     31#   endif
    2832#endif
    2933#include <string.h>
     
    201205
    202206    if(has_exclude && regexec(&re_exclude, file, 0, NULL, 0) != REG_NOMATCH)
     207        return 0; /* excluded: ignore */
     208#else
     209    (void)file;
     210#endif
     211
     212    return 1; /* default */
     213}
     214
     215int _zz_mustwatchw(wchar_t const *file)
     216{
     217#if defined HAVE_REGEX_H
     218    if(has_include && regwexec(&re_include, file, 0, NULL, 0) == REG_NOMATCH)
     219        return 0; /* not included: ignore */
     220
     221    if(has_exclude && regwexec(&re_exclude, file, 0, NULL, 0) != REG_NOMATCH)
    203222        return 0; /* excluded: ignore */
    204223#else
  • zzuf/trunk/src/common/fd.h

    r4253 r4832  
    2525
    2626extern int _zz_mustwatch(char const *);
     27extern int _zz_mustwatchw(wchar_t const *);
    2728extern int _zz_iswatched(int);
    2829extern void _zz_register(int);
  • zzuf/trunk/src/libzzuf/lib-win32.c

    r4829 r4832  
    106106
    107107    if(!_zz_ready || _zz_islocked(-1)) return ret;
    108     if (ret != INVALID_HANDLE_VALUE && dwCreationDisposition == OPEN_EXISTING && _zz_mustwatch(lpFileName))
     108    if (ret != INVALID_HANDLE_VALUE && dwCreationDisposition == OPEN_EXISTING && _zz_mustwatchw(lpFileName))
    109109    {
    110110        debug("handle %#08x is registered", ret);
  • zzuf/trunk/src/myfork.c

    r4830 r4832  
    380380    /* insert your breakpoint here to have a chance to attach a debugger to libzzuf.dll */
    381381    ret = ResumeThread(pinfo.hThread);
    382     if(ret < 0)
     382    if(ret == -1)
    383383    {
    384384        TerminateProcess(pinfo.hProcess, -1);
  • zzuf/trunk/src/zzuf.c

    r4829 r4832  
    3030#endif
    3131#if defined HAVE_REGEX_H
    32 #   include <regex.h>
     32#   if _WIN32
     33#       include "com_regexp.hpp"
     34#   else
     35#       include <regex.h>
     36#   endif
    3337#endif
    3438#if defined HAVE_WINSOCK2_H
Note: See TracChangeset for help on using the changeset viewer.