View unanswered posts | View active topics It is currently Thu Jul 31, 2014 8:03 am






Reply to topic  [ 7 posts ] 
user include file modifications are not applied at compile 
Author Message
Rookie

Joined: Sun Jan 29, 2012 1:07 pm
Posts: 4
Post user include file modifications are not applied at compile
When working with a user include file in RobotC, modifications to the include file are not applied at compile, but are only picked up when the RobotC IDE is re-started.

example:

1) user-included file defines and initializes a string, which is displayed on the lcd by the program. The include file is edited with Wordpad to change the definition of the string. The program is compiled and downloaded, but the old string value is displayed.

2) a syntax error is introduced into the include file. The program compiles successfully despite the syntax error. The old message is displayed.

3) the include file is renamed. The compile errors out (can't find include file; undefined variable). the include file (which still contains a syntax error and a changed message) is named properly again. The program *compiles clean*, executes, and displays the old message.

4) RobotC is killed and restarted. The syntax error in the include file now hits the compiler. The error is fixed in the include file, but the compiler still complains of the error.

5) RobotC is killed and restarted. The corrected file is picked up during compile now, and the new message is displayed.

6) The include file is opened within RobotC editor, modified and saved. *this* modification is actually applied to the compiled program, and the new message is displayed.

So it appears that RobotC is checking that the include file exists, but is using a cached version of the include file, unless it is edited w/i the IDE. Obviously RobotC needs to see any modifications made to the include file regardless of how the include file is modified. I can't imagine how caching the include file could save any noticeable time, but at least the file's time stamp should be checked when its existence is checked.

Please let me know if there is a preference or registry switch that would change this behavior, otherwise this is a bug. I am using 3.05, but have tried this in 3.04 with the same negative results.

Regards,
Jason Robbins

message.txt:
string msg = "hello there";

testinc.c:
#include "message.txt"

task main() {
eraseDisplay();
nxtDisplayTextLine(3, "%s", msg);
wait10Msec(500);
}


Sun Jan 29, 2012 3:12 pm
Profile
Rookie

Joined: Sun Jan 29, 2012 1:07 pm
Posts: 4
Post Re: user include file modifications are not applied at compi
I just tried it with .c and .h extensions for the included file, with the same error.

Here's another anamalous behavior. If I open message.h in RobotC IDE, close it, modify the file with wordpad and then open it again in the RobotC IDE, RobotC displays the old contents of the file!

miki, could I bother you to verify this behavior in your environment, using the code examples in my first post? This is so fundamental, I feel like I must be doing something wrong.

Regards,
Jason Robbins


Sun Jan 29, 2012 5:01 pm
Profile
Rookie

Joined: Sun Jan 29, 2012 1:07 pm
Posts: 4
Post Re: user include file modifications are not applied at compi
Miki,

Thanks very much for verifying. I have submitted a support ticket.

Regards,
Jason Robbins


Thu Feb 02, 2012 1:03 pm
Profile
Creator
Creator

Joined: Fri Feb 09, 2007 9:21 am
Posts: 614
Post Re: user include file modifications are not applied at compi
kb5pdq wrote:
So it appears that RobotC is checking that the include file exists, but is using a cached version of the include file, unless it is edited w/i the IDE. Obviously RobotC needs to see any modifications made to the include file regardless of how the include file is modified. I can't imagine how caching the include file could save any noticeable time, but at least the file's time stamp should be checked when its existence is checked.
}

ROBOTC has a "precompiled header" functionality similar to that found in Microsoft's Visual Studio. The system level include files are precompiled once and remembered so that they do not have to be parsed and recompiled on every compile. This does save elapsed time during compiles. You can notice the time difference when the first time ROBOTC compiler is invoked it takes a few seconds more time that subsequent compiles.

On other files, ROBOTC remembers the parsed tokens and if the file has not changed simply feeds the list of parsed tokens to the compiler rather than parsing them again. A token is "if" (and other language keywords), numbers and identifiers. I'm not sure whether this actually saves compile time.


Thu Feb 09, 2012 1:38 am
Profile
Creator
Creator

Joined: Fri Feb 09, 2007 9:21 am
Posts: 614
Post Re: user include file modifications are not applied at compi
Yes. There appears to be a bug in ROBOTC's checking of file date on disk vs the date of the last saved precompiled tokens. If the fix is small then it will make it into the next imminent release.


Thu Feb 09, 2012 1:39 am
Profile
Creator
Creator

Joined: Fri Feb 09, 2007 9:21 am
Posts: 614
Post Re: user include file modifications are not applied at compi
THe "check for source ile has been modified on disk" is now correct and will be in the next incremental release which is within a few days.


Thu Feb 09, 2012 2:23 am
Profile
Rookie

Joined: Sun Jan 29, 2012 1:07 pm
Posts: 4
Post Re: user include file modifications are not applied at compi
Great support! Thank you.

Regards,
Jason Robbins


Fri Feb 10, 2012 11:14 am
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 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

Search for:
Jump to:  



Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software for PTF.