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


C++ print_indent函数代码示例

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


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

示例1: print_assignment

 std::ostream& print_assignment(const ast::Assignment& assignment) {
   print_indent();
   stream << assignment.identifier << " := ";
   node(*assignment.value);
   stream << ";\n";
   return stream;
 }
开发者ID:scoiatael,项目名称:Czero,代码行数:7,代码来源:pretty_print.cpp

示例2: xml_print_tree_internal

static void xml_print_tree_internal(GNode *node, gpointer data){
	NODE_DATA *node_data;

	node_data = (NODE_DATA *)(node->data);

	if(node_data->name){
		print_indent(node_data->depth);
		printf("%s", node_data->name);
		if(node_data->attr != NULL){
			GList *list;
			NODE_ATTR *attr;
			list = g_list_first(node_data->attr);
			while(list){
				attr = (NODE_ATTR *)(list->data);
				g_print(" %s=%s", attr->name, attr->value);
				list = g_list_next(list);
			}
		}
		g_print("\n");

		if(G_NODE_IS_LEAF(node)){
			print_indent2(node_data->depth);
			if(node_data->content != NULL){
				printf(">%s<\n", node_data->content);
			} else {
				printf("NULL\n");
			}
		} else {
			g_node_children_foreach(node, G_TRAVERSE_ALL, (GNodeForeachFunc)xml_print_tree_internal, (gpointer)NULL);
		}
	} else {
		g_node_children_foreach(node, G_TRAVERSE_ALL, (GNodeForeachFunc)xml_print_tree_internal, (gpointer)NULL);
	}
}
开发者ID:fujii,项目名称:ebview,代码行数:34,代码来源:xml.c

示例3: print_return

 std::ostream& print_return(const ast::Return& retrn) {
   print_indent();
   stream << "return ";
   node(*retrn.value);
   stream << ";\n";
   return stream;
 }
开发者ID:scoiatael,项目名称:Czero,代码行数:7,代码来源:pretty_print.cpp

示例4: terminal_callback

void terminal_callback(struct gzl_parse_state *parse_state,
                       struct gzl_terminal *terminal)
{
    struct gzl_buffer *buffer = (struct gzl_buffer*)parse_state->user_data;
    struct gzlparse_state *user_state = (struct gzlparse_state*)buffer->user_data;
    struct gzl_parse_stack_frame *frame = DYNARRAY_GET_TOP(parse_state->parse_stack);
    assert(frame->frame_type == GZL_FRAME_TYPE_RTN);
    struct gzl_rtn_frame *rtn_frame = &frame->f.rtn_frame;

    print_newline(user_state, false);
    print_indent(user_state);

    char *terminal_name = get_json_escaped_string(terminal->name, 0);
    int start = terminal->offset.byte - buffer->buf_offset;
    assert(start >= 0);
    assert(start+terminal->len <= buffer->buf_len);
    char *terminal_text = get_json_escaped_string(buffer->buf+
                                                  (terminal->offset.byte - buffer->buf_offset),
                                                  terminal->len);
    char *slotname = get_json_escaped_string(rtn_frame->rtn_transition->slotname, 0);
    printf("{\"terminal\": %s, \"slotname\": %s, \"slotnum\": %d, \"byte_offset\": %zu, "
           "\"line\": %zu, \"column\": %zu, \"len\": %zu, \"text\": %s}",
           terminal_name, slotname, rtn_frame->rtn_transition->slotnum,
           terminal->offset.byte, terminal->offset.line, terminal->offset.column,
           terminal->len, terminal_text);
    free(terminal_name);
    free(terminal_text);
    free(slotname);
}
开发者ID:ktf,项目名称:gazelle,代码行数:29,代码来源:gzlparse.c

示例5: start_rule_callback

