2007-05-02 01:07:00 +00:00
|
|
|
/*
|
2012-08-16 03:47:55 +00:00
|
|
|
* $Id$
|
2007-05-02 01:07:00 +00:00
|
|
|
*
|
2019-06-06 05:28:23 +00:00
|
|
|
Copyright (c) 2006-2019 Chung, Hyung-Hwan. All rights reserved.
|
2008-12-30 04:49:25 +00:00
|
|
|
|
2014-11-19 14:42:24 +00:00
|
|
|
Redistribution and use in source and binary forms, with or without
|
|
|
|
modification, are permitted provided that the following conditions
|
|
|
|
are met:
|
|
|
|
1. Redistributions of source code must retain the above copyright
|
|
|
|
notice, this list of conditions and the following disclaimer.
|
|
|
|
2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
notice, this list of conditions and the following disclaimer in the
|
|
|
|
documentation and/or other materials provided with the distribution.
|
2008-12-30 04:49:25 +00:00
|
|
|
|
2014-11-19 14:42:24 +00:00
|
|
|
THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR
|
|
|
|
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
|
|
|
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
|
|
|
IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
|
|
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
|
|
|
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
|
|
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
|
|
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
|
|
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
|
|
|
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
2007-05-02 01:07:00 +00:00
|
|
|
*/
|
|
|
|
|
2008-12-21 21:35:07 +00:00
|
|
|
#ifndef _QSE_LIB_AWK_RUN_H_
|
|
|
|
#define _QSE_LIB_AWK_RUN_H_
|
2007-05-02 01:07:00 +00:00
|
|
|
|
2008-12-21 21:35:07 +00:00
|
|
|
enum qse_awk_assop_type_t
|
2007-05-02 01:07:00 +00:00
|
|
|
{
|
2008-02-09 03:04:38 +00:00
|
|
|
/* if you change this, you have to change assop_str in tree.c.
|
2012-10-25 14:38:27 +00:00
|
|
|
* synchronize it wit:
|
|
|
|
* - binop_func in eval_assignment of run.c
|
|
|
|
* - assop in assing_to_opcode of parse.c
|
|
|
|
* - TOK_XXX_ASSN in tok_t in parse.c
|
|
|
|
* - assop_str in tree.c
|
|
|
|
*/
|
2008-12-21 21:35:07 +00:00
|
|
|
QSE_AWK_ASSOP_NONE,
|
|
|
|
QSE_AWK_ASSOP_PLUS, /* += */
|
|
|
|
QSE_AWK_ASSOP_MINUS, /* -= */
|
|
|
|
QSE_AWK_ASSOP_MUL, /* *= */
|
|
|
|
QSE_AWK_ASSOP_DIV, /* /= */
|
|
|
|
QSE_AWK_ASSOP_IDIV, /* //= */
|
|
|
|
QSE_AWK_ASSOP_MOD, /* %= */
|
|
|
|
QSE_AWK_ASSOP_EXP, /* **= */
|
2011-08-16 07:52:48 +00:00
|
|
|
QSE_AWK_ASSOP_CONCAT, /* %%= */
|
2009-07-18 06:42:02 +00:00
|
|
|
QSE_AWK_ASSOP_RS, /* >>= */
|
|
|
|
QSE_AWK_ASSOP_LS, /* <<= */
|
2008-12-21 21:35:07 +00:00
|
|
|
QSE_AWK_ASSOP_BAND, /* &= */
|
2012-10-25 14:38:27 +00:00
|
|
|
QSE_AWK_ASSOP_BXOR, /* ^^= */
|
2008-12-21 21:35:07 +00:00
|
|
|
QSE_AWK_ASSOP_BOR /* |= */
|
2007-05-02 01:07:00 +00:00
|
|
|
};
|
|
|
|
|
2008-12-21 21:35:07 +00:00
|
|
|
enum qse_awk_binop_type_t
|
2007-05-02 01:07:00 +00:00
|
|
|
{
|
|
|
|
/* if you change this, you have to change
|
2008-02-09 03:04:38 +00:00
|
|
|
* binop_str in tree.c and binop_func in run.c accordingly. */
|
2008-12-21 21:35:07 +00:00
|
|
|
QSE_AWK_BINOP_LOR,
|
|
|
|
QSE_AWK_BINOP_LAND,
|
|
|
|
QSE_AWK_BINOP_IN,
|
2007-05-02 01:07:00 +00:00
|
|
|
|
2008-12-21 21:35:07 +00:00
|
|
|
QSE_AWK_BINOP_BOR,
|
|
|
|
QSE_AWK_BINOP_BXOR,
|
|
|
|
QSE_AWK_BINOP_BAND,
|
2007-05-02 01:07:00 +00:00
|
|
|
|
2012-10-25 14:38:27 +00:00
|
|
|
QSE_AWK_BINOP_TEQ,
|
|
|
|
QSE_AWK_BINOP_TNE,
|
2008-12-21 21:35:07 +00:00
|
|
|
QSE_AWK_BINOP_EQ,
|
|
|
|
QSE_AWK_BINOP_NE,
|
|
|
|
QSE_AWK_BINOP_GT,
|
|
|
|
QSE_AWK_BINOP_GE,
|
|
|
|
QSE_AWK_BINOP_LT,
|
|
|
|
QSE_AWK_BINOP_LE,
|
2007-05-02 01:07:00 +00:00
|
|
|
|
2009-07-18 06:42:02 +00:00
|
|
|
QSE_AWK_BINOP_LS,
|
|
|
|
QSE_AWK_BINOP_RS,
|
2007-05-02 01:07:00 +00:00
|
|
|
|
2008-12-21 21:35:07 +00:00
|
|
|
QSE_AWK_BINOP_PLUS,
|
|
|
|
QSE_AWK_BINOP_MINUS,
|
|
|
|
QSE_AWK_BINOP_MUL,
|
|
|
|
QSE_AWK_BINOP_DIV,
|
|
|
|
QSE_AWK_BINOP_IDIV,
|
|
|
|
QSE_AWK_BINOP_MOD,
|
|
|
|
QSE_AWK_BINOP_EXP,
|
2007-05-02 01:07:00 +00:00
|
|
|
|
2008-12-21 21:35:07 +00:00
|
|
|
QSE_AWK_BINOP_CONCAT,
|
|
|
|
QSE_AWK_BINOP_MA,
|
|
|
|
QSE_AWK_BINOP_NM
|
2007-05-02 01:07:00 +00:00
|
|
|
};
|
|
|
|
|
2008-12-21 21:35:07 +00:00
|
|
|
enum qse_awk_unrop_type_t
|
2007-05-02 01:07:00 +00:00
|
|
|
{
|
|
|
|
/* if you change this, you have to change
|
|
|
|
* __unrop_str in tree.c accordingly. */
|
2008-12-21 21:35:07 +00:00
|
|
|
QSE_AWK_UNROP_PLUS,
|
|
|
|
QSE_AWK_UNROP_MINUS,
|
|
|
|
QSE_AWK_UNROP_LNOT,
|
2019-04-26 18:04:57 +00:00
|
|
|
QSE_AWK_UNROP_BNOT
|
2007-05-02 01:07:00 +00:00
|
|
|
};
|
|
|
|
|
2008-12-21 21:35:07 +00:00
|
|
|
enum qse_awk_incop_type_t
|
2007-05-02 01:07:00 +00:00
|
|
|
{
|
|
|
|
/* if you change this, you have to change
|
|
|
|
* __incop_str in tree.c accordingly. */
|
2008-12-21 21:35:07 +00:00
|
|
|
QSE_AWK_INCOP_PLUS,
|
|
|
|
QSE_AWK_INCOP_MINUS
|
2007-05-02 01:07:00 +00:00
|
|
|
};
|
|
|
|
|
2014-11-14 02:44:20 +00:00
|
|
|
#if defined(__cplusplus)
|
2007-05-02 01:07:00 +00:00
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2009-02-15 03:14:49 +00:00
|
|
|
qse_char_t* qse_awk_rtx_format (
|
2009-01-31 04:31:40 +00:00
|
|
|
qse_awk_rtx_t* run,
|
2009-01-23 04:40:57 +00:00
|
|
|
qse_str_t* out,
|
|
|
|
qse_str_t* fbu,
|
|
|
|
const qse_char_t* fmt,
|
|
|
|
qse_size_t fmt_len,
|
|
|
|
qse_size_t nargs_on_stack,
|
|
|
|
qse_awk_nde_t* args,
|
|
|
|
qse_size_t* len
|
|
|
|
);
|
2007-05-02 01:07:00 +00:00
|
|
|
|
2019-04-21 15:54:49 +00:00
|
|
|
qse_mchar_t* qse_awk_rtx_formatmbs (
|
|
|
|
qse_awk_rtx_t* run,
|
|
|
|
qse_mbs_t* out,
|
|
|
|
qse_mbs_t* fbu,
|
|
|
|
const qse_mchar_t* fmt,
|
|
|
|
qse_size_t fmt_len,
|
|
|
|
qse_size_t nargs_on_stack,
|
|
|
|
qse_awk_nde_t* args,
|
|
|
|
qse_size_t* len
|
|
|
|
);
|
|
|
|
|
2019-05-02 13:45:24 +00:00
|
|
|
int qse_awk_rtx_cmpval (
|
|
|
|
qse_awk_rtx_t* rtx,
|
|
|
|
qse_awk_val_t* left,
|
|
|
|
qse_awk_val_t* right,
|
|
|
|
int* ret
|
|
|
|
);
|
|
|
|
|
2014-11-14 02:44:20 +00:00
|
|
|
#if defined(__cplusplus)
|
2007-05-02 01:07:00 +00:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif
|