home *** CD-ROM | disk | FTP | other *** search
/ Solo Programadores 22 / SOLO_22.iso / packages / win32ada / data.z / CONVERT.ADB < prev    next >
Encoding:
Text File  |  1995-12-19  |  2.4 KB  |  73 lines

  1. -- $Source: /home/harp/1/proto/monoBANK/winnt/convert.adb,v $ 
  2. -- $Revision: 1.3 $ $Date: 95/12/18 19:44:20 $ $Author: mg $
  3.  
  4. with Win32;
  5. with Interfaces;    use Interfaces;    -- for operations on types
  6. with Interfaces.C;  use Interfaces.C;  -- for operations on types
  7.  
  8.  
  9. package body Convert is
  10.  
  11.   pragma Suppress(All_Checks);
  12.  
  13.   function LOWORD (w : Win32.DWORD) return Win32.WORD is
  14.   begin
  15.     return Win32.WORD (w and 16#FFFF#);
  16.   end LOWORD;
  17.  
  18.   function HIWORD (w : Win32.DWORD) return Win32.WORD is
  19.     shift : Interfaces.UNSIGNED_32;
  20.   begin
  21.     shift := Interfaces.UNSIGNED_32 (w);
  22.     shift := Interfaces.Shift_Right (shift, 16);
  23.     return Win32.WORD (shift);
  24.   end HIWORD;
  25.  
  26.   function LOWORD (i : Win32.INT) return Win32.SHORT is
  27.     signed_word : Win32.SHORT;
  28.   begin
  29.     signed_word := Win32.SHORT (LOWORD (w => Win32.DWORD (i)));
  30.     return signed_word;
  31.   end LOWORD;
  32.  
  33.   function HIWORD (i : Win32.INT) return Win32.SHORT is
  34.     signed_word : Win32.SHORT;
  35.   begin
  36.     signed_word := Win32.SHORT (HIWORD (w => Win32.DWORD (i)));
  37.     return signed_word;
  38.   end HIWORD;
  39.  
  40.   function MAKEINTRESOURCE (i : Win32.INT) return Win32.LPCSTR is
  41.     tmp : Win32.DWORD;
  42.   begin
  43.     tmp := Win32.DWORD (loword (i));
  44.     return DWORD_TO_LPCSTR (tmp);
  45.   end MAKEINTRESOURCE;
  46.  
  47.   function CP(C_Str : Win32.CHAR_Array) return Win32.LPCSTR is
  48.       function UC is new Ada.Unchecked_Conversion
  49.             (System.Address,Win32.LPCSTR);
  50.   begin
  51.       return UC(C_Str(C_Str'First)'Address);
  52.   end CP;
  53.  
  54. -------------------------------------------------------------------------------
  55. --
  56. -- THIS FILE AND ANY ASSOCIATED DOCUMENTATION IS PROVIDED "AS IS" WITHOUT 
  57. -- WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT 
  58. -- LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR 
  59. -- A PARTICULAR PURPOSE.  The user assumes the entire risk as to the accuracy 
  60. -- and the use of this file.  This file may be used only by licensees of 
  61. -- Microsoft Corporation's WIN32 Software Development Kit in accordance with 
  62. -- the terms of the licensee's End-User License Agreement for Microsoft 
  63. -- Software for the WIN32 Development Kit.
  64. --
  65. -- Copyright (c) Intermetrics, Inc. 1995
  66. -- Portions (c) 1985-1994 Microsoft Corporation with permission.
  67. -- Microsoft is a registered trademark and Windows and Windows NT are 
  68. -- trademarks of Microsoft Corporation.
  69. --
  70. -------------------------------------------------------------------------------
  71.  
  72. end Convert;
  73.