Browse Source

morphunits: diskfont, keymap units rewrote from current SDK

git-svn-id: trunk@34771 -
marcus 8 years ago
parent
commit
ad31914a73

+ 278 - 99
packages/morphunits/src/diskfont.pas

@@ -20,129 +20,308 @@
 
 unit diskfont;
 
-INTERFACE
+interface
 
-uses exec, agraphics, utility;
+uses
+  exec, agraphics, utility;
 
-Const
-
-    MAXFONTPATH         = 256;
-
-Type
-
-    pFontContents = ^tFontContents;
-    tFontContents = record
-        fc_FileName     : Array [0..MAXFONTPATH-1] of Char;
-        fc_YSize        : Word;
-        fc_Style        : Byte;
-        fc_Flags        : Byte;
-    end;
-
-
-   pTFontContents = ^tTFontContents;
-   tTFontContents = record
-    tfc_FileName  : Array[0..MAXFONTPATH-3] of Char;
-    tfc_TagCount  : Word;
-    tfc_YSize     : Word;
-    tfc_Style,
-    tfc_Flags     : Byte;
-   END;
-
-
-Const
-    FCH_ID              = $0f00;
-    TFCH_ID             = $0f02;
-    OFCH_ID             = $0f03;
-
-
-
-Type
-    pFontContentsHeader = ^tFontContentsHeader;
-    tFontContentsHeader = record
-        fch_FileID      : Word;
-        fch_NumEntries  : Word;
-    end;
-
-Const
-
-    DFH_ID              = $0f80;
-    MAXFONTNAME         = 32;
+const
+  MAXFONTPATH = 256;
+
+type
+  PFontContents = ^TFontContents;
+  TFontContents = record
+    fc_FileName: array[0..MAXFONTPATH - 1] of Char;
+    fc_YSize: Word;
+    fc_Style: Byte;
+    fc_Flags: Byte;
+  end;
+
+  PTFontContents = ^TTFontContents;
+  TTFontContents = record
+    tfc_FileName: array[0..MAXFONTPATH - 3] of Char;
+    tfc_TagCount: Word;
+    tfc_YSize: Word;
+    tfc_Style: Byte;
+    tfc_Flags: Byte;
+  end;
 
-Type
+const
+  FCH_ID  = $0f00;
+  TFCH_ID = $0f02;
+  OFCH_ID = $0f03;
 
-    pDiskFontHeader = ^tDiskFontHeader;
-    tDiskFontHeader = record
-        dfh_DF          : tNode;
-        dfh_FileID      : Word;
-        dfh_Revision    : Word;
-        dfh_Segment     : Longint;
-        dfh_Name        : Array [0..MAXFONTNAME-1] of Char;
-        dfh_TF          : tTextFont;
-    end;
+type
+  PFontContentsHeader = ^TFontContentsHeader;
+  TFontContentsHeader = record
+    fch_FileID: Word;
+    fch_NumEntries: Word;
+  end;
 
-Const
+const
+  DFH_ID = $0f80;
 
-    AFB_MEMORY          = 0;
-    AFF_MEMORY          = 1;
-    AFB_DISK            = 1;
-    AFF_DISK            = 2;
-    AFB_SCALED          = 2;
-    AFF_SCALED          = $0004;
-    AFB_BITMAP          = 3;
-    AFF_BITMAP          = $0008;
-    AFB_TAGGED          = 16;
-    AFF_TAGGED          = $10000;
+  MAXFONTNAME = 32;
 
+type
+  PDiskFontHeader = ^TDiskFontHeader;
+  TDiskFontHeader = record
+    dfh_DF: TNode;
+    dfh_FileID: Word;
+    dfh_Revision: Word;
+    dfh_Segment: LongInt;
+    dfh_Name: array[0..MAXFONTNAME - 1] of Char;
+    dfh_TF: TTextFont;
+  end;
 
