Exemple #1
0
bool forward_dir(void)
{	bool ok = true;
	//
	ok     &= abs_op();
	ok     &= acos_op();
	ok     &= acosh_op();
	ok     &= asin_op();
	ok     &= asinh_op();
	ok     &= atan_op();
	ok     &= atanh_op();
	ok     &= addpv_op();
	ok     &= addvv_op();
	ok     &= cexp_op();
	ok     &= cosh_op();
	ok     &= cos_op();
	ok     &= csum_op();
	ok     &= dis_op();
	ok     &= divpv_op();
	ok     &= divvp_op();
	ok     &= divvv_op();
	ok     &= exp_op();
	ok     &= load_op();
	ok     &= log_op();
	ok     &= mulpv_op();
	ok     &= par_op();
	ok     &= powpv_op();
	ok     &= powvp_op();
	ok     &= powvv_op();
	ok     &= sign_op();
	ok     &= sin_op();
	ok     &= sinh_op();
	ok     &= subpv_op();
	ok     &= subvp_op();
	ok     &= subvv_op();
	ok     &= sqrt_op();
	ok     &= tan_op();
	ok     &= tanh_op();
	ok     &= usr_op();
	//
	return ok;
}
int main(int argc, char *argv[]) 
{
	int i = 0;
	int *key;
	record *value;
	filedata_t *fd;
	final_data_t op_results;
	final_data_t op_results0;
	final_data_t op_results2;
	final_data_t op_results3;
	final_data_t op_results4;
	final_data_t op_results5;
	final_data_t op_results6;
	final_data_t op_results7;

	struct timeval starttime,endtime;
	char * fname, * op_num_str;
	int op_num;

	struct timeval begin_total, end_total;


	// Make sure a filename is specified
	if (argv[1] == NULL)
	{
		printf("USAGE: %s <filename> [ # of operator to use (1:sel 2:prj 3:srt 4:prt 5:agg) ]\n", argv[0]);
		exit(1);
	}

	fname = argv[1];
	op_num_str = argv[2];

	// Get the number of operator to run
	CHECK_ERROR((op_num = (op_num_str == NULL) ? 10 : atoi(op_num_str)) < 0);



	fd=load_op (fname, sizeof(record));	
		//printLoads(fd);
	
	if ((op_num  != 6) && (op_num != 0)){
		prepare_op(fd, &op_results, 0);
		dprintf("\nop_results length  %d:\n", op_results.length);
	}
	get_time (&begin_total);

	switch(op_num){
		case 0:
			prepare_op(fd, &op_results0, 1);

			break;
		case 1:
			select_op(&op_results, cmp12, &op_results2, 1);
				print_sel(op_results2);
			break;
		case 2:
			project_op(&op_results, prj5, &op_results3, 1);
				print_prj(op_results3);
			break;
		case 3:
			sort_op(&op_results, stringcmp, key_ptr, keysize, &op_results4, 1);
				print_srt(op_results4);
			break;
		case 4:
			partition_op(&op_results, hsh_prt, &op_results5, 1);
				print_prt(op_results5);

			//	partition_2op(&op_results, prt, &op_results5, 0);
			break;
		case 5:
			aggregate_op(&op_results, aggr, key_ptr, keysize, &op_results6, 1);
				printAggr(op_results6);
			break;
		case 6:
			select_op_old(fd,cmp12, &op_results7, 1);
				print_sel(op_results7);
			break;
		default:
			printf("No operator selected\n");
			break;
	}

	get_time (&end_total);
	unload_op(fd);


#ifdef TIMING
	fprintf (stderr, "\n\nOverall time: %u\n\n\n", time_diff (&end_total, &begin_total));
#endif
	return 1;
}