-- Em3270CharTransDefs:  3270 EBCDIC Translation Description

-- Last revised for Star 3.2fKlamath by Pettit:	30-Nov-83 14:32:02
-- Owner:  Lui

-- Overview: 
--  Em3270CharTransDefs provides the necessary procedures needed to translate EBCDIC(USA) characters to the NS (OIS) character set and vice versa.
--  Em3270CharTransDefs does not care whether the translation tables are store in a data file or not. 

DIRECTORY
  CharDefs USING [Char],
  Em3270Defs USING [IBMlanguages],
  Em3270PrivDefs,
  Space USING [Interval],
  StandardDefs USING [Bv];
    
Em3270CharTransDefs: DEFINITIONS =
BEGIN OPEN Em3270PrivDefs;
 

-- ======================= 
--     Public Procedures
-- =======================

GetTransFile: PUBLIC PROC [hostLang: Em3270Defs.IBMlanguages]
  RETURNS [ptrToTransFile: BaseOISToEFile, sp: Space.Interval];
-- GetTransFile will map the data file for hostLang onto VM. A pointer(filePtr) to the mapped space will be returned. At the end of the emulation session, DeleteFileSpace should be called to unmap and delete the space allocated. 

DeleteFileSpace: PUBLIC PROC[sp: Space.Interval];
-- Delete the mapped space used for the translation file.

-- The following two procedures provide translation between the IBM Host and Star's 3270 window
OISCharFromEBCDIC: PUBLIC PROC[
  ptrToTransFile: BaseOISToEFile, char: CHARACTER] RETURNS[oisChar: CharDefs.Char];
-- OISCharFromEBCDIC takes an EBCDIC character and translates it into an WS (OIS) character. 

OISRunFromEBCDIC: PUBLIC PROC[
  ptrToTransFile: BaseOISToEFile, inRun: LptETextRun, outRun: LptTextRun, ctChar: TextIndexType]; 
-- OISCharFromEBCDIC takes a run of  EBCDIC character(inRun) and translates it into a run of WS (OIS) character(outRun). ctChar is the number of EBCDIC characters in the run.

EBCDICFromOISChar: PUBLIC PROC[ptrToTransFile: BaseOISToEFile, oisChar: CharDefs.Char]   RETURNS[char: CHARACTER];
-- EBCDICFromOISChar takes an WS (OIS) Character and translates it into a EBCDIC character.


-- The following two procedures provide deadkey accents between Star's 3270 window and other Star Documents.

ExpandLegalDeadchar: PUBLIC PROC[ptrToTransFile: BaseOISToEFile, inChar: CharDefs.Char] 
  RETURNS[outChar1, outChar2: CharDefs.Char];
-- ExpandLegalDeadchar is called to move text from a Star Document into a 3270 window.  ie. one-to-many.
-- hostLang specifies the IBM EBCDIC translation file.  
-- IF the given inChar cannot be expanded then inChar is assigned to outChar1 and outChar2 is set to Roman[unused177B].
-- IF the given inChar can be expanded then its expandion is given by outChar1 and  outChar2.
 
CoalesceDeadChar: PUBLIC PROC[
  ptrToTransFile: BaseOISToEFile, firstChar, secondChar: CharDefs.Char] 
  RETURNS[outChar: CharDefs.Char, skip: StandardDefs.Bv];
-- CoalesceDeadChar is called to move text from a 3270 window to a Star Document. ie. many-to-one.
-- skip = TRUE => firstChar, and secondChar can be represented by a single Char. i.e. outChar 
-- skip = FALSE => firstChar and secondChar cannot be represented by a single Char. outChar is set to firstChar. 

-- =======================
--     Modules
-- =======================
Em3270CharTransPack: PRIVATE PROGRAM;


END.
LOG
 1-Feb-82    - Lui       - Created
22-Mar-82    - Lui       - Added ExpandLegalDeadchar, CoalesceDeadChar.
18-Jun-82    - Lui       - Added OISRunFromEBCDIC.
 4-Aug-82    - Lui       - merge with Star2.1ar
31-Aug-82    - Lui       - added hostLang.
 9-Sep-82    - Lui       - added procedure GetTransFile 
 9-Dec-82    - Lui       - added DeleteFileSpace to delete VM Spaces allocated by GetTransFile.
30-Nov-83    - Pettit    - Klamath conversion: replaced SpDefs.Sp by Space.Interval.