-Type
+const
+  AFB_MEMORY = 0;
+  AFF_MEMORY = 1 shl AFB_MEMORY;
+  AFB_DISK   = 1;
+  AFF_DISK   = 1 shl AFB_DISK;
+  AFB_SCALED = 2;
+  AFF_SCALED = 1 shl AFB_SCALED;
+  AFB_BITMAP = 3;
+  AFF_BITMAP = 1 shl AFB_BITMAP;
+
+  AFB_TAGGED = 16;
+  AFF_TAGGED = 1 shl AFB_TAGGED;
+
+type
+  PAvailFonts = ^TAvailFonts;
+  TAvailFonts = record
+    af_Type: Word;
+    af_Attr: TTextAttr;
+  end;
+
+  PTAvailFonts = ^TTAvailFonts;
+  TTAvailFonts = record
+    taf_Type: Word;
+    taf_Attr: tTTextAttr;
+  end;
+
+  PAvailFontsHeader = ^TAvailFontsHeader;
+  TAvailFontsHeader = record
+    afh_NumEntries: Word;
+  end;
+
+// diskfont tag defines
+const
+  OT_Level0   = TAG_USER;
+  OT_Level1   = TAG_USER or $1000;
+  OT_Level2   = TAG_USER or $2000;
+  OT_Level3   = TAG_USER or $3000;
+  OT_Indirect = $8000;
+
+  OT_DeviceDPI      = OT_Level0 or $01;
+  OT_DotSize        = OT_Level0 or $02;
+  OT_PointHeight    = OT_Level0 or $08;
+  OT_SetFactor      = OT_Level0 or $09;
+  OT_ShearSin       = OT_Level0 or $0a;
+  OT_ShearCos       = OT_Level0 or $0b;
+  OT_RotateSin      = OT_Level0 or $0c;
+  OT_RotateCos      = OT_Level0 or $0d;
+  OT_EmboldenX      = OT_Level0 or $0e;
+  OT_EmboldenY      = OT_Level0 or $0f;
+  OT_PointSize      = OT_Level0 or $10;
+  OT_GlyphCode      = OT_Level0 or $11;
+  OT_GlyphCode2     = OT_Level0 or $12;
+  OT_GlyphWidth     = OT_Level0 or $13;
+  OT_OTagPath       = OT_Level0 or OT_Indirect or $14;
+  OT_OTagList       = OT_Level0 or OT_Indirect or $15;
+  OT_GlyphMap       = OT_Level0 or OT_Indirect or $20;
+  OT_WidthList      = OT_Level0 or OT_Indirect or $21;
+  OT_TextKernPair   = OT_Level0 or OT_Indirect or $22;
+  OT_DesignKernPair = OT_Level0 or OT_Indirect or $23;
+  OT_UnderLined     = OT_Level0 or $24;
+  OT_StrikeThrough  = OT_Level0 or $25;
+  OT_GlyphMap8Bits  = OT_Level0 or OT_Indirect or $50;
+
+// More sane support of real bold and italic fonts via families and/or algostyling
+  OT_StyleFlags        = OT_Level0 or $101;  // Obtain with or OT_Indirect
+
+{ Setting OTSF_Designed flags tells engine to try to open a styled
+  font in the same family, failing that it will algorithmically create
+  the right style = if you require only real designed styles, obtain the
+  actual flags afterwards and compare against desired result;.
+
+  OTSF_Algo flags tells engine to algorithmically style the font for
+  you, this can be applied on top of OTSF_Designed to achieve whichever
+  effect you need.}
+
+  OTSF_DesignedBold   = 1 shl 0;
+  OTSF_DesignedItalic = 1 shl 1;
+  OTSF_AlgoBold       = 1 shl 16;
+  OTSF_AlgoItalic     = 1 shl 17;
+
+
+  OTUL_None         = 0;
+  OTUL_Solid        = 1;
+  OTUL_Broken       = 2;
+  OTUL_DoubleSolid  = 3;
+  OTUL_DoubleBroken = 4;
+  OUTL_DoubleBroken = OTUL_DoubleBroken;
+
+  OTSUFFIX   = '.otag';
+  OTE_Bullet = 'bullet';
+
+  OT_FileIdent        = OT_Level1 or $01;
+  OT_Engine           = OT_Level1 or OT_Indirect or $02;
+  OT_Family           = OT_Level1 or OT_Indirect or $03;
+
+  OT_BName            = OT_Level2 or OT_Indirect or $05;
+  OT_IName            = OT_Level2 or OT_Indirect or $06;
+  OT_BIName           = OT_Level2 or OT_Indirect or $07;
+  OT_RName            = OT_Level2 or OT_Indirect or $09;
+
+  OT_SymbolSet        = OT_Level1 or $10;
+  OT_YSizeFactor      = OT_Level1 or $11;
+  OT_SpaceWidth       = OT_Level2 or $12;
+  OT_IsFixed          = OT_Level2 or $13;
+  OT_SerifFlag        = OT_Level1 or $14;
+  OT_StemWeight       = OT_Level1 or $15;
+  OT_SlantStyle       = OT_Level1 or $16;
+  OT_HorizStyle       = OT_Level1 or $17;
+  OT_SpaceFactor      = OT_Level2 or $18;
+  OT_InhibitAlgoStyle = OT_Level2 or $19;
+  OT_AvailSizes       = OT_Level1 or OT_Indirect or $20;
+
+  OT_MAXAVAILSIZES = 20;
+
+  OTS_Upright    = 0;
+  OTS_Italic     = 1;
+  OTS_LeftItalic = 2;
+  OTS_UltraThin  = 8;
+  OTS_ExtraThin  = 24;
+  OTS_Thin       = 40;
+  OTS_ExtraLight = 56;
+  OTS_Light      = 72;
+  OTS_DemiLight  = 88;
+  OTS_SemiLight  = 104;
+  OTS_Book       = 120;
+  OTS_Medium     = 136;
+  OTS_SemiBold   = 152;
+  OTS_DemiBold   = 168;
+  OTS_Bold       = 184;
+  OTS_ExtraBold  = 200;
+  OTS_Black      = 216;
+  OTS_ExtraBlack = 232;
+  OTS_UltraBlack = 248;
+
+  OTH_UltraCompressed = 16;
+  OTH_ExtraCompressed = 48;
+  OTH_Compressed      = 80;
+  OTH_Condensed       = 112;
+  OTH_Normal          = 144;
+  OTH_SemiExpanded    = 176;
+  OTH_Expanded        = 208;
+  OTH_ExtraExpanded   = 240;
+
+  OT_SpecCount = OT_Level1 or $100;
+  OT_Spec      = OT_Level1 or $100;
+  OT_Spec1     = OT_Level1 or $101;
+
+  DFCTRL_BASE     = TAG_USER + $0B000000;
+  DFCTRL_XDPI     = DFCTRL_BASE + 1;
+  DFCTRL_YDPI     = DFCTRL_BASE + 2;
+  DFCTRL_XDOTP    = DFCTRL_BASE + 3;
+  DFCTRL_YDOTP    = DFCTRL_BASE + 4;
+  DFCTRL_CACHE    = DFCTRL_BASE + 5;
+  DFCTRL_SORTMODE = DFCTRL_BASE + 6;
+
+  DFCTRL_SORT_OFF = 0;
+  DFCTRL_SORT_ASC = 1;
+  DFCTRL_SORT_DES = -1;
+
+// diskfont glyph defines
+type
+  PGlyphEngine = ^TGlyphEngine;
+  TGlyphEngine = record
+    gle_Library: PLibrary;
+    gle_Name: PChar;
+  end;
+
+  FIXED = LongInt;
+
+  PGlyphMap = ^TGlyphMap;
+  TGlyphMap = record
+    glm_BMModulo: Word;
+    glm_BMRows: Word;
+    glm_BlackLeft: Word;
+    glm_BlackTop: Word;
+    glm_BlackWidth: Word;
+    glm_BlackHeight: Word;
+    glm_XOrigin: FIXED;
+    glm_YOrigin: FIXED;
+    glm_X0: SmallInt;
+    glm_Y0: SmallInt;
+    glm_X1: SmallInt;
+    glm_Y1: SmallInt;
+    glm_Width: FIXED;
+    glm_BitMap: PByte;
+  end;
+
+  PGlyphWidthEntry = ^TGlyphWidthEntry;
+  TGlyphWidthEntry = record
+    gwe_Node: TMinNode;
+    gwe_Code: Word;
+    gwe_Width: FIXED;
+  end;
+
+// outline errors
+const
+  OTERR_Failure      = -1;
+  OTERR_Success      = 0;
+  OTERR_BadTag       = 1;
+  OTERR_UnknownTag   = 2;
+  OTERR_BadData      = 3;
+  OTERR_NoMemory     = 4;
+  OTERR_NoFace       = 5;
+  OTERR_BadFace      = 6;
+  OTERR_NoGlyph      = 7;
+  OTERR_BadGlyph     = 8;
+  OTERR_NoShear      = 9;
+  OTERR_NoRotate     = 10;
+  OTERR_TooSmall     = 11;
+  OTERR_UnknownGlyph = 12;
 
