From: DeaDDooMER Date: Tue, 4 Aug 2020 17:58:59 +0000 (+0300) Subject: cpmake: read target-specific library replacements from file "libs" X-Git-Url: http://deadsoftware.ru/gitweb?a=commitdiff_plain;h=3e5a4737d6df12df371d139556ee8fea7722ead6;p=cpc.git cpmake: read target-specific library replacements from file "libs" --- diff --git a/src/generic/Dsw/Mod/MakeMain.cp b/src/generic/Dsw/Mod/MakeMain.cp index b88795d..25c80b5 100644 --- a/src/generic/Dsw/Mod/MakeMain.cp +++ b/src/generic/Dsw/Mod/MakeMain.cp @@ -123,6 +123,11 @@ MODULE DswMakeMain; END END Define; + PROCEDURE DefineNew (IN n: ARRAY OF CHAR); + BEGIN + Define(n, FALSE); + END DefineNew; + PROCEDURE AddModule (IN n: ARRAY OF CHAR; selectors: Selector; dir: DevCPM.Directory); VAR i, res: INTEGER; m: Module; BEGIN @@ -253,11 +258,13 @@ MODULE DswMakeMain; END END ParseArgs; - PROCEDURE ReadDefines; - VAR loc: Files.Locator; name: Files.Name; m: DswDocuments.Model; r: DswDocuments.Reader; i, res: INTEGER; + PROCEDURE ReadLines (loc: Files.Locator; IN name: Files.Name; p: PROCEDURE (IN s: ARRAY OF CHAR)); + VAR s: Name; m: DswDocuments.Model; r: DswDocuments.Reader; i, res: INTEGER; BEGIN - loc := Files.dir.This(base).This(target); - DswDocuments.Open(loc, "defines", m, res); + ASSERT(loc # NIL, 20); + ASSERT(name # "", 21); + ASSERT(p # NIL, 22); + DswDocuments.Open(loc, name, m, res); IF res = 0 THEN r := m.NewReader(NIL); r.SetPos(0); @@ -265,13 +272,14 @@ MODULE DswMakeMain; WHILE ~r.eot DO i := 0; WHILE ~r.eot & (r.char <= 20X) DO r.Read END; - WHILE ~r.eot & (r.char > 20X) DO name[i] := r.char; r.Read; INC(i) END; - IF i # 0 THEN name[i] := 0X; Define(name, FALSE) END + WHILE ~r.eot & (r.char > 20X) DO s[i] := r.char; r.Read; INC(i) END; + IF i # 0 THEN s[i] := 0X; p(s) END END END - END ReadDefines; + END ReadLines; PROCEDURE CheckParams; + VAR loc: Files.Locator; BEGIN IF (exe # NIL) & (exe^ = "") THEN Error("specified empty file name for exe", "", "", 0) @@ -282,7 +290,9 @@ MODULE DswMakeMain; IF base^ = "" THEN Error("specified empty path to cpmake rules", "", "", 0) END; - ReadDefines + loc := Files.dir.This(base).This(target); + ReadLines(loc, "defines", DefineNew); + ReadLines(loc, "libs", AddLib) END CheckParams; (* --------- loader --------- *)