/*
 * Copyright(c) 2019 Jeroen Koekkoek
 *
 * This program and the accompanying materials are made available under the
 * terms of the Eclipse Public License v. 2.0 which is available at
 * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License
 * v. 1.0 which is available at
 * http://www.eclipse.org/org/documents/edl-v10.php.
 *
 * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
 */

/* Template for configed.H based on config.h generated by autotools and
   configed.H generated by configure for mcpp 2.7.2 with unused and unwanted
   definitions left out and tailored for use within Eclipse Cyclone DDS. */

#define TRUE                1
#define FALSE               0
#define DATE                "2008/11"
#define VERSION             "2.7.2"

/* Always build as a library for Eclipse Cyclone DDS. */
#define MCPP_LIB            TRUE


/*
 *      P A R T   1     Configurations for target-operating-system
 *                      and target-compiler.
 */

/* This mcpp configuration is tailored to idlc, meaning that, mcpp normally
   aims to replace the resident C preprocessor and strives for compatibility
   with the compiler toolchain that preprocessor belongs to, but as a
   preprocessor for idlc, different requirements apply. For example, mcpp
   must not search for included files in /usr/include on UNIX systems or
   advertise itself as a C preprocessor. mcpp is also not strictly required
   to define architecture- or platform-specific macros as IDL files are
   compiled to language-specific sources, not machine code. */

/* Define the cpu-specific-macro. */
#define CPU                 "undefined"

/* Define the target system. */
#define SYSTEM              @idlpp_system@

/* Define the target compiler to GNUC to output GCC line directives, which
   are required to construct an include stack. */
#define COMPILER            IDLC
/* __GNUC__ and __GNUC_MINOR__ are required if COMPILER equals GNUC. */
#define COMPILER_EXT        "__GNUC__"
#define COMPILER_EXT_VAL    "0"
#define COMPILER_EXT2       "__GNUC_MINOR__"
#define COMPILER_EXT2_VAL   "0"

/* Define the output line prefix. */
#define LINE_PREFIX         "# "
#define STD_LINE_PREFIX     FALSE    /* Output GCC line directives */

/* Default path to search for included files. */
#define C_INCLUDE_DIR1      "@idlpp_include_dir@"
#ifndef INC_DIR
# define INC_DIR C_INCLUDE_DIR1
#endif

/* Name of environment variable with paths to search for included files. */
#define ENV_C_INCLUDE_DIR   "IDL_INCLUDE_PATH"

#define ONE_PASS            FALSE

#define HAVE_DIGRAPHS       TRUE    /* Output digraphs as it is */

/*
 * Names of the SYSTEM (i.e. target operating system).  This is needed so that
 * cpp can use appropriate filename conventions.
 */
#define SYS_UNKNOWN         0
#define SYS_UNIX            0x1000
#define SYS_LINUX           0x1800  /* (SYS_LINUX & 0xF000) == SYS_UNIX */
#define SYS_FREEBSD         0x1A00  /* (SYS_FREEBSD & 0xF000) == SYS_UNIX */
#define SYS_CYGWIN          0x1C00  /* (SYS_CYGWIN & 0xF000) == SYS_UNIX */
#define SYS_MAC             0x1E00  /* (SYS_MAC & 0xF000) == SYS_UNIX */
#define SYS_WIN             0x7000
#define SYS_WIN32           0x7400  /* (SYS_WIN32 & 0xF000) == SYS_WIN */
#define SYS_MINGW           0x7C00  /* (SYS_MINGW & 0xF000) == SYS_WIN */

/* COMPILER */
#define COMPILER_UNKNOWN    0
#define MSC                 0x7400  /* Microsoft C, Visual C++ */
#define BORLANDC            0x7440  /* Borland C */
#define WIN_SYMANTECC       0x7470  /* Symantec for Windows */
#define LCC                 0x74C0  /* LCC-Win32 */
#define GNUC                0x00E0  /* GNU C (GCC) */
#define IDLC                0xFFFE  /* Eclipse Cyclone DDS IDL Compiler */
#define INDEPENDENT         0xFFFF  /* No target, compiler-independent-build */

#define SYS_FAMILY          (SYSTEM & 0xF000)
#define COMPILER_FAMILY     (COMPILER & 0xF0)
#define HOST_SYS_FAMILY     (HOST_SYSTEM & 0xF000)

