comp.lang.ada
 help / color / mirror / Atom feed
From: Martin Krischik <krischik@users.sourceforge.net>
Subject: Re: sed and perl - yuck [Was Re: Preprocessor functionality equivalent ideas needed]
Date: Tue, 16 Dec 2003 21:52:25 +0100
Date: 2003-12-16T21:52:25+01:00	[thread overview]
Message-ID: <1324276.yJNICJfKoU@linux1.krischik.com> (raw)
In-Reply-To: brlkaa$h1h$1@panorama.wcss.wroc.pl

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




  reply	other threads:[~2003-12-16 20:52 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-12-10 20:04 Preprocessor functionality equivalent ideas needed Greg Milford
2003-12-10 21:41 ` Ludovic Brenta
2003-12-11 17:12   ` sed and perl - yuck [Was Re: Preprocessor functionality equivalent ideas needed] Martin Krischik
2003-12-16  0:40     ` Waldek Hebisch
2003-12-16 20:52       ` Martin Krischik [this message]
2003-12-10 22:29 ` Preprocessor functionality equivalent ideas needed Georg Bauhaus
2003-12-12  5:52   ` Simon Wright
2003-12-11  1:07 ` Jeffrey Carter
2003-12-11 13:34   ` Marin David Condic
2003-12-11 17:49     ` Jeffrey Carter
2003-12-11  5:39 ` Steve
2003-12-11 16:59 ` Martin Krischik
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox