Google
 

Trailing-Edge - PDP-10 Archives - SRI_NIC_PERM_SRC_1_19910112 - 6-sources/dixcst.bli
There are 21 other files named dixcst.bli in the archive. Click here to see a list.
%TITLE 'Library definitions for character conversion tables'

!  COPYRIGHT (C) DIGITAL EQUIPMENT CORPORATION 1983, 1985.
!  ALL RIGHTS RESERVED.
!  
!  THIS SOFTWARE IS FURNISHED UNDER A LICENSE AND MAY  BE  USED  AND
!  COPIED ONLY IN ACCORDANCE WITH THE TERMS OF SUCH LICENSE AND WITH
!  THE INCLUSION OF THE ABOVE COPYRIGHT NOTICE.   THIS  SOFTWARE  OR
!  ANY  OTHER  COPIES  THEREOF MAY NOT BE PROVIDED OR OTHERWISE MADE
!  AVAILABLE TO ANY OTHER PERSON.  NO TITLE TO AND OWNERSHIP OF  THE
!  SOFTWARE IS HEREBY TRANSFERRED.
!  
!  THE INFORMATION IN THIS SOFTWARE IS  SUBJECT  TO  CHANGE  WITHOUT
!  NOTICE  AND  SHOULD  NOT  BE CONSTRUED AS A COMMITMENT BY DIGITAL
!  EQUIPMENT CORPORATION.
!  
!  DIGITAL ASSUMES NO RESPONSIBILITY FOR THE USE OR  RELIABILITY  OF
!  ITS SOFTWARE ON EQUIPMENT THAT IS NOT SUPPLIED BY DIGITAL.

!++
! .chapter >DIXCST
! 
!   This file is the source for the library DIXCST.  This library
! defines the character conversion tables for all character sets known
! to the DIX string module.
! 
!   These are defined in a library so that an auxiliary program could be
! written which would search the library and print authoritative
! character conversion tables.  Also, putting the definitions in a
! library eliminates the necessity of compiling them every time the
! string module (DIXSTR) is compiled.
!--

LIBRARY 'DIXLIB';                       ! \.p;\ is used.
LIBRARY 'FIELDS';                       ! \.p;\ is used.

! ;   Library XPORT is used.

%BLISS32 (

LIBRARY 'SYS$LIBRARY:XPORT';

)
%BLISS36 (

LIBRARY 'BLI:XPORT';

)
%sbttl 'Edit History'                   ! [7] Add this entire subsection

!++
! .hl 1 Edit History
!
!   The edit history/version number information in this file is used
! to build a literal, dix$k_dixcst_version, giving the full version
! information.  Modules that use this library (in particular, the
! DIXSTR module) should make an OWN location called
! dix$g_dixcst_version and initialize it to dix$k_dixcst_version.
! This makes it possible to tell at debug time what version of the
! library was actually compiled against.
!--

LIBRARY 'VERSION';

! ; .autotable

!++ COPY 

new_version (1, 0)

edit (7, '23-Aug-82', 'David Dyer-Bennet')
 %( Change version and revision standards everywhere.
    Files: All. )%

Edit (%O'30', '19-Jan-83', 'David Dyer-Bennet')
%(  Update copyright notices, add mark at end of edit histories.
)%

Edit (%O'35', '10-Mar-83', 'Charlotte L. Richardson')
%( Declare version 1.  All modules.
)%

new_version (1, 1)

new_version (2, 0)

Edit (%O'36', '11-Apr-84', 'Sandy Clemens')
%( Put all Version 2 DIX development files under edit control.  Some of
   the files listed below have major code edits, or are new modules.  Others
   have relatively minor changes, such as cleaning up a comment.
   FILES: COMDIX.VAX-COM, COMPDX.CTL, DIXCST.BLI, DIXDEB.BLI,
   DIXDN.BLI (NEW), DIXFBN.BLI, DIXFP.BLI, DIXGBL.BLI, DIXGEN.BLI,
   DIXHST.BLI, DIXINT.PR1, DIXINT.PR2, DIXLIB.BLI, DIXPD.BLI (NEW),
   DIXREQ.REQ, DIXSTR.BLI, DIXUTL.BLI, DXCM10.10-CTL, MAKDIXMSG.BLI,
   STAR36.BLI, VERSION.REQ.
)%

Edit (%O'50', '8-Oct-84', 'Sandy Clemens')
  %( Add new format of COPYRIGHT notice.  FILES:  ALL )%

! **EDIT**
!-- .autoparagraph

LITERAL
    dix$k_dixcst_version = version_number
        (major = major_version,
        minor = minor_version,
        edit_no = edit_number);

UNDECLARE 
    major_version, minor_version, edit_number, sequence_check_edits;
%SBTTL 'Character Set Tables (CST)'

!++
! .hl 1 Character set tables (>CST>)
!
!   Each of these tables defines one character set and its translation to the
! String Intermediate (SI) form, and vs.
!
!   The structure prefix for character set tables is CST.
!
!   Each table entry contains the information to go from its index character
! (the character whose code is its index into the table) to the proper SI
! character, and from an SI character (used as an index) to the appropriate
! character of the character set defined.
!
!   The SI form is ASCII for the printing characters and formatting controls.
! The other positions are arbitrary.
!--

! ; .HL 2 BLISS definition of CST format
! ; .literal
!++ copy

