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

Third Party Driver Syntax error
http://robotc.net/forums/viewtopic.php?f=1&t=5419
Page 1 of 1

Author:  Mentor3923 [ Thu Jan 24, 2013 1:06 pm ]
Post subject:  Third Party Driver Syntax error

There is a flag in the RobotC Compiler that is normally set that allows the use of parenthesis in place of a brackets. I turned it off when I noticed that I had a syntax error in my code and it was not flagged. When I turned it off, it flagged my error and another in the third party driver "lego-touch.h". I did not test any other drivers but I do also use IRSeeker, Sonar, lights and no errors were flagged in those drivers.

I started a support ticket ([#437747] Syntax error not flagged) and they suggested I let Xander know. So here it is.

Here are the errors reported for lego-touch.h:

Line 1 bool TSreadState(tSensors link) {
Line 2 if ((SensorType(link) != sensorTouch) && SensorMode(link) != modeBoolean) {
Line 3 SetSensorType(link, sensorTouch);
Line 4 SetSensorMode(link, modeBoolean);

Line 1: N
Line 2 Errors:
**Error**:Variable 'SensorType' is not a Procedure.
**Error**:Too many parameters specified. Call to 'SensorType'. Parameter: 'N/A' is 'link' of type 'tSensors'.
**Error**:Variable 'SensorMode' is not a Procedure.
**Error**:Too many parameters specified. Call to 'SensorMode'. Parameter: 'N/A' is 'link' of type 'tSensors'.
Line 3 Errors:
**Error**:Internal Compiler: Unexpected use of proc 'SensorType' in an expression
**Error**:LValue for '[]' operator must be a pointer
**Error**:'[]' operator requires pointer value on left hand side [2].
Line 4 Errors:
**Error**:Internal Compiler: Unexpected use of proc 'SensorMode' in an expression
**Error**:LValue for '[]' operator must be a pointer
**Error**:'[]' operator requires pointer value on left hand side [2].

Author:  mightor [ Thu Jan 24, 2013 4:08 pm ]
Post subject:  Re: Third Party Driver Syntax error

Hi there,

SensorType is an array, not a function. Simply replace all instances of SensorType(...) with SensorType[...]. Same applies to SensorMode.

Let me know if that fixes it.

Regards,
Xander

Author:  Mentor3923 [ Fri Jan 25, 2013 4:38 pm ]
Post subject:  Re: Third Party Driver Syntax error

mightor wrote:
Hi there,

SensorType is an array, not a function. Simply replace all instances of SensorType(...) with SensorType[...]. Same applies to SensorMode.

Let me know if that fixes it.

Regards,
Xander


I changed line 2 of my message below to: if ((SensorType[link] != sensorTouch) && SensorMode[link] != modeBoolean) {

in lego-touch.h and the errors are no longer flagged. Will you be making those changes in your next release? Perhaps testing without that flag set in the compiler might be in order.

Thanks, Mentor 3923 FTC

Author:  mightor [ Fri Jan 25, 2013 5:17 pm ]
Post subject:  Re: Third Party Driver Syntax error

I had no idea that flag even existed, much less was enabled.

Thanks for reporting the bug.

= Xander

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