qse/lib/awk/run.h

148 lines
3.8 KiB
C
Raw Permalink Normal View History

/*
2012-08-16 03:47:55 +00:00
* $Id$
*
Copyright (c) 2006-2019 Chung, Hyung-Hwan. All rights reserved.
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.
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.
*/
2008-12-21 21:35:07 +00:00
#ifndef _QSE_LIB_AWK_RUN_H_
#define _QSE_LIB_AWK_RUN_H_
2008-12-21 21:35:07 +00:00
enum qse_awk_assop_type_t
{
2008-02-09 03:04:38 +00:00
/* if you change this, you have to change assop_str in tree.c.
* 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, /* **= */
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, /* &= */
QSE_AWK_ASSOP_BXOR, /* ^^= */
2008-12-21 21:35:07 +00:00
QSE_AWK_ASSOP_BOR /* |= */
};
2008-12-21 21:35:07 +00:00
enum qse_awk_binop_type_t
{
/* 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,
2008-12-21 21:35:07 +00:00
QSE_AWK_BINOP_BOR,
QSE_AWK_BINOP_BXOR,
QSE_AWK_BINOP_BAND,
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,
2009-07-18 06:42:02 +00:00
QSE_AWK_BINOP_LS,
QSE_AWK_BINOP_RS,
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,
2008-12-21 21:35:07 +00:00
QSE_AWK_BINOP_CONCAT,
QSE_AWK_BINOP_MA,
QSE_AWK_BINOP_NM
};
2008-12-21 21:35:07 +00:00
enum qse_awk_unrop_type_t
{
/* 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,
QSE_AWK_UNROP_BNOT
};
2008-12-21 21:35:07 +00:00
enum qse_awk_incop_type_t
{
/* 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
};
#if defined(__cplusplus)
extern "C" {
#endif
qse_char_t* qse_awk_rtx_format (
qse_awk_rtx_t* run,
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
);
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
);
#if defined(__cplusplus)
}
#endif
#endif