File: map_sym.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 (114 lines) | stat: -rw-r--r-- 3,487 bytes parent folder | download | duplicates (2)
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
108
109
110
111
112
113
114
/****************************************************************
 *								*
 * Copyright (c) 2001-2024 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_stdlib.h"

#include "collseq.h"
#include <rtnhdr.h>
#include "lv_val.h"		/* needed for "fgncal.h" */
#include "fgncal.h"
#include "iosp.h"
#include "io.h"
#include "trans_log_name.h"
#include "error.h"
#include "gtmmsg.h"

#define ERR_FGNSYM				\
{						\
	fgn_closepak(handle, INFO);		\
	return FALSE;				\
}

error_def(ERR_COLLFNMISSING);

/* Maps all the collation related symbols from the act shared library.
 * Return TRUE/FALSE based on mapping success.
 */
boolean_t map_collseq(mstr *fspec, collseq *ret_collseq)
{
	mstr   		fspec_trans;
	char   		buffer[MAX_TRANS_NAME_LEN];
	int    		status;
	void_ptr_t 	handle;
	boolean_t	coll_lib_found;

	static MSTR_CONST(xform_sym_1, "gtm_ac_xform_1");
	static MSTR_CONST(xback_sym_1, "gtm_ac_xback_1");
	static MSTR_CONST(xform_sym, "gtm_ac_xform");
	static MSTR_CONST(xback_sym, "gtm_ac_xback");
	static MSTR_CONST(verify_sym, "gtm_ac_verify");
	static MSTR_CONST(xutil_sym, "gtm_ac_xutil");
	static MSTR_CONST(version_sym, "gtm_ac_version");
	DCL_THREADGBL_ACCESS;

	SETUP_THREADGBL_ACCESS;
	coll_lib_found = FALSE;
	if (SS_NORMAL != (status = TRANS_LOG_NAME(fspec, &fspec_trans, buffer, SIZEOF(buffer), do_sendmsg_on_log2long)))
		return FALSE;
	if (NULL == (handle = fgn_getpak(buffer, INFO)))
		return FALSE;
	if ((ret_collseq->xform = (collseq_xform_fptr_t)fgn_getrtn(handle, &xform_sym_1, SUCCESS)))
	{
		if ((ret_collseq->xback = (collseq_xback_fptr_t)fgn_getrtn(handle, &xback_sym_1, SUCCESS)))
		{
			coll_lib_found = TRUE;
			ret_collseq->argtype = 1;
		} else
		{
			if (!TREF(skip_gtm_putmsg))
			{	/* Warn about the missing routine */
				gtm_putmsg_csa(CSA_ARG(NULL)
					VARLSTCNT(5) ERR_COLLFNMISSING, 3, LEN_AND_LIT("gtm_ac_xback_1()"), ret_collseq->act);
			}
			ERR_FGNSYM;
		}
	}
	if ( FALSE == coll_lib_found)
	{
		if ((ret_collseq->xform = (collseq_xform_fptr_t)fgn_getrtn(handle, &xform_sym, SUCCESS)))
		{
			if ((ret_collseq->xback = (collseq_xback_fptr_t)fgn_getrtn(handle, &xback_sym, SUCCESS)))
			{
				coll_lib_found = TRUE;
				ret_collseq->argtype = 0;
			} else
			{
				if (!TREF(skip_gtm_putmsg))
				{	/* Warn about the missing routine */
					gtm_putmsg_csa(CSA_ARG(NULL)
						VARLSTCNT(5) ERR_COLLFNMISSING, 3, LEN_AND_LIT("gtm_ac_xback()"), ret_collseq->act);
				}
				ERR_FGNSYM;
			}
		} else /* Neither xform_1 or xform is found */
			ERR_FGNSYM;
	}
	assert(TRUE == coll_lib_found);
	if (!(ret_collseq->verify = (collseq_verify_fptr_t)fgn_getrtn(handle, &verify_sym, INFO)))
		ERR_FGNSYM;
	if (!(ret_collseq->version = (collseq_version_fptr_t)fgn_getrtn(handle, &version_sym, INFO)))
		ERR_FGNSYM;

	/*
	 * This is not fatal so don't warn, ERR_FGNSYM or close the dll.
	 * The xutil routine is only needed for the -2/2
	 * zatransform collation functionality.  Other operations do not use it.
	 */
	if (!(ret_collseq->xutil = (collseq_xutil_fptr_t)fgn_getrtn(handle, &xutil_sym, SUCCESS)))
	{
		ret_collseq->xutil = NULL;
	}

	return TRUE;
}