Example #1
0
int main(int argc, char** argv)
{
	uint32_t signature;
	int fd;
	const char* target = "64";
	bool reg;
	
	if (argc == 2 && (reg = !strcmp(argv[1], "--register") || !strcmp(argv[1], "--deregister")))
		return registerDeregister(argv[0], reg);

	fd = open(argv[1], O_RDONLY | O_CLOEXEC);

	// We let real dyld output all serious error messages
	// not to duplicate the functionality.
	if (fd < 0)
		junction(target, argc, argv);

	if (read(fd, &signature, 4) != 4)
		junction(target, argc, argv);

	if (signature == 0xfeedface || signature == 0xcefaedfe)
		target = "32";
	else if (signature == 0xcafebabe || signature == 0xbebafeca)
		target = decideFat(fd, signature == 0xbebafeca);

	junction(target, argc, argv);
	return 1;
}
Example #2
0
task main()
{
	/*
		The main function contains just an infinite while loop that continues to call all the functions before mentioned. In the called
		functions we check for specific things like the line curving or a bleutooth input.
	*/

	//read the beginvalues of the light sensors
	/*int begin_value_s1 = SensorValue[S1];
	int begin_value_s2 = SensorValue[S2];*/

	//delayed startup nog maken
	/*for (int i = 0; i< 100; i+=5){
		setMultipleMotors(i, motorA, motorB);
		wait(0.1);
	}*/

	int stopcode2 = 0;//for stopping the while loop in case of a remote code shutdown

	

	while(1){
		stopcode2 = bleutooth_control();//check for bleutooth input. This is the version of bleutooth input that takes over the robot
		junction();//check for an intersection
		need_for_speed();//check if the line is curving and if not then just drive
		if(stopcode2 == 1){//if "C" is pressed in the bleutooth_control function then stop the code completely
			return;
		}
	}
}
task main() {
    /*
            The main function contains just an infinite while loop that continues to call all the functions before mentioned. In the called
            functions we check for specific things like the line curving or a bleutooth input.
     */
    nxtDisplayTextLine(0, "Start");
    get_places();
    nxtDisplayTextLine(1, "Map calibrated!");
    nxtDisplayTextLine(7, "[%d][%d][%d][%d]",startrow,startcollumn,endrow,endcollumn);
    while(matrix[currentrow][currentcollumn] != matrix[endrow][endcollumn]){
      nxtDisplayTextLine(3, "Finding route");
    	finding_route();
    }
    nxtDisplayTextLine(4, "Calculating directions!");
    nxtDisplayTextLine(6, "%c %c %c ",instructions[0], instructions[1],instructions[2]);
    calculate();
    nxtDisplayTextLine(5, "Route Found!");
    nxtDisplayTextLine(2, "%c,%c,%c", new_matrix[0], new_matrix[1], new_matrix[2]);
    int stopcode2 = 0; //for stopping the while loop in case of a remote code shutdown

    startTask(music); //start the music in a seperate thread

    counter = 0;

    while (1) {
        junction(); //check for an intersection
        linefollow(); //check if the line is curving and if not then just drive
        if (stopcode2 == 1) {//if "C" is pressed in the bleutooth_control function then stop the code completely
            return;
        }
    }
}
void BinomialHeap::insert(BinomialHeap &bh, NodoB &nodo)
{

    BinomialHeap *bTemp=new BinomialHeap(funcionComparar,this->size);
    nodo.parent = NULL;
//    list<NodoB*> *listTemp;
//    *listTemp = a.pChild;
//    listTemp=NULL;

    nodo.siblingDer = NULL;
    nodo.degree = 0;
    nodo.siblingIzq=NULL;
    bTemp->heap.push_back(&nodo);
    BinomialHeap *bhTemp;
    bhTemp=junction(bh,*bTemp);

}
Example #5
0
void ConnEnd::outputCode(FILE *fp, const char *srcDst) const
{
    if (junction())
    {
        fprintf(fp, "    %sPt = ConnEnd(junctionRef%u);\n", srcDst,
                m_anchor_obj->id());
    }
    else if (shape())
    {
        fprintf(fp, "    %sPt = ConnEnd(shapeRef%u, %u);\n", srcDst,
                m_anchor_obj->id(), m_connection_pin_class_id);
    }
    else
    {
        fprintf(fp, "    %sPt = ConnEnd(Point(%" PREC "g, %" PREC "g), (ConnDirFlags) %u);\n",
                srcDst, m_point.x, m_point.y, m_directions);
    }
}
Example #6
0
task main()
{
	/*
		The main function contains just an infinite while loop that continues to call all the functions before mentioned. In the called
		functions we check for specific things like the line curving or a bleutooth input.
	*/
	int stopcode2 = 0;//for stopping the while loop in case of a remote code shutdown

	startTask(music);//start the music in a seperate thread

	string s = "";//create a string
	TFileIOResult nBTCmdRdErrorStatus;
  int nSizeOfMessage;
  ubyte nRcvBuffer[kMaxSizeOfMessage];

	while(1){
		 nSizeOfMessage = cCmdMessageGetSize(INBOX);

    if (nSizeOfMessage > kMaxSizeOfMessage){//make the message shorter if its to long
      nSizeOfMessage = kMaxSizeOfMessage;
    }

    if (nSizeOfMessage > 0){//if the message is not empty, put the received information in string s
    	nBTCmdRdErrorStatus = cCmdMessageRead(nRcvBuffer, nSizeOfMessage, INBOX);
    	nRcvBuffer[nSizeOfMessage] = '\0';
    	s = "";
    	stringFromChars(s, (char *) nRcvBuffer);//put the received data in string s
    	displayCenteredBigTextLine(4, s);
    }
    if (s == "B"){//bluetooth override
    	setMultipleMotors(0, motorA, motorB);
			stopcode2 = bleutooth_control(&s);//check for bleutooth input. This is the version of bleutooth input that takes over the robot
		}
		junction(&s);//check for an intersection
		linefollow();//check if the line is curving and if not then just drive
		if(stopcode2 == 1){//if "C" is pressed in the bleutooth_control function then stop the code completely
			return;
		}
	}
}
Example #7
0
void ConnEnd::outputCode(FILE *fp, const char *srcDst, unsigned int num) const
{
    if (num == 0)
    {
        num = m_conn_ref->id();
    }

    if (junction())
    {
        fprintf(fp, "    ConnEnd %sPt%u(junctionRef%u);\n", srcDst,
                num, m_anchor_obj->id());
    }
    else if (shape())
    {
        fprintf(fp, "    ConnEnd %sPt%u(shapeRef%u, %u);\n", srcDst,
                num, m_anchor_obj->id(), m_connection_pin_class_id);
    }
    else
    {
        fprintf(fp, "   ConnEnd %sPt%u(Point(%g, %g), (ConnDirFlags) %u);\n",
                srcDst, num, m_point.x, m_point.y, m_directions);
    }
}
Example #8
0
// ------------------------------------------
//  マニピュレータを描画
// ------------------------------------------
void Model::manipulator(float theta1, float theta2, int d)
{

    glPushMatrix();
        glTranslatef(0, 0, 150);
        cylinder(50, 200, 200);

        // リンク1
        {
            float Ambient[] = {0.1f, 0.1f, 0.1f, 1.0f};
            float AmbientLight[] = { 0.4f, 0.0f, 0.0f, 1.0f};
            glMaterialfv(GL_FRONT,GL_AMBIENT,Ambient);
            glLightfv(GL_LIGHT0, GL_AMBIENT, AmbientLight);
        }
        glTranslatef(0, 0, 200);            // 円柱
        glTranslatef(0, 0, 20);             // 厚み分
        glRotatef(-90.0, 1.0, 0.0, 0.0);
        glRotatef(theta1, 0, 1, 0);
        cuboid(80, 40, 200);

        // 接合部
        junction(40, 50, 100);

        // リンク2
        {
            float Ambient[] = {0.7f, 0.5f, 0.1f, 1.0f};
            float AmbientLight[] = { 0.1f, 0.1f, 0.3f, 1.0f};
            glMaterialfv(GL_FRONT,GL_AMBIENT,Ambient);
            glLightfv(GL_LIGHT0, GL_AMBIENT, AmbientLight);
        }
        glTranslatef(0, 0, 200);
        glRotatef(theta2, 0, 1, 0);
        cuboid(80, 40, 200);

        // 接合部
        junction(40, 50, 100);

        // リンク3
        glTranslatef(0, 0, 200);
        junction(40, 50, 100);
        {
            float Ambient[] = {0.1f, 0.2f, 0.2f, 1.0f};
            float AmbientLight[] = { 1.0f, 1.0f, 1.0f, 1.0f};
            glMaterialfv(GL_FRONT,GL_AMBIENT,Ambient);
            glLightfv(GL_LIGHT0, GL_AMBIENT, AmbientLight);
        }
        glRotatef(-90, 1, 0, 0);
        glTranslatef(0, -10, -280);
        glTranslatef(0, 0, d);
        cylinder(20, 300, 200);

        // グリッパ
        {
            float Ambient[] = {0.0f, 0.0f, 0.0f, 1.0f};
            float AmbientLight[] = { 1.0f, 1.0f, 1.0f, 1.0f};
            glMaterialfv(GL_FRONT,GL_AMBIENT,Ambient);
            glLightfv(GL_LIGHT0, GL_AMBIENT, AmbientLight);
        }
        glTranslatef(0, 0, 300);
        cuboid(80, 30, 10);
        glPushMatrix();
            glTranslatef(30, 0, 0);
            cuboid(10, 20, 40);
        glPopMatrix();
        glPushMatrix();
            glTranslatef(-30, 0, 0);
            cuboid(10, 20, 40);
        glPopMatrix();


    glPopMatrix();

}