-    pAvailFonts = ^tAvailFonts;
-    tAvailFonts = record
-        af_Type         : Word;
-        af_Attr         : tTextAttr;
-    end;
+const
+    DISKFONTNAME : PChar = 'diskfont.library';
 
-    pTAvailFonts = ^tTAvailFonts;
-    tTAvailFonts = record
-        taf_Type        : Word;
-        taf_Attr        : tTTextAttr;
-    END;
+var DiskfontBase : pLibrary = nil;
 
-    pAvailFontsHeader = ^tAvailFontsHeader;
-    tAvailFontsHeader = record
-        afh_NumEntries  : Word;
-    end;
+function OpenDiskFont(TextAttr: PTextAttr location 'a0'): PTextFont; syscall DiskfontBase 030;
+function AvailFonts(Buffer: STRPTR location 'a0'; BufBytes: LongInt location 'd0'; Flags: LongInt location 'd1'): LongInt; syscall DiskfontBase 036;
+function NewFontContents(FontsLock: BPTR location 'a0'; FontName: STRPTR location 'a1'): PFontContentsHeader; syscall DiskfontBase 042;
+procedure DisposeFontContents(FontContentsHeader: PFontContentsHeader location 'a1'); syscall DiskfontBase 048;
+function NewScaledDiskFont(SourceFont: PTextFont location 'a0'; DestTextAttr: PTextAttr location 'a1'): PDiskFontHeader; syscall DiskfontBase 054;
 
