static void findTag (const char *const name, const int options) { tagFileInfo info; tagEntry entry; tagFile *const file = tagsOpen (TagFileName, &info); if (file == NULL) { fprintf (stderr, "%s: cannot open tag file: %s: %s\n", ProgramName, strerror (info.status.error_number), name); exit (1); } else { if (SortOverride) tagsSetSortType (file, SortMethod); if (tagsFind (file, &entry, name, options) == TagSuccess) { do { printTag (&entry); } while (tagsFindNext (file, &entry) == TagSuccess); } tagsClose (file); } }
static void listTags (void) { tagFileInfo info; tagEntry entry; tagFile *const file = tagsOpen (TagFileName, &info); if (file == NULL) { fprintf (stderr, "%s: cannot open tag file: %s: %s\n", ProgramName, strerror (info.status.error_number), TagFileName); exit (1); } else { while (tagsNext (file, &entry) == TagSuccess) { #ifdef QUALIFIER if (Qualifier) { int i = q_is_acceptable (Qualifier, &entry); switch (i) { case Q_REJECT: continue; case Q_ERROR: exit (1); } } #endif printTag (&entry); } tagsClose (file); } }
void appl::TextPluginCtags::jumpTo(const std::string& _name) { if (m_ctagFile == nullptr) { APPL_WARNING("No ctags file open"); return; } tagEntry entry; APPL_INFO("try to find the tag : " << _name); if (tagsFind (m_ctagFile, &entry, _name.c_str(), 0) != TagSuccess) { APPL_INFO("no tag find ..."); return; } tagEntry entrySave = entry; int32_t numberOfTags = 0; // For all tags : Save in an internal Structure : std::string tmpFile(m_tagFolderBase + "/" + entry.file); etk::FSNode myfile(tmpFile); int32_t lineID = entry.address.lineNumber; printTag(&entry); if (tagsFindNext (m_ctagFile, &entry) == TagSuccess) { APPL_INFO("Multiple file destination ..."); ememory::SharedPtr<appl::TagFileSelection> tmpWidget = appl::TagFileSelection::create(); if (tmpWidget == nullptr) { APPL_ERROR("Can not allocate widget == > display might be in error"); } else { tmpWidget->addCtagsNewItem(myfile.getFileSystemName(), lineID); do { tmpFile = m_tagFolderBase + "/" + entry.file; myfile = tmpFile; lineID = entry.address.lineNumber; printTag(&entry); tmpWidget->addCtagsNewItem(myfile.getFileSystemName(), lineID); } while (tagsFindNext (m_ctagFile, &entry) == TagSuccess); ewol::getContext().getWindows()->popUpWidgetPush(tmpWidget); tmpWidget->signalSelect.connect(sharedFromThis(), &appl::TextPluginCtags::onCallbackOpenCtagsSelectReturn); } } else { jumpFile(myfile.getName(), lineID - 1); } }
static void listTags (void) { tagFileInfo info; tagEntry entry; tagFile *const file = tagsOpen (TagFileName, &info); if (file == NULL) { fprintf (stderr, "%s: cannot open tag file: %s: %s\n", ProgramName, strerror (info.status.error_number), TagFileName); exit (1); } else { while (tagsNext (file, &entry) == TagSuccess) printTag (&entry); tagsClose (file); } }
void agregar(){ int x; int opc = 0; do { printTag(); cout << " Agregar Canciones" << endl; cout << endl; cout << "( 1 ) Nuevo autor" << endl; cout << "( 2 ) Nuevo genero" << endl; cout << "( 3 ) Nuevo album" << endl; cout << "( 4 ) Nuevo single" << endl; cout << "( 0 ) Regresar" << endl; cin >> opc; switch (opc){ case 1: agregarAutor(); break; case 2: cancionLDC *g; cout << "ingrese el nombre del genero" << endl; cin >> nombre; g = new cancionLDC(nombre); lGeneros->insertar(g); break; case 3: agregarLista(NULL, "album"); break; case 4: agregarCancion(NULL); break; case 0: break; default: cout << "Opcion no valida..." << endl; }// fin del switch system("pause"); } while (opc != 0); menu(); }
static void findTag (const char *const name, const int options) { tagFileInfo info; tagEntry entry; tagFile *const file = tagsOpen (TagFileName, &info); if (file == NULL) { fprintf (stderr, "%s: cannot open tag file: %s: %s\n", ProgramName, strerror (info.status.error_number), name); exit (1); } else { if (SortOverride) tagsSetSortType (file, SortMethod); if (debugMode) fprintf (stderr, "%s: searching for \"%s\" in \"%s\"\n", ProgramName, name, TagFileName); if (tagsFind (file, &entry, name, options) == TagSuccess) { do { #ifdef QUALIFIER if (Qualifier) { int i = q_is_acceptable (Qualifier, &entry); switch (i) { case Q_REJECT: continue; case Q_ERROR: exit (1); } } #endif printTag (&entry); } while (tagsFindNext (file, &entry) == TagSuccess); } tagsClose (file); } }
void eliminar(){ int x; int opc = 0; do { printTag(); cout << " Eliminar Musica" << endl; cout << endl; cout << "( 1 ) Desplegar todas" << endl; cout << "( 2 ) Eliminar por Autor" << endl; cout << "( 3 ) Eliminar por Nombre" << endl; cout << "( 0 ) Regresar" << endl; cin >> opc; switch (opc){ case 1: all->mostrarLista(); break; case 2: cout << "ingrese el nombre del autor a eliminar" << endl; cin >> nombre; lAutores->eliminarAutor(nombre); break; case 3: cout << "ingrese el nombre de la cancion a eliminar" << endl; cin >> nombre; all->eliminar(nombre); break; case 0:cout << " " << endl; break; default: cout << "Opcion no valida..." << endl; }// fin del switch system("pause"); } while (opc != 0); }
int main(int argc, const char *argv[]) { if (argc < 2) { usage(); exit(EXIT_FAILURE); } parseopts(argv[1]); nfc_init(&context); if (context == NULL) { ERR("Unable to init libnfc (malloc)"); exit(EXIT_FAILURE); } // Try to open the NFC reader pnd = nfc_open(context, NULL); if (pnd == NULL) { ERR("Error opening NFC reader"); nfc_exit(context); exit(EXIT_FAILURE); } if (nfc_initiator_init(pnd) < 0) { nfc_perror(pnd, "nfc_initiator_init"); nfc_close(pnd); nfc_exit(context); exit(EXIT_FAILURE); }; // Let the reader only try once to find a tag if (nfc_device_set_property_bool(pnd, NP_INFINITE_SELECT, false) < 0) { nfc_perror(pnd, "nfc_device_set_property_bool"); nfc_close(pnd); nfc_exit(context); exit(EXIT_FAILURE); } // Disable ISO14443-4 switching in order to read devices that emulate Mifare Classic with ISO14443-4 compliance. if (nfc_device_set_property_bool(pnd, NP_AUTO_ISO14443_4, false) < 0) { nfc_perror(pnd, "nfc_device_set_property_bool"); nfc_close(pnd); nfc_exit(context); exit(EXIT_FAILURE); } // Configure the CRC if (nfc_device_set_property_bool(pnd, NP_HANDLE_CRC, false) < 0) { nfc_perror(pnd, "nfc_device_set_property_bool"); nfc_close(pnd); nfc_exit(context); exit(EXIT_FAILURE); } // Use raw send/receive methods if (nfc_device_set_property_bool(pnd, NP_EASY_FRAMING, false) < 0) { nfc_perror(pnd, "nfc_device_set_property_bool"); nfc_close(pnd); nfc_exit(context); exit(EXIT_FAILURE); } printf("NFC reader: %s opened\n", nfc_device_get_name(pnd)); // Try to find a MIFARE Classic tag if (select_target(pnd, &nt) <= 0) { printf("Error: no tag was found\n"); nfc_close(pnd); nfc_exit(context); exit(EXIT_FAILURE); } // Test if we are dealing with a MIFARE compatible tag if ((nt.nti.nai.btSak & 0x08) == 0) { printf("Warning: tag is probably not a MFC!\n"); } printf("Found MIFARE Classic card:\n"); nt.nm = nmMifare; print_nfc_target(&nt, false); // Guessing size if ((nt.nti.nai.abtAtqa[1] & 0x02) == 0x02) // 4K uiBlocks = 0xff; else if ((nt.nti.nai.btSak & 0x01) == 0x01) // 320b uiBlocks = 0x13; else // 1K/2K, checked through RATS uiBlocks = 0x3f; printf("Guessing size: seems to be a %i-byte card\n", (uiBlocks + 1) * 16); if (parse_card()) { printf("Done, %d blocks read.\n", uiBlocks + 1); fflush(stdout); } if(is_addv) if(!easy_add_value(0xff) || !parse_card()) printf("Failed Add Value!!\n"); printTag(&e); nfc_close(pnd); nfc_exit(context); exit(EXIT_SUCCESS); }
void reproducir(){ int x; int opc = 0; do { printTag(); cout << " Reproducir Musica" << endl; cout << endl; cout << "( 1 ) Playlist" << endl; cout << "( 2 ) Album" << endl; cout << "( 3 ) Genero" << endl; cout << "( 4 ) Autores" << endl; cout << "( 5 ) Todas" << endl; cout << "( 0 ) Regresar" << endl; cin >> opc; switch (opc){ case 1:{ lPlayList->mostrar(); cout << "ingrese el nombre de la playlist a escuchar" << endl; cin >> nombre; cancionLDC *aux = lPlayList->contiene(nombre); if (aux != NULL) reproducirLista(aux); break; } case 2:{ lAlbumes->mostrar(); cout << "ingrese el nombre del album a escuchar" << endl; cin >> nombre; cancionLDC *albumes = lAlbumes->contiene(nombre); if (albumes != NULL) reproducirLista(albumes); break; } case 3:{ lGeneros->mostrar(); cout << "ingrese el nombre del genero a escuchar" << endl; cin >> nombre; cancionLDC *temp = lAlbumes->contiene(nombre); if (temp != NULL) reproducirLista(temp); break; } case 4:{ lAutores->desplegarLISTA(); cout << "ingrese el nombre del autor a escuchar" << endl; cin >> nombre; cancionLDC *listaAutor = lAlbumes->contiene(nombre); if (listaAutor != NULL) reproducirLista(listaAutor); break; } case 5:{ all->mostrarLista(); cout << "ingrese el nombre de la cancion a escuchar" << endl; cin >> nombre; if (all->dirNodo(nombre) != NULL){ all->dirNodo(nombre)->getCancion()->getPath(); char test[50]; char vlc[80] = "vlc "; strcpy_s(test, all->dirNodo(nombre)->getCancion()->getPath()); strcat_s(vlc, test); system(vlc); } // if (todos != NULL) //// reproducirLista(todos); break; } case 0:cout << "Fin del programa..." << endl; break; default: cout << "Opcion no valida..." << endl; }// fin del switch system("pause"); } while (opc != 0); }