PDA

View Full Version : ICCV7 STDIO Terminal Control Compatibility Problems



TJHJ
03-31-2009, 11:25 PM
Ok So I suspect that this might be from my own fault but if anyone has any suggestions or ideas.

I am having a hard time making any terminal program universal. Personally I like to use the PST terminal over the built in ICCv7 terminal, but in order to have it display correctly in one it shows up all messed up in the other.

Example.




putchar(0); // Clear the screen
printf("Some String %c", 13); // Some string followed by a CR
printf("Some more string %c", 13); // More stuff followed by a CR




Ok in the PST this comes out correctly, in the ICCv7 terminal the CR command does not seem to create a new line. It just prints all the lines on top of each other.





putchar(0); // Clear the screen
printf("Some String %c", '\n'); // Some string followed by a new line
printf("Some more string %c", '\n'); // More stuff followed by a new line





This code seems to make ICCv7 Show correctly but makes PST show up strange.




here is what I get in PST

Some String
Some More string
The next new line starts printing here.






Any suggestions or ideas?

Thanks
TJ

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
I owe everyone here a bunch, So thanks again for answering my dumb questions.
Projects. RG500 ECU system. PropCopter. Prop CanSat. Prop Paste Gun.
Suzuki RG500 in a RGV 250 frame.
Bimota V-Due (Running on the fuel injection system)
Aprilia RS250

WNed
04-01-2009, 12:01 AM
The weird line run-on in PST is caused by the fact that what we think of as "Enter" (ASCII 13) is actually two control characters - \n (new line), and \r (carriage return). So both terminals are doing what they're told, but the "return" is lost in your translation...

Try - printf("Some more string %c", '\n\r'); // More stuff followed by a new line plus carriage return

Ned

p.s. - To understand the logic behind the use of two control characters, you can visit a museum and watch an old Teletype in action. Moving the paper and moving the print head are two distinct tasks.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
"They may have computers, and other weapons of mass destruction." - Janet Reno

Post Edited (WNed) : 3/31/2009 4:13:10 PM GMT

ImageCraft
04-01-2009, 02:42 AM
Tools->EnvOptions->Terminal

You can set how the terminal should interpret LF or CR.

Joćo Geada
04-01-2009, 11:13 AM
Return being 2 control characters applies only to unwashed masses stuck with M$ technology.
On Unix machines (and that includes Macs & Linux) it is just 1 character just like god intended http://forums.parallax.com/images/smilies/smile.gif

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
---
Joćo

WNed
04-01-2009, 11:55 AM
Au Contraire,
Control codes date back to the days of PDP-11's and model 33 Teletype's. I've owned both and feel justified in my objection to being thrown in with the unwashed masses. I may be unclean, but that's a story for a different time. The point is to make the distinction between ASCII characters and control codes. In fact, the original Kernighan and Ritchie C used the same control codes, and they weren't thinking about how well it would run under Windows, since Bill Gates was just dropping out of college at the time.
So come Sunday, you sit down and pray that god forgives you blaspheming about his control codes, and the sanctity of *nix. http://forums.parallax.com/images/smilies/freaked.gif

Ned

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
"They may have computers, and other weapons of mass destruction." - Janet Reno

shanghai_fool
04-01-2009, 11:57 AM
Sorry Joćo,
The 2 separate functions of carriage return and line feed predates Unix by 9+ years and M$ by much more. Having grown up with Baudot and teletypes, I appreciated the individual functions especially when printing tables. A linefeed and backspace was much more efficient than sending lots of spaces and saved a lot of paper tape.

WNed
04-01-2009, 01:48 PM
Shanghai_fool,
Saved all that paper tape so you could use it to punch out "Merry Christmas" and "Happy Birthday" streamers, didn't you... come on, at least once...

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
"They may have computers, and other weapons of mass destruction." - Janet Reno

shanghai_fool
04-01-2009, 02:59 PM
Yeah, but we could run them through magnets, jump up and down on them and still be able to read them. Punch cards also. The ones made from Mylar were practically industructable. They would melt, however, if heated enough.

I remember having to "read" mag tape with a fluid of iron dust. No power. Just put the tape under the glass, wiggle it a little and presto, you could see the bit pattern.
I'm not sure I would call them "the good old days" though. But a 3 platter 12" disk could hold a whopping 10 Megabytes. Thats actually quite a lot of raw text.

Joćo Geada
04-03-2009, 02:51 AM
LOL, agreed with all. I also used teletypes (though luckily for only 1 year) and completely missed out on the punch cards and paper tape
by a hair's breath. Worked at TJ Watson for a while and the museum has some amazing mechanical contraptions to move paper tape
faster than any kind of paper should ever move. Jaw dropping.
But still think that in the age of crts and lcds, that is one useless character at the end of every line. But that's just when I want to
tweak people about even just plain text files can look utterly different across different OSes

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
---
Joćo