-const
-    DISKFONTNAME : PChar = 'diskfont.library';
+// MorphOS actually supports these V45+ calls
+function GetDiskFontCtrl(TagID: LongInt location 'd0'): LongInt; syscall DiskfontBase 060;
+procedure SetDiskFontCtrlA(TagList: PTagItem location 'a0'); syscall DiskfontBase 066;
 
-VAR DiskfontBase : pLibrary = nil;
+// vartags Version
+procedure SetDiskFontCtrl(const Tags: array of PtrUInt); inline;
 
-FUNCTION AvailFonts(buffer : pCHAR location 'a0'; bufBytes : LONGINT location 'd0'; flags : LONGINT location 'd1') : LONGINT; syscall DiskfontBase 036;
-PROCEDURE DisposeFontContents(fontContentsHeader : pFontContentsHeader location 'a1'); syscall DiskfontBase 048;
-FUNCTION NewFontContents(fontsLock : BPTR location 'a0'; fontName : pCHAR location 'a1') : pFontContentsHeader; syscall DiskfontBase 042;
-FUNCTION NewScaledDiskFont(sourceFont : pTextFont location 'a0'; destTextAttr : pTextAttr location 'a1') : pDiskFontHeader; syscall DiskfontBase 054;
-FUNCTION OpenDiskFont(textAttr : pTextAttr location 'a0') : pTextFont; syscall DiskfontBase 030;
-{ MorphOS actually supports these V45+ calls }
-FUNCTION GetDiskFontCtrl(tagid : LONGINT location 'd0') : LONGINT; syscall DiskfontBase 060;
-PROCEDURE SetDiskFontCtrlA(taglist : pTagItem location 'a0'); syscall DiskfontBase 066;
+function InitDiskFontLibrary: boolean; inline;
 
