This is the mail archive of the cygwin@sourceware.cygnus.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Portable code for B19 and B20(.1)


Please tell me there's better way to write code that works both with B19
and B20, and to determine which beta release is being used. I'm using
the header file snippet below, and when I want to call
cygwin[32]_conv_to_posix_path(blah blah), I write
CYGWIN_CONV_TO_POSIX_PATH((blah blah)). [1]  Of course, I haven't
actually _tested_ this under B20...but theoretically it oughta work.

The basic problem is that all the cygwin32_* function calls changed
names to cygwin_*. Okay, I can live with that - as long as my
preprocessor can figure out which beta release is begin used, I can used
the very ugly #defines in the second half of the code snippet below.
However, I'm not at all sure that the first half of the code snippet,
which is trying to determine the beta version, is the right way to do
it.

So, #1) is there some huge thing that I've overlooked that would make
life much simpler, or #2) are there any small tweaks necessary before
this ugly monstrosity will work properly under B20(.1)? - I know it
works under B19.

Chuck Wilson

[1] the doubled parentheses are intentional & necessary.


// B19 - egcs automatically defines CYGWIN32 but not CYGWIN
// B20 - egcs automatically defines both CYGWIN32 and CYGWIN
// Bfuture - (???) defines CYGWIN but not CYGWIN32
#if defined(__CYGWIN32__)
#if !defined(__CYGWIN__)
 #define B19
 #define __CYGWIN__
#else
 #define B20
#endif
#else
#if defined(__CYGWIN__)
 #define B21
#endif
#endif
// Now: use __CYGWIN__ to represent any version
// distinguish using B19, B20, or B21

#if defined(__CYGWIN__)
#ifdef B19
#define CYGWIN_ATTACH_HANDLE_TO_FD(a)
cygwin32_attach_handle_to_fd      a
#define CYGWIN_CONV_TO_FULL_POSIX_PATH(a)
cygwin32_conv_to_full_posix_path  a
#define CYGWIN_CONV_TO_FULL_WIN32_PATH(a)
cygwin32_conv_to_full_win32_path  a
#define CYGWIN_CONV_TO_POSIX_PATH(a)
cygwin32_conv_to_posix_path       a
#define CYGWIN_CONV_TO_WIN32_PATH(a)
cygwin32_conv_to_win32_path       a
#define CYGWIN_DETACH_DLL(a)
cygwin32_detach_dll               a
#define CYGWIN_GETSHARED(a)
cygwin32_getshared                a
#define CYGWIN_INTERNAL(a)
cygwin32_internal                 a
#define CYGWIN_POSIX_PATH_LIST_P(a)
cygwin32_posix_path_list_p        a
#define CYGWIN_POSIX_TO_WIN32_PATH_LIST(a)
cygwin32_posix_to_win32_path_list a
#define CYGWIN_POSIX_TO_WIN32_PATH_LIST_BUF_SIZE(a)
cygwin32_posix_to_win32_path_list_buf_size a
#define CYGWIN_SPLIT_PATH(a)
cygwin32_split_path               a
#define CYGWIN_WIN32_TO_POSIX_PATH_LIST(a)
cygwin32_win32_to_posix_path_list a
#define CYGWIN_WIN32_TO_POSIX_PATH_LIST_BUF_SIZE(a)
cygwin32_win32_to_posix_path_list_buf_size a
#define CYGWIN_WINPID_TO_PID(a)
cygwin32_winpid_to_pid            a
#else
#define CYGWIN_ATTACH_HANDLE_TO_FD(a)
cygwin_attach_handle_to_fd      a
#define CYGWIN_CONV_TO_FULL_POSIX_PATH(a)
cygwin_conv_to_full_posix_path  a
#define CYGWIN_CONV_TO_FULL_WIN32_PATH(a)
cygwin_conv_to_full_win32_path  a
#define CYGWIN_CONV_TO_POSIX_PATH(a)
cygwin_conv_to_posix_path       a
#define CYGWIN_CONV_TO_WIN32_PATH(a)
cygwin_conv_to_win32_path       a
#define CYGWIN_DETACH_DLL(a)
cygwin_detach_dll               a
#define CYGWIN_GETSHARED(a)
cygwin_getshared                a
#define CYGWIN_INTERNAL(a)
cygwin_internal                 a
#define CYGWIN_POSIX_PATH_LIST_P(a)
cygwin_posix_path_list_p        a
#define CYGWIN_POSIX_TO_WIN32_PATH_LIST(a)
cygwin_posix_to_win32_path_list a
#define CYGWIN_POSIX_TO_WIN32_PATH_LIST_BUF_SIZE(a)
cygwin_posix_to_win32_path_list_buf_size a
#define CYGWIN_SPLIT_PATH(a)
cygwin_split_path               a
#define CYGWIN_WIN32_TO_POSIX_PATH_LIST(a)
cygwin_win32_to_posix_path_list a
#define CYGWIN_WIN32_TO_POSIX_PATH_LIST_BUF_SIZE(a)
cygwin_win32_to_posix_path_list_buf_size a
#define CYGWIN_WINPID_TO_PID(a)
cygwin_winpid_to_pid            a
#endif
#endif


-
For help on using this list (especially unsubscribing), send a message to
"gnu-win32-request@cygnus.com" with one line of text: "help".


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]