|
Page 1 of 1
|
[ 7 posts ] |
|
Author |
Message |
NeXT-Generation
Senior Roboticist
Joined: Wed Sep 28, 2011 10:13 pm Posts: 630 Location: If I told you, I'd have to kill you.
|
 RobotC 3.51 errors
I updated to 3.51 today, and now my code is mass broken. I was improving that learning code I posted earlier this year, and in 3.5 it was working fine. New code:  |  |  |  | Code: void LookupColorText(int Color, int BrickLoc);
task main() { typedef struct { bool ColorDefined; byte WhereDoesColorBelong; string DoesColorBelong[6]; }BRICK_STRUCT;
BRICK_STRUCT BrickInfo[6];
for(int i = 0; i <= 5; i++) { BrickInfo[i].ColorDefined = false; BrickInfo[i].WhereDoesColorBelong = 0;
for(int x = 0; x <= 5; x++) { BrickInfo[i].DoesColorBelong[x] = "unknown"; } }
string ClrAbr[] = {"Bk ", "Bl ", "Gr ", "Yl ", "Rd ", "Wt "}; bool AbrUsed[] = {false, false, false, false, false, false}; string RndmClrAbrOut;
for(byte a = 0; a < 6; a++) { bool AbrFnd = false;
while(AbrFnd == false) { byte RandomAbr = random[5];
if(AbrUsed[RandomAbr] == false) { strcat(RndmClrAbrOut, ClrAbr[RandomAbr]); AbrFnd = true; AbrUsed[RandomAbr] = true; } } }
strTrim(RndmClrAbrOut);
nxtDisplayTextLine(0, RndmClrAbrOut); nxtDisplayCenteredTextLine(1, "1 2 3 4 5 6");
while(true) { int RandomLoc = random[5]; int BrickColor = random[5];
if(BrickInfo[BrickColor].ColorDefined == true) { LookupColorText(BrickColor + 1, BrickInfo[BrickColor].WhereDoesColorBelong); nxtDisplayCenteredTextLine(7, "Already Confrmed"); wait1Msec(1500); } else { bool FoundUnkownLoc = false;
while(FoundUnkownLoc == false) { if(BrickInfo[BrickColor].DoesColorBelong[RandomLoc] == "unknown") { FoundUnkownLoc = true; } else { RandomLoc = random[5]; } } LookupColorText(BrickColor + 1, RandomLoc + 1);
while(nNxtButtonPressed == kNoButton);
if(nNxtButtonPressed == kLeftButton) { while(nNxtButtonPressed != kNoButton);
BrickInfo[BrickColor].ColorDefined = true; BrickInfo[BrickColor].WhereDoesColorBelong = RandomLoc + 1; BrickInfo[BrickColor].DoesColorBelong[RandomLoc] = "yes";
for(int y = 0; y <= 5; y++) { if(BrickInfo[y].DoesColorBelong[RandomLoc] == "unknown") { BrickInfo[y].DoesColorBelong[RandomLoc] = "no"; } } } else { while(nNxtButtonPressed != kNoButton);
BrickInfo[BrickColor].DoesColorBelong[RandomLoc] = "no"; } } } }
void LookupColorText(int Color, int BrickLoc) { string ColorText;
switch (Color) { case 1: ColorText = "Black"; break; case 2: ColorText = "Blue"; break; case 3: ColorText = "Green"; break; case 4: ColorText = "Yellow"; break; case 5: ColorText = "Red"; break; case 6: ColorText = "White"; break; }
nxtDisplayCenteredTextLine(3, "%s", ColorText + " goes in"); nxtDisplayCenteredTextLine(4, "bin: %d", BrickLoc); nxtDisplayCenteredTextLine(7, "Yes No"); } |  |  |  |  |
And the error output:  |  |  |  | Code: File "Learning_Color_Sorter.c" compiled on Sep 21 2012 19:36:17 **Error**:Intrinsic function ASM command 'variableRefCharPtr(pChar)' evaluates to undefined value **Severe*:Not enought memory to allocate temporary variable **Error**:Intrinsic function ASM command 'variableRefCharPtr(pChar)' evaluates to undefined value *Warning*:Comparison between 'signed' and 'unsigned' operands. **Error**:Invalid comparison with 'string' and 'long' types *Warning*:';' found following 'while' statement. Is this intentional? *Warning*:';' found following 'while' statement. Is this intentional? *Warning*:Comparison between 'signed' and 'unsigned' operands. **Error**:Invalid comparison with 'string' and 'long' types *Warning*:';' found following 'while' statement. Is this intentional? **Error**:Internal Compiler: Bad source parameter for conversion to 'long' result **Severe*:Bad opcode for string variable type **Severe*:Invalid/undefined opcode [Bad]
Compile Statistics: (Learning_Color_Sorter.c) 0.013 Total Compile Time (seconds) 1,528 Total code bytes, (after 244 bytes removed during optimization) 146 Constant Pool Size (in bytes) 972 Used memory locations (of 15000), 1 Tasks, 2 Procedures 136 User Source file lines, 571 tokens 7,163 System Include file lines, 30,795 tokens 15 Errors, 7 Warnings, 0 Info Messages CPU ......Lines/sec..... Seconds Total Source Scanner/parsing: Setup 0.003 2,271,724 42,328 Scanner/parsing: System 0.001 13,342,065 248,598 Scanner/parsing: User Files 0.002 3,467,201 64,603 Code Generation 0.004 1,662,002 30,967 Code Optimize 0.001 6,296,824 117,326 Total 0.013 571,693 10,652 33 Total symbols added to symbol table 1.125 Avg hash bucket depth (1.0 is best possible) |  |  |  |  |
Devs? Any new function defs? Other stuff that could be causing this?
_________________A.K.A. inxt-generation Self-proclaimed genius, and future world dominator. My Brickshelf Folder"Don't they teach recreational mathematics anymore?" - The Tenth Doctor Bow down to Nikola Tesla, King of the Geek Gods.
|
Fri Sep 21, 2012 8:38 pm |
|
 |
