Ejemplo n.º 1
0
Archivo: edit.c Proyecto: OPSF/uClinux
static void edit_timer(void)
{
    char *cmd;
    int editing = 1;
    
    do {
    	if (timer) printf("\nTimer colors:\n");
    	show_timer();
    	printf("\nTimer setup:  ");
    	
	if (timer) printf("C)olors, P)osition, D)isable");
	else printf("E)nable");
	
	printf(", B)ack:  ");
	
	cmd = getLine();
	
	if (timer) switch(toupper(*cmd)) {
	    case 'C':
		get3colors("Timer", &mn.t_fg);
		break;
	    case 'D':
		while (timer) {
		    mn.t_row -= 480;
		}
		break;
	    case 'P':
		getXY("\nTimer col", &mn.t_col, 8, 1);
		getXY("Timer row", &mn.t_row, 16, 1);
		break;
	    case 'B':
		editing = 0;
		break;
	    default:
	    	printf("???");
	}
	else switch(toupper(*cmd)) {
	    case 'E':
		while (!timer) {
		    mn.t_row += 480;
		}
		break;
	    case 'B':
		editing = 0;
		break;
	    default:
	    	printf("???");
	}
	free(cmd);
	printf("\n");
    } while (editing);
}
Ejemplo n.º 2
0
Archivo: edit.c Proyecto: OPSF/uClinux
static void edit_bitmap(char *bitmap_file)
{
    char *cmd;
    int editing = 1;
    
    printf("Editing contents of bitmap file:  %s\n", bitmap_file);
    
    bmp_file_open(bitmap_file);

    do {
	show_layout();
	printf("\nText colors:\n");
	show_colors(0);
	show_timer();
	
	printf("\nCommands are:  L)ayout, C)olors, T)imer, Q)uit, W)rite:  ");
	cmd = getLine();
	switch(toupper(*cmd)) {
	    case 'C':
		edit_colors();
		break;
	    case 'L':
		edit_layout();
		break;
	    case 'T':
		edit_timer();
		break;
	    case 'W':
	        if (yesno("Save companion configuration file?", 0))
						dat_file_creat(bitmap_file);
	    	editing = !yesno("Save changes to bitmap file?", 0);
	    	if (!editing) {
	    	    printf("Writing output file:  %s\n", bitmap_file);
	    	    bmp_file_close(!test);  /* update */
	    	    if (test) printf("***The bitmap file has not been changed***\n");
		}
	    	break;
	    case 'Q':
	    	editing = !yesno("Abandon changes?", 0);
	    	if (!editing) bmp_file_close(0);  /* no update */
	    	break;
	    default:
	    	printf("???");
	}
	free(cmd);
	printf("\n");
    } while (editing);
    exit(0);
}
Ejemplo n.º 3
0
int main (int argc, char *argv[]){

    // VERIFICAR SE O USUARIO
    // CONTINUA OU SAI DO PROGRAMA
    char op=NULL;
    do {

        PPMImageParams* imageParams;

        imageParams = (PPMImageParams *)malloc(sizeof(PPMImageParams));

        // CARREGA O MENU OU SETA AS OPCOES
        // CASO INSERIDAS NA LINHA DE COMANDO
        initialParams* ct = (initialParams *)calloc(1,sizeof(initialParams));

        ct->DIRIMGIN = "images_in/";
        ct->DIRIMGOUT = "images_out/";
        ct->DIRRES = "resultados/";
        ct->typeAlg = 'S'; // SEQUENCIAL
        menu(ct, argc, argv);

        sprintf((char*) &imageParams->fileOut, "%s%s", ct->DIRIMGOUT, ct->filePath);
        sprintf((char*) &imageParams->fileIn, "%s%s", ct->DIRIMGIN, ct->filePath);

        if (ct->filePath != NULL) {
            // RELOGIO
            tempo* relogio = (tempo* )malloc(sizeof(tempo)*2);

            //CARREGA O RELOGIO
            timer* tempoA = (timer *)malloc(sizeof(timer));
            timer* tempoR = (timer *)malloc(sizeof(timer));
            timer* tempoF = (timer *)malloc(sizeof(timer));
            timer* tempoW = (timer *)malloc(sizeof(timer));

            start_timer(tempoA);

            sequencial(imageParams, ct, tempoR, tempoF, tempoW);

            //PARA O RELOGIO
            stop_timer(tempoA);

            relogio[0].tempoA = total_timer(tempoA);
            relogio[1].tempoR = total_timer(tempoR);
            relogio[1].tempoF = total_timer(tempoF);
            relogio[1].tempoW = total_timer(tempoW);

            show_timer(relogio, 1);

            // ESCREVENDO OS RESULTADOS
            // NO ARQUIVO /resultados/
            writeFile(ct, imageParams, relogio);

            // LIMPANDO A MEMORIA
            cleanMemory(ct, imageParams, NULL, relogio, tempoA, tempoR, tempoF, tempoW);

        } else {
            printf("\nOpcao invalida!\n\n");
        }

        if (!argv[1]) {
            printf("\nPressione 's' para voltar ao menu ou 'n' para sair...\n");
            int ret = scanf(" %c", &op);
            if (ct->debug >= 1) printf("\nRet OP: %d", ret);
        } else {
            op = 'n';
        }

    } while (op != 'n');

    return 0;
}