From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=0.2 required=5.0 tests=BAYES_00,INVALID_MSGID, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,e9f0eae6d714d11c X-Google-Attributes: gid103376,public From: Marin David Condic Subject: Re: Gnat pretty printing Date: 1998/12/11 Message-ID: <36714049.2C5CE298@pwfl.com>#1/1 X-Deja-AN: 421217197 Content-Transfer-Encoding: 7bit Sender: condicma@bogon.pwfl.com References: <74lt16$9r0@romeo.logica.co.uk> <366E9E44.AA7370C7@pwfl.com> <74on70$m9o$1@cnn.Princeton.EDU> Content-Type: text/plain; charset=us-ascii Organization: Pratt & Whitney Mime-Version: 1.0 Reply-To: diespammer@pwfl.com Newsgroups: comp.lang.ada Date: 1998-12-11T00:00:00+00:00 List-Id: > > As it turns out, I have an independent study project slated for next semester > to reimplement the reformatting tool in AdaGIDE. It is also available as > a standalone tool, and will generate colorized RTF output. Suggestions for > requirements are welcome, although I don't promise to have the same > preferences you do :-). Send these to mcc@cs.usafa.af.mil > > AdaGIDE is distributed with GNAT on Windows, beginning with version 3.10p, > but the latest AdaGIDE is found at > http://www.usafa.af.mil/dfcs/bios/mcc_html/adagide.html > > The reformatter standalone is at: > http://www.usafa.af.mil/dfcs/bios/mcc_html/ada_stuff.html > > Of course, the best way to implement such a tool would be with ASIS rather > than modifying the sources of GNAT. We will NOT take this approach, however, > because it is essential in our environment to be able to reformat code that > will not compile, on a "as you go" basis during editing. > For the record, the thing I typically dislike about pretty-printers is that I like to span certain things across lines and want them to line up in a predictable way. Formal parameter lists on procedure declarations and named associations on procedure calls are the two most common areas where I'd like spanned lines and tabs to make things line up. I don't think I could write a formal requirements document for you in just a couple of minutes, but here's an example of some code as I manually format it: procedure Pop ( Item : out Element_Ptr_Type ; List : in out List_Type) is -- Temp : Link_Type := null ; begin pragma Debug ( Ada.Text_IO.Put_Line ( File => Ada.Text_IO.Current_Error, Item => "UTIL.Tagged_Lists.Pop: ")) ; if (List.Length <= 0) then raise Underflow ; end if ; Temp := List.First ; -- List.First := List.First.Next ; List.Current := List.First ; List.Length := List.Length - 1 ; List.Memory := List.Memory - ((Temp.all'Size / System.Storage_Unit) + (Temp.Value.all'Size / System.Storage_Unit)) ; if (List.First = null) then -- -- Empty list. -- List.Last := null ; end if ; -- Item := Temp.Value ; Dispose ( X => Temp) ; exception when Storage_Error => pragma Debug ( Ada.Text_IO.Put_Line ( File => Ada.Text_IO.Current_Error, Item => "UTIL.Tagged_Lists.Pop: Storage_Error.")) ; raise Underflow ; when Constraint_Error => pragma Debug ( Ada.Text_IO.Put_Line ( File => Ada.Text_IO.Current_Error, Item => "UTIL.Tagged_Lists.Pop: Constraint_Error.")) ; raise Underflow ; end Pop ; Notice specifically how the formal parameter list in/out, etc line up with each parameter on a separate line. Also the procedure calls with named association and the assignment statements with the := lining up. I am not too terribly concerned about the capitalization/lower-case issues since this is usually a toggleable option and you have to modify the capitalization anyway for abbreviations. The main thing about my formatting style is that it is extremely regular & predictable with a visually pleasing alignment of related objects. I'm not sure it is possible to codify all of the style into a program that would produce the desired result in all cases, but even if it just got me close, I'd be willing to patch it up manually when I considered the jobe done. I hope this might give you a few good ideas. If you want to talk over any ideas I'd be glad to help if I can. MDC -- Marin David Condic Real Time & Embedded Systems, Propulsion Systems Analysis United Technologies, Pratt & Whitney, Large Military Engines M/S 731-95, P.O.B. 109600, West Palm Beach, FL, 33410-9600 Ph: 561.796.8997 Fx: 561.796.4669 ***To reply, remove "bogon" from the domain name.*** "Transported to a surreal landscape, a young girl kills the first woman she meets and then teams up with three complete strangers to kill again." -- TV listing for the Wizard of Oz