[Developer] Cleanup and address review comments

This commit is contained in:
Marc Durdin 2019-01-31 09:25:11 -06:00
parent 8b1199b4fb
commit e8d0210da0
3 changed files with 17 additions and 9 deletions

View file

@ -211,7 +211,8 @@ type
FTabStop: string; // I3681
fMnemonic: Boolean;
FCompilerWarningsAsErrors: Boolean;
FTouchLayoutFont: string; // I4872
FTouchLayoutFont: string;
FFix183_LadderLength: Integer; // I4872
function JavaScript_String(ch: DWord): string; // I2242
@ -266,6 +267,7 @@ uses
CompileErrorCodes,
JsonUtil,
KeymanDeveloperOptions,
KeyboardParser,
Keyman.System.KeyboardUtils,
KeymanWebKeyCodes,
@ -379,6 +381,7 @@ end;
constructor TCompileKeymanWeb.Create;
begin
FillChar(fk, sizeof(fk), 0);
FFix183_LadderLength := FKeymanDeveloperOptions.Fix183_LadderLength; // How frequently to break ladders
end;
destructor TCompileKeymanWeb.Destroy;
@ -711,9 +714,6 @@ begin
// We know the rules are sorted by key code.
// First pass, break the grouping down by key code.
// Result := Result + FTabstop+FTabstop; // I3681
// if HasRules then Result := Result + 'else ';
// HasRules := True;
if fgp.fUsingKeys then
begin
Result := Result + Format('%s%sif(k.KKM(e,%s,%s)) {%s',
@ -733,14 +733,13 @@ begin
LocalCounter := 0;
while (j < Integer(fgp.cxKeyArray)) and (fkp2.Key = fkp.Key) and (fkp2.ShiftFlags = fkp.ShiftFlags) do
begin
//writeln(Format('%d of %d [%d]', [j, fgp.cxKeyArray, fkp.Line]));
if not RuleIsExcludedByPlatform(fkp) then
begin
processed_rule[j] := True;
Result := Result + JavaScript_Rule(FTabStop + FTabStop + FTabStop, IfThen(LocalHasRules, 'else ', ''), fgp, fkp);
Inc(LocalCounter);
if (LocalCounter mod 100) = 0 then
if (FFix183_LadderLength <> 0) and ((LocalCounter mod FFix183_LadderLength) = 0) then
begin
// Break if/else ladders
Result := Result + Format('%sif(m) {}%s', [FTabStop + FTabStop + FTabStop, nl]);
@ -756,7 +755,7 @@ begin
end
else
begin
//TODO
// TODO: context character level switches instead of full context comparisons
Result := Result + JavaScript_Rule(FTabStop + FTabStop + FTabStop, IfThen(HasRules, 'else ', ''), fgp, fkp);
HasRules := True;
Inc(Counter);
@ -764,7 +763,7 @@ begin
Inc(j);
end;
if (Counter mod 100) = 0 then
if (FFix183_LadderLength <> 0) and ((Counter mod FFix183_LadderLength) = 0) then
begin
// Break if/else ladders
// We need to only match if no previous line is matched (i.e. m is false)

View file

@ -59,6 +59,7 @@ type
FOpenKeyboardFilesInSourceView: Boolean; // I4751
FDisplayTheme: string;
FEditorTheme: string;
FFix183_LadderLength: Integer;
procedure CloseRegistry;
procedure OpenRegistry;
function regReadString(const nm, def: string): string;
@ -83,6 +84,7 @@ type
property CharMapAutoLookup: Boolean read FCharMapAutoLookup write FCharMapAutoLookup;
property CharMapDisableDatabaseLookups: Boolean read FCharMapDisableDatabaseLookups write FCharMapDisableDatabaseLookups;
property Fix183_LadderLength: Integer read FFix183_LadderLength write FFix183_LadderLength;
property DebuggerBreakWhenExitingLine: Boolean read FDebuggerBreakWhenExitingLine write FDebuggerBreakWhenExitingLine;
property DebuggerSingleStepAfterBreak: Boolean read FDebuggerSingleStepAfterBreak write FDebuggerSingleStepAfterBreak;
property DebuggerShowStoreOffset: Boolean read FDebuggerShowStoreOffset write FDebuggerShowStoreOffset;
@ -196,6 +198,8 @@ begin
FExternalEditorPath := regReadString(SRegValue_IDEOptExternalEditorPath, '');
FSMTPServer := regReadString(SRegValue_IDEOptSMTPServer, ''); // I4506
FTestEmailAddresses := regReadString(SRegValue_IDEOptTestEmailAddresses, ''); // I4506
FFix183_LadderLength := regReadInt(SRegValue_IDEOpt_WebLadderLength, CRegValue_IDEOpt_WebLadderLength_Default);
finally
CloseRegistry;
end;
@ -233,6 +237,8 @@ begin
regWriteString(SRegValue_IDEOptExternalEditorPath, FExternalEditorPath);
regWriteString(SRegValue_IDEOptSMTPServer, FSMTPServer); // I4506
regWriteString(SRegValue_IDEOptTestEmailAddresses, FTestEmailAddresses); // I4506
regWriteInt(SRegValue_IDEOpt_WebLadderLength, FFix183_LadderLength);
finally
CloseRegistry;
end;

View file

@ -394,6 +394,9 @@ const
SRegValue_IDEOptSMTPServer = 'smtp server'; // CU // I4506
SRegValue_IDEOptTestEmailAddresses = 'test email addresses'; // CU // I4506
SRegValue_IDEOpt_WebLadderLength = 'web ladder length'; // CU
CRegValue_IDEOpt_WebLadderLength_Default = 100;
{ SRegKey_KCT values }
// SRegValue_KCTTemplatePath = 'template path'; // LM