当前位置: 首页>>代码示例>>C++>>正文


C++ copy_node函数代码示例

本文整理汇总了C++中copy_node函数的典型用法代码示例。如果您正苦于以下问题:C++ copy_node函数的具体用法?C++ copy_node怎么用?C++ copy_node使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了copy_node函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: reheap_down

static void reheap_down(pj_timer_heap_t *ht, pj_timer_entry *moved_node,
                        size_t slot, size_t child)
{
    PJ_CHECK_STACK();

    // Restore the heap property after a deletion.
    
    while (child < ht->cur_size)
    {
	// Choose the smaller of the two children.
	if (child + 1 < ht->cur_size
	    && PJ_TIME_VAL_LT(ht->heap[child + 1]->_timer_value, ht->heap[child]->_timer_value))
	    child++;
	
	// Perform a <copy> if the child has a larger timeout value than
	// the <moved_node>.
	if (PJ_TIME_VAL_LT(ht->heap[child]->_timer_value, moved_node->_timer_value))
        {
	    copy_node( ht, slot, ht->heap[child]);
	    slot = child;
	    child = HEAP_LEFT(child);
        }
	else
	    // We've found our location in the heap.
	    break;
    }
    
    copy_node( ht, slot, moved_node);
}
开发者ID:conght,项目名称:BLM-Lib,代码行数:29,代码来源:timer.c

示例2: SE_addto_summary

static void
SE_addto_summary(IPA_cgraph_edgelist_e edge_type, 
		 IPA_cgraph_node_t *src_node, 
		 IPA_cgraph_node_t *dst_node, 
		 IPA_cgraph_edge_data_t *edata)
{
  IPA_cgraph_node_t *ls;
  IPA_cgraph_node_t *ld;

  if (src_node->cgraph == local_sum)
    {
      ls = src_node;
    }
  else
    {
      assert(src_node->cgraph == cg);
      ls = copy_node(local_sum, src_node, 0);
    }

  if (dst_node->cgraph == local_sum)
    {
      ld = dst_node;
    }
  else    
    {
      assert(dst_node->cgraph == cg);
      ld = copy_node(local_sum, dst_node, 0);
    }

  if (IPA_FLAG_ISSET(src_node->flags, IPA_CG_NODE_FLAGS_GLOBAL) ||
      IPA_FLAG_ISSET(dst_node->flags, IPA_CG_NODE_FLAGS_GLOBAL))
    {
      assert(0);
    }
  if (IPA_FLAG_ISSET(src_node->flags, IPA_CG_NODE_FLAGS_NOCNTXT) ||
      IPA_FLAG_ISSET(dst_node->flags, IPA_CG_NODE_FLAGS_NOCNTXT))
    {
      assert(0);
    }

  IPA_FLAG_SET(src_node->flags, EA_PERMANENT);
  IPA_FLAG_SET(dst_node->flags, EA_PERMANENT);

#if DB_EFF
  printf("Final Effect : ");
  IPA_cg_node_print(stdout, dst_node, IPA_PRINT_ASCI);
  printf(" <- %14s %d,%d,%d - ",
	 edge_types[edge_type],
	 edata->target_offset,
	 edata->assign_size,
	 edata->source_offset);
  IPA_cg_node_print(stdout, src_node, IPA_PRINT_ASCI);
  printf("\n");
#endif

  IPA_consg_ensure_edge_d (edge_type, ls, ld,
			   edata,
			   (IPA_CG_EDGE_FLAGS_EXPLICIT |
			    IPA_CG_EDGE_FLAGS_HZ));
}
开发者ID:invisibleboy,项目名称:mycompiler,代码行数:60,代码来源:pipa_consg_fdvs_effect_analysis.c

示例3: add_polynomial

int add_polynomial(const polynomial ppoly1, const polynomial ppoly2, polynomial poly_sum)
{
	int temp_coe;
	position poly1 = ppoly1->next;
	position poly2 = ppoly2->next;
	
	ppoly1->next->exponent = 10000;	
	
	printf("----start to add----\n");
	while(poly1 && poly2){
		if(poly1->exponent > poly2->exponent){
			copy_node(poly1,&poly_sum);

			poly1 = poly1->next;
		}
		else if(poly1->exponent < poly2->exponent){
			copy_node(poly2,&poly_sum);

			poly2 = poly2->next;	
		}
		else{
			temp_coe = poly1->coefficient + poly2->coefficient;

			if(temp_coe){
				polynomial new_node = malloc(sizeof(struct node));
				if(new_node == NULL){
					printf("out of space\n");
					return 0;
				}
				new_node->coefficient = temp_coe;
				new_node->exponent = poly1->exponent;
				new_node->next = NULL;
				
				copy_node(new_node,&poly_sum);

				poly1 = poly1->next;
				poly2 = poly2->next;
			}
		}
	}

	while(poly1){
		copy_node(poly1,&poly_sum);
		poly1 = poly1->next;
	}
	while(poly2){
		copy_node(poly2,&poly_sum);
		poly2 = poly2->next;
	}
}
开发者ID:woodcarver,项目名称:my-homework,代码行数:50,代码来源:polynomail.c

