示例#1
0
文件: race.c 项目: icattlecoder/go
void
runtime·racegostart(int32 goid, void *pc)
{
	m->racecall = true;
	runtime∕race·GoStart(g->goid-1, goid-1, pc);
	m->racecall = false;
}
示例#2
0
文件: race.c 项目: blackbeans/golang
uintptr
runtime·racegostart(void *pc)
{
	uintptr racectx;

	m->racecall = true;
	runtime∕race·GoStart(g->racectx, &racectx, pc);
	m->racecall = false;
	return racectx;
}
示例#3
0
task main()
{
    int count=0;
    int direction=1;
    int end=0;
    int doubleline=0;
    int pause=0;

    //open the file to write
    fileHandle=fileOpenWrite(filename);
    //turn right go forward until hit double line go back half a square then turn left You are at bottom left sq now
    RightTurn();
    while(pause==0)
  	{
      motor(motorB)=SPEED;
  		motor(motorC)=SPEED;
  		wait1Msec(1);

  		if(SensorValue(S3)<45&&doubleline!=1)
  		{
  			if(time1[T1]<200)
  			{
  				pause=1;
  			}
  			doubleline=1;
  	}
  		if(SensorValue(S3)>45&&doubleline==1)
  		{
  			doubleline=0;
  			clearTimer(T1);
  		}
	}
	motor[motorB]=-20;
	motor[motorC]=-20;
	wait1Msec(700);
	LeftTurn();

    //start traversing grid
    while(end!=7)
    {
        //traverse right and count lines
        if(direction==1)
        {
            end++;
            while(count<8)
            {
                if(SensorValue(S3)<45)
                {
                    blacksq++;
                    //store position to array
                    grid[pos1][pos2]='1';
                }
                //increment counters
                count++;
                total++;
                displayBigTextLine(2,"Black:%d",blacksq);
                displayBigTextLine(5,"Count:%d ",count);
                displayBigTextLine(8,"Total:%d",total);
                //move forward one square
                Forward();
                pos2++;
            }

            //Switches to next line
            if(end!=7)
            {
                direction=NextLineLeft(direction);
                //Resets count
                count=ResetCount(count);
                pos1++;
            }
        }
        if(direction==2)
        {
            end++;
            while(count<8)
            {
                if(SensorValue(S3)<45)
                {
                    blacksq++;
                    //store position to array
                    grid[pos1][pos2]='1';
                }
                //increment counters
                count++;
                total++;
                displayBigTextLine(2,"Black:%d",blacksq);
                displayBigTextLine(5,"Count:%d ",count);
                displayBigTextLine(8,"Total:%d",total);
                //move forward one square
                Forward();
                pos2--;
            }
            //Switches to next line
            if(end!=7)
            {
                //Switches to next line
                direction=NextLineRight(direction);
                //Resets count
                count=ResetCount(count);
                pos1++;
            }
        }//end if()
    }//end while()
		checkarray();
    //Goes back to the start function
    GoStart();

    //THIS IS THE SECOND PART OF THE PROGRAM TO MAP THE LOCATION OF THE OBJECT
    while(1==1)
    {
    	if(getTouchValue(S2)==1)
    	{
            //reset all values
            pos1=0;
            pos2=0;
            count=0;
            direction=1;
            end=0;
            while(end!=7)
            {
                //traverse right and count lines
                if(direction==1)
                {
                    end++;
                    while(count<8)
                    {
                        //check to see if there is an object 140mm away
                        if(getUSDistance(S1)<14)
                        {
                            grid[pos1][pos2]='J';
                             	motor[motorB]=0;
															motor[motorC]=0;
                            wait1Msec(1000000);
                        }
                        //increment counters
                        count++;
                        Forward();
                        pos2++;
                    }

                    //Switches to next line
                    if(end!=7)
                    {
                        direction=NextLineLeft(direction);
                        //Resets count
                        count=ResetCount(count);
                        pos1++;
                    }
                }
                if(direction==2)
                {
                    //check to see if there is an object 140mm away
                    end++;
                    while(count<8)
                    {
                        if(getUSDistance(S1)<14)
                        {
                            grid[pos1][pos2]='J';
                            	motor[motorB]=0;
															motor[motorC]=0;
                            wait1Msec(1000000);
                        }
                        //increment counters
                        count++;
                        //move forward one square
                        Forward();
                        pos2--;
                    }
                    //Switches to next line
                    if(end!=7)
                    {
                        //Switches to next line
                        direction=NextLineRight(direction);
                        //Resets count
                        count=ResetCount(count);
                        pos1++;
                    }
                }//end if()
            }//end while()

      }  }//end if()
}//end main()