File: jobinterrupt_process.c

package info (click to toggle)
fis-gtm 6.3-014-3
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 36,680 kB
  • sloc: ansic: 333,039; asm: 5,180; csh: 4,956; sh: 1,924; awk: 291; makefile: 66; sed: 13
file content (107 lines) | stat: -rw-r--r-- 4,095 bytes parent folder | download
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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
/****************************************************************
 *								*
 * Copyright (c) 2001-2019 Fidelity National Information	*
 * Services, Inc. and/or its subsidiaries. All rights reserved.	*
 *								*
 *	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 "gtm_string.h"

#include "error.h"
#include "indir_enum.h"
#include <rtnhdr.h>
#include "op.h"
#include "stack_frame.h"
#include "error_trap.h"
#include "mv_stent.h"
#include "gtm_stdio.h"
#include "stringpool.h"
#include "jobinterrupt_process.h"
#include "gdsroot.h"
#include "gtm_facility.h"
#include "fileinfo.h"
#include "gdsbt.h"
#include "gdsfhead.h"
#include "filestruct.h"
#include "gdskill.h"
#include "jnl.h"
#include "gdscc.h"
#include "buddy_list.h"
#include "tp.h"
#include "gvname_info.h"
#include "op_merge.h"
#include "zwrite.h"
#include "zshow.h"

GBLREF stack_frame		*frame_pointer, *error_frame;
GBLREF unsigned char		*stackbase, *stacktop, *msp, *stackwarn;
GBLREF spdesc			stringpool;
GBLREF mval			dollar_zinterrupt;
GBLREF boolean_t		dollar_zininterrupt;
GBLREF unsigned short		proc_act_type;
GBLREF mv_stent			*mv_chain;
GBLREF int			dollar_truth;
GBLREF mstr			extnam_str;
GBLREF unsigned char		*restart_pc, *restart_ctxt;
GBLREF dollar_ecode_type	dollar_ecode;
GBLREF dollar_stack_type	dollar_stack;

error_def(ERR_STACKOFLOW);
error_def(ERR_STACKCRIT);

void jobinterrupt_process(void)
{
	mv_stent	*mv_st_ent;

	assert(dollar_zininterrupt);
	/* Compile and push new (counted) frame onto the stack to drive the
	 * $zinterrupt handler.
	 */
	assert((SFT_COUNT | SFT_ZINTR) == proc_act_type);
	op_commarg(&dollar_zinterrupt, indir_linetail);
	frame_pointer->type = proc_act_type;	/* The mark of zorro.. */
	proc_act_type = 0;
	/* Now we need to preserve our current environment. This MVST_ZINTR mv_stent type will hold
	 * the items deemed necessary to preserve. All other items are the user's responsibility.
	 *
	 * Initialize the mv_stent elements processed by stp_gcol which can be called for either the
	 * op_gvsavtarg() or extnam items. This initialization keeps stp_gcol from attempting to
	 * process unset fields with garbage in them as valid mstr address/length pairs.
	 */
	PUSH_MV_STENT(MVST_ZINTR);
	mv_st_ent = mv_chain;
	mv_st_ent->mv_st_cont.mvs_zintr.savtarg.str.len = 0;
	mv_st_ent->mv_st_cont.mvs_zintr.savextref.len = 0;
	mv_st_ent->mv_st_cont.mvs_zintr.saved_dollar_truth = dollar_truth;
	op_gvsavtarg(&mv_st_ent->mv_st_cont.mvs_zintr.savtarg);
	if (extnam_str.len)
	{
		ENSURE_STP_FREE_SPACE(extnam_str.len);
		mv_st_ent->mv_st_cont.mvs_zintr.savextref.addr = (char *)stringpool.free;
		memcpy(mv_st_ent->mv_st_cont.mvs_zintr.savextref.addr, extnam_str.addr, extnam_str.len);
		stringpool.free += extnam_str.len;
		assert(stringpool.free <= stringpool.top);
	}
	mv_st_ent->mv_st_cont.mvs_zintr.savextref.len = extnam_str.len;
	/* save/restore $ECODE/$STACK over this invocation */
	mv_st_ent->mv_st_cont.mvs_zintr.error_frame_save = error_frame;
	memcpy(&mv_st_ent->mv_st_cont.mvs_zintr.dollar_ecode_save, &dollar_ecode, SIZEOF(dollar_ecode));
	memcpy(&mv_st_ent->mv_st_cont.mvs_zintr.dollar_stack_save, &dollar_stack, SIZEOF(dollar_stack));
	NULLIFY_ERROR_FRAME;
	ecode_init();
	/* If we interrupted a Merge, ZWrite, or ZShow, save the state info in an mv_stent that will be restored when this
	 * interrupt frame returns. Note that at this time, return from an interrupt does not "return" to the interrupt
	 * point but rather restarts the line of M code we were running *OR* at the most recent save point (set by
	 * op_restartpc or equivalent). In the future this is likely to change, at least for an interrupted Merge, ZWrite
	 * or ZShow command, so this save/restore is appropriate both now (to let these nest at all) and especially in the future.
	 */
	PUSH_MVST_MRGZWRSV_IF_NEEDED;
	return;
}