main() { char *p = "harsh"; head = (Node*)malloc(sizeof(Node)); head->next = NULL; insertToList(&head,p, 5, 0); insertToList(&head,"abcdef",6,7); insertToList(&head,"harshitha",9,13); insertToList(&head,"hhh",3,1); // printAggr(head); //removeFromList(&head,7); printf("\n printing data"); printAggr(head); freeList(&head); }
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; }