The misery of a misplaced ;
vining
Posts: 4,368
After what seemd like hours, re-compiling w/ debug strings every where I could think, changing stack vars to local to watch in debug, completely re-writing several section, starring at the same sections of code over and over again with out anything obvious starring back and then I finally found it. Of course this being the 1st code I've written since upgrading to NS3 yesterday and now dealing with the crashing to add to my insanity one simple little semi colon in the wrong place. How it got there? Probably a quick copy and paste. Now so obvious although before invisible. I got the 1st debug string but nothing after and never returned to the code that called this function.
Now to try & undo all the stupid crap I did for no reason, oy vey!
DEFINE_FUNCTION fnComcastParseChannels(CHAR iBuff[],INTEGER iParseStrIndx ) { LOCAL_VAR CHAR cCH_Buff[8000] ; STACK_VAR INTEGER nFBS ; LOCAL_VAR INTEGER nCurChannel ; cCH_Buff = iBuff ; fnComcast_Debug("'Parsing Ch. for Section # ',itoa(iParseStrIndx),'. line-<',ITOA(__LINE__),'>',crlf") ; WHILE(find_string(cCH_Buff,'20%;">',1)) ; { fnComcast_Debug("'Parsing Ch. inside while. line-<',ITOA(__LINE__),'>',crlf") ; REMOVE_STRING(cCH_Buff,'20%;">',1) nFBS = find_string(cCH_Buff,'</',1) nCurChannel = ATOI("GET_BUFFER_STRING(cCH_Buff,nFBS-1)") ; fnComcast_Debug("'Parsing Channels # ',itoa(nCurChannel),'. line-<',ITOA(__LINE__),'>',crlf") ; if(find_string(cCH_Buff,'C0;">',1)) { REMOVE_STRING(cCH_Buff,'C0;">',1) nFBS = find_string(cCH_Buff,'</',1) sComcast[nCurChannel].CH_Name = GET_BUFFER_STRING(iBuff,nFBS-1) ; sComcast[nCurChannel].CH_Number = nCurChannel ; sComcast[nCurChannel].CH_Type = CH_SECTION_NAMES[iParseStrIndx] ; } else { sComcast[nCurChannel].CH_Name = 'n/a' ; sComcast[nCurChannel].CH_Number = MAX_NUM_CH + 1 ; sComcast[nCurChannel].CH_Type = 'err' ; } } fnComcast_Debug("'Parsing Channels ends. line-<',ITOA(__LINE__),'>',crlf") ; cCH_Buff = '' ; RETURN ; }
Now to try & undo all the stupid crap I did for no reason, oy vey!
0
Comments
I'm surprised it let you compile with where it was. If you were to do that with an IF, SWITCH or SELECT - it chokes . . . bug in the compiler perhaps?
I think there might be something going on. In another post I mentioned a weird anomoly involving define_Module.
I've been working on a new system lately and was putting in two modules.
Module for Mitsubishi TV
Module for Marantz receiver.
The marantz module quit working altogether unexpectedly. Online event would never fire on the serial device in the module. Variables would show up in the debugger wiht zero values. You could change them but nothing worked. I trashed all the .tkos and .tkns, compiled individual files one at a time, etc...
The project continued to comple and/or build with zero errors.
After beating and banging for several hours, on a whim I tried reversing the order of the module declarations in code just to see if the compile was missing something.
so I reversed
Module for Mitsubishi TV
Module for Marantz receiver.
for
Module for Marantz receiver.
Module for Mitsubishi TV
complied, uploaded and it worked just fine. Crisis averted, you can all go home now.
So, then to see if there was something to do with the order in which they occured I put them back to
Module for Mitsubishi TV
Module for Marantz receiver.
compiled, uploaded and it works still to this day.
So, there seems to be something that's getting past somehow. I'm not too surprised that vining's error compiled. I can still remember the old days of Axcess where you could get away with murder all the time. Ah, those halcyon days...
Bummer about all the time wasted Dan.
--John
I always use semi-colons and have learned where they can & can't go but somehow that sucker was invisible and laughing at me for hours. I've done dumber stuff but the amount of re-writing I went through to end up with a simple, stupid misplaced semi-colon made me want to kick myself in the a$$.
Ctrl-Z . . . .
That might be a good feature addition for Studio. F7 compiles and backs up 10 iterations back in case you need to restore to your previous code.
Ahhh the life of programming
--John
Paul
FYI, personally I do a lot of stuff that isn't required that works with my anal OCD ADD quirks and in my head they make things, for me, more readable & organized. I actually can't stand the way most of you guys on the forum write code but maybe cuz you guys are programmers and I still don't consider myself one, that's why. Well, I do but I don't. I know the way I write & structure code has got to make you guys sick but I am what I am and I do what I do.
I use them in the languages that require them of course. Never saw a need to use them in Netlinx though. I would suggest not using them if they will create hard to find bugs, but I know old habits die hard.
Paul
so would the proper saying then be:
"It is the poor programmer who blames his punctuations?"
I blame my computer for almost everything that goes wrong.
:D:D
Jeff
I had a situation the other day where I needed a semi-colon at the end of declaring stac vars inside timeline events.
Without the semi-colon, the compiler would error out.
regards
Craig
I would be interested in seeing that. Can you post the relevant code?
Paul
http://amxforums.com/showpost.php?p=3587&postcount=5