/* Default MBCHAR (multi-byte character) encoding.  */
#define EUC_JP          0x10    /* Extended UNIX code of JIS X 0208 */
#define GB2312          0x20    /* EUC-like encoding of Chinese GB 2312-80 */
#define KSC5601         0x30    /* EUC-like encoding of Korean KS C 5601 */
#define SJIS            0x80    /* Shift-JIS encoding of JIS X 0208 */
#define BIGFIVE         0x90    /* Encoding of Taiwanese Big Five */
#define ISO2022_JP      0x100   /* ISO-2022-JP (ISO-2022-JP1) encoding */
#define UTF8            0x1000  /* UTF-8 encoding */

/*
 * CHARBIT, UCHARMAX are respectively CHAR_BIT, UCHAR_MAX of target compiler.
 * CHARBIT should be defined to the number of bits per character.
 * It is needed only for processing of multi-byte character constants.
 * UCHARMAX should be defined to the maximum value of type unsigned char
 * or maximum value of unsigned int which is converted from type (signed)
 * char.
 *
 * LONGMAX      should be defined to the LONG_MAX in <limits.h>.
 * ULONGMAX     should be defined to the ULONG_MAX in <limits.h>.
 */
#include <limits.h>
#define CHARBIT             CHAR_BIT
#define UCHARMAX            UCHAR_MAX
#define USHRTMAX            USHRT_MAX
#define LONGMAX             LONG_MAX
#define ULONGMAX            ULONG_MAX

/*
 * MBCHAR means multi-byte character encoding.
 * MBCHAR means the default encoding, and you can change the encoding by
 *      #pragma MCPP setlocale, -e <encoding> option or environment variable
 *      LC_ALL, LC_CTYPE, LANG.
 * MBCHAR == 0 means not to recognize any multi-byte character encoding.
 */
#define MBCHAR              UTF8

/*
the system name might come in handy within idl for constant expressions or
something so go through the trouble of defining it!
*/
#if     SYS_FAMILY == SYS_UNIX

#define SYSTEM_OLD          "unix"
#define SYSTEM_STD1         "__unix"
#define SYSTEM_STD2         "__unix__"

#if     SYSTEM == SYS_FREEBSD
#define SYSTEM_EXT          "__FreeBSD__"
#define SYSTEM_EXT_VAL      "@idlpp_system_version@"
#endif

#if     SYSTEM == SYS_LINUX
#define SYSTEM_EXT          "__linux"
#define SYSTEM_EXT2         "__linux__"
#endif  /* SYSTEM == SYS_LINUX */

#if     SYSTEM == SYS_MAC   /* Mac OS X */
#define SYSTEM_EXT          "__APPLE__"
#define FNAME_FOLD          TRUE    /* Case-insensitive file-system */
/* Do not define FRAMEWORK[1-2] constants. These directories are added to the
   list of paths to search for include files. */
#endif  /* SYSTEM == SYS_MAC    */

#if     SYSTEM == SYS_CYGWIN
#define SYSTEM_EXT          "__CYGWIN__"
#define SYSTEM_EXT2         "__CYGWIN32__"
#define FNAME_FOLD          TRUE
/* CYGWIN_ROOT_DIRECTORY is used to convert "/cygdrive/x/dir" style of
   absolute path-list, but there must be a better way to retrieve the Cygwin
   installation path, preferably at runtime. */
/* #define CYGWIN_ROOT_DIRECTORY   "c:/path/to/cygwin" */
#endif  /* SYSTEM == SYS_CYGWIN */

#define ENV_SEP             ':'
#ifndef FNAME_FOLD
#define FNAME_FOLD          FALSE
#endif  /* FNAME_FOLD */

        /* SYS_FAMILY == SYS_UNIX */
#elif   SYS_FAMILY == SYS_WIN

/* _WIN32, _WIN64, ... are added automatically by system.c. */

#if     SYSTEM == SYS_MINGW
#define SYSTEM_EXT          "__MINGW__"
#define SYSTEM_EXT2         "__MINGW32__"
/* There must be a more convenient method to determine the MSYS and MinGW
   installation path, preferably at runtime. */
/* #define MSYS_ROOT_DIRECTORY "c:/path/to/msys/1.0" */
/* #define MINGW_DIRECTORY     "c:/path/to/mingw" */
#endif  /* SYSTEM == SYS_MINGW */

#define ENV_SEP             ';'
#define FNAME_FOLD          TRUE

#endif  /* SYS_FAMILY == SYS_WIN */

#ifdef  SYSTEM_EXT
#ifndef SYSTEM_EXT_VAL
#define SYSTEM_EXT_VAL      "1"
#endif
#endif

#ifdef  SYSTEM_EXT2
#ifndef SYSTEM_EXT2_VAL
#define SYSTEM_EXT2_VAL     "1"
#endif
#endif

