ROBOTC.net forums
http://www.robotc.net/forums/

Loop inside ROBOTC IDE or COMPILER...
http://www.robotc.net/forums/viewtopic.php?f=1&t=175
Page 1 of 1

Author:  SuntzuMaster [ Mon May 21, 2007 9:01 pm ]
Post subject:  Loop inside ROBOTC IDE or COMPILER...

Hi,

I have a source program that I cannot open anymore from ROBOTC IDE.
I can open it from MS-VS, NotePad,... without any issue...
The task manager display ROBOTC.EXE 100% CPU busy...
In fact I stay stuck on the ROBOTC splash screen...

any help welcome.

thanks.

jm.

Author:  SuntzuMaster [ Mon May 21, 2007 9:02 pm ]
Post subject: 

PS: I am using the ROBOTC v 1.05.

Author:  SuntzuMaster [ Tue May 22, 2007 8:19 am ]
Post subject: 

I found the code that is creating trouble and that the compiler loop....

I think that some compiler debug should be done... This code is a development in progress... If needed I can send or post the fulll source program.

thanks.

jm.


inline bool I2C_Convers(const tSensors I2C_Port,const unsigned byte I2C_Bus_Addr ,const unsigned byte I2C_RegIndex, ubyte *I2C_Reply, unsigned int I2C_Reply_Length, int nDelay)
{
TI2C_Output I2C_Output;
int nI2C_BytesReady = 0;
bool bRecv0 = true;
bool bRecv1 = true;

while (true)
{
nI2C_BytesReady = 0;
I2C_Output.nMsgSize = 2;
I2C_Output.I2C_Bus_Addr = I2C_Bus_Addr;
I2C_Output.I2C_RegIndex = I2C_RegIndex;

memset(I2C_Reply,0x00,I2C_Reply_Length);

nI2CBytesReady[I2C_Port] = 0;
nI2CRetries = 5;

bRecv0 = true;
while(bRecv0)
{
sendI2CMsg(I2C_Port,I2C_Output.nMsgSize,0);
switch(nI2CStatus[I2C_Port])
{
case NO_ERR:
while(nI2C_BytesReady < I2C_Reply_Length)
{
nI2C_BytesReady = nI2CBytesReady[I2C_Port];
wait1Msec(1);
}
readI2CReply(I2C_Port,I2C_Reply,I2C_Reply_Length);
bRecv0 = false;
break;

case STAT_COMM_PENDING:
wait1Msec(1);
continue;
break;

default:
case ERR_COMM_BUS_ERR:
return(false);
break;
}
}

bRecv1 = true;
while(bRecv1)
{
sendI2CMsg(I2C_Port,I2C_Output.nMsgSize,I2C_Reply_Length);
switch(nI2CStatus[I2C_Port])
{
case NO_ERR:
while(nI2C_BytesReady < I2C_Reply_Length)
{
nI2C_BytesReady = nI2CBytesReady[I2C_Port];
wait1Msec(1);
}
readI2CReply(I2C_Port,I2C_Reply,I2C_Reply_Length);
bRecv1 = false;
break;

case STAT_COMM_PENDING:
wait1Msec(1);
continue;
break;

default:
case ERR_COMM_BUS_ERR:
return(false);
break;
}
}

break;
}

wait1Msec(nDelay);
return(true);
}

Author:  tfriez [ Tue May 29, 2007 9:25 am ]
Post subject: 

You can manually reset RobotC's IDE by deleting the following registry values through regedit.

HKEY_CURRENT_USER\Software\Robotics Academy\RobotC

This should reset your RobotC and fix the compiler issue.

Author:  Dick Swan [ Wed May 30, 2007 1:35 am ]
Post subject: 

This is a new bug in the RobotC compiler. The compiler goes into an infinite loop when a "continue" statement is used within a "switch" block.

This is corrected in version 1.06.

There are a couple of other problems in your program that you should correct as well. Replace the "*" with a "&" in the function declaration. While RobotC accepts this syntax today this is an anomoly (i.e. bug or unsupported function) and RobotC treats this as a "&". In future, you may get compile errors if RobotC supports proper pointer variables.

I would recommend removing the "inline" qualifier from your function declaration as well.

Author:  SuntzuMaster [ Wed May 30, 2007 7:45 pm ]
Post subject: 

I am using "inline" because I call that function from two different tasks.
Is that something that is not appropriate from ROBOTC compiler standard?
I was thinking that the "&" was used to pass a parameter to a function by address and then the function prototype have to use "int * x" to tell that a parameter is an address to an integer?

I am still very "C" ANSI, "C++" and "C#" then because I was unable to find a language reference book about ROBOTC I tried to guess what can be done based on my "C" skills... By the way any idea on when more documentation could be available?

Does ROBOTC support pointeur based algebra?

Could you tell me what is the right way to concatenate string variables:
in "C" I was used to "strcat, strncat,..." I found that wiith ROBOTC I can used s1 = s2 + s3 + s4.... looks like "C#" or even "Java" is that the right way to do that?

I think that I have found another bug... I have to test it again and if I am able to reproduce it I shall post a new open issue on the bug tracker application.

thanks

jm.

PS: When does the 1.06 be available?.

Author:  Dick Swan [ Fri Jun 22, 2007 6:33 am ]
Post subject: 

ROBOTC does not support pointer variables. Not because they're difficult to support but because they introduce too much risk in thing going awry without an easy way to figure out why.

ROBOTC does support the standard "call by reference" variables found in C++. Which incidently, utilize pointers but in a controlled fashion managed by the compiler. You simply declare your function variables with the "&" qualifier to indicate that it is a call-by-reference variable. When you call function, the compiler will generate a reference (i.e. pointre containing the address) for the variable. All accesses to the function variable will use this pointer value; this is a convenient way to have the function update values of its parameters and have the results returned to the calling program.

Page 1 of 1 All times are UTC - 5 hours [ DST ]
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/