$field

    cst_fields =
	SET
	cst$v_to_si_char = [$byte],		! Equiv SI char for this index
	cst$v_to_si_valid = [$bit],		! Set if conversion is "valid"
	cst$v_to_si_format_err = [$bit],	! Set if conversion doesn't 
                                                ! preserve formatting
	cst$v_to_si_noprint_err = [$bit],	! Set if conversion doesn't
                                                ! preserve nonprinting
	cst$v_to_si_graphic_err = [$bit],	! Set if conversion doesn't
                                                ! preserve graphic
    	cst$v_kludge = [$bit],			! Initialized to prevent overlap
	$align (WORD) blf$comma			! Force efficient alignment
	cst$v_to_typ_char = [$byte],    ! Equiv char set char for this index
	cst$v_to_typ_valid = [$bit],		! Set if conversion is "valid"
	cst$v_to_typ_format_err = [$bit],	! Set if conversion doesn't
                                                ! preserve formatting
	cst$v_to_typ_noprint_err = [$bit],	! Set if conversion doesn't 
                                                ! preserve non-printing
	cst$v_to_typ_graphic_err = [$bit]	! Set if conversion doesn't 
                                                ! preserve graphic
	TES;

LITERAL
    cst_size = $field_set_size,
    si$k_invalid = 26;                  ! ASCII SUB

!-- .end literal

!++
! .hl 1 Mechanism of definition
! 
!   The full details of the mechanism used in defining CST's are
! complicated.  This scheme was adopted because it is extremely
! powerful, and because the work of adding a new character set
! definition is very simple if approached in a cook-book fashion
! (recipes below).
! 
!   However, the price of this is that the mechanism is non-trivial.  If
! the mechanism itself breaks, you will need to understand it.
! Therefore a full explanation of it is included here.  Note, however,
! that if all you want to do is add a new character set, or change a few
! of the existing definitions, you don't need to know the full details.
! 
!   See the module that performs the actual string conversions (DIXSTR)
! for details of how the tables built here are used.
! 
!   Each character set is assigned a name.  This name must conform to
! the rules for BLISS names when appended to the end of a valid BLISS
! name.  Many of the macros used in defining character set tables take
! the character set name as a string literal as one of their arguments.
! It is a very important name.  Each string data type has, as one of its
! defining parameters, the name of the character set used to encode the
! data.  The association between the data types and the character sets
! is made solely in terms of the character set name.
! 
!   To define a character set, the following things must be done:
! .s 1.list 1
! .le;Select the character set name.
! .le;In file DIXCST, insert a definition of a macro DEF_CST_name, where
! "name" is the character set name selected.
! 
!   The body of the macro should consist of a series of calls to the
! macros LOC_DEF_TO_SI, LOC_DEF_TO_TYP, and DEF_SI_AND_TYP.  In all
! three cases the parameter list is the same -- see documentation on
! DEF_TO_SI or DEF_TO_TYP below.  LOC_DEF_TO_SI defines a conversion
! from the character set to SI.  LOC_DEF_TO_TYP defines a conversion
! from SI to the character set.  DEF_SI_AND_TYP does both.
! .le;After the definition of DEF_CST_name, place a call to COUNT_CST
! giving the name of the character set as the argument.
! .le;In file DIXSTR, place a call to BUILD_CST giving the character set
! name as the argument.  This expands to the actual conversion table.
! .end list
! 
!   In defining DEF_CST_name, be sure to include a conversion from SI
! >SI$K_INVALID>.  This is the SI code that will be presented if the
! source contains some invalid character. 
! 
!   The reason for the two "LOC" macros is as follows:  In the library
! pre-compilation of DIXCST, the DEF_CST_name macros are expanded once
! to find the maximum type and SI characters present in the table.  In
! the compilation of DIXSTR, the DEF_CST_name macros are expanded again
! to build the actual table initialization information.  These two
! different effects are obtained from expanding a single macro by
! establishing different defintions of the "LOC" macros in the two
! situations.  (DEF_SI_AND_TYP simply calls both "LOC" functions, so it
! needs no LOC definition).
!--


! ; .hl 2 Specific macros used

