Python Forum
expressing an 8-bit ASCII code - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Forum & Off Topic (https://python-forum.io/forum-23.html)
+--- Forum: Bar (https://python-forum.io/forum-27.html)
+--- Thread: expressing an 8-bit ASCII code (/thread-23736.html)



expressing an 8-bit ASCII code - Skaperen - Jan-15-2020

every possible unambiguous way people might want to express one of the 256 possible byte codes, where the first 128 are ASCII codes, i want to be able to support. probably the most well known example is \n which is the value 10, ASCII newline. i will be reviewing past code i have written to convert a stream of the expression to a stream of 8-bit bytes. it already supports raw printable characters except for \ and ^, 3 digit octal escape sequences for all 256 possible values, \0 not followed by a digit, common single character backslash sequences \a (7), \b (8), \t (9), \n (10), \v (11), \f (12), \r (13), 59 common single character carat sequences, 26 upper case letters, 26 lower case letters, and 7 special characters, and 4 special sequences to produce \ and ^.

are there any others that would be suggested?

my intent is to make this into its own module.


RE: expressing an 8-bit ASCII code - DeaD_EyE - Jan-15-2020

I miss EOT. If you're in a Terminal, you can use CTRL+D, which interpreted and fires a EOT, which closes the Terminal.
Another example is CTRL+L, which clears the screen in a Terminal. It's 0x0C.


RE: expressing an 8-bit ASCII code - Skaperen - Jan-16-2020

EOT is handled by the pty emulation. the terminal program just sends byte value 4 to the pty emulation. it is that emulation that converts it to end-of-file. the shell gets the EOF. Today's shells require several EOF events. Classical shells will exit upon just one such event. that exit by the shell sends SIGCHLD to the terminal. or the terminal gets EOF from the side of the PTY it's reading to get shell session output. then the terminal window closes. same action. same effect. now days just type in the shell command "exit" or hold Ctrl+D to let it repeat.

on IBM mainframes, in VM/CP, i found a bug where any "ASCII" terminal doing EOT followed rapidly by BREAK would cause the entire system to freeze requiring a reboot (IPL). the terminal did not even need to be logged in so anyone could dial up the mainframe if they had ASCII dial up and freeze the whole system. once i got the source code, i wrote a patch to fix the bug and sent it to IBM. they accepted it. the new effect took that particular terminal offline and gave the main operator a message of what happened.