Пример #1
0
/* Fill audio buffer */
void my_audio_callback(void *ud, void *stream, int len)
{
    JNIEnv *thread_env;
    JNIEnv ref_env;

    jarray *array;
    (*VM(global))->AttachCurrentThread(VM(global), &thread_env, NULL);

    /* here we need the original NewGlobalRef */
    if(global->use_dvm)
    {
        ref_env = &global->dalvik_copy_env;
    }
    else ref_env = *thread_env;

    array = (*thread_env)->NewShortArray(thread_env, len / 2);

    jobject *ref = ref_env->NewGlobalRef(thread_env, array);
    angrybirds_priv.native_mixdata(ENV(global), VM(global), audioHandle, ref, len);
    ref_env->DeleteGlobalRef(thread_env, ref);

    jshort *elements = (*thread_env)->GetShortArrayElements(thread_env, array, 0);
    memcpy(stream, elements, len);
    (*thread_env)->ReleaseShortArrayElements(thread_env, array, elements, JNI_ABORT);

    (*thread_env)->DeleteLocalRef(thread_env, array);

    (*VM(global))->DetachCurrentThread(VM(global));
}
Пример #2
0
static void mix_audio(void *user_data, void *stream, int len)
{
    struct SupportModule *self = (struct SupportModule *)user_data;

    JNIEnv *thread_env;
    JNIEnv ref_env;

    jarray *array;
    (*VM(global))->AttachCurrentThread(VM(global), &thread_env, NULL);

    /* here we need the original NewGlobalRef */
    if(global->use_dvm)
    {
        ref_env = &(global->dalvik_copy_env);
    }
    else ref_env = *thread_env;

    array = (*thread_env)->NewShortArray(thread_env, len / 2);

    jobject *ref = ref_env->NewGlobalRef(thread_env, array);
    petalsredux_priv.native_mix(ENV_M, GLOBAL_M, ref);
    ref_env->DeleteGlobalRef(thread_env, ref);

    jshort *elements = (*thread_env)->GetShortArrayElements(thread_env, array, 0);
    memcpy(stream, elements, len);
    (*thread_env)->ReleaseShortArrayElements(thread_env, array, elements, JNI_ABORT);

    (*thread_env)->DeleteLocalRef(thread_env, array);

    (*VM(global))->DetachCurrentThread(VM(global));
}
Пример #3
0
int traceV(int i, int j) {
	int a, b, c, d, Vij;
	if (j-i < TURN)  return INFINITY_;

	a = canHairpin(i,j)?eH(i, j):INFINITY_;
	b = canStack(i,j)?eS(i, j) + V(i + 1, j - 1):INFINITY_;
	c = canStack(i,j)?VBI(i,j):INFINITY_;
	d = canStack(i,j)?VM(i,j):INFINITY_;
	
	Vij = V(i,j);
	structure[i] = j;
	structure[j] = i;

	if (Vij == a ) { 
		if (print_energy_decompose == 1) fprintf(energy_decompose_outfile, "i %5d j %5d Hairpin   %12.2f\n", i, j, eH(i, j)/100.00);
		total_en += eH(i,j);
		return Vij;
	} else if (Vij == b) { 
		if (print_energy_decompose == 1) fprintf(energy_decompose_outfile, "i %5d j %5d Stack     %12.2f\n", i, j, eS(i, j)/100.00);
		total_en += eS(i,j);
		traceV(i + 1, j - 1);
		return Vij;
	} else if (Vij == c) { 
		if (print_energy_decompose == 1) fprintf(energy_decompose_outfile, "i %5d j %5d IntLoop  ", i, j);
		traceVBI(i, j);
		return Vij;
	} else if (Vij == d) { 
		int eVM = traceVM(i, j);
		if (print_energy_decompose ==1) fprintf(energy_decompose_outfile, "i %5d j %5d MultiLoop %12.2f\n", i, j, (Vij-eVM)/100.0);
		total_en += (Vij-eVM);
		return Vij;
	}

	return 0;
}
Пример #4
0
void CrearTabla::on_btnVisualizar_clicked()
{
    VisualizacionModo VM(gestor);
    VM.setModal(true);
    VM.exec();

    this->close();
}
Пример #5
0
/* Fill audio buffer */
void my_audio_callback(void *ud, Uint8 *stream, int len)
{
    struct dummy_array array;
    array.data = stream;
    array.length = len;
    array.element_size = 1;
    angrybirds_priv.native_mixdata(ENV(global), VM(global), audioHandle, &array, len);
}
Пример #6
0
int traceVM(int i, int j) {

	int done;
	int h;
	int A_temp;
	int eVM = 0;

	done = 0;
	int VMij = VM(i,j);

	for (h = i + 2; h <= j - 1 && !done; h++) {
		A_temp = WM(i+1,h-1) + WM(h,j - 1) + Ea + Eb + auPenalty(i, j);
		if (A_temp == VMij) { 
			done = 1;
			eVM += traceWM(i + 1, h - 1);
			eVM += traceWM(h, j - 1);
			break;
		}
	}

	if (check_base(i+1)) {
		for (h = i + 3; h <= j - 1 && !done; h++) {
			A_temp = WM(i + 2,h - 1) + WM(h,j - 1) + Ea + Eb + auPenalty(i,j) + Ed5(i,j,i + 1); 
			if (A_temp == VMij) {
				done = 1;
				eVM += traceWM(i + 2, h - 1);
				eVM += traceWM(h, j - 1);
				break;
			}
		}
	}

	if (check_base(j-1)) {
		for (h = i + 2; h <= j - 2 && !done; h++) { 
			A_temp = WM(i + 1,h - 1) + WM(h,j - 2) + Ea + Eb + auPenalty(i, j) + Ed3(i,j,j - 1);
			if (A_temp == VMij) {
				done = 1;
				eVM += traceWM(i + 1, h - 1);
				eVM += traceWM(h, j - 2);
				break;
			}
		}
	}

	if (check_base(i+1)&&check_base(j-1)) {
		for (h = i + 3; h <= j - 2 && !done; h++) { 
			A_temp = WM(i + 2,h - 1) + WM(h,j - 2) + Ea + Eb + auPenalty(i,j) + Ed5(i,j,i + 1) + Ed3(i,j,j - 1);
			if (A_temp == VMij) {
				done = 1;
				eVM += traceWM(i + 2, h - 1);
				eVM += traceWM(h, j - 2);
				break;
			}
		}
	}

	return eVM;
}
Пример #7
0
int traceVM(int i, int j) {
	int done = 0;
	int eVM = 0;

	if (g_unamode||g_mismatch) {
		if (VM(i,j) == WMPrime[i+1][j - 1] + Ea + Eb + auPenalty(i, j) ) {
			done = 1;
			eVM += traceWMPrime(i + 1, j - 1);
		} else if (VM(i,j) == WMPrime[i + 2][j - 1] + Ea + Eb + auPenalty(i,j) + Ed5(i,j,i + 1) + Ec && canSS(i+1) ) {
			done = 1;
			eVM += traceWMPrime(i + 2, j - 1);
		}
		else if ( VM(i,j) == WMPrime[i + 1][j - 2] + Ea + Eb + auPenalty(i, j) + Ed3(i,j,j - 1) + Ec && canSS(j-1)) {
			done = 1;
			eVM += traceWMPrime(i + 1, j - 2);
		}
		else if (V(i,j) == WMPrime[i + 2][j - 2] + Ea + Eb + auPenalty(i,j) + Estackm(i,j) + 2*Ec && canSS(i+1) && canSS(j-1) ) {
			done = 1;
			eVM += traceWMPrime(i + 2, j - 2);
		}
	} else if (g_dangles == 2) {
		if (V(i,j) ==  WMPrime[i + 1][j - 1] + Ea + Eb + auPenalty(i,j) + Ed5(i,j,i + 1) + Ed3(i,j,j - 1) && canSS(i+1) && canSS(j-1) ) {
			done = 1;
			eVM += traceWMPrime(i + 1, j - 1);
		}
	}	else if (g_dangles == 0) {
		if (VM(i,j) == WMPrime[i+1][j - 1] + Ea + Eb + auPenalty(i, j) ) {
			done = 1;
			eVM += traceWMPrime(i + 1, j - 1);
		}
	} else {
		if (VM(i,j) == WMPrime[i+1][j - 1] + Ea + Eb + auPenalty(i, j) ) {
			done = 1;
			eVM += traceWMPrime(i + 1, j - 1);
		} else if (VM(i,j) == WMPrime[i + 2][j - 1] + Ea + Eb + auPenalty(i,j) + Ed5(i,j,i + 1) + Ec && canSS(i+1) ) {
			done = 1;
			eVM += traceWMPrime(i + 2, j - 1);
		}
		else if ( VM(i,j) == WMPrime[i + 1][j - 2] + Ea + Eb + auPenalty(i, j) + Ed3(i,j,j - 1) + Ec && canSS(j-1)) {
			done = 1;
			eVM += traceWMPrime(i + 1, j - 2);
		} else if (V(i,j) ==  WMPrime[i + 2][j - 2] + Ea + Eb + auPenalty(i,j) + Ed5(i,j,i + 1) + Ed3(i,j,j - 1) + 2*Ec && canSS(i+1) && canSS(j-1) ) {
			done = 1;
			eVM += traceWMPrime(i + 2, j - 2);
		}
	}
	if(!done) { 
		fprintf(stderr, "ERROR: VM(%d,%d) could not be traced\n", i,j);
	}

	return eVM;
}
Пример #8
0
void LSLuaState::initializeLuaTypes(const utArray<Type *>& types)
{
    for (UTsize i = 0; i < types.size(); i++)
    {
        types[i]->cache();
    }

    // initialize all classes
    for (UTsize i = 0; i < types.size(); i++)
    {
        initializeClass(types[i]);
    }

    // run static initializers now that all classes have been initialized
    for (UTsize i = 0; i < types.size(); i++)
    {
        lsr_classinitializestatic(VM(), types[i]);
    }
}
Пример #9
0
int traceV(int i, int j) {
	int a, b, c, d, Vij;
	if (j-i < TURN)  return INFINITY_;

	a = eH(i, j);
	b = eS(i, j) + V(i + 1, j - 1);
	if (eS(i, j) == 0) b = INFINITY_;
	c = VBI(i,j);
	d = VM(i,j);
	
	Vij = MIN(MIN(a, b), MIN(c, d));
	
	if (Vij == a && Vij != b && Vij != c && Vij != d) { 
		if (verbose == 1) 
			printf("i %5d j %5d Hairpin   %12.2f\n", i, j, eH(i, j)/100.00);
		total_en += eH(i,j);
		return Vij;
	} else if (Vij == b) { 
		if (verbose == 1) 
			printf("i %5d j %5d Stack     %12.2f\n", i, j, eS(i, j)/100.00);
		total_en += eS(i,j);
		structure[i + 1] = j - 1;
		structure[j - 1] = i + 1;
		traceV(i + 1, j - 1);
		return Vij;
	} else if (Vij == c) { 
		if (verbose == 1) 
			printf("i %5d j %5d IntLoop  ", i, j);
		traceVBI(i, j);
		return Vij;
	} else if (Vij == d && Vij != a && Vij != b && Vij != c) { 
		int eVM = traceVM(i, j);
		if (verbose ==1) 
			printf("i %5d j %5d MultiLoop %12.2f\n", i, j, (Vij-eVM)/100.0);
		total_en += (Vij-eVM);
		return Vij;
	} 
	return 0;
}
Пример #10
0
void main(int argc, char *argv[] ){
	int count;
	for(count=1;count<argc;count++){
		if(strcmp(argv[count],"-t")==0){
			
			t=1;
		}
		else if(strcmp(argv[count],"-s")==0){
			s=1;
		}else if(strcmp(argv[count],"-m")==0){
			m=1;
		}else if(strcmp(argv[count],"-a")==0){
			a=1;
		}else if(strcmp(argv[count],"-v")==0){
			v=1;
		}	
		else{
			printf("%s invalid command.\n",argv[count]);
		}		
				
		
				
			
		
		
	}
	
	scanner();
	parser();
	VM();
	
	
	
	
	display();
	
}
Пример #11
0
/* Fill audio buffer */
void my_audio_callback(void *ud, Uint8 *stream, int len)
{
    angrybirds_priv.native_mixdata(ENV(global), VM(global), audioHandle, stream, len);
}
Пример #12
0
void VrmlNodePlaneSensor::activate( double timeStamp,
				    bool isActive,
				    double *p )
{
  // Become active
  if ( isActive && ! d_isActive.get() )
    {
      d_isActive.set(isActive);

      float V[3] = { (float)p[0], (float)p[1], (float)p[2] };
      double M[4][4];
      inverseTransform( M );
      VM( V, M, V );
      d_activationPoint.set( V[0], V[1], V[2] );
#if 0
      theSystem->warn(" planesensor: activate at (%g %g %g)\n",
		      p[0],p[1],p[2]);
      theSystem->warn(" planesensor: local coord (%g %g %g)\n",
		      V[0],V[1],V[2]);
#endif
      eventOut( timeStamp, "isActive", d_isActive );
    }

  // Become inactive
  else if ( ! isActive && d_isActive.get() )
    {
#if 0
      theSystem->warn(" planesensor: deactivate\n");
#endif
      d_isActive.set(isActive);
      eventOut( timeStamp, "isActive", d_isActive );

      // auto offset
      if ( d_autoOffset.get() )
	{
	  d_offset = d_translation;
	  eventOut( timeStamp, "offset_changed", d_offset );
	}
    }

  // Tracking
  else if ( isActive )
    {
      float V[3] = { (float)p[0], (float)p[1], (float)p[2] };
      double M[4][4];
      inverseTransform( M );
      VM( V, M, V );
#if 0
      theSystem->warn(" planesensor: track at (%g %g %g)\n",
		      p[0],p[1],p[2]);
      
      theSystem->warn(" planesensor: local cd (%g %g %g)\n",
		      V[0],V[1],V[2]);
#endif
      d_trackPoint.set( V[0], V[1], V[2] );
      eventOut( timeStamp, "trackPoint_changed", d_trackPoint );

      float t[3];
      t[0] = V[0] - d_activationPoint.x() + d_offset.x();
      t[1] = V[1] - d_activationPoint.y() + d_offset.y();
      t[2] = 0.0;

      if ( d_minPosition.x() == d_maxPosition.x() )
	t[0] = d_minPosition.x();
      else if ( d_minPosition.x() < d_maxPosition.x() )
	{
	  if (t[0] < d_minPosition.x())
	    t[0] = d_minPosition.x();
	  else if (t[0] > d_maxPosition.x())
	    t[0] = d_maxPosition.x();
	}

      if ( d_minPosition.y() == d_maxPosition.y() )
	t[1] = d_minPosition.y();
      else if ( d_minPosition.y() < d_maxPosition.y() )
	{
	  if (t[1] < d_minPosition.y())
	    t[1] = d_minPosition.y();
	  else if (t[1] > d_maxPosition.y())
	    t[1] = d_maxPosition.y();
	}

      d_translation.set( t[0], t[1], t[2] );
      eventOut( timeStamp, "translation_changed", d_translation );
    }
}
Пример #13
0
bool cmp (pt a, pt b)
{
	return (VM (a, b) > 0 || (VM(a, b) == 0 && a.x*a.x+a.y*a.y < b.x*b.x+b.y*b.y));
}
Пример #14
0
/**
 * Description not yet available.
 * \param
 */
