View unanswered posts | View active topics It is currently Mon Dec 22, 2014 9:45 am






Reply to topic  [ 5 posts ] 
1.45: "enhanced" print / nxtDisplayTextLine function? 
Author Message
Guru
User avatar

Joined: Sat Mar 01, 2008 12:52 pm
Posts: 1030
Post 1.45: "enhanced" print / nxtDisplayTextLine function?
hi,
the RobotC print command
nxtDisplyTextLine
allows only 2 variable values to be written on the screen like
Code:
int v, w, x, y;
nxtDisplayTextLine(1, "%3d %3d", x, y);

The original ANSI C command doesn't have this limitation, I may display 4 variables or more in each line like:
Code:
int v, w, x, y;
print("%3d %3d %3d %3d /n",v,w,x,y);


@developers:
could you plz enhance the print/nxtDisplayTextLine command to support more output values in each line like the ANSI "print"?

_________________
regards,
HaWe aka Ford
#define S sqrt(t+2*i*i)<2
#define F(a,b) for(a=0;a<b;++a)
float x,y,r,i,s,j,t,n;task main(){F(y,64){F(x,99){r=i=t=0;s=x/33-2;j=y/32-1;F(n,50&S){t=r*r-i*i;i=2*r*i+j;r=t+s;}if(S){PutPixel(x,y);}}}while(1)}


Last edited by Ford Prefect on Sat Dec 27, 2008 2:38 pm, edited 1 time in total.



Wed Oct 22, 2008 3:27 am
Profile
Moderator
Moderator
User avatar

Joined: Wed Mar 05, 2008 8:14 am
Posts: 3297
Location: Rotterdam, The Netherlands
Post Re: "enhanced" print / nxtDisplayTextLine function?
I second that motion. I've had to resort to using a string to concatenate two values and then printing two of those concatenated strings to be able to print more than one variable on a line. It's a hack and it's nasty and doesn't scale very well.

Xander

_________________
| Professional Conduit of Reasonableness
| (Title bestowed upon on the 8th day of November, 2013)
| My Blog: I'd Rather Be Building Robots
| ROBOTC 3rd Party Driver Suite: [Project Page]


Wed Oct 22, 2008 4:31 am
Profile WWW
Rookie

Joined: Sat Apr 19, 2008 11:51 am
Posts: 43
Post Re: "enhanced" print / nxtDisplayTextLine function?
uuuhh - guys, I'm with you!
I've been missing such a thing since I'm using the screen for debugging reasons!


Wed Oct 22, 2008 12:09 pm
Profile
Creator
Creator

Joined: Fri Feb 09, 2007 9:21 am
Posts: 615
Post Re: "enhanced" print / nxtDisplayTextLine function?
You're right. This would be a useful addition and I have looked at the ease with which it could be added. Unfortunately, it appears very complex. The "print" statement uses a construct for variable length arguments to a procedure. Each of the different native C compilers -- i.e. the compilers used to generate the ROBOTC firmware -- use a different method of building the variable length argument list. The documentation / macros on retrieving the arguments appears complex but straightforware. However, building the argument list appears to be pretty undocumented and I haven't been able to figure out how to do this. If I could figure it out, then I would add to the ROBOTC language.


Sun Dec 21, 2008 2:06 pm
Profile
Guru
User avatar

Joined: Sat Mar 01, 2008 12:52 pm
Posts: 1030
Post Re: "enhanced" print / nxtDisplayTextLine function?
thx, I'm gladly looking forward!

_________________
regards,
HaWe aka Ford
#define S sqrt(t+2*i*i)<2
#define F(a,b) for(a=0;a<b;++a)
float x,y,r,i,s,j,t,n;task main(){F(y,64){F(x,99){r=i=t=0;s=x/33-2;j=y/32-1;F(n,50&S){t=r*r-i*i;i=2*r*i+j;r=t+s;}if(S){PutPixel(x,y);}}}while(1)}


Sun Dec 21, 2008 2:36 pm
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 5 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.