diff options
-rw-r--r-- | .gitignore | 2 | ||||
-rw-r--r-- | Make.1.in | 39 | ||||
-rw-r--r-- | Make.lps | 104 | ||||
-rw-r--r-- | dateibeziehungen.pas | 114 |
4 files changed, 140 insertions, 119 deletions
@@ -8,7 +8,7 @@ *.out Machdatei Make -Make.8 +Make.1 lib ewemake *~ @@ -63,37 +63,34 @@ Commands on one line are concatenated with \fB&&\fP instead of \fB;\fP \- to use .SH SUBSTITUTIONS Some substitutions and macros are recognized. Obviously, substitutions marked with \fB(*)\fP are only available in COMMAND- and TARGET-DEFINITION lines. +Number parameters may be omitted from back to front and default to \fI0\fP unless otherwise noted. .TP -.B "%nurmit'filePart'" (*) -only execute command / generate target name from source file if name of source file contains \fIfilePart\fP +.B "%nurmit\fIn\fP'filePart'%" (*) +only execute command / generate target name from source file if name of \fIn\fP-th source file contains \fIfilePart\fP .TP -.B "%nurohne'filePart'" (*) -opposite of \fB%nurmit'filePart'\fP +.B "%nurohne\fIn\fP'filePart'%" (*) +opposite of \fB%nurmit'filePart'%\fP .TP -.B "%in" (*) -file name and path of source file +.B "%in\fIn\fP%" (*) +file name and path of \fIn\fP-th source file .TP -.B "%ifile" (*) -file name of source file +.B "%ifile\fIn\fP%" (*) +file name of \fIn\fP-th source file .TP -.B "%basename" (*) -file name of source file without extension(s) +.B "%basename\fIn\fP%" (*) +file name of \fIn\fP-th source file without extension(s) .TP -.B "%dirname(num1,num2)" (*) -components \fInum1\fP upto \fInum2\fP of path to source file. -Negative numbers are counted from the back - e.g. \fB-1\fP is the last path component, etc. -\fInum2\fP may be omitted, it defaults to \fB-1\fP. +.B "%dirname\fIn1\fP,\fIn2\fP,\fIn3\fP%" (*) +components \fIn1\fP upto \fIn2\fP of path to \fIn3\fP-th source file. +Negative numbers \fIn1\fP or \fIn2\fP are counted from the back - e.g. \fB-1\fP is the last path component, etc. +If omitted, \fIn2\fP defaults to \fI-1\fP. .TP -.B "%dirname" (*) -path so source file. -Identical to \fB%dirname(0)\fP. -.TP -.B "%DIRNAME" +.B "%DIRNAME%" path to \fIMachdatei\fP .TP -.B "%num'string'" +.B "%num'string'%" last decimal number in \fIstring\fP. -E.g. \fB%num'abc123def456ghi'\fP becomes \fB456\fP. +E.g. \fB%num'abc123def456ghi'%\fP becomes \fB456\fP. .SH AUTHOR .nf Erich Eckner <opensource at eckner dot net> @@ -3,30 +3,29 @@ <ProjectSession> <Version Value="9"/> <BuildModes Active="Default"/> - <Units Count="16"> + <Units Count="17"> <Unit0> <Filename Value="Make.lpr"/> <IsPartOfProject Value="True"/> - <TopLine Value="2"/> + <TopLine Value="32"/> <CursorPos Y="26"/> - <UsageCount Value="85"/> + <UsageCount Value="87"/> <Loaded Value="True"/> </Unit0> <Unit1> <Filename Value="Machdatei.txt"/> <IsPartOfProject Value="True"/> - <UsageCount Value="85"/> + <UsageCount Value="87"/> <DefaultSyntaxHighlighter Value="None"/> </Unit1> <Unit2> <Filename Value="tools.pas"/> <IsPartOfProject Value="True"/> - <IsVisibleTab Value="True"/> <EditorIndex Value="2"/> - <TopLine Value="365"/> - <CursorPos X="52" Y="383"/> - <FoldState Value=" T3iF03B pibjN0K1 pj4jS0D311w"/> - <UsageCount Value="64"/> + <TopLine Value="51"/> + <CursorPos X="32" Y="409"/> + <FoldState Value=" T3iF03B pibjN0K1 pj4jS0D4[95W07n"/> + <UsageCount Value="66"/> <Loaded Value="True"/> </Unit2> <Unit3> @@ -36,17 +35,18 @@ <TopLine Value="83"/> <CursorPos Y="221"/> <FoldState Value=" T3i803718 pialE0E116I"/> - <UsageCount Value="61"/> + <UsageCount Value="63"/> </Unit3> <Unit4> <Filename Value="dateibeziehungen.pas"/> <IsPartOfProject Value="True"/> <UnitName Value="dateiBeziehungen"/> + <IsVisibleTab Value="True"/> <EditorIndex Value="1"/> - <TopLine Value="970"/> - <CursorPos X="48" Y="995"/> - <FoldState Value=" T3k103C pjYkO0A4]9DjX0n3]97kL0P8]91k5071[R4I042 piel70G114I"/> - <UsageCount Value="53"/> + <TopLine Value="1011"/> + <CursorPos X="58" Y="1031"/> + <FoldState Value=" T3k103C pjYkO0A4]9Tk60n3]97kL0P8]91k5071]9EI042 piel80G114*"/> + <UsageCount Value="55"/> <Loaded Value="True"/> </Unit4> <Unit5> @@ -123,125 +123,133 @@ <CursorPos X="23" Y="193"/> <UsageCount Value="10"/> </Unit15> + <Unit16> + <Filename Value="Make.1.in"/> + <EditorIndex Value="-1"/> + <TopLine Value="42"/> + <UsageCount Value="10"/> + <DefaultSyntaxHighlighter Value="None"/> + </Unit16> </Units> <JumpHistory Count="30" HistoryIndex="29"> <Position1> <Filename Value="dateibeziehungen.pas"/> - <Caret Line="491" Column="9" TopLine="316"/> + <Caret Line="636" Column="12" TopLine="603"/> </Position1> <Position2> <Filename Value="dateibeziehungen.pas"/> - <Caret Line="492" Column="9" TopLine="317"/> + <Caret Line="637" Column="10" TopLine="604"/> </Position2> <Position3> <Filename Value="dateibeziehungen.pas"/> - <Caret Line="499" Column="21" TopLine="324"/> + <Caret Line="672" Column="22" TopLine="616"/> </Position3> <Position4> <Filename Value="dateibeziehungen.pas"/> - <Caret Line="500" Column="14" TopLine="325"/> + <Caret Line="673" Column="15" TopLine="617"/> </Position4> <Position5> <Filename Value="dateibeziehungen.pas"/> - <Caret Line="594" Column="12" TopLine="476"/> + <Caret Line="674" Column="14" TopLine="618"/> </Position5> <Position6> <Filename Value="dateibeziehungen.pas"/> </Position6> <Position7> <Filename Value="dateibeziehungen.pas"/> - <Caret Line="89" Column="12" TopLine="56"/> + <Caret Line="90" TopLine="56"/> </Position7> <Position8> <Filename Value="dateibeziehungen.pas"/> - <Caret Line="486" Column="14" TopLine="311"/> + <Caret Line="292" TopLine="219"/> </Position8> <Position9> <Filename Value="dateibeziehungen.pas"/> - <Caret Line="627" Column="10" TopLine="594"/> + <Caret Line="311" TopLine="291"/> </Position9> <Position10> <Filename Value="dateibeziehungen.pas"/> - <Caret Line="635" Column="16" TopLine="602"/> + <Caret Line="471" TopLine="403"/> </Position10> <Position11> <Filename Value="dateibeziehungen.pas"/> - <Caret Line="636" Column="12" TopLine="603"/> + <Caret Line="560" TopLine="471"/> </Position11> <Position12> <Filename Value="dateibeziehungen.pas"/> - <Caret Line="637" Column="10" TopLine="604"/> + <Caret Line="588" TopLine="568"/> </Position12> <Position13> <Filename Value="dateibeziehungen.pas"/> - <Caret Line="672" Column="22" TopLine="616"/> + <Caret Line="595" TopLine="575"/> </Position13> <Position14> <Filename Value="dateibeziehungen.pas"/> - <Caret Line="673" Column="15" TopLine="617"/> + <Caret Line="625" TopLine="598"/> </Position14> <Position15> <Filename Value="dateibeziehungen.pas"/> - <Caret Line="674" Column="14" TopLine="618"/> + <Caret Line="928" Column="30" TopLine="908"/> </Position15> <Position16> - <Filename Value="dateibeziehungen.pas"/> + <Filename Value="tools.pas"/> + <Caret Line="124" TopLine="45"/> </Position16> <Position17> - <Filename Value="dateibeziehungen.pas"/> - <Caret Line="90" TopLine="56"/> + <Filename Value="tools.pas"/> + <Caret Line="112" Column="28" TopLine="88"/> </Position17> <Position18> - <Filename Value="dateibeziehungen.pas"/> - <Caret Line="292" TopLine="219"/> + <Filename Value="tools.pas"/> + <Caret Line="32" Column="41" TopLine="12"/> </Position18> <Position19> <Filename Value="dateibeziehungen.pas"/> - <Caret Line="311" TopLine="291"/> + <Caret Line="116" Column="29" TopLine="98"/> </Position19> <Position20> <Filename Value="dateibeziehungen.pas"/> - <Caret Line="471" TopLine="403"/> + <Caret Line="952" Column="30" TopLine="687"/> </Position20> <Position21> <Filename Value="dateibeziehungen.pas"/> - <Caret Line="560" TopLine="471"/> + <Caret Line="388" Column="80" TopLine="349"/> </Position21> <Position22> <Filename Value="dateibeziehungen.pas"/> - <Caret Line="588" TopLine="568"/> + <Caret Line="408" Column="22" TopLine="379"/> </Position22> <Position23> <Filename Value="dateibeziehungen.pas"/> - <Caret Line="595" TopLine="575"/> + <Caret Line="738" Column="65" TopLine="685"/> </Position23> <Position24> <Filename Value="dateibeziehungen.pas"/> - <Caret Line="625" TopLine="598"/> + <Caret Line="739" Column="8" TopLine="719"/> </Position24> <Position25> <Filename Value="dateibeziehungen.pas"/> - <Caret Line="928" Column="30" TopLine="908"/> + <Caret Line="726" Column="44" TopLine="598"/> </Position25> <Position26> - <Filename Value="tools.pas"/> - <Caret Line="124" TopLine="45"/> + <Filename Value="dateibeziehungen.pas"/> + <Caret Line="739" Column="9" TopLine="660"/> </Position26> <Position27> - <Filename Value="tools.pas"/> - <Caret Line="112" Column="28" TopLine="88"/> + <Filename Value="dateibeziehungen.pas"/> + <Caret Line="783" Column="19" TopLine="751"/> </Position27> <Position28> - <Filename Value="tools.pas"/> - <Caret Line="32" Column="41" TopLine="12"/> + <Filename Value="dateibeziehungen.pas"/> + <Caret Line="333" Column="35" TopLine="317"/> </Position28> <Position29> <Filename Value="dateibeziehungen.pas"/> - <Caret Line="116" Column="29" TopLine="98"/> + <Caret Line="400" Column="21" TopLine="378"/> </Position29> <Position30> <Filename Value="dateibeziehungen.pas"/> - <Caret Line="952" Column="30" TopLine="687"/> + <Caret Line="401" Column="13" TopLine="378"/> </Position30> </JumpHistory> </ProjectSession> diff --git a/dateibeziehungen.pas b/dateibeziehungen.pas index c244a79..dbfa552 100644 --- a/dateibeziehungen.pas +++ b/dateibeziehungen.pas @@ -326,70 +326,86 @@ end; function tGenerischeAbhaengigkeit.quellersetzung(var worin: string; quellen: tDateienMitDaten; momentanePosition: longint): boolean; var - s,anfang,mitte: string; - i,li,re,qNum: longint; - tmpRE: tRegExpr; + s,anfang,mitte,numStr: string; + i,li,re,qNum: longint; + tmpRE: tRegExpr; begin result:=true; - for qNum:=0 to momentanePosition-1 do begin - ersetzeAlleVorkommen(worin,'%in('+inttostr(qNum)+')',quellen[qnum].name); - s:=extractfilename(quellen[qnum].name); - ersetzeAlleVorkommen(worin,'%ifile('+inttostr(qNum)+')',s); + for qNum:=-byte(momentanePosition>0) to momentanePosition-1 do begin + if qNum<0 then + numStr:='' + else + numStr:=inttostr(qnum); + s:=quellen[qnum+byte(qnum<0)].name; + ersetzeAlleVorkommen(worin,'%in'+numStr+'%',s); // %in% + s:=extractfilename(s); + ersetzeAlleVorkommen(worin,'%ifile'+numStr+'%',s); // %ifile% if pos('.',s)>0 then delete(s,pos('.',s),length(s)); - ersetzeAlleVorkommen(worin,'%basename('+inttostr(qNum)+')',s); - - while pos('%dirname('+inttostr(qNum)+',',worin)>0 do begin - anfang:=erstesArgument(worin,'%dirname('+inttostr(qNum)+',',false); - mitte:=erstesArgument(worin,')',false); - s:=extractfilepath(quellen[qnum].name); - if rightStr(s,1)='/' then - delete(s,length(s),1); - i:=anzCs('/',s)+1; - li:=strtoint(trim(erstesArgument(mitte,',',false))); - if li<0 then li:=li+i; - if mitte='' then - re:=0 - else - re:=strtoint(mitte); - if re<=0 then re:=re+i; - while li>0 do begin - dec(li); - dec(re); - erstesArgument(s,'/',false); - end; - mitte:=''; - while re>0 do begin - dec(re); - mitte:=mitte+'/'+erstesArgument(s,'/',false); - end; - delete(mitte,1,1); - worin:=anfang+mitte+worin; - end; + ersetzeAlleVorkommen(worin,'%basename'+numStr+'%',s); // %basename% + end; + + while pos('%dirname',worin)>0 do begin // %dirname% + anfang:=erstesArgument(worin,'%dirname',false); + mitte:=erstesArgument(worin,'%',false); + if mitte='' then + li:=0 + else + li:=strtoint(erstesArgument(mitte,',',true)); + if mitte='' then + re:=-1 + else + re:=strtoint(erstesArgument(mitte,',',true)); + if mitte='' then + qNum:=0 + else + qNum:=strtoint(erstesArgument(mitte,',',true)); + + if qNum>=momentanePosition then + fehler('Quellersetzung sieht ''%dirname%'' für Quelle Nummer '+inttostr(qNum)+' an Position '+inttostr(momentanePosition)+'.'); s:=extractfilepath(quellen[qnum].name); if rightStr(s,1)='/' then delete(s,length(s),1); - ersetzeAlleVorkommen(worin,'%dirname('+inttostr(qnum)+')',s); + i:=anzCs('/',s)+1; + if li<0 then li:=li+i; + if re<0 then re:=re+i; + while li>0 do begin + dec(li); + dec(re); + erstesArgument(s,'/',false); + end; + mitte:=''; + while re>=0 do begin + dec(re); + mitte:=mitte+'/'+erstesArgument(s,'/',false); + end; + delete(mitte,1,1); + worin:=anfang+mitte+worin; end; - allgemeineErsetzungen(worin,machDatei); + allgemeineErsetzungen(worin,machDatei); // %DIRNAME% %num'...'% result:=false; tmpRE:=tRegExpr.create; - for qNum:=0 to momentanePosition-1 do begin - while pos('%nurmit('+inttostr(qnum)+')''',worin)>0 do begin - anfang:=erstesArgument(worin,'%nurmit('+inttostr(qnum)+')''',false); - tmpRE.expression:=erstesArgument(worin,'''',false); - if not tmpRE.exec(quellen[qnum].name) then begin + for qNum:=-byte(momentanePosition>0) to momentanePosition-1 do begin + if qNum<0 then + numStr:='' + else + numStr:=inttostr(qnum); + s:=quellen[qnum+byte(qnum<0)].name; + while pos('%nurmit'+numStr+'''',worin)>0 do begin // %nurmit'...'% + anfang:=erstesArgument(worin,'%nurmit'+numStr+'''',false); + tmpRE.expression:=erstesArgument(worin,'''%',false); + if not tmpRE.exec(s) then begin tmpRE.free; exit; end; worin:=anfang+worin; end; - while pos('%nurohne('+inttostr(qnum)+')''',worin)>0 do begin - anfang:=erstesArgument(worin,'%nurohne('+inttostr(qnum)+')''',false); - tmpRE.expression:=erstesArgument(worin,'''',false); - if tmpRE.exec(quellen[qnum].name) then begin + while pos('%nurohne'+numStr+'''',worin)>0 do begin // %nurohne'...'% + anfang:=erstesArgument(worin,'%nurohne'+numStr+'''',false); + tmpRE.expression:=erstesArgument(worin,'''%',false); + if tmpRE.exec(s) then begin tmpRE.free; exit; end; @@ -1064,10 +1080,10 @@ begin s:=extractfilepath(machDatei); if rightStr(s,1)='/' then delete(s,length(s),1); - ersetzeAlleVorkommen(worin,'%DIRNAME',s); + ersetzeAlleVorkommen(worin,'%DIRNAME%',s); while pos('%num''',worin)>0 do begin anfang:=erstesArgument(worin,'%num'''); - mitte:=erstesArgument(worin,''''); + mitte:=erstesArgument(worin,'''%'); for i:=length(mitte) downto 1 do if mitte[i] in ['0'..'9'] then break |