double fcomp1(dvector x,dvector d,int samplesize,int n,dvector & g,
  dmatrix& M)
{
  dmatrix VM(1,samplesize,1,n);
  dmatrix C(1,samplesize,1,samplesize);
  dmatrix VM0(1,samplesize,1,n);
  dvector N(1,samplesize);
  dmatrix dfVM(1,samplesize,1,n);
  dmatrix dfVM0(1,samplesize,1,n);
  dvector dfN(1,samplesize);
  dfVM.initialize();
  dfVM0.initialize();
  dfN.initialize();

  double f=0.0;
  int ii=0;
  VM0(1)=M(1);
  for (int i=2;i<=samplesize;i++)
  {
    for (int j=1;j<=n;j++)
    {
      VM0(i,j)=x(++ii);
    }
  }
  for (int i=1;i<=samplesize;i++)
  {
    N(i)=norm(VM0(i));
    VM(i)=VM0(i)*(d(i)/N(i));
  }
  for (int i=1;i<=samplesize;i++)
  {
    for (ii=i+1;ii<=samplesize;ii++)
    {
      //C(i,ii)=1.0/(0.01+norm2(VM(i)-VM(ii)));
      //f+=C(i,ii);
      C(i,ii)=norm2(VM(i)-VM(ii));
      f-=C(i,ii);
      //f+=1.0/(0.01+norm2(VM(i)-VM(ii)));
    }
    f+=100.0*square(log(N(i)));
  }
  for (int i=1;i<=samplesize;i++)
  {
    //f+=100.0*square(log(N(i)));
    dfN(i)+=200*log(N(i))/N(i);
    for (ii=i+1;ii<=samplesize;ii++)
    {
      //f+=1.0/(0.01+norm2(VM(i)-VM(ii)));
      //double tmp=-1.0/square(0.01+norm2(VM(i)-VM(ii)));
      //double tmp=-square(C(i,ii));
      dvector vtmp=-2.0*(VM(i)-VM(ii));
      dfVM(i)+=vtmp;
      dfVM(ii)-=vtmp;
    }
  }
  for (int i=1;i<=samplesize;i++)
  {
    //VM(i)=VM0(i)*(d(i)/N(i));
    dfVM0(i)=dfVM(i)*d(i)/N(i);
    dfN(i)-=(dfVM(i)*VM0(i))*d(i)/square(N(i));

    //N(i)=norm(VM0(i));
    dfVM0(i)+=dfN(i)/N(i)*VM0(i);
  }
  ii=0;
  for (int i=2;i<=samplesize;i++)
  {
    for (int j=1;j<=n;j++)
    {
      //VM0(i,j)=vx(++ii);
      g(++ii)=dfVM0(i,j);
    }
  }
  return f;
}
Пример #15
0
int main( int argc, char* argv[] )
{
    IOManagerType& IOManager(IOManagerType::Instance() );
    MemoryManagerType& MemoryManager(MemoryManagerType::Instance() );
    VarMapType& VM(VarMapType::Instance() );
    
    po::options_description Options( "Global Options" );
    Options.add_options() ( "help", "Produces this Help" )
    ( "input-file,i", po::value<std::string>(), "Input CDAT File" )
    ( "output-file,o", po::value<std::string>(), "Output TXT File" );
            
    po::positional_options_description p;    
    p.add("input-file", 1);
    p.add("output-file", 1);

    po::variables_map VMap;

    po::store( po::command_line_parser( argc, argv ).options( Options ).positional(p).run(), VMap );

    po::notify( VMap );

    if ( VMap.count( "help" ) )
    {
        std::cout << Options << std::endl;
        exit( -1 );
    }

    if ( !VMap.count( "input-file" ) )
    {
        std::cout << std::endl << "Input File not Specified" << std::endl << std::endl;
        std::cout << Options << std::endl;
        exit( -1 );
    }


    if ( !VMap.count( "output-file" ) )
    {
        std::cout << std::endl << "Output File has to be specified" << std::endl << std::endl;
        std::cout << Options << std::endl;
        exit( -1 );
    }
        
    // **
    // ** Start Reading in Data
    // **

    std::string InputFileName( VMap[ "input-file" ].as<std::string>() );
    std::vector<int> ATTRIBUTES = IOManager.LoadCDAT(InputFileName);

    matrix_reference Data(MemoryManager.Data);

    // **
    // ** Start Writing
    // **
    
    std::fstream fout;

    fout.open( VMap[ "output-file" ].as<std::string>().c_str(), std::ios::out );

    if ( !fout ) {
    	std::cerr << "Error Writing " << VMap[ "output-file" ].as<std::string>().c_str() << "\n";
    }
        
    fout << "#version 3.6;\n";
    fout << "global_settings {  assumed_gamma 1.0 }\n";
    fout << "#default{ finish{ ambient 0.1 diffuse 0.9}}\n";
    fout << "#include \"colors.inc\"\n";
    fout << "camera {location <1.2 , 1.2 ,-0.7>\n";
    fout << "        look_at  <0.5 , 0.5 , 0.5>}\n";
    fout << "light_source{<1500,2500,-2500> color White}\n";
    
    for (size_t i = 0; i < Data.size1(); i++) {
        fout << "sphere{<"
                << Data(i, oosph::X)
                << "," << Data(i, oosph::Y)
                << "," << Data(i, oosph::Z)
                << ">, 0.005\n";
        fout << "   texture{\n";
        fout << "       pigment {color rgb<1,0.3,0>} \n";
        fout << "       } \n";
        fout << "} \n";
    }
    
    fout.close();

    std::cout << VMap[ "input-file" ].as<std::string>() << " -> " << VMap[ "output-file" ].as<std::string>() << "\n";
    
    exit( EXIT_SUCCESS );
}
Пример #16
0
extern const TText* VCardMaping(const TFieldType& type)
	{
	switch (type.iUid)
		{
	//case KUidContactFieldAddressValue: return _S("KUidContactFieldAddressValue");
	VM(KUidContactFieldAddressValue			);                
	VM(KUidContactFieldPostOfficeValue		);            
	VM(KUidContactFieldExtendedAddressValue	);       
	VM(KUidContactFieldLocalityValue		);            
	VM(KUidContactFieldRegionValue			);            
	VM(KUidContactFieldPostCodeValue		);            
	VM(KUidContactFieldCountryValue			);                

	VM(KUidContactFieldCompanyNameValue );                
	VM(KUidContactFieldCompanyNamePronunciationValue );
	VM(KUidContactFieldPhoneNumberValue );                
	VM(KUidContactFieldGivenNameValue   );                
	VM(KUidContactFieldFamilyNameValue  );                
	VM(KUidContactFieldGivenNamePronunciationValue );   
	VM(KUidContactFieldFamilyNamePronunciationValue );    

	VM(KUidContactFieldAdditionalNameValue);              
	VM(KUidContactFieldSuffixNameValue  );                
	VM(KUidContactFieldPrefixNameValue  );                
	VM(KUidContactFieldHiddenValue      );                
	VM(KUidContactFieldEMailValue       );                
	VM(KUidContactFieldMsgValue         );                
	VM(KUidContactFieldSmsValue         );                
	VM(KUidContactFieldFaxValue         );                

	VM(KUidContactFieldDefinedTextValue );                
	VM(KUidContactFieldNoteValue		);            
	VM(KUidContactFieldBirthdayValue	);            
	VM(KUidContactFieldUrlValue			);                
	VM(KUidContactFieldStorageInlineValue);            
	VM(KUidContactFieldTemplateLabelValue);            
	VM(KUidContactFieldPictureValue		);                
	VM(KUidContactFieldRingToneValue	);            
	VM(KUidContactFieldDTMFValue		);            
	VM(KUidContactsVoiceDialFieldValue	);            
	VM(KUidContactFieldNoneValue		);			
	VM(KUidContactFieldJobTitleValue	);            
	VM(KUidContactFieldICCSlotValue		);		
	VM(KUidContactFieldICCPhonebookValue);	
	VM(KUidContactFieldICCGroupValue	);		
	VM(KUidContactFieldIMAddressValue	);	
	VM(KUidContactFieldSecondNameValue	);	
	VM(KUidContactFieldSIPIDValue		);	

	VM(KIntContactFieldVCardMapWORK );                      
	VM(KIntContactFieldVCardMapHOME );                      
	VM(KIntContactFieldVCardMapMSG  );                      
	VM(KIntContactFieldVCardMapVOICE);                      
	VM(KIntContactFieldVCardMapFAX  );                      
	VM(KIntContactFieldVCardMapPREF );                      
	VM(KIntContactFieldVCardMapCELL );                      
	VM(KIntContactFieldVCardMapPAGER);                      
	VM(KIntContactFieldVCardMapBBS  );                      
	VM(KIntContactFieldVCardMapMODEM);                      
	VM(KIntContactFieldVCardMapCAR  );                      
	VM(KIntContactFieldVCardMapISDN );                      
	VM(KIntContactFieldVCardMapVIDEO);                      
	VM(KIntContactFieldVCardMapDOM  );                      

	VM(KIntContactFieldVCardMapADR          );          
	VM(KIntContactFieldVCardMapPOSTOFFICE	);          
	VM(KIntContactFieldVCardMapEXTENDEDADR	);              
	VM(KIntContactFieldVCardMapLOCALITY		);              
	VM(KIntContactFieldVCardMapREGION		);          
	VM(KIntContactFieldVCardMapPOSTCODE		);               
	VM(KIntContactFieldVCardMapCOUNTRY		);           
	VM(KIntContactFieldVCardMapAGENT        );               
	VM(KIntContactFieldVCardMapBDAY         );               
	VM(KIntContactFieldVCardMapEMAILINTERNET);               
	VM(KIntContactFieldVCardMapGEO          );               
	VM(KIntContactFieldVCardMapLABEL        );               
	VM(KIntContactFieldVCardMapLOGO         );               
	VM(KIntContactFieldVCardMapMAILER       );               
	VM(KIntContactFieldVCardMapNOTE         );               
	VM(KIntContactFieldVCardMapORG          );               
	VM(KIntContactFieldVCardMapORGPronunciation );           
	VM(KIntContactFieldVCardMapPHOTO        );               
	VM(KIntContactFieldVCardMapROLE         );               
	VM(KIntContactFieldVCardMapSOUND        );               
	VM(KIntContactFieldVCardMapTEL          );               
	VM(KIntContactFieldVCardMapTELFAX       );               
	VM(KIntContactFieldVCardMapTITLE        );               
	VM(KIntContactFieldVCardMapURL          );               
	VM(KIntContactFieldVCardMapUnusedN      );               
	VM(KIntContactFieldVCardMapUnusedFN     );               
	VM(KIntContactFieldVCardMapNotRequired  );               
	VM(KIntContactFieldVCardMapUnknownXDash );               
	VM(KIntContactFieldVCardMapUnknown      );               
	VM(KIntContactFieldVCardMapUID          );               
	VM(KIntContactFieldVCardMapINTL         );               
	VM(KIntContactFieldVCardMapPOSTAL       );               
	VM(KIntContactFieldVCardMapPARCEL       );               
	VM(KIntContactFieldVCardMapGIF		    );              
	VM(KIntContactFieldVCardMapCGM          );               
	VM(KIntContactFieldVCardMapWMF          );               
	VM(KIntContactFieldVCardMapBMP          );               
	VM(KIntContactFieldVCardMapMET          );               
	VM(KIntContactFieldVCardMapPMB          );               
	VM(KIntContactFieldVCardMapDIB          );               
	VM(KIntContactFieldVCardMapPICT         );               
	VM(KIntContactFieldVCardMapTIFF         );               
	VM(KIntContactFieldVCardMapPDF          );               
	VM(KIntContactFieldVCardMapPS           );               
	VM(KIntContactFieldVCardMapJPEG         );               
	VM(KIntContactFieldVCardMapMPEG         );               
	VM(KIntContactFieldVCardMapMPEG2        );               
	VM(KIntContactFieldVCardMapAVI          );               
	VM(KIntContactFieldVCardMapQTIME        );               
	VM(KIntContactFieldVCardMapTZ			);           
	VM(KIntContactFieldVCardMapKEY			);           

	VM(KIntContactFieldVCardMapX509			);               
	VM(KIntContactFieldVCardMapPGP			);           
	VM(KIntContactFieldVCardMapSMIME		);           
	VM(KIntContactFieldVCardMapWV			);		
	VM(KIntContactFieldVCardMapSECONDNAME	);	
	VM(KIntContactFieldVCardMapSIPID		);		
	VM(KIntContactFieldVCardMapPOC			);	
	VM(KIntContactFieldVCardMapSWIS			);	
	VM(KIntContactFieldVCardMapVOIP			);	
	default: return _S("Unknown");
		};
	};