MACRO
    cst (table_size) =                  ! \.p;
    !
    ! ; Macro to define a CST of specified size.  Size should be MAX (max 
    ! ; type character, max SI character) + 1 .
    !
        BLOCKVECTOR [table_size, cst_size]   ! 
        FIELD (cst_fields)
    %,						! End CST definition
    cst_ref (addr, char_index, field_name) =    ! \.p;>
    !
    ! ; Make general structure reference to CST entry given necessary data.
    !
        BLOCKVECTOR [(addr), (char_index), field_name;  ! 
            1, cst_size]                ! Repetition count must be ctce, but is errelevant
    %,						! End cst_ref definition
    def_si_and_typ (char_index, si_index, format_err,   ! \.p;>
        print_err, graphic_err) =       ! \
    !
    ! ; This macro calls the local to-SI and to-TYP macros, one for each half
    ! ; of the 1-to-1 character conversion specified.
    !
        loc_def_to_si (char_index, si_index, format_err, print_err, graphic_err)
        loc_def_to_typ (char_index, si_index, format_err, print_err, graphic_err)
    %,						! End def_si_and_typ definition
    def_to_si (char_index, si_index, format_err,        ! \.p;>
        print_err, graphic_err) =       ! \
    !
    ! ; This macro generates preset-entries for the to-SI half of a character
    ! ; conversion.
    !
        [char_index, cst$v_to_si_char] = si_index,
        [char_index, cst$v_to_si_valid] = 1,
        [char_index, cst$v_to_si_format_err] = format_err,
        [char_index, cst$v_to_si_noprint_err] = print_err,
        [char_index, cst$v_to_si_graphic_err] = graphic_err,
    %,                                  ! End def_to_si definition
    def_to_typ (char_index, si_index, format_err,       ! \.p;>
        print_err, graphic_err) =       ! \
    !
    ! ; This macro generates preset-entries for the to-type half of a character
    ! ; conversion.
    !
        [si_index, cst$v_to_typ_char] = char_index,
        [si_index, cst$v_to_typ_valid] = 1,
        [si_index, cst$v_to_typ_format_err] = format_err,
        [si_index, cst$v_to_typ_noprint_err] = print_err,
        [si_index, cst$v_to_typ_graphic_err] = graphic_err,
    %,                                  ! End def_to_typ
    count_cst (char_set_name) =         ! \.p;>
    !
    ! ; This macro, when called with a valid character set name and a proper
    ! ; prior definition of DEF_CST_name, will define:
    ! ; .list 0, " "
    ! ; .le;CST$K_name_MAX          Max character code occurring in set
    ! ; .le;CST$K_name_SI_MAX       Max SI code assigned to character in set
    ! ; .end list
    !
        !
        ! First, go through that stack of data to determine maximum ASCII 
        ! and SI characters involved.
        !
        MACRO
            %QUOTE %QUOTE loc_def_to_si (typ_char, si_char, skp1, skp2, skp3) =
                %ASSIGN (si_max, MAX (si_max, si_char))
                %ASSIGN (typ_max, MAX (typ_max, typ_char)) 
            %QUOTE %,
            !
            ! Define to-typ to be same as to-si, since all we care about are
            ! the max values of some params, and they're in the same order
            ! for both.
            !
            %QUOTE %QUOTE loc_def_to_typ = loc_def_to_si
            %QUOTE %
        ;

        !
        ! Now, extract that information from the above table.
        !

        COMPILETIME
            si_max = 0,
            typ_max = 0;

        %NAME ('def_cst_', char_set_name)

        LITERAL
            %NAME ('cst$k_', char_set_name, '_max') = %NUMBER (typ_max),
            %NAME ('cst$k_', char_set_name, '_si_max') = %NUMBER (si_max);

        %PRINT (%NAME ('cst$k_', char_set_name, '_max'), '=',
            %NUMBER (%NAME ('cst$k_', char_set_name, '_max')))
        %PRINT (%NAME ('cst$k_', char_set_name, '_si_max'), '=', 
            %NUMBER (%NAME ('cst$k_', char_set_name, '_si_max')))

        UNDECLARE
            si_max,
            typ_max,
            %QUOTE %QUOTE loc_def_to_si,
            %QUOTE %QUOTE loc_def_to_typ;
    % ,					! End count_cst definition
    build_cst (char_set_name) =         ! \.p;>
    !++
    ! This macro, when called with a valid character set name and a proper
    ! prior definition of DEF_CST_name, CST$K_name_MAX, and CST$K_name_SI_MAX
    ! will define:
    ! .list  0, " "
    ! .le;DIX$ACST_name           CST for character set
    ! .end list
    !
    !   DEF_CST_name must be previously defined to call def_si_and_typ or 
    ! either of the local half-conversion macros passing
    ! character code, SI equivalent, and flags for format preservation
    ! error, non-printing preservation error, and graphic preservation error
    ! for each character in the character set.
    !--

        MACRO
            %QUOTE %QUOTE loc_def_to_si = %QUOTE %QUOTE def_to_si
                %QUOTE % ,
            %QUOTE %QUOTE loc_def_to_typ = %QUOTE %QUOTE def_to_typ
                %QUOTE % ;

        OWN                             ! ;   Place CST tables in OWN storage.
            %NAME ('dix$acst_', char_set_name) :
                cst (MAX (%NAME ('cst$k_', char_set_name, '_max'),
                    %NAME ('cst$k_', char_set_name, '_si_max')) + 1)
                                        ! Define character set table 
    		PSECT (readonly_psect)  ! \Assign to \.
                PRESET (                ! Begin PRESET
                %NAME ('def_cst_', char_set_name)
                [%NAME ('cst$k_', char_set_name, '_max'), cst$v_kludge] = 1 !
                                        ! Previous macro leaves trailing comma
                );                      ! End PRESET

        UNDECLARE                       ! Clean up our mess
            %QUOTE %QUOTE loc_def_to_si,
            %QUOTE %QUOTE loc_def_to_typ;

    %                                   ! End bld_cst definition
;                                       ! End MACRO statement
%SBTTL 'Define ASCII conversion table (dix$acst_ascii)'

!++
! .hl 1 Character set ASCII
!--

