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 "iotimer.h"
|
|
|
|
#include "indir_enum.h"
|
|
|
|
#include "advancewindow.h"
|
|
|
|
#include "cmd.h"
|
|
|
|
|
2012-03-24 14:06:46 -04:00
|
|
|
error_def(ERR_RPARENMISSING);
|
2012-02-05 11:35:58 -05:00
|
|
|
|
|
|
|
int m_lock(void)
|
|
|
|
{
|
2012-03-24 14:06:46 -04:00
|
|
|
boolean_t indirect;
|
|
|
|
opctype ox;
|
|
|
|
oprtype indopr;
|
|
|
|
triple *ref, *restart;
|
|
|
|
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
|
|
|
restart = newtriple(OC_RESTARTPC);
|
|
|
|
newtriple(OC_LKINIT);
|
|
|
|
indirect = FALSE;
|
2012-03-24 14:06:46 -04:00
|
|
|
switch (TREF(window_token))
|
2012-02-05 11:35:58 -05:00
|
|
|
{
|
2012-03-24 14:06:46 -04:00
|
|
|
case TK_MINUS:
|
|
|
|
advancewindow();
|
|
|
|
ox = OC_LCKDECR;
|
|
|
|
break;
|
|
|
|
case TK_PLUS:
|
|
|
|
advancewindow();
|
|
|
|
ox = OC_LCKINCR;
|
|
|
|
break;
|
|
|
|
case TK_EOL:
|
|
|
|
case TK_SPACE:
|
|
|
|
ox = OC_UNLOCK;
|
|
|
|
restart->opcode = OC_NOOP;
|
|
|
|
newtriple(OC_UNLOCK);
|
|
|
|
return TRUE;
|
|
|
|
break;
|
|
|
|
case TK_ATSIGN:
|
|
|
|
if (!indirection(&indopr))
|
|
|
|
return FALSE;
|
|
|
|
ref = maketriple(OC_COMMARG);
|
|
|
|
ref->operand[0] = indopr;
|
|
|
|
if (TK_COLON != TREF(window_token))
|
|
|
|
{
|
|
|
|
ref->operand[1] = put_ilit((mint) indir_lock);
|
|
|
|
ins_triple(ref);
|
2012-02-05 11:35:58 -05:00
|
|
|
return TRUE;
|
2012-03-24 14:06:46 -04:00
|
|
|
}
|
|
|
|
ref->operand[1] = put_ilit((mint) indir_nref);
|
|
|
|
indirect = TRUE;
|
|
|
|
/*** CAUTION: FALL-THROUGH ***/
|
|
|
|
default:
|
|
|
|
newtriple(OC_UNLOCK);
|
|
|
|
ox = OC_LOCK;
|
2012-02-05 11:35:58 -05:00
|
|
|
}
|
|
|
|
if (indirect)
|
|
|
|
ins_triple(ref);
|
|
|
|
else
|
|
|
|
{
|
2012-03-24 14:06:46 -04:00
|
|
|
switch (TREF(window_token))
|
2012-02-05 11:35:58 -05:00
|
|
|
{
|
|
|
|
case TK_LPAREN:
|
|
|
|
do
|
|
|
|
{
|
|
|
|
advancewindow();
|
|
|
|
if (nref() == EXPR_FAIL)
|
|
|
|
return FALSE;
|
2012-03-24 14:06:46 -04:00
|
|
|
} while (TK_COMMA == TREF(window_token));
|
|
|
|
if (TK_RPAREN != TREF(window_token))
|
2012-02-05 11:35:58 -05:00
|
|
|
{
|
|
|
|
stx_error(ERR_RPARENMISSING);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
advancewindow();
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
if (nref() == EXPR_FAIL)
|
|
|
|
return FALSE;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
ref = maketriple(ox);
|
2012-03-24 14:06:46 -04:00
|
|
|
if (TK_COLON != TREF(window_token))
|
2012-02-05 11:35:58 -05:00
|
|
|
{ ref->operand[0] = put_ilit(NO_M_TIMEOUT);
|
|
|
|
ins_triple(ref);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
advancewindow();
|
2012-03-24 14:06:46 -04:00
|
|
|
if (EXPR_FAIL == expr(&(ref->operand[0]), MUMPS_INT))
|
2012-02-05 11:35:58 -05:00
|
|
|
return FALSE;
|
|
|
|
ins_triple(ref);
|
|
|
|
newtriple(OC_TIMTRU);
|
|
|
|
}
|
|
|
|
return TRUE;
|
|
|
|
}
|