From d61c29265989e6adf6e807ca0a8286abf93a1430 Mon Sep 17 00:00:00 2001 From: hyung-hwan Date: Sun, 21 Jan 2018 04:15:09 +0000 Subject: [PATCH] added qse_floc_t and qse_flocxx_t types --- qse/include/qse/awk/awk.h | 8 +------- qse/include/qse/types.h | 38 ++++++++++++++++++++++++++++++++++++++ qse/include/qse/xli/xli.h | 9 +-------- 3 files changed, 40 insertions(+), 15 deletions(-) diff --git a/qse/include/qse/awk/awk.h b/qse/include/qse/awk/awk.h index 718ee7ce..ddd2c5f0 100644 --- a/qse/include/qse/awk/awk.h +++ b/qse/include/qse/awk/awk.h @@ -121,13 +121,7 @@ typedef struct qse_awk_rtx_t qse_awk_rtx_t; /** * The qse_awk_loc_t type defines a structure to hold location. */ -struct qse_awk_loc_t -{ - const qse_char_t* file; /**< file */ - qse_size_t line; /**< line */ - qse_size_t colm; /**< column */ -}; -typedef struct qse_awk_loc_t qse_awk_loc_t; +typedef qse_floc_t qse_awk_loc_t; /** * The #QSE_AWK_VAL_HDR defines the common header for a value. diff --git a/qse/include/qse/types.h b/qse/include/qse/types.h index b9c10afb..97c98f70 100644 --- a/qse/include/qse/types.h +++ b/qse/include/qse/types.h @@ -734,6 +734,44 @@ struct qse_xptl_t }; typedef struct qse_xptl_t qse_xptl_t; +/** + * The qse_floc_t type defines a structure that can hold a position + * in a file. + */ +struct qse_floc_t +{ + const qse_char_t* file; + qse_size_t line; + qse_size_t colm; +}; +typedef struct qse_floc_t qse_floc_t; + +#if defined(__cplusplus) +struct qse_flocxx_t: qse_floc_t +{ + qse_flocxx_t () + { + this->file = (const qse_char_t*)0 /*QSE_NULL*/; + this->line = 0; + this->colm = 0; + } + + qse_flocxx_t (qse_size_t line, qse_size_t colm) + { + this->file = (const qse_char_t*)0 /*QSE_NULL*/; + this->line = line; + this->colm = colm; + } + + qse_flocxx_t& operator= (const qse_floc_t& floc) + { + this->file = floc.file; + this->line = floc.line; + this->colm = floc.colm; + return *this; + } +}; +#endif typedef struct qse_mmgr_t qse_mmgr_t; diff --git a/qse/include/qse/xli/xli.h b/qse/include/qse/xli/xli.h index 863ca715..e202240e 100644 --- a/qse/include/qse/xli/xli.h +++ b/qse/include/qse/xli/xli.h @@ -334,17 +334,10 @@ struct qse_xli_ecb_t qse_xli_ecb_t* next; }; -typedef struct qse_xli_loc_t qse_xli_loc_t; - /** * The qse_xli_loc_t defines a structure to store location information. */ -struct qse_xli_loc_t -{ - const qse_char_t* file; - qse_size_t line; /**< line */ - qse_size_t colm; /**< column */ -}; +typedef qse_floc_t qse_xli_loc_t; /** * The qse_xli_io_cmd_t type defines I/O command codes. The code indicates