wishlist for NXC

Discussion specific to NXT-G, NXC, NBC, RobotC, Lejos, and more.
HaWe
Posts: 2500
Joined: 04 Nov 2014, 19:00

Re: wishlist for NXC

Post by HaWe »

as meanwhile the nxcdefs.h has grown big enough to sink the whole Royal Navy^^ i would appreciate if we could get more distinct header files, e.g.
stdlib.h (including stdio.h., conio.h, stdlib.h: display, button, and file io, math, array, and strings calculation/manipulation/statistics)
sensors.h
motors.h
comm.h (for BT and rs485 and i2c)
Last edited by HaWe on 07 Mar 2012, 20:45, edited 2 times in total.
pepijndevos
Posts: 175
Joined: 28 Dec 2011, 13:07
Location: Gelderland, Netherlands
Contact:

Re: wishlist for NXC

Post by pepijndevos »

John, you are awesome! I can't wait to play with them. So you even managed to do variable jumps? I'm sorry I can't do Pascal, because I'd want this sooner rather than later. Is there any low-hanging fruit I could help with?

I guess you also made Doc really happy, but apparently he doesn't realize yet.
-- Pepijn
http://studl.es Mindstorms Building Instructions
HaWe
Posts: 2500
Joined: 04 Nov 2014, 19:00

Re: wishlist for NXC

Post by HaWe »

I guess you also made Doc really happy, but apparently he doesn't realize yet.
no, actually not. when? what? why?
afanofosc
Site Admin
Posts: 1256
Joined: 26 Sep 2010, 19:36
Location: Nashville, TN
Contact:

Re: wishlist for NXC

Post by afanofosc »

Doc realizes it but he just hasn't realized that he has yet. In any case, he can draw text to any Y value now without resorting to RIC fonts and he can use super-fast string uppercase and lowercase functions. If you have any suggestions for additional array operations that are specific to strings (like uppercase and lowercase) let me know.

Since I'm home sick with a cold I've been working on the compiler changes for variable jumps et al. I just need to sort out how to get the set opcode to work with either a Clump name or a Label name and I should be good to go. The main problem is both of these are optimized a ton so I can't swap out the name for a constant until after all the optimizations are done. And I also need to make sure I include these clump names and label names in the code that builds up a list of references so that I don't optimize out a clump that is referred to in a set opcode. Until I get these changes made you won't be able to do much with the firmware support that is already in place. Hopefully by the end of the day it will be all ready to go.

John Hansen
Multi-platform LEGO MINDSTORMS programming
http://bricxcc.sourceforge.net/
HaWe
Posts: 2500
Joined: 04 Nov 2014, 19:00

Re: wishlist for NXC

Post by HaWe »

it was actually only because I was curious about these 2 issues:
1) print(x,y) anywhere without grafic ric fonts
2) upper/lower string.

for 1) I was using ric fonts (especially with smaller fonts 6x7, 5x6) so far and
for 2) it was only for a small programming idea of a palindrom check program, not for any ongoing need; but this once might become important if we once had a real commercial PC keyboard which could be attached by i2c or BT.

much more really useful to have would be
3) a really full ANSI compatible print/printf for multiple variables of any kind of type supporting also functions as parameters.

Code: Select all

task main()
{
   printf ("Characters: %c %c \n", 'a', 65);
   printf ("Decimals: %d %ld\n", 1977, 650000L);
   printf ("Preceding with blanks: %10d \n", 1977);
   printf ("Preceding with zeros: %010d \n", 1977);
   printf ("Some different radixes: %d %x %o %#x %#o \n", 100, 100, 100, 100, 100);
   printf ("floats: %4.2f %+.0e %E \n", 3.1416, 3.1416, 3.1416);
   printf (upper("Width trick")+": %*d \n", 5, 10);
   printf ("%s \n", lower("A string"));
   return 0;
}
and this combined
4) with a cursor(x,y) cmd:

Code: Select all

void cursor( short x, short y ) {
  COORD position = { x, y }; 
  //...
  SetConsoleCursorPosition( hStdout, position );
}

cursor(5, 7); printf (upper("Width trick")+": %*d", 5, 10);
cursor(5,17); printf ("%s \n", lower("A string"));
mattallen37
Posts: 1818
Joined: 02 Oct 2010, 02:19
Location: Michigan USA
Contact:

Re: wishlist for NXC

Post by mattallen37 »

~Helmut, can't you use sprintf? Or do you want it to be terminal style, where you write to the screen, and it writes to the bottom, and moves up as necessary? I am working on an NXC library for that, that supports RIC fonts. It already works well, but it isn't as fast as I want it to be. I am currently converting it to use NBC for some of the drawing, and already increased speed over 40% (with the test program).

That reminds me of my wish for a terminal for the NXT. I want a way that an NXT running an NXC program can send a debug stream to the computer, and have it displayed (like a serial terminal). I think I already mentioned this in the BCC wishlist.
Matt
http://mattallen37.wordpress.com/

I'm all for gun control... that's why I use both hands when shooting ;)
HaWe
Posts: 2500
Joined: 04 Nov 2014, 19:00

Re: wishlist for NXC

Post by HaWe »

matt,
I already have single printf for 1, 2, or three definite variables but not "overloaded" to use printf for any number of variables with just 1 format string, and not always for any number of "\"
( just like I showed in my examples, and it doesn't work with expressions).

The cursor function is not original C but it's in some windows C libraries.

I never used sprintf so far, what's the difference to printf?
mattallen37
Posts: 1818
Joined: 02 Oct 2010, 02:19
Location: Michigan USA
Contact:

Re: wishlist for NXC

Post by mattallen37 »

You can use sprintf to format numbers. You give it a string to write to, a string that includes a formatter, and a number to format. It doesn't display anything, it just writes the info into the output string (so you can do whatever you want with it). I don't know if it supports multiple formatters and numbers though (for which there are obviously workarounds).
Matt
http://mattallen37.wordpress.com/

I'm all for gun control... that's why I use both hands when shooting ;)
HaWe
Posts: 2500
Joined: 04 Nov 2014, 19:00

Re: wishlist for NXC

Post by HaWe »

ok, I see.
But I need printf only to display but with multiple formatters and for any number of and kind of variables (char, int, long, float, string).
Workarounds I already have.
pepijndevos
Posts: 175
Joined: 28 Dec 2011, 13:07
Location: Gelderland, Netherlands
Contact:

Re: wishlist for NXC

Post by pepijndevos »

What Matt said(I think). One thing I really liked about pbLua is the terminal connection. Direct commands are nice, but limited. I wonder if it can be done with NBC hacking, or needs a special firmware.
-- Pepijn
http://studl.es Mindstorms Building Instructions
Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests