10Sduke------------------------------------------------------------------------------
214851Sgoetz--                                                                          --
30Sduke--                        GNAT RUN-TIME COMPONENTS                          --
40Sduke--                                                                          --
50Sduke--          A D A . S E Q U E N T I A L _ I O . C _ S T R E A M S           --
60Sduke--                                                                          --
70Sduke--                                 B o d y                                  --
80Sduke--                                                                          --
90Sduke--          Copyright (C) 1992-2009, Free Software Foundation, Inc.         --
100Sduke--                                                                          --
110Sduke-- GNAT is free software;  you can  redistribute it  and/or modify it under --
120Sduke-- terms of the  GNU General Public License as published  by the Free Soft- --
130Sduke-- ware  Foundation;  either version 3,  or (at your option) any later ver- --
140Sduke-- sion.  GNAT is distributed in the hope that it will be useful, but WITH- --
150Sduke-- OUT ANY WARRANTY;  without even the  implied warranty of MERCHANTABILITY --
160Sduke-- or FITNESS FOR A PARTICULAR PURPOSE.                                     --
170Sduke--                                                                          --
180Sduke-- As a special exception under Section 7 of GPL version 3, you are granted --
192362Sohair-- additional permissions described in the GCC Runtime Library Exception,   --
202362Sohair-- version 3.1, as published by the Free Software Foundation.               --
212362Sohair--                                                                          --
220Sduke-- You should have received a copy of the GNU General Public License and    --
230Sduke-- a copy of the GCC Runtime Library Exception along with this program;     --
240Sduke-- see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see    --
250Sduke-- <http://www.gnu.org/licenses/>.                                          --
2614851Sgoetz--                                                                          --
270Sduke-- GNAT was originally developed  by the GNAT team at  New York University. --
280Sduke-- Extensive contributions were provided by Ada Core Technologies Inc.      --
290Sduke--                                                                          --
300Sduke------------------------------------------------------------------------------
3116177Salanb
320Sdukewith Interfaces.C_Streams; use Interfaces.C_Streams;
330Sdukewith System.File_IO;
340Sdukewith System.File_Control_Block;
350Sdukewith System.Sequential_IO;
360Sdukewith Ada.Unchecked_Conversion;
370Sduke
380Sdukepackage body Ada.Sequential_IO.C_Streams is
390Sduke
400Sduke   package FIO renames System.File_IO;
410Sduke   package FCB renames System.File_Control_Block;
420Sduke   package SIO renames System.Sequential_IO;
430Sduke
440Sduke   subtype AP is FCB.AFCB_Ptr;
450Sduke
460Sduke   function To_FCB is new Ada.Unchecked_Conversion (File_Mode, FCB.File_Mode);
470Sduke
480Sduke   --------------
490Sduke   -- C_Stream --
500Sduke   --------------
510Sduke
520Sduke   function C_Stream (F : File_Type) return FILEs is
530Sduke   begin
540Sduke      FIO.Check_File_Open (AP (F));
550Sduke      return F.Stream;
560Sduke   end C_Stream;
570Sduke
580Sduke   ----------
590Sduke   -- Open --
600Sduke   ----------
610Sduke
620Sduke   procedure Open
630Sduke     (File     : in out File_Type;
640Sduke      Mode     : File_Mode;
650Sduke      C_Stream : FILEs;
660Sduke      Form     : String := "";
670Sduke      Name     : String := "")
680Sduke   is
690Sduke      Dummy_File_Control_Block : SIO.Sequential_AFCB;
700Sduke      pragma Warnings (Off, Dummy_File_Control_Block);
710Sduke      --  Yes, we know this is never assigned a value, only the tag
720Sduke      --  is used for dispatching purposes, so that's expected.
730Sduke
740Sduke   begin
750Sduke      FIO.Open (File_Ptr  => AP (File),
760Sduke                Dummy_FCB => Dummy_File_Control_Block,
770Sduke                Mode      => To_FCB (Mode),
780Sduke                Name      => Name,
790Sduke                Form      => Form,
800Sduke                Amethod   => 'Q',
810Sduke                Creat     => False,
820Sduke                Text      => False,
830Sduke                C_Stream  => C_Stream);
840Sduke   end Open;
850Sduke
860Sdukeend Ada.Sequential_IO.C_Streams;
870Sduke