Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!

How to? How do you escape the escape character?

Sep
5
0
TCC LE 13.06.77 x64 Windows 7 [Version 6.1.7601]

How can I escape the escape character "^". I can't seem to change it because everything in the Option | Advanced | Special Character group is dimmed and won't let me change anything.

I need to specify a regular expression that uses "^" as an arg to a program, but without being able to escape the ^ I'm stuck.
 
In general, escape it thus: ^^

Various situations (depending on how many times TCC is going to parse it) might require ^^^^ or ^^^^^^^^.

Parentheses can protect it, and depending on how the program gets its args, the parentheses may stay or go. The usual "C" argc/argv mechanism will remove them.

Code:
v:\> u:\EchoArgs.exe ^^ foo
u:\EchoArgs.exe
^
foo

v:\> u:\EchoArgs.exe "^" foo
u:\EchoArgs.exe
^
foo
 
How can I escape the escape character "^". I can't seem to change it because everything in the Option | Advanced | Special Character group is dimmed and won't let me change anything.

That's odd; I wonder whether it's intentional.

You can change the escape character temporarily with SETDOS /E. If you change it to something weird, you may also want to create a keystroke alias, to make it easier to type:

Code:
rem  Set escape character to the currency symbol:
setdos /e0xa4
alias @alt-e=%@char[0xff]%@char[0xa4]

(Edit: Doesn't work quite the way I remember. For some reason which I don't understand, you need an editor escape (hex FF) before the syntax escape....)
 
Last edited:
That's odd; I wonder whether it's intentional.
I thought so too, but the help page for the option dialog's "Advanced" tab says, of special characters, "Not in LE".

Neither does the "EscapeChar" INI directive work.

I also noticed that in TCC 16, the Option\Advanced\SpecialCharacters dialog won't let you specify a key combination; it only accepts a single keystroke. But the "EscapeChar" directive works. I successfully made it Ctrl-g but I couldn't (oddly) make it Ctrl-x. TCC 16 seems to completely ignore Ctrl-x. With 4NTv8, Ctrl-x gives the up-arrow symbol and EscapeChar=Ctrl-x works. I'll ask about that in the support forum.
 
Neither does the "EscapeChar" INI directive work.

EscapeChar works fine for me, at least as long as I don't go past character 0xFF. Higher characters have issues; I guess Rex didn't intend the directive to support weird Unicode glyphs.
 
EscapeChar works fine for me, at least as long as I don't go past character 0xFF. Higher characters have issues; I guess Rex didn't intend the directive to support weird Unicode glyphs.
It works in LE? Can you "EscapeChar=Ctrl-X" in LE or even v16?
 
It works in LE? Can you "EscapeChar=Ctrl-X" in LE or even v16?

Much to my amazement, I can! ....Once I remembered how to put a control character into a text file. (Use ye olde EDIT.COM; press Control-P, then Control-X.)

But in retrospect, I guess it makes sense that that is allowed. 4DOS used Control-X as its escape, didn't it?
 
Much to my amazement, I can! ....Once I remembered how to put a control character into a text file. (Use ye olde EDIT.COM; press Control-P, then Control-X.)

But in retrospect, I guess it makes sense that that is allowed. 4DOS used Control-X as its escape, didn't it?
My v16 inifile is unicode. I just hex-edited it, changing 0x5E00 (^) to 0x1800 (char 24, Ctrl-x). That didn't work.
 
You can change the escape character temporarily with SETDOS /E. If you change it to something weird, you may also want to create a keystroke alias, to make it easier to type:
Code:
rem  Set escape character to the currency symbol:
setdos /e0xa4
alias @alt-e=%@char[0xff]%@char[0xa4]

Okay, thanks. I did:
Code:
setdos /e0x18
alias @alt-e=%@char[0xff]%@char[0x18]
to use Ctrl+x instead, and that seems to work.

I also happened to read "Command Line Editing" in the Help file which mentions the ALT-255 method of entering special chars. However, when I try entering ALT0255 I get a Ġ ? If I do ALT255 I get a space.

If I do ALT0164 I do get the ¤ symbol.

If I do ALT024 I get nothing?
 
I also happened to read "Command Line Editing" in the Help file which mentions the ALT-255 method of entering special chars. However, when I try entering ALT0255 I get a Ġ ? If I do ALT255 I get a space.

If I do ALT0164 I do get the ¤ symbol.

If I do ALT024 I get nothing?

This is Windows doing this. Your Alt-keypad number is interpreted differently, depending on whether or not you enter a leading zero. Without a leading zero, the number is interpreted according to the current console code page (probably 437, if you're in the U.S.) With a leading zero, the number is ... Unicode? Or the current Windows code page? I forget.
 
Back
Top