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 "cmd.h"
|
|
|
|
#include "toktyp.h"
|
2012-10-29 18:54:31 -04:00
|
|
|
#include <rtnhdr.h>
|
2012-02-05 11:35:58 -05:00
|
|
|
#include "stack_frame.h"
|
|
|
|
#include "opcode.h"
|
|
|
|
#include "indir_enum.h"
|
|
|
|
#include "advancewindow.h"
|
|
|
|
#include "cache.h"
|
|
|
|
#include "hashtab_objcode.h"
|
|
|
|
#include "do_indir_do.h"
|
|
|
|
#include "op.h"
|
|
|
|
|
|
|
|
|
|
|
|
#define INDIR(a, b, c) b
|
|
|
|
UNIX_ONLY(GBLDEF) VMS_ONLY(LITDEF) int (*indir_fcn[])() = {
|
|
|
|
#include "indir.h"
|
|
|
|
};
|
|
|
|
|
|
|
|
GBLREF stack_frame *frame_pointer;
|
|
|
|
GBLREF unsigned short proc_act_type;
|
|
|
|
|
2012-03-24 14:06:46 -04:00
|
|
|
error_def (ERR_INDEXTRACHARS);
|
|
|
|
|
2012-02-05 11:35:58 -05:00
|
|
|
void op_commarg(mval *v, unsigned char argcode)
|
|
|
|
{
|
2012-03-24 14:06:46 -04:00
|
|
|
int rval;
|
2012-02-05 11:35:58 -05:00
|
|
|
icode_str indir_src;
|
2012-03-24 14:06:46 -04:00
|
|
|
mstr *obj, object;
|
|
|
|
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(v);
|
2012-03-24 14:06:46 -04:00
|
|
|
assert((3 <= argcode) && (SIZEOF(indir_fcn) / SIZEOF(indir_fcn[0]) > argcode));
|
2012-02-05 11:35:58 -05:00
|
|
|
indir_src.str = v->str;
|
|
|
|
indir_src.code = argcode;
|
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
|
|
|
if (((indir_do == argcode) || (indir_goto == argcode)) &&
|
2012-03-24 14:06:46 -04:00
|
|
|
(frame_pointer->type & SFT_COUNT) && v->str.len && (MAX_MIDENT_LEN > v->str.len) &&
|
2012-02-05 11:35:58 -05:00
|
|
|
!proc_act_type && do_indir_do(v, argcode))
|
|
|
|
return;
|
|
|
|
comp_init(&v->str);
|
|
|
|
for (;;)
|
|
|
|
{
|
2012-03-24 14:06:46 -04:00
|
|
|
if (EXPR_FAIL == (rval = (*indir_fcn[argcode])())) /* NOTE assignment */
|
2012-02-05 11:35:58 -05:00
|
|
|
break;
|
2012-03-24 14:06:46 -04:00
|
|
|
if (TK_EOL == TREF(window_token))
|
2012-02-05 11:35:58 -05:00
|
|
|
break;
|
2012-03-24 14:06:46 -04:00
|
|
|
if (TK_COMMA == TREF(window_token))
|
2012-02-05 11:35:58 -05:00
|
|
|
advancewindow();
|
|
|
|
else
|
|
|
|
{ /* Allow trailing spaces/comments that we will ignore */
|
2012-03-24 14:06:46 -04:00
|
|
|
while (TK_SPACE == TREF(window_token))
|
2012-02-05 11:35:58 -05:00
|
|
|
advancewindow();
|
2012-03-24 14:06:46 -04:00
|
|
|
if (TK_EOL == TREF(window_token))
|
2012-02-05 11:35:58 -05:00
|
|
|
break;
|
|
|
|
rts_error(VARLSTCNT(1) ERR_INDEXTRACHARS);
|
|
|
|
}
|
|
|
|
}
|
2012-03-24 14:06:46 -04:00
|
|
|
if (EXPR_FAIL == comp_fini(rval, obj, OC_RET, 0, v->str.len))
|
|
|
|
return;
|
|
|
|
indir_src.str.addr = v->str.addr; /* reassign because stp_gcol might have changed v->str.addr */
|
|
|
|
cache_put(&indir_src, obj);
|
2012-02-05 11:35:58 -05:00
|
|
|
}
|
2012-03-24 14:06:46 -04:00
|
|
|
comp_indr(obj);
|
|
|
|
if (indir_linetail == argcode)
|
|
|
|
frame_pointer->type = SFT_COUNT;
|
2012-02-05 11:35:58 -05:00
|
|
|
}
|