Exemplo n.º 1
0
ArbreEntier* Merge(donnees d, TabHuff* TH) {
	TabMerge TM;
	liste* L;
	int i, k;
	InitPM(&TM);
	for (k = 0; k<d.Lmax; k++) {
		MergeAjout(TH, &TM);
		i = 0;
		TM.TailleP = 0;
		while (i<TM.TailleM - 2) {
			TM.Package[TM.TailleP] = Concat2Listes(TM.Merge[i], TM.Merge[i + 1]);
			TM.PoidsP[TM.TailleP] = TM.PoidsM[i] + TM.PoidsM[i + 1];
			TM.TailleP++;
			i += 2;
		}

	}
	printf("Hey\n");
	if (TM.TailleP != (d.nbSymboles - 2))
		printf("Taille : %d\n", TM.TailleP);

	for (k = 0; k<TM.TailleP; k++) {
		L = TM.Package[k];
		while (L != NULL) {
			AjoutSymbole(L->valeur, TH);
			L = L->Suivant;
		}
	}

	return ConversionArbre(ArbreMerge(TH));
}
Exemplo n.º 2
0
/*!
*
*/
int
main(int argc, char** argv) {
#ifdef USE_OS2
	PPIB pib;
	PTIB tib;
#endif
	char *progname = argv[0];
	
	
	glutInit(&argc, argv);
	
	
	for (++argv; --argc > 0; ++argv) {
		if (strcmp(*argv, "-help") == 0 || strcmp(*argv, "--help") == 0) {
			fputs("View a 3DS model file using OpenGL.\n", stderr);
			fputs("Usage: 3dsplayer [-nodb|-aa|-flush] <filename>\n", stderr);
#ifndef USE_SDL
			fputs("Texture rendering is not available; install SDL_image and recompile.\n", stderr);
#endif
			exit(0);
		} else if (strcmp(*argv, "-nodb") == 0)
			dbuf = 0;
		else if (strcmp(*argv, "-aa") == 0)
			anti_alias = 1;
		else if (strcmp(*argv, "-flush") == 0)
			flush = 1;
		else {
			filepath = *argv;
			decompose_datapath(filepath);
		}
	}
	
	
	if (filepath == NULL) {
		fputs("3dsplayer: Error: No 3DS file specified\n", stderr);
		exit(1);
	}
	
	
#ifdef USE_OS2
	DosGetInfoBlocks(&tib, &pib); pib->pib_ultype = 3;
#ifdef USE_MESA
	if (InitPM(0)) return 1;
#endif
#endif
	
	glutInitDisplayMode(GLUT_DEPTH | GLUT_RGB | (dbuf ? GLUT_DOUBLE : 0));
	glutInitWindowSize(500, 500);
	glutInitWindowPosition(100, 100);
	glutCreateWindow(filepath != NULL ? (char*)Basename(filepath) : progname);
	
	
	init();
	create_icons();
	load_model();
	
	
	build_menu();
	glutAttachMenu(2);
	
	
	glutDisplayFunc(display);
	glutReshapeFunc(reshape);
	glutKeyboardFunc(keyboard);
	glutMouseFunc(mouse_cb);
	glutMotionFunc(drag_cb);
	glutTimerFunc(1000 / FRAMES_PER_SECOND, timer_cb, 0);
	glutMainLoop();
	return(0);
}