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

C++ print_expr函数代码示例

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

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



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

示例1: print_binary

static void
print_binary(char *string, expr_t *expr)
{
    print_expr(expr->data._binary.lvalue);
    printf(" %s ", string);
    print_expr(expr->data._binary.rvalue);
}
开发者ID:pcpa,项目名称:lightning,代码行数:7,代码来源:cjit_debug.c


示例2: cmd_add

/* 'add' adds a message to the database, and takes two parameters:
 * 'path', which is the full path to the message, and 'maildir', which
 * is the maildir this message lives in (e.g. "/inbox"). response with
 * an (:info ...) message with information about the newly added
 * message (details: see code below)
 */
static MuError
cmd_add (ServerContext *ctx, GSList *args, GError **err)
{
	unsigned docid;
	const char *maildir, *path;
	MuMsg *msg;
	gchar *sexp;

	GET_STRING_OR_ERROR_RETURN (args, "path", &path, err);
	GET_STRING_OR_ERROR_RETURN (args, "maildir", &maildir, err);

	docid = mu_store_add_path (ctx->store, path, maildir, err);
	if (docid == MU_STORE_INVALID_DOCID)
		print_and_clear_g_error (err);
	else {
		gchar *escpath;
		escpath = mu_str_escape_c_literal (path, TRUE);
		print_expr ("(:info add :path %s :docid %u)", escpath, docid);

		msg = mu_store_get_msg (ctx->store, docid, err);
		if (msg) {
			sexp = mu_msg_to_sexp (msg, docid, NULL,
					       MU_MSG_OPTION_VERIFY);
			print_expr ("(:update %s :move nil)", sexp);

			mu_msg_unref(msg);
			g_free (sexp);
		}
		g_free (escpath);
	}

	return MU_OK;
}
开发者ID:Popsch,项目名称:mu,代码行数:39,代码来源:mu-cmd-server.c


示例3: cons

expr cons (expr a, expr d)
{
expr c;
#ifdef TRACE
	printf ("\n\t\tcons (car=");
	print_expr (a);
	printf (", cdr=");
	print_expr (d);
	printf (")...");
#endif
	while (!cons_free(ptr_cons) && ptr_cons < N_CONS-1)
		ptr_cons++;
	if (!cons_free(ptr_cons))
		gc ();
	take_cons (ptr_cons);
	tab_cons [ptr_cons] [0] = a;
	tab_cons [ptr_cons] [1] = d;
	c = (ptr_cons | 0x8000) ;
#ifdef TRACE
	printf ("\n\t\tcons (car=");
	print_expr (a);
	printf (", cdr=");
	print_expr (d);
	printf (") = ");
	print_expr (c);
#endif
	return c;
}
开发者ID:jbailhache,项目名称:log,代码行数:28,代码来源:expr.c


示例4: print_return_type_list

static void print_return_type_list(struct return_type_list *l, int depth)
{
    int i;
    struct return_type *r;

    if (l == NULL)
	return;

    printf("%sreturns\n", indent(depth));
    for (i = 0, r = l->req_types; r != NULL; i++, r = r->next)
	if (r->temp)
	    printf("%sresult %d: %s\n", indent(depth+1), i, r->temp->name);
	else if (r->type) {
	    printf("%sresult %d:\n", indent(depth+1), i);
	    print_expr(r->type, depth+2);
	}
	else
	    printf("%sresult %d.\n", indent(depth+1), i);
    if (l->rest_temp)
	printf("%s#rest %s\n", indent(depth+1), l->rest_temp->name);
    else if (l->rest_type) {
	printf("%s#rest\n", indent(depth+1));
	print_expr(l->rest_type, depth+2);
    }
    else if (l->restp)
	printf("%s#rest foo :: <object>\n", indent(depth+1));
    printf("%send returns\n", indent(depth));
}
开发者ID:dylan-hackers,项目名称:GD_2_4,代码行数:28,代码来源:print.c


示例5: gen_expr_str_funcall

