Пример #1
0
static List *
filterList(List *list, bool skip_spaces, bool qnames)
{
	List *result = NIL;
	ListCell *cell;
	bool isdot = false;
	orafce_lexnode *a = NULL;
	orafce_lexnode *dot = NULL;

	foreach(cell, list)
	{
		orafce_lexnode *nd = (orafce_lexnode *) lfirst(cell);

		if (qnames)
		{
			isdot = (IsType(nd, OTHERS) && (nd->str[0] == '.'));

			if (IsType(nd, IDENT) && dot && a)
			{
				a = compose(a, nd);
				dot = NULL;
				continue;
			}
			else if (isdot && !dot && a)
			{
				dot = COPY_NODE(nd);
				continue;
			}
			else if (IsType(nd, IDENT) && !a)
			{
				a = COPY_NODE(nd);
				continue;
			}
		}

		/* clean buffered values */
		APPEND_NODE(result,a);
		APPEND_NODE(result,dot);

		if (!(skip_spaces && IsType(nd, WHITESPACE)))
		{
			result = lappend(result, COPY_NODE(nd));
		}
	}
Пример #2
0
Файл: glbl.c Проект: slewsys/ed
/*
 * append_global_node: Append node to end of global queue. Return node
 *   pointer.
 */
static ed_global_node_t *
append_global_node (const ed_line_node_t *lp, ed_buffer_t *ed)
{
  ed_global_node_t *gp;
  ed_global_node_t *tq = ed->core->global_head->q_back;

  spl1 ();
  if (!(gp = (ed_global_node_t *) malloc (ED_GLOBAL_NODE_T_SIZE)))
    {
      fprintf (stderr, "%s\n", strerror (errno));
      ed->exec->err = _("Memory exhausted");
      spl0 ();
      return NULL;
    }
  gp->lp = (ed_line_node_t *) lp;

  /* APPEND_NODE is macro, so tq is mandatory! */
  APPEND_NODE (gp, tq);
  spl0 ();
  return gp;
}