MACRO
    !
    ! Put all the ascii conversion information into a macro definition
    !
    def_cst_ascii =
        def_si_and_typ (  0,   0, 0, 0, 0)	! NUL
        def_si_and_typ (  1,   1, 0, 0, 0)	! (arbitrary)
        def_si_and_typ (  2,   2, 0, 0, 0)	! (arbitrary)
        def_si_and_typ (  3,   3, 0, 0, 0)	! (arbitrary)
        def_si_and_typ (  4,   4, 0, 0, 0)	! (arbitrary)
        def_si_and_typ (  5,   5, 0, 0, 0)	! (arbitrary)
        def_si_and_typ (  6,   6, 0, 0, 0)	! (arbitrary)
        def_si_and_typ (  7,   7, 0, 0, 0)	! BEL (ring bell)
        def_si_and_typ (  8,   8, 0, 0, 0)	! BS (backspace)
        def_si_and_typ (  9,   9, 0, 0, 0)	! HT (horizontal tab)
        def_si_and_typ ( 10,  10, 0, 0, 0)	! LF (line feed)
        def_si_and_typ ( 11,  11, 0, 0, 0)	! VT (vertical tab)
        def_si_and_typ ( 12,  12, 0, 0, 0)	! FF (form feed)
        def_si_and_typ ( 13,  13, 0, 0, 0)	! CR (carriage return)
        def_si_and_typ ( 14,  14, 0, 0, 0)	! (arbitrary)
        def_si_and_typ ( 15,  15, 0, 0, 0)	! (arbitrary)
        def_si_and_typ ( 16,  16, 0, 0, 0)	! (arbitrary)
        def_si_and_typ ( 17,  17, 0, 0, 0)	! (arbitrary)
        def_si_and_typ ( 18,  18, 0, 0, 0)	! (arbitrary)
        def_si_and_typ ( 19,  19, 0, 0, 0)	! (arbitrary)
        def_si_and_typ ( 20,  20, 0, 0, 0)	! (arbitrary)
        def_si_and_typ ( 21,  21, 0, 0, 0)	! (arbitrary)
        def_si_and_typ ( 22,  22, 0, 0, 0)	! (arbitrary)
        def_si_and_typ ( 23,  23, 0, 0, 0)	! (arbitrary)
        def_si_and_typ ( 24,  24, 0, 0, 0)	! (arbitrary)
        def_si_and_typ ( 25,  25, 0, 0, 0)	! (arbitrary)
        loc_def_to_si ( 26, si$k_invalid, 0, 0, 0)      ! SUB (invalid character)
        loc_def_to_typ ( 92, si$k_invalid, 0, 0, 1)     ! Invalid converts to "\"
        def_si_and_typ ( 27,  27, 0, 0, 0)	! ESC (escape sequence start)
        def_si_and_typ ( 28,  28, 0, 0, 0)	! (arbitrary)
        def_si_and_typ ( 29,  29, 0, 0, 0)	! (arbitrary)
        def_si_and_typ ( 30,  30, 0, 0, 0)	! (arbitrary)
        def_si_and_typ ( 31,  31, 0, 0, 0)	! (arbitrary)
        def_si_and_typ ( 32,  32, 0, 0, 0)	! Space
        def_si_and_typ ( 33,  33, 0, 0, 0)	! "!"
        def_si_and_typ ( 34,  34, 0, 0, 0)	! '"' (double quote)
        def_si_and_typ ( 35,  35, 0, 0, 0)	! "#"
        def_si_and_typ ( 36,  36, 0, 0, 0)	! "$"
        def_si_and_typ ( 37,  37, 0, 0, 0)	! "%"
        def_si_and_typ ( 38,  38, 0, 0, 0)	! "&"
        def_si_and_typ ( 39,  39, 0, 0, 0)	! "'" (single quote)
        def_si_and_typ ( 40,  40, 0, 0, 0)	! "("
        def_si_and_typ ( 41,  41, 0, 0, 0)	! ")"
        def_si_and_typ ( 42,  42, 0, 0, 0)	! "*"
        def_si_and_typ ( 43,  43, 0, 0, 0)	! "+"
        def_si_and_typ ( 44,  44, 0, 0, 0)	! "," (comma)
        def_si_and_typ ( 45,  45, 0, 0, 0)	! "-" (minus)
        def_si_and_typ ( 46,  46, 0, 0, 0)	! "." (period)
        def_si_and_typ ( 47,  47, 0, 0, 0)	! "/" (slash)
        def_si_and_typ ( 48,  48, 0, 0, 0)	! "0" (zero)
        def_si_and_typ ( 49,  49, 0, 0, 0)	! "1" (one)
        def_si_and_typ ( 50,  50, 0, 0, 0)	! "2"
        def_si_and_typ ( 51,  51, 0, 0, 0)	! "3"
        def_si_and_typ ( 52,  52, 0, 0, 0)	! "4"
        def_si_and_typ ( 53,  53, 0, 0, 0)	! "5"
        def_si_and_typ ( 54,  54, 0, 0, 0)	! "6"
        def_si_and_typ ( 55,  55, 0, 0, 0)	! "7"
        def_si_and_typ ( 56,  56, 0, 0, 0)	! "8"
        def_si_and_typ ( 57,  57, 0, 0, 0)	! "9"
        def_si_and_typ ( 58,  58, 0, 0, 0)	! ":" (colon)
        def_si_and_typ ( 59,  59, 0, 0, 0)	! ";" (semicolon)
        def_si_and_typ ( 60,  60, 0, 0, 0)	! "<" (less than)
        def_si_and_typ ( 61,  61, 0, 0, 0)	! "=" (equals)
        def_si_and_typ ( 62,  62, 0, 0, 0)	! ">" (greater than)
        def_si_and_typ ( 63,  63, 0, 0, 0)	! "?"
        def_si_and_typ ( 64,  64, 0, 0, 0)	! "@" (at sign)
        def_si_and_typ ( 65,  65, 0, 0, 0)	! "A" (capital A)
        def_si_and_typ ( 66,  66, 0, 0, 0)	! "B"
        def_si_and_typ ( 67,  67, 0, 0, 0)	! "C"
        def_si_and_typ ( 68,  68, 0, 0, 0)	! "D"
        def_si_and_typ ( 69,  69, 0, 0, 0)	! "E"
        def_si_and_typ ( 70,  70, 0, 0, 0)	! "F"
        def_si_and_typ ( 71,  71, 0, 0, 0)	! "G"
        def_si_and_typ ( 72,  72, 0, 0, 0)	! "H"
        def_si_and_typ ( 73,  73, 0, 0, 0)	! "I"
        def_si_and_typ ( 74,  74, 0, 0, 0)	! "J"
        def_si_and_typ ( 75,  75, 0, 0, 0)	! "K"
        def_si_and_typ ( 76,  76, 0, 0, 0)	! "L"
        def_si_and_typ ( 77,  77, 0, 0, 0)	! "M"
        def_si_and_typ ( 78,  78, 0, 0, 0)	! "N"
        def_si_and_typ ( 79,  79, 0, 0, 0)	! "O"
        def_si_and_typ ( 80,  80, 0, 0, 0)	! "P"
        def_si_and_typ ( 81,  81, 0, 0, 0)	! "Q"
        def_si_and_typ ( 82,  82, 0, 0, 0)	! "R"
        def_si_and_typ ( 83,  83, 0, 0, 0)	! "S"
        def_si_and_typ ( 84,  84, 0, 0, 0)	! "T"
        def_si_and_typ ( 85,  85, 0, 0, 0)	! "U"
        def_si_and_typ ( 86,  86, 0, 0, 0)	! "V"
        def_si_and_typ ( 87,  87, 0, 0, 0)	! "W"
        def_si_and_typ ( 88,  88, 0, 0, 0)	! "X"
        def_si_and_typ ( 89,  89, 0, 0, 0)	! "Y"
        def_si_and_typ ( 90,  90, 0, 0, 0)	! "Z"
        def_si_and_typ ( 91,  91, 0, 0, 0)	! "[" (left square bracket)
        def_si_and_typ ( 92,  92, 0, 0, 0)	! "\" (back slash)
        def_si_and_typ ( 93,  93, 0, 0, 0)	! "]" (right square bracket)
        def_si_and_typ ( 94,  94, 0, 0, 0)	! "^" (caret)
        def_si_and_typ ( 95,  95, 0, 0, 0)	! "_" (underscore)
        def_si_and_typ ( 96,  96, 0, 0, 0)	! "`" (accent grave)
        def_si_and_typ ( 97,  97, 0, 0, 0)	! "a" (lower case A)
        def_si_and_typ ( 98,  98, 0, 0, 0)	! "b"
        def_si_and_typ ( 99,  99, 0, 0, 0)	! "c"
        def_si_and_typ (100, 100, 0, 0, 0)	! "d"
        def_si_and_typ (101, 101, 0, 0, 0)	! "e"
        def_si_and_typ (102, 102, 0, 0, 0)	! "f"
        def_si_and_typ (103, 103, 0, 0, 0)	! "g"
        def_si_and_typ (104, 104, 0, 0, 0)	! "h"
        def_si_and_typ (105, 105, 0, 0, 0)	! "i"
        def_si_and_typ (106, 106, 0, 0, 0)	! "j"
        def_si_and_typ (107, 107, 0, 0, 0)	! "k"
        def_si_and_typ (108, 108, 0, 0, 0)	! "l"
        def_si_and_typ (109, 109, 0, 0, 0)	! "m"
        def_si_and_typ (110, 110, 0, 0, 0)	! "n"
        def_si_and_typ (111, 111, 0, 0, 0)	! "o"
        def_si_and_typ (112, 112, 0, 0, 0)	! "p"
        def_si_and_typ (113, 113, 0, 0, 0)	! "q"
        def_si_and_typ (114, 114, 0, 0, 0)	! "r"
        def_si_and_typ (115, 115, 0, 0, 0)	! "s"
        def_si_and_typ (116, 116, 0, 0, 0)	! "t"
        def_si_and_typ (117, 117, 0, 0, 0)	! "u"
        def_si_and_typ (118, 118, 0, 0, 0)	! "v"
        def_si_and_typ (119, 119, 0, 0, 0)	! "w"
        def_si_and_typ (120, 120, 0, 0, 0)	! "x"
        def_si_and_typ (121, 121, 0, 0, 0)	! "y"
        def_si_and_typ (122, 122, 0, 0, 0)	! "z"
        def_si_and_typ (123, 123, 0, 0, 0)	! "{" (left curly brace)
        def_si_and_typ (124, 124, 0, 0, 0)	! "|" (vertical bar)
        def_si_and_typ (125, 125, 0, 0, 0)	! "}" (right curly brace)
        def_si_and_typ (126, 126, 0, 0, 0)	! "~" (tilde)
        def_si_and_typ (127, 127, 0, 0, 0) 	! (arbitrary)
    %;
