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
|
/****************************************************************
* *
* Copyright (c) 2001-2020 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 "compiler.h"
#include "toktyp.h"
#include "advancewindow.h"
#include "op.h"
#include "opcode.h"
#include "gtm_utf8.h"
#include "mdq.h"
GBLREF boolean_t gtm_utf8_mode;
int f_ascii(oprtype *a, opctype op)
{
triple *r;
mval tmp_mval;
DCL_THREADGBL_ACCESS;
SETUP_THREADGBL_ACCESS;
r = maketriple(op);
if (EXPR_FAIL == expr(&(r->operand[0]), MUMPS_STR))
return FALSE;
if (TK_COMMA != TREF(window_token))
r->operand[1] = put_ilit(1);
else
{
advancewindow();
if (EXPR_FAIL == expr(&(r->operand[1]), MUMPS_INT))
return FALSE;
}
if ((OC_LIT == r->operand[0].oprval.tref->opcode)
&& (OC_ILIT == r->operand[1].oprval.tref->opcode)
&& (!gtm_utf8_mode || valid_utf_string(&r->operand[0].oprval.tref->operand[0].oprval.mlit->v.str)))
{
if (OC_FNASCII == r->opcode)
{
op_fnascii(r->operand[1].oprval.tref->operand[0].oprval.ilit,
&r->operand[0].oprval.tref->operand[0].oprval.mlit->v, &tmp_mval);
} else
{
op_fnzascii(r->operand[1].oprval.tref->operand[0].oprval.ilit,
&r->operand[0].oprval.tref->operand[0].oprval.mlit->v, &tmp_mval);
}
r->operand[1].oprval.tref->operand[0].oprclass = NO_REF;
r->operand[1].oprval.tref->opcode = OC_NOOP; /* sideline abandoned triples */
unuse_literal(&r->operand[0].oprval.tref->operand[0].oprval.mlit->v); /* knock out abandoned use of a literal */
r->operand[0].oprval.tref->operand[0].oprclass = NO_REF;
r->operand[0].oprval.tref->opcode = OC_NOOP;
*a = put_lit(&tmp_mval);
a->oprval.tref->src = r->src;
return TRUE;
}
ins_triple(r);
*a = put_tref(r);
return TRUE;
}
|