void gen_expr_str_funcall(expr *e, symtable *stab)
{
	expr **iter;

	(void)stab;

	idt_printf("funcall, calling:\n");

	gen_str_indent++;
	print_expr(e->expr);
	gen_str_indent--;

	if(e->funcargs){
		int i;
		idt_printf("args:\n");
		gen_str_indent++;
		for(i = 1, iter = e->funcargs; *iter; iter++, i++){
			idt_printf("arg %d:\n", i);
			gen_str_indent++;
			print_expr(*iter);
			gen_str_indent--;
		}
		gen_str_indent--;
	}else{
		idt_printf("no args\n");
	}
}
开发者ID:mtexier,项目名称:ucc,代码行数:27,代码来源:expr_funcall.c


示例6: print_dot_expr

static void print_dot_expr(struct dot_expr *e, int depth)
{
    printf("%sdot operator\n%sargument\n", indent(depth), indent(depth+1));
    print_expr(e->arg, depth+2);
    printf("%sfunction\n", indent(depth+1));
    print_expr(e->func, depth+2);
    printf("%send dot operator\n", indent(depth));
}
开发者ID:dylan-hackers,项目名称:GD_2_4,代码行数:8,代码来源:print.c


示例7: print_arg

/* generate code from function call arguments*/
int print_arg(Expr expr, int reg, char* proc_id,
    int paramNum,char* callee) {

    int curr_reg = reg;
    int next_reg;
    int ID_type;
    int ID_type2;
    switch (expr->kind) {
        Type ID_type;
        int stackNo;
        case EXPR_ID:
            ID_type = getType(proc_id,expr->id);
            stackNo = getStackSlotNum(proc_id, expr->id);
            if(isParamRef(callee,paramNum)==0){
                
                printf("load r%d, %d\n", curr_reg,stackNo);
            }
            if(isParamRef(callee,paramNum)==1){
                if(isRef(proc_id, expr->id)==1)
                    printf("load r%d, %d\n", curr_reg,stackNo);
                else
                    printf("load_address r%d, %d\n", curr_reg,stackNo);
            }
            break;
        case EXPR_CONST:
            print_constant(expr->constant, curr_reg);
            
            break;
        case EXPR_BINOP:
            ID_type = getExprType(expr->e1, proc_id);
            ID_type2 = getExprType(expr->e2, proc_id);
            curr_reg = print_expr(expr->e1, curr_reg, proc_id);
            next_reg = print_expr(expr->e2, curr_reg + 1, proc_id);
            print_binop_string(expr->binop, curr_reg, 
                next_reg, ID_type, ID_type2);
            break;
        case EXPR_RELOP:
            ID_type = getExprType(expr->e1, proc_id);
            ID_type2 = getExprType(expr->e2, proc_id);
            
            curr_reg = print_expr(expr->e1, curr_reg, proc_id);
            next_reg = print_expr(expr->e2, curr_reg + 1, proc_id);
            print_relop_string(expr->relop, curr_reg, 
                next_reg, ID_type, ID_type2);
            break;
        case EXPR_UNOP: 
            ID_type = getExprType(expr->e1, proc_id);
            print_unop_string(expr->unop, curr_reg, ID_type);
            break;
            
            }
        if(getExprType(expr,proc_id) != getParamType(callee,paramNum)){
            //printf("%d,%d    ",getExprType(expr), getParamType(callee,paramNum));
            printf("int_to_real r%d, r%d\n", curr_reg,curr_reg);
        }
    return curr_reg;        
}
开发者ID:ryanleong,项目名称:ProgrammingLanguageImplementation,代码行数:58,代码来源:codegen.c


示例8: print_comma_list

static void
print_comma_list(expr_t *expr)
{
    print_expr(expr);
    if (expr) {
	for (expr = expr->next; expr; expr = expr->next) {
	    printf(" , ");
	    print_expr(expr);
	}
    }
}
开发者ID:pcpa,项目名称:lightning,代码行数:11,代码来源:cjit_debug.c


示例9: print_select_expr

static void print_select_expr(struct select_expr *e, int depth)
{
    printf("%sselect\n", indent(depth));
    print_expr(e->expr, depth+1);
    if (e->by) {
	printf("%sby\n", indent(depth));
	print_expr(e->by, depth+1);
    }
    print_condition_body(e->body, depth);
    printf("%send select\n", indent(depth));
}
开发者ID:dylan-hackers,项目名称:GD_2_4,代码行数:11,代码来源:print.c


示例10: print_binop_series_expr

