Ignore:
Timestamp:
02/10/14 17:08:23 (11 years ago)
Author:
sz
Message:

Cygwin compatibility

File:
1 edited

Legend:

Unmodified
Added
Removed
  • cpp/frams/virtfile/virtfile.h

    r121 r123  
    7070DLLEXP int fread(void *ptr, size_t size, size_t nmemb, VirtFILE* f);
    7171DLLEXP int fwrite(const void *ptr, size_t size, size_t nmemb, VirtFILE* f);
     72
     73
     74//for some systems, we need to #undef feof which is unfortunately defined as a macro... we have to #undef just to be able to define our own function with this name. Same in virtfile.cpp
     75#if defined __BORLANDC__ || defined _MSC_VER || defined __CYGWIN__ || defined SHP
     76 #undef feof
     77#endif
     78 
     79DLLEXP int feof(VirtFILE* f);// {return f->Veof();}
     80
     81//...and then restore the original macro:
    7282#ifdef __BORLANDC__
    73 #undef feof
     83 #define feof(__f)     ((__f)->flags & _F_EOF)
    7484#endif
    7585#ifdef _MSC_VER
    76 #undef feof
     86 #define feof(_stream)     ((_stream)->_flag & _IOEOF)
     87#endif
     88#ifdef __CYGWIN__
     89 #define feof(p)  __sfeof(p)
    7790#endif
    7891#ifdef SHP
    79 #undef feof //not sure if this is OK since feof() is not defined below for bada, but it won't compile without this #undef. Same in virtfile.cpp
     92 restore original macro... if you ever want to compile this code on bada
    8093#endif
    81 DLLEXP int feof(VirtFILE* f);// {return f->Veof();}
    82 #ifdef __BORLANDC__
    83 #define feof(__f)     ((__f)->flags & _F_EOF)
    84 #endif
    85 #ifdef _MSC_VER
    86 #define feof(_stream)     ((_stream)->_flag & _IOEOF)
    87 #endif
     94
    8895
    8996DLLEXP int fputc(int c,VirtFILE* f);
Note: See TracChangeset for help on using the changeset viewer.