[NXC] Memory Manager

Discussion specific to NXT-G, NXC, NBC, RobotC, Lejos, and more.
muntoo
Posts: 834
Joined: 01 Oct 2010, 02:54
Location: Your Worst Nightmare
Contact:

Re: [NXC] Memory Manager

Post by muntoo »

The "bug" that I fixed (in my last post, which still requires testing) was in my code in task main(). (I fixed it.)
afanofosc wrote:
// Report NXC Bug. Can't use "MM_ID ptr = myvar;"
Oh, sorry, I should have deleted that line; my code comments [if any] are a bit misleading at the moment. That line was from before when I was getting random compiler errors on that line; it was actually another bug in the compiler [below]. :)

The bug in the compiler: I can't use any more #includes without causing a compiler error.
Image

Commit to LEGO Mindstorms Robotics Stack Exchange:
bit.ly/MindstormsSE


Commit to LEGO Stack Exchange: bit.ly/Area51LEGOcommit
afanofosc
Site Admin
Posts: 1256
Joined: 26 Sep 2010, 19:36
Location: Nashville, TN
Contact:

Re: [NXC] Memory Manager

Post by afanofosc »

What I need is a zip containing exactly the files that cause the error - not modified so that the error no longer happens. And preferably simplified to as little content as possible to still have the error occur. And the F12 error listing. So far I have not been able to understand your description of the problem. Are you saying that if I #include a file that #includes 4 or 5 other files - regardless of the content - it will cause a compiler error? Or is it only if one of the include files ends with a block comment?

John Hansen
Multi-platform LEGO MINDSTORMS programming
http://bricxcc.sourceforge.net/
muntoo
Posts: 834
Joined: 01 Oct 2010, 02:54
Location: Your Worst Nightmare
Contact:

Re: [NXC] Memory Manager

Post by muntoo »

EDIT: Also, could someone tell me the output on the NXT's screen of the "v04_works" version? Thanks.

Attached are the "working" and "error" versions.
v0_4_works.zip
(33 KiB) Downloaded 195 times
v0_4_error.zip
(30.3 KiB) Downloaded 199 times
The "MM-Demo.nbc" is the F12 Code Listing.
(BTW, how do you produce "Code Listing" via command line? -sm- -ER=5 -EF -v=128 -Z2 -L="..." produces a thousand #line xxx "...")

----

The working version has this in "MM-Demo.nxc":

Code: Select all

/*

*/
// <ATTENTION> <UNTESTED>
byte MM_get_BYTE(MM_ID /* & is not necessary; pointers! */ id)
{
	// <ATTENTION> Possible bug. Do you think using returns like this is *safe*?
	return(MM_mem[id.idx]);
}


/*

*/
// <ATTENTION> <UNTESTED>
MM_ID MM_set_BYTE(MM_ID /* & is not necessary; pointers! */ id, byte val)
{
	MM_mem[id.idx] = val;

	return(id); // return id for no reason
}
The error version has this in "MM-Demo.nxc" instead:

Code: Select all

#include "MM_BYTE.nxc"
Those are the only differences.


-----

Attachments:
v0_4_works.zip
(33 KiB) Downloaded 195 times
v0_4_error.zip
(30.3 KiB) Downloaded 199 times
Image

Commit to LEGO Mindstorms Robotics Stack Exchange:
bit.ly/MindstormsSE


Commit to LEGO Stack Exchange: bit.ly/Area51LEGOcommit
afanofosc
Site Admin
Posts: 1256
Joined: 26 Sep 2010, 19:36
Location: Nashville, TN
Contact:

Re: [NXC] Memory Manager

Post by afanofosc »

All of your files that end with

Code: Select all

23 65 6E 64 69 66
need to be changed so that they end with either

Code: Select all

23 65 6E 64 69 66 0A
or

Code: Select all

23 65 6E 64 69 66 0D 0A
The tokenizer used by the Preprocessor is not returning a token for #endif when there are no more bytes in the file following the "f" Even if you had a space after #endif it would work but not (currently) with the file ending with "f".

Didn't you report some kind of problem also when a file ended with a block comment? Probably the same kind of problem (i.e., no bytes in the file following the "/" at the end of the block comment). Use an editor that adds 0D 0A to the end of your files (like BricxCC does) and you won't have this problem.

John Hansen
Multi-platform LEGO MINDSTORMS programming
http://bricxcc.sourceforge.net/
muntoo
Posts: 834
Joined: 01 Oct 2010, 02:54
Location: Your Worst Nightmare
Contact:

Re: [NXC] Memory Manager

Post by muntoo »

afanofosc wrote:Didn't you report some kind of problem also when a file ended with a block comment? Probably the same kind of problem (i.e., no bytes in the file following the "/" at the end of the block comment). Use an editor that adds 0D 0A to the end of your files (like BricxCC does) and you won't have this problem.
Yeah, it works now. :) The block comment problem was the same; the file ended with "/" with no CRLF or space.)
Image