count_cst ('ascii')
%SBTTL 'Define SIXBIT conversion table (dix$acst_sixbit)'

!++
! .hl 1 Character set SIXBIT
!--

MACRO
    def_cst_sixbit =
        def_si_and_typ (0, 32, 0, 0, 0) ! Space
        def_si_and_typ (1, 33, 0, 0, 0) ! "!" (exclamation mark)
        def_si_and_typ (2, 34, 0, 0, 0) ! '"' (double quote)
        def_si_and_typ (3, 35, 0, 0, 0) ! "#" (commercial pould/hash/sharp)
        def_si_and_typ (4, 36, 0, 0, 0) ! "$" (dollar sign)
        def_si_and_typ (5, 37, 0, 0, 0) ! "%" (percent sign)
        def_si_and_typ (6, 38, 0, 0, 0) ! "&" (ampersand)
        def_si_and_typ (7, 39, 0, 0, 0) ! "'" (single quote/apostrophe)
        def_si_and_typ (8, 40, 0, 0, 0) ! "(" (left paren)
        def_si_and_typ (9, 41, 0, 0, 0) ! ")" (right paren)
        def_si_and_typ (10, 42, 0, 0, 0)        ! "*" (asterisk)
        def_si_and_typ (11, 43, 0, 0, 0)        ! "+" (plus)
        def_si_and_typ (12, 44, 0, 0, 0)        ! "," (comma)
        def_si_and_typ (13, 45, 0, 0, 0)        ! "-" (minus)
        def_si_and_typ (14, 46, 0, 0, 0)        ! "." (period)
        def_si_and_typ (15, 47, 0, 0, 0)        ! "/" (slash)
        def_si_and_typ (16, 48, 0, 0, 0)        ! "0" (digit zero)
        def_si_and_typ (17, 49, 0, 0, 0)        ! "1" (digit one)
        def_si_and_typ (18, 50, 0, 0, 0)        ! "2" (digit two)
        def_si_and_typ (19, 51, 0, 0, 0)        ! "3"
        def_si_and_typ (20, 52, 0, 0, 0)        ! "4"
        def_si_and_typ (21, 53, 0, 0, 0)        ! "5"
        def_si_and_typ (22, 54, 0, 0, 0)        ! "6"
        def_si_and_typ (23, 55, 0, 0, 0)        ! "7"
        def_si_and_typ (24, 56, 0, 0, 0)        ! "8"
        def_si_and_typ (25, 57, 0, 0, 0)        ! "9"
        def_si_and_typ (26, 58, 0, 0, 0)        ! ":" (colon)
        def_si_and_typ (27, 59, 0, 0, 0)        ! ";" (semi-colon)
        def_si_and_typ (28, 60, 0, 0, 0)        ! "<" (greater-than/left angle bracket)
        def_si_and_typ (29, 61, 0, 0, 0)        ! "=" (equals)
        def_si_and_typ (30, 62, 0, 0, 0)        ! ">" (less-than/right angle bracket)
        def_si_and_typ (31, 63, 0, 0, 0)        ! "?" (question mark)
        def_si_and_typ (32, 64, 0, 0, 0)        ! "@" (at sign)
        def_si_and_typ (33, 65, 0, 0, 0)        ! "A" (capital A)
        def_si_and_typ (34, 66, 0, 0, 0)        ! "B"
        def_si_and_typ (35, 67, 0, 0, 0)        ! "C"
        def_si_and_typ (36, 68, 0, 0, 0)        ! "D"
        def_si_and_typ (37, 69, 0, 0, 0)        ! "E"
        def_si_and_typ (38, 70, 0, 0, 0)        ! "F"
        def_si_and_typ (39, 71, 0, 0, 0)        ! "G"
        def_si_and_typ (40, 72, 0, 0, 0)        ! "H"
        def_si_and_typ (41, 73, 0, 0, 0)        ! "I"
        def_si_and_typ (42, 74, 0, 0, 0)        ! "J"
        def_si_and_typ (43, 75, 0, 0, 0)        ! "K"
        def_si_and_typ (44, 76, 0, 0, 0)        ! "L"
        def_si_and_typ (45, 77, 0, 0, 0)        ! "M"
        def_si_and_typ (46, 78, 0, 0, 0)        ! "N"
        def_si_and_typ (47, 79, 0, 0, 0)        ! "O" (capital letter O)
        def_si_and_typ (48, 80, 0, 0, 0)        ! "P"
        def_si_and_typ (49, 81, 0, 0, 0)        ! "Q"
        def_si_and_typ (50, 82, 0, 0, 0)        ! "R"
        def_si_and_typ (51, 83, 0, 0, 0)        ! "S"
        def_si_and_typ (52, 84, 0, 0, 0)        ! "T"
        def_si_and_typ (53, 85, 0, 0, 0)        ! "U"
        def_si_and_typ (54, 86, 0, 0, 0)        ! "V"
        def_si_and_typ (55, 87, 0, 0, 0)        ! "W"
        def_si_and_typ (56, 88, 0, 0, 0)        ! "X"
        def_si_and_typ (57, 89, 0, 0, 0)        ! "Y"
        def_si_and_typ (58, 90, 0, 0, 0)        ! "Z"
        def_si_and_typ (59, 91, 0, 0, 0)        ! "[" (left square bracket)
        def_si_and_typ (60, 92, 0, 0, 0)        ! "\" (backslash)
        def_si_and_typ (61, 93, 0, 0, 0)        ! "]" (right square bracket)
        def_si_and_typ (62, 94, 0, 0, 0)        ! "^" (caret/uparrow)
        def_si_and_typ (63, 95, 0, 0, 0)        ! "_" (underscore)
        loc_def_to_typ (33, 97, 0, 0, 0)        ! lc to UC => A
        loc_def_to_typ (34, 98, 0, 0, 0)        ! lc to UC => B
        loc_def_to_typ (35, 99, 0, 0, 0)        ! lc to UC => C
        loc_def_to_typ (36, 100, 0, 0, 0)       ! lc to UC => D
        loc_def_to_typ (37, 101, 0, 0, 0)       ! lc to UC => E
        loc_def_to_typ (38, 102, 0, 0, 0)       ! lc to UC => F
        loc_def_to_typ (39, 103, 0, 0, 0)       ! lc to UC => G
        loc_def_to_typ (40, 104, 0, 0, 0)       ! lc to UC => H
        loc_def_to_typ (41, 105, 0, 0, 0)       ! lc to UC => I
        loc_def_to_typ (42, 106, 0, 0, 0)       ! lc to UC => J
        loc_def_to_typ (43, 107, 0, 0, 0)       ! lc to UC => K
        loc_def_to_typ (44, 108, 0, 0, 0)       ! lc to UC => L
        loc_def_to_typ (45, 109, 0, 0, 0)       ! lc to UC => M
        loc_def_to_typ (46, 110, 0, 0, 0)       ! lc to UC => N
        loc_def_to_typ (47, 111, 0, 0, 0)       ! lc to UC => O
        loc_def_to_typ (48, 112, 0, 0, 0)       ! lc to UC => P
        loc_def_to_typ (49, 113, 0, 0, 0)       ! lc to UC => Q
        loc_def_to_typ (50, 114, 0, 0, 0)       ! lc to UC => R
        loc_def_to_typ (51, 115, 0, 0, 0)       ! lc to UC => S
        loc_def_to_typ (52, 116, 0, 0, 0)       ! lc to UC => T
        loc_def_to_typ (53, 117, 0, 0, 0)       ! lc to UC => U
        loc_def_to_typ (54, 118, 0, 0, 0)       ! lc to UC => V
        loc_def_to_typ (55, 119, 0, 0, 0)       ! lc to UC => W
        loc_def_to_typ (56, 120, 0, 0, 0)       ! lc to UC => X
        loc_def_to_typ (57, 121, 0, 0, 0)       ! lc to UC => Y
        loc_def_to_typ (58, 122, 0, 0, 0)       ! lc to UC => Z
        loc_def_to_typ (60, si$k_invalid, 0, 0, 1) ! SI invalid prints as "\"
        loc_def_to_typ (59, 123, 0, 0, 1)       ! SI "{" becomes "["
        loc_def_to_typ (61, 125, 0, 0, 1)       ! SI "}" becomes "]"
    %;
