2012-02-05 11:35:58 -05:00
|
|
|
/****************************************************************
|
|
|
|
* *
|
|
|
|
* Copyright 2001, 2011 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"
|
|
|
|
|
|
|
|
#include "lv_val.h"
|
|
|
|
#include "toktyp.h"
|
|
|
|
#include "compiler.h"
|
|
|
|
#include "opcode.h"
|
|
|
|
#include "indir_enum.h"
|
|
|
|
#include "cache.h"
|
|
|
|
#include "op.h"
|
2012-10-29 18:54:31 -04:00
|
|
|
#include <rtnhdr.h>
|
2012-02-05 11:35:58 -05:00
|
|
|
#include "valid_mname.h"
|
|
|
|
|
|
|
|
GBLREF symval *curr_symval;
|
2012-03-24 14:06:46 -04:00
|
|
|
|
|
|
|
error_def(ERR_INDMAXNEST);
|
|
|
|
error_def(ERR_VAREXPECTED);
|
2012-02-05 11:35:58 -05:00
|
|
|
|
|
|
|
void op_indset(mval *target, mval *value)
|
|
|
|
{
|
|
|
|
char new;
|
2012-03-24 14:06:46 -04:00
|
|
|
ht_ent_mname *tabent;
|
2012-02-05 11:35:58 -05:00
|
|
|
icode_str indir_src;
|
2012-03-24 14:06:46 -04:00
|
|
|
int rval;
|
|
|
|
mstr *obj, object;
|
|
|
|
oprtype v;
|
|
|
|
triple *s, *src;
|
2012-02-05 11:35:58 -05:00
|
|
|
var_tabent targ_key;
|
2012-03-24 14:06:46 -04:00
|
|
|
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_DEFINED(value);
|
|
|
|
MV_FORCE_STR(target);
|
|
|
|
indir_src.str = target->str;
|
|
|
|
indir_src.code = indir_set;
|
|
|
|
if (NULL == (obj = cache_get(&indir_src)))
|
|
|
|
{
|
|
|
|
if (valid_mname(&target->str))
|
|
|
|
{
|
|
|
|
targ_key.var_name = target->str;
|
|
|
|
COMPUTE_HASH_MNAME(&targ_key);
|
|
|
|
targ_key.marked = FALSE;
|
|
|
|
if (add_hashtab_mname_symval(&curr_symval->h_symtab, &targ_key, NULL, &tabent))
|
|
|
|
lv_newname(tabent, curr_symval);
|
|
|
|
((lv_val *)tabent->value)->v = *value;
|
|
|
|
return;
|
|
|
|
}
|
2012-03-24 14:06:46 -04:00
|
|
|
if (TREF(ind_source_sp) >= TREF(ind_source_top))
|
|
|
|
rts_error(VARLSTCNT(1) ERR_INDMAXNEST); /* mdbcondition_handler resets ind_source_sp */
|
|
|
|
obj = &object;
|
2012-02-05 11:35:58 -05:00
|
|
|
comp_init(&target->str);
|
|
|
|
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_IDENT:
|
2012-03-24 14:06:46 -04:00
|
|
|
if (EXPR_FAIL != (rval = lvn(&v, OC_PUTINDX, 0))) /* NOTE assignment */
|
2012-02-05 11:35:58 -05:00
|
|
|
{
|
|
|
|
s = maketriple(OC_STO);
|
|
|
|
s->operand[0] = v;
|
|
|
|
s->operand[1] = put_tref(src);
|
|
|
|
ins_triple(s);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case TK_CIRCUMFLEX:
|
2012-03-24 14:06:46 -04:00
|
|
|
if (EXPR_FAIL != (rval = gvn())) /* NOTE assignment */
|
2012-02-05 11:35:58 -05:00
|
|
|
{
|
|
|
|
s = maketriple(OC_GVPUT);
|
|
|
|
s->operand[0] = put_tref(src);
|
|
|
|
ins_triple(s);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case TK_ATSIGN:
|
2012-03-24 14:06:46 -04:00
|
|
|
if (EXPR_FAIL != (rval = indirection(&v))) /* NOTE assignment */
|
2012-02-05 11:35:58 -05:00
|
|
|
{
|
|
|
|
s = maketriple(OC_INDSET);
|
|
|
|
s->operand[0] = v;
|
|
|
|
s->operand[1] = put_tref(src);
|
|
|
|
ins_triple(s);
|
|
|
|
}
|
|
|
|
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;
|
|
|
|
}
|
2012-03-24 14:06:46 -04:00
|
|
|
if (EXPR_FAIL == comp_fini(rval, obj, OC_RET, 0, target->str.len))
|
|
|
|
return;
|
|
|
|
indir_src.str.addr = target->str.addr;
|
|
|
|
cache_put(&indir_src, obj);
|
|
|
|
/* Fall into code activation below */
|
|
|
|
} else if (TREF(ind_source_sp) >= TREF(ind_source_top))
|
|
|
|
rts_error(VARLSTCNT(1) ERR_INDMAXNEST); /* mdbcondition_handler resets ind_source_sp */
|
|
|
|
*(TREF(ind_source_sp))++ = value;
|
|
|
|
comp_indr(obj);
|
2012-02-05 11:35:58 -05:00
|
|
|
}
|