|
|
DataMuseum.dkPresents historical artifacts from the history of: Bogika Butler |
This is an automatic "excavation" of a thematic subset of
See our Wiki for more about Bogika Butler Excavated with: AutoArchaeologist - Free & Open Source Software. |
top - metrics - download
Length: 8320 (0x2080)
Types: TextFile
Names: »LNKP0.PAS«
└─⟦da8d53b95⟧ Bits:30009789/_.ft.Ibm2.50006585.imd Mogens Pelles Zilog 80,000 / EOS projekt
└─⟦this⟧ »LNKP0.PAS«
└─⟦dbb5cfece⟧ Bits:30009789/_.ft.Ibm2.50007354.imd Mogens Pelles Zilog 80,000 / EOS projekt
└─⟦this⟧ »LNKP0.PAS«
(******************************************************************************)
(* *)
(* Copyright (1985) by Metanic Aps., Denmark *)
(* *)
(* Author: Lars Gregers Jakobsen. *)
(* *)
(******************************************************************************)
PROCEDURE SetUp(VAR Status: StatusType
;VAR TargetFile: FileType
;VAR LogFile: LogFileType
;VAR Out_file: text
);
CONST
InputFileNameSuffix = 'OBJ';
TargetFileNameSuffix = 'OUT';
LogFileNameSuffix = 'MAP';
VAR
CommandLine: CommandLineType;
Current: CommandLineIndexType;
FileName: FileNameType;
PROCEDURE SkipBlanks;
BEGIN (*SKIPBLANKS*)
WHILE (CommandLine(.Current.) = ' ') and
(Current < length(CommandLine)) DO
Current := Current + 1;
END; (*SKIPBLANKS*)
PROCEDURE DecodeFileName(VAR Status: StatusType
;VAR FileName: FileNameType
; Suffix: FileNameType
; Terminators: CharSetType
);
VAR
I: CommandLineIndexType;
BEGIN (*DECODEFILENAME*)
I := 0;
WHILE (Current + I < length(CommandLine) ) and
not ( CommandLine(.Current + I.) in Terminators ) DO
I := I + 1;
IF (0 < I) and (I <= FileNameLength) THEN
BEGIN
FileName := Copy(CommandLine, Current, I);
Current := Current + I;
IF (pos('.', FileName) = 0) THEN
IF (length(FileName) <= FileNameLength - 4) THEN
FileName := concat(FileName, '.', Suffix)
ELSE
Status := Status + (.BadFileName.)
END
ELSE
Status := Status + (.BadFileName.);
(*#B#
IF test((.0,16,18.)) THEN
BEGIN
write(TestOut, 'DecodeFileName '); TSTstat(Status);
TSTindt; write(TestOut, 'Curr=', Current:1);
TSTindt; write(TestOut, 'I=', I:1);
TSTindt; writeln(TestOut, 'FileName=', FileName)
END
#E#*)
END; (*DECODEFILENAME*)
BEGIN (*SETUP*)
Getcomm(CommandLine);
CommandLine := concat(CommandLine, ' ');
Current := 1;
Status := (..);
SkipBlanks; (*Leaving current pointing at next non blank*)
(*Interpret option list*)
(*#B#
IF test((.0,16,18.)) THEN
BEGIN
write(TestOut, 'Setup-1 '); write(TestOut, 'Curr=', Current:1);
TSTindt; write(TestOut, 'Lng(ComLin)=', Length(CommandLine):1);
TSTindt; TSTmem; TSTln;
TSTindt; writeln(TestOut, 'ComLin=', CommandLine)
END;
#E#*)
WHILE (Current < length(CommandLine)) and
(CommandLine(.Current.) = '/') and
(Status = (..)) DO
BEGIN
Current := Current + 1;
CASE CommandLine(.Current.) OF
'M','m':
BEGIN
Current := Current + 1;
IF CommandLine(.Current.) = '=' THEN
BEGIN
Current := Current + 1;
DecodeFileName(Status, FileNametable(.-1.)
, LogFileNameSuffix, (.' ', '/', ','.) );
IF Status = (..) THEN
OptionTable.LogFileKind := Explicit
END
ELSE
OptionTable.LogFileKind := Implicit
END;
'O','o':
BEGIN
Current := Current + 1;
IF CommandLine(.Current.) = '=' THEN
BEGIN
Current := Current + 1;
DecodeFileName(Status, FileNameTable(.0.)
, TargetFileNameSuffix, (.' ', '/', ','.) );
IF Status = (..) THEN
OptionTable.TargetFileKind := Explicit
END
ELSE
OptionTable.TargetFileKind := Implicit
END;
OTHERWISE
Status := Status + (.BadOption.)
END; (*CASE*)
(*#B#
IF test((.0,16,18.)) THEN
BEGIN
write(TestOut, 'Setup-2 '); TSTstat(Status);
TSTindt; writeln(TestOut, 'Curr=', Current:1);
TSTindt; TSTopt;
TSTindt; TSTfnt(-1);
TSTindt; TSTfnt(0)
END;
#E#*)
END; (*WHILE*)
IF Status = (..) THEN (*Interpret file list*)
BEGIN
SkipBlanks;
IF Current < length(CommandLine) THEN
Status := Status + (.NotFinished.);
WHILE (Current < length(CommandLine)) and
(NotFinished IN Status) DO
BEGIN
DecodeFileName(Status, FileName
, InputFileNameSuffix, (.' ', ','.) );
IF not (BadFileName IN Status) THEN
BEGIN
(*#B#
IF test((.0,16,18.)) THEN
BEGIN
write(TestOut, 'Setup-3 '); TSTstat(Status); TSTindt;
write(TestOut, 'fstat(FileName)=');
TSTbool(fstat(FileName)); TSTln;
END;
#E#*)
IF fstat(FileName) THEN
FNTP(Status, FileName)
ELSE
Status := Status + (.NoSuchFile.);
END;
IF NotFinished IN Status THEN
CASE CommandLine(.Current.) OF
' ':
Status := Status - (.NotFinished.);
',':
BEGIN
Current := Current + 1 (*Skip the comma*)
END
END (*CASE CommandLine(.Current.) OF*)
END (* WHILE *** DO *)
END; (* IF Status = (..) -- End interpret file list *)
IF CurFileNo <= 0 THEN
Status := Status + (.NoInputFiles.);
IF Status = (..) THEN
BEGIN
FileName := copy(FileNameTable(.1.), 1, pos('.',FileNameTable(.1.)) );
IF OptionTable.LogFileKind = Implicit THEN
FileNameTable(.-1.) := concat(FileName, LogFileNameSuffix);
IF OptionTable.TargetFileKind = Implicit THEN
FileNameTable(. 0.) := concat(FileName, TargetFileNameSuffix);
IF (OptionTable.LogFileKind <> none) and
( (not checkfn(FileNameTable(.-1.) ) ) or
(fstat(FileNameTable(.-1.) ) )
) THEN
Status := Status + (.badlogfilename.);
IF (not checkfn(FileNameTable(.0.) ) ) or
(fstat(FileNameTable(.0.) ) ) THEN
Status := Status + (.badtargetfilename.);
(*#B#
IF test((.0,16,18.)) THEN
BEGIN
write(TestOut, 'Setup-4 '); TSTstat(Status); TSTln;
TSTindt; TSTopt;
TSTindt; TSTfnt(-1);
TSTindt; TSTfnt(0);
TSTindt; TSTfnt(1)
END;
#E#*)
IF Status = (..) THEN
BEGIN
IF OptionTable.LogFileKind <> None THEN
BEGIN
LogInit(LogFile, FileNameTable(.-1.) );
LogCmd(LogFile, CommandLine);
END;
FilAsg(TargetFile, FileNameTable(.0.) );
FilRwt(TargetFile);
END
ELSE
Status := Status + (.NoTarget.);
END
ELSE
BEGIN
Status := Status + (.Notarget.);
writeln(out_file, CommandLine);
writeln(out_file, '^':Current);
END
END; (*SETUP*)
(* *)
(* *)
(******************************************************************************)
«eof»