summaryrefslogtreecommitdiff
path: root/ipl/procs/asciinam.icn
blob: 44cfe9373c28b4a70f124c8eb4b8f290b8540adf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
############################################################################
#
#	File:     asciinam.icn
#
#	Subject:  Procedure for ASCII name of unprintable character
#
#	Author:   Robert J. Alexander
#
#	Date:     August 14, 1996
#
############################################################################
#
#   This file is in the public domain.
#
############################################################################
#
#  asciiname(s) returns the mnemonic name of the single unprintable
#  ASCII character s.
#
############################################################################

procedure asciiname(s)
   local o
   static names
   initial {
      names := ["NUL","SOH","STX","ETX","EOT","ENQ","ACK","BEL",
		"BS" ,"HT" ,"NL" ,"VT" ,"NP" ,"CR" ,"SO" ,"SI" ,
		"DLE","DC1","DC2","DC3","DC4","NAK","SYN","ETB",
		"CAN","EM" ,"SUB","ESC","FS" ,"GS" ,"RS" ,"US" ]
      }
   o := ord(s)
   return names[o + 1] | (if o = 127 then "DEL")
end