added <CPN and <CPFS> symbolic strings

This commit is contained in:
Basile Burg 2014-11-01 09:57:18 +01:00
parent 02337b060b
commit 66a5d9f0e2
4 changed files with 38 additions and 9 deletions

View File

@ -6,9 +6,10 @@ import std.getopt;
/* /*
pass: pass:
--a=<CPF> --b=<CPP> --c=<CPR> --d=<CFF> --e=<CFP> --f=<CI> --g=<CAF> --h=<CAP> --a=<CPF> --b=<CPP> --c=<CPR> --d=<CFF> --e=<CFP> --f=<CI> --g=<CAF> --h=<CAP> --j=<CPN> --k=<CPFS>
as parameters in "Run, Compile and Run file..." as parameters in "Run, Compile and Run file..."
<CPFS>: only the first item is displayed but the symbol is expanded as expected.
*/ */
void main(string args[]) void main(string args[])
{ {

View File

@ -88,7 +88,7 @@ begin
proc.Parameters.Clear; proc.Parameters.Clear;
for i:= 0 to fParameters.Count-1 do for i:= 0 to fParameters.Count-1 do
if fParameters.Strings[i] <> '' then if fParameters.Strings[i] <> '' then
proc.Parameters.Add(CEMainForm.expandSymbolicString(fParameters.Strings[i])); proc.Parameters.AddText(CEMainForm.expandSymbolicString(fParameters.Strings[i]));
proc.Options := proc.Options - [poUsePipes, poWaitOnExit]; proc.Options := proc.Options - [poUsePipes, poWaitOnExit];
proc.Execute; proc.Execute;
finally finally

View File

@ -920,7 +920,7 @@ begin
str2 := '-' + str1 str2 := '-' + str1
else else
str2 := str1; str2 := str1;
aList.Add(CEMainForm.expandSymbolicString(str2)); aList.AddText(CEMainForm.expandSymbolicString(str2));
end; end;
end; end;

View File

@ -1268,7 +1268,7 @@ var
dmdproc: TProcess; dmdproc: TProcess;
ppproc: TProcess; ppproc: TProcess;
olddir, prjpath, ppname: string; olddir, prjpath, ppname: string;
i: NativeInt; i, j: NativeInt;
begin begin
fMesgWidg.ClearAllMessages; fMesgWidg.ClearAllMessages;
@ -1283,8 +1283,11 @@ begin
try try
preBuildProcess.setProcess(ppproc); preBuildProcess.setProcess(ppproc);
ppproc.Executable := ppname; ppproc.Executable := ppname;
for i:= 0 to ppproc.Parameters.Count-1 do j := ppproc.Parameters.Count-1;
ppproc.Parameters.Strings[i] := expandSymbolicString(ppproc.Parameters.Strings[i]); for i:= 0 to j do
ppproc.Parameters.AddText(expandSymbolicString(ppproc.Parameters.Strings[i]));
for i:= 0 to j do
ppproc.Parameters.Delete(0);
if ppproc.CurrentDirectory = '' then if ppproc.CurrentDirectory = '' then
ppproc.CurrentDirectory := extractFilePath(ppproc.Executable); ppproc.CurrentDirectory := extractFilePath(ppproc.Executable);
ppproc.Execute; ppproc.Execute;
@ -1342,8 +1345,11 @@ begin
try try
postBuildProcess.setProcess(ppproc); postBuildProcess.setProcess(ppproc);
ppproc.Executable := ppname; ppproc.Executable := ppname;
for i:= 0 to ppproc.Parameters.Count-1 do j := ppproc.Parameters.Count-1;
ppproc.Parameters.Strings[i] := expandSymbolicString(ppproc.Parameters.Strings[i]); for i:= 0 to j do
ppproc.Parameters.AddText(expandSymbolicString(ppproc.Parameters.Strings[i]));
for i:= 0 to j do
ppproc.Parameters.Delete(0);
if ppproc.CurrentDirectory = '' then if ppproc.CurrentDirectory = '' then
ppproc.CurrentDirectory := extractFilePath(ppproc.Executable); ppproc.CurrentDirectory := extractFilePath(ppproc.Executable);
ppproc.Execute; ppproc.Execute;
@ -1724,7 +1730,7 @@ var
elems: TStringList; elems: TStringList;
elem: string; elem: string;
begs, ends: boolean; begs, ends: boolean;
i: integer; i, j, extLen: integer;
begin begin
if symString = '' then if symString = '' then
exit('``'); exit('``');
@ -1769,6 +1775,28 @@ begin
if fileExists(fProject.fileName) then if fileExists(fProject.fileName) then
result += fProject.fileName; result += fProject.fileName;
end; end;
'CPFS', 'CurrentProjectFiles':
begin
if fProject <> nil then
if fileExists(fProject.fileName) then
for j := 0 to fProject.Sources.Count-1 do
begin
result += fProject.getAbsoluteSourceName(j);
if fProject.Sources.Count > 1 then
if j <> fProject.Sources.Count-1 then
result += LineEnding;
end;
end;
'CPN', 'CurrentProjectName':
begin
if fProject <> nil then
if fileExists(fProject.fileName) then
begin
result += extractFileName(fProject.fileName);
extLen := length(ExtractFileExt(result));
result := result[1..length(result)-extLen];
end;
end;
'CPP', 'CurrentProjectPath': 'CPP', 'CurrentProjectPath':
begin begin
if fProject <> nil then if fProject <> nil then