/* This code is very similar to op_fngvget.c except, if the gvn is undefined, this returns an undefined value as a signal to * op_fnget2, which, in turn, returns a specified "default" value; that slight of hand deals with order of evaluation issues * Any changes to this routine most likely have to be made in op_fngvget.c as well. */ void op_fngvget1(mval *dst) { boolean_t gotit; DCL_THREADGBL_ACCESS; SETUP_THREADGBL_ACCESS; if (TREF(gv_last_subsc_null) && NEVER == gv_cur_region->null_subs) sgnl_gvnulsubsc(); switch (gv_cur_region->dyn.addr->acc_meth) { case dba_bg : case dba_mm : gotit = gv_target->root ? gvcst_get(dst) : FALSE; break; case dba_cm : gotit = gvcmx_get(dst); break; default : if (gotit = gvusr_get(dst)) /* NOTE: assignment */ s2pool(&dst->str); break; } if (!gotit) dst->mvtype = 0; assert(0 == (dst->mvtype & MV_ALIASCONT)); /* Should be no alias container flag */ return; }
/* This code is very similar to "op_fngvget1.c" except that this one returns the default value * (while op_fngvget1 returns an undefined value) if the global variable that we are trying to get is undefined. * * Any changes to this routine most likely have to be made in op_fngvget1.c as well. */ void op_fngvget(mval *v, mval *def) { boolean_t gotit; DCL_THREADGBL_ACCESS; SETUP_THREADGBL_ACCESS; if (TREF(gv_last_subsc_null) && NEVER == gv_cur_region->null_subs) sgnl_gvnulsubsc(); switch (gv_cur_region->dyn.addr->acc_meth) { case dba_bg : case dba_mm : if (gv_target->root) gotit = gvcst_get(v); else gotit = FALSE; break; case dba_cm : gotit = gvcmx_get(v); break; default : gotit = gvusr_get(v); if (gotit) s2pool(&v->str); break; } if (!gotit) { *v = *def; v->mvtype &= ~MV_ALIASCONT; /* Make sure do not allow alias container property to pass */ } return; }
boolean_t gvusr_queryget(mval *v) { /* this function logically should be in DDPGVUSR, but is now in GTMSHR because the tree of functions called from * str2gvkey_nogvfunc use globals that are currently not setup in DDPGVUSR, and the number of globals makes for nasty problems * in the link */ /* $Q and $G as separate steps, if $G returns "", loop until $Q returns "" or $Q and $G return non "" */ for (; ;) { if (gvusr_query(v)) { str2gvkey_nogvfunc(v->str.addr, v->str.len, gv_currkey); /* setup gv_currkey from return of query */ if (gvusr_get(v)) { s2pool(&v->str); return TRUE; } } else return FALSE; } }