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


C++ write_node函数代码示例

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


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

示例1: ruby_write_node_bool_to_float

void ruby_write_node_bool_to_float(node_t*n, state_t*s)
{
    strf(s, "(");
    write_node(s, n->child[0]);
    strf(s, " ? 1.0 : 0.0");
    strf(s, ")");
}
开发者ID:JackieXie168,项目名称:mrscake,代码行数:7,代码来源:codegen_ruby.c

示例2: c_write_node_sqr

void c_write_node_sqr(node_t*n, state_t*s)
{
    strf(s, "sqr");
    if(n->child[0]->type!=&node_brackets) strf(s, "(");
    write_node(s, n->child[0]);
    if(n->child[0]->type!=&node_brackets) strf(s, ")");
}
开发者ID:JackieXie168,项目名称:mrscake,代码行数:7,代码来源:codegen_c.c

示例3: 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

示例4: read_node

void FileAllocator::remove_node(FileOffset head_offset, list_node *head,
                                FileOffset node_offset, const list_node *node)
{
    list_node tmp;
    FileOffset tmp_offset;

    if (head->next == node_offset)
    {   // first node; make head skip it
        head->bytes -= node->bytes;
        head->next = node->next;
        if (head->next == 0) // list now empty?
            head->prev = 0;
        else
        {   // correct 'prev' ptr of what's now the first node
            read_node(head->next, &tmp);
            tmp.prev = 0;
            write_node(head->next, &tmp);
        }
        write_node(head_offset, head);
    }
    else
    {   // locate a node that's not the first
        tmp_offset = head->next;
        read_node(tmp_offset, &tmp);
        while (tmp.next != node_offset)
        {
            tmp_offset = tmp.next;
            if (!tmp_offset)
                throw GenericException(__FILE__, __LINE__,
                                       "node not found");
            read_node(tmp_offset, &tmp);
        }
        // tmp/tmp_offset == node before the one to be removed
        tmp.next = node->next;
        write_node(tmp_offset, &tmp);
        if (node->next)
        {   // adjust prev pointer of node->next
            read_node(node->next, &tmp);
            tmp.prev = tmp_offset;
            write_node(node->next, &tmp);
        }
        head->bytes -= node->bytes;
        if (head->prev == node_offset)
            head->prev = node->prev;
        write_node(head_offset, head);
    }
}
开发者ID:epicsdeb,项目名称:channelarchiver,代码行数:47,代码来源:FileAllocator.cpp

示例5: ruby_write_node_sub

void ruby_write_node_sub(node_t*n, state_t*s)
{
    int t;
    for(t=0;t<n->num_children;t++) {
        if(t && !node_has_minus_prefix(n->child[t])) strf(s, "-");
        write_node(s, n->child[t]);
    }
}
开发者ID:JackieXie168,项目名称:mrscake,代码行数:8,代码来源:codegen_ruby.c

示例6: printf

bool FileAllocator::attach(FILE *f, FileOffset reserved_space, bool init)
{
#ifdef DEBUG_FA
    printf("FileAllocator::attach()\n");
#endif
    LOG_ASSERT(f != 0);
    this->f = f;
    this->reserved_space = reserved_space;
    if (fseek(this->f, 0, SEEK_END))
        throw GenericException(__FILE__, __LINE__, "fseek error");
    file_size = ftell(this->f);
    if (file_size < 0)
        throw GenericException(__FILE__, __LINE__, "ftell error");
    // File size should be
    // 0 for new file or at least reserved_space + list headers
    if (file_size == 0)
    {
        if (init == false)
            throw GenericException(__FILE__, __LINE__,
                                   "FileAllocator in read-only mode found empty file");
        // create empty list headers
        memset(&allocated_head, 0, list_node_size);
        memset(&free_head, 0, list_node_size);
        write_node(this->reserved_space, &allocated_head);
        write_node(this->reserved_space+list_node_size, &free_head);
        file_size = ftell(this->f);
        FileOffset expected = reserved_space + 2*list_node_size;
        if (file_size != expected)
             throw GenericException(__FILE__, __LINE__,
                                    "Initialization error: "
                                    "Expected file size %ld, found %ld",
                                    (long) expected, (long) file_size);
        return true; 
    }
    FileOffset expected = this->reserved_space + 2*list_node_size;
    if (file_size < expected)
        throw GenericException(__FILE__, __LINE__,
                               "FileAllocator: Broken file header,"
                               "expected at least %ld bytes",
                               (long) expected);
    // read existing list headers
    read_node(this->reserved_space, &allocated_head);
    read_node(this->reserved_space+list_node_size, &free_head);
    return false; // Didn't initialize the file
}
开发者ID:epicsdeb,项目名称:channelarchiver,代码行数:45,代码来源:FileAllocator.cpp

示例7: write_nodes

static void
write_nodes(FILE *fp, const NSegment *tree)
{
   if (tree == NULL) return;

   write_node(fp, tree);
   write_nodes(fp, tree->left);
   write_nodes(fp, tree->right);
}
开发者ID:svn2github,项目名称:valgrind-3,代码行数:9,代码来源:dot.c

示例8: ruby_write_node_block

