コード例 #1
0
void pat_init(void)
{
	u64 pat;
	bool boot_cpu = !boot_pat_state;

	if (!pat_enabled)
		return;

	if (!cpu_has_pat) {
		if (!boot_pat_state) {
			pat_disable("PAT not supported by CPU.");
			return;
		} else {
			
			printk(KERN_ERR "PAT enabled, "
			       "but not supported by secondary CPU\n");
			BUG();
		}
	}

	
	
	pat = PAT(0, WB) | PAT(1, WC) | PAT(2, UC_MINUS) | PAT(3, UC) |
	      PAT(4, WB) | PAT(5, WC) | PAT(6, UC_MINUS) | PAT(7, UC);

	
	if (!boot_pat_state)
		rdmsrl(MSR_IA32_CR_PAT, boot_pat_state);

	wrmsrl(MSR_IA32_CR_PAT, pat);

	if (boot_cpu)
		printk(KERN_INFO "x86 PAT enabled: cpu %d, old 0x%Lx, new 0x%Lx\n",
		       smp_processor_id(), boot_pat_state, pat);
}
コード例 #2
0
ファイル: sqrmat.c プロジェクト: LJWilliams/Neuroimaging
sqrmat * sm_add( sqrmat *A , sqrmat *B )
{
   sqrmat *C ; int n=A->n , i,j,k ; double *mat,*nat,*pat;
   INIT_SQRMAT(C,n) ;
   mat = A->mat ; nat = B->mat ; pat = C->mat ;
   for( i=0 ; i < n ; i++ ){
     for( j=0 ; j < n ; j++ ){
       PAT(i,j) = MAT(i,j) + NAT(i,j) ;
     }
   }
   return C ;
}
コード例 #3
0
ファイル: pat.c プロジェクト: mikuhatsune001/linux2.6.32
void pat_init(void)
{
	u64 pat;
	bool boot_cpu = !boot_pat_state;

	if (!pat_enabled)
		return;

	if (!cpu_has_pat) {
		if (!boot_pat_state) {
			pat_disable("PAT not supported by CPU.");
			return;
		} else {
			/*
			 * If this happens we are on a secondary CPU, but
			 * switched to PAT on the boot CPU. We have no way to
			 * undo PAT.
			 */
			printk(KERN_ERR "PAT enabled, "
			       "but not supported by secondary CPU\n");
			BUG();
		}
	}

	/* Set PWT to Write-Combining. All other bits stay the same */
	/*
	 * PTE encoding used in Linux:
	 *      PAT
	 *      |PCD
	 *      ||PWT
	 *      |||
	 *      000 WB		_PAGE_CACHE_WB
	 *      001 WC		_PAGE_CACHE_WC
	 *      010 UC-		_PAGE_CACHE_UC_MINUS
	 *      011 UC		_PAGE_CACHE_UC
	 * PAT bit unused
	 */
	pat = PAT(0, WB) | PAT(1, WC) | PAT(2, UC_MINUS) | PAT(3, UC) |
	      PAT(4, WB) | PAT(5, WC) | PAT(6, UC_MINUS) | PAT(7, UC);

	/* Boot CPU check */
	if (!boot_pat_state)
		rdmsrl(MSR_IA32_CR_PAT, boot_pat_state);

	wrmsrl(MSR_IA32_CR_PAT, pat);

	if (boot_cpu)
		printk(KERN_INFO "x86 PAT enabled: cpu %d, old 0x%Lx, new 0x%Lx\n",
		       smp_processor_id(), boot_pat_state, pat);
}
コード例 #4
0
ファイル: r_mpeg_ts.cpp プロジェクト: davilla/mkvtoolnix
void
mpeg_ts_reader_c::read_headers() {
  try {
    size_t size_to_probe   = std::min(m_size, static_cast<uint64_t>(TS_PIDS_DETECT_SIZE));
    auto probe_buffer      = memory_c::alloc(size_to_probe);

    m_detected_packet_size = detect_packet_size(m_in.get(), size_to_probe);
    m_in->setFilePointer(0);

    mxverb(3, boost::format("mpeg_ts: Starting to build PID list. (packet size: %1%)\n") % m_detected_packet_size);

    mpeg_ts_track_ptr PAT(new mpeg_ts_track_c(*this));
    PAT->type = PAT_TYPE;
    tracks.push_back(PAT);

    unsigned char buf[TS_MAX_PACKET_SIZE]; // maximum TS packet size + 1

    bool done = m_in->eof();
    while (!done) {
      if (m_in->read(buf, m_detected_packet_size) != static_cast<unsigned int>(m_detected_packet_size))
        break;

      if (buf[0] != 0x47) {
        if (resync(m_in->getFilePointer() - m_detected_packet_size))
          continue;
        break;
      }

      parse_packet(buf);
      done  = PAT_found && PMT_found && (0 == es_to_process);
      done |= m_in->eof() || (m_in->getFilePointer() >= TS_PIDS_DETECT_SIZE);
    }
  } catch (...) {
  }
  mxverb(3, boost::format("mpeg_ts: Detection done on %1% bytes\n") % m_in->getFilePointer());

  m_in->setFilePointer(0, seek_beginning); // rewind file for later remux

  for (auto &track : tracks) {
    track->pes_payload->remove(track->pes_payload->get_size());
    track->processed        = false;
    track->data_ready       = false;
    track->pes_payload_size = 0;
    // track->timecode_offset = -1;
  }

  parse_clip_info_file();
  process_chapter_entries();

  show_demuxer_info();
}
コード例 #5
0
ファイル: sqrmat.c プロジェクト: LJWilliams/Neuroimaging
sqrmat * sm_mult( sqrmat *A , sqrmat *B )
{
   sqrmat *C ; int n=A->n , i,j,k ; double *mat,*nat,*pat , sum ;
   INIT_SQRMAT(C,n) ;
   mat = A->mat ; nat = B->mat ; pat = C->mat ;
   for( i=0 ; i < n ; i++ ){
     for( j=0 ; j < n ; j++ ){
       sum = 0.0 ;
       for( k=0 ; k < n ; k++ ) sum += MAT(i,k)*NAT(k,j) ;
       PAT(i,j) = sum ;
     }
   }
   return C ;
}
コード例 #6
0
ファイル: cona.cpp プロジェクト: treblewinner/FB-Alpha
// Read in the config file for the whole application
int ConfigAppLoad()
{
	TCHAR szConfig[MAX_PATH];
	TCHAR szLine[1024];
	FILE* h;
	
#ifdef _UNICODE
	setlocale(LC_ALL, "");
#endif

	CreateConfigName(szConfig);

	if ((h = _tfopen(szConfig, _T("rt"))) == NULL) {
		return 1;
	}

	// Go through each line of the config file
	while (_fgetts(szLine, sizeof(szLine), h)) {
		int nLen = _tcslen(szLine);

		// Get rid of the linefeed at the end
		if (szLine[nLen - 1] == 10) {
			szLine[nLen - 1] = 0;
			nLen--;
		}

#define VAR(x) { TCHAR* szValue = LabelCheck(szLine,_T(#x));			\
  if (szValue) x = _tcstol(szValue, NULL, 0); }
#define VAR64(x) { TCHAR* szValue = LabelCheck(szLine,_T(#x));			\
  if (szValue) x = (long long)_tcstod(szValue, NULL); }