示例4: add_node_graph

graph add_node_graph(graph g, node s){
  int newSize = graph_get_nbNodes(g)+1;
  graph d = realloc(g, sizeof(int) + sizeof(node) * newSize);
  d->nodes[newSize-1] = copy_node(s);
  d->nbNodes = newSize;
  return d;
}
开发者ID:ZuperKuchen,项目名称:ProjetRushHourPRS,代码行数:7,代码来源:graph.c

示例5: sort_list

void sort_list(node_t *node_list, int count)
{
	/* Insertion Sort - Ascending Order based on tag. */
	int i=0, j=0;
	node_t x;

	for (j=1 ; j < count ; j++) {
		copy_node(&x, &node_list[j]);
		i = j - 1;
		while (i >= 0 && node_list[i].tag > x.tag) {
			copy_node(&node_list[i+1], &node_list[i]);
			i -= 1;
		}
		copy_node(&node_list[i+1], &x);
	}
}
开发者ID:salilkanitkar,项目名称:out_of_order_superscalar_processor_simulator,代码行数:16,代码来源:utils.c

示例6: serd_writer_end_anon

SERD_API
SerdStatus
serd_writer_end_anon(SerdWriter*     writer,
                     const SerdNode* node)
{
	if (writer->syntax == SERD_NTRIPLES) {
		return SERD_SUCCESS;
	}
	if (serd_stack_is_empty(&writer->anon_stack) || writer->indent == 0) {
		w_err(writer, SERD_ERR_UNKNOWN,
		      "unexpected end of anonymous node\n");
		return SERD_ERR_UNKNOWN;
	}
	--writer->indent;
	write_sep(writer, SEP_ANON_END);
	reset_context(writer, true);
	writer->context = *anon_stack_top(writer);
	serd_stack_pop(&writer->anon_stack, sizeof(WriteContext));
	const bool is_subject = serd_node_equals(node, &writer->context.subject);
	if (is_subject) {
		copy_node(&writer->context.subject, node);
		writer->context.predicate.type = SERD_NOTHING;
	}
	return SERD_SUCCESS;
}
开发者ID:AkiraShirase,项目名称:audacity,代码行数:25,代码来源:writer.c

示例7: remove_discr_ref

static Node remove_discr_ref(Node expr_node, Node object) /*;remove_discr_ref*/
{
	/* Within the record definition, a discriminant reference can be replaced
	 * by a selected component for the instance of the record being built.
	 */

	Node		e;
	int		i, nk;
	Tuple	tup;

	if (N_KIND(expr_node) == as_discr_ref)
		return new_selector_node(object, N_UNQ(expr_node));
	else if (N_KIND(expr_node) == as_opt)
		return OPT_NODE;
	else {
		e = copy_node(expr_node);
		nk = N_KIND(e);
		if (N_AST1_DEFINED(nk) && N_AST1(e)!=(Node)0)
			N_AST1(e) = remove_discr_ref(N_AST1(e), object);
		if (N_AST2_DEFINED(nk) && N_AST2(e)!=(Node)0)
			N_AST2(e) = remove_discr_ref(N_AST2(e), object);
		if (N_AST3_DEFINED(nk) && N_AST3(e)!=(Node)0)
			N_AST3(e) = remove_discr_ref(N_AST3(e), object);
		if (N_AST4_DEFINED(nk) && N_AST4(e)!=(Node)0)
			N_AST4(e) = remove_discr_ref(N_AST4(e), object);
	}
	/*N_LIST(e) = [remove_discr_ref(n, object): n in N_LIST(e)];*/
	if (N_LIST_DEFINED(nk) && N_LIST(e)!=(Tuple)0) {
		tup = N_LIST(e);
		for (i = 1; i <= tup_size(tup); i++)
			tup[i] = (char *) remove_discr_ref((Node) tup[i], object);
	}
	return e;
}
开发者ID:daveshields,项目名称:AdaEd,代码行数:34,代码来源:initobj.c

示例8: write_pred

static void
write_pred(SerdWriter* writer, SerdStatementFlags flags, const SerdNode* pred)
{
	write_node(writer, pred, NULL, NULL, FIELD_PREDICATE, flags);
	write_sep(writer, SEP_P_O);
	copy_node(&writer->context.predicate, pred);
}
开发者ID:AkiraShirase,项目名称:audacity,代码行数:7,代码来源:writer.c

示例9: extract_abbreviations

/* extract_abbreviations -- traverse node tree and find abbreviation definitions */
void extract_abbreviations(node *list, scratch_pad *scratch) {
	node *temp;

	while (list != NULL) {
		switch (list->key) {
			case ABBREVIATION:
				temp = copy_node(list);
				list->key = KEY_COUNTER;	/* Mark this as dead; we will use it elsewhere */
				trim_trailing_whitespace(temp->str);
				scratch->abbreviations = cons(temp, scratch->abbreviations);
				break;
			case HEADINGSECTION:
			case RAW:
			case LIST:
			case BLOCKQUOTEMARKER:
			case BLOCKQUOTE:
				extract_abbreviations(list->children, scratch);
				break;
			default:
				/* Try to boost performance by skipping dead ends */
				break;
		}
		list = list->next;
	}
}
开发者ID:fletcher,项目名称:MultiMarkdown-4,代码行数:26,代码来源:writer.c

