File: op_indo2.c

package info (click to toggle)
fis-gtm 6.3-007-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 36,284 kB
  • sloc: ansic: 328,861; asm: 5,182; csh: 5,102; sh: 1,918; awk: 291; makefile: 69; sed: 13
file content (72 lines) | stat: -rwxr-xr-x 2,043 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
/****************************************************************
 *								*
 *	Copyright 2001, 2012 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 "compiler.h"
#include "opcode.h"
#include "op.h"
#include "lv_val.h"
#include "mvalconv.h"
#include "glvn_pool.h"

error_def(ERR_ORDER2);
error_def(ERR_VAREXPECTED);

void	op_indo2(mval *dst, uint4 indx, mval *direct)
{
	glvn_pool_entry	*slot;
	int4		dummy_intval;
	intszofptr_t	n;
	lv_val		*lv;
	mval		*key;
	opctype		oc;
	DCL_THREADGBL_ACCESS;

	SETUP_THREADGBL_ACCESS;
	MV_FORCE_NUM(direct);
	if (!MV_IS_TRUEINT(direct, &dummy_intval) || (direct->m[1] != (1 * MV_BIAS) && direct->m[1] != (-1 * MV_BIAS)))
		rts_error(VARLSTCNT(1) ERR_ORDER2);
	slot = &((TREF(glvn_pool_ptr))->slot[indx]);
	oc = slot->sav_opcode;
	if (OC_SAVLVN == oc)
	{	/* lvn */
		n = --slot->glvn_info.n;
		if (0 == n)
		{	/* lvn name */
			slot->glvn_info.n++;				/* quick restore count so glvnpop works correctly */
			/* like op_fnlvnameo2 */
			if ((1 * MV_BIAS) == direct->m[1])
				op_fnlvname(slot->lvname, FALSE, dst);
			else
				op_fnlvprvname(slot->lvname, dst);
		} else
		{	/* subscripted lv */
			key = (mval *)slot->glvn_info.arg[n];
			lv = op_rfrshlvn(indx, OC_RFRSHLVN);		/* funky opcode prevents UNDEF in rfrlvn */
			slot->glvn_info.n++;				/* quick restore count so glvnpop works correctly */
			/* like op_fnno2 */
			if ((1 * MV_BIAS) == direct->m[1])
				op_fnorder(lv, key, dst);
			else
				op_fnzprevious(lv, key, dst);
		}
	} else if (OC_NOOP != oc)					/* if indirect error blew set up, skip this */
	{	/* gvn */
		op_rfrshgvn(indx, oc);
		/* like op_gvno2 */
		if ((1 * MV_BIAS) == direct->m[1])
			op_gvorder(dst);
		else
			op_zprevious(dst);
	}
	return;
}