File: ci_ret_code.c

package info (click to toggle)
fis-gtm 7.1-006-1
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 32,908 kB
  • sloc: ansic: 344,906; asm: 5,184; csh: 4,859; sh: 2,000; awk: 294; makefile: 73; sed: 13
file content (58 lines) | stat: -rw-r--r-- 1,784 bytes parent folder | download | duplicates (7)
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
/****************************************************************
 *								*
 *	Copyright 2001, 2011 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 <rtnhdr.h>
#include "stack_frame.h"
#include "error.h"
#include "gtmci.h"
#include "op.h"
#include "error_trap.h"

GBLREF stack_frame 	*frame_pointer;
GBLREF unsigned char	*msp;
GBLREF int		mumps_status;

/* Routine executed at level 1 (SFF_CI frame) of the current gtm environment
 * to return control from M to gtm_ci(). the longjmp returns control to dm_start
 * which in turn returns to gtm_ci(). */
void ci_ret_code(void)
{
	assert(active_ch->ch == &mdb_condition_handler);
	longjmp(active_ch->jmp, -1);
}

/* Routine executed at level 0 from the bottom-most frame (base frame) of the
   current gtm environment - called when M routine does zgoto 0 */
void ci_ret_code_exit(void)
{
	assert(active_ch->ch == &mdb_condition_handler);
	ci_ret_code_quit();
	mumps_status = 0;
	longjmp(active_ch->jmp, -1);
}

/* Exit from the current Call-in environment */
void ci_ret_code_quit(void)
{
	DCL_THREADGBL_ACCESS;

	SETUP_THREADGBL_ACCESS;
	if (frame_pointer->flags & SFF_CI)
		op_unwind();
	gtmci_isv_restore(); /* restore $ECODE/$STACK of previous level in the nested call-ins */
	op_unwind(); 	/* base frame of this call-in environment */

	(TREF(gtmci_nested_level))--;
	/* restore frame_pointer stored at msp (see base_frame.c) */
	frame_pointer = *(stack_frame**)msp;
	msp += SIZEOF(frame_pointer);
}