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.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,d3037f71d9d26da1 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-12-17 09:16:13 PST Path: archiver1.google.com!news2.google.com!newsfeed2.dallas1.level3.net!news.level3.com!news-out.visi.com!petbe.visi.com!news.tele.dk!news.tele.dk!small.news.tele.dk!newsfeed00.sul.t-online.de!newsmm00.sul.t-online.com!t-online.de!news.t-online.com!not-for-mail From: Martin Krischik Newsgroups: comp.lang.ada Subject: Re: sed and perl - yuck [Was Re: Preprocessor functionality equivalent ideas needed] Date: Tue, 16 Dec 2003 21:52:25 +0100 Organization: AdaCL Message-ID: <1324276.yJNICJfKoU@linux1.krischik.com> References: <1255206.8rsULcRV6F@linux1.krischik.com> Reply-To: krischik@users.sourceforge.net Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7Bit X-Trace: news.t-online.com 1071681239 00 1038 GO0VGEtOpqDCP9 031217 17:13:59 X-Complaints-To: usenet-abuse@t-online.de X-ID: XHVVSeZageDZydVTrcLoGUceg2aj2zx38E3uu8ICGiHhyVuw9EVOgl User-Agent: KNode/0.7.2 Xref: archiver1.google.com comp.lang.ada:3508 Date: 2003-12-16T21:52:25+01:00 List-Id: Waldek Hebisch wrote: > Martin Krischik (krischik@users.sourceforge.net) wrote: > : Ludovic Brenta wrote: > > : > Another approach could be to simulate a preprocessor with sed or perl > : > scripts. > > : Did that, hated it and wrote AdaCL. If you rather use Ada then perl and > : find find sed cumbersome you should look at AdaCL. > > : If you disagree: Write a sed line which inserst "OS." bevore every > : CD_Recorder - but only if it is not allready there. > > Well, if you have unused chars (say ';' and '#') the task is easy: > > s/CD_Recorder/;CD_Recorder/g > s/OS\.;/OS.#/ > s/;CD_Recorder/OS.CD_Recorder/g > s/[;#]//g > > If all chars are used one have to quote first: > > s/./:&/g > s/:C:D:_:R:e:c:o:r:d:e:r/;::C:D:_:R:e:c:o:r:d:e:r/g > s/:O:S:\.;:/:O:S:.;#/g > s/;::C:D:_:R:e:c:o:r:d:e:r/:O:S:.:C:D:_:R:e:c:o:r:d:e:r/g > s/;#:/:/g > s/.\(.\)/\1/g > I have not put them on sigle line for readability. Cool. But you do prove my point: sed is to compicated. Isn't Ada a lot easier to read then sed: AdaCL.SAR.Filter.List.Append ( C => Filters, Elem => AdaCL.SAR.Filter.Insert.Text.New_Object ( SearchString => "AdaCL.Trace", InsertString => ".. ", Search_At => AdaCL.SAR.Filter.Insert.First, Insert_At => AdaCL.SAR.Filter.Insert.Before)); To much to type? With use and rename you could reduce it to: Append (Flt, IT.New_Object ("AdaCL.Trace", ".. ", First, Before)); But we are Ada programers so we don't do that, do we. > The above is > slightly off-topic, but I think it ilustrates nicely that a sequence > of simple steps can give result looking quite different then a single > step. In that spirit Ada discourages preprocessors (since complexity > grows quite a lot). Yes true. However, in OS dependen programming you might have package which is 90% the same and differ in 10%. Still, I might give some of the ideas here are thought and maybe I get rid of gnatprep. With Regards Martin -- mailto://krischik@users.sourceforge.net http://www.ada.krischik.com