Пример #1
0
static void
print_binary(char *string, expr_t *expr)
{
    print_expr(expr->data._binary.lvalue);
    printf(" %s ", string);
    print_expr(expr->data._binary.rvalue);
}
Пример #2
0
/* '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;
}
Пример #3
0
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;
}
Пример #4
0
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));
}
Пример #5
0
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");
	}
}
Пример #6
0
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));
}
/* 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;        
}
Пример #8
0
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);
	}
    }
}
Пример #9
0
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));
}
Пример #10
0
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));
}
Пример #11
0
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));
}
Пример #12
0
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);
	}
}
Пример #13
0
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));
}
/* 
    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");
        }
    }
    
}
Пример #15
0
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));
}
Пример #16
0
Файл: vasm.c Проект: ezrec/vasm
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);
}
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--;
}
Пример #18
0
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;
}
Пример #19
0
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;
}
Пример #20
0
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);
}
Пример #21
0
/* 'remove' removes the message with either docid: or msgid:, sends a
 * (:remove ...) message when it succeeds
 */
static MuError
cmd_remove (ServerContext *ctx, GSList *args, GError **err)
{
	unsigned docid;
	const char *path;

	docid = determine_docid (ctx->query, args, err);
	if (docid == MU_STORE_INVALID_DOCID) {
		print_and_clear_g_error (err);
		return MU_OK;
	}

	path = get_path_from_docid (ctx->store, docid, err);
	if (!path) {
		print_and_clear_g_error (err);
		return MU_OK;
	}

	if (unlink (path) != 0) {
		mu_util_g_set_error (err, MU_ERROR_FILE_CANNOT_UNLINK,
				     "%s", strerror (errno));
		print_and_clear_g_error (err);
		return MU_OK;
	}

	if (!mu_store_remove_path (ctx->store, path)) {
		print_error (MU_ERROR_XAPIAN_REMOVE_FAILED,
			     "failed to remove from database");
		return MU_OK;
	}

	print_expr ("(:remove %u)", docid);
	return MU_OK;
}
Пример #22
0
/* 'quit' takes no parameters, terminates this mu server */
static MuError
cmd_quit (ServerContext *ctx, GSList *args , GError **err)
{
	print_expr (";; quiting");

	return MU_STOP;
}
Пример #23
0
static MuError
index_and_cleanup (MuIndex *index, const char *path, GError **err)
{
	MuError rv;
	MuIndexStats stats, stats2;

	mu_index_stats_clear (&stats);
	rv = mu_index_run (index, path, FALSE, &stats,
			   index_msg_cb, NULL, NULL);

	if (rv != MU_OK && rv != MU_STOP) {
		mu_util_g_set_error (err, MU_ERROR_INTERNAL, "indexing failed");
		return rv;
	}

	mu_index_stats_clear (&stats2);
	rv = mu_index_cleanup (index, &stats2, NULL, NULL, err);
	if (rv != MU_OK && rv != MU_STOP) {
		mu_util_g_set_error (err, MU_ERROR_INTERNAL, "cleanup failed");
		return rv;
	}

	print_expr ("(:info index :status complete "
		    ":processed %u :updated %u :cleaned-up %u)",
		    stats._processed, stats._updated, stats2._cleaned_up);

	return rv;
}
Пример #24
0
void
print_pgm()
{
   int i, j, k, opndj;

   for (i = 0; i < numi; i++) {
      k = pgm[i].op;
      printf("   %-5s r%d,", isa[k].mnemonic, i + 1);
      for (j = 0; j < isa[k].numopnds; j++) {
         opndj = pgm[i].opnd[j];
         if (opndj < RX) {
            opndj = r[opndj];
            if (opndj >= -31 && opndj <= 31) printf("%d", opndj);
            else printf("0x%X", opndj);
         }
         else if (opndj == RX) printf( "rx");
#if NARGS > 1
         else if (opndj == RY) printf("ry");
#endif
         else printf("r%d", opndj - RI0 + 1);
         if (j < isa[k].numopnds - 1) printf(",");
      }
      if (debug)
         printf("     ==> %d (0x%X)\n", r[i+RI0], r[i+RI0]);
      else printf("\n");
   } // end for i

   /* Now print the program as an expression. */

   printf("   Expr: ");
   print_expr(numi - 1 + RI0);
   printf("\n");
}
Пример #25
0
static MuError
open_part (MuMsg *msg, unsigned docid, unsigned index, GError **err)
{
	char *targetpath;
	gboolean rv;

	targetpath = mu_msg_part_get_cache_path (msg,MU_MSG_OPTION_NONE,
						 index, err);
	if (!targetpath)
		return print_and_clear_g_error (err);

	rv = mu_msg_part_save (msg, MU_MSG_OPTION_USE_EXISTING,
			       targetpath, index, err);
	if (!rv) {
		print_and_clear_g_error (err);
		goto leave;
	}

	rv = mu_util_play (targetpath, TRUE,/*allow local*/
			   FALSE/*allow remote*/, err);
	if (!rv)
		print_and_clear_g_error (err);
	else {
		gchar *path;
		path = mu_str_escape_c_literal (targetpath, FALSE);
		print_expr ("(:info open :message \"%s has been opened\")",
			    path);
		g_free (path);
	}
leave:
	g_free (targetpath);
	return MU_OK;
}
Пример #26
0
void
print_expr(int pr, int opn)
{
   int i, j, k;

   if (opn < RX) {                      // Immediate value.
      if (-31 <= r[opn] && r[opn] <= 31) printb(pr, "%d", r[opn]);
      else                               printb(pr, "0x%X", r[opn]);
   }
   else if (opn == RX) printb(pr, "x");     // First argument.
#if NARGS >= 2
   else if (opn == RY) printb(pr, "y");     // Second argument.
#endif
#if NARGS >= 3
   else if (opn == RZ) printb(pr, "z");     // Third argument.
#endif
   else {                               // opn is an instruction.
      i = opn - RI0;
      k = pgm[i].op;
      printb(pr, "%s", isa[k].fun_name);
      for (j = 0; j < isa[k].numopnds; j++) {
         print_expr(pr, pgm[i].opnd[j]);
         if (j < isa[k].numopnds - 1) printb(pr, "%s", isa[k].op_name);
         else                         printb(pr, ")");
      }
   }
}
Пример #27
0
int main(int argc,char **argv) {
    struct postfix_expr_t expr;
    signed long val;

    if (argc < 2) {
        fprintf(stderr,"Please enter an expression in argv[1]\n");
        return 1;
    }

    if (parse_expr(&expr,argv[1]) < 0) {
        fprintf(stderr,"Failure to parse\n");
        return 1;
    }

    print_expr(&expr);
    printf("\n");

    val = eval_expr(&expr);
    if (val == LONG_MAX) {
        fprintf(stderr,"Failure to eval\n");
        return 1;
    }
    printf("result = %ld\n",val);

    return 0;
}
Пример #28
0
static void print_sues_static_asserts(symtable *stab)
{
	struct_union_enum_st **sit;
	static_assert **stati;
	int nl = 0;

	for(sit = stab->sues; sit && *sit; sit++){
		struct_union_enum_st *sue = *sit;
		(sue->primitive == type_enum ? print_enum : print_struct)(sue);
		nl = 1;
	}

	for(stati = stab->static_asserts; stati && *stati; stati++){
		static_assert *sa = *stati;

		idt_printf("static assertion: %s\n", sa->s);
		gen_str_indent++;
		print_expr(sa->e);
		gen_str_indent--;

		nl = 1;
	}

	if(nl)
		fputc('\n', cc1_out);
}
Пример #29
0
pl_consonne_1 (struct coroutine *k, expr a0)
{
expr nx[MAX_NEW_CONS];
int pnx, i;
struct process_list *alt_process;
	pnx = 0;
	begin_decl ();
	decl_expr (&a0);
	for (i=0; i<MAX_NEW_CONS; i++)
		dle (nx[i]);
#ifdef TRACE
	printf ("\nconsonne: a0 = "); print_expr (a0);
#endif
	if (alt (k, 1, 0))
	{
	/* clause */
	expr val_X, var_X;
		alt_process = getpl (k) -> alt;
		dle(val_X) dle(var_X)
		val_X=UNDEF; var_X=mk_var(&val_X);
#ifdef TRACE
		printf ("\n\ta0 = "); print_expr (a0);
#endif
		unify (k, var_X, a0);
		for (i=0; i<pnx; i++)
			nx[i] = 0;
		pnx=0;
		pl_lettre_1 (k, var_X);
		for (i=0; i<pnx; i++)
			nx[i] = 0;
		pnx=0;
		pl_non_voyelle_1 (k, var_X);
		for (i=0; i<pnx; i++)
			nx[i] = 0;
		pnx=0;
		unify (k, a0, var_X);
		for (i=0; i<pnx; i++)
			nx[i] = 0;
		pnx=0;
#ifdef TRACE
		printf ("\n\ta0 = "); print_expr (a0);
#endif
	} else
	end (k);
	free_expr ();
}
Пример #30
0
END_TEST

START_TEST (test_debug) /* this test just runs the debug output code to not get artificially low coverage */
{
    FILE *devnull = fopen("/dev/null", "w");
    expression *e = get_expression("c1, symbol O+C");
    print_expr(devnull, e, 0);
}