/*
 * SEARCH_INIT  specifies the default value of 'search_rule' (in system.c).
 *              'search_rule' holds searching rule of #include "header.h" to
 *              search first before searching user specified or system-
 *              specific include directories.
 *              CURRENT means to search the directory relative to "current
 *              directory" which is current at cpp invocation.
 *              SOURCE means to search the directory relative to that of the
 *              source file (i.e. "includer").
 *              (CURRENT & SOURCE) means to search current directory first
 *              source directory next.
 *              'search_rule' is initialized to SEARCH_INIT.
 */
#define CURRENT                     1
#define SOURCE                      2
#define SEARCH_INIT                 SOURCE  /* Include directory relative to source */

#define SJIS_IS_ESCAPE_FREE         TRUE    /* Do not treat SJIS specially */
#define BIGFIVE_IS_ESCAPE_FREE      TRUE    /* Do not treat specially */
#define ISO2022_JP_IS_ESCAPE_FREE   TRUE    /* Do not treat specially */
#define STDC_VERSION                199409L /* Initial value of __STDC_VERSION__ */

/*
 *      P A R T   2     Configurations for host-compiler.
 *
 *      WARNING: In case of HOST_COMPILER differs from COMPILER, you must
 *          edit here and there of this part.
 */

/* Define gcc major version. */
@idlpp_gcc_major_version_define@

/* Define gcc minor version. */
@idlpp_gcc_minor_version_define@

/* Define to 1 if the system has the type `intmax_t'. */
#define HAVE_INTMAX_T       @idlpp_have_intmax_t@

/* Define to 1 if you have the <inttypes.h> header file. */
#define HAVE_INTTYPES_H     @idlpp_have_inttypes_h@

/* Define to 1 if the system has the type `long long'. */
#define HAVE_LONG_LONG      @idlpp_have_long_long@

/* Define to 1 if you have the <stdint.h> header file. */
#define HAVE_STDINT_H       @idlpp_have_stdint_h@

#define LL_FORM             "@idlpp_ll_form@"

/* Define to 1 if you have the `stpcpy' function. */
#define HOST_HAVE_STPCPY    @idlpp_have_stpcpy@

/* Define to 1 if you have the `strlcpy' function. */
#define HOST_HAVE_STRLCPY   @idlpp_have_strlcpy@

/* Define to 1 if you have the `strlcat' function. */
#define HOST_HAVE_STRLCAT   @idlpp_have_strlcat@

/* Define the host system. */
#define HOST_SYSTEM         @idlpp_host_system@

/* Define the host compiler. */
#define HOST_COMPILER       @idlpp_host_compiler@

/* Define the host compiler name. */
#define HOST_CMP_NAME       "@idlpp_host_cmp_name@"

#if HOST_COMPILER == GNUC
# define MCPP_ATTRIBUTE(...) __attribute__(__VA_ARGS__)
# define MCPP_ATTRIBUTE_NORETURN() __attribute__((noreturn))
# if __MINGW32__
#   define MCPP_ATTRIBUTE_FORMAT_PRINTF(string_index, first_to_check) \
      __attribute__ ((format (__MINGW_PRINTF_FORMAT, string_index, first_to_check)))
# else
#   define MCPP_ATTRIBUTE_FORMAT_PRINTF(string_index, first_to_check) \
      __attribute__ ((format (printf, string_index, first_to_check)))
# endif
# define MSC_PRAGMA(...)
#elif HOST_COMPILER == MSC
# define MCPP_ATTRIBUTE(...)
# define MCPP_ATTRIBUTE_NORETURN() __declspec(noreturn)
# define MCPP_ATTRIBUTE_FORMAT_PRINTF(string_index, first_to_check)
# define MSC_PRAGMA(...) __pragma(__VA_ARGS__)
#else
# define MCPP_ATTRIBUTE(...)
# define MCPP_ATTRIBUTE_NORETURN()
# define MCPP_ATTRIBUTE_FORMAT_PRINTF(string_index, first_to_check)
# define MSC_PRAGMA(...)
#endif

/*
 * Declaration of standard library functions and macros.
 */

/* assert() */
#include <assert.h>

/* stdin, stdout, stderr, FILE, NULL, fgets(), fputs() and other functions. */
#include <stdio.h>

/* PATHMAX is the maximum length of path-list on the host system. */
#ifdef PATH_MAX
#define PATHMAX     PATH_MAX        /* POSIX macro */
#else
#define PATHMAX     FILENAME_MAX
#endif

/* islower(), isupper(), toupper(), isdigit(), isxdigit(), iscntrl() */
#include <ctype.h>

/* errno */
#include <errno.h>

#include <string.h>
#include <stdlib.h>
#include <time.h>
#include <setjmp.h>