-function InitDISKFONTLibrary: boolean;
+implementation
 
-IMPLEMENTATION
+procedure SetDiskFontCtrl(const Tags: array of PtrUInt);
+begin
+  SetDiskFontCtrlA(@Tags);
+end;
 
 const
-    { Change VERSION and LIBVERSION to proper values }
-    VERSION : string[2] = '0';
-    LIBVERSION : longword = 0;
+  LIBVERSION: LongWord = 0;
 
-function InitDiskFontLibrary: boolean;
+function InitDiskFontLibrary: boolean; inline;
 begin
   InitDiskFontLibrary := Assigned(DiskFontBase);
 end;
 
 initialization
-  DiskFontBase := OpenLibrary(DISKFONTNAME,LIBVERSION);
+  DiskFontBase := OpenLibrary(DISKFONTNAME, LIBVERSION);
 finalization
   if Assigned(DiskFontBase) then
     CloseLibrary(DiskFontBase);

+ 1 - 0
packages/morphunits/src/exec.pas

@@ -27,6 +27,7 @@ var
 { Some types for classic Amiga and AROS compatibility }
 type
   STRPTR    = PChar;
+  WSTRPTR   = PWideChar;
   ULONG     = Longword;
   LONG      = Longint;
   APTR      = Pointer;

+ 111 - 90
packages/morphunits/src/keymap.pas

@@ -16,111 +16,132 @@
 {$PACKRECORDS 2}
 unit keymap;
 
-INTERFACE
-
-uses exec, inputevent;
-
-Type
-
-    pKeyMap = ^tKeyMap;
-    tKeyMap = record
-        km_LoKeyMapTypes        : Pointer;
-        km_LoKeyMap             : Pointer;
-        km_LoCapsable           : Pointer;
-        km_LoRepeatable         : Pointer;
-        km_HiKeyMapTypes        : Pointer;
-        km_HiKeyMap             : Pointer;
-        km_HiCapsable           : Pointer;
-        km_HiRepeatable         : Pointer;
-    end;
-
-
-    pKeymapNode = ^tKeyMapNode;
-    tKeyMapNode = record
-        kn_Node         : tNode;         { including name of keymap }
-        kn_KeyMap       : tKeyMap;
-    end;
-
-{ the structure of keymap.resource }
-
-    pKeyMapResource = ^tKeyMapResource;
-    tKeyMapResource = record
-        kr_Node         : tNode;
-        kr_List         : tList;         { a list of KeyMapNodes }
-    end;
-
-
-Const
-
-{ Key Map Types }
-
-    KC_NOQUAL           = 0;
-    KC_VANILLA          = 7;    { note that SHIFT+ALT+CTRL is VANILLA }
-    KCB_SHIFT           = 0;
-    KCF_SHIFT           = $01;
-    KCB_ALT             = 1;
-    KCF_ALT             = $02;
-    KCB_CONTROL         = 2;
-    KCF_CONTROL         = $04;
-    KCB_DOWNUP          = 3;
-    KCF_DOWNUP          = $08;
-
-    KCB_DEAD            = 5;    { may be dead or modified by dead key:  }
-    KCF_DEAD            = $20;  {   use dead prefix bytes               }
-
-    KCB_STRING          = 6;
-    KCF_STRING          = $40;
-
-    KCB_NOP             = 7;
-    KCF_NOP             = $80;
-
-
-{ Dead Prefix Bytes }
+interface
+
+uses
+  exec, inputevent;
+
+type
+  PKeyMap = ^TKeyMap;
+  TKeyMap = record
+    km_LoKeyMapTypes: PByte;
+    km_LoKeyMap: PLongWord;
+    km_LoCapsable: PByte;
+    km_LoRepeatable: PByte;
+    km_HiKeyMapTypes: PByte;
+    km_HiKeyMap: PLongWord;
+    km_HiCapsable: PByte;
+    km_HiRepeatable: PByte;
+  end;
+
+  PKeymapNode = ^TKeyMapNode;
+  TKeyMapNode = record
+    kn_Node: TNode;      // including name of keymap
+    kn_KeyMap: TKeyMap;
+  end;
+
+{$PACKRECORDS 4}
+  PExtendedKeyMapNode = ^TExtendedKeyMapNode;
+  TExtendedKeyMapNode = record
+    ekn_Node: TNode;
+    ekn_KeyMap: TKeyMap;
+    ekn_Seglist: BPTR;
+    ekn_Resident: PResident;
+    ekn_Future0: APTR;        // keep 0 for now
+  end;
+{$PACKRECORDS 2}
 
