2012-02-05 11:35:58 -05:00
|
|
|
/****************************************************************
|
|
|
|
* *
|
2012-03-24 14:06:46 -04:00
|
|
|
* Copyright 2001, 2011 Fidelity Information Services, Inc *
|
2012-02-05 11:35:58 -05:00
|
|
|
* *
|
|
|
|
* 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"
|
|
|
|
#include "compiler.h"
|
|
|
|
#include "opcode.h"
|
|
|
|
#include "indir_enum.h"
|
|
|
|
#include "toktyp.h"
|
|
|
|
#include "mdq.h"
|
2012-03-24 14:06:46 -04:00
|
|
|
#include "fullbool.h"
|
2012-02-05 11:35:58 -05:00
|
|
|
|
2012-03-24 14:06:46 -04:00
|
|
|
error_def (ERR_VAREXPECTED);
|
2012-02-05 11:35:58 -05:00
|
|
|
|
2012-03-24 14:06:46 -04:00
|
|
|
int f_query(oprtype *a, opctype op)
|
2012-02-05 11:35:58 -05:00
|
|
|
{
|
2012-03-24 14:06:46 -04:00
|
|
|
triple *oldchain, *r, *r0, *r1, tmpchain, *triptr;
|
2012-02-05 11:35:58 -05:00
|
|
|
DCL_THREADGBL_ACCESS;
|
|
|
|
|
|
|
|
SETUP_THREADGBL_ACCESS;
|
2012-03-24 14:06:46 -04:00
|
|
|
if (TK_IDENT == TREF(window_token))
|
2012-02-05 11:35:58 -05:00
|
|
|
{
|
2012-03-24 14:06:46 -04:00
|
|
|
if (!lvn(a, OC_FNQUERY, 0))
|
2012-02-05 11:35:58 -05:00
|
|
|
return FALSE;
|
2012-03-24 14:06:46 -04:00
|
|
|
assert(TRIP_REF == a->oprclass);
|
|
|
|
if (OC_FNQUERY == a->oprval.tref->opcode)
|
2012-02-05 11:35:58 -05:00
|
|
|
{
|
2012-03-24 14:06:46 -04:00
|
|
|
assert(OC_FNQUERY == a->oprval.tref->opcode);
|
|
|
|
assert(TRIP_REF == a->oprval.tref->operand[0].oprclass);
|
|
|
|
assert(OC_ILIT == a->oprval.tref->operand[0].oprval.tref->opcode);
|
|
|
|
assert(ILIT_REF == a->oprval.tref->operand[0].oprval.tref->operand[0].oprclass);
|
|
|
|
assert(0 < a->oprval.tref->operand[0].oprval.tref->operand[0].oprval.ilit);
|
2012-02-05 11:35:58 -05:00
|
|
|
a->oprval.tref->operand[0].oprval.tref->operand[0].oprval.ilit += 2;
|
2012-03-24 14:06:46 -04:00
|
|
|
assert(TRIP_REF == a->oprval.tref->operand[1].oprclass);
|
|
|
|
assert(OC_PARAMETER == a->oprval.tref->operand[1].oprval.tref->opcode);
|
|
|
|
assert(TRIP_REF == a->oprval.tref->operand[1].oprval.tref->operand[0].oprclass);
|
2012-02-05 11:35:58 -05:00
|
|
|
r0 = a->oprval.tref->operand[1].oprval.tref->operand[0].oprval.tref;
|
2012-03-24 14:06:46 -04:00
|
|
|
assert(OC_VAR == r0->opcode);
|
|
|
|
assert(MVAR_REF == r0->operand[0].oprclass);
|
|
|
|
r1 = maketriple(OC_PARAMETER);
|
2012-02-05 11:35:58 -05:00
|
|
|
r1->operand[0] = put_str(r0->operand[0].oprval.vref->mvname.addr, r0->operand[0].oprval.vref->mvname.len);
|
|
|
|
r1->operand[1] = a->oprval.tref->operand[1];
|
|
|
|
a->oprval.tref->operand[1] = put_tref (r1);
|
|
|
|
dqins (a->oprval.tref->exorder.fl, exorder, r1);
|
|
|
|
} else
|
|
|
|
{
|
2012-03-24 14:06:46 -04:00
|
|
|
assert(OC_VAR == a->oprval.tref->opcode);
|
|
|
|
r0 = newtriple(OC_FNQUERY);
|
2012-02-05 11:35:58 -05:00
|
|
|
r0->operand[0] = put_ilit (3);
|
2012-03-24 14:06:46 -04:00
|
|
|
r0->operand[1] = put_tref(newtriple(OC_PARAMETER));
|
2012-02-05 11:35:58 -05:00
|
|
|
r0->operand[1].oprval.tref->operand[0] = put_str(a->oprval.tref->operand[0].oprval.vref->mvname.addr,
|
|
|
|
a->oprval.tref->operand[0].oprval.vref->mvname.len);
|
|
|
|
r1 = r0->operand[1].oprval.tref;
|
|
|
|
r1->operand[1] = *a;
|
|
|
|
*a = put_tref (r0);
|
|
|
|
}
|
|
|
|
} else
|
|
|
|
{
|
|
|
|
r = maketriple(op);
|
2012-03-24 14:06:46 -04:00
|
|
|
switch (TREF(window_token))
|
2012-02-05 11:35:58 -05:00
|
|
|
{
|
2012-03-24 14:06:46 -04:00
|
|
|
case TK_CIRCUMFLEX:
|
|
|
|
if (!gvn())
|
|
|
|
return FALSE;
|
|
|
|
r->opcode = OC_GVQUERY;
|
|
|
|
ins_triple(r);
|
|
|
|
break;
|
|
|
|
case TK_ATSIGN:
|
|
|
|
TREF(saw_side_effect) = TREF(shift_side_effects);
|
|
|
|
if (TREF(shift_side_effects) && (GTM_BOOL == TREF(gtm_fullbool)))
|
2012-02-05 11:35:58 -05:00
|
|
|
{
|
2012-03-24 14:06:46 -04:00
|
|
|
dqinit(&tmpchain, exorder);
|
|
|
|
oldchain = setcurtchain(&tmpchain);
|
|
|
|
if (!indirection(&(r->operand[0])))
|
|
|
|
{
|
|
|
|
setcurtchain(oldchain);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
r->operand[1] = put_ilit((mint)indir_fnquery);
|
|
|
|
ins_triple(r);
|
|
|
|
newtriple(OC_GVSAVTARG);
|
2012-02-05 11:35:58 -05:00
|
|
|
setcurtchain(oldchain);
|
2012-03-24 14:06:46 -04:00
|
|
|
dqadd(TREF(expr_start), &tmpchain, exorder);
|
|
|
|
TREF(expr_start) = tmpchain.exorder.bl;
|
|
|
|
triptr = newtriple(OC_GVRECTARG);
|
|
|
|
triptr->operand[0] = put_tref(TREF(expr_start));
|
|
|
|
} else
|
|
|
|
{
|
|
|
|
if (!indirection(&(r->operand[0])))
|
|
|
|
return FALSE;
|
|
|
|
r->operand[1] = put_ilit((mint)indir_fnquery);
|
|
|
|
ins_triple(r);
|
2012-02-05 11:35:58 -05:00
|
|
|
}
|
2012-03-24 14:06:46 -04:00
|
|
|
r->opcode = OC_INDFUN;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
stx_error(ERR_VAREXPECTED);
|
|
|
|
return FALSE;
|
2012-02-05 11:35:58 -05:00
|
|
|
}
|
|
|
|
*a = put_tref(r);
|
|
|
|
}
|
|
|
|
return TRUE;
|
|
|
|
}
|