static void print_binop_series_expr(struct binop_series_expr *e, int depth)
{
    struct binop *b;

    printf("%sbinop series\n", indent(depth));
    print_expr(e->first_operand, depth+1);
    for (b = e->first_binop; b != NULL; b = b->next) {
	printf("%sbinop %s\n", indent(depth), b->op->symbol->name);
	print_expr(b->operand, depth+1);
    }
    printf("%send binop series\n", indent(depth));
}
开发者ID:dylan-hackers,项目名称:GD_2_4,代码行数:12,代码来源:print.c


示例11: print_call_expr

static void print_call_expr(struct call_expr *e, int depth)
{
    int i;
    struct argument *arg;

    printf("%scall\n%sfunction:\n", indent(depth), indent(depth+1));
    print_expr(e->func, depth+2);
    for (i = 0, arg = e->args; arg != NULL; i++, arg = arg->next) {
	printf("%sargument %d\n", indent(depth+1), i);
	print_expr(arg->expr, depth+2);
    }
    printf("%send call\n", indent(depth));
}
开发者ID:dylan-hackers,项目名称:GD_2_4,代码行数:13,代码来源:print.c


示例12: repl

void repl() {
	char *input;

	while ((input = readline("> ")) != NULL) {
		int ss = stack_size;
	read_start:;
#ifdef READLINE
		if (input && *input)
			add_history(input);
#endif

		const char *p = input;
		error err;

		atom expr;
		err = read_expr(p, &p, &expr);
		if (err == ERROR_FILE) { /* read more lines */
			char *line = readline("  ");
			if (!line) break;
			input = strcat_alloc(&input, "\n");
			input = strcat_alloc(&input, line);
			free(line);
			goto read_start;
		}
		if (!err) {
			while (1) {
				atom result;
				error err = macex_eval(expr, &result);
				if (err) {
					print_error(err);
					printf("error in expression:\n");
					print_expr(expr);
					putchar('\n');
					break;
				}
				else {
					print_expr(result);
					puts("");
				}
				err = read_expr(p, &p, &expr);
				if (err != ERROR_OK) {
					break;
				}
			}
		} else {
			print_error(err);
		}
		stack_restore(ss);
		free(input);
	}
}
开发者ID:kimtg,项目名称:arcadia,代码行数:51,代码来源:arcadia.c


示例13: print_defclass_constituent

static void
    print_defclass_constituent(struct defclass_constituent *c, int depth)
{
    static char *alloc[] = {"instance", "class", "each-subclass",
				"constant", "virtual"};
    struct superclass *super;
    struct slot_spec *slot;
    struct initarg_spec *initarg;
    struct inherited_spec *inherited;

    printf("%sdefine class\n", indent(depth));
    printf("%sname: %s\n", indent(depth+1), c->name->symbol->name);
    if (c->tlf1) {
	printf("%sphase 1:\n", indent(depth+1));
	print_method(c->tlf1, depth+2);
	printf("%sphase 2:\n", indent(depth+1));
	print_method(c->tlf2, depth+2);
    }
    else {
	printf("%ssupers:\n", indent(depth+1));
	for (super = c->supers; super != NULL; super = super->next)
	    print_expr(super->expr, depth+2);
	printf("%sslots:\n", indent(depth+1));
	for (slot = c->slots; slot != NULL; slot = slot->next) {
	    printf("%s%s slot, %s allocation\n", indent(depth+2),
		   slot->name ? (char*)slot->name->symbol->name : "anonymous",
		   alloc[(int)slot->alloc]);
	    if (slot->type) {
		printf("%stype:\n", indent(depth+2));
		print_expr(slot->type, depth+3);
	    }
	    print_plist(slot->plist, depth+2);
	}
        printf("%sinitialization arguments:\n", indent(depth+1));
        for (initarg = c->initargs; initarg != NULL;
	     initarg = initarg->next) {
            printf("%s%s%s initarg\n", indent(depth+2),
                   initarg->keyword->name,
                   initarg->required ? " required " : "");
            print_plist(initarg->plist, depth+2);
        }
	printf("%sinherited slots:\n", indent(depth+1));
	for (inherited = c->inheriteds; inherited != NULL;
	     inherited = inherited->next) {
	    printf("%s%s inherited slot\n", indent(depth+2),
		   inherited->name->symbol->name);
	    print_plist(inherited->plist, depth+2);
	}
    }
    printf("%send define class\n", indent(depth));
}
开发者ID:dylan-hackers,项目名称:GD_2_4,代码行数:51,代码来源:print.c