-    DPB_MOD             = 0;
-    DPF_MOD             = $01;
-    DPB_DEAD            = 3;
-    DPF_DEAD            = $08;
+// the structure of keymap.resource
+  PKeyMapResource = ^TKeyMapResource;
+  TKeyMapResource = record
+    kr_Node: TNode;
+    kr_List: TList;  // a list of KeyMapNodes
+  end;
 
-    DP_2DINDEXMASK      = $0f;  { mask for index for 1st of two dead keys }
-    DP_2DFACSHIFT       = 4;    { shift for factor for 1st of two dead keys }
+const
+// Key Map Types
+  KC_NOQUAL   = 0;
+  KC_VANILLA  = 7;   // note that SHIFT+ALT+CTRL is VANILLA
+
+  KCB_SHIFT   = 0;
+  KCF_SHIFT   = 1 shl KCB_SHIFT;
+  KCB_ALT     = 1;
+  KCF_ALT     = 1 shl KCB_ALT;
+  KCB_CONTROL = 2;
+  KCF_CONTROL = 1 shl KCB_CONTROL;
+  KCB_DOWNUP  = 3;
+  KCF_DOWNUP  = 1 shl KCB_DOWNUP;
+
+  KCB_DEAD    = 5;              // may be dead or modified by dead key:
+  KCF_DEAD    = 1 shl KCB_DEAD; // use dead prefix bytes
+
+  KCB_STRING  = 6;
+  KCF_STRING  = 1 shl KCB_STRING;
+
+  KCB_NOP     = 7;
+  KCF_NOP     = 1 shl KCB_NOP;
+
+  // Dead Prefix Bytes
+  DPB_MOD  = 0;
+  DPF_MOD  = 1 shl DPB_MOD;
+  DPB_DEAD = 3;
+  DPF_DEAD = 1 shl DPB_DEAD;
+
+  DP_2DINDEXMASK = $0f; // mask for index for 1st of two dead keys
+  DP_2DFACSHIFT  = 4;   // shift for factor for 1st of two dead keys
+
+type
+  PUCS4_ConvTable = ^TUCS4_ConvTable;
+  TUCS4_ConvTable = record
+    FirstChar: Word;
+    LastChar: Word;
+    ConvTable: APTR; // Either pointer to Byte or LongWord
+  end;
+
+  PUCS4_CharsetCode = ^TUCS4_CharsetCode;
+  TUCS4_CharsetCode = record
+    UCS4: LongWord;
+    CharsetCode: LongWord;
+  end;
+
+  PUCS4_CharsetConvTable = ^TUCS4_CharsetConvTable;
+  TUCS4_CharsetConvTable = record
+    Mapping: PUCS4_CharsetCode;  // An optional array, terminated with  (0, 0) entry
+    ConvTables: array[0..0] of TUCS4_ConvTable; // 0 sized array
+  end;
 
 var
