From 3158ee2b850ce0311d8cb8f03cbe6b1681a1f48f Mon Sep 17 00:00:00 2001 From: tobigun Date: Mon, 9 Jun 2008 10:22:14 +0000 Subject: - all references to the libc unit removed. The Libc unit (not the library) was for kylix compatibility and should not be used anymore. In addition it seems the libc unit is not available on 64bit systems. - added some functions that will be introduced with FPC 2.2.2 git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@1145 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UCommon.pas | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) (limited to 'Game/Code/Classes/UCommon.pas') diff --git a/Game/Code/Classes/UCommon.pas b/Game/Code/Classes/UCommon.pas index 418c0c1a..768abe89 100644 --- a/Game/Code/Classes/UCommon.pas +++ b/Game/Code/Classes/UCommon.pas @@ -88,15 +88,26 @@ uses {$IFDEF Delphi} Dialogs, {$ENDIF} - {$IFDEF LINUX} - libc, + {$IFDEF FPC_VERSION_2_2_2_PLUS} + clocale, {$ENDIF} UMain, UConfig; + +// data used by the ...Locale() functions +{$IFDEF LINUX} var PrevNumLocale: string; +{$IFNDEF FPC_VERSION_2_2_2_PLUS} +const + __LC_NUMERIC = 1; + +function setlocale(category: integer; locale: pchar): pchar; cdecl; external 'c' name 'setlocale'; +{$ENDIF} +{$ENDIF} + // In Linux and maybe MacOSX some units (like cwstring) call setlocale(LC_ALL, '') // to set the language/country specific locale (e.g. charset) for this application. // Unfortunately, LC_NUMERIC is set by this call too. @@ -116,15 +127,15 @@ var procedure SetDefaultNumericLocale(); begin {$ifdef LINUX} - PrevNumLocale := setlocale(LC_NUMERIC, nil); - setlocale(LC_NUMERIC, 'C'); + PrevNumLocale := setlocale(__LC_NUMERIC, nil); + setlocale(__LC_NUMERIC, 'C'); {$endif} end; procedure RestoreNumericLocale(); begin {$ifdef LINUX} - setlocale(LC_NUMERIC, PChar(PrevNumLocale)); + setlocale(__LC_NUMERIC, PChar(PrevNumLocale)); {$endif} end; @@ -258,13 +269,14 @@ function QueryPerformanceCounter(lpPerformanceCount:TLARGEINTEGER):Bool; end; begin - // Use clock_gettime here maybe ... from libc + // Use clock_gettime(CLOCK_REALTIME, ...) here (but not from the libc unit) lpPerformanceCount := RDTSC(); result := true; end; function QueryPerformanceFrequency(lpFrequency:TLARGEINTEGER):Bool; begin + // clock_getres(CLOCK_REALTIME, ...) lpFrequency := 0; result := true; end; -- cgit v1.2.3