Commit 7e903adb authored by Martin Schreiber's avatar Martin Schreiber

+ mseexecmacros.pas.

+ EXEC_OUT macro.
parent fe395fea
......@@ -147,7 +147,7 @@ ${MAC_IFDEF(macroname,notdefinedvalue,definedvalue)}
MSEide environment macros
*************************
${ENV_VAR(variablename)} returns the macro value if defined.
${ENV_VAR(variablename)} returns the variable value if defined.
${ENV_VAR(variablename,notdefinedvalue)} returns the variable value if defined,
notdefinedvalue otherwise.
${ENV_VAR(variablename,notdefinedvalue,definedvalue)}
......@@ -167,6 +167,10 @@ FILE_EXT file name extension.
FILE_NONAME directory part only.
FILE_NOEXT no file name extension.
MSEide exec macros
******************
${EXEC_OUT(commandline)} executes commandline, returns the process output.
MSEide macros in 'Project'-'Options'-'Debugger'-'xterm Command'
***************************************************************
${PTS} expands to tty pts path.
......
......@@ -874,7 +874,7 @@ uses
watchform,stackform,main,projecttreeform,findinfileform,
selecteditpageform,programparametersform,sourceupdate,mseimagelisteditor,
msesysenvmanagereditor,targetconsole,
msefilemacros,mseenvmacros,msemacmacros,
msefilemacros,mseenvmacros,msemacmacros,mseexecmacros,
msedesigner,panelform,watchpointsform,commandlineform,messageform,
componentpaletteform,mserichstring,msesettings,formdesigner,actionsmodule,
msestringlisteditor,msetexteditor,msepropertyeditors,mseshapes,mseactions,
......@@ -1077,7 +1077,7 @@ begin
value:= d.t.progparameters;
end;
end;
result:= initmacros([result,macmacros,filemacros,envmacros]);
result:= initmacros([result,macmacros,filemacros,envmacros,execmacros]);
end;
procedure hintmacros(const sender: tcustomedit; var info: hintinfoty);
......
{ MSEgui Copyright (c) 2015 by Martin Schreiber
See the file COPYING.MSE, included in this distribution,
for details about the copyright.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
}
unit mseexecmacros;
{$ifdef FPC}{$mode objfpc}{$h+}{$endif}
interface
uses
msemacros;
function execmacros(): macroinfoarty;
implementation
uses
mseprocess,mseprocutils,msefileutils,msestrings;
var
fexecmacros: macroinfoarty;
function execmacros(): macroinfoarty;
begin
result:= fexecmacros;
end;
function exec_out(const sender: tmacrolist;
const params: msestringarty): msestring;
var
str1: string;
begin
result:= '';
if params <> nil then begin
getprocessoutput(syscommandline(params[0]),'',str1,1000000);
result:= msestring(str1);
end;
end;
const
execmacroconst: array[0..0] of macroinfoty = (
(name: 'EXEC_OUT'; value: ''; handler: macrohandlerty(@exec_out);
expandlevel: 0) //processoutput
);
procedure initexecmacros();
var
int1: integer;
begin
setlength(fexecmacros,length(execmacroconst));
for int1:= 0 to high(execmacroconst) do begin
fexecmacros[int1]:= execmacroconst[int1];
end;
end;
initialization
initexecmacros();
end.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment