2012-02-05 11:35:58 -05:00
|
|
|
/****************************************************************
|
|
|
|
* *
|
2024-07-19 11:43:27 -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 "mlkdef.h"
|
|
|
|
#include "zshow.h"
|
|
|
|
#include "cache.h"
|
|
|
|
#include "op.h"
|
|
|
|
|
2012-03-24 14:06:46 -04:00
|
|
|
error_def(ERR_VAREXPECTED);
|
2012-02-05 11:35:58 -05:00
|
|
|
|
|
|
|
void op_indrzshow(mval *s1, mval *s2)
|
|
|
|
{
|
|
|
|
icode_str indir_src;
|
2012-03-24 14:06:46 -04:00
|
|
|
int rval;
|
2012-02-05 11:35:58 -05:00
|
|
|
mstr *obj, object;
|
|
|
|
oprtype v;
|
2012-03-24 14:06:46 -04:00
|
|
|
triple *lvar, *outtype, *r, *src;
|
|
|
|
DCL_THREADGBL_ACCESS;
|
2012-02-05 11:35:58 -05:00
|
|
|
|
2012-03-24 14:06:46 -04:00
|
|
|
SETUP_THREADGBL_ACCESS;
|
2012-02-05 11:35:58 -05:00
|
|
|
MV_FORCE_STR(s2);
|
|
|
|
indir_src.str = s2->str;
|
|
|
|
indir_src.code = indir_zshow;
|
|
|
|
if (NULL == (obj = cache_get(&indir_src)))
|
|
|
|
{
|
2012-03-24 14:06:46 -04:00
|
|
|
obj = &object;
|
2024-07-19 11:43:27 -04:00
|
|
|
comp_init(&s2->str, NULL);
|
2012-02-05 11:35:58 -05:00
|
|
|
src = maketriple(OC_IGETSRC);
|
|
|
|
ins_triple(src);
|
2012-03-24 14:06:46 -04:00
|
|
|
switch(TREF(window_token))
|
2012-02-05 11:35:58 -05:00
|
|
|
{
|
|
|
|
case TK_CIRCUMFLEX:
|
2012-03-24 14:06:46 -04:00
|
|
|
if (EXPR_FAIL != (rval = gvn())) /* NOTE assignment */
|
|
|
|
{
|
|
|
|
r = maketriple(OC_ZSHOW);
|
2012-02-05 11:35:58 -05:00
|
|
|
outtype = newtriple(OC_PARAMETER);
|
|
|
|
r->operand[1] = put_tref(outtype);
|
|
|
|
r->operand[0] = put_tref(src);
|
|
|
|
outtype->operand[0] = put_ilit(ZSHOW_GLOBAL);
|
|
|
|
ins_triple(r);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case TK_IDENT:
|
2012-03-24 14:06:46 -04:00
|
|
|
if (EXPR_FAIL != (rval = lvn(&v, OC_PUTINDX, 0))) /* NOTE assignment */
|
|
|
|
{
|
|
|
|
r = maketriple(OC_ZSHOWLOC);
|
2012-02-05 11:35:58 -05:00
|
|
|
outtype = newtriple(OC_PARAMETER);
|
|
|
|
r->operand[1] = put_tref(outtype);
|
|
|
|
r->operand[0] = put_tref(src);
|
|
|
|
lvar = newtriple(OC_PARAMETER);
|
|
|
|
outtype->operand[1] = put_tref(lvar);
|
|
|
|
lvar->operand[0] = v;
|
|
|
|
outtype->operand[0] = put_ilit(ZSHOW_LOCAL);
|
|
|
|
ins_triple(r);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case TK_ATSIGN:
|
2012-03-24 14:06:46 -04:00
|
|
|
if (EXPR_FAIL != (rval = indirection(&v))) /* NOTE assignment */
|
|
|
|
{
|
|
|
|
r = newtriple(OC_INDRZSHOW);
|
2012-02-05 11:35:58 -05:00
|
|
|
r->operand[0] = put_tref(src);
|
|
|
|
r->operand[1] = v;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
stx_error(ERR_VAREXPECTED);
|
2012-03-24 14:06:46 -04:00
|
|
|
rval = EXPR_FAIL;
|
2012-02-05 11:35:58 -05:00
|
|
|
break;
|
|
|
|
}
|
2024-07-19 11:43:27 -04:00
|
|
|
if (EXPR_FAIL == comp_fini(rval, obj, OC_RET, NULL, NULL, s2->str.len))
|
2012-02-05 11:35:58 -05:00
|
|
|
return;
|
2012-03-24 14:06:46 -04:00
|
|
|
indir_src.str = s2->str;
|
|
|
|
indir_src.code = indir_zshow;
|
|
|
|
cache_put(&indir_src, obj);
|
|
|
|
/* Fall into code activation below */
|
2012-02-05 11:35:58 -05:00
|
|
|
}
|
2024-07-19 11:43:27 -04:00
|
|
|
TREF(ind_source) = s1;
|
2012-02-05 11:35:58 -05:00
|
|
|
comp_indr(obj);
|
|
|
|
return;
|
|
|
|
}
|