fis-gtm/sr_port/expr.c

45 lines
1.4 KiB
C
Raw Permalink Normal View History

/****************************************************************
* *
2024-07-19 11:43:27 -04:00
* Copyright 2001, 2012 Fidelity Information Services, Inc *
* *
* This source code contains the intellectual property *
* of its copyright holder(s), and is made available *
* under a license. If you do not know the terms of *
* the license, please stop and do not read further. *
* *
****************************************************************/
#include "mdef.h"
2024-07-19 11:43:27 -04:00
#include "gtm_string.h" /* needed by INCREMENT_EXPR_DEPTH */
#include "compiler.h"
#include "opcode.h"
#include "fullbool.h"
int expr(oprtype *a, int m_type)
{
2024-07-19 11:43:27 -04:00
int rval;
DCL_THREADGBL_ACCESS;
SETUP_THREADGBL_ACCESS;
2024-07-19 11:43:27 -04:00
INCREMENT_EXPR_DEPTH;
if (EXPR_FAIL == (rval = eval_expr(a))) /* NOTE assignment */
{
2024-07-19 11:43:27 -04:00
DECREMENT_EXPR_DEPTH;
return FALSE;
}
coerce(a, (MUMPS_INT == m_type) ? OCT_MINT : OCT_MVAL);
ex_tail(a);
2024-07-19 11:43:27 -04:00
if (TREF(expr_start) != TREF(expr_start_orig) && (OC_NOOP != (TREF(expr_start))->opcode))
{
assert((OC_GVSAVTARG == (TREF(expr_start))->opcode));
2024-07-19 11:43:27 -04:00
if ((OC_GVSAVTARG == (TREF(expr_start))->opcode) && ((GTM_BOOL == TREF(gtm_fullbool)) || !TREF(saw_side_effect)))
{
if ((OC_GVRECTARG != (TREF(curtchain))->exorder.bl->opcode)
2024-07-19 11:43:27 -04:00
|| ((TREF(curtchain))->exorder.bl->operand[0].oprval.tref != TREF(expr_start)))
newtriple(OC_GVRECTARG)->operand[0] = put_tref(TREF(expr_start));
}
}
2024-07-19 11:43:27 -04:00
DECREMENT_EXPR_DEPTH;
return rval;
}