Google
 

Trailing-Edge - PDP-10 Archives - BB-JF18A-BM - sources/diu/diumlb.bli
There are 4 other files named diumlb.bli in the archive. Click here to see a list.
%TITLE 'DIUMLB -- Library of definitions for data type code mappings.'
!++
!	COPYRIGHT (C) DIGITAL EQUIPMENT CORPORATION 1986.
!	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.
!
!   FACILITY: Data Interchange Utility (DIU)
!
!   ABSTRACT: DIUMLB is the library of definitions and data structures
!             used by the Mapping routines (see module DIUMAP).
!
!   AUTHOR: Sandy Clemens, Creation Date: 30-Jul-84
!
!   HISTORY:
!
!  236  Change library of DIXLIB to DIUDIX.
!       Sandy Clemens  19-Jun-86
!
!   73	Get rid of "need_usage".  Make all usage type literals POSITIVE so that
!	comparison of reqblk[DIU$B_???_USAGE_TYP] (a single BYTE) with the
!	the fullword literals always gives the desired result.
!	Sandy Clemens	4-Mar-86
!
!   65	Add new usage type codes.
!	Sandy Clemens  12-Feb-86
!  
!--
!++
!
!  Library and require files.
!
!--
%BLISS32 
         (LIBRARY 'SYS$LIBRARY:XPORT';)

%BLISS36
        (LIBRARY 'BLI:XPORT';)

LIBRARY 'DIUDIX';
!++
!
!   The maximum possible values for the various data type codes.  The
!   three sources for data type codes are VAX CDD, TOPS-20 Datatrieve,
!   and DIL/DIU sources.  The maximum values are determined by what is
!   value for each of the sources!  The DIL maximum values are defined
!   (one for each class) in DIUDIX.  The names for the DIL maximum data
!   type codes are named DT_CLASS_<class-name>_MAX.  For example the max
!   type code for the string class is DT_CLASS_STRING_MAX.  See DIUDIX
!   for more information!
!
!--

LITERAL cdd_max = 260,                  ! max cdd table index value
        dtr_max = 26;                   ! max dtr table index value


!++
!
!   Values for the usage type flag.  The usage flag indicates a usage
!   type (or character set) which overrides the usage type that may be
!   indicated by the data type.  This flag should be set to default_typ
!   for non-text data types.  Text data types are in the classes string
!   and display-numeric.  Note that packed decimal has a special case
!   here because on 36-Bit systems packed decimal can only be used with
!   usage EBCDIC, but on 8-bit systems it can be used with any usage.
!   
!--

LITERAL default_typ = 0,                ! default usage type
        ascii_txt = 1,                  ! ascii text
        ebcdic_txt = 2,                 ! ebcdic text
        sixbit_txt = 3,                 ! sixbit text
        unspec_typ = 4;                 ! type has not been specified yet
!++
!
!   Source indicators.  The source indicator is passed by any routine
!   which calls the mapping routines.  The source indicator
!   determines whether the source is DTR-20, VAX CDD or DIL/DIU.  It
!   is necessary to know this in order to know which set of data type
!   codes are being mapped from.
!
!--

LITERAL 
        cdd32_src = 0,
        dil_src = 1,
        dtr20_src = 2;

!++
! Define two literals which do not conflict with any of the DIL
! datatypes and which can be used to identify the cases of datatype
! OVERLAY and datatype STRUCTURE.  The CDD uses the literal value
! 'CDD$K_DTYPE_OVR' which is set to 258 for data type overlay.  The
! value 258 is aleady used as a data type code by DIL.  The CDD uses
! the literal 'CDD$K_DTYPE_Z' (which is set to 0) for structures, but
! the mapping routines return zero when a requested mapping is
! invalid.  Therefore, we can't simply use the CDD codes, so two new
! literals are necesssary.
!--

LITERAL DIU$K_DT_OVERLAY = 4001;
LITERAL DIU$K_DT_STRUCTURE = 4002;
!++
!
!   Definition of the OPTLST structure.  The OPTLST structure is the
!   list of options available if a special usage type switch is
!   indicated.  The list of options is in a separate structure so that
!   space can be saved in the MAP_TAB structure, and because for many
!   of the MAP_TABs used in DIUMAP, the options are exactly the same
!   for numerous data types.  If a data type in a mapping table is a
!   usage type, the address of the OPTLST for the data type will be
!   stored as part of the MAP_TAB entry.
!
!--

