• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ dump_node函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: dump_node

bool dump_node(TAP_state_t *state, userp_ident_t *root, int lev) {
	if (!root) return false;
	userp_ident_t *next= userp_ident_by_name_right(root);
	if (next) dump_node(state, next, lev+1);
	TAP_NOTE("%*s(%c) %s", lev*4, "", root->name_tree_node.color? 'R':'B', root->name);
	next= userp_ident_by_name_left(root);
	if (next) dump_node(state, next, lev+1);
	return true;
}
开发者ID:nrdvana,项目名称:userp,代码行数:9,代码来源:02-rbtree.c


示例2: dump_node

void dump_node( struct xmlNode *node )
{
	if( node == 0 )
	{
		return;
	}
	printf( "Node:%s Attr:", node->name );
	dump_attr( node->attr_list );
	putc( '\n', stdout );
	dump_node( node->children );
	dump_node( node->sibling );
}
开发者ID:atupal,项目名称:klcommon,代码行数:12,代码来源:test_parser.c


示例3: main

int main( int argc, char **argv )
{
	FILE *fp = 0;
	if( argc < 2 )
	{
		fprintf( stderr, "Usage : %s filename.\n", argv[0] );
		exit( -1 );
	}
	fp = fopen( argv[1], "r" );
	if( fp == 0 )
	{
		fprintf( stderr, "Unable to open %s.\n", argv[1] );
		exit( -1 );
	}

	{
		struct xmlDocument *doc = xmldoc_new( fp );
		xml_seterrorfn( error_log );
		xml_parse( doc );
		dump_node( doc->root );
		xmldoc_free( doc );
	}
	fclose( fp );

	return 0;
}
开发者ID:atupal,项目名称:klcommon,代码行数:26,代码来源:test_parser.c


示例4: dump_node

 void dump_node(Node *n, bool same_line, int padding, MappedSubstring orig) {
     int delta = 0;
     if (!same_line) {
         for (int i = 0; i < padding; ++i) {
             std::cout << " ";
         }
     }
     if (!orig.empty()) {
         auto s = haystack.find(orig.ref_str);
         for (int i = orig.l; i <= orig.r && i <= s->second.length(); ++i) {
             std::cout << s->second[i];
         }
         std::cout << "-";
         delta = orig.r - orig.l + 2;
         if (orig.r == std::numeric_limits<int>::max()) {
             delta = s->second.length() - orig.l + 2;
         }
     }
     same_line = true;
     for (auto t_it : n->g) {
         dump_node(t_it.second.tgt, same_line, padding + delta, t_it.second.sub);
         same_line = false;
     }
     if (same_line) {
         std::cout << "##" << std::endl;
     }
 }
开发者ID:CCJY,项目名称:coliru,代码行数:27,代码来源:main.cpp


示例5: dump_vector

void
dump_vector(int indent, Vector *vec)
{
  for (int i = 0; i < vec->length; i++) {
    dump_node(indent, (Node *)vector_get(vec, i));
  }
}
开发者ID:k0kubun,项目名称:clannad,代码行数:7,代码来源:debug.c


示例6: c_genericize

void
c_genericize (tree fndecl)
{
  FILE *dump_orig;
  int local_dump_flags;
  struct cgraph_node *cgn;

  /* Dump the C-specific tree IR.  */
  dump_orig = dump_begin (TDI_original, &local_dump_flags);
  if (dump_orig)
    {
      fprintf (dump_orig, "\n;; Function %s",
	       lang_hooks.decl_printable_name (fndecl, 2));
      fprintf (dump_orig, " (%s)\n",
	       (!DECL_ASSEMBLER_NAME_SET_P (fndecl) ? "null"
		: IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (fndecl))));
      fprintf (dump_orig, ";; enabled by -%s\n", dump_flag_name (TDI_original));
      fprintf (dump_orig, "\n");

      if (local_dump_flags & TDF_RAW)
	dump_node (DECL_SAVED_TREE (fndecl),
		   TDF_SLIM | local_dump_flags, dump_orig);
      else
	print_c_tree (dump_orig, DECL_SAVED_TREE (fndecl));
      fprintf (dump_orig, "\n");

      dump_end (TDI_original, dump_orig);
    }

  /* Dump all nested functions now.  */
  cgn = cgraph_node (fndecl);
  for (cgn = cgn->nested; cgn ; cgn = cgn->next_nested)
    c_genericize (cgn->decl);
}
开发者ID:sequoiar,项目名称:moxiedev,代码行数:34,代码来源:c-gimplify.c


