diff --git a/developer/src/common/delphi/compiler/compile.pas b/developer/src/common/delphi/compiler/compile.pas index 9ebea18ad2..04470239c5 100644 --- a/developer/src/common/delphi/compiler/compile.pas +++ b/developer/src/common/delphi/compiler/compile.pas @@ -141,6 +141,7 @@ type const CKF_KEYMAN = 0; CKF_KEYMANWEB = 1; + // CKF_KEYMANWEB_MODERN = 2; // used only by Typescript-based compiler const CERR_FATAL = $00008000; diff --git a/developer/src/kmc-kmn/src/compiler/compiler.ts b/developer/src/kmc-kmn/src/compiler/compiler.ts index 5ca3f9a942..18995796e2 100644 --- a/developer/src/kmc-kmn/src/compiler/compiler.ts +++ b/developer/src/kmc-kmn/src/compiler/compiler.ts @@ -148,7 +148,8 @@ export class KmnCompiler { private runCompiler(infile: string, outfile: string, options: CompilerOptions): boolean { const CKF_KEYMAN = 0; - const CKF_KEYMANWEB = 1; + // const CKF_KEYMANWEB = 1; // not used -- legacy compiler only + const CKF_KEYMANWEB_MODERN = 2; try { if (!this.wasm.setCompilerOptions(options.shouldAddCompilerVersion ? 1 : 0)) { @@ -161,7 +162,7 @@ export class KmnCompiler { options.compilerWarningsAsErrors ? 1 : 0, options.warnDeprecatedCode ? 1 : 0, this.callbackName, - options.target == 'js' ? CKF_KEYMANWEB : CKF_KEYMAN); + options.target == 'js' ? CKF_KEYMANWEB_MODERN : CKF_KEYMAN); } catch(e) { this.callbacks.reportMessage(CompilerMessages.Fatal_UnexpectedException({e:e})); return false; diff --git a/developer/src/kmcmplib/include/kmcmplibapi.h b/developer/src/kmcmplib/include/kmcmplibapi.h index 8360dd8ea4..2df44d8b6d 100644 --- a/developer/src/kmcmplib/include/kmcmplibapi.h +++ b/developer/src/kmcmplib/include/kmcmplibapi.h @@ -33,13 +33,14 @@ EXTERN bool kmcmp_CompileKeyboardFile( bool AWarnDeprecatedCode, kmcmp_CompilerMessageProc pMsgproc, void* AmsgprocContext, - int target // CKF_KEYMAN || CKF_KEYMANWEB + int target // CKF_KEYMAN || CKF_KEYMANWEB || CKF_KEYMANWEB_MODERN ); /* Compile target */ #define CKF_KEYMAN 0 -#define CKF_KEYMANWEB 1 +#define CKF_KEYMANWEB 1 // For legacy kmcomp compiler, to be deprecated and removed +#define CKF_KEYMANWEB_MODERN 2 // For Typescript kmc-kmw compiler EXTERN bool kmcmp_CompileKeyboardFileToBuffer( char* pszInfile, diff --git a/developer/src/kmcmplib/src/Compiler.cpp b/developer/src/kmcmplib/src/Compiler.cpp index 48d97120d5..4292dd21d9 100644 --- a/developer/src/kmcmplib/src/Compiler.cpp +++ b/developer/src/kmcmplib/src/Compiler.cpp @@ -1042,10 +1042,10 @@ KMX_DWORD ProcessSystemStore(PFILE_KEYBOARD fk, KMX_DWORD SystemID, PFILE_STORE pp2[4] = 0; } - if(CompileTarget == CKF_KEYMAN) { - // When we compile to kmx, we want to save this info into - // the .kmx, but for KMW, we need the original source file - // for the KMW compiler process + if(CompileTarget != CKF_KEYMANWEB_MODERN) { + // When we compile to kmx, we want to save this info into the .kmx, and + // for the legacy kmw compiler, but for kmc-kmw, we need the original + // source file for the kmc-kmw compiler process delete[] sp->dpString; sp->dpString = q; } @@ -1054,7 +1054,7 @@ KMX_DWORD ProcessSystemStore(PFILE_KEYBOARD fk, KMX_DWORD SystemID, PFILE_STORE return msg; } - if(CompileTarget == CKF_KEYMANWEB) { + if(CompileTarget == CKF_KEYMANWEB_MODERN) { delete[] q; } } @@ -1234,7 +1234,7 @@ KMX_DWORD CheckStatementOffsets(PFILE_KEYBOARD fk, PFILE_GROUP gp, PKMX_WCHAR co // Due to a limitation in earlier versions of KeymanWeb, the minimum version // for context() referring to notany() is 14.0. See #917 for details. - if (kmcmp::CompileTarget == CKF_KEYMANWEB) { + if (kmcmp::CompileTarget != CKF_KEYMAN) { for (q = context, i = 1; *q && i < contextOffset; q = incxstr(q), i++); if (*q == UC_SENTINEL && *(q + 1) == CODE_NOTANY) { VERIFY_KEYBOARD_VERSION(fk, VERSION_140, CERR_140FeatureOnlyContextAndNotAnyWeb); @@ -1687,7 +1687,7 @@ int LineTokenType(PKMX_WCHAR *str) /* Test KeymanWeb, Keyman and KeymanOnly prefixes */ if (kmcmp::CompileTarget == CKF_KEYMAN && lpt == lptKeymanWebOnly) return T_BLANK; - if (kmcmp::CompileTarget == CKF_KEYMANWEB && lpt == lptKeymanOnly) return T_BLANK; + if (kmcmp::CompileTarget != CKF_KEYMAN && lpt == lptKeymanOnly) return T_BLANK; while (iswspace(*p)) p++; @@ -2168,7 +2168,7 @@ KMX_DWORD GetXStringImpl(PKMX_WCHAR tstr, PFILE_KEYBOARD fk, PKMX_WCHAR str, KMX // in the web target platform, even if there are platform() rules excluding this possibility. In that (rare) situation, the keyboard developer should simply specify // the &version to be 9.0 or whatever to avoid this behaviour. if (sFlag & (LCTRLFLAG | LALTFLAG | RCTRLFLAG | RALTFLAG | CAPITALFLAG | NOTCAPITALFLAG | NUMLOCKFLAG | NOTNUMLOCKFLAG | SCROLLFLAG | NOTSCROLLFLAG) && - kmcmp::CompileTarget == CKF_KEYMANWEB && + kmcmp::CompileTarget != CKF_KEYMAN && fk->dwFlags & KF_AUTOMATICVERSION) { VERIFY_KEYBOARD_VERSION(fk, VERSION_100, 0); }