summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 0c2f975)
raw | patch | inline | side by side (parent: 0c2f975)
author | DeaDDooMER <deaddoomer@deadsoftware.ru> | |
Sat, 15 Feb 2020 11:49:25 +0000 (14:49 +0300) | ||
committer | DeaDDooMER <deaddoomer@deadsoftware.ru> | |
Sat, 15 Feb 2020 11:49:25 +0000 (14:49 +0300) |
src/generic/Dsw/Mod/MakeMain.cp | patch | blob | history |
index 98d76c5f86e80a116ccb0a82eea489d28d909210..c45005e5b42fc2664bd8b7f383f189795d8a28a7 100644 (file)
imported = 0; trace = 1; hasObj = 2; hasSym = 3; hasErrors = 4; library = 5;
debugImport = FALSE;
+ debugOrder = FALSE;
debugJobs = FALSE;
TYPE
name: DevCPT.Name;
path: Files.Name;
selectors: Selector; (* with head, list of selectors for this module *)
- mno, depth: INTEGER;
+ depth: INTEGER; (* 0: leaf, MAX: root *)
+ mno: INTEGER;
imp: ARRAY maxImps OF Module;
flags: SET;
worker: DswProcs.Process;
jobs: INTEGER;
exe: String;
+ (* --------- options --------- *)
+
PROCEDURE IdentLen (IN s: ARRAY OF CHAR): INTEGER;
VAR i: INTEGER;
BEGIN
END StrToInt;
PROCEDURE ParseArgs;
- VAR res: INTEGER;
BEGIN
jobs := 1;
LOOP
END
END ParseArgs;
+ (* --------- loader --------- *)
+
PROCEDURE Import (m: Module; IN name: DevCPT.Name);
VAR i, j: INTEGER; imp: Module;
BEGIN
END
END GetSource;
- PROCEDURE Trace (m, parent: Module; depth: INTEGER; VAR lno: INTEGER);
+ PROCEDURE Trace (m, parent: Module; VAR lno: INTEGER);
VAR i: INTEGER;
BEGIN
- m.depth := MAX(m.depth, depth);
IF ~(trace IN m.flags) THEN
INCL(m.flags, trace);
- IF m.mno > 0 THEN
- FOR i := 0 TO m.mno - 1 DO
- Trace(m.imp[i], m, depth + 1, lno)
- END
+ FOR i := 0 TO m.mno - 1 DO
+ Trace(m.imp[i], m, lno);
+ m.depth := MAX(m.depth, m.imp[i].depth + 1)
END;
IF ~(imported IN m.flags) THEN
INCL(m.flags, imported);
WHILE i < mno DO
m := cmpList[i];
j := i - 1;
- WHILE (j >= 0) & (cmpList[j].depth < m.depth) DO
+ WHILE (j >= 0) & (cmpList[j].depth > m.depth) DO
cmpList[j + 1] := cmpList[j];
DEC(j)
END;
END
END Sort;
- PROCEDURE MakeTree;
+ PROCEDURE CheckDeps;
VAR i, j, num: INTEGER; m: Module; s: String; ok: BOOLEAN;
BEGIN
i := 0; rno := mno;
END;
num := 0;
FOR i := 0 TO rno - 1 DO
- Trace(modList[i], modList[i], 0, num);
+ Trace(modList[i], modList[i], num)
END;
ASSERT((err # 0) OR (num = mno), 100);
Sort;
- END MakeTree;
+ IF debugOrder THEN
+ Log.String("Parallel depth:"); Log.Ln;
+ FOR i := 0 TO mno - 1 DO
+ Log.String(" " + cmpList[i].name); Log.Int(cmpList[i].depth); Log.Ln;
+ END
+ END
+ END CheckDeps;
PROCEDURE IsCompiled (m: Module): BOOLEAN;
CONST target = {hasSym, hasObj};
END
END Link;
- PROCEDURE WriteSelector (s: Selector);
- BEGIN
- Log.String(s.name$);
- IF s.value THEN Log.Char("+") ELSE Log.Char("-") END
- END WriteSelector;
-
PROCEDURE Main;
VAR m: Module; s: Selector; p: DswProcs.Process; ok: BOOLEAN; i, res: INTEGER;
BEGIN
IF Kernel.trapCount # 0 THEN Kernel.Quit(1) END;
ParseArgs;
IF err = 0 THEN
- MakeTree;
+ CheckDeps;
IF err = 0 THEN
Compile;
IF err = 0 THEN
END
END
END;
- IF err = 0 THEN
- Log.String("no errors"); Log.Ln;
- Kernel.Quit(0)
- ELSE
- Kernel.Quit(1)
+ IF err = 0 THEN Kernel.Quit(0)
+ ELSE Kernel.Quit(1)
END;
END Main;