describe(3f) - [M_strings:DESCRIBE] returns a string describing the name of
a single character
(LICENSE:PD)
function describe(ch) result (string)
character(len=1),intent(in) :: ch
character(len=:),allocatable :: string
describe(3f) returns a string describing long name of a single
character
Sample Program:
program demo_describe
use M_strings, only : describe
implicit none
integer :: i
do i=1,128 ! fill variable with base ASCII character set
write(*,*)describe(char(i-1))
enddo
end program demo_describe
Expected output
ctrl-@ or ctrl-? (NUL) null
ctrl-A (SOH) start of heading
ctrl-B (STX) start of text
ctrl-C (ETX) end of text
ctrl-D (EOT) end of transmission
ctrl-E (ENQ) enquiry
ctrl-F (ACK) acknowledge
ctrl-G (BEL) bell
ctrl-H (BS) backspace
ctrl-I (HT) horizontal tabulation
ctrl-J (LF) line feed
ctrl-K (VT) vertical tabulation
ctrl-L (FF) form feed
ctrl-M (CR) carriage return
ctrl-N (SO) shift out
ctrl-O (SI) shift in
ctrl-P (DLE) data link escape
ctrl-Q (DC1) device control 1
ctrl-R (DC2) device control 2
ctrl-S (DC3) device control 3
ctrl-T (DC4) device control 4
ctrl-U (NAK) negative acknowledge
ctrl-V (SYN) synchronous idle
ctrl-W (ETB) end of transmission block
ctrl-X (CAN) cancel
ctrl-Y (EM) end of medium
ctrl-Z (SUB) substitute
ctrl-[ (ESC) escape
ctrl-\ or ctrl-@ (FS) file separator
ctrl-] (GS) group separator
ctrl-^ or ctrl-= (RS) record separator
ctrl-_ (US) unit separator
space
! exclamation point
" quotation marks
# number sign
$ currency symbol
% percent
& ampersand
' apostrophe
( left parenthesis
) right parenthesis
* asterisk
+ plus
, comma
- minus
. period
/ slash
0 zero
1 one
2 two
3 three
4 four
5 five
6 six
7 seven
8 eight
9 nine
: colon
; semicolon
< less than
= equals
> greater than
? question mark
@ at sign
majuscule A
majuscule B
majuscule C
majuscule D
majuscule E
majuscule F
majuscule G
majuscule H
majuscule I
majuscule J
majuscule K
majuscule L
majuscule M
majuscule N
majuscule O
majuscule P
majuscule Q
majuscule R
majuscule S
majuscule T
majuscule U
majuscule V
majuscule W
majuscule X
majuscule Y
majuscule Z
[ left bracket
\ backslash
] right bracket
^ caret
_ underscore
` grave accent
miniscule a
miniscule b
miniscule c
miniscule d
miniscule e
miniscule f
miniscule g
miniscule h
miniscule i
miniscule j
miniscule k
miniscule l
miniscule m
miniscule n
miniscule o
miniscule p
miniscule q
miniscule r
miniscule s
miniscule t
miniscule u
miniscule v
miniscule w
miniscule x
miniscule y
miniscule z
{ left brace
| vertical line
} right brace
~ tilde
ctrl-? (DEL) delete
John S. Urban
Public Domain
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(len=1), | intent(in) | :: | ch |
function describe(ch) result (string)
! ident_61="@(#) M_strings describe(3f) return string describing long name of a single character"
character(len=1),intent(in) :: ch
character(len=:),allocatable :: string
! LATER: add hex, octal, decimal, key-press description, alternate names
! ASCII character codes
select case (iachar(ch))
case( 0 ); STRING="ctrl-@ or ctrl-? (NUL) null"
case( 1 ); STRING="ctrl-A (SOH) start of heading"
case( 2 ); STRING="ctrl-B (STX) start of text"
case( 3 ); STRING="ctrl-C (ETX) end of text"
case( 4 ); STRING="ctrl-D (EOT) end of transmission"
case( 5 ); STRING="ctrl-E (ENQ) enquiry"
case( 6 ); STRING="ctrl-F (ACK) acknowledge"
case( 7 ); STRING="ctrl-G (BEL) bell"
case( 8 ); STRING="ctrl-H (BS) backspace"
case( 9 ); STRING="ctrl-I (HT) horizontal tabulation"
case( 10 ); STRING="ctrl-J (LF) line feed"
case( 11 ); STRING="ctrl-K (VT) vertical tabulation"
case( 12 ); STRING="ctrl-L (FF) form feed"
case( 13 ); STRING="ctrl-M (CR) carriage return"
case( 14 ); STRING="ctrl-N (SO) shift out"
case( 15 ); STRING="ctrl-O (SI) shift in"
case( 16 ); STRING="ctrl-P (DLE) data link escape"
case( 17 ); STRING="ctrl-Q (DC1) device control 1"
case( 18 ); STRING="ctrl-R (DC2) device control 2"
case( 19 ); STRING="ctrl-S (DC3) device control 3"
case( 20 ); STRING="ctrl-T (DC4) device control 4"
case( 21 ); STRING="ctrl-U (NAK) negative acknowledge"
case( 22 ); STRING="ctrl-V (SYN) synchronous idle"
case( 23 ); STRING="ctrl-W (ETB) end of transmission block"
case( 24 ); STRING="ctrl-X (CAN) cancel"
case( 25 ); STRING="ctrl-Y (EM) end of medium"
case( 26 ); STRING="ctrl-Z (SUB) substitute"
case( 27 ); STRING="ctrl-[ (ESC) escape"
case( 28 ); STRING="ctrl-\ or ctrl-@ (FS) file separator"
case( 29 ); STRING="ctrl-] (GS) group separator"
case( 30 ); STRING="ctrl-^ or ctrl-= (RS) record separator"
case( 31 ); STRING="ctrl-_ (US) unit separator"
case( 32 ); STRING="space"
case( 33 ); STRING="! exclamation point (screamer, gasper, slammer, startler, bang, shriek, pling)"
case( 34 ); STRING=""" quotation marks"
case( 35 ); STRING="# number sign (hash, pound sign, hashtag)"
case( 36 ); STRING="$ currency symbol"
case( 37 ); STRING="% percent"
case( 38 ); STRING="& ampersand"
case( 39 ); STRING="' apostrophe"
case( 40 ); STRING="( left parenthesis"
case( 41 ); STRING=") right parenthesis"
case( 42 ); STRING="* asterisk"
case( 43 ); STRING="+ plus"
case( 44 ); STRING=", comma"
case( 45 ); STRING="- minus"
case( 46 ); STRING=". period"
case( 47 ); STRING="/ slash"
case( 48 ); STRING="0 zero"
case( 49 ); STRING="1 one"
case( 50 ); STRING="2 two"
case( 51 ); STRING="3 three"
case( 52 ); STRING="4 four"
case( 53 ); STRING="5 five"
case( 54 ); STRING="6 six"
case( 55 ); STRING="7 seven"
case( 56 ); STRING="8 eight"
case( 57 ); STRING="9 nine"
case( 58 ); STRING=": colon"
case( 59 ); STRING="; semicolon"
case( 60 ); STRING="< less than"
case( 61 ); STRING="= equals"
case( 62 ); STRING="> greater than"
case( 63 ); STRING="? question mark"
case( 64 ); STRING="@ at sign"
case( 65 ); STRING="A majuscule A"
case( 66 ); STRING="B majuscule B"
case( 67 ); STRING="C majuscule C"
case( 68 ); STRING="D majuscule D"
case( 69 ); STRING="E majuscule E"
case( 70 ); STRING="F majuscule F"
case( 71 ); STRING="G majuscule G"
case( 72 ); STRING="H majuscule H"
case( 73 ); STRING="I majuscule I"
case( 74 ); STRING="J majuscule J"
case( 75 ); STRING="K majuscule K"
case( 76 ); STRING="L majuscule L"
case( 77 ); STRING="M majuscule M"
case( 78 ); STRING="N majuscule N"
case( 79 ); STRING="O majuscule O"
case( 80 ); STRING="P majuscule P"
case( 81 ); STRING="Q majuscule Q"
case( 82 ); STRING="R majuscule R"
case( 83 ); STRING="S majuscule S"
case( 84 ); STRING="T majuscule T"
case( 85 ); STRING="U majuscule U"
case( 86 ); STRING="V majuscule V"
case( 87 ); STRING="W majuscule W"
case( 88 ); STRING="X majuscule X"
case( 89 ); STRING="Y majuscule Y"
case( 90 ); STRING="Z majuscule Z"
case( 91 ); STRING="[ left bracket"
case( 92 ); STRING="\ backslash"
case( 93 ); STRING="] right bracket"
case( 94 ); STRING="^ caret"
case( 95 ); STRING="_ underscore"
case( 96 ); STRING="` grave accent"
case( 97 ); STRING="a miniscule a"
case( 98 ); STRING="b miniscule b"
case( 99 ); STRING="c miniscule c"
case( 100 ); STRING="d miniscule d"
case( 101 ); STRING="e miniscule e"
case( 102 ); STRING="f miniscule f"
case( 103 ); STRING="g miniscule g"
case( 104 ); STRING="h miniscule h"
case( 105 ); STRING="i miniscule i"
case( 106 ); STRING="j miniscule j"
case( 107 ); STRING="k miniscule k"
case( 108 ); STRING="l miniscule l"
case( 109 ); STRING="m miniscule m"
case( 110 ); STRING="n miniscule n"
case( 111 ); STRING="o miniscule o"
case( 112 ); STRING="p miniscule p"
case( 113 ); STRING="q miniscule q"
case( 114 ); STRING="r miniscule r"
case( 115 ); STRING="s miniscule s"
case( 116 ); STRING="t miniscule t"
case( 117 ); STRING="u miniscule u"
case( 118 ); STRING="v miniscule v"
case( 119 ); STRING="w miniscule w"
case( 120 ); STRING="x miniscule x"
case( 121 ); STRING="y miniscule y"
case( 122 ); STRING="z miniscule z"
case( 123 ); STRING="{ left brace"
case( 124 ); STRING="| vertical line"
case( 125 ); STRING="} right brace"
case( 126 ); STRING="~ tilde"
case( 127 ); STRING="ctrl-? (DEL) delete"
case default
STRING='UNKNOWN'//v2s(IACHAR(ch))
end select
end function describe