示例10: do_CopyNode

 // 'chr
 // [...]
 // "..."
 // begin-end
 inline bool do_CopyNode() {
     if (!allocate(true)) return false;
     copy_node();
     result->type = node->type;
     result->done = true;
     return true;
 }
开发者ID:dkdream,项目名称:Copper,代码行数:11,代码来源:cu_firstset.c

示例11: pushdecl

tree
pushdecl (tree decl)
{
  if (global_bindings_p ())
    DECL_CONTEXT (decl) = current_translation_unit;
  else
    {
      /* External objects aren't nested.  For debug info insert a copy
         of the decl into the binding level.  */
      if (DECL_EXTERNAL (decl))
	{
	  tree orig = decl;
	  decl = copy_node (decl);
	  DECL_CONTEXT (orig) = NULL_TREE;
	}
      DECL_CONTEXT (decl) = current_function_decl;
    }

  /* Put the declaration on the list.  */
  DECL_CHAIN (decl) = current_binding_level->names;
  current_binding_level->names = decl;

  /* For the declaration of a type, set its name if it is not already set.  */

  if (TREE_CODE (decl) == TYPE_DECL && TYPE_NAME (TREE_TYPE (decl)) == 0)
    {
      if (DECL_SOURCE_LINE (decl) == 0)
	TYPE_NAME (TREE_TYPE (decl)) = decl;
      else
	TYPE_NAME (TREE_TYPE (decl)) = DECL_NAME (decl);
    }

  return decl;
}
开发者ID:mohammadsavadkuhi,项目名称:gcc,代码行数:34,代码来源:f95-lang.c

示例12: new_full_graph

graph new_full_graph(node *tabNodes, int nbNodes){
  graph newGraph = malloc(sizeof(int) + sizeof(node)*nbNodes);
  newGraph->nbNodes = nbNodes;
  for(int i=0; i<nbNodes; i++){
    newGraph->nodes[i] = copy_node(tabNodes[i]);
  }
  return newGraph;
}
开发者ID:ZuperKuchen,项目名称:ProjetRushHourPRS,代码行数:8,代码来源:graph.c

示例13: extract_references

/* extract_references -- go through node tree and find elements we need to reference;
   e.g. links, images, citations, footnotes 
   Copy them from main parse tree */
void extract_references(node *list, scratch_pad *scratch) {
	node *temp;
	char * temp_str;
	link_data *l;
	
	while (list != NULL) {
		switch (list->key) {
			case LINKREFERENCE:
				l = list->link_data;
				temp_str = lower_string(l->label);

				temp = mk_link(list->children, temp_str, l->source, l->title, NULL);
				temp->link_data->attr = copy_node_tree(l->attr);

				/* store copy of link reference */
				scratch->links = cons(temp, scratch->links);
				
				free(temp_str);

				break;
			case NOTESOURCE:
			case GLOSSARYSOURCE:
				temp = copy_node(list);
				scratch->notes = cons(temp, scratch->notes);
				break;
			case H1: case H2: case H3: case H4: case H5: case H6:
				if ((list->children->key != AUTOLABEL) && !(scratch->extensions & EXT_NO_LABELS)
				&& !(scratch->extensions & EXT_COMPATIBILITY)) {
					char *label = label_from_node_tree(list->children);

					/* create a label from header */
					temp = mk_autolink(label);
					scratch->links = cons(temp, scratch->links);
					free(label);
				}
				break;
			case TABLE:
				if (list->children->key != TABLELABEL) {
					char *label = label_from_node(list->children);

					/* create a label from header */
					temp = mk_autolink(label);
					scratch->links = cons(temp, scratch->links);
					free(label);
				}

				break;
			case HEADINGSECTION:
			case RAW:
			case LIST:
				extract_references(list->children, scratch);
				break;
			default:
				break;
		}
		list = list->next;
	}
}
开发者ID:fletcher,项目名称:MultiMarkdown-4,代码行数:61,代码来源:writer.c

示例14: list_copy

list list_copy(const list p)
{
    list ls = make_nil();
    for (node *q = p; q != NULL; q = q->next) {
        node *pnew = copy_node(q);
        append_node(&ls, pnew);
    }
    return ls;
}
开发者ID:nettee,项目名称:code_history,代码行数:9,代码来源:o_sllist.c

示例15: copy_node

void copy_node(node *f, node *t)
{
	int i;
	t->n=f->n;
	if (t->n<=0)	return;
	t->t=f->t;
	t->child=new node [t->n];
	for (i=0;i<t->n;i++)
		copy_node(&f->child[i],&t->child[i]);
}
开发者ID:BingyZhang,项目名称:CommutEnc,代码行数:10,代码来源:cpabe.cpp


注:本文中的copy_node函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。