/*! \brief Input: _. Output: A matrix * * Generates a unimodular matrix. */ gsl_matrix* genU(){ int z, j ,display = 1; /* Initialize and allocate memory for necessary matrices */ gsl_matrix* result = gsl_matrix_alloc(SIZE,SIZE); gsl_matrix* result2 = gsl_matrix_alloc(SIZE,SIZE); gsl_matrix* base = gsl_matrix_alloc(SIZE,SIZE); gsl_matrix_set_identity(result); gsl_matrix_set_identity(result2); gsl_matrix_set_identity(base); /* Display progress of generating a unimodular to the user */ printf("Generating Unimodular\n"); printf("|..................................................|\r\033[01;35m|"); fflush(stdout); if(SIZE/50 > 1) display = SIZE/50; for(z = 0; z<DEPTH; z++){ if(z%2 == 0){ for(j=0; j < SIZE ; j++) { if(j%2 == 0){ randomLine(base,j); gsl_linalg_matmult(result,base,result2); gsl_matrix_memcpy(result,result2); clearLine(base,j); if(j % display == 0){ printf("-"); fflush(stdout); } } } }else{ printf("| 50%%\r\033[01;32m|"); for(j=SIZE-1; j >= 0 ; j--) { if(j%2 == 1){ randomLine(base,j); gsl_linalg_matmult(result,base,result2); gsl_matrix_memcpy(result,result2); clearLine(base,j); if(j % display == 1){ printf("="); fflush(stdout); } } } } } printf("| 100%% DONE\rUnimodular Generated\033[0m\n"); free(result2); free(base); return result; }
static int mpc_tell(char *word[], char *word_eol[], void *userdata){ char *tTitle, *zero, *oggLine, *line; struct tagInfo info; HWND hwnd = FindWindow("MediaPlayerClassicW",NULL); if (hwnd==0) {hexchat_command(ph, randomLine(notRunTheme));return HEXCHAT_EAT_ALL;} tTitle=(char*)malloc(sizeof(char)*1024); GetWindowText(hwnd, tTitle, 1024); zero=strstr(tTitle," - Media Player Classic"); if (zero!=NULL) zero[0]=0; else hexchat_print(ph,"pattern not found"); if ((tTitle[1]==':')&&(tTitle[2]=='\\')){ //hexchat_print(ph,"seams to be full path"); if (endsWith(tTitle,".mp3")==1){ //hexchat_print(ph,"seams to be a mp3 file"); info = readHeader(tTitle); if ((info.artist!=NULL)&&(strcmp(info.artist,"")!=0)){ char *mode=MODES[info.mode]; //hexchat_printf(ph,"mode: %s\n",mode); char *mp3Line=randomLine(mp3Theme); mp3Line=replace(mp3Line,"%art",info.artist); mp3Line=replace(mp3Line,"%tit",info.title); mp3Line=replace(mp3Line,"%alb",info.album); mp3Line=replace(mp3Line,"%com",info.comment); mp3Line=replace(mp3Line,"%gen",info.genre); //mp3Line=replace(mp3Line,"%time",pos); //mp3Line=replace(mp3Line,"%length",len); //mp3Line=replace(mp3Line,"%ver",waVers); //mp3Line=intReplace(mp3Line,"%br",br); //mp3Line=intReplace(mp3Line,"%frq",frq); mp3Line=intReplace(mp3Line,"%br",info.bitrate); mp3Line=intReplace(mp3Line,"%frq",info.freq); mp3Line=replace(mp3Line,"%mode",mode); //mp3Line=replace(mp3Line,"%size",size); //mp3Line=intReplace(mp3Line,"%perc",perc); //mp3Line=replace(mp3Line,"%plTitle",title); mp3Line=replace(mp3Line,"%file",tTitle); hexchat_command(ph, mp3Line); return HEXCHAT_EAT_ALL; } } if (endsWith(tTitle,".ogg")==1){ hexchat_printf(ph,"Ogg detected\n"); info = getOggHeader(tTitle); if (info.artist!=NULL){ char *cbr; if (info.cbr==1) cbr="CBR"; else cbr="VBR"; oggLine=randomLine(oggTheme); //if (cue==1) oggLine=cueLine; //hexchat_printf(ph,"ogg-line: %s\n",oggLine); oggLine=replace(oggLine,"%art",info.artist); oggLine=replace(oggLine,"%tit",info.title); oggLine=replace(oggLine,"%alb",info.album); oggLine=replace(oggLine,"%com",info.comment); oggLine=replace(oggLine,"%gen",info.genre); //oggLine=replace(oggLine,"%time",pos); //oggLine=replace(oggLine,"%length",len); //oggLine=replace(oggLine,"%ver",waVers); oggLine=intReplace(oggLine,"%chan",info.mode); oggLine=replace(oggLine,"%cbr",cbr); oggLine=intReplace(oggLine,"%br",info.bitrate/1000);//br); oggLine=intReplace(oggLine,"%frq",info.freq); //oggLine=replace(oggLine,"%size",size); //oggLine=intReplace(oggLine,"%perc",perc); //oggLine=replace(oggLine,"%plTitle",title); oggLine=replace(oggLine,"%file",tTitle); hexchat_command(ph, oggLine); return HEXCHAT_EAT_ALL; } } } line=randomLine(titleTheme); line=replace(line,"%title", tTitle); hexchat_command(ph,line); return HEXCHAT_EAT_ALL; }