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 "toktyp.h"
|
|
|
|
#include "compiler.h"
|
|
|
|
#include "opcode.h"
|
|
|
|
#include "indir_enum.h"
|
|
|
|
#include "advancewindow.h"
|
|
|
|
#include "cache.h"
|
|
|
|
#include "hashtab_objcode.h"
|
|
|
|
#include "op.h"
|
|
|
|
|
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_indfnname(mval *dst, mval *target, mval *depth)
|
|
|
|
{
|
2012-03-24 14:06:46 -04:00
|
|
|
boolean_t gbl;
|
|
|
|
icode_str indir_src;
|
|
|
|
int rval;
|
|
|
|
mstr *obj, object;
|
2012-02-05 11:35:58 -05:00
|
|
|
oprtype v;
|
|
|
|
triple *s, *src;
|
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;
|
|
|
|
if ((TREF(ind_source_sp) >= TREF(ind_source_top)) || (TREF(ind_result_sp) >= TREF(ind_result_top)))
|
|
|
|
rts_error(VARLSTCNT(1) ERR_INDMAXNEST); /* mdbcondition_handler resets ind_result_sp & ind_source_sp */
|
2012-02-05 11:35:58 -05:00
|
|
|
MV_FORCE_STR(target);
|
|
|
|
indir_src.str = target->str;
|
|
|
|
indir_src.code = indir_fnname;
|
2012-03-24 14:06:46 -04:00
|
|
|
if (NULL == (obj = cache_get(&indir_src))) /* NOTE assignment */
|
2012-02-05 11:35:58 -05:00
|
|
|
{
|
2012-03-24 14:06:46 -04:00
|
|
|
obj = &object;
|
2012-02-05 11:35:58 -05:00
|
|
|
gbl = FALSE;
|
|
|
|
comp_init(&target->str);
|
|
|
|
src = newtriple(OC_IGETSRC);
|
|
|
|
s = maketriple(OC_FNNAME);
|
2012-03-24 14:06:46 -04:00
|
|
|
switch (TREF(window_token))
|
2012-02-05 11:35:58 -05:00
|
|
|
{
|
|
|
|
case TK_CIRCUMFLEX:
|
|
|
|
gbl = TRUE;
|
|
|
|
advancewindow();
|
|
|
|
/* caution fall through */
|
|
|
|
case TK_IDENT:
|
2012-03-24 14:06:46 -04:00
|
|
|
if (EXPR_FAIL != (rval = name_glvn(gbl, &s->operand[1]))) /* NOTE assignment */
|
2012-02-05 11:35:58 -05:00
|
|
|
{
|
|
|
|
ins_triple(s);
|
|
|
|
s->operand[0] = put_tref(src);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case TK_ATSIGN:
|
|
|
|
s->opcode = OC_INDFNNAME;
|
2012-03-24 14:06:46 -04:00
|
|
|
if (EXPR_FAIL != (rval = indirection(&(s->operand[0])))) /* NOTE assignment */
|
2012-02-05 11:35:58 -05:00
|
|
|
{
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
v = put_tref(s);
|
2012-03-24 14:06:46 -04:00
|
|
|
if (EXPR_FAIL == comp_fini(rval, obj, OC_IRETMVAL, &v, target->str.len))
|
|
|
|
return;
|
|
|
|
indir_src.str.addr = target->str.addr;
|
|
|
|
cache_put(&indir_src, obj);
|
|
|
|
/* Fall into code activation below */
|
2012-02-05 11:35:58 -05:00
|
|
|
}
|
2012-03-24 14:06:46 -04:00
|
|
|
*(TREF(ind_result_sp))++ = dst;
|
|
|
|
*(TREF(ind_source_sp))++ = depth;
|
|
|
|
comp_indr(obj);
|
|
|
|
return;
|
2012-02-05 11:35:58 -05:00
|
|
|
}
|