added QSE_XLI_JSON and abandoned QSE_XLI_TAGMARKER, QSE_XLI_ARRAYMARKER, and QSE_XLI_ASSIGNWITHCOLON

This commit is contained in:
2018-01-08 08:25:49 +00:00
parent 03cb7dd9dc
commit 6237b43441
12 changed files with 284 additions and 125 deletions

View File

@ -162,6 +162,9 @@ public:
/** data type that can hold any character */
typedef qse_char_t char_t;
/** data type that can hold an unsigned char_t value */
typedef qse_chau_t chau_t;
/** data type that can hold any character or an end-of-file value */
typedef qse_cint_t cint_t;

View File

@ -513,6 +513,11 @@ typedef qse_ssize_t qse_ptrdiff_t;
typedef char qse_mchar_t;
#define QSE_SIZEOF_MCHAR_T QSE_SIZEOF_CHAR
/** \typedef qse_mchau_t
* The qse_mchau_t type defines a type that can hold the unsigned qse_mchar_t value.
*/
typedef unsigned char qse_mchau_t;
/**
* The qse_mcint_t defines a type that can hold a qse_mchar_t value and
* #QSE_MCHAR_EOF.
@ -520,9 +525,13 @@ typedef char qse_mchar_t;
typedef int qse_mcint_t;
#define QSE_SIZEOF_MCINT_T QSE_SIZEOF_INT
/** \typedef qse_wchar_t
* The qse_wchar_t type defines a wide character type.
*/
/** \typedef qse_wchau_t
* The qse_wchau_t type defines a type that can hold the unsigned qse_wchar_t value.
*/
/** \typedef qse_wcint_t
* The qse_wcint_t type defines a type that can hold a qse_wchar_t value and
* #QSE_WCHAR_EOF.
@ -531,62 +540,101 @@ typedef int qse_mcint_t;
/* WATCOM C++ before OpenWatcom */
typedef long char qse_wchar_t;
typedef unsigned long char qse_wchau_t;
typedef long char qse_wcint_t;
#elif defined(__cplusplus) && !( \
(defined(_MSC_VER) && !defined(_NATIVE_WCHAR_T_DEFINED)) || \
(defined(__WATCOMC__) && (__WATCOMC__ < 1200)) || \
defined(_SCO_DS) \
)
(defined(_MSC_VER) && !defined(_NATIVE_WCHAR_T_DEFINED)) || \
(defined(__WATCOMC__) && (__WATCOMC__ < 1200)) || \
defined(_SCO_DS) \
)
/* C++ */
typedef wchar_t qse_wchar_t;
#if (QSE_SIZEOF_WCHAR_T == QSE_SIZEOF_LONG)
typedef unsigned long int qse_wchau_t;
#elif (QSE_SIZEOF_WCHAR_T == QSE_SIZEOF_INT)
typedef unsigned int qse_wchau_t;
#elif (QSE_SIZEOF_WCHAR_T == QSE_SIZEOF_SHORT)
typedef unsigned short int qse_wchau_t;
#else
/* may still be signed, but wchar_t should be large enough that the largest character won't exceed the maximum value of the type */
typedef wchar_t qse_wchau_t;
#endif
typedef wchar_t qse_wcint_t;
/* all the way down from here for C */
#elif defined(__GNUC__) && defined(__WCHAR_TYPE__) && defined(__WINT_TYPE__)
typedef __WCHAR_TYPE__ qse_wchar_t;
#if (defined(__SIZEOF_WCHAR_T) && __SIZEOF_WCHAR_T == QSE_SIZEOF_LONG)
typedef unsigned long int qse_wchau_t;
#elif (defined(__SIZEOF_WCHAR_T) && __SIZEOF_WCHAR_T == QSE_SIZEOF_INT)
typedef unsigned int qse_wchau_t;
#elif (defined(__SIZEOF_WCHAR_T) && __SIZEOF_WCHAR_T == QSE_SIZEOF_SHORT)
typedef unsigned short int qse_wchau_t;
#elif (QSE_SIZEOF_WCHAR_T == QSE_SIZEOF_LONG)
typedef unsigned long int qse_wchau_t;
#elif (QSE_SIZEOF_WCHAR_T == QSE_SIZEOF_INT)
typedef unsigned int qse_wchau_t;
#elif (QSE_SIZEOF_WCHAR_T == QSE_SIZEOF_SHORT)
typedef unsigned short int qse_wchau_t;
#else
/* i can't guarantee the unsignedness */
typedef __WINT_TYPE__ qse_wchau_t;
#endif
typedef __WINT_TYPE__ qse_wcint_t;
#elif (QSE_SIZEOF_WCHAR_T == QSE_SIZEOF_MCHAR_T)
/* most likely, there is no support for wchar_t */
typedef qse_mchar_t qse_wchar_t;
typedef qse_mchau_t qse_wchau_t;
typedef qse_mcint_t qse_wcint_t;
#elif (QSE_SIZEOF_WCHAR_T == 2) || (QSE_SIZEOF_WCHAR_T == 0)
typedef unsigned short qse_wchar_t;
typedef unsigned short qse_wcint_t;
typedef unsigned short int qse_wchar_t;
typedef unsigned short int qse_wchau_t;
typedef unsigned short int qse_wcint_t;
#elif (QSE_SIZEOF_WCHAR_T == 4)
# if defined(vms) || defined(__vms)
typedef unsigned int qse_wchar_t;
typedef int qse_wcint_t;
typedef unsigned int qse_wchau_t;
typedef int qse_wcint_t;
# elif defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__)
typedef int qse_wchar_t;
typedef int qse_wcint_t;
typedef int qse_wchar_t;
typedef unsigned int qse_wchau_t;
typedef int qse_wcint_t;
# elif (defined(sun) || defined(__sun) || defined(__linux))
# if defined(_LP64)
typedef int qse_wchar_t;
typedef int qse_wcint_t;
typedef int qse_wchar_t;
typedef unsigned int qse_wchau_t;
typedef int qse_wcint_t;
# else
typedef long qse_wchar_t;
typedef long qse_wcint_t;
typedef long int qse_wchar_t;
typedef unsigned long int qse_wchau_t;
typedef long int qse_wcint_t;
# endif
# elif defined(__APPLE__) && defined(__MACH__)
typedef int qse_wchar_t;
typedef int qse_wcint_t;
typedef int qse_wchar_t;
typedef unsigned int qse_wchau_t;
typedef int qse_wcint_t;
# elif defined(hpux) || defined(__hpux) || defined(__hpux__)
# if defined(__HP_cc) || defined(__HP_aCC)
typedef unsigned int qse_wchar_t;
# else
typedef int qse_wchar_t;
# endif
typedef int qse_wcint_t;
typedef unsigned int qse_wchau_t;
typedef int qse_wcint_t;
# elif QSE_SIZEOF_LONG == 4
typedef long qse_wchar_t;
typedef long qse_wcint_t;
typedef long int qse_wchar_t;
typedef unsigned long int qse_wchau_t;
typedef long int qse_wcint_t;
# elif QSE_SIZEOF_INT == 4
typedef int qse_wchar_t;
typedef int qse_wcint_t;
typedef int qse_wchar_t;
typedef unsigned int qse_wchau_t;
typedef int qse_wcint_t;
# else
# error No supported data type for wchar_t
# endif
@ -597,15 +645,20 @@ typedef int qse_mcint_t;
/** \typedef qse_char_t
* The qse_char_t type defines a character type.
*/
/** \typedef qse_chau_t
* The qse_chau_t type defines a type that can hold a unsigned qse_char_t value.
*/
/** \typedef qse_cint_t
* The qse_cint_t typep defines a type that can hold a qse_char_t value and
* The qse_cint_t type defines a type that can hold a qse_char_t value and
* #QSE_CHAR_EOF.
*/
#if defined(QSE_CHAR_IS_MCHAR)
typedef qse_mchar_t qse_char_t;
typedef qse_mchau_t qse_chau_t;
typedef qse_mcint_t qse_cint_t;
#elif defined(QSE_CHAR_IS_WCHAR)
typedef qse_wchar_t qse_char_t;
typedef qse_wchau_t qse_chau_t;
typedef qse_wcint_t qse_cint_t;
#else
/* If the character type is not determined in the conf_xxx files */
@ -614,10 +667,12 @@ typedef int qse_mcint_t;
# if defined(UNICODE) || defined(_UNICODE)
# define QSE_CHAR_IS_WCHAR
typedef qse_wchar_t qse_char_t;
typedef qse_wchau_t qse_chau_t;
typedef qse_wcint_t qse_cint_t;
# else
# define QSE_CHAR_IS_MCHAR
typedef qse_mchar_t qse_char_t;
typedef qse_mchau_t qse_chau_t;
typedef qse_mcint_t qse_cint_t;
# endif
# else

