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 "indir_enum.h"
|
|
|
|
#include "toktyp.h"
|
|
|
|
#include "advancewindow.h"
|
|
|
|
#include "cmd.h"
|
|
|
|
|
|
|
|
#define CANCEL_ONE -1
|
|
|
|
#define CANCEL_ALL -2
|
|
|
|
|
|
|
|
LITREF mident zero_ident;
|
|
|
|
|
2012-03-24 14:06:46 -04:00
|
|
|
error_def(ERR_VAREXPECTED);
|
|
|
|
|
2012-02-05 11:35:58 -05:00
|
|
|
int m_zwatch(void)
|
|
|
|
{
|
2012-03-24 14:06:46 -04:00
|
|
|
boolean_t is_count;
|
|
|
|
opctype op;
|
|
|
|
oprtype count, name,action;
|
|
|
|
triple *next, *ref;
|
|
|
|
DCL_THREADGBL_ACCESS;
|
2012-02-05 11:35:58 -05:00
|
|
|
|
2012-03-24 14:06:46 -04:00
|
|
|
SETUP_THREADGBL_ACCESS;
|
|
|
|
if (TK_MINUS == TREF(window_token))
|
2012-02-05 11:35:58 -05:00
|
|
|
{
|
|
|
|
advancewindow();
|
2012-03-24 14:06:46 -04:00
|
|
|
switch (TREF(window_token))
|
2012-02-05 11:35:58 -05:00
|
|
|
{
|
|
|
|
case TK_ASTERISK:
|
|
|
|
name = put_str(zero_ident.addr, zero_ident.len);
|
|
|
|
count = put_ilit(CANCEL_ALL);
|
|
|
|
advancewindow();
|
|
|
|
break;
|
|
|
|
case TK_IDENT:
|
2012-03-24 14:06:46 -04:00
|
|
|
name = put_str((TREF(window_ident)).addr, (TREF(window_ident)).len);
|
2012-02-05 11:35:58 -05:00
|
|
|
count = put_ilit(CANCEL_ONE);
|
|
|
|
advancewindow();
|
|
|
|
break;
|
|
|
|
case TK_ATSIGN:
|
|
|
|
if (!indirection(&name))
|
|
|
|
return FALSE;
|
|
|
|
count = put_ilit(CANCEL_ONE);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
stx_error(ERR_VAREXPECTED);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
action = put_str("",0);
|
|
|
|
op = OC_WATCHREF;
|
2012-03-24 14:06:46 -04:00
|
|
|
} else
|
2012-02-05 11:35:58 -05:00
|
|
|
{
|
2012-03-24 14:06:46 -04:00
|
|
|
if (TK_EQUAL == TREF(window_token))
|
2012-02-05 11:35:58 -05:00
|
|
|
{
|
|
|
|
advancewindow();
|
|
|
|
op = OC_WATCHMOD;
|
2012-03-24 14:06:46 -04:00
|
|
|
} else
|
2012-02-05 11:35:58 -05:00
|
|
|
op = OC_WATCHREF;
|
2012-03-24 14:06:46 -04:00
|
|
|
switch (TREF(window_token))
|
2012-02-05 11:35:58 -05:00
|
|
|
{
|
|
|
|
case TK_IDENT:
|
2012-03-24 14:06:46 -04:00
|
|
|
name = put_str((TREF(window_ident)).addr, (TREF(window_ident)).len);
|
2012-02-05 11:35:58 -05:00
|
|
|
advancewindow();
|
|
|
|
break;
|
|
|
|
case TK_ATSIGN:
|
|
|
|
if (!indirection(&name))
|
|
|
|
return FALSE;
|
2012-03-24 14:06:46 -04:00
|
|
|
if ((OC_WATCHREF == op) && (TK_COLON != TREF(window_token)))
|
2012-02-05 11:35:58 -05:00
|
|
|
{
|
|
|
|
ref = maketriple(OC_COMMARG);
|
|
|
|
ref->operand[0] = name;
|
|
|
|
ref->operand[1] = put_ilit((mint) indir_zwatch);
|
|
|
|
ins_triple(ref);
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
stx_error(ERR_VAREXPECTED);
|
|
|
|
return FALSE;
|
|
|
|
}
|
2012-03-24 14:06:46 -04:00
|
|
|
if (TK_COLON != TREF(window_token))
|
2012-02-05 11:35:58 -05:00
|
|
|
{
|
|
|
|
action = put_str("",0);
|
|
|
|
count = put_ilit(0);
|
2012-03-24 14:06:46 -04:00
|
|
|
} else
|
2012-02-05 11:35:58 -05:00
|
|
|
{
|
|
|
|
advancewindow();
|
2012-03-24 14:06:46 -04:00
|
|
|
if (TK_COLON == TREF(window_token))
|
2012-02-05 11:35:58 -05:00
|
|
|
{
|
|
|
|
is_count = TRUE;
|
2012-03-24 14:06:46 -04:00
|
|
|
action = put_str("", 0);
|
|
|
|
} else
|
2012-02-05 11:35:58 -05:00
|
|
|
{
|
2012-03-24 14:06:46 -04:00
|
|
|
if (EXPR_FAIL == expr(&action, MUMPS_STR))
|
2012-02-05 11:35:58 -05:00
|
|
|
return FALSE;
|
2012-03-24 14:06:46 -04:00
|
|
|
is_count = (TK_COLON == TREF(window_token));
|
2012-02-05 11:35:58 -05:00
|
|
|
}
|
|
|
|
if (is_count)
|
|
|
|
{
|
|
|
|
advancewindow();
|
2012-03-24 14:06:46 -04:00
|
|
|
if (EXPR_FAIL == expr(&count, MUMPS_INT))
|
2012-02-05 11:35:58 -05:00
|
|
|
return FALSE;
|
2012-03-24 14:06:46 -04:00
|
|
|
} else
|
2012-02-05 11:35:58 -05:00
|
|
|
count = put_ilit(0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
ref = newtriple(op);
|
|
|
|
ref->operand[0] = name;
|
|
|
|
next = newtriple(OC_PARAMETER);
|
|
|
|
ref->operand[1] = put_tref(next);
|
|
|
|
next->operand[0] = action;
|
|
|
|
next->operand[1] = count;
|
|
|
|
return TRUE;
|
|
|
|
}
|