chore(developer): enforce file versions for feature

This commit is contained in:
Marc Durdin 2021-11-11 13:26:56 +11:00
parent d704fc6233
commit 33a2e230f6
22 changed files with 30 additions and 11 deletions

View file

@ -42,9 +42,11 @@ namespace kmx {
#define VERSION_80 0x00000800
#define VERSION_90 0x00000900
#define VERSION_100 0x00000A00
#define VERSION_140 0x00000E00
#define VERSION_150 0x00000F00
#define VERSION_MIN VERSION_50
#define VERSION_MAX VERSION_100
#define VERSION_MAX VERSION_150
//
// Backspace types

1
common/test/keyboards/.gitignore vendored Normal file
View file

@ -0,0 +1 @@
*/build/

View file

@ -1,6 +1,6 @@
c u_xxxx_yyyy_2858 generated from template at 2021-11-11 12:27:04
c with name "U_xxxx_yyyy_2858"
store(&VERSION) '10.0'
store(&VERSION) '15.0'
store(&NAME) 'U_xxxx_yyyy_2858'
store(&COPYRIGHT) '©'
store(&KEYBOARDVERSION) '1.0'

File diff suppressed because one or more lines are too long

View file

@ -42,12 +42,10 @@ struct COMP_KEYBOARD {
#define VERSION_80 0x00000800
#define VERSION_90 0x00000900
#define VERSION_100 0x00000A00
#define VERSION_110 0x00000B00
#define VERSION_120 0x00000C00
#define VERSION_130 0x00000D00
#define VERSION_140 0x00000E00
#define VERSION_150 0x00000F00
#define VERSION_MIN VERSION_50
#define VERSION_MAX VERSION_140
#define VERSION_MAX VERSION_150
struct COMP_GROUP {
DWORD dpName; // string (only debug)
@ -122,7 +120,7 @@ struct COMP_STORE {
#define K_CTRLFLAG 0x0020 // Either ctrl flag
#define K_ALTFLAG 0x0040 // Either alt flag
//#define K_METAFLAG 0x0080 // Either Meta-key flag (tentative). Not usable in keyboard rules;
// Used internally (currently, only by KMW) to ensure Meta-key
// Used internally (currently, only by KMW) to ensure Meta-key
// shortcuts safely bypass rules
// Meta key = Command key on macOS, Windows key on Windows
#define CAPITALFLAG 0x0100 // Caps lock on

View file

@ -251,6 +251,7 @@ type
function JavaScript_SetupDebug: string;
function JavaScript_SetupEpilog: string;
function JavaScript_SetupProlog: string;
function IsKeyboardVersion15OrLater: Boolean;
public
function Compile(AOwnerProject: TProject; const InFile: string; const OutFile: string; Debug: Boolean; Callback: TCompilerCallbackW): Boolean; // I3681 // I4140 // I4688 // I4866
constructor Create;
@ -1635,6 +1636,8 @@ var
values: TArray<string>;
begin
values := value.Split(['_']);
if (Length(values) > 1) and not IsKeyboardVersion15OrLater then
Exit(False);
for v in values do
if not IsValidUnicodeValue(StrToIntDef('$'+v, 0)) then
Exit(False);
@ -2340,6 +2343,11 @@ begin
Result := fk.version >= VERSION_140;
end;
function TCompileKeymanWeb.IsKeyboardVersion15OrLater: Boolean;
begin
Result := fk.version >= VERSION_150;
end;
procedure TCompileKeymanWeb.CheckStoreForInvalidFunctions(key: PFILE_KEY; store: PFILE_STORE); // I1520
var
n: Integer;

View file

@ -136,8 +136,16 @@ begin
end;
function GetDebugKMCmpDllPath: string;
var
root: string;
const
DevCompilerPath = 'windows\bin\developer';
begin
Result := GetDebugPath('Debug_KMCMPDLLPath', ExtractFilePath(ParamStr(0)));
if TKeymanPaths.RunningFromSource(root) and
FileExists(root + DevCompilerPath + '\kmcmpdll.dll')
then Result := root + DevCompilerPath
else Result := ExtractFilePath(ParamStr(0));
Result := GetDebugPath('Debug_KMCMPDLLPath', Result);
end;
function GetXMLTemplatePath: string;

View file

@ -1220,6 +1220,7 @@ DWORD ProcessSystemStore(PFILE_KEYBOARD fk, DWORD SystemID, PFILE_STORE sp)
else if (wcsncmp(p, L"9.0", 3) == 0) fk->version = VERSION_90;
else if (wcsncmp(p, L"10.0", 4) == 0) fk->version = VERSION_100;
else if (wcsncmp(p, L"14.0", 4) == 0) fk->version = VERSION_140; // Adds support for #917 -- context() with notany() for KeymanWeb
else if (wcsncmp(p, L"15.0", 4) == 0) fk->version = VERSION_150; // Adds support for U_xxxx_yyyy #2858
else return CERR_InvalidVersion;
if (fk->version < VERSION_60) FOldCharPosMatching = TRUE;

View file

@ -97,9 +97,10 @@ const
VERSION_90 = $00000900;
VERSION_100 = $00000A00;
VERSION_140 = $00000E00;
VERSION_150 = $00000F00;
VERSION_MIN = VERSION_50;
VERSION_MAX = VERSION_140;
VERSION_MAX = VERSION_150;
VERSION_MASK_MINOR = $00FF;
VERSION_MASK_MAJOR = $FF00;

View file

@ -70,9 +70,10 @@
#define VERSION_90 0x00000900
#define VERSION_100 0x00000A00
#define VERSION_140 0x00000E00
#define VERSION_150 0x00000F00
#define VERSION_MIN VERSION_50
#define VERSION_MAX VERSION_140
#define VERSION_MAX VERSION_150
/*
Special flag for WM_CHAR/WM_KEY???/WM_SYSKEY???: says that key has been