示例14: print_assign

/* 
    Non-array assignment 
*/
void print_assign(Assign assign, char* proc_id) {
    int ID_type;
    int expr_type;
    int slot;
    int reg = 0;
    ID_type = getType(proc_id,assign.id);
    expr_type = getExprType(assign.expr, proc_id);
    if (isRef(proc_id, assign.id)==0){
        if (ID_type == 2 && expr_type == 1){
            slot = getStackSlotNum(proc_id, assign.id);
            printf("#assignment\n");
            print_expr(assign.expr, 0, proc_id);
            printf("int_to_real r0, r0\n");
            printf("store %d, r0\n", slot);
            printf("\n");
        }
        
        else if ((ID_type == 1 && expr_type == 1) ||
            (ID_type == 2 && expr_type == 2) ||
            (ID_type == 0 && expr_type == 0)){
            slot = getStackSlotNum(proc_id, assign.id); 
            printf("#assignment\n");
            print_expr(assign.expr, 0, proc_id);
            printf("store %d, r0\n", slot);
            printf("\n");
        }
    }
    else if(isRef(proc_id, assign.id)==1){
        if (ID_type == 2 && expr_type == 1){
            slot = getStackSlotNum(proc_id, assign.id);
            printf("#assignment\n");
            print_expr(assign.expr, reg, proc_id);
            printf("int_to_real r0, r0\n");
            printf("load r1, %d\n", slot);
            printf("store_indirect r1, r%d\n", reg);
            printf("\n");
        }
        
        else if ((ID_type == 1 && expr_type == 1) ||
            (ID_type == 2 && expr_type == 2) ||
            (ID_type == 0 && expr_type == 0)){
            slot = getStackSlotNum(proc_id, assign.id); 
            printf("#assignment\n");
            print_expr(assign.expr, reg, proc_id);
            printf("load r1, %d\n", slot);
            printf("store_indirect r1, r%d\n", reg);
            printf("\n");
        }
    }
    
}
开发者ID:ryanleong,项目名称:ProgrammingLanguageImplementation,代码行数:54,代码来源:codegen.c


示例15: print_handler_constituent

static void print_handler_constituent(struct handler_constituent *c, int depth)
{
    printf("%shandler\n", indent(depth));
    if (c->type) {
	printf("%stype:\n", indent(depth+1));
	print_expr(c->type, depth+2);
	printf("%sfunction:\n", indent(depth+1));
	print_expr(c->func, depth+2);
	print_plist(c->plist, depth+1);
    }
    printf("%sbody\n", indent(depth));
    print_body(c->body, depth+1);
    printf("%send handler\n", indent(depth));
}
开发者ID:dylan-hackers,项目名称:GD_2_4,代码行数:14,代码来源:print.c


示例16: print_type

static void print_type(FILE *f,symbol *p)
{
    static const char *typename[] = {"???","obj","func","sect","file"};
    if(p==NULL)
        ierror(0);
    fprintf(f,"type=%s ",typename[TYPE(p)]);
}

void print_symbol(FILE *f,symbol *p)
{
    if(p==NULL)
        ierror(0);	/* this is usually an error in a cpu-backend, don't crash! */
    fprintf(f,"%s ",p->name);
    if(p->type==LABSYM)
        fprintf(f,"LAB (0x%llx) ",((unsigned long long)p->pc)&taddrmask);
    if(p->type==IMPORT)
        fprintf(f,"IMP ");
    if(p->type==EXPRESSION) {
        fprintf(f,"EXPR(");
        print_expr(f,p->expr);
        fprintf(f,") ");
    }
    if(p->flags&EXPORT)
        fprintf(f,"EXPORT ");
    if(p->flags&COMMON)
        fprintf(f,"COMMON ");
    if(p->flags&WEAK)
        fprintf(f,"WEAK ");
    if(TYPE(p))
        print_type(f,p);
    if(p->size) {
        fprintf(f,"size=");
        print_expr(f,p->size);
        fprintf(f," ");
    }
    if(p->align)
        fprintf(f,"align=%lu ",(unsigned long)p->align);
    if(p->sec)
        fprintf(f,"sec=%s ",p->sec->name);
}