#define FLT(x) { TCHAR* szValue = LabelCheck(szLine,_T(#x));			\
  if (szValue) x = _tcstod(szValue, NULL); }
#define STR(x) { TCHAR* szValue = LabelCheck(szLine,_T(#x) _T(" "));	\
  if (szValue) _tcscpy(x,szValue); }
#define PAT(x) { TCHAR* szValue = LabelCheck(szLine,_T(#x) _T(" "));	\
	if (szValue) { _tcscpy(x, szValue); UpdatePath(x); } }
#define DRV(x) { TCHAR* szValue = LabelCheck(szLine,_T(#x) _T(" "));	\
  if (szValue) x = NameToDriver(szValue); }

		VAR(nIniVersion);

		// Emulation
		VAR(bBurnUseASMCPUEmulation);

		// Video
		VAR(nVidDepth); VAR(nVidRefresh);
		VAR(nVidRotationAdjust);

		// horizontal oriented
		VAR(nVidHorWidth); VAR(nVidHorHeight);
		VAR(bVidArcaderesHor);
		VAR(VidPreset[0].nWidth); VAR(VidPreset[0].nHeight);
		VAR(VidPreset[1].nWidth); VAR(VidPreset[1].nHeight);
		VAR(VidPreset[2].nWidth); VAR(VidPreset[2].nHeight);
		VAR(VidPreset[3].nWidth); VAR(VidPreset[3].nHeight);
		VAR(nScreenSizeHor);

		// vertical oriented
		VAR(nVidVerWidth); VAR(nVidVerHeight);
		VAR(bVidArcaderesVer);
		VAR(VidPresetVer[0].nWidth); VAR(VidPresetVer[0].nHeight);
		VAR(VidPresetVer[1].nWidth); VAR(VidPresetVer[1].nHeight);
		VAR(VidPresetVer[2].nWidth); VAR(VidPresetVer[2].nHeight);
		VAR(VidPresetVer[3].nWidth); VAR(VidPresetVer[3].nHeight);
		VAR(nScreenSizeVer);

		VAR(nWindowSize);
		VAR(nWindowPosX); VAR(nWindowPosY);
		VAR(bDoGamma);
		VAR(bVidUseHardwareGamma);
		VAR(bHardwareGammaOnly);
		FLT(nGamma);
		VAR(bVidFullStretch);
		VAR(bVidCorrectAspect);
		
		VAR(bVidAutoSwitchFull);

		VAR(bVidTripleBuffer);
		VAR(bVidVSync);
		VAR(bVidDWMCore);

		VAR(bVidScanlines);
		VAR(nVidScanIntensity);
		VAR(bMonitorAutoCheck);
		VAR(nVidScrnAspectX);
		VAR(nVidScrnAspectY);
		VAR(bForce60Hz);
		VAR(bAlwaysDrawFrames);

		VAR(nVidSelect);
		VAR(nVidBlitterOpt[0]);
		VAR64(nVidBlitterOpt[1]);
		VAR(nVidBlitterOpt[2]);
		VAR(nVidBlitterOpt[3]);
		VAR(nVidBlitterOpt[4]);

		// DirectDraw blitter
		VAR(bVidScanHalf);

		// Direct3D blitter
		VAR(bVidBilinear);
		VAR(bVidScanDelay);
		VAR(bVidScanRotate);
		VAR(bVidScanBilinear);
		VAR(nVidFeedbackIntensity);
		VAR(nVidFeedbackOverSaturation);
		FLT(fVidScreenAngle);
		FLT(fVidScreenCurvature);
		VAR(bVidForce16bit);
		VAR(nVidTransferMethod);

		// DirectX Graphics blitter
		FLT(dVidCubicB);
		FLT(dVidCubicC);
		
		// DirectX Graphics 9 Alt blitter
		VAR(bVidDX9Bilinear);
		VAR(bVidHardwareVertex);
		VAR(bVidMotionBlur);

		// Sound
		VAR(nAudSelect);
		VAR(nAudSegCount);
		VAR(nInterpolation);
		VAR(nFMInterpolation);
		VAR(nAudSampleRate[0]);
		VAR(nAudDSPModule[0]);
		VAR(nAudSampleRate[1]);
		VAR(nAudDSPModule[1]);

		// Other
		STR(szLocalisationTemplate);

		VAR(nVidSDisplayStatus);
		VAR(nMinChatFontSize);
		VAR(nMaxChatFontSize);

		VAR(bModelessMenu);

		VAR(nSplashTime);

		VAR(bDrvSaveAll);
		VAR(nAppThreadPriority);
		VAR(bAlwaysProcessKeyboardInput);
		VAR(bAutoPause);
		VAR(bSaveInputs);
		
		VAR(nCDEmuSelect);
		PAT(CDEmuImage);

		VAR(nLoadMenuShowX);
		VAR(nLoadMenuBoardTypeFilter);
		VAR(nLoadMenuGenreFilter);
		VAR(nLoadMenuFamilyFilter);

		STR(szAppRomPaths[0]);
		STR(szAppRomPaths[1]);
		STR(szAppRomPaths[2]);
		STR(szAppRomPaths[3]);
		STR(szAppRomPaths[4]);
		STR(szAppRomPaths[5]);
		STR(szAppRomPaths[6]);
		STR(szAppRomPaths[7]);
		
		STR(szNeoCDGamesDir);
		
		STR(szAppPreviewsPath);
		STR(szAppTitlesPath);
		STR(szAppCheatsPath);
		STR(szAppHiscorePath);
		STR(szAppSamplesPath);
		STR(szAppIpsPath);
		STR(szNeoCDCoverDir);

		VAR(bNoChangeNumLock);
		
		VAR(EnableHiscores);
		
		VAR(nIpsSelectedLanguage);
		
		STR(szPrevGames[0]);
		STR(szPrevGames[1]);
		STR(szPrevGames[2]);
		STR(szPrevGames[3]);
		STR(szPrevGames[4]);
		STR(szPrevGames[5]);
		STR(szPrevGames[6]);
		STR(szPrevGames[7]);
		STR(szPrevGames[8]);
		STR(szPrevGames[9]);
		
		// MVS cartridges
		DRV(nBurnDrvSelect[0]);
		DRV(nBurnDrvSelect[1]);
		DRV(nBurnDrvSelect[2]);
		DRV(nBurnDrvSelect[3]);
		DRV(nBurnDrvSelect[4]);
		DRV(nBurnDrvSelect[5]);
		
		VAR(bNeoCDListScanSub);
		VAR(bNeoCDListScanOnlyISO);

		// Default Controls
		VAR(nPlayerDefaultControls[0]);
		STR(szPlayerDefaultIni[0]);
		VAR(nPlayerDefaultControls[1]);
		STR(szPlayerDefaultIni[1]);
		VAR(nPlayerDefaultControls[2]);
		STR(szPlayerDefaultIni[2]);
		VAR(nPlayerDefaultControls[3]);
		STR(szPlayerDefaultIni[3]);