void start_rule_callback(struct gzl_parse_state *parse_state)
{
    struct gzl_buffer *buffer = (struct gzl_buffer*)parse_state->user_data;
    struct gzlparse_state *user_state = (struct gzlparse_state*)buffer->user_data;
    struct gzl_parse_stack_frame *frame = DYNARRAY_GET_TOP(parse_state->parse_stack);
    assert(frame->frame_type == GZL_FRAME_TYPE_RTN);
    struct gzl_rtn_frame *rtn_frame = &frame->f.rtn_frame;

    print_newline(user_state, false);
    print_indent(user_state);
    char *rule = get_json_escaped_string(rtn_frame->rtn->name, 0); 
    printf("{\"rule\":%s, \"start\": %zu, \"line\": %zu, \"column\": %zu, ",
           rule, frame->start_offset.byte,
           frame->start_offset.line, frame->start_offset.column);
    free(rule);

    if(parse_state->parse_stack_len > 1)
    {
        frame--;
        struct gzl_rtn_frame *prev_rtn_frame = &frame->f.rtn_frame;
        char *slotname = get_json_escaped_string(prev_rtn_frame->rtn_transition->slotname, 0);
        printf("\"slotname\":%s, \"slotnum\":%d, ",
               slotname, prev_rtn_frame->rtn_transition->slotnum);
        free(slotname);
    }

    printf("\"children\": [");
    RESIZE_DYNARRAY(user_state->first_child, user_state->first_child_len+1);
    *DYNARRAY_GET_TOP(user_state->first_child) = true;
}
开发者ID:ktf,项目名称:gazelle,代码行数:30,代码来源:gzlparse.c

示例6: r3_tree_dump

void r3_tree_dump(node * n, int level) {
    if ( n->combined_pattern ) {
        printf(" regexp:%s", n->combined_pattern);
    }

    printf(" endpoint:%d", n->endpoint);

    if (n->data) {
        printf(" data:%p", n->data);
    }
    printf("\n");

    for ( int i = 0 ; i < n->edge_len ; i++ ) {
        edge * e = n->edges[i];
        print_indent(level);
        printf("  |-\"%s\"", e->pattern);

        if (e->has_slug) {
            printf(" slug:");
            printf("%s", compile_slug(e->pattern, e->pattern_len) );
        }

        if ( e->child ) {
            r3_tree_dump( e->child, level + 1);
        }
        printf("\n");
    }
}
开发者ID:arpanlepcha,项目名称:r3,代码行数:28,代码来源:node.c

示例7: print_atr_bytes

void
print_atr_bytes(int indent, struct card_state *cst) {
    size_t i;
    const char *t0_byte_names[] = { "TS", "T0", "TB1", "TC1", NULL };
    const char *t1_byte_names[] = { "TS", "T0", "TB1", "TC1", "TD1", "TD2", "TA3", "TB3", "TCK", NULL };
    const char **byte_names = NULL;
    const char *atr = cst->atr;
    size_t atr_len = cst->atr_len;
#   define BYTE_NAME_FMT "%3s"

    switch(cst->proto) {
    case SCARD_PROTOCOL_T0:
        byte_names = t0_byte_names;
        break;
    case SCARD_PROTOCOL_T1:
        byte_names = t1_byte_names;
        break;
    default:
        return;
    }
    
    for (i = 0; i < atr_len && byte_names[i] != NULL; ++i) {
        print_indent(indent);
        printf(BYTE_NAME_FMT " = 0x%02x\n", byte_names[i], (unsigned char) atr[i]);
    }
}
开发者ID:S010,项目名称:test,代码行数:26,代码来源:sctest.c

示例8: print_return_stmt

static void print_return_stmt(int indent, struct stmt *s)
{
	print_indent(indent);
	printf("RETURN\n");
	if (s->ret)
		print_expr_r(indent+1, s->ret);
}
开发者ID:carriercomm,项目名称:ancient,代码行数:7,代码来源:parser.c

示例9: print_for_stmt

static void print_for_stmt(int indent, struct stmt *s)
{
	print_indent(indent);
	printf("FOR\n");
	print_expr_r(indent+1, s->forloop.cond);
	print_block_stmt(indent+1, s->forloop.block->block);
}
开发者ID:carriercomm,项目名称:ancient,代码行数:7,代码来源:parser.c

