index 9cb6a98e7ed5de28fee74f202633123605f25b76..e024a3c913d0944e511175121e9b210f793d901a 100644 (file)
Module = POINTER TO RECORD
name: DevCPT.Name;
Module = POINTER TO RECORD
name: DevCPT.Name;
- path: Files.Name;
- selectors: Selector; (* with head, list of selectors for this module *)
+ odc: Files.Name;
depth: INTEGER; (* 0: leaf, MAX: root *)
dir: DevCPM.Directory;
mno: INTEGER;
depth: INTEGER; (* 0: leaf, MAX: root *)
dir: DevCPM.Directory;
mno: INTEGER;
auto: BOOLEAN;
jobs: INTEGER;
exe: String;
auto: BOOLEAN;
jobs: INTEGER;
exe: String;
+ printCompileModList: BOOLEAN;
+ printLinkModList: BOOLEAN;
+ printCompileFileList: BOOLEAN;
PROCEDURE Error (e: INTEGER; IN p0, p1: ARRAY OF CHAR; i2: INTEGER);
VAR msg, p2: ARRAY 128 OF CHAR;
PROCEDURE Error (e: INTEGER; IN p0, p1: ARRAY OF CHAR; i2: INTEGER);
VAR msg, p2: ARRAY 128 OF CHAR;
RETURN i
END IdentLen;
RETURN i
END IdentLen;
- PROCEDURE Define (n: ARRAY OF CHAR);
+ PROCEDURE Define (n: ARRAY OF CHAR; overwrite: BOOLEAN);
VAR i: INTEGER; v: BOOLEAN; s: Selector;
BEGIN
i := IdentLen(n);
VAR i: INTEGER; v: BOOLEAN; s: Selector;
BEGIN
i := IdentLen(n);
IF s.next = NIL THEN
NEW(s.next);
Strings.StringToUtf8(n, s.next.name, i);
IF s.next = NIL THEN
NEW(s.next);
Strings.StringToUtf8(n, s.next.name, i);
- ASSERT(i = 0)
- END;
- s.next.value := v
+ ASSERT(i = 0);
+ s.next.value := v
+ ELSIF overwrite THEN
+ s.next.value := v
+ END
ELSE
Error(1, "", "", 0)
END
END Define;
ELSE
Error(1, "", "", 0)
END
END Define;
- PROCEDURE Undefine (IN n: ARRAY OF CHAR);
- VAR i: INTEGER; s: Selector;
- BEGIN
- i := IdentLen(n);
- IF (i # 0) & (n[i] = 0X) THEN
- s := def;
- WHILE (s.next # NIL) & (s.next.name$ # n$) DO s := s.next END;
- IF s.next # NIL THEN s.next := s.next.next END
- ELSE
- Error(2, "", "", 0)
- END
- END Undefine;
-
- PROCEDURE CopySelectorList (base: Selector): Selector;
- VAR s, t, x: Selector;
- BEGIN
- ASSERT(base # NIL, 20);
- s := base; NEW(t); x := t;
- WHILE s # NIL DO
- x^ := s^;
- IF s.next # NIL THEN NEW(x.next); x := x.next END;
- s := s.next
- END;
- RETURN t
- END CopySelectorList;
-
PROCEDURE AddModule (IN n: ARRAY OF CHAR; selectors: Selector; dir: DevCPM.Directory);
VAR i, res: INTEGER; m: Module;
BEGIN
PROCEDURE AddModule (IN n: ARRAY OF CHAR; selectors: Selector; dir: DevCPM.Directory);
VAR i, res: INTEGER; m: Module;
BEGIN
NEW(m);
Strings.StringToUtf8(n, m.name, res);
ASSERT(res = 0);
NEW(m);
Strings.StringToUtf8(n, m.name, res);
ASSERT(res = 0);
- m.selectors := CopySelectorList(selectors);
m.dir := dir;
modList[i] := m;
INC(mno)
m.dir := dir;
modList[i] := m;
INC(mno)
Log.String(" -Cg params Pass parameters to Component Pasacal compiler directly"); Log.Ln;
Log.String(" -Ci params Pass parameters to internal linker directly"); Log.Ln;
Log.String(" -II Trap on user interrupt"); Log.Ln;
Log.String(" -Cg params Pass parameters to Component Pasacal compiler directly"); Log.Ln;
Log.String(" -Ci params Pass parameters to internal linker directly"); Log.Ln;
Log.String(" -II Trap on user interrupt"); Log.Ln;
+ Log.String(" -IC Print module list for compilation and quit"); Log.Ln;
+ Log.String(" -IL Print module list for linking and quit"); Log.Ln;
+ Log.String(" -Ic Print file list for compilation and quit"); Log.Ln;
+(*
+ Log.String(" -Il Print file list for linking and quit"); Log.Ln;
+*)
Log.String(" -a Enable automatic dependency resolution"); Log.Ln;
Log.String(" -o name Generate executable file"); Log.Ln;
Log.String(" -j num Specifies the number of jobs to run simultaneously"); Log.Ln;
Log.String(' -D ident["+"|"-"] Add preprocessor selector'); Log.Ln;
Log.String(" -a Enable automatic dependency resolution"); Log.Ln;
Log.String(" -o name Generate executable file"); Log.Ln;
Log.String(" -j num Specifies the number of jobs to run simultaneously"); Log.Ln;
Log.String(' -D ident["+"|"-"] Add preprocessor selector'); Log.Ln;
- Log.String(' -U ident Remove preprocessor selector'); Log.Ln;
Log.String(" -h Print help and quit"); Log.Ln;
Log.String(" -V Print version and quit"); Log.Ln;
Kernel.Quit(1)
Log.String(" -h Print help and quit"); Log.Ln;
Log.String(" -V Print version and quit"); Log.Ln;
Kernel.Quit(1)
PROCEDURE ParseInfoOpts;
BEGIN
PROCEDURE ParseInfoOpts;
BEGIN
- CASE DswOpts.GetOpt("I") OF
+ CASE DswOpts.GetOpt("CLcI") OF
| "I": Kernel.intTrap := TRUE
| "I": Kernel.intTrap := TRUE
+ | "C": printCompileModList := TRUE
+ | "L": printLinkModList := TRUE
+ | "c": printCompileFileList := TRUE
| ":": Error(10, "-I" + DswOpts.str, "", 0)
| "?": Error(11, "-I" + DswOpts.str, "", 0)
| 0X: Error(11, "-I", "", 0)
| ":": Error(10, "-I" + DswOpts.str, "", 0)
| "?": Error(11, "-I" + DswOpts.str, "", 0)
| 0X: Error(11, "-I", "", 0)
exe := NIL; auto := FALSE; jobs := 1; def.next := NIL; mno := 0; rno := 0;
processor := anymach; os := anyos; compiler := anycp;
LOOP
exe := NIL; auto := FALSE; jobs := 1; def.next := NIL; mno := 0; rno := 0;
processor := anymach; os := anyos; compiler := anycp;
LOOP
- CASE DswOpts.GetOpt("ao:j:D:U:TCXIFhV") OF
+ CASE DswOpts.GetOpt("ao:j:D:TCXIFhV") OF
| "a": auto := TRUE
| "o": exe := DswOpts.str
| "j": jobs := MIN(MAX(StrToInt(DswOpts.str, 1), 1), maxJobs)
| "h": Help
| "V": Version
| "a": auto := TRUE
| "o": exe := DswOpts.str
| "j": jobs := MIN(MAX(StrToInt(DswOpts.str, 1), 1), maxJobs)
| "h": Help
| "V": Version
- | "D": Define(DswOpts.str)
- | "U": Undefine(DswOpts.str)
+ | "D": Define(DswOpts.str, TRUE)
| "T": ParseTargetOpts
| "C": ParseCommandOpts
| "X": ParseExternalOpts
| "T": ParseTargetOpts
| "C": ParseCommandOpts
| "X": ParseExternalOpts
END ParseArgs;
PROCEDURE CheckParams;
END ParseArgs;
PROCEDURE CheckParams;
+
+ PROCEDURE Default (IN name: ARRAY OF CHAR; value: BOOLEAN);
+ BEGIN
+ IF value = TRUE THEN
+ Define(name + "+", FALSE)
+ ELSE
+ Define(name + "-", FALSE)
+ END
+ END Default;
+
BEGIN
IF compiler = anycp THEN
Error(12, "", "", 0)
BEGIN
IF compiler = anycp THEN
Error(12, "", "", 0)
IF cplExe = NIL THEN
Error(26, "", "", 0)
END
IF cplExe = NIL THEN
Error(26, "", "", 0)
END
- END
+ END;
+ (* cpompiler *)
+ Default("NATIVE", compiler = cpnative);
+ Default("CPFRONT", compiler = cpfront);
+ (* processor *)
+ Default("I486", processor = mach386);
+ Default("I386", processor = mach386);
+ Default("M68K", processor = mach68k);
+ (* operating system *)
+ Default("LINUX", os = linux);
+ Default("FREEBSD", os = freebsd);
+ Default("OPENBSD", os = openbsd);
+ Default("DARWIN", os = darwin);
+ Default("WIN32", os = win32);
+ Default("CYGWIN", os = cygwin);
+ Default("POSIX", os IN {linux, freebsd, openbsd, darwin, cygwin});
+ (* linker *)
+ Default("DEV2", linker = dev2);
END CheckParams;
(* --------- loader --------- *)
END CheckParams;
(* --------- loader --------- *)
IF ~auto THEN
Log.String("module " + name + " required before " + m.name); Log.Ln; INC(werr)
END;
IF ~auto THEN
Log.String("module " + name + " required before " + m.name); Log.Ln; INC(werr)
END;
- NEW(imp); imp.name := name$; imp.selectors := CopySelectorList(m.selectors);
+ NEW(imp); imp.name := name$;
modList[mno] := imp; INC(mno)
ELSE
imp := modList[j]
modList[mno] := imp; INC(mno)
ELSE
imp := modList[j]
IF oberon IN m.opts THEN INCL(DevCPM.options, DevCPM.oberon) END;
*)
DevCPR.Init;
IF oberon IN m.opts THEN INCL(DevCPM.options, DevCPM.oberon) END;
*)
DevCPR.Init;
- s := m.selectors.next;
+ s := def.next;
WHILE s # NIL DO
DevCPR.Set(s.name, s.value);
s := s.next
WHILE s # NIL DO
DevCPR.Set(s.name, s.value);
s := s.next
i := 0; rno := mno;
WHILE (err = 0) & (i < mno) DO
m := modList[i];
i := 0; rno := mno;
WHILE (err = 0) & (i < mno) DO
m := modList[i];
- GetSource(m.name$, m.dir, m.path, src);
+ GetSource(m.name$, m.dir, m.odc, src);
IF src # NIL THEN
CheckModule(m, src, ok);
IF ~ok THEN INC(err) END
IF src # NIL THEN
CheckModule(m, src, ok);
IF ~ok THEN INC(err) END
PROCEDURE PutPathList (w: DswProcs.Process; IN par: ARRAY OF CHAR; base: DevCPM.Directory);
BEGIN
IF base # NIL THEN
PROCEDURE PutPathList (w: DswProcs.Process; IN par: ARRAY OF CHAR; base: DevCPM.Directory);
BEGIN
IF base # NIL THEN
- PutPath(w, base.next); (* in revese order *)
+ PutPathList(w, par, base.next); (* in revese order *)
w.PutParam(par);
w.PutParam(base.path);
END
END PutPathList;
PROCEDURE ExecuteCompiler (m: Module): DswProcs.Process;
w.PutParam(par);
w.PutParam(base.path);
END
END PutPathList;
PROCEDURE ExecuteCompiler (m: Module): DswProcs.Process;
- VAR w: DswProcs.Process; ok: BOOLEAN;
+ VAR w: DswProcs.Process; ok: BOOLEAN; s: Selector;
BEGIN
ASSERT(m # NIL, 20);
BEGIN
ASSERT(m # NIL, 20);
- ASSERT(m.path # "", 21);
+ ASSERT(m.odc # "", 21);
ASSERT(m.worker = NIL, 22);
w := DswProcs.dir.New();
w.Program(cpcExe);
w.PutParam("-legacy");
ASSERT(m.worker = NIL, 22);
w := DswProcs.dir.New();
w.Program(cpcExe);
w.PutParam("-legacy");
- PutPath(w, "-legacysymdir", m.dir);
- PutParams(w, cpcArgs);
- CASE compiler OF
- | cpfront:
- w.PutParam("-define+"); w.PutParam("CPFRONT");
- w.PutParam("-define-"); w.PutParam("NATIVE");
- | cpnative:
- w.PutParam("-define-"); w.PutParam("CPFRONT");
- w.PutParam("-define+"); w.PutParam("NATIVE");
- END;
- CASE processor OF
- | mach386:
- w.PutParam("-define+"); w.PutParam("I486");
- w.PutParam("-define-"); w.PutParam("M68K");
- | mach68k:
- w.PutParam("-define+"); w.PutParam("I486");
- w.PutParam("-define-"); w.PutParam("M68K");
- ELSE
- w.PutParam("-define-"); w.PutParam("I486");
- w.PutParam("-define-"); w.PutParam("M68K");
- END;
- CASE os OF
- | linux:
- w.PutParam("-define+"); w.PutParam("POSIX");
- w.PutParam("-define+"); w.PutParam("LINUX");
- w.PutParam("-define-"); w.PutParam("FREEBSD");
- w.PutParam("-define-"); w.PutParam("OPENBSD");
- w.PutParam("-define-"); w.PutParam("WIN32");
- w.PutParam("-define-"); w.PutParam("DARWIN");
- | freebsd:
- w.PutParam("-define+"); w.PutParam("POSIX");
- w.PutParam("-define-"); w.PutParam("LINUX");
- w.PutParam("-define+"); w.PutParam("FREEBSD");
- w.PutParam("-define-"); w.PutParam("OPENBSD");
- w.PutParam("-define-"); w.PutParam("WIN32");
- w.PutParam("-define-"); w.PutParam("CYGWIN");
- w.PutParam("-define-"); w.PutParam("DARWIN");
- | openbsd:
- w.PutParam("-define+"); w.PutParam("POSIX");
- w.PutParam("-define-"); w.PutParam("LINUX");
- w.PutParam("-define-"); w.PutParam("FREEBSD");
- w.PutParam("-define+"); w.PutParam("OPENBSD");
- w.PutParam("-define-"); w.PutParam("WIN32");
- w.PutParam("-define-"); w.PutParam("CYGWIN");
- w.PutParam("-define-"); w.PutParam("DARWIN");
- | win32:
- w.PutParam("-define-"); w.PutParam("POSIX");
- w.PutParam("-define-"); w.PutParam("LINUX");
- w.PutParam("-define-"); w.PutParam("FREEBSD");
- w.PutParam("-define-"); w.PutParam("OPENBSD");
- w.PutParam("-define+"); w.PutParam("WIN32");
- w.PutParam("-define-"); w.PutParam("CYGWIN");
- w.PutParam("-define-"); w.PutParam("DARWIN");
- | cygwin:
- w.PutParam("-define+"); w.PutParam("POSIX");
- w.PutParam("-define-"); w.PutParam("LINUX");
- w.PutParam("-define-"); w.PutParam("FREEBSD");
- w.PutParam("-define-"); w.PutParam("OPENBSD");
- w.PutParam("-define+"); w.PutParam("WIN32");
- w.PutParam("-define+"); w.PutParam("CYGWIN");
- w.PutParam("-define-"); w.PutParam("DARWIN");
- | darwin:
- w.PutParam("-define+"); w.PutParam("POSIX");
- w.PutParam("-define-"); w.PutParam("LINUX");
- w.PutParam("-define-"); w.PutParam("FREEBSD");
- w.PutParam("-define-"); w.PutParam("OPENBSD");
- w.PutParam("-define-"); w.PutParam("WIN32");
- w.PutParam("-define-"); w.PutParam("CYGWIN");
- w.PutParam("-define+"); w.PutParam("DARWIN");
- ELSE
- w.PutParam("-define-"); w.PutParam("POSIX");
- w.PutParam("-define-"); w.PutParam("LINUX");
- w.PutParam("-define-"); w.PutParam("FREEBSD");
- w.PutParam("-define-"); w.PutParam("OPENBSD");
- w.PutParam("-define-"); w.PutParam("WIN32");
- w.PutParam("-define-"); w.PutParam("DARWIN");
- END;
- CASE linker OF
- | dev2:
- w.PutParam("-define+"); w.PutParam("DEV2");
- ELSE
- w.PutParam("-define-"); w.PutParam("DEV2");
+ PutPathList(w, "-legacysymdir", m.dir);
+ s := def.next;
+ WHILE s # NIL DO
+ IF s.value = TRUE THEN w.PutParam("-define+")
+ ELSE w.PutParam("-define-")
+ END;
+ w.PutParam(s.name$);
+ s := s.next
END;
END;
- w.PutParam(m.path);
+ PutParams(w, cpcArgs);
+ w.PutParam(m.odc);
w.Execute(ok);
IF ok THEN
w.Execute(ok);
IF ok THEN
- Log.String("Compile " + m.name + " (" + m.path + ")"); Log.Ln;
+ Log.String("Compile " + m.name + " (" + m.odc + ")"); Log.Ln;
ELSE
w := NIL
END;
ELSE
w := NIL
END;
ASSERT(compiler = cpnative, 22);
p := DswProcs.dir.New();
p.Program(cplExe);
ASSERT(compiler = cpnative, 22);
p := DswProcs.dir.New();
p.Program(cplExe);
- PutPath(w, "-legacycodedir", dirList);
+ PutPathList(p, "-legacycodedir", dirList);
IF os # anyos THEN
p.PutParam("-os");
CASE os OF
IF os # anyos THEN
p.PutParam("-os");
CASE os OF
END
END Link;
END
END Link;
+ PROCEDURE PrintInfo;
+ VAR i: INTEGER;
+ BEGIN
+ IF printCompileModList THEN
+ FOR i := 0 TO mno - 1 DO
+ Log.String(cmpList[i].name$); Log.Char(" ")
+ END;
+ Log.Ln
+ ELSIF printLinkModList THEN
+ FOR i := 0 TO mno - 1 DO
+ IF ~(library IN lnkList[i].flags) THEN
+ Log.String(lnkList[i].name$); Log.Char(" ")
+ END
+ END;
+ Log.Ln
+ ELSIF printCompileFileList THEN
+ FOR i := 0 TO mno - 1 DO
+ Log.String(cmpList[i].odc); Log.Char(" ")
+ END;
+ Log.Ln
+(* ELSIF printLinkFileList THEN
+ FOR i := 0 TO mno - 1 DO
+ IF ~(library IN lnkList[i].flags) THEN
+ Log.String(lnkList[i].ocf); Log.Char(" ")
+ END
+ END;
+ Log.Ln*)
+ END
+ END PrintInfo;
+
PROCEDURE Main;
PROCEDURE Main;
- VAR m: Module; s: Selector; p: DswProcs.Process; ok: BOOLEAN; i, res: INTEGER;
BEGIN
IF Kernel.trapCount = 0 THEN
ParseArgs;
IF err = 0 THEN
BEGIN
IF Kernel.trapCount = 0 THEN
ParseArgs;
IF err = 0 THEN
+ IF printCompileModList OR printLinkModList OR printCompileFileList THEN
+ auto := TRUE
+ END;
CheckParams;
IF err = 0 THEN
CheckDeps;
IF err = 0 THEN
CheckParams;
IF err = 0 THEN
CheckDeps;
IF err = 0 THEN
- Compile;
- IF err = 0 THEN
- Link
+ IF printCompileModList OR printLinkModList OR printCompileFileList THEN
+ PrintInfo
+ ELSE
+ Compile;
+ IF err = 0 THEN
+ Link
+ END
END
END
END
END
END
END