How to eliminate irrelevant conditionals?
Hello,
I am trying to read source code for an editor (Vim, available at sourceforge.net) but I find the plethora of precompiler conditionals very confusing (see code below). Virtually all "portable" source code has this problem. Is there a program that will eliminate the irrelevant (to my configuration) conditional code, yet keep the important stuff (like comments).
Thank you.
p.s. I use the MingW gcc compiler.
Code:
#if defined(MSDOS) || defined(WIN32) || defined(_WIN64)
# include <io.h> /* for close() and dup() */
#endif
#define EXTERN
#include "vim.h"
#ifdef SPAWNO
# include <spawno.h> /* special MSDOS swapping library */
#endif
#ifdef HAVE_FCNTL_H
# include <fcntl.h>
#endif
#ifdef __CYGWIN__
# ifndef WIN32
# include <sys/cygwin.h> /* for cygwin_conv_to_posix_path() */
# endif
# include <limits.h>
#endif
#if defined(UNIX) || defined(VMS)
static int file_owned __ARGS((char *fname));
#endif
static void mainerr __ARGS((int, char_u *));
static void main_msg __ARGS((char *s));
static void usage __ARGS((void));
static int get_number_arg __ARGS((char_u *p, int *idx, int def));
static void main_start_gui __ARGS((void));
#if defined(FEAT_GUI_DIALOG) || defined(FEAT_CON_DIALOG)
static void check_swap_exists_action __ARGS((void));
#endif
#ifdef FEAT_CLIENTSERVER
static void cmdsrv_main __ARGS((int *argc, char **argv, char_u *serverName_arg, char_u **serverStr));
static char_u *serverMakeName __ARGS((char_u *arg, char *cmd));
#endif