示例10: print_assign_stmt

static void print_assign_stmt(int indent, struct stmt *s)
{
	print_indent(indent);
	printf("ASSIGN STMT\n");
	print_expr_r(indent+1, s->assign.ident);
	print_expr_r(indent+1, s->assign.rhs);
}
开发者ID:carriercomm,项目名称:ancient,代码行数:7,代码来源:parser.c

示例11: enter_block

void enter_block(const std::string &msg, const bool indent)
{
    if (inhibit_profiling_counters)
    {
        return;
    }

    block_names.emplace_back(msg);
    timespec t;
    clock_gettime(CLOCK_REALTIME, &t);
    enter_times[msg] = t;

    if (inhibit_profiling_info)
    {
        return;
    }
    #pragma omp critical
    {
        op_profiling_enter(msg);

        print_indent();
        printf("(enter) %-35s\t[0s]\t(%0.4fs from start)\n",
               msg.c_str(), nsec_diff(t, start_time) * 1e-9);
        fflush(stdout);

        if (indent)
        {
            ++indentation;
        }
    }
}
开发者ID:herumi,项目名称:libsnark,代码行数:31,代码来源:profiling.cpp

示例12: print_funcall

void print_funcall(struct funcall *f, int indent)
{
  print_indent(indent);
  int fun_id = get_funcall_name(f);
  switch (fun_id)
  {
    case 1: /* 1 is ecrire */
      print_write_fun(f);
      break;
    case 2: /* 2 is allouer */
      print_alloc_fun(f);
      break;
    case 3:
      print_read_function(f);
      break;
    case 4:
      print_free_fun(f);
      break;

    default:
      printf("%s(", f->fun_ident);
      print_arglist(f->args);
      printf(");\n");

  }
}
开发者ID:Neodyblue,项目名称:a2c,代码行数:26,代码来源:codegen.c

示例13: enter_block

void enter_block(const std::string &msg, const bool indent)
{
    if (inhibit_profiling_counters)
    {
        return;
    }

    block_names.emplace_back(msg);
    long long t = get_nsec_time();
    enter_times[msg] = t;

    if (inhibit_profiling_info)
    {
        return;
    }

#ifdef MULTICORE
#pragma omp critical
#endif
    {
        op_profiling_enter(msg);

        print_indent();
        printf("(enter) %-35s\t[0s]\t(%0.4fs from start)\n",
               msg.c_str(), (t - start_time) * 1e-9);
        fflush(stdout);

        if (indent)
        {
            ++indentation;
        }
    }
}
开发者ID:aburan28,项目名称:libsnark,代码行数:33,代码来源:profiling.cpp

示例14: dump_application_name_descriptor

static
void dump_application_name_descriptor(struct tssp_descriptor *desc, int depth, void *param)
{
    int i;
    int ret;
    struct tssp_dr_application_name app_name;
    uint8_t *value;

    if (desc == NULL)
        return;

    ret = tssp_dr_application_name_parse(&app_name, desc);
    if (ret != TSSP_STATUS_OK)
        return;

    for (i = 0; i < app_name.count; i++) {
        value = app_name.lang[i].name;

        print_indent(depth);

        /* skip character table, see Annex A of A038 */
        if (value[0] < 0x20) {
            printf("char_table(0x%02x), ", value[0]);
            value++;
        }

        printf("lang_code(0x%06x), value(%s)\n",
               app_name.lang[i].code, value);
    }
}
开发者ID:disigma,项目名称:tssp,代码行数:30,代码来源:dump.c

示例15: print_on_its_own_line

static void print_on_its_own_line(int indent, const char* msg,
                                  bool newline = true) {
  if (newline) printf("\n");
  printf("%6c", ' ');
  print_indent(indent);
  printf("%s", msg);
}
开发者ID:DawidvC,项目名称:chapel,代码行数:7,代码来源:view.cpp


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