File: f_get1.c

package info (click to toggle)
fis-gtm 6.2-000-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 30,784 kB
  • ctags: 42,554
  • sloc: ansic: 358,483; asm: 4,847; csh: 4,574; sh: 2,261; awk: 200; makefile: 86; sed: 13
file content (70 lines) | stat: -rw-r--r-- 1,737 bytes parent folder | download | duplicates (3)
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
/****************************************************************
 *								*
 *	Copyright 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 "toktyp.h"
#include "opcode.h"
#include "indir_enum.h"
#include "mdq.h"
#include "op.h"
#include "fullbool.h"

error_def(ERR_VAREXPECTED);

int	f_get1(oprtype *a, opctype op)
{
	triple		*oldchain, *r;
	save_se		save_state;
	DCL_THREADGBL_ACCESS;

	SETUP_THREADGBL_ACCESS;
	r = maketriple(OC_NOOP);		/* We'll fill in the opcode later, when we figure out what it is */
	switch (TREF(window_token))
	{
		case TK_IDENT:
			r->opcode = OC_FNGET1;
			if (!lvn(&r->operand[0], OC_SRCHINDX, 0))
				return FALSE;
			break;
		case TK_CIRCUMFLEX:
			r->opcode = OC_FNGVGET1;
			if (!gvn())
				return FALSE;
			break;
		case TK_ATSIGN:
			r->opcode = OC_INDFUN;
			r->operand[1] = put_ilit((mint)indir_get);
			if (SHIFT_SIDE_EFFECTS)
			{	/* with short-circuited booleans move indirect processing to expr_start */
				START_GVBIND_CHAIN(&save_state, oldchain);
				if (!indirection(&r->operand[0]))
				{
					setcurtchain(oldchain);
					return FALSE;
				}
				ins_triple(r);
				PLACE_GVBIND_CHAIN(&save_state, oldchain);
				*a = put_tref(r);
				return TRUE;
			}
			if (!indirection(&(r->operand[0])))
				return FALSE;
			break;
		default:
			stx_error(ERR_VAREXPECTED);
			return FALSE;
	}
	ins_triple(r);
	*a = put_tref(r);
	return TRUE;
}