* moved to utils

This commit is contained in:
peter 2000-06-01 10:58:47 +00:00
parent d854774374
commit 30b8959557

View File

@ -21,12 +21,14 @@
**************************************************************************** ****************************************************************************
} }
program postw32;
program post_process_win32_executable;
uses uses
globtype,globals,strings; {$ifdef fpc}
strings
{$else}
sysutils
{$endif}
;
const const
execinfo_f_cant_open_executable='Cannot open file '; execinfo_f_cant_open_executable='Cannot open file ';
@ -36,12 +38,31 @@ execinfo_x_uninitdatasize='Size of Uninitialized Data: ';
execinfo_f_cant_process_executable='Cannot process file '; execinfo_f_cant_process_executable='Cannot process file ';
execinfo_x_stackreserve='Size of Stack Reserve: '; execinfo_x_stackreserve='Size of Stack Reserve: ';
execinfo_x_stackcommit='Size of Stack Commit: '; execinfo_x_stackcommit='Size of Stack Commit: ';
type
tapptype = (at_none,
at_gui,at_cui
);
var var
verbose:longbool; verbose:longbool;
stacksize,
ii,jj:longint; ii,jj:longint;
code:integer; code:integer;
DllVersion : sTring; DllVersion : sTring;
Dllmajor,Dllminor : word; Dllmajor,Dllminor : word;
apptype : tapptype;
function tostr(i : longint) : string;
{
return string of value i
}
var
hs : string;
begin
str(i,hs);
tostr:=hs;
end;
procedure Message1(const info,fn:string); procedure Message1(const info,fn:string);
var var
@ -241,20 +262,22 @@ begin
postprocessexecutable:=true; postprocessexecutable:=true;
end; end;
var var
fn,s:string; fn,s:string;
function GetSwitchValue(const key,shortkey,default:string;const PossibleValues:array of pchar):string; function GetSwitchValue(const key,shortkey,default:string;const PossibleValues:array of pchar):string;
var var
i,j,k:longint; i,j,k:longint;
x:double; x:double;
s1,s2:string; s1,s2:string;
code:integer; code:integer;
procedure Error; procedure Error;
begin begin
writeln('Error: unrecognized option ',paramstr(i),' ',s1); writeln('Error: unrecognized option ',paramstr(i),' ',s1);
halt(1); halt(1);
end; end;
begin begin
for i:=1 to paramcount do for i:=1 to paramcount do
if(paramstr(i)=key)or(paramstr(i)=shortkey)then if(paramstr(i)=key)or(paramstr(i)=shortkey)then
@ -297,6 +320,7 @@ begin
end; end;
GetSwitchValue:=default; GetSwitchValue:=default;
end; end;
procedure help_info; procedure help_info;
begin begin
fn:=paramstr(0); fn:=paramstr(0);
@ -316,8 +340,8 @@ begin
writeln('-h | --help | -? - show this screen'); writeln('-h | --help | -? - show this screen');
halt; halt;
end; end;
begin begin
aktglobalswitches:=[];
verbose:=false; verbose:=false;
if paramcount=0 then if paramcount=0 then
help_info; help_info;
@ -331,16 +355,11 @@ for ii:=1 to paramcount do
end; end;
fn:=GetSwitchValue('--input','-i','',['*s']); fn:=GetSwitchValue('--input','-i','',['*s']);
val(GetSwitchValue('--stack','-s','33554432',['*i']),stacksize,code); val(GetSwitchValue('--stack','-s','33554432',['*i']),stacksize,code);
{value from
systems.pas
for Win32 target}
s:=GetSwitchValue('--subsystem','-m','console',['gui','console']); s:=GetSwitchValue('--subsystem','-m','console',['gui','console']);
if s='gui' then if s='gui' then
apptype:=at_GUI apptype:=at_GUI
else else
apptype:=at_cui; apptype:=at_cui;
dllversion:=GetSwitchValue('--version','-V','1.0',['*r']); dllversion:=GetSwitchValue('--version','-V','1.0',['*r']);
ii:=pos('.',dllversion); ii:=pos('.',dllversion);
if ii=0 then if ii=0 then
@ -362,7 +381,10 @@ end.
{ {
$Log$ $Log$
Revision 1.1 2000-04-14 11:10:46 pierre Revision 1.1 2000-06-01 10:58:47 peter
* moved to utils
Revision 1.1 2000/04/14 11:10:46 pierre
renamed to fit in 8.3 limitation renamed to fit in 8.3 limitation
} }