Spiked3
Expert
Joined: Tue Feb 28, 2012 3:10 pm Posts: 197
|
 Re: RobotC 3.51 errors
You must have taken brace lessons from Xander  is the same as; you do realize? Personal choice, do what you want, and the compiled code is the same, but one is easier to read IMHO. in a couple of places, you are comparing strings ( == ), another place you concatenate them (string + string). Some languages allow that, ANSI C does not (unless its changed that I do not know of), RobotC is somewhere in the middle so it may have worked and no longer does, or it may be an unintentional bug. My tendency is use strncmp and strncat.
_________________Mike aka Spiked3 http://www.spiked3.com
|
Fri Sep 21, 2012 10:03 pm |
|
 |
NeXT-Generation
Senior Roboticist
Joined: Wed Sep 28, 2011 10:13 pm Posts: 630 Location: If I told you, I'd have to kill you.
|
 Re: RobotC 3.51 errors
 As I said, I was working on updating it. I've learned a lot of things since April. That thing with the braces being one of them. It did support them when I originally wrote it. Apparently not anymore. It seems to me as if some of the errors have to do with internal stuff? Here's a screen cap so the line numbers can be seen.
_________________A.K.A. inxt-generation Self-proclaimed genius, and future world dominator. My Brickshelf Folder"Don't they teach recreational mathematics anymore?" - The Tenth Doctor Bow down to Nikola Tesla, King of the Geek Gods.
|
Fri Sep 21, 2012 10:55 pm |
|
 |
tfriez
Site Admin
Joined: Wed Jan 24, 2007 10:42 am Posts: 620
|
 Re: RobotC 3.51 errors
It's difficult when trying to do inline comparisons of strings (I.e someVar == "abc) with the new support for character arrays. A fixed string comparison should not rely on the double equal sign as this does not promote comparing between strings and character arrays. ANSI-C does not support this and the previous ROBOTC implementation was a kludge... So we fixed it so its more in line with what a C compiler should do... Apparently we can't please everyone even though you guys get on us for not being "C compliant"  To permanently solve the issue, you should change the logic to if(strcmp(someVar,"abc") == 0) - its more in line with how it should be taught rather than relying on language extensions to implicitly do the same thing.
_________________Timothy Friez ROBOTC Developer - SW Engineer tfriez@robotc.net
|
Sat Sep 22, 2012 5:17 am |
|
 |
MHTS
Guru
Joined: Sun Nov 15, 2009 5:46 am Posts: 1523
|
 Re: RobotC 3.51 errors
I agree. You should learn the standard way. The problem with non-standard features is that beginners would learn this all wrong and got a surprise when they switch to standard C in the real world. In general, using non-standard features also makes your program not portable to other platforms.
|
Sat Sep 22, 2012 10:36 am |
|
 |
NeXT-Generation
Senior Roboticist
Joined: Wed Sep 28, 2011 10:13 pm Posts: 630 Location: If I told you, I'd have to kill you.
|
 Re: RobotC 3.51 errors
Okay. I will forget all my previous string work. I don't even want to know how much of my old code is broken by now.....
_________________A.K.A. inxt-generation Self-proclaimed genius, and future world dominator. My Brickshelf Folder"Don't they teach recreational mathematics anymore?" - The Tenth Doctor Bow down to Nikola Tesla, King of the Geek Gods.
|
Sat Sep 22, 2012 11:07 am |
|
 |
tfriez
Site Admin
Joined: Wed Jan 24, 2007 10:42 am Posts: 620
|
 Re: RobotC 3.51 errors
I understand the frustration with the new version of ROBOTC - Because of the newly re-written compiler, there may be things that we were working previously but were not necessarily the correct methodology - but we feel that the new functionality will assist users with learning with a proper C-programming while still having an easy to use experience. Our goal is to make ROBOTC as easy to use with absolute beginners while still providing all of the tools for advanced programmers to feel comfortable. If you're having issues converting your code with all of the new functionality, please contact us at support@robotc.net and attach your programs and we'll be happy to assist with any issues you're having.
_________________Timothy Friez ROBOTC Developer - SW Engineer tfriez@robotc.net
|
Sat Sep 22, 2012 7:57 pm |
|
|
|
Page 1 of 1
|
[ 7 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
|
|