示例7: open_file

static svn_error_t *
open_file(const char *path,
          void *parent_baton,
          svn_revnum_t ancestor_revision,
          apr_pool_t *pool,
          void **file_baton)
{
  struct dir_baton *pb = parent_baton;
  struct edit_baton *eb = pb->edit_baton;
  const char *cmp_path = NULL;
  svn_revnum_t cmp_rev = SVN_INVALID_REVNUM;

  /* If the parent directory has explicit comparison path and rev,
     record the same for this one. */
  if (ARE_VALID_COPY_ARGS(pb->cmp_path, pb->cmp_rev))
    {
      cmp_path = svn_relpath_join(pb->cmp_path,
                                  svn_relpath_basename(path, pool), pool);
      cmp_rev = pb->cmp_rev;
    }

  SVN_ERR(dump_node(eb, path,
                    svn_node_file, svn_node_action_change,
                    FALSE, cmp_path, cmp_rev, pool));

  *file_baton = NULL;  /* muhahahaha again */
  return SVN_NO_ERROR;
}
开发者ID:mommel,项目名称:alien-svn,代码行数:28,代码来源:dump.c


示例8: close_directory

static svn_error_t *
close_directory(void *dir_baton,
                apr_pool_t *pool)
{
  struct dir_baton *db = dir_baton;
  struct edit_baton *eb = db->edit_baton;
  apr_hash_index_t *hi;
  apr_pool_t *subpool = svn_pool_create(pool);

  for (hi = apr_hash_first(pool, db->deleted_entries);
       hi;
       hi = apr_hash_next(hi))
    {
      const void *key;
      const char *path;
      apr_hash_this(hi, &key, NULL, NULL);
      path = key;

      svn_pool_clear(subpool);

      /* By sending 'svn_node_unknown', the Node-kind: header simply won't
         be written out.  No big deal at all, really.  The loader
         shouldn't care.  */
      SVN_ERR(dump_node(eb, path,
                        svn_node_unknown, svn_node_action_delete,
                        FALSE, NULL, SVN_INVALID_REVNUM, subpool));
    }

  svn_pool_destroy(subpool);
  return SVN_NO_ERROR;
}
开发者ID:mommel,项目名称:alien-svn,代码行数:31,代码来源:dump.c


示例9: add_file

static svn_error_t *
add_file(const char *path,
         void *parent_baton,
         const char *copyfrom_path,
         svn_revnum_t copyfrom_rev,
         apr_pool_t *pool,
         void **file_baton)
{
  struct dir_baton *pb = parent_baton;
  struct edit_baton *eb = pb->edit_baton;
  void *val;
  svn_boolean_t is_copy = FALSE;

  /* This might be a replacement -- is the path already deleted? */
  val = apr_hash_get(pb->deleted_entries, path, APR_HASH_KEY_STRING);

  /* Detect add-with-history. */
  is_copy = ARE_VALID_COPY_ARGS(copyfrom_path, copyfrom_rev);

  /* Dump the node. */
  SVN_ERR(dump_node(eb, path,
                    svn_node_file,
                    val ? svn_node_action_replace : svn_node_action_add,
                    is_copy,
                    is_copy ? copyfrom_path : NULL,
                    is_copy ? copyfrom_rev : SVN_INVALID_REVNUM,
                    pool));

  if (val)
    /* delete the path, it's now been dumped. */
    apr_hash_set(pb->deleted_entries, path, APR_HASH_KEY_STRING, NULL);

  *file_baton = NULL;  /* muhahahaha */
  return SVN_NO_ERROR;
}
开发者ID:mommel,项目名称:alien-svn,代码行数:35,代码来源:dump.c


示例10: dump_node