$field optlst_fields =
   SET
   opt_ascii8 = [$bits(class_code_bits + type_code_bits)],      ! ascii 8bit
   opt_ascii7 = [$bits(class_code_bits + type_code_bits)],      ! ascii 7bit
   opt_ebcdic8 = [$bits(class_code_bits + type_code_bits)],     ! ebcdic 8bit
   opt_ebcdic9 = [$bits(class_code_bits + type_code_bits)],     ! ebcdic 9bit
   opt_sixbit = [$bits(class_code_bits + type_code_bits)]       ! sixbit
   TES;

LITERAL optlst_size = $field_set_size;


!++
!
!   Macro optlst_vals is used to assign values to a single OPTLST's
!   fields.  If the caller indicates a usage option, other than the
!   default, and the data type's text flag is set to ON in the
!   MAP_TAB, then the mapping routines will use the OPTLST indicated
!   in the MAP_TAB to select the appropriate data type.  For example,
!   if a calling program has passed the CDD data type code for ASCII
!   8-bit text, but the user has the EBCDIC flag on and indicates that
!   the destination system is LCG, then the data type which should be
!   returned is EBCDIC 9-bit.  A second example: If the caller passes
!   data type code for UNSIGNED NUMERIC ASCII 8-bit (DN8U) but the
!   SIXBIT flag is on and the destination system is LCG, then the data
!   type which should be returned is UNSIGNED NUMERIC SIXBIT (DN6U).
!   The OPTLST table is where this information is stored.  This macro
!   is used to make assigning values to OPTLST's easier!!!  (*WHEW*)
!   
!--

MACRO optlst_vals (asc_lcg, asc_8bit, ebc_lcg, ebc_8bit, sxb_lcg) =
      [opt_ascii7] = asc_lcg, 
      [opt_ascii8] = asc_8bit, 
      [opt_ebcdic9] = ebc_lcg, 
      [opt_ebcdic8] = ebc_8bit, 
      [opt_sixbit] = sxb_lcg
%;

!++
!   
!   Macro OPTLST is used to define a single OPTLST structure...
!   
!--

MACRO optlst = BLOCK [optlst_size]
               FIELD (optlst_fields)
               %;
!++
!
!   Definition of the mapping table (MAP_TAB) structure.  Each MAP_TAB
!   is set up for the index to be a data type code of the source
!   facility (CDD, DTR, DIL/DIU).  Each MAP_TAB entry, one for each
!   possible source data type code, contains a default data type for
!   each of the three systems: LCG, 8BIT (VAX/VMS), PRO.  Each entry
!   also has a text flag which indicates whether or not the data type
!   can be effected by a character set preference.  If the text flag
!   is ON, then there should be an OPTLST address included in the
!   MAP_TAB entry.  If the text flag is OFF, the OPTLST address should
!   be set to zero, althought it will be ignored.
!
!--

$field map_fields = 
   SET

   map_def8 =                           ! default 8bit data type
       [$bits(class_code_bits
              + type_code_bits)],
   map_deflcg =                         ! default LCG data type
       [$bits(class_code_bits
              + type_code_bits)],
   map_defpro =                         ! default PRO data type
       [$bits(class_code_bits
              + type_code_bits)],

   map_txt_flg = [$bit],                ! if ON, there are different options
                                        ! available, depending on the usage
                                        ! type indicated by the caller

   map_optlst = [$address]              ! address of OPTLST

   TES;

LITERAL map_size = $field_set_size;

!++
!   
!   Macro map_entry is used to define a single map table entry.  It
!   takes the index, text flag, default 8-bit data type, default LCG
!   data type, default PRO data type and the OPTLST address and stuffs
!   all this information into the MAP_TAB at the index indicated.  The
!   index should be the value of a data type code from the source
!   facility, depending on what that source facility is (DIU/DIL, CDD,
!   DTR).
!
!--

MACRO map_entry (map_indx, txt_flag, def_8bit, def_lcg, def_pro, opts) =
      [map_indx, map_def8] = def_8bit,
      [map_indx, map_deflcg] = def_lcg,
      [map_indx, map_defpro] = def_pro,
      %IF txt_flag                      ! if text flag ON, save OPTLST address
          %THEN
               [map_indx, map_optlst] = %QUOTE %NAME (opts, '_opt'),
          %ELSE
      %FI
      [map_indx, map_txt_flg] = txt_flag
   %;

!++
!   
!   Macro MAP_TAB is used to define a mapping table structure...
!   
!--

MACRO map_tab (size) = BLOCKVECTOR [size, map_size]
                       FIELD (map_fields)
                       %;