wishlist for NXC

Discussion specific to NXT-G, NXC, NBC, RobotC, Lejos, and more.

wishlist for NXC

Postby HaWe » 30 Sep 2010, 19:23

hi John,
will be here a wishlist for NXC improvements? 8-)
Last edited by HaWe on 15 Jun 2011, 17:30, edited 3 times in total.
User avatar
HaWe
 
Posts: 2500
Joined: 04 Nov 2014, 19:00

Re: wishlist for NXC?

Postby afanofosc » 30 Sep 2010, 20:06

Here's one from the old nxtasy wishlist thread:

NXTFreak wrote:Hey Mr. Hansen. I was wondering if you could add support to NXC for struct initialization, identical to the syntax used in C:

Code: Select all
typedef struct {
     string firstName;
     string lastName;
     unsigned int age;
     string pets[];
} person;

person person1 = {.age = 55, .firstName = "Steve", .lastName = "Jobs"};

person person2 = {"Bill", "Gates", 54};

person person3 = {.pets = {"Tiger", "Lulubell"}};



I see if I can dig up a few more.
Multi-platform LEGO MINDSTORMS programming
http://bricxcc.sourceforge.net/
User avatar
afanofosc
Site Admin
 
Posts: 1256
Joined: 26 Sep 2010, 19:36
Location: Nashville, TN

Re: wishlist for NXC?

Postby afanofosc » 30 Sep 2010, 20:09

One thing I know Xander has wished for is support for overloaded functions so that you could write:

Code: Select all

int foobar(int x, int y) { return x+y; }
string foobar(string x, string y) {  return x + y; }



Hopefully I will have both the time and the mental prowess to implement that feature later this year.

John Hansen
Multi-platform LEGO MINDSTORMS programming
http://bricxcc.sourceforge.net/
User avatar
afanofosc
Site Admin
 
Posts: 1256
Joined: 26 Sep 2010, 19:36
Location: Nashville, TN

Re: wishlist for NXC?

Postby mightor » 30 Sep 2010, 20:25

afanofosc wrote:One thing I know Xander has wished for is support for overloaded functions so that you could write:
..
Hopefully I will have both the time and the mental prowess to implement that feature later this year.


Having overloaded functions would allow me to make the NXC Sensor MUX driver transparent in its use. That would be pretty sweet.

- Xander
| My Blog: I'd Rather Be Building Robots (http://botbench.com)
| RobotC 3rd Party Driver Suite: (http://rdpartyrobotcdr.sourceforge.net)
| Some people, when confronted with a problem, think, "I know, I'll use threads,"
| and then two they hav erpoblesms. (@nedbat)
User avatar
mightor
Site Admin
 
Posts: 1079
Joined: 25 Sep 2010, 15:02
Location: Rotterdam, Netherlands

Re: wishlist for NXC !

Postby HaWe » 30 Sep 2010, 20:34

hi guys,
I appreciate that you've taken up my idea so fast...

... a kingdom of heaven if NXC had recursions...! :mrgreen:

(.. and a real ANSI C printf function clone :D )
Code: Select all
printfXY(x,y, "format string", var1, var2, var3, var4...);
Last edited by HaWe on 01 Oct 2010, 19:15, edited 1 time in total.
User avatar
HaWe
 
Posts: 2500
Joined: 04 Nov 2014, 19:00

Re: wishlist for NXC!

Postby HaWe » 30 Sep 2010, 21:35

...and DOUBLE :))
User avatar
HaWe
 
Posts: 2500
Joined: 04 Nov 2014, 19:00

Re: wishlist for NXC!

Postby physics-matt » 01 Oct 2010, 06:54

How about implementing all the Direct Commands in NXC?

There appear to be some, but not all. For instance, there is no GetInputValues.

Matt
physics-matt
 
Posts: 76
Joined: 29 Sep 2010, 06:57

Re: wishlist for NXC!

Postby sebi-mylegopage » 01 Oct 2010, 11:24

Not for NXC but for Bricxcc:
A Linux Version of Bricxcc.
sebi-mylegopage
 
Posts: 16
Joined: 29 Sep 2010, 13:47
Location: Germany

Re: wishlist for NXC!

Postby afanofosc » 01 Oct 2010, 13:09

physics-matt wrote:How about implementing all the Direct Commands in NXC?

There appear to be some, but not all. For instance, there is no GetInputValues.


I will have to go back and look at the firmware source code to remind myself, but I recall thinking at the time that the firmware was throwing away direct command response messages for all direct and system commands except for the read message command, which it handles and copies the response message into the appropriate mailbox. I could modify the enhanced NBC/NXC firmware to do something different. But it might be possible to just grab the response from the bluetooth input buffer just like people do with GPS data (but easier due to the content following the LEGO protocol specifications). It depends on if the RC Handler function erases the data or just ignores it.

In any case, the ones I implemented are the ones which do not require access to the response contents to have any useful purpose.

John Hansen
Multi-platform LEGO MINDSTORMS programming
http://bricxcc.sourceforge.net/
User avatar
afanofosc
Site Admin
 
Posts: 1256
Joined: 26 Sep 2010, 19:36
Location: Nashville, TN

Re: wishlist for NXC!

Postby afanofosc » 01 Oct 2010, 13:15

I am slowly making a connection between doc helmut and my old friend Ford Prefect. I know, I'm slow!

In any case, support for doubles is highly unlikely due to the substantial firmware changes that would be required. I don't see the ROI.

Similarly, if it were easy to support recursion I would. Lacking any kind of local variable or stack-based variables or a call stack of any kind and given the design of the subcall opcode and the subret opcode there just isn't any way without huge changes to the firmware to support recursion. Maybe the compiler could be made to support a limited subset of recursive calls by unwinding the call in the compiler itself if I were much smarter than I am. You need to keep in mind that alien abduction phase way back when and the resulting effect it has had on my mental capacity.

John Hansen
Multi-platform LEGO MINDSTORMS programming
http://bricxcc.sourceforge.net/
User avatar
afanofosc
Site Admin
 
Posts: 1256
Joined: 26 Sep 2010, 19:36
Location: Nashville, TN

Next

Return to Mindstorms Software

Who is online

Users browsing this forum: No registered users and 9 guests

cron