View File

@ -66,7 +66,7 @@ enum qse_xli_errnum_t
QSE_XLI_ESYNTAX, /**< syntax error */
QSE_XLI_ESCOLON, /**< semicolon expected in place of '${0}' */
QSE_XLI_EEQ, /**< = expected in place of '${0}' */
QSE_XLI_EASSIGN, /**< = expected in place of '${0}' */
QSE_XLI_ELBREQ, /**< { or = expected in place of '${0}' */
QSE_XLI_ERBRCE, /**< } expected in place of '${0}' */
QSE_XLI_EPAVAL, /**< pair value expected in place of '${0}' */
@ -126,9 +126,7 @@ enum qse_xli_opt_t
* and the second chracter specifies the tag closer. The are used when
* key tags and/or string tags are enabled. By default, it is "[]".
*/
QSE_XLI_TAGMARKER,
QSE_XLI_ARRAYMARKER
QSE_XLI_TAGMARKER
};
typedef enum qse_xli_opt_t qse_xli_opt_t;
@ -158,9 +156,8 @@ enum qse_xli_trait_t
* "tg" is stored into the tag field of qse_xli_str_t. */
QSE_XLI_STRTAG = (1 << 10),
/** use a colon as an assignment character intead of an equal sign.
* it doesn't apply when reading or writing in the ini format. */
QSE_XLI_ASSIGNWITHCOLON = (1 << 11),
/** support the json format */
QSE_XLI_JSON = (1 << 11),
/** enable pair validation against pair definitions while reading */
QSE_XLI_VALIDATE = (1 << 12)
@ -407,9 +404,10 @@ enum qse_xli_scm_flag_t
QSE_XLI_SCM_VALNIL = (1 << 1),
QSE_XLI_SCM_VALSTR = (1 << 2),
QSE_XLI_SCM_VALLIST = (1 << 3),
QSE_XLI_SCM_VALARRAY = (1 << 4),
QSE_XLI_SCM_KEYNODUP = (1 << 4),
QSE_XLI_SCM_KEYALIAS = (1 << 5),
QSE_XLI_SCM_KEYNODUP = (1 << 5),
QSE_XLI_SCM_KEYALIAS = (1 << 6),
/** Indicates that the value is a list with uncertain definitions with
* the following constraints:
@ -420,7 +418,7 @@ enum qse_xli_scm_flag_t
* is specified.
*
* Applies only if #QSE_XLI_SCM_VALLIST is set. */
QSE_XLI_SCM_VALIFFY = (1 << 6)
QSE_XLI_SCM_VALIFFY = (1 << 7)
};
typedef enum qse_xli_scm_flag_t qse_xli_scm_flag_t;