Example #1
0
File: test.c Project: ae-m/LinOTP
int main() {
printme();
//char * serial="2222";
//CK_RV rv=my_GetTokenSerial( 0, serial);
//printf ("%d\n", (int)rv);
//printf ("%s\n", serial);
printme();


 return 0;
}
Example #2
0
//----------------------------------------------------------------------------- set frustum
void Camera::setFrustum(){

	float dn =(afEye-bs.c).length()-bs.r;
	znear = (dn<=0 )? dNEAR : dn;
	zfar = (afEye-bs.c).length()+bs.r;
	
	printme(znear);
	printme(zfar);
	
	gluPerspective( alpha, aspect, znear, zfar);
}
Example #3
0
int Expression::checkWellFormed() const {
  int retval = 0;
  if (kindIs("+-")) {
    if ((!arg1->typeIs(type) && !arg1->typeIs("double")) ||
        (!arg2->typeIs(type) && !arg2->typeIs("double"))) {
      printf("Types don't match on addition!\n");
      retval++;
    }
  } else if (kindIs("*/")) {
    if (!arg1->typeIs(type) && !arg1->typeIs("double")) {
      printf("Types don't match on multiplication!\n");
      retval++;
    }
    if (!arg2->typeIs(type) && !arg2->typeIs("double")) {
      printf("Types don't match on multiplication!\n");
      retval++;
    }
  } else if (kindIs("unary") && name == "-") {
    if (!arg1->typeIs(type)) {
      printf("Types don't match on unary minus: %s\n", printme().c_str());
      printf("Type of %s is %s\n", arg1->printme().c_str(), arg1->type);
      printf("\n\n");
      retval++;
    }
  }
  if (arg1) retval += arg1->checkWellFormed();
  if (arg2) retval += arg2->checkWellFormed();
  if (arg3) retval += arg3->checkWellFormed();
  return retval;
}
int
main()
{
        int i;
        int *vals;
        pthread_t *tid_array;
        void *retval;
        int err;

        vals = (int *)malloc(THREADS*sizeof(int));
        if(vals == NULL)
        {
                exit(1);
        }

        tid_array = (pthread_t *)malloc(THREADS*sizeof(pthread_t));
        if(tid_array == NULL)
        {
                exit(1);
        }

        for (i = 0; i < THREADS; i++)
        {
                err = pthread_create(&(tid_array[i]),
                                     NULL,
                                     printme,
                                     NULL);

                if(err != 0)
                {
                        fprintf(stderr,"thread %d ",i);
                        perror("on create");
                        exit(1);
                }

        }

        printf("main thread -- ");
        printme(NULL);  /* main thread */

        for (i = 0; i < THREADS; i++)
        {

                printf("I'm %d Trying to join with thread %d\n",
                        Ego(),(int)tid_array[i]);
                int sum = 1;
                for (int j = 1; j <= (int)tid_array[i]; j++)
                {
                   sum = sum * j;
                }
                printf ("Faktorialas: %d\n", sum);
                pthread_join(tid_array[i], &retval);
                printf("%d Joined with thread %d\n",
                        Ego(),(int)tid_array[i]);
        }

        free(tid_array);

        return(0);
}
int main() {
	// get number of elements
	bool ischanged;

	printme();

	do { 
		ischanged = false;
		// check array for inconsistent elements;
		for( unsigned int i=0; i < nelems - 1; i++) {
			if ( isgood(i, i+1) ) { 
				swap(i, i+1);
				ischanged = true;
			}
		}
		// print the array
		printme();
	} while(ischanged);

	return 0;
}
Example #6
0
int main(int argc, char * argv[])
{
    double param = 0.5;
    printme(" is: %f\n", atan (param) * 180 / PI);
    printme(" is: %f\n", acos (param) * 180 / PI);
    printme(" is: %f\n", asin (param) * 180 / PI);
    
    double degree  = 45.0;
    printme(" is: %f\n", cos (degree / 180 * PI));
    printme(" is: %f\n", sin (degree / 180 * PI));
    printme(" is: %f\n", tan (degree / 180 * PI));

    return EXIT_SUCCESS;
}
 void print(std::ostream& os)
 {
   int level = 0;
   printme(os, level);
 }
