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 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146
|
/****************************************************************
* *
* Copyright 2001, 2014 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 "gtm_string.h"
#include "compiler.h"
#include "opcode.h"
#include "toktyp.h"
#include "nametabtyp.h"
#include "job.h"
#include "advancewindow.h"
#include "namelook.h"
#include "mvalconv.h"
/* JOB Parameter tables */
#define JPSDEF(a,b,c) {a, b}
const static readonly nametabent job_param_names[] =
{
#include "jobparamstrs.h"
};
#undef JPSDEF
#define JPSDEF(a,b,c) c
const static readonly jp_type job_param_data[] =
{
#include "jobparamstrs.h" /* BYPASSOK */
};
/* Index is the number of param strings before the character
* For instance index(D) = n(A) + n(B) + n(C) = 2 + 0 + 0 =2
*/
#ifdef UNIX
const static readonly unsigned char job_param_index[27] =
{
/* A(2) B(0) C(2) D(4) E(2) F(0) G(2) H(0) I(4) J(0) K(0) L(2) M(0) */
0, 2, 2, 4, 8, 10, 10, 12, 12, 16, 16, 16, 18,
/* N(6) O(2) P(6) Q(0) R(0) S(6) T(0) U(0) V(0) W(0) X(0) Y(0) Z(0) */
18, 24, 26, 32, 32, 32, 39, 39, 39, 39, 39, 39, 39,
39
};
#else
const static readonly unsigned char job_param_index[27] =
{
0, 2, 2, 2, 6, 8, 8, 10, 10, 14, 14, 14, 16,
16, 22, 24, 28, 28, 28, 34, 34, 34, 34, 34, 34, 34,
34
};
#endif
#undef JPDEF
#define JPDEF(a,b) b
LITDEF jp_datatype job_param_datatypes[] =
{
#include "jobparams.h"
};
/* Maximum length string for any JOB parameter. Length limit
* dictated by having only one byte to represent the string
* length. That translates to 255 characters*/
#define MAXJOBPARSTRLEN 255
error_def(ERR_JOBPARNOVAL);
error_def(ERR_JOBPARNUM);
error_def(ERR_JOBPARSTR);
error_def(ERR_JOBPARTOOLONG);
error_def(ERR_JOBPARUNK);
error_def(ERR_JOBPARVALREQ);
int one_job_param (char **parptr)
{
boolean_t neg;
int x, num;
int len;
DCL_THREADGBL_ACCESS;
SETUP_THREADGBL_ACCESS;
if ((TK_IDENT != TREF(window_token))
|| (0 > (x = (namelook(job_param_index, job_param_names, (TREF(window_ident)).addr, (TREF(window_ident)).len)))))
{ /* NOTE assigment above */
stx_error (ERR_JOBPARUNK);
return FALSE;
}
advancewindow();
*(*parptr)++ = job_param_data[x];
if (job_param_datatypes[job_param_data[x]] != jpdt_nul)
{
if (TK_EQUAL != TREF(window_token))
{
stx_error (ERR_JOBPARVALREQ);
return FALSE;
}
advancewindow ();
switch (job_param_datatypes[job_param_data[x]])
{
case jpdt_num:
neg = FALSE;
if ((TK_MINUS == TREF(window_token)) && (TK_INTLIT == TREF(director_token)))
{
advancewindow();
neg = TRUE;
}
if (TK_INTLIT != TREF(window_token))
{
stx_error (ERR_JOBPARNUM);
return FALSE;
}
num = MV_FORCE_INTD(&(TREF(window_mval)));
*((int4 *)(*parptr)) = (neg ? -num : num);
*parptr += SIZEOF(int4);
break;
case jpdt_str:
if (TK_STRLIT != TREF(window_token))
{
stx_error (ERR_JOBPARSTR);
return FALSE;
}
len = (TREF(window_mval)).str.len;
if (MAXJOBPARSTRLEN < len)
{
stx_error (ERR_JOBPARTOOLONG);
return FALSE;
}
*(*parptr)++ = len;
memcpy(*parptr, (TREF(window_mval)).str.addr, len);
*parptr += len;
break;
default:
assertpro(FALSE && job_param_datatypes[job_param_data[x]]);
}
advancewindow ();
} else if (TK_EQUAL == TREF(window_token))
{
stx_error (ERR_JOBPARNOVAL);
return FALSE;
}
return TRUE;
}
|