home *** CD-ROM | disk | FTP | other *** search
/ POINT Software Programming / PPROG1.ISO / pascal / swag / dos.swg / 0017_Get the Country Code.pas < prev    next >
Encoding:
Pascal/Delphi Source File  |  1993-08-18  |  3.0 KB  |  91 lines

  1. { Gets the current country code number.
  2.   Part of the Heartware Toolkit v2.00 (HTelse.PAS) for Turbo Pascal.
  3.   Author: Jose Almeida. P.O.Box 4185. 1504 Lisboa Codex. Portugal.
  4.           I can also be reached at RIME network, site ->TIB or #5314.
  5.   Feel completely free to use this source code in any way you want, and, if
  6.   you do, please don't forget to mention my name, and, give me and Swag the
  7.   proper credits. }
  8.  
  9. PROCEDURE Get_Country_Code(var CC : word;
  10.                    var Error_Code : byte);
  11. { DESCRIPTION:
  12.     Gets the current country code number.
  13.   SAMPLE CALL:
  14.     Get_Country_Code(CC,Error_Code);
  15.   RETURNS:
  16.     CC         : country code number
  17.                  or $FFFF if Error_Code <> 0
  18.     Error_Code : see The Programmers PC Source Book 3.191
  19.   NOTES:
  20.     None. }
  21.  
  22. var
  23.   TmpA   : array[1..34] of byte;
  24.   HTregs : registers;
  25.  
  26. BEGIN { Get_Country_Code }
  27.   FillChar(TmpA,SizeOf(TmpA),0);
  28.   HTregs.AX := $3800;
  29.   HTregs.DX := Ofs(TmpA);
  30.   HTregs.DS := Seg(TmpA);
  31.   MsDos(HTregs);
  32.   if HTregs.Flags and FCarry <> 0 then
  33.     begin
  34.       CC := $FFFF;           { on error set to $FFFF }
  35.       Error_Code := HTregs.AL;
  36.     end
  37.   else
  38.     begin
  39.       CC := HTregs.BX;
  40.       Error_Code := 0;
  41.     end;
  42. END; { Get_Country_Code }
  43.  
  44.  
  45.  
  46. FUNCTION Get_Country_Code_Text(CC : word) : String25;
  47.  
  48. { DESCRIPTION:
  49.     Gets country code in string format.
  50.   SAMPLE CALL:
  51.     St := Get_Country_Code_Text(CC);
  52.   RETURNS:
  53.     Country code name.
  54.   NOTES:
  55.     None. }
  56.  
  57. BEGIN { Get_Country_Code_Text }
  58.   case CC of
  59.     001 : Get_Country_Code_Text := 'United States';
  60.     002 : Get_Country_Code_Text := 'Canada (French)';
  61.     003 : Get_Country_Code_Text := 'Latin America';
  62.     031 : Get_Country_Code_Text := 'Netherlands';
  63.     032 : Get_Country_Code_Text := 'Belgium';
  64.     033 : Get_Country_Code_Text := 'France';
  65.     034 : Get_Country_Code_Text := 'Spain';
  66.     036 : Get_Country_Code_Text := 'Hungary';
  67.     038 : Get_Country_Code_Text := 'Yugoslavia';
  68.     039 : Get_Country_Code_Text := 'Italy';
  69.     041 : Get_Country_Code_Text := 'Switzerland';
  70.     042 : Get_Country_Code_Text := 'Czechoslovakia';
  71.     044 : Get_Country_Code_Text := 'United Kingdom';
  72.     045 : Get_Country_Code_Text := 'Denmark';
  73.     046 : Get_Country_Code_Text := 'Sweden';
  74.     047 : Get_Country_Code_Text := 'Norway';
  75.     048 : Get_Country_Code_Text := 'Poland';
  76.     049 : Get_Country_Code_Text := 'Germany';
  77.     055 : Get_Country_Code_Text := 'Brazil';
  78.     061 : Get_Country_Code_Text := 'International English';
  79.     081 : Get_Country_Code_Text := 'Japan';
  80.     082 : Get_Country_Code_Text := 'Korea';
  81.     086 : Get_Country_Code_Text := 'Peoples Republic of China';
  82.     088 : Get_Country_Code_Text := 'Taiwan';
  83.     351 : Get_Country_Code_Text := 'Portugal';
  84.     358 : Get_Country_Code_Text := 'Finland';
  85.     785 : Get_Country_Code_Text := 'Middle East (Arabic)';
  86.     972 : Get_Country_Code_Text := 'Israel (Hebrew)';
  87.   else
  88.     Get_Country_Code_Text := 'Unknown';
  89.   end;
  90. END; { Get_Country_Code_Text }
  91.