void add_symbol(symbol *p)
{
    hashdata data;
    p->next=first_symbol;
    first_symbol=p;
    data.ptr=p;
    add_hashentry(symhash,p->name,data);
}
开发者ID:ezrec,项目名称:vasm,代码行数:49,代码来源:vasm.c


示例17: gen_expr_str_assign_compound

void gen_expr_str_assign_compound(expr *e)
{
	idt_printf("compound %s%s-assignment expr:\n",
			e->assign_is_post ? "post-" : "",
			op_to_str(e->op));

	idt_printf("assign to:\n");
	gen_str_indent++;
	print_expr(e->lhs);
	gen_str_indent--;
	idt_printf("assign from:\n");
	gen_str_indent++;
	print_expr(e->rhs);
	gen_str_indent--;
}
开发者ID:guoguocat,项目名称:ucc-c-compiler,代码行数:15,代码来源:expr_assign_compound.c


示例18: print_sexps

static unsigned
print_sexps (MuMsgIter *iter, gboolean threads, unsigned maxnum)
{
	unsigned u;
	u = 0;

	while (!mu_msg_iter_is_done (iter) && u < maxnum && !MU_TERMINATE) {

		MuMsg *msg;
		msg = mu_msg_iter_get_msg_floating (iter);

		if (mu_msg_is_readable (msg)) {
			char *sexp;
			const MuMsgIterThreadInfo* ti;

			ti = threads ? mu_msg_iter_get_thread_info (iter) : NULL;
			sexp = mu_msg_to_sexp (msg, mu_msg_iter_get_docid (iter),
					       ti, MU_MSG_OPTION_HEADERS_ONLY);
			print_expr ("%s", sexp);
			g_free (sexp);
			++u;
		}
		mu_msg_iter_next (iter);
	}
	return u;
}
开发者ID:Popsch,项目名称:mu,代码行数:26,代码来源:mu-cmd-server.c


示例19: cmd_contacts

static MuError
cmd_contacts (ServerContext *ctx, GSList *args, GError **err)
{
	MuContacts *contacts;
	char *sexp;
	gboolean personal;
	time_t after;
	const char *str;

	personal = get_bool_from_args (args, "personal", TRUE, NULL);
	str = get_string_from_args (args, "after", TRUE, NULL);
	after = str ? (time_t)atoi(str) : 0;

	contacts = mu_contacts_new
		(mu_runtime_path (MU_RUNTIME_PATH_CONTACTS));
	if (!contacts) {
		print_error (MU_ERROR_INTERNAL,
			     "failed to open contacts cache");
		return MU_OK;
	}

	/* dump the contacts cache as a giant sexp */
	sexp = contacts_to_sexp (contacts, personal, after);
	print_expr ("%s\n", sexp);
	g_free (sexp);

	mu_contacts_destroy (contacts);
	return MU_OK;
}
开发者ID:Popsch,项目名称:mu,代码行数:29,代码来源:mu-cmd-server.c


示例20: print_method

static void print_method(struct method *method, int depth)
{
    fputs(indent(depth), stdout);
    if (method->top_level)
	fputs("top level ", stdout);
    if (method->debug_name)
	printf("method %s\n", debug_name_string(method->debug_name));
    else if (method->name)
	printf("method %s\n", method->name->symbol->name);
    else
	fputs("anonymous method\n", stdout);

    print_param_list(method->params, depth+1);
    if (method->specializers) {
	printf("%sspecializers\n", indent(depth));
	print_expr(method->specializers, depth+1);
    }
    print_return_type_list(method->rettypes, depth);
    printf("%sbody\n", indent(depth));
    print_body(method->body, depth+1);

    printf("%send ", indent(depth));
    if (method->top_level)
	fputs("top level ", stdout);
    if (method->debug_name)
	printf("method %s\n", debug_name_string(method->debug_name));
    else if (method->name)
	printf("method %s\n", method->name->symbol->name);
    else
	fputs("anonymous method\n", stdout);
}
开发者ID:dylan-hackers,项目名称:GD_2_4,代码行数:31,代码来源:print.c



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ print_file函数代码示例发布时间:2022-05-30
下一篇:
C++ print_exit_status函数代码示例发布时间: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