mirror of https://gitlab.com/basile.b/dexed.git
implemented expandSymbolicString, added usage for several TProcess.Parameters, added a runnable d test for current constants
This commit is contained in:
parent
e592b047e0
commit
6a20a971a4
|
@ -0,0 +1,19 @@
|
||||||
|
module runnable;
|
||||||
|
|
||||||
|
import std.stdio;
|
||||||
|
import std.getopt;
|
||||||
|
|
||||||
|
// pass --a=<CPF> --b=<CPP> --c=<CFF> --d=<CFP> --e=<CI> --f=<CAF> --g=<CAP> as parameters in "Run file..."
|
||||||
|
void main(string args[])
|
||||||
|
{
|
||||||
|
|
||||||
|
string expanded;
|
||||||
|
for (char c = 'a'; c != 'z'; c++)
|
||||||
|
{
|
||||||
|
expanded = "";
|
||||||
|
getopt(args, std.getopt.config.passThrough, c, &expanded);
|
||||||
|
if (expanded.length != 0)
|
||||||
|
writeln(expanded);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -98,12 +98,13 @@ inherited CEEditorWidget: TCEEditorWidget
|
||||||
object completion: TSynCompletion[4]
|
object completion: TSynCompletion[4]
|
||||||
OnExecute = completionExecute
|
OnExecute = completionExecute
|
||||||
Position = 0
|
Position = 0
|
||||||
LinesInWindow = 6
|
LinesInWindow = 8
|
||||||
SelectedColor = clHighlight
|
SelectedColor = clHighlight
|
||||||
CaseSensitive = True
|
CaseSensitive = True
|
||||||
Width = 262
|
Width = 262
|
||||||
|
ShowSizeDrag = True
|
||||||
ShortCut = 16416
|
ShortCut = 16416
|
||||||
EndOfTokenChr = '()[].'
|
EndOfTokenChr = '()[].!+"''(-*/\$:;?<>'
|
||||||
OnCodeCompletion = completionCodeCompletion
|
OnCodeCompletion = completionCodeCompletion
|
||||||
ExecCommandID = ecSynCompletionExecute
|
ExecCommandID = ecSynCompletionExecute
|
||||||
left = 96
|
left = 96
|
||||||
|
|
|
@ -1936,6 +1936,7 @@ object CEMainForm: TCEMainForm
|
||||||
Caption = 'Compile and run file...'
|
Caption = 'Compile and run file...'
|
||||||
ImageIndex = 22
|
ImageIndex = 22
|
||||||
OnExecute = ActFileCompAndRunWithArgsExecute
|
OnExecute = ActFileCompAndRunWithArgsExecute
|
||||||
|
ShortCut = 24695
|
||||||
end
|
end
|
||||||
object actFileSaveAll: TAction
|
object actFileSaveAll: TAction
|
||||||
Category = 'File'
|
Category = 'File'
|
||||||
|
@ -3039,9 +3040,6 @@ object CEMainForm: TCEMainForm
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
object ApplicationProperties1: TApplicationProperties
|
object ApplicationProperties1: TApplicationProperties
|
||||||
HintHidePause = 4000
|
|
||||||
HintPause = 100
|
|
||||||
HintShortPause = 50
|
|
||||||
OnException = ApplicationProperties1Exception
|
OnException = ApplicationProperties1Exception
|
||||||
OnShowHint = ApplicationProperties1ShowHint
|
OnShowHint = ApplicationProperties1ShowHint
|
||||||
left = 96
|
left = 96
|
||||||
|
|
|
@ -866,7 +866,10 @@ begin
|
||||||
CanShow := true;
|
CanShow := true;
|
||||||
{if EditWidget.currentEditor <> nil then
|
{if EditWidget.currentEditor <> nil then
|
||||||
if EditWidget.currentEditor.Focused then
|
if EditWidget.currentEditor.Focused then
|
||||||
HintStr := EditWidget.getEditorHint;}
|
begin
|
||||||
|
HintStr := EditWidget.getEditorHint;
|
||||||
|
CanShow := HintStr <> '';
|
||||||
|
end;}
|
||||||
end;
|
end;
|
||||||
{$ENDREGION}
|
{$ENDREGION}
|
||||||
|
|
||||||
|
@ -1272,7 +1275,7 @@ begin
|
||||||
fMesgWidg.addCeInf(editor.fileName + ' successfully compiled', mcEditor );
|
fMesgWidg.addCeInf(editor.fileName + ' successfully compiled', mcEditor );
|
||||||
runproc.Options := [poStderrToOutPut, poUsePipes];
|
runproc.Options := [poStderrToOutPut, poUsePipes];
|
||||||
runproc.CurrentDirectory := extractFilePath(runProc.Executable);
|
runproc.CurrentDirectory := extractFilePath(runProc.Executable);
|
||||||
runproc.Parameters.DelimitedText := runArgs;
|
runproc.Parameters.DelimitedText := expandSymbolicString(runArgs);
|
||||||
runproc.Executable := fname {$IFDEF WINDOWS}+ '.exe'{$ENDIF};
|
runproc.Executable := fname {$IFDEF WINDOWS}+ '.exe'{$ENDIF};
|
||||||
runproc.Execute;
|
runproc.Execute;
|
||||||
repeat ProcessOutputToMsg(runproc, mcEditor) until not runproc.Running;
|
repeat ProcessOutputToMsg(runproc, mcEditor) until not runproc.Running;
|
||||||
|
@ -1316,6 +1319,8 @@ begin
|
||||||
ppproc := TProcess.Create(nil);
|
ppproc := TProcess.Create(nil);
|
||||||
try
|
try
|
||||||
preBuildProcess.setProcess(ppproc);
|
preBuildProcess.setProcess(ppproc);
|
||||||
|
for i:= 0 to ppproc.Parameters.Count-1 do
|
||||||
|
ppproc.Parameters.Strings[i] := expandSymbolicString(ppproc.Parameters.Strings[i]);
|
||||||
if ppproc.CurrentDirectory = '' then
|
if ppproc.CurrentDirectory = '' then
|
||||||
ppproc.CurrentDirectory := extractFilePath(ppproc.Executable);
|
ppproc.CurrentDirectory := extractFilePath(ppproc.Executable);
|
||||||
ppproc.Execute;
|
ppproc.Execute;
|
||||||
|
@ -1371,6 +1376,8 @@ begin
|
||||||
ppproc := TProcess.Create(nil);
|
ppproc := TProcess.Create(nil);
|
||||||
try
|
try
|
||||||
postBuildProcess.setProcess(ppproc);
|
postBuildProcess.setProcess(ppproc);
|
||||||
|
for i:= 0 to ppproc.Parameters.Count-1 do
|
||||||
|
ppproc.Parameters.Strings[i] := expandSymbolicString(ppproc.Parameters.Strings[i]);
|
||||||
if ppproc.CurrentDirectory = '' then
|
if ppproc.CurrentDirectory = '' then
|
||||||
ppproc.CurrentDirectory := extractFilePath(ppproc.Executable);
|
ppproc.CurrentDirectory := extractFilePath(ppproc.Executable);
|
||||||
ppproc.Execute;
|
ppproc.Execute;
|
||||||
|
@ -1408,6 +1415,7 @@ begin
|
||||||
prm := ''; i := 1;
|
prm := ''; i := 1;
|
||||||
repeat
|
repeat
|
||||||
prm := ExtractDelimited(i, runArgs, [' ']);
|
prm := ExtractDelimited(i, runArgs, [' ']);
|
||||||
|
prm := expandSymbolicString(prm);
|
||||||
if prm <> '' then
|
if prm <> '' then
|
||||||
runProc.Parameters.AddText(prm);
|
runProc.Parameters.AddText(prm);
|
||||||
Inc(i);
|
Inc(i);
|
||||||
|
@ -1849,9 +1857,94 @@ end;
|
||||||
{$ENDREGION}
|
{$ENDREGION}
|
||||||
|
|
||||||
function TCEMainForm.expandSymbolicString(const symString: string): string;
|
function TCEMainForm.expandSymbolicString(const symString: string): string;
|
||||||
|
var
|
||||||
|
elems: TStringList;
|
||||||
|
elem: string;
|
||||||
|
begs, ends: boolean;
|
||||||
|
i: integer;
|
||||||
begin
|
begin
|
||||||
// expands some symbolic constant, e.g: project path, current file name, etc.
|
|
||||||
result := '';
|
result := '';
|
||||||
|
elems := TStringList.Create;
|
||||||
|
try
|
||||||
|
i := 0;
|
||||||
|
elem := '';
|
||||||
|
repeat
|
||||||
|
inc(i);
|
||||||
|
if not (symString[i] in ['<', '>']) then
|
||||||
|
elem += symString[i]
|
||||||
|
else
|
||||||
|
begin
|
||||||
|
if symString[i] = '<' then
|
||||||
|
begs := true;
|
||||||
|
ends := symString[i] = '>';
|
||||||
|
elems.Add(elem);
|
||||||
|
elem := '';
|
||||||
|
if begs and ends then
|
||||||
|
begin
|
||||||
|
begs := false;
|
||||||
|
ends := false;
|
||||||
|
elems.Objects[elems.Count-1] := Self;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
until
|
||||||
|
i = length(symString);
|
||||||
|
elems.Add(elem);
|
||||||
|
elem := '';
|
||||||
|
for i:= 0 to elems.Count-1 do
|
||||||
|
begin
|
||||||
|
if elems.Objects[i] = nil then
|
||||||
|
result += elems.Strings[i]
|
||||||
|
else case elems.Strings[i] of
|
||||||
|
'<','>' :
|
||||||
|
continue;
|
||||||
|
'CPF', 'CurrentProjectFile':
|
||||||
|
begin
|
||||||
|
result += '`';
|
||||||
|
if fProject <> nil then
|
||||||
|
if fileExists(fProject.fileName) then
|
||||||
|
result += fProject.fileName;
|
||||||
|
result += '`';
|
||||||
|
end;
|
||||||
|
'CPP', 'CurrentProjectPath':
|
||||||
|
begin
|
||||||
|
result += '`';
|
||||||
|
if fProject <> nil then
|
||||||
|
if fileExists(fProject.fileName) then
|
||||||
|
result += extractFilePath(fProject.fileName);
|
||||||
|
result += '`';
|
||||||
|
end;
|
||||||
|
'CFF', 'CurrentFileFile':
|
||||||
|
begin
|
||||||
|
result += '`';
|
||||||
|
if EditWidget.currentEditor <> nil then
|
||||||
|
if fileExists(EditWidget.currentEditor.fileName) then
|
||||||
|
result += EditWidget.currentEditor.fileName;
|
||||||
|
result += '`';
|
||||||
|
end;
|
||||||
|
'CFP', 'CurrentFilePath':
|
||||||
|
begin
|
||||||
|
result += '`';
|
||||||
|
if EditWidget.currentEditor <> nil then
|
||||||
|
if fileExists(EditWidget.currentEditor.fileName) then
|
||||||
|
result += extractFilePath(EditWidget.currentEditor.fileName);
|
||||||
|
result += '`';
|
||||||
|
end;
|
||||||
|
'CI', 'CurrentIdentifier':
|
||||||
|
begin
|
||||||
|
result += '`';
|
||||||
|
if EditWidget.currentEditor <> nil then
|
||||||
|
result += EditWidget.currentEditor.Identifier;
|
||||||
|
result += '`';
|
||||||
|
end;
|
||||||
|
'CAF', 'CoeditApplicationFile':
|
||||||
|
result += '`' + application.ExeName + '`';
|
||||||
|
'CAP', 'CoeditApplicationPath':
|
||||||
|
result += '`' + extractFilePath(Application.ExeName) + '`';
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
finally
|
||||||
|
elems.Free;
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure PlugDispatchToHost(aPlugin: TCEPlugin; opCode: LongWord; data0: Integer; data1, data2: Pointer); cdecl;
|
procedure PlugDispatchToHost(aPlugin: TCEPlugin; opCode: LongWord; data0: Integer; data1, data2: Pointer); cdecl;
|
||||||
|
|
Loading…
Reference in New Issue