Commit to LEGO Mindstorms Robotics Stack Exchange:
bit.ly/MindstormsSE


Commit to LEGO Stack Exchange: bit.ly/Area51LEGOcommit
muntoo
Posts: 834
Joined: 01 Oct 2010, 02:54
Location: Your Worst Nightmare
Contact:

Re: [NXC] Memory Manager

Post by muntoo »

New Test File

Please test the .rxe, and tell me what the output is. (Or post a NXT screenshot/screencapture.)

Thanks.
v0_4.zip
(36.94 KiB) Downloaded 285 times
Image

Commit to LEGO Mindstorms Robotics Stack Exchange:
bit.ly/MindstormsSE


Commit to LEGO Stack Exchange: bit.ly/Area51LEGOcommit
timpattinson
Posts: 224
Joined: 30 Oct 2010, 04:10
Location: 127.0.0.1
Contact:

Re: [NXC] Memory Manager

Post by timpattinson »

As far as I can tell, it still doesn't work
-Tim
Attachments
video.zip
screenshot
(90.67 KiB) Downloaded 182 times
Commit to Lego Mindstorms StackExchange Q&A http://area51.stackexchange.com/proposals/4105
Minboards IRC Channel #mindboards on Freenode
My blog: http://timpattinson.wordpress.com/
muntoo
Posts: 834
Joined: 01 Oct 2010, 02:54
Location: Your Worst Nightmare
Contact:

Re: [NXC] Memory Manager

Post by muntoo »

New Test File

Please test the .rxe, and tell me what the output is. (Or post a NXT screenshot/screencapture.)

Thanks.

-----

This program will act differently. I know it!
v0_4.zip
(36.95 KiB) Downloaded 283 times
Image

Commit to LEGO Mindstorms Robotics Stack Exchange:
bit.ly/MindstormsSE


Commit to LEGO Stack Exchange: bit.ly/Area51LEGOcommit
timpattinson
Posts: 224
Joined: 30 Oct 2010, 04:10
Location: 127.0.0.1
Contact:

Re: [NXC] Memory Manager

Post by timpattinson »

It works now
screenshot.gif
screenshot.gif (1.43 KiB) Viewed 7610 times
nxt_000.zip
(46.56 KiB) Downloaded 304 times
-Tim
Commit to Lego Mindstorms StackExchange Q&A http://area51.stackexchange.com/proposals/4105
Minboards IRC Channel #mindboards on Freenode
My blog: http://timpattinson.wordpress.com/
muntoo
Posts: 834
Joined: 01 Oct 2010, 02:54
Location: Your Worst Nightmare
Contact:

Re: [NXC] Memory Manager

Post by muntoo »

New Test File

Please test MM-Demo.rxe and MM-Demo_2.rxe, and tell me what the outputs are. (Or post NXT screenshots/screencaptures.)

Thanks.

-----

Joy because last one worked: :D :D :D :D :D :D :D :D :D :D
v0_4.zip
(36.1 KiB) Downloaded 290 times
Image

Commit to LEGO Mindstorms Robotics Stack Exchange:
bit.ly/MindstormsSE


Commit to LEGO Stack Exchange: bit.ly/Area51LEGOcommit
Post Reply

Who is online

Users browsing this forum: Semrush [Bot] and 0 guests