2012-02-05 11:35:58 -05:00
|
|
|
/****************************************************************
|
|
|
|
* *
|
2012-03-24 14:06:46 -04:00
|
|
|
* Copyright 2001, 2011 Fidelity Information Services, Inc *
|
2012-02-05 11:35:58 -05:00
|
|
|
* *
|
|
|
|
* 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. *
|
|
|
|
* *
|
|
|
|
****************************************************************/
|
|
|
|
|
|
|
|
/*** STUB FILE ***/
|
|
|
|
|
|
|
|
#include "mdef.h"
|
|
|
|
#include "gtm_string.h"
|
|
|
|
#include "gtm_stdlib.h"
|
|
|
|
#include "stringpool.h"
|
|
|
|
#include "nametabtyp.h"
|
|
|
|
#include "op.h"
|
|
|
|
#include "namelook.h"
|
|
|
|
#include "mvalconv.h"
|
|
|
|
|
|
|
|
GBLREF spdesc stringpool;
|
|
|
|
|
2012-03-24 14:06:46 -04:00
|
|
|
error_def(ERR_INVSTRLEN);
|
|
|
|
error_def(ERR_BADTRNPARAM);
|
|
|
|
|
|
|
|
#define FULL 3
|
|
|
|
#define LENGTH 4
|
|
|
|
#define NO_ALIAS 6
|
|
|
|
#define TABLE_NAME 8
|
|
|
|
#define TERMINAL 9
|
|
|
|
#define VALUE 10
|
2012-02-05 11:35:58 -05:00
|
|
|
|
|
|
|
static readonly nametabent trnitm_table[] =
|
|
|
|
{
|
2012-03-24 14:06:46 -04:00
|
|
|
{ 11, "ACCESS_MODE"}, { 9, "CONCEALED"},
|
|
|
|
{ 7, "CONFINE"}, { 3, "FUL*"},
|
|
|
|
{ 3, "LEN*"}, { 9, "MAX_INDEX"},
|
|
|
|
{ 8, "NO_ALIAS"}, { 5, "TABLE"},
|
|
|
|
{ 10, "TABLE_NAME"}, { 3, "TER*"},
|
2012-02-05 11:35:58 -05:00
|
|
|
{ 3, "VAL*"}
|
|
|
|
};
|
2012-03-24 14:06:46 -04:00
|
|
|
|
|
|
|
static readonly unsigned char trnitm_index[] =
|
2012-02-05 11:35:58 -05:00
|
|
|
{
|
2012-03-24 14:06:46 -04:00
|
|
|
0, 1, 1, 3, 3, 3, 4, 4, 4, 4, 4, 4, 5,
|
|
|
|
6, 7, 7, 7, 7, 7, 7, 10, 10, 11, 11, 11, 11
|
2012-02-05 11:35:58 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
void op_fnztrnlnm(mval *name, mval *table, int4 ind, mval *mode, mval *case_blind, mval *item, mval *ret)
|
|
|
|
{
|
2012-03-24 14:06:46 -04:00
|
|
|
char buf[MAX_TRANS_NAME_LEN];
|
2012-02-05 11:35:58 -05:00
|
|
|
char *status;
|
|
|
|
int item_code;
|
|
|
|
short retlen;
|
|
|
|
|
|
|
|
MV_FORCE_STR(name);
|
2012-03-24 14:06:46 -04:00
|
|
|
if (name->str.len >= MAX_TRANS_NAME_LEN)
|
|
|
|
rts_error(VARLSTCNT(4) ERR_INVSTRLEN, 2, name->str.len, MAX_TRANS_NAME_LEN - 1);
|
2012-02-05 11:35:58 -05:00
|
|
|
MV_FORCE_STR(item);
|
|
|
|
if (item->str.len)
|
|
|
|
{
|
2012-03-24 14:06:46 -04:00
|
|
|
if ((item_code = namelook(trnitm_index, trnitm_table, item->str.addr, item->str.len)) < 0) /* NOTE assignment */
|
2012-02-05 11:35:58 -05:00
|
|
|
rts_error(VARLSTCNT(4) ERR_BADTRNPARAM,2,item->str.len,item->str.addr);
|
2012-03-24 14:06:46 -04:00
|
|
|
} else
|
2012-02-05 11:35:58 -05:00
|
|
|
item_code = VALUE;
|
2012-03-24 14:06:46 -04:00
|
|
|
ret->mvtype = MV_STR;
|
2012-02-05 11:35:58 -05:00
|
|
|
memcpy(buf, name->str.addr, name->str.len);
|
2012-03-24 14:06:46 -04:00
|
|
|
buf[name->str.len] = 0;
|
2012-02-05 11:35:58 -05:00
|
|
|
status = GETENV(buf);
|
2012-03-24 14:06:46 -04:00
|
|
|
switch (item_code)
|
2012-02-05 11:35:58 -05:00
|
|
|
{
|
2012-03-24 14:06:46 -04:00
|
|
|
case FULL:
|
|
|
|
case VALUE:
|
|
|
|
if (status)
|
|
|
|
{
|
|
|
|
retlen = strlen(status);
|
|
|
|
ENSURE_STP_FREE_SPACE(retlen);
|
|
|
|
ret->str.addr = (char *)stringpool.free;
|
|
|
|
ret->str.len = retlen;
|
|
|
|
memcpy(ret->str.addr, status, retlen);
|
|
|
|
stringpool.free += retlen;
|
|
|
|
} else
|
|
|
|
ret->str.len = 0;
|
|
|
|
break;
|
|
|
|
case LENGTH:
|
|
|
|
if (status)
|
|
|
|
{
|
|
|
|
MV_FORCE_MVAL(ret, STRLEN(status));
|
|
|
|
n2s(ret);
|
|
|
|
} else
|
|
|
|
ret->str.len = 0;
|
|
|
|
break;
|
|
|
|
case NO_ALIAS:
|
|
|
|
case TERMINAL:
|
|
|
|
MV_FORCE_MVAL(ret, ((NO_ALIAS == item_code) || status) ? 1 : 0);
|
2012-02-05 11:35:58 -05:00
|
|
|
n2s(ret);
|
2012-03-24 14:06:46 -04:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
if ((status) && (TABLE_NAME != item_code))
|
|
|
|
{
|
|
|
|
MV_FORCE_MVAL(ret, 0);
|
|
|
|
n2s(ret);
|
|
|
|
} else
|
|
|
|
ret->str.len = 0;
|
2012-02-05 11:35:58 -05:00
|
|
|
}
|
|
|
|
return;
|
|
|
|
}
|