home *** CD-ROM | disk | FTP | other *** search
/ Solo Programadores 22 / SOLO_22.iso / packages / win32ada / data.z / win32-wcharpkg.adb < prev    next >
Encoding:
Text File  |  1995-11-17  |  7.1 KB  |  220 lines

  1. -- $Source: /home/harp/1/proto/monoBANK/winnt/win32-wcharpkg.adb,v $ 
  2. -- $Revision: 1.5 $ $Date: 95/02/06 11:29:49 $ $Author: mg $ 
  3. -------------------------------------------------------------------------------
  4. --
  5. -- THIS FILE AND ANY ASSOCIATED DOCUMENTATION IS FURNISHED "AS IS" WITHOUT 
  6. -- WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED 
  7. -- TO THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR 
  8. -- PURPOSE.  The user assumes the entire risk as to the accuracy and the 
  9. -- use of this file.
  10. --
  11. -- Copyright (c) Intermetrics, Inc. 1995
  12. -- Royalty-free, unlimited, worldwide, non-exclusive use, modification, 
  13. -- reproduction and further distribution of this file is permitted.
  14. --
  15. -------------------------------------------------------------------------------
  16.  
  17.  
  18. with Ada.Unchecked_Conversion;
  19. with Stdarg.Impl;
  20. with Stdarg.Inst;
  21.  
  22. package body Win32.WcharPkg is
  23.     
  24.     use Stdarg, Stdarg.Impl, Stdarg.Inst;
  25.  
  26.     function getwchar return wint_t is
  27.     begin
  28.         return fgetwc(Stdio.stdin);
  29.     end getwchar;
  30.  
  31.     function putwchar (c : in wint_t) return wint_t is
  32.     begin
  33.         return fputwc(c, Stdio.stdout);
  34.     end putwchar;
  35.  
  36.     function "&" is new Stdarg.Concat(Win32.Stdio.FILE_Access);
  37.     function "&" is new Stdarg.Concat(Win32.PCWSTR);
  38.     function "&" is new Stdarg.Concat(Win32.PWSTR);
  39.     function To_INT is new Ada.Unchecked_Conversion(Stdarg.C_Param, Win32.INT);
  40.  
  41.     function fwprintf (
  42.         stream : Win32.Stdio.FILE_Access;
  43.         format : Win32.PCWSTR;
  44.         args   : Stdarg.ArgList := Stdarg.Empty) return Win32.INT is
  45.  
  46.         Complete_Args: Stdarg.Arglist :=
  47.             Stdarg.Empty & Stream & Format & Args;
  48.  
  49.         function C_fwprintf return Win32.INT;
  50.         pragma Import(C, C_fwprintf, "fwprintf");
  51.  
  52.     begin
  53.         return To_INT(F_Varargs(
  54.             C_fwprintf'Address,
  55.             ArgCount(Complete_Args),
  56.             Address_of_First_Arg(Complete_Args)));
  57.     end fwprintf;
  58.  
  59.     function fwscanf (
  60.         stream : Win32.Stdio.FILE_Access;
  61.         format : Win32.PCWSTR;
  62.         args   : Stdarg.ArgList := Stdarg.Empty) return Win32.INT is
  63.  
  64.         Complete_Args: Stdarg.Arglist :=
  65.             Stdarg.Empty & Stream & Format & Args;
  66.  
  67.         function C_fwscanf return Win32.INT;
  68.         pragma Import(C, C_fwscanf, "fwscanf");
  69.  
  70.     begin
  71.         return To_INT(F_Varargs(
  72.             C_fwscanf'Address,
  73.             ArgCount(Complete_Args),
  74.             Address_of_First_Arg(Complete_Args)));
  75.     end fwscanf;
  76.  
  77.     function wprintf (
  78.         format : Win32.PCWSTR;
  79.         args   : Stdarg.ArgList := Stdarg.Empty) return Win32.INT is
  80.  
  81.         Complete_Args: Stdarg.Arglist :=
  82.             Stdarg.Empty & Format & Args;
  83.  
  84.         function C_wprintf return Win32.INT;
  85.         pragma Import(C, C_wprintf, "wprintf");
  86.  
  87.     begin
  88.         return To_INT(F_Varargs(
  89.             C_wprintf'Address,
  90.             ArgCount(Complete_Args),
  91.             Address_of_First_Arg(Complete_Args)));
  92.     end wprintf;
  93.  
  94.     function wscanf (
  95.         format : Win32.PCWSTR;
  96.         args   : Stdarg.ArgList := Stdarg.Empty) return Win32.INT is
  97.  
  98.         Complete_Args: Stdarg.Arglist :=
  99.             Stdarg.Empty & Format & Args;
  100.  
  101.         function C_wscanf return Win32.INT;
  102.         pragma Import(C, C_wscanf, "wscanf");
  103.  
  104.     begin
  105.         return To_INT(F_Varargs(
  106.             C_wscanf'Address,
  107.             ArgCount(Complete_Args),
  108.             Address_of_First_Arg(Complete_Args)));
  109.     end wscanf;
  110.  
  111.     function snwprintf (
  112.         buffer : Win32.PWSTR;
  113.         count  : size_t;
  114.         format : Win32.PCWSTR;
  115.         args   : Stdarg.ArgList := Stdarg.Empty) return Win32.INT is
  116.  
  117.         Complete_Args: Stdarg.Arglist :=
  118.             Stdarg.Empty & Buffer & Int(Count) & Format & Args;
  119.  
  120.         function C_snwprintf return Win32.INT;
  121.         pragma Import(C, C_snwprintf, "_snwprintf");
  122.  
  123.     begin
  124.         return To_INT(F_Varargs(
  125.             C_snwprintf'Address,
  126.             ArgCount(Complete_Args),
  127.             Address_of_First_Arg(Complete_Args)));
  128.     end snwprintf;
  129.  
  130.     function swprintf (
  131.         buffer : Win32.PWSTR;
  132.         format : Win32.PCWSTR;
  133.         args   : Stdarg.ArgList := Stdarg.Empty) return Win32.INT is
  134.  
  135.         Complete_Args: Stdarg.Arglist :=
  136.             Stdarg.Empty & Buffer & Format & Args;
  137.  
  138.         function C_swprintf return Win32.INT;
  139.         pragma Import(C, C_swprintf, "swprintf");
  140.  
  141.     begin
  142.         return To_INT(F_Varargs(
  143.             C_swprintf'Address,
  144.             ArgCount(Complete_Args),
  145.             Address_of_First_Arg(Complete_Args)));
  146.     end swprintf;
  147.  
  148.     function swscanf (
  149.         buffer : Win32.PWSTR;
  150.         format : Win32.PCWSTR;
  151.         args   : Stdarg.ArgList := Stdarg.Empty) return Win32.INT is
  152.  
  153.         Complete_Args: Stdarg.Arglist :=
  154.             Stdarg.Empty & Buffer & Format & Args;
  155.  
  156.         function C_swscanf return Win32.INT;
  157.         pragma Import(C, C_swscanf, "swscanf");
  158.  
  159.     begin
  160.         return To_INT(F_Varargs(
  161.             C_swscanf'Address,
  162.             ArgCount(Complete_Args),
  163.             Address_of_First_Arg(Complete_Args)));
  164.     end swscanf;
  165.  
  166.     function vfwprintf (
  167.         stream : Win32.Stdio.FILE_Access;
  168.         format : Win32.PCWSTR;
  169.         args   : Stdarg.ArgList := Stdarg.Empty) return Win32.INT is
  170.  
  171.         function C_Vfwprintf(Stream  : Win32.Stdio.FILE_Access;
  172.                               Format : Win32.PCWSTR;
  173.                               AP     : Param_Access) return Win32.INT;
  174.         pragma Import(C, C_Vfwprintf, "vfwprintf");
  175.     begin
  176.         return C_Vfwprintf(Stream, Format, Address_of_Vararg_List (Args));
  177.     end vfwprintf;
  178.  
  179.     function vwprintf (
  180.         format : Win32.PCWSTR;
  181.         args   : Stdarg.ArgList := Stdarg.Empty) return Win32.INT is
  182.  
  183.         function C_Vwprintf(Format : Win32.PCWSTR;
  184.                             AP     : Param_Access) return Win32.INT;
  185.         pragma Import(C, C_Vwprintf, "vwprintf");
  186.     begin
  187.         return C_Vwprintf(Format, Address_of_Vararg_List (Args));
  188.     end vwprintf;
  189.  
  190.     function vsnwprintf (
  191.         buffer : Win32.PWSTR;
  192.         count  : size_t;
  193.         format : Win32.PCWSTR;
  194.         args   : Stdarg.ArgList := Stdarg.Empty) return Win32.INT is
  195.  
  196.         function C_Vsnwprintf(Buffer  : Win32.PWSTR;
  197.                                Count  : size_t;
  198.                                Format : Win32.PCWSTR;
  199.                                AP     : Param_Access) return Win32.INT;
  200.         pragma Import(C, C_Vsnwprintf, "_vsnwprintf");
  201.     begin
  202.         return C_Vsnwprintf(Buffer, Count, Format, 
  203.                 Address_of_Vararg_List (Args));
  204.     end vsnwprintf;
  205.  
  206.     function vswprintf (
  207.         buffer : Win32.PWSTR;
  208.         format : Win32.PCWSTR;
  209.         args   : Stdarg.ArgList := Stdarg.Empty) return Win32.INT is
  210.  
  211.         function C_Vswprintf(Buffer  : Win32.PWSTR;
  212.                               Format : Win32.PCWSTR;
  213.                               AP     : Param_Access) return Win32.INT;
  214.         pragma Import(C, C_Vswprintf, "vswprintf");
  215.     begin
  216.         return C_Vswprintf(Buffer, Format, Address_of_Vararg_List (Args));
  217.     end vswprintf;
  218.  
  219. end Win32.WcharPkg;
  220.