Page 7 of 25
					
				Re: wishlist for NXC
				Posted: 31 Jan 2011, 20:43
				by afanofosc
				I don't think FormatNum actually works with strings.  The compiler must be generating bad code or something.  The opcode that I added to the enhanced firmware definitely should not do the right thing if you pass in an array instead of a scalar as the third parameter (iirc).
fmtnum ar_out, fmt_in, value
Here's the firmware code:
Code: Select all
        //Make sure we're trying to convert a scalar/float to a string
        if (TypeCode3 == TC_VOID || (TypeCode3 > TC_LAST_INT_SCALAR && TypeCode3 != TC_FLOAT)) {
          Status = ERR_INSTR;
          return (Status);
        }
This suggests to me that it is not passing your string into the fmtnum opcode in the NBC code generated by the NXC layer since it would return an ERR_INSTR status value if it did.
John Hansen
 
			
					
				Re: wishlist for NXC
				Posted: 31 Jan 2011, 21:21
				by HaWe
				hm, it appears to work correctly although it seems to work (and should work) coincidently faulty - 
a real Wunderhorn, this Lego firmware  

 
			
					
				Re: wishlist for NXC
				Posted: 02 Feb 2011, 23:59
				by dsjove
				We cannot pass an array member as a reference. The work around is to use the array index as the reference variable. Is it possible to resolve the array access as a reference?
Code: Select all
struct Something
{
	int v1;
	int v2;
};
void DoSomethingWith(Something& Else)
{
}
Something everything[4];
task main()
{
	Something today;
	for (int i = 0; i < 4; i++)
	{
		DoSomethingWith(everything[i] /*today*/);
	}
}
 
			
					
				Re: wishlist for NXC
				Posted: 06 Feb 2011, 12:39
				by HaWe
				I indeed just got repetitive runtime errors (File error -1) using printf with "%s" and variable strings.
so my wish is:
a real correct working printf function like in ANSI C stdio.h
that means: 
- working with both nums and strings
- working with multiple format strings and multiple variables
			 
			
					
				Re: wishlist for NXC
				Posted: 07 Feb 2011, 02:52
				by muntoo
				Can we have "real" pass-by-referencing? I recall that you [John] once said something like this:
Guess who wrote:
There is no real passing by reference, so there should be no speed improvement between
and
in
Code: Select all
LOL
{
}
int myarr[1000];
foo(myarr);
in terms of speed.
 
I think this shouldn't be too hard to implement [using NBC global variable magic card tricks], and it'd help speed in some of my programs. (I may be wrong.)
 
			
					
				Re: wishlist for NXC
				Posted: 07 Feb 2011, 19:14
				by afanofosc
				For inline functions it might not be too hard to replace reference parameters with whatever you pass in using some kind of NBC magic but a non-line function that is called at run-time in more than one place with different input arguments could not be magically "fixed" by the compiler at compile time.  A real reference type requires real firmware VM support for pointers, which does not exist currently - and without a lot of work on the enhanced NBC/NXC firmware probably will never exist.
John Hansen
			 
			
					
				Re: wishlist for NXC
				Posted: 10 Feb 2011, 04:55
				by mattallen37
				I want support in the enhanced FW and API functions, for the 
"Absolute position reglation in firmware" feature that Nicolas created.
It is an 
awesome feature, and exactly what I have been wanting for a long time, but the FW isn't based on the "normal" enhanced FW. Now I can finally have a "rack and pinion" type car, and have it automatically steer to the right position 

 .
 
			
					
				Re: wishlist for NXC
				Posted: 10 Feb 2011, 16:24
				by HaWe
				me too! :)
			 
			
					
				Re: wishlist for NXC
				Posted: 16 Feb 2011, 19:40
				by afanofosc
				I will work to incorporate the new absolute position regulation changes from Nicolas into my enhanced NBC/NXC firmware.  I am also working on getting my firmware SVN repository up on sourceforge.  Hopefully I can get it up there this month.
John Hansen
			 
			
					
				Re: wishlist for NXC
				Posted: 16 Feb 2011, 20:35
				by HaWe
				John, what do you think about "outsourcing" some libs in order to decrease the memory NXC  needs?
e.g., I dont regularily need graphic libraries (except fonts).
My suggestion would be to resurrect  #include for specific libraries - 
nxtdefs.h may be included automatically (or- maybe not) - 
and anyone who wants different fonts may
#include "fonts.h"
who wants advanced graphics:
#include "graphics.h"
and maybe who ever (I actually can't imagine who exactly) likes faked stdio functions may use
#include "fakedio.h" 
 
ok-
the last one admittedly was a joke (because this lib's size would extend  even the nxtdefs.h) - 
no, I'm kidding - 
but honestly, I think the rest might be a good idea... :)