1a5ae21e4Smrg#!/usr/bin/env perl
204b94745Smrg# $XTermId: vt52chars.pl,v 1.1 2019/07/08 20:27:21 tom Exp $
3a5ae21e4Smrg# -----------------------------------------------------------------------------
4a5ae21e4Smrg# Copyright 2019 by Thomas E. Dickey
5a5ae21e4Smrg#
6a5ae21e4Smrg#                         All Rights Reserved
7a5ae21e4Smrg#
8a5ae21e4Smrg# Permission is hereby granted, free of charge, to any person obtaining a
9a5ae21e4Smrg# copy of this software and associated documentation files (the
10a5ae21e4Smrg# "Software"), to deal in the Software without restriction, including
11a5ae21e4Smrg# without limitation the rights to use, copy, modify, merge, publish,
12a5ae21e4Smrg# distribute, sublicense, and/or sell copies of the Software, and to
13a5ae21e4Smrg# permit persons to whom the Software is furnished to do so, subject to
14a5ae21e4Smrg# the following conditions:
15a5ae21e4Smrg#
16a5ae21e4Smrg# The above copyright notice and this permission notice shall be included
17a5ae21e4Smrg# in all copies or substantial portions of the Software.
18a5ae21e4Smrg#
19a5ae21e4Smrg# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
20a5ae21e4Smrg# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
21a5ae21e4Smrg# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
22a5ae21e4Smrg# IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY
23a5ae21e4Smrg# CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
24a5ae21e4Smrg# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
25a5ae21e4Smrg# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
26a5ae21e4Smrg#
27a5ae21e4Smrg# Except as contained in this notice, the name(s) of the above copyright
28a5ae21e4Smrg# holders shall not be used in advertising or otherwise to promote the
29a5ae21e4Smrg# sale, use or other dealings in this Software without prior written
30a5ae21e4Smrg# authorization.
31a5ae21e4Smrg# -----------------------------------------------------------------------------
32a5ae21e4Smrg# show the vt52 graphic characters, annotatated in a table.
33a5ae21e4Smrg
34a5ae21e4Smrgsub clear() {
35a5ae21e4Smrg    printf "\033H";    # home
36a5ae21e4Smrg    printf "\033J";    # erase
37a5ae21e4Smrg}
38a5ae21e4Smrg
39a5ae21e4Smrgsub move($$) {
40a5ae21e4Smrg    my $y = shift;
41a5ae21e4Smrg    my $x = shift;
42a5ae21e4Smrg    printf "\033Y%c%c", $y + 32, $x + 32;
43a5ae21e4Smrg}
44a5ae21e4Smrg
45a5ae21e4Smrgsub start_vt52() {
46a5ae21e4Smrg    printf "\033[?2l";
47a5ae21e4Smrg}
48a5ae21e4Smrg
49a5ae21e4Smrgsub stop_vt52() {
50a5ae21e4Smrg    printf "\033<";
51a5ae21e4Smrg}
52a5ae21e4Smrg
53a5ae21e4Smrgsub show_char() {
54a5ae21e4Smrg    my $value  = shift;
55a5ae21e4Smrg    my $string = shift;
56a5ae21e4Smrg    my $chr    = $value - 0140;
57a5ae21e4Smrg    return if ( $chr < 0 );    # not supported by xterm
58a5ae21e4Smrg    $value &= 0xff;
59a5ae21e4Smrg    my $y = 2 + int( $chr % 16 );
60a5ae21e4Smrg    my $x = 6 + int( $chr / 16 ) * 40;
61a5ae21e4Smrg    &move( $y, $x );
62a5ae21e4Smrg    printf "%03o \033F%s\033G %s", $value, chr($value), $string;
63a5ae21e4Smrg}
64a5ae21e4Smrg
65a5ae21e4Smrgsub show_table() {
66a5ae21e4Smrg    &clear;
67a5ae21e4Smrg    &move( 0, 28 );
68a5ae21e4Smrg    printf "VT52 graphic characters";
69a5ae21e4Smrg    &show_char( 0140, "reserved" );
70a5ae21e4Smrg    &show_char( 0141, "solid rectangle" );
71a5ae21e4Smrg    &show_char( 0142, "1/" );
72a5ae21e4Smrg    &show_char( 0143, "3/" );
73a5ae21e4Smrg    &show_char( 0144, "5/" );
74a5ae21e4Smrg    &show_char( 0145, "7/" );
75a5ae21e4Smrg    &show_char( 0146, "degrees" );
76a5ae21e4Smrg    &show_char( 0147, "plus or minus" );
77a5ae21e4Smrg    &show_char( 0150, "right arrow" );
78a5ae21e4Smrg    &show_char( 0151, "ellipsis" );
79a5ae21e4Smrg    &show_char( 0152, "divide by" );
80a5ae21e4Smrg    &show_char( 0153, "down arrow" );
81a5ae21e4Smrg    &show_char( 0154, "bar at scan 0" );
82a5ae21e4Smrg    &show_char( 0155, "bar at scan 1" );
83a5ae21e4Smrg    &show_char( 0156, "bar at scan 2" );
84a5ae21e4Smrg    &show_char( 0157, "bar at scan 3" );
85a5ae21e4Smrg    &show_char( 0160, "bar at scan 4" );
86a5ae21e4Smrg    &show_char( 0161, "bar at scan 5" );
87a5ae21e4Smrg    &show_char( 0162, "bar at scan 6" );
88a5ae21e4Smrg    &show_char( 0163, "bar at scan 7" );
89a5ae21e4Smrg    &show_char( 0164, "subscript 0" );
90a5ae21e4Smrg    &show_char( 0165, "subscript 1" );
91a5ae21e4Smrg    &show_char( 0166, "subscript 2" );
92a5ae21e4Smrg    &show_char( 0167, "subscript 3" );
93a5ae21e4Smrg    &show_char( 0170, "subscript 4" );
94a5ae21e4Smrg    &show_char( 0171, "subscript 5" );
95a5ae21e4Smrg    &show_char( 0172, "subscript 6" );
96a5ae21e4Smrg    &show_char( 0173, "subscript 7" );
97a5ae21e4Smrg    &show_char( 0174, "subscript 8" );
98a5ae21e4Smrg    &show_char( 0175, "subscript 9" );
99a5ae21e4Smrg    &show_char( 0176, "paragraph" );
100a5ae21e4Smrg    &move( 19, 6 );
101a5ae21e4Smrg    printf "BAR[\033F\154\155\156\157\160\161\162\163\033G]";
102a5ae21e4Smrg    &move( 23, 0 );
103a5ae21e4Smrg}
104a5ae21e4Smrg
105a5ae21e4Smrg&start_vt52;
106a5ae21e4Smrg&show_table;
107a5ae21e4Smrg&stop_vt52;
108a5ae21e4Smrg
109a5ae21e4Smrg1;
110