2012-02-05 11:35:58 -05:00
|
|
|
/****************************************************************
|
|
|
|
* *
|
2012-10-29 18:54:31 -04:00
|
|
|
* Copyright 2001, 2012 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_GVNEXTARG);
|
|
|
|
error_def(ERR_LVORDERARG);
|
|
|
|
error_def(ERR_VAREXPECTED);
|
2012-02-05 11:35:58 -05:00
|
|
|
|
2012-03-24 14:06:46 -04:00
|
|
|
int f_next(oprtype *a, opctype op)
|
2012-02-05 11:35:58 -05:00
|
|
|
{
|
2012-03-24 14:06:46 -04:00
|
|
|
triple *oldchain, *ref, *r, tmpchain, *triptr;
|
2012-02-05 11:35:58 -05:00
|
|
|
DCL_THREADGBL_ACCESS;
|
|
|
|
|
|
|
|
SETUP_THREADGBL_ACCESS;
|
|
|
|
r = maketriple(op);
|
2012-03-24 14:06:46 -04:00
|
|
|
switch (TREF(window_token))
|
2012-02-05 11:35:58 -05:00
|
|
|
{
|
|
|
|
case TK_IDENT:
|
2012-03-24 14:06:46 -04:00
|
|
|
if (TK_LPAREN != TREF(director_token))
|
2012-02-05 11:35:58 -05:00
|
|
|
{
|
|
|
|
stx_error(ERR_LVORDERARG);
|
|
|
|
return FALSE;
|
|
|
|
}
|
2012-03-24 14:06:46 -04:00
|
|
|
if (!lvn(&(r->operand[0]), OC_SRCHINDX,r))
|
2012-02-05 11:35:58 -05:00
|
|
|
return FALSE;
|
|
|
|
ins_triple(r);
|
|
|
|
break;
|
|
|
|
case TK_CIRCUMFLEX:
|
2012-03-24 14:06:46 -04:00
|
|
|
ref = TREF(shift_side_effects) ? TREF(expr_start) : (TREF(curtchain))->exorder.bl;
|
2012-02-05 11:35:58 -05:00
|
|
|
if (!gvn())
|
|
|
|
return FALSE;
|
2012-10-29 18:54:31 -04:00
|
|
|
/* the following assumes OC_LIT and OC_GVNAME are all one gets for an unsubscripted global variable reference */
|
2012-03-24 14:06:46 -04:00
|
|
|
if ((TREF(shift_side_effects) ? TREF(expr_start) : TREF(curtchain))->exorder.bl->exorder.bl->exorder.bl == ref)
|
2012-02-05 11:35:58 -05:00
|
|
|
{
|
|
|
|
stx_error(ERR_GVNEXTARG);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
r->opcode = OC_GVNEXT;
|
|
|
|
ins_triple(r);
|
|
|
|
break;
|
|
|
|
case TK_ATSIGN:
|
2012-03-24 14:06:46 -04:00
|
|
|
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
|
|
|
{
|
|
|
|
dqinit(&tmpchain, exorder);
|
|
|
|
oldchain = setcurtchain(&tmpchain);
|
|
|
|
if (!indirection(&(r->operand[0])))
|
|
|
|
{
|
|
|
|
setcurtchain(oldchain);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
r->operand[1] = put_ilit((mint)indir_fnnext);
|
|
|
|
ins_triple(r);
|
|
|
|
newtriple(OC_GVSAVTARG);
|
|
|
|
setcurtchain(oldchain);
|
|
|
|
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_fnnext);
|
|
|
|
ins_triple(r);
|
|
|
|
}
|
|
|
|
r->opcode = OC_INDFUN;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
stx_error(ERR_VAREXPECTED);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
*a = put_tref(r);
|
|
|
|
return TRUE;
|
|
|
|
}
|