void dump_node(const node_t *node, const char *path)
{
	node_t *child;
	char *path_new;
	int i;

	assert (node && path);	/* path could point to an empty string but never NULL */

	if (!(path_new = (char *)malloc(strlen(path) + 2))) {
		return;
	}

	sprintf(path_new, "%s%c", path, node->c);

	if (node->cnt) {
		printf("%s : %d\n", path_new, node->cnt);
	}

	for (i = 0; i < AVAILABLE_CHARS; i++) {
		if (!(child = node->children[i])) {
			continue;
		}

		dump_node(child, path_new);
	}

	free(path_new);
}
开发者ID:Qingtao-Cao,项目名称:quiz,代码行数:28,代码来源:node.c


示例11: setlocale

char *store_restart_layout(void) {
    setlocale(LC_NUMERIC, "C");
    yajl_gen gen = yajl_gen_alloc(NULL);

    dump_node(gen, croot, true);

    setlocale(LC_NUMERIC, "");

    const unsigned char *payload;
    size_t length;
    y(get_buf, &payload, &length);

    /* create a temporary file if one hasn't been specified, or just
     * resolve the tildes in the specified path */
    char *filename;
    if (config.restart_state_path == NULL) {
        filename = get_process_filename("restart-state");
        if (!filename)
            return NULL;
    } else {
        filename = resolve_tilde(config.restart_state_path);
    }

    int fd = open(filename, O_WRONLY | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR);
    if (fd == -1) {
        perror("open()");
        free(filename);
        return NULL;
    }

    size_t written = 0;
    while (written < length) {
        int n = write(fd, payload + written, length - written);
        /* TODO: correct error-handling */
        if (n == -1) {
            perror("write()");
            free(filename);
            close(fd);
            return NULL;
        }
        if (n == 0) {
            DLOG("write == 0?\n");
            free(filename);
            close(fd);
            return NULL;
        }
        written += n;
        DLOG("written: %zd of %zd\n", written, length);
    }
    close(fd);

    if (length > 0) {
        DLOG("layout: %.*s\n", (int)length, payload);
    }

    y(free);

    return filename;
}
开发者ID:Fresne,项目名称:i3-1,代码行数:59,代码来源:util.c


示例12: dump_node

static void
dump_node(struct npr_rbtree_node *n, int depth)
{
    if (n) {
        dump_node(n->left, depth+1);
        for (int di=0; di<depth; di++) {
            printf("    ");
        }
        if (n->color == BLACK) {
            printf("{B, %d,%d}\n", (int)n->key, (int)n->v);
        } else {
            printf("{R, %d,%d}\n", (int)n->key, (int)n->v);
        }

        dump_node(n->right, depth+1);
    }
}
开发者ID:tanakamura,项目名称:anytrace,代码行数:17,代码来源:red-black-tree.c


示例13: dump_trie

void dump_trie(Trie *v, int detail)
{
	int		i;

	dump_node(v, detail);
	for (i = 0; i < v->nchildren; i++)
		dump_trie(&v->children[i], detail);
}
开发者ID:jeffli999,项目名称:bitband,代码行数:8,代码来源:trie.c


示例14: dump_path

void dump_path(Trie *v, int detail)
{
	int		depth = v->depth, i;
	Trie 	*path[MAX_DEPTH];

	while (v != NULL) {
		path[v->depth] = v;
		v = v->parent;
	}

	for (i = 0; i < depth; i++) {
		if (path[i]->nrules <= 16)
			dump_node(path[i], detail);
		else
			dump_node(path[i], 0);
	}
}
开发者ID:jeffli999,项目名称:bitband,代码行数:17,代码来源:trie.c


示例15: dump

