Outputting into console without a newline?

Discuss any general programming issues here
Post Reply
jalih
Posts: 281
Joined: Fri Jun 18, 2010 8:08 pm
Location: Finland

Outputting into console without a newline?

Post by jalih »

Is it possible to output a character into console without outputting a newline. My interpreter would need such a functionality.
jalih
Posts: 281
Joined: Fri Jun 18, 2010 8:08 pm
Location: Finland

Re: Outputting into console without a newline?

Post by jalih »

Initial version is running and outputting into screen for now.
Bugala
Posts: 1400
Joined: Sun Feb 14, 2010 7:11 pm

Re: Outputting into console without a newline?

Post by Bugala »

you probably know this already, but would a workaround of joinig strings together work out?

example:

Code: Select all

x=1
y=2
string="X:"..x.."Y:"..y
debugprint(string)
jalih
Posts: 281
Joined: Fri Jun 18, 2010 8:08 pm
Location: Finland

Re: Outputting into console without a newline?

Post by jalih »

Bugala wrote:you probably know this already, but would a workaround of joining strings together work out?
That won't work as the interpreters simple virtual machine is executing a byte code, where printing of a string literal is encoded as a sequence of 'wrc character' op-codes to print character at a time followed by a 'wrl' op-code to print the line feed at the end.

I will add a string and real data types in the near future. Also Pascal style grammar will probably change into something more REXX like. Arrays will be implemented using stem array style notation:

Code: Select all

array1.10: integer;
array2.20.20: integer;
jalih
Posts: 281
Joined: Fri Jun 18, 2010 8:08 pm
Location: Finland

Re: Outputting into console without a newline?

Post by jalih »

Here is a little compiled demo for testing purposes on AmigaOS4, MorphOS and Windows.

It takes "-i filename" as parameter and test.pas and primes.pas files are included for testing purposes.
User avatar
airsoftsoftwair
Posts: 5887
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

Re: Outputting into console without a newline?

Post by airsoftsoftwair »

jalih wrote:Is it possible to output a character into console without outputting a newline. My interpreter would need such a functionality.
Unfortunately, it isn't. If you had asked this two weeks earlier, I could have implemented it for 6.0 because it's obviously pretty trivial but now I'm afraid you'll have to wait until the next update...
Post Reply