Example #8
0
int main(int argc, char * argv[])
{

    printme(" is: %d\n", FLT_ROUNDS);
    printme(" is: %d\n", FLT_RADIX);
    printme(" is: %d\n", FLT_MANT_DIG);
    printme(" is: %d\n", DBL_MANT_DIG);
    printme(" is: %d\n", LDBL_MANT_DIG);
    printme(" is: %d\n", FLT_DIG);
    printme(" is: %d\n", DBL_DIG);
    printme(" is: %d\n", LDBL_DIG);
    printme(" is: %d\n", FLT_MIN_10_EXP);
    printme(" is: %d\n", DBL_MIN_10_EXP);
    printme(" is: %d\n", LDBL_MIN_10_EXP);
    printme(" is: %d\n", FLT_MAX_10_EXP);
    printme(" is: %d\n", DBL_MAX_10_EXP);
    printme(" is: %d\n", LDBL_MAX_10_EXP);

    return EXIT_SUCCESS;
}
Example #9
0
//==============================================================================================================
//{TODO} LABELS!!
void File::SaveCIF(string filename){
	
	ofstream file;
	

	if(obtainExtension(filename) != "cif"){ filename = filename + ".cif"; }
	
	file.open(filename.c_str());

	
	file<<"\t(UFRGS - Universidade Federal do Rio Grande do Sul)\n"
		<<"\t(GME - Group of Microeletronic)\n"
		<<"\t(CIF generated by SightGL)\n"
		<<"\t(Marilena Maule - [email protected])\n"
		<<"\t(Guilherme Flach- [email protected])\n\n";	
		
	vector <Model> * models;
	
	models = clsRepository->getModelsPT();
	
	for(size_t i = 0; i < models->size(); i++ )	{
		file << "DS "<< (*models)[i].getModelId() << " " << (*models)[i].getDVD() << " " << (*models)[i].getDVS() <<";\n";
		file << "9 " << (*models)[i].getName() << ";\n";
		
		//find layers
		vector <ObjectReference> objs;
		(*models)[i].gimmeObjectsOnly(objs);

		while( !objs.empty() ){
			int currentLayer = objs[0].getLayer();
			if (currentLayer != 28 )//labels layer = 28 **CAUTION**
				file << "L " << clsRepository->getLayer(currentLayer).getName() << ";\n";	
			
			bool stop = false;	
			for(size_t l = 0; l <  objs.size() && !stop; l++){
				if(objs[l].getLayer() == currentLayer){
					Object * obj  = objs[l].getObject();
					stop = false;
					switch (obj->getType()){					
						case OBJECT_RECTANGLE: {
							Vertex min = obj->getMin();
							Vertex max = obj->getMax();
							int width = abs(max.x - min.x);
							int height = abs(max.y-min.y);
							int x = width/2 + min.x;
							int y = height/2 + min.y;
							file << "B " << width << " " << height << " " << x << " " << y << ";\n";
						} break;
						
						case OBJECT_LABEL: {
							Vertex min = obj->getMin();
							string lbl = obj->getText();							
							file << "94 "<< lbl << " " << min.x << " " << min.y << "\n";					
						} break;
						
						case OBJECT_WIRE:{}break;
						case OBJECT_LINE:{}break;
						case OBJECT_COMPONENT: break;
					};// end switch
					
					objs[i] = objs.back();
					objs.pop_back();
				} else {
					stop = true;
				}
				printme(objs.size());
				printme(l);
			}//end for save objects
		}//end while

		(*models)[i].saveCallsOnly(file);

		file<<"DF;\n";
	}//end for
		
	file	<< "E;";
	
	file.close();

}//end function