|
Page 1 of 1
|
[ 4 posts ] |
|
Third Party Driver Syntax error
Author |
Message |
Mentor3923
Rookie
Joined: Sat Sep 03, 2011 10:03 am Posts: 32
|
 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].
|
Thu Jan 24, 2013 1:06 pm |
|
 |
mightor
Site Admin
Joined: Wed Mar 05, 2008 8:14 am Posts: 3654 Location: Rotterdam, The Netherlands
|
 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
_________________| Professional Conduit of Reasonableness| (Title bestowed upon on the 8th day of November, 2013) | My Blog: I'd Rather Be Building Robots| ROBOTC 3rd Party Driver Suite: [ Project Page]
|
Thu Jan 24, 2013 4:08 pm |
|
 |
Mentor3923
Rookie
Joined: Sat Sep 03, 2011 10:03 am Posts: 32
|
 Re: Third Party Driver Syntax error
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
|
Fri Jan 25, 2013 4:38 pm |
|
 |
mightor
Site Admin
Joined: Wed Mar 05, 2008 8:14 am Posts: 3654 Location: Rotterdam, The Netherlands
|
 Re: Third Party Driver Syntax error
I had no idea that flag even existed, much less was enabled.
Thanks for reporting the bug.
= Xander
_________________| Professional Conduit of Reasonableness| (Title bestowed upon on the 8th day of November, 2013) | My Blog: I'd Rather Be Building Robots| ROBOTC 3rd Party Driver Suite: [ Project Page]
|
Fri Jan 25, 2013 5:17 pm |
|
|
|
Page 1 of 1
|
[ 4 posts ] |
|
Who is online |
Users browsing this forum: No registered users and 2 guests |
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot post attachments in this forum
|
|