Ïðèëîæåíèåç. ïàêåò òåõò_þÏàêåò Ada.Text_IO îáåñïå÷èâàåò òåêñòîâûé ââîä-âûâîä. with Ada..IO_ Exceptions; package Ada.Text_ IO is type File_Type is limited private; type File_Mode is ( In _ File, Out_File, Append_File ); type Count is range 0.. îïðåäåëÿåòñÿ „ðåàëèçàöèåé; subtype Positive_Count is Count range 1 .. Count'Last; Unbounded : constant Count: = 0 ; - - äëèíà ñòðàíèöû è ñòðî÷êè subtype Field is Integer range 0 . . îïðåäåëÿåòñÿ_ðåàëèçàöèåé; sybtype Number_Base is Integer range 2.. 16; type Type_Set is (Lower_Case, Upper_Case); procedure Create ( File : Mode Name Form procedure Open ( File Mode Name Form -Óïðàâëåíèå ôàéëàìè in out File_Type; in File_Mode := Out_File; in String :="", in String :=" " ); in out File_Type; in File_Mode; in String; in String : = " "); procedure Close (File : in out File_Type); procedure Delete (File : in out File_Type ); procedure Reset (File : in out File_Type; Mode: in File_ Mode ); procedure Reset (File : in out File_Type); function Mode (File : in File_Type ) return File_Mode; function Name (File : in File_Type) return String; function Form (File : in File_ Type) return String; function Is_Open(File : in File_Type) return Boolean; - - Óïðàâëåíèå ôàéëàìè ââîäà-âûâîäà, îïðåäåëÿåìûìè ïî óìîë÷àíèþ procedure Set_ Input (File : in File_Type); procedure Set_ Output (File : in File_Type ); procedure Set_ Error (File : in File_Type); function Standard_Input return File_Type; function Standard „Output return File_Type; function Standard_Error return File_Type; function Current_Input return File_Type; function Current_Output return File_Type; function Current_Error return File_Type; type File_Access is access constant File_Type; 227 function Standard_Input return File_Access; function Standard _Output return File_Access; function Standard_Error return File_Access; function Current_Input return File_Access; function Current_Output return File_Access; function Current_Error return File_Access; - - Óïðàâëåíèå áóôåðîì procedure Flush ( File : in out File_Type,) ; procedure Flush; - Îïðåäåëåíèå äëèíû ñòðàíèö è ñòðî÷åê procedure Set_Line_Length (File: in FiIe_Type ; To: in Count); procedure Set_Line_Length (To : in Count); procedure Set_ Page_ Length (File: in File_Type; To : in Count); procedure Set_ Page_ Length (To : in Count); function Line_ Length (File : in FileJType) return Count; function Line_ Length return Count; function Page_ Length (File: in File_Type) return Count; function Page_ Length return Count; -Óïðàâëåíèå ñòðàíèöàìè, ñòðî÷êàìè è ñòîëáöàìè Ïðèëîæåíèå 3. Ïàêåò Text_IO procedure New_Line ( File : in File_Type; Spacing : in Positive_ Count: = 1); procedure New_Line ( Spacing : in Positive_Count: = 1 ); procedure SkipJLine ( File : in File_Type; Spacing : in Positive_Count := 1 ); procedure Skip_Line ( Spacing : in Positive_Count: = 1); function End_Of_Line (File : in File_Type) return Boolean; function End_Of_Line return Boolean; procedure New_Page ( File : in File_Type); procedure New_Page; procedure Skip_Page (File : in File_Type); procedure Skip_Page; function End_Of_Page (File : in File_Type) return Boolean; function End_Of_ Page return Boolean; function End_Of_File (File : in File_Type) return Boolean; function End_Of_File return Boolean; procedure Set_Col (File : in File_Type; To: in Positive_Count;); procedure Set_Col (To : in Positive_Count); procedure Set_Line (File : in File_Type; To: in Positive_Count); procedure Set_Line (To : in Positive_Count); function Col (File : in File_Type) return Positive_Count; 228 Àäà 95. Ââåäåíèå â ïðîãðàììèðîâàíèå Ïðèëîæåíèå Ç. Ïàêåò Text JO 229
Available : out Boolean); function Col return Positive_Count; function Line (File : in File_Type) return Positive_Count; function Line return Positive_Count; function Page (File : in File_Type) return Positive_Count; function Page return Positive_Count; — Ñèìâîëüíûé ââîä-âûâîä procedure Get (File : in File_Type; Item: out Character); procedure Get (Item : out Character); procedure Put (File : in File_Type; Item: in Character); procedure Put (Item : in Character ; procedure Look_Ahead (File in FileJType ; Item out Character; End_of_Line out Boolean); procedure Look_Ahead (Item out Character; End_of_Line out Boolean ); in FileJype; out Character); out Character ); in File_Type; out Character; out Boolean ); procedure Getjmmediate (File Item procedure Getjmmediate (Item procedure Getjmmediate ( File Item Available procedure Getjmmediate (Item : out Character; - Ñòðîêîâûé ââîä-âûâîä procedure Get (File : in File_Type; Item : out String ); procedure Get fltem : out String ); procedure Put (File : in File_Type; Item : in String ) ; procedure Put (Item : in String ); procedure Get_ Line (File : in File_Type; Item : out String; Last : out Natural); procedure GetJJne (Item : out String; Last : out Natural); procedure PutJLine (File : in FileJType; Item : in String ); procedure Put_Line (Item : in String ); - Íàñòðàèâàåìûé ïàêåò äëÿ ââîäà-âûâîäà öåëûõ generic type Num is range < >; package IntegerJO is Default_Width : Field : = Num'Width; Default JJase : Number JJase : = 10; procedure Get (File : in File_Type; Item : out Num; ßÎ — Êïïî÷êò™ À.  230 Àäà 95. Ââåäåíèå â ïðîãðàììèð Ïðèëîæåíèå 3. Ïàêåò Text_IO 231
Width procedure Get (Item Width procedure Put ( File Item Width Base procedure Put (Item Width Base : in Field: =0); : out Num ; : in Field : = 0 ); : in File_Type; : in Num; : in Field:= Default _ Width; : in Number_ Base : = Default _ Base ) ; in Num; in Field: = Default _ Width; in NumberJJase := Default _Base); Width : in Field:= Default _ Width; Base : in Number_ Base : = Default _ Base ) ; procedure Put (Item : in Num; Width: in Field: = Default_Width; Base : in Number_Base := Default _Base); in String; out Num; out Positive); procedure Get (From Item Last procedure Get (From Item Last procedure Put (To Item Base end Integer_ IO; f f in String; out Num; out Positive ); out String; in Num; in Number_ Base: = Default _Base ); procedure Put (To : out String; Item : in Num; Base : in Number_ Base: = Default _Base); end Modular. IO; ~ Íàñòðàèâàåìûå ïàêåòû äëÿ ââîäà-âûâîäà âåùåñòâåííûõ generic type Num is digits<>; package Float_IO is Defaul_Fore Defaul_Aft Defaul_ Exp generic type Num is range < >; package Modular_IO is Default_Width : Field : = Num'Width; Default_Base : Number_Base : = 10; procedure Get (File in File_Type; Item out Num; Width in Field: =0); procedure Get (Item out Num ; Width in Field: = 0); procedure Put (File in File_Type; Item in Num; Field : = 2; Field := Num'Digits -1; Field : = 3; procedure Get (File : in File_Type; Item : out Num; Width : in Field = 0); procedure Get (Item : out Num; Width: in Field: = 0); procedure Put (File : in File_Type; Item : in Num; Fore : in Field: = Defaul_Fore; Aft : in Field: = DefauL Aft; 2(1*
Àäà 95. Ââåäåíèå â ïðîãðàììèðîâàíèå Ïðèëîæåíèå 3. Ïàêåò Text Þ in Field: = Defaul_ Exp);
procedure _Aft; Exp ); procedure .Aft; Exp); Fore; .Aft; JExp); _Fore; _Aft; - Exp );
procedure Put (To : out String; Item : in Num; Aft : in Field : = Default. Aft; Exp : in Field : = Default. Exp ); end Float_IO; generic type Num is delta <>; package Fixed_IO is procedure Get (File Item Width procedure Get (Item Width procedure Put (File ; Item Fore Aft Exp ; Default_Fore: Field: = Num'Fore-Default _Aft : Field := Num 'Aft;' Default _Exp : Field: = 0 • in File_Type; out Num; in Field := 0 ); out Num; in Field: = 0 ); in File_Type; in Num; in Field: = Default _Fore ; in Field: = Default _Aft; procedure Put (Item Fore in Field : = Default _Exp); in in Num; Field : = Default _Fore; Aft : in Field : = Default Exp : in Field : = Default in String; in out Num; out Positive); out String; in Num; in Field := Default in Field: = Default procedure Get (From Item Last procedure Put (To Item Aft Exp end Fixed_IO; generic type Num is delta <> digits <>; package Decimal_ Þ is Default_Fore: Field : = Num'Fore; Default _Aft : Field: = Num'Aft; Default _Exp : Field: = 0 ; in FileJType; out Num; in Field := 0); procedure Get (File Item ' Width procedure Get (Item : out Num ; Width : in Field: = 0); in File_Type; in Num; in Field : = Default in Field : = Default. in Field : = Default procedure Put (File Item Fore Aft Exp procedure Put (Item : in Num; Fore in Field: = Default Aft in Field: = Default Exp in Field : = Default. 234 Àäà 95. Ââåäåíèå â ïðîãðàììèðîâàíèå Ïðèëîæåíèå Ç. Ïàêåò Text_IO
procedure Get (From Item Last procedure Put (To Item Aft Exp end DecimaL IO; in String; in out Num; out Positive); out String; in Num; in Field := Default _ Aft; in Field: = Default_ Exp ); -- Íàñòðàèâàåìûé ïàêåò äëÿ ââîäà-âûâîäà ïåðå÷èñëèìûõ generic type Enum is (< >); package Enumeration _ IO is Default_Width : Field ; Default_Setting: Type _Set: = Upper_Case;
procedure Put (To : out String ; Item : out Enum; Set : in Type _Set: = Default_Setting); end Enumerations _ IO; - - Èñêëþ÷åíèÿ Status_ Error : exception renames IO_ Exceptions. Status_ Error; Mode_ Error : exception renames IO_ Exceptions. Mode_ Error; Name_ Error : exception renames IO_ Exceptions. Name_ Error; Use_ Error : exception renames IO_ Exceptions. Use_ Error; Device_Error : exception renames IO_ Exceptions. Device_Error; End_ Error : exception renames IO_ Exceptions. End_ Error; Data_Error : exception renames IO_ Exceptions. Data_Error; Layout_Error : exception renames Þ_ Exceptions. Layout_Error; private ... - - çàâèñèò îò ðåàëèçàöèè end Ada .TextJO; procedure Get( From : in String; Item : out Enum; Last : out Positive); 236 Àäà 95. Ââåäåíèå â ïðîãðàììèðîâàíèå Ïðèëîæåíèå 4. Ïðàãìû, îïðåäåëåííûå â ÿçûêå
ßÇÛÊÅ |
| Îãëàâëåíèå| |