Пример #1
0
static QTNode *
dofindsubquery(QTNode * root, QTNode * ex, MemoryType memtype, QTNode * subs, bool *isfind)
{
	root = findeq(root, ex, memtype, subs, isfind);

	if (root && (root->flags & QTN_NOCHANGE) == 0 && root->valnode->type == OPR)
	{
		int			i;

		for (i = 0; i < root->nchild; i++)
			root->child[i] = dofindsubquery(root->child[i], ex, memtype, subs, isfind);
	}

	return root;
}
Пример #2
0
static QTNode *
dofindsubquery(QTNode *root, QTNode *ex, QTNode *subs, bool *isfind)
{
	/* since this function recurses, it could be driven to stack overflow. */
	check_stack_depth();

	root = findeq(root, ex, subs, isfind);

	if (root && (root->flags & QTN_NOCHANGE) == 0 && root->valnode->type == QI_OPR)
	{
		int			i;

		for (i = 0; i < root->nchild; i++)
			root->child[i] = dofindsubquery(root->child[i], ex, subs, isfind);
	}

	return root;
}
Пример #3
0
/*
 * Find the given name in the dictionary
 * and return its value.  If the name was
 * not previously there, enter it now and
 * return a null value.
 */
struct var *lookup(const char *n)
{
	static struct var dummy;

	struct var *vp;
	const char *cp;
	char *xp;
	
	
	/* var 'n' in vlist ? */
	for (vp = vlist; vp; vp = vp->next) {
		if (eqname(vp->name, n)) {
			return vp;
		}
    }
    
    /* A new var, Add it */
	cp = findeq(n);
	vp = get_space(sizeof(*vp));
	if (vp == 0 || (vp->name = get_space((int) (cp - n) + 2)) == NULL) {
		dummy.name = dummy.value = (char*)"";
		return &dummy;
	}

	xp = vp->name;
	while ((*xp = *n++) != '\0' && *xp != '=')
		xp++;
	*xp++ = '=';
	*xp = '\0';;
	setarea((char *) vp, 0);
	setarea((char *) vp->name, 0);
	vp->value = null;
	vp->next = vlist;
	vp->status = GETCELL;
	vlist = vp;
	return vp;
}