public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* Looking for an ANSI Control Character header
@ 2013-12-29 21:59 Kevin Ingwersen
  2013-12-30  0:29 ` Tim Prince
  0 siblings, 1 reply; 5+ messages in thread
From: Kevin Ingwersen @ 2013-12-29 21:59 UTC (permalink / raw)
  To: gcc-help

Hello!

I have been trying to use control sequences like "\x1b[1K“ within my programs. But due to different terminals, and the fact that Win32 doesnt perfectly support ANSI control characters, I wanted to ask if there is somewhere a way one can archive this.

The reason why i am asking here is, there is no such thing as an ncurses forum or so, where such question would be more right.

Kind regards
Ingwie

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Looking for an ANSI Control Character header
  2013-12-29 21:59 Looking for an ANSI Control Character header Kevin Ingwersen
@ 2013-12-30  0:29 ` Tim Prince
       [not found]   ` <8487D432-2245-4CE1-BBBB-B372EF5C7802@googlemail.com>
  0 siblings, 1 reply; 5+ messages in thread
From: Tim Prince @ 2013-12-30  0:29 UTC (permalink / raw)
  To: gcc-help


On 12/29/2013 04:58 PM, Kevin Ingwersen wrote:
>   due to different terminals, and the fact that Win32 doesnt perfectly support ANSI control characters, I wanted to ask if there is somewhere a way one can archive this.
>
Do you mean termcap?
http://www.gnu.org/software/termutils/manual/termcap-1.3/html_mono/termcap.html

"win32" is far too vague a heading.  How about using one of the current 
widely used Windows ports of termcap or ncurses (cygwin, MinGW, ....)

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Looking for an ANSI Control Character header
       [not found]   ` <8487D432-2245-4CE1-BBBB-B372EF5C7802@googlemail.com>
@ 2013-12-30  2:11     ` Kevin Ingwersen
  2013-12-30  7:16       ` Václav Zeman
  0 siblings, 1 reply; 5+ messages in thread
From: Kevin Ingwersen @ 2013-12-30  2:11 UTC (permalink / raw)
  To: Tim Prince; +Cc: gcc-help

Termcap looks interesting, but I can not find anything about the control characters I would like to use.
I am trying to find a library that’d give me the right escape sequence - or a function - to do certain things. Such as
- Deleting everything from the left/right of the curser
- Erasing a whole line, setting the cursor to the beginning of the line
- Starting / ending a color sequence
i know that ncurses can do the color part, but I couldn’t find any way to make it print soemthing like "\x1b[1K“ for me. I know, that on some terminals, the \x expects an octal value rather than a hexadecimal value. (i.e. \x033 vs. \x1b). So the library I am looking for just needs to give me the right sequence to use o.o
Do you know any?

Am Mo. Dez. 30 2013 01:28:53 schrieb Tim Prince:
> 
> On 12/29/2013 04:58 PM, Kevin Ingwersen wrote:
>>  due to different terminals, and the fact that Win32 doesnt perfectly support ANSI control characters, I wanted to ask if there is somewhere a way one can archive this.
>> 
> Do you mean termcap?
> http://www.gnu.org/software/termutils/manual/termcap-1.3/html_mono/termcap.html
> 
> "win32" is far too vague a heading.  How about using one of the current widely used Windows ports of termcap or ncurses (cygwin, MinGW, ....)


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Looking for an ANSI Control Character header
  2013-12-30  2:11     ` Kevin Ingwersen
@ 2013-12-30  7:16       ` Václav Zeman
  2013-12-30 17:31         ` Ángel González
  0 siblings, 1 reply; 5+ messages in thread
From: Václav Zeman @ 2013-12-30  7:16 UTC (permalink / raw)
  To: gcc-help

[-- Attachment #1: Type: text/plain, Size: 2016 bytes --]

On 12/30/2013 03:11 AM, Kevin Ingwersen wrote:
> Termcap looks interesting, but I can not find anything about the control characters I would like to use.
> I am trying to find a library that’d give me the right escape sequence - or a function - to do certain things. Such as
> - Deleting everything from the left/right of the curser
> - Erasing a whole line, setting the cursor to the beginning of the line
> - Starting / ending a color sequence
> i know that ncurses can do the color part, but I couldn’t find any way to make it print soemthing like "\x1b[1K“ for me. I know, that on some terminals, the \x expects an octal value rather than a hexadecimal value. (i.e. \x033 vs. \x1b). So the library I am looking for just needs to give me the right sequence to use o.o
> Do you know any?

As far as I know, there is nothing else but curses/ncurses that can do that.

One possible approach is to parse terminfo's terminal specifications
yourself. You have the choice of parsing the compiled binary files or
the source files. However, if you succeed with the parsing, it is IMO
non-trivial to actually utilize the information that you get; you will
need interpreter of the terminal handling "instructions" as well.

IOW, I have tried once the same as you are trying now but I have given
up, when I was confronted with the size of the task. That said, by all
means, try for yourself, maybe you are a lot more tenacious than I was.

> 
> Am Mo. Dez. 30 2013 01:28:53 schrieb Tim Prince:
>>
>> On 12/29/2013 04:58 PM, Kevin Ingwersen wrote:
>>>  due to different terminals, and the fact that Win32 doesnt perfectly support ANSI control characters, I wanted to ask if there is somewhere a way one can archive this.
>>>
>> Do you mean termcap?
>> http://www.gnu.org/software/termutils/manual/termcap-1.3/html_mono/termcap.html
>>
>> "win32" is far too vague a heading.  How about using one of the current widely used Windows ports of termcap or ncurses (cygwin, MinGW, ....)

-- 
VZ



[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 295 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Looking for an ANSI Control Character header
  2013-12-30  7:16       ` Václav Zeman
@ 2013-12-30 17:31         ` Ángel González
  0 siblings, 0 replies; 5+ messages in thread
From: Ángel González @ 2013-12-30 17:31 UTC (permalink / raw)
  To: gcc-help

I think you are out of luck for Windows. If I remember right, for some 
"escape sequences" you actually need to perform function calls in order 
to get the win32 console do the requested action.
My approach was to define myself the escape codes I used in a header 
with those macros set to the empty string for windows. OTOH, I never 
attempted to support every terminal. Too daunting for just the bit of 
console sugar I was adding. But the direction would indeed be parsing 
the terminfo files.


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2013-12-30 17:31 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-12-29 21:59 Looking for an ANSI Control Character header Kevin Ingwersen
2013-12-30  0:29 ` Tim Prince
     [not found]   ` <8487D432-2245-4CE1-BBBB-B372EF5C7802@googlemail.com>
2013-12-30  2:11     ` Kevin Ingwersen
2013-12-30  7:16       ` Václav Zeman
2013-12-30 17:31         ` Ángel González

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).