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.cpp

    r121 r123  
    5858int fread(void *ptr, size_t size, size_t nmemb, VirtFILE* f) {return f->Vread(ptr,size,nmemb);}
    5959int fwrite(const void *ptr, size_t size, size_t nmemb, VirtFILE* f) {return f->Vwrite(ptr,size,nmemb);}
     60
     61//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.h
     62#if defined __BORLANDC__ || defined _MSC_VER || defined __CYGWIN__ || defined SHP
     63 #undef feof
     64#endif
     65
     66int feof(VirtFILE* f) {return f->Veof();}
     67
     68//...and then restore the original macro:
    6069#ifdef __BORLANDC__
    61 #undef feof
     70 #define feof(__f)     ((__f)->flags & _F_EOF)
    6271#endif
    6372#ifdef _MSC_VER
    64 #undef feof
     73 #define feof(_stream)     ((_stream)->_flag & _IOEOF)
     74#endif
     75#ifdef __CYGWIN__
     76 #define feof(p)  __sfeof(p)
    6577#endif
    6678#ifdef SHP
    67 #undef feof
     79 restore original macro... if you ever want to compile this code on bada
    6880#endif
    69 int feof(VirtFILE* f) {return f->Veof();}
    70 #ifdef __BORLANDC__
    71 #define feof(__f)     ((__f)->flags & _F_EOF)
    72 #endif
    73 #ifdef _MSC_VER
    74 #define feof(_stream)     ((_stream)->_flag & _IOEOF)
    75 #endif
     81
    7682
    7783int fputc(int c,VirtFILE* f) {return f->Vputc(c);}
     
    95101int closedir(VirtDIR* d) {delete d; return 0;}
    96102dirent* readdir(VirtDIR* d) {return d->Vreaddir();}
     103
Note: See TracChangeset for help on using the changeset viewer.