mirror of
https://github.com/keymanapp/keyman.git
synced 2026-08-12 03:45:34 +00:00
Merge pull request #9248 from keymanapp/chore/common-9079-builder-str-ref-epic-ldml
chore(common): add BUILDER_STR_REF 🙀
This commit is contained in:
commit
bf66631550
15 changed files with 136 additions and 114 deletions
|
|
@ -1,6 +1,6 @@
|
|||
import { constants } from '@keymanapp/ldml-keyboard-constants';
|
||||
import { KMXPlusData } from "../kmx-plus.js";
|
||||
import { build_strs_index, BUILDER_STRS } from "./build-strs.js";
|
||||
import { build_strs_index, BUILDER_STR_REF, BUILDER_STRS } from "./build-strs.js";
|
||||
import { BUILDER_SECTION } from './builder-section.js';
|
||||
|
||||
/* ------------------------------------------------------------------
|
||||
|
|
@ -11,13 +11,13 @@ import { BUILDER_SECTION } from './builder-section.js';
|
|||
* Builder for the 'disp' section
|
||||
*/
|
||||
interface BUILDER_DISP_ITEM {
|
||||
to: number;
|
||||
display: number;
|
||||
to: BUILDER_STR_REF;
|
||||
display: BUILDER_STR_REF;
|
||||
};
|
||||
|
||||
export interface BUILDER_DISP extends BUILDER_SECTION {
|
||||
count: number;
|
||||
baseCharacter: number;
|
||||
baseCharacter: BUILDER_STR_REF;
|
||||
items: BUILDER_DISP_ITEM[];
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -1,16 +1,19 @@
|
|||
import { constants } from "@keymanapp/ldml-keyboard-constants";
|
||||
import { ElementString } from "../element-string.js";
|
||||
import { Elem } from "../kmx-plus.js";
|
||||
import { build_strs_index, BUILDER_STRS } from "./build-strs.js";
|
||||
import { BUILDER_SECTION } from "./builder-section.js";
|
||||
import { build_uset_index, BUILDER_USET } from "./build-uset.js";
|
||||
import { build_strs_index, BUILDER_STR_REF, BUILDER_STRS } from "./build-strs.js";
|
||||
import { BUILDER_SECTION, BUILDER_U32CHAR } from "./builder-section.js";
|
||||
import { build_uset_index, BUILDER_USET, BUILDER_USET_REF } from "./build-uset.js";
|
||||
|
||||
/* ------------------------------------------------------------------
|
||||
* elem section
|
||||
------------------------------------------------------------------ */
|
||||
|
||||
/** return from build_elem_index */
|
||||
export type BUILDER_ELEM_REF = number;
|
||||
|
||||
interface BUILDER_ELEM_ELEMENT {
|
||||
element: number; // str | UTF-32 char
|
||||
element: BUILDER_STR_REF | BUILDER_USET_REF | BUILDER_U32CHAR; // str | UTF-32 char
|
||||
flags: number;
|
||||
_value: string;
|
||||
};
|
||||
|
|
@ -98,7 +101,7 @@ export function build_elem(source_elem: Elem, sect_strs: BUILDER_STRS, sect_uset
|
|||
return result;
|
||||
}
|
||||
|
||||
export function build_elem_index(sect_elem: BUILDER_ELEM, value: ElementString) {
|
||||
export function build_elem_index(sect_elem: BUILDER_ELEM, value: ElementString) : BUILDER_ELEM_REF{
|
||||
if(!(value instanceof ElementString)) {
|
||||
throw new Error('unexpected value '+value);
|
||||
}
|
||||
|
|
@ -107,5 +110,5 @@ export function build_elem_index(sect_elem: BUILDER_ELEM, value: ElementString)
|
|||
if(result < 0) {
|
||||
throw new Error('unexpectedly missing StrsItem '+value);
|
||||
}
|
||||
return result;
|
||||
return <BUILDER_ELEM_REF>result;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
|
||||
import { constants } from "@keymanapp/ldml-keyboard-constants";
|
||||
import { KeysFlick, KMXPlusData, StrsItem } from "../kmx-plus.js";
|
||||
import { build_strs_index, BUILDER_STRS } from "./build-strs.js";
|
||||
import { build_list_index, BUILDER_LIST } from "./build-list.js";
|
||||
import { BUILDER_SECTION } from "./builder-section.js";
|
||||
import { build_strs_index, BUILDER_STR_REF, BUILDER_STRS } from "./build-strs.js";
|
||||
import { build_list_index, BUILDER_LIST, BUILDER_LIST_REF } from "./build-list.js";
|
||||
import { BUILDER_SECTION, BUILDER_U32CHAR } from "./builder-section.js";
|
||||
|
||||
/* ------------------------------------------------------------------
|
||||
* keys section
|
||||
|
|
@ -13,15 +13,15 @@ import { BUILDER_SECTION } from "./builder-section.js";
|
|||
* This struct is a single <key> in the keys keybag
|
||||
*/
|
||||
interface BUILDER_KEYS_KEY {
|
||||
to: number; // str or single codepoint
|
||||
to: BUILDER_STR_REF | BUILDER_U32CHAR; // str or single codepoint
|
||||
flags: number;
|
||||
id: number; // str with original key id
|
||||
id: BUILDER_STR_REF; // str with original key id
|
||||
_id: string; // original key id, for sorting
|
||||
switch: number; // str with layer of new l
|
||||
switch: BUILDER_STR_REF; // str with layer of new l
|
||||
width: number; // ceil((width||1)*10), so 12 for width 1.2
|
||||
longPress: number; // list of longPress sequences
|
||||
longPressDefault: number; // str with the default longPress target
|
||||
multiTap: number; // list of multiTap sequences
|
||||
longPress: BUILDER_LIST_REF; // list of longPress sequences
|
||||
longPressDefault: BUILDER_STR_REF; // str with the default longPress target
|
||||
multiTap: BUILDER_LIST_REF; // list of multiTap sequences
|
||||
flicks: number; // index into the flicks[] subtable for this flick list
|
||||
};
|
||||
|
||||
|
|
@ -31,7 +31,7 @@ interface BUILDER_KEYS_KEY {
|
|||
interface BUILDER_KEYS_FLICKS {
|
||||
count: number; // number of BUILDER_KEYS_FLICK entries in this flick list
|
||||
flick: number; // index into the flick[] subtable of the first flick in the list
|
||||
id: number; // str with the original id of this flicks
|
||||
id: BUILDER_STR_REF; // str with the original id of this flicks
|
||||
_id: string; // copy of the flicks id, used for sorting during build
|
||||
_flicks: KeysFlick[]; // temporary copy of KeysFlick object
|
||||
};
|
||||
|
|
@ -40,9 +40,9 @@ interface BUILDER_KEYS_FLICKS {
|
|||
* This is a single <flick> element.
|
||||
*/
|
||||
interface BUILDER_KEYS_FLICK {
|
||||
directions: number; // list of cardinal/intercardinal directions
|
||||
directions: BUILDER_LIST_REF; // list of cardinal/intercardinal directions
|
||||
flags: number; //
|
||||
to: number; // str or single codepoint
|
||||
to: BUILDER_STR_REF | number; // str or single codepoint
|
||||
};
|
||||
|
||||
|
||||
|
|
@ -56,8 +56,6 @@ interface BUILDER_KEYS_KMAP {
|
|||
* Builder for the 'keys' section
|
||||
*/
|
||||
export interface BUILDER_KEYS extends BUILDER_SECTION {
|
||||
ident: number;
|
||||
size: number;
|
||||
keyCount: number;
|
||||
flicksCount: number;
|
||||
flickCount: number;
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
|
||||
import { constants } from "@keymanapp/ldml-keyboard-constants";
|
||||
import { KMXPlusData, LayrEntry, LayrRow, StrsItem } from "../kmx-plus.js";
|
||||
import { build_strs_index, BUILDER_STRS } from "./build-strs.js";
|
||||
import { build_strs_index, BUILDER_STR_REF, BUILDER_STRS } from "./build-strs.js";
|
||||
import { BUILDER_LIST } from "./build-list.js";
|
||||
import { BUILDER_SECTION } from "./builder-section.js";
|
||||
|
||||
|
|
@ -24,7 +24,7 @@ interface BUILDER_LAYR_LIST {
|
|||
* <layer> element
|
||||
*/
|
||||
interface BUILDER_LAYR_LAYER {
|
||||
id: number; // str of layer id
|
||||
id: BUILDER_STR_REF; // str of layer id
|
||||
_id: string; // original layer id, for sorting
|
||||
mod: number; // bitfield with modifier info
|
||||
row: number; // row index into row subtable
|
||||
|
|
|
|||
|
|
@ -1,13 +1,16 @@
|
|||
import { constants } from "@keymanapp/ldml-keyboard-constants";
|
||||
import { List, ListItem } from "../kmx-plus.js";
|
||||
import { build_strs_index, BUILDER_STRS } from "./build-strs.js";
|
||||
import { build_strs_index, BUILDER_STR_REF, BUILDER_STRS } from "./build-strs.js";
|
||||
import { BUILDER_SECTION } from "./builder-section.js";
|
||||
|
||||
/* ------------------------------------------------------------------
|
||||
* list section
|
||||
------------------------------------------------------------------ */
|
||||
|
||||
/**
|
||||
/** reference from build_list_index */
|
||||
export type BUILDER_LIST_REF = number;
|
||||
|
||||
/**
|
||||
* A list entry.
|
||||
*/
|
||||
interface BUILDER_LIST_LIST {
|
||||
|
|
@ -17,7 +20,7 @@ interface BUILDER_LIST_LIST {
|
|||
};
|
||||
|
||||
interface BUILDER_LIST_INDEX {
|
||||
str: number; // str for this string
|
||||
str: BUILDER_STR_REF; // str for this string
|
||||
_value: string; // for locating this string during finalization
|
||||
};
|
||||
|
||||
|
|
@ -82,7 +85,7 @@ export function build_list(source_list: List, sect_strs: BUILDER_STRS): BUILDER_
|
|||
* @param value
|
||||
* @returns
|
||||
*/
|
||||
export function build_list_index(sect_list: BUILDER_LIST, value: ListItem) {
|
||||
export function build_list_index(sect_list: BUILDER_LIST, value: ListItem) : BUILDER_LIST_REF {
|
||||
if(!(value instanceof ListItem)) {
|
||||
throw new Error('unexpected value '+ value);
|
||||
}
|
||||
|
|
@ -91,5 +94,5 @@ export function build_list_index(sect_list: BUILDER_LIST, value: ListItem) {
|
|||
if(result < 0) {
|
||||
throw new Error('unexpectedly missing ListItem ' + value); // TODO-LDML: it's an array of strs
|
||||
}
|
||||
return result;
|
||||
return <BUILDER_LIST_REF>result;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
import { constants } from "@keymanapp/ldml-keyboard-constants";
|
||||
import { KMXPlusData } from "../kmx-plus.js";
|
||||
import { build_strs_index, BUILDER_STRS } from "./build-strs.js";
|
||||
import { build_strs_index, BUILDER_STR_REF, BUILDER_STRS } from "./build-strs.js";
|
||||
import { BUILDER_SECTION } from "./builder-section.js";
|
||||
|
||||
/**
|
||||
|
|
@ -13,7 +13,7 @@ import { BUILDER_SECTION } from "./builder-section.js";
|
|||
*/
|
||||
export interface BUILDER_LOCA extends BUILDER_SECTION {
|
||||
count: number;
|
||||
items: number[]; //str[]
|
||||
items: BUILDER_STR_REF[]; //str[]
|
||||
};
|
||||
|
||||
export function build_loca(kmxplus: KMXPlusData, sect_strs: BUILDER_STRS): BUILDER_LOCA {
|
||||
|
|
|
|||
|
|
@ -5,19 +5,19 @@
|
|||
|
||||
import { constants } from "@keymanapp/ldml-keyboard-constants";
|
||||
import { KMXPlusData } from "../kmx-plus.js";
|
||||
import { build_strs_index, BUILDER_STRS } from "./build-strs.js";
|
||||
import { build_strs_index, BUILDER_STR_REF, BUILDER_STRS } from "./build-strs.js";
|
||||
import { BUILDER_SECTION } from "./builder-section.js";
|
||||
|
||||
/**
|
||||
* Builder for the 'meta' section
|
||||
*/
|
||||
export interface BUILDER_META extends BUILDER_SECTION {
|
||||
author: number; //str
|
||||
conform: number; //str
|
||||
layout: number; //str
|
||||
normalization: number; //str
|
||||
indicator: number; //str
|
||||
version: number; //str
|
||||
author: BUILDER_STR_REF; //str
|
||||
conform: BUILDER_STR_REF; //str
|
||||
layout: BUILDER_STR_REF; //str
|
||||
normalization: BUILDER_STR_REF; //str
|
||||
indicator: BUILDER_STR_REF; //str
|
||||
version: BUILDER_STR_REF; //str
|
||||
settings: number; //bitfield
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
import { constants } from "@keymanapp/ldml-keyboard-constants";
|
||||
import { KMXPlusData } from "../kmx-plus.js";
|
||||
import { build_strs_index, BUILDER_STRS } from "./build-strs.js";
|
||||
import { build_strs_index, BUILDER_STR_REF, BUILDER_STRS } from "./build-strs.js";
|
||||
import { BUILDER_SECTION } from "./builder-section.js";
|
||||
|
||||
/**
|
||||
|
|
@ -13,7 +13,7 @@ import { BUILDER_SECTION } from "./builder-section.js";
|
|||
*/
|
||||
export interface BUILDER_NAME extends BUILDER_SECTION {
|
||||
count: number;
|
||||
items: number[]; //str[]
|
||||
items: BUILDER_STR_REF[];
|
||||
};
|
||||
|
||||
export function build_name(kmxplus: KMXPlusData, sect_strs: BUILDER_STRS): BUILDER_NAME {
|
||||
|
|
|
|||
|
|
@ -2,6 +2,9 @@ import { constants } from "@keymanapp/ldml-keyboard-constants";
|
|||
import { Strs, StrsItem } from "../kmx-plus.js";
|
||||
import { BUILDER_SECTION } from "./builder-section.js";
|
||||
|
||||
/** reference from build_strs_index */
|
||||
export type BUILDER_STR_REF = number;
|
||||
|
||||
/* ------------------------------------------------------------------
|
||||
* strs section
|
||||
------------------------------------------------------------------ */
|
||||
|
|
@ -11,7 +14,7 @@ interface BUILDER_STRS_ITEM {
|
|||
// we always write a null terminator, so we can get restructure to do that for us here
|
||||
offset: number; //? new r.Pointer(r.uint32le, new r.String(null, 'utf16le')),
|
||||
length: number; // in UTF-16 code units
|
||||
_value: string
|
||||
_value: string; // in-memory: for finding and sorting
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
@ -48,7 +51,7 @@ export function build_strs(source_strs: Strs): BUILDER_STRS {
|
|||
/**
|
||||
* @returns str index, or UTF-32 char if value.char is set (single char)
|
||||
*/
|
||||
export function build_strs_index(sect_strs: BUILDER_STRS, value: StrsItem) {
|
||||
export function build_strs_index(sect_strs: BUILDER_STRS, value: StrsItem) : BUILDER_STR_REF {
|
||||
if(!(value instanceof StrsItem)) {
|
||||
if (value === null) {
|
||||
throw new Error('unexpected null StrsItem, use an empty string instead');
|
||||
|
|
@ -58,12 +61,12 @@ export function build_strs_index(sect_strs: BUILDER_STRS, value: StrsItem) {
|
|||
}
|
||||
|
||||
if(value.isOneChar) {
|
||||
return value.char;
|
||||
return <BUILDER_STR_REF>value.char;
|
||||
}
|
||||
|
||||
let result = sect_strs.items.findIndex(v => v._value === value.value);
|
||||
if(result < 0) {
|
||||
throw new Error('unexpectedly missing StrsItem '+value.value);
|
||||
}
|
||||
return result;
|
||||
return <BUILDER_STR_REF>result;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
|
||||
import { constants } from "@keymanapp/ldml-keyboard-constants";
|
||||
import { Bksp, Tran } from "../kmx-plus.js";
|
||||
import { BUILDER_ELEM, build_elem_index } from "./build-elem.js";
|
||||
import { BUILDER_STRS, build_strs_index } from "./build-strs.js";
|
||||
import { BUILDER_ELEM, BUILDER_ELEM_REF, build_elem_index } from "./build-elem.js";
|
||||
import { BUILDER_STRS, BUILDER_STR_REF, build_strs_index } from "./build-strs.js";
|
||||
import { BUILDER_SECTION } from "./builder-section.js";
|
||||
|
||||
/* ------------------------------------------------------------------
|
||||
|
|
@ -16,15 +16,15 @@ interface BUILDER_TRAN_GROUP {
|
|||
};
|
||||
|
||||
interface BUILDER_TRAN_TRANSFORM {
|
||||
from: number; //str
|
||||
to: number; //str
|
||||
mapFrom: number; // elem
|
||||
mapTo: number; // elem
|
||||
from: BUILDER_STR_REF; //str
|
||||
to: BUILDER_STR_REF; //str
|
||||
mapFrom: BUILDER_ELEM_REF; // elem
|
||||
mapTo: BUILDER_ELEM_REF; // elem
|
||||
};
|
||||
|
||||
interface BUILDER_TRAN_REORDER {
|
||||
elements: number; //elem
|
||||
before: number; //elem
|
||||
elements: BUILDER_ELEM_REF; //elem
|
||||
before: BUILDER_ELEM_REF; //elem
|
||||
};
|
||||
|
||||
export interface BUILDER_TRAN extends BUILDER_SECTION {
|
||||
|
|
|
|||
|
|
@ -1,19 +1,21 @@
|
|||
import { constants } from "@keymanapp/ldml-keyboard-constants";
|
||||
import { KMXPlusData, StrsItem, UsetItem } from "../kmx-plus.js";
|
||||
import { build_strs_index, BUILDER_STRS } from "./build-strs.js";
|
||||
import { BUILDER_SECTION } from "./builder-section.js";
|
||||
import { build_strs_index, BUILDER_STR_REF, BUILDER_STRS } from "./build-strs.js";
|
||||
import { BUILDER_SECTION, BUILDER_U32CHAR } from "./builder-section.js";
|
||||
|
||||
/** reference from build_uset_index */
|
||||
export type BUILDER_USET_REF = number;
|
||||
|
||||
interface BUILDER_USET_USET {
|
||||
range: number;
|
||||
count: number;
|
||||
pattern: number; // str
|
||||
pattern: BUILDER_STR_REF;
|
||||
_pattern: StrsItem; // for sorting
|
||||
};
|
||||
|
||||
interface BUILDER_USET_RANGE {
|
||||
start: number;
|
||||
end: number;
|
||||
start: BUILDER_U32CHAR; // uchar32
|
||||
end: BUILDER_U32CHAR; // uchar32
|
||||
}
|
||||
|
||||
export interface BUILDER_USET extends BUILDER_SECTION {
|
||||
|
|
|
|||
|
|
@ -1,19 +1,20 @@
|
|||
import { constants } from "@keymanapp/ldml-keyboard-constants";
|
||||
import { KMXPlusData } from "../kmx-plus.js";
|
||||
import { build_strs_index, BUILDER_STRS } from "./build-strs.js";
|
||||
import { build_strs_index, BUILDER_STR_REF, BUILDER_STRS } from "./build-strs.js";
|
||||
import { BUILDER_SECTION } from "./builder-section.js";
|
||||
import { build_elem_index, BUILDER_ELEM } from "./build-elem.js";
|
||||
import { BUILDER_LIST_REF } from "./build-list.js";
|
||||
import { build_elem_index, BUILDER_ELEM, BUILDER_ELEM_REF } from "./build-elem.js";
|
||||
|
||||
|
||||
interface BUILDER_VARS_ITEM {
|
||||
type: number;
|
||||
id: number; // str
|
||||
value: number; // str
|
||||
elem?: number; // elem
|
||||
id: BUILDER_STR_REF; // str
|
||||
value: BUILDER_STR_REF; // str
|
||||
elem?: BUILDER_ELEM_REF; // elem
|
||||
};
|
||||
|
||||
export interface BUILDER_VARS extends BUILDER_SECTION {
|
||||
markers: number; // list, TODO-LDML
|
||||
markers: BUILDER_LIST_REF;
|
||||
varCount: number;
|
||||
varEntries: BUILDER_VARS_ITEM[];
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,5 +1,10 @@
|
|||
/** for a 4-byte section identity */
|
||||
export type BUILDER_IDENT = number;
|
||||
/** for a single UTF-32 character (Unicode codepoint) */
|
||||
export type BUILDER_U32CHAR = number;
|
||||
|
||||
export interface BUILDER_SECTION {
|
||||
ident: number;
|
||||
ident: BUILDER_IDENT;
|
||||
size: number;
|
||||
_offset: number; // used only for building the output
|
||||
}
|
||||
|
|
|
|||
|
|
@ -187,5 +187,4 @@ export default class KMXPlusBuilder {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -639,6 +639,14 @@ export class KMXPlusFile extends KMXFile {
|
|||
super();
|
||||
// Binary-correct structures matching kmx_plus.h
|
||||
|
||||
// helpers
|
||||
const STR_REF = r.uint32le;
|
||||
const ELEM_REF = r.uint32le;
|
||||
const LIST_REF = r.uint32le;
|
||||
const STR_OR_CHAR32 = r.uint32le;
|
||||
const CHAR32 = r.uint32le;
|
||||
const STR_OR_CHAR32_OR_USET = r.uint32le;
|
||||
const IDENT = r.uint32le;
|
||||
// 'sect'
|
||||
|
||||
this.COMP_PLUS_SECT_ITEM = new r.Struct({
|
||||
|
|
@ -647,7 +655,7 @@ export class KMXPlusFile extends KMXFile {
|
|||
});
|
||||
|
||||
this.COMP_PLUS_SECT = new r.Struct({
|
||||
ident: r.uint32le,
|
||||
ident: IDENT,
|
||||
size: r.uint32le,
|
||||
total: r.uint32le,
|
||||
count: r.uint32le,
|
||||
|
|
@ -658,22 +666,22 @@ export class KMXPlusFile extends KMXFile {
|
|||
|
||||
// 'disp'
|
||||
this.COMP_PLUS_DISP_ITEM = new r.Struct({
|
||||
to: r.uint32le,
|
||||
display: r.uint32le,
|
||||
to: STR_REF,
|
||||
display: STR_REF,
|
||||
});
|
||||
|
||||
this.COMP_PLUS_DISP = new r.Struct({
|
||||
ident: r.uint32le,
|
||||
ident: IDENT,
|
||||
size: r.uint32le,
|
||||
count: r.uint32le,
|
||||
baseCharacter: r.uint32le,
|
||||
baseCharacter: CHAR32,
|
||||
items: new r.Array(this.COMP_PLUS_DISP_ITEM, 'count'),
|
||||
});
|
||||
|
||||
// 'elem'
|
||||
|
||||
this.COMP_PLUS_ELEM_ELEMENT = new r.Struct({
|
||||
element: r.uint32le,
|
||||
element: STR_OR_CHAR32_OR_USET,
|
||||
flags: r.uint32le
|
||||
});
|
||||
|
||||
|
|
@ -683,7 +691,7 @@ export class KMXPlusFile extends KMXFile {
|
|||
});
|
||||
|
||||
this.COMP_PLUS_ELEM = new r.Struct({
|
||||
ident: r.uint32le,
|
||||
ident: IDENT,
|
||||
size: r.uint32le,
|
||||
count: r.uint32le,
|
||||
strings: new r.Array(this.COMP_PLUS_ELEM_STRING, 'count')
|
||||
|
|
@ -720,7 +728,7 @@ export class KMXPlusFile extends KMXFile {
|
|||
});
|
||||
|
||||
this.COMP_PLUS_LAYR = new r.Struct({
|
||||
ident: r.uint32le,
|
||||
ident: IDENT,
|
||||
size: r.uint32le,
|
||||
listCount: r.uint32le,
|
||||
layerCount: r.uint32le,
|
||||
|
|
@ -733,26 +741,26 @@ export class KMXPlusFile extends KMXFile {
|
|||
});
|
||||
|
||||
this.COMP_PLUS_KEYS_FLICK = new r.Struct({
|
||||
directions: r.uint32le, // list
|
||||
directions: LIST_REF, // list
|
||||
flags: r.uint32le,
|
||||
to: r.uint32le, // str | codepoint
|
||||
to: STR_OR_CHAR32, // str | codepoint
|
||||
});
|
||||
|
||||
this.COMP_PLUS_KEYS_FLICKS = new r.Struct({
|
||||
count: r.uint32le,
|
||||
flick: r.uint32le,
|
||||
id: r.uint32le, // str
|
||||
id: STR_REF, // str
|
||||
});
|
||||
|
||||
this.COMP_PLUS_KEYS_KEY = new r.Struct({
|
||||
to: r.uint32le, // str | codepoint
|
||||
to: STR_OR_CHAR32, // str | codepoint
|
||||
flags: r.uint32le,
|
||||
id: r.uint32le, // str
|
||||
switch: r.uint32le, // str
|
||||
id: STR_REF, // str
|
||||
switch: STR_REF, // str
|
||||
width: r.uint32le, // width*10 ( 1 = 0.1 keys)
|
||||
longPress: r.uint32le, // list index
|
||||
longPressDefault: r.uint32le, // str
|
||||
multiTap: r.uint32le, // list index
|
||||
longPress: LIST_REF, // list index
|
||||
longPressDefault: STR_REF, // str
|
||||
multiTap: LIST_REF, // list index
|
||||
flicks: r.uint32le, // index into flicks table
|
||||
});
|
||||
|
||||
|
|
@ -763,7 +771,7 @@ export class KMXPlusFile extends KMXFile {
|
|||
});
|
||||
|
||||
this.COMP_PLUS_KEYS = new r.Struct({
|
||||
ident: r.uint32le,
|
||||
ident: IDENT,
|
||||
size: r.uint32le,
|
||||
keyCount: r.uint32le,
|
||||
flicksCount: r.uint32le,
|
||||
|
|
@ -783,11 +791,11 @@ export class KMXPlusFile extends KMXFile {
|
|||
});
|
||||
|
||||
this.COMP_PLUS_LIST_INDEX = new r.Struct({
|
||||
str: r.uint32le, // str
|
||||
str: STR_REF, // str
|
||||
});
|
||||
|
||||
this.COMP_PLUS_LIST = new r.Struct({
|
||||
ident: r.uint32le,
|
||||
ident: IDENT,
|
||||
size: r.uint32le,
|
||||
listCount: r.uint32le,
|
||||
indexCount: r.uint32le,
|
||||
|
|
@ -800,7 +808,7 @@ export class KMXPlusFile extends KMXFile {
|
|||
this.COMP_PLUS_LOCA_ITEM = r.uint32le; //str
|
||||
|
||||
this.COMP_PLUS_LOCA = new r.Struct({
|
||||
ident: r.uint32le,
|
||||
ident: IDENT,
|
||||
size: r.uint32le,
|
||||
count: r.uint32le,
|
||||
items: new r.Array(this.COMP_PLUS_LOCA_ITEM, 'count')
|
||||
|
|
@ -809,14 +817,14 @@ export class KMXPlusFile extends KMXFile {
|
|||
// 'meta'
|
||||
|
||||
this.COMP_PLUS_META = new r.Struct({
|
||||
ident: r.uint32le,
|
||||
ident: IDENT,
|
||||
size: r.uint32le,
|
||||
author: r.uint32le, //str
|
||||
conform: r.uint32le, //str
|
||||
layout: r.uint32le, //str
|
||||
normalization: r.uint32le, //str
|
||||
indicator: r.uint32le, //str
|
||||
version: r.uint32le, //str
|
||||
author: STR_REF, //str
|
||||
conform: STR_REF, //str
|
||||
layout: STR_REF, //str
|
||||
normalization: STR_REF, //str
|
||||
indicator: STR_REF, //str
|
||||
version: STR_REF, //str
|
||||
settings: r.uint32le, //new r.Bitfield(r.uint32le, ['fallback', 'transformFailure', 'transformPartial'])
|
||||
});
|
||||
|
||||
|
|
@ -825,7 +833,7 @@ export class KMXPlusFile extends KMXFile {
|
|||
this.COMP_PLUS_NAME_ITEM = r.uint32le; //str
|
||||
|
||||
this.COMP_PLUS_NAME = new r.Struct({
|
||||
ident: r.uint32le,
|
||||
ident: IDENT,
|
||||
size: r.uint32le,
|
||||
count: r.uint32le,
|
||||
items: new r.Array(this.COMP_PLUS_NAME_ITEM, 'count')
|
||||
|
|
@ -843,7 +851,7 @@ export class KMXPlusFile extends KMXFile {
|
|||
});
|
||||
|
||||
this.COMP_PLUS_STRS = new r.Struct({
|
||||
ident: r.uint32le,
|
||||
ident: IDENT,
|
||||
size: r.uint32le,
|
||||
count: r.uint32le,
|
||||
items: new r.Array(this.COMP_PLUS_STRS_ITEM, 'count')
|
||||
|
|
@ -859,19 +867,19 @@ export class KMXPlusFile extends KMXFile {
|
|||
});
|
||||
|
||||
this.COMP_PLUS_TRAN_TRANSFORM = new r.Struct({
|
||||
from: r.uint32le, //str
|
||||
to: r.uint32le, //str
|
||||
mapFrom: r.uint32le, //elem
|
||||
mapTo: r.uint32le //elem
|
||||
from: STR_REF, //str
|
||||
to: STR_REF, //str
|
||||
mapFrom: ELEM_REF, //elem
|
||||
mapTo: ELEM_REF //elem
|
||||
});
|
||||
|
||||
this.COMP_PLUS_TRAN_REORDER = new r.Struct({
|
||||
elements: r.uint32le, //elem
|
||||
before: r.uint32le, //elem
|
||||
elements: ELEM_REF, //elem
|
||||
before: ELEM_REF, //elem
|
||||
});
|
||||
|
||||
this.COMP_PLUS_TRAN = new r.Struct({
|
||||
ident: r.uint32le,
|
||||
ident: IDENT,
|
||||
size: r.uint32le,
|
||||
groupCount: r.uint32le,
|
||||
transformCount: r.uint32le,
|
||||
|
|
@ -885,16 +893,16 @@ export class KMXPlusFile extends KMXFile {
|
|||
this.COMP_PLUS_USET_USET = new r.Struct({
|
||||
range: r.uint32le,
|
||||
count: r.uint32le,
|
||||
pattern: r.uint32le, // str
|
||||
pattern: STR_REF, // str
|
||||
});
|
||||
|
||||
this.COMP_PLUS_USET_RANGE = new r.Struct({
|
||||
start: r.uint32le,
|
||||
end: r.uint32le,
|
||||
start: CHAR32,
|
||||
end: CHAR32,
|
||||
});
|
||||
|
||||
this.COMP_PLUS_USET = new r.Struct({
|
||||
ident: r.uint32le,
|
||||
ident: IDENT,
|
||||
size: r.uint32le,
|
||||
usetCount: r.uint32le,
|
||||
rangeCount: r.uint32le,
|
||||
|
|
@ -906,15 +914,15 @@ export class KMXPlusFile extends KMXFile {
|
|||
|
||||
this.COMP_PLUS_VARS_ITEM = new r.Struct({
|
||||
type: r.uint32le,
|
||||
id: r.uint32le, // str
|
||||
value: r.uint32le, // str
|
||||
elem: r.uint32le, // elem TODO-LDML
|
||||
id: STR_REF, // str
|
||||
value: STR_REF, // str
|
||||
elem: ELEM_REF,
|
||||
});
|
||||
|
||||
this.COMP_PLUS_VARS = new r.Struct({
|
||||
ident: r.uint32le,
|
||||
ident: IDENT,
|
||||
size: r.uint32le,
|
||||
markers: r.uint32le, // list TODO-LDML
|
||||
markers: LIST_REF,
|
||||
varCount: r.uint32le,
|
||||
varEntries: new r.Array(this.COMP_PLUS_VARS_ITEM, 'varCount'),
|
||||
});
|
||||
|
|
@ -927,7 +935,7 @@ export class KMXPlusFile extends KMXFile {
|
|||
});
|
||||
|
||||
this.COMP_PLUS_VKEY = new r.Struct({
|
||||
ident: r.uint32le,
|
||||
ident: IDENT,
|
||||
size: r.uint32le,
|
||||
count: r.uint32le,
|
||||
items: new r.Array(this.COMP_PLUS_VKEY_ITEM, 'count')
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue