From b5698c71200b362d162a9afb6bf467d877dc6b09 Mon Sep 17 00:00:00 2001 From: DeaDDooMER Date: Sat, 29 Dec 2018 12:02:45 +0300 Subject: [PATCH] df now can be comiled for go32v2 --- src/lib/vampimg/ImagingUtility.pas | 14 +++++++++-- src/shared/a_modes.inc | 10 ++++++-- src/shared/envvars.pas | 15 +++++++++--- src/shared/utils.pas | 39 ++++++++++++++++++++++++++++++ 4 files changed, 70 insertions(+), 8 deletions(-) diff --git a/src/lib/vampimg/ImagingUtility.pas b/src/lib/vampimg/ImagingUtility.pas index c137e1d..257ca26 100644 --- a/src/lib/vampimg/ImagingUtility.pas +++ b/src/lib/vampimg/ImagingUtility.pas @@ -354,7 +354,11 @@ uses {$IF Defined(MSWINDOWS)} Windows; {$ELSEIF Defined(FPC)} - Dos, BaseUnix, Unix; + Dos + {$IFDEF Unix} + , BaseUnix, Unix + {$ENDIF} + ; {$ELSEIF Defined(DELPHI)} Posix.SysTime; {$IFEND} @@ -413,7 +417,7 @@ begin Posix.SysTime.GetTimeOfDay(Time, nil); Result := Int64(Time.tv_sec) * 1000000 + Time.tv_usec; end; -{$ELSEIF Defined(FPC)} +{$ELSEIF Defined(FPC) and Defined(UNIX)} function GetTimeMicroseconds: Int64; var TimeVal: TTimeVal; @@ -421,6 +425,12 @@ begin fpGetTimeOfDay(@TimeVal, nil); Result := Int64(TimeVal.tv_sec) * 1000000 + TimeVal.tv_usec; end; +{$ELSE} + function GetTimeMicroseconds: Int64; + begin + {$WARNING GetTimeMicroseconds stub!} + result := 0 + end; {$IFEND} function GetTimeMilliseconds: Int64; diff --git a/src/shared/a_modes.inc b/src/shared/a_modes.inc index fc8cc51..efb88c0 100644 --- a/src/shared/a_modes.inc +++ b/src/shared/a_modes.inc @@ -33,7 +33,10 @@ {$COPERATORS ON} {$EXTENDEDSYNTAX ON} {$IFDEF CPU386} - {$FPUTYPE SSE} + {$IFDEF GO32V2} + {$ELSE} + {$FPUTYPE SSE} + {$ENDIF} {$ENDIF} {$GOTO ON} {$IEEEERRORS OFF} @@ -52,7 +55,10 @@ {$VARSTRINGCHECKS OFF} {$S-} // disable stack checking -{$MMX-} // get lost, mmx +{$IFDEF GO32V2} +{$ELSE} + {$MMX-} // get lost, mmx +{$ENDIF} {$IF DEFINED(D2F_DEBUG)} {$STACKFRAMES ON} diff --git a/src/shared/envvars.pas b/src/shared/envvars.pas index 5c60fd0..55d5870 100644 --- a/src/shared/envvars.pas +++ b/src/shared/envvars.pas @@ -42,10 +42,17 @@ begin Result := -1; end; {$ELSE} -{$LINKLIB c} -const clib = 'c'; -function setenv(const VarStr: PChar; const VarVal: PChar; Repl: cint): cint; -cdecl; external clib name 'setenv'; + {$IFDEF GO32V2} + function setenv(const VarStr: PChar; const VarVal: PChar; Repl: cint): cint; + begin + {$WARNING setenv stub!} + result := 0 + end; + {$ELSE} + {$LINKLIB c} + const clib = 'c'; + function setenv(const VarStr: PChar; const VarVal: PChar; Repl: cint): cint; cdecl; external clib name 'setenv'; + {$ENDIF} {$ENDIF} function SetEnvVar(const VarName: AnsiString; const VarVal: AnsiString): Boolean; diff --git a/src/shared/utils.pas b/src/shared/utils.pas index 1600605..641cae7 100644 --- a/src/shared/utils.pas +++ b/src/shared/utils.pas @@ -1392,7 +1392,46 @@ function nclamp (v, a, b: Extended): Extended; inline; overload; begin if (v < a {$IFDEF WINDOWS} function snprintf (buf: PAnsiChar; bufsize: SizeUInt; const fmt: PAnsiChar): SizeUInt; cdecl; varargs; external 'msvcrt.dll' name '_snprintf'; {$ELSE} + {$IFDEF GO32V2} + +function snprintf (buf: PAnsiChar; bufsize: SizeUInt; const fmt: PAnsiChar): SizeUInt; +begin + {$WARNING snprintf not implemented!} + buf[0] := #0; + result := 0 +end; + +function snprintf (buf: PAnsiChar; bufsize: SizeUInt; const fmt: PAnsiChar; x: LongInt): SizeUInt; overload; +begin + {$WARNING snprintf+longint not implemented!} + buf[0] := #0; + result := 0 +end; + +function snprintf (buf: PAnsiChar; bufsize: SizeUInt; const fmt: PAnsiChar; x: PAnsiChar): SizeUInt; overload; +begin + {$WARNING snprintf+string not implemented!} + buf[0] := #0; + result := 0 +end; + +function snprintf (buf: PAnsiChar; bufsize: SizeUInt; const fmt: PAnsiChar; x: Char): SizeUInt; overload; +begin + {$WARNING snprintf+char not implemented!} + buf[0] := #0; + result := 0 +end; + +function snprintf (buf: PAnsiChar; bufsize: SizeUInt; const fmt: PAnsiChar; x: Double): SizeUInt; overload; +begin + {$WARNING snprintf+double not implemented!} + buf[0] := #0; + result := 0 +end; + + {$ELSE} function snprintf (buf: PAnsiChar; bufsize: SizeUInt; const fmt: PAnsiChar): SizeUInt; cdecl; varargs; external 'libc' name 'snprintf'; + {$ENDIF} {$ENDIF} -- 2.29.2