Пример #17
0
int calculate(int len, int nThreads) { 
	int b, i, j;
#ifdef _OPENMP
	if (nThreads>0) omp_set_num_threads(nThreads);
#endif
#ifdef _OPENMP
#pragma omp parallel
#pragma omp master
	fprintf(stdout,"Thread count: %3d \n",omp_get_num_threads());
#endif


	for (b = TURN+1; b <= len-1; b++) {
#ifdef _OPENMP
#pragma omp parallel for private (i,j) schedule(guided)
#endif
		for (i = 1; i <= len - b; i++) {
			j = i + b;
			int flag = 0, newWM = INFINITY_; 
			if (canPair(RNA[i], RNA[j])) {
				flag = 1;
				int eh = canHairpin(i,j)?eH(i,j):INFINITY_; //hair pin
				int es = canStack(i,j)?eS(i,j)+getShapeEnergy(i)+getShapeEnergy(j)+V(i+1,j-1):INFINITY_; // stack
				if (j-i > 6) { // Internal Loop BEGIN
					int p=0, q=0;
					int VBIij = INFINITY_;
					for (p = i+1; p <= MIN(j-2-TURN,i+MAXLOOP+1) ; p++) {
						int minq = j-i+p-MAXLOOP-2;
						if (minq < p+1+TURN) minq = p+1+TURN;
						int maxq = (p==i+1)?(j-2):(j-1);
						for (q = minq; q <= maxq; q++) {
							if (!canPair(RNA[p], RNA[q])) continue;
							if (!canILoop(i,j,p,q)) continue;
							VBIij = MIN(eL(i, j, p, q) + V(p,q), VBIij);
						}
					}
					VBI(i,j) = VBIij;
					V(i,j) = V(i,j) + getShapeEnergy(i) + getShapeEnergy(j);

				} // Internal Loop END
				if (j-i > 10) { // Multi Loop BEGIN
					int h;
					int VMij, VMijd, VMidj, VMidjd;
					VMij = VMijd = VMidj = VMidjd = INFINITY_;
					for (h = i+TURN+1; h <= j-1-TURN; h++) { 
						VMij = MIN(VMij, WMU(i+1,h-1) + WML(h,j-1)); 
						VMidj = MIN(VMidj, WMU(i+2,h-1) + WML(h,j-1)); 
						VMijd = MIN(VMijd, WMU(i+1,h-1) + WML(h,j-2)); 
						VMidjd = MIN(VMidjd, WMU(i+2,h-1) + WML(h,j-2)); 
					}
					int d3 = canSS(j-1)?Ed3(i,j,j-1):INFINITY_;
					int d5 = canSS(i+1)?Ed5(i,j,i+1):INFINITY_;
					VMij = MIN(VMij, (VMidj + d5 +Ec)) ;
					VMij = MIN(VMij, (VMijd + d3 +Ec));
					VMij = MIN(VMij, (VMidjd + d5 + d3+ 2*Ec));
					VMij = VMij + Ea + Eb + auPenalty(i,j);
					VM(i,j) = canStack(i,j)?VMij:INFINITY_;
				} // Multi Loop END
				V(i,j) = MIN4(eh,es,VBI(i,j),VM(i,j));
			}
			else V(i,j) = INFINITY_;
			if (j-i > 4) { // WM BEGIN
				int h; 
				for (h = i+TURN+1 ; h <= j-TURN-1; h++) {
					//ZS: This sum corresponds to when i,j are NOT paired with each other.
					//So we need to make sure only terms where i,j aren't pairing are considered. 
					newWM = (!forcePair(i,j))?MIN(newWM, WMU(i,h-1) + WML(h,j)):newWM;
				}
				newWM = MIN(V(i,j) + auPenalty(i,j) + Eb, newWM); 
				newWM = canSS(i)?MIN(V(i+1,j) + Ed3(j,i+1,i) + auPenalty(i+1,j) + Eb + Ec, newWM):newWM; //i dangle
				newWM = canSS(j)?MIN(V(i,j-1) + Ed5(j-1,i,j) + auPenalty(i,j-1) + Eb + Ec, newWM):newWM;  //j dangle
				newWM = (canSS(i)&&canSS(j))?MIN(V(i+1,j-1) + Ed3(j-1,i+1,i) + Ed5(j-1,i+1,j) + auPenalty(i+1,j-1) + Eb + 2*Ec, newWM):newWM; //i,j dangle
				newWM = canSS(i)?MIN(WMU(i+1,j) + Ec, newWM):newWM; //i dangle
				newWM = canSS(j)?MIN(WML(i,j-1) + Ec, newWM):newWM; //j dangle
				WMU(i,j) = WML(i,j) = newWM;
			} // WM END
		}
	}
	for (j = TURN+2; j <= len; j++) {
		int i, Wj, Widjd, Wijd, Widj, Wij, Wim1;
		Wj = INFINITY_;
		for (i = 1; i < j-TURN; i++) {
			Wij = Widjd = Wijd = Widj = INFINITY_;
			Wim1 = MIN(0, W[i-1]); 
			Wij = V(i, j) + auPenalty(i, j) + Wim1;
			Widjd = (canSS(i)&&canSS(j))?V(i+1,j-1) + auPenalty(i+1,j-1) + Ed3(j-1,i + 1,i) + Ed5(j-1,i+1,j) + Wim1:Widjd;
			Wijd = canSS(j)?V(i,j-1) + auPenalty(i,j-1) + Ed5(j-1,i,j) + Wim1:Wijd;
			Widj = canSS(i)?V(i+1, j) + auPenalty(i+1,j) + Ed3(j,i + 1,i) + Wim1:Widj;
			Wj = MIN(MIN4(Wij, Widjd, Wijd, Widj), Wj); 
		}
		W[j] = canSS(j)?MIN(Wj, W[j-1]):Wj;
	}
	return W[len];
}
bool SteamDataCrypto(BYTE * data, BYTE * outbuf, int size, CSteamID *steam_id)
{	VM("SteamDataCrypto");

	DWORD *keys;
	__asm
	{
		push eax
		mov eax, steam_id
		mov keys, eax
		pop eax
	}

	DWORD * cryptotable = (DWORD *)malloc(256*4+100);
	DWORD * seedtable = (DWORD *)kCrc32Table;
	DWORD seedkey = keys[0] ^ keys[1];
	BYTE last_rot = 0x13;

	for (int i=0; i<256; i++)
	{
		__asm
		{	push ecx
			mov cl, last_rot
			rol seedkey, cl
			pop ecx  }

		if (i%2==1)
			cryptotable[i] = seedtable[(i + (seedkey&0xFF)) & 0xFF] + seedkey ^ seedkey;
		else
			cryptotable[i] = seedtable[(i + (seedkey&0xFF)) & 0xFF] - seedkey ^ seedkey;
		last_rot = cryptotable[i] % 0xFF;
	}
	#ifdef DEBUGGING_ENABLED
	info("Using crypto table (seed keys: %08X %08X):", keys[0], keys[1]);
	//PrintBuffer((BYTE*)cryptotable, 256*4, 16);
	info("--------------");
	#endif

	if (size <= 256 * 4)
	{
		BYTE * byte_cryptotable = (BYTE *)cryptotable;

		for (int i=0; i<size; i++)
		{
			outbuf[i] = data[i] ^ byte_cryptotable[i];
		}
	}
	else
	{
		int block = 0;
		DWORD * d_data = (DWORD *)data;
		DWORD * d_outbuf = (DWORD *)outbuf;
		
		for (int i=0; i<(size/4); i++)
		{
			if (i % 256 == 0) block ++;

			DWORD xkey = cryptotable[i & 0xFF] ^ seedtable[((i+1000) % (111 + block)) & 0xFF];
			
			d_outbuf[i] = d_data[i] ^ xkey; 
		}
	}

	#ifdef DEBUGGING_ENABLED
	info("Output data:");
	//PrintBuffer((BYTE*)outbuf, size, 16);
	info("--------------");
	#endif



	free(cryptotable);

	return true;
	VE();
}
Пример #19
0
#define SHIFT(c, a)	((WORDBITSIZE/(c)) * a)
#define IDX_MASK(c)	(c == 1 ? ~(word)0 : (((word)1 << (WORDBITSIZE/(c))) - 1))
#define VM(c, a)	((word)((IDX_MASK(c) << SHIFT(c, a))))

#define Shift(c, a)	(mask_shift[c][a])
#define Mask(c)		(mask_mask[c])
#define varMask(c, a)	(variable_mask[c][a])

#define matchIndex(i1, i2)	(((i1).key & (i2).varmask) ==\
				 ((i2).key & (i1).varmask))

static uintptr_t variable_mask[][4] =
{   { 0,        0,        0,        0 },
#ifdef DONOT_AVOID_SHIFT_WARNING
    { VM(1, 0), 0,        0,        0 },
#else
    { ~(word)0, 0,        0,        0 },
#endif
    { VM(2, 0), VM(2, 1), 0,        0 },
    { VM(3, 0), VM(3, 1), VM(3, 2), 0 },
    { VM(4, 0), VM(4, 1), VM(4, 2), VM(4, 3) }
};

static int mask_shift[][4] =
{   { 0,           0,           0,           0 },
    { SHIFT(1, 0), 0,           0,           0 },
    { SHIFT(2, 0), SHIFT(2, 1), 0,           0 },
    { SHIFT(3, 0), SHIFT(3, 1), SHIFT(3, 2), 0 },
    { SHIFT(4, 0), SHIFT(4, 1), SHIFT(4, 2), SHIFT(4, 3) }
};