-  KeymapBase : pLibrary = nil;
+  KeyMapBase: PLibrary = nil;
 
 const
-    KEYMAPNAME : PChar = 'keymap.library';
-
-procedure SetKeyMapDefault(CONST keyMap : pKeyMap location 'a0');
-SysCall KeymapBase 030;
-
-function AskKeyMapDefault : pKeyMap;
-SysCall KeymapBase 036;
-
-function MapRawKey(CONST event : pInputEvent location 'a0'; buffer : PChar location 'a1'; length : longint location 'd1'; CONST keyMap : pKeyMap location 'a2') : INTEGER;
-SysCall KeymapBase 042;
-
-function MapANSI(CONST strg : PChar location 'a0'; count : longint location 'd0'; buffer : PChar location 'a1'; length : longint location 'd1'; CONST keyMap : pKeyMap location 'a2') : longint;
-SysCall KeymapBase 048;
-
-{ Helper calls }
+  KEYMAPNAME: PChar = 'keymap.library';
+
+procedure SetKeyMapDefault(const KeyMap: PKeyMap location 'a0'); SysCall KeyMapBase 030;
+function AskKeyMapDefault: PKeyMap; SysCall KeyMapBase 036;
+function MapRawKey(const Event: PInputEvent location 'a0'; Buffer: STRPTR location 'a1'; Length: LongInt location 'd1'; const KeyMap: PKeyMap location 'a2'): LongInt; SysCall KeyMapBase 042;
+function MapANSI(const Strg: STRPTR location 'a0'; Count: LongInt location 'd0'; Buffer: STRPTR location 'a1'; Length: LongInt location 'd1'; const KeyMap: PKeyMap location 'a2'): LongInt; SysCall KeyMapBase 048;
+function MapRawKeyUCS4(const Event: PInputEvent location 'a0'; Buffer: WSTRPTR location 'a1'; Length: LongInt location 'd1'; const KeyMap: PKeyMap location 'a2'): LongInt; SysCall KeyMapBase 54;
+function MapUCS4(const Strg: WSTRPTR location 'a0'; Count: LongInt location 'd0'; Buffer: STRPTR location 'a1'; Length: LongInt location 'd1'; const KeyMap: PKeyMap location 'a2'): LongInt; SysCall KeyMapBase 60;
+function ToANSI(UCS4Char: WideChar location 'a0'; const KeyMap: PKeyMap location 'a1'): Char; SysCall KeyMapBase 66;
+function ToUCS4(ASCIIChar: Char location 'a0'; const KeyMap: PKeyMap location 'a1'): WideChar; SysCall KeyMapBase 72;
+function GetKeyMapCodePage(const KeyMap: PKeyMap location 'a0'): STRPTR; SysCall KeyMapBase 78;
+
+// Helper calls
 function InitKeymapLibrary : boolean;
 
 implementation
 
 const
-  { Change VERSION and LIBVERSION to proper values }
-  VERSION : string[2] = '50';
-  LIBVERSION : longword = 50;
+  LIBVERSION: LongWord = 50;
 
-function InitKeymapLibrary : boolean;
+function InitKeymapLibrary: boolean;
 begin
-  InitKeymapLibrary := Assigned(KeymapBase);
+  InitKeyMapLibrary := Assigned(KeyMapBase);
 end;
 
 initialization
-  KeymapBase := OpenLibrary(KEYMAPNAME,LIBVERSION);
+  KeyMapBase := OpenLibrary(KEYMAPNAME, LIBVERSION);
 finalization
-  if Assigned(KeymapBase) then
-    CloseLibrary(PLibrary(KeymapBase));
+  if Assigned(KeyMapBase) then
+    CloseLibrary(PLibrary(KeyMapBase));
 end.

+ 0 - 3
packages/morphunits/src/locale.pas

@@ -21,9 +21,6 @@ interface
 uses
   exec, amigados, utility;
 
-type
-  WSTRPTR = PWideChar;
-
 const
   // Internal String-Numbers GetLocaleStr()
   // Days of Week