本文整理汇总了C++中TREF函数的典型用法代码示例。如果您正苦于以下问题:C++ TREF函数的具体用法?C++ TREF怎么用?C++ TREF使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了TREF函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: gvzwrite_clnup
void gvzwrite_clnup(void)
{
gv_key *old;
DCL_THREADGBL_ACCESS;
SETUP_THREADGBL_ACCESS;
gv_cur_region = gvzwrite_block->gd_reg;
change_reg();
assert(reset_gv_target == ((gv_namehead *)gvzwrite_block->old_targ));
if (NULL != gvzwrite_block->old_key)
{
old = (gv_key *)gvzwrite_block->old_key;
memcpy(&gv_currkey->base[0], &old->base[0], old->end + 1);
gv_currkey->end = old->end;
gv_currkey->prev = old->prev;
gd_map = gvzwrite_block->old_map;
gd_map_top = gvzwrite_block->old_map_top;
free(gvzwrite_block->old_key);
gvzwrite_block->old_key = gvzwrite_block->old_targ = (unsigned char *)NULL;
gvzwrite_block->subsc_count = 0;
TREF(gv_last_subsc_null) = gvzwrite_block->gv_last_subsc_null;
TREF(gv_some_subsc_null) = gvzwrite_block->gv_some_subsc_null;
}
RESET_GV_TARGET(DO_GVT_GVKEY_CHECK);
}
示例2: f_zparse
int f_zparse(oprtype *a, opctype op)
{
boolean_t again;
int i;
triple *last, *r, *ref;
DCL_THREADGBL_ACCESS;
SETUP_THREADGBL_ACCESS;
last = r = maketriple(op);
if (EXPR_FAIL == expr(&(r->operand[0]), MUMPS_STR))
return FALSE;
again = TRUE;
for (i = 0; i < 4 ;i++)
{
ref = newtriple(OC_PARAMETER);
last->operand[1] = put_tref(ref);
if (again && TK_COMMA == TREF(window_token))
{
advancewindow();
if (TK_COMMA == TREF(window_token))
ref->operand[0] = put_str("", 0);
else if (EXPR_FAIL == expr(&ref->operand[0], MUMPS_STR))
return FALSE;
} else
{
again = FALSE;
ref->operand[0] = put_str("", 0);
}
last = ref;
}
ins_triple(r);
*a = put_tref(r);
return TRUE;
}
示例3: linetail
int linetail(void)
{
DCL_THREADGBL_ACCESS;
SETUP_THREADGBL_ACCESS;
for (;;)
{
while (TK_SPACE == TREF(window_token))
advancewindow();
if (TK_EOL == TREF(window_token))
return TRUE;
if (!cmd())
{
if (OC_RTERROR != (TREF(curtchain))->exorder.bl->exorder.bl->exorder.bl->opcode)
{ /* If rterror is last triple generated (has two args), then error already raised */
TREF(source_error_found) ? stx_error(TREF(source_error_found)) : stx_error(ERR_CMD);
}
assert((TREF(curtchain))->exorder.bl->exorder.fl == TREF(curtchain));
assert(TREF(source_error_found));
return FALSE;
}
if ((TK_SPACE != TREF(window_token)) && (TK_EOL != TREF(window_token)))
{
stx_error(ERR_SPOREOL);
return FALSE;
}
}
}
示例4: mupip_rctldump
void mupip_rctldump(void)
{
# ifdef AUTORELINK_SUPPORTED
unsigned short max_len;
mstr dir;
char objdir[GTM_PATH_MAX];
open_relinkctl_sgm *linkctl;
DCL_THREADGBL_ACCESS;
SETUP_THREADGBL_ACCESS;
if (TREF(parms_cnt))
{
assert(1 == TREF(parms_cnt));
max_len = SIZEOF(objdir);
if (!cli_get_str("DIRECTORY", objdir, &max_len))
rts_error_csa(CSA_ARG(NULL) VARLSTCNT(1) ERR_MUPCLIERR);
dir.addr = objdir;
dir.len = max_len;
linkctl = relinkctl_attach(&dir);
assert(linkctl == TREF(open_relinkctl_list));
assert((NULL == linkctl) || (NULL == linkctl->next));
} else
zro_init();
util_out_print("", RESET); /* Reset output buffer */
zshow_rctldump(NULL); /* callee knows caller is mupip_rctldump type based on the NULL parameter */
# endif /* AUTORELINK_SUPPORTED */
}
示例5: util_spawn
void util_spawn(void)
{
char *cmd;
int rc;
DCL_THREADGBL_ACCESS;
SETUP_THREADGBL_ACCESS;
assert(1 >= TREF(parms_cnt));
if (0 == TREF(parms_cnt))
{
cmd = GETENV("SHELL");
if (!cmd)
cmd = "/bin/sh";
rc = SYSTEM(cmd);
if (-1 == rc)
PERROR("system : ");
} else
{
assert(TAREF1(parm_ary, TREF(parms_cnt) - 1));
assert((char *)-1L != (TAREF1(parm_ary, TREF(parms_cnt) - 1)));
rc = SYSTEM((TAREF1(parm_ary, TREF(parms_cnt) - 1)));
if (-1 == rc)
PERROR("system : ");
}
}
示例6: m_zattach
int m_zattach(void)
{
oprtype x;
triple *triptr;
DCL_THREADGBL_ACCESS;
SETUP_THREADGBL_ACCESS;
if ((TK_EOL == TREF(window_token)) || (TK_SPACE == TREF(window_token)))
{
triptr = newtriple(OC_ZATTACH);
triptr->operand[0] = put_str("",0);
return TRUE;
}
else
{
switch (expr(&x, MUMPS_STR))
{
case EXPR_FAIL:
return FALSE;
case EXPR_GOOD:
triptr = newtriple(OC_ZATTACH);
triptr->operand[0] = x;
return TRUE;
case EXPR_INDR:
make_commarg(&x,indir_zattach);
return TRUE;
}
}
return FALSE; /* This should never get executed, added to make compiler happy */
}
示例7: f_fnumber
int f_fnumber(oprtype *a, opctype op)
{
triple *r, *ref, *ref1;
DCL_THREADGBL_ACCESS;
SETUP_THREADGBL_ACCESS;
r = maketriple(op);
if (EXPR_FAIL == expr(&r->operand[0], MUMPS_NUM))
return FALSE;
if (TK_COMMA != TREF(window_token))
{
stx_error(ERR_COMMA);
return FALSE;
}
advancewindow();
ref = newtriple(OC_PARAMETER);
r->operand[1] = put_tref(ref);
if (EXPR_FAIL == expr(&ref->operand[0], MUMPS_STR))
return FALSE;
ref1 = newtriple(OC_PARAMETER);
ref->operand[1] = put_tref(ref1);
if (TK_COMMA == TREF(window_token))
{
advancewindow();
if (EXPR_FAIL == expr(&ref1->operand[1], MUMPS_INT))
return FALSE;
ref1->operand[0] = put_ilit((mint)(1)); /* flag that the 3rd argument is real */
} else
ref1->operand[0] = ref1->operand[1] = put_ilit((mint)0); /* flag no 3rd argument and give it default value */
ins_triple(r);
*a = put_tref(r);
return TRUE;
}
示例8: f_find
int f_find(oprtype *a, opctype op)
{
triple *delimiter, *r, *start;
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))
{
stx_error(ERR_COMMA);
return FALSE;
}
advancewindow();
delimiter = newtriple(OC_PARAMETER);
start = newtriple(OC_PARAMETER);
r->operand[1] = put_tref(delimiter);
delimiter->operand[1] = put_tref(start);
if (EXPR_FAIL == expr(&(delimiter->operand[0]), MUMPS_STR))
return FALSE;
if (TK_COMMA != TREF(window_token))
start->operand[0] = put_ilit(1);
else
{
advancewindow();
if (EXPR_FAIL == expr(&(start->operand[0]), MUMPS_INT))
return FALSE;
}
ins_triple(r);
*a = put_tref(r);
return TRUE;
}
示例9: mprof_stack_free
/* Free the memory allocated for MPROF stack. */
void mprof_stack_free(void)
{
mprof_stack_frame *chunk_start, *prev_chunk_start;
DCL_THREADGBL_ACCESS;
SETUP_THREADGBL_ACCESS;
if (process_exiting) /* no point trying to clean after ourselves if we are exiting */
return;
/* there are no elements on the stack */
if (MPROF_STACK_ALLOC_CNT == TREF(mprof_chunk_avail_size))
{
free(TREF(mprof_stack_next_frame));
TREF(mprof_stack_next_frame) = TREF(mprof_stack_curr_frame) = NULL;
TREF(mprof_chunk_avail_size) = 0;
return;
}
chunk_start = TREF(mprof_stack_curr_frame) - (MPROF_STACK_ALLOC_CNT - TREF(mprof_chunk_avail_size) - 1);
while (NULL != chunk_start)
{
if (NULL != chunk_start->prev)
prev_chunk_start = chunk_start->prev - (MPROF_STACK_ALLOC_CNT - 1);
else
prev_chunk_start = NULL;
free(chunk_start);
chunk_start = prev_chunk_start;
}
TREF(mprof_stack_next_frame) = TREF(mprof_stack_curr_frame) = NULL;
TREF(mprof_chunk_avail_size) = 0;
return;
}
示例10: op_indpat
void op_indpat(mval *v, mval *dst)
{
int rval;
icode_str indir_src;
mstr *obj, object;
oprtype x, getdst;
DCL_THREADGBL_ACCESS;
SETUP_THREADGBL_ACCESS;
MV_FORCE_STR(v);
indir_src.str = v->str;
indir_src.code = indir_pattern;
if (NULL == (obj = cache_get(&indir_src)))
{
obj = &object;
comp_init(&v->str, &getdst);
source_column = 1; /* to coordinate with scanner redirection*/
rval = compile_pattern(&x, (TK_ATSIGN == TREF(window_token)));
if (EXPR_FAIL == comp_fini(rval, obj, OC_IRETMVAL, &x, &getdst, v->str.len))
return;
indir_src.str.addr = v->str.addr;
cache_put(&indir_src, obj);
/* Fall into code activation below */
}
TREF(ind_result) = dst; /* Where to store return value */
comp_indr(obj);
return;
}
示例11: f_ztrigger
int f_ztrigger(oprtype *a, opctype op)
{
triple *r, *arg1, *arg2;
DCL_THREADGBL_ACCESS;
SETUP_THREADGBL_ACCESS;
r = maketriple(op);
arg1 = newtriple(OC_PARAMETER);
arg2 = newtriple(OC_PARAMETER);
if (EXPR_FAIL == expr(&(r->operand[0]), MUMPS_STR))
return FALSE;
if (TK_COMMA == TREF(window_token))
{ /* Looking for a 2nd argument */
advancewindow();
if (EXPR_FAIL == expr(&(arg1->operand[0]), MUMPS_STR))
return FALSE;
if (TK_COMMA == TREF(window_token))
{
advancewindow();
if (EXPR_FAIL == expr(&(arg2->operand[0]), MUMPS_STR))
return FALSE;
} else
arg2->operand[0] = put_lit((mval *)&literal_null);
} else
{
arg1->operand[0] = put_lit((mval *)&literal_null);
arg2->operand[0] = put_lit((mval *)&literal_null);
}
r->operand[1] = put_tref(arg1);
arg1->operand[1] = put_tref(arg2);
ins_triple(r);
*a = put_tref(r);
return TRUE;
}
示例12: util_help
void util_help(void)
{
int rc;
char *help_option;
char help_cmd_string[HELP_CMD_STRING_SIZE];
DCL_THREADGBL_ACCESS;
SETUP_THREADGBL_ACCESS;
assert(1 >= TREF(parms_cnt));
assert(GTM_IMAGE < image_type && UTIL_HELP_IMAGES > image_type);
if (0 == TREF(parms_cnt))
help_option = utilImageGLDs[INVALID_IMAGE];
else
{
assert(TAREF1(parm_ary, TREF(parms_cnt) - 1));
assert((char *)-1L != (TAREF1(parm_ary, TREF(parms_cnt) - 1)));
help_option = (TAREF1(parm_ary, TREF(parms_cnt) - 1));
}
SNPRINTF(help_cmd_string, SIZEOF(help_cmd_string),
"$gtm_dist/mumps -run %%XCMD 'do ^GTMHELP(\"%s\",\"$gtm_dist/%shelp.gld\")'",
help_option, utilImageGLDs[image_type]);
rc = SYSTEM(help_cmd_string);
if (0 != rc)
rts_error_csa(NULL, VARLSTCNT(5) ERR_TEXT, 2, RTS_ERROR_TEXT("HELP command error"), rc);
}
示例13: m_zhalt
/* Halt the process similar to op_halt but allow a return code to be specified. If no return code
* is specified, return code 0 is used as a default (making it identical to op_halt).
*/
int m_zhalt(void)
{
triple *triptr;
oprtype ot;
int status;
DCL_THREADGBL_ACCESS;
SETUP_THREADGBL_ACCESS;
/* Let m_halt() handle the case of the missing return code */
if ((TK_SPACE == TREF(window_token)) || (TK_EOL == TREF(window_token)))
return m_halt();
switch (status = expr(&ot, MUMPS_NUM)) /* NOTE assignment */
{
case EXPR_FAIL:
return FALSE;
case EXPR_GOOD:
triptr = newtriple(OC_ZHALT);
triptr->operand[0] = ot;
return TRUE;
case EXPR_INDR:
make_commarg(&ot, indir_zhalt);
return TRUE;
default:
assertpro(FALSE);
}
return FALSE; /* This should never get executed, added to make compiler happy */
}
示例14: f_name
int f_name(oprtype *a, opctype op)
{
boolean_t gbl;
oprtype *depth;
short int column;
triple *r, *s;
DCL_THREADGBL_ACCESS;
SETUP_THREADGBL_ACCESS;
r = maketriple(op);
gbl = FALSE;
switch (TREF(window_token))
{
case TK_CIRCUMFLEX:
gbl = TRUE;
advancewindow();
/* caution fall through */
case TK_IDENT:
if (!name_glvn(gbl, &r->operand[1]))
return FALSE;
depth = &r->operand[0];
break;
case TK_ATSIGN:
r->opcode = OC_INDFNNAME2; /* chomps extra subscripts of resulting string */
s = maketriple(OC_INDFNNAME);
if (!indirection(&(s->operand[0])))
return FALSE;
s->operand[1] = put_ilit(MAX_LVSUBSCRIPTS + 1); /* first, get all the subscripts. r will chomp them */
coerce(&s->operand[1], OCT_MVAL);
ins_triple(s);
depth = &r->operand[0];
r->operand[1] = put_tref(s);
break;
default:
stx_error(ERR_VAREXPECTED);
return FALSE;
}
/* allow for optional default value */
if (TK_COMMA != TREF(window_token))
{
*depth = put_ilit(MAX_LVSUBSCRIPTS + 1); /* default to maximum number of subscripts allowed by law */
/* ideally this should be MAX(MAX_LVSUBSCRIPTS, MAX_GVSUBSCRIPTS) but they are the same so take the easy path */
assert(MAX_LVSUBSCRIPTS == MAX_GVSUBSCRIPTS); /* add assert to ensure our assumption is valid */
} else
{
DISABLE_SIDE_EFFECT_AT_DEPTH; /* doing this here let's us know specifically if direction had SE threat */
advancewindow();
column = source_column;
if (EXPR_FAIL == expr(depth, MUMPS_STR))
return FALSE;
if (!run_time && (OC_INDFNNAME2 == r->opcode) && (SE_WARN == TREF(side_effect_handling)))
ISSUE_SIDEEFFECTEVAL_WARNING(column - 1);
}
coerce(depth, OCT_MVAL);
ins_triple(r);
*a = put_tref(r);
return TRUE;
}
示例15: rts_error_va
int rts_error_va(void *csa, int argcnt, va_list var)
{
int msgid;
va_list var_dup;
const err_ctl *ctl;
# ifdef DEBUG
DCL_THREADGBL_ACCESS;
SETUP_THREADGBL_ACCESS;
if (TREF(rts_error_unusable) && !TREF(rts_error_unusable_seen))
{
TREF(rts_error_unusable_seen) = TRUE;
/* The below assert ensures that this rts_error invocation is appropriate in the current context of the code that
* triggered this rts_error. If ever this assert fails, investigate the window of DBG_MARK_RTS_ERROR_UNUSABLE
* and DBG_MARK_RTS_ERROR_USABLE in the call-stack.
*/
assert(FALSE);
}
# endif
VAR_COPY(var_dup, var);
if (-1 == gtm_errno)
gtm_errno = errno;
msgid = va_arg(var_dup, int);
/* If there was a previous fatal error that did not yet get printed, do it before overwriting the
* util_output buffer with the about-to-be-handled nested error. This way one will see ALL the
* fatal error messages (e.g. assert failures) in the order in which they occurred instead of
* just the last nested one.
*/
if (DUMPABLE)
PRN_ERROR;
/* This is simply a place holder msg to signal tp restart or otherwise rethrow an error */
if ((ERR_TPRETRY == msgid) || (ERR_REPEATERROR == msgid) || (ERR_REPLONLNRLBK == msgid) || (ERR_JOBINTRRQST == msgid)
|| (ERR_JOBINTRRETHROW == msgid))
{
SET_ERROR_CONDITION(msgid); /* sets "error_condition" & "severity" */
} else
{ /* Note this message is not flushed out. This is so user console is not polluted with messages that are going to be
* handled by a ZTRAP. If ZTRAP is not active, the message will be flushed out in mdb_condition_handler - which is
* usually the top level handler or is rolled over into by higher handlers.
*/
if (IS_GTMSECSHR_IMAGE)
util_out_print(NULL, RESET);
SET_ERROR_CONDITION(msgid); /* sets "error_condition" & "severity" */
gtm_putmsg_list(csa, argcnt, var);
if (DUMPABLE)
created_core = dont_want_core = FALSE; /* We can create a(nother) core now */
if (IS_GTMSECSHR_IMAGE)
util_out_print(NULL, OPER); /* gtmsecshr errors always immediately pushed out */
}
va_end(var_dup);
va_end(var);
DRIVECH(msgid); /* Drive the topmost (inactive) condition handler */
/* Note -- at one time there was code here to catch if we returned from the condition handlers
* when the severity was error or above. That code had to be removed because of several errors
* that are handled and returned from. An example is EOF errors. SE 9/2000
*/
return 0;
}