libgphoto2 (libgphoto2): libgphoto2_port/libgphoto2_port/gphoto2-port-portability.h Source File

Main Page | Data Structures | Directories | File List | Data Fields | Globals | Related Pages

# gphoto2-port-portability.h

    00001
    00002 /* Windows Portability, but not during WINE compilation (TWAIN mode)
    00003    ------------------------------------------------------------------ */
    00004
    00005 #if defined(WIN32) && !defined(__WINESRC__)
    00006
    00007 #include <windows.h>
    00008 #include <sys/types.h>
    00009 #include <sys/stat.h>
    00010 #include <string.h>
    00011 #include <stdio.h>
    00012 #include <direct.h>
    00013
    00014 #ifdef IOLIBS
    00015 #undef IOLIBS
    00016 #endif
    00017 #define IOLIBS                  "."
    00018 #define strcasecmp              _stricmp
    00019 #define snprintf                _snprintf
    00020
    00021 /* Work-around for readdir() */
    00022 typedef struct {
    00023         HANDLE handle;
    00024         int got_first;
    00025         WIN32_FIND_DATA search;
    00026         char dir[1024];
    00027         char drive[32][2];
    00028         int  drive_count;
    00029         int  drive_index;
    00030 } GPPORTWINDIR;
    00031
    00032 /* Sleep functionality */
    00033 #define GP_SYSTEM_SLEEP(_ms)            Sleep(_ms)
    00034
    00035 /* Directory-oriented functions */
    00036 #define gp_system_dir                   GPPORTWINDIR *
    00037 #define gp_system_dirent                WIN32_FIND_DATA *
    00038 #define gp_system_dir_delim             '\\'
    00039
    00040
    00041 #else
    00042
    00043 /* POSIX Portability
    00044    ------------------------------------------------------------------ */
    00045
    00046 /* yummy. :) */
    00047
    00048 #include <sys/types.h>
    00049 #include <dirent.h>
    00050 #include <sys/param.h>
    00051 #include <sys/stat.h>
    00052 #include <unistd.h>
    00053
    00054 /* Sleep functionality */
    00055 #define GP_SYSTEM_SLEEP(_ms)            usleep((_ms)*1000)
    00056
    00057 /* Directory-oriented functions */
    00058 #define gp_system_dir                   DIR *
    00059 #define gp_system_dirent                struct dirent *
    00060 #ifdef OS2
    00061 #define gp_system_dir_delim             '\\'
    00062 #else
    00063 #define gp_system_dir_delim             '/'
    00064 #endif /* OS2 */
    00065
    00066 #endif /* else */
    00067
    00068 int              gp_system_mkdir        (const char *dirname);
    00069 int              gp_system_rmdir        (const char *dirname);
    00070 gp_system_dir    gp_system_opendir      (const char *dirname);
    00071 gp_system_dirent gp_system_readdir      (gp_system_dir d);
    00072 const char*      gp_system_filename     (gp_system_dirent de);
    00073 int              gp_system_closedir     (gp_system_dir dir);
    00074 int              gp_system_is_file      (const char *filename);
    00075 int              gp_system_is_dir       (const char *dirname);
    00076
    00077 /* end of file */