void ruby_write_node_block(node_t*n, state_t*s)
{
    int t;
    for(t=0;t<n->num_children;t++) {
        if(t)
            strf(s, "\n");
        write_node(s, n->child[t]);
    }
}
开发者ID:JackieXie168,项目名称:mrscake,代码行数:9,代码来源:codegen_ruby.c

示例9: ruby_write_node_arg_min_or_max

static void ruby_write_node_arg_min_or_max(node_t*n, state_t*s, char*min_or_max)
{
    strf(s, "([");
    int t;
    for(t=0;t<n->num_children;t++) {
        if(t) strf(s, ",");
        write_node(s, n->child[t]);
    }
    strf(s, "].each_with_index.map.%s)[1]", min_or_max);
}
开发者ID:JackieXie168,项目名称:mrscake,代码行数:10,代码来源:codegen_ruby.c

示例10: ps3_repository_write_highmem_size

int ps3_repository_write_highmem_size(unsigned int region_index,
	u64 highmem_size)
{
	return write_node(
		make_first_field("highmem", 0),
		make_field("region", region_index),
		make_field("size", 0),
		0,
		highmem_size, 0);
}
开发者ID:0-T-0,项目名称:ps4-linux,代码行数:10,代码来源:repository.c

示例11: write_node

bool MemoryDump::draw_tree(Node &node, std::ofstream &ofile, const cmd_opt &opt, std::set<uintptr_t> &declared_nodes, int level)
{
    if (node.visited >= 0 && node.visited <= level) return true;
    if (opt.critical_only && !node.critical) return true;
    if (opt.depth > 0 && level >= opt.depth) return true;
    node.visited = level;

    std::vector<ChildNode*> edges;
    for (auto &&c : node.children) {
        if (c.node->subtree_size >= min_size
            && (!opt.critical_only || c.node->critical)) {
            edges.push_back(&c);
        }
    }
    
    std::sort(edges.begin(), edges.end(),
        [](const ChildNode *a, const ChildNode *b) {
        return a->node->subtree_size > b->node->subtree_size;
    }
    );

    if (opt.max_subnodes > 0 && edges.size() > opt.max_subnodes) { //too many nodes, only write nodes with big sizes;
        edges.resize(opt.max_subnodes);
    }

    bool tail_written = false;
    for (const auto & c : edges) {
        if (!tail_written && declared_nodes.find(node.label) == declared_nodes.end()) {
            write_node(node, ofile, opt);
            declared_nodes.insert(node.label);
            tail_written = true;
        }
        if (declared_nodes.find(c->node->label) == declared_nodes.end()) {
            write_node(*c->node, ofile, opt);
            declared_nodes.insert(c->node->label);
        }
        exporter->write_edge(node, *c->node, ofile, c->edge.str());
        draw_tree(*c->node, ofile, opt, declared_nodes, level + 1);
    }

    return true;
}
开发者ID:zsx,项目名称:dump2dot,代码行数:42,代码来源:dump.cpp

示例12: walk_tree

/*
 *  Tree walking with acending key order
 */
void walk_tree(int fd_in, int fd_out, compact_header_t * tree)
{
    if (tree->left != NULL) {
        walk_tree(fd_in, fd_out, tree->left);
    }
    write_node(fd_in, fd_out, tree, io_buf, IO_BUFFER_SZ);

    if (tree->right != NULL) {
        walk_tree(fd_in, fd_out, tree->right);
    }
    free(tree);
}
开发者ID:seccipon,项目名称:test01,代码行数:15,代码来源:main.c

示例13: set_new

intset_t*
set_new() 
{
  intset_t *set;
  node_t *min, *max;

  if ((set = (intset_t *) malloc(sizeof (intset_t))) == NULL) 
    {
      perror("malloc");
      EXIT(1);
    }

  node_t** nodes = (node_t**) pgas_app_alloc_rr(2, sizeof(node_t));
  min = nodes[0];
  max = nodes[1];
  write_node(max, VAL_MAX, 0, 0);
  write_node(min, VAL_MIN, OF(max), 0);

  set->head = min;
  return set;
}
开发者ID:LPD-EPFL,项目名称:tm2c-threads,代码行数:21,代码来源:linkedlist.c

示例14: c_write_node_arg_min_i

void c_write_node_arg_min_i(node_t*n, state_t*s)
{
    strf(s, "arg_min_i(%d, ", n->num_children);
    int t;
    for(t=0;t<n->num_children;t++) {
        if(t)
            strf(s, ", ");
        strf(s, "(int)");
        write_node(s, n->child[t]);
    }
    strf(s, ")");
}
开发者ID:JackieXie168,项目名称:mrscake,代码行数:12,代码来源:codegen_c.c

示例15: ps3_repository_write_highmem_region_count

int ps3_repository_write_highmem_region_count(unsigned int region_count)
{
	int result;
	u64 v1 = (u64)region_count;

	result = write_node(
		make_first_field("highmem", 0),
		make_field("region", 0),
		make_field("count", 0),
		0,
		v1, 0);
	return result;
}
开发者ID:0-T-0,项目名称:ps4-linux,代码行数:13,代码来源:repository.c


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