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. *
|
|
|
|
* *
|
|
|
|
****************************************************************/
|
|
|
|
|
|
|
|
#include "mdef.h"
|
|
|
|
#include "compiler.h"
|
|
|
|
#include "opcode.h"
|
|
|
|
#include "toktyp.h"
|
|
|
|
#include "io_params.h"
|
|
|
|
#include "indir_enum.h"
|
|
|
|
#include "advancewindow.h"
|
|
|
|
#include "cmd.h"
|
|
|
|
#include "deviceparameters.h"
|
|
|
|
|
|
|
|
int m_use(void)
|
|
|
|
{
|
|
|
|
boolean_t inddevparms;
|
|
|
|
static readonly unsigned char empty_plist[1] = { iop_eol };
|
2012-03-24 14:06:46 -04:00
|
|
|
int rval;
|
|
|
|
oprtype sopr, plist, devpopr;
|
|
|
|
triple *indref, *ref;
|
|
|
|
DCL_THREADGBL_ACCESS;
|
2012-02-05 11:35:58 -05:00
|
|
|
|
2012-03-24 14:06:46 -04:00
|
|
|
SETUP_THREADGBL_ACCESS;
|
2012-02-05 11:35:58 -05:00
|
|
|
inddevparms = FALSE;
|
2012-03-24 14:06:46 -04:00
|
|
|
if (EXPR_FAIL == (rval = expr(&sopr, MUMPS_STR))) /* NOTE assignment */
|
2012-02-05 11:35:58 -05:00
|
|
|
return FALSE;
|
2012-03-24 14:06:46 -04:00
|
|
|
if (TK_COLON != TREF(window_token))
|
2012-02-05 11:35:58 -05:00
|
|
|
{ /* Single parameter */
|
2012-03-24 14:06:46 -04:00
|
|
|
if (EXPR_INDR == rval)
|
2012-02-05 11:35:58 -05:00
|
|
|
{ /* Indirect entire parameter list */
|
|
|
|
make_commarg(&sopr, indir_use);
|
|
|
|
return TRUE;
|
2012-03-24 14:06:46 -04:00
|
|
|
} else /* default device parms */
|
2012-02-05 11:35:58 -05:00
|
|
|
plist = put_str((char *)empty_plist, SIZEOF(empty_plist));
|
|
|
|
} else
|
|
|
|
{ /* Have device parms. Determine type */
|
|
|
|
advancewindow();
|
2012-03-24 14:06:46 -04:00
|
|
|
if (TK_ATSIGN == TREF(window_token))
|
2012-02-05 11:35:58 -05:00
|
|
|
{ /* Have indirect device parms */
|
|
|
|
if (!indirection(&devpopr))
|
|
|
|
return FALSE;
|
|
|
|
indref = newtriple(OC_INDDEVPARMS);
|
|
|
|
indref->operand[0] = devpopr;
|
|
|
|
indref->operand[1] = put_ilit(IOP_USE_OK);
|
|
|
|
inddevparms = TRUE;
|
|
|
|
} else
|
|
|
|
{ /* Process device parameters now */
|
|
|
|
if (!deviceparameters(&plist, IOP_USE_OK))
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
ref = newtriple(OC_USE);
|
|
|
|
ref->operand[0] = sopr;
|
|
|
|
ref->operand[1] = !inddevparms ? plist : put_tref(indref);
|
|
|
|
return TRUE;
|
|
|
|
}
|