Esempio n. 1
0
void DescargoBienesMB::on_correlativoNO_editingFinished (){
    QString nombreClase=m_ui->claseNO->text();
    QString cuentaAsignada=m_ui->cuentaAsignada->text();
    QString correlativo=m_ui->correlativoNO->text();
    QString titulo, nombreAutor, isbn;

    Persistencia::Persistencia *servicioPersistencia=new Persistencia(this->regBasico->getUnidad()->id);    

    Bien *bien=servicioPersistencia->getBienMB(this->anioInvSelecc, cuentaAsignada, correlativo, nombreClase);

    if(bien!=NULL){
        m_ui->valorBien->setValue(bien->getValor());
        m_ui->descripcion->setText(QString::fromStdString(bien->getDescripcionClase()));

        titulo=servicioPersistencia->getTitulo(bien->idTitulo);
        nombreAutor=servicioPersistencia->getAutor(bien->idTitulo);

        isbn=servicioPersistencia->getISBN(bien->idTitulo, bien->idAutor);

        m_ui->titulo->setText(titulo);
        m_ui->nombreAutor->setText(nombreAutor);

        m_ui->isbn->setText(isbn);
        m_ui->especificoNO->setText(QString::fromStdString(bien->getEspecifico()));
        m_ui->fechaAquisicion->setDate(QDate::QDate(bien->fechaAdquisicion->getAnio(), bien->fechaAdquisicion->getMes(), bien->fechaAdquisicion->getDia()));
        m_ui->nombreEspecifico->setText(QString::fromStdString(bien->getNombreEspecifico()));

    }else{
        limpiar();
    }

}
Esempio n. 2
0
QStringList ZGui::limpiar(const QString &path, const QString &filter)
{
 if(path != "/mmc/mmca1/.system")
 {
 QDir dir ( path );
	  QStringList::Iterator it;
	  QStringList fullFiles="";
	  int size = 0;
	  QStringList files = dir.entryList ( filter, QDir::Files );
	  it = files.begin();
	  while ( it != files.end() ) 
	  {
	    fullFiles += QFileInfo ( path, *it ).filePath();
	    ++it;
	  }
	  QStringList dirs = dir.entryList ( QDir::Dirs );
	  it = dirs.begin();
	  while ( it != dirs.end() ) {
	    if ( *it != "." && *it != ".." )
	      fullFiles += limpiar ( path + "/" + *it , filter);
	    ++it;
	  }
          return fullFiles;
 }
void debePoderObtenerUnRegistro()
{
	inicializar();

	buffer = obtenerRegistro(archivo);
	CU_ASSERT_STRING_EQUAL(buffer, REGISTRO1);

	limpiar();
}
Esempio n. 4
0
int main(int argc, char* argv[])
{
    /*Limpiamos la pantalla*/
    limpiar();

    /*MENU*/
    menu();

    return 0;
}
void debePoderObtenerElSiguienteRegistro()
{
	inicializar();

	buffer = obtenerRegistro(archivo);
	free(buffer);
	buffer = obtenerRegistro(archivo);

	CU_ASSERT_STRING_EQUAL(buffer, REGISTRO2);

	limpiar();
}
Esempio n. 6
0
ZGui::ZGui ( const QString &ejecuta, QWidget* parent, const char* name, WFlags fl )
    : ZKbMainWidget ( ZHeader::FULL_TYPE, NULL, "ZMainWidget", 0 )
{
  QString eje = ejecuta;
  if ( eje == "cleannow" )
  {infos=NULL;
  dlg=NULL;
  ZConfig conf ( getProgramDir() + "av_db.cfg", true );
  QStringList list = conf.readListEntry ( QString("DATABASE"), QString("DELETE"), QChar(';') );
  QStringList a="";
  for(int i=0;i< list.count();i++) {
  a=limpiar(SD,list[i]); borrar(a); a="";
  a=limpiar(phone,list[i]); borrar(a); a="";}
  qApp->quit();  
  }
  else
  {infos=NULL;
  dlg=NULL; 
  eliminados="";
  CreateWindow ( parent );
  ( ( ZApplication* ) qApp )->showMainWidget ( this );}
}
void devuelveNuloSiNoHayMasRegistros()
{
	inicializar();

	buffer = obtenerRegistro(archivo);
	free(buffer);
	buffer = obtenerRegistro(archivo);
	free(buffer);
	buffer = obtenerRegistro(archivo);

	CU_ASSERT_PTR_EQUAL(buffer, NULL);

	limpiar();
}
void puedeLeerUltimoRegistroSiNoHayMasContenidoLuego()
{
	FILE *archivoALlenar = fopen(PATH_ARCHIVO_LECTURA, "w");
	fprintf(archivoALlenar, "%s", REGISTRO1);
	fclose(archivoALlenar);

	inicializar();

	buffer = obtenerRegistro(archivo);

	CU_ASSERT_STRING_EQUAL(buffer, REGISTRO1);

	limpiar();
}
Esempio n. 9
0
void menu()
{
    char seleccion = '0';

    printf("=== ADIVINANDO 0.2 ===\n");
    printf("     === MENU ===\n\n");
    printf("1. Jugar\n");
    printf("2. Ayuda\n");
    printf("3. Salir\n\n");

    printf("Tu seleccion: ");
    seleccion = getchar();
    putchar(seleccion);

    if(seleccion == '1')
    {
    	juego();
    }
    else if(seleccion == '2')
    {
    	ayuda();
    }
    else if(seleccion == '3')
    {
        /*Adios !*/
        limpiar();
    	printf("Bye !\n");
    }
    else /*El juego se puede volver "Loco" y puede crashear...*/
    {
    	limpiar();
    	printf("Por favor, elija una opcion valida...\n\n");
	pause();
	limpiar();
    	menu();
    }
}
Esempio n. 10
0
void Usuarios::editarUsuario()
{

    disconnect(btnAceptar, SIGNAL(clicked()),0, 0);
    disconnect(btnCancelar,SIGNAL(clicked()),0,0);

    limpiar();

    leCedula->move(450,180);
    lbCedula->move(330,180);
    lbCedula->setText("Ingrese Cedula: ");

    btnCancelar->move(610,178);
    btnCancelar->setText("Buscar");
    btnCancelar->setIcon(QIcon(":/images/ver.png"));
    btnCancelar->setIconSize(QSize(15,15));
    connect(btnCancelar,SIGNAL(clicked()),this,SLOT(btnBuscar()));

    btnAceptar->move(450,330);
    btnAceptar->setText("Editar");
    btnAceptar->setIcon(QIcon(":/images/useredit.png"));
    btnAceptar->setIconSize(QSize(0,0));
    btnAceptar->setEnabled(false);
    connect(btnAceptar,SIGNAL(clicked()),this,SLOT(btnEditar()));

    lbNombre->move(280,240);
    leNombre->move(350,240);

    lbApellido->move(510,240);
    leApellido->move(580,240);

    lbTipo->move(300,270);

    rbProf->move(300,290);
    rbEstu->move(300,310);

    leCedula->show();
    lbCedula->show();
    btnAceptar->show();
    btnCancelar->show();
    lbApellido->show();
    leApellido->show();
    lbNombre->show();
    leNombre->show();
    lbTipo->show();
    rbEstu->show();
    rbProf->show();

}
Esempio n. 11
0
void ayuda()
{
	limpiar();

	char op;
	printf("=== AYUDA ===\n");
	printf("Hola, en el siguiente juego tendras que adivinar un numero\na partir de una serie de pistas que se te iran dando a\nmedida que vayas digitando tu opcion.\n\n");
	printf("Entendiste (S/n) ?: ");
	op = getchar();
	putchar(op);

	if(op == 'S' || op == 's')
	{
		limpiar();
		menu();
	}
	else if(op == 'N' || op == 'n')
	{
		limpiar();
		printf("Lee bien... Si tienes alguna duda puedes\ncontactarme a traves de mi E-mail: [email protected]\n\n");
		pause();
		ayuda();
	}
}
Esempio n. 12
0
void CashBoxWindow::on_boton_eliminar_clicked()
{
    //Se presiona 'Sacar Efectivo'
    //Se coloca la variable tipoMod en 2
    if (tipoMod == 2)
    {
        tipoMod = 0;
        desactivarEdicion();
        limpiar();
    }
    else
    {
        tipoMod = 2;
        activarEdicion();
        limpiar();

        ui->mod_billetes_2->setMaximum(ui->billetes_2->toPlainText().toInt());
        ui->mod_billetes_5->setMaximum(ui->billetes_5->toPlainText().toInt());
        ui->mod_billetes_10->setMaximum(ui->billetes_10->toPlainText().toInt());
        ui->mod_billetes_20->setMaximum(ui->billetes_20->toPlainText().toInt());
        ui->mod_billetes_50->setMaximum(ui->billetes_50->toPlainText().toInt());
        ui->mod_billetes_100->setMaximum(ui->billetes_100->toPlainText().toInt());
    }
}
Esempio n. 13
0
void CashBoxWindow::on_boton_agregar_clicked()
{
    //Se presiona 'Agregar Efectivo'
    //Se coloca la variable tipoMod en 1
    if (tipoMod == 1)
    {
        tipoMod = 0;
        desactivarEdicion();
        limpiar();
    }
    else
    {
        tipoMod = 1;
        activarEdicion();
        limpiar();

        ui->mod_billetes_2->setMaximum(99999);
        ui->mod_billetes_5->setMaximum(99999);
        ui->mod_billetes_10->setMaximum(99999);
        ui->mod_billetes_20->setMaximum(99999);
        ui->mod_billetes_50->setMaximum(99999);
        ui->mod_billetes_100->setMaximum(99999);
    }
}
Esempio n. 14
0
void FXTabSim::reiniciar(void) {
	FXint i;

	limpiar();
	clearItems();

	setTableSize(10,9);

	for ( i = 0; i < 9; i++ )
		setColumnText(i, cabecera[i]);

	tope = -1;
	numRegs = 0;

	bloques->clear();
	}
void devuelveNULLSiNoHayMasRegistrosEnNingunArchivo()
{
	inicializar();

	int leidas;
	for(leidas = 0; leidas < 8; leidas ++)
	{
		char *registro = obtenerRegistro(archivoApareado);
		free(registro);
	}

	char *registroQueDeberiaSerNulo = obtenerRegistro(archivoApareado);

	CU_ASSERT_PTR_EQUAL(registroQueDeberiaSerNulo, NULL);

	limpiar();
}
Esempio n. 16
0
void Libro::editarLibro()
{

    disconnect(btnAceptar, SIGNAL(clicked()),0, 0);
    btnAceptar->setIcon(QIcon(":/images/ver.png"));
    disconnect(btnCancelar,SIGNAL(clicked()),0,0);

    limpiar();

    mostrarEditar();
    comboTipoBusqueda->setCurrentIndex(0);

    connect(btnAceptar,SIGNAL(clicked()),this,SLOT(btnBuscar()));

    connect(btnCancelar,SIGNAL(clicked()),this,SLOT(btnEditar()));

    bandera=true;

}
Esempio n. 17
0
void en() {
    IEC0bits.IC1IE = 1; // inhabilitar interrupcion de Captura1
    IEC0bits.IC2IE = 1; // inhabilitar interrupcion de Captura2
    IEC2bits.IC3IE = 1; // inhabilitar interrupcion de Captura3
    IEC2bits.IC4IE = 1; // inhabilitar interrupcion de Captura4
    IEC2bits.IC5IE = 1; // inhabilitar interrupcion de Captura5
    IEC2bits.IC6IE = 1; // inhabilitar interrupcion de Captura6
    IEC1bits.IC7IE = 1; // inhabilitar interrupcion de Captura7
    IEC1bits.IC8IE = 1; // inhabilitar interrupcion de Captura8
    limpiar();
    IC1CONbits.ICM = 0b001; //Capture on every Edge (R/F)
    IC2CONbits.ICM = 0b001; //Capture on every Edge (R/F)
    IC3CONbits.ICM = 0b001; //Capture on every Edge (R/F)
    IC4CONbits.ICM = 0b001; //Capture on every Edge (R/F)
    IC5CONbits.ICM = 0b001; //Capture on every Edge (R/F)
    IC6CONbits.ICM = 0b001; //Capture on every Edge (R/F)
    IC7CONbits.ICM = 0b001; //Capture on every Edge (R/F)
    IC8CONbits.ICM = 0b001; //Capture on every Edge (R/F)
}
void obtieneLosRegistrosApareandoDeManeraCreciente()
{
	inicializar();

	char *registro0 = obtenerRegistro(archivoApareado);
	char *registro1 = obtenerRegistro(archivoApareado);
	char *registro2 = obtenerRegistro(archivoApareado);
	char *registro3 = obtenerRegistro(archivoApareado);
	char *registro4 = obtenerRegistro(archivoApareado);
	char *registro5 = obtenerRegistro(archivoApareado);

	CU_ASSERT_STRING_EQUAL(registro0, ARCHIVO1_REGISTRO0_0);
	CU_ASSERT_STRING_EQUAL(registro1, ARCHIVO2_REGISTRO0_1);
	CU_ASSERT_STRING_EQUAL(registro2, ARCHIVO1_REGISTRO1_2);
	CU_ASSERT_STRING_EQUAL(registro3, ARCHIVO2_REGISTRO1_3);
	CU_ASSERT_STRING_EQUAL(registro4, ARCHIVO2_REGISTRO2_4);
	CU_ASSERT_STRING_EQUAL(registro5, ARCHIVO1_REGISTRO2_5);

	limpiar();
}
Esempio n. 19
0
void Libro::buscarLibro()
{

    disconnect(btnAceptar, SIGNAL(clicked()),0, 0);

    limpiar();

    lbBuscar->setVisible(true);
    leBuscar->setVisible(true);
    lbTipoBusqueda->setVisible(true);
    comboTipoBusqueda->setVisible(true);

    btnAceptar->setText("Buscar");
    btnAceptar->setIcon(QIcon(":/images/ver.png"));
    btnAceptar->move(630,180);
    btnAceptar->setVisible(true);

    connect(btnAceptar,SIGNAL(clicked()),this,SLOT(btnBuscar()));

    bandera=false;
}
Esempio n. 20
0
void Usuarios::eliminarUsuario()
{

    disconnect(btnAceptar, SIGNAL(clicked()),0, 0);

    limpiar();

    lbCedula->setText("Ingrese Cedula: ");
    leCedula->move(460,180);
    lbCedula->move(330,180);

    btnAceptar->move(430,270);
    btnAceptar->setText("Eliminar");
    btnAceptar->setIcon(QIcon(":/images/cancel.png"));
    btnAceptar->setIconSize(QSize(15,15));
    connect(btnAceptar,SIGNAL(clicked()),this,SLOT(btnEliminar()));

    leCedula->show();
    lbCedula->show();
    btnAceptar->show();

}
Esempio n. 21
0
void Usuarios::buscarUsuario()
{

    disconnect(btnAceptar, SIGNAL(clicked()),0, 0);

    limpiar();

    leNombre->setReadOnly(true);
    leApellido->setReadOnly(true);

    leCedula->move(450,180);
    lbCedula->move(330,180);
    lbCedula->setText("Ingrese Cedula: ");

    btnAceptar->move(450,320);
    btnAceptar->setText("Buscar");
    btnAceptar->setIcon(QIcon(":/images/ver.png"));
    btnAceptar->setIconSize(QSize(15,15));
    connect(btnAceptar,SIGNAL(clicked()),this,SLOT(btnBuscar()));

    lbNombre->move(280,240);
    leNombre->move(350,240);

    lbApellido->move(510,240);
    leApellido->move(580,240);

    lbTipo->move(300,270);

    leCedula->show();
    lbCedula->show();
    btnAceptar->show();
    lbApellido->show();
    leApellido->show();
    lbNombre->show();
    leNombre->show();
    lbTipo->show();


}
Esempio n. 22
0
void Libro::eliminarLibro()
{

    disconnect(btnAceptar, SIGNAL(clicked()),0, 0);
    btnAceptar->setIcon(QIcon(":/images/cancel.png"));

    limpiar();

    lbCota->setText("Ingrese Cota: ");
    lbCota->move(360,180);
    leCota->move(450,180);

    btnAceptar->move(430,230);
    btnAceptar->setText("Eliminar");
    connect(btnAceptar,SIGNAL(clicked()),this,SLOT(btnEliminar()));

    leCota->show();
    lbCota->show();
    btnAceptar->show();

    bandera=false;

}
Esempio n. 23
0
void limpiar (char *cadena)
{
    char* s;
    s = strrchr(cadena,' ');
    if(s){
        if(s[1]=='\r'||s[1]=='\0'||s[1]=='\n'){
            *s = '\0';
            limpiar(cadena);
        }
    }

  char *p;
  p = strchr (cadena, '\n');
  if (p){
    *p = '\0';
    char *pp = strchr (cadena, '\r');
    if(pp)
        *pp = '\0';
    char *ppp = strchr (cadena, '\r');
    if(ppp)
        *ppp = '\0';
  }
}
Esempio n. 24
0
/**
 * \brief programa principal
 */
int main (void)
#endif
{
	SDL_Surface *screen;
	char cadena[25];
	int retorno;

	info ();

	if (iniciar(&screen))
		return 1;

	limpiar(screen, 0, 0, screen->w, screen->h);

	retorno = leer_teclado (cadena, 25, screen);

	if (retorno == 0)
		printf("La cadena escrita es : '%s'\n", cadena);
	else
		printf("en 'main()', leer_teclado fué cancelada\n"); 
	
	SDL_Quit();
	return 0;
}
Esempio n. 25
0
int main( int argc, char* args[] )
{

    //Quit flag
    bool quit = false;

    //Initialize
    if( init() == false )
    {
        return 1;
    }

    //Load the files
    if( load_files() == false )
    {
        return 1;
    }

    //Generate the message surfaces
//    upMessage = TTF_RenderText_Solid( font, "Up was pressed.", textColor );
//    downMessage = TTF_RenderText_Solid( font, "Down was pressed.", textColor );
//    leftMessage = TTF_RenderText_Solid( font, "Left was pressed", textColor );
//    rightMessage = TTF_RenderText_Solid( font, "Right was pressed", textColor );



    SDL_Surface* pasillo = load_image("tablero/path.png");
    SDL_Surface* muro = load_image("tablero/brick.png");
    SDL_Surface* obstaculo = load_image("tablero/green.png");
    SDL_Surface* ventaja = load_image("tablero/adv.png");

    char tablero[9][9]={{' ','#',' ','O','V',' ','#',' ','O'},
                        {' ','#',' ','#',' ',' ','#',' ','O'},
                        {'V','#',' ','#',' ',' ','#',' ','O'},
                        {'V','#',' ','#','#',' ',' ',' ','O'},
                        {' ','#',' ','#',' ',' ','#',' ','O'},
                        {'V','#',' ','#',' ',' ','#',' ','O'},
                        {'V','#',' ','#','#',' ','#',' ','O'},
                        {' ','#',' ','#',' ',' ','#',' ','O'},
                        {' ','O','O',' ',' ',' ','#',' ','O',}};

    char tablero_de_pasos[9][9]={{' ',' ',' ',' ',' ',' ',' ',' ',' '},
                                 {' ',' ',' ',' ',' ',' ',' ',' ',' '},
                                 {' ',' ',' ',' ',' ',' ',' ',' ',' '},
                                 {' ',' ',' ',' ',' ',' ',' ',' ',' '},
                                 {' ',' ',' ',' ',' ',' ',' ',' ',' '},
                                 {' ',' ',' ',' ',' ',' ',' ',' ',' '},
                                 {' ',' ',' ',' ',' ',' ',' ',' ',' '},
                                 {' ',' ',' ',' ',' ',' ',' ',' ',' '},
                                 {' ',' ',' ',' ',' ',' ',' ',' ',' '}};



    SDL_Surface* pasos_surface = load_image("pasos.png");
    SDL_Surface* atq_surface = load_image("ataque.png");
    SDL_Surface* win_surface = load_image("win.png");
    SDL_Surface* go_surface = load_image("go.png");

    SDL_Surface* personaje_surface = load_image("player1/image1.png");
     SDL_Surface* enemigo_surface = load_image("enem.png");
    Personaje* personaje= new Personaje(2,3,personaje_surface);

    Personaje* enemigo=new Personaje(5,5,enemigo_surface);

    Personaje* actual=personaje;

//    enemigo.turn=false;


    SDL_Surface* cursor_surface = load_image("cursor.png");
    int cursor_x=0;
    int cursor_y=0;

    //While the user hasn't quit
    while( quit == false )
    {
        //If there's an event to handle
        if( SDL_PollEvent( &event ) )
        {
            //If a key was pressed
            if( event.type == SDL_KEYDOWN )
            {
                //Set the proper message surface
                switch( event.key.keysym.sym )
                {
                    case SDLK_UP:
                        cursor_y--;
//
//                        limpiar(tablero_de_pasos);
//                        if(cursor_x==personaje->x && cursor_y==personaje->y)
//                        {
//
//                            marcar_atq(tablero,tablero_de_pasos,personaje->x,personaje->y,3);
//
//                            marcar(tablero,tablero_de_pasos,personaje->x,personaje->y,2);
//                        }

                    break;
                    case SDLK_DOWN:

                        cursor_y++;
                    break;
                    case SDLK_LEFT:

                        cursor_x--;
                    break;
                    case SDLK_RIGHT:

                        cursor_x++;
                    break;

                    case SDLK_F1:

//                        personaje->atacar(enemigo);
//                        enemigo->attacar(personaje);

                        if(actual->x==personaje->x &&  actual->y==personaje->y){
                            enemigo->atacar(personaje);

                        }
                        if(actual->x==enemigo->x &&  actual->y==enemigo->y)
                            personaje->atacar(enemigo);


                    break;

                    case SDLK_RETURN:
                       if(turno){

                        if(puedoLLegar(tablero,personaje->x,personaje->y,2,cursor_x,cursor_y))
                        {
                            actual = personaje;

                            personaje->x=cursor_x;
                            personaje->y=cursor_y;




                            limpiar(tablero_de_pasos);

                            marcar_atq(tablero,tablero_de_pasos,personaje->x,personaje->y,3);

                            marcar(tablero,tablero_de_pasos,personaje->x,personaje->y,2);




                        }

                        turno=false;
                        }



                        else if(turno==false){

                         if(puedoLLegar(tablero,enemigo->x,enemigo->y,2,cursor_x,cursor_y))
                        {

                            actual=enemigo;

                            enemigo->x=cursor_x;
                            enemigo->y=cursor_y;

                            limpiar(tablero_de_pasos);


                            marcar_atq(tablero,tablero_de_pasos,enemigo->x,enemigo->y,3);
                            marcar(tablero,tablero_de_pasos,enemigo->x,enemigo->y,2);





                        }

                        turno =true;

                        }



                    break;
                }
            }

            //If the user has Xed out the window
            else if( event.type == SDL_QUIT )
            {
                //Quit the program
                quit = true;
            }
        }

        //Apply the background
       apply_surface( 0, 0, background, screen );

        //If a message needs to be displayed
        if( message != NULL )
        {
            //Apply the background to the screen
            apply_surface( 0, 0, background, screen );

            //Apply the message centered on the screen
            apply_surface( ( SCREEN_WIDTH - message->w ) / 2, ( SCREEN_HEIGHT - message->h ) / 2, message, screen );

            //Null the surface pointer
            message = NULL;
        }

        for(int x=0;x<9;x++)
            for(int y=0;y<9;y++)
            {
                if(tablero[y][x]==' ')
                    apply_surface(x*75,y*75,pasillo,screen);
                if(tablero[y][x]=='#')
                    apply_surface(x*75,y*75,muro,screen);
                if(tablero[y][x]=='O')
                    apply_surface(x*75,y*75,obstaculo,screen);
                if(tablero[y][x]=='V')
                    apply_surface(x*75,y*75,ventaja,screen);
            }

        for(int x=0;x<9;x++)
            for(int y=0;y<9;y++){
                if(tablero_de_pasos[y][x]=='P')
                    apply_surface(x*75,y*75,pasos_surface,screen);

                if(tablero_de_pasos[y][x]=='A')
                    apply_surface(x*75,y*75,atq_surface,screen);


            }


        personaje->hp=TTF_RenderText_Solid( personaje->font, personaje->toString(personaje->vida).c_str(), personaje->textColor );
        enemigo->hp=TTF_RenderText_Solid( enemigo->font, enemigo->toString(enemigo->vida).c_str(), enemigo->textColor );

        personaje->dibujar(screen);
      //  personaje->hp_dibujar(screen);


        enemigo->dibujar(screen);
        //enemigo->hp_dibujar(screen);

        apply_surface(cursor_x*75,cursor_y*75,cursor_surface,screen);


        if(personaje->vida==0)
            apply_surface(0,0,go_surface,screen);

        if(enemigo->vida==0)
            apply_surface(0,0,win_surface,screen);

        //Update the screen
        if( SDL_Flip( screen ) == -1 )
        {
            return 1;
        }
    }

    //Clean up
    clean_up();

    return 0;
}
Esempio n. 26
0
void Colas::limpiar() {
    if(frente)
        pop();
    limpiar();
}
Esempio n. 27
0
void Libro::cancelar()
{

    limpiar();

}
Esempio n. 28
0
void Libro::nuevoLibro()
{
    limpiar();
    mostrarNuevo();
    bandera=false;
}
Esempio n. 29
0
int main(int argc, char** argv) {

    /////////Configuracion de Clock/////////
    CLKDIVbits.ROI = 0;
    CLKDIVbits.DOZE = 0b000;
    CLKDIVbits.DOZEN = 0;
    CLKDIVbits.PLLPRE = 0b00010; //N1 = 4
    PLLFBDbits.PLLDIV = 0b000011110; //M = 32
    CLKDIVbits.PLLPOST = 0b00; //N2 = 2;
    //(20*32)/(2*4) = 5*16 = 80 MHz

    /////////Secuencia Cambio de Oscilador/////////
    __builtin_write_OSCCONH(0x03);
    __builtin_write_OSCCONL(OSCCON | 0x01);
    // Wait for Clock switch to occur
    while (OSCCONbits.COSC != 0b011);
    // Wait for PLL to lock
    while (!OSCCONbits.LOCK);
    //////////////////////////////////////////////

    //Inicializacion de Variables//
    cha = 'Q';
    cant = 0;
    cont = 0;
    CN = 0;
    itm = 0;
    ti = 0;
    deb = 0;
    ///////////////////////////////
    AD1PCFGLbits.PCFG4 = 1;
    AD1PCFGLbits.PCFG5 = 1;
    TRISBbits.TRISB4 = 1;
    TRISBbits.TRISB5 = 1;
    TRISFbits.TRISF2 = 1; //U1RX
    TRISGbits.TRISG2 = 0;//Activador de Bomba
    TRISGbits.TRISG3 = 1;//FeedBack bomba
    TRISFbits.TRISF6 = 1;//Modo debug segun estado (1 o 0)
    LATGbits.LATG2 = 0;
    if (PORTFbits.RF6)
        deb = 1;
//    /////////Configuracion timer 1/////////
//    T1CONbits.TSIDL = 1;
//    T1CONbits.TCS = 0;
//    T1CONbits.TGATE = 0;
//    T1CONbits.TCKPS = 0b11; //1:256 PreScaller 16 us per ++
//    PR1 = 62500; //periodo del timer 1 = 1 sec
//    IPC0bits.T1IP = 5; // Prioridad 1 para inttimer1
//    IFS0bits.T1IF = 0; // limpiar flag de interrupcion 1
//    IEC0bits.T1IE = 0; // habilitar interrupcion del timer1
//    T1CONbits.TON = 1; // iniciar timer 1

    ///////Configuracion timer 2/////////
    T2CONbits.TSIDL = 1;
    T2CONbits.TCS = 0;
    T2CONbits.TGATE = 0;
    T2CONbits.TCKPS = 0b00; //1:1 PreScaller 0.0625 us per ++
    PR2 = 65535; //periodo del timer 2
    IPC1bits.T2IP = 5; // Prioridad 1 para inttimer2
    IFS0bits.T2IF = 0; // limpiar flag de interrupcion 2
    IEC0bits.T2IE = 0; // habilitar interrupcion del timer2
    T2CONbits.TON = 1; // iniciar timer 2

    ////////////configuracion de ICx///////
    limpiar();
    IC1CONbits.ICSIDL = 1; //free-Running Mode  //0b10100; //IC1 Trig Souce  = IC1 pin
    IC2CONbits.ICSIDL = 1; //free-Running Mode  //0b10101; //IC2 Trig Souce  = IC2 pin
    IC3CONbits.ICSIDL = 1; //free-Running Mode  //0b10101; //IC2 Trig Souce  = IC2 pin
    IC4CONbits.ICSIDL = 1; //free-Running Mode  //0b10101; //IC2 Trig Souce  = IC2 pin
    IC5CONbits.ICSIDL = 1; //IC1 halts on idle
    IC6CONbits.ICSIDL = 1; //IC2 halts on idle
    IC7CONbits.ICSIDL = 1; //IC1 halts on idle
    IC8CONbits.ICSIDL = 1; //IC1 halts on idle
    IC1CONbits.ICTMR = 1; //IC1 Captute Timer = Timer2
    IC2CONbits.ICTMR = 1; //IC1 Captute Timer = Timer2
    IC3CONbits.ICTMR = 1; //IC1 Captute Timer = Timer2
    IC4CONbits.ICTMR = 1; //IC1 Captute Timer = Timer2
    IC5CONbits.ICTMR = 1; //IC1 Captute Timer = Timer2
    IC6CONbits.ICTMR = 1; //IC1 Captute Timer = Timer2
    IC7CONbits.ICTMR = 1; //IC1 Captute Timer = Timer2
    IC8CONbits.ICTMR = 1; //IC1 Captute Timer = Timer2
    IC1CONbits.ICI = 0b00; //Interrupt on every capture event
    IC2CONbits.ICI = 0b00; //Interrupt on every capture event
    IC3CONbits.ICI = 0b00; //Interrupt on every capture event
    IC4CONbits.ICI = 0b00; //Interrupt on every capture event
    IC5CONbits.ICI = 0b00; //Interrupt on every capture event
    IC6CONbits.ICI = 0b00; //Interrupt on every capture event
    IC7CONbits.ICI = 0b00; //Interrupt on every capture event
    IC8CONbits.ICI = 0b00; //Interrupt on every capture event
    IC1CONbits.ICM = 0b000; //Capture on every Edge (R/F)
    IC2CONbits.ICM = 0b000; //Capture on every Edge (R/F)
    IC3CONbits.ICM = 0b000; //Capture on every Edge (R/F)
    IC4CONbits.ICM = 0b000; //Capture on every Edge (R/F)
    IC5CONbits.ICM = 0b000; //Capture on every Edge (R/F)
    IC6CONbits.ICM = 0b000; //Capture on every Edge (R/F)
    IC7CONbits.ICM = 0b000; //Capture on every Edge (R/F)
    IC8CONbits.ICM = 0b000; //Capture on every Edge (R/F)
    TMR2 = 0;
    IPC0bits.IC1IP = 1; // Prioridad 1 para Captura1
    IPC1bits.IC2IP = 1; // Prioridad 1 para Captura2
    IPC9bits.IC3IP = 1; // Prioridad 1 para Captura3
    IPC9bits.IC4IP = 1; // Prioridad 1 para Captura4
    IPC9bits.IC5IP = 1; // Prioridad 1 para Captura5
    IPC10bits.IC6IP = 1; // Prioridad 1 para Captura6
    IPC5bits.IC7IP = 1; // Prioridad 1 para Captura7
    IPC5bits.IC8IP = 1; // Prioridad 1 para Captura8
    IFS0bits.IC1IF = 0; // limpiar flag de interrupcion IC1
    IFS0bits.IC2IF = 0; // limpiar flag de interrupcion IC2
    IFS2bits.IC3IF = 0; // limpiar flag de interrupcion IC3
    IFS2bits.IC4IF = 0; // limpiar flag de interrupcion IC4
    IFS2bits.IC5IF = 0; // limpiar flag de interrupcion IC5
    IFS2bits.IC6IF = 0; // limpiar flag de interrupcion IC6
    IFS1bits.IC7IF = 0; // limpiar flag de interrupcion IC7
    IFS1bits.IC8IF = 0; // limpiar flag de interrupcion IC8
    IEC0bits.IC1IE = 0; // inhabilitar interrupcion de Captura1
    IEC0bits.IC2IE = 0; // inhabilitar interrupcion de Captura2
    IEC2bits.IC3IE = 0; // inhabilitar interrupcion de Captura3
    IEC2bits.IC4IE = 0; // inhabilitar interrupcion de Captura4
    IEC2bits.IC5IE = 0; // inhabilitar interrupcion de Captura5
    IEC2bits.IC6IE = 0; // inhabilitar interrupcion de Captura6
    IEC1bits.IC7IE = 0; // inhabilitar interrupcion de Captura7
    IEC1bits.IC8IE = 0; // inhabilitar interrupcion de Captura8

    /////////Configuracion UART 1/////////
    //    U1BRG = 259; //BaudRate = 9600;
    U1BRG = 64; //BaudRate = 38400;
    //    U1BRG = 21; //BaudRate = 115200;
    U1MODEbits.USIDL = 0; //1?
    U1MODEbits.IREN = 0;
    U1MODEbits.RTSMD = 1;
    U1MODEbits.UEN = 0b00; //11?
    U1MODEbits.WAKE = 0;
    U1MODEbits.LPBACK = 0;
    U1MODEbits.ABAUD = 0;
    U1MODEbits.URXINV = 0;
    U1MODEbits.BRGH = 0;
    U1MODEbits.PDSEL = 0b00;
    U1MODEbits.STSEL = 0;
    U1STAbits.UTXISEL1 = 0;
    U1STAbits.UTXISEL0 = 1;
    U1STAbits.UTXINV = 0;
    U1STAbits.UTXBRK = 0;
    U1STAbits.URXISEL = 0b01;
    U1STAbits.ADDEN = 0;
    U1STAbits.RIDLE = 0;
    U1MODEbits.UARTEN = 1;
    U1STAbits.UTXEN = 1;
    IPC2bits.U1RXIP = 2; // Prioridad 2 para U1RX
    IFS0bits.U1RXIF = 0;
    IEC0bits.U1RXIE = 1;
    //    U1STAbits.UTXBF //recurso, buffer vacio
    //    U1STAbits.URXDA //recurso, datos recibidos

    //Protocolo Inicial
    delay_ms(1000);
    printf("LT8-WL\r\n");
    printf("Sensores:\r\n");
    tomdatp();
    printf("Funcionamiento Correcto\r\n");
    printf("Esperando Comandos.....\r\n");
    ///////////////////
    while (1) {
        if (ti == 1) {
            printf("\r\nToma de %u Muestras Iniciada!#\r\n", cant);
            ti = 0;
        }
        cont = 0;
        while (itm == 1 && ti == 0) {
            tomdat();
            cont++;
            if (cont >= cant) {
                report(1);
                report(2);
                report(3);
                report(4);
                report(5);
                report(6);
                report(7);
                report(8);
                printf("#Toma de %u Muestras Terminada!\r\n", cant);
                printf("#%u#/", cant);
                cant = 0;
                itm = 0;
                CN = 0;
            }
        }
    }
    return 1;
}
Esempio n. 30
0
File: Menu.cpp Progetto: ejpcr/lib-c
void menu(matriz A, matriz B)
{int op; limpiar();double x;
 gotoxy(10,5);  cout<<"[1] OBTENER UN ELEMENTO DE A..";
 gotoxy(10,6);  cout<<"[2] OBTENER UN ELEMENTO DE B..";
 gotoxy(10,7);  cout<<"[3] ASIGNAR UN ELEMENTO DE A..";
 gotoxy(10,8);  cout<<"[4] ASIGNAR UN ELEMENTO DE B..";
 gotoxy(10,9);  cout<<"[5] IGUALAR A<-B..............";
 gotoxy(10,10); cout<<"[6] IGUALAR B<-A..............";
 gotoxy(10,11); cout<<"[7] SUMAR A + B...............";
 gotoxy(10,12); cout<<"[8] NEGATIVA DE A.............";
 gotoxy(10,13); cout<<"[9] NEGATIVA DE B.............";
 gotoxy(10,14); cout<<"[10] RESTAR A - B.............";
 gotoxy(10,15); cout<<"[11] RESTAR B - A.............";
 gotoxy(10,16); cout<<"[12] ESCALAR PARA A...........";
 gotoxy(10,17); cout<<"[13] ESCALAR PARA B...........";
 gotoxy(10,18); cout<<"[14] PRODUCTO A * B...........";
 gotoxy(10,19); cout<<"[15] PRODUCTO B * A...........";
 gotoxy(10,20); cout<<"[16] TRANSPUESTA DE A.........";
 gotoxy(10,21); cout<<"[17] TRANSPUESTA DE B.........";
 gotoxy(10,22); cout<<"[18] DETERMINANTE DE A........";
 gotoxy(10,23); cout<<"[19] DETERMINANTE DE B........";
 gotoxy(10,24); cout<<"[20] INVERSA DE A.............";
 gotoxy(10,25); cout<<"[21] INVERSA DE B.............";
 gotoxy(10,26); cout<<"[22] SALIR....................";
 do{gotoxy(22,28); cout<<"Seleccione una opcion (1-22): ";cin>>op;
 if(op<1 || op>22)
  {gotoxy(20,28);cout<<"Opci¢n incorrecta vuelva a intentar";}
 }while(op<1 || op>22);
 switch(op)
 {case 1:  {limpiar();gotoxy(28,4);  cout<<"[1] OBTENER UN ELEMENTO DE A..";
	    obtener(A);menu(A,B);break;}
  case 2:  {limpiar(); gotoxy(28,4); cout<<"[2] OBTENER UN ELEMENTO DE B..";
	    obtener(B);menu(A,B);break;}
  case 3:  {limpiar(); gotoxy(28,4); cout<<"[3] ASIGNAR UN ELEMENTO DE A..";
	    imprimir(asignar(A));getchar();menu(A,B);break;}
  case 4:  {limpiar(); gotoxy(28,4); cout<<"[4] ASIGNAR UN ELEMENTO DE B..";
	    imprimir(asignar(B));getchar();menu(A,B);break;}
  case 5:  {limpiar(); gotoxy(28,4); cout<<"[5] IGUALAR A<-B..............";
	    imprimir(igual(A,B));menu(A,B);break;}
  case 6:  {limpiar(); gotoxy(28,4); cout<<"[6] IGUALAR B<-A..............";
	    imprimir(igual(B,A));menu(A,B);break;}
  case 7:  {limpiar(); gotoxy(28,4); cout<<"[7] SUMAR A + B...............";
	    imprimir(sumar(A,B));menu(A,B);break;}
  case 8:  {limpiar(); gotoxy(28,4); cout<<"[8] NEGATIVA DE A.............";
	    imprimir(negativa(A));menu(A,B);break;}
  case 9:  {limpiar(); gotoxy(28,4); cout<<"[9] NEGATIVA DE B.............";
	    imprimir(negativa(B));menu(A,B);break;}
  case 10: {limpiar(); gotoxy(28,4); cout<<"[10] RESTAR A - B.............";
	    imprimir(restar(A,B));menu(A,B);break;}
  case 11: {limpiar(); gotoxy(28,4); cout<<"[11] RESTAR B - A.............";
	    imprimir(restar(B,A));menu(A,B);break;}
  case 12: {limpiar(); gotoxy(28,4); cout<<"[12] ESCALAR PARA A...........";
	    imprimir(escalar(A));menu(A,B);break;}
  case 13: {limpiar(); gotoxy(28,4); cout<<"[13] ESCALAR PARA B...........";
	    imprimir(escalar(B));menu(A,B);break;}
  case 14: {limpiar(); gotoxy(28,4); cout<<"[14] PRODUCTO A * B...........";
	    imprimir(producto(A,B));menu(A,B);break;}
  case 15: {limpiar(); gotoxy(28,4); cout<<"[15] PRODUCTO B * A...........";
	    imprimir(producto(B,A));menu(A,B);break;}
  case 16: {limpiar(); gotoxy(28,4); cout<<"[16] TRANSPUESTA DE A.........";
	    imprimir(transpuesta(A));menu(A,B);break;}
  case 17: {limpiar(); gotoxy(28,4); cout<<"[17] TRANSPUESTA DE B.........";
	    imprimir(transpuesta(B));menu(A,B);break;}
  case 18: {limpiar(); gotoxy(28,4); cout<<"[18] DETERMINANTE DE A........";
	    x=det(A);gotoxy(5,5);cout<<"Determinante = "<<x;getchar();menu(A,B);break;}
  case 19: {limpiar(); gotoxy(28,4); cout<<"[19] DETERMINANTE DE B........";
	    x=det(B);gotoxy(5,5);cout<<"Determinante = "<<x;getchar();menu(A,B);break;}
  case 20: {limpiar(); gotoxy(28,4); cout<<"[20] INVERSA DE A.............";
	    inversa(A);menu(A,B);break;}
  case 21: {limpiar(); gotoxy(28,4); cout<<"[21] INVERSA DE B.............";
	    inversa(B);menu(A,B);break;}
  case 22: {limpiar(); gotoxy(28,4); cout<<"[22] SALIR....................";
	    gotoxy(10,10); cout<<"Saliendo...";
	    gotoxy(25,23); cout<<"Presione Enter Para Salir...";break;
	   }
 }
}