From a2cb348ef4d982ff951a398a07e71f7bdff020ab Mon Sep 17 00:00:00 2001 From: Robert Dewar Date: Mon, 5 Sep 2005 10:07:00 +0200 Subject: a-dirval-mingw.adb, [...]: Minor reformatting 2005-09-01 Robert Dewar * a-dirval-mingw.adb, a-direct.adb, a-coinve.adb, g-dynhta.adb, g-dynhta.ads, cstand.adb, exp_smem.adb, g-debuti.ads, g-dirope.adb, g-table.adb, lib-sort.adb, sem_maps.adb, exp_fixd.adb, exp_aggr.adb, a-intnam-mingw.ads, a-intnam-vxworks.ads, g-arrspl.adb, g-arrspl.ads, g-awk.adb, g-awk.ads, g-boubuf.ads, g-boubuf.ads, g-boubuf.ads, g-bubsor.ads, g-bubsor.adb, g-busora.adb, g-busora.ads, g-busorg.adb, g-busorg.ads, g-calend.adb, g-calend.ads, g-casuti.adb, g-casuti.ads, g-catiio.adb, g-catiio.ads, g-cgi.adb, g-cgi.ads, g-cgicoo.adb, g-cgicoo.ads, g-cgideb.adb, g-cgideb.ads, g-comlin.adb, g-comver.ads, g-semaph.ads, g-socthi.ads, sem_ch7.adb, a-direio.adb, a-caldel.ads, i-cstrea-vms.adb, a-ztedit.adb, a-ztenau.adb, g-socthi-vms.adb, g-socthi-vms.ads, g-socthi-mingw.adb, g-socthi-mingw.ads, g-socthi-vxworks.ads, a-intnam-irix.ads, a-intnam-irix.ads, a-intnam-hpux.ads, a-intnam-os2.ads, a-intnam-os2.ads, a-caldel-vms.adb, a-calend-vms.adb, a-calend-vms.ads, g-heasor.adb, g-heasor.ads, g-hesora.adb, g-hesora.ads, g-hesorg.adb, g-hesorg.ads, g-htable.adb, g-htable.ads, g-io.adb, g-io.ads, g-io_aux.adb, g-io_aux.ads, g-locfil.ads, g-memdum.adb, g-memdum.ads, g-traceb.adb, g-traceb.ads, i-cobol.adb, i-cobol.ads, i-cstrea.ads, i-cstrin.adb, a-wtedit.adb, a-tifiio.adb, a-wtenau.adb, a-wtenau.adb, a-teioed.adb: Minor reformatting From-SVN: r103894 --- gcc/ada/g-awk.adb | 103 ++++++++++++++++++++++-------------------------------- 1 file changed, 42 insertions(+), 61 deletions(-) (limited to 'gcc/ada/g-awk.adb') diff --git a/gcc/ada/g-awk.adb b/gcc/ada/g-awk.adb index e6f4910..2aa712a 100644 --- a/gcc/ada/g-awk.adb +++ b/gcc/ada/g-awk.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 2000-2003 Ada Core Technologies, Inc. -- +-- Copyright (C) 2000-2005 Ada Core Technologies, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -65,7 +65,7 @@ package body GNAT.AWK is procedure Current_Line (S : Mode; Session : Session_Type) is abstract; - -- Split Session's current line using split mode. + -- Split current line of Session using split mode S ------------------------ -- Split on separator -- @@ -102,7 +102,7 @@ package body GNAT.AWK is package File_Table is new Dynamic_Tables (AWK_File, Natural, 1, 5, 50); - -- List of filename associated with a Session. + -- List of file names associated with a Session procedure Free is new Unchecked_Deallocation (String, AWK_File); @@ -114,17 +114,17 @@ package body GNAT.AWK is First : Positive; Last : Natural; end record; - -- This is a field slice (First .. Last) in session's current line. + -- This is a field slice (First .. Last) in session's current line package Field_Table is new Dynamic_Tables (Field_Slice, Natural, 1, 10, 100); - -- List of fields for the current line. + -- List of fields for the current line -------------- -- Patterns -- -------------- - -- Define all patterns style : exact string, regular expression, boolean + -- Define all patterns style: exact string, regular expression, boolean -- function. package Patterns is @@ -137,13 +137,12 @@ package body GNAT.AWK is function Match (P : Pattern; - Session : Session_Type) - return Boolean + Session : Session_Type) return Boolean is abstract; - -- Returns True if P match for the current session and False otherwise. + -- Returns True if P match for the current session and False otherwise procedure Release (P : in out Pattern); - -- Release memory used by the pattern structure. + -- Release memory used by the pattern structure -------------------------- -- Exact string pattern -- @@ -156,8 +155,7 @@ package body GNAT.AWK is function Match (P : String_Pattern; - Session : Session_Type) - return Boolean; + Session : Session_Type) return Boolean; -------------------------------- -- Regular expression pattern -- @@ -172,8 +170,7 @@ package body GNAT.AWK is function Match (P : Regexp_Pattern; - Session : Session_Type) - return Boolean; + Session : Session_Type) return Boolean; procedure Release (P : in out Regexp_Pattern); @@ -187,8 +184,7 @@ package body GNAT.AWK is function Match (P : Callback_Pattern; - Session : Session_Type) - return Boolean; + Session : Session_Type) return Boolean; end Patterns; @@ -211,9 +207,8 @@ package body GNAT.AWK is procedure Call (A : Action; - Session : Session_Type) - is abstract; - -- Call action A as required. + Session : Session_Type) is abstract; + -- Call action A as required ------------------- -- Simple action -- @@ -317,13 +312,13 @@ package body GNAT.AWK is procedure Finalize (Session : in out Session_Type) is begin - -- We release the session data only if it is not the default session. + -- We release the session data only if it is not the default session if Session.Data /= Def_Session.Data then Free (Session.Data); - -- Since we have closed the current session, set it to point - -- now to the default session. + -- Since we have closed the current session, set it to point now to + -- the default session. Cur_Session.Data := Def_Session.Data; end if; @@ -334,11 +329,10 @@ package body GNAT.AWK is ---------------------- function Always_True return Boolean; - -- A function that always returns True. + -- A function that always returns True function Apply_Filters - (Session : Session_Type := Current_Session) - return Boolean; + (Session : Session_Type := Current_Session) return Boolean; -- Apply any filters for which the Pattern is True for Session. It returns -- True if a least one filters has been applied (i.e. associated action -- callback has been called). @@ -358,7 +352,7 @@ package body GNAT.AWK is -- number and the filename if possible. procedure Read_Line (Session : Session_Type); - -- Read a line for the Session and set Current_Line. + -- Read a line for the Session and set Current_Line procedure Split_Line (Session : Session_Type); -- Split session's Current_Line according to the session separators and @@ -414,8 +408,7 @@ package body GNAT.AWK is function Match (P : String_Pattern; - Session : Session_Type) - return Boolean + Session : Session_Type) return Boolean is begin return P.Str = Field (P.Rank, Session); @@ -427,8 +420,7 @@ package body GNAT.AWK is function Match (P : Regexp_Pattern; - Session : Session_Type) - return Boolean + Session : Session_Type) return Boolean is use type Regpat.Match_Location; @@ -444,8 +436,7 @@ package body GNAT.AWK is function Match (P : Callback_Pattern; - Session : Session_Type) - return Boolean + Session : Session_Type) return Boolean is pragma Unreferenced (Session); @@ -664,14 +655,13 @@ package body GNAT.AWK is ------------------- function Apply_Filters - (Session : Session_Type := Current_Session) - return Boolean + (Session : Session_Type := Current_Session) return Boolean is Filters : Pattern_Action_Table.Instance renames Session.Data.Filters; Results : Boolean := False; begin - -- Iterate through the filters table, if pattern match call action. + -- Iterate through the filters table, if pattern match call action for F in 1 .. Pattern_Action_Table.Last (Filters) loop if Patterns.Match (Filters.Table (F).Pattern.all, Session) then @@ -748,8 +738,7 @@ package body GNAT.AWK is function Discrete_Field (Rank : Count; - Session : Session_Type := Current_Session) - return Discrete + Session : Session_Type := Current_Session) return Discrete is begin return Discrete'Value (Field (Rank, Session)); @@ -760,8 +749,7 @@ package body GNAT.AWK is ----------------- function End_Of_Data - (Session : Session_Type := Current_Session) - return Boolean + (Session : Session_Type := Current_Session) return Boolean is begin return Session.Data.File_Index = File_Table.Last (Session.Data.Files) @@ -773,8 +761,7 @@ package body GNAT.AWK is ----------------- function End_Of_File - (Session : Session_Type := Current_Session) - return Boolean + (Session : Session_Type := Current_Session) return Boolean is begin return Text_IO.End_Of_File (Session.Data.Current_File); @@ -786,8 +773,7 @@ package body GNAT.AWK is function Field (Rank : Count; - Session : Session_Type := Current_Session) - return String + Session : Session_Type := Current_Session) return String is Fields : Field_Table.Instance renames Session.Data.Fields; @@ -800,7 +786,7 @@ package body GNAT.AWK is elsif Rank = 0 then - -- Returns the whole line, this is what $0 does under Session_Type. + -- Returns the whole line, this is what $0 does under Session_Type return To_String (Session.Data.Current_Line); @@ -813,8 +799,7 @@ package body GNAT.AWK is function Field (Rank : Count; - Session : Session_Type := Current_Session) - return Integer + Session : Session_Type := Current_Session) return Integer is begin return Integer'Value (Field (Rank, Session)); @@ -830,8 +815,7 @@ package body GNAT.AWK is function Field (Rank : Count; - Session : Session_Type := Current_Session) - return Float + Session : Session_Type := Current_Session) return Float is begin return Float'Value (Field (Rank, Session)); @@ -850,8 +834,7 @@ package body GNAT.AWK is ---------- function File - (Session : Session_Type := Current_Session) - return String + (Session : Session_Type := Current_Session) return String is Files : File_Table.Instance renames Session.Data.Files; @@ -942,8 +925,7 @@ package body GNAT.AWK is ---------------------- function Number_Of_Fields - (Session : Session_Type := Current_Session) - return Count + (Session : Session_Type := Current_Session) return Count is begin return Count (Field_Table.Last (Session.Data.Fields)); @@ -954,8 +936,7 @@ package body GNAT.AWK is -------------------------- function Number_Of_File_Lines - (Session : Session_Type := Current_Session) - return Count + (Session : Session_Type := Current_Session) return Count is begin return Count (Session.Data.FNR); @@ -966,8 +947,7 @@ package body GNAT.AWK is --------------------- function Number_Of_Files - (Session : Session_Type := Current_Session) - return Natural + (Session : Session_Type := Current_Session) return Natural is Files : File_Table.Instance renames Session.Data.Files; @@ -980,8 +960,7 @@ package body GNAT.AWK is --------------------- function Number_Of_Lines - (Session : Session_Type := Current_Session) - return Count + (Session : Session_Type := Current_Session) return Count is begin return Count (Session.Data.NR); @@ -1078,7 +1057,7 @@ package body GNAT.AWK is Session : Session_Type) is function Filename return String; - -- Returns current filename and "??" if the informations is not + -- Returns current filename and "??" if this information is not -- available. function Line return String; @@ -1090,7 +1069,6 @@ package body GNAT.AWK is function Filename return String is File : constant String := AWK.File (Session); - begin if File = "" then return "??"; @@ -1105,7 +1083,6 @@ package body GNAT.AWK is function Line return String is L : constant String := Natural'Image (Session.Data.FNR); - begin return L (2 .. L'Last); end Line; @@ -1132,6 +1109,10 @@ package body GNAT.AWK is NR : Natural renames Session.Data.NR; FNR : Natural renames Session.Data.FNR; + --------------- + -- Read_Line -- + --------------- + function Read_Line return String is Buffer : String (1 .. 1_024); Last : Natural; -- cgit v1.1