示例#1
0
void test_list_remove_entry(void)
{
	ListEntry *empty_list = NULL;
	ListEntry *list;
	ListEntry *entry;

	list = generate_list();

	/* Remove the third entry */

	entry = list_nth_entry(list, 2);
	assert(list_remove_entry(&list, entry) != 0);
	assert(list_length(list) == 3);
	check_list_integrity(list);

	/* Remove the first entry */

	entry = list_nth_entry(list, 0);
	assert(list_remove_entry(&list, entry) != 0);
	assert(list_length(list) == 2);
	check_list_integrity(list);

	/* Try some invalid removes */

	/* NULL */

	assert(list_remove_entry(&list, NULL) == 0);

	/* Removing NULL from an empty list */

	assert(list_remove_entry(&empty_list, NULL) == 0);

	list_free(list);

	/* Test removing an entry when it is the only entry. */

	list = NULL;
	assert(list_append(&list, &variable1) != NULL);
	assert(list != NULL);
	assert(list_remove_entry(&list, list) != 0);
	assert(list == NULL);

	/* Test removing the last entry */

	list = generate_list();
	entry = list_nth_entry(list, 3);
	assert(list_remove_entry(&list, entry) != 0);
	check_list_integrity(list);
	list_free(list);
}
示例#2
0
int main()
{
  int n = MAX_SIZE;
  int *data0 = NULL;
  int *data1 = NULL;
  int *tmp = NULL;

  data0 = new int [n];
  data1 = new int [n];
  tmp = new int[n];

  generate_list(data0, n);
  memcpy(data1, data0, n * sizeof(int));

  #if 0
  printf("List Before Sorting...\n");
  print_list(data, n);
  #endif

  auto t_start = std::chrono::high_resolution_clock::now();
  mergesort(data0, n, tmp);
  auto t_end = std::chrono::high_resolution_clock::now();
  std::cout << "Wall clock time passed: " << std::chrono::duration<double>(t_end - t_start).count() << "seconds [Serial]\n";

  t_start = std::chrono::high_resolution_clock::now();
  mergesortOMP(data1, n, tmp);
  t_end = std::chrono::high_resolution_clock::now();
  std::cout << "Wall clock time passed: " << std::chrono::duration<double>(t_end - t_start).count() << "seconds [OpenMP]\n";

  return 0;
}
示例#3
0
void test_list_nth_entry(void)
{
	ListEntry *list;
	ListEntry *entry;

	list = generate_list();

	/* Check all values in the list */

	entry = list_nth_entry(list, 0);
	assert(list_data(entry) == &variable1);
	entry = list_nth_entry(list, 1);
	assert(list_data(entry) == &variable2);
	entry = list_nth_entry(list, 2);
	assert(list_data(entry) == &variable3);
	entry = list_nth_entry(list, 3);
	assert(list_data(entry) == &variable4);

	/* Check out of range values */

	entry = list_nth_entry(list, 4);
	assert(entry == NULL);
	entry = list_nth_entry(list, 400);
	assert(entry == NULL);

	list_free(list);
}
示例#4
0
void test_list_to_array(void)
{
	ListEntry *list;
	void **array;

	list = generate_list();

	array = list_to_array(list);

	assert(array[0] == &variable1);
	assert(array[1] == &variable2);
	assert(array[2] == &variable3);
	assert(array[3] == &variable4);

	free(array);

	/* Test out of memory scenario */

	alloc_test_set_limit(0);

	array = list_to_array(list);
	assert(array == NULL);

	list_free(list);
}
示例#5
0
static void slideshow_list_init(SlideShowData *ss, gint start_index)
{
	if (ss->list_done)
		{
		g_list_free(ss->list_done);
		ss->list_done = NULL;
		}

	if (ss->list) g_list_free(ss->list);

	if (slideshow_random)
		{
		ss->list = generate_random_list(ss);
		}
	else
		{
		ss->list = generate_list(ss);
		if (start_index >= 0)
			{
			/* start with specified image by skipping to it */
			gint i = 0;

			while(ss->list && i < start_index)
				{
				ss->list_done = g_list_prepend (ss->list_done, ss->list->data);
				ss->list = g_list_remove(ss->list, ss->list->data);
				i++;
				}
			}
		}
}
示例#6
0
int main(int argc, char const *argv[])
{
    SingleList *A, *B;
    int i;
    // generate random 20 cases
    for (i=1; i<=20; ++i)
    {
        A = generate_list(i);
        B = generate_list(i);
        print_list(A);
        printf("+\n");
        print_list(B);
        printf("=\n");
        print_list(adder(A, B));
        printf("---\n");
    }

    return 0;
}
示例#7
0
int main()
{
	std::vector<int> vec( 100 );
	random_iota( vec.begin(), vec.end() );
	list_pool<int> pool;
	list_pool<int>::iterator nil( pool );
	list_pool<in2t>::iterator list = generate_list( vec.begin(), vec.end(), nil );
	print_range( list, nil );
	list = mergesort_linked( list, nil, std::less<int>() );
	print_range( list, nil );
}
示例#8
0
void test_list_free(void)
{
	ListEntry *list;

	/* Create a list and free it */

	list = generate_list();

	list_free(list);

	/* Check the empty list frees correctly */

	list_free(NULL);
}
示例#9
0
void test_array(int n) {
  int i;
  P l;
  P t;
  l = generate_list(n);
  debug(l);

  t = list_to_array64(l);
  debug(t);

  i = 0;
  while (i < n) {
    debug(get_array64(t, i));
    i += 1;
  }
}
int main()
{
	for (size_t n = 2; n <= 100; ++n)
	{
		/*
		 * for each i in [0,n-1), generate a list 0 -> 1 -> ... -> (n-1)
		 * and delete node i
		 */
		for (size_t i = 0; i+1 < n; ++i)
		{
			list_node* head = generate_list(n);
			list_node* node = head;

			while (node->label != i)
			{
				node = node->next;
			}

			/* delete node i */
			delete_node(node);

			node = head;

			/*
			 * check if the resulting list after deleting i is
			 * 0 -> ... -> (i-1) -> (i+1) -> ... -> (n-1)
			 */
			for (size_t j = 0; j < n; ++j)
			{
				if (j == i)
				{
					continue;
				}

				assert(node->label == j);
				node = node->next;
			}

			delete head;
		}

		std::cout << "passed tests for lists of length " << n << std::endl;
	}

	return 0;
}
示例#11
0
static GList *generate_random_list(SlideShowData *ss)
{
	GList *src_list = NULL;
	GList *list = NULL;
	GList *work;

	src_list = generate_list(ss);

	while(src_list)
		{
		gint p = (double)rand() / ((double)RAND_MAX + 1.0) * g_list_length(src_list);
		work = g_list_nth(src_list, p);
		list = g_list_prepend(list, work->data);
		src_list = g_list_remove(src_list, work->data);
		}

	return list;
}
示例#12
0
void test_list_nth_data(void)
{
	ListEntry *list;

	list = generate_list();

	/* Check all values in the list */

	assert(list_nth_data(list, 0) == &variable1);
	assert(list_nth_data(list, 1) == &variable2);
	assert(list_nth_data(list, 2) == &variable3);
	assert(list_nth_data(list, 3) == &variable4);

	/* Check out of range values */

	assert(list_nth_data(list, 4) == NULL);
	assert(list_nth_data(list, 400) == NULL);

	list_free(list);
}
示例#13
0
void test_list_next(void)
{
	ListEntry *list;
	ListEntry *rover;

	list = generate_list();

	rover = list;
	assert(list_data(rover) == &variable1);
	rover = list_next(rover);
	assert(list_data(rover) == &variable2);
	rover = list_next(rover);
	assert(list_data(rover) == &variable3);
	rover = list_next(rover);
	assert(list_data(rover) == &variable4);
	rover = list_next(rover);
	assert(rover == NULL);

	list_free(list);
}
示例#14
0
int main()
{
   int n = 100;
   double start, stop;

   int data[MAX_SIZE], tmp[MAX_SIZE];
  
   generate_list(data, n);
   printf("List Before Sorting...\n");
   print_list(data, n);
   start = omp_get_wtime();
   #pragma omp parallel
   {
      #pragma omp single
      mergesort(data, n, tmp);
   }
   stop = omp_get_wtime();
   printf("\nList After Sorting...\n");
   print_list(data, n);
   printf("\nTime: %g\n",stop-start);
}
示例#15
0
int main()
{
  // Initialise a root node and define a traversal node
  struct node *root;

  // Make the 'rand' function generate random numbers
  srand(time(NULL));
  
  // Generate a random linked list
  root = generate_list(5, 10);

  // Print the list
  print_list(root);

  // Reverse the list
  root = reverse_linked_list(root);
  
  // Print the list again
  print_list(root);

  return(0);
}
示例#16
0
void test_list_length(void)
{
	ListEntry *list;

	/* Generate a list and check that it is four entries long */

	list = generate_list();

	assert(list_length(list) == 4);

	/* Add an entry and check that it still works properly */

	assert(list_prepend(&list, &variable1) != NULL);

	assert(list_length(list) == 5);

	list_free(list);

	/* Check the length of the empty list */

	assert(list_length(NULL) == 0);
}
int main(int argc, char** argv){
  
  if(argc != 3) {
    printf("Usage: list_gen [amount][any number]\nExample: ./list_gen 5 1229");
    return EXIT_FAILURE;
  }
  
  int amount_people= atoi(argv[1]);
  time_t startRand=atoi(argv[2]);
  srand(time(&startRand));
  
  person_t* people=(person_t*)malloc(amount_people*sizeof(person_t));
  person_t* people_sorted=(person_t*)malloc(amount_people*sizeof(person_t));
  int* count_sort_hist=(int*)malloc(MAX_AGE*sizeof(int));
  int* tmp_hist=(int*)malloc(MAX_AGE*sizeof(int));
  
  generate_list(people, amount_people);
  
  printPeople(people,amount_people);
  
  /*sort*/
  printf("\n----------------------------\n");
  
  calcHistogram(people, count_sort_hist,amount_people);

  prefixSum(tmp_hist, count_sort_hist);
  
  countSortLastStage(people, people_sorted, tmp_hist, amount_people);
  
  printPeople(people_sorted,amount_people); 
  
  //finalization
  free(people);
  free(people_sorted);
  free(count_sort_hist);
  free(tmp_hist);
  
  return EXIT_SUCCESS; 
}
示例#18
0
int main(int argc, char *argv[])
{
	char buf[128];
	char filename[128];
	char dd[128];
	char user_str[128];
	char* ptr;
	
	int tmp;
	int first_arg;
	int second_arg;
	
	int i;

	auth_ok = 0;

	for(i=0; i < argc; ++i) {
		if(!strcmp(argv[i], "-a")) {
			auth_ok = 1;
		}
	}
	
	current_conf = NULL;
	current_base = NULL;
	
	ptr = getenv("DAYDREAM");
	if(!ptr) {
		syslog(0, "Can't get DAYDREAM env");
		exit(1);
	}

	strncpy(dd, ptr, 128);
	datadir = dd;
	
	printf("200 DDNNTP ready to serve\r\n");
	fflush(stdout);
	while(1) {
		if(fgets(buf, 128, stdin) == NULL) {
			break;
		}
		strip_crlf(buf);
		
		if(!strncasecmp(buf, "LIST", 4)) {
			if(check_auth()) {
				if(strlen(buf) > 5) {
					if(!strncasecmp(buf+5, "NEWSGROUPS", 10)) {
						generate_list_with_desc();
					}
					else {
						generate_list();
	
					}
				} 
				else {
					generate_list();
				}
			}
		}
		else if(!strncasecmp(buf, "GROUP", 5)) {
			if(check_auth()) {
				if(strlen(buf) < 7) {
					printf("411 no such news group\r\n");
				}
				else {
					if(do_group_command(buf+6, 1) < 0) {
						printf("411 no such news group\r\n");
					}
				}
			}
		}
		else if(!strncasecmp(buf, "HEAD", 4) ||
		        !strncasecmp(buf, "BODY", 4) ||
		        !strncasecmp(buf, "ARTICLE", 7)) {
		        
			if(check_auth()) {
				if(!current_base || !current_conf) {
					printf("412 No newsgroup has been selected.\r\n");
				}
				else {
					if(!strncasecmp(buf, "ARTICLE", 7)) {
						parse_input_message_id(buf+8, &tmp);
					}
					else {
						parse_input_message_id(buf+5, &tmp);
					}
				
					if(message_num_ok(tmp)) {
						if(!strncasecmp(buf, "HEAD", 4)) {
							printf("221 %d %s article retrieved - head follows\r\n", tmp, generate_message_id(tmp));
							print_message_headers(tmp);
							printf(".\r\n");
						}
						else if(!strncasecmp(buf, "BODY", 4)) {
							printf("222 %d %s article retrieved - body follows\r\n", tmp, generate_message_id(tmp));
							print_message(tmp);
							printf(".\r\n");
						}
						else {
							printf("220 %d %s article retrieved - head and body follow\r\n", tmp, generate_message_id(tmp));
							print_message_headers(tmp);
							printf("\r\n");
							print_message(tmp);
							printf(".\r\n");
						}
					}
					else {
						printf("423 No such article number in this group.\r\n");
					}
				}
			}
		}
		else if(!strncasecmp(buf, "QUIT", 4)) {
			printf("205 Closing connection - Goodbye!\r\n");
			break;
		}
		else if(!strncasecmp(buf, "MODE READER", 11)) {
			printf("200 Hello, you can post.\r\n");
		}
		else if(!strncasecmp(buf, "XOVER", 5)) {
			if(check_auth()) {
				if(!current_base || !current_conf) {
					printf("412 No news group current selected.\r\n");
				}
				else {
					ptr = strchr(buf+5, '-');
					if(ptr == NULL) {
						printf("420 No article(s) selected.\r\n");
					}
					else {
						*ptr = '\0';
						first_arg = atoi(buf+6);
						second_arg = atoi(ptr+1);
						printf("224 %d-%d fields follow\r\n", first_arg, second_arg);
						process_xover(first_arg, second_arg);
						printf(".\r\n");
					}
				}	
			}
		}
		else if(!strncasecmp(buf, "POST", 4)) {
			if(check_auth()) {
				printf("340 Ok\r\n");
				fflush(stdout);
				if(!process_post()) {
					printf("240 Article posted.\r\n");
					syslog(LOG_INFO, "Message posted\n");
				}
				else {
					printf("441 posting failed.\r\n");
					syslog(LOG_INFO, "Message post failed\n");
				}
			}
		}
		else if(!strncasecmp(buf, "IHAVE", 5)) {
			if(check_auth()) {
				printf("335 Go ahead\r\n");
				fflush(stdout);
				if(!process_post()) {
					printf("235 Article posted.\r\n");
				}
				else {
					printf("435 posting failed.\r\n");
				}
			}
		}
		else if(!strncasecmp(buf, "AUTHINFO", 8)) {
			if(!strncasecmp(buf+9, "USER", 4)) {
				strncpy(user_str, buf+14, 128);
				printf("381 More authentication information required.\r\n");
			}
			else if(!strncasecmp(buf+9, "PASS", 4)) {
				struct userbase* u = ddgetpwnam(user_str);	
				if(!u) {
					printf("482 Authentication rejected.\r\n");
				}
				else if(cmppasswds(buf+14, u->user_password)) {
					syslog(LOG_INFO, "User %s logged in", user_str);
					printf("281 Authentication accepted.\r\n");
					auth_ok = 1;
				}
				else {
					printf("482 Authentication rejected.\r\n");
				}
			}
		}
		else {
			printf("500 Command not recognized\r\n");
			syslog(LOG_INFO, "Unknown command: %s", buf);
		}
		fflush(stdout);
	}

	sprintf(filename, "/tmp/msg.%d", getpid());
	unlink(filename);
	
	return 0;
}
示例#19
0
// =============================================
// MAIN MODULE
// =============================================
int main(int argc, const char* argv[])
{
	int i;
	int r				= -1;
	//int count			= 0;
	int nTry			= 0;	
	char* cur_device	= NULL;
	char path[1024]		= { 0 };
	memset(&path, 0, sizeof(path));
	FILE* fp_isolist	= NULL;

	fp_isolist = fopen(SISOPATH"/iso_list.txt", "w"); // always overwrite with clean list...

	cur_device = (char*)malloc(strlen("/ntfs0:")+1);
	memset(cur_device, 0, strlen("/ntfs0:")+1);

	// Try to mount devices ...
	while(nTry < 1000)
	{
		//count = 0;

		// __io_ntfs_usb000 ... __io_ntfs_usb007		
				
		for(i = 0; i < 8 ; i++) 
		{
			int rr = NTFS_Event_Mount(i);

			if(rr == 1) 
			{ 
				// mount device            
				NTFS_UnMount(i);

				mounts[i] = NULL;
				mountCount[i] = 0;

				mountCount[i] = ntfsMountDevice (disc_ntfs[i], &mounts[i], NTFS_DEFAULT | NTFS_RECOVER);
            
				if(mountCount[i] > 0) {
					//count = 1;
				} // update counter
			} 
			else if(rr == -1) 
			{ 
				// unmount device
				NTFS_UnMount(i);
				//count = 1;
			}
		}

		r = -1;		

		r = NTFS_Test_Device("ntfs0");
		if(r >= 0) { strcpy(cur_device, (char*)"/ntfs0:"); break; }

		r = NTFS_Test_Device("ntfs1");
		if(r >= 0) { strcpy(cur_device, (char*)"/ntfs1:"); break; }
		
		r = NTFS_Test_Device("ntfs2");
		if(r >= 0) { strcpy(cur_device, (char*)"/ntfs2:"); break; }
		
		r = NTFS_Test_Device("ntfs3");
		if(r >= 0) { strcpy(cur_device, (char*)"/ntfs3:"); break; }
		
		nTry++;
	}

	if(r>=0 && cur_device) 
	{
		sprintf(path, "%s/PS3ISO"	, cur_device);
		generate_list(fp_isolist, path, 0);

		sprintf(path, "%s/PSXISO"	, cur_device);
		generate_list(fp_isolist, path, 0);

		sprintf(path, "%s/BDISO"	, cur_device);
		generate_list(fp_isolist, path, 0);

		sprintf(path, "%s/DVDISO"	, cur_device);
		generate_list(fp_isolist, path, 0);
	}

	if(fp_isolist) { fclose(fp_isolist); *&fp_isolist = NULL; }

	NTFS_UnMountAll();

	// This flag will let "Simple NTFS ISO Mounter" that this was already launched,
	// allowing it to continue booting normally...

	FILE* fp = fopen(SISOPATH"/isolist_finished", "w");
	if(fp) { fclose(fp); *&fp = NULL; }

	sysProcessExitSpawn2( SISOPATH"/RELOAD.SELF", NULL, NULL, NULL, 0, 1001, SYS_PROCESS_SPAWN_STACK_SIZE_1M );	

	return 0;
}
示例#20
0
文件: codadd.c 项目: stcorp/coda
int main(int argc, char *argv[])
{
    int i = 1;

    ascii_col_sep = " ";
    show_type = 0;
    show_unit = 0;
    show_format = 0;
    show_description = 0;
    show_quotes = 0;
    show_hidden = 0;
    show_expressions = 0;
    show_parent_types = 0;
    show_attributes = 0;
    use_special_types = 1;

    if (argc > 1)
    {
        if (strcmp(argv[i], "-h") == 0 || strcmp(argv[i], "--help") == 0)
        {
            print_help();
            exit(0);
        }

        if (strcmp(argv[i], "-v") == 0 || strcmp(argv[i], "--version") == 0)
        {
            print_version();
            exit(0);
        }
    }

    if (i + 1 < argc && strcmp(argv[i], "-D") == 0)
    {
        coda_set_definition_path(argv[i + 1]);
        i += 2;
    }
    else
    {
#ifdef WIN32
        const char *definition_path = "../definitions";
#else
        const char *definition_path = "../share/" PACKAGE "/definitions";
#endif
        if (coda_set_definition_path_conditional(argv[0], NULL, definition_path) != 0)
        {
            fprintf(stderr, "ERROR: %s\n", coda_errno_to_string(coda_errno));
            exit(1);
        }
    }

    coda_option_read_all_definitions = 1;
    if (coda_init() != 0)
    {
        fprintf(stderr, "ERROR: %s\n", coda_errno_to_string(coda_errno));
        exit(1);
    }

    if (i == argc)
    {
        coda_done();
        exit(0);
    }

    coda_set_option_perform_conversions(0);

    if (strcmp(argv[i], "doc") == 0)
    {
        i++;
        if (i != argc - 1)
        {
            fprintf(stderr, "ERROR: invalid arguments\n");
            print_help();
            exit(1);
        }
        generate_html(argv[i]);
    }
    else if (strcmp(argv[i], "list") == 0)
    {
        const char *product_class = NULL;
        const char *product_type = NULL;
        int version = -1;

        i++;
        while (i < argc)
        {
            if (strcmp(argv[i], "-e") == 0 || strcmp(argv[i], "--expr") == 0)
            {
                show_expressions = 1;
            }
            else if (strcmp(argv[i], "-q") == 0 || strcmp(argv[i], "--quote_strings") == 0)
            {
                show_quotes = 1;
            }
            else if (strcmp(argv[i], "-t") == 0 || strcmp(argv[i], "--type") == 0)
            {
                show_type = 1;
            }
            else if (strcmp(argv[i], "-u") == 0 || strcmp(argv[i], "--unit") == 0)
            {
                show_unit = 1;
            }
            else if (strcmp(argv[i], "--description") == 0)
            {
                show_description = 1;
            }
            else if (strcmp(argv[i], "--hidden") == 0)
            {
                show_hidden = 1;
            }
            else if (strcmp(argv[i], "--parent-types") == 0)
            {
                show_parent_types = 1;
            }
            else if (strcmp(argv[i], "--attributes") == 0)
            {
                show_attributes = 1;
            }
            else if (strcmp(argv[i], "--no_special_types") == 0)
            {
                use_special_types = 0;
            }
            else if ((strcmp(argv[i], "-s") == 0 || strcmp(argv[i], "--column_separator") == 0) &&
                     i + 1 < argc && argv[i + 1][0] != '-')
            {
                i++;
                ascii_col_sep = argv[i];
            }
            else if (argv[i][0] != '-')
            {
                break;
            }
            else
            {
                fprintf(stderr, "ERROR: invalid arguments\n");
                print_help();
                exit(1);
            }
            i++;
        }

        if (i < argc)
        {
            product_class = argv[i];
            i++;
            if (i < argc)
            {
                product_type = argv[i];
                i++;
                if (i < argc)
                {
                    if (sscanf(argv[i], "%d", &version) != 1)
                    {
                        fprintf(stderr, "ERROR: invalid product version argument\n");
                        print_help();
                        exit(1);
                    }
                    i++;
                    if (i < argc)
                    {
                        fprintf(stderr, "ERROR: invalid arguments\n");
                        print_help();
                        exit(1);
                    }
                }
            }
        }
        generate_list(product_class, product_type, version);
    }
    else if (strcmp(argv[i], "xmlschema") == 0)
    {
        const char *output_file_name = NULL;
        const char *product_class = NULL;
        const char *product_type = NULL;
        int version = -1;

        i++;
        while (i < argc)
        {
            if ((strcmp(argv[i], "-o") == 0 || strcmp(argv[i], "--output") == 0) &&
                i + 1 < argc && argv[i + 1][0] != '-')
            {
                i++;
                output_file_name = argv[i];
            }
            else if (argv[i][0] != '-')
            {
                break;
            }
            else
            {
                fprintf(stderr, "ERROR: invalid arguments\n");
                print_help();
                exit(1);
            }
            i++;
        }

        if (i != argc - 3)
        {
            fprintf(stderr, "ERROR: invalid arguments\n");
            print_help();
            exit(1);
        }
        product_class = argv[i];
        i++;
        product_type = argv[i];
        i++;
        if (sscanf(argv[i], "%d", &version) != 1)
        {
            fprintf(stderr, "ERROR: invalid product version argument\n");
            print_help();
            exit(1);
        }
        generate_xmlschema(output_file_name, product_class, product_type, version);
    }
    else if (strcmp(argv[i], "dtree") == 0)
    {
        coda_format format;

        i++;
        if (i != argc - 1)
        {
            fprintf(stderr, "ERROR: invalid arguments\n");
            print_help();
            exit(1);
        }
        if (coda_format_from_string(argv[i], &format) != 0)
        {
            fprintf(stderr, "ERROR: invalid arguments\n");
            print_help();
            exit(1);
        }
        generate_detection_tree(format);
    }
    else if (strcmp(argv[i], "definition") == 0)
    {
        const char *output_file_name = NULL;

        i++;
        while (i < argc)
        {
            if ((strcmp(argv[i], "-o") == 0 || strcmp(argv[i], "--output") == 0) &&
                i + 1 < argc && argv[i + 1][0] != '-')
            {
                i++;
                output_file_name = argv[i];
            }
            else if (argv[i][0] != '-')
            {
                break;
            }
            else
            {
                fprintf(stderr, "ERROR: invalid arguments\n");
                print_help();
                exit(1);
            }
            i++;
        }

        if (i != argc - 1)
        {
            fprintf(stderr, "ERROR: invalid arguments\n");
            print_help();
            exit(1);
        }
        generate_definition(output_file_name, argv[i]);
    }
    else
    {
        fprintf(stderr, "ERROR: invalid arguments\n");
        print_help();
        exit(1);
    }

    coda_done();

    return 0;
}