"Fossies" - the Fresh Open Source Software Archive

Member "xterm-379/vttests/vt52chars.pl" (8 Jul 2019, 3696 Bytes) of package /linux/misc/xterm-379.tgz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Perl source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "vt52chars.pl" see the Fossies "Dox" file reference documentation.

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