Example #1
0
///////////////////////////////////////
// on qualified name, select direct DB
//
DbIntlog *DbIntlog::FixPathName(Term *t) const
{
    DbIntlog *db = (DbIntlog*)this;
    Term r = *t;

    while (db && r.is_expr(Operator::PATHNAME) && r.getarg(0).type(f_ATOM))
    {
        kstring dbid = r.getarg(0).kstr();

        if (!strcmp(dbid, ".."))
            db = db->m_father;
        else
        {
            DbInherIter itdb(db);
            while ((db = itdb.next()) != 0)
                if (db->GetId() == dbid)
                    break;
        }

        if (db)
            r = r.getarg(1);
    }

    *t = r;
    return db;
}
Example #2
0
Term TermVisit::next()
{
	if (size()) {
		Term top = get();
		pop();

		if (top.type(f_STRUCT|f_LIST))
			for (int n = top.get_arity() - 1; n >= 0; n--)
				push(top.getarg(n));

		return top;
	}

	return Term(f_NOTERM);
}