home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 10 Tools
/
10-Tools.zip
/
vp21beta.zip
/
LRTLSRC.RAR
/
LINKLNX
/
LINKLNX.PAS
Wrap
Pascal/Delphi Source File
|
2000-08-15
|
2KB
|
81 lines
{█▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀█}
{█ █}
{█ Virtual Pascal for Linux █}
{█ Wrapper for Watcom 11.x linker █}
{█ ─────────────────────────────────────────────────█}
{█ Copyright (C) 1999 Joerg Pleumann █}
{█ █}
{▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀}
program LinkLnx;
{$H+}
uses
SysUtils, Dos;
function Split(var S: string; Separator: Char): string;
var
P: Integer;
begin
P := Pos(Separator, S);
if P = 0 then
begin
Result := S;
S := '';
end
else
begin
Result := Copy(S, 1, P - 1);
Delete(S, 1, P);
end;
end;
function Replace(const S: string; OldChar, NewChar: Char): string;
var
I: Integer;
begin
Result := S;
for I := 1 to Length(Result) do
if Result[I] = OldChar then Result[I] := NewChar;
end;
var
BaseDir, InFile, OutFile, Arguments, Line: string;
Stream: Text;
begin
BaseDir := ExtractFileDir(ExpandFileName(ParamStr(0)));
InFile := Copy(ParamStr(1), 2, Length(ParamStr(1)) - 2);
OutFile := ChangeFileExt(InFile, '.wat');
Assign(Stream, InFile);
Reset(Stream);
while not EOF(Stream) do
begin
ReadLn(Stream, Line);
Arguments := Arguments + Line;
end;
Close(Stream);
Assign(Stream, OutFile);
Rewrite(Stream);
WriteLn(Stream, 'file ', Replace(Split(Arguments, ','), '+', ','));
WriteLn(Stream, 'name ', Split(Arguments, ','), '');
WriteLn(Stream, 'option map=', Split(Arguments, ','));
WriteLn(Stream, 'library ', Replace(Split(Arguments, ','), '+', ','));
WriteLn(Stream, 'format elf');
WriteLn(Stream, 'option undefsok');
WriteLn(Stream, 'libpath ', BaseDir, '\..\lib.w32');
Close(Stream);
WriteLn('[Linker=', BaseDir + '\wlink.exe @' + OutFile + ']');
Exec(BaseDir + '\wlink.exe', '@' + OutFile);
WriteLn('[DosError=', DosError, ', DosExitCode=', DosExitCode, ']');
end.