Initial revision
[AROS-Contrib.git] / development / compilers / freepascal / rtl / os2 / tests / getctry.pas
blobaa3c7337886963b37c41d46e169e36372036e3b2
1 program GetCountryInfo;
3 {$IFNDEF OS2}
4 Sorry, this code is for OS/2 only...
5 {$ENDIF}
7 uses
8 {$IFDEF FPC}
9 DosCalls;
10 {$ELSE}
11 Os2Def,
12 {$IFDEF VIRTUALPASCAL}
13 Os2Base;
14 {$ELSE}
15 {$IFDEF SPEED}
16 BseDos;
17 {$ELSE}
18 DosProcs, DosTypes;
19 {$ENDIF}
20 {$ENDIF}
21 {$ENDIF}
23 type
24 cardinal = longint;
26 {$IFDEF FPC}
27 const
28 NO_ERROR = 0;
29 {$ENDIF}
31 var
32 {$IFDEF VER70} (* patched Borland Pascal *)
33 Country: TCountryCode;
34 CtryInfo: TCountryInfo;
35 Size: longint;
36 {$ELSE}
37 Country: COUNTRYCODE; (* Country code info (0 = current country) *)
38 CtryInfo: COUNTRYINFO; (* Buffer for country-specific information *)
39 Size: cardinal; (* Real size of returned data *)
40 {$ENDIF}
41 W: word;
43 begin
44 WriteLn;
45 Size := 0;
46 FillChar (Country, SizeOf (Country), 0);
47 FillChar (CtryInfo, SizeOf (CtryInfo), 0);
48 W :=
49 {$IFDEF VER70}
50 DosGetCtryInfo
51 {$ELSE}
52 DosQueryCtryInfo
53 {$ENDIF}
54 (SizeOf (CtryInfo), Country, CtryInfo, Size);
55 if (W <> NO_ERROR) then
56 begin
57 WriteLn ('DosQueryCtryInfo error: return code = ', W);
58 Halt (1);
59 end;
60 WriteLn ('Code of the country is ', CtryInfo.Country,
61 ', current codepage is ', CtryInfo.CodePage);
62 end.