#undef DRV
#undef PAT
#undef STR
#undef FLT
#undef VAR
#undef VAR64
	}

	fclose(h);
	return 0;
}
コード例 #7
0
void CTsTimestampShifter::Reset()
{
    m_pat = PAT();
}
コード例 #8
0
ファイル: main.c プロジェクト: ZtuX/zPAT
int main(){
    char * razonamiento = NULL;
    //PILA DONDE SE ALMACENARÁN LAS OPERACIONES A RESOLVER
    pNode primero = NULL, ultimo=NULL;
    int vFlag = 1; //Bandera que verifica si un razonamiento es valido o no
    int validez, invalidos=0, validos=0, total=0, Bool=1;
    int cuenta=0; //
    int verific=0, z=0, contadorValidos=0; //Funciona como bandera para verificar
    char * razonamientoEnCola; //Variable que saca un razonamiento de la cola
    char ** rCola; //Mostrara el razonamiento que esta en la cola
    char * rInvalido = NULL, **rInvalidoAux=NULL; //Para mostrar el ultimo razonamiento invalido

    //VARIABLE QUE SEPARAMOS EN ANTECEDENTE Y CONSECUENTE EL RAZONAMIENTO AUXILIAR PARA
    //MOSTRARLO EN PANTALLA AL FINAL
    char ** rAux;
    char ** rAux2;
    char ** comas; //Contendra todos los razonamientos separados con comas
    //Variables para la verificacion de la cadena:
    char * aParentesis=NULL;
    int parentesisValidos=0, cadenaValidaA=0, cadenaValidaB=0;

    printf("==================================================\n");
    printf("\tPrueba Automatica de Teoremas (PAT)\n");
    printf("==================================================\n");
    simbologia();
    printf("Para mostrar la ayuda escriba el comando \"a\" o \"ayuda\"\n");
    printf("\nIntroduce el razonamiento a verificar:\n");

    while(Bool==1){
        //MENU
        consola(cuenta);
        //INGRESAR LA CADENA
        razonamiento = readString();
        rAux = split(razonamiento,"="); //Para verificar
        rAux2 = split(razonamiento,"=");//Para mostrar
        //Si es un comando
        if(esComando(razonamiento)==1){
            if(strncmp("s",razonamiento,1)==0 || strncmp("salir",razonamiento,5)==0){
                //printf("[-] Saliendo del programa\n");
                Bool = 0;
            }
            else if(strncmp("a",razonamiento,1)==0 || strncmp("ayuda",razonamiento,5)==0){
                mostrarAyuda();
            }
            else if(strncmp("i",razonamiento,1)==0 || strncmp("invalido",razonamiento,8)==0){
                if(rInvalido!=NULL){
                    rInvalidoAux = split(rInvalido,"=");
                    printf("[+] Ultimo razonamiento invalido\n");
                    mostrarRazonamiento(rInvalidoAux[0],rInvalidoAux[1]);
                }else{
                    printf("[!] No existe algun razonamiento invalido\n");
                }
            }
            else if(strncmp("l",razonamiento,1)==0 || strncmp("limpiar",razonamiento,7)==0){
                system("clear");
            }
            else if(strncmp("v",razonamiento,1)==0 || strncmp("version",razonamiento,7)==0){
                version();
 	    }
        }
        else if(stringArraySize(rAux)<2){
                printf("[Error] Falta el operador '=>'\n");
        }else if (stringArraySize(rAux)>2){
            printf("[Error] El operador '=>' encontrado mas de una vez\n");
        }
        else{
            //Eliminar espacios en blanco de la expresión
            quitarEspaciosBlanco(razonamiento);
            //Pasamos a minusculas el razonamiento
            strlwr(razonamiento);

            //Verificamos la cadena (Parentesis)
            aParentesis = obtenerParentesis(razonamiento);
            parentesisValidos = verificaParentesis(aParentesis);
            if(parentesisValidos==0){
                printf("[Error] Razonamiento no valido: Parentesis no validos\n");
            }

            //Para verificar el antecedente y el consecuente
            strlwr(rAux[0]);
            strlwr(rAux[1]);
            quitarEspaciosBlanco(rAux[0]); //Quita espacios en blanco de antecedente
            quitarEspaciosBlanco(rAux[1]); //Quita espacios en blanco de consecuente

            comas = split(rAux[0],",");
            for(verific=0;verific<stringArraySize(comas);verific++){
                z = verificaCadena(comas[verific]);
                if(z==1) contadorValidos++;
            }
            if(contadorValidos==stringArraySize(comas)){
                //Si son iguales quiere decir queno hay errores
                cadenaValidaA=1;
            }else{
                printf("[Error] Razonamiento no valido: Error de sintaxis en el Antecedente\n");
                cadenaValidaA=0;
            }

            comas = split(rAux[1],",");
            contadorValidos =0;
            for(verific=0;verific<stringArraySize(comas);verific++){
                z = verificaCadena(comas[verific]);
                if(z==1) contadorValidos++;
            }
            if(contadorValidos==stringArraySize(comas)){
                //Si son iguales quiere decir queno hay errores
                cadenaValidaB=1;
            }else{
                printf("[Error] Razonamiento no valido: Error de sintaxis en el Consecuente\n");
                cadenaValidaB=0;
            }

            //Si no hay errores entonces hace el procedimiento
            if(parentesisValidos==1 && cadenaValidaA==1 && cadenaValidaB==1){
                //AGREGAMOS A LA COLA EL RAZONAIENTO INGRESADO
                add(&primero,&ultimo,razonamiento);
                //LEEMOS EL RAZONAMIENTO INGRESADO DE LA COLA
                razonamientoEnCola = read(&primero,&ultimo);

                //MIENTRAS QUE EXISTAN RAZONAMIENTOS:
                do{
                    validez = PAT(razonamientoEnCola,&primero,&ultimo);
                    if(validez!=0){
                        //Mientras sea valido el razonamiento
                        razonamientoEnCola = read(&primero,&ultimo);
                        if(razonamientoEnCola!=NULL){
                            rCola = split(razonamientoEnCola,"=");
                            printf("\n[+] Analizando el siguiente razonamiento en espera: %s => %s \n",rCola[0],rCola[1]);
                        }
                        vFlag = 1;
                    }else{
                        //Si existe algun razonamiento invalido lo copiamos a rInvalido
                        rInvalido = (char*)calloc(strlen(razonamientoEnCola)+1,sizeof(char));
                        strncpy(rInvalido,razonamientoEnCola,strlen(razonamientoEnCola)+1);
                        vFlag = 0;
                        break;
                    }
                }while(razonamientoEnCola!=NULL);
                if (vFlag == 1){
                    printf("\n[VALIDO] El Razonamiento : %s => %s es valido\n\n",rAux2[0],rAux2[1]);
                    return 0;
                }else{
                    printf("\n[INVALIDO] El Razonamiento : %s => %s es invalido\n\n",rAux2[0],rAux2[1]);
                    return 0;
                }
                //VACIAMOS LA COLA
                primero=ultimo=NULL;
            }
        }
        cuenta++;
        verific=0, z=0, contadorValidos=0; //Resetamos las banderas
        parentesisValidos=0;
    }
    return 0;
}