Exemplo n.º 1
0
int main(int argc, char **argv)
{
    srand(time(NULL));

    if(argc < 2)
        die("please supply a source file to interpret.");

    readsrc(argv[1]);
    execute();
    return EXIT_SUCCESS;
}
Exemplo n.º 2
0
int main(int argc, char **argv) {

	const char *source = NULL;
	u8 offset = 0, i;

	if (argc < 2) {
		die("Usage: %s [--source src.png / --offset 4] dst.png ...\n",
			argv[0]);
	}

	const struct option opts[] = {
		{"source", 1, NULL, 's'},
		{"offset", 1, NULL, 'o'},
		{NULL, 0, NULL, 0}
	};

	while (1) {
		const int c = getopt_long(argc, argv, "s:o:", opts, NULL);
		if (c < 0)
			break;

		switch (c) {
			case 's':
				source = strdup(optarg);
			break;
			case 'o':
				offset = atoi(optarg);
			break;
		}
	}

	if (source && offset)
		die("Can't use both offset and source at the same time\n");

	if (source) {
		readsrc(source);

		for (i = optind; i < argc; i++)
			remap(argv[i], 0);
	} else if (offset) {
		for (i = optind; i < argc; i++)
			remap(argv[i], offset);
	}

	if (source) free((char *) source);
	return 0;
}
Exemplo n.º 3
0
int main(int argc, char **argv)
{
	source * src;
	int i;
	int * M;
	int * resultat;
       
	if(argc < 2)
	{
	    printf("syntaxe : %s benchmarks_Taillard/...\n", argv[0]);
	    return -1;
	}
	src=readsrc(argv[1]);          // table de durée d'opération Tab[][]
	M=TabtoM(src);                 // table de durée d'opération M[]
    //aff_source(src);
	//aff_M(M,src->n,src->m);

	// ILS
	resultat=ILS(M, src->n, src->m);
	printf("ILS la séquence de Jobs est: \n");
	for(i=0;i<src->n;i++)	
		printf("%-4d",resultat[i]);
	printf("\nILS la somme de date de fin est:  %d\n",calculateCbarre(M, src->m, src->n, resultat, src->n));

	// IGA
	resultat=IGA(M, src->n, src->m);
	printf("IGA la séquence de Jobs est: \n");
	for(i=0;i<src->n;i++)	
		printf("%-4d",resultat[i]);	
	printf("\nIGA la somme de date de fin est:  %d\n",calculateCbarre(M, src->m, src->n, resultat, src->n));
	
	free(resultat);
	freeSource(src);
	freeM(M);

	return 1;
}