summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 3e5a473)
raw | patch | inline | side by side (parent: 3e5a473)
author | DeaDDooMER <deaddoomer@deadsoftware.ru> | |
Tue, 4 Aug 2020 20:43:23 +0000 (23:43 +0300) | ||
committer | DeaDDooMER <deaddoomer@deadsoftware.ru> | |
Tue, 4 Aug 2020 20:43:23 +0000 (23:43 +0300) |
src/generic/Dsw/Mod/MakeMain.cp | patch | blob | history |
index 25c80b5b0bdfcb5c9026bd14eaac4323fadad02b..ad0ead7eb2d123284edf9388fa1e50b62c15026d 100644 (file)
Kernel.FastCollect
END CheckModule;
- PROCEDURE MakePath (IN dir, name: Files.Name; IN type: Files.Type; OUT path: Files.Name);
+ PROCEDURE GetModText (IN base, sub, name: Files.Name; OUT path: Files.Name; OUT text: DswDocuments.Model);
+ VAR res: INTEGER; loc: Files.Locator;
BEGIN
ASSERT(name # "", 21);
- IF dir = "" THEN path := modDir + "/" + name
- ELSE path := dir + "/" + modDir + "/" + name
+ IF sub = "" THEN
+ loc := Files.dir.This(base);
+ IF base = "" THEN path := name
+ ELSE path := base + "/" + name
+ END
+ ELSE
+ loc := Files.dir.This(base).This(sub).This(modDir);
+ IF base = "" THEN path := sub + "/" + modDir + "/" + name
+ ELSE path := base + "/" + sub + "/" + modDir + "/" + name
+ END
END;
- Kernel.MakeFileName(path, type)
- END MakePath;
+ DswDocuments.Open(loc, name, text, res)
+ END GetModText;
- PROCEDURE Open (loc: Files.Locator; IN sub, name: Files.Name; OUT path: Files.Name; OUT text: DswDocuments.Model);
- VAR res: INTEGER;
+ PROCEDURE Open (IN base, sub, name: Files.Name; OUT path: Files.Name; OUT text: DswDocuments.Model);
+ VAR cp, odc: Files.Name;
BEGIN
- ASSERT(loc # NIL, 20);
- ASSERT(name # "", 21);
- (* !!! use Kernel.MakeFileName instead ".ext" concat !!! *)
- MakePath(sub, name, "cp", path);
- DswDocuments.Open(loc, name + ".cp", text, res);
+ ASSERT(name # "", 20);
+ Files.dir.GetFileName(name, "cp", cp); (* !!! *)
+ GetModText(base, sub, cp, path, text);
IF text = NIL THEN
- MakePath(sub, name, "odc", path);
- DswDocuments.Open(loc, name + ".odc", text, res);
+ Files.dir.GetFileName(name, "odc", odc); (* !!! *)
+ GetModText(base, sub, odc, path, text);
IF (text = NIL) & (sub = "") THEN
- MakePath(sysDir, name, "cp", path);
- loc := Files.dir.This(sysDir).This(modDir);
- DswDocuments.Open(loc, name + ".cp", text, res);
+ GetModText(base, sysDir, cp, path, text);
IF text = NIL THEN
- MakePath(sysDir, name, "odc", path);
- DswDocuments.Open(loc, name + ".odc", text, res);
+ GetModText(base, sysDir, odc, path, text);
IF text = NIL THEN
path := ""
END
PROCEDURE GetSource (IN modName: ARRAY OF CHAR; list: DevCPM.Directory; OUT path: Files.Name; OUT s: String);
VAR
- sub, name: Files.Name; loc: Files.Locator; base: DevCPM.Directory;
- text: DswDocuments.Model; r: DswDocuments.Reader; i, res: INTEGER;
+ sub, name: Files.Name;
+ base: DevCPM.Directory;
+ text: DswDocuments.Model;
+ r: DswDocuments.Reader;
+ i, res: INTEGER;
BEGIN
s := NIL; path := ""; base := list;
Kernel.SplitName(modName, sub, name);
- loc := Files.dir.This(sub).This(modDir);
- Open(loc, sub, name, path, text);
+ Open("", sub, name, path, text);
WHILE (text = NIL) & (base # NIL) DO
ASSERT(base.legacy, 100);
- loc := Files.dir.This(base.path).This(sub).This(modDir);
- Open(loc, sub, name, path, text);
+ Open(base.path, sub, name, path, text);
base := base.next
END;
IF text # NIL THEN
CheckModule(m, src, ok);
IF ~ok THEN INC(err) END
ELSE
- Error("unable to open module ^1", m.name$, "", 0)
+ Error("unable to open module ^0", m.name$, "", 0)
END;
INC(i)
END;