/*
Print the created AST to stdout, mostly for debugging purposes
*/
void dump(file_contents contents) {
    {
        linked_iter iterator = ll_iter_head(contents.imports);
        while(ll_iter_has_next(&iterator)) {
            import_declaration *import = ll_iter_next(&iterator);
            printf("IMPORT: %s\n", evaluate(import->name));
        }
    }
    {
        linked_iter iterator = ll_iter_head(contents.enums);
        while(ll_iter_has_next(&iterator)) {
            enum_declaration *dec = ll_iter_next(&iterator);
            printf("ENUM: %s\n", evaluate(dec->name));
            linked_iter items = ll_iter_head(dec->options);
            while(ll_iter_has_next(&items)) {
                statement *option = ll_iter_next(&items);
                printf("\tOPTION: %s\n", evaluate(option->data));
            }
        }
    }
	{
		linked_iter iterator = ll_iter_head(contents.structs);
		while(ll_iter_has_next(&iterator)) {
            struct_declaration *current = ll_iter_next(&iterator);
			printf("STRUCT: %s\n", evaluate(current->name));
            linked_iter iterator = ll_iter_head(current->members);
			while(ll_iter_has_next(&iterator)) {
                struct_member *member = ll_iter_next(&iterator);
				printf("\tMEMBER: NAME: %s | TYPE: %s\n", evaluate(member->name), evaluate(member->type));
			}
		}
	}
	{
        linked_iter iterator = ll_iter_head(contents.functions);
        while(ll_iter_has_next(&iterator)) {
            func_declaration *current = ll_iter_next(&iterator);
			printf("FUNC: %s | TYPE : %s\n", evaluate(current->name), evaluate(current->type));
            printf("\tPARAMETERS:\n");
			dump_node(current->parameters, 2);
            printf("\tBODY:\n");
			dump_node(current->root->children, 2);
		}
	}

}
开发者ID:fwum,项目名称:fwum,代码行数:48,代码来源:printing.c


示例16: dump_node

static int dump_node(pNode node)
{
  switch(node->type) {
  case literal: printf("\"%s\"", node->data); break;
  case symbol: 
    printf("{%s", node->data); 
    if(node->params) { printf("("); dump_atoms(node->params); printf(")"); };
    printf("}"); 
    break;
  case mapping: dump_node(node->params); printf(" > %s", node->data); break;
  case deref: printf("DEREF("); dump_node(node->params); printf(")"); break;
  case var_conddef: printf("%s << ", node->data); dump_node(node->params); 
      break;
  case var_def: printf("%s = ", node->data); dump_node(node->params); break;
  case code: printf("code:"); dump_code(node->data); break;
    break;
  };
};
开发者ID:ahaym,项目名称:trumpify,代码行数:18,代码来源:dump.c


示例17: yyprint

void yyprint (FILE* outfile, unsigned short toknum,
              astree* yyvaluep) {
   if (is_defined_token (toknum)) {
      dump_node (outfile, yyvaluep);
   }else {
      fprintf (outfile, "%s(%d)\n",
               get_yytname (toknum), toknum);
   }
   fflush (NULL);
}
开发者ID:Nicojaw,项目名称:104a-A4,代码行数:10,代码来源:astree.cpp


示例18: yyprint

void yyprint (FILE *outfile, unsigned short toknum, astree yyvaluep) {
   fprintf (outfile, "%d=%s)\n%*s(",
             toknum, get_yytname (toknum), 9, "");
   if (is_astree (yyvaluep)) {
      dump_node (outfile, yyvaluep, 3);
   }else{
      fprintf (outfile, "yyvaluep = %p", (void*) yyvaluep);
   }
   fflush (NULL);
}
开发者ID:mtnash,项目名称:oc,代码行数:10,代码来源:astree.c


示例19: dump_astree_rec

static void dump_astree_rec (FILE* outfile, astree* root,
                             int depth) {
   if (root == NULL) return;
   dump_node (outfile, root);
   fprintf (outfile, "\n");
   for (size_t child = 0; child < root->children.size();
        ++child) {
      dump_astree_rec (outfile, root->children[child],
                       depth + 1);
   }
}
开发者ID:Nicojaw,项目名称:104a-A4,代码行数:11,代码来源:astree.cpp


示例20: dump_astree_rec

static void dump_astree_rec (FILE *outfile, astree root, int depth) {
   astree child = NULL;
   if (root == NULL) return;
   assert (is_astree (root));
   //fprintf (outfile, "%*s%s ", depth * 3, "", root->lexinfo);
   dump_node (outfile, root, depth);
   fprintf (outfile, "\n");
   for (child = root->first; child != NULL; child = child->next) {
      dump_astree_rec (outfile, child, depth + 1);
   }
}
开发者ID:mtnash,项目名称:oc,代码行数:11,代码来源:astree.c



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ dump_packet函数代码示例发布时间:2022-05-30
下一篇:
C++ dump_mem函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap