コード例 #1
0
ファイル: cu_list.c プロジェクト: bnordgren/postgis
void test_traversal(void)
{
	FILENODE *node[5];
	FILENODE *current_node;
	GtkTreeIter iter;
	int i = 0;
	init_file_list();

	node[0] = append_file("file1", "schema", "table", "geom_column", "-1", 'c', &iter);
	CU_ASSERT_PTR_NOT_NULL(node[0]);
	node[1] = append_file("file2", "schema", "table", "geom_column", "-1", 'c', &iter);
	CU_ASSERT_PTR_NOT_NULL(node[1]);
	node[2] = append_file("file3", "schema", "table", "geom_column", "-1", 'c', &iter);
	CU_ASSERT_PTR_NOT_NULL(node[2]);
	node[3] = append_file("file4", "schema", "table", "geom_column", "-1", 'c', &iter);
	CU_ASSERT_PTR_NOT_NULL(node[3]);
	node[4] = append_file("file5", "schema", "table", "geom_column", "-1", 'c', &iter);
	CU_ASSERT_PTR_NOT_NULL(node[4]);

	current_node = get_next_node(NULL);
	CU_ASSERT_PTR_NOT_NULL(current_node);
	while (current_node != NULL)
	{
		CU_ASSERT_NOT_EQUAL(i, 5);
		CU_ASSERT_PTR_EQUAL(current_node, node[i]);
		current_node = get_next_node(current_node);
		i++;
	}
}
コード例 #2
0
ファイル: game.c プロジェクト: szczys/SloCommunicator
void follow_tail(void)
{
  --snake_length_current;
  //is tail a neighbor of next?
  if (neighbors(corners[tail],corners[get_next_node(tail)]))
  {
    tail = get_next_node(tail);
  }
  
  //find which axis tail and next have in common
  else
  {
    if (corners[tail].x == corners[get_next_node(tail)].x)
    {
      //These points have the same X, so make adjustment to the Y
      if ((corners[tail].y - corners[get_next_node(tail)].y) < 0) corners[tail].y += 1;
      else corners[tail].y -= 1; 
    }
    else
    {
      //These points have the same Y, so make adjustment to the X
      if ((corners[tail].x - corners[get_next_node(tail)].x) < 0) corners[tail].x += 1;
      else corners[tail].x -= 1; 
    }
  }
}
コード例 #3
0
void
Ndb_cluster_connection_impl::do_test()
{
  Ndb_cluster_connection_node_iter iter;
  int n= no_db_nodes()+5;
  Uint32 *nodes= new Uint32[n+1];

  for (int g= 0; g < n; g++)
  {
    for (int h= 0; h < n; h++)
    {
      Uint32 id;
      Ndb_cluster_connection_node_iter iter2;
      {
	for (int j= 0; j < g; j++)
	{
	  nodes[j]= get_next_node(iter2);
	}
      }

      for (int i= 0; i < n; i++)
      {
	init_get_next_node(iter);
	fprintf(stderr, "%d dead:(", g);
	id= 0;
	while (id == 0)
	{
	  if ((id= get_next_node(iter)) == 0)
	    break;
	  for (int j= 0; j < g; j++)
	  {
	    if (nodes[j] == id)
	    {
	      fprintf(stderr, " %d", id);
	      id= 0;
	      break;
	    }
	  }
	}
	fprintf(stderr, ")");
	if (id == 0)
	{
	  break;
	}
	fprintf(stderr, " %d\n", id);
      }
      fprintf(stderr, "\n");
    }
  }
  delete [] nodes;
}
コード例 #4
0
PurpleBlistNode *purple_blist_node_next(PurpleBlistNode *node, gboolean offline)
{
	PurpleBlistNode *ret = node;

	if (offline)
		return get_next_node(ret, TRUE);
	do
	{
		ret = get_next_node(ret, TRUE);
	} while (ret && PURPLE_IS_BUDDY(ret) &&
			!purple_account_is_connected(purple_buddy_get_account((PurpleBuddy *)ret)));

	return ret;
}
コード例 #5
0
ファイル: nodelist.c プロジェクト: howard5888/wineT
static HRESULT WINAPI xmlnodelist_get_length(
        IXMLDOMNodeList* iface,
        long* listLength)
{

    xmlNodePtr curr, tmp;
    xmlNodePtr *top_level_node = NULL;
    long nodeCount = 0;
    HRESULT r;

    xmlnodelist *This = impl_from_IXMLDOMNodeList( iface );

    TRACE("%p\n", This);

    if (This->node == NULL) {
        *listLength = 0;
	return S_OK;
    }
        
    if(This->enum_children)
    {
        tmp = curr;
        top_level_node = &tmp;
    }

    for(curr = This->node; curr; curr = get_next_node(&This->xinfo, curr, top_level_node))
    {
        r = xslt_next_match( &This->xinfo, &curr, top_level_node );
        if(FAILED(r) || !curr) break;
        nodeCount++;
    }

    *listLength = nodeCount;
    return S_OK;
}
コード例 #6
0
ファイル: nodelist.c プロジェクト: howard5888/wineT
static HRESULT WINAPI xmlnodelist_nextNode(
        IXMLDOMNodeList* iface,
        IXMLDOMNode** nextItem)
{
    xmlnodelist *This = impl_from_IXMLDOMNodeList( iface );
    HRESULT r;
    xmlNodePtr *top_level_node = NULL;

    TRACE("%p %p\n", This, nextItem );

    *nextItem = NULL;

    if(This->enum_children)
        top_level_node = &This->top_level_node;

    r = xslt_next_match( &This->xinfo, &This->current, top_level_node );
    if (FAILED(r) )
        return r;

    if (!This->current)
        return S_FALSE;

    *nextItem = create_node( This->current );
    This->current = get_next_node(&This->xinfo, This->current, top_level_node);
    return S_OK;
}
コード例 #7
0
ファイル: nodelist.c プロジェクト: howard5888/wineT
static HRESULT xslt_next_match( struct xslt_info *info, xmlNodePtr *node, xmlNodePtr *top_level_node )
{
    if (!info->ctxt)
        return S_FALSE;
 
    /* make sure that the current element matches the pattern */
    while ( *node )
    {
        int r;

        r = xsltTestCompMatchList( info->ctxt, *node, info->pattern );
        if ( 1 == r )
        {
            TRACE("Matched %p (%s)\n", *node, (*node)->name );
            return S_OK;
        }
        if (r != 0)
        {
            ERR("Pattern match failed\n");
            return E_FAIL;
        }
        *node = get_next_node(info, *node, top_level_node);
    }
    return S_OK;
}
コード例 #8
0
ファイル: switch_lpm.c プロジェクト: krambn/switch
void switch_lpm_trie_insert(switch_lpm_trie_t *trie,
                            const char *prefix,
                            int prefix_length,
                            const value_t value) {
  node_t *current_node = trie->root;
  byte_t byte;
  unsigned short prefix_key;

  while (prefix_length >= 8) {
    byte = (byte_t)*prefix;
    node_t *node = get_next_node(current_node, byte);
    if (!node) {
      allocate_node(&node);
      node->parent = current_node;
      node->child_id = byte;
      set_next_node(current_node, byte, node);
      current_node->branch_num++;
    }

    prefix++;
    prefix_length -= 8;
    current_node = node;
  }

  if (prefix_length == 0)
    prefix_key = 0;
  else
    prefix_key = get_prefix_key((unsigned)prefix_length, (byte_t)*prefix);

  if (!insert_prefix(current_node, prefix_key, value)) current_node->pref_num++;

  trie->num_entries++;
}
コード例 #9
0
int g2_breadth_first_road_solver_class::path_solve(g1_team_type team, g1_road_object_class * start, g1_road_object_class * dest,
												   g1_path_object_class * * path, w32 stack_size)
{
	g1_road_object_class * node;
	i4_float len; //actually we now use exspected time

	clear_heap();
	clear_solve();

	if (!start || !dest)
	{
		return i4_F;
	}

	add_node(start, 0, 0);
	link_manager * lman=g2_link_man();
	len=0;
	w32 starttime=(w32)g2_act_man()->daytime;
	while (get_next_node(node, len))
	{
		//g1_road_object_class *c =0;
		for (int i=0; i<node->total_links(G1_ALLY); i++) //ally means outgoing
		{
			g2_link * l=lman->get_link(node->get_link_id(G1_ALLY,i));
			i4_float extime=l->quratio(starttime,len);
			//i4_float extime=l->get_length()/l->get_freespeed();
			add_node((g1_road_object_class *)node->get_link(G1_ALLY,i), node,
					 len + extime);
			//else we skip.
		}
	}

	w32 points=0;

	if (dest->ref==0)
	{
		return 0;
	}

	// count nodes
	node = dest;
	points = 0;
	while (node!=start&&points<(stack_size))
	{
		/*point[points*2+0] = i4_float(graph->critical[node].x)+0.5f;
		   point[points*2+1] = i4_float(graph->critical[node].y)+0.5f;
		   points++;
		   node = solve_graph[node].ref;*/
		path[points++]=node;
		node=node->ref;
	}
	path[points++]=start; //it seems paths need this entry to work correctly

	//point[points*2+0] = i4_float(graph->critical[start_node].x)+0.5f;
	//point[points*2+1] = i4_float(graph->critical[start_node].y)+0.5f;
	//points++;

	return points;
}
コード例 #10
0
MatchErrorCode
MatchTable::modify_entry(
  entry_handle_t handle, const ActionFn *action_fn, ActionData action_data
)
{
  WriteLock lock = lock_write();

  ActionFnEntry action_fn_entry(action_fn, std::move(action_data));
  const ControlFlowNode *next_node = get_next_node(action_fn->get_id());
  return match_unit->modify_entry(
    handle, ActionEntry(std::move(action_fn_entry), next_node)
  );
}
コード例 #11
0
ファイル: game.c プロジェクト: szczys/SloCommunicator
uint8_t collision(void)
{
  uint8_t lower = 0;
  uint8_t upper = 0;
  uint8_t testpoint = 1;
  uint8_t i=tail;
  uint8_t nextNode = get_next_node(i);;

  //Check to see if we hit part of the snake
  //traverse all nodes from tail forward
  for (int8_t count=get_node_list_length(tail,head)-3; count>0; count--)
  //while (nextNode<head)
    //( check head-3 because you can't run into a segment any close than that to the head)
  { 
    //check to see if head's x or y are shared with the current point
    if ((corners[head].x == corners[i].x) && (corners[i].x == corners[nextNode].x))
    {
      //which point is the higher  number?
      if (corners[i].y < corners[nextNode].y) {lower = corners[i].y; upper = corners[nextNode].y;}
      else {lower = corners[nextNode].y; upper = corners[i].y;}
      testpoint = corners[head].y;
    }
    else if ((corners[head].y == corners[i].y) && (corners[i].y == corners[nextNode].y))
    {
      //which point is the higher  number?
      if (corners[i].x < corners[nextNode].x) {lower = corners[i].x; upper = corners[nextNode].x;}
      else {lower = corners[nextNode].x; upper = corners[i].x;}
      testpoint = corners[head].x;
    }
    else continue;
    
    //Now check to see if head is a point between this node and the next
    if ((lower<=testpoint) && (testpoint<= upper)) return 1;
    
    i = nextNode;
    nextNode = get_next_node(i);
  }
  return 0;
}
コード例 #12
0
static PurpleBlistNode *get_next_node(PurpleBlistNode *node, gboolean godeep)
{
	if (node == NULL)
		return NULL;

	if (godeep && node->child)
		return node->child;

	if (node->next)
		return node->next;

	return get_next_node(node->parent, FALSE);
}
コード例 #13
0
MatchErrorCode
MatchTable::set_default_action(
  const ActionFn *action_fn, ActionData action_data
)
{
  ActionFnEntry action_fn_entry(action_fn, std::move(action_data));
  const ControlFlowNode *next_node = get_next_node(action_fn->get_id());

  WriteLock lock = lock_write();

  default_entry = ActionEntry(std::move(action_fn_entry), next_node);

  return MatchErrorCode::SUCCESS;
}
コード例 #14
0
ファイル: ecos_bb.c プロジェクト: aeternocap/ecos
idxint ECOS_BB_solve(ecos_bb_pwork* prob) {
    idxint curr_node_idx = 0;

#if MI_PRINTLEVEL > 0
    if (prob->stgs->verbose){
        PRINTTEXT("Iter\tLower Bound\tUpper Bound\tGap\n");
        PRINTTEXT("================================================\n");
    }
#endif

    /* Initialize to root node and execute steps 1 on slide 6 */
    /* of http://stanford.edu/class/ee364b/lectures/bb_slides.pdf*/
    prob->iter = 0;
    initialize_root(prob);
    /*print_node(prob, curr_node_idx);*/
    get_bounds(curr_node_idx, prob);

    prob->global_L = prob->nodes[curr_node_idx].L;
    prob->global_U = prob->nodes[curr_node_idx].U;

    while ( should_continue(prob, curr_node_idx) ){

#if MI_PRINTLEVEL > 0
        if (prob->stgs->verbose){ print_progress(prob); }
#endif

        ++(prob->iter);

        /* Step 2*/
        /* Branch replaces nodes[curr_node_idx] with leftNode*/
        /* and nodes[prob->iter] with rightNode */
        branch(curr_node_idx, prob);

        /* Step 3*/
        get_bounds(curr_node_idx, prob);
        get_bounds(prob->iter, prob);

        /* Step 4*/
        prob->global_L = get_global_L(prob);

        curr_node_idx = get_next_node(prob);
    }
    load_solution(prob);

#if MI_PRINTLEVEL > 0
    if (prob->stgs->verbose){ print_progress(prob); }
#endif

    return get_ret_code(prob);
}
コード例 #15
0
MatchErrorCode
MatchTableIndirect::modify_member(
  mbr_hdl_t mbr, const ActionFn *action_fn, ActionData action_data
)
{
  ActionFnEntry action_fn_entry(action_fn, std::move(action_data));
  const ControlFlowNode *next_node = get_next_node(action_fn->get_id());

  WriteLock lock = lock_write();

  if(!is_valid_mbr(mbr)) return MatchErrorCode::INVALID_MBR_HANDLE;

  action_entries[mbr] = ActionEntry(std::move(action_fn_entry), next_node);

  return MatchErrorCode::SUCCESS;
}
コード例 #16
0
ファイル: fdt.c プロジェクト: 376473984/TrustedGRUB2
/* Find a direct sub-node of a given parent node. */
int grub_fdt_find_subnode (const void *fdt, unsigned int parentoffset,
			   const char *name)
{
  grub_uint32_t *token, *end;
  char *node_name;

  if (parentoffset & 0x3)
    return -1;
  token = (void *) ((grub_addr_t) fdt + grub_fdt_get_off_dt_struct(fdt)
                    + parentoffset);
  end = (void *) struct_end (fdt);
  if ((token >= end) || (grub_be_to_cpu32(*token) != FDT_BEGIN_NODE))
    return -1;
  SKIP_NODE_NAME(node_name, token, end);
  while (token < end)
  {
    switch (grub_be_to_cpu32(*token))
    {
      case FDT_BEGIN_NODE:
        node_name = (char *) (token + 1);
        if (node_name + grub_strlen (name) >= (char *) end)
          return -1;
        if (!grub_strcmp (node_name, name))
          return (int) ((grub_addr_t) token - (grub_addr_t) fdt
                        - grub_fdt_get_off_dt_struct (fdt));
        token = get_next_node (fdt, node_name);
        if (!token)
          return -1;
        break;
      case FDT_PROP:
        /* Skip property token and following data (len, nameoff and property
           value). */
        if (token >= end - 1)
          return -1;
        token += prop_entry_size(grub_be_to_cpu32(*(token + 1)))
                 / sizeof(*token);
        break;
      case FDT_NOP:
        token++;
        break;
      default:
        return -1;
    }
  }
  return -1;
}
コード例 #17
0
MatchErrorCode
MatchTable::add_entry(
  const std::vector<MatchKeyParam> &match_key,
  const ActionFn *action_fn, ActionData action_data, // move it
  entry_handle_t *handle, int priority
)
{
  ActionFnEntry action_fn_entry(action_fn, std::move(action_data));
  const ControlFlowNode *next_node = get_next_node(action_fn->get_id());

  WriteLock lock = lock_write();

  return match_unit->add_entry(
    match_key,
    ActionEntry(std::move(action_fn_entry), next_node),
    handle, priority
  );
}
コード例 #18
0
ファイル: project.c プロジェクト: dkparker/REUproject
static void handle_init_event(node_state *ns, tw_bf *b, node_msg *m, tw_lp *lp) {
  int dest_id;
  node_msg m_remote;

  m_remote.node_event_type = PING;
  m_remote.src = lp->gid;
  ns->start_ts = tw_now(lp);
  ns->last_ts = ns->start_ts;

  dest_id = get_next_node(lp->gid);
  
  if (dest_id == -1) return;
  
  int dim_lens[3] = {10, 10, 10};
  model_net_torus_get_dim_id(dest_id, 3, dim_lens, ns->dest_dim_id); //dim length hard-coded for now
  model_net_event(net_id, "ping", dest_id, payload_sz, 0.0, sizeof(node_msg),
		  (const void*)&m_remote, 0, NULL, lp);
  ns->msg_sent_count++;
}
コード例 #19
0
MatchErrorCode
MatchTableIndirect::add_member(
  const ActionFn *action_fn, ActionData action_data,
  mbr_hdl_t *mbr
)
{
  ActionFnEntry action_fn_entry(action_fn, std::move(action_data));
  const ControlFlowNode *next_node = get_next_node(action_fn->get_id());

  WriteLock lock = lock_write();

  if(mbr_handles.get_handle(mbr)) return MatchErrorCode::ERROR;

  entries_insert(*mbr, ActionEntry(std::move(action_fn_entry), next_node));

  num_members++;

  return MatchErrorCode::SUCCESS;
}
コード例 #20
0
ファイル: switch_lpm.c プロジェクト: krambn/switch
bool switch_lpm_trie_delete(switch_lpm_trie_t *trie,
                            const char *prefix,
                            int prefix_length) {
  node_t *current_node = trie->root;
  byte_t byte;
  unsigned short prefix_key;
  value_t *pdata = NULL;

  while (prefix_length >= 8) {
    byte = (byte_t)*prefix;
    node_t *node = get_next_node(current_node, byte);
    if (!node) return NULL;

    prefix++;
    prefix_length -= 8;
    current_node = node;
  }

  if (prefix_length == 0)
    prefix_key = 0;
  else
    prefix_key = get_prefix_key((unsigned)prefix_length, (byte_t)*prefix);

  pdata = get_prefix_ptr(current_node, prefix_key);
  if (!pdata) return false;

  if (trie->release_memory) {
    assert(delete_prefix(current_node, prefix_key) == 1);
    current_node->pref_num--;
    while (current_node->pref_num == 0 && current_node->branch_num == 0) {
      node_t *tmp = current_node;
      current_node = current_node->parent;
      if (!current_node) break;
      assert(delete_branch(current_node, tmp->child_id) == 1);
      switch_free(tmp);
      current_node->branch_num--;
    }
  }

  trie->num_entries--;
  return true;
}
コード例 #21
0
ファイル: fdt.c プロジェクト: 376473984/TrustedGRUB2
static grub_uint32_t *get_next_node (const void *fdt, char *node_name)
{
  grub_uint32_t *end = (void *) struct_end (fdt);
  grub_uint32_t *token;

  if (node_name >= (char *) end)
    return NULL;
  while (*node_name++)
  {
    if (node_name >= (char *) end)
  	  return NULL;
  }
  token = (grub_uint32_t *) ALIGN_UP ((grub_addr_t) node_name, 4);
  while (token < end)
  {
    switch (grub_be_to_cpu32(*token))
    {
      case FDT_BEGIN_NODE:
        token = get_next_node (fdt, (char *) (token + 1));
        if (!token)
          return NULL;
        break;
      case FDT_END_NODE:
        token++;
        if (token >= end)
          return NULL;
        return token;
      case FDT_PROP:
        /* Skip property token and following data (len, nameoff and property
           value). */
        token += prop_entry_size(grub_be_to_cpu32(*(token + 1)))
                 / sizeof(*token);
        break;
      case FDT_NOP:
        token++;
        break;
      default:
        return NULL;
    }
  }
  return NULL;
}
コード例 #22
0
ファイル: game.c プロジェクト: szczys/SloCommunicator
void move_head(uint8_t new_dir)
{
  if (new_dir)
  {
    //Copy head to new position
    head = get_next_node(head); //increment head
    corners[head].x = corners[get_previous_node(head)].x;
    corners[head].y = corners[get_previous_node(head)].y;
    change_direction();  //change direction
  }
  
  //Have we left the game board?
  if ((corners[head].x == 0) && (dirX == -1)) { game_over(); return; }
  if ((corners[head].y == 0) && (dirY == -1)) { game_over(); return; }
  if ((corners[head].x == GAMEBOARD_X-1) && (dirX == 1)) { game_over(); return; }
  if ((corners[head].y == GAMEBOARD_Y-1) && (dirY == 1)) { game_over(); return; }
  corners[head].x += dirX;
  corners[head].y += dirY;
  ++snake_length_current;
}
コード例 #23
0
Uint32
Ndb_cluster_connection_impl::get_next_alive_node(Ndb_cluster_connection_node_iter &iter)
{
  Uint32 id;

  TransporterFacade *tp = m_impl.m_transporter_facade;
  if (tp == 0 || tp->ownId() == 0)
    return 0;

  while ((id = get_next_node(iter)))
  {
    tp->lock_mutex();
    if (tp->get_node_alive(id) != 0)
    {
      tp->unlock_mutex();
      return id;
    }
    tp->unlock_mutex();
  }
  return 0;
}
コード例 #24
0
ファイル: switch_lpm.c プロジェクト: krambn/switch
bool switch_lpm_trie_lookup(const switch_lpm_trie_t *trie,
                            const char *key,
                            value_t *pvalue) {
  const node_t *current_node = trie->root;
  byte_t byte;
  size_t key_width = trie->key_width_bytes;
  value_t *pdata = NULL;
  unsigned short prefix_key;
  unsigned i;
  bool found = false;

  while (current_node) {
    pdata = get_prefix_ptr(current_node, 0);
    if (pdata) {
      *pvalue = *pdata;
      found = true;
    }
    if (key_width > 0) {
      byte = (byte_t)*key;
      for (i = 7; i > 0; i--) {
        prefix_key = get_prefix_key((unsigned)i, byte);
        pdata = get_prefix_ptr(current_node, prefix_key);
        if (pdata) {
          *pvalue = *pdata;
          found = true;
          break;
        }
      }

      current_node = get_next_node(current_node, byte);
      key++;
      key_width--;
    } else {
      break;
    }
  }

  return found;
}
コード例 #25
0
ファイル: nodelist.c プロジェクト: howard5888/wineT
static HRESULT WINAPI xmlnodelist_get_item(
        IXMLDOMNodeList* iface,
        long index,
        IXMLDOMNode** listItem)
{
    xmlnodelist *This = impl_from_IXMLDOMNodeList( iface );
    xmlNodePtr curr, tmp;
    xmlNodePtr *top_level_node = NULL;
    long nodeIndex = 0;
    HRESULT r;

    TRACE("%p %ld\n", This, index);
 
    *listItem = NULL;

    if (index < 0)
        return S_FALSE;

    curr = This->node;

    if(This->enum_children)
    {
        tmp = curr;
        top_level_node = &tmp;
    }

    while(curr)
    {
        r = xslt_next_match( &This->xinfo, &curr, top_level_node);
        if(FAILED(r) || !curr) return S_FALSE;
        if(nodeIndex++ == index) break;
        curr = get_next_node(&This->xinfo, curr, top_level_node);
    }
    if(!curr) return S_FALSE;

    *listItem = create_node( curr );

    return S_OK;
}
コード例 #26
0
ファイル: switch_lpm.c プロジェクト: krambn/switch
bool switch_lpm_trie_has_prefix(const switch_lpm_trie_t *trie,
                                const char *prefix,
                                int prefix_length) {
  node_t *current_node = trie->root;
  byte_t byte;
  unsigned short prefix_key;

  while (prefix_length >= 8) {
    byte = (byte_t)*prefix;
    node_t *node = get_next_node(current_node, byte);
    if (!node) return false;

    prefix++;
    prefix_length -= 8;
    current_node = node;
  }

  if (prefix_length == 0)
    prefix_key = 0;
  else
    prefix_key = get_prefix_key((unsigned)prefix_length, (byte_t)*prefix);

  return (get_prefix_ptr(current_node, prefix_key) != NULL);
}
main(int argc ,char *argv[])
{
	int i;

	/*checking for creation and printing the tree ---Working*/
	node *tree ;
	tree=create_tree();
	read_ssf_from_file(tree, argv[1]);
	print_tree(tree);
	printf("Checked read and print\n\n");



	/*checking for get_nth_child ----Working*/
	node *child = get_nth_child(tree, 2);
	print_node_without_index(child);
	printf("Checked get_nth_child\n\n");

	/*checking for getchildren-----Working*/
	list_of_nodes *l1;
	l1=getchildren(tree);
	printf("\n\nsize=%d\n", l1->size);
	for (i=0; i< l1->size; i++)
	{
		print_attr_of_node(l1->l[i] );
		printf("\n");
	}
	printf("Checked getchildren\n\n");


	/*checking for getleaves----Working*/
	list_of_nodes *l2;
	l2=getleaves(tree);
	printf("\n\nsize=%d\n", l2->size);
	for (i=0; i< l2->size; i++)
	{
		print_attr_of_node(l2->l[i] );
		printf("\n");
	}
	printf("Checked getleaves\n\n");
	
	/*checking for getleaves_child---Working*/
	list_of_nodes *l3;
	l3=getleaves_child(l1->l[1]);
	printf("\n\nsize=%d\n", l3->size);
	for (i=0; i< l3->size; i++)
	{
		print_attr_of_node(l3->l[i] );
		printf("\n");
	}
	printf("Checked getleaves_child\n\n");

	/*checking for get_nodes---Working*/
	list_of_nodes *l4;
	l4=get_nodes(2,"NNS",tree);
	printf("\n\nsize=%d\n",l4->size);
	for (i=0; i< l4->size; i++)
	{
		print_attr_of_node(l4->l[i]);
		printf("\n");
	}
	printf("Checked get_nodes\n\n");


	/*checking for get_pattern---Working*/
	list_of_nodes *l5;
	l5=get_pattern(2,".*N.*",tree);
	printf("\n\nsize=%d\n",l5->size);
	for (i=0; i< l5->size; i++)
	{
		print_attr_of_node(l5->l[i]);
		printf("\n");
	}
	printf("Checked get_pattern\n\n");

	//checking for delete_node------Working
	//printf("%d\n",delete_node(l5->l[1]));
	//print_tree(tree);

	//checking for count_leaf_nodes ----Working
	printf("count of leaf nodes----%d\n\n", count_leaf_nodes(tree));

	//checking for get_field(s)  ----Working 
	char *str;
       	str=get_field(l5->l[1],1);
	printf("%s\n",str);
	str=get_fields(l5->l[1]);
	printf("%s\n", str);
	printf("Checked get_field and get_fields\n\n");


	//checking for get_next_node  and get_previos_node----Working
	node *N;
	N=get_next_node(l1->l[1]);
	str=get_fields(N);
	printf("%s\n", str);
	N=get_previous_node(l1->l[1]);
	str=get_fields(N);
	printf("%s\n", str);
	printf("Checked get_next_node & get_previous_node\n\n");


	//checking for insert_node_position------Working
	node *M;
	M=create_node_with_attr("iiit","NNP","<loc=hyd>",NULL);
	insert_node_into_position(tree,M,1);
	print_tree(tree);
	printf("Checked insert_node_position\n\n");
	
	/*Checkin print_attr_of_or_node--------Working*/	
	print_attr_of_or_node(M->OR);
	printf("\nChecked print_attr_of_or_node\n\n");
		
}