Print Command

I was trying to keep the language 'clean' and not have commands like PRINT that were so tied to the compiler.  PRINT really isn't a standard function.  The compiler constructs a special parameter list based on the type of the parameters passed and calls an assembly function (which is named _acprint).

The paramter list ends up looking like this:

print("hello", 1, 5.0, 3f);

_acprint(5, TYPE_STRING, &"hello", TYPE_INT, 1, TYPE_DOUBLE, 5.0, TYPE_FLOAT, 3f, TYPE_STRING, "\n");

Because windows are in classes now it wouldn't work directly with a window variable like it did in IBasic.  However the alternative is not too bad. A string printing function.

win1.DrawText(0,20, sprint("hello",1,5.0,3f));


sprint won't add the newline.  So you could use it directly with Write.  However fprint would be interesting.

The only thing left to work out is decimal places in the conversions of floats and double.  SETPRECISION wasn't named to intuitively.


We now have a print command.  Requires the parenthesis to keep it consistant.  Could have left them out but it just lookes weird

print("hello there ", "enter your name:", );


The only problem with me not adding the space before a number is you'll have to.

print(1.5," ",2.35);

That's true, but it's better to have to do something yourself than to not be able to do the alternative. With spaces added, there's no way to do print("#",1); coming out with #1 instead of # 1. I suppose NumToStr could be used, but the point of print is to eliminate that.


The only other contention I have with print is the byte type.

In IBasic Pro PRINT would print a character, and not the number.

print('a') ;

Prints a number currently since 'a' is converted to an INT by the lexer.


Post by: Mike Stefanik on February 26, 2006, 02:02:25 PM
I'd say that the current behavior (ie: 'a' is the integer value of the character "a") should be retained. It's consistent. Folks from the IBasic world looking into Aurora would just need to be made aware of the difference.


SetPrintDecimals(nPlaces);

Now contorls how many decimal places Print will output for float and double.  Like IBasic it defaults at 2. 

sprint now works.  Quite useful actually since you can format a window/printer output the same as a console.