count_cst ('sixbit')
%SBTTL 'Define EBCDIC conversion table (dix$acst_ebcdic)'

!++
! .HL 1 Character set EBCDIC
!   This is based on EBCDIC, not IBM multinational.  The definitions come from
! the DEC multinational standard, and the existing DEC-20 COBOL conversions.
!--

MACRO
    def_cst_ebcdic =
        def_si_and_typ (%X'05', %X'09', 0, 0, 0)        ! Horizontal Tab
        def_si_and_typ (%X'0B', %X'0B', 0, 0, 0)        ! Vertical Tab
        def_si_and_typ (%X'0C', %X'0C', 0, 0, 0)        ! Form Feed
        def_si_and_typ (%X'15', %X'0D', 0, 0, 0)        ! Carriage return/new line
    	def_si_and_typ (%X'16', %X'08', 0, 0, 0)	! Back space
        def_si_and_typ (%X'25', %X'0A', 0, 0, 0)        ! Line feed
        def_si_and_typ (%X'27', %X'16', 0, 0, 0)        ! Escape
        def_si_and_typ (%X'2F', %X'07', 0, 0, 0)        ! Bell
        def_si_and_typ (%X'40', %X'20', 0, 0, 0)        ! Space
        def_si_and_typ (%X'4B', %X'2E', 0, 0, 0)        ! period/decimal point
        def_si_and_typ (%X'4C', %X'3C', 0, 0, 0)        ! Less than
        def_si_and_typ (%X'4D', %X'28', 0, 0, 0)        ! Open paren
        def_si_and_typ (%X'4E', %X'2B', 0, 0, 0)        ! Plus
        loc_def_to_si (%X'4F', %X'7C', 0, 0, 1)         ! Short vertical bar -> vertical bar
        def_si_and_typ (%X'50', %X'26', 0, 0, 0)        ! Ampersand
        def_si_and_typ (%X'5A', %X'21', 0, 0, 0)        ! Exclamation point
        def_si_and_typ (%X'5B', %X'24', 0, 0, 0)        ! Dollar sign
        def_si_and_typ (%X'5C', %X'2A', 0, 0, 0)        ! Asterisk
        def_si_and_typ (%X'5D', %X'29', 0, 0, 0)        ! Close paren
        def_si_and_typ (%X'5E', %X'3B', 0, 0, 0)        ! Semicolon
        def_si_and_typ (%X'60', %X'2D', 0, 0, 0)        ! hyphen/minus
        def_si_and_typ (%X'61', %X'2F', 0, 0, 0)        ! slash/slant/solidus
        def_si_and_typ (%X'6A', %X'7C', 0, 0, 0)        ! vertical line
        def_si_and_typ (%X'6B', %X'2C', 0, 0, 0)        ! Comma
        def_si_and_typ (%X'6C', %X'25', 0, 0, 0)        ! Percent sign
        def_si_and_typ (%X'6D', %X'5F', 0, 0, 0)        ! Underline
        def_si_and_typ (%X'6E', %X'3E', 0, 0, 0)        ! Greater than
        def_si_and_typ (%X'6F', %X'3F', 0, 0, 0)        ! Question mark
        def_si_and_typ (%X'79', %X'60', 0, 0, 0)        ! opening single quote
        def_si_and_typ (%X'7A', %X'3A', 0, 0, 0)        ! Colon
        def_si_and_typ (%X'7B', %X'23', 0, 0, 0)        ! Number/pound sign
        def_si_and_typ (%X'7C', %X'40', 0, 0, 0)        ! Commercial at
        def_si_and_typ (%X'7D', %X'27', 0, 0, 0)        ! Apostrophe
        def_si_and_typ (%X'7E', %X'3D', 0, 0, 0)        ! Equals
        def_si_and_typ (%X'7F', %X'22', 0, 0, 0)        ! Double quotes
        def_si_and_typ (%X'81', %X'61', 0, 0, 0)        ! small a
        def_si_and_typ (%X'82', %X'62', 0, 0, 0)        ! small b
        def_si_and_typ (%X'83', %X'63', 0, 0, 0)        ! small c
        def_si_and_typ (%X'84', %X'64', 0, 0, 0)        ! small d
        def_si_and_typ (%X'85', %X'65', 0, 0, 0)        ! small e
        def_si_and_typ (%X'86', %X'66', 0, 0, 0)        ! small f
        def_si_and_typ (%X'87', %X'67', 0, 0, 0)        ! small g
        def_si_and_typ (%X'88', %X'68', 0, 0, 0)        ! small h
        def_si_and_typ (%X'89', %X'69', 0, 0, 0)        ! small i
        def_si_and_typ (%X'91', %X'6A', 0, 0, 0)        ! small j
        def_si_and_typ (%X'92', %X'6B', 0, 0, 0)        ! small k
        def_si_and_typ (%X'93', %X'6C', 0, 0, 0)        ! small l
        def_si_and_typ (%X'94', %X'6D', 0, 0, 0)        ! small m
        def_si_and_typ (%X'95', %X'6E', 0, 0, 0)        ! small n
        def_si_and_typ (%X'96', %X'6F', 0, 0, 0)        ! small o
        def_si_and_typ (%X'97', %X'70', 0, 0, 0)        ! small p
        def_si_and_typ (%X'98', %X'71', 0, 0, 0)        ! small q
        def_si_and_typ (%X'99', %X'72', 0, 0, 0)        ! small r
        def_si_and_typ (%X'A1', %X'7E', 0, 0, 0)        ! tilde
        def_si_and_typ (%X'A2', %X'73', 0, 0, 0)        ! small s
        def_si_and_typ (%X'A3', %X'74', 0, 0, 0)        ! small t
        def_si_and_typ (%X'A4', %X'75', 0, 0, 0)        ! small u
        def_si_and_typ (%X'A5', %X'76', 0, 0, 0)        ! small v
        def_si_and_typ (%X'A6', %X'77', 0, 0, 0)        ! small w
        def_si_and_typ (%X'A7', %X'78', 0, 0, 0)        ! small x
        def_si_and_typ (%X'A8', %X'79', 0, 0, 0)        ! small y
        def_si_and_typ (%X'A9', %X'7A', 0, 0, 0)        ! small z
    	def_si_and_typ (%X'AD', %X'5B', 0, 0, 0)	! left square bracket
    	def_si_and_typ (%X'BD', %X'5D', 0, 0, 0)	! right square bracket
        def_si_and_typ (%X'C0', %X'7B', 0, 0, 0)        ! opening brace
        def_si_and_typ (%X'C1', %X'41', 0, 0, 0)        ! "A"
        def_si_and_typ (%X'C2', %X'42', 0, 0, 0)        ! "B"
        def_si_and_typ (%X'C3', %X'43', 0, 0, 0)        ! "C"
        def_si_and_typ (%X'C4', %X'44', 0, 0, 0)        ! "D"
        def_si_and_typ (%X'C5', %X'45', 0, 0, 0)        ! "E"
        def_si_and_typ (%X'C6', %X'46', 0, 0, 0)        ! "F"
        def_si_and_typ (%X'C7', %X'47', 0, 0, 0)        ! "G"
        def_si_and_typ (%X'C8', %X'48', 0, 0, 0)        ! "H"
        def_si_and_typ (%X'C9', %X'49', 0, 0, 0)        ! "I"
        def_si_and_typ (%X'D0', %X'7D', 0, 0, 0)        ! closing brace
        def_si_and_typ (%X'D1', %X'4A', 0, 0, 0)        ! "J"
        def_si_and_typ (%X'D2', %X'4B', 0, 0, 0)        ! "K"
        def_si_and_typ (%X'D3', %X'4C', 0, 0, 0)        ! "L"
        def_si_and_typ (%X'D4', %X'4D', 0, 0, 0)        ! "M"
        def_si_and_typ (%X'D5', %X'4E', 0, 0, 0)        ! "N"
        def_si_and_typ (%X'D6', %X'4F', 0, 0, 0)        ! "O"
        def_si_and_typ (%X'D7', %X'50', 0, 0, 0)        ! "P"
        def_si_and_typ (%X'D8', %X'51', 0, 0, 0)        ! "Q"
        def_si_and_typ (%X'D9', %X'52', 0, 0, 0)        ! "R"
        def_si_and_typ (%X'E0', %X'5C', 0, 0, 0)        ! Back slash
        def_si_and_typ (%X'E2', %X'53', 0, 0, 0)        ! "S"
        def_si_and_typ (%X'E3', %X'54', 0, 0, 0)        ! "T"
        def_si_and_typ (%X'E4', %X'55', 0, 0, 0)        ! "U"
        def_si_and_typ (%X'E5', %X'56', 0, 0, 0)        ! "V"
        def_si_and_typ (%X'E6', %X'57', 0, 0, 0)        ! "W"
        def_si_and_typ (%X'E7', %X'58', 0, 0, 0)        ! "X"
        def_si_and_typ (%X'E8', %X'59', 0, 0, 0)        ! "Y"
        def_si_and_typ (%X'E9', %X'5A', 0, 0, 0)        ! "Z"
        def_si_and_typ (%X'F0', %X'30', 0, 0, 0)        ! Digit 0
        def_si_and_typ (%X'F1', %X'31', 0, 0, 0)        ! Digit 1
        def_si_and_typ (%X'F2', %X'32', 0, 0, 0)        ! Digit 2
        def_si_and_typ (%X'F3', %X'33', 0, 0, 0)        ! Digit 3
        def_si_and_typ (%X'F4', %X'34', 0, 0, 0)        ! Digit 4
        def_si_and_typ (%X'F5', %X'35', 0, 0, 0)        ! Digit 5
        def_si_and_typ (%X'F6', %X'36', 0, 0, 0)        ! Digit 6
        def_si_and_typ (%X'F7', %X'37', 0, 0, 0)        ! Digit 7
        def_si_and_typ (%X'F8', %X'38', 0, 0, 0)        ! Digit 8
        def_si_and_typ (%X'F9', %X'39', 0, 0, 0)        ! Digit 9
    	loc_def_to_typ (%X'E0', si$k_invalid, 0, 0, 0)	! for invalid
    % ;                                 ! end def_cst_ebcdic
count_cst ('ebcdic')
%sbttl 'Cleanup'

!++
! .hl 1 Cleanup
! 
!   XPORT isn't housebroken yet, so it is necessary to trash this
! definition:
!--

UNDECLARE
    %QUOTE $descriptor;			! \\